http://stackoverflow.com/a/21205169
type: AcceptedAnswer
has body: @Flame_Phoenix your sample code is working, I checked with my ejabberd server. I modified the code Make sure that you added these libraries httpclient-4.1.3.jar httpcore-4.1.4.jar jstun.jar xpp3-1.1.4c.jar versions might be changed import java.util.*; import java.io.*; import org.jivesoftware.smack.Chat; import org.jivesoftware.smack.ConnectionConfiguration; import org.jivesoftware.smack.MessageListener; import org.jivesoftware.smack.Roster; import org.jivesoftware.smack.RosterEntry; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.util.StringUtils; public class JabberSmackAPI implements MessageListener { private XMPPConnection connection; private final String mHost = "yourserver.com"; // server IP address or the // host public void login(String userName, String password) throws XMPPException { String service = StringUtils.parseServer(userName); String user_name = StringUtils.parseName(userName); ConnectionConfiguration config = new ConnectionConfiguration(mHost, 5222, service); config.setSendPresence(true); config.setDebuggerEnabled(false); connection = new XMPPConnection(config); connection.connect(); connection.login(user_name, password); } public void sendMessage(String message, String to) throws XMPPException { Chat chat = connection.getChatManager().createChat(to, this); chat.sendMessage(message); } 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() { connection.disconnect(); } public void processMessage(Chat chat, Message message) { System.out.println("Received something: " + message.getBody()); if (message.getType() == Message.Type.chat) System.out.println(chat.getParticipant() + " says: " + message.getBody(…
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31981150
accepted answer of: http://stackoverflow.com/q/21195402
answers question: http://stackoverflow.com/q/21195402
has comment: http://stackoverflow.com/comment/32775581
upvote count: 3
has comment: http://stackoverflow.com/comment/32012181

http://stackoverflow.com/q/21247998
has answer: http://stackoverflow.com/a/22351374
answer count: 4
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/32039527
has comment: http://stackoverflow.com/comment/32034177
has body: I have a map of JSON objects as follows: Map&lt;String,Object&gt; map = HashMap&lt;String,Object&gt;(); map.put("first_name", "prod"); JSONObject jsonObj = new JSONObject("some complex json string here"); map.put("data", jsonObj); Gson gson = new Gson(); String result = gson.toJson(map); Now if the "some complex JSON string here" was: {"sender":{"id":"test test"},"recipients":{"id":"test1 test1"} } and execute above code gives me something like: { "first_name": "prod", "data": { "map": { "sender": { "map": { "id": "test test" } } }, "recipients": { "map": { "id": "test1 test1" } } } } } I might have some syntax error up there, but basically I don't know why I am seeing objects wrapped around map's. Update according to comments, it is a bad idea to mix different json parsers. i can understand that. but my case requires calling an external api which takes a hash map of objects that are deserialized using gson eventually. is there any other object bedsides JSONObject that i can add to the map and still have gson create json out of it without extra 'map' structure? i do understand that i can create java beans and achieve this. but i'm looking for a simpler way since my data structure can be complex. Update2 going one step back, i am given a xml string. and i have converted them to json object. now i have to use an external api that takes a map which in turn gets converted to json string using gson in external service. so i am given an xml data structure, but i need to pass a map to that function. the way i have described above produces extra 'map' structures when converted to json string using gson. i do not have control to change how the external service behaves (e.g. using gson to convert the map).
downvote count: 1
possible better answer: http://stackoverflow.com/a/21248035
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
accepted answer: http://stackoverflow.com/a/21248250
has answer: http://stackoverflow.com/a/21248035
type: Question
has title: How to convert map of JSON objects to JSON using GSON in Java?
has comment: http://stackoverflow.com/comment/32009864
tagged with: hashmap
has answer: http://stackoverflow.com/a/22797272
has answer: http://stackoverflow.com/a/21248250

http://stackoverflow.com/comment/32129879
score: 0
has text: If the classes complied with java 7 wont be compatible with java 6 even both compilers are from same vendor.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21316452

http://stackoverflow.com/comment/32177687
has text: Related: [Is there a way to refer to the current type with a type variable?](http://stackoverflow.com/questions/7354740/is-there-a-way-to-refer-to-the-current-type-with-a-type-variable). In your case I would not recommend the solution that I explain there - rather try to decouple the responsibility of keeping track of other groups to another type. See my answer related to that approach here: http://stackoverflow.com/a/17076406/697449
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21342696
score: 1

http://stackoverflow.com/comment/32004777
type: QuestionComment
has text: J#? What? (and also Why?) Isn't it already long dead?
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21244694

http://stackoverflow.com/q/21291908
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/21292137
answer count: 1
tagged with: constructor
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21292137
has comment: http://stackoverflow.com/comment/32086321
type: Question
has body: I am trying to implement a board game in java, and I am currently working on the game board. The game board has 37 hex shaped tiles. Each of these can hold buildings, several Creatures, and a marker that shows who owns it. I have 37 instances of each tile, and now I am unsure as to how I can have each tile hold a collection(array, array list, linked list, whatever) on each tile. As a player moves there creatures through the board, I will be taking things from the array on that tile and adding it to a different array on a different tile. My first instinct is to put several array lists in the constructor for my Tile class, but I don't believe this is possible. any ideas? This is how I have defined my Tile class so far if curious: public class Tile { //neighbours of each tile public Tile n0; public Tile n1; public Tile n2; public Tile n3; public Tile n4; public Tile n5; public int owner = 0; public Tile (Terrain ter, int owned){ owner = owned; } } Edit: I want to do something like this with my constructor: public Tile (Terrain ter, int owned, ArrayList&lt;Creature&gt; creatureList){ owner = owned; } BUT I'm not sure if this is legal, or this makes sense. Will doing something like this allow me to have an array list associate with each Tile instance I define? Or is there a better way? I don't know if it needs to be defined in the parameters of the constructor or not.
has title: How can I have each of my tile objects be initiate with an empty arraylist that I can add things to later?

http://stackoverflow.com/q/21246983
has answer: http://stackoverflow.com/a/23453540
favorite count: 0
tagged with: android-studio
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32011462
has answer: http://stackoverflow.com/a/26481998
upvote count: 4
has answer: http://stackoverflow.com/a/29519323
downvote count: 0
has answer: http://stackoverflow.com/a/33798852
has comment: http://stackoverflow.com/comment/32096032
tagged with: java
has answer: http://stackoverflow.com/a/21247021
tagged with: eclipse
has title: ADB Not Responding - Android Studio
type: Question
answer count: 8
tagged with: intellij-idea
score: 4
has answer: http://stackoverflow.com/a/53466199
has body: Don't mark this as a duplicate. Let me explain what's wrong and tell you what I've done. So here's my problem. When I open Android Studio, it gives me an error like so: So then I went to my windows firewall settings. Here is what I have: As you can see, Firewall is off. Then, I went to my antivirus security program and turned the settings off there: As you can see here too, I disabled Smart Firewall. Then, I opened Android Studio again. I got the same error here too. I pressed the OK button and moved on. Then, Android Studio loaded up and everything. After that, ADB started loading. This is where the real error occurs. I have also tried it with Eclipse, but it also says ADB not responding. For the past month or so, Android Studio has been working fine. I have never gotten these error or warning messages with Android Studio before, so this is rather new to me. Here is what I have tried: In cmd, adb kill-server then I pressed the restart button on the ADB not responding message Restarting computer Turning USB Debugging on and off on my Nexus 5 So, I really can't find a solution to this. Any help regarding this problem would be extremely appreciated.
has answer: http://stackoverflow.com/a/31199709
tagged with: android
has answer: http://stackoverflow.com/a/26783750

http://stackoverflow.com/q/21224737
tagged with: java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21224788
score: 1
has answer: http://stackoverflow.com/a/21224757
favorite count: 0
has body: package com.example.des; import com.example.des.Question1; import com.example.des.R; import android.os.Bundle; import android.app.Activity; import android.app.AlertDialog; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.CheckBox; import android.widget.Toast; public class Question1 extends Activity implements OnClickListener{ CheckBox q1; CheckBox q2; CheckBox q3; CheckBox q4; Button btndone; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.question); q1 = (CheckBox)findViewById(R.id.q1a); q2 = (CheckBox)findViewById(R.id.q2a); q3 = (CheckBox)findViewById(R.id.q3a); q4 = (CheckBox)findViewById(R.id.q4a); btndone = (Button) findViewById(R.id.done); btndone.setOnClickListener(this); } @Override public void onClick(View v) { if (q1.isChecked() &amp;&amp; q2.isChecked()) { new AlertDialog.Builder(this).setMessage(R.string.positive).show(); } if (q3.isChecked() &amp;&amp; q4.isChecked()) { new AlertDialog.Builder(this).setMessage(R.string.negative).show(); } } } if q1 and q2 is check then the result must be positive then if q3 and q4 then it must be negative..but when i check q1,q2 and q3..it also goes positive and it should not give a result..when it is not only q1 and q2 are checked..
type: Question
downvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/21224757
tagged with: android
has title: what is the missing code for this.?
accepted answer: http://stackoverflow.com/a/21224788
upvote count: 3

http://stackoverflow.com/comment/32017279
type: Comment
has text: Is your class DbImpl annotated with component?
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21252759

http://stackoverflow.com/q/21285654
type: Question
tagged with: gwt
has answer: http://stackoverflow.com/a/21287162
has title: Whitespaces between words trimmed in ListBox gwt?
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: java
has body: I am using ListBox in a gwt project. ListBox populate multiple record and each record has multiple words. One of the record may have multiple spaces between words. Is there a way to preserve those spaces. I tried with providing css to Listbox with {white-space: pre;} but it is not working.

http://stackoverflow.com/comment/32107763
has text: Assuming tomcat is listening on 8080 by default, try `telnet xx.xxx.xxx.xxx 8080`,
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21303941
type: Comment

http://stackoverflow.com/q/21321814
answer count: 2
possible better answer: http://stackoverflow.com/a/21321851
has title: Caused by: org.hibernate.MappingException: Repeated column in mapping for entity
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/21321851
favorite count: 0
tagged with: postgresql
has body: I am beginner in handling JPA with maven and JBOSS, with Restful to make my application I have the following problem arose me doing DEPLOY Caused by: javax.persistence.PersistenceException: [PersistenceUnit: com.company.test_resources_war_1.0-SNAPSHOTPU] Unable to build EntityManagerFactory Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: database.Photo column: fid_module (should be mapped with insert = \ "false \" update = \ "false \") "}} Not that step, check all posles solutions, but did not find anything, can someone help me?? Thanks in advance Below I show the SQL code in postgres that I have and I did the mapping. I have three tables (activity, event and photo) where one of them (photo) refers to the other two (activity and event) but in a single column (photo.fid_module) SQL Code (enginer database-->Postgresql): CREATE TABLE activity ( id_activity integer not null, name character varying(150), description text, CONSTRAINT id_activity_pk PRIMARY KEY (id_activity) ) CREATE TABLE event ( id_event integer not null, name character varying(150), description text, date timestamp without time zone, CONSTRAINT id_event_pk PRIMARY KEY (id_event) ) CREATE TABLE photo( id_photo integer not null, path character varying(150), fid_module integer not null, CONSTRAINT id_photo_pk PRIMARY KEY (id_photo), CONSTRAINT fk_photo_activity FOREIGN KEY (fid_module) REFERENCE activity (id_activity) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT fk_photo_event FOREIGN KEY (fid_module) REFERENCE event (id_event) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION ) Now the mapping I did with the help of Netbenas and gave me the following code (I did the mapping for the three tables, but in presenting me the problem is in the class Photo.java). @Entity @Table(name = "photo") @XmlRootElement @NamedQueries({ @NamedQuery(name = "photo.findAll", query = "SELECT p FROM Photo p"), @NamedQuery(name = "photo.findByFidPhoto", query = "SELECT p FR…
accepted answer: http://stackoverflow.com/a/21322065
tagged with: maven
upvote count: 17
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/21322065
score: 17
type: Question

http://stackoverflow.com/q/21266500
has body: In Java, what is the best way to split a string into an array of blocks, when the delimiters at the beginning of each block are different from the delimiters at the end of each block? For example, suppose I have String string = "abc 1234 xyz abc 5678 xyz". I want to apply some sort of complex split in order to obtain {"1234","5678"}. The first thing that comes to mind is: String[] parts = string.split("abc"); for (String part : parts) { String[] blocks = part.split("xyz"); String data = blocks[0]; // Do some stuff with the 'data' string } Is there a simpler / cleaner / more efficient way of doing it? My purpose (as you've probably guessed) is to parse an XML document. I want to split a given XML string into the Inner-XML blocks of a given tag. For example: String xml = " ABC White Spaces Only XYZ "; String[] blocks = Split(xml," "," "); // should be {"ABC","XYZ"} How would you implement String[] Split(String str,String prefix,String suffix)? Thanks
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/373833
tagged with: java
has comment: http://stackoverflow.com/comment/32042108
has answer: http://stackoverflow.com/a/21266913
type: Question
tagged with: split
downvote count: 0
has comment: http://stackoverflow.com/comment/32041542
has title: What is the best way to split a string, when the prefix delimiters and the suffix delimiters are different?
has answer: http://stackoverflow.com/a/21266808
tagged with: regex
has answer: http://stackoverflow.com/a/21266692
answer count: 4
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/21266832
score: 2
linked to: http://stackoverflow.com/q/16712391
has comment: http://stackoverflow.com/comment/32041600

http://stackoverflow.com/a/21265632
type: Answer
score: 0
type: AcceptedAnswer
has body: Nevermind, I solved the question - I put BoxBug as the source package so it ran that one.
answers question: http://stackoverflow.com/q/21243246
accepted answer of: http://stackoverflow.com/q/21243246

http://stackoverflow.com/a/21314773
type: AcceptedAnswer
has body: had to add xhrFields: { withCredentials: true }, as an ajax param and response.addHeader("Access-Control-Allow-Origin", request.getHeader("Origin")); response.setHeader("Access-Control-Allow-Credentials", "true"); as my response headers
type: Answer
accepted answer of: http://stackoverflow.com/q/21267909
answers question: http://stackoverflow.com/q/21267909
score: 0

http://stackoverflow.com/q/21313512
type: AnsweredQuestion
has title: Why doesn't finally block execute after playframework renderbinary?
upvote count: 3
has comment: http://stackoverflow.com/comment/32136175
has comment: http://stackoverflow.com/comment/32126544
has comment: http://stackoverflow.com/comment/32237416
type: Question
score: 3
tagged with: java
tagged with: try-catch-finally
has comment: http://stackoverflow.com/comment/32135766
accepted answer: http://stackoverflow.com/a/23376710
has body: I was recently surprised to find that the finally block in this play framework controller action code only got called after an Exception, but never when the call actually succeeded. try { InputStream is = getInputStreamMethod(); renderBinary(is, "out.zip"); catch (Exception e) { e.printStackTrace(); } finally { cleanUp(); } Perhaps the thread is terminated or something when renderBinary() is called, but to me, it was non-intuitive. I would suspect the same thing happens for other render() calls, but I didn't verify it. I solved the problem by moving the renderBinary() to after the try/catch. Further investigation revealed that play provides an @Finally annotation to create a method that gets executed after a controller action executes. The caveat here is that this will get called after the execution of ANY action in the controller, so it may not always be a good choice. My question is: why does the finally block not get executed after a renderBinary(), and is this documented anywhere? I can't find any reference to it in the play doc. To clarify the sequence of events that led to this discovery: The files that were supposed to be deleted as a result of the finally block were not deleted. Thinking that it couldn't possibly be caused by a non-executing finally block, I changed the methodology to use the Amazon SQS Messaging Queue to send a message in the finally block -- a separate job receives the message and deletes the associated files. The messages were not getting sent. I set breakpoints in the code and determined that renderBinary was being called, but the finally block was not getting executed. Just to be safe, I added log messages to the finally clause, and these also were not present. I have repeated the debug exercise several times, and each time, the finally clause is not executed. (Please note that the actual code doesn't really look like the above. This is a very simplified example just to illustrate the case.)
has comment: http://stackoverflow.com/comment/32151022
has comment: http://stackoverflow.com/comment/32132720
tagged with: playframework
tagged with: try-finally
has comment: http://stackoverflow.com/comment/32130570
has comment: http://stackoverflow.com/comment/32216665
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32130377
has comment: http://stackoverflow.com/comment/32127098
favorite count: 0
tagged with: finally
has comment: http://stackoverflow.com/comment/32131170
has answer: http://stackoverflow.com/a/23376710

http://stackoverflow.com/comment/31981455
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21231806
has text: @Durandal the list2 is used after the loop. the code is not shown because it is not useful for the topic discussion.

http://stackoverflow.com/comment/32119013
comment on: http://stackoverflow.com/q/21310696
type: Comment
type: QuestionComment
score: 4
has text: `opencsv`, Super CSV. Is your Google down?

http://stackoverflow.com/q/21217097
score: -1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31954269
type: Question
has answer: http://stackoverflow.com/a/21217173
has body: I need to use a method that is located inside of a package in an external jar that i have loaded. The problem is, this method relies on a class that is in the same jar but it is in the Default Package so i cannot import it into my project. Is there a way to do this? Using: Eclipse
answer count: 2
has title: Java Import From External Jar Default Package
favorite count: 0
downvote count: 1
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21217221
has comment: http://stackoverflow.com/comment/31954248
tagged with: java

http://stackoverflow.com/a/21269869
accepted answer of: http://stackoverflow.com/q/21260794
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21260794
has comment: http://stackoverflow.com/comment/32087264
type: Answer
downvote count: 0
score: 1
has body: Android will pick the layout resource to use based on resource qualifiers, or buckets. e.g. layout-mdpi layout-hdpi layout-xlarge layout-port layout-sw600dp These are all resource buckets, than can all contain a layout file named activity_item_list. Android will then pick the layout file to use based on the current devices attributes. So the solution is to create a list_fragment layout file that exists in the layout folder, and the layout-sw600dp folder (or whatever you currently have). The layout in the layout-sw600dp folder can be adjusted for a tablet. Have a read up on these articles for more info: http://android-developers.blogspot.co.uk/2011/07/new-tools-for-managing-screen-sizes.html http://developer.android.com/guide/practices/screens_support.html http://developer.android.com/guide/topics/resources/providing-resources.html

http://stackoverflow.com/a/21253161
has comment: http://stackoverflow.com/comment/32018612
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21252960
score: 3
has comment: http://stackoverflow.com/comment/32018535
answers question: http://stackoverflow.com/q/21252960
has comment: http://stackoverflow.com/comment/32018676
has comment: http://stackoverflow.com/comment/32018715
upvote count: 3
has comment: http://stackoverflow.com/comment/32018400
has comment: http://stackoverflow.com/comment/32018770
has comment: http://stackoverflow.com/comment/32017897
has comment: http://stackoverflow.com/comment/32018836
has body: You should change: c++; Action.setText(ActionName.get(c)); //move this down if(c&gt;=ActionTime.size()){ timer.stop(); JOptionPane.showMessageDialog(null, "Workout Completed!"); } to: c++; if(c&gt;=ActionTime.size()){ timer.stop(); JOptionPane.showMessageDialog(null, "Workout Completed!"); return; //add this too as the program should not continue with below } Action.setText(ActionName.get(c)); //to here Because when you attempt to do ActionName.get(c) when the value of c exceeds the maximum possible value, the get method will throw an Exception. That leads us to the second mistake you're making: catch(Exception error2){ } Doing this makes the program ignore the Exception and continue as though nothing happened. An easy-to-make mistake that deceived you into thinking something else is wrong, but now you know! Change it to: catch(Exception error2){ error2.printStackTrace(); System.exit(-1); //or some error handling } Or remove the try/catch block so that the Exception will end your program or is handled some other way.
has comment: http://stackoverflow.com/comment/32017961

http://stackoverflow.com/comment/32037570
type: AnswerComment
has text: Thanks a lot for you feedback John. I updated my example to be complete.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21242799

http://stackoverflow.com/q/21198799
has answer: http://stackoverflow.com/a/21198823
has comment: http://stackoverflow.com/comment/31921879
has answer: http://stackoverflow.com/a/21198841
tagged with: performance
tagged with: java
has title: Duplicate expressions: better to make a variable or not?
type: Question
has body: In Java, say I have an expression X that occurs multiple times in a function. Generally speaking, is it more efficient to create a variable and set it equal to X, or not use a variable at all? What are the advantages/disadvantages of each method? Ex. Say X = 5+9*9-1000. Which function is more efficient, function1 or function2? public void function1() { System.out.println(5+9*9-1000); System.out.println(5+9*9-1000); } public void function2() { int variable = 5+9*9-1000; System.out.println(variable); System.out.println(variable); }
tagged with: variables
score: -4
has answer: http://stackoverflow.com/a/21199409
downvote count: 4
answer count: 3
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31921865
has comment: http://stackoverflow.com/comment/31921851
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31921909

http://stackoverflow.com/comment/50870598
type: Comment
has text: @assylias I am facing the similar problem. Can you please tell me with which application do I have to write this command `-Dprism.verbose=true` . I am new at linux. So i dont have any idea how to rectify the issue.
score: 1
comment on: http://stackoverflow.com/a/21203726
type: AnswerComment

http://stackoverflow.com/comment/32436473
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21488813
type: AnswerComment
has text: @user1988876 - The routine at the top of that page is C code, and it uses aliasing of `short` and `char` to do its dirty work. As I said, there's no way to do such aliasing in Java.

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/21284313
tags question: http://stackoverflow.com/q/21281407
tags question: http://stackoverflow.com/q/21285453
tags question: http://stackoverflow.com/q/21204659
tags question: http://stackoverflow.com/q/21331331
tags question: http://stackoverflow.com/q/21334068
tags question: http://stackoverflow.com/q/21268859
tags question: http://stackoverflow.com/q/21291386
tags question: http://stackoverflow.com/q/21253757
tags question: http://stackoverflow.com/q/21308361
tags question: http://stackoverflow.com/q/21347366
tags question: http://stackoverflow.com/q/21260302
tags question: http://stackoverflow.com/q/21299096
tag name: jfreechart
tags question: http://stackoverflow.com/q/21212214
tags question: http://stackoverflow.com/q/21276502
tags question: http://stackoverflow.com/q/21228252
tags question: http://stackoverflow.com/q/21337986

http://stackoverflow.com/q/21230535
answer count: 0
type: UnansweredQuestion
has body: I am using JdbcTemplate with SQLite (will be replaced by ms sql server later on)for some local testing. I want to test that a connection is ok when connecting to a valid datasource BUT I also want to test that I get some exception if I connect to an invalid/non-existent datasource. My problem: When connecting to a non-existent datasource, a new database is created by default. How can I prevent this behavior? Thanks!
tagged with: jdbctemplate
downvote count: 0
score: 1
tagged with: java
tagged with: database
type: Question
has title: Jdbc/Jdbctemplate - Preventing creating a database on connect
upvote count: 1
favorite count: 0
tagged with: sqlite

java
tags question: http://stackoverflow.com/q/21334025
tags question: http://stackoverflow.com/q/21246813
tags question: http://stackoverflow.com/q/21333370
tags question: http://stackoverflow.com/q/21347091
tags question: http://stackoverflow.com/q/21212586
tags question: http://stackoverflow.com/q/21300634
tags question: http://stackoverflow.com/q/21205029
tags question: http://stackoverflow.com/q/21267909
tags question: http://stackoverflow.com/q/21256034
tags question: http://stackoverflow.com/q/21260794
tags question: http://stackoverflow.com/q/21193347
tags question: http://stackoverflow.com/q/21217741
tags question: http://stackoverflow.com/q/21307781
tags question: http://stackoverflow.com/q/21189527
tags question: http://stackoverflow.com/q/21262593
tags question: http://stackoverflow.com/q/21286109
tags question: http://stackoverflow.com/q/21199878
tags question: http://stackoverflow.com/q/21257455
tags question: http://stackoverflow.com/q/21239517
tags question: http://stackoverflow.com/q/21311948
tags question: http://stackoverflow.com/q/21281989
tags question: http://stackoverflow.com/q/21247283
tags question: http://stackoverflow.com/q/21205906
tags question: http://stackoverflow.com/q/21194527
tags question: http://stackoverflow.com/q/21280365
tags question: http://stackoverflow.com/q/21296000
tags question: http://stackoverflow.com/q/21204873
tags question: http://stackoverflow.com/q/21186862
tags question: http://stackoverflow.com/q/21284689
tags question: http://stackoverflow.com/q/21212929
tags question: http://stackoverflow.com/q/21285453
tags question: http://stackoverflow.com/q/21349314
tags question: http://stackoverflow.com/q/21229723
tags question: http://stackoverflow.com/q/21274732
tags question: http://stackoverflow.com/q/21324499
tags question: http://stackoverflow.com/q/21279579
tags question: http://stackoverflow.com/q/21234784
tags question: http://stackoverflow.com/q/21345890
tags question: http://stackoverflow.com/q/21202171
tags question: http://stackoverflow.com/q/21212224
tags question: http://stackoverflow.com/q/21217724
tags question: http://stackoverflow.com/q/21266684
tags question: http://stackoverflow.com/q/21349259
tags question: http://stackoverflow.com/q/21346281
tags question: http://stackoverflow.com/q/21204273
tags question: http://stackoverflow.com/q/21235091
tags question: http://stackoverflow.com/q/21273586
tags question: http://stackoverflow.com/q/21227665
tags question: http://stackoverflow.com/q/21229504
tags question: http://stackoverflow.com/q/21295832
tags question: http://stackoverflow.com/q/21260842
tags question: http://stackoverflow.com/q/21323653
tags question: http://stackoverflow.com/q/21201903
tags question: http://stackoverflow.com/q/21244206
tags question: http://stackoverflow.com/q/21292942
tags question: http://stackoverflow.com/q/21268494
tags question: http://stackoverflow.com/q/21209532
tags question: http://stackoverflow.com/q/21228056
tags question: http://stackoverflow.com/q/21229736
tags question: http://stackoverflow.com/q/21193225
tags question: http://stackoverflow.com/q/21261817
tags question: http://stackoverflow.com/q/21292322
tags question: http://stackoverflow.com/q/21341729
tags question: http://stackoverflow.com/q/21247752
tags question: http://stackoverflow.com/q/21210096
tags question: http://stackoverflow.com/q/21233831
tags question: http://stackoverflow.com/q/21260291
tags question: http://stackoverflow.com/q/21339335
tags question: http://stackoverflow.com/q/21286005
tags question: http://stackoverflow.com/q/21293446
tags question: http://stackoverflow.com/q/21197917
tags question: http://stackoverflow.com/q/21340129
tags question: http://stackoverflow.com/q/21283264
tags question: http://stackoverflow.com/q/21273387
tags question: http://stackoverflow.com/q/21213921
tags question: http://stackoverflow.com/q/21245687
tags question: http://stackoverflow.com/q/21278215
tags question: http://stackoverflow.com/q/21207638
tags question: http://stackoverflow.com/q/21324065
tags question: http://stackoverflow.com/q/21315537

http://stackoverflow.com/comment/31985482
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21190553
has text: Well actually the only hard collision detection i have to make (at least for the moment) is done with the linesegment - circle intersection. The other collisions don't Need to stop the movement in this direction but simply distroy this object. So i think i am done for now. Thanks anyway and i ll think about this if i Need it (:
score: 0

http://stackoverflow.com/comment/31956028
has text: Okay, so I seem to be getting somewhere. My endless adapter isn't crashing anymore. Now it is my MyAdapter. Cast exception. Can't cast from arraylist to string at getView `((TextView) convertView.findViewById(android.R.id.text1)).setText(Html .fromHtml(titles.get(position)));`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21217426
type: Comment

http://stackoverflow.com/comment/32156287
comment on: http://stackoverflow.com/a/21331332
type: Comment
score: 0
has text: Then you should use two drawString calls. One to just draw the first character.. measure the pixel width or height of the first character rendered. offset this width or height in the next drawString() call.
type: AnswerComment

http://stackoverflow.com/comment/32081890
has text: You could use the getter, sorry. `String name = customer.getName();`
type: Comment
comment on: http://stackoverflow.com/a/21289439
score: 0
type: AnswerComment

http://stackoverflow.com/q/21253505
favorite count: 0
has comment: http://stackoverflow.com/comment/32021860
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32018632
score: 2
has comment: http://stackoverflow.com/comment/32018902
tagged with: java
tagged with: web-applications
has title: How to access one web application from another web application (jsp)
type: Question
answer count: 2
downvote count: 0
tagged with: jsp
tagged with: tomcat
has comment: http://stackoverflow.com/comment/32018574
has answer: http://stackoverflow.com/a/21253761
has body: I have two web applications in jsp: 1st application is running on tomcat 6 2nd is running on tomcat 7 which resides on different machine now I want to call the jsp of 2nd web application from 1st web application and also want to pass some data during run-time. So how can I achieve that, please suggest me some solution.
has answer: http://stackoverflow.com/a/21253688

http://stackoverflow.com/comment/32139037
comment on: http://stackoverflow.com/q/21321295
type: Comment
type: QuestionComment
score: 1
has text: Can you include the stack trace please?

http://stackoverflow.com/a/25230523
answers question: http://stackoverflow.com/q/21221396
downvote count: 0
has body: [Files] section gives you a "dontcopy" flag, which means you can package your files, but copy them (or run them or whatever) whenever you want from [Code] section. Like this: [Files] Source: "a.txt"; Flags: dontcopy [Code] procedure CurStepChanged(CurStep: TSetupStep); begin if CurStep = ssPostInstall then begin //This will actually extract your file to setup's temporary directory. //If you don't do this, the file is skipped //The temporary directory is deleted after setup ends. ExtractTemporaryFile('a.txt'); FileCopy(ExpandConstant('{tmp}\a.txt'), 'c:\temp\a.txt', False); end; end; Use the "PostInstall" stage to extract your files and copy them to JRE folder.
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/32186538
score: 0
comment on: http://stackoverflow.com/q/21347961
has text: yes, my shop table is so composed (id,quantity)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31948894
type: QuestionComment
type: Comment
has text: can you show your codes?
score: 0
comment on: http://stackoverflow.com/q/21214017

http://stackoverflow.com/a/21205241
has body: I solved by changing the operation type to request-response because of the missing implementation of the operation solicit-response in WS-I Profile. More details can be found here, thanks to Bogdan.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21196171

http://stackoverflow.com/comment/35803421
has text: I've downloaded the JDK (8), installed it, and if I check "java -version" on the command line I got back version 8. However eclipse still cannot find it.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21301581

http://stackoverflow.com/q/21346130
has comment: http://stackoverflow.com/comment/32183749
answer count: 1
tagged with: cas
tagged with: single-sign-on
type: UnansweredQuestion
has title: Single sign-on TicketValidationException
tagged with: java
has body: I create a server and client, the client is not configure virtual directory "/ EIP", can be used normally; If configured with a virtual directory will appear the following questions: server error message ERROR org.jasig.cas.CentralAuthenticationServiceImpl -ServiceTicket ST-11-SLvleOutvxi7VEy53Q07-cas01.example.org with service http://localhost:9999/eip/eip/ does not match supplied service http://localhost:9999/eip/eip/eip/ Client error message 2014-01-25 15:52:56,799 WARN [org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter] - org.jasig.cas.client.validation.TicketValidationException: XXX'ST-2-KORiek3rHflhLctqzGT5-cas01.example.org'XXXXXXXX at org.jasig.cas.client.validation.Cas20ServiceTicketValidator.parseResponseFromServer(Cas20ServiceTicketValidator.java:86) at org.jasig.cas.client.validation.AbstractUrlBasedTicketValidator.validate(AbstractUrlBasedTicketValidator.java:217) at org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:169) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jasig.cas.client.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:116) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(Coyote…
type: Question
has comment: http://stackoverflow.com/comment/32183570
has comment: http://stackoverflow.com/comment/32186214
has comment: http://stackoverflow.com/comment/32186804
has answer: http://stackoverflow.com/a/21927647
score: 0

http://stackoverflow.com/comment/31941444
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21209994
score: 1
has text: I think this is a classic example that gives motivatation for the "wrapper class" `Double`. Not only is it not a "hack" as you fear, but it's quite common.

http://stackoverflow.com/a/21307578
type: Answer
score: 2
has body: As the other mentioned you can implement the Comparable Interface in your java class. A better alternative would be the use of an external Comparator. Comparator&lt;FictionBook&gt; comparator = new Comparator&lt;FictionBook&gt;() { public int compare(FictionBook a, FictionBook b) { return a.title.compareTo(b.title); } } If you now want to sort you books according to the release year you then only have to implement an other comparator and just use the new one. Or you write an DecoratorComparator which inverses the reuslt of the inner result. Inverse sorter: Comparator&lt;FictionBook&gt; inverse = new Comparator&lt;FictionBook&gt;() { public int compare(FictionBook a, FictionBook b) { return comparator.compare(a, b) * -1; } } The actual sorting is also done with Collections.sort(list, comparator). If you want a flexible sort solution use comparator.
downvote count: 0
answers question: http://stackoverflow.com/q/21307297
upvote count: 2

http://stackoverflow.com/comment/32083113
has text: Short answer: you can't. Postgres is not designed for an in-process deployment model. Just have a default server around with a default user that the unit tests can use.
type: Comment
score: 2
comment on: http://stackoverflow.com/q/21288667
type: QuestionComment

http://stackoverflow.com/q/21203708
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21203883
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/11643011
has body: I've written simple java code to display file list in Linux to use it for FTP program using TCP(I'm going step by step, using all features). I'm posting this question after googling for about half an hour. import java.io.*; class FileList { public static void main(String args[]) { String dirname="/home/vaibhav/Test"; File f1=new File(dirname); String sl[]=f1.list(); System.out.print(f1.list()+"......."+sl.length+" files found."); for(int i=0;i&lt;sl.length;i++) { System.out.print(sl[i]+" "); } } } Output: vaibhav@vaibhav-VirtualBox:~/Java$ javac FileList.java vaibhav@vaibhav-VirtualBox:~/Java$ java FileList Exception in thread "main" java.lang.NullPointerException at FileList.main(FileList.java:10) My Directories Test and Java contents: vaibhav@vaibhav-VirtualBox:~$ cd /home/vaibhav/Test vaibhav@vaibhav-VirtualBox:~/Test$ dir 1 2 vaibhav@vaibhav-VirtualBox:~/Test$ ls -al total 8 drwxrwxrwx 2 vaibhav vaibhav 4096 Jan 18 15:04 . drwxr-xr-x 25 vaibhav vaibhav 4096 Jan 18 16:50 .. -rw-rw-rw- 1 vaibhav vaibhav 0 Jan 18 15:04 1 -rw-rw-rw- 1 vaibhav vaibhav 0 Jan 18 15:04 2 vaibhav@vaibhav-VirtualBox:~/Test$ cd vaibhav@vaibhav-VirtualBox:~$ cd /home/vaibhav/Java vaibhav@vaibhav-VirtualBox:~/Java$ ls -al total 20 drwxr-xr-x 2 vaibhav vaibhav 4096 Jan 18 16:52 . drwxr-xr-x 25 vaibhav vaibhav 4096 Jan 18 16:50 .. -rw-r--r-- 1 vaibhav vaibhav 990 Jan 18 16:52 FileList.class -rw-r--r-- 1 vaibhav vaibhav 477 Jan 18 16:52 FileList.java -rw-r--r-- 1 vaibhav vaibhav 487 Jan 18 16:52 FileList.java~ When I changed String dirname to /home/vaibhav/Java which is pwd too, program executed well. What was the issue? Thank you.
favorite count: 0
tagged with: linux
has title: Java File List: NPE while using for loop
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/31930381
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31930465
has comment: http://stackoverflow.com/comment/31930302
tagged with: filepath
has comment: http://stackoverflow.com/comment/31930556
score: 1
tagged with: java

http://stackoverflow.com/q/21333260
tagged with: java
has title: Java : How to override a method and throw exception?
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/21334049
tagged with: overriding
has comment: http://stackoverflow.com/comment/32159171
has body: I'm trying to override a method, with throwing an exception: class A { public doSomething(){ // some of logic } } class B extends A { public doSomething() throws MyCustomizedException { try { // some of logic } catch(ExceptionX ex ) { throw new MyCustomizedException(" Some info ", ex); } } } But I get this compile time error : Exception MyCustomizedException is not compatible with throws clause in A The two constraints are : Using the same name of the function and the same arguments if they exist: doSomething() Throwing my customized exception How can I get rid of the exception? Thank you a lot.
favorite count: 0
has comment: http://stackoverflow.com/comment/32160638
has comment: http://stackoverflow.com/comment/32159157
has answer: http://stackoverflow.com/a/21333677
tagged with: exception
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/32159366
has comment: http://stackoverflow.com/comment/32159313
answer count: 4
has answer: http://stackoverflow.com/a/21333282
linked to: http://stackoverflow.com/q/11332684
score: 2
has comment: http://stackoverflow.com/comment/32159197
linked to: http://stackoverflow.com/q/10513374
has answer: http://stackoverflow.com/a/21333293

http://stackoverflow.com/q/21218816
tagged with: recursivetask
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31957323
has comment: http://stackoverflow.com/comment/31957253
type: Question
has comment: http://stackoverflow.com/comment/31960885
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31960488
has title: I would like to make my code more implementable for other applications
has body: I would like to make my code more implementable for others applications. I don't have problems with the code, it works perfectly. I would just like to rewrite it to use it in other contexts. My original code: import java.util.concurrent.*; class Sum extends RecursiveTask&lt;Double&gt; { final int seqThresHold = 500; double[] data; int start, end; Sum(double[] vals, int s, int e ) { data = vals; start = s; end = e; } protected Double compute() { double sum = 0; if((end - start) &lt; seqThresHold) { for(int i = start; i &lt; end; i++) sum += data[i]; } else { int middle = (start + end) / 2; Sum subTaskA = new Sum(data, start, middle); Sum subTaskB = new Sum(data, middle, end); subTaskA.fork(); subTaskB.fork(); sum = subTaskA.join() + subTaskB.join(); } return sum; } } class RecurTaskDemo { public static void main(String args[]) { ForkJoinPool fjp = new ForkJoinPool(); double[] nums = new double[5000]; for(int i=0; i &lt; nums.length; i++) nums[i] = (double) (((i%2) == 0) ? i : -i) ; Sum task = new Sum(nums, 0, nums.length); double summation = fjp.invoke(task); System.out.println("Summation " + summation); } } The new code I would like to get: public class RecurTaskDemo { private static double Sum(double[] data, int start, int end) { double sum = 0; for (int i = start; i &lt; end; i++) { sum += data[i]; } return sum; } // ??? public static void main(String args[]) { double[] nums = new double[4000]; for (int i = 0; i &lt; nums.length; i++) nums[i] = (double) (((i % 2) == 0) ? i : -i); double sum = Sum(nums, 0, 4000); // double sum = ... I would like to calculate 'sum' using 'Sum(...)' + '???' System.out.println(sum); } }

vlcj
tags question: http://stackoverflow.com/q/21303270
tag name: vlcj
tags question: http://stackoverflow.com/q/21284243
type: Tag

http://stackoverflow.com/comment/32028136
type: QuestionComment
comment on: http://stackoverflow.com/q/21248160
score: 0
has text: I'd be a bit surprised if just one question with downvotes would invoke a question ban (I know that there is a question rate limiting, but I don't know the details of that). If you do have a question ban, you can ask about it on http://meta.stackoverflow.com/.
type: Comment

http://stackoverflow.com/a/21309066
answers question: http://stackoverflow.com/q/21308921
type: Answer
has comment: http://stackoverflow.com/comment/32116093
has comment: http://stackoverflow.com/comment/32116218
upvote count: 1
score: 1
downvote count: 0
has body: That is a bit unnatural in Java. Intuitively, I would interpret this: new int[x][y][z] as being: new ((int[x])[y])[z] // (Array of int[][]) with length z But that is NOT true. That is the odd part. It actually really is: new int[x]([y]([z])) // (Array of int[][]) with length x Which means this is an array with length x. The array, contains arrays, all of size y, and these arrays, contain arrays all of size z.

http://stackoverflow.com/q/21328620
has comment: http://stackoverflow.com/comment/32151530
has comment: http://stackoverflow.com/comment/32151818
has body: I have requirement where I need to show data in HTML in following structure Region -------------------------------- outlet1 | outlet2 | outlet3 | --------------------------------- 123 | 323 | 123 233 | 34234 | 23234 Number of outlets are not fixed . Varibales of my Java Object that will be formed by action and which will be throws as JSON are DataObject : regionName, outletName, personName, count list of these DataObjects will be used. How can I draw these using Data Table or plain Jquery. I think currently Data Table does not allow dynamic column binding..:(
type: Question
has title: Dynamically create columns / HTML tables using DataTable or plain JQUERY
answer count: 2
possible better answer: http://stackoverflow.com/a/21417554
has answer: http://stackoverflow.com/a/21417554
tagged with: javascript
tagged with: jquery
has answer: http://stackoverflow.com/a/21331933
score: 0
has comment: http://stackoverflow.com/comment/32151699
accepted answer: http://stackoverflow.com/a/21331933
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/a/21297101
answers question: http://stackoverflow.com/q/21296953
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/32222581
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32222066
accepted answer of: http://stackoverflow.com/q/21296953
has body: Your basic problem is you're painting the delta values not the position values... g.fillOval(dx, dy, 2 * r, 2 * r); ^---^---These are the deltas, not the position... Other problems you will/may have... Using getGraphics instead of overriding paintComponent. getGraphics can return null and anything you paint to it will be wiped clean the next time a paint cycle occurs. Swing uses a passive painting system and can trigger repaints without your interactions Using KeyListener. You will, generally, find it easier to use the Key Bindings API which doesn't suffer from the same focus issues that KeyListener suffers from Be careful using a Thread to update the game state, as it's possible that a repaint may occur while you're modifying the state and you will end up with a dirty paint. The use of "magic" numbers (ie GamePanel.WIDTH). If I change the size of the window, these value will have no meaning. Use empirical values instead, pass the actual width and height of the container to the move method Your keyPressed and keyReleased calls are screwing with your movement code. It's possible to press Left and have the ball bounce right...same goes for the other directions, it's possible to have the ball bounce in the opposite direction before moving in the correct direction. As another example, if I hold down Left, the ball will move right... Take a look at Performing Custom Painting Code Conventions for the Java Programming Language

http://stackoverflow.com/q/21214463
has comment: http://stackoverflow.com/comment/31949447
favorite count: 0
possible better answer: http://stackoverflow.com/a/21214493
type: Question
has comment: http://stackoverflow.com/comment/31949446
tagged with: android
has answer: http://stackoverflow.com/a/21214493
score: -1
accepted answer: http://stackoverflow.com/a/21214476
tagged with: java
answer count: 2
downvote count: 2
upvote count: 1
has title: ClassCastException: cannot be cast to NewsItem
has body: newsitem is a class that hold my data. when I click an item in the list view I get this error: 01-19 11:03:20.094: E/AndroidRuntime(860): FATAL EXCEPTION: main 01-19 11:03:20.094: E/AndroidRuntime(860): java.lang.ClassCastException: java.lang.Integer cannot be cast to com.example.NewsItem 01-19 11:03:20.094: E/AndroidRuntime(860): at com.example.ListViewContents$2.onItemClick(ListViewContents.java:72) 01-19 11:03:20.094: E/AndroidRuntime(860): at android.widget.AdapterView.performItemClick(AdapterView.java:282) 01-19 11:03:20.094: E/AndroidRuntime(860): at android.widget.AbsListView.performItemClick(AbsListView.java:1037) 01-19 11:03:20.094: E/AndroidRuntime(860): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2449) 01-19 11:03:20.094: E/AndroidRuntime(860): at android.widget.AbsListView.onTouchEvent(AbsListView.java:3085) 01-19 11:03:20.094: E/AndroidRuntime(860): at android.widget.ListView.onTouchEvent(ListView.java:3591) when clicked should be open an activity. this is onCreate method in the my ListviewContents class: @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.listviewcontents); intent = getIntent(); url_topic = intent.getIntExtra("key", 0); listview = (ListView)findViewById(R.id.custom_list); adapter = new LazyImageLoadAdapter(this,arraylist_newitems); listview.setAdapter(adapter); Button buttonrefresh = (Button)findViewById(R.id.button_refresh); buttonrefresh.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub adapter.imageLoader.clearCache(); adapter.notifyDataSetChanged(); } }); new LongImageFetch().execute((Void)null); listview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { String url ; NewsItem newitem = (NewsItem) listview.getItemAtPosition(position); url = newitem.…
tagged with: listview
tagged with: onitemclicklistener
has answer: http://stackoverflow.com/a/21214476
type: AnsweredQuestion

http://stackoverflow.com/q/21191928
downvote count: 0
duplicate of: http://stackoverflow.com/q/13693312
tagged with: unicode
favorite count: 0
has answer: http://stackoverflow.com/a/21192018
has answer: http://stackoverflow.com/a/21192034
tagged with: unicode-literals
possible better answer: http://stackoverflow.com/a/21192034
upvote count: 7
accepted answer: http://stackoverflow.com/a/21192018
type: AnsweredQuestion
tagged with: java
score: 7
has title: Getting empty character literal error in java code that specified unicode literals
linked to: http://stackoverflow.com/q/13693312
type: Question
has body: Why does this code public class Apostrophier { public static String replace(String s) { return s.replace('\u0092','\u0027'); } } give 'empty character literal' when I try to compile ?
answer count: 2

http://stackoverflow.com/comment/32000629
comment on: http://stackoverflow.com/q/21243010
type: Comment
type: QuestionComment
has text: http://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#getStackTrace()
score: 0

http://stackoverflow.com/comment/32004479
comment on: http://stackoverflow.com/a/21244722
score: 1
type: AnswerComment
has text: @Servy It is an answer because he clearly answered the question which was: Is this even possible to do? The answer was yes. The poster stated they were new to programming so the answer was according to the question. What if a beginner search this on a search engine and find this post? He'll be informed that it isn't meant to be done by a beginner in the first place. Answering is meant to answer the poster question, not other people.
type: Comment

http://stackoverflow.com/q/21284557
type: Question
has comment: http://stackoverflow.com/comment/32074926
has answer: http://stackoverflow.com/a/21285181
tagged with: afnetworking-2
score: 0
has comment: http://stackoverflow.com/comment/32073267
answer count: 1
tagged with: objective-c
has comment: http://stackoverflow.com/comment/32112046
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32073167
has body: NSURL *url = [NSURL here`URLWithString:@"http://testing.appspot.com/json/ListingBusinessService/"]; AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url]; httpClient.parameterEncoding = AFJSONParameterEncoding; NSDictionary *params = @{@"params":@"women",@"params" : @"women", @"params":@"women"}; [httpClient registerHTTPOperationClass:[AFJSONRequestOperation class]]; [httpClient setDefaultHeader:@"Accept" value:@"application/json"]; [httpClient postPath:@"getNewArrivalProductDetailsWithPaginationForIosApp" parameters:params success:^(AFHTTPRequestOperation *operation,id responseObject) { NSLog(@"%@",responseObject); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"%@",error); UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Error Retrieving Data" message:[NSString stringWithFormat:@"%@",error] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [av show]; } ]; I am getting following error while executing above code like AFNetworkingOperationFailingURLRequestErrorKey , i guess i missing something in parameters, please suggest me in this, Thanks in advance.
tagged with: java
has title: AFNetworking failing in java web service

http://stackoverflow.com/comment/31947505
has text: Where would I add the 1?
type: Comment
comment on: http://stackoverflow.com/q/21213271
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32055989
score: 0
type: Comment
type: QuestionComment
has text: Instead of `request.getSession().setAttribute()` you can directly write `session.setAttribute()` because session object is available in jsp
comment on: http://stackoverflow.com/q/21274366

http://stackoverflow.com/a/25252682
score: -2
downvote count: 2
answers question: http://stackoverflow.com/q/21189064
type: Answer
upvote count: 0
has body: From my personal experience, Jersey will map the most specific subclass specified by any ExceptionMapper implementation. In the case of your CustomBusinessException, the exception mapper used should be mapper A because mapper A is specific about the class type. For generic exceptions, such as the Exception class or any other sub-classes of Exception, mapper B will be used. Subsequently, you can let CustomBusinessException extend WebApplicationException as follows: public class CustomBusinessException extends WebApplicationException { public CustomBusinessException() { super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).type(MediaType.TEXT_PLAIN).build()); } } The above creates a response that is processed by Jersey and is more easily consumed by clients.

http://stackoverflow.com/comment/32008763
comment on: http://stackoverflow.com/q/21247434
has text: Don't forget to override the `toString()` method in your `Book` class.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31956147
type: QuestionComment
comment on: http://stackoverflow.com/q/21218200
has text: I assume you cannot just do `Integer.toBinaryString(num);`
score: 0
type: Comment

http://stackoverflow.com/q/21301835
has comment: http://stackoverflow.com/comment/32103812
tagged with: java
downvote count: 2
answer count: 1
type: UnansweredQuestion
has body: I want to set text of edittext into multiple textviews like if i enter 'HELLO', then H will be set to a textview, E to another. I have written below code where text is showing one by one on Toast message. App crashes if i use textview.settext(); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub String s=editText.getText().toString(); char charArray[] = s.toCharArray(); for(int i=0;i&lt;charArray.length;i++){ char r=charArray[i]; Toast.makeText(getApplicationContext(), ""+r, Toast.LENGTH_LONG).show(); } } });
has answer: http://stackoverflow.com/a/21301984
upvote count: 0
has comment: http://stackoverflow.com/comment/32103758
tagged with: textview
favorite count: 0
has title: Android set edittext values into multiple textviews
type: Question
tagged with: android
score: -2
tagged with: android-toast
tagged with: android-edittext

math
tags question: http://stackoverflow.com/q/21211021
tags question: http://stackoverflow.com/q/21277653
tags question: http://stackoverflow.com/q/21210923
type: Tag
tags question: http://stackoverflow.com/q/21226309
tags question: http://stackoverflow.com/q/21247883
tags question: http://stackoverflow.com/q/21249739
tags question: http://stackoverflow.com/q/21317976
tags question: http://stackoverflow.com/q/21314991
tags question: http://stackoverflow.com/q/21325143
tags question: http://stackoverflow.com/q/21285515
tags question: http://stackoverflow.com/q/21246696
tags question: http://stackoverflow.com/q/21239386
tags question: http://stackoverflow.com/q/21185883
tag name: math

http://stackoverflow.com/q/21215878
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21328127
has body: I'm trying to call the following c++ function: uint32_t FunctionName(uint32_t *arg1,uint32_t *arg2,uint32_t *arg3) but I cannot find a way to map this in Javacpp. How do I pass the pointer reference to the function, and how do I retrieve the changed values from the passed pointers afterwards?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21328127
tagged with: java
tagged with: javacpp
type: Question
has title: Call function with reference

http://stackoverflow.com/comment/32083216
type: QuestionComment
has text: Thanks, but since i'm fairly new to java I don't have a clue of how to use Timer in my app.
type: Comment
comment on: http://stackoverflow.com/q/21289140
score: 0

http://stackoverflow.com/q/21346606
score: 0
has answer: http://stackoverflow.com/a/21346617
has body: So say I have 3 classes, Tester, Fruit (superclass), and Apple (subclass) I have written a new method in Apple (which extends Fruit). The method being: public String getAppleColor() Now say in Tester I have created an array of 10 Fruit Fruit fruitArray = new Fruit[10] and say I make one of them fruitArray[3] = new Apple() This is fine, since Apple is also of type Fruit. However I wish to use my getAppleColor() on this specific element of the array: String appleColor = fruitArray[3].getAppleColor(); How come this is not working? When I look at useable methods on fruitArray[3] in eclipse, none of my Apple methods show up, but I made fruitArray[3] an Apple?
type: UnansweredQuestion
has title: Trying to use subclass method but it is not letting me
has comment: http://stackoverflow.com/comment/32184288
answer count: 4
has answer: http://stackoverflow.com/a/21346634
type: Question
linked to: http://stackoverflow.com/q/125367
has answer: http://stackoverflow.com/a/21346616
tagged with: java
has answer: http://stackoverflow.com/a/21346660
has comment: http://stackoverflow.com/comment/32184511
tagged with: inheritance

http://stackoverflow.com/q/21264456
has answer: http://stackoverflow.com/a/21265083
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/32038404
has answer: http://stackoverflow.com/a/21264541
has comment: http://stackoverflow.com/comment/32039983
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/24979102
has comment: http://stackoverflow.com/comment/32038013
has title: Optimizing String manupulation code
has comment: http://stackoverflow.com/comment/32037927
type: AnsweredQuestion
score: 2
upvote count: 2
accepted answer: http://stackoverflow.com/a/21264541
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32082625
possible better answer: http://stackoverflow.com/a/21265083
has body: I am trying to all possible child domains from a given host. I have written following code. It works but my only worry is performance. Is it required to optimize this code further: import java.util.Arrays; import java.util.Collections; public class DemoExtractHostArray { public static String[] createHostArray(String host) { String[] stringArr = host.split("\\."); String[] hostArray = new String[stringArr.length]; int hostIndex = 0; for(int index = stringArr.length-1; index&gt;=0;index--){ if(hostIndex==0){ hostArray[hostIndex] = stringArr[index]; } else{ hostArray[hostIndex] = stringArr[index]+"."+hostArray[hostIndex-1]; } hostIndex++; } Collections.reverse(Arrays.asList(hostArray)); return hostArray; } public static void main(String a[]){ for(String s: createHostArray("a.b.c.d.e.f")){ System.out.println(s); } } } Output: a.b.c.d.e.f b.c.d.e.f c.d.e.f d.e.f e.f f
has comment: http://stackoverflow.com/comment/32037939

http://stackoverflow.com/comment/32567871
type: Comment
comment on: http://stackoverflow.com/a/21533288
has text: Thanks a lot, mattes! I am happy that this project is still alive.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31933826
has text: I am curious why you are using `input.matches("[4-9]|10")`, is that really neccessary?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21205768
score: 0

http://stackoverflow.com/comment/31997382
has text: Which Thread are you sending to sleep? There's no definition in your code.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21240826

http://stackoverflow.com/comment/32034762
has text: @SotiriosDelimanolis That's a constructor (unfortunately).
score: 0
comment on: http://stackoverflow.com/q/21262763
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31972832
comment on: http://stackoverflow.com/q/21226621
score: 0
type: QuestionComment
type: Comment
has text: In this case, for me to get a reference to that activity, I'd have to launch it from my app, which is not something I want ( as of now). So this is not feasible.

http://stackoverflow.com/q/21238238
has answer: http://stackoverflow.com/a/21238459
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/21238486
possible better answer: http://stackoverflow.com/a/21238459
score: 0
answer count: 2
has body: I'm having some problems aranging a tablelayout. The way i've written the XML doesnt seem to show as i think it should when it appears on the screen. I want each column of my first tablerow to be equal in size, with its contents centered but what i am getting is the first 2 column bigger than the second two. My XML code: <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:screenOrientation="portrait" android:animateLayoutChanges="true" tools:context=".SettingsActivity" > <TextView android:id="@+id/lblIP" android:layout_weight="1" android:gravity="center" android:text="@string/ip" /> <TextView android:id="@+id/lblPort" android:layout_weight="1" android:gravity="center" android:text="@string/port" /> How it appears:
tagged with: java
tagged with: tablelayout
has answer: http://stackoverflow.com/a/21238486
has title: TableLayout problems
type: AnsweredQuestion
tagged with: layout
type: Question
tagged with: android

http://stackoverflow.com/comment/34338746
comment on: http://stackoverflow.com/q/21190626
type: Comment
type: QuestionComment
score: 1
has text: sou should measure before layout

http://stackoverflow.com/comment/31902974
score: 0
type: Comment
has text: @skiwi I think that would work pretty much the same way, only you'd need to throw around more `@SuppressWarnings("unchecked")` annotations. Java just isn't a good language for the sort of elegance you desire.
comment on: http://stackoverflow.com/a/21188234
type: AnswerComment

http://stackoverflow.com/comment/32167870
comment on: http://stackoverflow.com/q/21337549
score: 0
type: Comment
has text: Servlet is saying "cannot find symbol, symbol: method addCar(CarBean), location: class MainServlet". It's offering to make "method addCar(Bean.CarBean) in Servlets.MainServlet", but that can't be right? To clarify; "Bean" and "Servlets" are folders, in "Bean" there is CarBean class and in "Servlets" there is MainServlet servlet. Now I have third folder which is "Database" and there is that DAO class.
type: QuestionComment

http://stackoverflow.com/comment/31928630
type: Comment
type: QuestionComment
has text: If you'll transfer your data compress then it would be fairly easy to use the current idea your using, because those are just plain files, with lots of common characters.
comment on: http://stackoverflow.com/q/21202634
score: 2

http://stackoverflow.com/a/21246439
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32007002
upvote count: 1
answers question: http://stackoverflow.com/q/21246351
type: Answer
has body: Don't initialize your String object to "" if you want it to be null if the json parsing bits fail. Change your top line to: String object = null; More to the point, check out https://stackoverflow.com/a/21246501/599075
has comment: http://stackoverflow.com/comment/32007007

http://stackoverflow.com/a/21391619
type: AcceptedAnswer
type: Answer
has body: In order to have the content of your field searchable the first step is to make that field analyzed. That means, apply a chain of transformations, clean ups, tokenizations etc to extract searchable units (tokens). In your case you could use the WordDelimiterFilter as one step in the analysis chain.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21307507
accepted answer of: http://stackoverflow.com/q/21307507
upvote count: 1

http://stackoverflow.com/q/21277355
has comment: http://stackoverflow.com/comment/32062836
tagged with: java
accepted answer: http://stackoverflow.com/a/21348697
possible better answer: http://stackoverflow.com/a/21287912
type: Question
has title: How can you find the point on an ellipse that sweeps a given area?
answer count: 2
has comment: http://stackoverflow.com/comment/32062279
downvote count: 0
has comment: http://stackoverflow.com/comment/32060964
score: 1
has answer: http://stackoverflow.com/a/21348697
has comment: http://stackoverflow.com/comment/32066425
favorite count: 0
tagged with: geometry
has body: I am working on the problem of dividing an ellipse into equal sized segments. This question has been asked but the answers suggested numerical integration so that I what I'm attempting. This code short-circuits the sectors so the integration itself should never cover more than 90 degrees. The integration itself is being done by totaling the area of intermediate triangles. Below is the code I have tried, but it is sweeping more than 90 degrees in some cases. public class EllipseModel { protected double r_x; protected double r_y; private double a,a2; private double b,b2; boolean flip; double area; double sector_area; double radstep; double rot; int xp,yp; double deviation; public EllipseModel(double r_x, double r_y, double deviation) { this.r_x = r_x; this.r_y = r_y; this.deviation = deviation; if (r_x &lt; r_y) { flip = true; a = r_y; b = r_x; xp = 1; yp = 0; rot = Math.PI/2d; } else { flip = false; xp = 0; yp = 1; a = r_x; b = r_y; rot = 0d; } a2 = a * a; b2 = b * b; area = Math.PI * r_x * r_y; sector_area = area / 4d; radstep = (2d * deviation) / a; } public double getArea() { return area; } public double[] getSweep(double sweep_area) { System.out.println(String.format("getSweep(%f) a = %f b = %f deviation = %f",sweep_area,a,b,deviation)); double[] ret = new double[2]; double[] next = new double[2]; double t_base, t_height, swept,x_mid,y_mid; double t_area; sweep_area = sweep_area % area; if (sweep_area &lt; 0d) { sweep_area = area + sweep_area; } if (sweep_area == 0d) { ret[0] = r_x; ret[1] = 0d; return ret; } double sector = Math.floor(sweep_area/sector_area); double theta = Math.PI * sector/2d; double theta_last = theta; System.out.println(String.format("- Theta start = %f",Math.toDegrees(theta))); ret[xp] = a * Math.cos(theta + rot); ret[yp] = (1 + (((theta / Math.PI) % 2d) * -2d)) * Math.sqrt((1 - ( (ret[xp] * ret[xp])/a2)) * b2); next[0] = ret[0]; next[1] = ret[1]; swept = sector * sector_area; System.out.println(String.format("- Sweeping for %f sector_area=%…
upvote count: 1
has answer: http://stackoverflow.com/a/21287912
tagged with: ellipse
type: AnsweredQuestion

http://stackoverflow.com/q/21235874
score: 2
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/21235928
has title: Do I need entities if only getting data from db?
upvote count: 2
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/21235928
tagged with: jpa
tagged with: dao
has body: Hopefully easy questions: If I have an application that is supposed to only get data from database (it doesn't persist anything)? Do I need an exact structure of db presented by set of @Entity-annotated classes? Do I need Entities at all anyway? Or can I just use DAO and do something like: ObjectFromDb ob = dao.find(someProperty); given that ObjectFromDb is just a regular POJO without a single JPA annotation? I google'd it for a short while, but it seems to be too specific questions... Thanks for any advice!
tagged with: relational-database
type: AnsweredQuestion

http://stackoverflow.com/a/36656094
score: 0
upvote count: 1
downvote count: 1
type: Answer
has body: After Java update ant build failed and the below steps fixed it . Right Click on build.xml-Run As-External Tools Go to JRE tab and check the box to use the JRE same as workspace.
answers question: http://stackoverflow.com/q/21296620

http://stackoverflow.com/a/21343759
has comment: http://stackoverflow.com/comment/32179758
answers question: http://stackoverflow.com/q/21343504
type: Answer
downvote count: 0
score: 1
has body: You need to compute the angle and sine for every value of 'bufferLength', not from every second value. What you're doing is essentially under-sampling with interpolation. I don't see any 'symmetry' about that.
upvote count: 1

http://stackoverflow.com/comment/32170771
score: 0
comment on: http://stackoverflow.com/q/21338840
type: QuestionComment
has text: so basically you can not write generic version of column sorting. You would have to repeat the same process in every place you wants to perform the sorting right ?
type: Comment

http://stackoverflow.com/comment/32019242
score: 0
has text: Regex works, but when you try to limit the matching cases by using `^` they will limit to the first match then.
type: Comment
comment on: http://stackoverflow.com/a/21253115
type: AnswerComment

http://stackoverflow.com/comment/32182768
type: Comment
comment on: http://stackoverflow.com/q/21345810
score: 3
type: QuestionComment
has text: To address a different problem, two `NaN` values are not equal. Use `Double.isNan(operand)` instead.

http://stackoverflow.com/q/21193516
accepted answer: http://stackoverflow.com/a/21197696
has comment: http://stackoverflow.com/comment/53613224
tagged with: java
tagged with: hibernate
score: 6
has comment: http://stackoverflow.com/comment/31917844
has title: Hibernate not providing date in UTC timezone
type: Question
has comment: http://stackoverflow.com/comment/31916185
has answer: http://stackoverflow.com/a/21197696
has answer: http://stackoverflow.com/a/40594006
has comment: http://stackoverflow.com/comment/31917401
linked to: http://stackoverflow.com/q/2627992
answer count: 2
possible better answer: http://stackoverflow.com/a/40594006
downvote count: 0
has comment: http://stackoverflow.com/comment/31916957
has body: This seems like a stupid question, but I am not able to understand this creepy behavior. I am completely aware of the fact that java Date class does not store any TimeZone information in it. It just stores the number of milliseconds since January 1, 1970, 00:00:00 GMT Thing is that, I am using MySql which is residing on a server with UTC timezone and I am also storing DateTime in UTC only. If I make a select query then I get this date 2014-01-17 16:15:49 By using http://www.epochconverter.com/ I get this: Epoch timestamp: 1389975349 Timestamp in milliseconds: 1389975349000 Human time (GMT): Fri, 17 Jan 2014 16:15:49 GMT Human time (your time zone): Friday, January 17, 2014 9:45:49 PM Now comes the part of Hibernate. I am running my Java web app on a machine having IST as system timezone. I made a simple object fetch using Id and fetched createdDate property which is a Date object. I have wrote a simple code to understand its output, here is the code: Date dt = c.getCreatedDate(); System.out.println(dt.getTime()); System.out.println(dt); DateFormat df = new SimpleDateFormat("dd/MM/yyyy hh:mm a z"); df.setTimeZone(TimeZone.getTimeZone("IST")); System.out.println(df.format(dt)); df.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.println(df.format(dt)); And following is the output for this: 1389955549000 2014-01-17 16:15:49.0 17/01/2014 04:15 PM IST 17/01/2014 10:45 AM UTC If you put this 1389955549000 in http://www.epochconverter.com/ then you get following output: GMT: Fri, 17 Jan 2014 10:45:49 GMT Your time zone: Friday, January 17, 2014 4:15:49 PM GMT+5.5 This is not the expected output, right. It is giving me time in millis which is -5:30 from the UTC time, so If I try to get time in IST timezone then it actually gives me time which is in UTC Does anyone got idea where I am doing wrong? --------------------------How I fixed it---------------------------- Based on suggestions from - Ako and Basil Bourque Hibernate takes system timezone into consideration while …
has comment: http://stackoverflow.com/comment/31916426
favorite count: 0
has comment: http://stackoverflow.com/comment/31927506
tagged with: datetime
upvote count: 6
type: AnsweredQuestion

http://stackoverflow.com/comment/32026574
has text: @Kayaman You are patronizing OP, which makes you fair game.
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21258160
type: Comment

http://stackoverflow.com/comment/31921995
type: QuestionComment
comment on: http://stackoverflow.com/q/21198882
type: Comment
has text: [It's in the Javadoc](http://joda-time.sourceforge.net/apidocs/org/joda/time/base/BaseDateTime.html#getMillis%28%29)
score: 2

http://stackoverflow.com/a/21190015
answers question: http://stackoverflow.com/q/21189518
has comment: http://stackoverflow.com/comment/31920659
score: 0
type: Answer
has body: Your code is needlessly complicated and using available() is always rather confusing I find. It means you can read without a system call it doesn't mean there is nothing left. I suggest just serializing the array. FileOutputStream fos = new FileOutputStream(outFile); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(this.getStudents()); oos.close(); FileInputStream fis = new FileInputStream(fileName); ObjectInputStream ois = new ObjectInputStream(fis); Student[] copy = (Student[]) ois.readObject(); ois.close(); In Java, arrays are objects too.
has comment: http://stackoverflow.com/comment/31907068
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31909054
accepted answer of: http://stackoverflow.com/q/21189518
type: AcceptedAnswer

http://stackoverflow.com/comment/31962979
type: Comment
type: QuestionComment
has text: See also this [example](http://stackoverflow.com/a/2562685/230513) and [variation](http://stackoverflow.com/a/2563350/230513), as well as this [Q&A](http://stackoverflow.com/q/21142686/230513).
comment on: http://stackoverflow.com/q/21218210
score: 0

http://stackoverflow.com/q/21205393
tagged with: oop
tagged with: opengl
tagged with: java
tagged with: lwjgl
has answer: http://stackoverflow.com/a/21205515
accepted answer: http://stackoverflow.com/a/21205515
upvote count: 1
has body: I am using Java/LWJGL and am in the process of creating my own light object-orientated framework around LWJGL, during the process of learning OpenGL, however I am quite confused on what to do with glVertexAttribPointer. Take my following code: public class GameController extends Controller { //&lt;editor-fold defaultstate="collapsed" desc="keep-imports"&gt; static { int KEEP_LWJGL_IMPORTS = GL_2_BYTES | GL_ALIASED_LINE_WIDTH_RANGE | GL_ACTIVE_TEXTURE | GL_BLEND_COLOR | GL_ARRAY_BUFFER | GL_ACTIVE_ATTRIBUTE_MAX_LENGTH | GL_COMPRESSED_SLUMINANCE | GL_ALPHA_INTEGER | GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH | GL_ALREADY_SIGNALED | GL_ANY_SAMPLES_PASSED | GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH | GL_ACTIVE_PROGRAM | GL_ACTIVE_ATOMIC_COUNTER_BUFFERS | GL_ACTIVE_RESOURCES | GL_BUFFER_IMMUTABLE_STORAGE; int KEEP_OWN_IMPORTS = PROJECTION_MATRIX.getLocation(); } //&lt;/editor-fold&gt; private Program testProgram; private VertexArray vertexArray; private ArrayBuffer arrayBuffer; private final Matrix4f modelviewMatrix = new Matrix4f(); private final FloatBuffer modelViewMatrixBuffer = BufferUtils.createFloatBuffer(16); private float aspect; private Matrix4f projectionMatrix; final float[] vertexPositions = new float[] { -0.25f, 0.25f, -0.25f, -0.25f, -0.25f, -0.25f, 0.25f, -0.25f, -0.25f, 0.25f, -0.25f, -0.25f, 0.25f, 0.25f, -0.25f, -0.25f, 0.25f, -0.25f, 0.25f, -0.25f, -0.25f, 0.25f, -0.25f, 0.25f, 0.25f, 0.25f, -0.25f, 0.25f, -0.25f, 0.25f, 0.25f, 0.25f, 0.25f, 0.25f, 0.25f, -0.25f, 0.25f, -0.25f, 0.25f, -0.25f, -0.25f, 0.25f, 0.25f, 0.25f, 0.25f, -0.25f, -0.25f, 0.25f, -0.25f, 0.25f, 0.25f, 0.25f, 0.25f, 0.25f, -0.25f, -0.25f, 0.25f, -0.25f, -0.25f, -0.25f, -0.25f, 0.25f, 0.25f, -0.25f, -0.25f, -0.25f, -0.25f, 0.25f, -0.25f, -0.25f, 0.25f, 0.25f, -0.25f, -0.25f, 0.25f, 0.25f, -0.25f, 0.25f, 0.25f, -0.25f, -0.25f, 0.25f, -0.25f, -0.25f, -0.25f, -0.25f, -0.25f, -0.25f, -0.25f, 0.25f, -0.25f, 0.25f, -0.25f, 0.25f, 0.25f, -0.25f, 0.25f, 0.25f, 0.25f, 0.25f, 0.25f, 0.25f, -0.25f,…
possible better answer: http://stackoverflow.com/a/21205464
has title: OpenGL Where to put glVertexAttribPointer in an object orientated model?
has answer: http://stackoverflow.com/a/21205464
tagged with: object-oriented-analysis
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
answer count: 2

http://stackoverflow.com/comment/31904975
comment on: http://stackoverflow.com/q/21189541
score: 0
type: Comment
type: QuestionComment
has text: I didn't see the other. Sorry.

http://stackoverflow.com/q/21213693
has body: I'm using JBoss Server for EJB And I need JNDI in console app to get reference of session bean, console app code looks like this import java.util.Properties; import javax.naming.InitialContext; import javax.naming.NamingException; public class Program { public static void main(String[] args) throws NamingException { // TODO Auto-generated method stub Properties pr = new Properties(); pr.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); pr.put(InitialContext.PROVIDER_URL,"remote://localhost:4447"); InitialContext ic = new InitialContext(pr); } } when I run the application I get exception Exception in thread "main" javax.naming.NoInitialContextException: Cannot instantiate class: org.jboss.naming.remote.client.InitialContextFactory [Root exception is java.lang.ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory] at javax.naming.spi.NamingManager.getInitialContext(Unknown Source) at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source) at javax.naming.InitialContext.init(Unknown Source) at javax.naming.InitialContext.&lt;init&gt;(Unknown Source) at Program.main(Program.java:14) Caused by: java.lang.ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source) ... 5 more
possible better answer: http://stackoverflow.com/a/27500919
answer count: 5
has comment: http://stackoverflow.com/comment/31948442
has answer: http://stackoverflow.com/a/27500919
score: 8
has answer: http://stackoverflow.com/a/79235921
has answer: http://stackoverflow.com/a/21213922
has answer: http://stackoverflow.com/a/22831555
type: AnsweredQuestion
tagged with: java
tagged with: jboss
tagged with: eclipse
has answer: http://stackoverflow.com/a/57756221
type: Question
linked to: http://stackoverflow.com/q/40015829
downvote count: 0
accepted answer: http://stackoverflow.com/a/21213922
favorite count: 0
has title: JNDI "Cannot instantiate class: org.jboss.naming.remote.client.InitialContextFactory"
upvote count: 8

http://stackoverflow.com/comment/75379735
type: Comment
comment on: http://stackoverflow.com/a/21279523
type: AnswerComment
has text: @SUDARSHAN - did you see printTag() ? tag is available via String tag = vn.toString(vn.getCurrentIndex());
score: 0

http://stackoverflow.com/comment/32063449
has text: Can you include your web.xml?
comment on: http://stackoverflow.com/q/21278942
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/21215645
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21215597
upvote count: 5
answers question: http://stackoverflow.com/q/21215597
type: Answer
has body: If you can change addY() to "return this" then you're in business. Since it is a third party API maybe you just need a helper function: Vector makeAndSetupVector(float f1, float f2, float f3, int y) { Vector vect = new Vector(f1, f2, f3); vect.addY(y); return vect; } Now you can do: setLocation(makeAndSetupVector(0f, 4f, 0f, 3));
downvote count: 0
score: 5

http://stackoverflow.com/a/21289053
has body: Change your below loop code. it shall work now. for(int i=0 ; i&lt;adapter.getCount() ; i++) { C itemObject=adapter.getItem(i); if(itelObject!=null) b.append(itemObject.getText()); }
accepted answer of: http://stackoverflow.com/q/21288929
answers question: http://stackoverflow.com/q/21288929
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32081165

http://stackoverflow.com/comment/31916123
has text: That's interesting, this would support multiple products? I was using Document to represent a product. This way I can see what products are in a store, and see what stores carry a product.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21195662
type: Comment

http://stackoverflow.com/a/34770585
score: 9
answers question: http://stackoverflow.com/q/21347187
upvote count: 9
type: Answer
has body: The minimum number of nodes in an AVL tree for a tree with a height of 6 is not 20, it should be 33. The following equation should demonstrate the recursive call of the N(h) function. Since we know that N(0)=1 ,N(1) = 2, N(2) = 4, we can reduce the following equation to these knowns for h = 6. Because AVL tree is balanced BST, for each height h, we must form a h-1 and h-2 tree before moving forward to construct a height h AVL tree by adding another node. Thus, formula N(h)=1+N(h-1)+N(h-2) N(3)=1+N(3-1)+N(3-2)=1+N(2)+N(1)=7 N(4)=1+N(4-1)+N(4-2)=1+N(3)+N(2)=12 N(5)=1+N(5-1)+N(5-2)=1+N(4)+N(3)=20 N(6)=1+N(6-1)+N(6-2)=1+N(5)+N(4)=33 I hope this may help you
downvote count: 0
has comment: http://stackoverflow.com/comment/82920163

http://stackoverflow.com/a/21289843
has body: You could make use of the root() and pow() methods. A number, n, taken to the 0.9 power is equivalent to n taken to the 9/10 power, which in turn is equal to the 10th root of (n taken to the 9th power). So, you could have this using only ints: Unit newton09 = newton.pow(9).root(10);
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21289303
upvote count: 1

http://stackoverflow.com/comment/31936259
type: AnswerComment
has text: I think it also adds readability. Declaring a method as abstract and not providing a method body is a far clearer expression of non-implementation than providing a dummy method with comments indicating it must be overridden.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21206856

http://stackoverflow.com/q/21336296
has answer: http://stackoverflow.com/a/21397750
tagged with: java
upvote count: 6
has answer: http://stackoverflow.com/a/21392799
has body: So currently I am doing something like this to do cross browser testing: @DataProvider(name="foo") public Object[][] getDrivers() { DesiredCapabilities firefoxCapabs = DesiredCapabilities.firefox(); capabillities.setCapability("version", "26"); capabillities.setCapability("platform", Platform.WINDOWS); DesiredCapabilities chromeCapabs = .... .... DesiredCapabilities ieCapabs = ... .... return new Object[][]{ {new RemoteWebDriver(url, firefoxCapabs)}, {new RemoteWebDriver(url, chromeCapabs)}, ...... }; } @Test(dataProvider="foo") public void testSomething(WebDriver driver) { //some test } This seems extremely inefficient as I am basically creating and destroying these WebDriver objects every time I run a test. Is there no way to do something like this at least at the TestSuite level so that I am not generating and destroying these objects for every test. I would like something like below. I am aware that you cannot have a DataProvider for @BeforeSuite methods! public class TestSuite{ public static WebDriver driver; @BeforeSuite(dataProvider="foo") public void setDriver(WebDriver driver) { this.driver = driver; } } public class TestClass { private WebDriver driver; @BeforeTest public void getDriver() { this.driver = TestSuite.driver; } @Test public void myTest() { //use this.driver to do testing stuff } } Are there options I am not seeing to do something like this?
has answer: http://stackoverflow.com/a/21450617
has answer: http://stackoverflow.com/a/21337596
has title: Selenium testing on different browsers using TestNG
answer count: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/32398392
has comment: http://stackoverflow.com/comment/32409484
possible better answer: http://stackoverflow.com/a/21457154
has answer: http://stackoverflow.com/a/21457154
has answer: http://stackoverflow.com/a/21465690
tagged with: cross-browser
has comment: http://stackoverflow.com/comment/32276832
tagged with: testng
type: AnsweredQuestion
downvote count: 0
tagged with: selenium
score: 6
has answer: http://stackoverflow.com/a/21527966
accepted answer: http://stackoverflow.com/a/21392799
type: Question

http://stackoverflow.com/comment/31947073
type: AnswerComment
comment on: http://stackoverflow.com/a/21212925
score: 0
type: Comment
has text: All of these ideas can still be taken into account do what you need to acheive. This is just an example based on the code you have above.

http://stackoverflow.com/q/21242015
answer count: 1
has answer: http://stackoverflow.com/a/21242089
has title: Java Paint Error Setting Up
type: AnsweredQuestion
tagged with: paint
accepted answer: http://stackoverflow.com/a/21242089
score: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/14172262
has body: The problem is simple: I get the error "void is an invalid type for the variable paint". public void paint(Graphics g){ } I could not find a solution on the web.I have used the method before, so I have no idea what could be wrong.

file
tags question: http://stackoverflow.com/q/21265163
type: Tag
tags question: http://stackoverflow.com/q/21346327
tags question: http://stackoverflow.com/q/21249241
tags question: http://stackoverflow.com/q/21203846
tags question: http://stackoverflow.com/q/21345770
tags question: http://stackoverflow.com/q/21305453
tag name: file
tags question: http://stackoverflow.com/q/21320365
tags question: http://stackoverflow.com/q/21342903
tags question: http://stackoverflow.com/q/21197569
tags question: http://stackoverflow.com/q/21289412
tags question: http://stackoverflow.com/q/21310470
tags question: http://stackoverflow.com/q/21240392
tags question: http://stackoverflow.com/q/21291846
tags question: http://stackoverflow.com/q/21285370
tags question: http://stackoverflow.com/q/21248995
tags question: http://stackoverflow.com/q/21293031
tags question: http://stackoverflow.com/q/21223969
tags question: http://stackoverflow.com/q/21264888
tags question: http://stackoverflow.com/q/21301770
tags question: http://stackoverflow.com/q/21245950
tags question: http://stackoverflow.com/q/21273125
tags question: http://stackoverflow.com/q/21307122
tags question: http://stackoverflow.com/q/21202634
tags question: http://stackoverflow.com/q/21206303
tags question: http://stackoverflow.com/q/21200127
tags question: http://stackoverflow.com/q/21232669
tags question: http://stackoverflow.com/q/21245140
tags question: http://stackoverflow.com/q/21339095
tags question: http://stackoverflow.com/q/21243138
tags question: http://stackoverflow.com/q/21229493
tags question: http://stackoverflow.com/q/21281000
tags question: http://stackoverflow.com/q/21254465
tags question: http://stackoverflow.com/q/21304261
tags question: http://stackoverflow.com/q/21333728
tags question: http://stackoverflow.com/q/21201914

http://stackoverflow.com/q/21184549
type: Question
has title: Flexicapture 10 SDK verification step issue
tagged with: abbyy
answer count: 1
score: 0
linked to: http://stackoverflow.com/q/24034598
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22758739
tagged with: java
has body: I'm trying to use flexicapture SDK for verification step. when i'm trying to obtain Recognized word count from IText object it returns 0 (zero). int wordCount = text.getRecognizedWordsCount() ; wordCount is zero here ... Work flow as below: 1.Load the engine 2.create project 3.creating and adding images in batch obtained from project ( project.getBatches().AddNew("TestBatch") ) 4.Recognize batch using batch object (batch.Recognize(null, RecognitionModeEnum.RM_ReRecognizeAll,null) ) 5. Start verification session 6. enable context verification and disable group verification 7. Get work set from session 8. FOR ALL Work Set: get verification group 9. FOR ALL Verification group: get verification object 10. FOR each verification object: Get Fields ( under context verification ) 11. obtained IField object 12. get IFieldValue object from Field object 13. Get IText object ( IText text = fieldValue.getAsText() ) 14. get recognized word count ( int wordCount = text.getRecognizedWordsCount() ) here i'm getting 0 as result ( wordCount = 0 ) Pls suggest some solution; My main task to get Every fieldValue, for each word or each character we need to confidence level. // © ABBYY. 2012. // SAMPLES code is property of ABBYY, exclusive rights are reserved. // // DEVELOPER is allowed to incorporate SAMPLES into his own APPLICATION and modify it under // the terms of License Agreement between ABBYY and DEVELOPER. import java.io.File; import java.io.IOException; import java.sql.BatchUpdateException; import com.abbyy.FCEngine.*; public class VerificationStep { private static Object verificationWorkSet(Object object) { // TODO Auto-generated method stub return null; } private static void trace( String txt ) { System.out.println( txt ); } static private String samplesFolder; static private String projectFolder; static private String serialNumber; static private String dllPath; static { samplesFolder = "C:\\ProgramData\\ABBYY\\SDK\\10\\FlexiCapture Engine\\Samples\\"; projectFolder = "C:\\Use…
accepted answer: http://stackoverflow.com/a/22758739

http://stackoverflow.com/a/23376710
has body: It's true. I just found out about this today, since my company uses the play framework and someone ran into it. As I understand it, this likely only occurs in play versions prior to 2.0, but when you catch all Exceptions following a render call, play apparently rewrites the code to skip the finally block... I don't understand why or exactly how this is done, but it is apparently the case. If you catch a specific exception, I don't think this will happen. But yes, you're not crazy or a bad programmer. This really is just a weird, undocumented play gotcha.
has comment: http://stackoverflow.com/comment/35810074
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21313512
upvote count: 4
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/21313512

http://stackoverflow.com/q/21241341
has answer: http://stackoverflow.com/a/21241598
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21241598
type: AnsweredQuestion
tagged with: java
type: Question
has title: Cygwin runs different version of java than windows powershell
tagged with: powershell
tagged with: cygwin
has body: I have multiple versions of java installed. Recently while testing I noticed that cygwin and powershell were running different versions, and figured it was a problem with my path, but it looks to be something stranger. In powershell I get: PS C:\Users\djpeaco&gt; echo $env:JAVA_HOME PS C:\Users\pavon&gt; where.exe java C:\Windows\System32\java.exe PS C:\Users\pavon&gt; C:\Windows\System32\java.exe -version java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode) And then in cygwin (bash): $ echo $JAVA_HOME $ which java /cygdrive/c/Windows/system32/java $ /cygdrive/c/Windows/system32/java -version java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode) I tried restaring both shells, in case there was some environment change that one hadn't picked up, but that didn't solve the problem. Also, cmd.exe behaves the same as powershell. Does anyone know why running the exact same executable in cygwin vs powershell would end up running different JVMs?

gwt
tags question: http://stackoverflow.com/q/21348288
tags question: http://stackoverflow.com/q/21266487
tags question: http://stackoverflow.com/q/21308005
tags question: http://stackoverflow.com/q/21231546
tags question: http://stackoverflow.com/q/21330113
tags question: http://stackoverflow.com/q/21325572
tag name: gwt
tags question: http://stackoverflow.com/q/21285312
tags question: http://stackoverflow.com/q/21340004
tags question: http://stackoverflow.com/q/21323914
tags question: http://stackoverflow.com/q/21234745
type: Tag
tags question: http://stackoverflow.com/q/21314780
tags question: http://stackoverflow.com/q/21336421
tags question: http://stackoverflow.com/q/21337100
tags question: http://stackoverflow.com/q/21334145
tags question: http://stackoverflow.com/q/21292690
tags question: http://stackoverflow.com/q/21299015
tags question: http://stackoverflow.com/q/21191701
tags question: http://stackoverflow.com/q/21239369
tags question: http://stackoverflow.com/q/21301415
tags question: http://stackoverflow.com/q/21266344
tags question: http://stackoverflow.com/q/21326341
tags question: http://stackoverflow.com/q/21286650
tags question: http://stackoverflow.com/q/21285654
tags question: http://stackoverflow.com/q/21235109
tags question: http://stackoverflow.com/q/21286677
tags question: http://stackoverflow.com/q/21228439
tags question: http://stackoverflow.com/q/21338840
tags question: http://stackoverflow.com/q/21223160
tags question: http://stackoverflow.com/q/21335189
tags question: http://stackoverflow.com/q/21207085
tags question: http://stackoverflow.com/q/21254594
tags question: http://stackoverflow.com/q/21231759
tags question: http://stackoverflow.com/q/21328111
tags question: http://stackoverflow.com/q/21216546
tags question: http://stackoverflow.com/q/21342269
tags question: http://stackoverflow.com/q/21232680
tags question: http://stackoverflow.com/q/21227324
tags question: http://stackoverflow.com/q/21188495

http://stackoverflow.com/q/21190816
has comment: http://stackoverflow.com/comment/31908030
accepted answer: http://stackoverflow.com/a/21191992
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21191974
has comment: http://stackoverflow.com/comment/31907244
has title: Calculate an operation with a negative number first in a string
score: 0
possible better answer: http://stackoverflow.com/a/21191974
has comment: http://stackoverflow.com/comment/31908097
has body: I've just about written every possible combination of code I can think of, but I can't get my calculator to work if there is a negative operator first. The way the calculator works is if there already contains an operator (with the last character of the string being a digit) it will calculate what's already there first and then add the operator pressed. However, I want it to allow and second operator if and only if the first character is a negative (- symbol). But I can't for the life of me do this. This is what I have so far: // calculation logic public void calculate() { for (int i = 0; i &lt; textField.length(); i++) { checkOp(i); } resultDisplayed = true; } public float checkOp(int i) { if (textField.getText().charAt(i) == '+') { result = Float.parseFloat(textField.getText().toString().substring(0, i)) + Float.parseFloat(textField.getText().toString().substring(i + 1, textField.length())); returnAnswer(decimalFormat.format(result)); } else if (textField.getText().charAt(i) == '-') { if (textField.getText().charAt(0) != '-') { result = Float.parseFloat(textField.getText().toString().substring(0, i)) - Float.parseFloat(textField.getText().toString().substring(i + 1, textField.length())); } else { } } else if (textField.getText().charAt(i) == '*') { result = Float.parseFloat(textField.getText().toString().substring(0, i)) * Float.parseFloat(textField.getText().toString().substring(i + 1, textField.length())); returnAnswer(decimalFormat.format(result)); } else if (textField.getText().charAt(i) == '/') { result = Float.parseFloat(textField.getText().toString().substring(0, i)) / Float.parseFloat(textField.getText().toString().substring(i + 1, textField.length())); returnAnswer(decimalFormat.format(result)); } return result; } // checks if last character is one of the operands (not -) public void checkLastOp(String op) { if (textField.length() == 0 &amp; op.equals("-")) { addToOutput("-"); } else if (textField.length() &gt; 0) { if (op.equals("+")) { if (textField.get…
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31907061
has comment: http://stackoverflow.com/comment/31907142
tagged with: java
has comment: http://stackoverflow.com/comment/31907109
has answer: http://stackoverflow.com/a/21191992

http://stackoverflow.com/q/21215883
upvote count: 2
has answer: http://stackoverflow.com/a/21215980
has body: I wrote a little copy tool in java to copy .mp3 files on my USB stick. When new files are copied, some file attributes are preserved, but not the creation time. To copy files I use: org.apache.commons.io.FileUtils static void copyFile(File srcFile, File destFile, boolean preserveFileDate) FileUtils.copyFile(sourceFile, newTargetFile, preserveFileDate); So my question, is there a way to preserve the file creation time? If not, I think I set up a class to copy with windows robocopy.
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21215923
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21215923
favorite count: 0
has title: Preserve file creation time with Java
score: 2
possible better answer: http://stackoverflow.com/a/21215980

spring-aop
tags question: http://stackoverflow.com/q/21279716
tags question: http://stackoverflow.com/q/21281470
tags question: http://stackoverflow.com/q/21275337
tags question: http://stackoverflow.com/q/21271485
tags question: http://stackoverflow.com/q/21191941
tags question: http://stackoverflow.com/q/21275819
tags question: http://stackoverflow.com/q/21280718
tag name: spring-aop
tags question: http://stackoverflow.com/q/21347725
tags question: http://stackoverflow.com/q/21185838
type: Tag

http://stackoverflow.com/a/21340099
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32172687
has comment: http://stackoverflow.com/comment/32219458
has comment: http://stackoverflow.com/comment/32172439
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21340013
has body: The Spring way to do this is to have your three beans implementing three different interfaces (or subinterfaces) and then reference the three interfaces with the @Autowired annotation. After all, if the three beans have different functionality, it makes sense to do it this way. You could also have a bean containing the three and have that be @Autowired so you don't need the three references everywhere. I'm not even sure how the @Service would get properly wired if there are more instances of the same interfaces. It would work for concrete classes but I don't think it would work for many implementation of an interface. Here's an example of what I suggest: interface BInterface{ /*...*/ } @Service class B1 extends BInterface{/*...*/} @Service class B2 extends BInterface{/*...*/} @Service class B3 extends BInterface{/*...*/} @Service class BProvider { @Autowired private B1 b1; @Autowired private B2 b2; @Autowired private B2 b2; public BInterface get(String k) { switch(k){ case "b1": return b1; case "b2": return b2; case "b3": return b3; default: return b1; } } } BClient { @Autowired private BProvider provider; public void doSomething(){ BInterface b = provider.get(/* one of the three */); // use b ... } } As an alternative, you could make BProvider configurable and configure it with a Map&lt;String,BInterface&gt; using XML configuration. So it would be: @Service class BProvider { @Autowired private Map&lt;String,BInterface&gt; bs; public BInterface get(String k) { return bs.get(k); } } And you have to define your map in the configuration file. To do so, you can manually create your beans in the XML file or I believe you can use a BeanPostProcessor to add them to the collection.
answers question: http://stackoverflow.com/q/21340013
has comment: http://stackoverflow.com/comment/32173087
has comment: http://stackoverflow.com/comment/32195963
type: Answer

http://stackoverflow.com/comment/31990345
type: AnswerComment
comment on: http://stackoverflow.com/a/21223346
score: 0
type: Comment
has text: Many questions. You need to live within the boundaries of the framework. It started out as an experiment for a research paper, not a commercial application development package. Threads have to wake up and go looking for work so there is no way to balance the load. In a tree, you half, fork/compute, which gives other threads a chance to pick up the forked task and do the same. Every thread is doing one split up to the threshold. This gives the other threads a chance to participate. For more detail look at the source.

http://stackoverflow.com/q/21329509
has answer: http://stackoverflow.com/a/21368442
has comment: http://stackoverflow.com/comment/32156681
upvote count: 0
has body: In jboss 4 we used dom4j SAX parser to read server.xml. It was working fine but it is not working in case of JBoss EAP 6. .Below is code used in jboss 4 public static Document modifyAttributeValue(Document document, String elementName, String attributeName, String attributeValue) { if (document == null) return document; try { Element element = (Element) document.selectSingleNode(elementName); if (element != null) { Attribute attribute = element.attribute(attributeName); attribute.setValue(attributeValue); } } catch (Exception e) { logger.error("Failed to modify attribute.", e); } return document; } I am getting element as null value .
tagged with: java
has comment: http://stackoverflow.com/comment/32156737
type: Question
has comment: http://stackoverflow.com/comment/32153168
score: -2
answer count: 1
downvote count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/32156366
has comment: http://stackoverflow.com/comment/32156328
has title: Change JBoss EAP 6 port number
type: UnansweredQuestion

http://stackoverflow.com/a/24488418
answers question: http://stackoverflow.com/q/21246154
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37913928
has body: You said you have tried with java 1.8 with MaxPermSize $ /opt/jdk1.8.0/bin/java -XX:MaxPermSize=128M -Xms256M -Xmx496M -jar /home/server-god/spigot.jar nogui and with Java 1.7 without MaxPermSize : $ sudo /opt/jdk1.7.0_51/bin/java -Xms256M -Xmx496M -jar /home/server-god/spigot.jar nogui But as some modpack for minecraft seem to have issues with java 1.8 have you tried Java 1.7 with MaxPermSize ? $ sudo /opt/jdk1.7.0_51/bin/java -XX:MaxPermSize=128M -Xms256M -Xmx496M -jar /home/server-god/spigot.jar nogui It could be a comment but I can only post answers right now (weird rule of Stack Overflow ^^)
upvote count: 1

http://stackoverflow.com/q/21293628
tagged with: google-app-engine
upvote count: 1
has body: We are creating an app for iOS and have chosen Java running on Google App Engine for the backend. We use Google Cloud Endpoints to generate client library for iOS. We are relatively new to most of this and we are not quite sure how the backend should respond after an error based on user action. For example we have a method for creating a custom user, which should return the user-object if the save was successful. But there may be conditions that are not met and if so the app must get an appropriate response and handle present to the user. This is how we thought of doing it: @ApiMethod(name = "createUser", httpMethod = HttpMethod.POST) public User createUser(User user) throws BadRequestException { if(!validateUsername(user.getUsername())) throw new BadRequestException("Invalid characters in username"); //Do stuff and save user ......... return user } And then maybe throw a custom exception derived from ServiceException if the username exists etc. Is this a reasonable way to do it? I just feel like it's a little brutal to be throwing exceptions every time something like this happens. It also also appears in the log which could make it difficult to distinguish between actual application errors that needs to be fixed.
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21299272
type: Question
downvote count: 0
answer count: 1
favorite count: 0
tagged with: google-cloud-endpoints
has title: How should backend application respond to error or invalid input?
has comment: http://stackoverflow.com/comment/32089647
type: UnansweredQuestion

http://stackoverflow.com/comment/32183965
type: QuestionComment
comment on: http://stackoverflow.com/q/21346343
score: 2
has text: by `i and j` I referred to the coordinates. C, E and G would have a value of 2. F and H would have a value of 3. I's value is 4.
type: Comment

http://stackoverflow.com/a/21212508
answers question: http://stackoverflow.com/q/21212482
has comment: http://stackoverflow.com/comment/31946266
upvote count: 2
score: 2
has body: your in.read() call is executed twice and only stored in the variable once it seems. public void readStream(){ try{ while(in.read()!=-1){ char c = (char) in.read(); msg = msg + c; }in.close(); }catch (Exception e) { System.out.println("Error:" + e); } } Notice that in.read() is called in the while loop(making the char returned by in.read() not stored inside of the c variable and skips over the character), a better example may be something similar to... try{ char c; while((c = (char)in.read()) != -1) { msg += c; } in.close(); } catch(Exception e){ System.out.println("Error: " + e); } savvy?
accepted answer of: http://stackoverflow.com/q/21212482
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31946252
type: Answer
has comment: http://stackoverflow.com/comment/31946449

http://stackoverflow.com/comment/32059203
has text: @ReneLink you could imagine that a warning is emitted by some analysis tool and the op wants to fix the code so SO is fine IMO.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21276424

http://stackoverflow.com/q/21244147
has comment: http://stackoverflow.com/comment/32002835
tagged with: tomcat
tagged with: servlets
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21244275
has body: I'm running a Tomcat server on my raspberry pi. When someone browses my server, the servlet launch a JFrame that shows some information on my TV (which is connected to the Pi). This is how it's made, in the servlet: public static JFrame gui; @Override public void init() throws ServletException { // super.init() not needed if (gui==null) gui = launchUi(); else if(!gui.isVisible()) gui.setVisible(true); } The problem is, when I stop the server, the JFrame is not closed. This is what I found in the Tomcat logs. janv. 20, 2014 9:53:18 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/myapp] appears to have started a thread named [AWT-Shutdown] but has failed to stop it. This is very likely to create a memory leak. janv. 20, 2014 9:53:18 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/myapp] appears to have started a thread named [AWT-EventQueue-0] but has failed to stop it. This is very likely to create a memory leak. How could I force the JFrame to be closed? Or I am doing it all wrong? (what's the right way then?) Thanks
tagged with: jframe
type: UnansweredQuestion
has title: Tomcat servlets and JFrame
tagged with: java
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/a/21187179
has comment: http://stackoverflow.com/comment/31902675
downvote count: 0
score: 3
has body: You need a derby driver installer in the application server for this to work. It is not enough to include it in your application itself. The simplest way to do so for the Java distributions at the time the question was asked, as I believe Derby is included in the JDK, is to tell JBoss to use the JDK instead of the default JRE.
answers question: http://stackoverflow.com/q/21186997
upvote count: 3
type: Answer

http://stackoverflow.com/a/21271576
has comment: http://stackoverflow.com/comment/32084934
answers question: http://stackoverflow.com/q/21271351
downvote count: 0
has body: for (int i = 0; i &lt; a.length; ++i) { System.out.print(a[i]); System.out.print(b[i]); }
has comment: http://stackoverflow.com/comment/32051687
has comment: http://stackoverflow.com/comment/32051067
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/32171867
comment on: http://stackoverflow.com/a/21329863
type: AnswerComment
score: 0
type: Comment
has text: I didn't mean it that literally :-)

http://stackoverflow.com/comment/31943414
has text: @user3210676 Do you enter in your if condition? Try to print to the log to see what happends.
comment on: http://stackoverflow.com/a/21210939
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21293528
has comment: http://stackoverflow.com/comment/32089337
score: 0
answer count: 3
has title: How to display a text in textArea?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21297194
tagged with: swing
has answer: http://stackoverflow.com/a/21294601
tagged with: java
has body: I'm trying to display the public key of X.509 certificate in a textArea in a GUI instead of using System.out.println(). When I tried to display it inside the textArea using setText(), it didn't show it inside the textArea. The following method readCertificate extract the fields of the certificate and ActionPerformed(ActionEvent e) is simply a bottom that activate the action: public void actionPerformed(ActionEvent e){ File f = new File("/Users/AhmadAseeri/Desktop/cer.cer"); Read r = new Read(); r.readCertificate(f); } public void readCertificate(File f) throws Exception { CertificateFactory cf = CertificateFactory.getInstance("X.509"); BufferedInputStream in = new BufferedInputStream(new FileInputStream(f)); while (in.available() &gt; 0) { Certificate cert = cf.generateCertificate(in); String c=String.valueOf(cert.getPublicKey()); JTextArea textArea= new JTextArea(); textArea.setText(c); } in.close(); }
type: Question
has comment: http://stackoverflow.com/comment/32090976
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/32089209
has answer: http://stackoverflow.com/a/21296240

http://stackoverflow.com/comment/31941918
score: 0
type: Comment
has text: `Exception in thread "main" javax.imageio.IIOException: Can't read input file!` `at javax.imageio.ImageIO.read(ImageIO.java:1301)` `at Project6b.grayscale(Project6b.java:23)` `at Project6b.main(Project6b.java:18)` `Press any key to continue...`
type: AnswerComment
comment on: http://stackoverflow.com/a/21210153

http://stackoverflow.com/q/21275650
linked to: http://stackoverflow.com/q/7924961
possible better answer: http://stackoverflow.com/a/21275762
has body: Following code compiles and gives 1 as output, its a bit confusing for me. I tried javap for this but from there also I couldn't figure out. I have checked for similar posts but couldn't find out similar question here. Take look at the code: int i = (byte) + (char) - (int) + (long) - 1; System.out.println(i); here is bytecode for it Compiled from "Test.java" public class Test { public Test(); public static void main(java.lang.String[]); } How the types are working here? is it dependent of size of datatype? How the code is working?
has answer: http://stackoverflow.com/a/21275762
accepted answer: http://stackoverflow.com/a/21275727
upvote count: 15
duplicate of: http://stackoverflow.com/q/7924961
score: 13
type: AnsweredQuestion
tagged with: types
favorite count: 0
has answer: http://stackoverflow.com/a/21275727
type: Question
answer count: 2
has title: confusing code, compiles fine. How this code works?
has comment: http://stackoverflow.com/comment/32057991
tagged with: java
has comment: http://stackoverflow.com/comment/32058093
downvote count: 2

http://stackoverflow.com/q/21323543
score: 2
has comment: http://stackoverflow.com/comment/32142530
has title: Java ObjectInputStream: How to check for new data?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21323786
has comment: http://stackoverflow.com/comment/32142930
has comment: http://stackoverflow.com/comment/32142920
tagged with: java
duplicate of: http://stackoverflow.com/q/1501378
has comment: http://stackoverflow.com/comment/32143494
tagged with: objectinputstream
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/21323670
accepted answer: http://stackoverflow.com/a/21323670
answer count: 3
has comment: http://stackoverflow.com/comment/32142849
has comment: http://stackoverflow.com/comment/32143037
downvote count: 0
has answer: http://stackoverflow.com/a/21323802
favorite count: 0
has comment: http://stackoverflow.com/comment/32142661
has answer: http://stackoverflow.com/a/21323786
has comment: http://stackoverflow.com/comment/32143419
has comment: http://stackoverflow.com/comment/32142809
tagged with: io
has comment: http://stackoverflow.com/comment/32142564
linked to: http://stackoverflow.com/q/1501378
has body: I am using Java and ObjectInputStream and ObjectOutputStream to write a TCP client/server pair. The server sends data through the ObjectOutputStream, and the client receives the data in the ObjectInputStream. Part of the client code is below: try { newMessage = (Message) in.readObject(); System.out.println(newMessage); } catch (Exception e) { // temporary System.out.println(e); } Unfortunately readObject() is a blocking method, which means that if there is no new Object in the ObjectInputStream, it will simply wait until one arrives. (Note: Unlike readInt(), readObject() does not throw an EOFException when the EOF has been reached.) This is a problem: This may be in a separate thread, but I do not want the thread to hang while waiting for a new message to arrive. I would rather use a Timer to schedule a periodic check of ObjectInputStream. How can I check whether there is new data in the ObjectInputStream, so that I can avoid calling readObject() when there is no new data?
has comment: http://stackoverflow.com/comment/32142588
has comment: http://stackoverflow.com/comment/32142777
has comment: http://stackoverflow.com/comment/32142797

http://stackoverflow.com/q/21237695
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/32016303
has title: Adding a table on the bottom of existing content on a PDF page with Itext
score: 0
accepted answer: http://stackoverflow.com/a/21259806
has comment: http://stackoverflow.com/comment/32014843
tagged with: itext
has body: I am trying to produce a document from a PDF template with forms, where the second page should be repeated N types with different form values. For such a purpose, I need to copy the second page, change the fields names,set their values and start again. I have managed to do it correctly by using PdfSmartCopy, however on a page I would need to add a table just below a form. How can I correctly add a table below a form, given that I have a PdfStamper in scope?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21259806

http://stackoverflow.com/q/21185802
tagged with: web-services
tagged with: paypal
has comment: http://stackoverflow.com/comment/105343919
linked to: http://stackoverflow.com/q/21285263
tagged with: java
tagged with: jax-ws
linked to: http://stackoverflow.com/q/20154248
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21267242
has comment: http://stackoverflow.com/comment/31992059
has answer: http://stackoverflow.com/a/21389150
has comment: http://stackoverflow.com/comment/32249734
has body: I want to use paypal as a payment process in my application. At paypal they have shown many ways as using REST API, classic api, and also using SOAP API. I am trying to use SOAP client by following way. 1.I am trying to create a SOAP web service client using paypal's provided wsdl file. But it's giving me error while creating client as ' unable to retieve that url',though it creates client files. 2.Created object for proxyClass, as proxy class contains all required methods like getAuthDetails,setExpressCheckout,setEndPoint etc. 3.So these method contains parameters like DetailLevelCodeType[]detailLevel,MessageElement[]_any. so what will be the value for it ? 4.As per my understanding if I am performing any operation on payapal, it should ask me first authentication parameters like username,secret, token, password of my account. When it comes to paypal using rest api, I am aware about getting access token by providing user credentials. So in soap web service client how to get that first? I didin't get any method available here for that. But I have got one way to perform authorization from this link. security credentials . So I followed these steps, now I have my username,password. In next topic they are explaining , your SOAP client must set the Username, Password elements to pass an API username/password combination in the SOAP request header. So I am trying in this way to add username,password in request header reference. This process includes marshalling. //packages used so far import javax.xml.ws.Binding; import javax.xml.ws.BindingProvider; import javax.xml.ws.handler.Handler; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; import javax.xml.bind.Marshaller; import javax.xml.rpc.ServiceException; import javax.xml.soap.SOAPHeader; public static void main(String[] args) { // TODO Auto-generated method stub PayPalAPIAAInterfaceProxy proxy=new PayPalAPIAAInterfaceProxy(); // proxy.setEndpoint(""); // following class is generated by wsdl2java uti…
tagged with: soap
has comment: http://stackoverflow.com/comment/31992356
has comment: http://stackoverflow.com/comment/105343917
linked to: http://stackoverflow.com/q/10654608
favorite count: 0
has title: Use paypal with java
score: 2
has comment: http://stackoverflow.com/comment/105343918
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/21218130
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/21218055
score: 2
has comment: http://stackoverflow.com/comment/31956105
has body: The data structure you'll need to hold this associative array (Map) is: Map&lt;String, List&lt;String&gt;&gt; map; When you split first record you can store it in a List&lt;String&gt; called headers When you split next records then insert into this map using: String[] vals = str.split("\\s*,\\s*"); for (int i=0; i&lt;vals.length; i++) { List&lt;String&gt; cols = map.get(headers.get(i)); if (cols == null) cols = new ArrayList&lt;String&gt;(); cols.add(vals[i]); map.put(headers.get(i), cols); }
downvote count: 0
has comment: http://stackoverflow.com/comment/31956181
has comment: http://stackoverflow.com/comment/31955925

http://stackoverflow.com/comment/32014702
comment on: http://stackoverflow.com/q/21250553
type: Comment
type: QuestionComment
has text: Thanks, I now have the result I was first expecting. I didn't realize that the Java 7 Update 51 left the previous version (Update 45) intact.
score: 0

http://stackoverflow.com/q/21323037
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32141948
tagged with: java.util.scanner
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21323423
upvote count: 1
has answer: http://stackoverflow.com/a/21323389
type: Question
has title: Read text file for integers and storing to array using scanner and exceptions
tagged with: arrays
tagged with: file-io
answer count: 3
has answer: http://stackoverflow.com/a/21323352
downvote count: 0
has comment: http://stackoverflow.com/comment/32141970
has answer: http://stackoverflow.com/a/21323423
favorite count: 0
possible better answer: http://stackoverflow.com/a/21323352
tagged with: exception
has body: I'm trying to loop through a text file for integers and store integers found into an array. Using a try-catch to determine which words are integers and which are not using InputMismatchException, removing the non-int strings from the input stream. As well as a NoSuchElementException for blank lines in the file. My main issue is storing the integers and printing those integers in the array, in my second method :o . It also appears my loop is also recording non-ints as null as well. They aren't suppose be stored into the array. public static void main(String[] commandlineArgument) { Integer[] array = ReadFile6.readFileReturnIntegers(commandlineArgument[0]); ReadFile6.printArrayAndIntegerCount(array, commandlineArgument[0]); } public static Integer[] readFileReturnIntegers(String filename) { Integer[] array = new Integer[1000]; // connect to the file File file = new File(filename); Scanner inputFile = null; try { inputFile = new Scanner(file); } // If file not found-error message catch (FileNotFoundException Exception) { System.out.println("File not found!"); } // if connected, read file if (inputFile != null) { // loop through file for integers and store in array while (inputFile.hasNextLine()) { for(int i = 0; i&lt;array.length; i++) { try{ array[i] = inputFile.nextInt(); } catch(InputMismatchException excep1) { String word = inputFile.next(); } catch(NoSuchElementException excep2){ } } } } return array; } public static void printArrayAndIntegerCount(Integer[] array, String filename) { //prints number of integers from file //prints each integer in array } }

http://stackoverflow.com/a/21247916
has comment: http://stackoverflow.com/comment/32053406
type: Answer
has body: The JLS states Every field declaration in the body of an interface is implicitly public, static, and final. It is permitted to redundantly specify any or all of these modifiers for such fields. Therefore, the field score in your example is not inherited since it is static.
answers question: http://stackoverflow.com/q/21247902
has comment: http://stackoverflow.com/comment/32053749
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/32030133
downvote count: 0
has comment: http://stackoverflow.com/comment/32053779
has comment: http://stackoverflow.com/comment/32029692

http://stackoverflow.com/q/21279220
tagged with: broadcastreceiver
has comment: http://stackoverflow.com/comment/32064404
possible better answer: http://stackoverflow.com/a/21282375
has comment: http://stackoverflow.com/comment/32063778
tagged with: notifications
answer count: 2
has comment: http://stackoverflow.com/comment/32064441
has answer: http://stackoverflow.com/a/21282662
accepted answer: http://stackoverflow.com/a/21282662
has body: I would like to create a custom notification service in my app. I wouldn't use the google service (google cloud messaging). Is there a way to create a daemon that check every X seconds a particular condition on my app db and show a notification? Thank you, edit I call this method in MainActivity's oncreate(). I get the times from my db private void restartNotify() { AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(this, AlarmReceiver.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); am.cancel(pendingIntent); ArrayList&lt;String&gt; item = new ArrayList&lt;String&gt;(); item = GetLists.GetTimesListForNotification(this); for (int i = 0; i &lt; item.size(); ++i) { String time = item.get(i); int Position = time.indexOf(":"); int hour = Integer.parseInt(time.substring(0, Position)); int min = Integer.parseInt(time.substring(Position + 1)); Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, hour); cal.set(Calendar.MINUTE, min); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); am.set(AlarmManager.RTC, cal.getTimeInMillis(), pendingIntent); } And this is my broadcast receiver public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { NotificationManager mManager; mManager = (NotificationManager) context.getApplicationContext() .getSystemService( context.getApplicationContext().NOTIFICATION_SERVICE); Intent intent1 = new Intent(context.getApplicationContext(), MainActivity.class); Notification notification = new Notification(R.drawable.ic_launcher, "New message to read", System.currentTimeMillis()); intent1.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingNotificationIntent = PendingIntent.getActivity( context.getApplicationContext(), 0, intent1, PendingIntent.FLAG_UPDATE_CURRENT); notification.flags |= Notification.F…
has comment: http://stackoverflow.com/comment/32064228
favorite count: 0
upvote count: 1
tagged with: android
has answer: http://stackoverflow.com/a/21282375
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has title: How to create a custom notification in android

http://stackoverflow.com/q/21237877
type: UnansweredQuestion
has title: Is this a correct BubbleSort Algorithm?
tagged with: bubble-sort
favorite count: 0
has comment: http://stackoverflow.com/comment/31991538
type: Question
has body: I wrote the following code to sort the elements in the array values using a BubbleSort. Is this correct or is there anything missing? My test cases are good, but maybe it's the test cases that are also missing something. public void sort(ValuePair[] values) { ValuePair value = null; for (int i = 0; i &lt; values.length; i++) { for (int j = 1 + i; j &lt; values.length; j++) { if (values[i].getValue() &gt; values[j].getValue()) { value = values[j]; values[j] = values[i]; values[i] = value; } } } }
has comment: http://stackoverflow.com/comment/31991523
has comment: http://stackoverflow.com/comment/31991870
score: -1
has answer: http://stackoverflow.com/a/21238382
has comment: http://stackoverflow.com/comment/31991633
has comment: http://stackoverflow.com/comment/31991670
tagged with: java
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/31991660
answer count: 1
has comment: http://stackoverflow.com/comment/31991690

http://stackoverflow.com/a/55632910
type: Answer
answers question: http://stackoverflow.com/q/21328099
has body: Thanks all. On a Windows 7 machine apparently running under the Netbeans IDE path names are not case sensitive - but running the JAR file under Java Se 8.2 on the same machine file names suddenly are case sensitive.
score: 0

http://stackoverflow.com/q/21270925
has body: Lets say I have a test case in a Java based Gradle project that requires an image to be present to complete, and that the image is largish (~100MB). For example, maybe a test needs to read pixel data from an image so that it can confirm that some CV algorithm is completing consistently. It would be pretty straight forward to just add this data to a directory in the project, such as src/test/data, and check the data into version control with everything else, but that makes the repository very large and requires a copy of the image also be checked into every other project that wishes to use it. Is there a way to package this image so that it may be added to a network repository such as Nexus or Artifactory and then pulled in to a project using the Gradle dependency mechanism? If so, how would I then reference the image from within my test case? Edit: This is the solution I ended up going with. Publish an artifact containing the test data. In this case I decided to actually bundle multiple test images into a zip file and publish it like that. Add the following to my gradle.build file: configurations { testData } dependencies { testData group: 'com.company', name: 'testData', version: '1.0', ext: 'zip' } task unzip(type: Copy) { def outputDir = file("${buildDir}/unpacked/dist") from {zipTree(configurations.testData.singleFile)} into outputDir } test { dependsOn unzip systemProperties 'testDataDir': file("${buildDir}/unpacked/dist") } This will add a new configuration to hold the test data in, as well as a new task to unzip the data. Note that the brackets around zipTree(configurations.testData.singleFile) are important because they create a closure that ensures that the path is only resolved at build time. Without them, the test data is downloaded whenever the build script is run, not just when the test task is. The last block in there configures the test task to depend on the unzip one, and then to pass the location of the files into the tests as a system property. You…
tagged with: nexus
tagged with: artifactory
has answer: http://stackoverflow.com/a/21271359
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21271179
tagged with: gradle
type: Question
possible better answer: http://stackoverflow.com/a/21271179
accepted answer: http://stackoverflow.com/a/21271359
score: 0
answer count: 2
has title: Can I use gradle to retrieve test data dependancies?

http://stackoverflow.com/comment/31935088
has text: I believe that I am writing to the file in the Bank Class, inside of the newUser method, so every time a new user is created they would get stored inside of the file. I'm still struggling with pulling down each user, and storing them into a user object that's unique. Do I have to pull every user from the list down? I was thinking to just pull the one that has a matching username and password, then when the user is done adding or withdrawing money, overwrite the user in the file with the updated info... problem is I'm not even sure where to begin.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21198091
type: AnswerComment

http://stackoverflow.com/a/21269655
answers question: http://stackoverflow.com/q/21268595
has comment: http://stackoverflow.com/comment/41454778
has comment: http://stackoverflow.com/comment/53637316
has comment: http://stackoverflow.com/comment/50661295
has comment: http://stackoverflow.com/comment/69530343
has body: There is some misplacement of directories in your project as shown in attached screenshot. Your main directory should be inside the src directory and IInAppBillingService.aidl must be on the below mentioned path /src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl so create a directory inside your main and then create the package as mentioned and put your .aidl file inside. Make the necessary changes and sync Your project with gradle.
score: 45
downvote count: 0
upvote count: 45
type: Answer

http://stackoverflow.com/a/21349766
type: Answer
score: 2
has body: You declared people_selected but you're using selected_people?! Which is never filled...
answers question: http://stackoverflow.com/q/21349733
has comment: http://stackoverflow.com/comment/32189495
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/32152706
comment on: http://stackoverflow.com/q/21329215
has text: @ThomasMueller I would call this subtyping, not overloading.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32160378
type: Comment
has text: Thanks. It's rather unfortunate that the logging system you're using decides not to display helpful messages like the one you've included there by default (my personal preference would be a system that displays all messages unless configured otherwise) and that as I haven't figured out how to configure logging yet, I missed it. :(
comment on: http://stackoverflow.com/a/21299331
type: AnswerComment
score: 0

http://stackoverflow.com/a/21301908
has body: Learn JPA-Hibernate, remove the XStream annotations from the domain objects, add JPA annotations on the domain objects and replace the SolutionDao class with something that uses EntityManager instead of XStream.
answers question: http://stackoverflow.com/q/21281989
accepted answer of: http://stackoverflow.com/q/21281989
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32151546
score: 0
has comment: http://stackoverflow.com/comment/32149589
type: Answer
has comment: http://stackoverflow.com/comment/32151073

http://stackoverflow.com/q/21187863
tagged with: chaining
possible better answer: http://stackoverflow.com/a/21188234
tagged with: generics
has comment: http://stackoverflow.com/comment/31902187
favorite count: 0
has comment: http://stackoverflow.com/comment/31902012
has title: Multiple levels of subclasses and method chaining
has body: I am working on the following structure: Buffer XBuffer extends Buffer XYBuffer extends XBuffer All objects should be instantiable, so no abstract, in order to support forward compatability. I have came up with the following, with pitfalls/issues I will describe below: public class Buffer&lt;S extends Buffer&lt;S&gt;&gt; { protected final int bufferType; protected final int bufferDataType; protected int bufferId; protected boolean created; public Buffer(final int bufferType, final int bufferDataType) { this.bufferType = bufferType; this.bufferDataType = bufferDataType; } @SuppressWarnings("unchecked") public S create() { assertNotCreated(); bufferId = GL15.glGenBuffers(); created = true; return (S)this; } @SuppressWarnings("unchecked") public S bind() { assertCreated(); GL15.glBindBuffer(bufferType, bufferId); return (S)this; } @SuppressWarnings("unchecked") public S fillData(final float[] data) { assertCreated(); FloatBuffer dataBuffer = BufferUtils.createFloatBuffer(data.length).put(data); dataBuffer.flip(); GL15.glBufferData(bufferType, dataBuffer, bufferDataType); return (S)this; } public void delete() { assertCreated(); GL15.glDeleteBuffers(bufferId); } public int getBufferId() { return bufferId; } public boolean hasBeenCreated() { return created; } private void assertCreated() { if (!hasBeenCreated()) { throw new RuntimeException("Buffer has not been created."); } } private void assertNotCreated() { if (hasBeenCreated()) { throw new RuntimeException("Buffer has been created already."); } } @Override public String toString() { return "Buffer(" + bufferType + ", " + bufferDataType + ", " + bufferId + ", " + created + ")"; } } public class ArrayBuffer&lt;S extends ArrayBuffer&lt;S&gt;&gt; extends Buffer&lt;S&gt; { public ArrayBuffer(final int bufferDataType) { super(GL15.GL_ARRAY_BUFFER, bufferDataType); } } public class StaticDrawArrayBuffer extends ArrayBuffer&lt;StaticDrawArrayBuffer&gt; { public StaticDrawArrayBuffer() { super(GL15.GL_STATIC_DRAW); } } Now th…
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/31902095
score: 1
has comment: http://stackoverflow.com/comment/31902411
tagged with: java
has answer: http://stackoverflow.com/a/21188234
type: Question
has comment: http://stackoverflow.com/comment/31901847
upvote count: 1
has answer: http://stackoverflow.com/a/21188347
accepted answer: http://stackoverflow.com/a/21188247
has comment: http://stackoverflow.com/comment/31902196
tagged with: inheritance
has comment: http://stackoverflow.com/comment/31902958
answer count: 3
tagged with: subclass
has answer: http://stackoverflow.com/a/21188247

http://stackoverflow.com/comment/70830307
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25621702
has text: Just found you can use @RequestScoped annotation, e.g.

http://stackoverflow.com/a/21277508
has body: instead of while, you can try If condition and remove the last print. public static void call(int x) { System.out.print(x+"\n"); if (x&gt;0) { x--; call(x--); } }
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21277156
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32060983

http://stackoverflow.com/q/21313177
has answer: http://stackoverflow.com/a/21313513
tagged with: algorithm
has comment: http://stackoverflow.com/comment/32123753
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/21315398
has comment: http://stackoverflow.com/comment/32123829
favorite count: 0
type: UnansweredQuestion
has body: I'm working on a coding project, and I am having a problem with the speed of the program. The program takes an input between 1 and 80, this input represents a number of match sticks, and outputs how many different numbers can be made with that number of match sticks. Ex: The number 1 can be formed with 2 match sticks, and the number 2 requires 5 match sticks Here is the full prompt of the program: Here is my code to the algorithm I came up with to compute all the possible out comes, it functions fairly well for the lower end of the inputs although it becomes highly inefficient for large inputs such as 80 taking hours to compute all the possibilities. How can I cut this time down to a minimum? n represents the input, and all the Counter object does is keep track of each possible number created public static void digitCounter(int n, Counter count) { if (n &lt; 2) { //ouput } else { if (count.getCount() == 0) { // If there are enough match sticks to form it // accounts for 0 only once if (n &gt;= 7) { // counts 0 count.setCount(10); // counts 1 digitCounter(n - 2, count); // counts 2 digitCounter(n - 5, count); // counts 3 digitCounter(n - 5, count); // count 4 digitCounter(n - 4, count); // counts 5 digitCounter(n - 5, count); // counts 6 digitCounter(n - 6, count); // counts 7 digitCounter(n - 3, count); // counts 8 digitCounter(n - 7, count); // counts 9 digitCounter(n - 5, count); } else if (n == 6) { count.setCount(9); digitCounter(n - 2, count); digitCounter(n - 5, count); digitCounter(n - 5, count); digitCounter(n - 4, count); digitCounter(n - 5, count); digitCounter(n - 6, count); digitCounter(n - 3, count); digitCounter(n - 5, count); } else if (n == 5) { count.setCount(7); digitCounter(n - 2, count); digitCounter(n - 5, count); digitCounter(n - 5, count); digitCounter(n - 4, count); digitCounter(n - 5, count); digitCounter(n - 3, count); digitCounter(n - 5, count); } else if (n == 4) { count.setCount(3); digitCounter(n - 2, count); digitCounter(n - 4, count);…
downvote count: 0
score: 1
tagged with: java
has title: Recursive Algorithm Effiency - Java
has comment: http://stackoverflow.com/comment/32131774
type: Question
tagged with: recursion
has answer: http://stackoverflow.com/a/21314797
tagged with: performance

http://stackoverflow.com/comment/32004069
type: QuestionComment
score: 0
has text: For me, the code above throws an exception. "java.text.ParseException". Unparseable Date "Mon Jan 20 00:00:00 BRT 2014" (at offset 0).
comment on: http://stackoverflow.com/q/21244760
type: Comment

http://stackoverflow.com/q/21335205
linked to: http://stackoverflow.com/q/21232304
score: 0
answer count: 2
tagged with: junit
has body: I'm using TestNG 6.5.1. So I have test methods B and C that depends on test method A. Is there a way to run method A before running method B and also again before running method C? I know that the obvious way would be to just call the method but I don't want that because if the method A fails I don't want for method C to fail also, but to be skipped. If you have just these three methods it would seem stupid to ask for another way, but when you have a much complex dependency tree than everything changes...
possible better answer: http://stackoverflow.com/a/21383493
has title: TestNG run dependent methods every time
has answer: http://stackoverflow.com/a/21383493
tagged with: testng
type: AnsweredQuestion
tagged with: java
tagged with: integration-testing
type: Question
tagged with: testing
has answer: http://stackoverflow.com/a/21347970
accepted answer: http://stackoverflow.com/a/21347970

http://stackoverflow.com/a/21314012
has comment: http://stackoverflow.com/comment/32125135
answers question: http://stackoverflow.com/q/21313643
type: Answer
has body: Use Apaches httpcomponets/httpclient library to generate and send the post request. Anything else is far to much work for no gain. See https://hc.apache.org/httpcomponents-client-ga/quickstart.html
downvote count: 1
upvote count: 0
score: -1

http://stackoverflow.com/comment/32055022
score: 0
type: Comment
type: QuestionComment
has text: Yes thank you that is good enough for what I wanted, if you have ever loaded minecraft feed the beast server, the console that is in the background is what I am after, but this will do.
comment on: http://stackoverflow.com/q/21273381

http://stackoverflow.com/a/24587212
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21300132
has body: you could use multi-threading and make for example 2 pointers, one travel from the start of the array and one form the end till the middle of the array. It will use more processing but less time.

http://stackoverflow.com/q/21290739
type: Question
has answer: http://stackoverflow.com/a/21306665
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21290949
tagged with: osgi
has answer: http://stackoverflow.com/a/21290949
tagged with: maven
accepted answer: http://stackoverflow.com/a/21306665
has body: I have been dealing with maven and osgi for a few weeks time now and still get confused regarding dependencies and bundles/packages/plug-ins. Mainly i cant understand what they are. Because im new to both java and osgi/maven its hard for me to visualize how they are connected or what is a part of the other. So not to be too vague ill try to ask a bunch of specific questions. 1) As i understand bundles and plug-ins are same things - just different name. Is package also the same thing? I found many debates on the topic "should i use import-package or require-bundle" but i cant really understand them before i understand what a package or bundle is. 2) Dependencys. For example if i want to use slf4j api i add this dependency: org.slf4j slf4j-api 1.7.5 But what does that really mean? I understand that adding the dependency will make the usage of slf4j available to me. Can i assume that the "thing" im depending on is just a compiled project (like the one i make locally) somewhere in maven repository? 3) Osgi bundles. If my previous notion is correct (dependencys are like projects) then are bundles like packages under project? If so then i assume that one dependency may add the possibility of adding multiple osgi plugins. If so then where can i see what dependency makes what imports available. Im asking this because i noticed that the name i write under import-package isnt always the same in the dependency. 4) When launching osgi configuration in eclipse i have to select plug-ins. There are some i can select from under target platform and as i understand i have to select all the plugins i imported in manifest. What is this target platform and where did those plugins get there? These are long (and probably really stupid questions) so i really appreciate any help. Thanks! :)
type: AnsweredQuestion
tagged with: java
has title: Confusion about maven, osgi and eclipse

http://stackoverflow.com/comment/32106277
type: Comment
comment on: http://stackoverflow.com/q/21302240
score: 0
type: QuestionComment
has text: Strange question. It “knows” because you told it so. Maybe you try to explain what you think could stop it from “knowing”.

http://stackoverflow.com/comment/31962547
score: 0
type: AnswerComment
type: Comment
has text: is not that simple, man! I can't how to create the Intent in the switch class??? in the tutorial they used Intent intent = new Intent(this, DisplayMessageActivity.class); It does not work
comment on: http://stackoverflow.com/a/21221623

http://stackoverflow.com/a/21187792
downvote count: 0
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21186494
upvote count: 2
has body: As noted in the comments, you do not need a java.class file. You can keep your data in a serialized format (XML, JSON, your custom way). For example lets have a String called questionJson: JSON: { "questionBody": "How much is 2+2?", "answers":["2","3","4","How should I know?"], "correctAnswerIndex": "2" } You'd have a class like: class Question{ public String questionBody; public String[] answers; public int correctAnswerIndex; } Using google's Gson library: Gson gson = new Gson(); Question question= gson.fromJson(questionJson, Question.class);
answers question: http://stackoverflow.com/q/21186494
type: AcceptedAnswer

http://stackoverflow.com/comment/31987600
type: Comment
has text: Why can't you add a second constructor?
type: AnswerComment
comment on: http://stackoverflow.com/a/21195604
score: 0

http://stackoverflow.com/comment/31912731
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21193714
has text: @SvetlinZarev, I can make this loop faster with my OS customization, is possible to achieve less than 1054ms?

http://stackoverflow.com/a/21240266
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21236968
upvote count: 2
has body: I need to disable modify\delete current content in component by users. textArea.setEditable( false ); Users may only add\insert some text at the end, but setText method must work as usual. You should have an "Add Text" button that will take text from a separate text field and then append the text to the Document using the append(...) method of the JTextArea.
type: Answer

http://stackoverflow.com/a/21311029
has body: You can do: Process p2 = runtime.exec("c:\\windows\\system32\\taskkill /IM program.exe") it is a standard kill not a forceful one (that requires /F), hence it will simply notify the program it should terminate spontaneously. I could not try with your program, but I opened notepad typed some text and before saving, I used this way to terminate it and notepad asked me if I wanted to save my work. With the /F option notepad was terminated immediately leaving the file unsaved. This is the same difference you have in unix between kill vs and kill -9. Note that this will terminate all the instances of you process, otherwise you should use the pid. And if your program upon signaling will be able to comply and try to close the open connections and terminate, it will depend on the program itself.
answers question: http://stackoverflow.com/q/21309882
score: 1
downvote count: 0
upvote count: 1
type: Answer

http://stackoverflow.com/q/21285515
favorite count: 0
linked to: http://stackoverflow.com/q/2043614
has comment: http://stackoverflow.com/comment/32075315
downvote count: 2
upvote count: 1
tagged with: excel
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32075832
has answer: http://stackoverflow.com/a/21296539
tagged with: math
tagged with: java
score: -1
tagged with: apache-commons-math
type: Question
has comment: http://stackoverflow.com/comment/32095568
has body: I do have mathematical formulas like, (3.14*2.500^2)/4 IF(45.0=0,0,1/42.9^2) Which are formulas derived from Excel formulas. I need to get result of these kind of formulas using java only. I come across helpful link. Can you please advice me for best way doing this? Do we have anything where we can directly put this formula and get result? Do I need to Tokanize the string and calculate it using basic Java Math package? If I have to Tokanize only then which is the best basic Math package or Commons Math?
has comment: http://stackoverflow.com/comment/32075856
accepted answer: http://stackoverflow.com/a/21296539
has title: Formula calculations in Java
answer count: 1
linked to: http://stackoverflow.com/q/7258538

http://stackoverflow.com/a/21226952
has comment: http://stackoverflow.com/comment/31974454
upvote count: 5
answers question: http://stackoverflow.com/q/21226850
has comment: http://stackoverflow.com/comment/31971964
has comment: http://stackoverflow.com/comment/31997882
score: 5
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31973791
has comment: http://stackoverflow.com/comment/31971918
has comment: http://stackoverflow.com/comment/31972588
has body: $ matches end of string so try: [\\.,;:\-_]+$ Since \ is special regular expression characters you should escape it with \ so it becomes \\ in regular expression. Also - in character class has special meaning because it is used to create range of characters like a-z so you will need to escape it. Also since you are asking about Java you need to know that \ need to be written as "\\" because it is also special character in String literal, so String with regex will look like "[\\\\.,;:\\-_]+$"
has comment: http://stackoverflow.com/comment/31972244
has comment: http://stackoverflow.com/comment/31972042

http://stackoverflow.com/q/21260209
type: Question
has answer: http://stackoverflow.com/a/21261018
accepted answer: http://stackoverflow.com/a/21261018
has comment: http://stackoverflow.com/comment/32031265
tagged with: jsp
has body: How can I convert a string from a form input (easyui-datetimebox, in case) to a Calendar property in an object in Controller, autobinded by Spring? I've read http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/validation.html but I couldn't find anything nearly right-to-the-point there. JSP: &lt;input id="DeadLineDate" class="easyui-datetimebox" name="DeadLineDate" value="${SessionDeadLineDate}" data-options="formatter:myformatter, parser:myparser /&gt; When submited, Spring validation throws an error: Failed to convert property value of type java.lang.String to required type java.util.Calendar for property DeadLineDate; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.util.Calendar] for property DeadLineDate: no matching editors or conversion strategy found. PS: Spring 3 Edit: adding controller's method to perform operation: @Controller @RequestMapping("/project/MaintainProjectFrm") @SessionAttributes({"project","SessionDeadLineDate"}) public class MaintainProjectController { /* ... many methods... */ @RequestMapping(params = "update", method = RequestMethod.POST, produces={"text/plain; charset=UTF-8"}) public String update(@ModelAttribute("project") Project project, BindingResult result, SessionStatus status, ModelMap model, HttpServletRequest req, HttpServletResponse resp) throws IOException { projectValidator.validate(project, result); if (result.hasErrors()) { //has errors, in this case, that one shown in text above, which is rendered again in view (JSP) return "/project/MaintainProjectFrm"; } else { try{ mpService.updateProject(project); } catch(Exception e){ resp.setStatus(500); resp.getWriter().write("Error updating project: " + e.getMessage()); return "/project/MaintainProjectFrm"; } status.setComplete(); } } /* ... yet other methods ... */ }
has title: Spring: Convert String from View to a Calendar Object
favorite count: 0
upvote count: 3
possible better answer: http://stackoverflow.com/a/21260934
answer count: 3
has comment: http://stackoverflow.com/comment/32030278
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/21260934
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/29905245
has comment: http://stackoverflow.com/comment/32030864

http://stackoverflow.com/comment/31993644
type: Comment
has text: I actually have my own gameobject classes like enemie, which stores health, Speed and weapon he is holding. Then i have a class GraphicObject which extend Image. For enemie i have then a subclass GraphicEnemie, which extends GraphicObject and in itself it has a reference to a object of type enemie. In the act() method i move the graphic accordingly the Speed in the enemie object. Do you think this is a good way or will it get to complicated if i add more Content like more Enemies etc?
type: AnswerComment
comment on: http://stackoverflow.com/a/21239005
score: 0

http://stackoverflow.com/comment/32052292
type: Comment
score: 0
has text: they are random no. Care to give some example of dynamically generated vs normal instantiate ?
type: AnswerComment
comment on: http://stackoverflow.com/a/21270649

http://stackoverflow.com/q/21290810
score: 0
has title: Bit Shifting wrong value
has body: I have a problem, I need to convert coordinates using shift, and after that convert them back to original but it returns not the same value (min,max values can't be changed..). int x = 1000; int y = -1000; int minx = -294912; // can't be changed. int miny = -262144; // can't be changed. //Convert int convertedX = x - minx &gt;&gt; 4; int convertedY = y - miny &gt;&gt; 4; //Convert back int originalX = (convertedX &lt;&lt; 4) + minx; int originalY = (convertedY &lt;&lt; 4) + miny; System.out.println(originalX + " " + originalY + " - After Convert Back");
has answer: http://stackoverflow.com/a/21290860
accepted answer: http://stackoverflow.com/a/21290860
has comment: http://stackoverflow.com/comment/32084803
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21290914
tagged with: java
has answer: http://stackoverflow.com/a/21290914
type: Question
answer count: 2

http://stackoverflow.com/comment/32126746
type: Comment
has text: A "reference" is a memory address. You don't know what the memory address will be on the remote system, so I'd say officially "no". However, you can send a complete copy of an object, and reconstruct a replica over on the remote side. Some call this serialization, some call this "marshaling", but in essence you would have 2 exacting replicas. But, those replicas are just that...replicas. Changing on will not effect a change in the other, unless you are syncronizing your objects somehow manually.
score: 1
comment on: http://stackoverflow.com/q/21314914
type: QuestionComment

http://stackoverflow.com/a/21244650
answers question: http://stackoverflow.com/q/21244563
type: Answer
has body: Probably add a KeyListener to JTextField1 and update the text of JTextField2 accordingly. (Although you might need a MouseMotionListener too to handle drags too.)
score: 0

http://stackoverflow.com/comment/31990217
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21236864
has text: When trying to go with Team->Share, I can see the sources from the src dir in the project under revision control, but the same sources in the package tree view aren't... I'm at a loss.

http://stackoverflow.com/a/21237199
score: 1
has comment: http://stackoverflow.com/comment/32029681
has comment: http://stackoverflow.com/comment/32062973
has comment: http://stackoverflow.com/comment/32035425
answers question: http://stackoverflow.com/q/21236979
has body: Your test is failing at your driver.findElement in your for loop because in the first iteration, it is selecting the first window and attempting to find that link. If that link doesn't exist in your parent window (not the popup window), then your test will fail at this step. If there are only 2 windows open, then you should do: public void test() throws Exception{ driver.findElement(By.xpath("//img[@alt='Calender']")).click(); String Parent_Window =driver.getWindowHandle(); String Child_Window = driver.getWindowHandles().iterator().next(); driver.switchTo().window(Child_Window); driver.findElement(By.xpath("//div[@class='pbBody']//table[@class='list']//tr[@class='dataRow even first']//a")).click(); driver.switchTo().window(Parent_Window); } Alternatively, if you use the getting started with selenium framework your test would look like: @Config(url="http://testsite.com") public void Test extends AutomationTest { @Test public void test() { click(By.cssSelector("img[alt='Calender']")) .switchToWindow("Title of New Window") .click(By.cssSelector("div.pbBody table.list tr.dataRow.even.first a")) .switchToDefaultContent(); } }
downvote count: 0
has comment: http://stackoverflow.com/comment/32034830
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/32032000

http://stackoverflow.com/q/21274162
has comment: http://stackoverflow.com/comment/32140335
tagged with: sockets
has comment: http://stackoverflow.com/comment/32140468
answer count: 1
has comment: http://stackoverflow.com/comment/32090443
has comment: http://stackoverflow.com/comment/32140209
upvote count: 3
tagged with: tcp
tagged with: java
has title: Can a virus scan close a java TCP socket connection?
has comment: http://stackoverflow.com/comment/32056004
has answer: http://stackoverflow.com/a/23675247
downvote count: 0
has comment: http://stackoverflow.com/comment/32093415
has body: I have a java 1.6 "client" running on a managed windows 2008 server. When the "client" starts up it connects to an external machine using: socket = new Socket(host, port); This socket connection has been closing on a weekly basis with the added issue of the "server" not recognising the closed socket. So when the "client" tries to immediately reconnect, the "server" thinks its already connected and disallows another connection. We only now just realised that the timing of this coincides perfectly with the virus scanner. Could these symptoms be caused by a virus scanner? The virus software is from Symantec, but I do not know more than that. I can get those details if you think it helps.
type: UnansweredQuestion
type: Question
score: 3
tagged with: virus-scanning
favorite count: 0
tagged with: antivirus
has comment: http://stackoverflow.com/comment/32055973

http://stackoverflow.com/q/21299547
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has body: I am working on a Perlin Noise generator for my video game in Java. The problem is that whenever I run my generator then the only output I get is 0. Since I am new to Perlin Noise I am not really sure what to try, so therefore I have not tried anything except for tweaking the numbers with no change. Here is my perlin noise code: package PerlinGen; import java.util.*; public class PerlinNoiseGenerator { private Random random; private int octaves, x, y; private int[][][] heightMap; public PerlinNoiseGenerator(int octaves, int x, int y, long seed){ heightMap = new int[octaves][x][y]; this.octaves = octaves; this.x = x; this.y = y; random = new Random(seed); } public int[][] generate(int ic){ for(int co=1;co&lt;=octaves;co++){ for(int cx=0;x&lt;x;x+=Math.pow(2, co)){ for(int cy=0;y&lt;y;y+=Math.pow(2, co)){ square(co, cx, cy, (int) (cx + Math.pow(2, co) - 1), (int) (cy + Math.pow(2, co) - 1), random.nextInt(co)); } } for(int ci=0;ci&lt;ic;ci++){ for(int cx=1;x&lt;(x - 1);x++){ for(int cy=1;y&lt;(y - 1);y++){ heightMap[co][cx][cy] = ( heightMap[co][cx][cy] + heightMap[co][cx + 1][cy] + heightMap[co][cx - 1][cy] + heightMap[co][cx][cy + 1] + heightMap[co][cx][cy - 1] ) / 5; } } } } int[][] perlinNoise = new int[x][y]; for(int cx=1;x&lt;(x - 1);x++){ for(int cy=1;y&lt;(y - 1);y++){ perlinNoise[cx][cy] = 0; for(int co=1;co&lt;=octaves;co++){ perlinNoise[cx][cy] += heightMap[co][cx][cy]; } } } return perlinNoise; } private void square(int o, int sx, int sy, int ex, int ey, int v){ for(int x=sx;x&lt;ex;x++){ for(int y=sy;y&lt;ey;y++){ heightMap[o][x][y] = v; } } } } Thank you in advance to anyone who helps me :)!
upvote count: 0
tagged with: java
type: Question
score: -1
has title: Perlin Noise generating only 0
has answer: http://stackoverflow.com/a/21300532
answer count: 1

http://stackoverflow.com/comment/32103615
has text: Answer to this question will help: http://stackoverflow.com/questions/1395551/convert-a-json-string-to-object-in-java
score: 0
comment on: http://stackoverflow.com/q/21301679
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21225989
has body: When I want to compare two variables(One type Object, one type Long), I found that cannot convert Object to Long, for example: Object obj = 100; Long l_num = 100L; System.out.println(obj.equals((Object)l_num)); // print false System.out.println(((Long)obj) == l_num); // throw java.lang.ClassCastException Exception Then I can only compare the two with (obj.toString()).equals(l_num.toString()), it returns true. But, the result is different when I compare Integer with Object: Object obj = 100; Integer i_num = 100; System.out.println(((Integer)obj) == i_num); // return true System.out.println(obj.equals(i_num)); // return true System.out.println((obj.toString()).equals(i_num.toString())); // return true Is there someone kindly tell me why two results are different and is there any method better to compare Object with Long ? If it's a meaningful question you think, let's talk about it. Thanks.
tagged with: compare
has title: Compare Object and Long&Integer
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/31970291
has comment: http://stackoverflow.com/comment/31970243
tagged with: object
has answer: http://stackoverflow.com/a/21226328
tagged with: java
type: Question
answer count: 2
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/31970300
has answer: http://stackoverflow.com/a/21226042

http://stackoverflow.com/q/21186232
type: AnsweredQuestion
tagged with: compiler-errors
duplicate of: http://stackoverflow.com/q/18100785
linked to: http://stackoverflow.com/q/1660856
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31900727
duplicate of: http://stackoverflow.com/q/1660856
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/21186321
score: 4
has comment: http://stackoverflow.com/comment/31898315
has comment: http://stackoverflow.com/comment/31898242
has comment: http://stackoverflow.com/comment/31898154
has comment: http://stackoverflow.com/comment/31898199
answer count: 1
has body: I have code like this short a = 1; short b = 2 ; short c = a + b; // dosen't compile What is the reason for compilation failure? x + x always produces Integer or bigger Number, but why?
tagged with: jvm
favorite count: 0
accepted answer: http://stackoverflow.com/a/21186321
has title: Why plus operator in Java always produces Integer?
linked to: http://stackoverflow.com/q/18100785
tagged with: language-specifications
has comment: http://stackoverflow.com/comment/31898205

http://stackoverflow.com/a/21192064
upvote count: 1
has body: I want to create a button with checkbox in the right side of it. Maybe you just want the checkbox on the right side of the text? If so you can do: JCheckBox cb = new JCheckBox("Print with Edge"); cb.setHorizontalTextPosition(SwingConstants.LEADING);
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21187552
type: Answer

http://stackoverflow.com/a/21199001
has comment: http://stackoverflow.com/comment/31922605
has comment: http://stackoverflow.com/comment/31922710
upvote count: 1
has body: You could wrap the code from where you're generating the contents of the ticket up to where you display those numbers in another loop like so. for (int ticketNo = 0; ticketNo &lt; ticket_amount; ticketNo++) { for(int i = 0; i &lt; group1.length; i++) { group1[i] = 1 + (int) (Math.random() * 56); } //sort the elements Arrays.sort(group1); //group2 number int group2 = 1 + (int) (Math.random()*46); //print the ticket numbers numbers System.out.println("Your group1 ticket numbers are " + Arrays.toString(group1) + " your group2 ticket number is " + group2); }
has comment: http://stackoverflow.com/comment/31922357
has comment: http://stackoverflow.com/comment/31922270
has comment: http://stackoverflow.com/comment/31922294
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21198873

http://stackoverflow.com/comment/31897272
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21185208
has text: I'm working with WebSockets directly

http://stackoverflow.com/a/21194950
score: 4
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/31915060
type: Answer
answers question: http://stackoverflow.com/q/21194762
has comment: http://stackoverflow.com/comment/31914927
has body: Handler, Runnable, and Threads actually work together, I dont think you should compare them. Handler allows send messages between two threads in a safe manner, that means that sending thread puts message into destination thread queue, and this destination queue will process this message in its appropriate time. Runnable this is an interface that you implement, in implementation you put logic you want to execute on some thread. You can actually use Runnable also in non thread related places. Lots of Java apis actually use Runnable, not only Thread's. You can post Runnable using handler, or you can use it with executors. Runnables are nice because you can implement them in a form of anonymous implementation. UniThread you meant UI Thread? Most user interfaces implements its workings in single thread, all UI elements: windows/widgets communicate using messages (just like in Handler). Ie. user presses button, this initiates a message with information that button was pressed, it is send to UI thread and finally delivered to your listener. In Android it is forbidden (results in exception) to modify UI elements from non UI thread, this makes sense - if you would modify it from other thread this could happen while UI thread is doing some changes to the same widget - resulting in Undefined Behaviour.
has comment: http://stackoverflow.com/comment/31915030

http://stackoverflow.com/a/23162741
accepted answer of: http://stackoverflow.com/q/21275798
answers question: http://stackoverflow.com/q/21275798
score: 0
type: AcceptedAnswer
has body: The communication protocols and the data format of NFC tags are standardized by the NFC Forum. Their specifications are freely available on their web site. As the ACR122 does not provide any abstraction layer for NFC tags (or even NDEF data), you would have to design the access to NFC tags on your own (the ACR122 API guide and the PN532 user manual will help you to find the right commands for that reader).
type: Answer

http://stackoverflow.com/q/21327175
answer count: 1
has body: Have used openOrCreateDatabase to create a SQLiteDatabase associated with my application package.Wat does setVersion api do? Now my DB is getting upgraded on newer version of my app.Is there any upgrade callback? OR we need to use SQLiteOpenHelper to get upgrade callback?
score: 0
tagged with: android
tagged with: sqlite
has comment: http://stackoverflow.com/comment/32148822
has answer: http://stackoverflow.com/a/21327230
has title: Android: Sqlite DB Upgrade openOrCreateDatabase
type: AnsweredQuestion
tagged with: java
tagged with: database
type: Question
accepted answer: http://stackoverflow.com/a/21327230

http://stackoverflow.com/a/21322419
answers question: http://stackoverflow.com/q/21322375
score: 1
has comment: http://stackoverflow.com/comment/32142411
downvote count: 0
type: Answer
has body: The standard way to do this is to use the read method on the inputstream? If the data is text then you may use the readLine method. See this informative link Of course, the tread that is calling this code will block, so it would ideally this code would be in a different thread.
upvote count: 1

http://stackoverflow.com/comment/32142530
comment on: http://stackoverflow.com/q/21323543
has text: Yes, most read/write operations are blocking but I do believe some people create a new `Thread` per client connection.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32073267
score: 0
comment on: http://stackoverflow.com/q/21284557
type: QuestionComment
type: Comment
has text: What's the error? What's not working?

http://stackoverflow.com/a/21447293
accepted answer of: http://stackoverflow.com/q/21310386
answers question: http://stackoverflow.com/q/21310386
upvote count: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: While there are many ways of doing this, the "Low tech", "No Framework", and "No Refactoring" version would be to simply shunt it out in your test. It could look something like this: public MyEpicAbstractClassTest { public void testThatNeedsTheFakeMessageWriter() { ShuntedMyEpicAbstractClass meac = new ShuntedMyEpicAbstractClass(); meac.doSomething("Arguments"); verify(meac.getMessageWriter()).write("Arguments"); } } // And the shunt is here public class ShuntedMyEpicAbstractClass extends MyEpicAbstractClass { private IMessageWriter stubbedWriter = Mockito.mock(IMessageWriter.class); public IMessageWriter getMessageWriter() { return stubbedWriter; } } This technique is often useful when you don't have the option of refactoring the base class as one other poster suggested. Hope this helps! Brandon
score: 3

http://stackoverflow.com/comment/31958569
type: Comment
score: 0
has text: Why not just use the Maven integration plug-ins from http://eclipse.org/m2e/?
comment on: http://stackoverflow.com/q/21219242
type: QuestionComment

http://stackoverflow.com/comment/31932351
comment on: http://stackoverflow.com/q/21205029
has text: See https://netbeans.org/kb/articles/javase-deploy.html
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21311557
accepted answer: http://stackoverflow.com/a/21312786
tagged with: web-applications
has comment: http://stackoverflow.com/comment/32124013
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21312786
tagged with: java
has comment: http://stackoverflow.com/comment/32124732
type: Question
has body: I am following a Struts2 tutorial. It tells me to import the listed classes. But it does not tell me which jar files to put in the lib folder under WEB-INF folder. These are the import statements that I have in my action class: import com.opensymphony.xwork2.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import java.util.List; import javax.servlet.http.HttpServletRequest; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; I have the following jars in the lib folder. But apparently these are not enough. Commons-IO 2.2 Commons-lang3-3.0 Commons-logging-1.1.3 Commons-fileupload-1.2 Freemarker-2.3.19 Javaassist- 3.12.1 GA Ognl-3.0.6 Sqljdbc4 Org.apache.commons.io-2.4 Struts2-core 2.3.16 Xwork-core 2.3.16 Can someone tell me which jars I should put in the lib folder?
has title: Which jar files do I have to put in the lib folder for these import statements to work?
tagged with: jar
has comment: http://stackoverflow.com/comment/32121337
tagged with: struts2
score: 0
upvote count: 1
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/32121920
favorite count: 0
has comment: http://stackoverflow.com/comment/32120674

http://stackoverflow.com/comment/32099735
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/21299405
type: Comment
has text: You might try giving `-version` along with the other parameters that you want to evaluate.

http://stackoverflow.com/comment/31964575
type: Comment
comment on: http://stackoverflow.com/q/21222278
has text: @genpfault Edited most important snippets into post. Do you have any ideas?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31905233
comment on: http://stackoverflow.com/q/21189820
type: QuestionComment
type: Comment
has text: `QuizActivity.this` refers to activity context. http://developer.android.com/reference/android/content/Context.html
score: 0

http://stackoverflow.com/q/21293767
has comment: http://stackoverflow.com/comment/32090205
linked to: http://stackoverflow.com/q/21065047
has comment: http://stackoverflow.com/comment/32090415
possible better answer: http://stackoverflow.com/a/21294448
has comment: http://stackoverflow.com/comment/32090277
has comment: http://stackoverflow.com/comment/32176391
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32089923
accepted answer: http://stackoverflow.com/a/21342209
has body: I receive 415 HTTP Unsupported Media Type error with the following code: Spring MVC Controller: @RequestMapping(value="/addItem", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<String> addItem(@RequestBody final ToDoItem item) { toDoItemDao.create(item); return new ResponseEntity<String>(HttpStatus.OK); } JavaScript AJAX request: $.ajax({ url: ToDoDemo.serverRoot + "/addItem", type:'POST', contentType: 'application/json', dataType:"json", data: JSON.stringify(oItem), success: function() { ... }, error: function(jqXHR, strStatus, strErrorThrown) { ... } }); pom.xml: org.codehaus.jackson jackson-core-asl 1.9.8 org.codehaus.jackson jackson-mapper-asl 1.9.8 org.codehaus.jackson jackson-jaxrs 1.9.7 There are plenty of similar questions on StackOverflow I tried to use solutions from them, but none of the worked for me. What am I missing?
tagged with: java
has answer: http://stackoverflow.com/a/21294448
has comment: http://stackoverflow.com/comment/32090881
tagged with: post
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21342209
has title: Spring MVC POST Unsupporeted Media Type
tagged with: javascript
has comment: http://stackoverflow.com/comment/32089625
tagged with: ajax
score: 0
has comment: http://stackoverflow.com/comment/32138705

http://stackoverflow.com/a/61884305
has comment: http://stackoverflow.com/comment/113024703
type: Answer
answers question: http://stackoverflow.com/q/21243690
has body: I tried out all possible solution finally this helped me out. Add the following dependencies in pom.xml org.apache.tomcat.embed tomcat-embed-jasper org.eclipse.jdt.core.compiler ecj 4.6.1 Add the view resolver to application.properties file. spring.mvc.view.prefix: /WEB-INF/jsp/ spring.mvc.view.suffix: .jsp Once, we are done with above code, we will build our project, using maven commands and then execute as standalone jar using standard java’s jar execution command. cd <TO_YOUR_PROJECT_DIR> mvn clean package spring-boot:repackage java -jar target/<YOUR_PROJECT_CREATED_JAR>
score: 0

http://stackoverflow.com/q/21235520
has body: I'm using this URL to get a response of several builds related statuses such as latest successful, list of builds,latest completed,latest stable etc .. http://JenkinsServer:8080/jenkins/job/jenkins_job/api/json i was able to get the list of jobs as well but im unable to get the builds currently in progress, for instance if builds X Y and Z are currently running and i sent the request, i need a response of these builds in progress, i tryed several suggested URLs from Jenkins website but nothing gave me this specific request
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21235577
has answer: http://stackoverflow.com/a/21236322
tagged with: hudson
downvote count: 0
tagged with: jenkins
has comment: http://stackoverflow.com/comment/31987195
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/14843874
score: 1
tagged with: java
has title: How to get the list of builds in progress in jenkins using java?
type: Question
answer count: 2

http://stackoverflow.com/q/21282400
has title: Passing parameters to action through ModelDriven in Struts 2
tagged with: regex
type: AnsweredQuestion
tagged with: java
downvote count: 1
linked to: http://stackoverflow.com/q/16598049
type: Question
tagged with: ognl
has answer: http://stackoverflow.com/a/21282401
tagged with: struts2
upvote count: 4
accepted answer: http://stackoverflow.com/a/21282401
score: 3
answer count: 1
tagged with: jsp
favorite count: 0
has body: The issue is related to the ModelDriven and Struts 2.3.16. Since the behavior of the params interceptor changed to access parameters passed to the action requires to configure acceptParamNames list to use with ModelDriven action. If acceptParamNames list is empty, it works by default accepting params via default pattern. Suppose we have a ModelDriven action: @Namespace("/modelDriven") public class ModelDrivenAction extends ActionSupport implements ModelDriven { private Gangster model = new Gangster(); private String name; //getter and setter public Object getModel() { return model; } @Actions({ @Action(value="modelDriven", results=@Result(location = "/modelDriven/modelDriven.jsp")), @Action(value="modelDrivenResult", results=@Result(location = "/modelDriven/modelDrivenResult.jsp")) }) public String execute() throws Exception { model.setName(name); return SUCCESS; } } the model: public class Gangster { private String name; //getter and setter } modelDriven.jsp: <s:form id="modelDrivenForm" action="modelDrivenResult" method="POST" namespace="/modelDriven"> <s:textfield label="Gangster Name" name="[1].name"/> <sj:submit cssClass="btn btn-primary" executeScripts="true" targets="div1"/> </s:form> modelDrivenResult.jsp: <s:label label="Gangster Name" name="name"/> In the action execute method we are getting parameter name which should be populated by the params interceptor and initializing the model property to display it in the result. But the problem is the parameter is not populated. How to get parameter name being populated by the params interceptor, so the action could display the value?
linked to: http://stackoverflow.com/q/20254142

http://stackoverflow.com/comment/32050745
score: 0
type: Comment
type: QuestionComment
has text: Grr, tunnel vision. Thanks Travis. Changing to use val text = scala.io.Source.fromFile(filepath).map(_.toByte).toArray, previously getLines().mkString(...), has fixed it. Want to make that an answer?
comment on: http://stackoverflow.com/q/21267726

http://stackoverflow.com/comment/31914942
score: 0
type: QuestionComment
has text: As long as `getProp1` doesn't do something resource intesive, like contact a webservice to get the `String` I would stick with the second method.
type: Comment
comment on: http://stackoverflow.com/q/21194990

http://stackoverflow.com/comment/31955410
comment on: http://stackoverflow.com/q/21215840
score: 1
has text: You need to explain the problem more clearly; is the server sending java serialized objects? if so, this log implies to me that the messages are incomplete and the deserializer is waiting for more data. Take a thread dump (with `jstack` or `VisualVM`) to see what the threads are doing.
type: Comment
type: QuestionComment

recursion
type: Tag
tags question: http://stackoverflow.com/q/21349790
tags question: http://stackoverflow.com/q/21277156
tag name: recursion
tags question: http://stackoverflow.com/q/21302908
tags question: http://stackoverflow.com/q/21227514
tags question: http://stackoverflow.com/q/21326506
tags question: http://stackoverflow.com/q/21313177
tags question: http://stackoverflow.com/q/21212725
tags question: http://stackoverflow.com/q/21187789
tags question: http://stackoverflow.com/q/21282024
tags question: http://stackoverflow.com/q/21195206
tags question: http://stackoverflow.com/q/21221858
tags question: http://stackoverflow.com/q/21262915
tags question: http://stackoverflow.com/q/21205768

http://stackoverflow.com/q/21214967
type: Question
tagged with: portlet
score: 1
has answer: http://stackoverflow.com/a/21216973
upvote count: 1
has body: My question is how can I go from one portlet to another. My scenario is this: The user can view a specific portlet's view.jsp. When he clicks on a button then the page will show the view.jsp of another portlet. Maybe this is called portlet redirection, but I have no idea how to implement this. Maybe one solution could be different jsp files in the same portlet but I want to navigate through portlets not the jsps. It would be useful if someone could provide me a sample of code or a reference to a literature that will help me find out how to implement this scenario.
answer count: 1
has title: How to navigate from portlet to portlet
tagged with: java
accepted answer: http://stackoverflow.com/a/21216973
tagged with: liferay
type: AnsweredQuestion
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/21343138
type: Question
has answer: http://stackoverflow.com/a/21343174
has comment: http://stackoverflow.com/comment/32178453
has body: I have looked at comparators and algorithms but I cannot make much sense of them. The comparator thing from java.util.Collections. So I chose to use this: //return an array in descending order, using set algorithm public int[] descendSort() { int[] tempArray = new int[temps.length]; for (int i = temps.length-1; i &lt;= 0; --i) { tempArray[i] = temps[i]; } return tempArray; } my created array in my client is this: int[] temps1 = new int[]{45, 76, 12, 102, 107, 65, 43, 67, 81, 14}; My output ended up like this:. The temperatures in descending order is: 0 0 0 0 0 0 0 0 0 0 WHY????
has answer: http://stackoverflow.com/a/21343565
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/32224658
score: 1
has comment: http://stackoverflow.com/comment/32178526
favorite count: 0
tagged with: assign
accepted answer: http://stackoverflow.com/a/21343174
has answer: http://stackoverflow.com/a/21343667
answer count: 4
possible better answer: http://stackoverflow.com/a/21343667
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7414299
tagged with: java
tagged with: loops
upvote count: 1
has title: Sorting an array in descending order?

http://stackoverflow.com/comment/31997855
comment on: http://stackoverflow.com/a/21238830
score: 0
type: AnswerComment
type: Comment
has text: I've edited the answer. I don't know why your mapp() doesn't stops, but maybe this new answer guides you on the right way.

http://stackoverflow.com/comment/32091902
score: 0
type: Comment
type: QuestionComment
has text: @ChrisZhang In looking at that site, it doesn't seem as much about code but about issues with the games themselves.. Which isn't what I'm looking for. Thanks for the suggestion though.
comment on: http://stackoverflow.com/q/21274477

http://stackoverflow.com/q/21224266
tagged with: for-loop
has answer: http://stackoverflow.com/a/21224296
has title: Java: Syntax error on token "}"?
tagged with: printf
has comment: http://stackoverflow.com/comment/31967345
answer count: 3
has comment: http://stackoverflow.com/comment/31967328
favorite count: 0
has comment: http://stackoverflow.com/comment/31967284
has answer: http://stackoverflow.com/a/21224293
tagged with: system
has comment: http://stackoverflow.com/comment/31967286
has answer: http://stackoverflow.com/a/21224286
type: UnansweredQuestion
score: -1
has body: Attempting to write some code to convert feet to meters and meters to feet and achieve the table shown below. This is my first java program and I have no idea why I'm getting syntax errors involving "}". Feet Meters| Meters Feet 1.0 0.305 | 20.0 65.574 2.0 0.61 | 25.0 81.967 … 9.0 2.745 | 60.0 196.721 10.0 3.05 | 65.0 213.115 Here's what I have... public class Hmwk { public static void main(String[] args){ public static double footToMeter(double foot){ return 0.305 * foot; } public static double meterToFoot(double meter){ return 3.279 * meter; } for (double i = 1.0; i &lt;11; i++){ System.out.printf(i+footToMeter(i)+"|"+(i*5+15)+meterToFoot(i*5+15));} }} Any and all help is much appreciated.
tagged with: syntax
tagged with: java
downvote count: 2
upvote count: 1
type: Question

http://stackoverflow.com/comment/31930434
comment on: http://stackoverflow.com/q/21203595
score: 0
type: QuestionComment
has text: This is a standard procedure for most hotels, libraries, and other places that offer some form of wifi. When you open your browser and access the wireless access point, the first page is some kind of login page often with disclaimers and policies of use. It is called a captive portal. See this stackoverflow http://security.stackexchange.com/questions/14561/is-it-possible-to-create-a-custom-login-page-for-your-own-wi-fi-hotspot and maybe start with Chillispot open source http://www.chillispot.org/
type: Comment

http://stackoverflow.com/comment/31951138
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21215338
has text: Project Clean doesn't work.
type: Comment

http://stackoverflow.com/comment/31980056
has text: It's a good advice to catch generic Exception and not only IOException working with camera. In this specific case, this could prevent the app crash (the author will need to design a fallback, though). But there will be no additional information not printed in the attached crash log.
type: AnswerComment
comment on: http://stackoverflow.com/a/21223931
score: 0
type: Comment

http://stackoverflow.com/a/21220123
has comment: http://stackoverflow.com/comment/91310221
downvote count: 0
type: Answer
upvote count: 7
has comment: http://stackoverflow.com/comment/50306055
answers question: http://stackoverflow.com/q/21219942
score: 7
has body: Solution with Mockito Spy import org.junit.Test; import static org.mockito.Mockito.*; public class ElephantTest { @Test public void shouldMakeNoise() throws Exception { //given Elephant elephant = spy(new Elephant("foo")); //when elephant.perform("friday"); //then verify(elephant).makeNoise(); } } Negative tests: @Test public void elephantShouldDontMakeNoisesOnMonday() { //given Elephant elephant = spy(new Elephant("foo")); //when elephant.perform("monday"); //then verify(elephant, never()).makeNoise(); } or @Test public void shouldDoNotMakeNoisesOnMonday() { //given Elephant elephant = spy(new Elephant("foo")); //when elephant.perform("monday"); then(elephant).should(never()).makeNoise(); } Dependency org.mockito:mockito-core:2.21.0 Read about Mockito#doNothing() Mockito#spy(T)

http://stackoverflow.com/a/21273477
type: Answer
downvote count: 0
score: 1
has body: Vague Question You do not provide actual values, so we cannot determine precisely the problem. We do not know what the today and dueDate variables are. Outmoded The question is now outmoded, as the troublesome old date-time classes including java.util.Date/.Calendar have been supplanted by the new java.time framework. See Tutorial. Defined by JSR 310, inspired by Joda-Time, and extended by the ThreeTen-Extra project. In java.time: An Instant is a moment on the timeline in UTC. A ZoneId represents a time zone. Use proper time zone names, never the 3-4 letter codes like "EST" or "IST" as they are neither standardized nor unique. Conceptually, ZonedDateTime = Instant + ZoneId. ThreeTen-Extra Unfortunately, java.time does not include a facility for calculating days elapsed between date-time values. We can use the ThreeTen-Extra project and its Days class with between method to provide that calculation. The ThreeTen-Extra project is a collection of features deemed non-essential for java.time during the JSR process. ZoneId zoneId = ZoneId.of ( "America/Montreal" ); ZonedDateTime now = ZonedDateTime.now ( zoneId ); ZonedDateTime then = now.minusDays ( 4 ); ZonedDateTime due = now.plusDays ( 3 ); Integer days = org.threeten.extra.Days.between ( then , due ).getAmount (); Dump to console. System.out.println ( "From then: " + then + " to due: " + due + " = days: " + days ); From then: 2015-10-31T16:01:13.082-04:00[America/Montreal] to due: 2015-11-07T16:01:13.082-05:00[America/Montreal] = days: 7 Joda-Time For Android or older versions of Java, use the excellent Joda-Time library. The Days class is smart and handles anomalies such as Daylight Saving Time (DST). Note that unlike java.util.Date, a Joda-Time DateTime object knows its own time zone. // Specify a time zone rather than rely on default. DateTimeZone timeZone = DateTimeZone.forID( "America/Regina" ); // Or "Europe/London". DateTime now = new DateTime( timeZone ); DateTime startOfToday = now.withTimeAtStartOfDay(); Da…
upvote count: 1
has comment: http://stackoverflow.com/comment/58666375
answers question: http://stackoverflow.com/q/21272737

http://stackoverflow.com/a/21312456
type: Answer
has body: You need to format your date using SimpleDateFormat's object. Replace startdateString = myFormat.format(fromUser2.parse(startdateString)); By startdateString = fromUser2.format(fromUser2.parse(startdateString));
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/21312229

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

http://stackoverflow.com/comment/32084150
has text: As far as Eclipse goes, there is no opinion about it, Eclipse project config and settings files are *designed* and *intended* to be stored along with the source files. See http://wiki.eclipse.org/FAQ_How_do_I_set_up_a_Java_project_to_share_in_a_repository%3F
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21245111

http://stackoverflow.com/q/21195088
possible better answer: http://stackoverflow.com/a/21195146
tagged with: java
has answer: http://stackoverflow.com/a/21195146
has title: how can I return as a string with everything in the array per row?
type: Question
tagged with: arrays
accepted answer: http://stackoverflow.com/a/21195165
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31915102
has answer: http://stackoverflow.com/a/21195186
has body: Hello I am trying to figure out after looking through a double array: public static String returnWhatIsInTheArrayAsAString(char [][] a){ String whatIs = " "; for(int i = 0; i &lt; a.length; i++){ for(int j = 0; j &lt; a[i].length; j++){ } } return whatIs + "\n"; } How do I return what was in both arrays, if that makes sense? How do I add that to my \n?
tagged with: return
has answer: http://stackoverflow.com/a/21195165
type: AnsweredQuestion

http://stackoverflow.com/a/21203473
accepted answer of: http://stackoverflow.com/q/21203397
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31929978
type: Answer
has comment: http://stackoverflow.com/comment/31930017
upvote count: 1
downvote count: 1
has body: String sPhoneNumber = "456-8889999"; Pattern pattern = Pattern.compile("\\([4-6]{1}[0-9]{2}\\) [0-9]{3}\\-[0-9]{4}$"); Matcher matcher = pattern.matcher(sPhoneNumber); if (matcher.matches()) { System.out.println("Phone Number Valid"); } else { System.out.println("Phone Number must be in the form XXX-XXXXXXX"); }
answers question: http://stackoverflow.com/q/21203397
has comment: http://stackoverflow.com/comment/31930051

http://stackoverflow.com/comment/117454384
has text: I had the same issue, Solved it empty the entire database to empty and re run the application. Everything is no working fine.
comment on: http://stackoverflow.com/a/21244693
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31957934
has text: before i started the task, i watched tons of videos, however there are almost no videos about refactoring huge legacy codebase, and most of examples simply don't apply to my case(my examples simplified too), that's why i was so much confused by multiple constructors.. Thank you again!
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21216372
score: 0

http://stackoverflow.com/q/21328561
has comment: http://stackoverflow.com/comment/32152693
score: 7
has comment: http://stackoverflow.com/comment/32153251
tagged with: glassfish
answer count: 1
downvote count: 0
favorite count: 0
has title: Netbeans can't start Glassfish 4 server
has body: I am using Netbeans 7.4 and Glassfish 4.0. I can start glassfish 4.0 manually from command line but when i click the run the project button from netbeans it says "Starting GlassFish Server". It became more than 10 minutes but nothing happens. It was running fine yesterday, i didn't change anything but today it can't start the server. What may be the problem?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32822494
tagged with: netbeans
has comment: http://stackoverflow.com/comment/32152983
tagged with: java
upvote count: 7
has comment: http://stackoverflow.com/comment/32767482
has answer: http://stackoverflow.com/a/22408876
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/comment/32066315
type: Comment
score: 0
type: AnswerComment
has text: But as stated above, it doesn't pass back the BAD REQUEST. It only passes back a generic 500 SERVER ERROR so I have no way of differentiating between the errors. Which makes me think my TestMapper class is defined in the wrong place/incorrect etc...
comment on: http://stackoverflow.com/a/21280409

http://stackoverflow.com/comment/31997350
type: Comment
comment on: http://stackoverflow.com/q/21241036
has text: Why not mock that calls, and see what else could be the cause of this ?
score: 0
type: QuestionComment

http://stackoverflow.com/q/21239601
has comment: http://stackoverflow.com/comment/31994538
tagged with: java
has comment: http://stackoverflow.com/comment/31994546
has answer: http://stackoverflow.com/a/21239900
possible better answer: http://stackoverflow.com/a/21239753
has answer: http://stackoverflow.com/a/21239753
has comment: http://stackoverflow.com/comment/31994547
has title: Adding items in an array using a custom class
answer count: 3
tagged with: arrays
has answer: http://stackoverflow.com/a/21239659
has comment: http://stackoverflow.com/comment/31994628
has comment: http://stackoverflow.com/comment/31994719
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21239659
score: 0
has body: Hello I have a project for my class and I'm a bit stuck right now. I created a custom class with this code: public double getTotal() { for (int i; i&lt; finalTotal.length; i++) { sum + finalTotal[i] = sum; } return sum; }//end getTotal() The array finalTotal is created in my driver class in the method main, but my custom class that suppose to find the total of the array but, won't compile because it can't find the variable finalTotal. So how would I allow my custom class to be able to access info from the array in my driver class? public static void main (String args[]) throws IOException { Checkout total = new Checkout(); double finalTotal[] = new double[10]; }//end method main
type: Question

http://stackoverflow.com/a/21292089
has comment: http://stackoverflow.com/comment/32090628
has body: The value of the newlink variable in insertFirst is copied into the instance variable here: first=newlink; Then in displayLink, the value of first is copied back into a local variable: link current=first; It's important to distinguish between variables and their values - and also between references and objects. The values of all these link variables are only references. (As an aside, is this example straight out of the book? If so, I'm concerned at the use of unconventional names like link instead of Link for a class, and newlink instead of newLink as a variable.)
accepted answer of: http://stackoverflow.com/q/21292043
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32087441
has comment: http://stackoverflow.com/comment/32090716
score: 3
has comment: http://stackoverflow.com/comment/32087370
upvote count: 3
answers question: http://stackoverflow.com/q/21292043

ones-complement
tag name: ones-complement
type: Tag
tags question: http://stackoverflow.com/q/21213271

http://stackoverflow.com/comment/32143432
has text: Thank you, Ashish, this is one of the ideas I presented in my question too. I actually want to know if there is some list chaining syntax in java.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21324052

http://stackoverflow.com/comment/32104535
has text: As the author of JaNeLA, I can tell you with confidence that it does not detect *every possible error.* Are there any non UTF-8 characters in the file? Can you show it exactly as it appears to the client as an [edit to the question](http://stackoverflow.com/posts/21263030/edit)? Note that the reporting on JNLP problems is less than ideal. It often happens that an error occurs much earlier in a file than what the output says.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21276330

http://stackoverflow.com/a/21207015
accepted answer of: http://stackoverflow.com/q/21206925
type: Answer
upvote count: 3
score: 3
has body: You did not specify how to join the tables. The query therefore generates all possible combinations of the records in Cserv and Bserv. That you got twice the sum indicates that the other table just contains two records. Typically, there would be one column in each table that should have the same value in the JOIN result. Assuming these columns are called x and y, you specify it in this way: SELECT SUM(c.field_init), SUM(g.filed_1), SUM(g.field_2) FROM Cserv c JOIN Bserv g ON c.x = g.y
has comment: http://stackoverflow.com/comment/31936550
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31936333
answers question: http://stackoverflow.com/q/21206925
has comment: http://stackoverflow.com/comment/31936387

http://stackoverflow.com/comment/32552809
comment on: http://stackoverflow.com/q/21219474
has text: Manytimes i get passphrase to be null. Do you get any similar issues?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32030456
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21260318
has text: From what I remember from when I used eclipse, there is no expand all button when you are in the variable view. There is only a collapse all.

http://stackoverflow.com/q/21234355
tagged with: android
tagged with: cryptography
has answer: http://stackoverflow.com/a/21236584
score: 2
type: UnansweredQuestion
tagged with: java
has title: Java SSL pre-shared key mode in JSSE
type: Question
has comment: http://stackoverflow.com/comment/31986543
tagged with: ssl
answer count: 2
has comment: http://stackoverflow.com/comment/31986230
downvote count: 1
has body: I'm developing secure communication framework for PC and Android mobiles, without using certificates and public key exchange. Pre-shared key will be used. The framework has it's own protocol for authentication and key exchange. The procedure is the follows: Hosts authenticate to each other After two communicating hosts are authenticated to each other, they share session private key. Traffic between hosts is encrypted using that key. I plan to use SSL for traffic encryption, but without using and third-party SSL library (only standard JSSE facilities). Actually, SSL will be used only for traffic encryption (key exchange and authentication is already made). How it's possible to explicitly set pre-shared key for SSL? If it's not directly supported by JSSE, but can be made by overriding default SSL classes (SSLEngine, SSLSocketFactory, and etc), how to do it? What classes can be responsible for it?
favorite count: 0
has answer: http://stackoverflow.com/a/69109922
upvote count: 3
tagged with: encryption

http://stackoverflow.com/comment/32081733
score: 0
type: AnswerComment
type: Comment
has text: Yes but did I set the name to Bo peep correctly? Also when it says to output using tostring, does that mean I have to call toString or just print(customer); ?
comment on: http://stackoverflow.com/a/21289439

http://stackoverflow.com/a/21214245
upvote count: 2
has body: You use relative path for source. That's why browser is trying resolve absolute path relative to your page (seems it's located in /wicket/bookmarkable/). If you are going to use / context you can simply add "/" before "test.mp3" - it should be "/test.mp3". But if you are going to mount your application to other place rather then root context "/", I recommend to take a look to 'ContextRelativeResource'.
answers question: http://stackoverflow.com/q/21210808
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21210808
type: Answer
score: 2

http://stackoverflow.com/q/21286966
has comment: http://stackoverflow.com/comment/32077177
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32077174
has body: public class LotteryNumbers { private ArrayList &lt;Integer&gt; numbers; public LotteryNumbers() { this.numbers = new ArrayList &lt;Integer&gt; (); this.drawNumbers(); } public ArrayList &lt;Integer&gt; numbers() { return this.numbers; } public void drawNumbers() { Random random = new Random (); int counter = 0; while (counter &lt; 7) { this.numbers.add(random.nextInt(39) + 1); counter++; } } This is a class used for printing 7 numbers from 1..39. It does that job but the problem is I want the 7 random numbers to be different. How do I check if an arrayList contains the same number since it is random? Thanks for reading.
has answer: http://stackoverflow.com/a/21287069
has answer: http://stackoverflow.com/a/21287662
accepted answer: http://stackoverflow.com/a/21287069
tagged with: java
tagged with: duplicates
has answer: http://stackoverflow.com/a/21287151
has title: Finding duplicate random numbers in an ArrayList
linked to: http://stackoverflow.com/q/4228975
type: Question
tagged with: random
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/21287984
possible better answer: http://stackoverflow.com/a/21287151
answer count: 4

http://stackoverflow.com/comment/32204365
comment on: http://stackoverflow.com/q/21310260
score: 2
type: Comment
type: QuestionComment
has text: I don't use Eclipse but that picture seems to be a tabbed pane's header with a custom Look and Feel. It looks like [Seaglass](http://code.google.com/p/seaglass/) pretty much.

http://stackoverflow.com/a/21223551
downvote count: 3
has comment: http://stackoverflow.com/comment/32006726
type: Answer
has comment: http://stackoverflow.com/comment/33907062
has body: You are using JSF 2.2 xml namespaces and obviously don't have an environment (probably an application server) which supports JSF 2.2. If you want to use "the old" JSF 2 you have to use these namespace declarations: &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"&gt; If you want to use JSF 2.2 you have to update your application server to support JSF 2.2.
upvote count: 1
score: -2
has comment: http://stackoverflow.com/comment/31975514
has comment: http://stackoverflow.com/comment/32423621
answers question: http://stackoverflow.com/q/21223257

http://stackoverflow.com/comment/32168195
comment on: http://stackoverflow.com/q/21337826
has text: What exactly do you want to achieve with your code, 'cause there are several issues with this code... Not only with this `x[100] = Integer.parseInt(in.readLine());` which actually gives you the error.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21287087
tagged with: string
has comment: http://stackoverflow.com/comment/32078516
has comment: http://stackoverflow.com/comment/32077692
favorite count: 0
tagged with: sockets
has title: Maintaining communication between Arduino and Java program
has answer: http://stackoverflow.com/a/21364244
has body: I have gotten a project in school that consists of a RC car that gets controlled over WiFi. It works just fine for a few seconds, but then it just stops the connection and tries to reconnect again. Thing is that if i'm making a car that relies on that unstable connection, it can cause accidents. Either to itself or a person. Perhaps i'm doing something wrong? My question is, how do i keep that connection active at all times? Here is my program so far: Arduino Client: #include &lt;SPI.h&gt; #include &lt;WiFi.h&gt; int status = WL_IDLE_STATUS; char ssid[] = "mynet"; char pass[] = "password"; IPAddress remoteIp(192,168,80,165); int port = 37899; String message = ""; WiFiClient client; void setup() { // start the serial for debugging Serial.begin(9600); pinMode(9, OUTPUT); digitalWrite(9, LOW); //check if the wifi shield is present if(WiFi.status() == WL_NO_SHIELD){ Serial.println("WiFi shield not present! Press reset to try again."); while(true); //stops the program } connectWiFi(); printWifiStatus(); connectClient(3); } void loop(){ if(client){ if(client.available()){ char c = client.read(); if(c != '\n'){ message += c; } else{ Serial.println("Received message: "+message); checkMessage(); sendMessage(message); message = ""; } } } } void printWifiStatus() { // print the SSID of the network you're attached to: Serial.print("SSID: "); Serial.println(WiFi.SSID()); // print your WiFi shield's IP address: IPAddress ip = WiFi.localIP(); Serial.print("IP Address: "); Serial.println(ip); } void connectWiFi(){ if( status != WL_CONNECTED){ while(status != WL_CONNECTED){ Serial.print("Attempting connection to network..."); status = WiFi.begin(ssid, pass); delay(3000); if(status == WL_CONNECTED){ Serial.println(" SUCSESS"); } else{ Serial.println(" FAILED"); delay(3000); connectWiFi(); } } } } void connectClient(int retries){ //Attempt connection to server if(retries &lt;= 0){ Serial.println("FAILED"); Serial.println("Connection to server failed."); while(true); } Serial.print("At…
downvote count: 1
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32083408
has comment: http://stackoverflow.com/comment/32078218
tagged with: arduino
type: Question
accepted answer: http://stackoverflow.com/a/21364244
upvote count: 5
has comment: http://stackoverflow.com/comment/32078025
score: 4
answer count: 1
tagged with: wifi

httpclient
tags question: http://stackoverflow.com/q/21299625
tags question: http://stackoverflow.com/q/21213751
tags question: http://stackoverflow.com/q/21256034
type: Tag
tag name: httpclient
tags question: http://stackoverflow.com/q/21237391

http://stackoverflow.com/comment/32166369
score: 1
comment on: http://stackoverflow.com/q/21336141
has text: See how much better it looks now? It was a mess. I hope I've convinced you, since I don't do that for people often.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21260925
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21261798
has comment: http://stackoverflow.com/comment/32031294
type: Question
has comment: http://stackoverflow.com/comment/32032394
linked to: http://stackoverflow.com/q/11874017
has comment: http://stackoverflow.com/comment/32031561
score: 0
accepted answer: http://stackoverflow.com/a/21261798
answer count: 1
has title: Spring .properties files purpose
has comment: http://stackoverflow.com/comment/32031386
has body: I read @yorkw answer at this topic. He said: The purpose of .properties file is to provide the capability of configuring database connections at application runtime (for web application, usually require restarting application container/server after .properties file changes). The question is if we can change properties on the fly without restarting container/server? Provide me an example please (I ask because in my demo it doesn't work, means value isn't changed). I mean if we have some kind of admin tool than we can move all our configured settings to .properties files and change them via that admin tool.
tagged with: spring
has comment: http://stackoverflow.com/comment/32031394

http://stackoverflow.com/comment/32007331
score: 3
comment on: http://stackoverflow.com/q/21246637
has text: The source code for the method is readily available. Why not take a look and see what is happening? It's often with your JDK and is called src.zip. It is also available online, but I don't have the reference on my right this moment, although Google can find it.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32130977
has text: When debugging something like this and you see that you have the same result from the previous call added to the result of next call, it should signal to you that your data structure may not be cleared out between calls.
comment on: http://stackoverflow.com/q/21317074
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32172749
comment on: http://stackoverflow.com/q/21340316
score: 7
has text: codereview.stackexchange.com would be better for this type of question.
type: Comment
type: QuestionComment

spring
tags question: http://stackoverflow.com/q/21331002
tags question: http://stackoverflow.com/q/21340310
tags question: http://stackoverflow.com/q/21200425
tags question: http://stackoverflow.com/q/21228238
tags question: http://stackoverflow.com/q/21203875
tags question: http://stackoverflow.com/q/21347995
tags question: http://stackoverflow.com/q/21335164
tags question: http://stackoverflow.com/q/21275485
tags question: http://stackoverflow.com/q/21206732
tags question: http://stackoverflow.com/q/21318832
tags question: http://stackoverflow.com/q/21324142
tags question: http://stackoverflow.com/q/21312623
tags question: http://stackoverflow.com/q/21290836
tags question: http://stackoverflow.com/q/21307006
tags question: http://stackoverflow.com/q/21241210
tags question: http://stackoverflow.com/q/21188271
tags question: http://stackoverflow.com/q/21236469
tags question: http://stackoverflow.com/q/21276136
tags question: http://stackoverflow.com/q/21290023
tags question: http://stackoverflow.com/q/21241683
tags question: http://stackoverflow.com/q/21237707
tags question: http://stackoverflow.com/q/21293637
tags question: http://stackoverflow.com/q/21221085
tags question: http://stackoverflow.com/q/21281736
tags question: http://stackoverflow.com/q/21248341
tags question: http://stackoverflow.com/q/21238700
tags question: http://stackoverflow.com/q/21206678
tags question: http://stackoverflow.com/q/21316641
tags question: http://stackoverflow.com/q/21208594
tags question: http://stackoverflow.com/q/21306200
tags question: http://stackoverflow.com/q/21294160
tags question: http://stackoverflow.com/q/21276701
tags question: http://stackoverflow.com/q/21339088
tags question: http://stackoverflow.com/q/21267779
tags question: http://stackoverflow.com/q/21280028
tags question: http://stackoverflow.com/q/21282987
tags question: http://stackoverflow.com/q/21193380
tags question: http://stackoverflow.com/q/21308523
tags question: http://stackoverflow.com/q/21318300
tags question: http://stackoverflow.com/q/21213439
tags question: http://stackoverflow.com/q/21235472
tags question: http://stackoverflow.com/q/21323336
tags question: http://stackoverflow.com/q/21247749
tags question: http://stackoverflow.com/q/21336216
tags question: http://stackoverflow.com/q/21259406
tags question: http://stackoverflow.com/q/21345304
tags question: http://stackoverflow.com/q/21326046
tags question: http://stackoverflow.com/q/21331795
tags question: http://stackoverflow.com/q/21273067
tags question: http://stackoverflow.com/q/21304364
tags question: http://stackoverflow.com/q/21338102
type: Tag
tags question: http://stackoverflow.com/q/21187411
tags question: http://stackoverflow.com/q/21281803
tags question: http://stackoverflow.com/q/21330267
tags question: http://stackoverflow.com/q/21216277
tags question: http://stackoverflow.com/q/21300668
tags question: http://stackoverflow.com/q/21330624
tags question: http://stackoverflow.com/q/21332118
tags question: http://stackoverflow.com/q/21218071
tags question: http://stackoverflow.com/q/21273624
tags question: http://stackoverflow.com/q/21252759
tags question: http://stackoverflow.com/q/21239480
tags question: http://stackoverflow.com/q/21257819
tags question: http://stackoverflow.com/q/21302676
tags question: http://stackoverflow.com/q/21325530
tags question: http://stackoverflow.com/q/21266306
tags question: http://stackoverflow.com/q/21190955
tags question: http://stackoverflow.com/q/21193843
tags question: http://stackoverflow.com/q/21319370
tags question: http://stackoverflow.com/q/21186366
tags question: http://stackoverflow.com/q/21260018
tags question: http://stackoverflow.com/q/21323191
tags question: http://stackoverflow.com/q/21203497
tags question: http://stackoverflow.com/q/21230256
tags question: http://stackoverflow.com/q/21301543
tags question: http://stackoverflow.com/q/21261474
tags question: http://stackoverflow.com/q/21289217
tags question: http://stackoverflow.com/q/21220812
tags question: http://stackoverflow.com/q/21299907

http://stackoverflow.com/comment/31975510
score: 0
has text: If no more data comes, then wont this data just sit there?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21229053

http://stackoverflow.com/comment/32015915
has text: All executable code in Java must be inside a method.
type: Comment
comment on: http://stackoverflow.com/q/21251908
score: 0
type: QuestionComment

http://stackoverflow.com/a/21340930
has comment: http://stackoverflow.com/comment/32178097
downvote count: 1
upvote count: 0
answers question: http://stackoverflow.com/q/21339342
score: -1
has body: please try below changes. if your connection refuses it will wait for 2s(2000ms) and then again try to connect with server. if connection being successful it will take outputstream, write data in a while loop and flush the data. public void createSocketConnection() throws IOException { socket = new Socket(actuatorAddress, destPort.get()); if(socket!=null) { outToServer = socket.getOutputStream(); out = new DataOutputStream(outToServer); } } public void SendMessage(String message){ boolean isRunning=false; try { createSocketConnection(); isRunning=true; while(isRunning) { out.write(message.getBytes()); out.flush(); } } catch (java.net.ConnectException conExcp) { System.out.println(ex.getMessage()); try{ Thread.sleep(2000); }catch(Exception ee){} } catch (IOException ex) { System.out.println(ex.getMessage()); } }
type: Answer

http://stackoverflow.com/comment/31898314
score: 0
type: Comment
has text: Two questions: It seems work but for any reason the process never finish. I mean I'm running my class in Netbeans and the process is running till I decided to stop it.
type: AnswerComment
comment on: http://stackoverflow.com/a/21184976

http://stackoverflow.com/q/21281203
has answer: http://stackoverflow.com/a/21281299
has comment: http://stackoverflow.com/comment/32067128
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/21283267
favorite count: 0
possible better answer: http://stackoverflow.com/a/21281299
has body: I'm self learning Java, and I'm stuck on a chapter about Interfaces. I simply cannot understand how they work in Java. I believe I understand perfectly what Interface means and how they apply in everyday situations and technology. But when it comes to Java, code-wise and logic-wise, I'm stuck. I don't get it. How does the concept work? Say I have 3 objects, and 1 interface object. 2 Objects are ObjectCalculatingA, ObjectCalculatingB, ObjectMathFunctions, and ObjectInterface. Supposedly in ObjectInterface there must be some sort of reference to the ObjectMathFunctions, so that ObjectCalculatingA and B can just access the math functions in ObjectMathFunctions without writting them all again in A and B. Am I right?
type: Question
tagged with: interface
downvote count: 2
accepted answer: http://stackoverflow.com/a/21281388
has comment: http://stackoverflow.com/comment/32067116
tagged with: java
has title: How does an Interface in Java work?
has comment: http://stackoverflow.com/comment/32067230
answer count: 4
upvote count: 5
has answer: http://stackoverflow.com/a/21281950
has comment: http://stackoverflow.com/comment/32069769
has answer: http://stackoverflow.com/a/21281388

http://stackoverflow.com/q/21238784
tagged with: android
has title: Using a BaseActivity for OnResume Action Bar Styling
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21239088
type: Question
has comment: http://stackoverflow.com/comment/31993334
tagged with: java
accepted answer: http://stackoverflow.com/a/21239088
has body: I am trying to modify a project which contains code to style the action bar. The way the styling happens is that in each FragmentActivity the following code exists: @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); actionbarcolor = PreferenceData.getIntValues(AddJournalEntry.this, "actionbarcolor"); if (actionbarcolor == 1) { ActionBar actionBar = getActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(Color.BLUE)); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowTitleEnabled(true); } else if (actionbarcolor == 2) { ActionBar actionBar = getActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(Color.RED)); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowTitleEnabled(true); } } I want to create a new base fragment activity class that has this code in it so that for every screen I don't have to copy/paste/update this code. i would simply extend it for the other screens. I've created a new class like so: package com.fasttracksites.skyrimjournal; import android.app.ActionBar; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.support.v4.app.FragmentActivity; import com.fasttracksites.adapters.PreferenceData; public class BaseActivity extends FragmentActivity { @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); actionbarcolor = PreferenceData.getIntValues(AddJournalEntry.this, "actionbarcolor"); if (actionbarcolor == 1) { ActionBar actionBar = getActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(Color.BLUE)); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowTitleEnabled(true); } else if (actionbarcolor == 2) { ActionBar actionBar = getActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(Color.RED)); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowTitleEnabled(true); } } } The only issue that I see is that I need to be able to …
score: 0
answer count: 1

http://stackoverflow.com/a/21281276
score: 2
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21281130
upvote count: 2
answers question: http://stackoverflow.com/q/21281130
type: Answer
has body: You're calling toString() on a char[]. That doesn't do what you think it does - it will return something like "[C@6af3a631" because arrays don't override toString(). You end up with the default implementation of toString() from Object: The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. You can use: // Eek - security problem! out.writeObject(new String(passfield.getPassword()); ... but that would leave a string hanging around in memory, which can't then be cleared. It's also transmitting the password in plaintext, which is awful unless this stream is secured in some other way. I suspect you can just use: out.writeObject(passfield.getPassword()); which will transmit the char[] as an object, and you'll get the same char[] out at the other end. It doesn't solve the "transmitting a password" problem though - and you'll still need to clear the char[] afterwards to avoid the password being accessible in memory.

http://stackoverflow.com/a/21239402
downvote count: 1
score: 0
answers question: http://stackoverflow.com/q/21239077
type: Answer
has body: Constructor is a special function that consturcts the class (creates the object), so therefore it is fully logical to have the same name. That is the way C# is defined and other languages. Constructors are special things. They can't be called, they can be instantiated.
upvote count: 1

http://stackoverflow.com/comment/32107272
score: 0
type: Comment
type: QuestionComment
has text: @greg-449 there is only one handler named `handler` in my code.
comment on: http://stackoverflow.com/q/21299998

http://stackoverflow.com/q/21327739
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21328713
has comment: http://stackoverflow.com/comment/32149740
type: Question
accepted answer: http://stackoverflow.com/a/21327799
has body: Following declaration void insert_LL(Node *head, int data); when called, a copy of head pointer reaches the function, so if a node is added at the head, the value of the head is changed. But, as we have the local copy of head so the actual head pointer isn't changed. So we declare it as follows void insert_LL(Node **head, int data); My question: Is the above explanation correct? If yes, so that means in C, it is always a pass by value (a copy of pointer is reached in the function) which is same as in Java. Am I correct? If yes, so how does pass by reference/pointer come into the picture?
linked to: http://stackoverflow.com/q/57483
has title: Confusion in pass by value vrs pass by reference/pointer
score: 0
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/21327799
tagged with: http://stackoverflow.com/tag/c
possible better answer: http://stackoverflow.com/a/21328713

http://stackoverflow.com/a/21188204
accepted answer of: http://stackoverflow.com/q/21186146
answers question: http://stackoverflow.com/q/21186146
upvote count: 2
has body: With some Googling I found that your output matrix must contain at least 3 channels. (Blue, Green and Red). Where Blue and Green will be completely empty and you put your grayscale image as Red channel of the output image. Any other number of channels will cause the error you are getting.
type: AcceptedAnswer
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31905316
downvote count: 0

http://stackoverflow.com/a/21281482
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21277865
type: Answer
has body: Provided that I understood you correctly, I would suggest that you use the Specification design pattern which is used in cases like this. There's no need in such a fancy library like Lucene for such a simple task. The advantage of the Specification pattern is that it keeps all the filtering logic grouped and encapsulated. Your implementation may vary, but below is a simple example of what it could look like public interface Specification&lt;T&gt; { boolean isSatisfiedBy(T candidate); Specification&lt;T&gt; and(Specification&lt;T&gt; specification); Specification&lt;T&gt; or(Specification&lt;T&gt; specification); Specification&lt;T&gt; not(Specification&lt;T&gt; specification); } public abstract class Calculator { // ... } public class Calculator1 extends Calculator implements Specification&lt;Request&gt; { public boolean isSatisfiedBy(Request request) { // check if the request fits this calculator } } public class Calculator2 extends Calculator implements Specification&lt;Request&gt; { public boolean isSatisfiedBy(Request request) { // check if the request fits this calculator } } You can then have a collection or a pool of calculators such that public class Calculators { private final List&lt;RequestSpecification&gt; calculators; public Calculator getOneSuitedFor(Request request) { for (Calculator calculator : calculators) { if (calculator.isSatisfiedBy(request)) { return calculator; } } return null; } } And here how you would use it Calculator calculator = Calculators.getOneSuitedFor(request); Or, if needed, you can always go on and expand on it by making use of composition (see the reference link above) which allows for logic chaining and combining of different specifications depending on the context. This, however, would require a little bit different class design from that of above, but is more flexible final Request request; Specification&lt;Calculator&gt; price = new Specification&lt;&gt;() { public boolean isSatisfiedBy(Calculator calculator) { return calcul…
downvote count: 0

http://stackoverflow.com/comment/32069317
type: AnswerComment
has text: Thanks! I know how to make equivalent! I posted question after testing! The line "A a = new B()" is confusing to me. "a" is holding object of "B" but the output is "Class A"! Shouldn't it call method of class "B"? Or it is a language construct?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21282368

http://stackoverflow.com/comment/32147030
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21325597
type: AnswerComment
has text: I still seem to be getting the same problem though.

http://stackoverflow.com/comment/32102374
type: Comment
comment on: http://stackoverflow.com/a/21300646
type: AnswerComment
score: 0
has text: I tried this and I got null when trying to print out one of the integers.

http://stackoverflow.com/a/21722062
has comment: http://stackoverflow.com/comment/40960016
upvote count: 14
accepted answer of: http://stackoverflow.com/q/21254291
has body: I managed to install delete-project plugin after following this thread: https://groups.google.com/forum/#!topic/repo-discuss/hbBc2TUhl7s and then install according to: https://gerrit-review.googlesource.com/Documentation/cmd-plugin-install.html P.S. I build the jar following the below steps: git clone --recursive https://gerrit.googlesource.com/gerrit cd gerrit git clone --recursive https://gerrit.googlesource.com/plugins/delete-project buck build delete-project:delete-project You should then find the delete-project.jar in buck-out/gen/delete-project/delete-project.jar
type: Answer
answers question: http://stackoverflow.com/q/21254291
has comment: http://stackoverflow.com/comment/40347036
downvote count: 0
has comment: http://stackoverflow.com/comment/55837912
score: 14
has comment: http://stackoverflow.com/comment/40956429
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40956289

http://stackoverflow.com/a/21193927
has comment: http://stackoverflow.com/comment/31913495
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: I see many several problems here. First, you almost never (if ever) want to call runOnUiThread() from AsyncTask. Every method of AsyncTask runs on the UI except for doInBackground() so this usually isn't needed and often causes problems. Update the UI with the correct methods depending on what you are doing. Second, I think you misunderstand what doInBackground() is returning. Its result is returned to onPostExecute() which is the 3rd param in your class declaration private class doFileUpload extends AsyncTask &lt;String, Void, String&gt; { So this means that onPostExecute() (which I don't see you overriding) should expect a String and that is what doInBackground() should return. So you should convert your return variables to String if you want to pass a String to onPostExecute() AsyncTask Docs Typically progressDialog.dismiss(); is called in onPostExecute() and progressDialog.show(); would be called in onPreExecute() when using an AsyncTask. Then you don't have to create a new Thread in your onClick().
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/31913355
answers question: http://stackoverflow.com/q/21192778
has comment: http://stackoverflow.com/comment/31913398
accepted answer of: http://stackoverflow.com/q/21192778
has comment: http://stackoverflow.com/comment/31913817

http://stackoverflow.com/comment/32090685
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21294308
has text: Did you mean use `Customer.class` instead of pasting the same code as OP?

cucumber-jvm
tag name: cucumber-jvm
type: Tag
tags question: http://stackoverflow.com/q/21226985
tags question: http://stackoverflow.com/q/21334207
tags question: http://stackoverflow.com/q/21258220

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/21242079
tags question: http://stackoverflow.com/q/21241060
tags question: http://stackoverflow.com/q/21344733
tags question: http://stackoverflow.com/q/21322353
tags question: http://stackoverflow.com/q/21232313
tags question: http://stackoverflow.com/q/21261379
type: Tag
tags question: http://stackoverflow.com/q/21323260
tags question: http://stackoverflow.com/q/21331221
tags question: http://stackoverflow.com/q/21302611
tags question: http://stackoverflow.com/q/21208239
tags question: http://stackoverflow.com/q/21184347
tags question: http://stackoverflow.com/q/21300960

http://stackoverflow.com/a/21297933
type: Answer
has body: but imagine that we have more than 1 root level data then what could be the solution. e.g., 1-&gt; 2-&gt; 3 -&gt; 4 -&gt; 5 6-&gt; 7-&gt; 8-&gt; 9 10 -&gt; 11 -&gt;12 now here we have 3 root elements. how to sort out this one?
score: 0
answers question: http://stackoverflow.com/q/21295325

http://stackoverflow.com/q/21256616
tagged with: c++
has comment: http://stackoverflow.com/comment/32025815
has title: use JAVA APIs in Firebreath
has comment: http://stackoverflow.com/comment/32023793
type: Question
tagged with: java
downvote count: 11
has answer: http://stackoverflow.com/a/21256653
has comment: http://stackoverflow.com/comment/32023644
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: -10
has body: I want to develop a cross Browser Plugin in Firebreath using JAVA APIs. How in Firebreath, which is in C++,can i use JAVA APIs. One way was to convert JAVA Project to C++ via JNI but to convert so many files is there any simpler way? Or any other way by which I can give the reference of JAVA APIs in Firebreath.

http://stackoverflow.com/comment/32045891
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21268461
has text: It looks like your suggestion of using StringBuilder instead of String worked. Thanks.
type: AnswerComment

http://stackoverflow.com/comment/31918864
has text: @Shmoopy Unfortunately question downvotes are sometimes catchy.
type: Comment
comment on: http://stackoverflow.com/a/21197083
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31922790
has text: Haha wrote it in C#, didn't notice the tag, changed the code example to java. Sorry!
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21199221
type: Comment

http://stackoverflow.com/comment/31968893
has text: Sorry, but that is so wrong, and you're fixing the wrong thing. The solution is to call the public methods off of an instance, an object. You need to read up on OOP first principles because your statements above suggest that this will help you code better. I strongly urge you to put aside GUI programming for a bit and read Bruce Eckel's [Thinking in Java](http://www.mindview.net/Books/TIJ/).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21219149
type: AnswerComment

http://stackoverflow.com/comment/32153709
type: Comment
comment on: http://stackoverflow.com/a/21307671
score: 0
type: AnswerComment
has text: Thanks @vanOekal. The problem was with sending bytes. I replaced my code with `while (bytesRead > 0) { wr.write(buffer, 0, bytesAvailable); bytesAvailable = fileInputStream.available(); bytesAvailable = Math.min(bytesAvailable, maxBufferSize); bytesRead = fileInputStream.read(buffer, 0, bytesAvailable); }` It works fine now.

http://stackoverflow.com/comment/32026638
has text: Now I read your code again, I've noticed you are using `BufferedOutputStream`. As a test, use the regular underlying (non-buffered) stream instead, to rule out buffering issues.
comment on: http://stackoverflow.com/q/21249714
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32154465
comment on: http://stackoverflow.com/q/21330421
type: QuestionComment
score: 2
has text: HTTP 1.1 persistent connections have by definition less overhead than non-persistent ones. I think however that in a local network, this overhead will be pretty negligible. If you really want to use the fastest protocol possible, why not try SPDY ?
type: Comment

http://stackoverflow.com/comment/118039860
comment on: http://stackoverflow.com/a/60096314
type: AnswerComment
has text: @Transactional @Modifying(clearAutomatically = true) @Query(value = Update/Delete/InstertQuery , nativeQuery = true)
score: 0
type: Comment

http://stackoverflow.com/comment/32167330
type: QuestionComment
comment on: http://stackoverflow.com/q/21321897
has text: @user2310289 I've run `netstat -a` to see if the port was already open, but nothing, even when I was running my application, the results were the same. @MadProgrammer I added the port as TCP in the firewall, but I still having the same problem. Even I restart my pc to validate if changes were applied.
score: 0
type: Comment

http://stackoverflow.com/comment/32021600
has text: @ᴍaroun ᴍaroun I simplified the code, xx takes its value by a xx = Float.parseFloat(request.getParameter("price")); statement. Otherwise that would be correct.
score: 0
comment on: http://stackoverflow.com/q/21255009
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31941361
comment on: http://stackoverflow.com/q/21209994
score: 0
has text: Is there a reason you don't change the return value to double?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31932210
comment on: http://stackoverflow.com/q/21201004
type: QuestionComment
has text: did you get mail. I just tried and it showed me message sent successfully . no change in your code.
score: 0
type: Comment

http://stackoverflow.com/q/21236598
has comment: http://stackoverflow.com/comment/31989569
has answer: http://stackoverflow.com/a/21236692
downvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/32016542
has answer: http://stackoverflow.com/a/21236737
has comment: http://stackoverflow.com/comment/31989168
has comment: http://stackoverflow.com/comment/31989106
favorite count: 0
has body: I have to deal with a domain object that's real name is 351K-Report. According to the Java naming convention its forbidden to use a number at the beginning of an identifier. I don't want to fully spell out the number. And, I also think that it's a bad idea to place an underline in front of the number. But what is the recommended alternative? UPDATE There are also other reports, like SpecReport, TopReport, LF10Report and so on. So I'm very doubtful that inverting parts of the noun changes the meaning of the whole project.
type: UnansweredQuestion
tagged with: classname
has comment: http://stackoverflow.com/comment/32016753
has answer: http://stackoverflow.com/a/21236661
has comment: http://stackoverflow.com/comment/32016391
tagged with: naming-conventions
has title: Java naming convention for identifiers that begin with a number
tagged with: java
score: -1
type: Question
upvote count: 1

http://stackoverflow.com/a/36860794
has comment: http://stackoverflow.com/comment/83012070
upvote count: 14
answers question: http://stackoverflow.com/q/21254291
score: 14
downvote count: 0
type: Answer
has body: Download the delete-project.jar from the build that matches your Gerrit version on https://gerrit-ci.gerritforge.com Copy it to gerrit/plugins directory. Restart Gerrit.

http://stackoverflow.com/comment/32177430
score: 0
comment on: http://stackoverflow.com/q/21340539
has text: Thanks, was having a hard time trying to summarize it; changed it.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21323389
score: 0
type: Answer
has body: Replace your catch statement with: catch(InputMismatchException excep1) { String word = inputFile.next(); i-=1; } You were incrementing the array counter if it found a word. I have run my own test and this worked for me to fix your issue. public static void printArrayAndIntegerCount(Integer[] array, String filename) { String message = ""; int i = 0; while(i &lt; array.length &amp;&amp; array[i]!=null){ message = message + "index = "+i+", element = "+array[i]+"\n"; i+=1; } System.out.println("number of integers in file \""+filename+"\" = "+i); System.out.println(message); }
answers question: http://stackoverflow.com/q/21323037
has comment: http://stackoverflow.com/comment/32142940

http://stackoverflow.com/comment/31958467
type: Comment
type: QuestionComment
has text: You are testing the parser so it is the CUT. You should not mock the CUT, this defeats the object of testing it. I would take a `URI` as input rather than a `File` and store the testcase in the testing classpath. Then you can use the `ClassLoader` to locate it and pass in the URI.
comment on: http://stackoverflow.com/q/21219419
score: 0

http://stackoverflow.com/q/21336216
has body: My application has a lot of DataAccessObjects and I have to put them in my applicationContext.xml file like this: &lt;bean id="sourceOfferDAO" class="com.example.dao.OfferDAO"&gt; &lt;constructor-arg ref="sourceDataSource" /&gt; &lt;/bean&gt; I would like to know whether I can generate these entries based on a list of classes? Autowiring is not an option now.
accepted answer: http://stackoverflow.com/a/21336333
tagged with: applicationcontext
favorite count: 0
tagged with: code-generation
upvote count: 1
tagged with: spring
type: AnsweredQuestion
has title: Is there a way to generate applicationContext.xml for Spring?
has answer: http://stackoverflow.com/a/21336333
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32165659
has comment: http://stackoverflow.com/comment/32165324
type: Question
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/31927668
has text: can you please explain to me how can i use this in my case? because i'm still beginner, and i didn't really understand the code.
type: Comment
comment on: http://stackoverflow.com/a/21202146
score: 0
type: AnswerComment

http://stackoverflow.com/q/21223502
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31966017
has comment: http://stackoverflow.com/comment/31965840
has comment: http://stackoverflow.com/comment/31965914
has comment: http://stackoverflow.com/comment/31966449
has title: Why Doesn't My Board Appear when creating connect four?
has body: I'm trying to make a GUI Java Code of Connect Four, however none of my game Board circles appear. I have drawn them onto the board however they just don't show up. I don't understand what I'm doing wrong. Please help and see revised code: import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; import java.io.*; //how do I get the board to actually appear? public class JenniferConnectFourJan19 { static int [][] boardArray = new int [6][7]; static String [][] spotOnBoard = new String [6][7]; static int maxRow=6; static int maxCol=7; static boolean endOfGame = false; static boolean gameStart; static JPanel boardPanel; static JButton firstOption = new JButton ("Drop"); static JButton secondOption = new JButton ("Drop"); static JButton thirdOption = new JButton ("Drop"); static JButton fourthOption = new JButton ("Drop"); static JButton fifthOption = new JButton ("Drop"); static JButton sixthOption = new JButton ("Drop"); static JButton seventhOption = new JButton ("Drop"); static JButton playAgain = new JButton ("New"); static JButton reset = new JButton ("Reset"); static JButton exit = new JButton ("Exit"); static int blank =0; static int red=1; static int yellow=2; static int firstColour= red; public static void board() { boardArray = new int [maxRow][maxCol]; for (int row=0; row &lt; maxRow; row++){ for (int col=0; col&lt; maxCol; col++){ boardArray[row][col]= blank; } } } public static class drawBoard extends JPanel { public void paintComponent(Graphics g){ super.paintComponent(g); // drawBoard(g, drawBoard); }//end of paintComponent. void drawConnectFourBoard(Graphics g){ g.setColor(Color.BLUE); g.fillRect(110, 50, 100+100*maxCol, 100+100*maxRow); for (int row=0; row&lt;maxRow; row++) for (int col=0; col&lt;maxCol; col++) { if (boardArray[row][col]==blank) g.setColor(Color.white); if (boardArray[row][col]==red) g.setColor(Color.red); if (boardArray[row][col]==yellow) g.setColor(Color.yellow); g.fillOval(160+100*col, 100+100*row, 100, 1…
linked to: http://stackoverflow.com/q/21222937
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31965825
favorite count: 0
has comment: http://stackoverflow.com/comment/31965896
has comment: http://stackoverflow.com/comment/31965962
has comment: http://stackoverflow.com/comment/31965918
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31966067
score: -1
has answer: http://stackoverflow.com/a/21224198

http://stackoverflow.com/comment/31973668
has text: oh okay I got it. but this is recursion, we don't need while loop because the recursive method itself will do the loop. :)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21227709

http://stackoverflow.com/a/21224999
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21217724
has comment: http://stackoverflow.com/comment/31970119
has body: Try to rebuild your project or reconfigure your build path

http://stackoverflow.com/a/21235372
has body: It is possible that your IntelliJ's available memory space is not large enough to allocate 1024 to your process. Try reducing the JVM size for your process or increase the IntelliJ JVM memory size EDIT: I just learned that the process will not run inside the memory space of the IntelliJ JVM, albeit its own. Also a quick search on the www lead me to understand that the max size of the heap that can be allocated is limited to around 4 GB on a 32bit machine subject to the availability of enough contiguous memory... generally gets limited to 1.2 GB. That might be the problem in your case
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21235109
has comment: http://stackoverflow.com/comment/31993662
has comment: http://stackoverflow.com/comment/31988198
has comment: http://stackoverflow.com/comment/31987078
answers question: http://stackoverflow.com/q/21235109
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31991446
has comment: http://stackoverflow.com/comment/31989394
type: Answer
score: 1

http://stackoverflow.com/q/21340165
answer count: 5
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/21340184
has answer: http://stackoverflow.com/a/21340258
tagged with: arrays
has answer: http://stackoverflow.com/a/21340184
has answer: http://stackoverflow.com/a/21340223
score: 0
has answer: http://stackoverflow.com/a/21340414
has title: Converting string to char array in Java?
accepted answer: http://stackoverflow.com/a/21340223
has answer: http://stackoverflow.com/a/21340195
has body: I have something like the below: char[] array = new char[5]; String a = "HELLO"; String b = "WORLD"; array[0] = a.toCharArray(); array[1] = b.toCharArray(); I get error "incompatible types, char[] cannot be converted to char". My final product I'd like something like the below: array = {{H},{E},{L},{L},{O}},{{W},{O},{R},{L},{D}}; array becomes a [2][5] array in the end result. Is toCharArray() the incorrect method to use?

http://stackoverflow.com/comment/31906485
type: QuestionComment
type: Comment
has text: Can you please post your test class ? The probem seems to be there.
comment on: http://stackoverflow.com/q/21190019
score: 0

http://stackoverflow.com/comment/32099089
has text: You'll also want to use String.substring to extract parts of a string where you have identified the beginning and end of the bit you want.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21298740

http://stackoverflow.com/comment/32130632
score: 0
comment on: http://stackoverflow.com/q/21316869
type: Comment
type: QuestionComment
has text: That does not even mention different web services architectures.

http://stackoverflow.com/a/21192629
score: 0
type: Answer
has body: Maybe it's best to place your file external to your jar file if it needs to be read in and manipulated by other jars in your application. Like so: file.gz myjar.jar myjar2.jar That way you can obtain an absolute path to the common resource file by using code like: static final String WORKINGDIR = System.getProperty("user.dir"); static final String SEPARATOR = System.getProperty("file.separator"); String path = WORKINGDIR + SEPARATOR + "file.gz"; URL url = SentenceParser.class.getResource(path); Try this and see if it works. The thing is that when you run your application directly from within Eclipse, the application itself is not inside a jar. You're just running the class files, unpackaged. Therefore, it can find the resource file just fine. But when you jar your application and run it, the resource file resides inside the jar and the application has difficulty locating it. If you keep your resource files external to the jar, they are easier to locate using the code I provided above. I find this works best for me, anyway.
answers question: http://stackoverflow.com/q/21190441

http://stackoverflow.com/q/21269417
has comment: http://stackoverflow.com/comment/32047682
has answer: http://stackoverflow.com/a/21272279
upvote count: 2
has comment: http://stackoverflow.com/comment/32048138
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32049806
tagged with: swing
has comment: http://stackoverflow.com/comment/32047643
score: 2
has comment: http://stackoverflow.com/comment/32052474
tagged with: java
has comment: http://stackoverflow.com/comment/32048201
has comment: http://stackoverflow.com/comment/32047898
has title: Are GridLayout cells really all the same size?
type: Question
tagged with: layout
linked to: http://stackoverflow.com/q/9510125
downvote count: 0
answer count: 1
favorite count: 0
has body: I decided to use a GridLayout LayoutManager for my Java Swing app because each cell within the grid is supposed to be exactly the same size. From the Java Tutorials: A GridLayout object places components in a grid of cells. Each component takes all the available space within its cell, and each cell is exactly the same size. And even in the description of the GridLayout class: The GridLayout class is a layout manager that lays out a container's components in a rectangular grid. The container is divided into equal-sized rectangles, and one component is placed in each rectangle. However, my code seems to make a certain cell twice as large as the others. I added 3 JPanels to a Container with GridLayout, and gave each JPanel a different background color. This was the result: Clearly, the first JPanel (red background) is twice as big as the others (green and yellow). The code that produced this is the following: public void updateListFrameContentPane(Container mainPane) { mainPane.setLayout(new GridLayout(1,0)); JPanel listPanel = new JPanel(); listPanel.setLayout(new BoxLayout(listPanel, BoxLayout.Y_AXIS)); listPanel.add(friendsLabel); listPanel.add(listScrollPane); listPanel.setBackground(Color.RED); mainPane.add(listPanel); for(JPanel chatPanel : chatPanels) { chatPanel.setBackground((Math.random()&gt;0.5 ? Color.YELLOW : Color.GREEN)); mainPane.add(chatPanel); } } All I do is set the Container's layout to GridLayout with 1 row and any number of columns, and then add 3 JPanels to that. So why is the first JPanel so much larger? Strangely this only happens when two or more chatPanels are added. When there is only one, it formats correctly.
linked to: http://stackoverflow.com/q/21244363
has comment: http://stackoverflow.com/comment/32047856

http://stackoverflow.com/comment/32037886
type: Comment
score: 0
has text: It looks like the class you are editing is not the same as which is used at compile-time. Otherwise I don't see any reason why the line wouldn't change. Can you post the code?
type: QuestionComment
comment on: http://stackoverflow.com/q/21264113

http://stackoverflow.com/q/21211035
score: 0
tagged with: jdbc
has body: i want to use the string input in textfield in JFrame form as a part of my sql query in java. For example if i input a name in textfield, i want the sql query to use that name and give the relevant data and not the data of entire table. Like "select * from *table_name* where name = *textfield_input* ;" following is the code that i'm using to get the data of the entire table. private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { DefaultTableModel model = (DefaultTableModel)p1.getModel(); try{ Class.forName("java.sql.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/ritick","root", "iit2012054"); Statement st = con.createStatement(); String query = "select * from student;"; ResultSet rs = st.executeQuery(query); while(rs.next()){ String d1 = rs.getString("roll_no"); String d2 = rs.getString("name"); String d3 = rs.getString("dept"); String d4 = rs.getString("cgpa"); model.addRow(new Object[]{d1,d2,d3,d4}); } rs.close(); st.close(); con.close(); } catch (Exception e){ JOptionPane.showMessageDialog(this, "error in connectivity !"); } // TODO add your handling code here: } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { DefaultTableModel model = (DefaultTableModel)p2.getModel(); try{ Class.forName("java.sql.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/ritick","root", "iit2012054"); Statement st = con.createStatement(); String query = "show databases;"; ResultSet rs = st.executeQuery(query); while(rs.next()){ String d1 = rs.getString("database"); model.addRow(new Object[]{d1}); } rs.close(); st.close(); con.close(); } catch (Exception e){ JOptionPane.showMessageDialog(this, "error in connectivity !"); } }
has title: java database connectivity: jdbc
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31943640
tagged with: java
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/21217060
has comment: http://stackoverflow.com/comment/31943610
answer count: 1

http://stackoverflow.com/q/21220689
accepted answer: http://stackoverflow.com/a/21229871
tagged with: algorithm
has comment: http://stackoverflow.com/comment/31961396
has title: Suduko simulating Annealing
has comment: http://stackoverflow.com/comment/31961118
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has body: Is Simulating Annealing a good algorithm for generating and solving Sudoku problems? Why or why not? I had implemented a Sudoku game with backtracking but now I want to do it with a local search kind of algorithm in Java. However, I have no idea of where to start. Is there any available library I could use?
has answer: http://stackoverflow.com/a/21229871
type: Question
upvote count: 2
answer count: 2
tagged with: artificial-intelligence
tagged with: sudoku
possible better answer: http://stackoverflow.com/a/21220772
has answer: http://stackoverflow.com/a/21220772
tagged with: java
has comment: http://stackoverflow.com/comment/31960835

http://stackoverflow.com/a/21290865
accepted answer of: http://stackoverflow.com/q/21288493
has comment: http://stackoverflow.com/comment/32085974
answers question: http://stackoverflow.com/q/21288493
score: 2
type: AcceptedAnswer
downvote count: 0
has body: The position is declared an an Array, yet you use it an a Int. Changing it to a simple int should fix your problem. class Tile extends Button{ public int position; public Tile(){ super(); position = 0; } } The Initialization method: { Tile tiles [][] = new Tile[10][10]; for(int i=0; i&lt;10; i ++){ for(int j =0; j&lt;10; j++){ tiles[i][j].position = i*10+j; tiles[i][j].addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler&lt;MouseEvent&gt;(){ @Override public void handle(MouseEvent e) { System.out.println(((Tile)(e.getSource())).position); } }); } } }
upvote count: 2
has comment: http://stackoverflow.com/comment/32088181
has comment: http://stackoverflow.com/comment/32087855
type: Answer

http://stackoverflow.com/comment/31963325
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21222087
has text: You may need to kill tomcat manually. Does it appear is `ps auxfww`?

http://stackoverflow.com/comment/31930017
has text: str = str.replaceAll("\\D+","");
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21203473
type: Comment

http://stackoverflow.com/comment/32074085
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21285080
has text: I am opening it in gedit

http://stackoverflow.com/comment/32129288
comment on: http://stackoverflow.com/a/21316245
type: AnswerComment
has text: Did you try using `\\ ` instead of `/`? For instance, `C:\\OpenOffice 4\\program\\python.exe` instead of `C:/OpenOffice 4/program/python.exe`.
score: 0
type: Comment

http://stackoverflow.com/comment/32065798
type: Comment
type: QuestionComment
has text: Tried @Manu it shows nothing :(
comment on: http://stackoverflow.com/q/21280211
score: 0

http://stackoverflow.com/comment/32343944
type: AnswerComment
score: 0
type: Comment
has text: dex2jar and similar tools are notorious for emitting problematic exception handler tables (overlapping ranges, odd discontinuities, etc.). That is probably the cause, but there is no solution other than to try another decompiler.
comment on: http://stackoverflow.com/a/21327109

http://stackoverflow.com/comment/31951534
type: Comment
type: QuestionComment
has text: Why would your teacher do such a thing? The two answers posted here both imply that a `Cell` is some kind of `Program`. I would ask your teacher whether this makes any sense at all to them.
comment on: http://stackoverflow.com/q/21207204
score: 0

http://stackoverflow.com/q/21222937
tagged with: java
has comment: http://stackoverflow.com/comment/31970053
type: AnsweredQuestion
upvote count: 0
tagged with: icons
has title: Java Swing Window
favorite count: 0
has answer: http://stackoverflow.com/a/21223371
has comment: http://stackoverflow.com/comment/31964945
type: Question
tagged with: paintcomponent
has body: import javax.swing.*; import java.awt.*; public class Main { public static void main(String[] args) { //load the card image from the gif file. final ImageIcon cardIcon = new ImageIcon("cardimages/tenClubs.gif"); //create a panel displaying the card image JPanel panel = new JPanel() { //paintComponent is called automatically by the JRE whenever //the panel needs to be drawn or redrawn public void paintComponent(Graphics g) { super.paintComponent(g); cardIcon.paintIcon(this, g, 20, 20); } }; //create &amp; make visible a JFrame to contain the panel JFrame window = new JFrame("Title goes here"); window.add(panel); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setBackground(new Color(100, 200, 102)); window.setPreferredSize(new Dimension(200,200)); window.pack(); window.setVisible(true); } } I am trying to make a java project that will display all 52 cards on a window. I have the window working but I cant get a card to appear on the window. I am using eclipse for OSX, inside the project src file I have a (default package) container with my Main.java file. Then I have my cardimages folder in the same src file. How can I get the image to show in the window?
score: -1
has comment: http://stackoverflow.com/comment/31965119
has comment: http://stackoverflow.com/comment/31964855
accepted answer: http://stackoverflow.com/a/21223371
tagged with: swing
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31965166

http://stackoverflow.com/comment/31990723
has text: I get that you probably never faced any integration issues when using Java together with some closed source third-party library ;). Or when you need to implement additional functionality where the official documentation is almost non-existent and Google returns exactly 0 results. There is nothing unethical trying to understand how something works.
comment on: http://stackoverflow.com/a/21237055
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/q/21209866
tagged with: java
has comment: http://stackoverflow.com/comment/31941210
has title: Image processing code run time error
tagged with: runtime-error
score: 0
has body: I'm working on a project for my comp sci class which deals with image processing. My group and I are going to vertically flip and rotate a picture 90 degrees. The first part of my code is the sample from my teacher that turns the photo gray. I'm able to compile my code, but I get the error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at Project6b.main(Project6b.java:10) Press any key to continue... I'm not even sure if what I've coded so far works, and I can't get this to run. Can anyone help me solve my runtime error? import java.awt.image.*; import java.io.*; import javax.imageio.*; import java.awt.*; public class Project6b { public static void main (String args[]) throws Exception { // I would use these, if the program is finished. //grayscale(args[0], args[1]); //verticalFlip(args[0], args[1]); // I would comment the first two lines and //uncomment these for testing purposes. //grayscale("Vicc.jpg", "Vicc2.jpg"); verticalFlip("Vic.png", "Vic2.png"); } /*public static void grayscale(String originalImage, String convertedImage) throws Exception { BufferedImage bufferImg = ImageIO.read(new File(originalImage)); int r,g,b; Color color = null; for( int x = 0; x &lt;bufferImg.getWidth(); x++) { for(int y = 0; y&lt;bufferImg.getHeight(); y++) { int rgb = bufferImg.getRGB(x,y); color = new Color(rgb,true); r = color.getRed(); g = color.getGreen(); b = color.getBlue(); color = new Color((r+g+b)/3, (r+g+b)/3, (r+g+b)/3); bufferImg.setRGB(x,y, color.getRGB()); } } File outputfile = new File(convertedImage); ImageIO.write(bufferImg, "png", outputfile); } */ public static void verticalFlip(String originalImage, String convertedImage) throws Exception { BufferedImage bufferImg = ImageIO.read(new File(originalImage)); BufferedImage bufferImgOut = new BufferedImage(bufferImg.getWidth(),bufferImg.getHeight(), bufferImg.getType()); for (int x = 0; x &lt; bufferImg.getWidth(); x++) { for (int y = 0; y &lt; bufferImg.getHeight(); y++) { int px = bufferImg…
has answer: http://stackoverflow.com/a/21210153
answer count: 1
type: UnansweredQuestion
tagged with: image-processing
type: Question

http://stackoverflow.com/comment/31946783
has text: @user1302551 what do you mean by *return the new method in a string*?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21212537

http://stackoverflow.com/a/21210802
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31943235
type: Answer
has comment: http://stackoverflow.com/comment/31943076
has body: The problem is it waits forever. processMessage() is never called after I sent @refresh message Looks to me that your listRooms() call is doing a wait on the Client object while your processMessage(...) method is calling notify() on a Listener object. For the notify() to wake up the other thread it must be on the same object instance. When you have a synchronized method, it is locking on the this object instance. These two objects must share a common lock object to be able to signal each other. One way you can do this is to pass in a lock object into both the Client and the Listener and then do something like: synchronized (commonLock) { commonLock.wait(); } ... synchronized (commonLock) { commonLock.notify(); } EDIT: It also indicates that Listener thread is blocked for some reason... I don't know why the Listener would be blocked but it's not because of the notify() call.
upvote count: 3
has comment: http://stackoverflow.com/comment/31943320
answers question: http://stackoverflow.com/q/21210760
has comment: http://stackoverflow.com/comment/31943097

http://stackoverflow.com/a/21353345
has body: I guess the problem is caused by inlining. If you don't use inline, simple will put all elements as childs into a set-tag. This tag contains e.g. a class="java.util.LinkedHashSet" attribute, what makes it possible to decide the set-implementation. But this is impossible for an inline-collection, so simple takes a default one. What you can do: Use private LinkedHashSet&lt;Item&gt; items; as you've already written - this makes very clear what implementation you want Use a constructor where you instantiate the implementation: public Items() { this.items = new LinkedHashSet&lt;&gt;(); } Write a Converter, where you handle the deserialisation by your own (possible an overkill).
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32299096
has comment: http://stackoverflow.com/comment/32592660
type: Answer
answers question: http://stackoverflow.com/q/21215330
accepted answer of: http://stackoverflow.com/q/21215330
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32200684

http://stackoverflow.com/q/21255263
has body: Suddenly when trying to add an external library (jar) from disk to my database I get NoClassDefFoundError when running the agent. This has worked before without any hustle. [0A04:001B-13BC] 2014-01-21 11:24:57 AMgr: Start executing agent 'areadregis' in 'kunder\lf\emir.nsf' [0A04:001E-0F38] 2014-01-21 11:24:57 Agent Manager: Agent error: Exception in thread "AgentThread: readRegis" [0A04:001F-0F38] 2014-01-21 11:24:57 Agent Manager: Agent error: java.lang.NoClassDefFoundError: org.apache.commons.i o.FileUtils In reference to this thread https://stackoverflow.com/questions/14464827/are-jar-files-in-webcontent-web-inf-lib-available-to-java-design-elements-in-dom I have tried all tips but still failing. My code gets an error when referencing the library and suggest me to add it to Build Path. The thing is that it is already in my build path. If I add the jar file to WebContent/WEB-INF/lib/ and the right-click and add to Build Path it moves up to Referenced Libraries. The Java agent compiles without errors or warnings but when running it stops with an other error: [19D8:01CB-17D8] 2014-01-21 11:13:25 Agent Manager: Agent error: Exception in thread "Launcher: readRegis" [19D8:01CC-17D8] 2014-01-21 11:13:25 Agent Manager: Agent error: java.lang.Error: Unresolved compilation problems: The import org.apache.commons.io cannot be resolved FileUtils cannot be resolved running Domino 9.0.1 Win/64 Please advice
has comment: http://stackoverflow.com/comment/32022110
tagged with: lotus-domino
upvote count: 1
has answer: http://stackoverflow.com/a/28562768
has answer: http://stackoverflow.com/a/21255963
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21255963
possible better answer: http://stackoverflow.com/a/28562768
has comment: http://stackoverflow.com/comment/32021826
answer count: 2
tagged with: domino-designer-eclipse
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32022171
score: 1
has title: How to resolve NoClassDefFoundError Java agent
tagged with: java

http://stackoverflow.com/a/21211549
has body: The last condition, k += 2 occurs after the first iteration of the loop. So it's k = 1, sum = 1 k = 3, sum = 4 k = 5, sum = 9 k = 7, sum = 16 k = 9, sum = 25
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21211502

http://stackoverflow.com/a/21305221
has comment: http://stackoverflow.com/comment/32109886
has comment: http://stackoverflow.com/comment/32110509
has comment: http://stackoverflow.com/comment/32110281
score: 7
has comment: http://stackoverflow.com/comment/32110946
upvote count: 7
has comment: http://stackoverflow.com/comment/32111118
has comment: http://stackoverflow.com/comment/32110049
answers question: http://stackoverflow.com/q/21305129
downvote count: 0
has comment: http://stackoverflow.com/comment/32110577
has body: You've misunderstood how Date works. A Date doesn't have a time zone - if you use Date.toString() you'll always see the default time zone. The long value in a Date is purely the number of milliseconds since the Unix epoch: it doesn't have any concept of time zone or calendar system. If you want to represent a date and time in a particular time zone and calendar, use Calendar instead - but for getting "the current date and time as a long" you can just use System.currentTimeMillis(), which again does not have anything to do with the system time zone. Additionally, even if you did want to do manipulation like this, you shouldn't be using string conversions. You're not conceptually performing any string conversions, so why introduce them? If your aim is to display (as a string) the current date and time in a particular time zone, you should just use something like: Date date = new Date(); // This will use the current time SimpleDateFormat format = new SimpleDateFormat(...); // Pattern and locale format.setTimeZone(zone); // The zone you want to display in String formattedText = format.format(date); When working with date and time APIs - particularly bad ones like the Java Calendar/Date API - it's very important that you understand exactly what each value in your system represents.
has comment: http://stackoverflow.com/comment/32110020
type: Answer

http://stackoverflow.com/comment/32092680
has text: thank you for your comment! all I did was not compiling before running on terminal! and this code is not finished. just the guideline changed :0
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21290659

http://stackoverflow.com/q/21186818
has answer: http://stackoverflow.com/a/21186909
type: Question
has comment: http://stackoverflow.com/comment/31899679
possible better answer: http://stackoverflow.com/a/21186913
accepted answer: http://stackoverflow.com/a/21186909
tagged with: replace
score: 0
tagged with: char
tagged with: arrays
has comment: http://stackoverflow.com/comment/31899363
tagged with: string
favorite count: 0
has title: Java - I can't replace char 'Á' with another char in String
answer count: 4
type: AnsweredQuestion
has body: Why this "Á" alphabet doesn't change? this code works on the other alphabet but Á. public class Convert { static String turkishCharacterConverter(String s) { StringBuilder x = new StringBuilder(); char[] charArr = s.toLowerCase().toCharArray(); for (int i = 0; i &lt; charArr.length; i++) { if (charArr[i] == '˝') { x.append('I'); } else if (charArr[i] == '˛') { x.append("S"); } else if (charArr[i] == '') { x.append("G"); } else if (charArr[i] == 'ˆ') { x.append("O"); } else if (charArr[i] == '¸') { x.append("U"); } else if (charArr[i] == 'Á') { x.append("C"); } else { x.append(s.charAt(i)); } } return x.toString(); } public static void main(String[] args) { System.out.println(turkishCharacterConverter("˝˛˝˝nda")); System.out.println(turkishCharacterConverter("ˆlÁt¸¸m")); } } and java print ISIGInda OlÁtUGUm ( i want to make java print "OlCtUGUm" )
tagged with: java
has answer: http://stackoverflow.com/a/21186979
has answer: http://stackoverflow.com/a/21186913
has answer: http://stackoverflow.com/a/21187043
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/96467907
comment on: http://stackoverflow.com/a/54847689
type: AnswerComment
has text: Centainly you can add another level box5 to seperate JButton and JLabel, then it works.
score: 0
type: Comment

http://stackoverflow.com/q/21342376
tagged with: android
has title: Boot Strapping RoboGuice
has answer: http://stackoverflow.com/a/21342458
score: 0
has body: I am trying out RoboGuice-Sherlock in a application. I wrote a custom Binding that uses a provider. public class ActionBarProvider implements Provider&lt;ActionBar&gt;{ @Override public ActionBar get() { return new SherlockFragmentActivity().getSupportActionBar(); } } public class MyModule implements Module{ @Override public void configure(Binder binder) { binder.bind(ActionBar.class).toProvider(ActionBarProvider.class); } } Following the documentation I register the module but now I am having a cannot resolved type error. The method newDefaultRoboModule(Application) in the type RoboGuice is not applicable for the arguments (LoginAndRegistrationActivity) public class LoginAndRegistrationActivity extends RoboSherlockFragmentActivity{ @InjectView (R.id.login_reg_pager) private ViewPager viewPager; @Inject private FragmentManager fragmentManager; @Inject private ActionBar actionBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); RoboGuice.setBaseApplicationInjector(this, RoboGuice.DEFAULT_STAGE, RoboGuice.newDefaultRoboModule(this),new RoboGuiceModule()); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); } } What am I doing wrong and how can I resolve this problem?
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21342458
type: Question
tagged with: roboguice
answer count: 1

http://stackoverflow.com/a/21279359
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32064076
has comment: http://stackoverflow.com/comment/32064266
score: 2
has comment: http://stackoverflow.com/comment/32064422
has body: You can do something like this. log4j.appender.transaction=org.apache.log4j.DailyRollingFileAppender log4j.appender.transaction.DatePattern='.'yyyy-MM-dd log4j.appender.transaction.File=logs/transaction.log log4j.appender.transaction.layout=org.apache.log4j.PatternLayout log4j.appender.transaction.layout.ConversionPattern=%d{dd MMM yyyy HH\:mm\:ss} %-5p %c{2}\:%L - %m%n log4j.appender.transaction.threshold=info log4j.logger.transaction=INFO, transaction
answers question: http://stackoverflow.com/q/21279299
upvote count: 2

http://stackoverflow.com/comment/32039134
score: 0
has text: Hi rcook. The upvote is mine because I found the hint you gave me useful. I do always try to tick posts that answer the question posed in full. I would classify your post as a useful hint or clue, rather than a full answer, however, which is why I haven't ticked it, but I am grateful for the assistance and it did help me find the answer.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21217350

http://stackoverflow.com/q/21203497
tagged with: java
upvote count: 1
has title: Custom locale redirect after login - Spring Security
type: Question
has body: I am writing a simple prototype Spring MVC 3.2 with Spring Security. My requirements specify that the urls must be of the following structure http://app-name/{locale}/signin http://app-name/{locale}/logout http://app-name/{locale}/account I have implemented a Filter to set the locale as a request attribute and successfully managed to get everything working, except spring-security login process, where it does redirect to /account on successful login. I was wondering whether it is possible to define some kind of wrappers for these actions? &lt;security:intercept-url pattern="/signin" access="permitAll"/&gt; &lt;security:form-login login-page="/signin" login-processing-url="/security_check" username-parameter="username" password-parameter="password" authentication-failure-url="/signin" default-target-url="/account" /&gt;
downvote count: 0
has answer: http://stackoverflow.com/a/21210176
linked to: http://stackoverflow.com/q/6769654
tagged with: spring-security
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: internationalization
tagged with: spring-mvc
score: 1

http://stackoverflow.com/comment/32022939
score: 0
has text: I was wrong and feel kind of stupid. Let me revise this and return!
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21255963

http://stackoverflow.com/comment/31938042
type: QuestionComment
comment on: http://stackoverflow.com/q/21208049
has text: You will need to take the code out of the comment and format it somewhere readable.
score: 0
type: Comment

http://stackoverflow.com/q/21188057
answer count: 0
has title: Access Opened Java IO Streams from Another Java Application
type: UnansweredQuestion
tagged with: stream
has body: I am working on a game with multiplayer support. The connection between the client and server is not encrypted (I'm going to add it soon). Is there a way in Java that I could connect to the already opened IO streams and inject packets?
has comment: http://stackoverflow.com/comment/31903117
has comment: http://stackoverflow.com/comment/31902834
has comment: http://stackoverflow.com/comment/31904036
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31903963
score: 0
tagged with: io
has comment: http://stackoverflow.com/comment/31905671

http://stackoverflow.com/a/21279054
answers question: http://stackoverflow.com/q/21278517
accepted answer of: http://stackoverflow.com/q/21278517
has comment: http://stackoverflow.com/comment/32063540
score: 0
has body: here is a simple : WebAppInterface.java public class WebAppInterface { Context mContext; /** Instantiate the interface and set the context */ WebAppInterface(Context c) { mContext = c; } public void storeText(String text) { //TODO save text Toast.makeText(mContext, text, Toast.LENGTH_LONG).show(); } } WebView webview=(WebView)findViewById(R.id.webview); webview.getSettings().setJavaScriptEnabled(true); webview.addJavascriptInterface(new WebAppInterface(this), "Android"); Now you can call this method in html ,see it &lt;script type="text/javascript"&gt; function saveFunction(text) { Android.storeText(text); } &lt;/script&gt;
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/32096944

http://stackoverflow.com/comment/31895309
has text: To run a jar: java -jar server.jar. You have to copy the jar file to the server and run it. In case it's a web application you have to publish the war or ear.
comment on: http://stackoverflow.com/q/21184441
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21336616
type: Answer
accepted answer of: http://stackoverflow.com/q/21336141
has comment: http://stackoverflow.com/comment/32167231
downvote count: 0
answers question: http://stackoverflow.com/q/21336141
score: 3
has comment: http://stackoverflow.com/comment/32166884
has body: Here's the thing. You don't want a bunch of JPanels as balls. You should just have one JPanel to paint on and use only that one paintComponent method for all the Balls. So you Ball class doesn't need to extend anything at all. The Ball class should only be a model to hold data, such ass the RGB color. You should also a draw method in the ball class that take a Graphics object as an argument, and draws the ball public class Ball { int R, G, B; boolean striped; int x, y; public Ball(int R, int G, int B, boolean striped) { this.R = R: this.G = G; this.B = B; this.striped = striped; } public void drawBall(Graphics g) { if (isStriped) { // draw the ball with the values from this class } else { // draw the ball with the values from this class } } } Then in the class that you're doing the actual drawing with, you want to have a list of Ball objects public class TablePanel extends JPanel { List&lt;Ball&gt; balls = new ArrayList&lt;Ball&gt;(); public TablePanel(){ makeBalls(); } public void makeBalls(){ balls.add(new Ball(213, 2, 255, true); // add more balls } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); for (Ball ball : balls) { ball.drawBall(g); } } } You can see all I did was use the method ball.drawBall(g);. The ball will appear. But you will also need to specify the x and y location of the ball too. Then when you need to animate the balls, just change their x and y fields. Here's an example import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.util.ArrayList; import java.util.List; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class SorryPoolTable extends JPanel{ List&lt;ABall&gt; balls = new ArrayList&lt;ABall&gt;(); public SorryPoolTable(){ makeBalls(); } public void makeBalls(){ balls.add(new ABall(213, 2, 255, true, 125, 25)); balls.add(new ABall(65, 34, 25, true, 150, 135)); balls.add(new ABall(124, 211, 45, true, 160, 180)); balls.add(new ABall(35…
type: AcceptedAnswer
upvote count: 3

http://stackoverflow.com/a/21236667
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32011593
type: Answer
score: 6
upvote count: 6
has body: If you use a message format then \n symbol add a new line character. If you want to display this message with actionerror or actionmessage tags you need to use &lt;br&gt; and let it not escape. For example &lt;s:actionmessage escape="false"/&gt;
accepted answer of: http://stackoverflow.com/q/21232592
answers question: http://stackoverflow.com/q/21232592

http://stackoverflow.com/q/21339213
has answer: http://stackoverflow.com/a/29155060
answer count: 2
has answer: http://stackoverflow.com/a/21339312
tagged with: spring-security
has title: org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
possible better answer: http://stackoverflow.com/a/21339312
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/29155060
has body: I am getting the following error when I'm running the code: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: You cannot use a spring-security-2.0.xsd or spring-security-3.0.xsd schema with Spring Security 3.1. Please update your schema declarations to the 3.1 schema. Offending resource: ServletContext resource [/WEB-INF/spring-security.xml] at org.springframework.beans.factory.parsing.FailFastProblemReporter.fatal(FailFastProblemReporter.java:59) at org.springframework.beans.factory.parsing.ReaderContext.fatal(ReaderContext.java:68) at org.springframework.beans.factory.parsing.ReaderContext.fatal(ReaderContext.java:55) at org.springframework.security.config.SecurityNamespaceHandler.parse(SecurityNamespaceHandler.java:68) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1335) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135) The classes that I am using are 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.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.3.xsd"&gt; &lt;http auto-config="true"&gt; &lt;intercept-url pattern="/login*" access="ROLE_USER" /&gt; &lt;/http&gt; &lt;authentication-manager&gt; &lt;authentication-provider&gt; &lt;user-service&gt; &lt;user name="admin" password="roseindia" authorities="ROLE_USER" /&gt; &lt;/user-service&gt…
score: 0

http://stackoverflow.com/comment/32023656
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21250448
score: 0
has text: It is funny how people who don't have the slightest idea how to do something insist on an *efficient* approach.

http://stackoverflow.com/a/21240883
downvote count: 0
score: 54
has comment: http://stackoverflow.com/comment/41660571
has comment: http://stackoverflow.com/comment/66684415
has comment: http://stackoverflow.com/comment/43740088
has body: The APIs for the Distributed Cache can be found in the Job class itself. Check the documentation here: http://hadoop.apache.org/docs/stable2/api/org/apache/hadoop/mapreduce/Job.html The code should be something like Job job = new Job(); ... job.addCacheFile(new Path(filename).toUri()); In your mapper code: Path[] localPaths = context.getLocalCacheFiles(); ...
upvote count: 54
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/59565210
accepted answer of: http://stackoverflow.com/q/21239722
has comment: http://stackoverflow.com/comment/41541588
answers question: http://stackoverflow.com/q/21239722
has comment: http://stackoverflow.com/comment/32001252
type: Answer
has comment: http://stackoverflow.com/comment/32028115

http://stackoverflow.com/a/21271566
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21271480
has body: First, your roster is of the raw form of ArrayList, so the get method will return an Object, not a Player. Use generics to specify "of what" on your ArrayList: private static ArrayList&lt;Player&gt; roster; and in your Team constructor: public Team (String teamname, ArrayList&lt;Player&gt; teamroster, double price, double teambudget, int games) { Next, allstar is a private field in Player. Create a public getter method and call it instead of referencing the field directly. Next, for some reason your roster variable and numberOfAllstars method are static. There's no reason for that. Just make everything non-static here. Also, there's no reason for the name parameter on numberOfAllStars; it can be removed. Additionally, once you do that, you will run off the end of the array with this for loop, because indexes range from 0 to size() - 1. for (int counter = 0; counter &lt;= rostersize; counter++) { Try for (int counter = 0; counter &lt; rostersize; counter++) { And, the comparison to true is unnecessary; the condition is already a boolean. Try if (roster.get(counter).isAllstar()) (once you've made the getter method isAllstar().

http://stackoverflow.com/q/21348850
has comment: http://stackoverflow.com/comment/32199776
type: UnansweredQuestion
has title: Connecting a tomcat project app with mysql on openshift
has comment: http://stackoverflow.com/comment/32210285
has comment: http://stackoverflow.com/comment/32190596
tagged with: http-status-code-404
tagged with: openshift
has comment: http://stackoverflow.com/comment/32189494
has comment: http://stackoverflow.com/comment/32192363
answer count: 0
has comment: http://stackoverflow.com/comment/32326183
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/32188304
tagged with: tomcat
has comment: http://stackoverflow.com/comment/32188367
score: 0
has body: Im trying to make a simple tomcat-mysql connection on openshift. But when i run it on the server it shows a HTTP Status 404 error and i dont know why . Here there are my main files : Java Class: import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class DB_Info { public static final String MYSQL_USERNAME = System.getenv("OPENSHIFT_MYSQL_DB_USERNAME"); public static final String MYSQL_PASSWORD = System.getenv("OPENSHIFT_MYSQL_DB_PASSWORD"); public static final String MYSQL_DATABASE_HOST = System.getenv("OPENSHIFT_MYSQL_DB_HOST"); public static final String MYSQL_DATABASE_PORT = System.getenv("OPENSHIFT_MYSQL_DB_PORT"); public static final String MYSQL_DATABASE_NAME = "brooker"; private static Connection con; /** * returns connection to DB * @param con Connection */ public static String initConnection(){ String url = ""; if(con==null){ try { url = "jdbc:mysql://" + MYSQL_DATABASE_HOST + ":" + MYSQL_DATABASE_PORT + "/" + MYSQL_DATABASE_NAME; con = DriverManager.getConnection(url, MYSQL_USERNAME, MYSQL_PASSWORD); } catch (SQLException e) { e.printStackTrace(); return e.getMessage(); } } return "Connection Initialized!"; } public static Connection getConnection() { if (con == null) { initConnection(); } return con; } } My web.xml file: <?xml version="1.0" encoding="UTF-8"?> HelloWorld Application This is a simple web application with a source code organization based on the recommendations of the Application Developer's Guide. DB_Info DB_Info DB_Info /DB_Info And my pom.xml file : 4.0.0 brooker brooker war 1.0 brooker eap http://maven.repository.redhat.com/techpreview/all true true eap http://maven.repository.redhat.com/techpreview/all true true <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.6</maven.compiler.source> <maven.compiler.target>1.6</maven.compiler.target> org.postgresql postgresql 9.2-1003-jdbc4 mysql mysql-connector-java 5.1.25 openshift brooker maven-war-plugin 2.1.1 weba…

http://stackoverflow.com/a/21261136
has body: You can use Visitor Pattern for this. interface Message{ public void accept(MessageVisitor visitor); } interface MessageVisitor{ public void visit(TextMessage message); public void visit(AudioMessage message); } class PrintVisitor implements MessageVisitor{ public void visit(TextMessage message){ //print text message } public void visit(AudioMessage message){ //do step required } } class TextMessage implements Message{ //other methods public void accept(MessageVisitor visitor){ visitor.visit(this); } } Using this double dispatch technique your instanceof checks are not required. As well as the Printing logic goes out in the PrintVisitor class, which allows for greater flexibility. visitor.visit(this); in this line you are calling visit on visitor with this, now this will use the actual type of instance, so the method of visitor that will be called will be according to actual type. How do you achieve flexibility? Because now you can add new operations to your Message class without changing the actual code of Message using Visitors Beware of some downfalls too. When your hierarchy of Message changes it will cause change in all the Visitors. So do take care of that.
has comment: http://stackoverflow.com/comment/32032380
answers question: http://stackoverflow.com/q/21261077
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21261077
downvote count: 0
score: 8
has comment: http://stackoverflow.com/comment/32031726
upvote count: 8
has comment: http://stackoverflow.com/comment/32032289
type: Answer

http://stackoverflow.com/comment/31981022
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21209926
has text: @user3209450 B'coz compiler doesn't really know what kind of list might be coming? What if compiler allowed adding a `String`, and you passed a `List<Integer>`?

http://stackoverflow.com/q/21348104
has body: Can someone help me with to come up with a Java Servlet that can upload files in this kind of variation or give me any idea how to it: 5 file input type field, but fill in only 1 or 2 of them (in any file field), and upload those no. of files. I found out the problems to be: 1) If I fill in the file field not from the first one, then it will not upload my file. e.g. I fill in the 3rd file field, and click upload. The file won't be uploaded. But if I fill in the first one, it will get uploaded. Same if I fill in any 2-3 fields, but if I don't fill them in order (1,2,3...), they won't be uploaded. 2) I have radio button below the file fields. If I don't fill in all of the file fields, the radio button values won't be read by the servlet. Can someone enlighten me why this happen? In summary, it works if and only if I fill in all 5 file fields, and tick one of the radio button. The HTML code: File Uploading Form Energy Efficient Color Mapping Texture Transformer Select 5 images to upload: Image 1 Image 2 Image 3 Image 4 Image 5 Select conversion scheme below: Sat 25 Hue 9 Sat 25 Hue 24 Sat 25 Hue 36 Sat 50 Hue 9 Sat 70 Hue 9 Sat 50 Hue 24 Sat 70 Hue 36 So say, I want to just fill in Image 3 and 4, and upload those 2 images. The servlet: // Import required java libraries import java.io.*; import java.util.*; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.apache.commons.io.output.*; public class UploadServlet extends HttpServlet { private boolean isMultipart; private String filePath; private int maxFileSize = 5*1024*1024; private int maxMemSize = 4 * 1024*1024; private File fi…
tagged with: java
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/21382807
score: 0
answer count: 1
tagged with: file-upload
has title: Java Servlet Multiple File Upload Variation
type: UnansweredQuestion

http://stackoverflow.com/a/21311555
type: AcceptedAnswer
downvote count: 0
has body: A Timer starts out repeating, by default. So, your timers are all firing every second, forever. You ought to call setRepeats(false): void doLater(ActionListener action, int delay) { Timer timer = new Timer(delay, action); timer.setRepeats(false); timer.start(); }
type: Answer
has comment: http://stackoverflow.com/comment/32121264
answers question: http://stackoverflow.com/q/21311456
accepted answer of: http://stackoverflow.com/q/21311456
score: 4
upvote count: 4

http://stackoverflow.com/comment/31952138
type: Comment
comment on: http://stackoverflow.com/a/21206146
has text: I´ve done it like you told with a do{} while() in this way: `do ask for input and check wehther input is valid if it is, set the variable if not, return an error while the input doesn´t match` But I do get an null-pointer when typing sth. not matching.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32096329
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21242200
has text: Thanks for your answer. Yes i am familiar with the Serializable interface. I dont use it because its slow on Android (i did use it one time long ago). I am familiar how parcels and the parcelable interface works. I just want to find a way to avoid writing many lines of code in each object. Especially when objects are complicated implementing the parcelable interface is time consuming. So you say that the only way that parcels are so fast in android is that you explicitly declare what you want to write to the parcel? Is this what im trying to make gonna be as slow as Serializable?
score: 0

http://stackoverflow.com/comment/32026786
score: 0
type: Comment
type: QuestionComment
has text: its just a panel with some buttons such as exit, new game, help. i didnt add this code in ask my buttons work
comment on: http://stackoverflow.com/q/21258058

paint
tags question: http://stackoverflow.com/q/21325792
tags question: http://stackoverflow.com/q/21336305
tags question: http://stackoverflow.com/q/21242015
tags question: http://stackoverflow.com/q/21244967
tags question: http://stackoverflow.com/q/21323326
tag name: paint
tags question: http://stackoverflow.com/q/21273533
tags question: http://stackoverflow.com/q/21298547
tags question: http://stackoverflow.com/q/21268190
type: Tag
tags question: http://stackoverflow.com/q/21300526

http://stackoverflow.com/a/21348168
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21347961
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21347961
has body: I think you have two different tables 'shop' in different schemas. One of them is in 'itshop' schema and it contains id, other not.

http://stackoverflow.com/a/21333608
has body: Since you already have the book, I'll quote it for you (p. 98-99): If you want to export contants, there are several reasonable choices. If the constants are strongly tied to an existing class or interface, you should add them to the class or interface. For example, all of the boxed numerical primitive classes, such as Integer and Double, export MIN_VALUE and MAX_VALUE constants. If the constants are best viewed as members of an enumerated type, you should export them with an enum type. Otherwise, you should export the constants with a noninstantiable utility class. However, the answer above deals with exporting constants. If you want to "mandate that a Class provide this constant", that's a different thing, and having constants in your interface does not do that. Only way you could mandate such a thing is to have a getter for it in your interface.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32161496
score: 5
type: Answer
answers question: http://stackoverflow.com/q/21333460
has comment: http://stackoverflow.com/comment/32159742
accepted answer of: http://stackoverflow.com/q/21333460
has comment: http://stackoverflow.com/comment/32165782
upvote count: 5

http://stackoverflow.com/comment/31938777
comment on: http://stackoverflow.com/a/21208422
type: AnswerComment
has text: @ziggy updated the answer with that in mind. Should do the trick.
score: 0
type: Comment

http://stackoverflow.com/comment/32080483
comment on: http://stackoverflow.com/a/21288753
type: Comment
score: 0
has text: As byte allow only -128 to 127 but number of bits allowed is 8. pareByte also internally do the same time. I don't want to play with numbers, I just want the raw data of bits
type: AnswerComment

http://stackoverflow.com/a/21278135
type: Answer
has comment: http://stackoverflow.com/comment/32062507
has comment: http://stackoverflow.com/comment/32062453
has body: Re-reading your question, I suspect the problem is this line: println((double) (total / 10000)*4); You are dividing one integer with another, which will result in an integer. You then cast that to a double, but by then the damage is done. To solve this, force the compiler to treat the 10000 value as a double. This will ensure the result is a double. println((total / 10000d)*4);
answers question: http://stackoverflow.com/q/21278055
score: 0

http://stackoverflow.com/q/21295842
type: UnansweredQuestion
tagged with: java
has title: Using Lucene, how to index TXT files into different fields?
type: Question
has body: I am using the NSF data whose format is txt. Now I have indexed these data and can send a query and got several results. But how can I search something in a selected field (eg. title) ? Because all of these NSF data are totally plain txt file. I do not think Lucene can recognize which part of the file is a "title" or something else. Should I firstly transfer the txt files to XML files (with tags telling Lucene which part is "title")? Can Lucene do that? I have no idea how to split the txt files into several fields. Can anyone please give me some suggestions? Thanks a lot! BTW, every txt file looks like this: ---begin--- Title: Mitochondrial DNA and Historical Demography Type: Award Date: August 1, 1991 Number: 9000006 Abstract: asdajsfhsjdfhsjngfdjnguwiehfrwiuefnjdnfsd ----end----
has answer: http://stackoverflow.com/a/21296731
tagged with: lucene
score: 0
answer count: 1

http://stackoverflow.com/comment/31949672
type: Comment
has text: I don't chat. Part of the reason is *because* the questions on SO are subject to a vetting process. If you want to hire a personal tutor, I am available at $30 per hour (special deal - usually I charge $50+ per hour).
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21214460

http://stackoverflow.com/comment/31912490
score: 0
type: Comment
type: QuestionComment
has text: I'm interested in JVM flags for low latency code execution or OS configuration.
comment on: http://stackoverflow.com/q/21193657

http://stackoverflow.com/a/21308749
upvote count: 1
answers question: http://stackoverflow.com/q/21308623
has body: You should consider using XML strings as a way to display something to the user and change it depending on locale. Never the less, public static final String data="apps"; should be used in order to hide some not-for-user data like db connections, log messages etc.
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/21325201
has comment: http://stackoverflow.com/comment/32180380
tagged with: jfilechooser
type: Question
has body: I have a swing application which takes user input and goes to full screen and displays variations of input image, I want to stop this thread execution on particular key press (prig should not terminate) and program should ask for the another user input. don't know how to approach? plz help here's code::: public class ImageProcessor extends JFrame implements ActionListener { /** * */ private static final long serialVersionUID = 2916361361443483318L; private JFileChooser fc = null; private JMenuItem item1, item2; private BufferedImage image = null; private JFrame frame = null; private JPanel panel = null; private int width = 0; private int height = 0; private BorderLayout card; private Container contentPane; private int wcount = 0; private int hcount = 0; public ImageProcessor() { frame = new JFrame("Image Processor"); contentPane = frame.getContentPane(); panel = new JPanel(); card = new BorderLayout(); panel.setLayout(card); panel.setBackground(Color.white); JMenuBar menuBar = new JMenuBar(); JMenu menu = new JMenu("Menu"); menu.setMnemonic(KeyEvent.VK_M); menuBar.add(menu); item1 = new JMenuItem("Browse an image"); item2 = new JMenuItem("Exit"); item1.addActionListener(this); item2.addActionListener(this); menu.add(item1); menu.add(item2); frame.setJMenuBar(menuBar); contentPane.add(panel); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new ImageProcessor(); } }); } @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == item1) { if (fc == null) fc = new JFileChooser(); int retVal = fc.showOpenDialog(null); if (retVal == JFileChooser.APPROVE_OPTION){ File file = fc.getSelectedFile(); try { image = ImageIO.read(file); width = image.getWidth(); height = image.getHeight(); final GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironme…
has comment: http://stackoverflow.com/comment/32226751
has title: listen for key event while swing main thread is running
score: 0
answer count: 0
tagged with: jframe
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/32227280
tagged with: swing
has comment: http://stackoverflow.com/comment/32145491
tagged with: java

http://stackoverflow.com/a/21399531
type: Answer
answers question: http://stackoverflow.com/q/21273360
score: 0
has body: you are using the latest version of chrome 32.0.1700.76 m......means you have to update the chrome driver server also that is 2.8...and selenium 2.39

http://stackoverflow.com/comment/119061858
has text: this was insightful and something I couldn't find in the docs
type: Comment
comment on: http://stackoverflow.com/a/21219258
score: 0
type: AnswerComment

http://stackoverflow.com/a/21286140
score: 0
type: AcceptedAnswer
has body: It seems I had to set strict mode too. JexlEngine jexl = new JexlEngine(); jexl.setSilent(false); jexl.setStrict(true); I'm not sure if silent mode is actually necessary.
type: Answer
accepted answer of: http://stackoverflow.com/q/21277714
answers question: http://stackoverflow.com/q/21277714

http://stackoverflow.com/a/21282401
accepted answer of: http://stackoverflow.com/q/21282400
has comment: http://stackoverflow.com/comment/36812463
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32099390
has body: The name is the property of the model and also the property of the action class. The modelDriven interceptor pushes the model on top of the value stack, so it is easy to use it in JSP. The action object is below the model. So, it could be referenced directly using [1] prefix. See OGNL basics. But it's not necessary if there's no duplicate property names in the model and action object. When the name such as name is evaluated by OGNL it searches from the top of the valueStack to down the stack for the property accessor. The first found accessor will be executed. So, the model property has a priority because the model is on top of the value stack. If the property with the name name should be set on the action then you could directly name that property as [1].name. But, such parameter name is not accepted by default pattern of params interceptor. However, it is a valid OGNL expression. So, to get it pass through the interceptor you need to add it to a pattern of accepted parameter names. Like that @Action(value="modelDrivenResult", results=@Result(location = "/modelDriven/modelDrivenResult.jsp"), interceptorRefs = @InterceptorRef(value="defaultStack", params={ "params.acceptParamNames", "(\\[\\d+\\]\\.)*\\w+((\\.\\w+)|(\\[\\d+\\])|(\\(\\d+\\))|(\\['\\w+'\\])|(\\('\\w+'\\)))*" }) ) This is because OGNL also checks the pattern of accepted parameters and this regex pattern allows to match both params and OGNL matchers.
has comment: http://stackoverflow.com/comment/32108275
answers question: http://stackoverflow.com/q/21282400
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/32086159
has text: @Sergey -- edited to provide relevant FXML code. @ James_D -- I've printed the object in my debugging and it says it is null :/
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21266694

http://stackoverflow.com/comment/32134549
type: Comment
comment on: http://stackoverflow.com/a/21317884
has text: @casgage Just use `Display.getCurrent()` to get the display instance.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21344011
has answer: http://stackoverflow.com/a/21344070
score: 0
answer count: 1
has body: So I've been working on a small application that would allow me to create a server, have the server connect/bind to a hamachi network/port, and allow the client to join the hamachi server, then use the client application to communicate and other such things over the server. There is no good documentation that I've been able to find in the last 4 hours that specifies how to do this. I have a basic Server application that works fine on the "localhost", but I really want to make it work over hamachi. code example: InetAddress addr = InetAddress.getByName("**.***.***.***"); ServerSocket sSocket = new ServerSocket(****, 5, addr); The error received is: Error: java.net.BindException: Cannot assign requested address: JVM_Bind I am using netbeans, and yes, I am 100% positive that the port is NOT in use. Please help!
has title: Java ServerSocket binding to port Hamachi
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21344070
tagged with: serversocket
tagged with: java
type: Question

http://stackoverflow.com/a/21268318
score: 1
upvote count: 1
has body: Because the name of the class is MyClass and not MyClass.class. And when running java you specify the CLASS NAME and not the PATH to the actual compiled file. For more in depth knowledge I guess Sun &amp; Oracle will have to answer :)
downvote count: 0
answers question: http://stackoverflow.com/q/21268149
type: Answer

http://stackoverflow.com/comment/31933994
comment on: http://stackoverflow.com/q/21205871
type: Comment
type: QuestionComment
has text: Note that there are simpler ways than manually going through all the pixels: http://stackoverflow.com/questions/14513542/convert-image-to-black-white/14514294#14514294
score: 0

http://stackoverflow.com/a/21186948
has comment: http://stackoverflow.com/comment/31901209
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21186037
score: 0
answers question: http://stackoverflow.com/q/21186037
type: Answer
has comment: http://stackoverflow.com/comment/31901138
has comment: http://stackoverflow.com/comment/31902178
has body: The reason for your Exception is most likely that your flux = connec.createStatement(); wasn't executed. You'll find out by removing that try-catch block from the class' constructor. Reasons for that I can only speculate on - need to deploy the required mysql/jdbc jars perhaps?

http://stackoverflow.com/comment/32120471
type: QuestionComment
comment on: http://stackoverflow.com/q/21309528
score: 1
has text: unfortunately (or fortunately for me, as I can point fingers :-), it's not specific for J/X/Tree/Table - same/similar behaviour as a plain table. The editor with a combo is not well implemented ... from the top of my head, don't remember any fix/workaround.
type: Comment

http://stackoverflow.com/comment/31910555
type: Comment
score: 0
type: AnswerComment
has text: I've had to use something similar in the past; often times ugly problems result in ugly solutions.
comment on: http://stackoverflow.com/a/21192684

http://stackoverflow.com/comment/32085686
comment on: http://stackoverflow.com/a/21268197
score: 0
type: AnswerComment
type: Comment
has text: yeah but it's not all. I'm gonna need the download speed and some other things like that!!

http://stackoverflow.com/q/21335182
has answer: http://stackoverflow.com/a/67836637
has answer: http://stackoverflow.com/a/21337614
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32164572
possible better answer: http://stackoverflow.com/a/21335859
has answer: http://stackoverflow.com/a/21335859
tagged with: java
has comment: http://stackoverflow.com/comment/32166079
has comment: http://stackoverflow.com/comment/32164784
has body: When I try to run project, the Tomcat return an exception. Some one can help with this problem? Configuration class: https://github.com/intrade/inventory/blob/master/src/main/java/com/springapp/mvc/InitApp/SecurityConfig.java Stack trace: Jan 24, 2014 4:09:40 PM org.apache.catalina.core.ApplicationContext log org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public javax.servlet.Filter org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain() throws java.lang.Exception] threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:581) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1029) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:925) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factor…
tagged with: spring-java-config
type: Question
upvote count: 4
downvote count: 0
accepted answer: http://stackoverflow.com/a/21337614
score: 4
has title: springSecurityFilterChain nullPointer Exception
tagged with: spring-security
has comment: http://stackoverflow.com/comment/32173701
has comment: http://stackoverflow.com/comment/32163890
answer count: 3
has comment: http://stackoverflow.com/comment/32166018
favorite count: 0

sql
tags question: http://stackoverflow.com/q/21349061
tags question: http://stackoverflow.com/q/21289248
tags question: http://stackoverflow.com/q/21261996
tags question: http://stackoverflow.com/q/21222374
tags question: http://stackoverflow.com/q/21315750
tags question: http://stackoverflow.com/q/21311450
tags question: http://stackoverflow.com/q/21263489
tags question: http://stackoverflow.com/q/21195644
tags question: http://stackoverflow.com/q/21264767
tags question: http://stackoverflow.com/q/21319234
tags question: http://stackoverflow.com/q/21188010
tags question: http://stackoverflow.com/q/21324450
tags question: http://stackoverflow.com/q/21238441
tags question: http://stackoverflow.com/q/21232884
tags question: http://stackoverflow.com/q/21291419
tags question: http://stackoverflow.com/q/21237514
tags question: http://stackoverflow.com/q/21205389
tags question: http://stackoverflow.com/q/21184351
tags question: http://stackoverflow.com/q/21222784
tags question: http://stackoverflow.com/q/21186136
tags question: http://stackoverflow.com/q/21217546
tags question: http://stackoverflow.com/q/21282027
tags question: http://stackoverflow.com/q/21253915
tags question: http://stackoverflow.com/q/21315657
tags question: http://stackoverflow.com/q/21274589
tags question: http://stackoverflow.com/q/21252705
tags question: http://stackoverflow.com/q/21273430
tags question: http://stackoverflow.com/q/21249993
tags question: http://stackoverflow.com/q/21285371
tags question: http://stackoverflow.com/q/21310194
tag name: sql
tags question: http://stackoverflow.com/q/21246714
type: Tag
tags question: http://stackoverflow.com/q/21240888
tags question: http://stackoverflow.com/q/21213779
tags question: http://stackoverflow.com/q/21332325
tags question: http://stackoverflow.com/q/21328371
tags question: http://stackoverflow.com/q/21298580
tags question: http://stackoverflow.com/q/21203457
tags question: http://stackoverflow.com/q/21243247
tags question: http://stackoverflow.com/q/21206925
tags question: http://stackoverflow.com/q/21310660
tags question: http://stackoverflow.com/q/21208400
tags question: http://stackoverflow.com/q/21281989
tags question: http://stackoverflow.com/q/21208292
tags question: http://stackoverflow.com/q/21305342
tags question: http://stackoverflow.com/q/21348177
tags question: http://stackoverflow.com/q/21207072
tags question: http://stackoverflow.com/q/21348472
tags question: http://stackoverflow.com/q/21217184
tags question: http://stackoverflow.com/q/21328111
tags question: http://stackoverflow.com/q/21327012
tags question: http://stackoverflow.com/q/21233359
tags question: http://stackoverflow.com/q/21289637
tags question: http://stackoverflow.com/q/21343839
tags question: http://stackoverflow.com/q/21236759
tags question: http://stackoverflow.com/q/21247104
tags question: http://stackoverflow.com/q/21206865
tags question: http://stackoverflow.com/q/21231547
tags question: http://stackoverflow.com/q/21337830
tags question: http://stackoverflow.com/q/21268501
tags question: http://stackoverflow.com/q/21231604
tags question: http://stackoverflow.com/q/21184422
tags question: http://stackoverflow.com/q/21205156
tags question: http://stackoverflow.com/q/21241860
tags question: http://stackoverflow.com/q/21251501
tags question: http://stackoverflow.com/q/21327067
tags question: http://stackoverflow.com/q/21236080
tags question: http://stackoverflow.com/q/21255016
tags question: http://stackoverflow.com/q/21287024
tags question: http://stackoverflow.com/q/21264610
tags question: http://stackoverflow.com/q/21261200
tags question: http://stackoverflow.com/q/21193819
tags question: http://stackoverflow.com/q/21338367

http://stackoverflow.com/comment/31952248
type: Comment
type: QuestionComment
has text: The only thing I was questioning is `toString` which contains double to string conversion and string append but that is not affected by the input data so O(1) still seems right.
comment on: http://stackoverflow.com/q/21215982
score: 0

http://stackoverflow.com/a/21328045
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21328007
score: 1
upvote count: 1
has body: "Any idea how I can fix this?" put catch block after try block. this would be one of the right solution: catch(Exception e){}

http://stackoverflow.com/a/21258182
answers question: http://stackoverflow.com/q/21252078
type: Answer
has comment: http://stackoverflow.com/comment/32060521
has body: I assume that one of your problems is located in the byte[] getRawKey(byte[] seed). If I understand it correctly this method assumes that you always get the same key for a given seed. However this is not the case as it uses a SHA1PRNG - and such pseudo random generators are not standardized. Therefore if you only use Java SE 1.6 for generating a key you will always get the same result. But the SHA1PRNG algorithm in other programming languages, alternative Java platforms like Android or even other Java versions/libraries my be get a different result. Read also: javax.crypto working differently in different versions of Android OS? Conclusion: Never misuse a KeyGenerator and/or a SecureRandom for creating keys. The only usage of these classes is to create new random keys! The current implementation you have posted is totally broken.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32070694
downvote count: 0

http://stackoverflow.com/a/21239846
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21239660
upvote count: 2
has comment: http://stackoverflow.com/comment/32018314
type: Answer
has body: I'm not sure how you build your application or how you protect the private part of the certificate - usually, there is a passphrase involved. Are you really suggesting to spread these important details to other people? You do realize that they can start signing anything using your key if you do, right? Don't. Just ... don't.
score: 2
has comment: http://stackoverflow.com/comment/31995163
accepted answer of: http://stackoverflow.com/q/21239660

http://stackoverflow.com/a/21252951
has comment: http://stackoverflow.com/comment/32233465
has comment: http://stackoverflow.com/comment/32236408
downvote count: 0
has comment: http://stackoverflow.com/comment/32237029
type: Answer
has body: What you are looking for is: for(int i=0; i&lt;5; i += 2){ This will increase the value of i by 2. "i+2" at that point is simply a syntax error and won't compile. Also, this is not about arrays. This is a for-loop. An array is a data structure. Some useful links: The official Java tutorial about for-loops. The official Java tutorial about arrays.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32236785
answers question: http://stackoverflow.com/q/21252905

http://stackoverflow.com/q/21244892
score: 0
has body: What is the maximum length of the url argument for App Engine's createLogoutURL(url) function in Java? We are getting this Exception: java.lang.IllegalArgumentException: URL too long at com.google.appengine.api.users.UserServiceImpl.makeSyncCall(UserServiceImpl.java:126) at com.google.appengine.api.users.UserServiceImpl.createLogoutURL(UserServiceImpl.java:77) at com.google.appengine.api.users.UserServiceImpl.createLogoutURL(UserServiceImpl.java:67) There's no doc on the limit, and we cannot find the code that throws the REDIRECT_URL_TOO_LONG error in ApiProxy https://code.google.com/p/googleappengine/source/browse/trunk/java/src/main/com/google/apphosting/api/ApiProxy.java#58 called by UserServiceImpl https://code.google.com/p/googleappengine/source/browse/trunk/java/src/main/com/google/appengine/api/users/UserServiceImpl.java?r=173#114
answer count: 1
has title: App Engine createLogoutURL(url) max url length?
type: UnansweredQuestion
tagged with: google-app-engine
linked to: http://stackoverflow.com/q/417142
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32004166
has answer: http://stackoverflow.com/a/21245582

http://stackoverflow.com/a/21270284
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21259234
has body: I have solved the problem. Just use a fixed file BodyEditorLoader.java than the original file available in the framework. (The file included in the framework is refered to a version of Physics Body Editor that has a different JSON API than the last LibGDX). You can download the fixed BodyEditorLoader.java here!.
accepted answer of: http://stackoverflow.com/q/21259234
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/74489510

http://stackoverflow.com/comment/32132170
type: AnswerComment
has text: Yes, you haven't declare `Random rand = new Random()` globally. You can save yourself the trouble and just declare it in the `actionPerformed` if you want. I was just trying to show you the correct way to do it.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21315495

http://stackoverflow.com/a/21322558
has comment: http://stackoverflow.com/comment/32141046
has comment: http://stackoverflow.com/comment/32140924
has comment: http://stackoverflow.com/comment/32140970
has comment: http://stackoverflow.com/comment/32141006
has comment: http://stackoverflow.com/comment/32141013
score: -1
downvote count: 1
upvote count: 0
has body: class SomeComponent extends JComponent { private Graphics2D g2d; public void paintComponent(Graphics g) { g2d = (Graphics2D) g.create(); g2d.setColor(Color.BLACK); g2d.scale(scale, scale); g2d.drawOval(0, 0, importance, importance); } public Graphics2D getG2d() { return g2d; } public void setG2d(Graphics2D g2d) { this.g2d = g2d; } } then you can do the following get the SomeComponent instance in the panel and modify it Graphics2D x= v.getPanel().get(i).getG2d; x.setColor(Color.BLUE); v.getPanel().get(i).setG2d(x); v.getPanel().repaint(); v.getPanel().revalidate(); V is a class that extends JFrame and contains the panel in it AND i is instance of SomeComponent
type: Answer
answers question: http://stackoverflow.com/q/21322353

http://stackoverflow.com/comment/32033795
type: Comment
has text: I would be thankfull If you write codes with Jframe which has JToggleButton and transfere it to the new JDialog. thank you alot
type: AnswerComment
comment on: http://stackoverflow.com/a/21255288
score: 0

http://stackoverflow.com/comment/32114700
type: Comment
comment on: http://stackoverflow.com/q/21305820
has text: This is *probably* because your URLs, token, or OAuth secret/token are incorrect. There's really no way for us to tell you much more, because you didn't post any code or anything other relevant info.
score: 0
type: QuestionComment

http://stackoverflow.com/q/21214201
favorite count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31949059
has answer: http://stackoverflow.com/a/21215121
tagged with: dictionary
upvote count: 4
has title: Optimized java Map/Dictionary for small number of entries w/o removals
has answer: http://stackoverflow.com/a/37304210
linked to: http://stackoverflow.com/q/360040
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31950202
has body: I have a specific usage of HashMap, where it just stores few entries (usually less then 5-10) for String keys. I just have to add entries, get them by key, and sometimes to iterate the entry set. Entries are never removed during the lifespan of the map. I have some operation where 5-6 such smaller maps are needed and allocated every time during single user usage, i.e. request. I am using HashMap for this. However, I wonder if there is a better, optimized implementation of Map-alike structure that I might use for this? For example, one that would allocate less space and that might be faster for small number of elements. Or HashMap is simply good enough? Note that I don't insist to follow Map interface for this. My thoughts are going into direction of array-backed map, something like this implementation that caught my attention from JetBrains: SmartFMap (An immutable map optimized for storing few entries with relatively rare updates, as they say). Does anyone know about such alternative implementations that would be a good HashMap replacement? ADDON My initial idea is what @Evgeniy Dorofeev said in his answer, to have sorted array of entries and use binary search, but with following modification. Since I need to add elements to this collection and to prevent re-creation of array I was thinking of using array with some empty spaces. First element is added eg in the middle of the array, second element is added in the middle of remaining half (below or under, depending on sorting order). If initial size of such array is good, we can (mostly) prevent recreation of this array and still be able to binary/radix search.
score: 4
has answer: http://stackoverflow.com/a/21214244
has answer: http://stackoverflow.com/a/21215027
answer count: 4

http://stackoverflow.com/comment/32256574
type: Comment
comment on: http://stackoverflow.com/a/21352320
type: AnswerComment
score: 4
has text: Сomplexity of the solution is n^2. Codility requires n*log(n).

enums
tags question: http://stackoverflow.com/q/21274858
tags question: http://stackoverflow.com/q/21189568
tags question: http://stackoverflow.com/q/21278681
tags question: http://stackoverflow.com/q/21202576
tags question: http://stackoverflow.com/q/21231785
tag name: enums
tags question: http://stackoverflow.com/q/21328329
tags question: http://stackoverflow.com/q/21299907
tags question: http://stackoverflow.com/q/21247945
type: Tag
tags question: http://stackoverflow.com/q/21324737
tags question: http://stackoverflow.com/q/21344696
tags question: http://stackoverflow.com/q/21342210
tags question: http://stackoverflow.com/q/21334055

http://stackoverflow.com/comment/31961928
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21221105
has text: BTW OP, why don't you compare notes with the JDK? Here is the link: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/Arrays.java#Arrays.sort1%28int%5B%5D%2Cint%2Cint%29
score: 0

http://stackoverflow.com/q/21230238
has comment: http://stackoverflow.com/comment/31977736
tagged with: src
type: Question
score: -2
has answer: http://stackoverflow.com/a/21230324
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/21230288
accepted answer: http://stackoverflow.com/a/21230288
favorite count: 0
tagged with: http://stackoverflow.com/tag/zip
downvote count: 2
possible better answer: http://stackoverflow.com/a/21230324
has body: I am trying to use this library from github. They only provide a src folder and there is no compiled JAR that I can use. My question is, How can I use the library in my Java project in the Eclipse IDE? I've tried researching but I can't find a single website that doesn't assume I know how to use these types of libraries. It must be something obvious that I'm missing. It would be great if someone could point me in the right direction.
type: AnsweredQuestion
tagged with: java
has title: How can I use a src folder library from GitHub
tagged with: eclipse

http://stackoverflow.com/a/21196219
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: That could depend on the JRE implementation, but in general JIT optimization gets redone each time you launch the program. Among other things, hotspot environments may change their optimization based on runtime profiling with the input data actually being processed. Yes, this is very different from traditionally compiled languages. One thing to watch out for: Partly because it depends on input, there is no guarantee that a hotspot JIT will optimize the code the same way every time. This makes trying to hand-optimize Java code MUCH more difficult. You really need to do full profile analysis, and you need to do it over extended executions and a complete range of input data, or you're likely to fool yourself. I've seen 20% performance variation on the same machine running the same code over the same input, apparently because the JIT optimized in a different order and ran into limits on how much native code it was willing to produce.
accepted answer of: http://stackoverflow.com/q/21196099
has comment: http://stackoverflow.com/comment/31926132
answers question: http://stackoverflow.com/q/21196099
upvote count: 4
has comment: http://stackoverflow.com/comment/31917238
score: 4
has comment: http://stackoverflow.com/comment/31919047

http://stackoverflow.com/comment/32094019
type: Comment
comment on: http://stackoverflow.com/q/21296144
type: QuestionComment
has text: possible duplicate of [What is the 'instanceof' operator used for?](http://stackoverflow.com/questions/7313559/what-is-the-instanceof-operator-used-for)
score: 0

http://stackoverflow.com/a/21201938
has comment: http://stackoverflow.com/comment/31927275
has comment: http://stackoverflow.com/comment/31927354
accepted answer of: http://stackoverflow.com/q/21201914
score: 0
has body: If you wish to write integers I'm thinking as text and not binary data, you need to convert the integers to text first, using a toString operation and then write the resulting string to file.
answers question: http://stackoverflow.com/q/21201914
has comment: http://stackoverflow.com/comment/31927393
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/21189776
downvote count: 0
accepted answer: http://stackoverflow.com/a/21189852
possible better answer: http://stackoverflow.com/a/54657520
has comment: http://stackoverflow.com/comment/31905172
has answer: http://stackoverflow.com/a/54657520
score: 1
favorite count: 0
tagged with: multithreading
has comment: http://stackoverflow.com/comment/31910384
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21189852
has body: Create a method which accept a integer as a argument and print on console. This method is accessed by multiple threads. If two or more threads call the method with same value then only one thread should allow to print the value other threads should wait. If values are different then all threads should allow to print the value. I know interning would help here but Java interning happens till values less than 128. After that two Integer having same value are different object... Can it be done? Any provision for synchronizing on condition??
tagged with: java
has comment: http://stackoverflow.com/comment/31905359
type: Question
answer count: 2
has title: Java Concurrency based on condition

http://stackoverflow.com/a/21232852
has body: Before trying to get your own code to run on Google AppEngine, ensure all the fundamental pieces are in place by building and running an existing debugged project such as Google's guestbook tutorial. The Data store cannot natively handle an ArrayList or any other kind of Collection, only simpler scalar structures defined in Properties and value types. You're evidently new on GAE, your questions show a need to better understand what your compiled Java code is and is not allowed to do on a GAE server. For example Sockets are restricted (see Socket Java API and the big picture in Java Runtime Environment documentation). You will probably be forced to use the URL Fetch Java API instead of Sockets for your CToJavaToCloud project.
type: Answer
answers question: http://stackoverflow.com/q/21226929
score: 0

http://stackoverflow.com/a/21314019
has body: These primitive types have wrapper classes. int - java.lang.Integer float - java.lang.Float This way, you can actually have List&lt;Integer&gt;, etc.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21313870
downvote count: 0
type: Answer

http://stackoverflow.com/q/21240030
upvote count: 3
tagged with: java
has title: Append nodes into existing XML File with java
has answer: http://stackoverflow.com/a/21240862
has answer: http://stackoverflow.com/a/33802408
has answer: http://stackoverflow.com/a/21240317
answer count: 4
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/21240317
has answer: http://stackoverflow.com/a/21240911
downvote count: 0
has comment: http://stackoverflow.com/comment/31995344
favorite count: 0
type: Question
has body: Hi im looking for a solution to append nodes from java into an existing xml file. What i got is an xml file like this Frank Erb true hm001.jpg Hans Mustermann true hm001.jpg Thomas Tester false tt001.jpg what i whant to add is a person node with its elements inside the people element. My big problem is the data node which is root node. If it would be the Person node as root I could solve it. But I can't manage to get the person nodes under the people node. Tom Hanks false tt001.jpg thanks for your help! my java code looks as far like this Element root = document.getDocumentElement(); // Root Element Element rootElement = document.getDocumentElement(); Collection<Server> svr = new ArrayList<Server>(); svr.add(new Server()); for (Server i : svr) { // server elements Element server = document.createElement("people"); rootElement.appendChild(server); //rootElement.appendChild(server); Element name = document.createElement("person"); server.appendChild(name); Element firstName = document.createElement("firstName"); firstName.appendChild(document.createTextNode(i.getFirstName())); server.appendChild(firstName); name.appendChild(firstName); Element port = document.createElement("lastName"); port.appendChild(document.createTextNode(i.getLastName())); server.appendChild(port); name.appendChild(port); Element access = document.createElement("access"); access.appendChild(document.createTextNode(i.getAccess())); server.appendChild(access); name.appendChild(access); String imageName = Main.randomImgNr+""; Element images = document.createElement("images"); //images.appendChild(document.createTextNode(i.getAccess())); Element img = document.createElement("img"); img.appendChild(document.createTextNode(imageName));//i.getImage())); images.appendChild(img); server.appendChild(images); name.appendChild(images); root.appendChild(server);
accepted answer: http://stackoverflow.com/a/21240862
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/32142698
comment on: http://stackoverflow.com/a/21318800
type: Comment
has text: @BasilBourque lol ;). What I'm curious about is how could you detect that without a `Date` component, for example, if I wanted to calculate the "split" between the two (ie render 2200-2400 on one column and 0000-0200 on the next), would it be possible to know that I've skipped a date boundary using `LocalTime`? This is not a criticism, just curiosity. I've use `LocalTime` before to calculate the time difference which was awesome
type: AnswerComment
score: 0

http://stackoverflow.com/a/21331058
has comment: http://stackoverflow.com/comment/32155666
has body: length method in String returns the length of the string. Here you want to get the substring after remove first char and last char. Thus String sub = s.substring(1,s.length()-2); should be: String sub = s.substring(1,s.length()-1);
downvote count: 0
has comment: http://stackoverflow.com/comment/32159148
type: Answer
has comment: http://stackoverflow.com/comment/32159077
answers question: http://stackoverflow.com/q/21330961
has comment: http://stackoverflow.com/comment/32159406
has comment: http://stackoverflow.com/comment/32155793
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/32155998

arraylist
tags question: http://stackoverflow.com/q/21213921
tags question: http://stackoverflow.com/q/21337649
tags question: http://stackoverflow.com/q/21261188
tags question: http://stackoverflow.com/q/21212129
tags question: http://stackoverflow.com/q/21339262
tags question: http://stackoverflow.com/q/21310721
tags question: http://stackoverflow.com/q/21201922
tags question: http://stackoverflow.com/q/21299030
tags question: http://stackoverflow.com/q/21337069
tags question: http://stackoverflow.com/q/21187369
tags question: http://stackoverflow.com/q/21271378
tags question: http://stackoverflow.com/q/21312876
tags question: http://stackoverflow.com/q/21228300
tags question: http://stackoverflow.com/q/21231665
tags question: http://stackoverflow.com/q/21233123
tags question: http://stackoverflow.com/q/21302354
tags question: http://stackoverflow.com/q/21210545
tags question: http://stackoverflow.com/q/21201415
tags question: http://stackoverflow.com/q/21288895
tags question: http://stackoverflow.com/q/21324972
tags question: http://stackoverflow.com/q/21338122
tags question: http://stackoverflow.com/q/21324417
tags question: http://stackoverflow.com/q/21273125
tags question: http://stackoverflow.com/q/21209426
tags question: http://stackoverflow.com/q/21286966
tags question: http://stackoverflow.com/q/21259918
tags question: http://stackoverflow.com/q/21308539
tags question: http://stackoverflow.com/q/21200430
tags question: http://stackoverflow.com/q/21213431
tags question: http://stackoverflow.com/q/21310399
tags question: http://stackoverflow.com/q/21265391
tags question: http://stackoverflow.com/q/21263288
tags question: http://stackoverflow.com/q/21275187
tags question: http://stackoverflow.com/q/21330439
tags question: http://stackoverflow.com/q/21298318
tags question: http://stackoverflow.com/q/21245213
tags question: http://stackoverflow.com/q/21208883
tags question: http://stackoverflow.com/q/21271102
tags question: http://stackoverflow.com/q/21349396
tags question: http://stackoverflow.com/q/21213985
tags question: http://stackoverflow.com/q/21228641
tags question: http://stackoverflow.com/q/21226043
tags question: http://stackoverflow.com/q/21263380
tags question: http://stackoverflow.com/q/21291908
tags question: http://stackoverflow.com/q/21233956
tags question: http://stackoverflow.com/q/21229632
tags question: http://stackoverflow.com/q/21197184
tags question: http://stackoverflow.com/q/21204266
tags question: http://stackoverflow.com/q/21271793
tags question: http://stackoverflow.com/q/21193277
tags question: http://stackoverflow.com/q/21238088
tags question: http://stackoverflow.com/q/21223421
tags question: http://stackoverflow.com/q/21249079
tags question: http://stackoverflow.com/q/21234341
tags question: http://stackoverflow.com/q/21262043
tags question: http://stackoverflow.com/q/21317074
tags question: http://stackoverflow.com/q/21202647
tags question: http://stackoverflow.com/q/21271480
tags question: http://stackoverflow.com/q/21335861
tags question: http://stackoverflow.com/q/21198327
tags question: http://stackoverflow.com/q/21241836
tags question: http://stackoverflow.com/q/21294190
tags question: http://stackoverflow.com/q/21299107
tags question: http://stackoverflow.com/q/21349733
tags question: http://stackoverflow.com/q/21211284
tags question: http://stackoverflow.com/q/21334940
type: Tag
tags question: http://stackoverflow.com/q/21292248
tags question: http://stackoverflow.com/q/21303106
tags question: http://stackoverflow.com/q/21214906
tags question: http://stackoverflow.com/q/21323921
tags question: http://stackoverflow.com/q/21227037
tag name: arraylist
tags question: http://stackoverflow.com/q/21203508
tags question: http://stackoverflow.com/q/21189855
tags question: http://stackoverflow.com/q/21197078
tags question: http://stackoverflow.com/q/21338582
tags question: http://stackoverflow.com/q/21246813
tags question: http://stackoverflow.com/q/21292322

http://stackoverflow.com/comment/32038756
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21264702
has text: Method returns List<HashMap<String, String>> only. But I need List<String, HashMap<String,String>>

http://stackoverflow.com/comment/31895316
type: Comment
comment on: http://stackoverflow.com/q/21184478
score: 0
has text: I am in the process of doing some debugging and after call Workbook.create(inputStream) I inspect the rows from the sheet and can see that the number contained in the rows contains the extraneous zeroes
type: QuestionComment

http://stackoverflow.com/comment/32039705
type: Comment
type: QuestionComment
has text: I'm fine with both of them. Any clue on my question is appreciated :)
score: 0
comment on: http://stackoverflow.com/q/21263367

http://stackoverflow.com/a/21313591
answers question: http://stackoverflow.com/q/21311450
has body: How is your pojo annotated? Is the id field annotated as an id? public class UserLockHistoryEntity implements java.io.Serializable { private Long id; ... @Id @Column(name = "USER_LOCK_HISTORY_ID", unique = true, nullable = false) public Long getId() { return this.id; } ... }
score: 0
has comment: http://stackoverflow.com/comment/32125141
has comment: http://stackoverflow.com/comment/32130491
type: Answer

http://stackoverflow.com/comment/32125206
comment on: http://stackoverflow.com/q/21314047
has text: If you need to mock it, it shouldn't be static! Otherwise, just leave it be (as others have already said).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21246056
answers question: http://stackoverflow.com/q/21245650
score: 3
has comment: http://stackoverflow.com/comment/32007857
accepted answer of: http://stackoverflow.com/q/21245650
upvote count: 3
has body: Here's the issue. You're trying to load your entire dataset into memory. And you're running out of memory. Android's JSON classes (and some other JSON libraries) are designed to take a Java object (in memory), serialize it to a parse tree of objects (e.g. JSONObject, JSONArray) (in memory), then convert that tree to a String (in memory) and write it out somewhere. Specifically in your case (at the moment) it appears what when it converts the parse tree into a String it runs out of memory; That String is effectively doubling the amount of memory required at that point. To solve your issue you have a few different choices, I'll offer 3: Don't use JSON at all. Refactor to simply send files and information to your server. Refactor things so that you only read X images into memory at a time and have multiple output files. Where X is some number of images. Note this is still problematic if your image sizes vary greatly / aren't predictable. Switch to using Jackson as a JSON library. It supports streaming operations where you can stream the JSON to the output file as you create each object in the array. Edit to add: for your code, it would look something like this using Jackson: // Before you get here, have created your `File` object JsonFactory jsonfactory = new JsonFactory(); JsonGenerator jsonGenerator = jsonfactory.createJsonGenerator(file, JsonEncoding.UTF8); jsonGenerator.writeStartArray(); // Note: I don't know what `c` is, but if it's a cursor of some sort it // should have a "hasNext()" or similar you should be using instead of // this for loop for (int i = 0; i &lt; count; i++) { jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("pid", c.getString(c.getColumnIndex("pid"))); jsonGenerator.writeStringField("status", c.getString(c.getColumnIndex("status"))); jsonGenerator.writeStringField("pop_time", c.getString(c.getColumnIndex("pop_time"))); jsonGenerator.writeStringField("punching_time", c.getString(c.getColumnIndex("punching_time"))); // stores ba…
has comment: http://stackoverflow.com/comment/42091394
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32006419
has comment: http://stackoverflow.com/comment/32099305
has comment: http://stackoverflow.com/comment/32006519
type: Answer

http://stackoverflow.com/a/21342603
answers question: http://stackoverflow.com/q/21342560
has comment: http://stackoverflow.com/comment/32178492
has comment: http://stackoverflow.com/comment/32178537
has comment: http://stackoverflow.com/comment/32178261
accepted answer of: http://stackoverflow.com/q/21342560
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32178594
has comment: http://stackoverflow.com/comment/32178113
has comment: http://stackoverflow.com/comment/32178353
upvote count: 1
has body: You shouldn't export jar file from maven project. Use maven command: mvn package to build android applications and copy it form target directory.
has comment: http://stackoverflow.com/comment/32178306
has comment: http://stackoverflow.com/comment/32178201
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32178644

http://stackoverflow.com/q/21328955
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32282443
has comment: http://stackoverflow.com/comment/32279876
has body: I'm developing a app at the moment wich displayes a Map, your gps postition and a marker on this postition. Next Step is to recieve Data from a XML file. The XML I'm trying to use is http://webservice.recruit.co.jp/hotpepper/gourmet/v1/?key=899d70a29e983f4b&amp;lat=33.58724&amp;lng=130.3986&amp;range=5&amp;order=4 But poorly after launching the app (on a real device, newest version) the app terminates and displays nothing. LogCat says FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.xmlparser/com.example.xmlparser.MainActivitz}: java.lang.nullPointerException MainActivity.java package com.example.xmlparser; import android.app.Activity; import android.content.Context; import android.location.Criteria; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import java.io.IOException; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.ParseException; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; import com.google.android.gms.maps.CameraUpdate; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; public class MainActivity extends Activity implements LocationListener { private TextView latituteField; private TextView longitudeField; private LocationManager locationManager; private String provider; public String url = "http://webservice.recruit.co.jp/hotpepper/gourmet/v1/?key=899d70a29e983f4b&amp;lat=33.58724&amp;lng=130.3986&a…
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32153043
score: 0
has title: Parsing XML into Google Maps Program
has comment: http://stackoverflow.com/comment/32281036
tagged with: parsing
favorite count: 0
has comment: http://stackoverflow.com/comment/32280534
has comment: http://stackoverflow.com/comment/32283466
has comment: http://stackoverflow.com/comment/32278118
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/55691519
has text: I wanted to try another approach like loading classes/jars from a Java program and using reflection instead. Maybe it's possible to leverage some libraries from Java IDEs for that.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21212673
type: AnswerComment

http://stackoverflow.com/a/34912720
upvote count: 2
has body: I haven't been able to find this documented anywhere, but I've run into the same problem. The issue is with your content type header. If your header says text then you can get the body as a string and the body as json will be null. Likewise if your header says json then the body as string will be null and the body as json will be parsed.
answers question: http://stackoverflow.com/q/21289511
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/21239733
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21239666
has comment: http://stackoverflow.com/comment/31995612
has body: Compliation eRROR AT System.out.printlnI"Finally block!"); ^ here :-)
downvote count: 0
has comment: http://stackoverflow.com/comment/31995203
type: Answer
has comment: http://stackoverflow.com/comment/31995088

http://stackoverflow.com/comment/32095269
comment on: http://stackoverflow.com/a/21248005
score: 0
type: AnswerComment
type: Comment
has text: If I understand your concern correctly, I might not be able to distinguish between user messages and protocol messages? Mine is a rather simplistic implementation, so I am not sure that I will even add "message received" notifictations, but since I am not sending messages in plaintext anyway, but serializing them along with their metadata, I think that's not an issue.

http://stackoverflow.com/comment/32183708
type: Comment
type: QuestionComment
has text: You should show, the Exception Trace also.
score: 1
comment on: http://stackoverflow.com/q/21346327

http://stackoverflow.com/q/21349813
type: UnansweredQuestion
tagged with: java
type: Question
has title: Using ClearNLP Semantic Role Labeler
score: 0
has body: I want to use clearNLP (http://clearnlp.wikispaces.com/) for extracting semantic role labels of an input sentence. I followed the instructions here: http://clearnlp.wikispaces.com/installation (I downloaded the jar files, put them in a directory called ClearNLP and set the classpath) but when I run the command java com.clearnlp.run.Version, I face the error: Could Not find or Load Main. I tried it twice: Once I set the classpath as an environment variable of windows and ran the command in CMD. But, when it didn't work, I tried to create a java project, set the libraries using NetBeans and run the program. But, it didn't work, too. BTW, when I run echo %classpath% command, I see that the classpath is set correctly. Can anybody help me?
answer count: 1
has answer: http://stackoverflow.com/a/22050495
tagged with: semantics
tagged with: nlp
tagged with: parsing

http://stackoverflow.com/comment/32006360
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21246036
has text: Also, You should provide an image of your package structure, and where your images reside in relationship to this structure. This is key. If not an image, there are jar commands that will give us pretty much the same thing (if the program is in a jar).

http://stackoverflow.com/comment/32115641
score: 0
type: AnswerComment
has text: [JLS 4.8](http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.8) covers raw types. I also can't find any reference to removal of all generic info, but that is implied by "making it compatible with pre-generic versions".
type: Comment
comment on: http://stackoverflow.com/a/21285107

http://stackoverflow.com/q/21260291
score: 10
tagged with: apache-storm
accepted answer: http://stackoverflow.com/a/21260537
has body: I have started using storm, so I create simple topology using this tutorial When I run my topology with LocalCluster and all seem fine, My Problem is that I'm not getting ACK on the tuple, meaning my spout ack is never called. my code is below - do you know why ack is not called ? so my topology look like this public StormTopology build() { TopologyBuilder builder = new TopologyBuilder(); builder.setSpout(HelloWorldSpout.class.getSimpleName(), helloWorldSpout, spoutParallelism); HelloWorldBolt bolt = new HelloWorldBolt(); builder.setBolt(HelloWorldBolt.class.getSimpleName(), bolt, boltParallelism) .shuffleGrouping(HelloWorldSpout.class.getSimpleName()); } My Spout look like this public class HelloWorldSpout extends BaseRichSpout implements ISpout { private SpoutOutputCollector collector; public void declareOutputFields(OutputFieldsDeclarer declarer) { declarer.declare(new Fields("int")); } public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { this.collector = collector; } private static Boolean flag = false; public void nextTuple() { Utils.sleep(5000); //emit only 1 tuple - for testing if (!flag){ this.collector.emit(new Values(6)); flag = true; } } @Override public void ack(Object msgId) { System.out.println("[HelloWorldSpout] ack on msgId" + msgId); } public void fail(Object msgId){ System.out.println("[HelloWorldSpout] fail on msgId" + msgId); } } and my bolt look like this @SuppressWarnings("serial") public class HelloWorldBolt extends BaseRichBolt{ private OutputCollector collector; public void prepare(Map conf, TopologyContext context, OutputCollector collector) { this.collector = collector; logger.info("preparing HelloWorldBolt"); } public void execute(Tuple tuple) { System.out.println("[HelloWorldBolt] got" + tuple.getInteger(0)); this.collector.ack(tuple); } public void cleanup() { } @Override public void declareOutputFields(OutputFieldsDeclarer declarer) { // TODO Auto-generated method stub } }
has comment: http://stackoverflow.com/comment/38039167
answer count: 1
has title: Storm Spout not getting Ack
favorite count: 0
has answer: http://stackoverflow.com/a/21260537
upvote count: 10
downvote count: 0
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/36183731
type: Comment
type: QuestionComment
score: 1
has text: Can you indicate which version of Restlet you are using. Did you try with latest 2.2 version (stable)?
comment on: http://stackoverflow.com/q/21339855

http://stackoverflow.com/q/21212066
answer count: 1
score: 0
tagged with: binding
tagged with: sockets
has answer: http://stackoverflow.com/a/21212301
type: Question
has title: JDK 1.7 DatagramSocket not binding IP and port correctly
type: AnsweredQuestion
tagged with: network-programming
tagged with: java
accepted answer: http://stackoverflow.com/a/21212301
has body: I am writing a server program using UDP in Java. I am using, of course, DatagramSocket for the server UDP socket. I am on Mac OS X 10.9.1, and my coding environment is set to JDK 1.7. My problem is that when I initialize my socket like this: serverSocket = new DatagramSocket(19132); It doesn't throw an exception, but when I try to log it to the console, like this: log("Starting Minecraft PE server on " + serverSocket.getInetAddress() + ":" + serverSocket.getPort()); The .getInetAddress is null, and the port is -1. The port that I am trying to bind to is 19132. My firewall was turned off while I was trying the code, it still was null. Here is some output fromt the log: 2014-01-18 17:16:20 [MCPE_Server][INFO] Starting Minecraft PE server on null:-1

http://stackoverflow.com/q/21276827
has answer: http://stackoverflow.com/a/21276959
has answer: http://stackoverflow.com/a/21277100
type: AnsweredQuestion
score: 1
possible better answer: http://stackoverflow.com/a/21277100
has body: I know that we can invoke a class in a jar file providing the Main-class attribute in the Manifest file. But how can we invoke multiple files in a jar in that way. Or can we invoke a class in a jar file without specifying in the Manifest file using bash.
accepted answer: http://stackoverflow.com/a/21276959
upvote count: 1
type: Question
tagged with: java
tagged with: bash
answer count: 2
has title: How to execute multiple java class files inside a jar using bash
tagged with: executable-jar
tagged with: jar
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/97325365
has text: You can do the same in a method outside of the enum itself. Simply move the method into your own code.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25306595
type: AnswerComment

http://stackoverflow.com/comment/31992489
has text: Check http://stackoverflow.com/questions/19440354/is-oracle-killing-intranet-applets-on-jre-7-update-51 and http://stackoverflow.com/questions/18914650/can-you-sign-a-java-applet-but-keep-it-in-the-sandbox-not-give-it-full-access-t
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21238199

http://stackoverflow.com/a/21273983
answers question: http://stackoverflow.com/q/21243378
type: Answer
has body: Personally, I would try the three asynchronous retrievals sequentially, starting with the least expensive and ending with the most expensive. However, responding to the first of three parallel retrievals is an interesting problem. You should be able to exploit the characteristic of $q.all(promises), by which : as soon as any of the promises fails then the returned promise is rejected if all promises are successful then the returned promise is resolved. But you want to invert the logic such that : as soon as any of the promises is successful then the returned promise is resolved if all promises fail then the returned promise is rejected. This should be achievable with an invert() utility which converts success to failure and vice versa. function invert(promise) { return promise.then(function(x) { return $q.defer().reject(x).promise; }, function(x) { return $q.defer().resolve(x).promise; }); } And a first() utility, to give the desired behaviour : function first(arr) { return invert($q.all(arr.map(invert))); } Notes: the input arr is an array of promises a native implementation of array.map() is assumed (otherwise you can explicitly loop to achieve the same effect) the outer invert() in first() restores the correct sense of the promise it returns I'm not particularly experienced in angular, so I may have made syntactic errors - however I think the logic is correct. Then getOrder() will be something like this : function getOrder(id) { return first([ cache.get(id), localStorage.get(id).then(cache.put), backend.get(id).then(cache.put).then(localStorage.put) ]); } Thus, getOrder(id) should return a Promise of an order (not the order directly).
score: 8
downvote count: 0
upvote count: 8

http://stackoverflow.com/comment/32066000
type: QuestionComment
has text: @user1516873, Ok, I moved RMI bean to standalone class and it looks like `NoSuchBeanDefinitionException` has gone and `@Autowired` is working. Now I am getting `NullPointerException` error while calling remote method. Also I can get the bean from `Application.class` context, but not from `BasicSearchQuery.class` context.
comment on: http://stackoverflow.com/q/21275485
score: 0
type: Comment

http://stackoverflow.com/comment/32477160
comment on: http://stackoverflow.com/q/21333232
score: 0
has text: Your `getRootFile` and `getNewContent` methods keep replacing text with the last line you've read, and therefore the XML document is not valid. However, you do not need to read from file to string, XStream can read from file directly.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32005460
has text: @PeterLawrey I don't know why that comment is addressed to me.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21245449

http://stackoverflow.com/a/21309104
upvote count: 9
downvote count: 0
answers question: http://stackoverflow.com/q/21308803
score: 9
has body: The easiest way is to put this in the onCreate() method of all your Activities (better yet, put it in a BaseActivity class and extend all your Activities from it) @Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); if (isLargeDevice(getBaseContext())) { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); } else { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } } You can use this method to detect if the device is a phone or tablet: private boolean isLargeDevice(Context context) { int screenLayout = context.getResources().getConfiguration().screenLayout; screenLayout &amp;= Configuration.SCREENLAYOUT_SIZE_MASK; switch (screenLayout) { case Configuration.SCREENLAYOUT_SIZE_SMALL: case Configuration.SCREENLAYOUT_SIZE_NORMAL: return false; case Configuration.SCREENLAYOUT_SIZE_LARGE: case Configuration.SCREENLAYOUT_SIZE_XLARGE: return true; default: return false; } }
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21308803

http://stackoverflow.com/a/21249322
has body: meta does not have a closing tag http://www.w3schools.com/tags/tag_meta.asp
answers question: http://stackoverflow.com/q/21249297
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32011656
type: Answer

http://stackoverflow.com/comment/33793161
has text: @SotiriosDelimanolis How to get hold of DispatcherServlet in Spring 4.0?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21334263

http://stackoverflow.com/q/21325643
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32146239
has title: PDF file that generated by itext is corrupted if the PDF file is generated by a jar extension application
tagged with: http://stackoverflow.com/tag/pdf
type: Question
score: 0
tagged with: itext
has comment: http://stackoverflow.com/comment/32146266
has body: I'm newbie in Java and I desperately need your help. Currently I'm working on my project which requires me to generate PDF file from certain user inputs. My output PDF file is expected to contain images in several cells. Everything seems okay if I run the application in Netbeans IDE. I try to open the generated PDF file and it's nice. No problem at all. Then I do the 'Clean and Build' thing so I'll have an application with jar extension. This where the problem is. If I generate the PDF file from this jar-extension-application, the PDF file is corrupted. It says that 'An error occured'. I see the size of the file is (always) 0 bytes. But if I remove the codes for 'adding-images-in-cells' in my source code, the PDF file is not corrupted. It can be opened, but the consequence is my file doesn't contain any image. My questions are: Am I possibly doing something wrong in the code so that the error occurs? Or is it natural that I can not generated PDF file using the 'jar-extension-application' if that file contains any image? How come the file is generated nicely if run directly in Netbeans IDE, but get the opposite after if run in jar extension? Thanks for any answer.
tagged with: java
has comment: http://stackoverflow.com/comment/32148815
has comment: http://stackoverflow.com/comment/32153010
answer count: 0
tagged with: jar

http://stackoverflow.com/comment/31960062
type: QuestionComment
comment on: http://stackoverflow.com/q/21220299
score: 1
has text: oh and it's referred to as "non-canonical" mode in the UNIX world, if that helps you search.
type: Comment

http://stackoverflow.com/q/21345335
accepted answer: http://stackoverflow.com/a/21345425
tagged with: class
has comment: http://stackoverflow.com/comment/32181914
has body: When I try to compile the following code, it tells me that it is not an abstract class and does not override abstract method actionPerformed. How do I fix this? Here is the code I am attempting to compile: import java.awt.*; import java.awt.event.*; public class FinalProj1 extends Frame implements ActionListener { static FinalProj1 objFrame; static Button objButton1; static Button objButton2; static TextField count = new TextField(20); static TextField count2 = new TextField(20); static Label objLabel; static Label objLabel2; FinalProj1() { setTitle("Click Counter"); setSize(400,400); show(); } public static void main(String args[]) { objFrame= new FinalProj1(); objButton1= new Button("Agree"); objButton2= new Button("Dissagree"); objLabel= new Label(); objLabel2= new Label(); objLabel2.setText("Mexican Food Is Better Than Chineese Food"); objButton1.setBounds(110,175,75,75); objButton2.setBounds(190,175,75,75); objLabel2.setBounds(80,95, 250,25); objFrame.add(objButton2); objFrame.add(objButton1); objFrame.add(objLabel2); objFrame.add(objLabel); objButton1.addActionListener(objFrame); objButton2.addActionListener(objFrame); int numClicks = 0; int numClicks2 = 0; } @Override public void actionPerformed(ActionEvent e); { objButton1.addActionListener(this); objButton2.addActionListener(this); if(e.getSource()==objButton1) { numClicks++; } else { numClicks2++; } count.setText("There are " + numClicks + " who agree"); count2.setText("There are " + numClicks2 + " who dissagree"); } }
score: 0
answer count: 2
tagged with: abstract
has title: How to fix an issue with an abstract class error
has answer: http://stackoverflow.com/a/21345425
tagged with: user-interface
has answer: http://stackoverflow.com/a/21345374
has comment: http://stackoverflow.com/comment/32181952
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/32181982
has comment: http://stackoverflow.com/comment/32181920
has comment: http://stackoverflow.com/comment/32181956
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21345374
type: Question

http://stackoverflow.com/q/21273686
has comment: http://stackoverflow.com/comment/32054923
accepted answer: http://stackoverflow.com/a/21274130
tagged with: request
tagged with: google-chrome
tagged with: http
possible better answer: http://stackoverflow.com/a/21274610
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21274610
has answer: http://stackoverflow.com/a/21274130
tagged with: java
linked to: http://stackoverflow.com/q/151756
has title: HTTP request differences between Java API/Google Chrome requests?
type: Question
score: 0
answer count: 2
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32055100
has body: Whoever is on the side of the webserver: how do they differentiate (as in, what especifically is different) between a HTTP request made through the Google Chrome browser (page refresh with no forms or nothing, a GET supposedly right?), and an HTTP request made through the JavaAPI: Using the following libs: import java.net.URL; import java.net.HttpURLConnection; By doing the following: String MY_URL = "www.mysite.com"; URL url = new URL(MY_URL); HttpURLConnection http = (HttpURLConnection) url.openConnection(); rd = new BufferedReader(new InputStreamReader(http.getInputStream()));
favorite count: 0
tagged with: get

http://stackoverflow.com/a/21189366
type: Answer
answers question: http://stackoverflow.com/q/21188880
downvote count: 0
score: 1
has body: A while back I ran into this same problem. I'm not sure that this code solved it, but I think it helped? There are some window listeners already there, this code removes them. I also dimly recall having to run it after a few frames because they hadn't been initialized or something immediately after the program starts or something. You can give it a shot, anyway: WindowListener[] wls = frame.getWindowListeners(); println("Removing " + wls.length + " window listeners."); for (int i = 0; i &lt; wls.length; i++) { frame.removeWindowListener(wls[i]); } frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { checkExit(); } } );
upvote count: 1

http://stackoverflow.com/a/21264975
has body: Java has deprecated methods for explicitly killing another thread (like Thread.stop / Thread.destroy). The right way is to make sure the operations on the other thread can handle being told to stop (for example, they expect an InterruptedException, which means you can call Thread.interrupt() in order to stop it). Taken from How do I kill a thread from another thread in Java?
type: Answer
answers question: http://stackoverflow.com/q/21264844
score: 0

http://stackoverflow.com/comment/115279294
has text: Editing `/etc/crypto-policies/back-ends/java.config` on Fedora 33 using Java 11 is what I needed for Apache Directory Studio
score: 3
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/34896224

multipleoutputs
tags question: http://stackoverflow.com/q/21206303
type: Tag
tag name: multipleoutputs

http://stackoverflow.com/a/21335365
type: Answer
has comment: http://stackoverflow.com/comment/32260767
accepted answer of: http://stackoverflow.com/q/21243729
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/32256659
has body: A solution attempt: (EDITED, see below) import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; // Solution for Lesson 9, "CountNonDivisible" // of http://codility.com/demo/train/ public class Solution { public static void main(String[] args) { int A[] = new int[5]; A[0] = 3; A[1] = 1; A[2] = 2; A[3] = 3; A[4] = 6; Solution s = new Solution(); int B[] = s.solution(A); System.out.println("Input : "+Arrays.toString(A)); System.out.println("Result : "+Arrays.toString(B)); } public int[] solution(int[] A) { Set&lt;Integer&gt; setA = asSet(A); List&lt;Set&lt;Integer&gt;&gt; divisors = computeDivisors(A.length * 2); int occurrences[] = computeOccurrences(A); int nonDivisors[] = new int[A.length]; for (int i=0; i&lt;A.length; i++) { int value = A[i]; Set&lt;Integer&gt; d = divisors.get(value); int totalOccurances = 0; for (Integer divisor : d) { if (setA.contains(divisor)) { totalOccurances += occurrences[divisor]; } } nonDivisors[i] = A.length-totalOccurances; } return nonDivisors; } /** * Returns a set containing all elements of the given array * * Space: O(N) * Time: O(N) * * @param A The input array * @return The set */ private static Set&lt;Integer&gt; asSet(int A[]) { Set&lt;Integer&gt; result = new HashSet&lt;Integer&gt;(); for (int value : A) { result.add(value); } return result; } /** * Computes a list that contains for each i in [0...maxValue+1] a set * with all divisors of i. This is basically an "Eratosthenes Sieve". * But in addition to setting the entries of a list to 'false' * (indicating that the respective numbers are non-prime), this * methods inserts the divisors into the corresponding set. * * Space: O(N) (?) * Time: O(N*logN) (?) * * @param maxValue The maximum value * @return The list */ private static List&lt;Set&lt;Integer&gt;&gt; computeDivisors(int maxValue) { List&lt;Boolean&gt; prime = new ArrayList&lt;Boolean&gt;(); prime.addAll(Collections.nCopies…
has comment: http://stackoverflow.com/comment/106531143
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32262117
answers question: http://stackoverflow.com/q/21243729
has comment: http://stackoverflow.com/comment/32262588

http://stackoverflow.com/q/21222087
tagged with: out-of-memory
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31963932
has comment: http://stackoverflow.com/comment/31963382
has title: After Java OutOfMemoryError, Tomcat Won't Start
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31963752
has body: After running my App in Tomcat many times, I've maxed out the PermGen memory (a problem with my quartz servlet, I suspect) and Java threw a OutOfMemoryError. Normally, I just restart tomcat from time to time, but since this happened I'm unable to start/restart. Tomcat is running in our qa environment and is normally started/stoped/restarted via the sbin folder. I've tried to start tomcat using the alternative, catalina.sh run, but it says the port is being used! That led me to suspect that tomcat was already running, but when I try to stop it, I get this error: SEVERE: Could not contact localhost:8005. Tomcat may not be running. Jan 19, 2014 3:10:58 PM org.apache.catalina.startup.Catalina stopServer SEVERE: Catalina.stop: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) ... So, if it's not started or stopped, then what state is tomcat in?! How can I bring it back to a startable state? Update As per Boris's comment, I've used ps auxfww to list processes and the only one with tomcat as the user is the following: tomcat 5111 8.0 29.0 2052336 556512 ? Sl Jan17 221:48 /usr/java/latest/bin/java -Djava.util.logging.config.file=/var/lib/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -javaagent:/usr/share/tomcat/newrelic/newrelic.jar -Xmx512m -Djava.awt.headless=true -Djava.endorsed.dirs=/usr/share/tomcat/endorsed -classpath /usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/var/lib/tomcat -Dcatalina.home=/usr/share/tomcat -Djava.io.tmpdir=/var/lib/tomcat/temp org.apache.catalina.startup.B…
has comment: http://stackoverflow.com/comment/31963325
has comment: http://stackoverflow.com/comment/31963457
has answer: http://stackoverflow.com/a/21223390
answer count: 1
has comment: http://stackoverflow.com/comment/31964162
downvote count: 0
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/31964023

http://stackoverflow.com/comment/32056887
score: 0
type: Comment
type: QuestionComment
has text: @SachinVerma I didn't gave any answer there.
comment on: http://stackoverflow.com/q/21274858

http://stackoverflow.com/q/21241683
has comment: http://stackoverflow.com/comment/33056031
possible better answer: http://stackoverflow.com/a/68063092
tagged with: spring-batch
has comment: http://stackoverflow.com/comment/33199747
answer count: 2
score: 36
has title: Spring-batch @BeforeStep does not work with @StepScope
upvote count: 36
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/68063092
tagged with: spring
has comment: http://stackoverflow.com/comment/32837832
accepted answer: http://stackoverflow.com/a/21941127
type: AnsweredQuestion
has body: I'm using Spring Batch version 2.2.4.RELEASE I tried to write a simple example with stateful ItemReader, ItemProcessor and ItemWriter beans. public class StatefulItemReader implements ItemReader&lt;String&gt; { private List&lt;String&gt; list; @BeforeStep public void initializeState(StepExecution stepExecution) { this.list = new ArrayList&lt;&gt;(); } @AfterStep public ExitStatus exploitState(StepExecution stepExecution) { System.out.println("******************************"); System.out.println(" READING RESULTS : " + list.size()); return stepExecution.getExitStatus(); } @Override public String read() throws Exception { this.list.add("some stateful reading information"); if (list.size() &lt; 10) { return "value " + list.size(); } return null; } } In my integration test, I'm declaring my beans in an inner static java config class like the one below: @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) public class SingletonScopedTest { @Configuration @EnableBatchProcessing static class TestConfig { @Autowired private JobBuilderFactory jobBuilder; @Autowired private StepBuilderFactory stepBuilder; @Bean JobLauncherTestUtils jobLauncherTestUtils() { return new JobLauncherTestUtils(); } @Bean public DataSource dataSource() { EmbeddedDatabaseBuilder embeddedDatabaseBuilder = new EmbeddedDatabaseBuilder(); return embeddedDatabaseBuilder.addScript("classpath:org/springframework/batch/core/schema-drop-hsqldb.sql") .addScript("classpath:org/springframework/batch/core/schema-hsqldb.sql") .setType(EmbeddedDatabaseType.HSQL) .build(); } @Bean public Job jobUnderTest() { return jobBuilder.get("job-under-test") .start(stepUnderTest()) .build(); } @Bean public Step stepUnderTest() { return stepBuilder.get("step-under-test") .&lt;String, String&gt;chunk(1) .reader(reader()) .processor(processor()) .writer(writer()) .build(); } @Bean public ItemReader&lt;String&gt; reader() { return new StatefulItemReader(); } @Bean public ItemProcessor&lt;String, String&gt; processor() { r…
tagged with: java
has answer: http://stackoverflow.com/a/21941127
has comment: http://stackoverflow.com/comment/32033640
type: Question

http://stackoverflow.com/a/53466199
answers question: http://stackoverflow.com/q/21246983
score: 0
type: Answer
has body: I had the same problem on Mac OS X. After some research I've found a bad entry in my /etc/hosts file for my localhost (192.168.99.100 localhost). I removed the bad line and left the line 127.0.0.1 localhost for ipv4 and some entries for ipv6 in. After a reboot the Android Studio was able to communicate with adb and found my connected Android device again.

http://stackoverflow.com/q/21240380
downvote count: 0
tagged with: generics
tagged with: wildcard
possible better answer: http://stackoverflow.com/a/21240501
favorite count: 0
has answer: http://stackoverflow.com/a/21240501
upvote count: 8
has comment: http://stackoverflow.com/comment/31996593
score: 8
has title: Java wild card BestPractices for casting
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32087830
has answer: http://stackoverflow.com/a/21240579
type: Question
has body: I have researched this extensively and cant seem to find a best practice for this scenario. ArrayList&lt;GenericObject&lt;?&gt;&gt; list = new ArrayList&lt;&gt;(); list.add( new GenericObject&lt;Integer&gt;(6) ); // Autoboxing list.add( new GenericObject&lt;String&gt;("HI") ); if(list.get( 0 ).getGenaricValue().getClass() == Integer.class){ GenericObject&lt;Integer&gt; gi = (GenericObject&lt;Integer&gt;) list.get( 0 ); System.out.println("Was Integer"); System.out.println(gi); } } while this block of code works the cast from GenericObject &lt;?&gt; to GenericObject&lt;Integer&gt; gives an unchecked warning. Now as you can see i have clearly checked the type with my if statement so I am not paranoid about an exception but is there a better way to do this without having to suppress the unchecked warning? Is there a best practice for this scenario? I have read the entire Generics oracle tutorial here and i have read a lot of stackoverflow posts but none that seem to answer this problem. any help would be appreciated thanks.
has comment: http://stackoverflow.com/comment/31999776
tagged with: java
has comment: http://stackoverflow.com/comment/32042499
answer count: 2
tagged with: casting
accepted answer: http://stackoverflow.com/a/21240579
has comment: http://stackoverflow.com/comment/31996644

http://stackoverflow.com/a/21337174
answers question: http://stackoverflow.com/q/21336967
has comment: http://stackoverflow.com/comment/32168759
score: 0
has comment: http://stackoverflow.com/comment/32168293
has comment: http://stackoverflow.com/comment/32167571
has comment: http://stackoverflow.com/comment/32169227
has body: I'm not shure if it fit's your requirements and not if it is "the" correct way to handle it but I make use of the @Transactional Annotation. So I would have: @Autowired AccountDAO accountDAO; @Transactional public List&lt;String&gt; getNamesOfAccount(String accountName){ Account account = accountDAO.get(accountName); return account.getNames(); } the names attribute in Account is lazy, and is loaded just before the return. If there is a better way let be hear!
has comment: http://stackoverflow.com/comment/32167906
type: Answer

http://stackoverflow.com/comment/31903799
type: Comment
has text: No it doesn't solve the problem. I figured out why it is happening
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21187800

http://stackoverflow.com/a/21223645
has body: It means that the filter is only applied during the terminal operation. Think of something like this: public Stream filter(Predicate p) { this.filter = p; // just store it, don't apply it yet return this; // in reality: return a new stream } public List collect() { for (Object o : stream) { if (filter.test(o)) list.add(o); } return list; } (That does not compile and is a simplification of the reality but the principle is there)
answers question: http://stackoverflow.com/q/21219667
type: AcceptedAnswer
downvote count: 0
upvote count: 90
accepted answer of: http://stackoverflow.com/q/21219667
type: Answer
score: 90

http://stackoverflow.com/a/21258646
has body: This should work. It will get the characters after 2014- , then cast them as an int, then get the highest one. For HS-01, change (ID, 6) for (ID, 4) select max(cast(substring(ID, 6) as UNSIGNED)) as maxid from table Casting : http://dev.mysql.com/doc/refman/5.6/en/cast-functions.html#function_cast Subtring: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substring
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21258107

http://stackoverflow.com/comment/32139651
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21321606
has text: Alright this worked. I was having a problem at first with it just repeating the same chance over and over which caused the critical to succeed every time until I reset and vice versa with it not succeeding until I reset, so incorporated it into the method like the working code showed rather then having it as a constant in my class. I appreciate your help!
type: Comment

http://stackoverflow.com/q/21347807
tagged with: java
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/21348187
has title: Android Call a method from another method
tagged with: class
score: 0
has comment: http://stackoverflow.com/comment/32186755
tagged with: android
has comment: http://stackoverflow.com/comment/32186619
has comment: http://stackoverflow.com/comment/32186825
has answer: http://stackoverflow.com/a/21348187
has body: In my android app I have a View class that will activate on button click .. but I need to call another method it using an if else statement for that what I have to do...? I checked class name().execute(); for executing but it is only for the class... I am giving my code below.. In xml android:onClick : "save" In Activity public void save(View V) { //code } I need to call this method with if else statement like SharedPreferences setting = getSharedPreferences(PREFS_NAME, 0); if (setting.getString("log", "").toString().equals("log")) { // call the above method } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.fullexplanationentry_xm); SharedPreferences setting = getSharedPreferences(PREFS_NAME, 0); if (setting.getString("log", "").toString().equals("log")) { //Here I need call the save method.. } EditText et1 = (EditText) findViewById (R.id.editText1); EditText et2 = (EditText) findViewById (R.id.editText2); EditText et3 = (EditText) findViewById (R.id.editText3); EditText et4 = (EditText) findViewById (R.id.editText4); EditText et5 = (EditText) findViewById (R.id.editText5); EditText et6 = (EditText) findViewById (R.id.editText6); EditText et7 = (EditText) findViewById (R.id.editText7); EditText et8 = (EditText) findViewById (R.id.editText8); EditText et9 = (EditText) findViewById (R.id.editText9); et1.setText(getIntent().getStringExtra("ett1")); et2.setText(getIntent().getStringExtra("ett2")); et3.setText(getIntent().getStringExtra("ett3")); et4.setText(getIntent().getStringExtra("ett4")); et5.setText(getIntent().getStringExtra("ett5")); et6.setText(getIntent().getStringExtra("ett6")); et7.setText(getIntent().getStringExtra("ett7")); et8.setText(getIntent().getStringExtra("ett8")); et9.setText(getIntent().getStringExtra("ett9")); db = openOrCreateDatabase("MyDBI", MODE_PRIVATE, null); db.execSQL("CREATE TABLE IF NOT EXISTS …
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32186761

http://stackoverflow.com/a/22452831
type: AcceptedAnswer
has body: CXF uses java.util.logging, not Log4J. You will have to configure that too, or use a bridge to send j.u.l output through log4j if you want all the configuration in one place.
accepted answer of: http://stackoverflow.com/q/21267071
type: Answer
answers question: http://stackoverflow.com/q/21267071
score: 0

http://stackoverflow.com/comment/31954248
score: 0
comment on: http://stackoverflow.com/q/21217097
type: Comment
type: QuestionComment
has text: You need to be more clear, post code, mention how your running the application (command line, eclipse ,...)

http://stackoverflow.com/a/21248418
score: 0
has body: Little is achieved by putting "large blobs of binary data" (such as PDFs) into a database. The only situation where this would be justified is when the data has to be handled transactionally. If there is nothing to be achieved by putting the PDFs into the database, then don't do it. You should be able to upload and download large documents faster if they are stored as files in the file system. How do you do it? Well there are a variety of ways. But WebDAV offers a simple "off-the-shelf" solution ... if that is what you are after.
type: Answer
answers question: http://stackoverflow.com/q/21247835

http://stackoverflow.com/a/58030461
answers question: http://stackoverflow.com/q/21216476
has body: When reading past the end of the file, an EOFException is thrown. So you can tell there's no more data to read. For examle: DataInputStream inputStream = new DataInputStream(new FileInputStream(file)); int data = 0; try { while (true) { data += inputStream.readInt(); } } catch (EOFException e) { System.out.println("All data were read"); System.out.println(data); }
score: 0
type: Answer

http://stackoverflow.com/q/21222882
has answer: http://stackoverflow.com/a/21242799
tagged with: jclouds
accepted answer: http://stackoverflow.com/a/21242799
type: AnsweredQuestion
has body: I'm looking to leverage RackSpace's CloudFiles platform for large object storage (word docs, images, etc). Following some of their guides, I found a useful code snippet, that looks like it should work, but doesn't in my case. Iterable&lt;Module&gt; modules = ImmutableSet.&lt;Module&gt; of( new Log4JLoggingModule()); Properties properties = new Properties(); properties.setProperty(LocationConstants.PROPERTY_ZONE, ZONE); properties.setProperty(LocationConstants.PROPERTY_REGION, "ORD"); CloudFilesClient cloudFilesClient = ContextBuilder.newBuilder(PROVIDER) .credentials(username, apiKey) .overrides(properties) .modules(modules) .buildApi(CloudFilesClient.class); The problem is that when this code executes, it tries to log me in the IAD (Virginia) instance of CloudFiles. My organization's goal is to use the ORD (Chicago) instance as primary to be colocated with our cloud and use DFW as a back up environment. The login response results in the IAD instance coming back first, so I'm assuming JClouds is using that. Browsing around, it looks like the ZONE/REGION attributes are ignored for CloudFiles. I was wondering if there is any way to override the code that comes back for authentication to loop through the returned providers and choose which one to login to. Update: The accepted answer is mostly good, with some more info available in this snippet: RestContext&lt;CommonSwiftClient, CommonSwiftAsyncClient&gt; swift = cloudFilesClient.unwrap(); CommonSwiftClient client = swift.getApi(); SwiftObject object = client.newSwiftObject(); object.getInfo().setName(FILENAME + SUFFIX); object.setPayload("This is my payload."); //input stream. String id = client.putObject(CONTAINER, object); System.out.println(id); SwiftObject obj2 = client.getObject(CONTAINER,FILENAME + SUFFIX); System.out.println(obj2.getPayload());
has title: Overriding authentication behavior in jclouds
tagged with: java
type: Question
answer count: 1
score: 0

http://stackoverflow.com/comment/31979179
type: Comment
type: QuestionComment
has text: @mKorbel thanks... it worked. I can now see both icon and image and the text i want to be displayed over button.
comment on: http://stackoverflow.com/q/21214640
score: 0

http://stackoverflow.com/a/21231445
type: Answer
answers question: http://stackoverflow.com/q/21231283
has body: Add all dependencies of JSCH to lib directory of ANT using similar &lt;copy tag. To find dependencies of JSCH check its documentation.
score: 0

http://stackoverflow.com/comment/31906232
type: AnswerComment
type: Comment
score: 0
has text: JUnit ignores abstract test classes, unless of course you click on the class in an IDE and try to run it explicitly... Having just tried that, it gives exactly the exception in the question.
comment on: http://stackoverflow.com/a/21190241

http://stackoverflow.com/comment/32028436
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21255672
type: AnswerComment
has text: Ok. So best-practice-wise what would be the proper approach? (see my example pls)

http://stackoverflow.com/q/21309627
has answer: http://stackoverflow.com/a/21309768
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32117335
type: Question
linked to: http://stackoverflow.com/q/6578205
linked to: http://stackoverflow.com/q/5621338
tagged with: layout
has comment: http://stackoverflow.com/comment/32117623
answer count: 1
downvote count: 0
tagged with: layout-manager
has title: How to add JLabel at run time in Swing?
accepted answer: http://stackoverflow.com/a/21309768
has comment: http://stackoverflow.com/comment/32117435
has body: I am making am window application on Java. I want to add label name at run time in my Swing application. How can I do this using Java Swing? public class Component1 extends JPanel { Component1() { JLabel label = new JLabel("dd"); label.setBounds(370, 340, 150, 20); // label.setText("labeVVl"); add(label); } public static void main(String[] args) { // create frame JFrame frame = new JFrame(); final int FRAME_WIDTH = 800; final int FRAME_HEIGHT = 600; // set frame attributes frame.setSize(FRAME_WIDTH, FRAME_HEIGHT); frame.setTitle("My Frame"); frame.setVisible(true); Component1 Com = new Component1(); Component add = frame.add(Com); } }
favorite count: 0
tagged with: jlabel
has comment: http://stackoverflow.com/comment/32117511
linked to: http://stackoverflow.com/q/6988317
upvote count: 1
tagged with: swing
linked to: http://stackoverflow.com/q/4279435
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717

http://stackoverflow.com/q/21188476
has answer: http://stackoverflow.com/a/21188563
tagged with: loops
upvote count: 1
has comment: http://stackoverflow.com/comment/31902779
type: Question
has answer: http://stackoverflow.com/a/21188589
tagged with: java
possible better answer: http://stackoverflow.com/a/21188589
has answer: http://stackoverflow.com/a/21188595
has comment: http://stackoverflow.com/comment/31902732
accepted answer: http://stackoverflow.com/a/21188563
tagged with: for-loop
linked to: http://stackoverflow.com/q/85190
has title: Java for-loop syntax?
has answer: http://stackoverflow.com/a/21189698
has comment: http://stackoverflow.com/comment/31902726
has body: My friend sent me this piece of code and it works, but I can't understand what the "ss" means? Can anyone help me out? Thanks. public static void main(String[] args) { String sentence; int index=1; String[] words; System.out.print("Please enter a sentence: "); sentence = EasyIn.getString(); words = sentence.split(" "); for(String ss : words ) { System.out.println("Word "+index+ " is "+ ss); if(ss.matches("[a-zA-Z]+")) { System.out.println("Word "+ss+" is a good word"); System.out.print("\n"); } else { System.out.println("Word "+ss+" is a bad word"); System.out.print("\n"); } index++; } }
favorite count: 0
duplicate of: http://stackoverflow.com/q/85190
answer count: 4
downvote count: 6
type: AnsweredQuestion
score: -5

http://stackoverflow.com/a/21267794
has comment: http://stackoverflow.com/comment/32044733
upvote count: 3
answers question: http://stackoverflow.com/q/21267630
downvote count: 0
has comment: http://stackoverflow.com/comment/32044044
has comment: http://stackoverflow.com/comment/32044919
has body: The .csv file format with line# and indices: | columnIndex | 1 2 3 4 ---------------- line1 | 1,2,3,4 line2 | 5,6,7,8 line3 | 9,a,b,c ... lineN | w,x,y,z With this visualization it should be easy to see how to parse it. Here is a code snippet to read it into your gridWorld array, hope this helps: lineIndex = 0; while ((line = br.readLine()) != null) { String[] split = line.split(","); for (int i=0; i&lt;split.length; i++) { gridWorld[lineIndex][i] = split[i].charAt(0); } lineIndex++; }
type: Answer
score: 3

http://stackoverflow.com/q/21228056
has body: In OSGI, we can update, activate, deactivate bundles during run time. But I didn't understand how it is possible because some other may use functionality of this bundle. Why not this happening crashes the application ? Normally, in JVM, whenever it runs any application, it loads source class files and required Java API class files and produces the result. Can you explain what is the basic architecture of OSGI, so that it allows above happenings.
answer count: 1
downvote count: 0
tagged with: apache-felix
tagged with: osgi
accepted answer: http://stackoverflow.com/a/21230096
favorite count: 0
has title: How can we update any bundle in OSGI during runtime
tagged with: maven
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/17018266
upvote count: 3
tagged with: osgi-bundle
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21230096

http://stackoverflow.com/comment/32143836
has text: How `Java` and `Assembly` tags related here?
type: QuestionComment
type: Comment
score: 3
comment on: http://stackoverflow.com/q/21324308

http://stackoverflow.com/comment/32142669
comment on: http://stackoverflow.com/a/21323625
has text: I put an Intent into setContent().
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21236469
has title: How manage heavy task under Java/Spring?
score: 0
has comment: http://stackoverflow.com/comment/31988968
has body: I have a dashboard where users can do modification to their customers datas. Some modifications needs heavy processing on all those customers. I don't want to block my user waiting that the task finished so how can I manage this in background? I saw Spring Batch but I'm not sure it's the good answer. Is there anything else? Thanks in advance for your help.
has answer: http://stackoverflow.com/a/21236539
tagged with: spring
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21236585
has answer: http://stackoverflow.com/a/21237418
tagged with: java
possible better answer: http://stackoverflow.com/a/21236585
type: Question
has comment: http://stackoverflow.com/comment/31988926
accepted answer: http://stackoverflow.com/a/21236539
has comment: http://stackoverflow.com/comment/31989010
has answer: http://stackoverflow.com/a/21237201
linked to: http://stackoverflow.com/q/533783

http://stackoverflow.com/a/45831508
answers question: http://stackoverflow.com/q/21326747
type: Answer
has body: My suggestion is to use PrintWriter for better time performance, though the time difference is not major in smaller programs. For larger programs you may notice significant difference. I have replaced and run System.out.println with PrintWriter and my execution time reduced from 0.06 sec to 0.05 sec. Here is a link to a similar question: https://discuss.codechef.com/questions/62586/systemoutprintln-vs-printwriter Hope it helps :)
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/92307006
score: 0

alpha
tags question: http://stackoverflow.com/q/21199072
tag name: alpha
type: Tag

http://stackoverflow.com/comment/32099407
type: Comment
score: 3
comment on: http://stackoverflow.com/q/21299216
has text: Umm... start by reading the Javadoc for `ArrayList` to see that the changes required are minimal?
type: QuestionComment

http://stackoverflow.com/comment/93394949
score: 1
comment on: http://stackoverflow.com/a/21233711
type: AnswerComment
type: Comment
has text: Ah ok so the cast has precedence over the addition operator. Thanks!

http://stackoverflow.com/q/21319905
has body: I currently am accessing a streaming h264 file and want to save it off for the ability to slice frames. However, I'm having issues saving/opening the .flv file When pointing to the URL in the address bar - I am told it's an x-flv file. I then attempt to do the following to save a chunk of the stream. URL url = new URL("http://foo.bar.com/foo/bar"); HttpURLConnection conn = (HttpURLConnection) url .openConnection(proxy); conn.setRequestMethod("GET"); File f = new File("C:\\tmpArea\\tmp.flv"); FileWriter fr = new FileWriter(f); bw = new BufferedWriter(fr); BufferedReader br = new BufferedReader(new InputStreamReader( (conn.getInputStream()))); String output = ""; int i = 0; while (((output = br.readLine()) != null) && i < 100000) { bw.write(output); i++; } Upon doing this I've attempted to open the file in VLC Media Player and am told: No suitable decoder module: VLC does not support the audio or video format "undf". Unfortunately there is no way for you to fix this. I then thought, well maybe it's not really an FLV file and that's on me. So I used a run of the mill hex-editor. Opening up the file in the HexEditor gives me the following information: FLV onMetaData duration width height videodatarate framerate videocodecid audiodatarate audiosamplerate audiosamplesize stereo audiocodecid encoder Lavf52.10.6.0 filesize.... Is there a different way I should be trying to save off this data? Is there a conversion/codec issue I'm not seeing?
accepted answer: http://stackoverflow.com/a/21320118
tagged with: flv
tagged with: codec
answer count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21320118
score: 0
tagged with: vlc
type: Question
tagged with: video-streaming
has title: Saving an FLV Stream
tagged with: java

http://stackoverflow.com/a/21218807
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21198867
downvote count: 0
score: 1
has body: Testng has listeners. Refer this link http://testng.org/doc/documentation-main.html#testng-listeners

http://stackoverflow.com/q/21207072
has comment: http://stackoverflow.com/comment/31936245
favorite count: 0
has comment: http://stackoverflow.com/comment/31936070
has comment: http://stackoverflow.com/comment/31936353
has comment: http://stackoverflow.com/comment/31936574
has comment: http://stackoverflow.com/comment/31936210
has comment: http://stackoverflow.com/comment/31935937
has comment: http://stackoverflow.com/comment/31936496
type: UnansweredQuestion
has body: I am retrieving data from database to arraylist of object , and then from arraylist to JTextFields . but im facing a problem with printing it out from the arraylist . how can i print the arraylist into the JTextFields ! try { Class.forName(DRIVER); cn = DriverManager.getConnection(url, "", ""); stmt = cn.createStatement(); rs = stmt.executeQuery("SELECT * FROM Userpref"); while(rs.next()){ int id = rs.getInt("ID"); String fName = rs.getString("FirstName"); String lName = rs.getString("SecondName"); double gpa = rs.getDouble("GPA"); Student s = new Student(fName, lName, id, gpa); students.add(s); // how i can print out the arraylist into the JTextFields line by line ! } } catch(Exception e) { System.out.println(e.getMessage()); }
has answer: http://stackoverflow.com/a/21207105
upvote count: 0
has comment: http://stackoverflow.com/comment/31936896
has comment: http://stackoverflow.com/comment/31936205
tagged with: swing
downvote count: 1
has title: Print Out ArrayList of objects into JTextFields
type: Question
has comment: http://stackoverflow.com/comment/31936000
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/31937340
tagged with: sql
answer count: 1

http://stackoverflow.com/a/23614722
upvote count: 5
answers question: http://stackoverflow.com/q/21245796
type: Answer
downvote count: 0
score: 5
has body: I ran into a similar issue and found I was hitting the wrong port. After fixing the port things worked great.

http://stackoverflow.com/a/21259911
type: Answer
has body: Can't you do this with a like and wildcards instead? Query query = HibernateUtil.getSessionFactory().getCurrentSession().createQuery( "from User u where u.user like :user"); query.setString("user", "John%"); Otherwise do a native query
answers question: http://stackoverflow.com/q/21259549
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/21289511
upvote count: 3
type: UnansweredQuestion
tagged with: request
has title: Play Framework 2.0 - asJson() always returns null
tagged with: playframework-2.0
has comment: http://stackoverflow.com/comment/32117474
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32118130
type: Question
has answer: http://stackoverflow.com/a/34912720
has body: This is a simple form with username and email fields. Sign up Now I try to parse request().body() as in the documentation. @BodyParser.Of(BodyParser.Json.class) public static Result signup() { RequestBody body = request().body(); return ok("Got json: " + body.asJson()); } This returns null. request().body().toString() doesn't though, in fact, I can print the request, which is displayed as: DefaultRequestBody(Some(Map(username -> List(james), email -> List(hello@sdfs.com))),None,None,None,None,None,false) Basically I want to extract the name and email from the request but the toJson method always returns null.
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32182740
linked to: http://stackoverflow.com/q/4150219
favorite count: 0
score: 3

http://stackoverflow.com/a/21211263
answers question: http://stackoverflow.com/q/21211244
has body: I don't know if this is your error (you haven't told us which line is line 60 of your Map class, the line that is causing your exception), but this is dangerous code: while(m.hasNext()) { for(int i = 0; i &lt; 14; i++) { Map[i] = m.next(); } } You're calling hasNext() once per loop iteration, but calling next() 14 times! There should be a strict 1 to 1 correlation in that each next() should match with a preceding hasNext(). Also, there's no reason for the nested for loop since the while loop will handle all you need. You probably would get by with something like: int i = 0; while(m.hasNext()) { Map[i] = m.next(); i++; } But it would be safer to use an ArrayList rather than an array. As an aside, please learn and follow Java coding conventions. Methods and fields/variables/parameters should all start with a lower-case letter, so Map[i] is not allowed, but rather should be map[i]. Doing this will help us to better understand and follow your code and thus help you.
has comment: http://stackoverflow.com/comment/31944432
has comment: http://stackoverflow.com/comment/31944034
has comment: http://stackoverflow.com/comment/31999939
type: Answer
has comment: http://stackoverflow.com/comment/31944372
has comment: http://stackoverflow.com/comment/31944459
has comment: http://stackoverflow.com/comment/31943967
has comment: http://stackoverflow.com/comment/31945220
has comment: http://stackoverflow.com/comment/31944223
upvote count: 5
has comment: http://stackoverflow.com/comment/31944949
accepted answer of: http://stackoverflow.com/q/21211244
score: 5
has comment: http://stackoverflow.com/comment/31944414
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32163103
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21334940
has text: nice we chatted here, time to post an SSCCE/MCVE, short, runnable, compilable with hardcoded value for JTable in local variable, otherwise this question isn't answerable, nor from description posted here
score: 1

http://stackoverflow.com/comment/32109638
comment on: http://stackoverflow.com/q/21305172
type: Comment
type: QuestionComment
score: 0
has text: http://stackoverflow.com/questions/3271249/difference-between-statement-and-preparedstatement

http://stackoverflow.com/q/21241060
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21241204
tagged with: swing
has comment: http://stackoverflow.com/comment/31997527
type: AnsweredQuestion
tagged with: jslider
has answer: http://stackoverflow.com/a/21241204
has comment: http://stackoverflow.com/comment/32000980
score: 1
tagged with: java
has body: I there a way to get the color that is behind the slider portion of a JSlider? For Example, I made a program (see Image Below) that creates a gradient and requires the user to pick a color with a JSlider. Is there a way to get the color that the JSlider stops at?
upvote count: 1
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/31999815
has title: How to get the color behind a JSlider
has comment: http://stackoverflow.com/comment/31997833
tagged with: colors
has comment: http://stackoverflow.com/comment/31997469

http://stackoverflow.com/a/21329440
has body: This could be due to two reasons: In the lines before the IF statement an Exception is thrown. addresses has no elements You should check addresses length and capture any possible Exception to know the reason why is your conditional not executed.
answers question: http://stackoverflow.com/q/21329366
score: 0
type: Answer

http://stackoverflow.com/q/21278681
accepted answer: http://stackoverflow.com/a/21287849
possible better answer: http://stackoverflow.com/a/55113361
answer count: 2
has answer: http://stackoverflow.com/a/55113361
tagged with: .net
favorite count: 0
upvote count: 4
type: AnsweredQuestion
has body: We have exposed a SOAP web service in Java that includes complex types. One of the types includes a member that is of type ENUM. This ENUM is exposed in the WSDL. When adding a service reference in C# to this web service, the Reference.cs ends up showing the ENUM as /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.225")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://services.war.indi.ecm.barmergek.de/")] public enum status { /// <remarks/> UNBEKANNT, /// <remarks/> WERT_OK, /// <remarks/> FALSCH, /// <remarks/> RICHTIG, /// <remarks/> IRRELEVANT, } Receiving values from the Java web service with those values works just fine. Now when we use this ENUM in C# as a value to the respective type member, it will not be serialized when calling a web service method with this value. The XML element simply does not exist. What are we missing? EDIT: This is the part of the WSDL that defines the status ENUM <xs:simpleType name="status"> <xs:restriction base="xs:string"> <xs:enumeration value="UNBEKANNT" /> <xs:enumeration value="WERT_OK" /> <xs:enumeration value="FALSCH" /> <xs:enumeration value="RICHTIG" /> <xs:enumeration value="IRRELEVANT" /> </xs:restriction> </xs:simpleType> It is part of the complex type indexField <xs:complexType name="indexField"> <xs:sequence> <xs:element name="fieldId" type="xs:int" /> <xs:element minOccurs="0" name="fieldName" type="xs:string" /> <xs:element minOccurs="0" name="fieldValue" type="xs:string" /> <xs:element minOccurs="0" name="status" type="tns:status" /> </xs:sequence> </xs:complexType> In C# we fill the value from the status ENUM idxField.status = status.IRRELEVANT; We verified in a debug session that the enum value is set in the resulting parameter object for the web service method before calling it. But the resulting SOAP message does not contain this value 0 ordnungsbegriff 93685377 EDIT2: We have exposed another method in the same web service whi…
downvote count: 0
tagged with: web-services
type: Question
tagged with: c#
linked to: http://stackoverflow.com/q/4261038
tagged with: enums
has title: C# from .NET 3.5 does not serialize ENUM exposed by Java Web Service
tagged with: java
score: 4
has answer: http://stackoverflow.com/a/21287849

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/21207511
tags question: http://stackoverflow.com/q/21266344
tags question: http://stackoverflow.com/q/21219966
tags question: http://stackoverflow.com/q/21318629
tags question: http://stackoverflow.com/q/21215305
tags question: http://stackoverflow.com/q/21218371
tags question: http://stackoverflow.com/q/21278160
type: Tag
tags question: http://stackoverflow.com/q/21286650
tags question: http://stackoverflow.com/q/21290154
tags question: http://stackoverflow.com/q/21261674
tags question: http://stackoverflow.com/q/21286746
tags question: http://stackoverflow.com/q/21296000
tags question: http://stackoverflow.com/q/21349322
tags question: http://stackoverflow.com/q/21261993
tags question: http://stackoverflow.com/q/21210808
tags question: http://stackoverflow.com/q/21202278
tags question: http://stackoverflow.com/q/21207085
tags question: http://stackoverflow.com/q/21200743
tags question: http://stackoverflow.com/q/21229564
tags question: http://stackoverflow.com/q/21311953
tags question: http://stackoverflow.com/q/21240790
tags question: http://stackoverflow.com/q/21227324
tags question: http://stackoverflow.com/q/21194294
tags question: http://stackoverflow.com/q/21326046
tags question: http://stackoverflow.com/q/21300060
tags question: http://stackoverflow.com/q/21325608
tags question: http://stackoverflow.com/q/21214940
tags question: http://stackoverflow.com/q/21281197
tags question: http://stackoverflow.com/q/21329384
tags question: http://stackoverflow.com/q/21340823
tag name: html
tags question: http://stackoverflow.com/q/21212694
tags question: http://stackoverflow.com/q/21289844
tags question: http://stackoverflow.com/q/21230601
tags question: http://stackoverflow.com/q/21265599
tags question: http://stackoverflow.com/q/21263091
tags question: http://stackoverflow.com/q/21191584
tags question: http://stackoverflow.com/q/21218392
tags question: http://stackoverflow.com/q/21306385
tags question: http://stackoverflow.com/q/21220433
tags question: http://stackoverflow.com/q/21188844

http://stackoverflow.com/q/21332818
has comment: http://stackoverflow.com/comment/32171277
accepted answer: http://stackoverflow.com/a/21362072
tagged with: dependency-injection
type: AnsweredQuestion
has body: I have a big issue with the dependency jnjection of Spring. I created a class ObjectJPA, that implements my DAO interface. Now I want to test it within a JUnit testcase. But I get a NoSuchBeanDefinitionException. This is the beginning of the test: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:Spring-Common.xml" }) public class Test { @Autowired ObjectJPA jpa; } And this is the bean package model.dao.jpa; @Repository public class ObjectJPA implements ObjectDAO { … } content of the Spring-Common.xml the declaration of the interface package model.dao; public interface ObjectDAO { Content of the Spring-Common.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" 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/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="model.dao.jpa" /> <context:annotation-config /> <tx:annotation-driven /> </beans> Do you have any ideas? Which information do you need to get a better impact?
has comment: http://stackoverflow.com/comment/32159469
has comment: http://stackoverflow.com/comment/32161797
type: Question
has answer: http://stackoverflow.com/a/21362072
has title: Why does my Spring setup fail with a NoSuchBeanDefinitionException?
has comment: http://stackoverflow.com/comment/32164690
score: 0
tagged with: spring-orm
answer count: 1
tagged with: junit4
tagged with: java

http://stackoverflow.com/q/21336141
has comment: http://stackoverflow.com/comment/32164942
tagged with: swing
has comment: http://stackoverflow.com/comment/32166091
has comment: http://stackoverflow.com/comment/32166369
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21336649
type: Question
answer count: 2
has body: Title says it all... My friend and I are doing this and we have no idea why Ball.java isn't actually making the balls in the gamePanel and then making the GUI. This is 8-ball pool, by the way. Here is the code: Driver or Final2 import javax.swing.*; import java.awt.*; import java.io.*; import java.util.*; import java.awt.event.*; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Ellipse2D; import java.awt.geom.Rectangle2D; public class Final2 implements ActionListener { JPanel titlePanel, gamePanel, buttonPanel; JLabel titleLabel, turnLabel, oneTypeLabel, twoTypeLabel; JButton newGameButton; int turn; String oneType,twoType; public JPanel createContentPane() { turn = 0; oneType = ""; twoType = ""; JPanel totalGUI = new JPanel(); totalGUI.setLayout(null); titlePanel = new JPanel(); titlePanel.setLayout(null); titlePanel.setLocation(10,0); titlePanel.setSize(500,100); totalGUI.add(titlePanel); titleLabel = new JLabel("8-ball Pool"); titleLabel.setLocation(25,10); titleLabel.setSize(100,20); titleLabel.setHorizontalAlignment(0); titleLabel.setForeground(Color.red); titlePanel.add(titleLabel); gamePanel = new gamePanel(); gamePanel.setLayout(null); gamePanel.setLocation(200,250); gamePanel.setSize(864,432); //this needs to be turned into 864x432 later gamePanel.setBorder(BorderFactory.createLineBorder(Color.black)); totalGUI.add(gamePanel); buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout()); buttonPanel.setLocation(900,40); buttonPanel.setSize(200,40); totalGUI.add(buttonPanel); turnLabel = new JLabel("" + turn); turnLabel.setHorizontalAlignment(0); titlePanel.add(turnLabel); oneTypeLabel = new JLabel(oneType); oneTypeLabel.setHorizontalAlignment(0); oneTypeLabel.setForeground(Color.red); buttonPanel.add(oneTypeLabel); twoTypeLabel = new JLabel(twoType); twoTypeLabel.setHorizontalAlignment(0); twoTypeLabel.setForeground(Color.blue); buttonPanel.add(twoTypeLabel); newGameButton = new JButton("New Game"); ne…
has comment: http://stackoverflow.com/comment/32164637
score: 0
tagged with: user-interface
possible better answer: http://stackoverflow.com/a/21336649
has title: How to GUI - Using paintcomponent() to initialize a GUI and then to add GUI based on mouse
tagged with: paintcomponent
has answer: http://stackoverflow.com/a/21336616
accepted answer: http://stackoverflow.com/a/21336616

http://stackoverflow.com/comment/31931335
comment on: http://stackoverflow.com/a/21195987
has text: if go to Errors / Warnings - there are selector with 3 states(warning, error and ignore)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31918715
type: AnswerComment
has text: @SadikHasan - What exception do you get?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21191527

http://stackoverflow.com/comment/32122805
score: 0
type: Comment
has text: This approach works for for my purposes. There is one improvement I would suggest. On my machines, the above approach leads to one second lags between turns on my system. What I've found is that calling flush() after printing on both ends eliminates these one second lags. I'll add non-random test code using this approach momentarily.
comment on: http://stackoverflow.com/a/21296121
type: AnswerComment

jax-rs
tags question: http://stackoverflow.com/q/21262344
tags question: http://stackoverflow.com/q/21345153
tags question: http://stackoverflow.com/q/21189064
tags question: http://stackoverflow.com/q/21279617
tags question: http://stackoverflow.com/q/21301896
tags question: http://stackoverflow.com/q/21260252
tags question: http://stackoverflow.com/q/21260522
tags question: http://stackoverflow.com/q/21277528
tags question: http://stackoverflow.com/q/21276988
tags question: http://stackoverflow.com/q/21217232
tags question: http://stackoverflow.com/q/21192057
tags question: http://stackoverflow.com/q/21256504
tags question: http://stackoverflow.com/q/21258705
tags question: http://stackoverflow.com/q/21192879
type: Tag
tags question: http://stackoverflow.com/q/21312121
tags question: http://stackoverflow.com/q/21240777
tags question: http://stackoverflow.com/q/21232160
tag name: jax-rs

http://stackoverflow.com/comment/32143220
has text: Am I applying this to main or I will create a new method?
type: Comment
comment on: http://stackoverflow.com/a/21323694
score: 0
type: AnswerComment

http://stackoverflow.com/comment/54143874
comment on: http://stackoverflow.com/a/21289748
has text: We never talked about the original C implementation or the C# wrapper. It is possible that they may not be thread safe. Never worked with them.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21281499
tagged with: java
has body: I am making a program in java that requests a certain url and gets the information I need. I am using the Jsoup lib but I'm having trouble with one certain aspect. How can I request a http url, wait a couple of seconds (while maintaining the connection), and then get the response? Because the site needs a couple of seconds to load the requested url, before the data is loaded onto the webpage a loading screen is displayed. I tried the following: Connection con = Jsoup.connect(url); Thread.sleep(10000); Document doc = con.get(); But this didn't work out..
tagged with: delay
answer count: 1
tagged with: get
score: 0
has answer: http://stackoverflow.com/a/21283385
has title: java HTTP get response after delay
type: UnansweredQuestion
tagged with: http
type: Question

http://stackoverflow.com/q/21322888
duplicate of: http://stackoverflow.com/q/812415
has answer: http://stackoverflow.com/a/21323156
accepted answer: http://stackoverflow.com/a/21323156
answer count: 1
score: 0
linked to: http://stackoverflow.com/q/812415
has comment: http://stackoverflow.com/comment/32141777
has body: I would like to know what's the better things between these situations in therme of performance : @Component public class A{ public void doSomethingOne(){ ServiceDelegateA serviceA = (ServiceDelegateA) ApplicationContextUtils.getBean("ServiceDelegateA"); serviceA.compute(); } public void doSomethingTwo(){ ServiceDelegateB serviceB = (ServiceDelegateB) ApplicationContextUtils.getBean("ServiceDelegateB"); serviceB.doAction(); } } Or @Component public class A{ @Autowired ServiceDelegateA serviceA; @Autowired ServiceDelegateB serviceB; public void doSomethingOne(){ serviceA.compute(); } public void doSomethingTwo(){ serviceB.doAction(); } } Thank your in advance for help and your advices.
tagged with: spring
has title: What's the better thing between annotation and ApplicationContext in spring
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32141534
has comment: http://stackoverflow.com/comment/32144541

http://stackoverflow.com/comment/32149328
comment on: http://stackoverflow.com/a/21325573
type: Comment
has text: Great proposal. I've tried something along does lines. But I encounter the problem I commented on my question.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32107945
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21303770
has text: Yes, good point. You're right in that regard. Good discussion to have. Thanks.
type: AnswerComment

http://stackoverflow.com/q/21280904
accepted answer: http://stackoverflow.com/a/21289597
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
linked to: http://stackoverflow.com/q/10505856
type: Question
has comment: http://stackoverflow.com/comment/32099906
tagged with: weblogic12c
has body: We use Weblogic 12 in our application and create a custom Weblogic domain in system and deploy application to it. I know that in Jboss 7.1.1 we can copy application to ./standalone/deployments to deploy the application. But is it possible to create a domain similar to Weblogic in Jboss, so that application can be started from some other location even though it isn't copied inside ./standalone/deployments?
tagged with: jboss
has title: Jboss setup similar to Weblogic domain?
tagged with: weblogic11g
answer count: 1
downvote count: 0
tagged with: jboss7.x
favorite count: 0
has answer: http://stackoverflow.com/a/21289597

http://stackoverflow.com/comment/32186804
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21346130
score: 0
has text: I changed as you said，I think it should be the server configuration is wrong；

http://stackoverflow.com/comment/31996602
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21240740
has text: Can you explain this -> `count instances of any classes when creating`? Add creates an object as well?
type: Comment

http://stackoverflow.com/a/29189811
has body: LocalDate localDate = LocalDate.parse( new SimpleDateFormat("yyyy-MM-dd").format(date) );
has comment: http://stackoverflow.com/comment/54895799
has comment: http://stackoverflow.com/comment/69696521
upvote count: 33
downvote count: 5
has comment: http://stackoverflow.com/comment/54895669
type: Answer
answers question: http://stackoverflow.com/q/21242110
score: 28
has comment: http://stackoverflow.com/comment/69443341

jdbc
tags question: http://stackoverflow.com/q/21346953
tags question: http://stackoverflow.com/q/21260273
tags question: http://stackoverflow.com/q/21207049
tags question: http://stackoverflow.com/q/21228618
tags question: http://stackoverflow.com/q/21322912
tags question: http://stackoverflow.com/q/21263341
tags question: http://stackoverflow.com/q/21348891
tags question: http://stackoverflow.com/q/21302383
tags question: http://stackoverflow.com/q/21346305
tags question: http://stackoverflow.com/q/21228679
tags question: http://stackoverflow.com/q/21229902
tags question: http://stackoverflow.com/q/21234374
tags question: http://stackoverflow.com/q/21282057
tags question: http://stackoverflow.com/q/21294168
tags question: http://stackoverflow.com/q/21232923
type: Tag
tags question: http://stackoverflow.com/q/21305705
tags question: http://stackoverflow.com/q/21240888
tags question: http://stackoverflow.com/q/21216747
tags question: http://stackoverflow.com/q/21269951
tags question: http://stackoverflow.com/q/21284142
tags question: http://stackoverflow.com/q/21348472
tags question: http://stackoverflow.com/q/21327012
tags question: http://stackoverflow.com/q/21296649
tags question: http://stackoverflow.com/q/21345932
tags question: http://stackoverflow.com/q/21263771
tags question: http://stackoverflow.com/q/21266923
tags question: http://stackoverflow.com/q/21234932
tags question: http://stackoverflow.com/q/21280658
tags question: http://stackoverflow.com/q/21257819
tags question: http://stackoverflow.com/q/21286174
tags question: http://stackoverflow.com/q/21211035
tags question: http://stackoverflow.com/q/21238245
tags question: http://stackoverflow.com/q/21205156
tags question: http://stackoverflow.com/q/21242733
tags question: http://stackoverflow.com/q/21289637
tag name: jdbc
tags question: http://stackoverflow.com/q/21294570
tags question: http://stackoverflow.com/q/21200056
tags question: http://stackoverflow.com/q/21202523
tags question: http://stackoverflow.com/q/21242479

http://stackoverflow.com/comment/32038587
type: AnswerComment
comment on: http://stackoverflow.com/a/21264828
score: 0
type: Comment
has text: @dognose Added to the answer. That wasn't part of the question, however, which was about printing both together.

http://stackoverflow.com/a/21357787
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/21347670
downvote count: 0
has body: It it because you're comparing apples with oranges. In your Gson test, you are creating a single Gson instance and measuring the time to serialize N objects to it. In your Serialization test, you are measuring the time to create N ObjectOutputStreams and N ObjectInputStreams, and serialize one object. Try a valid comparison. You might get quite a surprise.
type: Answer

http://stackoverflow.com/comment/32006374
comment on: http://stackoverflow.com/q/21245037
score: 0
type: QuestionComment
has text: @BrianRoach I don't think so. According to the trace it fails in the CardView. The implementations ar Allways ArrayList... But I have other classes with CardView lists and they all work
type: Comment

http://stackoverflow.com/a/21226288
has comment: http://stackoverflow.com/comment/31970828
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21226244
type: Answer
has body: When you're creating a Random dice object, it's not creating a java.util.Random object, it's creating an object of your own class, Random. The nextInt method is being called on the object of your class, and since it doesn't exist, you get the error. Name your class ANYTHING but Random, or any of your other imports for that matter. Don't forget to rename your file as well, to the same new name.
upvote count: 2
has comment: http://stackoverflow.com/comment/31970780
has comment: http://stackoverflow.com/comment/31970785

http://stackoverflow.com/a/21219149
has comment: http://stackoverflow.com/comment/31966150
has comment: http://stackoverflow.com/comment/31968520
downvote count: 0
has comment: http://stackoverflow.com/comment/31962961
has comment: http://stackoverflow.com/comment/31962241
has body: Suggestions: Your log-in window should not be a JFrame, but instead should be a modal dialog such as either a JOptionPane or a modal JDialog. This way, when your calling code displays the dialog, all code flow in the calling code stops, and remains halted until the dialog is no longer visible. Once the dialog is no longer visible and the calling code resumes, this when you can query the dialog class's state and get the log-in information. You don't show us (or I'm not seeing) how you try to call this code from elsewhere. This is key since that is where your problem is located, and which is what we must see. As kleopatra states, don't use null layout and direct positioning and sizing of components for it will come back to bite you in the tush, trust me. Edit Yep, I believe that your problem is as I predicted and is because you're using a JFrame as a dialog window. Look here: Build1 a = new Build1(); String user = a.getUsername(); Since Build1 is a non-modal JFrame, it does not block the calling code when it is set visible. And so a.getUsername() is called immediately before the user has had a chance to enter data into the Build1 window. One solution is to use a WindowListener to see when the Build1 window is no longer visible, but why go through that mess. Instead why not simply use a modal JDialog not a JFrame for your dialog window. Again, you will want to stop using null layouts and absolute positioning, trust me. It will bite you. Edit 2 You state: First, can you give me an example of JDialog? Creating and using a JDialog is similar to creating a JFrame except that you should pass in a reference to the parent window in the constructor as well as tell it to be modal or not. Please have a look at the JDialog API for specifics on its constructor. Also, I've written many examples of using this on this site, and I invite you to please have a search of this site on my name and the term JDialog and you'll find plenty of examples that I've written. Also, I suggest that y…
has comment: http://stackoverflow.com/comment/31958051
has comment: http://stackoverflow.com/comment/31965952
type: Answer
has comment: http://stackoverflow.com/comment/31962692
has comment: http://stackoverflow.com/comment/31966100
has comment: http://stackoverflow.com/comment/31968122
has comment: http://stackoverflow.com/comment/31966028
has comment: http://stackoverflow.com/comment/31965856
accepted answer of: http://stackoverflow.com/q/21218525
upvote count: 1
has comment: http://stackoverflow.com/comment/31968271
has comment: http://stackoverflow.com/comment/31968957
answers question: http://stackoverflow.com/q/21218525
has comment: http://stackoverflow.com/comment/31968893
score: 1
has comment: http://stackoverflow.com/comment/31962835
has comment: http://stackoverflow.com/comment/31967860
has comment: http://stackoverflow.com/comment/31965777
type: AcceptedAnswer

http://stackoverflow.com/a/21237522
has body: Use equals and hashCode methods like below it will work perfectly alright @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (int) (from ^ from &gt;&gt;&gt; 32); result = prime * result + (int) (to ^ to &gt;&gt;&gt; 32); return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Interval other = (Interval) obj; if (from != other.from) { return false; } if (to != other.to) { return false; } return true; }
type: Answer
has comment: http://stackoverflow.com/comment/31990974
answers question: http://stackoverflow.com/q/21237270
upvote count: 1
has comment: http://stackoverflow.com/comment/31991346
score: 1
has comment: http://stackoverflow.com/comment/31991614
has comment: http://stackoverflow.com/comment/31991218
downvote count: 0

http://stackoverflow.com/a/21339201
downvote count: 0
answers question: http://stackoverflow.com/q/21338829
type: Answer
has body: As far as I remember, the standard delimiter of the Scanner class is a white space, therefore's only capturing the first part (Wake). Use input.useDelimiter("\n"); before you call the next() method and it will be solved.
upvote count: 1
score: 1

http://stackoverflow.com/a/21229108
answers question: http://stackoverflow.com/q/21227964
score: 0
upvote count: 1
downvote count: 1
has body: First install the pdf software in your local system then run this code in excel vb application. Give the name as you wish... that's it.. Sub expf() Application.ActivePrinter = "PDF Complete on PDFC" ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,""PDF Complete on PDFC"",,TRUE,,FALSE)" End Sub
has comment: http://stackoverflow.com/comment/31976681
type: Answer

http://stackoverflow.com/q/21280028
linked to: http://stackoverflow.com/q/24791298
type: Question
tagged with: jasper-reports
has title: creating jasper report using map data source spring mvc
downvote count: 0
has answer: http://stackoverflow.com/a/25174203
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
score: 2
tagged with: java
has body: I want to create a jasper report. I am passing following data source. Collection&lt;Map&lt;String, String&gt;&gt; listCollection = new ArrayList&lt;Map&lt;String, String&gt;&gt;(); //value insertion in listCollection JRDataSource ds= new JRMapCollectionDataSource(listCollection); Map&lt;String,Object&gt; parameterMap = new HashMap&lt;String,Object&gt;(); parameterMap.put("datasource", ds); ModelAndView modelAndView = new ModelAndView("xlsReport", parameterMap); Now, I want to get the values from this map in jrxml file through keys. I am using spring model and view. Want to use something like that &lt;![CDATA[$P{datasource}.get("key")]] in jrxml file inside textField.

http://stackoverflow.com/a/21256308
type: Answer
has body: Simply speaking, compiler takes statics from class def, not from an object. That is why you can replace t.getTest().i with Test.i and it will be the same.
score: 0
answers question: http://stackoverflow.com/q/21255684

http://stackoverflow.com/comment/31957872
type: Comment
has text: @Octopus I have been through all the code, and I have written a functional collections library for one of my jobs.
comment on: http://stackoverflow.com/a/21218415
type: AnswerComment
score: 0

http://stackoverflow.com/q/21241314
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/32062799
has body: I have a custom SoapEnvelopeLoggingInterceptor to log the soap envelope of the ws service calls using a transformer. Is there a way to log the remote URL of the call in this class? (ex. ip address) The best is to manipulate something like HttpServletRequest. In context I have: &lt;sws:interceptors&gt; &lt;bean id="envelopeLoggingInterceptor" class="path.to.my.CustomSoapEnvelopeLoggingInterceptor"&gt; &lt;property name="loggerName" value="myLogger" /&gt; &lt;property name="logRequest" value="true" /&gt; &lt;property name="logResponse" value="true" /&gt; &lt;property name="logFault" value="true" /&gt; &lt;/bean&gt; &lt;/sws:interceptors&gt; My CustomSoapEnvelopeLoggingInterceptor: public class CustomSoapEnvelopeLoggingInterceptor extends SoapEnvelopeLoggingInterceptor { @Override protected void logMessageSource(String message, Source source) throws TransformerException { if (source != null){ Transformer trf = this.getTransformerFactory().newTransformer(); trf.setOutputProperty(OutputKeys.INDENT, "yes"); trf.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); StringWriter writer = new StringWriter(); StreamResult stream = new StreamResult(writer); trf.transform(source, stream); writer.flush(); this.logger.debug(message + stream.getWriter().toString()); } } }
favorite count: 0
linked to: http://stackoverflow.com/q/9114141
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: SoapEnvelopeLoggingInterceptor: how log client remote URL
has comment: http://stackoverflow.com/comment/32031223
tagged with: spring-ws
score: 1
tagged with: java
tagged with: jax-ws

http://stackoverflow.com/comment/107779081
score: 0
has text: So, it will stay in the "local" socket's buffer if the buffer still has some room? Then depending on that, `read` call on the remote side may take more or less time?
type: AnswerComment
comment on: http://stackoverflow.com/a/21199573
type: Comment

http://stackoverflow.com/q/21280516
upvote count: 0
tagged with: runnable
tagged with: user-interface
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32066739
has title: my repaint() does't work when i call it in another class
has comment: http://stackoverflow.com/comment/32066230
has answer: http://stackoverflow.com/a/21280702
type: UnansweredQuestion
tagged with: paintcomponent
tagged with: repaint
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/32069217
type: Question
has comment: http://stackoverflow.com/comment/32066477
has body: The repaint() method works fine at the beginning and the end in the GUI class, but when I recall it again in the middle of my program in another class doesn't work. I have been searching and trying for almost a week now. I asked before the same question but one of the admins i guess asked me to post the whole program my old post after i did what he basked. so this is my whole program hoping for some help. package TEST_DiningPhilosophersproblem; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Random; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class DiningPhilosopherProblem { // Makes the code more readable. //=================================================================================================================== //================================================ChopStick class================================================================== //=================================================================================================================== public static class ChopStick { // Make sure only one philosopher can have me at any time. Lock up = new ReentrantLock(); // Who I am. private final int id; public ChopStick(int id) { this.id = id; } public boolean pickUp(Philosopher who, String where) throws InterruptedException { if (up.tryLock(10, TimeUnit.MILLISECONDS)) { System.out.println(who + " picked up " + where + " " + this); return true; } return false; } public void putDown(Philosopher who, String name) { up.unlock(); System.out.println(who + " put down " + name + " " + this); } @Override public String toString() { r…
score: -1

http://stackoverflow.com/comment/31949509
comment on: http://stackoverflow.com/a/21214476
type: Comment
has text: solved, tnx Raghunandan. I've changed to NewsItem newitem = (NewsItem)arraylist_newitems.get(position) ;
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32125010
score: 0
type: Comment
has text: After doing this it doesnt crash but it calls public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) only ones at creation
comment on: http://stackoverflow.com/a/21313895
type: AnswerComment

http://stackoverflow.com/comment/31962258
has text: Duplicate of http://stackoverflow.com/questions/21220273/java-chain-classes please report it, cause I have no flags left
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21221211

http://stackoverflow.com/comment/32129400
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21316245
type: Comment
has text: yes and the button freezes in the pressed state and nothing more happens

http://stackoverflow.com/q/21338393
upvote count: 1
type: Question
downvote count: 0
tagged with: asynchronous
has title: javafx textarea update and asynchronous calls?
favorite count: 0
type: UnansweredQuestion
answer count: 0
has body: I populate my Textarea from an external Datasource when a row in a table was selected. But the content in the area was sometimes not updated why? I have find me in programming frequently wizards with selections form list/table with crud functionality. Are there Frameworks how automate this process for creating this wizards in javafx? this.tablePresenter.getTable().getSelectionModel().selectedItemProperty().addListener(new ChangeListener&lt;Data&gt;() { @Override public void changed(ObservableValue&lt;? extends Data&gt; ov, Data n, Data newData) { if (newData != null) { populateTextAreContent(service.getContent(newData.getData())); }); populateTextAreaContent(String s) becomes his content data from an external datasource as String Object and i bind the propert like. How i make this call async in javafx? private void populateTextAreaContent(String data) { StringProperty p = new SimpleStringProperty(data); this.textAreaPresenter.gettextArea().textProperty().bind(p); } I use the afterburner framework from adam bien for my architecture. And the Presenter for the Textarea is empty public class TextArePresenter implements Initializable { @FXML private TextArea content; @Override public void initialize(URL url, ResourceBundle rb) { } public TextArea gettextArea() { return content; } }
score: 1
tagged with: java
tagged with: javafx

http://stackoverflow.com/comment/32040288
score: 0
type: Comment
type: QuestionComment
has text: No, there is just a org.springframework.orm.hibernate4.LocalSessionFactoryBean inside a Spring web app
comment on: http://stackoverflow.com/q/21265738

http://stackoverflow.com/q/21343026
has body: I am a beginner in Java, and I need help. I am trying to print a matrix in a JTextArea. But I don't know how to convert the matrix into a string in order to print it in the JTextArea. I am trying to use matrica.get(i), but I don't know how to use it for a matrix. Or is there any other possibility? Can anyone help me please? Here I fill the matrix: public void fillMatricen(){ for (int i =0; i&lt;x; i++){ for (int j=0; j&lt;y; j++){ matrica[i][j]=(int) ((double) Math.random()*10); } } } And here I am trying to print it: public void actionPerformed(ActionEvent event){ String row1 = inrows.getText(); int row2 = Integer.parseInt(row1); String col1 = incolumns.getText(); int col2 = Integer.parseInt(col1); fillMatricen(); for( int i=0; i&lt;row2; i++){ for( int j=0; j&lt;col2; j++){ matricaString= matricaString + matrica.get(i); } } matric.setText(matricaString); }
possible better answer: http://stackoverflow.com/a/21343476
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/21343476
has comment: http://stackoverflow.com/comment/32180524
has title: how to convert a matrix in string in order to output it in JTextArea
has answer: http://stackoverflow.com/a/21344017
favorite count: 0
has answer: http://stackoverflow.com/a/21343489
has comment: http://stackoverflow.com/comment/32192068
downvote count: 2
accepted answer: http://stackoverflow.com/a/21344017
answer count: 4
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21343557
has comment: http://stackoverflow.com/comment/32180553
type: Question

http://stackoverflow.com/a/21250164
accepted answer of: http://stackoverflow.com/q/21230220
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21230220
has body: Solved by adding Map&lt;String,String&gt; s=new HashMap&lt;String, String&gt;(); s.put("hibernate.dialect","Hibernate.SQLightDialect.SQLiteDialect"); dbconfigurations.setProperties(s); in public class databaseConfiguration extends Configuration { @Valid @NotNull @JsonProperty DatabaseConfiguration dbconfigurations = new DatabaseConfiguration(); public DatabaseConfiguration getDatabaseConfiguration() { //return dbconfigurations; Map&lt;String,String&gt; s=new HashMap&lt;String,String&gt;(); s.put("hibernate.dialect","Hibernate.SQLightDialect.SQLiteDialect"); dbconfigurations.setProperties(s); return dbconfigurations; } } Another Solution read on the Web is adding it in yml file like: database: # the name of your JDBC driver driverClass: org.postgresql.Driver # the username user: username # the password password: password # the JDBC URL url: jdbc:postgresql://localhost:5432/gis_database properties: hibernate.dialect: org.hibernate.spatial.dialect.postgis.PostgisDialect
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/32182376
score: 0
comment on: http://stackoverflow.com/q/21345609
type: QuestionComment
has text: Just move 'if(commandlineArgument.length == 0){...' block to the top of main method. And add 'return 1;' inside if block to stop execution
type: Comment

http://stackoverflow.com/comment/33804575
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21347957
has text: Hi Greg, I have tried your solution and now I am getting IllegalStateException. I have updated question.Any suggestion?

http://stackoverflow.com/comment/32073794
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21284030
has text: This is equivalent to string.length(), but with a useless array allocation inbetween. It's also not the index of the last character, but the index one after the last character.
score: 1

http://stackoverflow.com/a/21346574
answers question: http://stackoverflow.com/q/21346536
accepted answer of: http://stackoverflow.com/q/21346536
type: AcceptedAnswer
score: 0
has body: Try this.. JSONArray new_array = new JSONArray(response); for(int i = 0; i &lt; new_array.length; i++){ System.out.println("Values : "+new_array.getString(i)); }
type: Answer

http://stackoverflow.com/comment/31951202
type: Comment
comment on: http://stackoverflow.com/a/21215344
score: 0
type: AnswerComment
has text: what whould be the position of JPanel if placed in above diagram

http://stackoverflow.com/a/21373224
type: Answer
score: 8
downvote count: 0
has body: The problem was with my IE settings. The problem was resolved when the security settings in IE was changed to "Enable Protected Mode" for "Internet", "Local Intranet", "Trusted Sites" and "Restricted Sites". You can change it by going to Internet Options security tab and enable check box "Enable Protected Mode" for all the zones. I was able to get these information from the link http://jimevansmusic.blogspot.in/2012/08/youre-doing-it-wrong-protected-mode-and.html
answers question: http://stackoverflow.com/q/21330079
upvote count: 8
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21330079

http://stackoverflow.com/q/21201986
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21202433
tagged with: singleton
has body: I have one singleton class (one that is instantiated using factory method but not spring singleton) in my application. The application is deployed on jboss cluster. Moreover the application runs in spring container. Is the singleton is shared across jboss cluster nodes? Or how to share a singleton between different nodes of jboss cluster?
type: UnansweredQuestion
tagged with: spring
has title: How singleton class shared on jboss cluster
tagged with: java
tagged with: jboss

http://stackoverflow.com/q/21228425
answer count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/21231882
has title: populate the second select box based on the selection of first select box
tagged with: jquery
tagged with: ajax
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21231882
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31976491
has body: There are two drop downs ,second drop down will be populated based on the first select box. Both of them will be populated from the database. I have populate the first select box , also the second select box is populated, but all the values are coming as a one value. first select box : -select- <% Iterator contryIter = countries.iterator(); Lookup lookup = null; while(contryIter.hasNext()) { lookup = (Lookup)contryIter.next(); out.print(" "); out.print(lookup.getLabel()); out.println(" "); } %> function for on change : function populateSecValues(obj) { alert("enter the function"); var country = obj.value; $.get('/maintenance/timeZoneFinder.jsp?country='+country, function(responseData) { $("#zones").html(responseData); }); } timeZoneFinder.jsp <% ResultSet rset = null; Connection conn = null; Statement stmt = null; String SQL_COMMAND = ""; try { conn = ConnectionManager.getConnection(); stmt = conn.createStatement(); String country = request.getParameter("country"); System.out.println("country========>"+country); SQL_COMMAND="select a.full_name from org_base.time_zone a where a.country_code='"+country+"'"; rset = stmt.executeQuery(SQL_COMMAND); ResultSetMetaData meta = rset.getMetaData(); int col = meta.getColumnCount(); while(rset.next()){ out.print(" '"+rset.getString(1)+"' "); } } catch (Exception e) { e.printStackTrace(); } finally { if (rset != null) rset.close(); if (stmt != null) stmt.close(); if (conn != null) conn.close(); } %> second select box html -<%=bundle.getString("common.select") %>-
score: 0
has comment: http://stackoverflow.com/comment/31975559

http://stackoverflow.com/q/21222872
upvote count: 3
tagged with: java
has body: I want to use proguard to only remove log statements, but now my application crashes when it is started. I am not too familiar with proguard, but I guess I have to add in some lines to keep my other classes to be fine. This is my proguard-project.txt: # To enable ProGuard in your project, edit project.properties # to define the proguard.config property as described in that file. # # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in ${sdk.dir}/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the ProGuard # include property in project.properties. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} -assumenosideeffects class android.util.Log { *; } #ProGuard may remove code that it thinks you don't use such as: #a class that is referenced only in the AndroidManifest.xml file #a method called from JNI #dynamically referenced fields and methods #-keep public class &lt;MyClass&gt; How would I go about adding a statement that will "disregard" proguard for all of my other classes? I just want to make sure that the removal of the logging works. I will then concentrate on obfuscation later down the road. I am trying this, but I get an error when exporting: -keep class com.finesspro.gui** { * }
type: Question
has title: Use proguard to ONLY remove log statements
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/30785947
score: 3
tagged with: android
tagged with: obfuscation
favorite count: 0
tagged with: proguard
has answer: http://stackoverflow.com/a/21223409
type: UnansweredQuestion

http://stackoverflow.com/a/21346892
has body: Try this: public char[] toArray(List&lt;Character&gt; list){ char[] toReturn = new char[list.size()]; int i = 0; for(char c : list) toReturn[i ++] = c; return toReturn; }
answers question: http://stackoverflow.com/q/21346830
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/21345931
upvote count: 1
has comment: http://stackoverflow.com/comment/32183020
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21345810
score: 1
has body: If secondOperand is zero and operator is '/', an earlier check will pass, do the computation, and return the properly computed infinity value: else if (firstOperand != Double.NaN &amp;&amp; secondOperand != Double.NaN &amp;&amp; operator == '/') { return firstOperand / secondOperand; } As has been noted in other answers and comments, some of your code (including this snippet) is wrong in other ways. You should be using Double.isNan(operand) to test whether something is NaN, as NaN equality rules are a bit strange. And finally, you don't want to check a double and a character for equality. But if you want to handle division by zero specially, you need to check for it before other conditions that it also meets.

http://stackoverflow.com/a/21256380
type: Answer
accepted answer of: http://stackoverflow.com/q/21256348
score: 2
has body: I suspect trcList.get(j).getABC().getId() is java.lang.Integer and hence it should be compared with equals() if (trcList.get(j).getABC().getId().equals(abc.getId())) { } Below test will assert the same Integer i = new Integer(1); //set to 1 Integer j = new Integer(1); //also set to 1 System.out.println(i == j); //false, because it is reference comparison System.out.println(i.equals(j)); //true
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21256348
upvote count: 2

spring-mvc
tags question: http://stackoverflow.com/q/21340310
tags question: http://stackoverflow.com/q/21312623
tags question: http://stackoverflow.com/q/21276136
tags question: http://stackoverflow.com/q/21237707
tags question: http://stackoverflow.com/q/21293637
tags question: http://stackoverflow.com/q/21316641
tags question: http://stackoverflow.com/q/21306200
tags question: http://stackoverflow.com/q/21267930
tags question: http://stackoverflow.com/q/21280028
tags question: http://stackoverflow.com/q/21298561
tags question: http://stackoverflow.com/q/21193380
tags question: http://stackoverflow.com/q/21293767
tags question: http://stackoverflow.com/q/21235472
tags question: http://stackoverflow.com/q/21323336
tags question: http://stackoverflow.com/q/21220758
tags question: http://stackoverflow.com/q/21259406
tags question: http://stackoverflow.com/q/21326046
tags question: http://stackoverflow.com/q/21331795
tags question: http://stackoverflow.com/q/21330267
tags question: http://stackoverflow.com/q/21300668
tags question: http://stackoverflow.com/q/21218071
tags question: http://stackoverflow.com/q/21273624
tags question: http://stackoverflow.com/q/21302676
tags question: http://stackoverflow.com/q/21266306
tags question: http://stackoverflow.com/q/21203497
tags question: http://stackoverflow.com/q/21301543
tags question: http://stackoverflow.com/q/21220812
tags question: http://stackoverflow.com/q/21330900
tags question: http://stackoverflow.com/q/21260209
tags question: http://stackoverflow.com/q/21229839
tags question: http://stackoverflow.com/q/21272557
tags question: http://stackoverflow.com/q/21320335
tag name: spring-mvc
tags question: http://stackoverflow.com/q/21279108
tags question: http://stackoverflow.com/q/21296970
tags question: http://stackoverflow.com/q/21228447
tags question: http://stackoverflow.com/q/21297515
tags question: http://stackoverflow.com/q/21293337
tags question: http://stackoverflow.com/q/21224541
tags question: http://stackoverflow.com/q/21301366
type: Tag
tags question: http://stackoverflow.com/q/21277129
tags question: http://stackoverflow.com/q/21196957
tags question: http://stackoverflow.com/q/21308970
tags question: http://stackoverflow.com/q/21278307
tags question: http://stackoverflow.com/q/21293227
tags question: http://stackoverflow.com/q/21327497
tags question: http://stackoverflow.com/q/21248195
tags question: http://stackoverflow.com/q/21232250
tags question: http://stackoverflow.com/q/21191544
tags question: http://stackoverflow.com/q/21239517
tags question: http://stackoverflow.com/q/21336967
tags question: http://stackoverflow.com/q/21349322
tags question: http://stackoverflow.com/q/21300706
tags question: http://stackoverflow.com/q/21315276
tags question: http://stackoverflow.com/q/21326725
tags question: http://stackoverflow.com/q/21342788
tags question: http://stackoverflow.com/q/21308494
tags question: http://stackoverflow.com/q/21229564
tags question: http://stackoverflow.com/q/21240199
tags question: http://stackoverflow.com/q/21258294
tags question: http://stackoverflow.com/q/21319450
tags question: http://stackoverflow.com/q/21344352
tags question: http://stackoverflow.com/q/21263795
tags question: http://stackoverflow.com/q/21339996
tags question: http://stackoverflow.com/q/21277512
tags question: http://stackoverflow.com/q/21283406
tags question: http://stackoverflow.com/q/21242692
tags question: http://stackoverflow.com/q/21237339
tags question: http://stackoverflow.com/q/21331546
tags question: http://stackoverflow.com/q/21310711
tags question: http://stackoverflow.com/q/21336062
tags question: http://stackoverflow.com/q/21268494
tags question: http://stackoverflow.com/q/21235058
tags question: http://stackoverflow.com/q/21244114
tags question: http://stackoverflow.com/q/21338883
tags question: http://stackoverflow.com/q/21301956
tags question: http://stackoverflow.com/q/21349030
tags question: http://stackoverflow.com/q/21292366
tags question: http://stackoverflow.com/q/21244987

http://stackoverflow.com/a/30741335
has body: to answer your follow up question about color images, the VZ classifier stated in https://www.robots.ox.ac.uk/~vgg/research/texclass/with.html uses grayscale images. There are however variations which use multichannel/color images, mainly work done by Burghouts and Geusebroek, http://www.bmva.org/bmvc/2006/papers/362.pdf. This however adds extra complexity and other variations such as incorporating Support Vector Machines (SVM)'s, ('On the Significance of Real-World Conditions for Material Classification', E.Hayman et al.) can cause larger increases in classification rates while also allowing for a level of scale invariance, one of the main limitations in the 2001 VZ classifier.
type: Answer
answers question: http://stackoverflow.com/q/21287443
score: 0

http://stackoverflow.com/comment/32103197
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21300772
has text: I think u have not added any jar files in your library. Add the following jars in your lib folder, common-logging-x.x.jar jstl-x.x.jar spring-aspects-x.x.jar spring-beans-x.x.jar spring-context-x.x.jar spring-core-x.x.jar spring-expression-x.x.jar spring-webmvc-x.x.jar

http://stackoverflow.com/q/21314184
tagged with: validation
possible better answer: http://stackoverflow.com/a/21315288
has answer: http://stackoverflow.com/a/21315288
has comment: http://stackoverflow.com/comment/32127004
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32125930
tagged with: regex
has comment: http://stackoverflow.com/comment/32125771
has comment: http://stackoverflow.com/comment/32125554
has comment: http://stackoverflow.com/comment/32127590
has answer: http://stackoverflow.com/a/21315943
has comment: http://stackoverflow.com/comment/32126562
score: 0
tagged with: java
has title: Regex not working, need a good regex for the below rules :
has comment: http://stackoverflow.com/comment/32126039
accepted answer: http://stackoverflow.com/a/21315943
has comment: http://stackoverflow.com/comment/32125695
has body: a) The below characters are unacceptable for first name field. * and + values are not accepted. Values other than alpha (a-z,A-Z) are not accepted. Symbols that are not allowed ~ ! $ % ^ * _ + ` = { }[ ] | \ : “ ; &lt; > ? ( ) &amp; # , / Allowed symbols are: apostrophe (') hyphen (-) period (.)) b) First name can not have a pattern like " and ". Eg : "John and Miller" c) First name is a mandatory parameter and it cannot be empty or blank value. d) One double quote without two characters before the next one is not be allowed and it fails validation. Eg : “P” e) One double quote without a matching one is not allowed and it fails validation. Eg : “ABC
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32126349

http://stackoverflow.com/a/21309154
accepted answer of: http://stackoverflow.com/q/21283316
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32117578
has body: You can do deep stubbing. Car car = mock(Car.class, Mockito.RETURNS_DEEP_STUBS); Note that deep stubbing usually means that the code is not clean. Consider the following quote from the documentation: Every time a mock returns a mock a fairy dies. Source: Mockito documentation
type: Answer
score: 4
answers question: http://stackoverflow.com/q/21283316
upvote count: 4

http://stackoverflow.com/q/21325318
has answer: http://stackoverflow.com/a/21325447
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
tagged with: mysql
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21325557
has comment: http://stackoverflow.com/comment/32145621
has title: Convert java.util.Date in YYYY-MM-DD HH:MM:SS format to compatible with MySQL DATETIME
has comment: http://stackoverflow.com/comment/32145755
linked to: http://stackoverflow.com/q/15389084
has comment: http://stackoverflow.com/comment/32145581
possible better answer: http://stackoverflow.com/a/21325447
answer count: 3
downvote count: 0
favorite count: 0
has body: For log entry of a web application I have table with primary key DATETIME in MySQL table. But java.util.Date is in different format causing mapping error in Hibernate. How can I map DATETIME type of MySQL table to java.util.Date?
has answer: http://stackoverflow.com/a/21325384
accepted answer: http://stackoverflow.com/a/21325384

http://stackoverflow.com/a/21341547
has comment: http://stackoverflow.com/comment/32175564
answers question: http://stackoverflow.com/q/21341466
score: 1
has body: You could do a ternary operation resultString = "The temperature above 100 degrees is: "; for(int i = 0; i &lt; blazing.length; i++){ resultString += blazing[i] != 0 ? blazing[i] : ""; } Note: This would require more memory than JonSkeets answer, but could potentially be more efficient. If your expect your array length to get very large, go with JonSkeet's answer. In other words, this won't scale well.
upvote count: 1
has comment: http://stackoverflow.com/comment/32175459
has comment: http://stackoverflow.com/comment/32175043
has comment: http://stackoverflow.com/comment/32175398
has comment: http://stackoverflow.com/comment/32175342
has comment: http://stackoverflow.com/comment/32175656
has comment: http://stackoverflow.com/comment/32175105
downvote count: 0
type: Answer

yahoo
type: Tag
tags question: http://stackoverflow.com/q/21342483
tag name: yahoo

http://stackoverflow.com/a/21260388
has comment: http://stackoverflow.com/comment/32031306
has comment: http://stackoverflow.com/comment/32035202
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/32034122
has comment: http://stackoverflow.com/comment/32032895
has comment: http://stackoverflow.com/comment/32030475
downvote count: 0
has comment: http://stackoverflow.com/comment/32034772
has comment: http://stackoverflow.com/comment/32031016
has comment: http://stackoverflow.com/comment/32032313
type: Answer
has comment: http://stackoverflow.com/comment/32058804
has comment: http://stackoverflow.com/comment/32033066
has comment: http://stackoverflow.com/comment/32030751
has comment: http://stackoverflow.com/comment/32033984
has comment: http://stackoverflow.com/comment/32030543
has comment: http://stackoverflow.com/comment/32031526
has comment: http://stackoverflow.com/comment/32033767
has comment: http://stackoverflow.com/comment/32031837
answers question: http://stackoverflow.com/q/21258468
has body: If you want to extract the prop belonging to a specific OBJECT_TYPE you can do that with /type/OBJECT_TYPE[. = 'some type']/following-sibling::prop[1] In Java you could build up this XPath expression dynamically using string concatenation but it would be much safer to use an XPath variable if the library you're using can support that (you don't say in the question what library you're using). For example with javax.xml.xpath XPath xp = XPathFactory.newInstance().newXPath(); final Map&lt;String, Object&gt; vars = new HashMap&lt;String, Object&gt;(); xp.setXPathVariableResolver(new XPathVariableResolver() { public Object resolveVariable(QName name) { return vars.get(name.getLocalPart()); } }); XPathExpression expr = xp.compile("/type/OBJECT_TYPE[. = $type]/following-sibling::prop[1]"); vars.put("type", "Data"); Node dataProps = (Node)expr.evaluate(doc, XPathConstants.NODE); vars.put("type", "SiteData"); Node siteProps = (Node)expr.evaluate(doc, XPathConstants.NODE); // taking the value from a variable vars.put("type", obj.getObjectType()); Node objectProps = (Node)expr.evaluate(doc, XPathConstants.NODE);

http://stackoverflow.com/q/21211932
has comment: http://stackoverflow.com/comment/31945198
has comment: http://stackoverflow.com/comment/31945237
favorite count: 0
tagged with: jlabel
has title: Add image to JPanel through JLabel
has body: I want to add an image from imgur onto a JPanel. The image is not appearing. UTC = new JLabel("test"); utcImg = new ImageIcon("http://i.imgur.com/pkBtKC5.png"); UTC.setIcon(utcImg); add(UTC); Only the text "test" is appearing. Am I doing this incorrectly? Thanks Edit: Adding image from local drive to mitigate latency issues. Now it's not loading. File is in C:\Users\chg1024\Test\src\images JLabel utc = new JLabel("test"); ImageIcon utcImg = new ImageIcon("images/UTC.png"); utc.setIcon(utcImg); add(utc); revalidate();
has comment: http://stackoverflow.com/comment/31945263
has comment: http://stackoverflow.com/comment/31945185
has comment: http://stackoverflow.com/comment/31945252
tagged with: swing
downvote count: 1
has answer: http://stackoverflow.com/a/21211990
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21212123
tagged with: java
has answer: http://stackoverflow.com/a/21212123
score: -1
type: Question
answer count: 2
upvote count: 0
accepted answer: http://stackoverflow.com/a/21211990

http://stackoverflow.com/q/21271111
has body: I need to capture the Title Case from my paragraph The Title Case example is Admit to Patient bla bla bla bla Hello There bla bla bla bla Get There by Noon bla bla bla bla Get There By Noon please don't be late Hello for Everyone on Here hope you are doing good Hello For Everyone On Here hope you are doing good Admit To Patient should be matched From the examples above , all words for title case are capitalized in the first letter except for: a, an, the, at, by, for, in, of, on, to, up, and, as, but, it, or, nor (which can be capitalized but do not have to be) Can some one help me on getting the regex for this. private static final String titleCase= *your regex here* static final Pattern titleCasePattern = Pattern.compile(titleCase); Matcher match = titleCasePattern .matcher(text); while (match.find()) { String match= match.group(1); //This should give me the title case group which is Admit to Patient,Hello There..etc }
tagged with: regex
has answer: http://stackoverflow.com/a/21436205
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32261939
has comment: http://stackoverflow.com/comment/32342271
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32341837
type: Question
tagged with: java
score: 0
has title: Capture Title Case Group in Regex in Java
has comment: http://stackoverflow.com/comment/32261834
answer count: 1
has comment: http://stackoverflow.com/comment/32347451
accepted answer: http://stackoverflow.com/a/21436205
favorite count: 0
has comment: http://stackoverflow.com/comment/32311706
has comment: http://stackoverflow.com/comment/32320298

http://stackoverflow.com/a/21334401
has comment: http://stackoverflow.com/comment/32161313
score: 1
accepted answer of: http://stackoverflow.com/q/21334130
upvote count: 1
answers question: http://stackoverflow.com/q/21334130
has comment: http://stackoverflow.com/comment/32161137
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32161407
type: Answer
has body: You can do it a little bit better: &lt;p:selectBooleanCheckbox id="adultCheckbox" value="#{bean.adult}"&gt; &lt;p:ajax update="property1, property2"/&gt; &lt;/p:selectBooleanCheckbox&gt; &lt;p:inputText id="property1" value="#{bean.property1}" required="#{bean.adult}"/&gt; &lt;p:inputText id="property2" value="#{bean.property2}" required="#{bean.adult}"/&gt; You could do something on client side customizing the Client Side Validation as described here. Buy I still believe is a good idea to do that through a Ajax Request.

http://stackoverflow.com/comment/31903927
comment on: http://stackoverflow.com/a/21189058
has text: I pretty much understand that, but how did you encrypt/decrypt the bytes?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32007784
score: 0
type: AnswerComment
has text: When I mentioned resizing in the question. I meant the equivalent of String = String + char; so ArrayList<Byte>.add(byte);
type: Comment
comment on: http://stackoverflow.com/a/21246892

http://stackoverflow.com/a/21309403
has comment: http://stackoverflow.com/comment/32163376
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: You have mode=Transparent on field level and that has higher priority then mode=Opaque at style level. Set the Transparent on style and remove it from fields, currently your conditional style sets background color on transparent fields. Change text field from: &lt;textField pattern="###0.0"&gt; &lt;reportElement mode="Transparent" ... to (1): &lt;textField pattern="###0.0"&gt; &lt;reportElement ... or (2): &lt;textField pattern="###0.0"&gt; &lt;reportElement mode="Opaque" ... I'm not sure which of those you can set but it should work after you change that. Also if you want the field to be transparent when condition is not satisfied you could change style to this: &lt;style name="style_TOU" mode="Transparent"&gt; The way you wrote your style you will change background on all the fields if any of them is null. I think you will have to write separate style for each field if you want to change the color only for the field with null value....
answers question: http://stackoverflow.com/q/21306923

http://stackoverflow.com/comment/32053391
score: 0
type: Comment
type: QuestionComment
has text: I do not know if it is a requirement or not but you could keep only one timer. I have an Android phone and it allows me to have only one countdown timer at a time. You could disable the `JButton` when one timer is running.
comment on: http://stackoverflow.com/q/21272833

http://stackoverflow.com/comment/32092257
has text: `// Layout containing Buttons` what makes you think that ?
comment on: http://stackoverflow.com/q/21295098
score: 0
type: Comment
type: QuestionComment

trace
tag name: trace
type: Tag
tags question: http://stackoverflow.com/q/21267071

http://stackoverflow.com/comment/32007706
comment on: http://stackoverflow.com/a/21246836
score: 2
has text: +1 I was looking at these answers and was wondering why no one was using `Random`. Especially since you can replace it with `SecureRandom`.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21339717
tagged with: android
answer count: 1
type: AnsweredQuestion
has body: I'm extending DialogFragment. I wanted to use a customer listener because onDateSet was causing numerous issues. (Not being able to cancel selection nicely, being called twice on some devices, not working at all on others.) However the problem is my class isn't very client friendly. As it stands somebody might instantiate my class and not set the required listener. As it's written the client that uses my code would have to know to create the class and then set the listener separately. What can I do to make the proper use of this class more obvious to the user? Anything I can think of doing involves changing the default constructor which Android does not allow me to do. public class DatePickerDialogFragment extends DialogFragment implements OnDateSetListener { DatePickerDialog dp; DatePickerDialogFragmentListener listener; final Calendar calendar; public DatePickerDialogFragment(){ calendar = Calendar.getInstance(); } public void setDatePickerDialogFragmentListener(DatePickerDialogFragmentListener dialogFragmentListener ){ listener = dialogFragmentListener; } public void setInitialDate(int year, int month, int day){ calendar.set(year, month, day); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); int day = calendar.get(Calendar.DAY_OF_MONTH); dp = new DatePickerDialog(getActivity(), this, year, month, day); DialogInterface.OnClickListener okClickListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (listener != null){ // if the listener has been set correctly. try { Field mDatePickerField = dp.getClass().getDeclaredField("mDatePicker"); mDatePickerField.setAccessible(true); DatePicker datePicker = (DatePicker) mDatePickerField.get(dialog); listener.okClicked(datePicker, datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth()); } catch (NoSuchFieldException e) { } catch (IllegalArgument…
has title: How to make construction client friendly when Exteneding DialogFragment?
tagged with: oop
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21340968
accepted answer: http://stackoverflow.com/a/21340968
score: 0

http://stackoverflow.com/comment/31971131
type: Comment
has text: Well, i actually want to use the available HTML 5 & CSS3, so that i can get a good powerful UI. I was thinking of setting up a UI under java but i figured if i use the current web techs, then it would be much better since it can already do so much.
comment on: http://stackoverflow.com/a/21220095
type: AnswerComment
score: 0

http://stackoverflow.com/q/21195006
has answer: http://stackoverflow.com/a/26713731
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/31931607
tagged with: php
upvote count: 0
tagged with: java
tagged with: character-encoding
has title: How to convert string to UTF-8 byte array in PHP for Java BufferedInputStream.read()?
type: Question
has body: I need to make Java socket client and PHP-cli socket server and need to send client a UTF-8 encoded byte array and make so that Java BufferedInputStream.read() function would accept it. [SERVER] $input = socket_read($client[$i]['sock'],1024,PHP_BINARY_READ); if($input==null || $input===FALSE) {unset($client[$i]);} socket_write($client[$i]['sock'], unpack('C*', utf8_encode($input))); [CLIENT] out = new BufferedOutputStream(socket.getOutputStream()); out.write(str.getBytes("UTF-8")); out.flush(); in = new BufferedInputStream(socket.getInputStream()); byte[] b = new byte[]{}; str = new String(in.read(b), "UTF-8"); System.out.println("[SOCKET] Server: " + str); So i need a PHP analogue of String.getBytes("UTF-8"); Thanks for feedback!
has comment: http://stackoverflow.com/comment/31927924
score: -1

http://stackoverflow.com/q/21326294
tagged with: date-format
tagged with: swing
type: AnsweredQuestion
tagged with: java
has body: If 12-Jan-14 entered into the date field manually, it becomes 12-Jan-0014. Auto tab is "1:9".
type: Question
accepted answer: http://stackoverflow.com/a/21327011
has title: In layout.xml for a java swing project, the ddMMMyyyy format attaches 00 to year if date entered
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21327011

http://stackoverflow.com/q/21286129
score: 0
has answer: http://stackoverflow.com/a/21286629
answer count: 1
has comment: http://stackoverflow.com/comment/32075848
has comment: http://stackoverflow.com/comment/32076073
tagged with: android
tagged with: regex
has body: I have got the following bbcodes , say [369] to be converted to &lt;img src ...http// /&gt; But when it comes to replacing multiple items, like [369] [369] [369] [369] , it turns to be with the following replaced strings 1,2,3,4 tokens , total in 10 respectively. &lt;img src ...http// /&gt; &lt;img src ...http// /&gt;&lt;img src ...http// /&gt; &lt;img src ...http// /&gt;&lt;img src ...http// /&gt;&lt;img src ...http// /&gt; &lt;img src ...http// /&gt;&lt;img src ...http// /&gt;&lt;img src ...http// /&gt;&lt;img src ...http// /&gt; Input 班仔比人陰返轉頭[369] [369] [369] &lt;br/&gt;BTW大家入黎咩都傾下,我地好warm的#yup# #yup# #yup# I would like to implement the string replacement and provide Desired Output: 班仔比人陰返轉頭&lt;img src ...http// /&gt; &lt;img src ...http// /&gt;&lt;img src ...http// /&gt; &lt;br/&gt;BTW大家入黎咩都傾下,我地好warm的&lt;img src ...http// /&gt;&lt;img src ...http// /&gt;&lt;img src ...http// /&gt; But when it comes to the execution.. Actual Output: 班仔比人陰返轉頭&lt;img src ...http// /&gt; &lt;img src ...http// /&gt;&lt;img src ...http// /&gt; &lt;img src ...http// /&gt;&lt;img src ...http// /&gt;&lt;img src ...http// /&gt; &lt;br/&gt;BTW大家入黎咩都傾下,我地好warm的&lt;img src ...http// /&gt; &lt;img src ...http// /&gt;&lt;img src ...http// /&gt; &lt;img src ...http// /&gt;&lt;img src ...http// /&gt;&lt;img src ...http// /&gt; Would you please help me check if there is any while loop to cause repeated replacement occurs? The below is my code: public String replace(String text , String bbcode , String imageLocation ){ StringBuffer imageBuffer = new StringBuffer (""); Pattern pattern = Pattern.compile(Pattern.quote(bbcode)); Matcher matcher = pattern.matcher(text); StringBuilder builder = new StringBuilder(); int i = 0; while (matcher.find()) { imageBuffer.append("&lt;img src=\"" + imageLocation + "\" /&gt;"); String replacement = imageBuffer.toString(); builder.append(text.substring(i, matcher.start())); if (replacement == null) { builder.append(matcher.group(0)); break; } else { builder.append…
has comment: http://stackoverflow.com/comment/32075781
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32076856
has comment: http://stackoverflow.com/comment/32075838
has title: Android Java Regex Replacement Repeated patterns is shown
type: Question
accepted answer: http://stackoverflow.com/a/21286629
has comment: http://stackoverflow.com/comment/32075942
has comment: http://stackoverflow.com/comment/32075761

http://stackoverflow.com/a/21218555
answers question: http://stackoverflow.com/q/21218520
accepted answer of: http://stackoverflow.com/q/21218520
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Objects don't have names, so you create as many as you like with out a name. References such a fields and local variables can name names. You can reuse those variables and names in a loop as many times as you like, or not. Whether you assign the reference to an object to a name or not is up to you.
type: Answer
downvote count: 0

http://stackoverflow.com/comment/32003941
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21244760
has text: And what did you try to achieve that? The code above does not throw exceptions.

http://stackoverflow.com/comment/70095859
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/37304210
type: Comment
has text: Note that IdentityHashMap tries to make equals by reference, not by value of keys. So it's not applicable to strings, only of you try to make string interning which may slow down performance.

http://stackoverflow.com/q/21243712
has answer: http://stackoverflow.com/a/21243864
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/32001852
has body: I'm making the game connect four however whenever I run the program, it drops the circles and everything but the winning conditions do not work. I'm not too sure if I'm calling to them not correctly or if it's just not being called to in the right spots. Please advise. I appreciate your upcoming answers. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ConnectFourJan { static boolean winCheck; static drawBoard drawConnectFourBoard = new drawBoard(); static int [][] spotOnBoard = new int [6][7]; static int maxRow=6; static int maxCol=7; static boolean endOfGame = false; static boolean gameStart; static JPanel boardPanel; static JButton firstOption = new JButton ("Drop"); static JButton secondOption = new JButton ("Drop"); static JButton thirdOption = new JButton ("Drop"); static JButton fourthOption = new JButton ("Drop"); static JButton fifthOption = new JButton ("Drop"); static JButton sixthOption = new JButton ("Drop"); static JButton seventhOption = new JButton ("Drop"); static JButton playAgain = new JButton ("New"); static JButton reset = new JButton ("Reset"); static JButton exit = new JButton ("Exit"); static int blank =0; static int red=1; static int yellow=2; static int firstColour= red; public static void board() { spotOnBoard = new int [maxRow][maxCol]; for (int row=0; row &lt; maxRow; row++){ for (int col=0; col&lt; maxCol; col++){ spotOnBoard[row][col]=blank; } } } public static class drawBoard extends JPanel { public void paintComponent(Graphics g){ super.paintComponent(g); drawConnectFourBoard(g); }//end of paintComponent. void drawConnectFourBoard(Graphics g){ g.setColor(Color.BLUE); g.fillRect(0, 0, 100+100*maxCol, 100+100*maxRow); for (int row=0; row&lt;maxRow; row++) for (int col=0; col&lt;maxCol; col++) { if (spotOnBoard[row][col]==blank) g.setColor(Color.white); if (spotOnBoard[row][col]==red) g.setColor(Color.red); if (spotOnBoard[row][col]==yellow) g.setColor(Color.yellow); g.fillOval(100*col, 100*row, 100, 100); …
favorite count: 0
has comment: http://stackoverflow.com/comment/32002032
has answer: http://stackoverflow.com/a/21243930
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32002107
has comment: http://stackoverflow.com/comment/32001905
has comment: http://stackoverflow.com/comment/32001953
has title: Can someone please tell me why my winning conditions aren't working?
has answer: http://stackoverflow.com/a/21244978
has comment: http://stackoverflow.com/comment/32001946
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32003534
has comment: http://stackoverflow.com/comment/32001863
score: -1

http://stackoverflow.com/comment/32006957
score: 0
has text: Do you get `Url Object: null`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21246351

http://stackoverflow.com/comment/32007032
comment on: http://stackoverflow.com/q/21246451
has text: Maybe it was a trick question, to get you to push back and tell him that there's no faster way.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32060470
score: 1
has text: why is f final? when you are iterating and assigning it value every other time?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21277250

http://stackoverflow.com/q/21246489
has answer: http://stackoverflow.com/a/21246509
has answer: http://stackoverflow.com/a/21246510
has answer: http://stackoverflow.com/a/21246524
has body: I'm not sure why Eclipse is giving me this error: The method listen() is undefined for the type Object What simple mistake am I making? Also, is my code the right way to write a main method which instantiates an EchoServer0 object and calls its listen method? public class EchoServer0 { public void listen() { ServerSocket socket = null; try{ socket = new ServerSocket(2013); System.out.println("Opened server socket"); socket.setSoTimeout(2000); socket.accept(); socket.close(); } catch (SocketTimeoutException ste){ System.out.println("Timed out after " + 2000 + " ms"); } catch (Exception e){ System.out.println(e.getClass().getName()+" at server: " + e.getMessage()); } } public static void main(String[] args) { Object EchoServer0; EchoServer0.listen(); } }
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/32007124
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32058221
has title: Why is my method undefined for the type object?
answer count: 4
score: 7
favorite count: 0
upvote count: 8
has answer: http://stackoverflow.com/a/21246589
type: Question
tagged with: sockets

http://stackoverflow.com/comment/32035537
has text: Simple solution. And what about accessing the `Bar` object itself from `FooBar`, is that possible ("`Bar.this`")?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21263087
type: AnswerComment

http://stackoverflow.com/a/21282346
has comment: http://stackoverflow.com/comment/32106249
has comment: http://stackoverflow.com/comment/32099600
score: 0
has body: So if you have a fixed size label, you can simple read image as BufferedImage object and then scale it to size of your label. After that you can create an icon and set it as JLabel's icon. Below code should work: File imageFile = new File("image.jpg"); BufferedImage bufImg = null; try { bufImg = ImageIO.read(imageFile); } catch (IOException e) { e.printStackTrace(); } BufferedImage scaledImg = bufImg.getScaledInstance(Label.width, Label.height, Image.SCALE_SMOOTH); Label.setIcon(new ImageIcon(scaledImg));
type: Answer
answers question: http://stackoverflow.com/q/21281414

http://stackoverflow.com/q/21347731
has comment: http://stackoverflow.com/comment/32186187
type: UnansweredQuestion
tagged with: multithreading
score: -3
has body: This program runs to infinite loop: public class NewClass { static void execute(String[] tasks) { PCTest test = new PCTest(tasks); new Thread(test.producer, "Prod").start(); new Thread(test.consumer, "Con").start(); } private static class PCTest { private String currentTask; final String[] producerTasks; final Prod producer; final Consmr consumer; public PCTest(String[] producerTasks) { this.producerTasks = producerTasks; producer = new Prod(); consumer = new Consmr(); } private class Prod implements Runnable { Prod() { } public synchronized void run() { int i = 0; while (i &lt; producerTasks.length) { if (currentTask == null) { currentTask = producerTasks[i++]; this.notify(); } try { this.wait(); } catch (InterruptedException e) { //do Nothing } } } } private class Consmr implements Runnable { Consmr() { } public synchronized void run() { int i = 0; while (i &lt; producerTasks.length) { if (currentTask != null) { System.out.print(currentTask); i++; if (i &lt; producerTasks.length) { System.out.print(","); } currentTask = null; //* this.notify(); } try { this.wait(); } catch (InterruptedException e) { //do Nothing } } } } } public static void main(String a[]){ String ar[]={"a","b","c"}; execute(ar); } }
has comment: http://stackoverflow.com/comment/32186186
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/21348015
upvote count: 0
answer count: 2
has answer: http://stackoverflow.com/a/21347929
favorite count: 0
has comment: http://stackoverflow.com/comment/32191517
has title: what is the issue in this multi threaded code

http://stackoverflow.com/a/21189977
answers question: http://stackoverflow.com/q/21189541
has body: Use comparator, for example: import java.sql.Timestamp; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; public class CommentComparator implements Comparator&lt;Comment&gt; { @Override public int compare(Comment o1, Comment o2) { return o1.getDate().compareTo( o2.getDate() ); } public static void main(String[] args) { List&lt;Comment&gt; list = new ArrayList&lt;Comment&gt;(); for (int i = 0; i &lt; 10; i++) { Timestamp t = new Timestamp( System.currentTimeMillis() ); Comment c = new Comment(); c.setDate(t); c.setDescription( String.valueOf(i) ); list.add(c); } Collections.sort(list, new CommentComparator()); } }
type: Answer
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/q/21232049
has comment: http://stackoverflow.com/comment/31980855
favorite count: 0
accepted answer: http://stackoverflow.com/a/21232230
has answer: http://stackoverflow.com/a/21232125
answer count: 3
has answer: http://stackoverflow.com/a/21232230
upvote count: 1
has body: I am trying to clear the time portion from a Date using Java Calendar. Here is the code based on the other stackoverflow solutions: Calendar cal = Calendar.getInstance(); // cal.setTime(new Date()); cal.clear(Calendar.HOUR); cal.clear(Calendar.MINUTE); cal.clear(Calendar.SECOND); cal.clear(Calendar.MILLISECOND); // cal.clear(Calendar.ZONE_OFFSET); cal.clear(Calendar.HOUR_OF_DAY); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); dateFormat.format(cal.getTime()); System.out.println(dateFormat.format(cal.getTime())); System.out.println(cal.getTime()); But the current output is: 2014-01-20 12:00:00 What could be the reason? Why the time is showing 12:00:00? I just want my Date Object with a time 00:00:00.
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/21232125
has title: Strange java.util.calendar Output
downvote count: 0
has answer: http://stackoverflow.com/a/21232163

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

http://stackoverflow.com/q/21244748
tagged with: javac
has comment: http://stackoverflow.com/comment/32003825
has comment: http://stackoverflow.com/comment/32003922
favorite count: 0
has answer: http://stackoverflow.com/a/21244901
has body: I'm doing some basic java homework for a class on my new laptop - issue is, I can't seem to get the program to compile and run from my batch file using the directions the instructor gave me. I've set the Path variable to my JDK inside the Environment Variables settings. My program is a simple shipping program to keep track of shipment information - I have the program working flawlessly in NetBeans (which our instructor advised us to use for developing the code), but he's going to be testing them using batch files, so we're also advised to test them on our systems with one we create prior to turning them in - pretty straightforward. Issue is, I cannot seem to get this to work. I've never done it before, but I've used .bat files to compile and run C++ programs, as well as using makefiles on a unix system, so I feel like I'm absolutely stupid for not figuring this out on my own, but none of my searches have returned any fruitful solutions that help at all. My program consists of 3 .java files: Shipment.java - an interface that contains abstracted methods that are implemented in the ShipmentHW1 class ShipmentHW1.java - a class that implements the abstracted methods from Shipment and has constructors, etc to create a usable object TestShipment.java - the main class of this program, which utilizes and creates ShipmentHW1 objects based on preset parameters. This is super duper basic stuff here, and again, it runs perfectly fine inside the NetBeans IDE. The instructions given to us state to have the batch file inside the package directory (which in this case I've set aside a seperate folder on my desktop titled "shipping", which is the package name - shouldn't be any issues there), where the 3 .java files are located as well. They say if you don't need to explicitly list the path to the JDK, then you can simply have javac TestShipment.java java TestShipment.java pause Afterwards I get errors talking about how it "cannot find symbol Shipment s = new ShipmentHW1();" I've trie…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32004546
has answer: http://stackoverflow.com/a/21244822
has comment: http://stackoverflow.com/comment/32004603
answer count: 4
score: 3
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32004709
type: Question
has answer: http://stackoverflow.com/a/21246659
has answer: http://stackoverflow.com/a/21245266
has comment: http://stackoverflow.com/comment/32004592
has title: Issue running java program from batch file, runs fine in IDE
upvote count: 3
tagged with: batch-file

http://stackoverflow.com/a/21279523
has comment: http://stackoverflow.com/comment/81893584
answers question: http://stackoverflow.com/q/21262030
has comment: http://stackoverflow.com/comment/32073392
type: Answer
has comment: http://stackoverflow.com/comment/75379735
has comment: http://stackoverflow.com/comment/81862621
score: 7
has comment: http://stackoverflow.com/comment/32071142
accepted answer of: http://stackoverflow.com/q/21262030
upvote count: 7
has comment: http://stackoverflow.com/comment/32072850
has comment: http://stackoverflow.com/comment/32072481
has body: I guess some of this depends on how you want to parse the file. Here's a "non-production" example which uses a few techniques which are useful, including: XPath select (just using "/*" here) look through all sibling nodes look down through child nodes extract node attributes into a map using AutoPilot Hope it helps package scce; import com.ximpleware.AutoPilot; import com.ximpleware.NavException; import com.ximpleware.VTDGen; import com.ximpleware.VTDNav; import com.ximpleware.XPathEvalException; import com.ximpleware.XPathParseException; import java.io.File; import java.io.IOException; import java.util.LinkedHashMap; import java.util.Map; /** * * @author David */ public class VTDParserExample { VTDGen vg; VTDNav vn; public VTDParserExample() { vg = new VTDGen(); } public void parseAndPrint() throws NavException { int level = 0; for(boolean el = (vn != null); el == true ; el = vn.toElement(VTDNav.NEXT_SIBLING)) { printTag(vn, level); parseAndPrintChildren(level); } } private void parseAndPrintChildren(int level) throws NavException { vn.push(); for(boolean el = vn.toElement(VTDNav.FIRST_CHILD); el == true ; el = vn.toElement(VTDNav.NEXT_SIBLING)) { printTag(vn, level + 1); parseAndPrintChildren(level + 1); } vn.pop(); } public VTDNav loadFile(String filePath) throws IOException { File fDoc = new File(filePath); if (fDoc != null &amp;&amp; fDoc.exists()) { System.out.println("loadFile file exists ["+filePath+"]"); vg.clear(); if (vg.parseFile(filePath, true)) { vn = vg.getNav(); } } else { throw new IOException("File ["+filePath+"] invalid"); } if (vn == null) { throw new IOException("Cannot parse file ["+filePath+"]"); } return vn; } public void getElementsByXpath() { AutoPilot ap = new AutoPilot(vn); try { String xpQ = "/*"; ap.selectXPath(xpQ); if (ap.evalXPathToBoolean()) { ap.evalXPath(); } else { System.out.println(this.getClass()+".getAllElements evalXPathToBoolean["+ap.evalXPathToBoolean()+"]"); } } catch(XPathParseException | XPathEvalException | NavExceptio…
has comment: http://stackoverflow.com/comment/32073445
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/74638407
has comment: http://stackoverflow.com/comment/32072823

http://stackoverflow.com/a/21278268
has body: You need to add your java/bin directory to the PATH enviroment variable: something like: C:\Program Files\Java\jdk1.7.0_45\bin
score: 0
upvote count: 1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21278185

http://stackoverflow.com/q/21295808
has answer: http://stackoverflow.com/a/28330822
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32101210
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/4527474
has comment: http://stackoverflow.com/comment/32098627
tagged with: java
upvote count: 1
type: Question
has title: custom xml formatting eclipse
has body: I want eclipse to format my xml into columns like the code below. Is there any possible way to do this in eclipse? I have tried Preferences->XML->Editor and changed some settings but I couldn't get the format I exactly wanted. If anyone knows of these settings could you please tell me? &lt;ListView style = "@style/listview" android:layout_below = "@+id/plu_enter_layout" android:layout_above = "@+id/fpc_scan_again" android:fadeScrollbars = "false" /&gt; &lt;LinearLayout android:layout_width = "wrap_content" android:layout_height = "wrap_content" android:layout_alignParentTop = "true" android:layout_centerHorizontal = "true" android:layout_marginTop = "20dp" android:orientation = "horizontal" &gt;
tagged with: eclipse
answer count: 1
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/31955521
score: 0
type: Comment
has text: Does any body else confirm this answer? You can access private members of other objects if they are from the same class?
comment on: http://stackoverflow.com/a/21217885
type: AnswerComment

http://stackoverflow.com/comment/32058855
has text: If you have only one Thread, then `No`.
comment on: http://stackoverflow.com/q/21276225
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/21349359
type: Answer
has body: Try: System.out.println("&lt;12&gt;".matches("^&lt;/*[0-9]+&gt;$")); Then you can wait for closing bracket, calculate the position, and substring.
score: 1
accepted answer of: http://stackoverflow.com/q/21349119
upvote count: 1
answers question: http://stackoverflow.com/q/21349119
has comment: http://stackoverflow.com/comment/32190187
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32189817

http://stackoverflow.com/a/21359061
has body: There's a UNIX (bash) shell script in src/examples/scripts/setMasterKey.sh that will show you how to do this. If your are running under Windows, it should work with Cygwin. Otherwise, you will have to translate it to a DOS script yourself.
score: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21250938
upvote count: 2

http://stackoverflow.com/comment/41405465
comment on: http://stackoverflow.com/a/21346447
has text: Which part would i have to change to change the direction in his method? (his original question)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32189484
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21349758
has text: No, a stream is a producer pattern. A collection has the elements all there and ready to go. A steam may calculate them on the fly. As collection must have finite length. A stream is often infinite.
score: 0

http://stackoverflow.com/comment/31978098
comment on: http://stackoverflow.com/q/21230181
type: Comment
type: QuestionComment
score: 0
has text: yes i need help in writting a perl script to do the same..

http://stackoverflow.com/q/21313519
type: AnsweredQuestion
score: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21315557
has title: Creating an ActorSelection to get an ActorRef created in parent actor
tagged with: akka
answer count: 1
downvote count: 0
has body: I have an Akka system with a ParentOrderActor that receives Create and Read messages to create- and read child-OrderActor respectively. All goes well if I create all Actors in the main "/user/..." path: // Inside the ParentOrderActor ("/user/orders") // Create in "/user" getContext().system().actorOf(new Props(OrderActor.class), "ABC"); // Read via an ActorSelection ActorSelection actorSelection = getContext().system().actorSelection("/user/ABC"); The logs show this when all goes well: ParentOrderActor -&gt; created: Actor[akka://system/user/ABC#1132819541] ParentOrderActor -&gt; received: Message[name=Read, id=ABC] ParentOrderActor -&gt; actorSelection: ActorSelection[Actor[akka://system/]/user/ABC] ParentOrderActor -&gt; for id=Message[name=Read, id=ABC], we retrieved ActorRef: Actor[akka://system/user/ABC#1132819541] But when trying to create- and read the child actors inside the ParentOrderActor: // Inside the ParentOrderActor ("/user/orders") // Create in "/user/orders" getContext().actorOf(new Props(OrderActor.class), "ABC"); // Read via an ActorSelection ActorSelection actorSelection = getContext().actorSelection("ABC"); this is being printed: ParentOrderActor -&gt; created: Actor[akka://system/user/orders/$a/ABC#-436492577] ParentOrderActor -&gt; received: Message[name=Read, id=ABC] ParentOrderActor -&gt; actorSelection: ActorSelection[Actor[akka://system/user/orders/$a#478613574]/ABC] Oops: java.util.concurrent.TimeoutException: Futures timed out after [2 seconds] ParentOrderActor -&gt; for id=Message[name=Read, id=ABC], we retrieved ActorRef: null I've tried all kind of paths in the actorSelection(...), but the ActorRef is always null. For completeness sake, here is a short SSCCE that demonstrates the above: public class Main { private static boolean createChildrenInUser = false; private static LoggingAdapter log; static abstract class Message { final String id; Message(String id) { this.id = id; } @Override public String toString() { return "Message[name=…
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/21315557

http://stackoverflow.com/comment/32649024
type: Comment
comment on: http://stackoverflow.com/a/21197787
type: AnswerComment
has text: This does not work for me - I am still getting the *GC overhead limit exceeded* message with that setting when importing [this file](http://queens.db.toronto.edu/~oktie/linkedmdb/linkedmdb-latest-dump.tar.gz).
score: 0

http://stackoverflow.com/q/21232312
has answer: http://stackoverflow.com/a/23165662
tagged with: bouncycastle
has body: Well, I need make api using java to encrypt, decrypt and another things about Cryptografy. I'm using bouncycastle framework to do. But I can't found Elliptic Curve Cryptigrafy Engine into BC Framework, I found RSAEngine, IESEngine. I wanna encrypt with public key, and decrypt with private key, but all exemples that I found need both keys to encrypt, so I no understand it. Like it: Security.addProvider(new BouncyCastleProvider()); KeyPairGenerator kpg = (KeyPairGenerator) KeyPairGenerator.getInstance("ECIES", "BC"); kpg.initialize(192, new SecureRandom()); KeyPair keyPair = kpg.generateKeyPair(); PublicKey pubKey = keyPair.getPublic(); PrivateKey privKey = keyPair.getPrivate(); byte[] d = new byte[]{1, 2, 3, 4, 5, 6, 7, 8}; // 1. can someone tell me what this parameters does? byte[] e = new byte[]{8, 7, 6, 5, 4, 3, 2, 1}; IESParameterSpec param = new IESParameterSpec(d, e, 192); // 2. and this parameters? IEKeySpec c1Key = new IEKeySpec(privKey, pubKey); System.out.println(c1Key.getPublic()); Cipher cipher = Cipher.getInstance("ECIES", "BC"); cipher.init(Cipher.ENCRYPT_MODE, c1Key, param); System.out.println(cipher.doFinal("test12345678900987654321".getBytes())); But in sometimes I no have private key, as encrypt with public key. Someone help me?
type: UnansweredQuestion
tagged with: elliptic-curve
tagged with: java
has title: ECC Engine with BouncyCastle for Java
type: Question
score: 0
answer count: 1

http://stackoverflow.com/comment/32158938
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21333072
has text: Have you worked it out can you show example how you work on your solution.
type: AnswerComment

http://stackoverflow.com/q/21337815
tagged with: java
has answer: http://stackoverflow.com/a/21337869
tagged with: eclipse
has answer: http://stackoverflow.com/a/22437555
upvote count: 9
downvote count: 0
tagged with: webstorm
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32171618
favorite count: 0
accepted answer: http://stackoverflow.com/a/22437555
tagged with: angularjs
type: Question
score: 9
answer count: 2
has comment: http://stackoverflow.com/comment/32168164
has comment: http://stackoverflow.com/comment/32941945
has body: I'm working on a project that has mix of angularjs/java . I like Eclipse for working with Java but find that its javascript/jQuery/AngularJS support is somewhat lacking. I've been using jetbrains webstorm for learning AngularJS and find that its a really nice tool for javascript/jQuery/AngularJS development. This is fine for proof of concepts etc but there will come a time when want to use Java / with Webstorm. I'm aware there is a Webstorm plugin for Intellij but I cannot change from current Eclipse IDE . A possible solution would be to create a new project that contains just AngualarJS/jQuery code and manage this using webstorm and continue to use Eclipse for java related projects. Are there project setup's to handle this type of problem - use two IDE's to separately manage different source code languages ?
possible better answer: http://stackoverflow.com/a/21337869
has title: Using different ide's for javascript/java

http://stackoverflow.com/a/21273137
has comment: http://stackoverflow.com/comment/32054057
type: AcceptedAnswer
score: 0
type: Answer
has body: Does anybody know why? The taskRunnerLauncher bean is set to be abstract. This means it will only act as a template for other beans. Spring will not actually create a bean for it. Therefore there won't be any invocation of startThreads because there is nothing to invoke it on.
has comment: http://stackoverflow.com/comment/32053980
has comment: http://stackoverflow.com/comment/32053973
answers question: http://stackoverflow.com/q/21273067
accepted answer of: http://stackoverflow.com/q/21273067

http://stackoverflow.com/q/21258887
has comment: http://stackoverflow.com/comment/32028304
answer count: 1
has comment: http://stackoverflow.com/comment/32028745
has comment: http://stackoverflow.com/comment/32027853
has comment: http://stackoverflow.com/comment/32028488
favorite count: 0
has comment: http://stackoverflow.com/comment/32028416
has comment: http://stackoverflow.com/comment/32028218
has title: executing millions of thread concurrently in java
has comment: http://stackoverflow.com/comment/32028126
has comment: http://stackoverflow.com/comment/32028316
has comment: http://stackoverflow.com/comment/32027614
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21260585
tagged with: multithreading
downvote count: 3
linked to: http://stackoverflow.com/q/510632
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32027678
has body: I have a requirement to handle millions of thread and i know its quite dependent on the hardware configuration and jvm. I have used executors for the task call flow of my project : user(mobile)----->Server(Telecom) ------>Application----->Server(Telecom)----->User Code call flow : A------>B---------->C //Code snippet of A public static final int maxPoolSize=100; ExecutorService executorCU=Executors.newFixedThreadPool(maxPoolSize); Runnable handleCalltask=new B(valans, sessionID, msisdn); executorCU.execute(handleCalltask); //Code snippet of B public static final int maxPoolSize=10; ExecutorService executor=Executors.newFixedThreadPool(maxPoolSize); Runnable handleCalltask=new c(valans, sessionID, msisdn); executor.execute(handleCalltask); and there are shared map which i implemented as concurrencyHashMap which gets loaded at the loading of application. Is my approach is correct and if not can anybody suggest how i can achieved maximum threading in my web application. I have tested with Jmeter and its result are not at all encouraging. Thanks.
linked to: http://stackoverflow.com/q/10770348
score: -2
tagged with: threadpool

http://stackoverflow.com/comment/32175416
type: Comment
comment on: http://stackoverflow.com/a/21341531
has text: this matches numbers preceded by a space, but is not matching negative or float number, also, numerical values could be in function calls, e.g. : int y = SumFunction(1,5); will be : int y = sumFunction(,);
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31955971
has text: You need to extend `Application`. What are you trying to achieve exactly?
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21218081
type: Comment

http://stackoverflow.com/a/38177870
has body: The gradle also needs to contain this defaultConfig { applicationId "com.example.app" } I had left it out completely
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21271246
score: 1

http://stackoverflow.com/comment/32186689
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21347914
type: Comment
has text: thanks Ahmad, i put the fillTextView in my MainActivity and tried to call the function from another method in another class and it came up with the non-static method cannot be called from a static class error - i am sorry i am trying to understand

http://stackoverflow.com/comment/32143312
has text: @ErwinBolwidt Yes. The question is either badly designed or actually very good. [Java 7](http://stackoverflow.com/questions/15052216/how-large-is-the-integer-cache) also seems to have added setting to change the cache size.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21323833

http://stackoverflow.com/q/21273553
tagged with: android-listfragment
has comment: http://stackoverflow.com/comment/32183255
has answer: http://stackoverflow.com/a/22761786
has comment: http://stackoverflow.com/comment/32078476
has answer: http://stackoverflow.com/a/22909332
answer count: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32054659
has comment: http://stackoverflow.com/comment/34698875
has comment: http://stackoverflow.com/comment/34698370
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32168570
has body: So I'm getting some strange behavior with one of my Android apps. I have two apps, both with the same custom background image, and one works just fine. The other, however, does not want to cooperate. I add a custom theme in my AndroidManifest.xml via the following: <application ... android:theme="@style/MyTheme" > I change my styles.xml (the entire file) to the following: <?xml version="1.0" encoding="utf-8"?> Again, this works just fine for app #1. But app #2... When I call this: setListAdapter(new ArrayAdapter<Game>(getActivity(), android.R.layout.simple_list_item_activated_1, android.R.id.text1, gameCategories.getCategories())); It throws: 01-22 21:30:21.439: E/AndroidRuntime(28044): FATAL EXCEPTION: main 01-22 21:30:21.439: E/AndroidRuntime(28044): java.lang.NumberFormatException: Invalid int: "res/drawable/dummy_background_image.png" 01-22 21:30:21.439: E/AndroidRuntime(28044): at java.lang.Integer.invalidInt(Integer.java:138) 01-22 21:30:21.439: E/AndroidRuntime(28044): at java.lang.Integer.parse(Integer.java:375) 01-22 21:30:21.439: E/AndroidRuntime(28044): at java.lang.Integer.parseInt(Integer.java:366) 01-22 21:30:21.439: E/AndroidRuntime(28044): at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:122) 01-22 21:30:21.439: E/AndroidRuntime(28044): at android.content.res.TypedArray.getInt(TypedArray.java:255) 01-22 21:30:21.439: E/AndroidRuntime(28044): at android.view.animation.Animation.<init>(Animation.java:251) 01-22 21:30:21.439: E/AndroidRuntime(28044): at android.view.animation.AlphaAnimation.<init>(AlphaAnimation.java:40) 01-22 21:30:21.439: E/AndroidRuntime(28044): at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:117) 01-22 21:30:21.439: E/AndroidRuntime(28044): at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:92) 01-22 21:30:21.439: E/AndroidRuntime(28044): at android.view.animation.AnimationUtils.loadAnimation(AnimationUtils.java:73) 01-22 21:30:21.439: E/Androi…
tagged with: android
score: 3
has answer: http://stackoverflow.com/a/21462619
has comment: http://stackoverflow.com/comment/34698542
upvote count: 3
tagged with: java
has title: Android Custom Background Causing Number Format Exception with List Adapter
type: Question

http://stackoverflow.com/comment/45063482
type: Comment
type: QuestionComment
has text: @AlekseyIzmailov - Those are packages ... not binaries. They might include binaries, but for a Java application the chances are that they don't.
comment on: http://stackoverflow.com/q/21212629
score: 0

http://stackoverflow.com/comment/32092817
has text: Do you mean something like [Sikuli](http://www.sikuli.org/)?
comment on: http://stackoverflow.com/q/21295505
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32065006
type: Comment
has text: Hi, thanks for your reply. I have verified the syntax using JaNeLa as weel and it does not complain about any error. Interestingly the error says line 26 whereas the jnlp closes even before that and no line 26 exist.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21276330

http://stackoverflow.com/q/21219037
tagged with: twitter-bootstrap
has comment: http://stackoverflow.com/comment/31958020
type: AnsweredQuestion
has title: NetworkonMainThreadExecption with Twitter Timeline Feeds Example
has body: I have tried to display twitter timeline user feeds with this link. The different with my code is I try it in a Fragment class. In this code didn't need twitter4j.jar library, is it right ?? This is the code public class WhatsHotFragment extends Fragment { public WhatsHotFragment() { } TextView tweetTextView; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_whats_hot, container, false); String twitterTimeline = getTwitterTimeline(); try { String tweets = ""; JSONArray jsonArray = new JSONArray(twitterTimeline); for (int i = 0; i &lt; jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); int j = i + 1; tweets += "Tweet #" + j + " \n"; tweets += "Date:" + jsonObject.getString("created_at") + "\n"; tweets += "Post:" + jsonObject.getString("text") + "\n\n"; } tweetTextView = (TextView) rootView.findViewById(R.id.tweetTextView); tweetTextView.setText(tweets); } catch (JSONException e) { e.printStackTrace(); } return rootView; } public String getTwitterTimeline() { StringBuilder builder = new StringBuilder(); HttpClient client = new DefaultHttpClient(); HttpGet httpGet = new HttpGet( "http://api.twitter.com/1/statuses/user_timeline/BBCNews.json?count=10&amp;include_rts=1&amp;callback=?"); try { HttpResponse response = client.execute(httpGet); StatusLine statusLine = response.getStatusLine(); int statusCode = statusLine.getStatusCode(); if (statusCode == 200) { HttpEntity entity = response.getEntity(); InputStream content = entity.getContent(); BufferedReader reader = new BufferedReader( new InputStreamReader(content)); String line; while ((line = reader.readLine()) != null) { builder.append(line); } } else { // Display couldn't obtain the data from twitter } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return builder.toString(); } } But i get error logcat: 01-19 10:41:37.137:…
tagged with: java
tagged with: twitter
accepted answer: http://stackoverflow.com/a/21219281
type: Question
has comment: http://stackoverflow.com/comment/31957787
answer count: 1
has comment: http://stackoverflow.com/comment/31957715
has answer: http://stackoverflow.com/a/21219281
score: 0
tagged with: android

http://stackoverflow.com/comment/32097467
score: 0
type: AnswerComment
type: Comment
has text: Can anyone tell me where to find more information about how this bit of code works? `int c0 = i < number0.length ? number0[number0.length - i - 1] : 0;`
comment on: http://stackoverflow.com/a/21297653

http://stackoverflow.com/comment/32016848
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21252516
score: 0
has text: I suggest you keep your Android code separate from your non-Android code... it's likely to make things much simpler.

http://stackoverflow.com/a/21231685
upvote count: 6
score: 6
has comment: http://stackoverflow.com/comment/32060483
has body: Frank, it is bad practice to do any I/O operations while you're in an EJB context. The reason behind this is simple. When working in a cluster: They will inherently block each other while waiting on I/O connection timeouts and all other I/O related waiting timeouts. That is if the connection does not block for an unspecified amount of time, in which case you will have to create another Thread which scans for dead connections. Only one of the EJBs will be able to connect and send/recieve information , the others will just wait in line. This way your system will not scale. No matter how many how many EJBs you have in your cluster, only one will actually do its work. Apparently you already ran into problems by doing that :) . Jboss 8 seems not to be able to properly create and destroy the bean. Now, I know your bean is a @Singleton so your architecture does not rely on transactionality, clustering and distribution of reading from that socket. So you might be ok with that. However :D , you are asking for a java EE compliant way of solving this. Here is what should be done: Redesign your solution to go with JMS. It 'smells' like you are trying to provide an async messaging functionality (Send a message &amp; wait for reply). You might be using a synchronous protocol to do async messaging. Just give it a thought. Create a JCA compliant adapter which will be injected in your EJB as a @Resource You will have a connection pool configurable at AS level ( so you can have different values for different environments You will have transactionality and rollback. Of course the rollback behavior will have to be coded by you You can inject it via a @Resource annotation There are some adapters out there, some might fit like a glove, some might be a bit overdesigned. Oracle JCA Adapter
answers question: http://stackoverflow.com/q/21231129
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31951064
type: QuestionComment
score: 0
type: Comment
has text: @Jon Skeet is java version is reading from some registry file instead of java_home?
comment on: http://stackoverflow.com/q/21215141

http://stackoverflow.com/comment/32148006
comment on: http://stackoverflow.com/a/21325040
type: AnswerComment
score: 0
type: Comment
has text: Well firstly, that is only a warning, not an error so it should still compile. Also, to tell you exactly what is causing this I would have to see the exact code you tried to compile because I compiled/ran this code without any warnings. If you just added my code to the code you posted above, it's probably from you parsing an int from an inputDialog with `JOptionPane.WARNING_MESSAGE` option.

http://stackoverflow.com/q/21268433
has comment: http://stackoverflow.com/comment/32045575
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21268567
downvote count: 3
score: -3
has comment: http://stackoverflow.com/comment/32045112
has answer: http://stackoverflow.com/a/21269432
type: Question
has comment: http://stackoverflow.com/comment/32045670
tagged with: java
tagged with: replace
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/21268702
favorite count: 0
has title: How to replace a char with a char?
has body: What I'm trying to do is to ask the user to type in a lowercase 5 letter word. Then the next window will have 5 dashes and will ask the user to enter a letter. If the letter matches one of the letters in the string they input in the beginning, the dash will be replaced with the letter. The computer will ask the user to enter a letter until all the dashes are replaced with the correct letters and every time they input a correct letter, the remaining dashes will appear as well as the correctly guessed words. for ex: if the word is "hello", a window will appear as " _ _ _ _ _". When I enter an "h" the window will appear as "h _ _ _ _". Then the computer will ask me to input another letter and I type in "l" so the window will show: "h _ l l _". this is what i have so far: String word; do{ word = JOptionPane.showInputDialog("Enter a 5 letter lowercase word"); }while(word.length()!=5); String blanks = "_____"; char letter = JOptionPane.showInputDialog(blanks).charAt(0); for(int a=0;a&lt;=5;a++){ char blankReplace; if(word.charAt(a)==letter){ blankReplace = letter; } letter = JOptionPane.showInputDialog(blanks).charAt(0); Sorry I didnt include this earlier, I'm new

http://stackoverflow.com/comment/31988422
comment on: http://stackoverflow.com/q/21236245
type: Comment
type: QuestionComment
score: 3
has text: use `startActivityForResult`. you can use `if(getIntent().getExtras()!=null)`

http://stackoverflow.com/q/21252587
type: Question
linked to: http://stackoverflow.com/q/8197261
tagged with: swingworker
tagged with: pagination
has comment: http://stackoverflow.com/comment/32020135
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/21130354
has comment: http://stackoverflow.com/comment/32018203
type: UnansweredQuestion
has body: Yo dudes. I need so suggestions on how to best implement something please. My program: I have a swing program that reads a file with multiple records of different types. I read these records into java objects, make JTables of them with their headings and content (so every table only has the heading and 1 record), add these tables to a panel and add the panel to a scrollpane. There are lots of records, about 70000, so i cant load everything into memory at once. My plan is to paginate the display by only displaying say 100 records at a time, and if you scroll past a certain point, lets say table nr 50, it will load the next 100 tables and add them to the scrollpane. This brings me to my questions 1) Im not sure how to notify myself that ive scrolled past a certain point. So given that i have 100 JTables attached to a JPanel attached to a scrollpane. How can i add a listener to notify when the user has scrolled past say Jtable 50 for arguments sake. 2) The other issue im having is related to how i put my tables into the panel. Im using a swingworker as below: private class TableRun extends SwingWorker&lt;Void, JTable&gt; { private ArrayDeque&lt;FileRecord&gt; fileRecords; private final GridBagConstraints gc; private final JPanel parentPanel; int counter = 1; TableRun(ArrayDeque&lt;FileRecord&gt; fileRecords, GridBagConstraints gc, JPanel parentPanel) { this.fileRecords = fileRecords; this.gc = gc; this.parentPanel = parentPanel; } @Override protected Void doInBackground() { Iterator&lt;FileRecord&gt; iterator = fileRecords.iterator(); while (iterator.hasNext()) { publish(getTabel(iterator.next())); } return null; } @Override protected void process(final List&lt;JTable&gt; tables) { Iterator&lt;JTable&gt; iterator = tables.iterator(); while(iterator.hasNext()) { JTable table = iterator.next(); gc.fill = 1; parentPanel.add(table.getTableHeader(), gc); gc.gridy++; parentPanel.add(table,gc); gc.gridy++; //validate takes a long time so i try to not do it too often. if(count…
has comment: http://stackoverflow.com/comment/32017133
has answer: http://stackoverflow.com/a/21256651
has comment: http://stackoverflow.com/comment/32017964
tagged with: java
has comment: http://stackoverflow.com/comment/32017805
has comment: http://stackoverflow.com/comment/32017203
tagged with: swing
has title: Swing scrollpane notify when you scroll past a certain point

http://stackoverflow.com/q/21345609
has answer: http://stackoverflow.com/a/21345652
has comment: http://stackoverflow.com/comment/32182376
has body: For my program, I'm having issues creating a error check if the user does not enter the commandline arguments and display an error message. Instead of crashing. With no text file argument, I get a ArrayIndexOutOfBoundsException :o ? public static void main(String[] commandlineArgument) { Integer[] array = ReadFile7.readFileReturnIntegers(commandlineArgument[0]); ReadFile7.printArrayAndIntegerCount(array, commandlineArgument[0]); if(commandlineArgument.length == 0){ System.out.println("Please file name " + "as the first commandline argument."); } }
has title: Error-checking for command line arguments
type: AnsweredQuestion
tagged with: java
tagged with: error-handling
type: Question
tagged with: command-line-arguments
possible better answer: http://stackoverflow.com/a/21345652
has answer: http://stackoverflow.com/a/21345637
accepted answer: http://stackoverflow.com/a/21345637
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21345680
tagged with: arrays

http://stackoverflow.com/comment/32164728
comment on: http://stackoverflow.com/q/21335894
score: 0
type: Comment
type: QuestionComment
has text: It's probably a classpath issue. How are you building your project and where did you get the jaxb-api.jar and jaxb-impl.jar that you're using?

http://stackoverflow.com/a/52663096
type: Answer
has body: Ctrl + Shift + R while the replaced text is selected: This works for Replace in Path (WebStorm 2018.2.3): see here
answers question: http://stackoverflow.com/q/21219884
score: 0

http://stackoverflow.com/q/21193985
tagged with: applet
accepted answer: http://stackoverflow.com/a/21199389
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31930077
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31941063
has title: Open java Applet or Frame inside a parent Applet method and wait for input
has comment: http://stackoverflow.com/comment/31921972
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21199389
has body: I have a Java applet (lets call it parentApplet) with a public method which must return information regarding the status of the performed actions (let's call it getUserInput()) . This method opens another Applet which needs user button input, by adding it as a child with add(childApplet), and afterwards adding itself (the parent) as an ActionListner of the buttons in the childApplet, being able to run other methods when the user clicks on the buttons in the childApplet. My question is, how can I halt getUserInput() execution until the user has clicked the childApplet buttons? I tried to have a static variable that tracks the return information, and spinning on a while(var == null) Thread.Sleep(1000); but it blocks the main thread, as it should. PS: Having the childApplet as an applet can be changed to anything that could better fulfil the requirement of opening another panel on top of the parent applet. Details on getUserInput() That childApplet has a canvas (a Graphics object from a BufferedImage) on which the user can draw and OK/Clear/Cancel buttons. When the user presses OK, I need to get the BufferedImage drawn. Do you know if this can be accomplished by extending a JDialog?
tagged with: awt
has answer: http://stackoverflow.com/a/21209812
possible better answer: http://stackoverflow.com/a/21209812

http://stackoverflow.com/q/21255009
answer count: 3
has answer: http://stackoverflow.com/a/21256436
accepted answer: http://stackoverflow.com/a/21255192
has title: Remove digit mark from float and convert to integer
has comment: http://stackoverflow.com/comment/32021600
possible better answer: http://stackoverflow.com/a/21255188
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21255192
type: Question
tagged with: jsp
has body: Let's say that I have these variables: float xx= 99.33f; int yy=0; I want to convert xx to yy by removing the digit marks, so that yy will be the number 9933, preferably with a single line statement. How is this possible?
has answer: http://stackoverflow.com/a/21255188
score: 0

frequency-distribution
tag name: frequency-distribution
type: Tag
tags question: http://stackoverflow.com/q/21325022

http://stackoverflow.com/q/21277221
has answer: http://stackoverflow.com/a/21289249
accepted answer: http://stackoverflow.com/a/21289249
has body: Is there something equivalent to get all keys (or inverses) from a bit map and concat each with a special character as a completely new string (without iterating through the map and building it manually? private static final BiMap&lt;String, String&gt; stuff = HashBiMap.create(); static { stuff.put("S1", "STUFF_TYPE_1"); stuff.put("S2", "STUFF_TYPE_2"); stuff.put("S3", "STUFF_TYPE_3"); } // The non-terminal &lt;&gt; is what I'm asking if something like exists either with bimap or some other container? private static final String concateKeys = &lt;stuff.getAllKeys().assignDelimiter("|").toString();&gt; Then the Value for concateKeys = "S1|S2|S3"
type: AnsweredQuestion
has title: BiMap single function to convert values to concatenated string value?
tagged with: bimap
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/21277339
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21277339
tagged with: dictionary

http://stackoverflow.com/a/21209348
downvote count: 1
has comment: http://stackoverflow.com/comment/31940550
has comment: http://stackoverflow.com/comment/31942623
has body: You must change the first for condition, because when i = 0 the condition i &gt; 0 is false, so it never enters the loop. Note that when you go line be line, the k must iterate in this pattern: [0, 01, 012, 0123] while i in [0, 1, 2, 3]. In other words, k must iterate until it reaches the value of i, so the condition of the nested for must be k &lt; i + 1. for (int i = 0; i &lt; 4; i++) { for (int k = 0; k &lt; i + 1; k++) { // Here you should access to the array // array[i][k] System.out.print(i + " " + k + " - "); // [DEBUG] } System.out.println(); // [DEBUG] } Output: Just to see indexes 0 0 - 1 0 - 1 1 - 2 0 - 2 1 - 2 2 - 3 0 - 3 1 - 3 2 - 3 3 -
has comment: http://stackoverflow.com/comment/31940583
has comment: http://stackoverflow.com/comment/31940572
upvote count: 4
score: 3
accepted answer of: http://stackoverflow.com/q/21209313
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21209313
type: Answer
has comment: http://stackoverflow.com/comment/31940599
has comment: http://stackoverflow.com/comment/31940712
has comment: http://stackoverflow.com/comment/31940500

http://stackoverflow.com/comment/31954326
has text: I think putAll just uses put for each element in the map
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21217264

http://stackoverflow.com/q/21279430
upvote count: 2
tagged with: java
tagged with: certificate
tagged with: https
accepted answer: http://stackoverflow.com/a/21280195
type: Question
has comment: http://stackoverflow.com/comment/32095987
has title: Export certificates from java?
tagged with: ssl
tagged with: truststore
has comment: http://stackoverflow.com/comment/32102721
has body: We had some https certificates installed under java 5 keystore. I am looking forward to migrate my old ssl certificate from java 5 trustore to java 6 trustore or is it a good option to replace java 6 kdystore file wuth java 5 keystore file(though i wont prefer this)?
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21280195
score: 2
type: AnsweredQuestion

websphere
tags question: http://stackoverflow.com/q/21336145
tags question: http://stackoverflow.com/q/21307118
tags question: http://stackoverflow.com/q/21240589
tag name: websphere
tags question: http://stackoverflow.com/q/21257422
type: Tag
tags question: http://stackoverflow.com/q/21269951

http://stackoverflow.com/q/21243213
tagged with: stream
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/21243486
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/32001011
favorite count: 0
has title: Java Reader Implementation
has body: I have exercise in java like "define text stream(Reader) that will clear from whitespaces". I checked Reader and It only requires to implement 2 methods: @Override public int read(char[] cbuf, int off, int len) throws IOException { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void close() throws IOException { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } I am little confused what should I really do. From what I understand cbuf is destination, so from what should I read?
answer count: 1
score: 1
type: UnansweredQuestion

http://stackoverflow.com/a/21309088
answers question: http://stackoverflow.com/q/21308869
type: AcceptedAnswer
has body: The classpath is used to search for your own classes, but the built-in class library is available automatically without needing to be added to the classpath. So Hello_1 is found on the default classpath (the current directory) and java.io.File is found in the built-in class library.
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21308869
upvote count: 2

http://stackoverflow.com/q/21243136
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: mongodb
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21244902
has body: I have a well-logged pool of several java servers behind an F5 load balancer (professionally managed, it's not sending traffic to >1 host) running Tomcat with my application installed, connecting to a sharded mongo cluster. I'm using a base64-encoded SHA-1 hash of the primary natural key as the _id. When a new record is to be created, I do a pretty basic: BasicDBObject query = new BasicDBObject(); query.put("userId", userId); query.put("_id", id); DBObject user = getUsersCollection().findOne(query); if (user == null) { getUsersCollection().insert(new UserObject(userId)); } This is simplified. In fact there are multiple checks for the pre-existence of this user, including one which should throw a custom exception, and none are triggered. The traffic logs indicate a single incoming create request, and here's an example of what happens: 2014-01-19 20:03:45,167 [http-bio-7950-exec-827]:[...] : ERROR FATAL [...] - Internal server error [...]: com.mongodb.MongoException$DuplicateKey: { "serverUsed" : "[...]" , "singleShard" : "replicaset_2/host1:27017,host2:27017,host3:27017" , "err" : "E11000 duplicate key error index: Users.$_id_ dup key: { : \"HASH\" }" , "code" : 11000 , "n" : 0 , "lastOp" : { "$ts" : 1390190614 , "$inc" : 1} , "connectionId" : 335764 , "ok" : 1.0} Yet in my Users collection the record has been created: db.Users.findOne({_id:"HASH"}): { "_id" : "HASH", "createDate" : ISODate("2014-01-20T04:03:45.161Z"), ... } I'm pasting this as important because of the timestamps. We have a timezone issue, but that aside I interpret the 6ms difference as clock skew between the mongo cluster and my application servers. There is no other record of this incoming traffic (and it is logged as it bounces from server to server, even - nothing else!) So I am 99.999% confident that my SINGLE LEGITIMATE insert call is both inserting and throwing an error. Any theories as to how/why this is happening would be greatly appreciated. I'll run tracers and examples if needed to answe…
has comment: http://stackoverflow.com/comment/32001884
favorite count: 0
score: 2
upvote count: 2
has title: Mongo DuplicateKey error despite no overlap
accepted answer: http://stackoverflow.com/a/21244902
has comment: http://stackoverflow.com/comment/32091843

http://stackoverflow.com/a/21215167
has body: finalize has the same problem in .NET (i.e. if the object is never garbage collected, then finalize will never be called) In Java, the best practice to guarantee cleanup is: final Resource resource = getResource(); try { // Do stuff ... } finally { resource.dispose(); } In .NET, the best practice to guarantee cleanup is: using (Resource resource = GetResource()) { // Do stuff ... }
type: Answer
answers question: http://stackoverflow.com/q/21214948
has comment: http://stackoverflow.com/comment/31951219
score: 0
has comment: http://stackoverflow.com/comment/31951467
has comment: http://stackoverflow.com/comment/31950813
has comment: http://stackoverflow.com/comment/31951328

http://stackoverflow.com/a/35449402
has body: Try doing this: preparedStatement.executeUpdate(sql); and you should also specify database String sql = "INSERT INTO database_name.document (document_id, document_name, format)" +"VALUES (?, ?, ?)";
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21257977

http://stackoverflow.com/a/21284413
has body: You can throw any RuntimeException in both Methods In writeObject(ObjectOutputStream out) you can also throw IOException In readObject(ObjectInputStream in) yu can also throw IOException and ClassNotFoundException
type: Answer
answers question: http://stackoverflow.com/q/21284253
score: 0

http://stackoverflow.com/comment/32057210
score: 0
comment on: http://stackoverflow.com/q/21275187
type: QuestionComment
type: Comment
has text: Let's say you have `objA` and `objB` with the same phone-number. `objA` is added to the `ArrayList`, then `objB` "wants" to be added to the `ArrayList` too. What would happen with `objB`? It would just don't be "accepted" *(added)*? Just curiosity.

http://stackoverflow.com/a/21259337
has body: To remove whitespace, you could have done something like the following: str.replaceAll("\\s+","")
answers question: http://stackoverflow.com/q/21259298
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32030562
has comment: http://stackoverflow.com/comment/32028635
type: Answer
score: 1

http://stackoverflow.com/q/21290270
has answer: http://stackoverflow.com/a/21290528
accepted answer: http://stackoverflow.com/a/21290528
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Jackson Jersey JSON
type: Question
possible better answer: http://stackoverflow.com/a/21290417
tagged with: jersey
tagged with: jackson
has comment: http://stackoverflow.com/comment/32083466
answer count: 2
has body: I'm trying to use Jersey and Jackson (although any other way of doing JSON demarshalling works) to get this into my system in some form (be it POJO or some other representation). Basically I only need the data section. I was trying to use GenericTypes with lists, but this is a nested list and I'm just not sure what to do. Lots of kudos for help and I really appreciate it! { "total": 4, "data": [ { "descriptor": "", "multiInstance": false, "active": false }, { "descriptor": "Apparel", "multiInstance": true, }, { "descriptor": "abcd123", "multiInstance": false, }, { "descriptor": "abcd", "multiInstance": false, } ] } This is the class I'm trying to use. I need a list of the class. public class customObject { @JsonProperty(value = "descriptor") private String descriptor; @JsonProperty(value = "multiInstance") private Boolean multiInstance; //getters and setters } Edit: I'm using it in here. CustomObjectResponse WDCOResponse = resource .type(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON) .header("Authorization", getToken()).get(WDCOResponse.class); But it's still not working. Edit2: Figured this out! Thanks to everyone. :) I had to add annotation to tell it to ignore if something wasn't found, some of the JSON I'm getting back was not fully-formed in that not all fields were absolutely neccesary.
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21290417
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/31941015
comment on: http://stackoverflow.com/q/21186057
has text: CountDownLatch is your friend in this case. Call await in your test and countDown in your dummy task to make the test wait for the task to be completed.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21292043
answer count: 2
accepted answer: http://stackoverflow.com/a/21292089
has answer: http://stackoverflow.com/a/21292176
type: AnsweredQuestion
has title: Java local object variable's scope
tagged with: java
possible better answer: http://stackoverflow.com/a/21292176
has answer: http://stackoverflow.com/a/21292089
type: Question
has body: I'm trying to pick up Java again using the book Data Structures &amp; Algorithms in Java, in pg 191, the book implements link list. The code first builds a link class, a link list class and a client class linkapp. public class Link { public int data; public link next; public Link (int newdata){ data=newdata; } } public class Linklist { public Link first; public void insertFirst(int data){ Link newlink=new Link (data); newlink.next=first; first=newlink; } public boolean isEmpty(){ return (first==null); } public void displaylist(){ if (!isEmpty()){ Link current=first; while(current!=null){ System.out.print(current.data); current=current.next;} } } } public class LinklistApp { public static void main(String[] args) { Linkedlist linkList = new Linkedlist(); linkList.insertFirst(3); linkList.insertFirst(4); linkList.insertFirst(5); linkList.displaylist(); } } But I don't understand why the link object created locally in the insertFirst method inside linklist class can be accessed by displaylist method. Local variables will disappear when the method exits because they're just intermediate result. So how did displaylist method still have access to those link objects?
tagged with: scope
score: 0

http://stackoverflow.com/q/21206864
score: 0
has title: Gson error occurs when I convert json to gson object Expected BEGIN_ARRAY but was BEGIN_OBJECT
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
accepted answer: http://stackoverflow.com/a/21207369
type: Question
has body: I am getting following error when I convert json to gson : E/AndroidRuntime(1142): com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 51 I have json like this : { "ResultCode": "0", "ErrorMessage": null, "Payload": [ { "Items": [ { "Title": "Star Wars" }, { … }, { … }, { … }, { … }, { … }, { … }, { … }, { … }, { … }, { … } ] }, { "Items": [ … ] }, { "Items": [ … ] } ] } I have two classes : MResult class import java.util.List; public class MResult{ private String ErrorMessage; private String ResultCode; private List&lt;List&lt;Item&gt;&gt; Payload; public String getErrorMessage() { return ErrorMessage; } public void setErrorMessage(String errorMessage) { ErrorMessage = errorMessage; } public String getResultCode() { return ResultCode; } public void setResultCode(String resultCode) { ResultCode = resultCode; } public List&lt;List&lt;Item&gt;&gt; getPayload() { return Payload; } public void setPayload(List&lt;List&lt;Item&gt;&gt; payload) { Payload = payload; } } Item class : public class Item{ private String Title; public String getTitle() { return Title; } public void setTitle(String title) { Title = title; } } I am getting the error on this line : MResult serviceResult = new Gson().fromJson(result,MResult.class);
answer count: 1
has answer: http://stackoverflow.com/a/21207369

http://stackoverflow.com/comment/32162367
comment on: http://stackoverflow.com/a/21332434
score: 0
type: AnswerComment
has text: I fixed it. Thanku so much for your help!
type: Comment

http://stackoverflow.com/comment/68597505
has text: It's not code, it's part of the Java options that are set when you call the Java executable. The exact answer will depend on your operating system and program. For Tomcat on Windows as in this example, running Tomcat7w will get you started, then modify Java options. In other cases you add the options to your initialization file, or for java.exe command-line, adding it there. I would definitely recommend researching Java options rather than blindly adding this in if you are not familiar with them. A good place is start is http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html .
type: AnswerComment
comment on: http://stackoverflow.com/a/34891294
score: 4
type: Comment

http://stackoverflow.com/comment/31897266
score: 0
type: Comment
type: QuestionComment
has text: @assylias, `Permissions: all-permissions` is set in manifest
comment on: http://stackoverflow.com/q/21185322

http://stackoverflow.com/comment/32112299
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21304540
has text: I get `null` content-type for http://cdn0.sbnation.com/uploads/hub/favicon/247/favicon-0666b2d5.ico, although I clearly see an 'ico' when I connect to this URL through Firefox. Would you know how to explain this? Thanks
score: 0

http://stackoverflow.com/q/21191941
has comment: http://stackoverflow.com/comment/31912804
has title: Monitoring a java request
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/31909441
answer count: 2
has comment: http://stackoverflow.com/comment/31909468
has answer: http://stackoverflow.com/a/21192150
tagged with: spring-aop
favorite count: 0
score: 2
has body: Is there a way to identify if the process is running currently and to define how long it has been running when it is triggered? Say for instance, I make a web service/ web app call to a method named getFirstName() which has a call to the database to retrieve the names. Just before this I have a AOP advise methodinterceptor which will intercept the method getFirstName(). Now in the interceptor I will note the start time of this request and then proceed to the actual method, now i need to trigger a mail to the user if the request has been running for a long time.so How do I keep track of this request timing? I don't want to use any thread to avoid the complexity, is there a simple way to do this? Thanks!
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21192171
has comment: http://stackoverflow.com/comment/31909516
tagged with: spring
has comment: http://stackoverflow.com/comment/31911227
has comment: http://stackoverflow.com/comment/31911465
tagged with: java

http://stackoverflow.com/a/21237513
type: Answer
has body: Java doesn't have unsigned bytes. All Java integer types are signed. This means that the left shift of a negative byte will be negative: byte b = -30; long x = b &lt;&lt; 24; System.out.printf("x = %d\n", x); // prints -503316480 On other hand if you convert byte to long everything'll turn out okay: byte b = -30; long x = (b &amp; 0xffL) &lt;&lt; 24; System.out.printf("x = %d\n", x); // prints 3791650816 To convert byte to "unsigned" (remember, there is no unsigned stuff in Java) long value use: long tVar = ((shaBytes[0] &amp; 0xffL) &lt;&lt; 24) + ((shaBytes[1] &amp; 0xffL) &lt;&lt; 16) + etc This'll work because Java long is 64-bit and can handle 24 left shift of 8-bit value without signed/unsigned problems.
has comment: http://stackoverflow.com/comment/31993917
accepted answer of: http://stackoverflow.com/q/21237454
answers question: http://stackoverflow.com/q/21237454
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/21307140
has body: I can't parse the title and the date of each article in this page: www.multiplayer.it. I tried in this way: protected String doInBackground(String... params) { try { Document doc = Jsoup.connect(BLOG_URL).get(); Elements nodeBlogStats = doc.select("div.news-col-0"); //per multiplayer.it Elements nodeBlogStats = doc.select("div.news-col-0 h3"); per ftv #comunePartINI &gt; option for(Element sezione : nodeBlogStats) { Element info = sezione.getElementsByClass("news-box-category").first(); String dataarticolo = info.getElementsByClass("news-box-date").first().text(); String titolo = info.getElementsByTag("h3").first().text(); titoli.add(titolo); data.add(dataarticolo); } } catch (Exception e) { // In caso di errore Log.e("ERROR", "PARSING ERROR"); } I can't understand how can i extract these two datas.
answer count: 1
tagged with: parsing
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21307170
tagged with: android
tagged with: java
type: Question
has title: Wrong parsing jsoup
tagged with: jsoup
score: 0

http://stackoverflow.com/a/21208627
downvote count: 0
score: 74
has body: I'd like to add a couple of things to @ejbs's answer. First of all, you concerned 2 separate issues: Java vs. C++ performance OpenCV vs JavaCV Java vs. C++ performance is a long, long story. On one hand, C++ programs are compiled to a highly optimized native code. They start quickly and run fast all the time without pausing for garbage collection or other VM duties (as Java do). On other hand, once compiled, program in C++ can't change, no matter on what machine they are run, while Java bytecode is compiled "just-in-time" and is always optimized for processor architecture they run on. In modern world, with so many different devices (and processor architectures) this may be really significant. Moreover, some JVMs (e.g. Oracle Hotspot) can optimize even the code that is already compiled to native code! VM collect data about program execution and from time to time tries to rewrite code in such a way that it is optimized for this specific execution. So in such complicated circumstances the only real way to compare performance of implementations in different programming languages is to just run them and see the result. OpenCV vs. JavaCV is another story. First you need to understand stack of technologies behind these libraries. OpenCV was originally created in 1999 in Intel research labs and was written in C. Since that time, it changed the maintainer several times, became open source and reached 3rd version (upcoming release). At the moment, core of the library is written in C++ with popular interface in Python and a number of wrappers in other programming languages. JavaCV is one of such wrappers. So in most cases when you run program with JavaCV you actually use OpenCV too, just call it via another interface. But JavaCV provides more than just one-to-one wrapper around OpenCV. In fact, it bundles the whole number of image processing libraries, including FFmpeg, OpenKinect and others. (Note, that in C++ you can bind these libraries too). So, in general it doesn't matte…
accepted answer of: http://stackoverflow.com/q/21207755
answers question: http://stackoverflow.com/q/21207755
has comment: http://stackoverflow.com/comment/71718160
type: AcceptedAnswer
upvote count: 74
type: Answer
has comment: http://stackoverflow.com/comment/31939540

http://stackoverflow.com/a/21233115
answers question: http://stackoverflow.com/q/21233053
score: 0
has body: Here your MainActivity must extends FragmentActivity So Change public class MainActivity extends FragmentActivity{ }
type: Answer

http://stackoverflow.com/q/21311248
has answer: http://stackoverflow.com/a/21311343
has comment: http://stackoverflow.com/comment/32120052
has answer: http://stackoverflow.com/a/21311289
score: 8
downvote count: 0
has title: How do i replace an array with an arraylist?
type: UnansweredQuestion
favorite count: 0
upvote count: 8
type: Question
linked to: http://stackoverflow.com/q/157944
has comment: http://stackoverflow.com/comment/32120453
duplicate of: http://stackoverflow.com/q/157944
answer count: 2
has body: How do I replace the following array with an ArrayList. Employee[] companyTeam = {manager, engineer1, superviso1, accountant, intern };
tagged with: java

http://stackoverflow.com/comment/41769179
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21306457
has text: I would use the BitmapFont class directly, or extend the class to do what you need to do with it. You can call BitmapFont.setColor(Color) to change the color of the font itself. There's a new module for reading TTF fonts too if you need to scale your font according to variable size or something.
score: 0

jsp
tags question: http://stackoverflow.com/q/21260209
tags question: http://stackoverflow.com/q/21258739
tags question: http://stackoverflow.com/q/21217935
tags question: http://stackoverflow.com/q/21320335
tags question: http://stackoverflow.com/q/21314159
tags question: http://stackoverflow.com/q/21342293
tags question: http://stackoverflow.com/q/21218371
tags question: http://stackoverflow.com/q/21303847
tags question: http://stackoverflow.com/q/21252685
tags question: http://stackoverflow.com/q/21265211
tags question: http://stackoverflow.com/q/21306407
tags question: http://stackoverflow.com/q/21338715
tags question: http://stackoverflow.com/q/21226327
tags question: http://stackoverflow.com/q/21208493
tags question: http://stackoverflow.com/q/21250935
tags question: http://stackoverflow.com/q/21216433
tags question: http://stackoverflow.com/q/21260318
tags question: http://stackoverflow.com/q/21304471
tags question: http://stackoverflow.com/q/21185151
tags question: http://stackoverflow.com/q/21253505
tags question: http://stackoverflow.com/q/21349737
tags question: http://stackoverflow.com/q/21301366
tags question: http://stackoverflow.com/q/21294436
tags question: http://stackoverflow.com/q/21236705
tags question: http://stackoverflow.com/q/21198203
tags question: http://stackoverflow.com/q/21298238
tags question: http://stackoverflow.com/q/21210444
tags question: http://stackoverflow.com/q/21326214
tags question: http://stackoverflow.com/q/21329850
tags question: http://stackoverflow.com/q/21305258
tags question: http://stackoverflow.com/q/21279636
tags question: http://stackoverflow.com/q/21331000
tags question: http://stackoverflow.com/q/21247835
tags question: http://stackoverflow.com/q/21274485
tags question: http://stackoverflow.com/q/21190818
tags question: http://stackoverflow.com/q/21220211
tags question: http://stackoverflow.com/q/21329071
tags question: http://stackoverflow.com/q/21222085
tags question: http://stackoverflow.com/q/21308536
tags question: http://stackoverflow.com/q/21292566
tags question: http://stackoverflow.com/q/21201004
tags question: http://stackoverflow.com/q/21302219
tags question: http://stackoverflow.com/q/21232592
tags question: http://stackoverflow.com/q/21202763
tags question: http://stackoverflow.com/q/21196043
tags question: http://stackoverflow.com/q/21294301
tags question: http://stackoverflow.com/q/21259191
tags question: http://stackoverflow.com/q/21326832
tags question: http://stackoverflow.com/q/21239025
type: Tag
tags question: http://stackoverflow.com/q/21241729
tags question: http://stackoverflow.com/q/21217413
tags question: http://stackoverflow.com/q/21227028
tags question: http://stackoverflow.com/q/21276059
tags question: http://stackoverflow.com/q/21256851
tags question: http://stackoverflow.com/q/21216400
tags question: http://stackoverflow.com/q/21185455
tags question: http://stackoverflow.com/q/21257464
tags question: http://stackoverflow.com/q/21268050
tags question: http://stackoverflow.com/q/21263795
tags question: http://stackoverflow.com/q/21339996
tags question: http://stackoverflow.com/q/21277512
tags question: http://stackoverflow.com/q/21255009
tags question: http://stackoverflow.com/q/21228425
tags question: http://stackoverflow.com/q/21262593
tags question: http://stackoverflow.com/q/21205906
tags question: http://stackoverflow.com/q/21323914
tags question: http://stackoverflow.com/q/21337549
tags question: http://stackoverflow.com/q/21300060
tags question: http://stackoverflow.com/q/21283341
tags question: http://stackoverflow.com/q/21190153
tag name: jsp
tags question: http://stackoverflow.com/q/21276965
tags question: http://stackoverflow.com/q/21193769
tags question: http://stackoverflow.com/q/21286933
tags question: http://stackoverflow.com/q/21324599
tags question: http://stackoverflow.com/q/21330218
tags question: http://stackoverflow.com/q/21282400
tags question: http://stackoverflow.com/q/21276904
tags question: http://stackoverflow.com/q/21206732

tablespace
tags question: http://stackoverflow.com/q/21190283
type: Tag
tag name: tablespace

entitymanager
tags question: http://stackoverflow.com/q/21265850
tag name: entitymanager
type: Tag
tags question: http://stackoverflow.com/q/21257947
tags question: http://stackoverflow.com/q/21290807
tags question: http://stackoverflow.com/q/21246488

http://stackoverflow.com/comment/32058842
has text: Im just parsing my xmlfile in my document : Document xmlDocument = builder.parse(file);
type: AnswerComment
comment on: http://stackoverflow.com/a/21260247
score: 0
type: Comment

http://stackoverflow.com/comment/32049201
score: 0
has text: See [JButton background image](http://stackoverflow.com/questions/17110315/jbutton-background-image)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21270656

android
tags question: http://stackoverflow.com/q/21337085
tags question: http://stackoverflow.com/q/21220019
tags question: http://stackoverflow.com/q/21279141
tags question: http://stackoverflow.com/q/21274366
tags question: http://stackoverflow.com/q/21325472
tags question: http://stackoverflow.com/q/21305482
tags question: http://stackoverflow.com/q/21262554
tags question: http://stackoverflow.com/q/21200286
tags question: http://stackoverflow.com/q/21275002
tags question: http://stackoverflow.com/q/21319769
tags question: http://stackoverflow.com/q/21233631
tags question: http://stackoverflow.com/q/21325991
tags question: http://stackoverflow.com/q/21345740
tags question: http://stackoverflow.com/q/21331704
tags question: http://stackoverflow.com/q/21323080
tags question: http://stackoverflow.com/q/21317426
tags question: http://stackoverflow.com/q/21292853
tags question: http://stackoverflow.com/q/21242378
tags question: http://stackoverflow.com/q/21281553
tags question: http://stackoverflow.com/q/21313813
tags question: http://stackoverflow.com/q/21348899
tags question: http://stackoverflow.com/q/21216943
tags question: http://stackoverflow.com/q/21334592
tags question: http://stackoverflow.com/q/21344338
tags question: http://stackoverflow.com/q/21328393
tags question: http://stackoverflow.com/q/21215633
tags question: http://stackoverflow.com/q/21209440
tags question: http://stackoverflow.com/q/21211974
tags question: http://stackoverflow.com/q/21213431
tags question: http://stackoverflow.com/q/21281131
tags question: http://stackoverflow.com/q/21197802
tags question: http://stackoverflow.com/q/21209369
tags question: http://stackoverflow.com/q/21278675
tags question: http://stackoverflow.com/q/21239053
tags question: http://stackoverflow.com/q/21198836
tags question: http://stackoverflow.com/q/21347750
tags question: http://stackoverflow.com/q/21269998
tags question: http://stackoverflow.com/q/21299496
tags question: http://stackoverflow.com/q/21331277
tags question: http://stackoverflow.com/q/21184351
tags question: http://stackoverflow.com/q/21219008
tags question: http://stackoverflow.com/q/21283636
tags question: http://stackoverflow.com/q/21280303
tags question: http://stackoverflow.com/q/21339569
tags question: http://stackoverflow.com/q/21259621
tags question: http://stackoverflow.com/q/21192675
tags question: http://stackoverflow.com/q/21197009
tags question: http://stackoverflow.com/q/21246481
tags question: http://stackoverflow.com/q/21238122
tags question: http://stackoverflow.com/q/21329711
tags question: http://stackoverflow.com/q/21316366
tags question: http://stackoverflow.com/q/21211143
tags question: http://stackoverflow.com/q/21273866
tags question: http://stackoverflow.com/q/21337389
tags question: http://stackoverflow.com/q/21223593
tags question: http://stackoverflow.com/q/21202806
tags question: http://stackoverflow.com/q/21191306
tags question: http://stackoverflow.com/q/21331205
tags question: http://stackoverflow.com/q/21222872
tags question: http://stackoverflow.com/q/21250436
tags question: http://stackoverflow.com/q/21185450
tags question: http://stackoverflow.com/q/21278860
tags question: http://stackoverflow.com/q/21330303
tags question: http://stackoverflow.com/q/21276265
tags question: http://stackoverflow.com/q/21247883
tags question: http://stackoverflow.com/q/21211169
tags question: http://stackoverflow.com/q/21303516
tags question: http://stackoverflow.com/q/21240824
tags question: http://stackoverflow.com/q/21272665
tags question: http://stackoverflow.com/q/21212674
tags question: http://stackoverflow.com/q/21222250
tags question: http://stackoverflow.com/q/21307224
tags question: http://stackoverflow.com/q/21302999
tags question: http://stackoverflow.com/q/21323353
tags question: http://stackoverflow.com/q/21265391
tags question: http://stackoverflow.com/q/21298660
tags question: http://stackoverflow.com/q/21268058
tags question: http://stackoverflow.com/q/21338580
tags question: http://stackoverflow.com/q/21326331
tags question: http://stackoverflow.com/q/21310506

http://stackoverflow.com/q/21290438
has title: TX-row lock contention : Inserting Duplicate values for Unique Key
tagged with: locking
answer count: 1
has comment: http://stackoverflow.com/comment/32091422
has answer: http://stackoverflow.com/a/21294090
has comment: http://stackoverflow.com/comment/32090448
tagged with: jobs
score: 0
tagged with: oracle-database
type: UnansweredQuestion
has body: We are getting a TX-row lock contention error while trying to insert data It happens while running a job which processes an xml with almost 10000 records, inserting the data into a table We are having a unique key constraint on one of the columns in the table, and in the request we are getting duplicate values. This is causing the locks and thereby the job is taking more time. We are using hibernate and spring. The DAO method we use is hibernate template's 'save' annotated with Spring Transaction Manager's @Transactional Any suggestions please?
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/32087559
has comment: http://stackoverflow.com/comment/32083809
type: Question

http://stackoverflow.com/q/21348555
upvote count: 12
score: 12
answer count: 3
downvote count: 0
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/21349132
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/18655541
has title: How bridge method works?
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/21348674
has answer: http://stackoverflow.com/a/21348639
has body: I am new to java.I still feel I have to understand a lot so if this question seems stupid forgive me. Now I was going through http://docs.oracle.com/javase/tutorial/java/generics/bridgeMethods.html Here I found a lot of confusion . public class Node&lt;T&gt; { public T data; public Node(T data) { this.data = data; } public void setData(T data) { System.out.println("Node.setData"); this.data = data; } } public class MyNode extends Node&lt;Integer&gt; { public MyNode(Integer data) { super(data); } public void setData(Integer data) { System.out.println("MyNode.setData"); super.setData(data); } public static void main(String[] args) { MyNode mn = new MyNode(5); Node n = mn; // A raw type - compiler throws an unchecked warning n.setData("Hello"); // Causes a ClassCastException to be thrown. Integer x = mn.data; } } When I ran this code I got below error Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer at MyNode.setData(MyNode.java:1) at MyNode.main(MyNode.java:14) Below are the confusions 1) Why is it showing line number 1 2) If you read through the blog they say that the type erasure will replace type parameter will replace above code as below public class Node { private Object data; public Node(Object data) { this.data = data; } public void setData(Object data) { System.out.println("Node.setData"); this.data = data; } } public class MyNode extends Node { public MyNode(Integer data) { super(data); } public void setData(Integer data) { System.out.println(data); super.setData(data); } public static void main(String[] args) { MyNode mn = new MyNode(5); Node n = mn; // A raw type - compiler throws an unchecked warning n.setData("Hello"); // Causes a ClassCastException to be thrown. //Integer x = mn.data } } when I run the above code I get no error , code runs fine from the documentation both r same ? why this different in behavior now other most important question on oop is when we extend one class and when we cal…
type: Question

http://stackoverflow.com/q/21335084
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32163270
has comment: http://stackoverflow.com/comment/32163107
has comment: http://stackoverflow.com/comment/32162555
score: 0
has title: Add and trace unhearable Noises or Markers to a Video Clip
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32163017
has body: I'm trying to write an application which adds some noises (or markers) to various parts of a Video Clip and trigger an action once a section (marker) been reached. I think using technologies like Audio Stenography cannot help this purpose. As far I understood it, It hides a text value in unused sections of a WAV file and extract them from a file. I also learned that any frequencies under 20 Hz and upper 20KHz cannot be heared by a human ear. Using a Audio Analysis library like musicg, gave me an idea to recognize and encode those frequencies with some algorithms like FFT and trigger an action based on that encoded unhearable frequency. That was all I could find out after a week of investigation and unfortunately don't know further and will appreciate if somebody have had a similar experience in this field and can help me.
tagged with: video
tagged with: audio
answer count: 0

http://stackoverflow.com/a/21208744
type: Answer
has body: Finally got the answer try increasing the size of the JLabel array by 1 and run it will work fine import javax.swing.JFrame; import javax.swing.JLabel; public class Labelss{ public static void main(String[] args) { JFrame frame = new JFrame(); frame.setBounds(50, 50, 700, 550); JLabel[] userLabel = new JLabel[6]; for(int p = 0; p &lt; userLabel.length; p++){ userLabel[p] = new JLabel(); } userLabel[0].setBounds(10,35,100,50); userLabel[1].setBounds(10,85,100,50); userLabel[2].setBounds(10,135,100,50); userLabel[3].setBounds(10,185,100,50); userLabel[4].setBounds(10,235,100,50); userLabel[0].setText("Width of Frame:"); userLabel[1].setText("Height of Frame:"); userLabel[2].setText("# OF Balls:"); userLabel[3].setText("Color:"); userLabel[4].setText("Stack overflow:"); for(int p = 0; p &lt; userLabel.length; p++){ frame.add(userLabel[p]); } frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/31941307
score: -1
answers question: http://stackoverflow.com/q/21208396

http://stackoverflow.com/q/21281414
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21291730
tagged with: swing
type: Question
tagged with: java
has title: Java Fill image into Label
upvote count: 2
answer count: 2
has body: I have a fixed size label to display image. How do I have the image resized to fit into the label, filled up. My current code below, is setting the label to the image size, I want it the other way round. Code ImageIcon icon = new ImageIcon(bi); Label.setIcon(icon); Dimension imageSize = new Dimension(icon.getIconWidth(), icon.getIconHeight()); Label.setPreferredSize(imageSize); Label.revalidate(); Label.repaint();
tagged with: awt
favorite count: 0
tagged with: imageicon
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21282346

http://stackoverflow.com/a/21284840
upvote count: 2
has body: Now I found the error. All I needed was to use the full address for the User DN. So I think that 'member' attribute for the group must have the full address. So both DN looks like this now: encodedGroupDn = "cn=GROUP_SKL, ou=roles" encodedUserDn = "cn=user_dfh, ou=external, ou=main, dc=nr, dc=company, dc=local" And that works!
type: Answer
accepted answer of: http://stackoverflow.com/q/21263789
score: 2
answers question: http://stackoverflow.com/q/21263789
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/55922160
type: QuestionComment
comment on: http://stackoverflow.com/q/21213143
type: Comment
has text: I have same problem, have you found solution?
score: 0

http://stackoverflow.com/comment/32100891
score: 2
comment on: http://stackoverflow.com/q/21300132
has text: Use a different data structure, or keep your array sorted.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21329326
has answer: http://stackoverflow.com/a/21330640
type: Question
score: 3
tagged with: android
favorite count: 0
tagged with: httpresponsecache
has title: java.lang.NoClassDefFoundError with HttpResponseCache and DiskLruCache
accepted answer: http://stackoverflow.com/a/21330640
answer count: 1
has body: I´m trying test this cache Library in a new project Android. When I run the project, I get this Logcat: 01-24 03:45:31.109: E/AndroidRuntime(1983): FATAL EXCEPTION: main 01-24 03:45:31.109: E/AndroidRuntime(1983): Process: com.test_cache, PID: 1983 01-24 03:45:31.109: E/AndroidRuntime(1983): java.lang.NoClassDefFoundError: com.jakewharton.DiskLruCache 01-24 03:45:31.109: E/AndroidRuntime(1983): at com.integralblue.httpresponsecache.compat.libcore.net.http.HttpResponseCache.&lt;init&gt;(HttpResponseCache.java:83) 01-24 03:45:31.109: E/AndroidRuntime(1983): at com.integralblue.httpresponsecache.HttpResponseCache.&lt;init&gt;(HttpResponseCache.java:155) 01-24 03:45:31.109: E/AndroidRuntime(1983): at com.integralblue.httpresponsecache.HttpResponseCache.install(HttpResponseCache.java:192) 01-24 03:45:31.109: E/AndroidRuntime(1983): at com.test_cache.MainActivity.onCreate(MainActivity.java:21) 01-24 03:45:31.109: E/AndroidRuntime(1983): at android.app.Activity.performCreate(Activity.java:5243) 01-24 03:45:31.109: E/AndroidRuntime(1983): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 01-24 03:45:31.109: E/AndroidRuntime(1983): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140) 01-24 03:45:31.109: E/AndroidRuntime(1983): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226) 01-24 03:45:31.109: E/AndroidRuntime(1983): at android.app.ActivityThread.access$700(ActivityThread.java:135) 01-24 03:45:31.109: E/AndroidRuntime(1983): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397) 01-24 03:45:31.109: E/AndroidRuntime(1983): at android.os.Handler.dispatchMessage(Handler.java:102) 01-24 03:45:31.109: E/AndroidRuntime(1983): at android.os.Looper.loop(Looper.java:137) 01-24 03:45:31.109: E/AndroidRuntime(1983): at android.app.ActivityThread.main(ActivityThread.java:4998) 01-24 03:45:31.109: E/AndroidRuntime(1983): at java.lang.reflect.Method.invokeNative(Native Method) 01-24 03:45:3…
upvote count: 3
tagged with: java
tagged with: noclassdeffounderror
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/21323498
type: Answer
answers question: http://stackoverflow.com/q/21323367
has body: It seems exchanging subclass with superclass would seem appropriate here. No type-check would be required this way. If your some other functionality is being broken due to this (I assume you are at an early design phase in your project), then I'd recommend you to seriously reconsider design. Hope this helps. Good luck.
score: 0

http://stackoverflow.com/comment/31978694
score: 0
has text: http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21230853

http://stackoverflow.com/a/21278402
has body: Put an L on the end of the literal. 0x80000009L is 2147483657. Note that a lower case l works too, but I don't recommend it because in many fonts, it looks like the number one.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21278332
has comment: http://stackoverflow.com/comment/32062505
score: 8
answers question: http://stackoverflow.com/q/21278332
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/32062481

http://stackoverflow.com/comment/32027869
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21238908
score: 0
has text: @Gordon thanks for that thorough answer. As you mentioned it is not the usual use case. I'm trying to set up an out of the box, no deployment/installation message/simple analytic engine.

http://stackoverflow.com/a/21255963
upvote count: 2
has body: As far as I am aware, you can't use a jar file that's in WebContent\WEB-INF in a Java agent. From that location it's only accessible to Java classes for XPages etc. If you add it directly to the agent or a Script Library, it should work.
has comment: http://stackoverflow.com/comment/32034217
accepted answer of: http://stackoverflow.com/q/21255263
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21255263
type: Answer
has comment: http://stackoverflow.com/comment/32114142
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32023094
has comment: http://stackoverflow.com/comment/32022939

http://stackoverflow.com/q/21340823
linked to: http://stackoverflow.com/q/14548998
has body: I'm new to Java environment and I want to know: 1) How to apply external HTML or CSS files to jsp pages(Web Application using NetBeans) 2) Is there any 'MasterPage' alternative feature in Java? Thanks in advance.
score: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
tagged with: netbeans
type: UnansweredQuestion
has title: How to apply external HTML or CSS templating to jsp pages (NetBeans)
has answer: http://stackoverflow.com/a/21341369
tagged with: css
tagged with: java
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/comment/31974050
type: Comment
has text: Tip: Indent your code and don't put huge blocks of code inside `case`s in your `switch`. Design your code and split it into small parts.
score: 0
comment on: http://stackoverflow.com/q/21228066
type: QuestionComment

http://stackoverflow.com/comment/32040472
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21263559
has text: It should be the exact same as printing the other one.
score: 0

word-boundary
tags question: http://stackoverflow.com/q/21274040
tag name: word-boundary
type: Tag

http://stackoverflow.com/comment/31942290
comment on: http://stackoverflow.com/a/21210153
score: 0
type: Comment
has text: Ok yeah check your folder for a new image.
type: AnswerComment

http://stackoverflow.com/q/21236857
has answer: http://stackoverflow.com/a/21236896
possible better answer: http://stackoverflow.com/a/21236933
type: AnsweredQuestion
has body: I want to have a method that would click a certain key public void pressKey ( KeyEvent keyName ) { // what class must keyName belong to ? this.robot.keyPress(KeyEvent.keyName); this.robot.keyRelease(KeyEvent.keyName); Thread.sleep(100); } It should work as a shorcut for example pressKey(VK_ENTER); But I tried to look up those VK_ codes and still do not know to what class do the keycodes belong ?
has answer: http://stackoverflow.com/a/21236933
tagged with: java
accepted answer: http://stackoverflow.com/a/21236896
type: Question
has title: Are the "VK_..." keyCodes methods or objects?
tagged with: keycode
score: 0
answer count: 2

http://stackoverflow.com/a/21234759
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21234674
has comment: http://stackoverflow.com/comment/31985617
has body: Try without additional phases: mvn exec:java -Dexec.mainClass="com.example.DatasetReader" or adding classpath scope from runtime: mvn exec:java -Dexec.mainClass="com.example.DatasetReader" -Dexec.classpathScope=runtime

http://stackoverflow.com/a/21332046
answers question: http://stackoverflow.com/q/21207037
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21207037
has comment: http://stackoverflow.com/comment/32173985
has comment: http://stackoverflow.com/comment/32163858
type: AcceptedAnswer
downvote count: 0
has body: After much searching and testing we've found only these two ways for a Java Web Start app, properly signed with a trusted 3rd party cert, to be deployed under JRE 1.7.0_51 &amp; display the expected Security dialog (with "Do not show this again..." check-box): 1) Add href= with the launch file self-reference as you describe above, e.g: jnlp spec="1.0+" codebase="http://some.dn.com/OurAppHome/" href="launch.jnlp" Which is not straight forward for sites that generate the JNLP through, say ASP, or under other condtions like you note above. 2) The proper thing: JAR manifest such that it shows no Missing Blah-Blah-Blah manifest attribute in console log. The minimal additional manifest attributes for 7u51 we've found must be present (*s as test values): Permissions: all-permissions Codebase: * Application-Library-Allowable-Codebase: * So our working full build script test manifest looks something like this (version is generated): &lt;manifest&gt; &lt;attribute name="Application-Name" value="Our App Name"/&gt; &lt;attribute name="Main-Class" value="com.whatever.main.AppLoader"/&gt; &lt;attribute name="Class-Path" value="./Corejar.jar ./Support.jar"/&gt; &lt;attribute name="Built-By" value="${user.name}"/&gt; &lt;attribute name="Permissions" value="all-permissions"/&gt; &lt;attribute name="Codebase" value="*"/&gt; &lt;attribute name="Application-Library-Allowable-Codebase" value="*"/&gt; &lt;attribute name="Trusted-Only" value="true"/&gt; &lt;attribute name="Specification-Title" value="Our App Name"/&gt; &lt;attribute name="Specification-Version" value="${version}"/&gt; &lt;attribute name="Specification-Vendor" value="Our Company Name"/&gt; &lt;/manifest&gt;
has comment: http://stackoverflow.com/comment/32174246
type: Answer
has comment: http://stackoverflow.com/comment/43828332
score: 2

http://stackoverflow.com/comment/31897315
comment on: http://stackoverflow.com/q/21185322
type: Comment
type: QuestionComment
has text: @Jorge_B , More Information also looks fine it has no any warning
score: 0

http://stackoverflow.com/a/21237533
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21232815
score: 1
has body: Do you really need an EntityManager? Grails/Gorm accesses hibernate through Session and SessionFactory instead of using the JPA specification. You can inject the sessionFactory bean in your grails code using def sessionFactory
downvote count: 0

http://stackoverflow.com/comment/32038130
has text: Is child_id the string variable and also it would be more helpful for us if you show your Model classes
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21263170

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

http://stackoverflow.com/q/21322152
answer count: 1
has body: I'm writing a client-server chat program using UDP. If either the client or the server sends a message, and the next message they send is shorter than the previous one they sent, part of the longer message will be put onto the end of the shorter one. This is my first time using UDP and I've no idea what could be causing this, I made a similiar program using TCP and didn't have this issue. What the client sees: Client: Hello, how are you? Server: I'm good thanks, and you? Client: Great What the server sees: Client: Hello, how are you? Server: I'm good thanks, and you? Client: Great, how are you? My server code: public class ChatServer implements Runnable { public static void main(String[] args) throws Exception { new Thread(new ChatServer()).start(); } @Override public void run() { try { BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in)); DatagramSocket serverSocket = new DatagramSocket(9876); byte[] receiveData = new byte[65508]; byte[] sendData = new byte[65508]; System.out.println("Enter a username: "); String serverUsername = inFromUser.readLine(); System.out.println("Send message..."); while(true) { DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); serverSocket.receive(receivePacket); String clientSentence = new String(receivePacket.getData()); System.out.println(clientSentence); InetAddress IPAddress = receivePacket.getAddress(); int port = receivePacket.getPort(); System.out.print("Me: "); String serverSentence = serverUsername + ": " + inFromUser.readLine(); sendData = serverSentence.getBytes(); DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, port); serverSocket.send(sendPacket); } } catch (IOException ex) { Logger.getLogger(ChatServer.class.getName()).log(Level.SEVERE, null, ex); } } } My client code: public class ChatClient { public static void main(String[] args) throws Exception { BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21323594
score: 0
tagged with: java
has title: Java UDP Chat Program: Part of first message gets appended onto second
type: Question
tagged with: chat
accepted answer: http://stackoverflow.com/a/21323594
tagged with: udp

http://stackoverflow.com/a/21209628
has comment: http://stackoverflow.com/comment/56773142
type: Answer
has comment: http://stackoverflow.com/comment/64486477
has body: You can add an accelerator key in scene builder or add it directly in the fxml file like so <?import javafx.scene.input.*?> ... KeyCodeCombination has two constructors, second example: If by "in javafx" you mean without using fxml you can use mnuSave.setAccelerator(KeyCombination);
upvote count: 19
score: 19
answers question: http://stackoverflow.com/q/21209461
has comment: http://stackoverflow.com/comment/64489404
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21209461
has comment: http://stackoverflow.com/comment/56773112

http://stackoverflow.com/comment/32148705
type: Comment
has text: @assylias, where can I see the implementation code of sum?
comment on: http://stackoverflow.com/q/21313525
score: 0
type: QuestionComment

http://stackoverflow.com/a/21341020
type: Answer
has body: No, it does not alter it. You will have the Android SDKs on their own folders and has nothing to do with JDK.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21339570
upvote count: 1

http://stackoverflow.com/comment/31943505
has text: `menuButton.setBounds(250, 410, 137, 23);` Java GUIs might have to work on a number of platforms, on different screen resolutions & using different PLAFs. As such they are not conducive to exact placement of components. To organize the components for a robust GUI, instead use layout managers, or [combinations of them](http://stackoverflow.com/a/5630271/418556), along with layout padding & borders for [white space](http://stackoverflow.com/q/17874717/418556).
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21211042

http://stackoverflow.com/a/21244788
score: 12
type: Answer
has body: It seems that eclipse noticed the path of the JAR file was within the path of an open project in the workspace. However that project had not been refreshed since the JAR was added, thus it did not show up in the file tree of the project. From here my best guess is that Eclipse used its stale snapshot of the file tree rather than the actual one from disk in determining if the JAR file existed or not. After refreshing the appropriate folder/project, the JAR resolved correctly in the User Library.
upvote count: 12
accepted answer of: http://stackoverflow.com/q/21242581
answers question: http://stackoverflow.com/q/21242581
has comment: http://stackoverflow.com/comment/79383220
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32166926
type: AnswerComment
has text: I created a new project under a new package, and copied and pasted the codes and it worked fine. Using the "refactored copy" worked perfectly. I wonder what happened in the last day on my computer to make it like that, when i did not use the eclipse program in the last couple days...works perfect now...
comment on: http://stackoverflow.com/a/21337143
score: 0
type: Comment

http://stackoverflow.com/comment/32074387
score: 1
has text: How did you "try the terminal window"? Like "less" or something? You _really_ need a tool that displays HEX.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21285080

http://stackoverflow.com/a/22871825
has comment: http://stackoverflow.com/comment/35019213
has comment: http://stackoverflow.com/comment/34923932
has body: If the tests are run in client JVM, you can probably use system properties. For example, with maven it could be: $ mvn test -Ddeployment.url=http://whatever And in test code: String url = System.getProperty("deployment.url", "http://defaulturl");
has comment: http://stackoverflow.com/comment/34971387
has comment: http://stackoverflow.com/comment/34963181
downvote count: 0
has comment: http://stackoverflow.com/comment/35020418
type: Answer
score: 1
answers question: http://stackoverflow.com/q/21329134
has comment: http://stackoverflow.com/comment/34930051
upvote count: 1

http://stackoverflow.com/comment/31917970
score: 2
comment on: http://stackoverflow.com/q/21196653
has text: it's that semicolon on the `else if(odd.equals("AT417"));` line
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21340622
answers question: http://stackoverflow.com/q/21340408
has body: You could secure the server side with SSL and require a client side certificate. When you distribute the source code, do not distribute the certificate that the code is using to communicate with the server. Modified versions of the app would then have to create their own certificate to communicate with the server and the server could determine what certificate was used to establish the SSL connection.
type: Answer
has comment: http://stackoverflow.com/comment/32173210
has comment: http://stackoverflow.com/comment/32173292
score: 0
has comment: http://stackoverflow.com/comment/32173506
has comment: http://stackoverflow.com/comment/32173304

http://stackoverflow.com/q/21215262
has answer: http://stackoverflow.com/a/21215368
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/31950878
has comment: http://stackoverflow.com/comment/33742351
upvote count: 2
has comment: http://stackoverflow.com/comment/31950969
has answer: http://stackoverflow.com/a/21215360
has comment: http://stackoverflow.com/comment/31950875
answer count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/31950822
has body: To be honest i am really struggling with Java, i am trying to access an array from another class. I believe i have created the array in this code public class aff_array { String name; public static void main (String[] args) { int z = 3; //total no of affirmations int x = 1; aff_array[] afz = new aff_array[z]; //dim while ( x &lt; z ) { afz[x] = new aff_array(); // create objects for array x = x + 1; } afz[1].name = "i am the best"; afz[2].name = "you are the rest"; } but i am really having trouble trying to figure out how i access afz[1].name for example, from another class. This is probably basic but i am really struggling..
favorite count: 0
has answer: http://stackoverflow.com/a/21222301
type: UnansweredQuestion
score: 1
tagged with: java
has title: how to reference array from another class

http://stackoverflow.com/comment/32140867
comment on: http://stackoverflow.com/a/21283721
type: Comment
has text: Sadly it was white-spaces in the web.xml org.springframework.web.context.support.AnnotationConfigWebApplicationContext
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32076189
comment on: http://stackoverflow.com/a/21286395
score: 0
type: AnswerComment
type: Comment
has text: to get 0.9, you have to do as Henry Keiter says...

http://stackoverflow.com/a/21235652
downvote count: 0
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21235241
type: Answer
accepted answer of: http://stackoverflow.com/q/21235241
has body: The full output (some context what plugin is having problems) would be useful. I'm not entirely sure, but I think that the jaxws maven plugin is missing the classes, not your application, so you should add the dependency to that plugin, not your application. EDIT: OP's code from comment for better read/copy/paste-ability org.codehaus.mojo jaxws-maven-plugin <...> com.sun tools 1.7 system ${java.home}/../lib/tools.jar
score: 2

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

http://stackoverflow.com/comment/32097444
type: QuestionComment
has text: Yeah, iterating over a list while editing it at the same time is tricky business.
score: 0
comment on: http://stackoverflow.com/q/21297925
type: Comment

http://stackoverflow.com/comment/32117605
has text: Mr.Abdul, actually i am executing this stored procedure in other schema. I want to execute this stored procedure in other schema not in same schema. Can you get me?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21309928
type: Comment

http://stackoverflow.com/q/21219039
upvote count: 17
type: Question
tagged with: java
score: 17
has answer: http://stackoverflow.com/a/21221016
tagged with: sqlite
downvote count: 0
answer count: 1
favorite count: 0
has body: I'am using an SQLite database and I regularly get runtime errors I can't find the origin of. After a query, I use moveToFirst to point on the first record retrieved and this sometimes triggers an android.database.CursorWindowAllocationException exception. Added to this exception is the following sentence : "Cursor window allocation of 2048kb failed.# open Cursors=736 (#cursors opendby this proc=736)". In the Android documentation, I haven't found anything related to this exception yet. Does anyone know it's cause and a way to avoid it?
has title: android.database.CursorWindowAllocationException when moving a Cursor
tagged with: android
accepted answer: http://stackoverflow.com/a/21221016
type: AnsweredQuestion
tagged with: android-cursor

http://stackoverflow.com/a/21226469
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21226086
has comment: http://stackoverflow.com/comment/31971184
answers question: http://stackoverflow.com/q/21226086
upvote count: 2
has body: See JComboBox.addItemListener(ItemListener). It works reliably on mouse or keyboard selection.
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/21202675
score: 6
has body: I would use a loop. public static &lt;T&gt; void swap(List&lt;T&gt; list1, List&lt;T&gt; list2, int from, int to) { for(int i = from; i &lt; to; i++) list2.set(i, list1.set(i, list2.get(i)); }
has comment: http://stackoverflow.com/comment/31928600
type: Answer
accepted answer of: http://stackoverflow.com/q/21202647
upvote count: 6
answers question: http://stackoverflow.com/q/21202647
has comment: http://stackoverflow.com/comment/31928966
has comment: http://stackoverflow.com/comment/31928951
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31975559
comment on: http://stackoverflow.com/q/21228425
type: Comment
score: 2
has text: what do you mean with `all the values are coming as a one value`? Any screenshot?
type: QuestionComment

http://stackoverflow.com/comment/31947159
type: QuestionComment
has text: Why do you use blocking queue? Should threads updating the price be blocked?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21211858

http://stackoverflow.com/q/21289139
has answer: http://stackoverflow.com/a/21289266
answer count: 4
type: AnsweredQuestion
downvote count: 0
has body: Im currently working on a java GUI. Now my question is, how to combine a switch statement with a for loop in a proper way. The current way is working, but it requires a lot of time to type the statement. public void labelSwitchCase(int i, int userInput) { // switch case on i switch (i) { case 0: gridLabels[i].setText("" + userInput); break; case 1: gridLabels[i].setText("" + userInput); break; case 2: gridLabels[i].setText("" + userInput); break; case 3: gridLabels[i].setText("" + userInput); break; case 4: gridLabels[i].setText("" + userInput); break; case 5: gridLabels[i].setText("" + userInput); break; case 6: gridLabels[i].setText("" + userInput); break; case 7: gridLabels[i].setText("" + userInput); break; case 8: gridLabels[i].setText("" + userInput); break; // no defoult } }
accepted answer: http://stackoverflow.com/a/21289200
possible better answer: http://stackoverflow.com/a/21289266
score: 1
tagged with: java
tagged with: switch-statement
type: Question
has answer: http://stackoverflow.com/a/21289200
has answer: http://stackoverflow.com/a/21289346
has comment: http://stackoverflow.com/comment/32081147
has answer: http://stackoverflow.com/a/21289436
has comment: http://stackoverflow.com/comment/32081361
has comment: http://stackoverflow.com/comment/32081183
upvote count: 1
tagged with: user-interface
favorite count: 0
has title: Combine switch statement with a for loop

http://stackoverflow.com/a/21307489
type: Answer
accepted answer of: http://stackoverflow.com/q/21273866
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21273866
type: AcceptedAnswer
has body: Instead of using sleep for 40 seconds and then checking you can use waitForExists API of UiObject. UiObject wifi = new UiObject(new UiSelector().text("Successfull")); boolean result = wifi.waitForExists(40000);//40 secs specified as timeout in ms if(!result){ //View not found in 40 secs // throw error } wifi.clickAndWaitForNewWindow(); Hope this will help !!
upvote count: 1

http://stackoverflow.com/q/21204242
tagged with: java
type: Question
score: 3
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31931179
favorite count: 0
has answer: http://stackoverflow.com/a/21204263
has body: If an object is going to be serialized will it be possible to serialize its data member(which are also objects that is composition). If yes then in which order the state of those objects will be retrieved?
has title: Serialization Concept In Java with Composition
upvote count: 3
type: UnansweredQuestion

http://stackoverflow.com/a/21242909
answers question: http://stackoverflow.com/q/21242664
downvote count: 0
type: Answer
upvote count: 3
has body: The OS tries to divide the CPU equally among the threads. Instead of the loop waiting for the winner, I would use a CountDownLatch or something like this, because your findWinner is competes for the CPU together with the runners.
score: 3

http://stackoverflow.com/q/21256327
type: AnsweredQuestion
downvote count: 0
score: 1
has body: I have downloaded the Upcoming Events portlet and I have done a few changes and I deployed the portlet to Liferay 6.2. I get this error: Unable to compile class for JSP: An error occurred at line: [36] in the generated java file: [D:\Liferay\Test\tomcat-7.0.42\work\Catalina\localhost\upcoming-events-portlet\org\apache\jsp\view_jsp.java] Only a type can be imported. com.liferay.portlet.calendar.service.CalEventServiceUtil resolves to a package An error occurred at line: 79 in the jsp file: /view.jsp CalEventServiceUtil cannot be resolved The line 36 of generated file: import com.liferay.portlet.calendar.service.CalEventServiceUtil; The line 79 of /view.jsp: lstEvents = CalEventServiceUtil.getEvents(scopeGroupId, gregCal, new String()); I have to add some library to project, but which one? Any help is appreciated! Thank you!
tagged with: java
has comment: http://stackoverflow.com/comment/32025335
type: Question
tagged with: liferay
has answer: http://stackoverflow.com/a/21256434
has title: CalEventServiceUtil cannot be resolved
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/32027456
favorite count: 0
possible better answer: http://stackoverflow.com/a/21256434
has answer: http://stackoverflow.com/a/23422355
has answer: http://stackoverflow.com/a/21261936
accepted answer: http://stackoverflow.com/a/21261936

http://stackoverflow.com/comment/31916443
type: AnswerComment
has text: The == is just a brainfart.. i did know that :D.... But thanks! with practice i wont make these dumb mistakes (hopefully :D) And with regards to the method in the if statement, i was unsure, so it is nice to know i cannot do it like that. Good idea with the method that checks if player is elligible.
comment on: http://stackoverflow.com/a/21195746
type: Comment
score: 0

http://stackoverflow.com/a/21347914
has comment: http://stackoverflow.com/comment/32213780
score: 0
accepted answer of: http://stackoverflow.com/q/21347811
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21347811
has comment: http://stackoverflow.com/comment/32209827
type: Answer
has comment: http://stackoverflow.com/comment/32189251
has comment: http://stackoverflow.com/comment/32186689
has body: you can use this code: change onCreate... private View mMainView; @Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); mMainView = getLayoutInflater().inflate(R.layout.activity_app_share, null); setContentView(mMainView); } public void fillTextView(View view,int resId, String text) { TextView textElement = (TextView) view.findViewById(resId); textElement.setText(text); } call function: fillTextView(mMainView,R.id.affirmation , "i love you");

http://stackoverflow.com/q/21258739
score: 1
tagged with: java
upvote count: 1
type: Question
has body: How can I call a specific method in a class using this tag? &lt;jsp:useBean id="user" scope="??" class="com.example.User" type="com.example.User" /&gt;
has comment: http://stackoverflow.com/comment/32027951
has answer: http://stackoverflow.com/a/21258945
answer count: 2
tagged with: jstl
has title: jsp:useBean call a specific method in a class
downvote count: 0
has comment: http://stackoverflow.com/comment/32029219
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/21276512
tagged with: el
accepted answer: http://stackoverflow.com/a/21258945
possible better answer: http://stackoverflow.com/a/21276512
type: AnsweredQuestion

http://stackoverflow.com/comment/32197215
score: 0
comment on: http://stackoverflow.com/a/21349132
type: Comment
has text: @sumedha Which 2nd example are you talking about? If it's the one in your question, then no it's not really a replica of a bridge method. There is no bridge method there. Remember, **the bridge method is created in the subclasses**.
type: AnswerComment

http://stackoverflow.com/comment/31958429
type: AnswerComment
comment on: http://stackoverflow.com/a/21219421
type: Comment
has text: That does make a lot of sense! Thanks!
score: 0

http://stackoverflow.com/comment/32139537
type: Comment
comment on: http://stackoverflow.com/a/21272015
score: 0
type: AnswerComment
has text: I just edited the original post, I used pretty much what you posted and it helped alot! However, once I got it to read off, it always comes out as either 0, or if i do a for loops such as (x = 0; x <=10; x++) it comes out as 11 (for example.)

c#
tags question: http://stackoverflow.com/q/21278681
tags question: http://stackoverflow.com/q/21286742
tag name: c#
tags question: http://stackoverflow.com/q/21192292
tags question: http://stackoverflow.com/q/21188176
tags question: http://stackoverflow.com/q/21279357
tags question: http://stackoverflow.com/q/21239077
tags question: http://stackoverflow.com/q/21249739
tags question: http://stackoverflow.com/q/21190705
tags question: http://stackoverflow.com/q/21292566
tags question: http://stackoverflow.com/q/21244694
tags question: http://stackoverflow.com/q/21285072
tags question: http://stackoverflow.com/q/21282318
type: Tag
tags question: http://stackoverflow.com/q/21257032
tags question: http://stackoverflow.com/q/21269727

http://stackoverflow.com/comment/31928966
type: Comment
has text: Yeah, it is definitely understandable!
score: 0
comment on: http://stackoverflow.com/a/21202675
type: AnswerComment

http://stackoverflow.com/q/21250411
type: Question
score: -2
answer count: 1
has body: I want to use some image in my application. But, I do not want to hard code the image path because where ever I stored the application it should works. I tried to use getClass().getResource and getClass().getClassLoader().getResource but in both cases I am getting NULL. here is the actual path for the image: C:\JDeveloper\mywork\MyApplication\ViewController\public_html\resources\images\img.gif and here is the actual path for the class I am working with: C:\JDeveloper\mywork\MyApplication\ViewController\src\view\MyClassBean So both the class and the image in the same project ViewController here is the output statements from MyClassBean Class: System.out.println("1. "+ getClass()); System.out.println("2. "+ getClass().getClassLoader()); System.out.println("----------------------------------------------------------------------------------------------------------------------------"); System.out.println("1. "+ getClass().getClassLoader().getResource("img.gif") ); System.out.println("2. "+ getClass().getClassLoader().getResource("/img.gif") ); System.out.println("3. "+ getClass().getClassLoader().getResource("images/img.gif") ); System.out.println("4. "+ getClass().getClassLoader().getResource("/images/img.gif") ); System.out.println("5. "+ getClass().getClassLoader().getResource("resources/images/img.gif") ); System.out.println("6. "+ getClass().getClassLoader().getResource("/resources/images/img.gif") ); System.out.println("7. "+ getClass().getClassLoader().getResource("public_html/resources/images/img.gif") ); System.out.println("8. "+ getClass().getClassLoader().getResource("/public_html/resources/images/img.gif") ); System.out.println("9. "+ getClass().getClassLoader().getResource("ViewController/public_html/resources/images/img.gif") ); System.out.println("10. "+ getClass().getClassLoader().getResource("/ViewController/public_html/resources/images/img.gif") ); System.out.println("11. "+ getClass().getClassLoader().getResource("myApplication/ViewController/public_htm…
has comment: http://stackoverflow.com/comment/32013403
has answer: http://stackoverflow.com/a/21250811
favorite count: 0
has title: getClass().getResource and getClass().getClassLoader().getResource return Null
tagged with: classloader
type: UnansweredQuestion
upvote count: 1
tagged with: java
downvote count: 3

http://stackoverflow.com/a/21667521
type: Answer
answers question: http://stackoverflow.com/q/21338125
has body: There are many arguments to be made for changing the visibility. But just think about the fact that you would be changing the interface (in the sense of API) of that class. Read up on evolving APIs and associate that information to your question. So in my book good practise would be to not change the visibility - if at all possible. Otherwise you have to carefully consider the consequences - if only in the long run.
score: 0

http://stackoverflow.com/q/21344049
tagged with: annotations
has comment: http://stackoverflow.com/comment/32179803
has comment: http://stackoverflow.com/comment/32179754
type: Question
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21408693
has title: Compound Validation annotations
has body: I would like the group some annotation in one and then need that the annotations work fine with Hibernate-validator and the generate-ddl utily of Hibernate I have a bunch of entities and most of then had similar fields. For example: @Entity public class Usuario implements Serializable { @Column(name = "ID", nullable = false) @Id private Long id; @GeneratedValue(strategy = GenerationType.SEQUENCE) @Column(name = "CODIGO", nullable = false) @NotNull private Integer code; @Column(name = "NOMBRE", length = 75, nullable = false) @NotNull @Size(max = 75) private String name; @Column(name = "CLAVE", length = 75, nullable = false) @NotNull @Size(max = 75) private String password; @Column(name = "ES_ADMINISTRADOR") @NotNull @Type(type = "org.hibernate.type.NumericBooleanType") private Boolean isAdmin; [...] } And I want have something like this other @Entity public class Usuario implements Serializable { @Column(name = "ID", nullable = false) @Id private Long id; @GeneratedValue(strategy = GenerationType.SEQUENCE) @CodeField private Integer code; @Column(name = "NOMBRE") @NameField private String name; @Column(name = "CLAVE", length = 75, nullable = false) @NotNull @Size(max = 75) private String password; @Column(name = "ES_ADMINISTRADOR") @BooleanField private Boolean isAdmin; [...] } Can I do that?
tagged with: hibernate-validator
possible better answer: http://stackoverflow.com/a/22769685
has answer: http://stackoverflow.com/a/22769685
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/21408693

http://stackoverflow.com/a/21287151
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21286966
upvote count: 2
has body: How do I check if an ArrayList contains the same number since it is random? Like this (example): public void drawNumbers() { Random random = new Random (); int counter = 0; while (counter &lt; 7) { int newNumber = random.nextInt(39) + 1; if (! numbers.contains(newNumber)) { this.numbers.add(newNumber); counter++; } } }
downvote count: 0

http://stackoverflow.com/comment/32077702
type: AnswerComment
score: 0
type: Comment
has text: Wait. So you want real-time functionality, but you aren't using a realtime OS or something like JamaicaVM?
comment on: http://stackoverflow.com/a/21198208

http://stackoverflow.com/a/21299035
downvote count: 0
score: 1
has body: try new View.OnClickListener()
has comment: http://stackoverflow.com/comment/32099388
has comment: http://stackoverflow.com/comment/32099424
has comment: http://stackoverflow.com/comment/32099453
upvote count: 1
has comment: http://stackoverflow.com/comment/32099341
has comment: http://stackoverflow.com/comment/32099164
has comment: http://stackoverflow.com/comment/32099448
answers question: http://stackoverflow.com/q/21299010
type: Answer

http://stackoverflow.com/q/21271480
has body: as the title says. I have two classes, one that makes a "player", and another that makes a "team", which includes an arraylist of players. one of my methods in the team class is howmanyallstars, where I try to see how many allstars there are on the team, but I'm getting an error on my boolean. public class Player { private String nameofplayer; private int currentposition; private double baverage; private boolean allstar; public Player (String name, int position, double battingaverage, boolean isallstar) { nameofplayer = name; currentposition = position; baverage = battingaverage; allstar = isallstar; } then I have: public class Team { private String nameteam; private static ArrayList roster; private double priceofgame; private double budget; private int numberofgames; public Team (String teamname, ArrayList teamroster, double price, double teambudget, int games) { nameteam = teamname; roster = teamroster; priceofgame = price; budget = teambudget; numberofgames = games; } public static int numberOfAllstars(Team name) { int rostersize = roster.size(); int numofallstars = 0; for (int counter = 0; counter &lt;= rostersize; counter++) { if (roster.get(counter).allstar == true) numofallstars++; } return numofallstars; } as I said, the .allstar is being flagged, and I don't know how to fix it. Can someone please help?
tagged with: arraylist
has comment: http://stackoverflow.com/comment/32051082
has answer: http://stackoverflow.com/a/21271645
answer count: 5
has answer: http://stackoverflow.com/a/21271568
has title: How can I access a part of an object that is part of an ArrayList?
has answer: http://stackoverflow.com/a/21271554
possible better answer: http://stackoverflow.com/a/21271566
has answer: http://stackoverflow.com/a/21271566
has answer: http://stackoverflow.com/a/21271551
type: AnsweredQuestion
tagged with: object
accepted answer: http://stackoverflow.com/a/21271568
tagged with: java
has comment: http://stackoverflow.com/comment/32050995
tagged with: class
type: Question
score: 0

http://stackoverflow.com/comment/32153325
has text: Try Java 8. With Java 7 there are some issues.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21329234

http://stackoverflow.com/comment/32176904
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21340968
has text: Another thought, if that's the case, would be to use an activity instead of a dialog fragment, and just use a translucent floating activity theme.

http://stackoverflow.com/q/21332162
tagged with: swing
type: Question
tagged with: jtextarea
score: 1
tagged with: java
tagged with: jscrollpane
accepted answer: http://stackoverflow.com/a/21332229
answer count: 1
downvote count: 0
has title: How to make one JScrollPane connected to two components?,workaround
tagged with: rowheader
favorite count: 0
has body: I'm aware that JViewport is a single-child container,and also that I cant add multiple components to one jscrollpane. But can I track position of scrollpane and according to it modify view of another component? To show what im trying to do here is a image: here is my code: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import java.awt.SystemColor; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.UIManager; import javax.swing.border.MatteBorder; import javax.swing.text.BadLocationException; import javax.swing.text.Utilities; public class XMLSettingsPage extends JPanel { private int lines; private LinePanel linePanel; private JPanel southButtP; private JButton saveBtn = new JButton("Save"); private JButton resetBtn = new JButton("Reset"); private JScrollPane jsp; private JTextArea textArea; private JPanel panel; public XMLSettingsPage() { setBackground(Color.BLACK); setLayout(new BorderLayout()); panel = new JPanel(); add(panel, BorderLayout.CENTER); panel.setLayout(new BorderLayout(0, 0)); linePanel = new LinePanel(); panel.add(linePanel, BorderLayout.WEST); linePanel.setForeground(Color.GRAY); linePanel.setFont(new Font("Tahoma", Font.PLAIN, 13)); linePanel.setBackground(SystemColor.inactiveCaptionBorder); textArea = new JTextArea(); textArea.setCaretColor(Color.BLACK); textArea.setFont(new Font("Tahoma", Font.PLAIN, 13)); textArea.setForeground(Color.BLACK); textArea.setBackground(UIManager.getColor("menu")); textArea.addKeyListener(new LinePanel() { @Override public void keyPressed(KeyEvent e) { linePanel.setLine(getLines()); } }); textArea.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { southButtP.setVisi…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32157440
has answer: http://stackoverflow.com/a/21332229
upvote count: 1

http://stackoverflow.com/comment/31957395
has text: @nhgrif: Yes, you are right. Look [here](http://dev.mysql.com/doc/refman/5.0/en/datetime.html).
comment on: http://stackoverflow.com/q/21218887
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21192868
score: 1
has body: Calling a method on a null object causes a NullPointerException. In your case if obj = null, then when you call concatAll, things will be null as well. You then try and call things.length which is not valid on a null object. You can make this method safer by checking the input of strings first. What you want to do exactly will depend on your situation, but here is one example. static String concatAll(Object[] things) { if (things == null) { return ""; } StringBuffer result = new StringBuffer(); for (int i = 0; i &lt; things.length; i++) { result.append( things[i] ); } String x = result.toString(); return x; }
answers question: http://stackoverflow.com/q/21192788
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/31926700
type: Comment
has text: Please read my comment. You **should** get an error, your code is **not** "technically correct"
comment on: http://stackoverflow.com/q/21201520
score: 0
type: QuestionComment

http://stackoverflow.com/q/21324468
type: AnsweredQuestion
has title: Why Joda DateTime gives different result than Java Date?
has body: I tested Joda DateTime against java.util.Date with UTC timezone, and I encountered an interesting case: import org.joda.time.DateTime; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; import java.util.Date; public class Main { public static void main(String[] args) throws ParseException { String dt = "2011-06-11T12:00:00Z"; String format = "yyyy-MM-dd'T'hh:mm:ss'Z'"; DateFormat df = new SimpleDateFormat(format); df.setTimeZone(TimeZone.getTimeZone("UTC")); Date d = df.parse(dt); DateTime joda = new DateTime(dt); // Output Sat Jun 11 05:00:00 PDT 2011 System.out.println(joda.toDate()); // Output Fri Jun 10 17:00:00 PDT 2011 System.out.println(d); } } I wonder is this a bug to either one or I missed something important here?
downvote count: 0
has comment: http://stackoverflow.com/comment/32147389
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/32144303
score: 5
tagged with: datetime
tagged with: datetime-parsing
has answer: http://stackoverflow.com/a/21324649
answer count: 2
has answer: http://stackoverflow.com/a/79407134
linked to: http://stackoverflow.com/q/19112357
upvote count: 5
tagged with: java
tagged with: date
possible better answer: http://stackoverflow.com/a/79407134
tagged with: jodatime
accepted answer: http://stackoverflow.com/a/21324649

http://stackoverflow.com/q/21345177
downvote count: 0
has body: The most recent version of the maven plugin has enabled updating of code every 5s, which is a great improvement. But unless I am configuring this wrong, it doesn't seem to pick up static file changes such as work in progress Javascript connecting to the appengine code. Is there any way to alter this behavior or do I just need to wait for a new release?
upvote count: 8
answer count: 3
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/24602308
favorite count: 0
score: 8
type: UnansweredQuestion
tagged with: maven
has title: Is there any way to trigger the Maven Appengine Devserver to auto-refresh static files?
tagged with: java
has answer: http://stackoverflow.com/a/24624192
has answer: http://stackoverflow.com/a/28099880
type: Question

http://stackoverflow.com/q/21296022
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21296277
tagged with: android
score: 1
upvote count: 1
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/7257449
tagged with: random
has comment: http://stackoverflow.com/comment/32094251
answer count: 1
downvote count: 0
has body: I have an app that has a square that moves around the screen every 1.5 seconds and every time you click it you get a point. I'm trying to make it where every you click the square the color changes to a random color. Also, I want to have an option under settings for a harder mode where the square moves every .7 seconds. Here is my draw method: protected void onDraw(Canvas canvas) { canvas.drawColor(Color.BLUE); Paint dotPaint = new Paint(); canvas.drawRect(dotX, dotY, dotX + 60, dotY + 60, dotPaint); dotPaint.setColor(Color.WHITE); dotPaint.setTextSize(60); canvas.drawText("Score: " + score, 20, 60, dotPaint); and here is my onTouch method: public boolean onTouch(View v, MotionEvent event) { if (detectHit( (int)event.getX(), (int)event.getY() )) { score++; invalidate(); } return false; I'm not too sure how to go about making the color of the square change every click. Also, here is my menu items: public boolean onOptionsItemSelected(MenuItem item) { // handle menu item selection switch (item.getItemId()){ case R.id.item1: newGame(); return true; case R.id.item2: quit(); return true; case R.id.item3: harder(); return true; default: return super.onOptionsItemSelected(item); and my harder method: public void harder(){ timer.schedule(task, 0, 700); }
favorite count: 0
tagged with: timer
tagged with: colors
has title: Java Android App Random Color and Timer

http://stackoverflow.com/comment/32068503
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21281850
has text: thanks for reply, I need to find the exact location of WEB-INF folder
score: 0

http://stackoverflow.com/comment/31999040
comment on: http://stackoverflow.com/q/21242075
type: Comment
type: QuestionComment
has text: why do you need nodejs? can not you use just javascript?
score: 0

http://stackoverflow.com/q/21268190
has title: paintComponent method mixes different JPanel components
favorite count: 0
has body: I'm developing a software which paints 2 different JPanel for my GUI: a score and a mast guitar. The score is a class which extends JPanel and has paintComponent() method like this: public class PanelPartitura extends JPanel implements MouseListener{ public void paintComponent(Graphics comp){ super.paintComponent(comp); comp2D = (Graphics2D)comp; comp2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); paintBackground(); paintStave(); paintNotes(); [...] } } The mast guitar is a class as well: public class PanelGuitarra extends JPanel implements MouseListener public void paintComponent(Graphics comp){ super.paintComponent(comp); comp2D = (Graphics2D)comp; comp2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //Then I call secondary methods to paint it: paintBackground(); PaintPoints(); } [...] } It still works fine. I add the class PanelPartitura to a JScrollPane in order to scroll when it's playing: partitura = new PanelPartitura(); JScrollPartitura = new JScrollPane(partitura, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); Both JPanels mix each others painted components when the software is playing and scrolling. I would like to ask, if somebody has a clue about what on earth is going on? In my opinion: It could be because I separated the painting methods as we've seen above: paintBackground(); paintStave(); paintNotes(); then, when the software starts to paint, it paints some parts of the first JPanel (paintBackground() for example) and then some parts of the mast guitar (paintBackground()), then it changes again and the result is a mixture of both. I think this is because it mixes different parts every time, I mean it doesn't behave in the same way every time it plays. I really don't want this to be happening, so let me ask you: how can I make atomic methods to be sure this wouldn't be the problem? I missunderstood the scroll method. I scroll on this way: …
tagged with: paintcomponent
tagged with: paint
has answer: http://stackoverflow.com/a/21269161
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
tagged with: jpanel
type: Question
tagged with: jscrollpane
downvote count: 0
answer count: 1

listener
tags question: http://stackoverflow.com/q/21319058
tags question: http://stackoverflow.com/q/21290238
tags question: http://stackoverflow.com/q/21219494
tags question: http://stackoverflow.com/q/21235194
type: Tag
tag name: listener
tags question: http://stackoverflow.com/q/21226046
tags question: http://stackoverflow.com/q/21293930

http://stackoverflow.com/comment/32048520
comment on: http://stackoverflow.com/a/21269161
type: AnswerComment
has text: Good guess. According to the description and the posted snippets, it's very likely that there's a call to `getGraphics` somewhere in the (omitted part of the) code, and this would explain the rendering bugs
type: Comment
score: 0

http://stackoverflow.com/a/21256075
answers question: http://stackoverflow.com/q/21255699
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: You can create a serializable wrapper around Button and implement custom serialization in it. You will be saving buttons properties in writeObject, read them back and recreated Buttons in readObject

http://stackoverflow.com/q/21339902
has comment: http://stackoverflow.com/comment/32172370
score: 0
answer count: 1
tagged with: variables
has title: Accessing global variables from Android JAR
has body: I have an Android library project which is used by several Android application projects. A library jar (having .class files) is attached to the project and located in the lib folder. I am trying to set the variable com.utility.Commons.outgoingSIP (string) to the variable located inside the jar. Declared inside Commons.java: public static String outgoingSIP = ""; Here is a code snipplet: public void sendMessage(SIPMessage sipMessage, InetAddress receiverAddress, int receiverPort) throws IOException { long time = System.currentTimeMillis(); byte[] bytes = sipMessage.encodeAsBytes(this.getTransport()); sendMessage(bytes, receiverAddress, receiverPort, sipMessage instanceof SIPRequest); Commons.outgoingSIP = receiverAddress.toString(); But the variable never changes. I imported it at the top too (import com.utility.Commons). The library and source are also attached otherwise the program wouldn't compile: From inside the jar I can also CTRL + CLICK the Commons.outgoingSIP variable and it will take me to commons.java. So eclipse KNOWS which variable I'm talking about. Am I missing something? Can someone please give me some advice.
accepted answer: http://stackoverflow.com/a/21340105
tagged with: android
tagged with: class-library
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21340105
has comment: http://stackoverflow.com/comment/32172497
has comment: http://stackoverflow.com/comment/32172601

http://stackoverflow.com/a/21237546
accepted answer of: http://stackoverflow.com/q/21232250
answers question: http://stackoverflow.com/q/21232250
type: AcceptedAnswer
upvote count: 5
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/32017914
has body: From my understanding to your question, you need to do the following : 1) Index you data (titles in your case) first you need to implement the code that create that index for you data, check this sample of code. Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT); // Store the index in memory: //Directory directory = new RAMDirectory(); Store an index on disk Directory directory = FSDirectory.open(indexfilesDirPathOnYourServer); IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_CURRENT, analyzer); IndexWriter iwriter = new IndexWriter(directory, config); Document doc = new Document(); String title = getTitle(); doc.add(new Field("fieldname", text, TextField.TYPE_STORED)); iwriter.addDocument(doc); iwriter.close(); here you need to loop over you all data. 2) Search for you indexed data. you can search for you data by using this code: DirectoryReader ireader = DirectoryReader.open(indexfilesDirPathOnYourServer); IndexSearcher isearcher = new IndexSearcher(ireader); // Parse a simple query that searches for "text": QueryParser parser = new QueryParser(Version.LUCENE_CURRENT, "fieldname", analyzer);//note here we used the same analyzer object Query query = parser.parse("test");//test is am example for a search query ScoreDoc[] hits = isearcher.search(query, null, 1000).scoreDocs; // Iterate through the results: for (int i = 0; i &lt; hits.length; i++) { Document hitDoc = isearcher.doc(hits[i].doc); System.out.println(hitDoc.get("fieldname")); } ireader.close(); directory.close(); Note : here you don't have to fetch all the data from your DB, you can directly get it from index. also you don't have to re-create the whole index each time user search or fetch the data, you can update the title from time to time when you add/update or delete one by one (the title that have been updated or deleted not the whole indexed titles). to update index use : Term keyTerm = new Term(KEY_FIELD, KEY_VALUE); iwriter.updateDocument(keyTerm, updatedFields); to del…
score: 5

http://stackoverflow.com/comment/32002842
has text: Can you insert into the table via mysql workbench without specifying actorID?
comment on: http://stackoverflow.com/q/21244110
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21240970
score: 1
has body: can setContentView get input other than xml layout? Yes. See the documentation for the different methods it has. Besides taking a layout resource id, it can also take a View (which is what is happening in your example) or a View and params. what does the following line means context.setContentView(mCardScrollView); As stated in a comment this is the View that will be set on the Window for the current Activity. If you are inside of an Activity method, such as onCreate() you do not need to use the Context variable since it already has a Context.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21240882
type: Answer
answers question: http://stackoverflow.com/q/21240882
upvote count: 1

http://stackoverflow.com/q/21246451
has comment: http://stackoverflow.com/comment/32007030
has answer: http://stackoverflow.com/a/21246529
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32007040
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21246515
has body: An interviewer asked me how to find the largest number in a random array. I answered that loop the whole array to find the largest number but he said it would take too much time. I wonder if there is a better solution for it. Any suggestion?
has answer: http://stackoverflow.com/a/21246828
has comment: http://stackoverflow.com/comment/32007043
favorite count: 0
answer count: 6
has comment: http://stackoverflow.com/comment/32007334
has comment: http://stackoverflow.com/comment/32007167
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/32007100
has comment: http://stackoverflow.com/comment/32007027
has comment: http://stackoverflow.com/comment/32007032
has answer: http://stackoverflow.com/a/21246483
has title: What is the best way to find the largest number in a random array?
tagged with: java
has answer: http://stackoverflow.com/a/21246482
has answer: http://stackoverflow.com/a/21246491

http://stackoverflow.com/a/21299036
type: Answer
answers question: http://stackoverflow.com/q/21288235
downvote count: 0
score: 1
has body: Looking in Maven Central, the version released in 2009 does not have sources available, but the one from 2008 is certainly available. Looking at the source, there's two versions of the constructor that takes a bean: JSONObject(Object bean) { ... } and JSONObject(Object bean, boolean includeSuperClass) { ... } I'm guessing you can surmise what includeSuperClass is for. The first, single argument version is not scanning the superclass. The 2013 release is changed to where that is the default behavior and the second version of the constructor was eliminated.
has comment: http://stackoverflow.com/comment/32116623
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21288235

http://stackoverflow.com/q/21292867
has comment: http://stackoverflow.com/comment/32087952
has answer: http://stackoverflow.com/a/21293609
tagged with: java
has comment: http://stackoverflow.com/comment/32268573
type: UnansweredQuestion
tagged with: jackson
has body: Does Jackson provide a means of saving the configuration of an ObjectMapper and then recreating it from this saved information? In my particular case, I need to be able to record along with some data what modules were in use by the mapper when the data was written so that the same modules can be loaded for deserialization. Update The reason for this is the need to store some data with the sequence of transformations that was applied to create that data. All of these transformations implement a known interface, but otherwise nothing is known about them and many different ones will be implemented by users. When serializing, it may be necessary to load modules in order to serialize some of the transformations. We'd like to be able to deserialize these transformations later in order to transform new data in the same way as the existing data, but without knowing what modules were loaded into the ObjectMapper, deserialization may fail.
has title: Save the Configuration of a Jackson ObjectMapper
downvote count: 0
score: 1
favorite count: 0
tagged with: serialization
has comment: http://stackoverflow.com/comment/32090324
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/32295091
answer count: 1

http://stackoverflow.com/comment/32324914
score: 0
has text: Sorry, did I say override? I didn't do anything of that sort. I just did the above call. When I said full signature, I meant method call to full signature method.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21308504

apache-camel
tags question: http://stackoverflow.com/q/21309081
tags question: http://stackoverflow.com/q/21298195
tags question: http://stackoverflow.com/q/21197112
tags question: http://stackoverflow.com/q/21297150
tags question: http://stackoverflow.com/q/21250540
tag name: apache-camel
tags question: http://stackoverflow.com/q/21302322
tags question: http://stackoverflow.com/q/21295316
tags question: http://stackoverflow.com/q/21258313
tags question: http://stackoverflow.com/q/21292341
tags question: http://stackoverflow.com/q/21221085
tags question: http://stackoverflow.com/q/21294160
tags question: http://stackoverflow.com/q/21270709
tags question: http://stackoverflow.com/q/21307221
tags question: http://stackoverflow.com/q/21300927
tags question: http://stackoverflow.com/q/21317519
type: Tag

http://stackoverflow.com/a/21291291
has body: There are a couple of issues currently in your code. The first issue is that your second button is being defined inside the first button's declaration. The next issue is that you're setting the second OnClickListener to the wrongly named button. You've made a typo and instead of PageTwo, which you've called the Button (presumably you wanted to call it PageTwoButton in accordance with the first Button) and then set the OnClickListener to PageTwoButton instead. Seeing as you're also using multiple Buttons, it's a lot cleaner and more efficient to use a GroupOnClickListener. I'd probably also suggest using 'this' instead of 'v.getContext()' as well when setting up your Intents. Change your code to be like so: Button PageOneButton = (Button) findViewById(R.id.btnPageOne); Button PageTwoButton = (Button) findViewById(R.id.btnPageTwo); PageOneButton.setOnClickListener(addGroupOnClickListener); PageTwoButton.setOnClickListener(addGroupOnClickListener); private OnClickListener addGroupOnClickListener = new OnClickListener() { public void onClick(View v) { if (v == PageOneButton) { Intent myIntent = new Intent(Main.this, PageOne.class); startActivity(myIntent); } else if (v == PageTwoButton) { Intent myIntent = new Intent(Main.this, PageTwo.class); startActivity(myIntent); } } }; Hope this helps!
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21290974
downvote count: 0

http://stackoverflow.com/comment/32162045
comment on: http://stackoverflow.com/a/21334775
type: AnswerComment
score: 0
type: Comment
has text: Didn't I do that by: ikkevenner = new Person[kjenner.length];

http://stackoverflow.com/a/21229111
has comment: http://stackoverflow.com/comment/31980623
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21228252
answers question: http://stackoverflow.com/q/21228252
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/61958056
has body: JFreeChart can do most things, this should get you started (I'll probably incorporate the center text feature into the upcoming 1.0.18 release so that the subclassing isn't necessary): package org.jfree.chart.demo; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GradientPaint; import java.awt.Graphics2D; import java.awt.Point; import java.awt.geom.Rectangle2D; import javax.swing.JPanel; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PiePlotState; import org.jfree.chart.plot.RingPlot; import org.jfree.chart.title.TextTitle; import org.jfree.data.general.DefaultPieDataset; import org.jfree.data.general.PieDataset; import org.jfree.text.TextUtilities; import org.jfree.ui.ApplicationFrame; import org.jfree.ui.HorizontalAlignment; import org.jfree.ui.RectangleInsets; import org.jfree.ui.RefineryUtilities; import org.jfree.ui.TextAnchor; /** * A simple demonstration application showing how to create a ring chart using * data from a {@link DefaultPieDataset}. */ public class RingChartDemo1 extends ApplicationFrame { private static final long serialVersionUID = 1L; static class CustomRingPlot extends RingPlot { private Font centerTextFont; private Color centerTextColor; public CustomRingPlot(PieDataset dataset) { super(dataset); this.centerTextFont = new Font(Font.SANS_SERIF, Font.BOLD, 24); this.centerTextColor = Color.LIGHT_GRAY; } @Override protected void drawItem(Graphics2D g2, int section, Rectangle2D dataArea, PiePlotState state, int currentPass) { super.drawItem(g2, section, dataArea, state, currentPass); if (currentPass == 1 &amp;&amp; section == 0) { Number n = this.getDataset().getValue(section); g2.setFont(this.centerTextFont); g2.setPaint(this.centerTextColor); TextUtilities.drawAlignedString(n.toString(), g2, (float) dataArea.getCenterX(), (float) dataArea.getCenterY(), TextAnchor.CENTER); } } } /** * Default constructor. * * @param title the frame title. */ public RingCh…
has comment: http://stackoverflow.com/comment/31975783
score: 6

http://stackoverflow.com/comment/31958164
has text: no problem buddy, you can vote afterwards when you get required points for this. ;)
type: Comment
comment on: http://stackoverflow.com/a/21219281
type: AnswerComment
score: 0

http://stackoverflow.com/a/21214874
has comment: http://stackoverflow.com/comment/31950494
has comment: http://stackoverflow.com/comment/31950328
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21214571
type: Answer
has body: Should the rock paper scissors logic be handled in the model, or should the logic be handled in the controller? One of the issues with MVC logic in Swing is that the place where the code resides is not always the place where the code is executed. The rock / paper / scissors logic will be executed as a part of the controller. The code will more likely reside in the model class, as that's where the values of the players choice of rock, paper, or scissors will be found. What is the "proper" way to link my GamePanel with my Game data that comes from the model? You'll have an instance of the Game data for each active game you have. You can store them in a List, as the order of the games is important. Your List would be defined in another model class, say AllGames. There would be one instance of AllGames, which would be passed to your Swing classes for them to use to retrieve game values. Take a look at this article, Dice Game, to see how the MVC architecture is used in a more elaborate game.
has comment: http://stackoverflow.com/comment/31950213
upvote count: 1

http://stackoverflow.com/q/21219388
has title: Java Virtual Machine crashes Multiple times
has comment: http://stackoverflow.com/comment/32042712
tagged with: crash
has comment: http://stackoverflow.com/comment/32012541
has comment: http://stackoverflow.com/comment/31958435
has comment: http://stackoverflow.com/comment/31965428
tagged with: runtime-error
has comment: http://stackoverflow.com/comment/31958319
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31958391
has comment: http://stackoverflow.com/comment/31958600
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31958306
has body: This is the entire error message http://pastebin.com/bDgye0rt The error log is too big that I can't attach it here. I am not extremely familiar with how jvm works in the background and what registers it makes use of. I am hoping someone can look at this error log and explain to me what it means. # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007ffd18cbcafe, pid=29906, tid=140725158119168 # # JRE version: 6.0_27-b27 # Java VM: OpenJDK 64-Bit Server VM (20.0-b12 mixed mode linux-amd64 compressed oops) # Derivative: IcedTea6 1.12.6 # Distribution: Debian GNU/Linux 7.1 (wheezy), package 6b27-1.12.6-1~deb7u1 # Problematic frame: # C [libresolv.so.2+0x7afe] __libc_res_nquery+0x19e # # If you would like to submit a bug report, please include # instructions how to reproduce the bug and visit: # http://icedtea.classpath.org/bugzilla # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # I can't understand why and how it is created. It keeps happening all the time. PS: I have the error log of another 3 crashes that happened in my machine which I can share if you think its necessary. EDIT I have around 8 logs and out of the 8 logs it is made clear that the last call before the program crashes is java.net.Inet6AddressImpl.lookupAllHostAddr I do not believe the input is that much related because there is a static list of inputs that are parsed serially, and the error occurs at different time frames (Sometimes 1 hour after the program has been running and some other times 6 hours, it appears to be random).
has answer: http://stackoverflow.com/a/55841522
score: 2
has comment: http://stackoverflow.com/comment/31959875
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31958282

http://stackoverflow.com/comment/32040252
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21246659
has text: You did just compile it regularly. (Compilation is the "javac" step.) The short answer is classloading. When Java looks for a class, it looks for it starting from each location in your CLASSPATH down the directory tree corresponding to its package - so when a class references another class named "shipment.Shipment", the classloader looks for shipment/Shipment.class under each path in the CLASSPATH. (There's a lot more going on, but that's the quick version) In many configurations (including yours, apparently), CLASSPATH contains the current directory by default.
score: 0

http://stackoverflow.com/a/21205359
downvote count: 0
answers question: http://stackoverflow.com/q/21200056
type: Answer
has body: If your main concern is data integrity and ODBC backend database is ACID-compliant, then you do not need to worry. Simply re-do the transaction after re-establishing the connection, and that will work just fine.
upvote count: 1
score: 1

ant
tags question: http://stackoverflow.com/q/21195911
tags question: http://stackoverflow.com/q/21265111
tags question: http://stackoverflow.com/q/21232142
tags question: http://stackoverflow.com/q/21261539
tags question: http://stackoverflow.com/q/21325572
tags question: http://stackoverflow.com/q/21241721
tags question: http://stackoverflow.com/q/21235811
tags question: http://stackoverflow.com/q/21342342
tags question: http://stackoverflow.com/q/21329483
type: Tag
tags question: http://stackoverflow.com/q/21262338
tags question: http://stackoverflow.com/q/21301799
tags question: http://stackoverflow.com/q/21296620
tags question: http://stackoverflow.com/q/21259346
tags question: http://stackoverflow.com/q/21314199
tags question: http://stackoverflow.com/q/21249205
tags question: http://stackoverflow.com/q/21312041
tag name: ant
tags question: http://stackoverflow.com/q/21212467
tags question: http://stackoverflow.com/q/21243312
tags question: http://stackoverflow.com/q/21257066
tags question: http://stackoverflow.com/q/21328037
tags question: http://stackoverflow.com/q/21313407
tags question: http://stackoverflow.com/q/21299558
tags question: http://stackoverflow.com/q/21303448
tags question: http://stackoverflow.com/q/21230819
tags question: http://stackoverflow.com/q/21263845
tags question: http://stackoverflow.com/q/21317229
tags question: http://stackoverflow.com/q/21209061
tags question: http://stackoverflow.com/q/21269335
tags question: http://stackoverflow.com/q/21247752
tags question: http://stackoverflow.com/q/21324065
tags question: http://stackoverflow.com/q/21328253
tags question: http://stackoverflow.com/q/21231283

http://stackoverflow.com/comment/32008804
score: 0
type: Comment
type: QuestionComment
has text: You can include the min/max number, but they are not needed because they are not in the array. It is part of an assignment, and the teacher wants us to use arrays.
comment on: http://stackoverflow.com/q/21247405

http://stackoverflow.com/comment/32126885
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21315003
has text: ah, I see. maybe a link to generics just for completeness?

http://stackoverflow.com/comment/31957266
type: AnswerComment
type: Comment
has text: i implemented it with your method now. But i have a small problem now. I edited my question. Maybe you could have a look :)
comment on: http://stackoverflow.com/a/21217897
score: 0

jackson
tags question: http://stackoverflow.com/q/21194713
tags question: http://stackoverflow.com/q/21330638
tags question: http://stackoverflow.com/q/21246733
tags question: http://stackoverflow.com/q/21283553
tags question: http://stackoverflow.com/q/21237572
tags question: http://stackoverflow.com/q/21253114
tags question: http://stackoverflow.com/q/21259975
type: Tag
tags question: http://stackoverflow.com/q/21278811
tags question: http://stackoverflow.com/q/21312121
tags question: http://stackoverflow.com/q/21273163
tags question: http://stackoverflow.com/q/21270546
tags question: http://stackoverflow.com/q/21265081
tag name: jackson
tags question: http://stackoverflow.com/q/21288922
tags question: http://stackoverflow.com/q/21206706
tags question: http://stackoverflow.com/q/21290270
tags question: http://stackoverflow.com/q/21345153
tags question: http://stackoverflow.com/q/21287780
tags question: http://stackoverflow.com/q/21259264
tags question: http://stackoverflow.com/q/21247425
tags question: http://stackoverflow.com/q/21197000
tags question: http://stackoverflow.com/q/21192057
tags question: http://stackoverflow.com/q/21292867
tags question: http://stackoverflow.com/q/21270760

http://stackoverflow.com/comment/31977812
has text: In that case try to post [MCVE](http://stackoverflow.com/help/mcve) with reproducing problem, because that should work.
type: AnswerComment
comment on: http://stackoverflow.com/a/21229023
type: Comment
score: 2

http://stackoverflow.com/comment/32026713
comment on: http://stackoverflow.com/q/21258348
type: Comment
type: QuestionComment
has text: What do you have so far? If you only need a DAG with no additional properties then a basic algorithm should suffice.
score: 0

http://stackoverflow.com/comment/44643534
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21191562
has text: Possibke duplicate of http://stackoverflow.com/questions/26459988/is-it-meaningful-for-autocloseables-close-method-to-throw-an-exception-how-sho
score: 0

http://stackoverflow.com/q/21328370
has comment: http://stackoverflow.com/comment/32151410
linked to: http://stackoverflow.com/q/12734303
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21328443
has comment: http://stackoverflow.com/comment/32151013
type: Question
linked to: http://stackoverflow.com/q/11273938
linked to: http://stackoverflow.com/q/11456190
tagged with: eclipse
has answer: http://stackoverflow.com/a/21328922
has body: building a app that will push notification enabled.when i run it on real device app crashes on start let me show u guys my code. MainActivity.java import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.content.SharedPreferences; import static com.my.app.CommonUtilities.SENDER_ID; import android.util.Log; import android.widget.TextView; import com.google.android.gcm.GCMRegistrar; import com.my.app.R; public class MainActivity extends Activity { private String TAG = "** pushAndroidActivity **"; private TextView mDisplay; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); checkNotNull(SENDER_ID, "SENDER_ID"); GCMRegistrar.checkDevice(this); GCMRegistrar.checkManifest(this); setContentView(R.layout.activity_main); mDisplay = (TextView) findViewById(R.id.display); final String regId = GCMRegistrar.getRegistrationId(this); Log.i(TAG, "registration id ===== "+regId); if (regId.equals("")) { GCMRegistrar.register(this, SENDER_ID); } else { Log.v(TAG, "Already registered"); } mDisplay.setText("ffffff"+regId); } and outside onCreate i have private void checkNotNull(Object reference, String name) { if (reference == null) { throw new NullPointerException( getString(R.string.error_config, name)); } } @Override protected void onPause() { super.onPause(); GCMRegistrar.unregister(this); } but when i compile and run it on device app suddenly crashes before even loading MainActivity let me post LogCat here. FATAL EXCEPTION: main java.lang.NoClassDefFoundError: com.google.android.gcm.GCMRegistrar com.my.app.MainActivity.onCreate(MainActivity.java:28) android.app.Activity.performCreate(Activity.java:5008) android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) android.app.ActivityThread.handleLaunchActiv…
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/15055351
linked to: http://stackoverflow.com/q/16824143
has title: GCM on android device and App crashes
has comment: http://stackoverflow.com/comment/32150967
has comment: http://stackoverflow.com/comment/32151041
tagged with: android
tagged with: google-cloud-messaging

http://stackoverflow.com/comment/31945029
comment on: http://stackoverflow.com/q/21211493
has text: Do everything on a different class. Use the main only to run the JFrame.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32159751
type: Comment
comment on: http://stackoverflow.com/a/21332434
has text: I think this is what you want check updated answer. PLease
score: 0
type: AnswerComment

apache-felix
tags question: http://stackoverflow.com/q/21291983
tags question: http://stackoverflow.com/q/21254994
type: Tag
tag name: apache-felix
tags question: http://stackoverflow.com/q/21243877
tags question: http://stackoverflow.com/q/21228056

http://stackoverflow.com/comment/31950652
score: 2
has text: It's not clear where you're running any of this... are you editing the environment variables in a command prompt - and then starting another command prompt? Note that JAVA_HOME is basically irrelevant in most cases.
comment on: http://stackoverflow.com/q/21215141
type: Comment
type: QuestionComment

pipeline
type: Tag
tags question: http://stackoverflow.com/q/21217180
tag name: pipeline

http://stackoverflow.com/comment/31956388
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21218081
has text: @Reimeus As i said when buttons are pressed functions in other class needs to be worked. I can't do that. I think it's because all my classes have the start() method and am unable to call them. I tried a lot, but nothing is working. How can I solve this issue ?
score: 0

http://stackoverflow.com/q/21211246
linked to: http://stackoverflow.com/q/17872751
type: Question
has answer: http://stackoverflow.com/a/21217435
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31954631
has title: What kind of Adapter should I use for JSON in Android?
has comment: http://stackoverflow.com/comment/31954578
tagged with: android-listview
linked to: http://stackoverflow.com/q/21213657
tagged with: commonsware-cwac
tagged with: android
has body: I'm attempting to use a JSON output from my blog. I'm getting the last 10 posts from my WordPress site and I'm able to get the data from it successfully in android and set it to a TextView. So I'm sure all of my networking works. Now, I need to make this a master detail layout. So in my master layout all I want to do is list the post_title, and in the detail I want to list the post_content. So this means I have to create an adapter. Where I'm getting confused is, what kind of adapter is the best to use? I'm not sure what kind of object I should use. Below is my code that I use to get 1 of the post_titles and the post_content. Can anyone give me any direction on this? I was thinking that I could just use an ArrayList to hold post_titles, and another arrayList to hold post_content, but the post content can be very large. I was wondering if anyone could point me in the right direction? I'm attempting use cwac-endless adapter so that I can load more blog posts, but it's just a wrapper. So I'm still stuck with creating my original adapter, and I'm still unsure of how to implement it. public void parseJson(JsonObject result){ JsonObject jsonPost = result.getAsJsonArray("posts").get(0).getAsJsonObject(); String title = jsonPost.get("title").getAsString(); String content = jsonPost.get("content").getAsString(); }
has answer: http://stackoverflow.com/a/21211417
type: UnansweredQuestion
tagged with: android-arrayadapter
tagged with: java

http://stackoverflow.com/comment/31990819
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21237503
has text: It's not clear what you mean. `Collections2<E>` just has static methods. You can't create an instance of it. `Iterables<E>` is the same. You can't convert between them because you never have an instance of either of them... It would really help if you could post a short but complete example of what you mean.

http://stackoverflow.com/q/21250812
favorite count: 0
possible better answer: http://stackoverflow.com/a/21250907
has comment: http://stackoverflow.com/comment/32014396
tagged with: regex
has comment: http://stackoverflow.com/comment/32014270
has answer: http://stackoverflow.com/a/21250907
has comment: http://stackoverflow.com/comment/32014177
score: 1
accepted answer: http://stackoverflow.com/a/21251363
tagged with: java
has title: Java Regex to find time between two words in a String
upvote count: 1
type: Question
type: AnsweredQuestion
has body: I am trying to find the time fields between two specific words in a String. Here is few examples of my inputs Examples The Big Cat eats at 3:49 AM and the Big Dog eats Daily (BBB) , On 12 at 5:00 AM done The Big Cat eats at 3:49 AM and the Big Dog eats Daily (BBB) , On 12 at 11:00 PM done Expected Output 5:00 AM 11:00 PM RegEx Used (?&lt;=Dog\s(\w+))((\d):(\d)(\d)\sAM)(?=\sdone) I dont seem to get it properly. Not sure if the special characters in between are causing the issue. But instead of Alphanumeric, if I use Any character, then all words between my two keywords get captured. Could anyone let me know what am I doing wrong here?
has comment: http://stackoverflow.com/comment/32014197
has comment: http://stackoverflow.com/comment/32014615
answer count: 2
tagged with: regex-lookarounds
has comment: http://stackoverflow.com/comment/32014167
downvote count: 0
has answer: http://stackoverflow.com/a/21251363

http://stackoverflow.com/comment/32059417
comment on: http://stackoverflow.com/q/21261474
type: Comment
type: QuestionComment
has text: My object1 is ofcorse List<MyClass1> and the second parameter is the expected result type. that is how toy use the conversion factory bean..., with the code above i get null returned
score: 0

http://stackoverflow.com/q/21215723
answer count: 2
tagged with: playframework
downvote count: 0
possible better answer: http://stackoverflow.com/a/21216418
has body: I'm trying to get started with the play framework by building a live twitter stream app. I'm super confused though, and have spent a few days trying to figure this out but I can't seem to get it.. hoping someone here wouldn't mind pointing me in the right direction. A few questions. 1) The actual TwitterStreamFactory instantiation, where would this go? Is this part of a model, or a controller? 2)Websockets, comet, SSE? What's the most efficient way - for every status that comes through the stream - to handle and send to the browser. 3)And the StatusListener. Every time I try to create this in eclipse it tells me to add unimplemented methods.. but I have implemented them. It just won't play nicely. 3 is a big problem for me, because I can't get it to run anywhere. The code works on a tomcat server, but it's obviously quite different using play. Any advice on where I should be writing the twitter stream part of the code? Thanks guys.. these questions are probably considered silly, but I am truly, truly in a rut here.
has answer: http://stackoverflow.com/a/21216418
favorite count: 0
has answer: http://stackoverflow.com/a/21216377
upvote count: 1
type: AnsweredQuestion
tagged with: playframework-2.0
has title: twitter4j-stream with play framework.
tagged with: twitter4j
score: 1
tagged with: java
tagged with: twitter
type: Question
accepted answer: http://stackoverflow.com/a/21216377

http://stackoverflow.com/a/21253844
type: Answer
answers question: http://stackoverflow.com/q/21253025
has comment: http://stackoverflow.com/comment/32027310
has comment: http://stackoverflow.com/comment/32028559
downvote count: 0
has comment: http://stackoverflow.com/comment/32032144
score: 7
has body: Tika detects and extracts metadata and structured text content. It doesn't support to find header distance of first section, image height and width etc. You can try PDFBox or Itext.
upvote count: 7

http://stackoverflow.com/comment/32162906
score: 0
comment on: http://stackoverflow.com/q/21325884
type: Comment
has text: What are your versions of Morphia & MongoDB? Do you have a firewall or load balancer in front of your MongoDB instance? If the interval is consistently about 1 minute, it sounds like there is some sort of timeout happening.
type: QuestionComment

http://stackoverflow.com/a/21420723
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32583301
score: 16
accepted answer of: http://stackoverflow.com/q/21303746
answers question: http://stackoverflow.com/q/21303746
upvote count: 16
has body: With log4j2, there is a separation between API and CORE. This allows the team to make changes to the implementation without breaking client code. So, if your code depends on implementation details, be aware that in the future this may change and your code may break. That said, you can get a map of the appenders like this: Logger logger = LogManager.getLogger(); Map&lt;String, Appender&gt; appenderMap = ((org.apache.logging.log4j.core.Logger) logger).getAppenders(); You can loop over the map until you find a RollingFileAppender. From this point it gets really ugly... The information you want is all in private fields, so you would need to use reflection to do the following: get the fileAppender's "manager" field and cast it to RollingFileManager get the manager's "strategy" field and cast it to DefaultRolloverStrategy get the defaultRolloverStrategy's "maxIndex" field This would obviously be pretty fragile... If you really need this you can request this feature on the log4j-dev mailing list or create a JIRA ticket. The quickest way to get this feature is if you provide a patch with the feature request.

http://stackoverflow.com/q/21186393
favorite count: 0
has comment: http://stackoverflow.com/comment/31898568
has body: import java.io.*; import java.awt.*; import org.xml.sax.*; import java.awt.event.*; import javax.swing.JButton; import javax.swing.JPanel; import javax.xml.parsers.*; import org.xml.sax.helpers.DefaultHandler; public class ch17_05 extends DefaultHandler { static int totalFigures = 0; static int x[] = new int[100]; static int y[] = new int[100]; static int width[] = new int[100]; public static void main(String args[]) { ch17_05 obj = new ch17_05(); obj.childLoop("C:\\Users\\xxxx\\Desktop\\ch17_04.xml"); AppFrame frame = new AppFrame(totalFigures, x, y, width); frame.setSize(400, 400); frame.addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) {System.exit(0);}}); frame.show(); } public void childLoop(String uri) { DefaultHandler defaultHandler = this; SAXParserFactory factory = SAXParserFactory.newInstance(); try { SAXParser saxParser = factory.newSAXParser(); saxParser.parse(new File(uri), defaultHandler); } catch (Throwable t) {} } public void startElement(String uri, String localName, String qualifiedName, Attributes attrs) { if (qualifiedName.equals("square")) { x[totalFigures] = Integer.parseInt(attrs.getValue("x")); y[totalFigures] = Integer.parseInt(attrs.getValue("y")); width[totalFigures] = Integer.parseInt(attrs.getValue("width")); totalFigures++; } } public void warning(SAXParseException exception) { System.err.println("Warning: " + exception.getMessage()); } public void error(SAXParseException exception) { System.err.println("Error: " + exception.getMessage()); } public void fatalError(SAXParseException exception) { System.err.println("Fatal error: " + exception.getMessage()); } } class AppFrame extends Frame { /** * */ private static final long serialVersionUID = 1L; int totalFigures; int[] xValues; int[] yValues; int[] widthValues; public AppFrame(int number, int[] x, int[] y, int[] width) { totalFigures = number; xValues = x; yValues = y; widthValues = width; final JButton[] buttons = new JButton[totalFigures]; for(int loopIn…
score: -2
has answer: http://stackoverflow.com/a/21200376
has answer: http://stackoverflow.com/a/21186563
type: UnansweredQuestion
tagged with: java
downvote count: 2
has title: Here i parse xml in java then making Jbutton
tagged with: swing
type: Question
answer count: 2
upvote count: 0
tagged with: layout

http://stackoverflow.com/comment/32028233
has text: Even if the solution you propose make fully dependent the game and the editor, I will try it.
type: Comment
comment on: http://stackoverflow.com/a/21258666
score: 0
type: AnswerComment

http://stackoverflow.com/q/21261266
score: 0
accepted answer: http://stackoverflow.com/a/21261395
has comment: http://stackoverflow.com/comment/32031977
has body: I have made a public "Utils" class, where I put some general static methods that are frequently used. Inside that Utils class, I have created a private static inner class, of some "tool" that Utils supplies. (That tools is some kind of a parser for my needs). One of the methods in Utils, returns a new instance of that parser, and everything works ok. The "problem" is that I am getting warnings, for every public method inside the parser, that is not called from the containing Utils class. This is the skeleton of how it looks: public class Utils { public static Parser(String[] msgs) throws Exception { return Parser.create(msgs); } private static class Parser { /** fields... **/ private Parser() {} public static Parser create(String[] msgs) throws Exception { Parser parser = new Parser(); setupParser(msgs); return parser; } private static void setupParser(String[] msgs) throws Exception { // do stuff } public boolean someInnerMethod(String key) { // do stuff } } } The method someInnerMethod raises the warning: The method someInnerMethod(String) from the type Utils.Parser is never used locally Am I doing something wrong? Is there a better way of doing what I have done here? I generally want the Parser not to be accessible from the outside, yet getting it could be possible using a static method (I don't want to instantiate a Utils class every time I need it's methods) Thanks in advance.
has answer: http://stackoverflow.com/a/21261395
type: AnsweredQuestion
tagged with: inner-classes
tagged with: java
tagged with: static-class
tagged with: private-class
has comment: http://stackoverflow.com/comment/32031864
type: Question
answer count: 2
has title: Is the following "private static inner class" implementation correct?
possible better answer: http://stackoverflow.com/a/21261377
has answer: http://stackoverflow.com/a/21261377
tagged with: static-methods

http://stackoverflow.com/a/21239041
has body: I'm not entirely sure what is in f1, f2 etc. Is it the URL of a document? or the XML document content itself? There are two possible approaches you could consider. One is to write a URIResolver. When you call document('f2.xml') Saxon will call your URIResolver to get the relevant document as a Source object. Your URIResolver could return a StreamSource initialized with a ByteArrayInputStream referring to the relevant btye[] value. A second approach is to supply the documents as parameters to the stylesheet. You could declare a global parameter &lt;xsl:param name="f2" as="document-node()"/&gt; and then use Transfomer.setParameter() to supply the actual document; within the stylesheet, replace document('f2.xml') by $f2. Saxon will accept a Source object as the value supplied to setParameter, so you could again create a StreamSource initialized with a ByteArrayInputStream referring to the relevant btye[] value; alternatively (and perhaps better) you could pre-build the tree by calling a Saxon DocumentBuilder.
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21232128
has comment: http://stackoverflow.com/comment/32033333
type: Answer
answers question: http://stackoverflow.com/q/21232128
score: 1
has comment: http://stackoverflow.com/comment/32016669

http://stackoverflow.com/q/21281071
has comment: http://stackoverflow.com/comment/32070032
answer count: 0
type: UnansweredQuestion
tagged with: oracle11g
type: Question
has title: Toplink foreign key with value zero
tagged with: java
tagged with: foreign-key-relationship
has comment: http://stackoverflow.com/comment/32067179
tagged with: junit
tagged with: toplink
has body: I’m modernizing an application which uses an Oracle 11g DB with Toplink. I’m having a problem with foreign keys which are ints of value zero. The application is kind of complicated so I have created a simple project with a two table DB, Toplink configured in the same way as the app and some JUnit tests to drive some simple requests through to the DB. One table (Party) has a reference to the other table (Address). An address can be used by many Party. It’s mapped as one-to-many in the Toplink Workbench Everything works fine until I try to create or update a Party referencing an Address with id zero. This throws a Toplink exception. NB. It’s no problem creating an Address with id zero, and it’s no problem creating or updating a Party with an Address of greater than zero. Here is the exception I see on the create: [TopLink Warning]: 2014.01.22 11:51:26.333--UnitOfWork(76409034)-- Thread(Thread[main,5,main])--Exception [TOPLINK-4002] (Oracle TopLink - 11g Release 1 (11.1.1.6.0) (Build 111018)): oracle.toplink.exceptions.DatabaseException Internal Exception: java.sql.SQLException: ORA-00001: unique constraint (PARTIES.ADR_PK) violated Error Code: 1 Call: INSERT INTO PTY_ADDRESS (ADR_ID, ADR_STREET, ADR_COUNTRY, ADR_NAME, ADR_CITY) VALUES (?, ?, ?, ?, ?) bind =&gt; [0, street, country, venue, city] Query: InsertObjectQuery(ch.hp.parties.Address@2e931d05) Any ideas? John D.
score: 0

http://stackoverflow.com/a/21238225
score: 2
accepted answer of: http://stackoverflow.com/q/21197112
answers question: http://stackoverflow.com/q/21197112
type: AcceptedAnswer
downvote count: 0
has body: Finally, we found an interceptor for doing that: public class SoapResponseInterceptor extends AbstractSoapInterceptor { public SoapResponseInterceptor() { super(Phase.PRE_LOGICAL); } @Override public void handleMessage(SoapMessage message) throws Fault { message.getExchange().setOneWay(false); } } Hope it helps!
type: Answer
upvote count: 2

http://stackoverflow.com/a/21339872
has body: Why are you calling onSharedPreferenceChanged manually and passing it null and empty String as arguements? Remove onSharedPreferenceChanged(null, "");from your code.
has comment: http://stackoverflow.com/comment/32174316
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21339543
has comment: http://stackoverflow.com/comment/32174213
answers question: http://stackoverflow.com/q/21339543
type: Answer
has comment: http://stackoverflow.com/comment/32171935

http://stackoverflow.com/comment/32050875
comment on: http://stackoverflow.com/q/21271173
has text: i will upload it tomorrow :)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21216741
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31954785
tagged with: swing
has answer: http://stackoverflow.com/a/21216781
has comment: http://stackoverflow.com/comment/31958702
tagged with: object
has comment: http://stackoverflow.com/comment/31953339
tagged with: java
has comment: http://stackoverflow.com/comment/31953354
downvote count: 1
has body: Consider the following code. import javax.swing.JFrame; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class RobotControl extends JFrame { public static void main (String args[]) { RobotControl GUI = new RobotControl(); GUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GUI.setSize(500,500); GUI.setVisible(true); GUI.setTitle("RobotControl"); } private Finch myf; private JButton front; private JButton back; private JButton left; public RobotControl() { myf = new Finch(); setLayout (new FlowLayout()); front = new JButton("front"); add(front); front.addActionListener(new FrontButtonListener(myf)); back = new JButton("back"); add(back); back.addActionListener(new BackButtonListener(myf)); left = new JButton("left"); add(left); left.addActionListener(new LeftButtonListener(myf)); } public class FowardButtonListener implements ActionListener { public FowardButtonListener(Finch myf) { } public void actionPerformed(ActionEvent arg0) { myf.setWheelVelocities(100,100,10000); } } public class BackwardButtonListener implements ActionListener{ public BackwardButtonListener(Finch myf){ } public void actionPerformed(ActionEvent arg0) { myf.setWheelVelocities(-100,-100,10000); } } public class LeftButtonListener implements ActionListener{ public LeftButtonListener(Finch myf){ } public void actionPerformed(ActionEvent arg0){ myf.setWheelVelocities(0, 200, 1000); } } Now, the program creates a GUI that operates a small Robot. Three options to move either foward, backward or turn left. I want the robot to wait for all three buttons or any combination of buttons to be clicked before it starts moving, as at the moment, the robot moves immediately i click any button.Any help is appreciated. I only started learning java recently, so my knowledge is very limited.
has comment: http://stackoverflow.com/comment/31953404
upvote count: 0
has answer: http://stackoverflow.com/a/21216782
type: UnansweredQuestion
has title: Objects and java GUI
tagged with: user-interface
score: -1
favorite count: 0

http://stackoverflow.com/comment/31968404
type: Comment
type: QuestionComment
has text: thanks @kolossus ! this works fine. I 've forgotten the "h" in the head's tag. Can you put your answer as the predefined one so I can check it as the correct one?!
score: 1
comment on: http://stackoverflow.com/q/21222864

http://stackoverflow.com/comment/32108061
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21304063
has text: Oh ofc. popup, a new window.. :) didnt used that for a long time! :) and the `sidebarright.jsp`, how is that included?
type: AnswerComment

http://stackoverflow.com/comment/32057304
comment on: http://stackoverflow.com/q/21275187
has text: In some cases, I need those two objects.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31987969
type: QuestionComment
has text: Unfortunately, rendering PDFs to images is outside the scope of iText. You'll need another product; for instance JPedal: http://www.idrsolutions.com/java-pdf-library/
comment on: http://stackoverflow.com/q/21235815
type: Comment
score: 1

http://stackoverflow.com/comment/31914709
score: 0
comment on: http://stackoverflow.com/q/21194831
has text: Is the micro amount of memory from an extra JList really that harmful? Why is this a requirement?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21201697
has body: I am using SoftHSM and am able to generate and store keys in a token. In order to use SunPKCS Interfaces many methods require the session handle and i am at a loss on how to retrieve them. Currently i am using SoftHSM and PKCS11 as follows. THe code within the comments are what i tried to work with the SUNPKCS11 interface signatures. Any example code on how to wrap and unwrap keys will also be much appreciated. I am attempting to backup keys using PKCS11 from one token to another and if my understanding is right, the approach must be via wrapping.... Sitaraman public static void main(String[] args) { // TODO code application logic hereString configName = "softhsm.cfg"; try { // Set up the Sun PKCS 11 provider String configName = "/etc/softhsm.cfg"; Provider p = new SunPKCS11(configName); String configName1 = "/etc/softhsm1.cfg"; Provider p1 = new SunPKCS11(configName1); if (-1 == Security.addProvider(p)) { throw new RuntimeException("could not add security provider"); } PKCS11 p11 = PKCS11.getInstance("/usr/local/lib/softhsm/libsofthsm.so", "C_GetFunctionList", null, false); /* p11.C_GetSessionInfo(0); CK_INFO cki = p11.C_GetInfo(); long[] slots = p11.C_GetSlotList(true); String label = new String(p11.C_GetTokenInfo(slots[0]).label); Object obj = new Object(); long sessionhandle = p11.C_OpenSession(slots[0], 1, null, null); CK_MECHANISM ckm = new CK_MECHANISM(); ckm.mechanism = PKCS11Constants.CKM_RSA_PKCS; CK_ATTRIBUTE[] cka = new CK_ATTRIBUTE[1]; CK_ATTRIBUTE[] cka1 = new CK_ATTRIBUTE[1]; long[] keypair =p11.C_GenerateKeyPair(slots[1], ckm, cka, cka1); */ //System.out.println("No. of slots" + slots.length + "label" + label); // Load the key store char[] pin = "vit12345".toCharArray(); char[] pin1 = "User12345".toCharArray(); KeyStore ks = KeyStore.getInstance("PKCS11", p); KeyStore ks1 = KeyStore.getInstance("PKCS11", p1); ks.load(null, pin); ks1.load(null, pin1); Entry e; KeyStore.PrivateKeyEntry e1; // Generate the key SecureRandom sr = new SecureRandom(); KeyPa…
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/21980752
type: Question
tagged with: hsm
has title: How to obtain Session Handle in SunPKCS11
upvote count: 2
tagged with: security

http://stackoverflow.com/a/77764471
type: Answer
answers question: http://stackoverflow.com/q/21329288
has body: Based on Moritz Petersen's answer, with simplification for a single test, and creating a test failure instead of an error @Test public void secureLoginWithLongUsername() { final Thread currentThread = Thread.currentThread(); ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); Future<?> timeout = scheduler.schedule(() -> currentThread.interrupt(), getTimeOut(), TimeUnit.SECONDS); try { // Test case goes here } catch (InterruptedException exception) { fail("thread was interrupted", exception); } timeout.cancel(true); }
score: 0

http://stackoverflow.com/q/21226309
has body: It seems that my code is not working for project Euler, problem 1. The problem states: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. The output of my program is 266333 my code is: private static final int max = 1000; private static int sum; public static void main(String[] args) { addMultiples(3); addMultiples(5); System.out.println(sum); } private static void addMultiples(int mult) { int x = mult; while(x &lt; max) { sum += x; x += mult; } } It seems that the basic fundamentals of mathematics are simply eluding me, and this really discourages me in becoming a programmer if I'm incapable of finding what seems to be a solution to such a simple problem.
has answer: http://stackoverflow.com/a/21226338
has answer: http://stackoverflow.com/a/21226395
possible better answer: http://stackoverflow.com/a/21226349
has comment: http://stackoverflow.com/comment/31970832
tagged with: logic
score: 0
has comment: http://stackoverflow.com/comment/31970857
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31970892
favorite count: 0
has answer: http://stackoverflow.com/a/21226349
has comment: http://stackoverflow.com/comment/31970861
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21226364
tagged with: math
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31970834
has answer: http://stackoverflow.com/a/21226364
has title: Project Euler, #1

http://stackoverflow.com/q/21215141
type: Question
has comment: http://stackoverflow.com/comment/31950799
has comment: http://stackoverflow.com/comment/31950652
accepted answer: http://stackoverflow.com/a/21215436
has comment: http://stackoverflow.com/comment/31951082
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31950833
has comment: http://stackoverflow.com/comment/31950716
has comment: http://stackoverflow.com/comment/31950698
answer count: 1
has comment: http://stackoverflow.com/comment/31950954
has comment: http://stackoverflow.com/comment/31951413
linked to: http://stackoverflow.com/q/20410555
has body: I upgraded to java and set to following advance envirnment variables frrom windows UI(not by command prompt) JAVA_HOME = C:\Program Files\Java\jdk1.7.0_51 PATH = %JAVA_HOME\bin% when i do java - version it reflects the right java version as "1.7.0_51" but when i try to revert back to jav java 6 after reverting java_home (from windows UI )back to JAVA_HOME = C:\Program Files\Java\jdk1.6.0_43 PATH = %JAVA_HOME\bin% i opened new commad prompt but java - version still reflects the java version as "1.7.0_51" should it not reflect java version as.6.0_43 ? Can't i go back to java 6 just by reverting java_home?
has comment: http://stackoverflow.com/comment/31950795
has comment: http://stackoverflow.com/comment/31950766
has comment: http://stackoverflow.com/comment/31950651
tagged with: java-6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21215436
has title: how to revert back to java 6?
has comment: http://stackoverflow.com/comment/31950759
has comment: http://stackoverflow.com/comment/31951064
has comment: http://stackoverflow.com/comment/31951113

http://stackoverflow.com/q/21239148
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31993703
has answer: http://stackoverflow.com/a/21239490
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/31994001
has answer: http://stackoverflow.com/a/21239516
has comment: http://stackoverflow.com/comment/31993787
favorite count: 0
has title: How to write units in Java like Radian, Newton, Pascal, mm, kg?
has comment: http://stackoverflow.com/comment/32070432
downvote count: 1
has body: I am developing a Java application, its about converting Mathcad worksheet to Java application. Can anyone know/suggest how to write units(newton, pascal, mm, kg)in java code? Example:1? double var1 = 10*newton/mm;//looking for a way to write the code in this format. double var2 = 5*mmpower2; double var = var1/var2; double var = ? Example: 2? double var1 = 90degress-tan(60)*Radian; double var1 = ?
has comment: http://stackoverflow.com/comment/31993741
possible better answer: http://stackoverflow.com/a/21239516
tagged with: mathcad
accepted answer: http://stackoverflow.com/a/21239490

http://stackoverflow.com/comment/32066361
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21280582
has text: Actually @PakkuDon if I override `equals` method then I will have to write if conditions, what if there are 20 member variable in a class then I will have to write 20 `if` condition, actually I want to avoid `if` conditions.
score: 0

http://stackoverflow.com/a/21218549
upvote count: 3
answers question: http://stackoverflow.com/q/21218533
downvote count: 0
has body: The Java® Virtual Machine Specification In documentation bytecodes are often described as instructions. Chapter 6 specifies the instruction set of the Java Virtual Machine, presenting the instructions in alphabetical order of opcode mnemonics. Chapter 6. The Java Virtual Machine Instruction Set A Java Virtual Machine instruction consists of an opcode specifying the operation to be performed, followed by zero or more operands embodying values to be operated upon. This chapter gives details about the format of each Java Virtual Machine instruction and the operation it performs. Complete bytecode list: Instructions 4.10.1.3. Instruction Representation Individual bytecode instructions are represented in Prolog as terms whose functor is the name of the instruction and whose arguments are its parsed operands. For example, an aload instruction is represented as the term aload(N), which includes the index N that is the operand of the instruction. Other resources Java bytecode: Understanding bytecode makes you a better programmer Java Bytecode Fundamentals CS1Bh Lecture Note 7, Compilation I: Java Byte Code Java bytecode veriﬁcation: algorithms and formalizations
type: Answer
score: 3

http://stackoverflow.com/comment/32072312
type: QuestionComment
score: 0
has text: In my opinion, Java warns you because your initialisation is done in a test. For example, if you change your statement to org.junit.Assert.assertFalse(false && (buf = new StringBuilder("qwe3")).toString().isEmpty()); your local variable will actually NOT be initialized because false && anything is always false and Java won't even try to evaluate the second part of your expression. It could explain the warning you have maybe.
type: Comment
comment on: http://stackoverflow.com/q/21283867

http://stackoverflow.com/comment/31968252
comment on: http://stackoverflow.com/q/21218958
score: 0
has text: I wanna know the right code of JAVA how to get SN of Hard-disk on computer.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32118303
type: QuestionComment
type: Comment
has text: Thanks khmarbaise for the suggestion. It lead me in the right direction.
score: 0
comment on: http://stackoverflow.com/q/21304710

http://stackoverflow.com/q/21267623
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
tagged with: intellij-idea
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32088249
has comment: http://stackoverflow.com/comment/32057325
type: UnansweredQuestion
has body: I cloned hibernate-orm project and trying to import it in Intellij Idea 12 and Intellij Idea 13. Everything is working, but classes which use antlr, like HqlSqlWalker doesn't compile because it can't find org.hibernate.hql.internal.antlr.HqlSqlBaseWalker and classes like it. I tried to run gradle generateSource and build, but it doesn't help. Thanks
has comment: http://stackoverflow.com/comment/32065844
has title: hibernate-orm source import intellij idea 12
answer count: 0

http://stackoverflow.com/q/21186136
tagged with: java
has answer: http://stackoverflow.com/a/21186939
has body: I'm looking for some gook looking GUI with sorting feature of JTable.Through searching I come know about Glazed List. But here Tutorials is quite difficult. https://sites.google.com/site/glazedlists/documentation/tutorial Can any you please guide me how can I link my Jtable to Glazed list table to view my SQL Table values via JDBC?
accepted answer: http://stackoverflow.com/a/21186939
tagged with: swing
type: Question
tagged with: jtable
score: 0
tagged with: sql
answer count: 1
tagged with: glazedlists
type: AnsweredQuestion
has title: I want to connect Glazed Lists to my JTable with filled SQL table values?

http://stackoverflow.com/a/21213905
answers question: http://stackoverflow.com/q/21206847
score: 3
type: AcceptedAnswer
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21206847
has body: Many (if not all) of the objects that are drawn in JavaFX applications already have antialiasing effect. This is visible to the naked eye. Try to write two identical applications, one in JavaFX, and another in Swing (without antialiasing effect of Graphics and RenderingHints object). The difference is clear, especially when drawing geometric shapes and text. Here you can find some comparisons between Swing and JavaFX, and here you can get to know better the JavaFX 2.X (read the subject "Graphics System" and "Media and Images"). Personally, I would prefer to use JavaFX technology. I previously used a lot Swing. Each of my applications had to be made in Swing. However, after seeing the practicality of JavaFX, its maintainability, its elegance and productivity, I did not think twice. Even if you just want to draw simple things, JavaFX seems to have a much better performance. If I'm not mistaken, JavaFX was developed taking into account the use of video hardware on your platform, and was also inspired by the famous game engines available for Java users, which are made to work with high processing visual effect, screen updates, and among many other things. For you marvel a bit with the technology and effort that was put, I beg you, visit this address. Look for the download of a JavaFX program named Ensemble. You will find where is written "JDK 7 and JavaFX Demos and Samples". click download and use the demo program Ensemble. For information on drawing text, geometric shapes and stuff, see the following links: http://java.dzone.com/articles/javafx-21-beta-improved-font http://fxexperience.com/2012/01/lcd-text-support-in-javafx-2-1-developer-preview/ (An alternative from the previous link) http://docs.oracle.com/javafx/2/text/jfxpub-text.htm (Look for "Setting LCD Text Support" and also, with the feature of applying effects to text and various things of JavaFX, you can still improve the visualization of what is shown to the user.) http://docs.oracle.com/javafx/2/api/javafx…
type: Answer

http://stackoverflow.com/q/21195726
upvote count: 4
accepted answer: http://stackoverflow.com/a/21200198
answer count: 1
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: android
type: AnsweredQuestion
score: 4
has title: Adding PreferenceScreen to linearlayout
has answer: http://stackoverflow.com/a/21200198
tagged with: java
type: Question
tagged with: android-layout
has body: Hi I am new to Android and Java and have run into a problem. My problem is that i am trying to add a PreferenceScreen to my linear layout so I am able to set an setOnSeekBarChangeListener() on the seekbar in res/layout/activity_main.xml. At the moment the PreferenceScreen and the LinearLayout get added to the view but they are on top of each other which is not what I want. Instead I want the PreferenceScreen to go in place of the ListView inside my layout file. res/xml/settings.xml &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;PreferenceCategory android:title="Category" android:key="category_preference"&gt; &lt;SwitchPreference android:key="switch_preference" android:title="Title" android:summary="Summary" android:defaultValue="true" /&gt; &lt;CheckBoxPreference android:key="checkbox_preference" android:title="Title" android:summary="Summary" android:defaultValue="true" /&gt; &lt;/PreferenceCategory&gt; &lt;/PreferenceScreen&gt; res/layout/activity_main.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:orientation="vertical" android:layout_height="fill_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" &gt; &lt;SeekBar android:id="@+id/main_seek_bar" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" /&gt; &lt;/LinearLayout&gt; MainActivity.java public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getFragmentManager().beginTransaction().replace(android.R.id.content, new Setting…

http://stackoverflow.com/q/21330209
favorite count: 0
has answer: http://stackoverflow.com/a/21330588
accepted answer: http://stackoverflow.com/a/21330588
type: AnsweredQuestion
downvote count: 0
has title: JPA inheritance of subclass
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32154758
type: Question
has comment: http://stackoverflow.com/comment/32154191
tagged with: spring-data-jpa
upvote count: 1
answer count: 1
has body: Imagine that we have : public class Person {...} public class Employee extends Person {....} We make of Employee an entity that have an other table as Person. With JPA we make our interface extends JpaRepository. I ask the personRepo.findAll() Is it possible to get only the List of Person without the Employees? (I'm analysing this atm so I don't have concreet example, just need to know if this is possible) Thx in advance

http://stackoverflow.com/q/21268405
tagged with: draw
has comment: http://stackoverflow.com/comment/32045237
linked to: http://stackoverflow.com/q/401847
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21270183
tagged with: rect
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21270183
has body: I have this code: public void paint(Graphics g) { g.setColor(Color.black); g.fill3DRect(myX, myY, 20, 20,true); g.setColor(Color.red); g.fillOval(nX, nY, 20, 20); } Coordinates of the 2 shapes are given by the user, how can i know if there's a intersection between them? (I don't need coordinates of the intersection, just need to know if there is or not) Thanks in advance!
score: 1
tagged with: java
has title: Java: Find possible intersection
upvote count: 1
type: Question
tagged with: intersection

http://stackoverflow.com/comment/32054503
comment on: http://stackoverflow.com/q/21273533
has text: Please show code or it didn't happen. Also, you should not override a JPanel's paint method, but rather its paintComponent method, and you should make sure to call the super method within the override.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21194262
has answer: http://stackoverflow.com/a/21194317
type: Question
has comment: http://stackoverflow.com/comment/31913627
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21194359
accepted answer: http://stackoverflow.com/a/21194359
possible better answer: http://stackoverflow.com/a/21194317
favorite count: 0
has title: How set JCalendar with a specific date?
has body: I want to use two JCalendar, one receive actual date with Calendar.getInstance() and other with the same date but with one month over the first. for example: Jcalendar1 = 05/04/2014 Jcalendar2 = 05/05/2014 I dindn't get how make this, I tryed whit this way... Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, Calendar.MONTH+1, Calendar.DAY_OF_MONTH); but set the JCalendar2 with 05/03/0001 it's a error in jcalendar? How can I make that? help please PD: sorry for my English
tagged with: jcalendar
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/21240868
linked to: http://stackoverflow.com/q/513832
tagged with: exception
has comment: http://stackoverflow.com/comment/31996808
downvote count: 7
has comment: http://stackoverflow.com/comment/31996971
has answer: http://stackoverflow.com/a/21241038
has title: Programming Challenges 110106
has body: I am currently doing Problem 110106 from the programming challenges website. I am getting NoSuchElementException on the second 000 in the file below. Below that is my code any help would be great. 1 299 492 495 399 492 495 399 283 279 689 078 100 000 000 000 Here's example: import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.util.NoSuchElementException; import java.util.Scanner; public class Problem110106 { int mainCounter = 0; int array[] = new int[10]; public static void main(String[] args) throws FileNotFoundException, NoSuchElementException { // TODO Auto-generated method stub Problem110106 problem = new Problem110106(); problem.start(); } public void start() throws FileNotFoundException, NoSuchElementException { Scanner input = new Scanner(new BufferedReader(new FileReader("text.txt"))); int numTestCases = Integer.parseInt(input.nextLine().trim()); System.out.println(numTestCases); String blank = input.nextLine(); System.out.println(blank); while (input.hasNext()) { int num = Integer.parseInt(input.next()); if (input.next() == "") { } else { int first = num / 100; int second = (num / 10) % 10; int third = (num % 10); System.out.println(first); System.out.println(second); System.out.println(third); switch (first) { case 0: break; case 1: break; case 2: set(first, second, third); break; case 3: add(first, second, third); break; case 4: multiply(first, second, third); break; case 5: set(first, second, third); break; case 6: add(first, second, third); break; case 7: multiply(first, second, third); break; case 8: set2(first, second, third); break; } } } } public void set(int first, int second, int third) { array[second] = third; mainCounter++; // System.out.println("got here"); } public void add(int first, int second, int third) { array[second] = array[second] + third; mainCounter++; } public void multiply(int first, int second, int third) { array[second] = array[second] * third; mainCounter++; } public void se…
type: AnsweredQuestion
score: -5
accepted answer: http://stackoverflow.com/a/21241068
tagged with: java
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/21241068
possible better answer: http://stackoverflow.com/a/21241038
has comment: http://stackoverflow.com/comment/31996860
favorite count: 0

http://stackoverflow.com/a/41583547
answers question: http://stackoverflow.com/q/21196120
score: 0
has body: If you observe compilation code by the command javap your class name i.e javap Tetris then it display it as class mytetris.Tetris{ } So when you execute this program ,you have to give command like this. java mytetris.Tetris then your program executes smoothly.
type: Answer

http://stackoverflow.com/q/21292479
answer count: 1
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/21292603
upvote count: 1
linked to: http://stackoverflow.com/q/3310066
has comment: http://stackoverflow.com/comment/32087231
type: AnsweredQuestion
score: 1
tagged with: java
has title: Writing a list to a file and reading from it
has comment: http://stackoverflow.com/comment/32089377
has body: I have looked around but have not been able to find anything related. I have 3 Lists (week, day, period) I need to write them to a file so that they are not deleted when the app is closed. How would I write these lists to a file and then when the app is open read them back into a List as they were before. Not sure if this is a stupid question.
type: Question
accepted answer: http://stackoverflow.com/a/21292603
downvote count: 0

http://stackoverflow.com/comment/32100892
has text: This won't work, use `i < user.length` instead. Remember index starts at `0`!
type: QuestionComment
type: Comment
score: 3
comment on: http://stackoverflow.com/q/21300132

http://stackoverflow.com/comment/31941801
has text: I posted it for code review for reviewing entire code, I posted it here for a very specific question.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21209994

http://stackoverflow.com/q/21297442
type: UnansweredQuestion
has body: hi I have this Java code, import java.io.*; import java.util.*; public class SongWriter { public static void main(String[] args) { PrintWriter outputStream = null; // Scope must be outside the try/catch structure try { outputStream = new PrintWriter("Song.txt"); // new FileOutputStream("Song.txt") } catch(FileNotFoundException e) { System.out.println("Error opening the file Song.txt."); System.exit(0); } System.out.println("\n classical songs has many lines"); System.out.println("\nNow enter the three lines of your Song."); String line = null; Scanner keyboard = new Scanner(System.in); int count; for (count = 1; count &lt;= 3; count++) { System.out.println("\nEnter line " + count + ": "); line = keyboard.nextLine(); outputStream.println(count + "\t" + line); } outputStream.close(); System.out.println("\nYour Song has been written to the file Song.txt.\n"); } // end of main } // end of class how do I Adjust the program so it first asks for a name of the file to write to. Use the Scanner class and its next() method. Read in the file name as a string variable after informing the reader the file name should end in the suffix .txt Eg:- Song with the file names Haiku1.txt, Haiku2.txt and Haiku3.txt.
tagged with: java
type: Question
has title: How to Use the Scanner class and its next() method in Java?
answer count: 2
has comment: http://stackoverflow.com/comment/32096266
has comment: http://stackoverflow.com/comment/32096522
has answer: http://stackoverflow.com/a/21297606
score: 0
linked to: http://stackoverflow.com/q/2885173
has answer: http://stackoverflow.com/a/21297589
has comment: http://stackoverflow.com/comment/32096301
has comment: http://stackoverflow.com/comment/32096270

http://stackoverflow.com/a/21304976
type: Answer
score: 2
downvote count: 0
has body: HibernateUtil is implementing the singleton pattern: there can be only one instance of that class, and that instance is HibernateUtil.INSTANCE.
has comment: http://stackoverflow.com/comment/32109461
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21304813
has comment: http://stackoverflow.com/comment/32109382
accepted answer of: http://stackoverflow.com/q/21304813

http://stackoverflow.com/comment/31999068
has text: What do you mean by the interface approach? Can you show a code sample for this approach?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21197662
score: 0

http://stackoverflow.com/a/21297536
score: 0
has comment: http://stackoverflow.com/comment/32099825
has comment: http://stackoverflow.com/comment/32096548
type: Answer
has comment: http://stackoverflow.com/comment/32096676
has body: The dispatcher servlet is mapped to an invalid url, * is not a valid servlet mapping, change the mapping to: spring / In general the url-pattern must start or end with a * (.jsp, /resources/ or /*)or be a fixed string like /hello. Also you will need to change the href attribute to prefix the context root: Say Hello
has comment: http://stackoverflow.com/comment/32096544
has comment: http://stackoverflow.com/comment/32096781
answers question: http://stackoverflow.com/q/21297515

http://stackoverflow.com/comment/44335587
has text: Such an ItemProcessor is provided by the framework as of 3.0: [ClassifierCompositeItemProcessor](http://docs.spring.io/spring-batch/trunk/apidocs/org/springframework/batch/item/support/ClassifierCompositeItemProcessor.html)
type: AnswerComment
comment on: http://stackoverflow.com/a/21326977
score: 1
type: Comment

http://stackoverflow.com/a/21228185
answers question: http://stackoverflow.com/q/21228015
accepted answer of: http://stackoverflow.com/q/21228015
type: Answer
score: 7
upvote count: 7
downvote count: 0
type: AcceptedAnswer
has body: Goto How to Change the Default Format Settings in Eclipse Follow the steps to create a new profile. Step 11 [Line Wrapping] shows a 'Maximum line width' field, changing that would fix your issue. Also, make sure your newly created profile is selected in the Active Profile drop-down inside Window -> Preferences -> Java -> Code Style -> Formatter. If you are trying to format XML: Goto Window -> Preferences -> XML -> XML Files -> Editor and change Line width field.

http://stackoverflow.com/q/21224618
tagged with: java
answer count: 1
has title: Android Live Feed to Website
has answer: http://stackoverflow.com/a/21224659
score: 0
accepted answer: http://stackoverflow.com/a/21224659
tagged with: android
has body: I had a quick question and I was hoping you could answer it. So I wanted to design an app that allows me to use my android camera and take that video feed and stream it live on my website, a security cam of sorts. Any idea where to start. I am a complete newbie to android so please dont get too technical. Also, I saw this https://github.com/Teaonly/android-eye but was wondering how to modify it for my purposes(Just change the website address to mine I'm thinking). ANy help would be great! Thanks again.
type: Question
tagged with: android-camera
type: AnsweredQuestion

http://stackoverflow.com/a/21313415
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32236799
score: 4
has body: Declaring an implicit collection means that you have several xml-elements with the same tag name at the same nesting level in your xml document. To map these to your Java classes, you need either a Collection or an Array to store those objects in. XStream can handle this by mapping those elements as an implicit collection to your object structure. Thus you need to change the param variable to a Collection or Array type. That is, change from: private Parameters param; to: @XStreamImplicit private List&lt;Parameters&gt; param;
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/21307117
downvote count: 0
has comment: http://stackoverflow.com/comment/32168533
has comment: http://stackoverflow.com/comment/32150368
accepted answer of: http://stackoverflow.com/q/21307117

http://stackoverflow.com/q/21235289
score: 0
tagged with: java
has title: illegal start of expression error
has comment: http://stackoverflow.com/comment/31987624
type: Question
answer count: 2
has body: I am generating a JTabbedFrame from other frame. In original frame, user enters "User Id" and "Password" &amp; by clicking on submit button JTabbedFrame is generated. My JTabbedFrame is getting compiled successfully but i am getting error in original frame as illegal start of expression in public void actionPerformed(Actionevent ae) I have attached code of both frames.Please help... Code for Original Frame import java.awt.*; import javax.swing.*; import java.awt.event.*; class Login extends JFrame implements ActionListener { JLabel l1,l2; JTextFiels t1,t2; JButton b; Login() { super("Login"); Container c = this.getContentPane(); setLayout(null); l1 = new JLabel("User Id"); 11.setBounds(20,45,100,30); c.add(l1); t1 = new JTextField(); t1.setBounds(110,50,150,20); t1.addActionListener(this); c.add(t1); l2 = new JLabel("Password"); l2.setBounds(20,95,100,30); c.add(l2); t2 = new JTextField(); t2.setBounds(110,100,150,20); t2.addActionListener(this); c.add(t2); b = new JButton("Submit"); b.setBounds(90,160,90,30); b.addActionListener(this); c.add(b); public void actionPerformed(ActionEvent ae) { String s1="admin",s2="bravo"; String user = t1.getText(); String pwd = t2.getText(); if(ae.getsource()==b) { if(user.equals(s1)&amp;&amp;pwd.equals(s2)) { Vehicle v=new Vehicle(); v.setSize(800,800); v.setVisible(true); } else { System.out.println("Enter data Proparly"); JOptionPane.showMessageDialog(this,"Plse Fillup All Field","Error",JOptionPane.ERROR_MESSAGE); } } } } public static void main(String args[]) { Login l = new Login(); l.setSize(300,300); l.setVisible(true); l.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } Code for TabbedFrame import java.awt.*; import javax.swing.*; import java.awt.event.*; class Vehicle extends JFrame { Vehicle() { Container c = getContentPane(); JTabbedPane jtp = new JTabbedPane(); jtp.addTab("Car", new Car()); jtp.addTab("Country", new Country()); c.add(jtp); } public static void main(String args[]) { Student s1=new Student(); s1.setSize…
has answer: http://stackoverflow.com/a/21235656
has comment: http://stackoverflow.com/comment/31987688
has answer: http://stackoverflow.com/a/21235757
has comment: http://stackoverflow.com/comment/31987068
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/q/21209994
has comment: http://stackoverflow.com/comment/31941801
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31942065
has title: Is this the right use of primitive wrapper class?
score: 0
has body: I have the following code: public final class MedianOfTwoSortedArrays { private MedianOfTwoSortedArrays() {} private static boolean isMedian (int[] a1, int[] a2, int pos) { if (pos == 0 || pos == (a1.length - 1)) return true; return (a1[pos] &gt;= a2[pos]) &amp;&amp; (a1[pos] &lt;= a2[pos + 1]); } public static Double median (int[] a1, int[] a2) { if (a1.length != a2.length) throw new IllegalArgumentException("The argument thrown is illegal"); int lb = 0; int hb = a1.length - 1; while (lb &lt;= hb) { int a1Median = (lb + hb)/2; int a2Median = (a2.length - 1) - a1Median; if (isMedian(a1, a2, a1Median) || isMedian(a2, a1, a2Median)) { return (a1[a1Median] + a2[a2Median])/2.0; } if (a1[a1Median] &lt; a2[a2Median]) { lb = a1Median + 1; } if (a1[a1Median] &gt; a2[a2Median]) { hb = a1Median - 1; } } return null; } public static void main(String[] args) { int[] a1 = {1, 3, 5, 7, 9}; int[] a2 = {2, 4, 6, 8, 10}; System.out.println("Expected 5.5, Actual " + median (a1, a2)); int[] a3 = {1, 3, 5, 7, 9, 100}; int[] a4 = {2, 4, 6, 8, 10, 200}; System.out.println("Expected 6.5, Actual " + median (a3, a4)); int[] a5 = {1, 2, 3, 4}; int[] a6 = {5, 6, 7, 8}; System.out.println("Expected 4.5, Actual " + median (a5, a6)); int[] a7 = {5, 6, 7, 8}; int[] a8 = {1, 2, 3, 4}; System.out.println("Expected 4.5, Actual " + median (a7, a8)); } } The function median returns a primitive wrapper Double rather than double simply because it's forced to do so. If median is not found then returning -1 may not be the right choice since, -1 may also be a valid median. In this case, unlike binary search, I dont return a index of an array and dont want to do it either. Last option which I have is to throw an exception. But coming to my question: is function median a valid use of a primitive wrapper of just an unwanted hack?
has comment: http://stackoverflow.com/comment/31941707
has comment: http://stackoverflow.com/comment/31942710
tagged with: wrapper
answer count: 1
has comment: http://stackoverflow.com/comment/31941947
has comment: http://stackoverflow.com/comment/31941444
favorite count: 0
has comment: http://stackoverflow.com/comment/31941768
has comment: http://stackoverflow.com/comment/31941323
has answer: http://stackoverflow.com/a/21298201
upvote count: 1
tagged with: primitive
has comment: http://stackoverflow.com/comment/31942782
downvote count: 1
has comment: http://stackoverflow.com/comment/31941951
has comment: http://stackoverflow.com/comment/31941361
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21298201

http://stackoverflow.com/comment/32188659
type: AnswerComment
comment on: http://stackoverflow.com/a/21348631
score: 0
type: Comment
has text: It, as I expected did not work. Its not due to browser issues.If you see it in actual web page, you also would be surprised to see that on selecting the text of a post, it shows it to be normal.But if you do a view page source, you will find it to be in a comment.

http://stackoverflow.com/a/21221401
has body: the onClick you're pointing to in the XML layout file must be part of the Activity that's inflating the view with the button. extract the method out to the class and finish the timer from there, and everything should work just fine. in general, declaring the onClick in the XML is bad practice and should be avoided.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21211853

http://stackoverflow.com/q/21238719
has answer: http://stackoverflow.com/a/21239098
favorite count: 0
tagged with: paintcomponent
type: AnsweredQuestion
has title: Changing painted image in paint panel
tagged with: drawimage
score: 1
has comment: http://stackoverflow.com/comment/31993607
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/21239276
has comment: http://stackoverflow.com/comment/31993058
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31993171
answer count: 2
has body: I'm trying to change the image being painted by sending the new image directory to my paint panel and then changing the Image variable to that image. I've tested the code to make sure that the directories are getting through, but the images never change. They just seem to ignore the new image and keep painting the previous one. I apologize for the messy code but I've been tweaking this for hours trying to get the image to change and the frustration is getting to me. public class painting extends JPanel { private String BGDir; private String Dir; private int Width; private int Height; private Image image1; private Image image2; public painting(int h, int w, String BG, String Char) { BGDir = BG; Dir = Char; Height = h; Width = w; System.out.println(BGDir); System.out.println(Dir); try { image1 = (new ImageIcon(Char)).getImage(); image2 = (new ImageIcon(BG)).getImage(); } catch (Exception e) { System.out.println("no such file"); } repaint(); } public void update(Graphics g) { paintComponent(g); } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; System.out.println(BGDir); System.out.println(Dir); // PAINTS THE BACKGROUND g2.drawImage(image2, 0, 0, getWidth(), (int) (getWidth() * .533), null); // PAINTS THE SCALED CHARACTER g2.drawImage(image1, (int) (Width / 6.22), (int) (Height * .246), (int) (Height * .754 * .2376), (int) (Height * .754), null); repaint(); } }
accepted answer: http://stackoverflow.com/a/21239276
downvote count: 0
possible better answer: http://stackoverflow.com/a/21239098

http://stackoverflow.com/q/21329658
tagged with: dao
has title: How do I build a GenericDao using QueryDSL?
tagged with: querydsl
answer count: 1
tagged with: generics
favorite count: 0
upvote count: 9
has body: First of, I am really new to QueryDSL. I'm using a Spring + Hibernate environment. The problem I'm facing is with building a GenericDAO to implement all the basic CRUD operations, but I'm not sure how do I get the static reference from a QEntity. My entity class structure looks like this: @Entity //jpa public class Entity extends AbstractEntity{ //fields ... } public abstract class AbstractEntity{ //Logger } The basic structure of a QueryDSL-generated entity public class QEntity extends PEntity&lt;Entity&gt;{ ... public static final QEntity entity = new QEntity("entity"); ... //constructors } And the GenericDao would look like this: public class abstract GenericDao&lt;T extends AbstractEntity, K extends PEntity&lt;? extends AbstractEntity&gt;&gt;{ //some kind of method to get the K.k (QEntity.entity) reference. //CRUD operations using T and K } One approach would be using Reflection, but I'm not an advocate of using that method, especially in this case. Another thing that I'm not sure of, is it mandatory to use the static reference from a QEntity to build queries or is it ok if I do a contructor call to get a new object. Also, what does the String in the constructor parameter signify? public QEntity(String variable) { this(Entity.class, forVariable(variable), INITS); }
has answer: http://stackoverflow.com/a/21334643
accepted answer: http://stackoverflow.com/a/21334643
type: AnsweredQuestion
downvote count: 0
tagged with: java
score: 9
type: Question
tagged with: jpa

http://stackoverflow.com/comment/32173014
comment on: http://stackoverflow.com/q/21340004
has text: I have added the code for setting the data, I am now testing with listdata provider.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/39804052
score: 0
type: QuestionComment
type: Comment
has text: thanks for you question, But its is possible for hit `localhost` url from stripe?
comment on: http://stackoverflow.com/q/21197622

http://stackoverflow.com/q/21321088
tagged with: android
has answer: http://stackoverflow.com/a/21321526
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/21321463
tagged with: java
has title: Website Text Search with Android?
type: Question
has body: I'm trying to build an android app for fun, I am able to import the web search box into the app, but what I would like to do, is to have the search restricted to given website(s). So, I would like for the user to be able to enter a string into the text box, and for the search engine to search the given website(s), that is programmed into the script, and return posts associated with the string. Can someone either explain or reference material the will explain how to do this, or at least give me the name of this process so I could do research myself? Thank you in advance
answer count: 2

http://stackoverflow.com/comment/31898638
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21186321
has text: @kocko it means the compiler puts the value in the code as if you had typed it there i.e. the byte code will read `short c = 3;` This generally doesn't matter much but if you change a constant using reflection it could mean it doesn't change anything.
type: Comment

http://stackoverflow.com/a/21362533
answers question: http://stackoverflow.com/q/21330859
score: 0
has body: It's not the problem. in java I can simply do the array and send it to combobox. i can't do it in jess. I don't know how to interact with it.
type: Answer

http://stackoverflow.com/comment/31999294
has text: String comparison should be done with `.equals()`, not `==`. It should be `if( user.equals("user") )`. See [this](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java/513839#513839).
comment on: http://stackoverflow.com/q/21242244
type: Comment
type: QuestionComment
score: 5

http://stackoverflow.com/a/21303642
answers question: http://stackoverflow.com/q/21302908
type: Answer
score: 0
has body: For me the part with count is redundant as you are checking all rows in r variable - after the last significant row (4th) the method will return. You do not need checking if there were 12 numbers checked. What is more temp variable acts as return value in your code which you are actually returning with the method itself - also redundant. I do not see the point in checking already defined number of values using recursion but if you need so consider the following: public static boolean oddRow(int[][] a, int r, int c) { //checking if we checked all rows if (r &gt; 4) { return true; } //checking if all columns in row were checked and moving to r+2 row if (c &gt; 3) { return oddRow(a, r + 2, 0); } //checking if current value is odd - if yes, keep checking the rest / if not, return false return (a[r][c] % 2 == 0) ? oddRow(a, r, c + 1) : false; }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21302908

http://stackoverflow.com/comment/32048452
comment on: http://stackoverflow.com/a/21270133
type: Comment
score: 3
type: AnswerComment
has text: +1 Proper test/benchmark suites are generally more apt than proliferation of development artifacts in code.

http://stackoverflow.com/q/21239389
has answer: http://stackoverflow.com/a/21240040
tagged with: configuration
tagged with: struts2
accepted answer: http://stackoverflow.com/a/21240040
score: 2
type: AnsweredQuestion
tagged with: ognl
downvote count: 0
has title: File download issue: comma in the file name in Struts 2
favorite count: 0
tagged with: download
type: Question
has body: I have a file download functionality in my application (the type of file can be TXT, DOCX, PDF, etc.). When I upload a file (for example : file A.pdf), I can download the file normally (the file downloaded is file A.pdf). But if there's a comma in the file name (for example : file,A.pdf), the file downloaded is named telechargerFichier.action which is the name of my action. Here is the key part of my struts.xml for downloading file : application/octet-stream fileInputStream 1024 How to solve this problem?
upvote count: 2
tagged with: java
answer count: 1

http://stackoverflow.com/comment/31963206
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21210012
has text: I get it, my point is you should rework your tests so they can't fail due to issues such as multiple test runs happening on the same machine.
score: 0

http://stackoverflow.com/q/21185922
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/44743590
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/33455956
tagged with: datanucleus
answer count: 2
upvote count: 1
favorite count: 0
tagged with: google-app-engine
has body: We've built a basic RESTful API using Google App Engine Cloud Endpoints, and we're looking to unit test some of the code we've written, just to check that inserts and updates do everything that we expect for example. I've looked into to Local Unit Testing documentation that Google provide, and implemented everything it suggests but am still getting crashes when EntityManager.close() is being called. I've added the 4 .jar files and am using LocalServiceTestHelper in my test file. I was hoping someone could shed some light on the problem, I'm under the assumption that all I need to do is change a value in the persistance.xml to allow DataNucleus to run within local unit tests, or maybe a .jar file i'm missing? I hope someone can help, one of the many users of Google App Engine! I can provide code but all i'm really doing is EntityManager.persist(Obj); ... EntityManager.close(); The Console output related to the problem is: Jan 17, 2014 12:08:04 PM org.datanucleus.transaction.Transaction rollback SEVERE: Operation rollback failed on resource: com.google.appengine.datanucleus.DatastoreXAResource@556afa8, error code UNKNOWN and transaction: [DataNucleus Transaction, ID=Xid=, enlisted resources=[com.google.appengine.datanucleus.DatastoreXAResource@556afa8]] Pointing to a datanucleus problem. The stack trace javax.persistence.PersistenceException: Illegal argument at org.datanucleus.api.jpa.NucleusJPAHelper.getJPAExceptionForNucleusException(NucleusJPAHelper.java:298) at org.datanucleus.api.jpa.JPAEntityManager.close(JPAEntityManager.java:197) at com.multipie.snapture.HashtagEndpoint.insertHashtag(HashtagEndpoint.java:124) at com.multipie.snapture.tests.HashtagTest.testInsertHashtag(HashtagTest.java:30) 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…
has answer: http://stackoverflow.com/a/21188202
has comment: http://stackoverflow.com/comment/31909848
has title: App Engine Cloud Endpoints Unit Testing, Issues with Data Nucleus, Is it possible?
tagged with: google-cloud-endpoints
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/31963752
has text: Boris is probably right, Tomcat may be running into an used port number and thus it does not start. However, your main problem is still your OutOfMemoryError; maybe you tried a memory sizing solution too soon. Have you diagnosed when and where is that memory being used? Have you tried any tool like jconsole (free, coming with JDK) in order to get more information about it? Maybe it can lead you to some coding error or bad practice with an easy solution
comment on: http://stackoverflow.com/q/21222087
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31955490
has text: I still got a little issue.. In the "ActionListener" class, Model Model = new Model(); now need a parameter(gui).. what should i pass in :-)?
type: AnswerComment
comment on: http://stackoverflow.com/a/21217469
score: 0
type: Comment

http://stackoverflow.com/q/21274478
tagged with: ffmpeg
upvote count: 2
score: 2
tagged with: video
has answer: http://stackoverflow.com/a/21276884
has comment: http://stackoverflow.com/comment/32057586
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32057230
tagged with: java
has body: I am trying to create video from images. but it takes too much time if I select more than 10 images. Can anybody help me to resolve this problem. I am using the following command: ffmpeg -y -r 1/5 -i frame_%05d.jpg -c:v libx264 -r 30 video.mp4; Thanks in advance.
type: Question
answer count: 1
downvote count: 0
has title: ffmpeg take long time for creating video from images
accepted answer: http://stackoverflow.com/a/21276884
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/32057222

http://stackoverflow.com/a/21275611
score: 1
has body: why don't you just use an array of Date objects? It seems to implement what you are trying to do with this 2D array already. Actually should use Calendar.set which replaces the link above
upvote count: 1
has comment: http://stackoverflow.com/comment/32057932
has comment: http://stackoverflow.com/comment/32057852
downvote count: 0
has comment: http://stackoverflow.com/comment/32057842
answers question: http://stackoverflow.com/q/21275555
type: Answer

http://stackoverflow.com/comment/31940983
has text: I think Karl-Heinz asked the correct question. *What* are you trying to build? Which pom.xml?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21204200

http://stackoverflow.com/a/21246875
answers question: http://stackoverflow.com/q/21246813
type: Answer
has body: You are boxing bytes within an ArrayList, which uses much more memory than simple Strings. What this means is each byte is wrapped in a whole object, and referred to by a reference. Note that such a reference is itself 4 to 8 times larger than the original byte! You would be much better off using primitive byte [] arrays, or perhaps a primitive collections library (which properly abstracts primitive arrays as collections) such as this or this.
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/21338883
downvote count: 0
answer count: 3
has body: I'm writting my application using Spring MVC. I want to validate is e-mail exists in database when user is registering. I've written my own annotation constraint named UniqueEmail. My User entity User.java: @Entity @Table(name="users") public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; @Column(name = "email", length = 100, nullable = false, unique = true) @NotEmpty @Email @UniqueEmail(message = "E-mail is not unique") private String email; @Column(name = "password", nullable = false) @NotEmpty @Size(min = 5, message = "size must be more 5") private String password; } My annotation constraint UniqueEmail.java: @Target({FIELD}) @Retention(RUNTIME) @Constraint(validatedBy = UniqueEmailValidator.class) @Documented public @interface UniqueEmail { String message() default "Email is exist"; Class<?>[] groups() default {}; Class<? extends Payload>[] payload() default {}; } My validator UniqueEmailValidator.java: @Component public class UniqueEmailValidator implements ConstraintValidator<UniqueEmail, String> { @Autowired private UserService userService; @Override public void initialize(UniqueEmail uniqueEmail) { } @Override public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) { try { return userService.isExistEmail(s); } catch (Exception e) { System.out.println(e); return false; } } } This code works in application. When I run my test code its return NullPointerException. In my validation class userService is null. I've read http://docs.spring.io/spring/docs/3.0.0.RC3/reference/html/ch05s07.html but cannot any solution. Any idea? Update I use JUnit. UserClassTest.java @ContextConfiguration("file:src/main/webapp/WEB-INF/mvc-dispatcher-servlet.xml") public class UserClass { private static Validator validator; @BeforeClass public static void setup() { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); } @Test public void emailIsUnique() { User user …
favorite count: 0
has comment: http://stackoverflow.com/comment/32171844
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32172284
has answer: http://stackoverflow.com/a/22649094
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/21367811
score: 7
has comment: http://stackoverflow.com/comment/32170060
tagged with: java
has answer: http://stackoverflow.com/a/21344002
upvote count: 7
type: Question
tagged with: bean-validation
has title: How to autowire service in ConstraintValidator

http://stackoverflow.com/a/21229328
type: Answer
accepted answer of: http://stackoverflow.com/q/21229026
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/31978930
type: AcceptedAnswer
downvote count: 0
has body: Should i use a Group and the player and the weapon are part of that group? Yes, that's the correct approach. A Group is part of a Stage and whenever the group is moved, all members (Actors) of that group move with it. It also acts like a new, local coordinate system. You could actually make your Player class a group instead of putting it in a group. The weapon itself will then be added to your player-group and its position should be fixed. Fixed means, that it will only be set once, to a small offset which will be added to the player-group position. Splitting up the weapon and the player makes sense, because when shooting you might want the weapon to "shake" a little bit, but your player should not do that. In pseudo code your given scenario might look like this: class Hero extends Actor { // update logic in act() // render sprite in draw() depending on the this.getX()/getY() } class Weapon extends Actor { // update logic in act() // render sprite in draw() depending on the this.getX()/getY() } class Character extends Group { private Hero hero; private Weapon weapon; public Character(Hero hero, Weapon weapon) { this.hero = hero; this.weapon = weapon; addActor(hero); addActor(weapon); weapon.setPosition(10f, 0f); // small offset to the right } } Moving the whole character would now work by using character.setPosition(). But as I said: Since the hero would probably execute the logic, you should get rid of your Character and make Hero a Group and add the weapon to it. Otherwise your hero needs a reference to the character-group to be able to move. That would also make switching weapons much easier. The logic-hero could then do that himself and doesn't need to manage the character group.
has comment: http://stackoverflow.com/comment/31989751
answers question: http://stackoverflow.com/q/21229026
has comment: http://stackoverflow.com/comment/31976039

http://stackoverflow.com/a/26854536
type: Answer
answers question: http://stackoverflow.com/q/21333949
has body: My reading is that you are experimenting with Java and programming and are now curious as to how to deploy an application into the wild. You could try a raw server such as an Amazon Web Service free account; but you will be biting off a lot of setup, net admin, sys admin work. Most service don't provide a graphical interface so using JFrame and swing is not going to work. You will be better off using a free web PaaS such as redhat openshift and making websockets chat app if you want to learn how to make software that runs in the wild.
score: 0

http://stackoverflow.com/comment/32073847
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21285080
score: 1
has text: (In fact, `Byte.parseByte` will throw an exception for that input...)

http://stackoverflow.com/comment/32165406
score: 4
comment on: http://stackoverflow.com/q/21336425
type: Comment
type: QuestionComment
has text: I can't reproduce this - it works fine for me... although the code that you say is broken doesn't even compile (System vs system), which leads me to wonder whether the *really* broken code is significantly different in some way. It would really help if you could post a short but complete program which demonstrates the problem.

sockets
tags question: http://stackoverflow.com/q/21191749
tags question: http://stackoverflow.com/q/21220383
tags question: http://stackoverflow.com/q/21272216
tags question: http://stackoverflow.com/q/21227108
tags question: http://stackoverflow.com/q/21247832
tags question: http://stackoverflow.com/q/21330421
tags question: http://stackoverflow.com/q/21198869
tags question: http://stackoverflow.com/q/21299231
tags question: http://stackoverflow.com/q/21191017
tags question: http://stackoverflow.com/q/21212066
tags question: http://stackoverflow.com/q/21199254
tags question: http://stackoverflow.com/q/21194536
tags question: http://stackoverflow.com/q/21261206
tags question: http://stackoverflow.com/q/21322537
tags question: http://stackoverflow.com/q/21313643
tags question: http://stackoverflow.com/q/21349796
tags question: http://stackoverflow.com/q/21247781
tags question: http://stackoverflow.com/q/21349771
tags question: http://stackoverflow.com/q/21321295
tags question: http://stackoverflow.com/q/21337599
tags question: http://stackoverflow.com/q/21195006
tags question: http://stackoverflow.com/q/21279236
type: Tag
tags question: http://stackoverflow.com/q/21186928
tags question: http://stackoverflow.com/q/21297271
tags question: http://stackoverflow.com/q/21193167
tags question: http://stackoverflow.com/q/21228716
tags question: http://stackoverflow.com/q/21335152
tags question: http://stackoverflow.com/q/21246489
tags question: http://stackoverflow.com/q/21186438
tags question: http://stackoverflow.com/q/21199439
tags question: http://stackoverflow.com/q/21340129
tags question: http://stackoverflow.com/q/21226929
tags question: http://stackoverflow.com/q/21233586
tags question: http://stackoverflow.com/q/21333949
tags question: http://stackoverflow.com/q/21242289
tags question: http://stackoverflow.com/q/21267457
tags question: http://stackoverflow.com/q/21191551
tags question: http://stackoverflow.com/q/21231129
tags question: http://stackoverflow.com/q/21291081
tags question: http://stackoverflow.com/q/21211235
tags question: http://stackoverflow.com/q/21260566
tags question: http://stackoverflow.com/q/21201678
tags question: http://stackoverflow.com/q/21207664
tags question: http://stackoverflow.com/q/21304249
tag name: sockets
tags question: http://stackoverflow.com/q/21203595
tags question: http://stackoverflow.com/q/21321247
tags question: http://stackoverflow.com/q/21242690
tags question: http://stackoverflow.com/q/21314914
tags question: http://stackoverflow.com/q/21274162
tags question: http://stackoverflow.com/q/21309266
tags question: http://stackoverflow.com/q/21230361
tags question: http://stackoverflow.com/q/21199644
tags question: http://stackoverflow.com/q/21220878
tags question: http://stackoverflow.com/q/21247244
tags question: http://stackoverflow.com/q/21316135
tags question: http://stackoverflow.com/q/21342370
tags question: http://stackoverflow.com/q/21216476
tags question: http://stackoverflow.com/q/21339342
tags question: http://stackoverflow.com/q/21311276
tags question: http://stackoverflow.com/q/21287087
tags question: http://stackoverflow.com/q/21212694

http://stackoverflow.com/comment/31910606
type: Comment
type: QuestionComment
has text: Have you bothered to step through the code in the debugger?
comment on: http://stackoverflow.com/q/21192685
score: 0

http://stackoverflow.com/a/21275958
accepted answer of: http://stackoverflow.com/q/21275819
downvote count: 2
answers question: http://stackoverflow.com/q/21275819
upvote count: 217
has comment: http://stackoverflow.com/comment/133386892
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32058585
has comment: http://stackoverflow.com/comment/112710176
has body: You can get the Signature from a ProceedingJoinPoint and in case of a method invocation just cast it to a MethodSignature. @Around("execution(public * *(..)) &amp;&amp; @annotation(com.mycompany.MyAnnotation)") public Object procede(ProceedingJoinPoint call) throws Throwable { MethodSignature signature = (MethodSignature) call.getSignature(); Method method = signature.getMethod(); MyAnnotation myAnnotation = method.getAnnotation(MyAnnotation.class); } But you should first add an annotation attribute. Your example code doesn't have one, e.g. @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface MyAnnotation { String value(); } Then you can access it MyAnnotation myAnnotation = method.getAnnotation(MyAnnotation.class); String value = myAnnotation.value(); EDIT How to get value if I have @MyAnnotation("ABC") at class level ? A Class is also an AnnotatedElement, so you can get it the same way as from a Method. E.g. An annotation of the method's declaring class can be obtained using Method method = ...; Class&lt;?&gt; declaringClass = method.getDeclaringClass(); MyAnnotation myAnnotation = declaringClass.getAnnotation(MyAnnotation.class) Since you are using spring you might also want to use spring's AnnotationUtils.findAnnotation(..). It searches for an annotation as spring does. E.g. also looking at superclass and interface methods, etc. MyAnnotation foundAnnotation = AnnotationUtils.findAnnotation(method, MyAnnotation.class); EDIT You might also be interessted in the capabilities of spring's MergedAnnotations which was introduced in 5.2.
type: Answer
has comment: http://stackoverflow.com/comment/108981518
score: 215

http://stackoverflow.com/comment/32124584
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21296953
score: 0
has text: Well, regarding the Key Bindings, I'm just curious to see how to make it work if I use KeyListener. If it does work, I will switch over to Key Bindings. I just want to see if it'll work using KeyListener. That's all.

http://stackoverflow.com/q/21303001
answer count: 0
has comment: http://stackoverflow.com/comment/32111262
type: UnansweredQuestion
tagged with: opencv
tagged with: java
tagged with: image-processing
has body: Here's the code: Mat img = Highgui.imread("recleft.jpg"); Mat procImg = new Mat(); BackgroundSubtractorMOG bs = new BackgroundSubtractorMOG(); bs.apply(img, procImg); Highgui.imwrite("test.jpg", procImg); However, when I open the test.jpg being produced by the program, it says "Invalid image". There is no direct tutorial I found regarding background subtractor using java and opencv. I based my code here!. I am currently creating a program which allow user to upload an image then get the background.
type: Question
has comment: http://stackoverflow.com/comment/32113355
score: 0
has title: Opencv: Invalid image when using BackgroundSubtractor
has comment: http://stackoverflow.com/comment/32110423

http://stackoverflow.com/a/21257695
score: 0
has comment: http://stackoverflow.com/comment/32025799
answers question: http://stackoverflow.com/q/21257162
type: Answer
has comment: http://stackoverflow.com/comment/32025436
has comment: http://stackoverflow.com/comment/32062685
has comment: http://stackoverflow.com/comment/32026114
has comment: http://stackoverflow.com/comment/32026255
has body: Also you need to track the following: Free Heap Thread count Timeout connection from pool All application threads and their states GC activities Rolled Back transaction Messages on the queue all these things directly effects any application performance. so you can track the above by using visualvm from JDK, or Java Mission Control. Mission Control is bundled with JDK starting at JDK 7 Update 40. With these tools you can connect to any JVM process, local or remote. If you're connecting to a remote JVM, you should have enabled JMX via JVM parameter -Dcom.sun.management.jmxremote.port=9010

http://stackoverflow.com/a/21227465
upvote count: 4
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/21227328
has body: I tried out this code (in the main method): Scanner scan = new Scanner(System.in); new Thread(){ public void run(){ Scanner scan = new Scanner(System.in); while(true){ if(scan.hasNext())System.out.println("Thread:"+scan.nextLine()); } } }.start(); while(true){ if(scan.hasNext())System.out.println("Main:"+scan.nextLine()); } Most of the time, neither thread was printing, and when it did print, it was clear that they were both parsing input at the same time. While they did not (I think) end up with duplicate characters, an input of abcd might send ac to one thread's scanner and bd to the other one. Sample run (anything not preceded by Main: or Thread: is input): abcdefghi jklmnopqr Thread:ghi Thread:mnopqr stuvwxyzA Thread:vwxyzA BCDEFGHIJ KLMNOPQRS Thread:KLM Main:abcdefjklstuBCDEFGHIJ TUVWXYZ`~ 1!2@3#4$5 Main:NOPQRS~ Thread:TUVWXYZ`1!2@3#4$5 If you wanted both threads to get the stdin, you could create a class such as this (it works, but is not optimal at all): class STDIN extends Thread{ //this way, it can only be used once, like intended. private static final BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); private static final ArrayList&lt;Integer&gt; data = new ArrayList&lt;&gt;(); private static final ArrayList&lt;Integer&gt; dataFlags = new ArrayList&lt;&gt;(); public void run(){ while(true){ synchronized(data){ try { int i = stdin.read(); if (i == -1) break; data.add(i); } catch (IOException ex) { ex.printStackTrace(); } synchronized(dataFlags){ if (dataFlags.get(0) == 3){ dataFlags.remove(0); data.remove(0); } } } } try { stdin.close(); } catch (IOException ex) { ex.printStackTrace(); } } public int getByte(int index){ synchronized(data){ return data.get(index); } } public void flagA(int index){ synchronized(dataFlags){ if (index&gt;dataFlags.size()){ dataFlags.add(1); } else{ dataFlags.set(index, dataFlags.get(index) | 1); } } } public void flagB(int index){ synchronized(dataFlags){ if (index&gt;dataFlags.size()){ dataFlags.add(2…

http://stackoverflow.com/q/21203512
upvote count: 1
has answer: http://stackoverflow.com/a/21203681
type: Question
tagged with: java
has title: World of Zuul: non-static method getCurrentRoom() cannot be referenced from a static context
tagged with: bluej
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has body: I know this question comes up often, but even after looking at asked question's I can't find a solution.. So for school we have to create an own version of World of Zuul. I've implemented a beamer in it. First I put it in the Game class, but I decided it would be better to have it in it's own class, Beamer. The Beamer class looks as follows: public class Beamer { private Room beamerRoom; private Room beamer; private int timesFired; private boolean beamerCharged; public Beamer(int timesFired, boolean beamerCharged) { this.timesFired = 0; this.beamerCharged = false; } public int getTimesFired() { return timesFired; } public Room getBeamerRoom() { return beamerRoom; } public boolean getBeamerCharged() { return beamerCharged; } public Room setBeamerRoom(Room room) { this.beamerRoom = Game.getCurrentRoom(); return beamerRoom; } /** * Try to use beamer device. When you charge the beamer, it memorizes the current room. * When you fire the beamer, it transports you immediately back to the room it was * charged in. */ public void beamer(Command command){ if (!command.hasSecondWord()) { // if there is no second word, we don't know what to do... System.out.println("Charge or fire beamer?"); return; } String action = command.getSecondWord(); if (action.equals("charge")) { if(timesFired() &lt; 1) { beamerRoom = Game.getCurrentRoom(); System.out.println("This room is charged to beam!"); beamerCharged = true; } else { System.out.println("The beamer has already been fired and can't be charged again"); } } else if (action.equals("fire")) { if(beamerCharged == true) { if(timesFired &lt; 1) { Game.getCurrentRoom() = beamer.getBeamerRoom(); System.out.println("The beamer has succesfully been fired!"); System.out.println(currentRoom.getLongDescription()); timesFired++; beamerCharged = false; } else { System.out.println("You can only fire the beamer once!"); } } else { System.out.println("The beamer hasn't been charged yet!"); } } else { System.out.println("Invalid beamer command!"); ret…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31930003

http://stackoverflow.com/comment/31935339
type: QuestionComment
has text: This question is about a hex representation of the value of the float. [How to convert hex string to float in Java?](https://stackoverflow.com/questions/1071904/how-to-convert-hex-string-to-float-in-java) was about a hex representation of a float's bit pattern. It's the difference between representing 32 bit floating point 1 as 0x1p0 and 0x3f800000.
comment on: http://stackoverflow.com/q/21199852
score: 0
type: Comment

http://stackoverflow.com/a/21246043
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21221114
accepted answer of: http://stackoverflow.com/q/21221114
has body: Since you use Play 2.2.1 that comes with sbt 0.13 support I'll use build.sbt instead. You should be able to migrate it to ApplicationBuild of yours with ease as the changes are rather cosmetic. Create build.sbt in the project directory of the Play application with the following content: import sbt.complete.Parsers._ import myfolder.Foo lazy val foo = inputKey[Unit]("Foo you.") foo := { val args: Seq[String] = spaceDelimited("&lt;arg&gt;").parsed Foo.bar(args: _*) } Note that import's don't need a new line in-between as well as args needs to be expanded to varargs with _*. Save the following Foo.java file in project/src/main/java/myfolder. project/src/main/java/myfolder/Foo.java package myfolder; public class Foo { public static void bar(String... args) { for(String s : args) System.out.println(s); } } Please note that since you need to use the Java class in the build definition (be able to execute a task with parameters from SBT), it has to be part of the SBT build not your Play project (and hence it's under project - see sbt is recursive). When SBT shell's up, run the foo input task with any number of arguments: [sbt-0-13-1]&gt; foo2 ala ma kota ala ma kota [success] Total time: 0 s, completed Jan 21, 2014 12:00:46 AM
type: Answer
has comment: http://stackoverflow.com/comment/32045435
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32047102
upvote count: 2

http://stackoverflow.com/a/21210977
score: 8
accepted answer of: http://stackoverflow.com/q/21205871
has body: int color = image.getRGB(x, y); // extract each color component int red = (color &gt;&gt;&gt; 16) &amp; 0xFF; int green = (color &gt;&gt;&gt; 8) &amp; 0xFF; int blue = (color &gt;&gt;&gt; 0) &amp; 0xFF; // calc luminance in range 0.0 to 1.0; using SRGB luminance constants float luminance = (red * 0.2126f + green * 0.7152f + blue * 0.0722f) / 255; // choose brightness threshold as appropriate: if (luminance &gt;= 0.5f) { // bright color } else { // dark color }
has comment: http://stackoverflow.com/comment/105690238
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/105694172
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/21205871

http://stackoverflow.com/q/21281780
has comment: http://stackoverflow.com/comment/32068331
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32071848
has answer: http://stackoverflow.com/a/21282325
has body: Here I am going to update the record. By adding one more child for the exciting parent and here I am removing the child by iterating the child's and then I am updating the record but its giving the exception as. EXCEPTION:org.hibernate.HibernateException: Found two representations of same collection: com.treamis.entity.LibraryBookListEntity.chield Here is my code. LibraryBookForm lb = (LibraryBookForm) form; int bookid = lb.getBooklistid(); System.out.println("bookidbookidbookid" + bookid); String[] bar = lb.getBarcode(); String[] accission = lb.getAccessno(); System.out.println("accissionaccission" + bar); UserEntity msg; HttpSession session = request.getSession(false); msg = (UserEntity) session.getAttribute("user"); int catid = lb.getCategory(); Session ses = HibernateUtil.getSessionFactory().openSession(); String d1 = lb.getBilldate(); java.util.Date temp = new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH).parse(d1); java.sql.Date date = new java.sql.Date(temp.getTime()); String d2 = lb.getDateAdded(); java.util.Date temp1 = new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH).parse(d2); java.sql.Date submissionDate = new java.sql.Date(temp1.getTime()); CategoryEntity ce = (CategoryEntity) ses.get(CategoryEntity.class, catid); LibraryBookListEntity lbl = (LibraryBookListEntity) ses.load(LibraryBookListEntity.class, bookid); Set&lt;LibraryBarCodeEntity&gt; s1 = lbl.getChield(); for (LibraryBarCodeEntity lbb : s1) { System.out.println("inside delte"); ses.delete(lbb); } Transaction tx = ses.beginTransaction(); lbl.setEdition(lb.getEdition()); lbl.setPublisher(lb.getPublisher()); lbl.setPlace(lb.getPlace()); lbl.setPage(lb.getPag()); lbl.setSource(lb.getSource()); lbl.setBillno(lb.getBillno()); lbl.setBilldate(date); lbl.setPublishedyear(lb.getPublishedyear()); lbl.setCallno(lb.getCallno()); lbl.setIsbn(lb.getIsbn()); lbl.setBooktitle(lb.getBooktitle()); lbl.setRack(lb.getRack()); lbl.setAuthor(lb.getAuthor()); lbl.setPrice(lb.getPrice()); lbl.setCategoryid(ce); lbl…
type: Question
has title: How to update the record by adding one more child row for exciting child by using hibernate?
has comment: http://stackoverflow.com/comment/32068137
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/32071173
answer count: 1

http://stackoverflow.com/comment/31994825
has text: You don't have anything subscribed to `input`. Direct channels need at least one subscriber. If you are just testing and want to see the wire tap, add a `<queue/>` subelement to the channel to make it a `QueueChannel`.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21235543
score: 0

http://stackoverflow.com/comment/31949463
type: Comment
type: AnswerComment
has text: @ErwinBolwidt You are correct. However, if you read the comments to the question made an hour before you made this comment, the OP is talking about 32bit ints.
score: 0
comment on: http://stackoverflow.com/a/21213058

http://stackoverflow.com/q/21334016
has answer: http://stackoverflow.com/a/21347355
has comment: http://stackoverflow.com/comment/32162777
score: 0
tagged with: eclipselink
answer count: 1
tagged with: jpa
tagged with: persistence
has title: Change column copy their father
type: AnsweredQuestion
tagged with: java
has body: I have problem with persist, in all my Entities I have control fields last user was update this and date when he update this. My problem are when I create or update an Entity and in this I create or update other Entity(dependent) I can´t change 'last user' and 'date update' on generic way. Any idea how to do??? Entity contains -> List of dependent Entity Like building -> List of flats THX and good weekend
accepted answer: http://stackoverflow.com/a/21347355
type: Question

http://stackoverflow.com/a/21195186
score: 0
has body: Use foreach and new String(char[] value) for row. public static String returnWhatIsInTheArrayAsAString(char[][] array) { String string = ""; for (char[] row : array) { string += new String(row) + "\n"; } return string; } Sample usage: public static void main(String[] args) throws InterruptedException { char[][] foo = new char[][] {{'a', 'b', 'c'}, {'d', 'e', 'f'}, {'g', 'h', 'i'}}; System.out.println(returnWhatIsInTheArrayAsAString(foo)); } will return abc def ghi
answers question: http://stackoverflow.com/q/21195088
type: Answer

google-oauth
tags question: http://stackoverflow.com/q/21334300
type: Tag
tag name: google-oauth

http://stackoverflow.com/a/21239537
type: Answer
has comment: http://stackoverflow.com/comment/31994579
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/31994850
answers question: http://stackoverflow.com/q/21239386
has body: y is always 0 x=sin (yaw) z=cos (yaw)
downvote count: 0

http://stackoverflow.com/comment/31904296
score: 0
type: Comment
has text: @Octopus because it requires run-time checking, read [the javadoc](http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#newInstance%28%29) pay particular attention to the Exceptions.
type: AnswerComment
comment on: http://stackoverflow.com/a/21189237

http://stackoverflow.com/a/21314967
type: Answer
has body: You're right that short are promoted to ints. This occurs during the evaluation of the binary operator +, and it's known as binary numeric promotion. However, this is effectively erased with compound assignment operators such as +=. Section 15.26.2 of the JLS states: A compound assignment expression of the form E1 op= E2 is equivalent to E1 = (T) ((E1) op (E2)), where T is the type of E1, except that E1 is evaluated only once. That is, it's equivalent to casting back to short.
upvote count: 17
answers question: http://stackoverflow.com/q/21314877
score: 17
has comment: http://stackoverflow.com/comment/32139554
has comment: http://stackoverflow.com/comment/32126747
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21314877

http://stackoverflow.com/comment/31965143
type: Comment
comment on: http://stackoverflow.com/a/21223088
has text: @mKorbel: yep, and also `setPrototypeCellValue(...)`.
type: AnswerComment
score: 1

http://stackoverflow.com/q/21262400
duplicate of: http://stackoverflow.com/q/1555262
has title: How to get difference between current date and other date ( java.util.Date) in years in Java
duplicate of: http://stackoverflow.com/q/5042587
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21262473
tagged with: java
tagged with: date
score: 0
has comment: http://stackoverflow.com/comment/32034069
favorite count: 0
accepted answer: http://stackoverflow.com/a/21262473
has answer: http://stackoverflow.com/a/21262511
linked to: http://stackoverflow.com/q/1555262
has answer: http://stackoverflow.com/a/21262521
has body: How to get difference between current date and other date ( java.util.Date) in years in Java I have incoming java.util.Date object and I need to get how many whole years are between them. I tried Joda's time Period but I have to create joda's time object. Is there other way to calculate this difference. Way to get millis and try to convert it to years doesn't count leap years.
answer count: 4
linked to: http://stackoverflow.com/q/5042587
possible better answer: http://stackoverflow.com/a/21262705
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32035523
has answer: http://stackoverflow.com/a/21262705

grails
tags question: http://stackoverflow.com/q/21246448
tags question: http://stackoverflow.com/q/21302618
type: Tag
tags question: http://stackoverflow.com/q/21232815
tags question: http://stackoverflow.com/q/21322594
tags question: http://stackoverflow.com/q/21307800
tags question: http://stackoverflow.com/q/21289285
tag name: grails
tags question: http://stackoverflow.com/q/21228772
tags question: http://stackoverflow.com/q/21279236

http://stackoverflow.com/q/21330767
tagged with: ntlm
answer count: 1
has title: Do Jersey client support NTLM proxy
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22411662
type: UnansweredQuestion
tagged with: jersey-client
has body: I'm trying to make a jersey client call using NTLM proxy? is that possible as i was not able to get any clear information on the same. Did anyone tried before?
score: 3
tagged with: proxy-authentication
upvote count: 3
tagged with: java
tagged with: http
type: Question

http://stackoverflow.com/comment/32107648
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21303770
has text: Sure, but he's not dividing by other numbers. For THIS problem, this solution is fine. Any other solution is NOT "a much better way of doing it", as you put it.

http://stackoverflow.com/a/21188970
score: 5
accepted answer of: http://stackoverflow.com/q/21185208
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31904432
has body: I'm sorry you don't want references to the docs, but that's where all the information is. StaticApplicationContext states org.springframework.context.ApplicationContext implementation which supports programmatic registration of beans and messages, rather than reading bean definitions from external onfiguration sources. Mainly useful for testing. So you use it to register bean definitions directly StaticApplicationContext context = new StaticApplicationContext(); context.registerBeanDefinition(beanName, beanDefinition); This can be used in cases where your ApplicationContext needs to be dynamically changed. Note that you can pass a parent ApplicationContext to the StaticApplicationContext if you need both behaviors, ie. reading from XML/Java config and dynamically registering. ClassPathXmlApplicationContext is one of the more common ApplicationContext implementations in my opinion. You simply point it to an XML (bean definition) resource on the classpath and it loads it up. The javadoc states Useful for test harnesses as well as for application contexts embedded within JARs. You could therefore simply point to a resource on the classpath coming from a JAR and load that. It's simply enough to setup tests environments this way. ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("some-context.xml"); // boom you're ready to go Note that Spring's JUnit support classes offer other (better) ways to setup testing environment. But from that definition its not clear that ClassPathXmlApplicationContext also implements AbstractRefreshableApplicationContext and can be used to change beans definition without stopping server. That's what the javadoc is for. FileSystemXmlApplicationContext is similar to the ClasspathXmlApplicationContext above, but it takes the configuration files from the file system instead of reading resources from the classpath. ResourceAdapterApplicationContext states org.springframework.context.ApplicationContext implementation for a J…
upvote count: 5
has comment: http://stackoverflow.com/comment/31905782
has comment: http://stackoverflow.com/comment/31905663
type: Answer
has comment: http://stackoverflow.com/comment/31905117
downvote count: 0
answers question: http://stackoverflow.com/q/21185208

http://stackoverflow.com/q/21220019
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has title: How can I make multiple activities be in one activity changing only strings?
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/33757467
tagged with: java
has body: I have an app that contains a ListView in its menu which I want to link to one activity with the same layout style but the content inside should be different after being clicked on. The ListView contains a list of songs, and the layout of an individual item when clicked contains a Title (TextView), Lyrics (TextView), a "next_button" button, a "previous_button" button to move between songs, a "back_button" button to get back to the ListView and a "play_tune" button which plays audio for that specific song. Not all of the songs contain audio, but where the "play_tune" button lies, I would like the app icon ic_launcher-web.png showing there instead. The XML file I would like to show (for a song with audio) is shown below: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/song" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000000" 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=".ScoutSongs" &gt; &lt;TextView android:id="@+id/Title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:textColor="#FFFFFF" android:textSize="20sp" /&gt; &lt;ImageButton android:id="@+id/play_tune" android:src="@drawable/play_tune" android:contentDescription="@string/play_tune" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignRight="@+id/Title" android:layout_alignTop="@+id/Title" /&gt; &lt;ScrollView android:id="@+id/LyricsView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/back_button" android:layout_alignLeft="@+id/Title" android:layout_alignRight="@+id/play_tune" and…
type: Question
has answer: http://stackoverflow.com/a/21220130
upvote count: 0
tagged with: layout
score: -2
tagged with: listview
has comment: http://stackoverflow.com/comment/33100067
tagged with: android
answer count: 1

http://stackoverflow.com/comment/31948775
type: Comment
has text: there is no need to add any jar . just add jboss.client present in jboss. Try using this ----- Context initialContext; initialContext = new InitialContext(pr); in your code.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21213922

http://stackoverflow.com/comment/32156146
comment on: http://stackoverflow.com/a/21331099
type: AnswerComment
type: Comment
score: 8
has text: @user1929674: The title of your question is "string.length not working properly in java". I maintain that `String.length()` works *perfectly* in Java, at least as far as is shown here. If you acknowledge that the bug is in your own code, it's not a good idea to start off by saying that other code isn't working...

http://stackoverflow.com/a/21216372
has comment: http://stackoverflow.com/comment/31954292
accepted answer of: http://stackoverflow.com/q/21216277
has comment: http://stackoverflow.com/comment/31957934
answers question: http://stackoverflow.com/q/21216277
type: Answer
has comment: http://stackoverflow.com/comment/31957030
has comment: http://stackoverflow.com/comment/44949292
upvote count: 2
has comment: http://stackoverflow.com/comment/44954723
has comment: http://stackoverflow.com/comment/31956886
has comment: http://stackoverflow.com/comment/31957783
score: 2
has comment: http://stackoverflow.com/comment/44949649
has body: I think you're missing something here. When you move from constructing dependencies inside the classes that use them, to inject them, you have to stop constructing them at all. I guess that's a little vague, let me explain with an example: Let's say you have a class Foo that uses the bean you're creating in the context: class Foo { public void someMethod() { MyClass myClass1 = new MyClass(); // do something with myClass1 } } And now you want to inject the bean. You don't call directly to AnnotationConfigApplicationContext like you did in your example. You're doing something like this: class Foo { private MyClass myClass1; public Foo(MyClass myClass1) { this.myClass1 = myClass1; } public void someMethod() { // do something with myClass1 } } In your application context you create Foo as a bean as well. Something like: @Configuration public class ApplicationConfiguration { @Bean Foo createFooBean() { return new Foo(createMyClassBean()); } @Bean MyClass createMyClassBean() { return new MyClass(); } } If you have arguments to the constructor of MyClass you need to pass them in the @Configuration class, when you create the bean. If you have different scenarios, and in each of them you need to construct MyClass with different arguments - you need to create multiple beans, that each instantiate its own MyClass.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21254069
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21251559
has body: Unfortunately, there's no (simple) way of doing that. The reason is that the ThemeDisplay object is tied to the current user and the current page. In the context of a scheduler (i.e., an automatically triggered event made by the system itself), there's no current logged in user (ok, you could use the default user, but...), and there's no displayed page. What you can do however is to make the required data available from somewhere else. You can store it in a custom property, read it from the DB or get it through services and so on. The PortalUtil.getPortalURL() function for instance may be your friend. Otherwise, you need the request object to get the ThemeDisplay.
upvote count: 2

http://stackoverflow.com/comment/32105708
has text: @EmilLundberg, It will return true for `1`. Also it will return false for `aaa111`.
type: Comment
comment on: http://stackoverflow.com/a/21302878
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31905305
type: Comment
has text: @user3176143 Why post images? Post your actual code as text.
type: QuestionComment
comment on: http://stackoverflow.com/q/21189535
score: 0

http://stackoverflow.com/comment/115095545
comment on: http://stackoverflow.com/a/21333137
score: 0
type: Comment
has text: u have no idea how big of help this answer is!!
type: AnswerComment

http://stackoverflow.com/comment/31928983
score: 0
comment on: http://stackoverflow.com/q/21202899
type: Comment
type: QuestionComment
has text: The program runs perfectly with ZouZou's modifications. Why did you not write that in a comment instead of as an answer ?

http://stackoverflow.com/q/21226621
has body: I have developed an app which password protects another app ( say app A). So when I try to open app A, an activity pops on top of A prompting the user to enter password. Upon incorrect entry, it should close that activity and also close app A, which is directly under it. Now I tried to do this using this code: List&lt;ActivityManager.RunningAppProcessInfo&gt; pids = Unlock.am.getRunningAppProcesses(); for(int i = 0; i &lt; pids.size(); i++) { ActivityManager.RunningAppProcessInfo info = pids.get(i); if(info.processName.equalsIgnoreCase("com.A")){ pid = info.pid; break; } } android.os.Process.killProcess(pid); But it does not work. Later I realized that this is probably because the process of app A is not a direct child of my app's process ( that is, my app did not call app A). So is there anyway I can close but not necessarily kill app A from my app? What I mean to say is, killing app A is optional but closing it is mandatory.
has answer: http://stackoverflow.com/a/21226883
tagged with: android-intent
has comment: http://stackoverflow.com/comment/31972787
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21226797
tagged with: java
has title: Closing an app from my app
has answer: http://stackoverflow.com/a/21226797
type: Question
upvote count: 4
answer count: 2
accepted answer: http://stackoverflow.com/a/21226883
downvote count: 0
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/31972832
tagged with: android

http://stackoverflow.com/q/21261869
linked to: http://stackoverflow.com/q/12641666
linked to: http://stackoverflow.com/q/14837601
favorite count: 0
has title: Transaction Management for multiple datasources created manually
type: UnansweredQuestion
tagged with: spring
tagged with: spring-jdbc
upvote count: 3
has body: I am working on an application wherein I have to connect to different database depending upon an customer id that is passed from the client side. The schema for all the databases is same. It is a kind of multi-tenant application. Since I don't know how many customers will be there, I cannot use xml configuration to statically create the datasources, hence I have to create datasources manually. We are using Spring JdbcTemplate for connecting to the databases and the connection parameter comes from another database which holds the configuration for the application. I am able to connect to the databases properly, but the method calls are not happening in a transaction. Following is the code snippet which does the database connectivity for only one database and I was going to extend it for multiple databases: BasicDataSource datasource = new BasicDataSource(); // set database connection params .... // create jdbcTemplate, jdbcTemplate = new JdbcTemplate(datasource); // create transaction managers PlatformTransactionManager txManager = new DataSourceTransactionManager(datasource); My idea is to create the transaction manager manually and somehow bind it in the spring container so that all the methods/classes with @Transactional annotation can use this transaction manager. I am not able to figure how do I bind the txManager, so that all the methods/classes with @Transactional will use this transaction manager. I am not sure whether this is the right way and should I be creating a transaction manager for every datasource, since, I don't want the transaction to span multiple databases, but I want that every service method call should be in a transaction. Note: All my service classes have @Component and @Transactional annotation. Am I solving the problem in the correct way?
has comment: http://stackoverflow.com/comment/32034196
has comment: http://stackoverflow.com/comment/32035349
type: Question
score: 3
tagged with: transactions
tagged with: java
has answer: http://stackoverflow.com/a/21274137
tagged with: spring-transactions
answer count: 2
has answer: http://stackoverflow.com/a/21273000
downvote count: 0

http://stackoverflow.com/q/21249993
has title: How to use soundex function in Jooq?
type: AnsweredQuestion
tagged with: java
type: Question
has body: Could someone please guide me on how to use soundex in jOOQ. I tried looking into jOOQ documentation but it is not clear. Please provide an example if possible.
answer count: 1
has answer: http://stackoverflow.com/a/21250456
accepted answer: http://stackoverflow.com/a/21250456
tagged with: jooq
score: 0
tagged with: sql

http://stackoverflow.com/a/21816249
answers question: http://stackoverflow.com/q/21312322
upvote count: 4
downvote count: 0
has body: As far as I know, JRMPProxyFactory uses normal MBeans found using the normal ObjectName rules. You don't need to configure any IP addresses, except in your client MBean definitions. If your tomcats are remote, then you should use JMXRemote to delegate to the remote MBeans, and enable JMXRemote in each of your tomcats. You could use tomcat's own proxy servlet for a lighter-weight alternative which doesn't require a local client in JBoss. You're probably not using Mule, but their page The Pros and Cons of Using Tomcat JMX does contain quite a few pointers and, of course, some pros and cons.
type: Answer
score: 4

http://stackoverflow.com/a/29094777
has comment: http://stackoverflow.com/comment/46422188
has comment: http://stackoverflow.com/comment/46421320
has body: For getErrorStream the spec says: Returns the error stream if the connection failed but the server sent useful data nonetheless. The typical example is when an HTTP server responds with a 404, which will cause a FileNotFoundException to be thrown in connect, but the server sent an HTML help page with suggestions as to what to do. This method will not cause a connection to be initiated. If the connection was not connected, or if the server did not have an error while connecting or if the server had an error but no error data was sent, this method will return null. This is the default. Returns: an error stream if any, null if there have been no errors, the connection is not connected or the server sent no useful data. You can also inspect the source to clear up any doubts, so lets look at some of the methods: public InputStream getErrorStream() { if (connected &amp;&amp; responseCode &gt;= 400) { // Client Error 4xx and Server Error 5xx if (errorStream != null) { return errorStream; } else if (inputStream != null) { return inputStream; } } return null; } It is safe to call this (no exception will be thrown) and the errorStream can be set in some IOException cases. The comment in the source is buffer the error stream if bytes &lt; 4k and it can be buffered within 1 second. getContentEncodings behaviour from the spec is: Returns: the content encoding of the resource that the URL references, or null if not known. But what about after an error? Lets look at code: public String getContentEncoding() { //from the base class java.net.URLConnection return getHeaderField("content-encoding"); } public String getHeaderField(String name) { try { getInputStream(); } catch (IOException e) {} //ah exception is eaten if (cachedHeaders != null) { return cachedHeaders.findValue(name); } return responses.findValue(name); } So it caches headers and returns them if known, even potentially after an IOException, it doesn't propagate an exception but might return null if it has not previously…
answers question: http://stackoverflow.com/q/21286836
has comment: http://stackoverflow.com/comment/46421995
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/46421060
downvote count: 0
has comment: http://stackoverflow.com/comment/46658435
has comment: http://stackoverflow.com/comment/46420806
has comment: http://stackoverflow.com/comment/46663773
upvote count: 2

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

http://stackoverflow.com/comment/31999562
type: Comment
comment on: http://stackoverflow.com/a/21239005
has text: It seems to work for me. When you introduce more enemies, that means different ones, it will also result in new enemy classes and you seperated your design. If you want to go with a 100% MVC approach, then you might have a look at Entity system frameworks, for example http://gamadu.com/artemis/tutorial.html. But they are not easy to get used to and your design will get more complicated. But that's your other option (without scene2d)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32185002
score: 0
has text: http://stackoverflow.com/questions/21346305/acces-denied-error-from-java-to-mysql from this question I have given access to buiud458_raklar'@'d24-36-33-148.home1.cgocable.net Is that what you mean?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21346953

http://stackoverflow.com/comment/31918885
score: 0
comment on: http://stackoverflow.com/a/21196902
type: Comment
has text: Thanks for the info, its my first post here. Simple test proved as I sorta thought that there is something going wrong elsewhere in the code. Thanks!
type: AnswerComment

http://stackoverflow.com/a/21254649
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21254547
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32021119
has comment: http://stackoverflow.com/comment/32020967
type: Answer
score: 11
has body: It will entirely depend on the implementation of the resource itself. The try-with-resource statement is "just" syntactic sugar (but oh so sweet) for calling close() within a finally block (and preserving exceptions etc). So long as the stream supports close() being called twice - which I expect most implementations do, and the contract of InputStream requires - it will be absolutely fine. Note that you'd be in exactly the same situation with the familiar wrapping of one resource within another, e.g. try (InputStream input = new FileInputStream(...)) { try (Reader reader = new InputStreamReader(input, ...)) { ... } } Or with a single try-with-resources statement: try (InputStream input = new FileInputStream(...); Reader reader = new InputStreamReader(input, ...)) { ... } In both cases there will be two finally blocks, so that first reader.close() is called, then input.close() - but reader.close() will close input anyway.
answers question: http://stackoverflow.com/q/21254547
upvote count: 11
has comment: http://stackoverflow.com/comment/32020925
has comment: http://stackoverflow.com/comment/32021070
has comment: http://stackoverflow.com/comment/32021174
has comment: http://stackoverflow.com/comment/32020460

http://stackoverflow.com/a/21236077
answers question: http://stackoverflow.com/q/21234603
upvote count: 4
type: AcceptedAnswer
type: Answer
has body: Somehow replacing the order of goals helped: From mvn install test surefire-report:report to mvn test surefire-report:report install
score: 3
accepted answer of: http://stackoverflow.com/q/21234603
downvote count: 1

http://stackoverflow.com/q/21223001
type: Question
answer count: 1
has body: I am making a little tick tac toe game to get the hang of gui in java. It was going very well till I ran into the problem I mentioned in the title. My Jbuttons have a transparent background. However, when my mouse entered the button, the button's background became little pieces of the background that last had focus. For Example, if my frame had the focus it would take a little bit of that and set it as the background. By adding this.setRolloverEnabled(false) to the code it no longer had this weird bug when I hovered over it, but the bug still occurs when I click the button. When the button is clicked it changes it icon to either an x or an o image but the problem still occurs Here is my code for my buttons public class Tile extends JButton implements ActionListener { private Board myBoard; private int ID; private int state; //0 = blank, 1 = x, 2 = O private Icon x; private Icon o; private Icon blank; public Tile() { blank = new ImageIcon(getClass().getResource("/Resources/Tiles/blank.png")); x = new ImageIcon(getClass().getResource("/Resources/Tiles/x.png")); o = new ImageIcon(getClass().getResource("/Resources/Tiles/o.png")); state = 0; setIcon(blank); addActionListener(this); this.setBorder(new BorderUIResource.EmptyBorderUIResource(0,0,0,0)); this.setBorderPainted(false); this.setContentAreaFilled(false); this.setFocusPainted(false); this.setRolloverEnabled(false); } public Tile(int ID) { this(); this.ID = ID; } public Tile(int ID, Board myBoard) { this(ID); this.myBoard = myBoard; } public void updateState(EnumTileState newState) { switch(newState) { case BLANK : state = 0; break; case X_STATE : state = 1; break; case O_STATE : state = 2; break; default: return; } update(); } private void update() { switch(state) { case 1: this.setIcon(x); break; case 2: setIcon(o); break; default: setIcon(blank); break; } } public int getID() { return ID; } public int getState() { return state; } public void actionPerformed(ActionEvent event) { Tile clickedTile = (Tile) event.g…
score: 0
has answer: http://stackoverflow.com/a/21223366
has title: My Jbuttons randomly grab bits of the frame and added it to the button background when clicked
accepted answer: http://stackoverflow.com/a/21223366
tagged with: events
tagged with: swing
tagged with: jbutton
type: AnsweredQuestion
tagged with: custom-component
tagged with: java

http://stackoverflow.com/comment/31917944
comment on: http://stackoverflow.com/q/21196542
score: 0
type: Comment
type: QuestionComment
has text: Is `insertedLetter.matches( "[a-r]+" )` doing what you what? Not sure if you accept empty string - that would be done in a separate check.

http://stackoverflow.com/a/21302396
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21302354
has body: If arr contains integer numbers it is index of counter array. Then you are incrementing the value of counter array on arr.get(i) index. I hope you understand what I am saying.

groupon
type: Tag
tags question: http://stackoverflow.com/q/21265407
tag name: groupon

http://stackoverflow.com/comment/31956303
type: QuestionComment
score: 0
has text: Nodes are elements of the data structure which represents the data in a `.class` file.
comment on: http://stackoverflow.com/q/21213595
type: Comment

http://stackoverflow.com/a/21227709
downvote count: 2
has comment: http://stackoverflow.com/comment/31973668
has comment: http://stackoverflow.com/comment/31973205
type: Answer
answers question: http://stackoverflow.com/q/21227514
upvote count: 0
has body: private static int recursionTest(int num){ while(num &lt; 10){ recursionTest(++num); if(num &lt; 10){ break; } } return num; } Above snippet will iterate while loop 10 times only so it will be fast.
score: -2
has comment: http://stackoverflow.com/comment/31973602

http://stackoverflow.com/comment/128114589
type: Comment
comment on: http://stackoverflow.com/a/21306824
type: AnswerComment
has text: Other browsers can run `.exe` files using emulators like [Boxedwine](http://www.boxedwine.org/), even if they don't support ActiveX.
score: 0

http://stackoverflow.com/comment/32162470
has text: 1. I developed the concept - remove everything about JComponents, Renderer, model its notifier from code posted here, 2. (a) the JTree (b) the JTable so that they are re-drawn? no idea about goal, direction from-to, guessing that there is "something" between JTree and JTable,
score: 0
comment on: http://stackoverflow.com/q/21332598
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32060828
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21277425
has text: Are you *sure* you want `kk` rather than `HH`? Will you really get an hour of `24` after midnight?
score: 0

http://stackoverflow.com/q/21309949
has answer: http://stackoverflow.com/a/21310921
tagged with: compiler-warnings
downvote count: 0
tagged with: sonarqube
answer count: 1
score: 1
favorite count: 0
has body: I have a compiler-warnings log from a JVM and I would like to import them in SonarQube labeled as issues. For example I was able to import UnitTests coverage files with the property 'sonar.jacoco.reportPath=[path]'. I wanted to ask if there is something similar for compiler-warnings. Can anybody help me here because I did not find any help on Internt research. Thanks in advance!
has title: Import Compiler Warnings in SonarQube
type: UnansweredQuestion
tagged with: java
upvote count: 1
tagged with: sonar-runner
type: Question

http://stackoverflow.com/q/21265163
has title: OutputStream stuck?
tagged with: file
has body: I've got a little problem with a file-transfer-system that has never happened to me before. @Override public void run() { while (true) { try { String message = (String) new ObjectInputStream(socket.getInputStream()).readObject(); if (message.startsWith("message=")) { message = message.replaceFirst("message=", ""); frame.addLine(message); } else if (message.startsWith("file=")) { final String file = message.replaceFirst("file=", ""); int selection = JOptionPane.showOptionDialog(frame, "Do you want to download \"" + file + "\"?", "Download", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, JOptionPane.YES_OPTION); if (selection == JOptionPane.YES_OPTION) { JFileChooser jFileChooser = new JFileChooser(); jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int rValue = jFileChooser.showDialog(frame, "Öffnen"); if (rValue == JFileChooser.APPROVE_OPTION) { new ObjectOutputStream(socket.getOutputStream()).writeObject("file_confirm=" + file); String selectedDir = jFileChooser.getSelectedFile().getAbsolutePath(); OutputStream out = new FileOutputStream(new File(selectedDir, file)); try { byte[] buffer = new byte[1024]; for (int c = 0; (c = socket.getInputStream().read(buffer)) &gt; 0;) { out.write(buffer, 0, c); System.out.println(c); } System.out.println("test1"); } catch (Exception ex) { ex.printStackTrace(); } finally { System.out.println("test2"); out.flush(); out.close(); System.out.println("test3"); } } } } else if (message.startsWith("kick()")) { frame.setVisible(false); frame.dispose(); JOptionPane.showMessageDialog(frame, "You have been kicked!", "Error", JOptionPane.ERROR_MESSAGE); System.exit(0); } else if (message.startsWith("clear()")) { frame.clear(); } } catch (Exception ex) { ex.printStackTrace(); frame.setVisible(false); frame.dispose(); JOptionPane.showMessageDialog(frame, "Connection timed out!", "Error", JOptionPane.ERROR_MESSAGE); System.exit(0); } } } This prints out (filesize 31 KB): around 30 times 1024 (as expected) …
type: Question
score: 0
tagged with: io
accepted answer: http://stackoverflow.com/a/21265436
answer count: 1
has answer: http://stackoverflow.com/a/21265436
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/31992116
comment on: http://stackoverflow.com/q/21237651
score: 0
type: Comment
type: QuestionComment
has text: What does `intervals.get(i)` do?

http://stackoverflow.com/a/21214813
type: Answer
answers question: http://stackoverflow.com/q/21214768
has body: First, a warning shouldn't forbid you from compiling in most cases. Second, you're misusing the constructor. Read the GridLayout docs - http://docs.oracle.com/javase/tutorial/uiswing/layout/grid.html
accepted answer of: http://stackoverflow.com/q/21214768
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/21239613
type: Answer
has comment: http://stackoverflow.com/comment/31994913
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/21239573
has comment: http://stackoverflow.com/comment/31994561
has body: Simple run your project online i.e mvn clean install . It fetches all the latest dependencies that you mention in your pom.xml and built the project

http://stackoverflow.com/a/21263270
has comment: http://stackoverflow.com/comment/32039716
answers question: http://stackoverflow.com/q/21262562
type: Answer
upvote count: 5
has body: Java holds a conceptual distinction between: Binary data: byte[], InputStream, OutputStream Text (Unicode): String, char, Reader, Writer Bridge between them: InputStreamReader, OutputStreamWriter, String.getBytes(charset), new String(bytes, charset) An int consists of 4 bytes, for instance 0, 0, 2, 12 for 2*256+12 = 524. In a file these bytes are not recognizable. A text representation of Integer.toString(524) = "524" in ASCII or almost any character set would be as: byte[] bytes = "542".getBytes("UTF-8"); // Three bytes: 53, 50, 52 A DataOutputStream is a special (binary data) OutputStream for Java objects. It can also output a String, as UTF-8 bytes, which are human recognizable, in a mess of binary values. The docx format (as does the odt format) is a zipped directory with content as XML file. XML generally is in UTF-8, and for Cyrillic that would be a bit more. The compression however muddles the issue. Unicode is a numbering of all characters fitting in [0, 224). There is the multi-byte encoding UTF-8 for Unicode, that for the first 128 ASCII characters uses one byte, and for the rest multiple bytes. In those multibyte sequences no \ or so can be found (high-bits set), which is comfortable. Also the byte 0 may redundantly written as multi-byte sequence, which is nice for C based software like operating systems, that interprete a 0 byte as string terminator (not so Java). UTF-16 uses two bytes, and with that can handle almost all non-Asian scripts. If the Unicode number is higher than 216 a similar mechanism is used, of char sequences for one Unicode char. There is UTF-16LE (little endian) and UTF-16BE (big endian) for order of the two bytes. Above in the int example big-endian was used. Intel processors/Windows uses little endian. After comment: A byte is a unit of 8 bits (0 or 1), and its values are 00000000 (=0), ..., 11111111 (=255). ASCII characters assign some character to a number between 0 and 127, like: 32 = ' ' 64 = '@' 48 = '0' 65 = 'A' 49 = '1' 66 = …
score: 5
downvote count: 0

http://stackoverflow.com/a/21299132
score: 1
answers question: http://stackoverflow.com/q/21245650
downvote count: 0
has body: First and foremost.Thanks a Billion to Brian Roach for assisting me.His inputs helped me solve the problem.I am sharing my answer. What was I trying to solve? - In my project I had some user data(name,age,picture_time) and some corresponding pictures for each of the user data.At the EOD I needed to sync all this data to the app server.However when I tried to sync a lot of pictures(say 50 of 50kb approx) I faced an OOM(Out of Memory) issue.Initially, I was trying to upload all the data using a conventional JSONArray approach,however soon I found that I was hitting OOM.This, I attribute to the heap getting full when I was trying to access the JSONArray(which had loads of values and why not ?, afterall I was encoding the pics by base64encoding,which trust me has a hell lot of string data in it !) Inputs from Brian suggested that I write all my data into a file one by one.So,after the whole process is complete I get one single file that has all the data(name,age,picture_time,base64encoded pictures etc) in it,and then I stream this file to the server. Following is the code snippet which takes the user data from app database,corresponding pictures from sd card,loops through all the records,creates a JSONArray of JSONObjects using Jackson Json Library(which you need to include in your libs folder,should you use this code) and stores them into a file.This file is then streamed to the server(this snippet not included).Hope this helps someone! // Sync the values in DB to the server Log.d("SyncData", "Opening db to read files"); SQLiteDatabase db = context.openOrCreateDatabase("data_monitor", Context.MODE_PRIVATE, null); db.execSQL("CREATE TABLE IF NOT EXISTS user_data(device_id VARCHAR,name VARCHAR,age VARCHAR,picture_time VARCHAR);"); Cursor c = db.rawQuery("SELECT * FROM user_data", null); int count = c.getCount(); if (count &gt; 0) { File file = new File(Environment.getExternalStorageDirectory().getPath(), "Pictures/UserFile/UserFile"); JsonFactory jsonfactory = new JsonFa…
type: Answer
upvote count: 1

http://stackoverflow.com/comment/32138612
has text: @csmckelvey, good point :) It was old code that I've had lying around for a decade (before the recommendation to use invokeLater) and I didn't notice the code hadn't been updated to the new standards.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21319987
type: Comment

http://stackoverflow.com/comment/31974215
has text: @user3214036 The size of vertexes is empty.
comment on: http://stackoverflow.com/a/21228037
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/139230669
has text: this worked for me! thank you, tried multiple CSS options with div and nothing worked but this.
comment on: http://stackoverflow.com/a/60633029
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21212947
upvote count: 3
has comment: http://stackoverflow.com/comment/31946994
type: Answer
answers question: http://stackoverflow.com/q/21212932
downvote count: 0
has comment: http://stackoverflow.com/comment/31947342
has comment: http://stackoverflow.com/comment/31949481
has body: Your sin values are very small numbers (very near to 0), so when you cast them to int you will get 0. Note that the notation xxxE-yy is another representation of xxx * Math.pow(10, -yy) Edit: Also, make sure that lastProgress is not 0.
has comment: http://stackoverflow.com/comment/31947008
score: 3
has comment: http://stackoverflow.com/comment/31946948
has comment: http://stackoverflow.com/comment/31947056
has comment: http://stackoverflow.com/comment/31946972

http://stackoverflow.com/a/21280299
answers question: http://stackoverflow.com/q/21255698
has body: It didn't work because it ran on the simulator not on the phone. Used it on the phone, no problems.
score: 0
type: Answer

http://stackoverflow.com/q/21199193
has answer: http://stackoverflow.com/a/21199242
score: 3
has comment: http://stackoverflow.com/comment/31922694
tagged with: java
tagged with: treemap
has title: How to get value from TreeMap in Java?
has answer: http://stackoverflow.com/a/35170107
has comment: http://stackoverflow.com/comment/31922671
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/31922591
linked to: http://stackoverflow.com/q/16246821
has comment: http://stackoverflow.com/comment/31922813
tagged with: jlist
has answer: http://stackoverflow.com/a/21199325
answer count: 4
favorite count: 0
has body: My problem is can't get an object "Item" (value) from my Treemap. I need send that info to my GUI class and display it in JList to get a select list, so can easily select and add songs to playlist, but only what I get as an output is "01, 02, 03, 04, 05" (key). Please help, because I'm beginner and have no idea what to do. public class LibraryData { private static class Item { Item(String n, String a, int r) { name = n; artist = a; rating = r; } // instance variables private String name; private String artist; private int rating; private int playCount; public String toString() { return name + " - " + artist; } } private static Map&lt;String, Item&gt; library = new TreeMap&lt;String, Item&gt;(); static { library.put("01", new Item("How much is that doggy in the window", "Zee-J", 3)); library.put("02", new Item("Exotic", "Maradonna", 5)); library.put("03", new Item("I'm dreaming of a white Christmas", "Ludwig van Beethoven", 2)); library.put("04", new Item("Pastoral Symphony", "Cayley Minnow", 1)); library.put("05", new Item("Anarchy in the UK", "The Kings Singers", 0)); } public static String[] getLibrary() { String [] tempa = (String[]) library.keySet().toArray(new String[library.size()]); return tempa; } SOLUTION: Because I've to pass the values to another class: JList tracks = new JList(LibraryData.getLibrary()); I made something like that and it's works public static Object[] getLibrary() { Collection c = library.values(); return c.toArray(new Item[0]); Thank You guys, after 10 hours I finally done it! }
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21199284
has comment: http://stackoverflow.com/comment/31922592
type: Question

http://stackoverflow.com/comment/32212235
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21331061
type: Comment
has text: The export and import packages are probably the source of this error. One of those packages might be gone from Java System bundle.

http://stackoverflow.com/comment/31955424
comment on: http://stackoverflow.com/q/21217854
type: Comment
type: QuestionComment
score: 1
has text: @lakshman - there's no reflection in this and it's not needed.

http://stackoverflow.com/a/21302754
upvote count: 7
score: 7
answers question: http://stackoverflow.com/q/21302658
type: AcceptedAnswer
has body: The String concatenation operator (+) triggers the need for String conversion of the int value because the first argument on the left is a String. Order of precedence causes the multiplication of the two ints to occur first in the second example before the concatenation operator is evaluated. I'd need to check the bytecode but I believe the compiler uses a StringBuilder here so the real code would look like: System.out.println(new StringBuilder("Result").append(2).append(3).append(4)); System.out.println(new StringBuilder("Result").append(2).append(3 * 5)); Edit for completeness: Your examples, because they are made up entirely of literals (String and primitive), are dealt with at compile time and simply turned into a string literal. This is a Compile Time Constant Expression. Precedence still applies so the result is the same. If any of those were to have been a variable, for example: int x = 5; System.out.println("Result"+2+x); then a StringBuilder is used at runtime to concatenate the literal part with the variable's value. (Edited to be authoritative after looking at the bytecode and JLS)
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21302658
type: Answer

http://stackoverflow.com/comment/32051759
type: QuestionComment
comment on: http://stackoverflow.com/q/21271803
has text: If you really want to understand what a hash code is for, please look up "hash table" in Wikipedia (it talks about a "hash function", which is what `hashCode` is). If you think that knowing that the result is 1955 helps you understand what `hashCode` is all about, then I have no idea what you're looking for.
score: 0
type: Comment

http://stackoverflow.com/q/21332598
has comment: http://stackoverflow.com/comment/32162470
has title: fireTableDataChanged() after a ListSelectionEvent causes StackOverFlow
tagged with: stack-overflow
has comment: http://stackoverflow.com/comment/32161798
type: UnansweredQuestion
has body: Essentially what I need to do is set a ListSelectionListener on my JTable for the row and column model so I know which cell has been clicked, I'm fine this. If the cell that I've clicked happens to have a JTree as it's renderer component then I am to expand/collapse the JTree, adjust the height of the table row and redraw the table. So my ListSelectionListener looks like this static class TableCellSelectionListener implements ListSelectionListener { private JTable _t; @Override public void valueChanged(ListSelectionEvent lse) { if(!lse.getValueIsAdjusting()) { int rowSelected = _t.getSelectedRow(); int colSelected = _t.getSelectedColumn(); if(rowSelected &gt; -1 &amp;&amp; colSelected &gt; -1) { TableCellRenderer renderer = _t.getCellRenderer(rowSelected, colSelected); Object obj = _t.getValueAt(rowSelected, colSelected); Component c = renderer.getTableCellRendererComponent(_t, obj, true, false, rowSelected, colSelected); if(c instanceof JTree) { JTree tree = (JTree) c; TreePath path = tree.getPathForRow(0); if(tree.isExpanded(path)) { tree.collapsePath(path); tree.fireTreeCollapsed(path); } else { tree.expandPath(path); tree.fireTreeExpanded(path); } Enumeration&lt;TableColumn&gt; columns = _t.getColumnModel().getColumns(); while(columns.hasMoreElements()) { TableColumn col = columns.nextElement(); int colIndex = col.getModelIndex(); if(_t.getColumnClass(colIndex) == JTree.class &amp;&amp; colIndex != colSelected) { JTree t = (JTree) _t.getValueAt(rowSelected, colIndex); TreePath p = t.getPathForRow(0); if(tree.isExpanded(path) &amp;&amp; !t.isExpanded(p)) { t.expandPath(p); t.fireTreeExpanded(p); } else if(!tree.isExpanded(path) &amp;&amp; t.isExpanded(p)) { t.collapsePath(p); t.fireTreeCollapsed(p); } } } _t.setRowHeight(rowSelected, c.getPreferredSize().height); //Line below causes StackOverFlow ((SortableTableModel)_t.getModel()).fireTableDataChanged(); _t.clearSelection(); } } } } public void setTable(JTable t) { _t = t; } } What would be the "correct" approac…
linked to: http://stackoverflow.com/q/6590462
linked to: http://stackoverflow.com/q/2908306
has answer: http://stackoverflow.com/a/47099163
has comment: http://stackoverflow.com/comment/32158203
has comment: http://stackoverflow.com/comment/32158140
tagged with: swing
type: Question
tagged with: jtree
tagged with: java
has answer: http://stackoverflow.com/a/21408007
score: 0
tagged with: listselectionlistener
answer count: 2

http://stackoverflow.com/comment/31902412
type: AnswerComment
comment on: http://stackoverflow.com/a/21187800
type: Comment
has text: I'm not sure what else explain... Your code executed the `actionPerformed` repeatedly until you called `stop()`. But, when `stop()` is called, the `actionPerformed` method can be called once more. What I did is just adding a lock, a boolean variable that is set to true just before calling `stop()` and checked just before calling `doClick`. This way, you get sure that `doClick` is never called after `stop()`.
score: 0

http://stackoverflow.com/comment/31928370
type: Comment
score: 0
has text: follow the link i posted and read the docs you will know why
type: QuestionComment
comment on: http://stackoverflow.com/q/21201903

http://stackoverflow.com/q/21341505
upvote count: 9
linked to: http://stackoverflow.com/q/18405740
has comment: http://stackoverflow.com/comment/32174977
tagged with: caliper
answer count: 3
has answer: http://stackoverflow.com/a/60602468
downvote count: 0
has title: How to use Caliper for benchmarking?
has body: I am trying to figure out how to use Caliper to do benchmark testing in Eclipse and I am getting nowhere. I tried following the 26 minute tutorial found here: https://code.google.com/p/caliper/ but I get lost quickly. I have downloaded the Caliper jar file but I'm not sure what folder it should be in. I've also downloaded Maven for Eclipse plugin but I'm not even sure if that is necessary. Is it possible to install Caliper from the 'Install New Software..' option in the Help menu in Eclipse? I just want to be able to do very simple speed tests for some of the algorithms I've created for a Data Structures and Algorithms class I am taking.
linked to: http://stackoverflow.com/q/611732
favorite count: 0
has answer: http://stackoverflow.com/a/21341592
has comment: http://stackoverflow.com/comment/32175053
tagged with: maven
accepted answer: http://stackoverflow.com/a/21341592
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32174987
tagged with: java
possible better answer: http://stackoverflow.com/a/41296131
score: 9
type: Question
has answer: http://stackoverflow.com/a/41296131

http://stackoverflow.com/q/21321374
has body: I am trying to make simple XMPP (Jabber) client in JavaFX (as a school project) using Smack API. I have already suceeded in making main window which keeps track of asociated clients (Roster list), but I am having problem with sending/receiving messages. I want to implement ordinary IM client functions - I need to track all incomming/outgoing chats and manage chat windows. What is the best way of doing so? My best guess is to store chats in some kind of array and keep track of opened chat windows (in array as well). I have class managing connection (login), class for main window, which displays Roster...I really dont know how (and where) to implement Listener for new messages to store chat history somehow and to manage opened chat windows. Desired function: Incomming chat -> is chat window (with this client) opened? if yes, append message to history and view in TextArray of that chat window, if no, open new window and display the message. Outgoing chat -> send the message and append to chat history (and view in according chat window). My code so far is really messy (If you are brave enough, you can download it from here: link) Thanks very much for your help
upvote count: 1
favorite count: 0
tagged with: smack
answer count: 0
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: javafx
type: Question
has title: XMPP JavaXF client

http://stackoverflow.com/comment/32001953
type: QuestionComment
comment on: http://stackoverflow.com/q/21243712
score: 5
has text: You decided to compare strings incorrectly because you're also comparing ints in lots of places?
type: Comment

jboss6.x
tag name: jboss6.x
tags question: http://stackoverflow.com/q/21332111
type: Tag

http://stackoverflow.com/comment/31917345
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21195942
has text: This string is a reference to: my@emailaddress.com , so it shoudn't be a problem, right?
score: 0

http://stackoverflow.com/comment/32091439
type: Comment
score: 4
has text: You should read the exercise again: you're required to create a class `Prime`, not a method `Prime()`. All those classes should implement a common interfece, e.g. `Test`, which defines a method to check whether a given int (or, in exercise 2, any type) fulfils the class's test, e.g. for `Prime` it tests whether the number is prime.
comment on: http://stackoverflow.com/q/21294680
type: QuestionComment

http://stackoverflow.com/a/21204514
answers question: http://stackoverflow.com/q/21204099
score: 0
has body: +1 for santosh's answer. I have tried it in following way . Try it out public class CountChar { public static void main(String[] args) { String[] strings = {"hidden", "Java SDK", "DDD", "parameter", "polymorphism", "eeeee", "dodged", "cats and dogs"}; int result = 0; for(int i=0;i&lt;strings.length;i++) { result += numberOfCharacters(strings[i], 'e'); } System.out.println("No. of occurrences of 'e' in String is "+ result); } public static int numberOfCharacters(String str, char a) { int counter = 0; for( int i=0; i&lt;str.length(); i++ ) { if( str.charAt(i)== a ) { counter++; } } return counter; } }
type: Answer
has comment: http://stackoverflow.com/comment/31933061
has comment: http://stackoverflow.com/comment/31931639
has comment: http://stackoverflow.com/comment/31932198

http://stackoverflow.com/comment/32130559
type: Comment
comment on: http://stackoverflow.com/a/21316376
has text: I've not heard of that type of system before. I will check some out. Does anyone else have input on this?
score: 0
type: AnswerComment

http://stackoverflow.com/q/21345121
has comment: http://stackoverflow.com/comment/32181510
type: Question
has answer: http://stackoverflow.com/a/21345148
has answer: http://stackoverflow.com/a/21345342
tagged with: java
answer count: 6
score: 0
has body: I am in the beginnings of learning Java, and have an assignment that is providing me with some difficulty (which I presume is not actually difficult). The instructions are as follows: "Within a class called MathCalculations, write a method named findMin that accepts three integers as parameters and returns the smallest of the three values. For example, the call findMin(1,10,-1) would return -1. You must use the Math class min function (which only takes 2 parameters). Write a main method in the class that calls findMin(5, 7, 3) and prints the returned result (see below for format)." As the prompt states, I have to use the Math.min function, yet it only takes two parameters. I wrote the code below that gives me the desired output for the assignment, but I do not believe I have done it in the correct way. I am having trouble understanding what is meant by "write a method named findMin that accepts three integers as parameters." Can anyone offer me some help? Thanks in advance. public class Test { public static void main(String[] args) { findMin(3); } public static int findMin(int min) { int minimum = Math.min(5, 7); int minimum2 = Math.min(minimum, 3); System.out.println("The minimum of 5, 7, and 3 is " + minimum2); return minimum2; } }
accepted answer: http://stackoverflow.com/a/21345148
has comment: http://stackoverflow.com/comment/32181508
has answer: http://stackoverflow.com/a/21345231
possible better answer: http://stackoverflow.com/a/21345149
has answer: http://stackoverflow.com/a/21345159
has answer: http://stackoverflow.com/a/21345149
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77298638
has title: Writing a small Java code that can take 3 integers, and output the smallest one

http://stackoverflow.com/comment/32142452
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21323425
has text: I can't shuffle them. It has to be consistent output and it has to look exactly like his, which doesn't use shuffle.

http://stackoverflow.com/a/21286853
answers question: http://stackoverflow.com/q/21286788
has body: You have to create an instance of the class that "contains" the MakeKK() method. File f = null; // ... Here you may add some code to avoid NullPointerException NameOfClass obj = new NameOfClass(...); obj.MakeKK(...); so you use it to call that method. Another solution would be making the method static: public static void MakeKK(String K1, String K2){ .... } Choosing the correct way depends on what you are doing in the program, and what your method MakeKK() does. You could read this SO post in order to understand when to use static methods. Notes: You are initializing File f with null, which would lead into a NullPointerException when you call the method MakeKK(...) I would recommend you to follow Java naming conventions. You should call your method something like: nameOfMethod instead of NameOfMethod. This last is used when naming classes, interfaces... Your method should be called makeKK().
score: 0
type: Answer

http://stackoverflow.com/comment/31918549
score: 0
type: AnswerComment
has text: @user3133608: yep, you'll need to show enough code to reproduce your problem, as well as a stacktrace of the exception, but not too much code to over-whelm us with a lot of unrelated code. Please check the link I've provided above.
comment on: http://stackoverflow.com/a/21196902
type: Comment

http://stackoverflow.com/comment/32045256
score: 1
comment on: http://stackoverflow.com/q/21267263
type: Comment
type: QuestionComment
has text: Solved. Apparently intelliJ hides the target/classes dir and all its contents. When I looked from the command line I could see all my properties files, perfectly filtered and copied as promised. But more than that, I don't even need to specifically use maven-resources-plugin, maven itself is able to interpolate values quite well as long as `<build> ... true ...` is present. HTH someone else.

http://stackoverflow.com/comment/32022525
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21255566
type: Comment
has text: ooops. I thinked that u have control of twitter app. Sorry. U can use redirect on side page. I mean: u post tweet with link. User click on it. App redirect him to Browser, where redirect will be happen to any.thing.u.want://

http://stackoverflow.com/q/21257947
accepted answer: http://stackoverflow.com/a/21262497
upvote count: 1
has comment: http://stackoverflow.com/comment/32026445
has body: Can anyone help me with a JPA issue that I thought would have been simple. I'm trying to write a general-purpose lazy load manager in my JPA persistence framework, so layers higher up the application stack can access lazy-loaded data without having to deal with the specifics. I have a lazy load manager: public class JpaLazyLoader extends AbstractJpaDAO&lt;Void&gt; implements LazyLoader { public JpaLazyLoader() { super( void.class ); } @Transactional(readOnly=true) public &lt;T,E&gt; T get( ILazyGetter&lt;T,E&gt; p_getter ) throws Exception { // reattach the object to the session E l_entity = getEntityManager().merge( p_getter.getEntity() ); // return the getter data return p_getter.get( l_entity ); } } The lazy getter is like this: public interface ILazyGetter&lt;T,E&gt; extends Serializable { public E getEntity(); public T get( E p_entity ) throws Exception; } And the idea is that it would be used like this: return m_lazyLoader.get( new ILazyGetter&lt;Collection&lt;Child&gt;, Parent&gt;() { private static final long serialVersionUID = 1L; public Parent getEntity() { return getValue(); // get the parent object from somewhere } public Collection&lt;Child&gt; get( Parent p_entity ) throws Exception { // children are a lazy-loaded Set&lt;Child&gt; return p_entity.getChildren(); } } ); The annotations in Parent are like this: @Entity(name="parent") public class Parent implements Serializable { private static final long serialVersionUID = 1L; .... @Id @Column(name="id") @GeneratedValue(strategy=GenerationType.AUTO) protected Long id; @OneToMany @JoinTable ( name="parent_child_associations", joinColumns={ @JoinColumn(name="parent_id", referencedColumnName="id") }, inverseJoinColumns={ @JoinColumn(name="child_id", referencedColumnName="id", unique=true) } ) protected Set&lt;Child&gt; children; } The parent object was loaded in a different transaction and then detached. I hoped it would be a trivial thing to reattach the parent to another session (within the @transactional …
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/21262497
tagged with: jpa
downvote count: 0
answer count: 1
tagged with: entitymanager
tagged with: persistence
favorite count: 0
has comment: http://stackoverflow.com/comment/32034010
has title: Reattaching an entity to lazy load a collection (JPA/Hibernate)

http://stackoverflow.com/comment/32187658
score: 0
has text: do you have the image icon_ask_fatwa_one.png in the drawable folder?
comment on: http://stackoverflow.com/a/21347913
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21274040
tagged with: word-boundary
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/21274068
tagged with: java
linked to: http://stackoverflow.com/q/4450045
has title: Java Regex: Word Boundary Matcher in a String Literal
has answer: http://stackoverflow.com/a/21274072
type: Question
score: 0
has answer: http://stackoverflow.com/a/21274112
upvote count: 1
has body: Java Code: import java.util.regex.*; class Test { public static void main(String[] args) { String r = "\\bdog\\b"; Pattern p = Pattern.compile(r); String text = "abc dog def"; System.out.println(p.matcher(text).matches()); } } Equivalent Perl Code: $x = "abc dog def"; if ($x =~ /\bdog\b/) { print "matches"; } The Perl code behaves as expected and prints that the string "abc dog def" matches the given regular expression. The Java code on the other hand, says the string does not match the regex. Am I am making some stupid mistake? Interestingly, if I enter the regex on cmd line (not in a string literal) as exemplified by the Oracle Docs, then it works all right.
has answer: http://stackoverflow.com/a/21274114
favorite count: 0
tagged with: regex
answer count: 4

http://stackoverflow.com/comment/31960217
has text: @JBNizet I am sorry but I am confused here, in the User class I am loading the Roles eagerly by @ManyToOne(fetch=FetchType.EAGER), do I have to load the Users eager from the Role class as well? I am quite confused now
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21220234

http://stackoverflow.com/comment/31975273
score: 1
comment on: http://stackoverflow.com/q/21190907
has text: I managed to correct the problem temporarily by changing the name of the class listed in the stack trace and then naming it back again. This seems to me to be a band-aide solution not really correcting the cause. Is there any way to prevent this from happening again? Am I doing something wrong to cause this error?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21205947
tagged with: restrictions
has comment: http://stackoverflow.com/comment/31936122
linked to: http://stackoverflow.com/q/6172267
has comment: http://stackoverflow.com/comment/31934060
has comment: http://stackoverflow.com/comment/31941621
score: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31934134
has comment: http://stackoverflow.com/comment/31934068
has comment: http://stackoverflow.com/comment/31934046
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31934052
has body: How to restrict a JTextFiled to accept only numbers less then 10, no words, no spaces or any other special characters?
has answer: http://stackoverflow.com/a/21208066
tagged with: swing
answer count: 4
has comment: http://stackoverflow.com/comment/31942027
has answer: http://stackoverflow.com/a/21207762
has answer: http://stackoverflow.com/a/21206066
tagged with: java
has title: How to limit JTextFiled to accept only numbers less then 10?
upvote count: 1
tagged with: jtextfield
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21208326

http://stackoverflow.com/comment/32043264
type: Comment
comment on: http://stackoverflow.com/a/21243627
has text: Hi Sunil, Thanks verymuch i really appreciate your quick respone on this. I did get the logic exiting through for loop using break; but then for somereason i am not able to get it implemented. What i am doing is(if option==1), i would like to enter name of the user and as soon as i enter name of the user, program should check from the file whether name exists in it or not. what is happening here is, When i enter name; it start search from 1st line and lets say entered name is on 6th position, it wont give me answer till i continue entering same name 6times. hope you got my question now.
type: AnswerComment
score: 0

http://stackoverflow.com/q/21339657
has answer: http://stackoverflow.com/a/21342630
type: Question
has comment: http://stackoverflow.com/comment/32171815
answer count: 3
possible better answer: http://stackoverflow.com/a/21339928
downvote count: 0
has comment: http://stackoverflow.com/comment/32171576
has answer: http://stackoverflow.com/a/21339928
has title: what's the difference between service layer and domain model layer
favorite count: 0
has answer: http://stackoverflow.com/a/21339774
score: 31
has comment: http://stackoverflow.com/comment/32173978
has comment: http://stackoverflow.com/comment/32174376
linked to: http://stackoverflow.com/q/2295445
upvote count: 31
has comment: http://stackoverflow.com/comment/32171539
tagged with: business-objects
accepted answer: http://stackoverflow.com/a/21339774
type: AnsweredQuestion
tagged with: service-layer
tagged with: domain-model
has body: for example, I have a user table, to be layer-ing, I create such POJOs: UserEntity.java UserDao.java UserBO.java (business object, domain model?) UserService.java (for service layer) what's the difference between UserBO.java and UserService.java? why we seperate it to two objects?
tagged with: java
linked to: http://stackoverflow.com/q/3688664

http://stackoverflow.com/q/21248443
type: Question
has comment: http://stackoverflow.com/comment/32023246
has answer: http://stackoverflow.com/a/21265600
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/32039763
accepted answer: http://stackoverflow.com/a/21265600
has body: I am trying to write a formula in Java, using Javax.units API to write a number and a unit into a single word. Here is my implementation so far. Unit mm = SI.MILLI(SI.METER); Unit mm2 = mm.pow(2); Unit unit = SI.NEWTON.divide(mm2); System.out.println(formula); //output = N/mm^2 int i = 1234; int singleWord = 1234*N/mm^2 or Unit singleWord = 1234*N/mm^2 // is it possible to write something like this? Please Note: I am not looking for String format, because I am going to use "singleWord" in further my calculations.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32010573
has title: Write a number and a unit in a single word

http://stackoverflow.com/comment/32003904
score: 1
type: AnswerComment
type: Comment
has text: CW isn't there to provide comments as answers. That's what comments are there for. CW is there for answers that are designed to be a composition of information from many different sources, to which this isn't, nor is there any indication that it should be. It is your personal opinion, not an aggregation of several people's knowledge. It should be a comment, not an answer.
comment on: http://stackoverflow.com/a/21244722

http://stackoverflow.com/comment/32126865
has text: @rob any reference to an object which is not Serializable prevents the whole data structure being serialized (and corrupts the stream)
comment on: http://stackoverflow.com/a/21314988
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21347072
has comment: http://stackoverflow.com/comment/32185211
answers question: http://stackoverflow.com/q/21347012
score: 0
type: Answer
has body: == between two objects, such as strings, compares whether they are the same instance. .equals(), on the other hand, compares them to see if they have the same value. Consider the possibility that you have a class called Point. Points are made up of two ints, x and y and are allowed to move. I have two points, A, at (0, 0), and B, at (1, 0). Right now, neither == nor .equals() would return true. A moment later, B moves to be at (0, 0). == is still false, because I still have two instances of points and they aren't the same, but .equals() is now true because they have the same value of (0, 0). Similarly, you should use .equals() if you want to check if two strings have the same value (you almost always want that,) or == if you want to check if two strings are the exact same string. == behaves differently when comparing primitive numbers, like straight up ints. == is a check to see if they have the same value and there's no equivalent concept of checking for their identity - if you'd like to have ints that have identities, consider using the Integer class instead of the int primitive.
has comment: http://stackoverflow.com/comment/32185098

http://stackoverflow.com/comment/32004546
score: 0
comment on: http://stackoverflow.com/q/21244748
has text: Can you show us your directory structure and the files in each?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21297633
tagged with: embed
tagged with: image
has title: Storing message into R,G,B instead of Alpha
linked to: http://stackoverflow.com/q/21267677
tagged with: decode
type: AnsweredQuestion
tagged with: argb
accepted answer: http://stackoverflow.com/a/21337586
has body: How to change it to store message into least significant bit of R,G,B. The code below only embed message into Alpha (0~7bit) embedInteger deals with embedding the length of the message in the first 32 pixels. embedByte embeds your message characters, one by one. Every time it is called upon, it takes as an input the next character in your message in byte form, b[i]. There, it embeds one bit per pixel, for a total of 8 bits per byte. private void embedMessage(BufferedImage img, byte[] mess) { int messageLength = mess.length; int imageWidth = img.getWidth(), imageHeight = img.getHeight(), imageSize = imageWidth * imageHeight; if(messageLength * 8 + 32 &gt; imageSize) { System.out.println("Message is too logn"); return; } embedInteger(img, messageLength, 0, 0); for(int i=0; i&lt;mess.length; i++){ embedByte(img, mess[i], i*8+32, 0); } } private void embedInteger(BufferedImage img, int n, int start, int storageBit) { int maxX = img.getWidth(), maxY = img.getHeight(), startX = start/maxY, startY = start - startX*maxY, count=0; for(int i=startX; i&lt;maxX &amp;&amp; count&lt;32; i++) { for(int j=startY; j&lt;maxY &amp;&amp; count&lt;32; j++) { int rgb = img.getRGB(i, j), bit = getBitValue(n, count); rgb = setBitValue(rgb, storageBit, bit); img.setRGB(i, j, rgb); count++; } } } private void embedByte(BufferedImage img, byte b, int start, int storageBit) { int maxX = img.getWidth(), maxY = img.getHeight(), startX = start/maxY, startY = start - startX*maxY, count=0; for(int i=startX; i&lt;maxX &amp;&amp; count&lt;8; i++) { for(int j=startY; j&lt;maxY &amp;&amp; count&lt;8; j++) { int rgb = img.getRGB(i, j), bit = getBitValue(b, count); rgb = setBitValue(rgb, storageBit, bit); img.setRGB(i, j, rgb); count++; } } } private int getBitValue(int n, int location) { //n=messageLength, location=count int v = n &amp; (int) Math.round(Math.pow(2, location)); return v==0?0:1; } private int setBitValue(int n, int location, int bit) { int toggle = (int) Math.pow(2, location), bv = getBit…
type: Question
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21337586
answer count: 1

http://stackoverflow.com/a/21190272
downvote count: 0
has comment: http://stackoverflow.com/comment/31906086
score: 1
has comment: http://stackoverflow.com/comment/31906097
answers question: http://stackoverflow.com/q/21189535
accepted answer of: http://stackoverflow.com/q/21189535
has comment: http://stackoverflow.com/comment/31906272
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31906247
type: Answer
has body: Change your line to &lt;svg id="&lt;%out.print(divid);%&gt; " class="sparkline"&gt;&lt;/svg&gt; In other words, use print instead of println. println adds a new line after your String.

android-viewpager
tag name: android-viewpager
type: Tag
tags question: http://stackoverflow.com/q/21320214

http://stackoverflow.com/a/21339897
downvote count: 0
has body: Creating a button having just an icon is quite easy. If you want hover effects it's getting tricky, therefore you should use the NativeButton. Button btnLogout = new Button(); btnLogout.setIcon(new ThemeResource("icons/logout.png")); btnLogout.addStyleName(Reindeer.BUTTON_LINK); // define it as a link button =&gt; no borders, just the icon. Every theme has this style-name. btnLogout.setDescription("Logout"); // set hint
accepted answer of: http://stackoverflow.com/q/21338898
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21338898
has comment: http://stackoverflow.com/comment/32172132
type: AcceptedAnswer

http://stackoverflow.com/comment/32023362
type: Comment
type: QuestionComment
has text: I really don't have an idea how to do so.
comment on: http://stackoverflow.com/q/21256417
score: 0

http://stackoverflow.com/q/21315425
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21356875
type: AnsweredQuestion
has body: I have to collect a big set (3000-5000) tweets selected randomly for a manual annotation, but I have some restrictions: all the tweets must have an image attached to; duplicated tweets are not allowed; I need information like the comments, so it wouldn't be useful to take them few seconds after their posting time, I have to process my data in Java, so I intend to use Twitter4J or Hosebird Client. Possibly, the tweets must be chosen randomly, without specify any tag (like "food" or "sport"). I managed, using Hosebird Client, to create a Stream and to fill a BlockingQueue with tweets, but in this way I don't respect restriction 3 and 5. With Twitter4J, on the other hand, using the class Query, I am not able to find a solution that respects from 1 to 5 at the same time. I feel that using a Queue will help me with the issue of duplicated tweets, but I don't succeed in respect all my prerequisites. My question is: is possible respect all my restrictions with twitter4j or HBC? If yes, can someone give me some code or advice? Thanks
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Get big number of random tweets
tagged with: twitter4j
has answer: http://stackoverflow.com/a/21356875
tagged with: twitter
tagged with: twitter-hbc

http://stackoverflow.com/q/21257976
tagged with: pgadmin
tagged with: postgresql
answer count: 2
has comment: http://stackoverflow.com/comment/32027534
possible better answer: http://stackoverflow.com/a/21258927
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/21262621
tagged with: java
tagged with: hibernate
has title: How to display text value inserted using Hibernate in pgAdmin3?
type: Question
accepted answer: http://stackoverflow.com/a/21262621
has answer: http://stackoverflow.com/a/21258927
tagged with: jpa
has body: I have a table, which has a column "description" of type TEXT. If I do: SELECT id, description FROM table_name; I see in "description" column instead of text value a number. Is there any way to see the text value? Edit: After some testing I found out why I see numbers, but others like Craig see real text. It's because the data are inserted using Hibernate. Entity: @Entity public class Settings { @Id @GeneratedValue private Integer id; @Column(nullable = false, unique = true) private String key; @Lob @Column(nullable = false, length = Integer.MAX_VALUE) private String value; // getters and setters } Log result: Hibernate: create table Settings (id int4 not null, key varchar(255) not null, value text not null, primary key (id)); Hibernate: select nextval ('hibernate_sequence') Hibernate: insert into Settings (key, value, id) values (?, ?, ?) 16:05:32,718 TRACE BasicBinder:81 - binding parameter [1] as [VARCHAR] - [GoogleSiteVerification] 16:05:32,718 TRACE BasicBinder:81 - binding parameter [2] as [CLOB] - [] 16:05:32,726 TRACE BasicBinder:81 - binding parameter [3] as [INTEGER] - [4] If I do in pgAdmin3 this select: select * from settings; I see this result: 1;"GoogleSiteVerification";"112351"

http://stackoverflow.com/comment/118344491
has text: Yeah, but why can't I have same column with two different entities? Can anyone suggest solution to this please?
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21321851
type: Comment

http://stackoverflow.com/a/21295042
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/21295013
accepted answer of: http://stackoverflow.com/q/21295013
has body: Get rid of the T in public &lt;T&gt; void put(T item) throws InterruptedException{ ^ If you leave it, you are declaring a different type variable that is shadowing your class' type variable T. You can bind a different type to this one, so the compiler cannot guarantee that it will be the same as the one bound to the Queue. You seem to want to use the same type variable as the one the in the class declaration.

http://stackoverflow.com/comment/31999877
comment on: http://stackoverflow.com/a/21241088
type: AnswerComment
has text: My service is up and running my get requests work fine. Its the post that fails. Im thinking it might be something to do with my constructor for my class and the Sequence I am using for the ID.
score: 0
type: Comment

http://stackoverflow.com/comment/32021435
type: QuestionComment
score: 1
has text: It looks like your server never actually finishes sending a line? It sends "killpr" then leaves the socket alone forever. No newline, and the socket isn't closed. So readLine on the client never returns because it's waiting for the rest of the line.
comment on: http://stackoverflow.com/q/21255106
type: Comment

http://stackoverflow.com/a/21344967
has comment: http://stackoverflow.com/comment/32181205
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32181462
accepted answer of: http://stackoverflow.com/q/21344934
type: Answer
answers question: http://stackoverflow.com/q/21344934
has body: Make array[0] into an empty array: array[0] = {};
upvote count: 1
has comment: http://stackoverflow.com/comment/32181241

http://stackoverflow.com/comment/31970880
type: AnswerComment
score: 0
type: Comment
has text: All I said is right for Java
comment on: http://stackoverflow.com/a/21224726

stack-trace
tags question: http://stackoverflow.com/q/21284281
type: Tag
tags question: http://stackoverflow.com/q/21210510
tag name: stack-trace

http://stackoverflow.com/q/21299942
type: Question
downvote count: 0
tagged with: tomcat
has answer: http://stackoverflow.com/a/21300025
answer count: 1
linked to: http://stackoverflow.com/q/3634707
favorite count: 0
upvote count: 2
has title: Only one usage of each socket address (protocol/network address/port) is normally permitted while tomcat start?
accepted answer: http://stackoverflow.com/a/21300025
has comment: http://stackoverflow.com/comment/32100722
type: AnsweredQuestion
score: 2
has body: Here is my connector element in server.xml. I also tried using 8443 instead of 8484 but same error. &lt;Connector SSLEnabled="true" acceptCount="100" connectionTimeout="20000" executor="tomcatThreadPool" keystoreFile="D:/.keystore" keystorePass="changeit" maxKeepAliveRequests="15" port="8484" protocol="HTTP/1.1" redirectPort="8484" scheme="https" secure="true" allowUnsafeLegacyRenegotiation="true"/&gt; SEVERE: Error starting endpoint java.lang.Exception: Socket bind failed: [730048] Only one usage of each socket address (protocol/network address/port) is normally permitted. at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:649) at org.apache.tomcat.util.net.AprEndpoint.start(AprEndpoint.java:766) at org.apache.coyote.http11.Http11AprProtocol.start(Http11AprProtocol.java:137) at org.apache.catalina.connector.Connector.start(Connector.java:1122) at org.apache.catalina.core.StandardService.start(StandardService.java:540) at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) Jan 23, 2014 10:05:26 AM org.apache.catalina.core.StandardService start SEVERE: Failed to start connector [Connector[HTTP/1.1-8484]] LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: java.lang.Exception: Socket bind failed: [730048] Only one usage of each socket address (protocol/network address/port) is normally permitted. at org.apache.catalina.connector.Connector.start(Connector.java:1129) at org.apache.catalina.core.StandardService.start(StandardService.jav…
tagged with: java
has comment: http://stackoverflow.com/comment/32100631

http://stackoverflow.com/q/21222784
has comment: http://stackoverflow.com/comment/31964538
favorite count: 0
has answer: http://stackoverflow.com/a/21222906
has body: I have a minor problem that sets me back nearly all day and I would like some input on how to solve it. I am making a servlet for my site and I have a formatted .txt in the following form: Name,Surname,Age for example: mary,jane,23 mark,thomson,25 . . . etc I want somehow to read this txt in order to pass these strings from my .txt to my database, in the corresponding fields. Thanks in advance for any input!
accepted answer: http://stackoverflow.com/a/21222906
has answer: http://stackoverflow.com/a/21222886
type: AnsweredQuestion
tagged with: java
type: Question
has title: Read Formated Text for Java Servlets
tagged with: servlets
possible better answer: http://stackoverflow.com/a/21222886
score: 0
answer count: 2
upvote count: 1
tagged with: sql
downvote count: 1

http://stackoverflow.com/q/21238747
type: Question
tagged with: java
tagged with: logback
has title: How do I timer log in Java and analyse the results?
answer count: 2
has answer: http://stackoverflow.com/a/21239623
downvote count: 0
favorite count: 0
tagged with: time
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21238886
score: 2
upvote count: 2
has body: My application server has slow paths that need analysis. I want to measure time and find out the slowest path, fix it, and measure again. Google return results for timers that schedule threads and tasks, which is not what I want. I use logback and can put log-statements in different methods. Each line has a timestamp. This data is logged into a separate logger. The duration of the action is the difference between 2 timestamps. Is there a way to analyse this timer log data, without manual evaluation of the duration? A tool? A methology? A best practice that I should use? I want to put timer log data through my application and then quickly find slow actions that need my attention. Application servers are also running in customer environments, a timer logger is an easy way to analyse their performance.
tagged with: logging

http://stackoverflow.com/comment/31911287
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21192908
has text: Open your runnable.jar with a zip-application (f.e. 7-zip) and look if the file is contained in the jar and in the respective directory. Often a wrong setting prevents the resource from being included into the jar.
score: 1

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/21311738
type: Tag
tags question: http://stackoverflow.com/q/21334782
tags question: http://stackoverflow.com/q/21310597
tags question: http://stackoverflow.com/q/21207943

http://stackoverflow.com/comment/31962091
type: Comment
type: QuestionComment
has text: no one wants to look at unformatted code
comment on: http://stackoverflow.com/q/21218210
score: 0

http://stackoverflow.com/a/21343149
answers question: http://stackoverflow.com/q/21343064
type: Answer
downvote count: 0
type: AcceptedAnswer
score: 15
has body: In Java, Strings are backed by a character array. The theoretical size of an array is limited by the maximum value of int, so it's impossible to have a String with over 231-1 characters to begin with. To overcome this issue you can create a string class of your own that uses multiple arrays or strings as storage.
upvote count: 15
accepted answer of: http://stackoverflow.com/q/21343064

http://stackoverflow.com/q/21284350
answer count: 0
type: UnansweredQuestion
tagged with: java
upvote count: 1
type: Question
tagged with: kerberos
has title: Jaas Kerberos Authentication through test AD in virtual environment
tagged with: jaas
downvote count: 0
score: 1
favorite count: 0
tagged with: oracle-database
has body: i was trying out this example authentication code from ORacle. The only thing I change is the logincontext try { lc = new LoginContext("SampleConfig", new TextCallbackHandler()); } my jaas.conf file looks like this SampleConfig { com.sun.security.auth.module.Krb5LoginModule required client=true useTicketCache=false; }; I put the conf file together with the class. However when i run it, it gives me this error C:\AnotherDirectory&gt; java -Djava.security.krb5.realm=corp.example.com -Djava.s ecurity.krb5.kdc=corp.example.com -Djava.security.auth.login.config=jaas.conf JaasAcn at JaasAcn.main(JaasAcn.java:37) Caused by: java.net.UnknownHostException: corp.example.com at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$1.lookupAllHostAddr(Unknown Source) at java.net.InetAddress.getAddressesFromNameService(Unknown Source) at java.net.InetAddress.getAllByName0(Unknown Source) at java.net.InetAddress.getAllByName(Unknown Source) at java.net.InetAddress.getAllByName(Unknown Source) at java.net.InetAddress.getByName(Unknown Source) at sun.security.krb5.internal.UDPClient.&lt;init&gt;(Unknown Source) at sun.security.krb5.internal.NetClient.getInstance(Unknown Source) at sun.security.krb5.KdcComm$KdcCommunication.run(Unknown Source) at sun.security.krb5.KdcComm$KdcCommunication.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.security.krb5.KdcComm.send(Unknown Source) at sun.security.krb5.KdcComm.send(Unknown Source) at sun.security.krb5.KdcComm.send(Unknown Source) at sun.security.krb5.KrbAsReqBuilder.send(Unknown Source) at sun.security.krb5.KrbAsReqBuilder.action(Unknown Source) I am running a test AD in a VBox Host only adaptor. I guess I did not set up the AD properly. So I use the actual IP address (IPv4) instead. C:\AnotherDirectory&gt;java -Djava.security.krb5.realm=192.168.56.101 -Djava.secu rity.krb5.kdc=192.168.56.101 -Djava.security.auth.login.config=jaas.config JaasAcn Kerberos username [Admi…

http://stackoverflow.com/comment/31980207
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21231730
score: 0
has text: Keep two classes with public access specifier in a single java file. One with main and one without main. You will get warning or error.

http://stackoverflow.com/a/21243930
type: Answer
has body: In addition to what others are saying, your for loop seems to have a bug in it: for(int j = 0; j &lt; 6; j++) { for(int k = 0; k &lt; 7; k++) { if(/* condition */) { return true; } else if(/* condition */) { return true; } else if(/* condition */) { return true; } else { // bug return false; // here } } } return false; This will only check the very first iteration so you need to remove the else. It also seems you don't check the result of winCheck: winCheck(firstColour); displayWinner(firstColour); And I think you mean something like this: if(winCheck(firstColour)) { displayWinner(firstColour); }
has comment: http://stackoverflow.com/comment/32004781
has comment: http://stackoverflow.com/comment/32004138
has comment: http://stackoverflow.com/comment/32004178
has comment: http://stackoverflow.com/comment/32003240
answers question: http://stackoverflow.com/q/21243712
has comment: http://stackoverflow.com/comment/32002605
score: 0
has comment: http://stackoverflow.com/comment/32003488
has comment: http://stackoverflow.com/comment/32004728
has comment: http://stackoverflow.com/comment/32002690
has comment: http://stackoverflow.com/comment/32003363
has comment: http://stackoverflow.com/comment/32002523
has comment: http://stackoverflow.com/comment/32002766
has comment: http://stackoverflow.com/comment/32004066
has comment: http://stackoverflow.com/comment/32002909
has comment: http://stackoverflow.com/comment/32004233
has comment: http://stackoverflow.com/comment/32002782
has comment: http://stackoverflow.com/comment/32004256

smslib
tags question: http://stackoverflow.com/q/21214228
type: Tag
tags question: http://stackoverflow.com/q/21299558
tag name: smslib

http://stackoverflow.com/comment/32083466
type: QuestionComment
comment on: http://stackoverflow.com/q/21290270
has text: Did you try using http://www.jsonschema2pojo.org/?
score: 0
type: Comment

http://stackoverflow.com/q/21215827
has answer: http://stackoverflow.com/a/21216025
tagged with: swing
tagged with: actionlistener
tagged with: java
type: Question
answer count: 1
has body: I am currently developing a small text-based game, and I keep getting an error... I don't know how to fix it, since its my first time using JFrame. The problem is, when I make the ButtonDemo method into ButtonDemo(), not public static void ButtonDemo(), there is a problem with the ButtonDemo(). However, if it is public static void ButtonDemo(), there would be an error on the jbtnW.addActionListener(this), saying that I cannot use the "this" because the ButtonDemo() is static. package game; import java.awt.*; import java.awt.event.*; import javax.swing.*; import game.Storylines.*; public class Frame implements ActionListener{ VillageDrengr shops = new VillageDrengr(); static JLabel jlab; static JFrame jfrm = new JFrame("A Game"); public static void ButtonDemo() { jfrm.setLayout(new FlowLayout()); jfrm.setSize(500, 350); jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton jbtnW = new JButton("Equipment Shop"); JButton jbtnP = new JButton("Potion Shop"); jbtnW.addActionListener(this); jbtnP.addActionListener(this); jfrm.add(jbtnW); jfrm.add(jbtnP); jlab = new JLabel("Choose a Store."); jfrm.add(jlab); jfrm.setVisible(true); } @Override public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("Equipment Shop")) jlab.setText("You went in to the Equipment Shop."); else jlab.setText("You went in to the Potion Shop."); } public static void main(String[] args) { // TODO Auto-generated method stub SwingUtilities.invokeLater(new Runnable() { public void run() { ButtonDemo(); } }); } }
has comment: http://stackoverflow.com/comment/31951871
score: 0
tagged with: mainclass
tagged with: constructor
has title: JFrame method prob
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31951911

http://stackoverflow.com/comment/32142492
type: Comment
has text: Thanks @Lestat, I found the solution, thanks for your answers, I had to set the position of the sprite, using `-spr.getWidth()*0.5f` and then it locates the sprite in front of the camera, otherwise, it was too much on the right, and I had to set the scale to 0.04f (the black was actually part of the img),I don't know how to automatically set the scale, I am using `camera = new OrthographicCamera(10, 10 * (Gdx.graphics.getHeight() / (float)Gdx.graphics.getWidth()));` and `0.04f` for the scale of the sprite. Maybe I'll find out how to find the correct scale, or if you know something about this?
comment on: http://stackoverflow.com/a/21299556
score: 0
type: AnswerComment

http://stackoverflow.com/q/21255406
tagged with: java
type: Question
has title: Time stamping a jar
score: 0
linked to: http://stackoverflow.com/q/1647759
answer count: 1
tagged with: jar
type: UnansweredQuestion
tagged with: timestamp
has body: I had following qustions about timestamping a jar: (exe timestamping is working fine) Do we have to "purchase" anything for timestamping , similar to code signing certificate? Is it mandatory to timestamp the exe/jar from the same TSA , with which it is signed? We have purchased a code signing certificate from GoDaddy. The "http://support.godaddy.com/help/article/4833/about-code-signing-certificates" link of GoDaddy says: Is there a limit to the amount of time stamp requests allowed for a Code Signing certificate? No. Unlike some of our competitors, we do not limit the number of time stamp requests which can be issued by a single Code Signing certificate. From above statement, I understand tha the timestamp can be done, if you have code signing certificate purchased. using command: jarsigner -keystore mykeys -sigfile SIG -signedjar SignedApp.jar -tsacert testalias app.jar johndoe where testalias is the TSA's public key certificate. Where can I get GoDaddy's TSA public key certificate ? If I use below command to timestamp jarsigner -verbose -keystore C:\a.pfx -storepass &lt;password&gt; -storetype pkcs12 C:\abc.jar -tsa http://tsa.starfieldtech.com &lt;pfx certificate alias&gt; I get the following error: jarsigner: Certificate chain not found for: -tsa. -tsa must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain. Apart from How to validate if a signed jar contains a timestamp?, is there any easier way to check the timestamp of a jar
has answer: http://stackoverflow.com/a/21621601

http://stackoverflow.com/q/21278208
type: Question
answer count: 2
has body: I have JTextPane object. I've added DefaultHighlighter.DefaultHighlightPainter highlighter like this: DefaultHighlighter.DefaultHighlightPainter high = new DefaultHighlighter.DefaultHighlightPainter(Color.GREEN); try { jTextPane1.getHighlighter().addHighlight(0, 20, high); } catch (BadLocationException ex) { ex.printStackTrace(); } Now, I want to select (highlight) text with my mouse. When I do that, the green part of text does not highlights in blue. I would like that all the text would highlight in blue when i select it with my mouse. How could i solve this issue?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21278949
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21279285
tagged with: highlight
has title: How to change text selection color in JTextPane when DefaultHighlighter.DefaultHighlightPainter is applied?
score: 1
tagged with: java
tagged with: jtextpane
upvote count: 1

http://stackoverflow.com/q/21303226
has answer: http://stackoverflow.com/a/21303454
has answer: http://stackoverflow.com/a/21303338
favorite count: 0
has answer: http://stackoverflow.com/a/21303396
has answer: http://stackoverflow.com/a/21303421
tagged with: android
tagged with: android-intent
type: AnsweredQuestion
score: 7
tagged with: java
has body: I see any intent has extra field and a data field. is there any difference between them or it's just a conceptual difference?
upvote count: 7
type: Question
has answer: http://stackoverflow.com/a/21303413
accepted answer: http://stackoverflow.com/a/21303421
downvote count: 0
answer count: 6
has answer: http://stackoverflow.com/a/26476399
has title: what is the difference between intent extra and intent data?
possible better answer: http://stackoverflow.com/a/21303338

http://stackoverflow.com/q/21191701
score: 4
upvote count: 4
answer count: 1
downvote count: 0
tagged with: smartgwt
favorite count: 0
tagged with: web-applications
has answer: http://stackoverflow.com/a/32861707
has title: I am building a web application that is deployable via WAR file, can I put 3rd party licenses in a folder, or must I display them in the application?
has body: The SmartGWT showcase examples only seem to include licenses in a folder (one copy of the appropriate license per 3rd party library). I was hoping I could do the same, but I want to make sure that is appropriate. Most of the licenses are Apache (1.1 or 2.0), and I have a couple LGPL and BSD 2-clause. I have read the licenses, and I am unclear as to whether or not packaging the license text files inside the WAR is good enough, or if I need to actually display them in some way.
tagged with: gwt
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/32861707

http://stackoverflow.com/a/21317734
score: 2
downvote count: 0
has body: provider is null. You declare it here private String provider; but you never initialize it properly. This line is returning null provider = locationManager.getBestProvider(criteria, false); which is causing your initial exception at this line Location location = locationManager.getLastKnownLocation(provider); you can see that by stepping back through the stacktrace. Debug that and see why provider is null.
type: Answer
answers question: http://stackoverflow.com/q/21317659
upvote count: 2

http://stackoverflow.com/q/21297056
has body: All I need is a peice of java code that can detect DTMF from microphone print out the characters to System.out. I've been searching forever and I couldn't find it.
has answer: http://stackoverflow.com/a/21297142
linked to: http://stackoverflow.com/q/17539366
tagged with: java
answer count: 1
downvote count: 0
tagged with: dtmf
favorite count: 0
type: UnansweredQuestion
tagged with: microphone
has title: Code to read data from microphone and detect DTMF tones
score: 2
upvote count: 2
type: Question
tagged with: audio

http://stackoverflow.com/q/21189662
has comment: http://stackoverflow.com/comment/31921605
upvote count: 1
tagged with: swing
has body: I want to modify ScrollPane using Synth L&amp;F Here is my XML code: &lt;style id="scrollBar"&gt; &lt;insets top="4" left="6" bottom="4" right="6"/&gt; &lt;state&gt; &lt;font name="Verdana" size="12"/&gt; &lt;color value="#D2DFF2" type="BACKGROUND"/&gt; &lt;color value="#000000" type="TEXT_FOREGROUND"/&gt; &lt;/state&gt; &lt;imagePainter method="scrollBarBackground" path="scrollbar.png" sourceInsets="4 6 4 6" paintCenter="true"/&gt; &lt;/style&gt; &lt;bind style="scrollBar" type="region" key="ScrollBar"/&gt; Is there any link where I can find all the methods and regions and subregions details?
has title: How to modify ScrollPane using synth L&F?
tagged with: java
tagged with: jscrollpane
answer count: 0
downvote count: 0
tagged with: synth
type: UnansweredQuestion
favorite count: 0
type: Question
score: 1
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/a/21218095
type: Answer
has body: You can monitor your http Traffic by using Fiddler Here is the download link
score: 0
answers question: http://stackoverflow.com/q/21217994

activemq-classic
tags question: http://stackoverflow.com/q/21274616
tags question: http://stackoverflow.com/q/21281732
tags question: http://stackoverflow.com/q/21292341
tags question: http://stackoverflow.com/q/21261142
tags question: http://stackoverflow.com/q/21254389
tags question: http://stackoverflow.com/q/21313281
tags question: http://stackoverflow.com/q/21221870
tag name: activemq-classic
tags question: http://stackoverflow.com/q/21233135
type: Tag

http://stackoverflow.com/q/21283339
has body: I am developing an application using Spring MVC 3 and Hibernate. I have 2 classes User and TenancyDetails with parent-child relationship. In the edit details functionality, we can edit the details of class User and dynamically add classTenancyDetails items and save the changes. I am using hibernate saveorupdate() method for this and hibernate is creating a new record for class User when it should be updating the existing record. Here is my code. Model classes: @Entity @Table(name="tenancydetails") public class TenancyDetails { @Column(name="tenancyID") @Id @GeneratedValue private int tenancyId; @Column(name="landlordName") @NotNull private String landlordName; @Column(name="landLordEmail") @NotNull private String landlordEmail; @Column(name="fromDate") @NotNull private Date fromDate; @Column(name="toDate") @NotNull private Date toDate; @Column(name="location") @NotNull private String location; @ManyToOne(cascade=CascadeType.ALL) @JoinColumn(name="userId", nullable=false) private User user; @Transient protected Object[] jdoDetachedState; public User getUser() { return user; } public void setUser(User user) { this.user = user; } public int getTenancyId() { return tenancyId; } public void setTenancyId(int tenancyId) { this.tenancyId = tenancyId; } public String getLandlordName() { return landlordName; } public void setLandlordName(String landlordName) { this.landlordName = landlordName; } public String getLandlordEmail() { return landlordEmail; } public void setLandlordEmail(String landlordEmail) { this.landlordEmail = landlordEmail; } public Date getFromDate() { return fromDate; } public void setFromDate(Date fromDate) { this.fromDate = fromDate; } public Date getToDate() { return toDate; } public void setToDate(Date toDate) { this.toDate = toDate; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } } @Entity @Table(name="User") public class User { @Column(name="userId") @Id private int userId; @Col…
has comment: http://stackoverflow.com/comment/32073047
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21285038
linked to: http://stackoverflow.com/q/170962
tagged with: google-app-engine
has title: Hibernate saveorupdate or merge for saving/updating one-to-many relationship objects
tagged with: spring
has answer: http://stackoverflow.com/a/21285038
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/32072238

while-loop
tags question: http://stackoverflow.com/q/21212761
type: Tag
tags question: http://stackoverflow.com/q/21194271
tags question: http://stackoverflow.com/q/21217512
tags question: http://stackoverflow.com/q/21212586
tags question: http://stackoverflow.com/q/21191551
tags question: http://stackoverflow.com/q/21277156
tags question: http://stackoverflow.com/q/21218464
tags question: http://stackoverflow.com/q/21333131
tags question: http://stackoverflow.com/q/21334920
tags question: http://stackoverflow.com/q/21296593
tags question: http://stackoverflow.com/q/21228344
tags question: http://stackoverflow.com/q/21332183
tag name: while-loop

http://stackoverflow.com/comment/32070245
type: QuestionComment
has text: First of all, do you understand the difference between Class and Object?. And secondly, what do you understand by Serialization?. have a look @aniket's answer...
comment on: http://stackoverflow.com/q/21283116
score: 4
type: Comment

http://stackoverflow.com/q/21222195
type: Question
has comment: http://stackoverflow.com/comment/31963576
tagged with: defaultlistmodel
has comment: http://stackoverflow.com/comment/31963539
has comment: http://stackoverflow.com/comment/31967437
has title: Deleting objects from a model in Swing
type: UnansweredQuestion
has body: I am working with a swing GUI for a grading system project I am doing. I originally found an issue with an NPE regarding deleting Student objects from the DefaultListModel, and I think I found the source. I ran two tests, one within the Controller Class, and the other the view. DefaultListModel&lt;Student&gt; model = new DefaultListModel(); //declarations in Controller private TreeMap&lt;String, Student&gt; tm = new TreeMap(); Now, when I add a student using the JButton for adding, I ran the following test to make sure the Student was added to the TreeMap and ListModel. private void handleAddButton(){ fn = sv.firstName(); //return firstName from textArea ln = sv.lastName(); //return lastName from textArea Student s = new Student(ln, fn); model.addElement(s); tm.put(Student.makeStudentKey(fn, ln), s); String grades = sv.getGrades(); //returns string of grades from textField sc = new Scanner(grades); while(sc.hasNext()){ s.addGrade(sc.nextDouble()); //add grades to Student's grades ArrayList } sv.clearField();//clear textFields and area sv.setId(); //set NextID to be displayed in respective textField debug(); } The Debug method: public void debug(){ System.out.println(tm.size()); for(Student s : tm.values()){ System.out.println(s); } System.out.println(model.size()); } Now when ran in the handleAddButton class given 1 student "test test", debug prints 1, student toString, 1. This is the method that runs debug in the View class, handling a Menu item to create a new file. private void NewActionPerformed(java.awt.event.ActionEvent evt) { int check = JOptionPane.showConfirmDialog(null, "Are you sure you want" + " to create a new file?", "New File", JOptionPane.YES_NO_OPTION); System.out.println(check); sc.debug(); if(check == 0){ sc.clearModel(); sc.clearTm(); sc.setListModel(); } when tested identically with one student, it returns 0 0, as if no students were added. sv is initialized, I just can't wrap my head around why this is happening, and its preventing me from bein…
has comment: http://stackoverflow.com/comment/31966151
answer count: 0
tagged with: java
score: 0
tagged with: swing

http://stackoverflow.com/comment/32171124
type: Comment
has text: Looking into ThreadLocal; basically each iteration takes so much resources it completely eats up the vcpu it's on so I really only need a thread per vcpu (approx). So there will only be few threads running at a time and given the runtime & memory usage of each iteration, the overhead will be negligible.
type: AnswerComment
comment on: http://stackoverflow.com/a/21339426
score: 0

http://stackoverflow.com/comment/32074247
comment on: http://stackoverflow.com/a/21285270
score: 0
type: AnswerComment
type: Comment
has text: @user3014391 Play around with these examples. And if you don't get further...ask again! ;)

http://stackoverflow.com/a/21231127
answers question: http://stackoverflow.com/q/21229493
has comment: http://stackoverflow.com/comment/32015029
has comment: http://stackoverflow.com/comment/32015200
has body: You can use obj.getDataInputStream() to get the file. And then org.apache.commons.io.IOUtils copy method to copy. S3Object obj=s3Client.getObject(new GetObjectRequest(bucketname,key)); File file=new File("/tmp/AWSStorage/"+key); // if the directory does not exist, create it if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } And then you can use either of following. try { IOUtils.copy(obj.getDataInputStream(), new FileOutputStream(file)); } catch (Exception e) { e.printStackTrace(); } OR BufferedReader reader=null; BufferedWriter out=null; String data = null; try { reader = new BufferedReader(new InputStreamReader(fileObj.getDataInputStream())); out = new BufferedWriter (new FileWriter(file)); while ((data = reader.readLine()) != null) { out.write(data); } } catch (Exception e) { e.printStackTrace(); } finally { reader.close(); out.close(); }
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/21211338
type: Answer
answers question: http://stackoverflow.com/q/21211169
score: 0
has body: The error is here: btnChart.setEnabled( false ); you have not initialized / set your btnChart object.

http://stackoverflow.com/comment/31911707
type: QuestionComment
has text: Suggest you take a look at the javadocs for http://docs.oracle.com/javase/6/docs/api/java/util/Collections.html#sort(java.util.List) You'll need to keep two lists if you want, you know, two lists.
score: 0
comment on: http://stackoverflow.com/q/21193277
type: Comment

http://stackoverflow.com/a/21317091
type: Answer
has comment: http://stackoverflow.com/comment/32154022
has body: By default, an Animation's framerate is not explicitly limited, meaning the Animation will run at an optimal framerate for the underlying platform.
upvote count: 3
has comment: http://stackoverflow.com/comment/32131506
score: 3
has comment: http://stackoverflow.com/comment/32141695
has comment: http://stackoverflow.com/comment/32138682
downvote count: 0
answers question: http://stackoverflow.com/q/21316806

http://stackoverflow.com/comment/32161520
comment on: http://stackoverflow.com/a/21334508
score: 0
type: AnswerComment
has text: Yes, its is part of Apache commons: org.apache.commons.io.FileUtils
type: Comment

http://stackoverflow.com/comment/33893117
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21220196
has text: looks like it's not fully portable (iOS still has no support of this?) better is not to depend on FPS

http://stackoverflow.com/comment/31987887
has text: for performance reasons.
score: 0
comment on: http://stackoverflow.com/q/21235828
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21211309
score: 1
accepted answer of: http://stackoverflow.com/q/21190410
answers question: http://stackoverflow.com/q/21190410
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31945941
has body: Usually you can break them down by day of the week or workday/weekend. So they are just repeating times across the year. That would narrow down the amount of relationships you need, or? And only update that information when the schedule changes, or there is some maintenance. So I'd try to do one relationship per category and probably put the times into an attribute. Another interesting option would be to divide the day up into 5 minute segments (i.e. at a frequent line you get at most 288 rels for every 5 min segment). Name the rel-types according to the segment and have the concrete time as another attribute. So you can do a rough, good enough path finding by just looking at the rel-types. And then narrow it down to the best fit of the best rough results by looking at the concrete times. Oh, there has been some work from Thoughtworks modeling Manchesters public transport system (Tramchester). There have been several recorded presentations about it. http://www.meetup.com/manchester-geek-nights/events/137491162/ http://slideshare.net/neo4j/graph-connect-v5 https://vimeo.com/79410571 http://www.thoughtworks.com/insights/blog/transforming-travel-and-transport-industry-one-graph-time
upvote count: 1

http://stackoverflow.com/q/21260589
answer count: 4
has body: I am attaching following code and i want to sort this as class sort{ public static void main(String args[]) {String a ="this is a kiran"; StringTokenizer st =new StringTokenizer(a); List f=new ArrayList(); f.add(st); Collections.sort(f); System.out.println("after sortting "+f); } } I want output as: a is kiran this But i am getting an exception as:- Exception in thread "main" java.lang.ClassCastException: java.util.StringTokenizer cannot be cast to java.lang.Comparableat java.util.Collections.sort(UnknownSource)atcom.sort.main(Sort.java:18)
tagged with: java
has answer: http://stackoverflow.com/a/21260649
type: Question
has comment: http://stackoverflow.com/comment/32030727
tagged with: sorting
score: 0
has answer: http://stackoverflow.com/a/21260670
has comment: http://stackoverflow.com/comment/32030622
has answer: http://stackoverflow.com/a/21260863
type: UnansweredQuestion
has title: Sorting a String using java collections
has answer: http://stackoverflow.com/a/21261113
has comment: http://stackoverflow.com/comment/32030623
has comment: http://stackoverflow.com/comment/32030609

http://stackoverflow.com/q/21200130
answer count: 1
has answer: http://stackoverflow.com/a/21224783
has body: So this is my first time threading, and i'm using to update a scene at continuous intervals. I have been working on this problem and looking around for an explanation everywhere, this is my last resort to my headache. In my GLWorld extends GLSurfaceView class I have a handler being created in this: private static int threadID = 0; private final WorldRenderer mRenderer; private boolean running; private Context context; Handler timeHandler; private int[] values; public GLWorld(Context context, int values[]) { super(context); this.context = context; timeHandler = new Handler(); // Create an OpenGL ES 2.0 context. setEGLContextClientVersion(2); // Set the Renderer for drawing on the GLSurfaceView Log.d("Test", "GL initialized"); mRenderer = new WorldRenderer(context, values); setRenderer(mRenderer); this.startThread(); timeHandler.postDelayed(tickThread, values[2] * 1000); // Render the view only when there is a change in the drawing data setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); } the thread it runs is this one: private Runnable tickThread = new Runnable() { public void run() { threadID++; Log.d("tick", "start " + threadID + " " + SystemClock.currentThreadTimeMillis()); ArrayList&lt;Point&gt; points = new ArrayList&lt;Point&gt;(); //work down and populate points not shown for(int i = 0; i &lt; values[0]; i++) { for(int j = 0; j &lt; values[1]; j++) { updateFire(i,j,points); points.clear(); } } requestRender(); Log.d("tick", "finish " + threadID + " " + SystemClock.currentThreadTimeMillis()); Log.d("",""); if(running) timeHandler.postDelayed(this, values[2]* 1000); } }; now the GLWorld object exists inside an activity called SimulationActivity. I have onPause/onResume defined as: @Override protected void onPause() { super.onPause(); // The following call pauses the rendering thread. // If your OpenGL application is memory intensive, // you should consider de-allocating objects that // consume significant memory here. mGLView.endThread(); mGLView.onPause(); Log…
tagged with: java
accepted answer: http://stackoverflow.com/a/21224783
type: AnsweredQuestion
tagged with: android
tagged with: onpause
tagged with: opengl-es
type: Question
score: 0
linked to: http://stackoverflow.com/q/8639133
tagged with: multithreading
has title: Object in openGL scene becomes null in android thread when onPause is called

http://stackoverflow.com/q/21261866
has comment: http://stackoverflow.com/comment/32033987
tagged with: class
has title: Java - Static Class Private Fields Visible Outside
has answer: http://stackoverflow.com/a/21261903
type: AnsweredQuestion
tagged with: private
type: Question
has body: In the following simple piece of code, surely this should produce an error, but instead it logs 's' and then '10'. Are private fields not only visible from within their class, even if that class is static? public class Test { public static void main(String[] args) { TestClass myObj = new TestClass(); myObj.test(); System.out.println(myObj.myField); } static class TestClass { private int myField = 5; private void test() { System.out.println("s"); } } }
accepted answer: http://stackoverflow.com/a/21261903
score: 0
has comment: http://stackoverflow.com/comment/32033133
answer count: 1
tagged with: java
tagged with: encapsulation

http://stackoverflow.com/q/21234350
upvote count: 3
tagged with: midi
has comment: http://stackoverflow.com/comment/31985790
favorite count: 0
type: UnansweredQuestion
tagged with: channel
downvote count: 0
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/47081486
score: 3
has body: I'd like to be able to play percussion sounds on two channels, so that I can sent one channel to the left (pan 0) and one to the right (pan 127) to have a stereo effect. I want to play two percussions sounds concurrently, one on the left, one on the right. Here is some code: final Synthesizer synthesizer = MidiSystem.getSynthesizer(); synthesizer.open(); channel = synthesizer.getChannels()[9]; ... channel.controlChange (10,0); // pan left channel.noteOn (35, 64); channel.controlChange (10,127); // pan right channel.noteOn (36, 64); This code doesn't work, since as soon as the pan right is executed, the note that is meant to sound on the left sounds on the right. It works OK if two channels are used, but so far I haven't been able to work out how to get the percussion sound on the second channel. Can the instrument from channel 10 be copied to another channel? I don't have much hope, since this post says "not possible": channel 10 (percussion) with output in stereo
has title: JAVA Midi: Using percussion sound on two channels, channel 10 and another
has comment: http://stackoverflow.com/comment/31993451
has comment: http://stackoverflow.com/comment/47096274

http://stackoverflow.com/a/21219809
answers question: http://stackoverflow.com/q/21219702
upvote count: 5
downvote count: 0
has body: Yes, you are right! Facade provides an interface of something complex, by hiding the complexity and haphazardness to its client. The client can be JSF view page, another bean or service. There is no technical problem as long as you are using it accordingly! But generally, if you have done layering in conventional manners, it should not be like what you described.
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/31963920
has comment: http://stackoverflow.com/comment/101620434

http://stackoverflow.com/comment/31936267
comment on: http://stackoverflow.com/a/21207167
has text: Now I am getting another error: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'user' in 'field list'
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/21328371
answer count: 4
has answer: http://stackoverflow.com/a/21329579
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/56302045
possible better answer: http://stackoverflow.com/a/27693866
tagged with: java
tagged with: mysql
has title: Get Primary Key Column from ResultSet Java
upvote count: 8
type: Question
tagged with: database
has answer: http://stackoverflow.com/a/27693866
tagged with: sql
has answer: http://stackoverflow.com/a/47299075
score: 8
favorite count: 0
accepted answer: http://stackoverflow.com/a/21329579
has comment: http://stackoverflow.com/comment/32151347
tagged with: resultset
has body: I am trying to get Primary Key Column(s) of table from ResultSet. Following are the Steps I followed: 1. SQL QUERY: Select id,subid,email,empname from Employee 2. Executed this from java.sql.Statement and got the Results in ResultSet. Here is the Interesting Part. 3. ResultSetMetadata rsmd = rs.getMetadata(); Now, if i watch this variable "rsmd" , it is showing primary key flags for relevant column names but I am not able to access it or get it into any variable. I need help regarding the same. NOTE: I do not want to use DatabaseMetadata and its getPrimaryKeys() function as it will take an additonal hit into External Database. Also, the ResultSetMetadata object is already having the primary key Information which i just need to fetch.

http://stackoverflow.com/comment/31947737
comment on: http://stackoverflow.com/q/21213362
has text: @StinePike He is trying to port code from Java to C++. Though, this code shouldn't be ported (and one could argue, shouldn't exist in Java either ...)
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/21233831
score: 3
tagged with: java-native-interface
has answer: http://stackoverflow.com/a/21233972
tagged with: java
has comment: http://stackoverflow.com/comment/31984074
has comment: http://stackoverflow.com/comment/31984000
type: Question
has answer: http://stackoverflow.com/a/49678808
has answer: http://stackoverflow.com/a/21239687
has body: I am working on a project(in Java) in which I need to evaluate user codes which may be written in C++ or Java. To evaluate a code, I need to pass a parameter to the code and get the return value from it. I can easily do it for Java codes; just create an object for the user's class and then call the function using the object. I have problems doing it for C++. What are the possible methods I can call a C++ function from Java and get its return value? My code looks something like this (I cannot give exact code here). C++ code #include&lt;stdio&gt; int[] function(int a[]) { } // A Simple function that takes //an array and reverses it and returns it` Java Code from where the above function is called int a[]; //The array I will pass int rev[] = Somehow call C++ code from here and pass array a to it. I read it internet that JNI can be used, but it DOES NOT allow me to use the existing code, it asks to change the int arrays to jint. Is there any way I can achieve my purpose? I just want to pass an array to an existing C++ code and get its return value.
answer count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/31983954
favorite count: 0
tagged with: c++
type: UnansweredQuestion
has title: Calling a C++ function from Java
upvote count: 4

http://stackoverflow.com/a/21213090
score: 0
has body: Get rid of all static methods from the Give class. The Moregot class should create Give instances and call their methods, but not call static methods off of the class. In fact that getInformation method should be replaced by a constructor. In the constructor you should use the parameters passed in to set fields of the class, i.e., this.foo = foo; I would change the main method to where you get all the initial data, and only then create a Give object, passing this initial data into its constructor. I would give the Give class a decent toString() method that returns a String representation of the state of the object. For instance, your method would return a String that holds the values in the name fields and the age field. Then any class that holds a Give object can easily print it out by passing the Give object to a System.out.println(...) call. You will want to read a decent Java textbook to learn the rudiments as all your subsequent programming will build from this. Thinking in Java by Bruce Eckel is a good one. A coded example reply is preferred Much better for you to experiment with your own coding as you will learn much more with the effort.
type: Answer
answers question: http://stackoverflow.com/q/21213072

http://stackoverflow.com/a/21342418
answers question: http://stackoverflow.com/q/21342210
type: Answer
has body: you can use values() to get an array of all your enum values, then providing an id you can get corresponding element. public int getIntValue() { return this.value; } public Color getColorById(int id){ for(Color value : values()){ if (value.getIntValue() == id){ return value; } } return null; }
upvote count: 1
score: 1
downvote count: 0

regex
tags question: http://stackoverflow.com/q/21314184
tags question: http://stackoverflow.com/q/21266500
tags question: http://stackoverflow.com/q/21288239
tags question: http://stackoverflow.com/q/21218055
tags question: http://stackoverflow.com/q/21251566
tags question: http://stackoverflow.com/q/21254118
tags question: http://stackoverflow.com/q/21246060
tags question: http://stackoverflow.com/q/21193347
tag name: regex
tags question: http://stackoverflow.com/q/21251590
tags question: http://stackoverflow.com/q/21302784
tags question: http://stackoverflow.com/q/21286129
tags question: http://stackoverflow.com/q/21201998
tags question: http://stackoverflow.com/q/21246606
tags question: http://stackoverflow.com/q/21282400
tags question: http://stackoverflow.com/q/21271802
tags question: http://stackoverflow.com/q/21226850
tags question: http://stackoverflow.com/q/21208712
tags question: http://stackoverflow.com/q/21193809
tags question: http://stackoverflow.com/q/21239375
tags question: http://stackoverflow.com/q/21254940
tags question: http://stackoverflow.com/q/21294293
tags question: http://stackoverflow.com/q/21210687
tags question: http://stackoverflow.com/q/21208355
tags question: http://stackoverflow.com/q/21250812
tags question: http://stackoverflow.com/q/21252930
tags question: http://stackoverflow.com/q/21267448
tags question: http://stackoverflow.com/q/21228295
tags question: http://stackoverflow.com/q/21268737
tags question: http://stackoverflow.com/q/21280833
tags question: http://stackoverflow.com/q/21267929
tags question: http://stackoverflow.com/q/21334988
tags question: http://stackoverflow.com/q/21271972
tags question: http://stackoverflow.com/q/21256389
tags question: http://stackoverflow.com/q/21339594
tags question: http://stackoverflow.com/q/21265330
tags question: http://stackoverflow.com/q/21343141
tags question: http://stackoverflow.com/q/21343227
tags question: http://stackoverflow.com/q/21285069
tags question: http://stackoverflow.com/q/21326023
tags question: http://stackoverflow.com/q/21341353
tags question: http://stackoverflow.com/q/21195031
tags question: http://stackoverflow.com/q/21275974
tags question: http://stackoverflow.com/q/21307622
tags question: http://stackoverflow.com/q/21283328
tags question: http://stackoverflow.com/q/21297597
tags question: http://stackoverflow.com/q/21287278
tags question: http://stackoverflow.com/q/21320839
tags question: http://stackoverflow.com/q/21342272
tags question: http://stackoverflow.com/q/21200363
tags question: http://stackoverflow.com/q/21235787
tags question: http://stackoverflow.com/q/21203611
tags question: http://stackoverflow.com/q/21222851
tags question: http://stackoverflow.com/q/21331704
tags question: http://stackoverflow.com/q/21206082
tags question: http://stackoverflow.com/q/21340539
tags question: http://stackoverflow.com/q/21250448
tags question: http://stackoverflow.com/q/21241247
tags question: http://stackoverflow.com/q/21215220
tags question: http://stackoverflow.com/q/21271111
tags question: http://stackoverflow.com/q/21345215
tags question: http://stackoverflow.com/q/21203397
tags question: http://stackoverflow.com/q/21245730
tags question: http://stackoverflow.com/q/21199440
tags question: http://stackoverflow.com/q/21192636
type: Tag
tags question: http://stackoverflow.com/q/21274040
tags question: http://stackoverflow.com/q/21270354
tags question: http://stackoverflow.com/q/21301622

http://stackoverflow.com/comment/32025416
has text: **EDIT**: nevermind about the length check, checked BigInteger source. Your class seems a bit verbose. What is `BigNumber.n`?
comment on: http://stackoverflow.com/q/21257488
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32051471
has text: The example you provided assumes that I am initially having a String with a date, which is not the case. I initially have a Date object with the date I need to format...makes sense?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21271729
type: Comment

http://stackoverflow.com/comment/32102977
has text: Just looked up what merge-sort algorithm is on Wikipedia. Thanks.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21301069

http://stackoverflow.com/q/21213779
duplicate of: http://stackoverflow.com/q/1208442
tagged with: mysql
tagged with: prepared-statement
type: Question
has comment: http://stackoverflow.com/comment/31948529
has comment: http://stackoverflow.com/comment/31948965
has title: Passing table name as parameter of prepared statement
has comment: http://stackoverflow.com/comment/31948633
answer count: 3
tagged with: sql
has answer: http://stackoverflow.com/a/21214621
downvote count: 0
has comment: http://stackoverflow.com/comment/31949259
favorite count: 0
has body: I'm trying to learn how to use MySQL with Java and as the title says, I'm having problems with prepared statements. I have a MySQL table named temp which contains the values (output directly from MySQL console): mysql&gt; select * from temp; +------+-----------------------------------------------+ | id | value | +------+-----------------------------------------------+ | 1 | this is a first item | | 2 | this is the second item | | 3 | This is the third item and slightly redundant | +------+-----------------------------------------------+ 3 rows in set (0.00 sec) In Java I'm accessing the DB like this: stmt = conn.prepareStatment("select * from ?"); stmt.setString(1,"temp"); ResultSet rs = stmt.executeQuery(); //This method call throws the exception stmt.toString reveals: select * from 'temp' and the exception message is: 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 ''temp'' at line 1 When I type select * from 'temp' (The output of stmt.toString()) directly into the MySQL console I get the exact same message. As you may have imagined, I'm planning on applying this concept to a JSP webpage, where the table name will be a HTTP GET parameter. So my question is: How do I bind the table name to the prepared statement and if it's not possible (which is the vibe I'm getting from similar questions for PHP), how would I sanitize input for the table name?
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33682231
has answer: http://stackoverflow.com/a/21213814
linked to: http://stackoverflow.com/q/1208442
score: 2
tagged with: java

http://stackoverflow.com/comment/32106581
has text: Loose coupling is about reducing dependencies. Your example is far too trivial to illustrate the concept.
type: Comment
comment on: http://stackoverflow.com/q/21303458
type: QuestionComment
score: 3

http://stackoverflow.com/q/21263771
tagged with: mysql
type: Question
upvote count: 6
has title: How do I escape the colon (:) in a mysql query over jdbc that contains a variable assignment?
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/10797794
favorite count: 0
tagged with: query-variables
score: 6
tagged with: jdbc
has answer: http://stackoverflow.com/a/21263929
accepted answer: http://stackoverflow.com/a/21263929
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has body: I'm trying to run a query that involves a custom variable over JDBC toward a MySQL 5.0 database (Hibernate 4 as the ORM): SET @rownum := 0; SELECT rnum FROM ( SELECT (@rownum := @rownum + 1) AS rnum, col_name_a FROM table_name WHERE (col_name_b IS NULL OR col_name_b != 'USER' ) ORDER BY col_name_a) c WHERE col_name_a = :aValue The first SET @rownum := 0; is needed to reset the variable, but the colon isn't required there (I've set the allowMutilQuery=true as suggested in this question). The problem is with the following SELECT, where I keep on getting: org.hibernate.QueryException: Space is not allowed after parameter prefix ':' Is there a way around this? Should I use other methods than javax.persistence.Query q = EntityManager instance&gt;.createNativequery(String) and q.setParameter(&lt;param name&gt;, &lt;param value&gt;) ?

http://stackoverflow.com/q/21248341
tagged with: spring
type: AnsweredQuestion
tagged with: java
has body: I'm new to google app engine and I'm trying to deploy a spring application with spring web flow in google app engine. My application works in localhost with the app engine development environment. However when I deploy the application with app engine I get the following error message. Appreciate if someone could advise to solve this issue. javax.servlet.ServletException: java.lang.RuntimeException: java.io.InvalidClassException: org.springframework.webflow.conversation.impl.ConversationContainer; local class incompatible: stream classdesc serialVersionUID = -612159325924033885, local class serialVersionUID = 5598780395474023335 I have tried searching for an answer and so far I haven't been able to fix this issue. Following are the jar files I have in WEB-INF/lib currently. all-themes-1.0.10.jar appengine-api-1.0-sdk-1.8.9.jar appengine-api-labs.jar appengine-endpoints-deps.jar appengine-endpoints.jar appengine-jsr107cache-1.8.9.jar commons-logging-1.1.1.jar el-ri-1.0.jar jsf-api-2.1.26.jar jsf-impl-2.1.26.jar jsr107cache-1.1.jar primefaces-4.0.jar spring-aop-3.2.6.RELEASE.jar spring-beans-3.2.6.RELEASE.jar spring-binding-2.3.2.RELEASE.jar spring-context-3.2.6.RELEASE.jar spring-core-3.2.6.RELEASE.jar spring-expression-3.2.6.RELEASE.jar spring-faces-2.3.2.RELEASE.jar spring-js-2.3.2.RELEASE.jar spring-web-3.2.6.RELEASE.jar spring-webflow-2.3.1.RELEASE.jar spring-webflow-2.3.2.RELEASE.jar spring-webmvc-3.2.6.RELEASE.jar Ive also tried to use latest jar files for webflow and spring but nothing seems to workout. Error Message: javax.servlet.ServletException: java.lang.RuntimeException: java.io.InvalidClassException: org.springframework.webflow.conversation.impl.ConversationContainer; local class incompatible: stream classdesc serialVersionUID = -612159325924033885, local class serialVersionUID = 5598780395474023335 at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:268) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerW…
accepted answer: http://stackoverflow.com/a/21249103
type: Question
score: 0
answer count: 1
tagged with: spring-webflow
has answer: http://stackoverflow.com/a/21249103
has title: InvalidClassException with spring webflow on google app engine
tagged with: google-app-engine

http://stackoverflow.com/comment/32014695
has text: Hi, welcome to StackOverflow. Please learn how to format code snippets properly. Also, it would help if you gave an explanation for why your answer works.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21250811
type: Comment

http://stackoverflow.com/comment/31989162
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21236507
has text: why don't you check even and odd lins with modulo 2? then you don't need two buffered readers and this ugly if blocks
score: 0

http://stackoverflow.com/comment/106081928
type: Comment
type: QuestionComment
has text: don't override toString for application reasons ... ever! Instead, access object properties and format them as needed.
comment on: http://stackoverflow.com/q/21204942
score: 0

http://stackoverflow.com/a/21250776
has body: Looks like there is problem in version of jars that you are using.
answers question: http://stackoverflow.com/q/21250586
score: 0
type: Answer

http://stackoverflow.com/q/21212129
has comment: http://stackoverflow.com/comment/31945997
has comment: http://stackoverflow.com/comment/31945559
tagged with: arraylist
score: 0
tagged with: android
tagged with: spinner
has body: I have an arraylist with 2-6 items. The items gets added through some if/else statements. I have to convert this arraylist(listFartoy) to an array(arrayFartoy) for it to work in a spinner. Im using the method below: String[] arrayFartoy = new String[listFartoy.size()]; arrayFartoy = listfartoy.toArray(arrayFartoy); It seems to work fine. But when I put it inside the spinner it wont work. The line arrayFartoy[position] gets red. ArrayAdapter&lt;String&gt; adapterFartoy = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, arrayFartoy); adapterFartoy.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner_fartoy.setAdapter(adapterFartoy); spinner_fartoy.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, int position, long id) { selectedFartoy = arrayFartoy[position]; } @Override public void onNothingSelected(AdapterView&lt;?&gt; arg0) { } }); When I used this spinner/adapter with a normal array it works well and the selected item is stored in "selectedFartoy". It works with this: String[] arrayFartoy = new String[] { "Tarot T960", "Tarot FY680", "Ecilop", "Sexycopter", "Skywalker" };
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21213519
has title: Convert arraylist to an array for a spinner
answer count: 1
tagged with: arrays

http://stackoverflow.com/comment/32232769
comment on: http://stackoverflow.com/a/21227466
type: Comment
score: 0
has text: Hi; could you please look at the question again i have just updated it could you please help me solving my problem.
type: AnswerComment

http://stackoverflow.com/q/21219131
has body: I have trying to fix this bit of code for ages now and have already posted on here because of another problem! Here is the error i am getting now... Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Maze.Map.getMap(Map.java:34) at Maze.Board.paint(Board.java:32) at javax.swing.JComponent.paintToOffscreen(Unknown Source) at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source) at javax.swing.RepaintManager$PaintManager.paint(Unknown Source) at javax.swing.RepaintManager.paint(Unknown Source) at javax.swing.JComponent._paintImmediately(Unknown Source) at javax.swing.JComponent.paintImmediately(Unknown Source) at javax.swing.RepaintManager$3.run(Unknown Source) at javax.swing.RepaintManager$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.access$1100(Unknown Source) at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) a…
has answer: http://stackoverflow.com/a/21219148
type: AnsweredQuestion
score: 2
upvote count: 2
has title: java.lang.NullPointerException, cant see whats wrong
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/21219175
has answer: http://stackoverflow.com/a/21219246
has answer: http://stackoverflow.com/a/21219161
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21219175
has answer: http://stackoverflow.com/a/21219240
answer count: 5
possible better answer: http://stackoverflow.com/a/21219148

http://stackoverflow.com/comment/32142333
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21323369
has text: LocalDateTime means no time zone. Think twice if you truly want to time zone.

eclipse
tags question: http://stackoverflow.com/q/21310743
tags question: http://stackoverflow.com/q/21313104
tags question: http://stackoverflow.com/q/21214768
tags question: http://stackoverflow.com/q/21202582
tags question: http://stackoverflow.com/q/21212467
tags question: http://stackoverflow.com/q/21301799
tag name: eclipse
tags question: http://stackoverflow.com/q/21280473
tags question: http://stackoverflow.com/q/21283092
tags question: http://stackoverflow.com/q/21312603
tags question: http://stackoverflow.com/q/21248921
tags question: http://stackoverflow.com/q/21258749
tags question: http://stackoverflow.com/q/21316196
tags question: http://stackoverflow.com/q/21206964
tags question: http://stackoverflow.com/q/21208772
tags question: http://stackoverflow.com/q/21237489
tags question: http://stackoverflow.com/q/21236493
tags question: http://stackoverflow.com/q/21338580
tags question: http://stackoverflow.com/q/21229862
tags question: http://stackoverflow.com/q/21239143
tags question: http://stackoverflow.com/q/21187855
tags question: http://stackoverflow.com/q/21203074
tags question: http://stackoverflow.com/q/21340637
tags question: http://stackoverflow.com/q/21274977
tags question: http://stackoverflow.com/q/21206421
tags question: http://stackoverflow.com/q/21289631
tags question: http://stackoverflow.com/q/21299597
tags question: http://stackoverflow.com/q/21204273
tags question: http://stackoverflow.com/q/21226929
tags question: http://stackoverflow.com/q/21328802
tags question: http://stackoverflow.com/q/21336500
tags question: http://stackoverflow.com/q/21320178
tags question: http://stackoverflow.com/q/21306889
tags question: http://stackoverflow.com/q/21215338
tags question: http://stackoverflow.com/q/21341314
tags question: http://stackoverflow.com/q/21245111
tags question: http://stackoverflow.com/q/21281867
tags question: http://stackoverflow.com/q/21330079
tags question: http://stackoverflow.com/q/21232675
tags question: http://stackoverflow.com/q/21283867
tags question: http://stackoverflow.com/q/21313696
tags question: http://stackoverflow.com/q/21196574
tags question: http://stackoverflow.com/q/21316533
tags question: http://stackoverflow.com/q/21345779
tags question: http://stackoverflow.com/q/21202763
tags question: http://stackoverflow.com/q/21307642
tags question: http://stackoverflow.com/q/21278783
tags question: http://stackoverflow.com/q/21297261
tags question: http://stackoverflow.com/q/21190441
tags question: http://stackoverflow.com/q/21314023
tags question: http://stackoverflow.com/q/21206326
tags question: http://stackoverflow.com/q/21330803
tags question: http://stackoverflow.com/q/21281354
tags question: http://stackoverflow.com/q/21308946
tags question: http://stackoverflow.com/q/21227028
tags question: http://stackoverflow.com/q/21339570
tags question: http://stackoverflow.com/q/21241080
tags question: http://stackoverflow.com/q/21236398
tags question: http://stackoverflow.com/q/21304212
tags question: http://stackoverflow.com/q/21305705
tags question: http://stackoverflow.com/q/21216297
tags question: http://stackoverflow.com/q/21293045
tags question: http://stackoverflow.com/q/21252516
tags question: http://stackoverflow.com/q/21328955
tags question: http://stackoverflow.com/q/21263624
tags question: http://stackoverflow.com/q/21237220
tags question: http://stackoverflow.com/q/21217097
tags question: http://stackoverflow.com/q/21256855
tags question: http://stackoverflow.com/q/21285171
tags question: http://stackoverflow.com/q/21260743
tags question: http://stackoverflow.com/q/21281149
tags question: http://stackoverflow.com/q/21305990
tags question: http://stackoverflow.com/q/21195518
tags question: http://stackoverflow.com/q/21273305
tags question: http://stackoverflow.com/q/21295534
tags question: http://stackoverflow.com/q/21256728
tags question: http://stackoverflow.com/q/21338318
tags question: http://stackoverflow.com/q/21213399
tags question: http://stackoverflow.com/q/21259613
tags question: http://stackoverflow.com/q/21276434

http://stackoverflow.com/comment/32163648
comment on: http://stackoverflow.com/a/21327738
type: Comment
has text: i think it does not really matter
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32132529
score: 0
type: Comment
type: QuestionComment
has text: Not the same assignment, I'm not allowed to use arraylists. But I think I've got it guys. He didn't specify to make a constructor in the RandomPermutation class, but I think that it's the only way to make it work.
comment on: http://stackoverflow.com/q/21317848

http://stackoverflow.com/comment/31938939
type: Comment
type: AnswerComment
has text: What does the '>' character do in the (?>REF) group - Thanks
comment on: http://stackoverflow.com/a/21208422
score: 0

http://stackoverflow.com/q/21212992
has answer: http://stackoverflow.com/a/21213057
type: Question
possible better answer: http://stackoverflow.com/a/21213050
tagged with: java
has answer: http://stackoverflow.com/a/21213050
answer count: 2
downvote count: 0
tagged with: jsp
accepted answer: http://stackoverflow.com/a/21213057
score: 1
has title: How many languages can be used in the JSP
favorite count: 0
has body: All, Forgive me I am not familiar with JSP front-end languages, I already read some books of JSP. I knew I can write script of Java in JSP with &lt;%...%>. and also EL, JSTL, Custom Tag(Anything else ? Please correct me if there is wrong.) . And As a web page of HTML, We can always use Javascript or java script library like Jquery etc to access DOM or access back end with AJAX. But there always exist a question bother me. How many languages can be used in the JSP? I don't know if there are any more except the ones I mentioned above. I hope someone can help me figure out it. Thanks. Updated Thanks Stephen's kindly and valuable help to me, No matter what kinds of expressions or tag are used in JSP, They are different from the script that web browser directly can understand. They are understood by JAVA of the back-end web server like tomcat ,jboss etc. and will be compiled into a Servlet class before they are ready to work. And like any other web page like ASP,PHPetc. The class will generate html response to the web client request. :) If I didn't misunderstand your meaning . If possible , Anyone can build his owner language engine which host in the web server. So like what you said It is not possible to enumerate the languages that could be "used" in a JSP. . Right ? thanks.
type: AnsweredQuestion
upvote count: 1

http://stackoverflow.com/comment/32222581
comment on: http://stackoverflow.com/a/21297101
score: 0
type: Comment
has text: Check out getKeyStroke(int keyCode, int modifiers, boolean onKeyReleased)
type: AnswerComment

http://stackoverflow.com/q/21207360
tagged with: jakarta-ee
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21207719
score: 1
tagged with: java
tagged with: servlets
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has body: I've found this problem in a lot of posts but i can't find a solution. I've an authentication based on realm and with two roles mapped USERS and ADMINS. The log-in works normally but if i try to use FacesContext context = FacesContext.getCurrentInstance(); ExternalContext externalContext = context.getExternalContext(); if(externalContext.getRemoteUser() != null && externalContext.isUserInRole("USERS")){ return true; } isUserInRole always returns false even if i am logged-in. How can i fix this problem? this is the web.xml file <?xml version="1.0" encoding="UTF-8"?> TravelDreamWeb index.xhtml Faces Servlet javax.faces.webapp.FacesServlet 1 Faces Servlet /faces/* *.jsf *.xhtml FORM authJdbcRealm /index.xhtml /loginError.xhtml <web-resource-collection> Admins Pages <description /> /admins/* </web-resource-collection> ADMINS <web-resource-collection> Users Pages <description /> /users/* </web-resource-collection> USERS and this is the glassfish-application.xml <?xml version="1.0" encoding="UTF-8"?> USERS USERS ADMINS ADMINS authJdbcRealm
has answer: http://stackoverflow.com/a/21207719
tagged with: jsf
upvote count: 1
has title: javaee IsUserInRole always return false jsf

http://stackoverflow.com/q/21242732
score: 0
has body: Since the "amount" class is used for the item prices in the "we also recommend" section, it all the prices instead of just the main item price. How do I get it to stop looking for more prices after the first one? Here is my code: import org.jsoup.Jsoup; import org.jsoup.nodes.Document; public class BestBuy { //retrieves item name and price from Best Buy public static void main(String[] args) throws Exception { String url = "http://www.bestbuy.ca/en-CA/product/samsung-samsung-galaxy-tab-3- 8-0-16gb-android-4-2-tablet-with-exynos-4212-processor-white-sm-t310/10254746.aspx?path=8654a6d491c7d5a9465456671fa126e4en02"; Document document = Jsoup.connect(url).get(); String amount = document.select(".amount").text(); System.out.println("Price: " + amount); String name = document.select(".product-title").text(); System.out.println("Item Name: " + name); } } Thank you.
has title: I am attempting to retrieve item names and prices from Best Buy, how do I get it to stop after the first price?
possible better answer: http://stackoverflow.com/a/21242919
has answer: http://stackoverflow.com/a/21242919
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jsoup
answer count: 2
has answer: http://stackoverflow.com/a/21242899
accepted answer: http://stackoverflow.com/a/21242899

http://stackoverflow.com/comment/31922891
has text: `grade` is a local variable in the scope of your method `graderate`, you don't modify the field in your class.
score: 0
comment on: http://stackoverflow.com/q/21199359
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31938354
type: AnswerComment
has text: Thank you for your answer but that doesn't actually answers the question... The JEditorPane is intended to let users edit the text of an HTML file (per example) not only view it.
comment on: http://stackoverflow.com/a/21208241
score: 0
type: Comment

http://stackoverflow.com/q/21332098
upvote count: 1
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/21335281
type: Question
tagged with: optimistic-locking
answer count: 1
downvote count: 0
has title: Implementing Optimistic locking in Hibernate using @Version or LockMode.OPTIMISTIC or both
favorite count: 0
has body: I read that we can implement optimistic locking in hibernate using version field using @Version. Then on reading about pessimistic locking, I came to know that org.hibernate.LockMode class which has some options like LockMode.OPTIMISTIC etc which we can specify in session.load(). So my question is do I need to use LockMode.OPTIMISTIC also along with @Version?
type: UnansweredQuestion

http://stackoverflow.com/a/21376828
answers question: http://stackoverflow.com/q/21330465
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/21330465
has body: Actually the solve of this problem was a bit more tricky. First of all I manually had to configure the manifest file of the package on the IS server to use the jars provided in the package abnd thus it wouldn't get in conflict with the Axis used by the IS itself. On the other hand I had to manually add the ClassLoader because WebMethods can't use META-INF based information from jar files as it seems. To solve this problem simply use: System.setProperty("org.apache.axiom.om.OMMetaFactory", "org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory"); That solves all the problems.

http://stackoverflow.com/a/21208057
accepted answer of: http://stackoverflow.com/q/21207977
has comment: http://stackoverflow.com/comment/31953344
upvote count: 2
answers question: http://stackoverflow.com/q/21207977
has comment: http://stackoverflow.com/comment/31940970
has comment: http://stackoverflow.com/comment/31942715
has body: The simplest way to do this is to wrap the SQL into one statement and let the SQL server handle it, I can't remember the exact syntax off hand but it would be something like: conn.execute("update foo set value = (select value from foo where id = 123)+1 where id = 123"); The SQL server will lock the row being used (and if using multiple rows will lock them all) and perform the operation atomically. This will also be faster/more efficient as it only makes the single database call instead of two. This sort of update could really do with being wrapped into a stored procedure though.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31953951
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31938196
downvote count: 0
has comment: http://stackoverflow.com/comment/31938807
has comment: http://stackoverflow.com/comment/32011472

http://stackoverflow.com/comment/32120148
score: 1
has text: We don't have the information we need to answer this. Show us your `@Controller`, the field the date is supposed to be mapped on, the value the ` ` field has, and what you expect to happen.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21308494

http://stackoverflow.com/comment/31918048
type: QuestionComment
has text: Not sure how you caught that Gus, but nice one!
comment on: http://stackoverflow.com/q/21196653
score: 0
type: Comment

http://stackoverflow.com/q/21278547
tagged with: weblogic
has answer: http://stackoverflow.com/a/21278741
answer count: 2
has title: JRE 7 update 51 breaks java swing application; get error: access denied ("java.io.SerializablePermission" "enableSubclassImplementation")
possible better answer: http://stackoverflow.com/a/21278741
accepted answer: http://stackoverflow.com/a/21609305
downvote count: 0
favorite count: 0
type: AnsweredQuestion
has body: After installing JRE 7 update 51, our java swing applications doesn't work. We have added the now required manifest attributes, so the application updates fine through java web start, and starts up, but it fails right after the log on process with the exception: [CORBA MARSHAL 1398079699 Maybe; nested exception is: org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 211 completed: Maybe] Caused by: access denied ("java.io.SerializablePermission" "enableSubclassImplementation") If we use JRE 7 update 45 (or earlier versions) this error doesn't occur. We're using Weblogic 9.2.3 as application server. Any suggestions for solving this? Edit: The jar files are signed with VeriSign Class 3 Code Signing
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21609305
type: Question

http://stackoverflow.com/comment/32177695
has text: I'd suggest checking out Collections.sort: http://docs.oracle.com/javase/6/docs/api/java/util/Collections.html#sort(java.util.List) You can pass in your own Comparator if you need to look specifically at `words[3]` after a split.
score: 0
comment on: http://stackoverflow.com/q/21342903
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31980550
type: Comment
has text: @AymanElmubark post the stacktrace and use interface as a callback to the activity
comment on: http://stackoverflow.com/q/21231601
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32034535
has text: Perhaps, but it doesn't connect Eclipse's Java debugger to it.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21262292

http://stackoverflow.com/q/21200425
type: Question
has answer: http://stackoverflow.com/a/30766359
has title: Null pointer Exception in JmsTemplate?
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31936922
has comment: http://stackoverflow.com/comment/31955226
tagged with: spring-jms
tagged with: jms
has comment: http://stackoverflow.com/comment/31971345
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31984817
has body: I have try to run simple spring jmstemplate example.Here goes for source code for sender, import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.Session; import javax.jms.TextMessage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jms.core.JmsTemplate; import org.springframework.jms.core.MessageCreator; public class MessageSender { @Autowired private JmsTemplate jmsTemplate; public void setJmsTemplate(JmsTemplate jmsTemplate) { this.jmsTemplate = jmsTemplate; } public void sendMessage() { jmsTemplate.send(new MessageCreator() { public Message createMessage(Session session) { TextMessage message = null; try { message = session.createTextMessage(); message.setStringProperty("text", "Hello World"); } catch (JMSException e) { e.printStackTrace(); } return message; } }); } } Here is config file for integrating spring with jmstemplate. <?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:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> <context:component-scan base-package="com.test"/> <aop:aspectj-autoproxy /> jnp://localhos…
tagged with: spring
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/q/21294146
has answer: http://stackoverflow.com/a/21295807
upvote count: 2
has comment: http://stackoverflow.com/comment/32092875
has comment: http://stackoverflow.com/comment/32091528
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32091485
accepted answer: http://stackoverflow.com/a/21295807
type: Question
tagged with: jakarta-mail
has body: Please help to reslove the below exception: DEBUG SMTP RCVD: 250 2.1.0 Sender OK DEBUG SMTP SENT: RCPT TO:&lt;XXXX@gmail.com&gt; DEBUG SMTP RCVD: 550 5.7.1 Unable to relay Invalid Addresses XXX@gmail.com DEBUG SMTPTransport: Sending failed because of invalid destination addresses DEBUG SMTP SENT: RSET DEBUG SMTP RCVD: 250 2.0.0 Resetting DEBUG SMTP SENT: QUIT Exception in thread "main" javax.mail.SendFailedException: Invalid Addresses; nested exception is: class javax.mail.SendFailedException: 550 5.7.1 Unable to relay at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:804) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:320) at javax.mail.Transport.send0(Transport.java:151) at javax.mail.Transport.send(Transport.java:80) at StatsEmail.sendEmail(StatsEmail.java:95) at Statements.main(Statements.java:73) SRC/ String host = "XXXXX"; String from = "XXXX"; java.util.Properties props = new java.util.Properties(); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", host); props.put("mail.debug", "true"); props.put("mail.smtp.port","25"); props.put("mail.smtp.debug", "true"); String[] to = {"XXXX@gmail.com"}; javax.mail.Session session = Session.getDefaultInstance(props, null); javax.mail.internet.MimeMessage message = new javax.mail.internet.MimeMessage(session); message.setFrom(new InternetAddress(from)); javax.mail.internet.InternetAddress[] toAddress = new javax.mail.internet.InternetAddress[to.length]; for(int i =0; i&lt; to.length; i++ ){ toAddress[i] = new InternetAddress(to[i]); } for(int i=0; i&lt;toAddress.length;i++){ message.addRecipient(Message.RecipientType.TO, toAddress[i]); } message.setSubject("TestMail"); message.setText("TestJavaMail"); Transport.send(message); System.out.println("Send Successful");
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32091732
favorite count: 0
score: 2
has title: javax.mail.SendFailedException

http://stackoverflow.com/a/21277260
has comment: http://stackoverflow.com/comment/32060651
has comment: http://stackoverflow.com/comment/32060597
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32061581
type: Answer
score: 11
has comment: http://stackoverflow.com/comment/32061546
accepted answer of: http://stackoverflow.com/q/21276775
answers question: http://stackoverflow.com/q/21276775
downvote count: 1
has comment: http://stackoverflow.com/comment/32060699
upvote count: 12
has body: Reading the Documentation for ChannelSftp it would appear you can just lstat the directory: SftpATTRS attrs = channelSftp.lstat(path); If that throws an exception, it doesn't exist. You can then use channelSftp.mkdir(path) to create it.

http://stackoverflow.com/q/21345122
tagged with: java
has comment: http://stackoverflow.com/comment/32181598
tagged with: android-fragmentactivity
type: Question
has title: StartFragment cannot be resolved to a type android error
score: 0
tagged with: android
has body: I have just started android programming and still figuring out how fragments and activity works. So I am trying some codes but I am getting the error "StartFragment cannot be resolved to a type" Here is my code import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; public class MainActivity extends FragmentActivity { Fragment fragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); FragmentManager fm = getSupportFragmentManager(); FragmentTransaction transaction = fm.beginTransaction(); //StartFragment cannot be resolved to a type StartFragment myfragment = new StartFragment(); transaction.add(R.id.namefrag, myfragment); transaction.add(R.id.view_fragment,myfragment); transaction.add(R.id.load, myfragment); transaction.add(R.id.store,myfragment); } }
has comment: http://stackoverflow.com/comment/32181499
answer count: 0
type: UnansweredQuestion
tagged with: android-fragments

http://stackoverflow.com/a/21184945
score: -1
type: Answer
answers question: http://stackoverflow.com/q/21184695
has body: Its part of Documentation. Usually everybody like to write Code in two phases before commit: Implementation Documentation By example (phase 1): ObjectOutputStream oos = ... List a : ob.getSOE(); for(Object a: b){ oos.writeObject(a); } Then phase 2: ObjectOutputStream stackOverflowElementOuputStream = ... List stackOverflowElements : ob.getStackOverflowElement(); for(Object currentStackOverflowElement: stackOverflowElements){ stackOverflowElementOuputStream.writeObject(currentStackOverflowElement); }
downvote count: 1
has comment: http://stackoverflow.com/comment/31896229
upvote count: 0

http://stackoverflow.com/comment/32159429
type: Comment
comment on: http://stackoverflow.com/a/21310309
has text: Thank you for the advice but I am still having some problems as updated in my question above.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31962945
type: Comment
has text: Tracing recursive methods can be challenging, so it's important that you keep track of what's going on in memory on paper step by step. Start with small values, and work your way up. Check your work by running the program.
score: 5
type: QuestionComment
comment on: http://stackoverflow.com/q/21221858

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/21247137
tags question: http://stackoverflow.com/q/21330113
tags question: http://stackoverflow.com/q/21240816
type: Tag
tags question: http://stackoverflow.com/q/21272230

http://stackoverflow.com/a/21327722
answers question: http://stackoverflow.com/q/21310366
score: 0
has body: I changed config intellij's config dirs in 'idea.properties' and found the 'idea' log file. The dependency problem went away as soon as I changed config dirs, no explanation, except that i didn't realize intellij was throwing errors until I ran 'idea.bat' at the command line. So - 1/ run from command line 2/ look into idea log file for unexplained problems
type: Answer

http://stackoverflow.com/comment/32031360
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21258753
has text: Looks like delay cannot be <= 0, but you could try a really high value. Otherwise, throwing an Exception (which you handle somehow) might also stop the route.
score: 0

http://stackoverflow.com/a/21247021
downvote count: 0
has comment: http://stackoverflow.com/comment/32008762
type: Answer
score: 4
has body: Sometimes it just gets into a mess. Close your ide then Go to processes and terminate all adb processes. Then when you open up android studio it should kick off adb again fresh (or you could run something like 'adb devices' from command prompt before opening the ide if you're worried it gets in to a bad state while the ide is waiting for it to initialize) If none of that works you could also reboot your device. I've very rarely found it necessary, but it has helped me in the past
answers question: http://stackoverflow.com/q/21246983
upvote count: 4

http://stackoverflow.com/comment/31911115
comment on: http://stackoverflow.com/a/21192752
has text: @waplet: there is no problem, player count is not take effect in UI, it's just data. Here is algorithm for your case: first, you get the current number by tt.getText().toString(), then convert it to int by Integer.parseInt(String str), incrase it, then tt.setText(String.valueof(Int int)). *Hint: if you use eclipse, type Ctrl+space for suggestion about code. Gluck!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32032144
type: Comment
has text: Okay, this leads me to ask whether we can get information such as font size, name, color etc for the text in the pdf using Tika?
comment on: http://stackoverflow.com/a/21253844
type: AnswerComment
score: 0

http://stackoverflow.com/a/21204370
has body: I suggest you spend another month to learn what is a MVC and how works an EventBus. There are a lot of tutorial about this. You should also spend another month to really care how works a database and what are their main differences because it will change the way you write all the other parts. To answer your question, you should not modify in the same method the view, the model, and then save stuff in the database. If you still want to do that, the best way is to use a JDO database such as http://db.apache.org/jdo/ or Google App Engine. But the way to do this can't be answered here, it's probably a too complex task.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21204266
upvote count: 1

http://stackoverflow.com/q/21187973
type: AnsweredQuestion
tagged with: ruby
type: Question
has body: For local environment I am using an improved version of fakes3 (some ruby implementation). In java I have this code: private final AmazonS3Client client; private final S3Configuration configuration; private final ObjectMapper objectMapper = new ObjectMapper(); // code code... final byte[] bytes = objectMapper.writeValueAsBytes(object); final InputStream input = new ByteArrayInputStream(bytes); final ObjectMetadata metadata = createJsonMetadata(); metadata.setContentLength(bytes.length); client.putObject(getBucket(), key, input, metadata); What I am trying to do is to use this fakes3 (and it works) but the method putObject looks like it takes 3 seconds to execute and it's really annoying for our development environment. How can I fix this?
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21386010
tagged with: amazon-s3
has title: Java amazon s3 with FakeS3 slow on putObject
tagged with: java
tagged with: amazon-web-services
has answer: http://stackoverflow.com/a/21386010

http://stackoverflow.com/q/21319824
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21319970
has body: Do you know any easy way to find out how many characters will be printed out by System.out.printf(&lt;&lt;some arguments here&gt;&gt;). In c++ printf returns the total number of characters written (on success). In java, when we type: System.out.println(System.out.printf(&lt;&lt;formula to check&gt;&gt;)); we will get sth like this: java.io.PrintStream@700dce12
has comment: http://stackoverflow.com/comment/32135979
upvote count: 3
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/32136087
tagged with: java
type: Question
has title: easy way to find out how many characters will be printed out (in general) by System.out.printf
has answer: http://stackoverflow.com/a/21319970
downvote count: 0

http://stackoverflow.com/a/21262169
has body: Use a Map&lt;String, Integer&gt; songToIndexMap to store the index of each song. Then just do: Integer index = songToIndexMap.remove(titleArtistInput.getText()); if(index != null) { // the song has been found! song.remove(index); } Binary search is O(log n) while remove/getin a HashMap is O(1).
answers question: http://stackoverflow.com/q/21262043
score: 4
upvote count: 4
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32033992

http://stackoverflow.com/q/21243700
type: Question
tagged with: android-gridview
downvote count: 0
score: 1
has title: Implementing endless scroll for grid view images in android app
favorite count: 0
tagged with: lazy-loading
type: UnansweredQuestion
tagged with: android
answer count: 0
tagged with: java
upvote count: 1
has body: I am building a google image searcher app which returns results in a grid view. I want to implement the endless scrolling mechanism to load images asynchronously. I have created a new class for EndlessScrolling. I am not able to figure out the logic to use for the onLoadMore method and customLoadMoreDataFromApi. I am posting both my main activity and the EndlessScrolling class which I have created. SearchActivity.java package com.example.gridimagesearch; import java.util.ArrayList; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView; import android.widget.Button; import android.widget.EditText; import android.widget.GridView; import android.widget.Toast; import com.loopj.android.http.AsyncHttpClient; import com.loopj.android.http.JsonHttpResponseHandler; public class SearchActivity extends Activity { EditText etQuery; GridView gvResults; Button btnSearch; ArrayList&lt;ImageResults&gt; imageResults= new ArrayList&lt;ImageResults&gt;(); ImageResultsArrayAdapter imageAdapter; private final int REQUEST_CODE=20; String imageSize; String colorFilter; String imageType; String siteFilter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); setViews(); imageAdapter= new ImageResultsArrayAdapter (this, imageResults); gvResults.setAdapter(imageAdapter); gvResults.setOnScrollListener(new EndlessScrollListener() { @Override public void onLoadMore(int page, int totalItemsCount) { // Triggered only when new data needs to be appended to the list // Add whatever code is needed to append new items to your Ad…

http://stackoverflow.com/a/21222451
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21222398
has body: Because contains(Object o); will look for the object in the list, for that to return true you would need to add the list itself, which would not make much sense. If you instead use list1.contains(obj1); you will get true, of course, since that actual object exists in the list. You can use containsAll(Collection&lt;?&gt; c); which will take a list and check if all elements in the supplied list exists within the list being invoked upon.
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/21199220
has comment: http://stackoverflow.com/comment/31922662
has body: So bCount is determining the number of digits that are in the answer, but not in the right place. So let's try this: public string bCount() { for (int indexOfGuess = 0; indexOfGuess &lt; answer.length(); indexOfGuess++) { for (int indexOfActualNumber = 0; indexOfActualNumber &lt; answer.length(); indexOfActualNumber++) { if (guess.charAt(indexOfGuess).equals(answer.charAt(indexOfActualNumber)) { bCount++; } } } } This method does: Creates an outer loop that loops through each index of the "guess" array Creates an inner loop that, while the "guess" array is at an index, the inner loop will loop through each index (so while "guess" is at index 0, "answer" will go through all indexes before "guess" goes to 1, and then the inner loop runs again) Check to see if the number at the guess index = number at the actual index. If it is, increment bCount. The only issue which I haven't taken care of for you is if the number is entered twice. Example: if the number is 1900, and you guess 1909, you number for bCount will be higher than it should be. However, I'll leave that to you as this is a homework assignment after all.
has comment: http://stackoverflow.com/comment/31922872
has comment: http://stackoverflow.com/comment/31922839
has comment: http://stackoverflow.com/comment/31922695
has comment: http://stackoverflow.com/comment/31922656
type: Answer
has comment: http://stackoverflow.com/comment/31922843
has comment: http://stackoverflow.com/comment/31922773
downvote count: 2
accepted answer of: http://stackoverflow.com/q/21199138
has comment: http://stackoverflow.com/comment/31922788
has comment: http://stackoverflow.com/comment/31922828
answers question: http://stackoverflow.com/q/21199138
has comment: http://stackoverflow.com/comment/31922670
score: -2
has comment: http://stackoverflow.com/comment/31922666
has comment: http://stackoverflow.com/comment/31922713
has comment: http://stackoverflow.com/comment/31922705
has comment: http://stackoverflow.com/comment/31922690
has comment: http://stackoverflow.com/comment/31922696
upvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/q/21267297
accepted answer: http://stackoverflow.com/a/21267332
favorite count: 0
has body: Is there a way to read a certain number of bytes from a RandomAccessFile in Java?
has answer: http://stackoverflow.com/a/21267332
type: AnsweredQuestion
upvote count: 0
tagged with: java
has title: Read x number of bytes from a RandomAccessFile
type: Question
has comment: http://stackoverflow.com/comment/32044367
score: -1
tagged with: randomaccessfile
answer count: 1
downvote count: 1

http://stackoverflow.com/a/21334090
has comment: http://stackoverflow.com/comment/98768823
has comment: http://stackoverflow.com/comment/89125402
upvote count: 56
accepted answer of: http://stackoverflow.com/q/21333646
answers question: http://stackoverflow.com/q/21333646
type: AcceptedAnswer
downvote count: 0
has body: You need to also override the hashCode method in class C. For example: @Override public int hashCode() { return n.hashCode(); } When two C objects are equal, their hashCode methods must return the same value. The API documentation for interface Stream does not mention this, but it's well-known that if you override equals, you should also override hashCode. The API documentation for Object.equals() mentions this: Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes. Apparently, Stream.distinct() indeed uses the hash code of the objects, because when you implement it like I showed above, you get the expected result: 2.
type: Answer
score: 56

http://stackoverflow.com/comment/31926622
has text: thanks this works correctly . but i want to use one list instead of two lists (ie one for string and other for timestamp) .
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21201484

http://stackoverflow.com/comment/31944553
type: QuestionComment
has text: Same message, Could not find or load main class P
score: 0
comment on: http://stackoverflow.com/q/21211391
type: Comment

http://stackoverflow.com/comment/31959280
type: Comment
has text: I also see `The sorting algorithm is a modified mergesort (in which the merge is omitted if the highest element in the low sublist is less than the lowest element in the high sublist). This algorithm offers guaranteed n*log(n) performance.` Seems like the algorithm depends on what you are sorting...
comment on: http://stackoverflow.com/a/21219858
score: 1
type: AnswerComment

http://stackoverflow.com/comment/31957463
type: Comment
score: 1
has text: I know about Data datatype in MySQL but how can I send value from Java, Sorry If I was not clear enough but I want to know how can I get current Date from Java to store in (Date)MySQL
type: AnswerComment
comment on: http://stackoverflow.com/a/21218956

http://stackoverflow.com/comment/32006240
comment on: http://stackoverflow.com/q/21245449
has text: You state, `"yes the object is in an ArrayList which luckily is public and static so the problem is solved."` -- no this is very bad, both your use of public and static modifiers. Please see edit to my answer.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43297184
has text: @Will getting the info for a Mac is useful, if one needs something that will work on all platforms, you need code for each supported platform.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26693894

http://stackoverflow.com/a/21253914
has comment: http://stackoverflow.com/comment/32019093
has comment: http://stackoverflow.com/comment/32019410
has body: I will describe a possible solution. There should be several way to achieve it. Put your config file next to your jar. Put explicitly the config file in your classpath while invoking java (e.g. java -cp .../Gyroscope.jar;.../Gyroscope.properties &lt;your_main_class&gt;). Now you can access your properties file as a ressource (ClassLoader.getSystemResourceAsStream("/Gyroscope.properties"). Use whatever classloader you want as soon as it is convenient and cleam for your actual implementation. Once your have an inputstream, you can load your properties into a Properties object as usual. Hope this will help.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32019692
has comment: http://stackoverflow.com/comment/32019786
has comment: http://stackoverflow.com/comment/32019503
type: Answer
has comment: http://stackoverflow.com/comment/32020067
has comment: http://stackoverflow.com/comment/32020306
upvote count: 1
answers question: http://stackoverflow.com/q/21253667

http://stackoverflow.com/q/21189361
has title: Joshua Bloch builder pattern - a good idea when concerned about thread safety?
answer count: 3
tagged with: user-interface
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/21189493
has answer: http://stackoverflow.com/a/21189493
has body: I am considering using the builder pattern described by Joshua Bloch mentioned here. I have a class which displays an Alert message and will be used by numerous applications. It can have a large number of varied options like, line1, btn txt, title, line2, timeout etc. I like the idea of chaining the object construction with setters, but really all the app has to do after the construction is to display this alert. Since the object created is immutable, they will have to create multiple ones for different scenarios. All calls to display these alerts are asynchronous. Is this pattern a good idea or is better to just have static methods in the class, keep it stateless and take all the parameters in the method itself.
has comment: http://stackoverflow.com/comment/31906938
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/31904369
type: AnsweredQuestion
score: 3
tagged with: builder
has comment: http://stackoverflow.com/comment/53919870
has answer: http://stackoverflow.com/a/21190064
upvote count: 3
tagged with: java
tagged with: thread-safety
type: Question
accepted answer: http://stackoverflow.com/a/21190064
has answer: http://stackoverflow.com/a/21189507

http://stackoverflow.com/q/21317005
answer count: 3
accepted answer: http://stackoverflow.com/a/21317099
has answer: http://stackoverflow.com/a/21317031
score: 2
tagged with: compiler-errors
tagged with: constructor
upvote count: 2
possible better answer: http://stackoverflow.com/a/21317031
has answer: http://stackoverflow.com/a/21317049
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21317099
type: Question
downvote count: 0
has body: I am trying to practice just writing a simple application with basic java concepts to reinforce these in my mind and I am getting an error that I can't seem to figure out. I'm sure this is some stupid oversight on my part, or perhaps something I don't know yet as I am learning. Any help at all would be greatly appreciated! This is the message I get when trying to compile this code below: error: constructor Dice in class Dice cannot be applied to given types; Dice di = new Dice(); ^ required: int,int found: no arguments reason: actual and formal argument lists differ in length 3 errors //import statements import java.util.Arrays; import java.util.Scanner; import java.util.Random; class Dice {//Begin Dice Class //initiate constructor for "Random" class Random r = new Random(); //declare Dice class variables int p1d6 = r.nextInt(6-0) + 1; int p2d6 = r.nextInt(6-0) + 1; //initiate class constructors public Dice (int p1d6, int p2d6) { this.p1d6 = p1d6; this.p2d6 = p2d6; } //create set and get methods for class variables public void setP1d6(int p1d6) { this.p1d6 = p1d6; } public int getP1d6() { return p1d6; } public void setP2d6(int p2d6) { this.p2d6 = p2d6; } public int getP2d6() { return p2d6; } //toString method that outputs the class variables //public String toString () //{ // return "P1D6: " + p1d6 + "\n" + "P2D6: " + p2d6 + "\n"; //} }// End Dice Class public class DiceGame2 { public static void main( String ars[] ) { //initiate constructor for Dice class Dice di = new Dice(); System.out.println( "--- Welcome to the Dice Game v2! ---" ); // welcomes player System.out.println("P1D6: " + di.getP1d6() + "\n"); System.out.println("P2D6: " + di.getP2d6() + "\n"); System.out.println("P1D6: " + di.getP1d6() + "\n"); System.out.println("P2D6: " + di.getP2d6() + "\n"); System.out.println("P1D6: " + di.getP1d6() + "\n"); System.out.println("P2D6: " + di.getP2d6() + "\n"); } }
favorite count: 0
has title: Java Beginner, Class Constructor error, no arguments found

http://stackoverflow.com/q/21212646
possible better answer: http://stackoverflow.com/a/21212660
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Which Exception class to use?
has body: I have written a music player in Java, but I have a problem with finding an exception to throw. Basically, what I want the exception handler to throw is if a filename of a song stored in the playlist is altered or if the file is deleted, as naturally, in that case it won't play. I first thought it was an IOException I would need, but it gave me the error saying exception IOException is never thrown in body of corresponding try statement Now, I understand that that means that I'm working with the wrong Exception class, and so I tried to write my own that extends Exception, but it gives me the same error when I try to compile. Can anyone see what I'm doing wrong? This is the method as it is right now: public void play() throws NoMatchException { if(player != null) { player.stop(); } try{ int fileToPlay = tracklist.getSelectedIndex(); String filename = organizer.getFile(fileToPlay); Media song = new Media(filename); player = new MediaPlayer(song); setVolume(currentVolume); player.play(); player.setOnEndOfMedia(new Runnable() { @Override public void run() { next(); } }); } catch (NoMatchException e){ //Some exception } }
accepted answer: http://stackoverflow.com/a/21212684
answer count: 2
downvote count: 0
favorite count: 0
tagged with: exception
has answer: http://stackoverflow.com/a/21212660
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21212684

http://stackoverflow.com/comment/32191505
score: 0
type: Comment
has text: i am creating an android application which has got two parts a client part and a server part. So the client will be asking the serveer for a particular data and server need to give it back to the client. My question is how i can run this server program (jar file ) in a web server. I have tested it locally using eclipse but i need to know how i can put this into a web server and run it there. So that the client can use a data connection and connect to the server program and get back the respose from there Sorry for the inconvenience caused and a thank you in advance
type: QuestionComment
comment on: http://stackoverflow.com/q/21347005

http://stackoverflow.com/comment/62105416
type: Comment
comment on: http://stackoverflow.com/a/35018156
score: 1
type: AnswerComment
has text: I know we aren't supposed to use this area for this but 'ballsack' had me rolling. Thanks for this hidden gem.

http://stackoverflow.com/comment/31954962
has text: I suggest you learn a bit more about Java and flow control https://thenewcircle.com/bookshelf/java_fundamentals_tutorial/flow_control.html
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21217290

http://stackoverflow.com/comment/32170262
type: Comment
score: 0
has text: OP, please show us what you have so far, and please change your question to have a correct definition of a saddle point and i'm sure people will try to help you out.
type: QuestionComment
comment on: http://stackoverflow.com/q/21338735

http://stackoverflow.com/comment/32004835
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21244978
score: 2
has text: @user3216679 - It seems to me that you are making many quite elementary mistakes, and asking some very basic questions. I don't mean to sound patronising, but my honest opinion is that you should start with an easier project than this one, and return to this project once you have mastered more of the basics of Java.

http://stackoverflow.com/comment/31927691
has text: i don't get this. I have download from FB oficial site. why mine doesn't work?
comment on: http://stackoverflow.com/q/21202121
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21201728
downvote count: 3
has comment: http://stackoverflow.com/comment/31927034
type: AnsweredQuestion
tagged with: syntax
possible better answer: http://stackoverflow.com/a/21201775
linked to: http://stackoverflow.com/q/283816
has comment: http://stackoverflow.com/comment/31941087
has answer: http://stackoverflow.com/a/21201775
has body: reifnsk/minimap/ReiMinimap.java:68: error: '.' expected import ro; ^ reifnsk/minimap/ReiMinimap.java:68: error: ';' expected import ro; ^ reifnsk/minimap/ReiMinimap.java:69: error: class, interface, or enum expected import sb; ^ I get one of these for most of my import statements, yet its all syntactically good. Full error: http://bit.ly/1eZ5l0h Files snapshot: http://bit.ly/1eSXMdE File is more or less closed source, but most of the problems are just with import statements and switch statements.
type: Question
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/21201779
has comment: http://stackoverflow.com/comment/36386418
has title: Java compiler complains about perfectly valid syntax
answer count: 3
has comment: http://stackoverflow.com/comment/31926978
upvote count: 1
has comment: http://stackoverflow.com/comment/31926896
favorite count: 0
has answer: http://stackoverflow.com/a/21201798
accepted answer: http://stackoverflow.com/a/21201798

http://stackoverflow.com/comment/31934046
type: QuestionComment
has text: For starters, better use a `JFormattedTextField` with a `NumberFormat`. I don't know off the top of the head how to limit the range though...
score: 0
comment on: http://stackoverflow.com/q/21205947
type: Comment

http://stackoverflow.com/a/21185359
type: Answer
accepted answer of: http://stackoverflow.com/q/21185312
downvote count: 0
score: 1
has body: I have to to produce a cycle on the list domainStr minus unavailable. If I understood correctly, I think you are looking for the removeAll method : Removes from this list all of its elements that are contained in the specified collection (optional operation). domainsStr.removeAll(result.getUnavailable()); for (String domain : domainsStr) { } If you want to let domainsStr unchanged, you can create a temporary list and perfom these operations on it.
answers question: http://stackoverflow.com/q/21185312
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/44498609
downvote count: 0
score: 20
has body: Autowire the Environment object in your class. Then you will be able to access the properties using environment.getProperty(propertyName); @Autowired private Environment environment; // access it as below wherever required. environment.getProperty(propertyName); Also add @PropertySource on Config class. @Configuration @PropertySource("classpath:some.properties") public class ApplicationConfiguration
has comment: http://stackoverflow.com/comment/82805465
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/82784740
upvote count: 20
accepted answer of: http://stackoverflow.com/q/21276701
type: Answer
has comment: http://stackoverflow.com/comment/114819643
answers question: http://stackoverflow.com/q/21276701

activity-finish
tags question: http://stackoverflow.com/q/21275956
type: Tag
tag name: activity-finish

http://stackoverflow.com/comment/31985458
has text: Basically, Java has little or nothing to do with the resolution of `currentTimeMillis` and `nanoTime`---they are more or less transparently propagated from the corresponding OS calls. That is why there are no substantial guarantees for them.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21234199
type: Comment

http://stackoverflow.com/q/21295832
score: 0
has title: GUI temperature converter
tagged with: user-interface
answer count: 1
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/32112460
tagged with: java
has body: So I have to make this GUI program that will convert temperatures (celsius, fahrenheit, and kelvin) all at the same time. problem is every time I run the program it won't let me edit the JTextFields. I think the problem is somewhere here in the Jlabels and actionListener: //create and initialize JLabels here Celsius = new JTextField("0", 5); Fahrenheit = new JTextField("32", 4); Kelvin = new JTextField("273.15", 5); JLabel celLabel = new JLabel("Celsius:"); JLabel fahLabel = new JLabel("Fahrenheit:"); JLabel kelLabel = new JLabel("Kelvin:"); EventHandler listener = new EventHandler(); Celsius.addActionListener(listener); Fahrenheit.addActionListener(listener); Kelvin.addActionListener(listener); Here is my complete code if it helps: public class M4L1T1 { static JTextField celInput = new JTextField("0"); static JTextField Fahrenheit, Celsius, Kelvin; private static class EventHandler implements ActionListener { /** * this method gets called when an object we are listening to is interacted with * * @param evt ActionEvent that interacted with */ public void actionPerformed(ActionEvent evt) { //creates the formating we would like for the numbers DecimalFormat df = new DecimalFormat("#.##"); //if the event triggered was celInput than if (evt.getSource() == celInput) { try { //get the input from the JTextField String num = Celsius.getText(); //convert the String to a number double number = Double.parseDouble(num); //set the JTextFields to the formated number of the converted temps String fNum = df.format(convertCtoF(number)); String kNum = df.format(convertCtoK(number)); Fahrenheit.setText(fNum); Kelvin.setText(kNum); } catch (NumberFormatException e) { //this happens if Java CANNOT convert the String to a number celInput.setText("Illegal data"); } } else if (evt.getSource() == celInput) { try { //get the input from the JTextField String num = Fahrenheit.getText(); //convert the String to a number double number = Double.parseDouble(num); //set the JTextFields to the forma…
tagged with: jtextfield
type: Question
tagged with: actionlistener
has answer: http://stackoverflow.com/a/21302272

http://stackoverflow.com/a/21186410
upvote count: 1
has body: Your first class -main UI- should implement the action listener. At some initialization point in your second class you have to register the main class as the action listener for the buttons. All your components have a method called addActionListener(), use this method an pass the first class as parameter. public class Main implements ActionListener() { public Main() { new Class2(this); } public actionPerformed(Event e) {....} } public Class2 { ActionListener a; public Class2(ActionListener a) { this.a = a; ... ... button1.addActionListener(a); button2.addActionListener(a); } }
accepted answer of: http://stackoverflow.com/q/21186265
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/31898818
answers question: http://stackoverflow.com/q/21186265

http://stackoverflow.com/comment/32136061
type: Comment
has text: Try again. His package name is "tp". It's also likely that he does not have the correct folder structure in place.
type: AnswerComment
comment on: http://stackoverflow.com/a/21319895
score: 0

http://stackoverflow.com/comment/64489404
has text: @brian http://stackoverflow.com/questions/38545939/customize-javafx-menubar-to-remove-margin Here I asked. I want menu items same as Firefox have.
comment on: http://stackoverflow.com/a/21209628
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21191021
favorite count: 0
has answer: http://stackoverflow.com/a/22360704
accepted answer: http://stackoverflow.com/a/22360704
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: jakarta-ee
has title: How to Do Java EE Container Security With MongoDB on Tomcat
tagged with: security
tagged with: mongodb
upvote count: 1
has body: I have used file realm and JDBC realm before to host the username and password combinations. I have not yet used MongoDB to perform the same function. I have read the Tomcat docs and searched around but have not seen any tutorials. Is there a realm someone knows of or am I missing something?
answer count: 1
tagged with: tomcat

http://stackoverflow.com/comment/31998833
comment on: http://stackoverflow.com/a/21241925
type: AnswerComment
score: 0
type: Comment
has text: I've done the revision of the code, but the exception comes when i try to populate the jtable in the method poptab.

http://stackoverflow.com/comment/32026735
comment on: http://stackoverflow.com/q/21258058
score: 0
type: Comment
type: QuestionComment
has text: Also, what exactly is `MyUIPanel`? I Don't see one anywhere

http://stackoverflow.com/q/21216487
score: 0
answer count: 1
tagged with: tomcat
has body: After moving my web project from Tomcat / directory to subfolder /WebApp I get an error GET http://localhost:8080/partials/view-worker-apps-used.html 404 (Not Found) This is my project structure: - WebApp - partials - view-worker-details.html - view-worker-apps-used.html - js - controlers.js - services.js - index.html First I load http://localhost:8080/WebApp/#/screen2 which is view-worker-details.html injected into index.html by $routeProvider In loaded view-worker-details.html screen there is &lt;div ng-include="/partials/view-worker-apps-used.html"&gt;&lt;/div&gt; I prefer to not put WebApp prefix into path of ng-include. How I can fix this problem?
tagged with: angularjs
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31976639
tagged with: http-status-code-404
tagged with: java
has comment: http://stackoverflow.com/comment/31960927
type: Question
has title: Web Server AngularJs GET 404 not found
has answer: http://stackoverflow.com/a/21219446
tagged with: webserver

http://stackoverflow.com/comment/32230832
type: Comment
has text: Are you working on Sample App which contains in Facebook's SDK, or a new app by yourself? They need different hashes. Check the document here. https://developers.facebook.com/docs/android/getting-started
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21248945

http://stackoverflow.com/comment/32119998
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21307910
has text: That might be a good way to fix it. I'll have a look. Thanks.

http://stackoverflow.com/q/21347875
linked to: http://stackoverflow.com/q/16615140
favorite count: 0
type: Question
duplicate of: http://stackoverflow.com/q/16615140
score: 4
answer count: 1
downvote count: 1
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/21348253
has title: Is a read to a volatile field happens before every subsequent write?
tagged with: volatile
type: UnansweredQuestion
has body: Java Concurrency in Practice says (in JMM chapter) Volatile variable rule: a write to a volatile field happens before every subsequent read of that same field My question is : A read to a volatile field happens before any/every subsequent write on that same field ??

http://stackoverflow.com/q/21309444
tagged with: geometry
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32117067
answer count: 0
has comment: http://stackoverflow.com/comment/32117034
tagged with: angle
has comment: http://stackoverflow.com/comment/32117197
tagged with: java
type: Question
tagged with: 2d
has body: I have read how to calculate the triangle with 3 points and its angles. The problem is, I have tried different approaches and still get strange results. That can only mean I am doing something simple terribly wrong. But I am too much into my programming to see it; maybe anyone of you can help me? I have 3 points: u, v and w u---------------v w is under u and v. I now want to get the angle in ° at w, which spans the triangle to u and v. The coordinates are defined by u(ux,uy) v(vx,vy) w(wx,wy) double dn = Math.sqrt(Math.pow(ux-wx, 2)+Math.pow(uy-wy, 2)) * Math.sqrt(Math.pow(vx-wx, 2)+Math.pow(vy-wy, 2)); double beta = Math.acos(((ux-wx)*(vx-wx)+(uy-wy)*(vy-wy))/(dn)); beta is always less than 3.5, so I can't really figure out what I did wrong. Or did I understand the formula wrong? All variables are double, so that can be excluded I think. I used: (source: matheplanet.com) .
has title: 3 Points, 1 angle - Java (2D)
score: 0
has comment: http://stackoverflow.com/comment/32116839

http://stackoverflow.com/comment/31926270
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21201365
type: Comment
has text: Thanks guys for the quick response. Vinayak, I am using eclipse and your solution works. Thanks.

http://stackoverflow.com/a/21276973
has comment: http://stackoverflow.com/comment/32060034
downvote count: 0
has body: When you have a reference T the actual class can be T or a subclass. When you have a &lt;T&gt; it has to be that class and only that class. This is required as it is a container of a references and modifying this container can alter the original. This doesn't happen with a plain reference as it is passed as a copy. A reference is copied by value. String a = "hi"; Object b = a; b = new Object(); // no problem as `a` is not changed by this. But for containers this doesn't work so well as only the reference to the container is copied, not the container itself. List&lt;String&gt; a = new ArrayList&lt;&gt;(); a.add("hi"); List&lt;Object&gt; b = (List) a; // compiler warning. b.add(new Object()); // alters `a` in an incorrect way. a.get(1); // ClassCastException oops.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21276914
score: 2
has comment: http://stackoverflow.com/comment/32060766

http://stackoverflow.com/q/21280030
answer count: 2
tagged with: android-loadermanager
has answer: http://stackoverflow.com/a/21280527
type: UnansweredQuestion
tagged with: android
has body: I am newbie in android and have used this code while when i am trying to open this Activity its giving me error. CODE: public class LoginActivityService extends Activity implements LoaderManager.LoaderCallbacks&lt;List&lt;User&gt;&gt; { Context context; EditText userName,password,version; Button logoutBtn; LoginLoader loginLoader; ImageButton loginBtn; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login_view_service); context = this; userName = (EditText)findViewById(R.id.userName1); password = (EditText)findViewById(R.id.password1); loginBtn = (ImageButton)findViewById(R.id.login1); logoutBtn = (Button)findViewById(R.id.logout1); loginBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub if(userName.getText().length() == 0 || password.getText().length() == 0) { Toast.makeText(context,"UserName Or Password Should be Filled",Toast.LENGTH_SHORT).show(); } else { userName.setText(""); password.setText(""); //HOW CAN I WRITE BELOW LINE INSIDE { } } } }); getLoaderManager().initLoader(1, null, (LoaderCallbacks&lt;List&lt;User&gt;&gt;) this); } @Override public Loader&lt;List&lt;User&gt;&gt; onCreateLoader(int id, Bundle args) { loginLoader = new LoginLoader(context,userName.getText().toString(),password.getText().toString(),"2013-07-10 01:18:26"); /* args.putString("username",userName.getText().toString()); args.putString("password",password.getText().toString()); args.putString("apkStatusDate","2013-07-10 01:18:26");*/ return loginLoader; } @Override public void onLoadFinished(Loader&lt;List&lt;User&gt;&gt; arg0, List&lt;User&gt; proposals) { Log.i("User",""+proposals.size()); } @Override public void onLoaderReset(Loader&lt;List&lt;User&gt;&gt; arg0) {} } WHILE on start if this activity i am getting error: 01-23 02:05:32.425: E/AndroidRuntime(20375): FATAL EXCEPTION: main 01-23 02:05:32.425: E/AndroidRuntime(20375): java.l…
tagged with: java
has comment: http://stackoverflow.com/comment/32065744
type: Question
has title: Failed to implement LoaderManager in class extended with Activity in Android?
has answer: http://stackoverflow.com/a/21280247
tagged with: android-fragmentactivity
score: 0

http://stackoverflow.com/q/21199523
linked to: http://stackoverflow.com/q/21177475
favorite count: 0
type: UnansweredQuestion
tagged with: setbounds
has body: is setBound() the best way for setting the position of GUI? What are the other option and each own strength over the other? tnx
has answer: http://stackoverflow.com/a/21199668
tagged with: java
type: Question
has title: How can I improve my knowledge in positioning components in java?
has comment: http://stackoverflow.com/comment/31923652
has answer: http://stackoverflow.com/a/21199553
score: -1
has answer: http://stackoverflow.com/a/21199532
downvote count: 2
answer count: 3
upvote count: 1
tagged with: user-interface

http://stackoverflow.com/a/21259734
has comment: http://stackoverflow.com/comment/32028962
has comment: http://stackoverflow.com/comment/32029094
score: 0
has comment: http://stackoverflow.com/comment/32029511
has comment: http://stackoverflow.com/comment/32029861
has body: You may use this command SELECT * FROM A WHERE A.id NOT IN (SELECT B.id FROM B) If you wan to use only join let me know
answers question: http://stackoverflow.com/q/21258803
type: Answer

http://stackoverflow.com/a/21321846
answers question: http://stackoverflow.com/q/21320547
upvote count: 1
has comment: http://stackoverflow.com/comment/32179504
has body: This will work, the exception is also telling you what is wrong. Test here is a JPA type, it is your typecast one line 2 that is incorrect. Your typecast is forcing a List&lt; Test > to a List&lt; Object[] >. The javadoc Execute a SELECT query and return the query results as a typed List. item.setData and item.setText should invoke the correct attribute accessor in row EntityManager connection = DB.Connection().createEntityManager(); //the EntityManagerFactory TypedQuery&lt;Test&gt; query = (TypedQuery&lt;Test&gt;) connection.createQuery("select t from Test t"); List&lt;Test&gt; tablelist = query.getResultList(); connection.close(); SWTtable.removeAll(); //clears all the elements in the table for (Test row : tablelist) { //error on this line - java.lang.ClassCastException {packagename}.Test cannot be cast to [Ljava.lang.Object; final TableItem item = new TableItem(SWTtable, SWT.None); item.setData(row.getSomeAttribute()); item.setText(0, row.getSomeOtherAttribute()); }
has comment: http://stackoverflow.com/comment/32139970
has comment: http://stackoverflow.com/comment/32153171
type: Answer
has comment: http://stackoverflow.com/comment/32139789
downvote count: 0
has comment: http://stackoverflow.com/comment/32143176
score: 1
has comment: http://stackoverflow.com/comment/32141681

http://stackoverflow.com/comment/32174987
comment on: http://stackoverflow.com/q/21341505
score: 0
has text: I am using Windows and I downloaded caliper-1.0-beta-1-all.jar
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21202246
has comment: http://stackoverflow.com/comment/31928233
has comment: http://stackoverflow.com/comment/31934905
has comment: http://stackoverflow.com/comment/31927912
downvote count: 1
accepted answer of: http://stackoverflow.com/q/21201998
has comment: http://stackoverflow.com/comment/31934943
has comment: http://stackoverflow.com/comment/31927968
has comment: http://stackoverflow.com/comment/31928275
has comment: http://stackoverflow.com/comment/31928765
has comment: http://stackoverflow.com/comment/31928213
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31927874
has comment: http://stackoverflow.com/comment/31928029
type: Answer
has body: I think you need a small parser for this. I don't think you can do it with regexp only but I haven't tried to prove that rigorously. Try this code. I haven't tested it on all your inputs though but it should give you an idea. public class Test002 { // private static String s = " 10 sin 5 ( x - 4 ) - 14 "; // private static String s = " 10 sin 2x "; private static String s = " -4 sin -7 (x+6) - 2 "; private static int i = 0; public static void main(String[] args){ String str = s.replaceAll(" ", ""); s = str; parseExpr(); } private static void parseExpr(){ parseA(); parseSin(); parseSinArgument(); parseD(); } private static void parseSinArgument(){ parseB(); if (s.charAt(i) == '('){ parseOpenBracket(); parseX(); parseC(); parseCloseBracket(); }else{ parseX(); } } private static void parseA(){ int j = i; while (s.charAt(i) != 's') i++; System.out.println("A=[" + getToken(j, i) + "]"); // stay at the 's' now! } private static void parseSin(){ int j = i; while (s.charAt(i) != 'n') i++; i++; // move past the 'n' now! } private static void parseB(){ int j = i; while ( s.charAt(i) == '-' || Character.isDigit( s.charAt(i) )) i++; System.out.println("B=[" + getToken(j, i) + "]"); } private static void parseOpenBracket(){ int j = i; i++; System.out.println("OPEN_BRACKET=[" + getToken(j, i) + "]"); } private static void parseX(){ int j = i; while (s.charAt(i) != 'x') i++; i++; System.out.println("X=[" + getToken(j, i) + "]"); } private static void parseC(){ int j = i; while (s.charAt(i) != ')') i++; System.out.println("C=[" + getToken(j, i) + "]"); } private static void parseCloseBracket(){ int j = i; i++; System.out.println("CLOSE_BRACKET=[" + getToken(j, i) + "]"); } private static void parseD(){ int j = i; while (i&lt;s.length()) i++; System.out.println("D=[" + getToken(j, i) + "]"); } private static String getToken(int i1, int i2){ String str = s.substring(i1, i2); str = str.replaceAll(" ", ""); return str.trim(); } }
upvote count: 2
answers question: http://stackoverflow.com/q/21201998
score: 1

http://stackoverflow.com/q/21203189
tagged with: imageview
score: 76
has title: Image View not Wrapping Contents
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31929548
answer count: 3
tagged with: android
accepted answer: http://stackoverflow.com/a/21203321
has comment: http://stackoverflow.com/comment/31929405
has body: I've got an ImageView wrapping this image: &lt;ImageView android:layout_height="wrap_content" android:layout_width="wrap_content" android:scaleType="fitStart" android:src="@drawable/oncmap"/&gt; and right below it, a TextView. Unfortunately, it either pushes it down the view or out of the view depending on the device's screen size. https://i.sstatic.net/t0yo0.png https://i.sstatic.net/biNIW.jpg I can "hack" it, but it'd rather not... &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:padding="16dp" android:orientation="vertical" tools:context="MapFragment"&gt; &lt;ImageView android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/oncmap"/&gt; &lt;TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="Neptune" style="@style/sectionHeader"/&gt; &lt;TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:paddingLeft="8dp" android:paddingRight="8dp" android:paddingTop="16dp" android:text="@string/info" style="@style/text"/&gt;
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31929431
has comment: http://stackoverflow.com/comment/31929355
tagged with: java
has comment: http://stackoverflow.com/comment/31929374
possible better answer: http://stackoverflow.com/a/65950197
upvote count: 76
has answer: http://stackoverflow.com/a/21203321
has answer: http://stackoverflow.com/a/65950197
type: Question
has comment: http://stackoverflow.com/comment/31929466
has comment: http://stackoverflow.com/comment/31929507
has answer: http://stackoverflow.com/a/59485801

http://stackoverflow.com/q/21198882
possible better answer: http://stackoverflow.com/a/21199462
has answer: http://stackoverflow.com/a/21198902
answer count: 4
has body: I want to convert the current datetime to a long value in Java. I know it has to be something with the DateTime DateTime datetime = new DateTime(); But I couldn't find a way to convert the dateTime to long.
has answer: http://stackoverflow.com/a/21199462
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
score: 14
has answer: http://stackoverflow.com/a/21198922
tagged with: date
accepted answer: http://stackoverflow.com/a/21198922
upvote count: 15
has title: Convert current datetime to long in Java
linked to: http://stackoverflow.com/q/38922754
favorite count: 0
has answer: http://stackoverflow.com/a/21198915
has comment: http://stackoverflow.com/comment/31921995
tagged with: datetime

http://stackoverflow.com/q/21213271
type: Question
has comment: http://stackoverflow.com/comment/31947505
downvote count: 0
has comment: http://stackoverflow.com/comment/31947602
has answer: http://stackoverflow.com/a/21213445
has comment: http://stackoverflow.com/comment/31947746
has comment: http://stackoverflow.com/comment/31947549
answer count: 1
has comment: http://stackoverflow.com/comment/31947592
favorite count: 0
has comment: http://stackoverflow.com/comment/31947470
upvote count: 2
accepted answer: http://stackoverflow.com/a/21213445
type: AnsweredQuestion
score: 2
tagged with: ones-complement
has body: My code is a class for converting decimal to binary. it will display the binary, one's complement and two's complement. So far I have figured out the one's complement but having a problem finding a solution for the two's complement. my plan was to use the output of the ones complement as an input to the two's complement method and convert there. Is this the right approach? //This method will convert binary result to ones complement public String do1sComp(){ if (binaryValue.length() == 0) doBinary(); //Ones Complement char[] digits = binaryValue.toCharArray(); for (char digit : digits){ if(digit == '0'){ onesComp += "1"; } else onesComp += "0"; } return onesComp; } /* This was my attempt to start the method public String do2sComp(){ if (onesComp.length() == 0){ if (binaryValue.length() == 0) doBinary(); do1sComp(); } //Twos Complement } */ }
has comment: http://stackoverflow.com/comment/31947622
has title: 1's complement to 2's complement conversion
tagged with: twos-complement
tagged with: java

http://stackoverflow.com/a/21297589
has comment: http://stackoverflow.com/comment/32097005
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32099361
has body: You almost had it. Scanner keyboard = new Scanner(System.in); System.out.println("Enter first file name:"); String first = keyboard.nextLine(); System.out.println("Enter second file name:"); String second = keyboard.nextLine(); System.out.println("Enter third file name:"); String third = keyboard.nextLine(); //and so on and continue whatever you want to do.. EDIT: After your comment. First store the 3 lines in a StringBuilder and then ask for the file name to write. Now you have the lyrics and file name.
answers question: http://stackoverflow.com/q/21297442

http://stackoverflow.com/a/24767293
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21331463
has body: Got it working by adding the plugin to the config.ini - I've not needed to do that before, previously it would just be picked up when I placed it in the plugins/ folder. Is there a configuration option that disables the detection of new plugins from the plugins/ folder?
answers question: http://stackoverflow.com/q/21331463

http://stackoverflow.com/a/21293622
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/32096967
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21292284
has body: Any @-prefixed field is used internally by Logstash. Removing them tends to cause errors. For example, I tried the following config file with Logstash 1.3.3: input { generator { type =&gt; "timestrip" message =&gt; "This is a test message." count =&gt; 1 } } filter { mutate { remove_field =&gt; ["@timestamp"] } } output { elasticsearch_http { host =&gt; "127.0.0.1" flush_size =&gt; 1 } } The ES output reports "Failed to flush outgoing items" with the following exception: NoMethodError: undefined method `tv_sec' for nil:NilClass

http://stackoverflow.com/comment/32004297
comment on: http://stackoverflow.com/q/21244993
has text: Java is a strongly typed language.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31982902
score: 0
has text: @TheLostMind yes, I had a similar problem to which I found an answer here. It said Iterator.remove() is a safe operation . I'll try to find this edit: from Java 7 documentation: "Iterators allow the caller to remove elements from the underlying collection during the iteration with well-defined semantics." http://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21233123

http://stackoverflow.com/q/21339996
tagged with: jsp
has body: I'm tring to make my webapp display different labels according to the user's language of choice, but I can't seem to make it work properly. It does read the messages_en.properties and messages_de.properties files whenever I change the "defaultLocale" in the servlet xml file. ...?lang=en and ...?lang=de are not working at all though. My xml files are as follows: web.xml <?xml version="1.0" encoding="UTF-8"?> SpringTest3 SpringTest3 org.springframework.web.servlet.DispatcherServlet 1 SpringTest3 / org.springframework.web.context.ContextLoaderListener contextConfigLocation /WEB-INF/application-context.xml application-context.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-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/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> <context:component-scan base-package="com.qwerty.controllers" /> <mvc:annotation-driven /> <import resource="spring-datasource.xml" /> </beans> SpringTest3-sevlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd ht…
tagged with: tomcat
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32173036
upvote count: 2
has answer: http://stackoverflow.com/a/21341105
has comment: http://stackoverflow.com/comment/32174091
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/32173771
accepted answer: http://stackoverflow.com/a/21341105
linked to: http://stackoverflow.com/q/3652090
tagged with: java
type: Question
has title: Spring MVC internationalization not working

http://stackoverflow.com/comment/32117551
score: 0
type: Comment
has text: Thx for changing the content Rafael, I saw the deprecation sign yesterday as well when I tried it in Neo4J 2.0.0 but then my internet went down and could not change it. It is a real pain that Neo4J documentation is sometimes very confusing as certain ways of calling the API change pretty frequently. I remember it took me quite a while to figure it out for the 1.x versions.
type: AnswerComment
comment on: http://stackoverflow.com/a/21288979

http://stackoverflow.com/comment/33859571
has text: @ÖmerFarukGül Exactly the same error (FATAL ERROR in native...) and renamin to `lib`worked ! Any explanation why? Does Heroku expect the `lib` folder?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21398144

http://stackoverflow.com/comment/32168719
comment on: http://stackoverflow.com/a/21337073
has text: so, you mean it´s not possible to have an inputStream to it after redeploy? then how can I access it again?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21237148
tagged with: java
has comment: http://stackoverflow.com/comment/31991650
has body: I have a source code from a website where textmessages start with "&lt; h2 >" and end with "&lt; /h2 >". In my app, I read the source code and make it into a string. Now I want to read only the messages, and have tried with this: returned = get.getInternetData("http://blablabla.com"); int start = returned.indexOf("&lt;h2&gt;") + 4; int end = returned.indexOf("&lt;/h2&gt;"); String message = returned.substring(start, end); The problem is that I only get the very first message! My idea was to use a scanner object and do something like while (scan.hasNext("&lt;h2&gt;")) { } But there are no get-methods from the scanner. How can read all the messages from the source code?
has comment: http://stackoverflow.com/comment/31990235
type: UnansweredQuestion
tagged with: copy
has title: Copying parts of a string several times in Java/Android
has answer: http://stackoverflow.com/a/21252917
type: Question
has answer: http://stackoverflow.com/a/21237353
tagged with: android
has comment: http://stackoverflow.com/comment/31990175
score: 0
answer count: 2

http://stackoverflow.com/comment/31995088
comment on: http://stackoverflow.com/a/21239733
type: AnswerComment
score: 0
type: Comment
has text: I guess you never made a typo :))

http://stackoverflow.com/comment/31997882
type: Comment
has text: @DevendraW It seems you are confusing String with word. String may contain only one word like `"word"` but words can be part of larger String like `"word1 word2 word3"`. In this case end of String would be after `word3`. There is no end of String after `word1` or `word2` (String doesn't end here because there are other characters after these words). That is why I asked you to edit your question and post code you are using with example input. So once again [edit](http://stackoverflow.com/posts/21226850/edit) your question and post code that will let us reproduce problem with regex.
type: AnswerComment
comment on: http://stackoverflow.com/a/21226952
score: 0

http://stackoverflow.com/comment/33107834
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21214145
has text: By way of followup, the private methods did not work (as documented) until I applied the Spring aspects using the AspectJ compiler (build time). I may update this answer if I get a chance to back and play with @Order and it works out.
type: AnswerComment

http://stackoverflow.com/a/21278574
score: 18
has body: Try : Reference Apache POI's Developer Guide Example Person table : +------------------+ | NAME | ADDRESS | +------------------+ | Jhone | USA | | Smith | USA | +------------------+ Example Program Workbook wb = new HSSFWorkbook(); Sheet personSheet = wb.createSheet("PersonList"); Row headerRow = personSheet.createRow(0); Cell nameHeaderCell = headerRow.createCell(0); Cell addressHeaderCell = headerRow.createCell(1); String sql = "select name, address from person_table"; PrepareStatement ps = connection.prepareStatement(sql); ResultSet resultSet = ps.executeQuery(); int row = 1; while(resultSet.next()) { String name = resultSet.getString("name"); String address = resultSet.getString("address"); Row dataRow = personSheet.createRow(row); Cell dataNameCell = dataRow.createCell(0); dataNameCell.setCellValue(name); Cell dataAddressCell = dataRow.createCell(1); dataAddressCell.setCellValue(address); row = row + 1; } String outputDirPath = "D:/PersonList.xls"; FileOutputStream fileOut = new FileOutputStream(outputDirPath); wb.write(fileOut); fileOut.close();
has comment: http://stackoverflow.com/comment/35641867
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21277967
answers question: http://stackoverflow.com/q/21277967
upvote count: 18
type: Answer
downvote count: 0

http://stackoverflow.com/q/21305705
linked to: http://stackoverflow.com/q/2096283
type: UnansweredQuestion
has body: I have created a project in eclipse and added jdbc jar library successfully.When I run the program in eclipse I see no error but When I type: javac *.java in console no problem occur but later when I type java Runner I get "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver" and more errors related to this."Runner" is the class which has the main method. But in eclipse eveyrthing was working fine.
tagged with: jdbc
has answer: http://stackoverflow.com/a/21305739
answer count: 4
has answer: http://stackoverflow.com/a/21305746
tagged with: java
type: Question
tagged with: eclipse
has answer: http://stackoverflow.com/a/21305852
score: 0
has title: class not found error in java when compiling a project with libraries
has answer: http://stackoverflow.com/a/21305745

http://stackoverflow.com/a/21253688
has comment: http://stackoverflow.com/comment/32020287
has body: It was very simple both will be running on some URL alone so redirect that to other. The major thing you should concentrate on the passing data should accomplish a same data store i.e., both should point a same database or any other data storing technique. You have to design a database such that both should use the same data without any conflict. If you want to use without any central repo you can pass the data by building it on an XML,JSON or any other technique that can act as a data carrier between two applications.
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/21253505
score: 3
type: Answer

http://stackoverflow.com/q/21243729
favorite count: 0
has answer: http://stackoverflow.com/a/49887387
has answer: http://stackoverflow.com/a/21390607
has answer: http://stackoverflow.com/a/71944311
has answer: http://stackoverflow.com/a/41923781
has answer: http://stackoverflow.com/a/69867507
type: Question
has answer: http://stackoverflow.com/a/21352320
has comment: http://stackoverflow.com/comment/32002038
has answer: http://stackoverflow.com/a/50525371
has answer: http://stackoverflow.com/a/52669038
upvote count: 16
has answer: http://stackoverflow.com/a/60958009
has answer: http://stackoverflow.com/a/21335365
has answer: http://stackoverflow.com/a/63133503
tagged with: algorithm
has answer: http://stackoverflow.com/a/21330999
tagged with: java
has answer: http://stackoverflow.com/a/30035757
has answer: http://stackoverflow.com/a/21397390
has answer: http://stackoverflow.com/a/62484011
has answer: http://stackoverflow.com/a/56469301
has answer: http://stackoverflow.com/a/33569299
has answer: http://stackoverflow.com/a/73934059
has answer: http://stackoverflow.com/a/21916916
has answer: http://stackoverflow.com/a/79307570
has answer: http://stackoverflow.com/a/60365754
has answer: http://stackoverflow.com/a/56199202
has answer: http://stackoverflow.com/a/32286131
has answer: http://stackoverflow.com/a/64139713
has answer: http://stackoverflow.com/a/61930002
has title: CountNonDivisible - Codility training task
tagged with: arrays
downvote count: 0
tagged with: training-data
has answer: http://stackoverflow.com/a/62133844
possible better answer: http://stackoverflow.com/a/21916916
has answer: http://stackoverflow.com/a/21318893
answer count: 29
accepted answer: http://stackoverflow.com/a/21335365
has comment: http://stackoverflow.com/comment/32002254
has answer: http://stackoverflow.com/a/62851284
score: 16
has body: I'm training on codility now. Some tasks I can solve by myself, but with some tasks have problems. Difficulty of this task is &lt;**&gt;. It's medium, but I stalled. Problem: You are given a non-empty zero-indexed array A consisting of N integers. For each number A[i] such that 0 ≤ i &lt; N, we want to count the number of elements of the array that are not the divisors of A[i]. We say that these elements are non-divisors. For example, consider integer N = 5 and array A such that: A[0] = 3 A[1] = 1 A[2] = 2 A[3] = 3 A[4] = 6 For the following elements: A[0] = 3, the non-divisors are: 2, 6, A[1] = 1, the non-divisors are: 3, 2, 3, 6, A[2] = 2, the non-divisors are: 3, 3, 6, A[3] = 3, the non-divisors are: 2, 6, A[6] = 6, there aren't any non-divisors. Write a function: class Solution { public int[] solution(int[] A); } that, given a non-empty zero-indexed array A consisting of N integers, returns a sequence of integers representing the numbers of non-divisors. The sequence should be returned as: a structure Results (in C), or a vector of integers (in C++), or a record Results (in Pascal), or an array of integers (in any other programming language). For example, given: A[0] = 3 A[1] = 1 A[2] = 2 A[3] = 3 A[4] = 6 the function should return [2, 4, 3, 2, 0], as explained above. Assume that: N is an integer within the range [1..50,000]; each element of array A is an integer within the range [1..2 * N]. Complexity: expected worst-case time complexity is O(N*log(N)); expected worst-case space complexity is O(N), beyond input storage (not counting the storage required for input arguments). Elements of input arrays can be modified. I have written some solutions. But my solutions bulky and still have O(n^2) complexity. Can you help me with some ideas or algorithms how to do it optimally? It's not an interview task or something else. I'm just training and try to solve all tasks. You can find this task here: http://codility.com/demo/train/ Lesson 9, first task in lesson.
has answer: http://stackoverflow.com/a/33066012
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32001933

http://stackoverflow.com/comment/32083120
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21289516
has text: How are you running the program? Are you running it in an IDE or are you running it from the command line?

http://stackoverflow.com/q/21238569
tagged with: mustache
score: 2
answer count: 0
upvote count: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
has body: I'd like to compile a mustache Java template directly to JSON with a Writer that writes an escape JSON string instead of using a StringWriter and then executing toString(). Here is my current code - MustacheFactory mustacheFactory = new DefaultMustacheFactory(); // reader is my InputStreamReader pointing to my template file Mustache mustache = mustacheFactory.compile(reader, "example"); StringWriter stringWriter = new StringWriter(); mustache.execute(stringWriter, view); String html = stringWriter.toString(); // elementAdapter is a TypeAdapter&lt;JsonElement&gt; elementAdapter.write(out, new JsonPrimitive(html)); This is a bit confusing, let me know if you have specific questions. But, basically, I'm looking for an API which can do the following - MustacheFactory mustacheFactory = new DefaultMustacheFactory(); // reader is my InputStreamReader pointing to my template file Mustache mustache = mustacheFactory.compile(reader, "example"); JsonStringWriter writer = new JsonStringWriter(response.getWriter()); mustache.execute(writer, view); The pseudo implementation of JsonStringWriter would be - public class JsonStringWriter extends Writer { Writer writer; public JsonStringValueWriter(PrintWriter writer) { this.writer = writer; } @Override public void write(char[] cbuf, int off, int len) { // check cbuf for string escape characters // if found, write escape to underlying writer // otherwise, write cbuf to underlying writer } } I don't want to write this class. My question is what JSON API currently has this class and can you provide a reference to it? Thanks.
has title: Compile mustache java template directly to JSON with a JSON string writer instead of a StringWriter
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/32000518
has text: I see.. So in short they both are same.. making a static in Task class? or using DI by passing around the objects?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21242941
type: AnswerComment

http://stackoverflow.com/comment/98468748
has text: Didnt work for me with version 161 - java.lang.IllegalArgumentException: 'protocols' cannot be null, or contain unsupported protocols
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/49154932

http://stackoverflow.com/comment/32130570
type: QuestionComment
score: 0
has text: But did you also verify that your `try` block ever completed? That’s the main reason for a `finally` block being not executed. Besides the possibility of the code hanging forever, as CodeChimp already said, a JVM termination might prevent the execution of a `finally` block too.
comment on: http://stackoverflow.com/q/21313512
type: Comment

javafx-2
tags question: http://stackoverflow.com/q/21247444
tags question: http://stackoverflow.com/q/21223893
tags question: http://stackoverflow.com/q/21246137
tags question: http://stackoverflow.com/q/21295203
type: Tag
tags question: http://stackoverflow.com/q/21252303
tags question: http://stackoverflow.com/q/21316257
tags question: http://stackoverflow.com/q/21316806
tags question: http://stackoverflow.com/q/21263169
tags question: http://stackoverflow.com/q/21316886
tags question: http://stackoverflow.com/q/21244622
tags question: http://stackoverflow.com/q/21266694
tags question: http://stackoverflow.com/q/21184764
tags question: http://stackoverflow.com/q/21205031
tags question: http://stackoverflow.com/q/21268973
tags question: http://stackoverflow.com/q/21346220
tag name: javafx-2

http://stackoverflow.com/a/21295799
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21295325
type: Answer
has body: You are inserting 3 folders. When you insert this: [1,7-Zip, childFolders[[2,7z],[3,Lang,childFolders[], childFiles[[3,7z.dll],[4,af.txt]]]], childfiles[[1,7-zip.chm],[2,7-zip.dll]]] You are creating Folder 1, 2 and 3 at the same time. Folder 2 hasn't files or subfolders. However, Folder 3 has 3 files. When you try to retrieve this information you have with getFolders you retrieve all three folders at the same time. That's what getSearchedData() does. You can solve it by creating a new method in the class SearchedFolder @Override public List&lt;SearchedFolder&gt; getSearchedFolder(Long folderId) { Criteria ctria = schedulerSessionFactory.getCurrentSession().createCriteria(SearchedFolder.class) .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY) .setFetchMode("childFiles", FetchMode.SELECT); List&lt;SearchedFolder&gt; folders = (List&lt;SearchedFolder&gt;) ctria.list(); ctria.add(Restrictions.eq("folderId", folderId)); return folders; }
answers question: http://stackoverflow.com/q/21295325
has comment: http://stackoverflow.com/comment/32097071
has comment: http://stackoverflow.com/comment/32093407
has comment: http://stackoverflow.com/comment/32093513
score: 0

http://stackoverflow.com/a/21207570
has comment: http://stackoverflow.com/comment/31937980
has comment: http://stackoverflow.com/comment/31938123
has comment: http://stackoverflow.com/comment/31937391
has comment: http://stackoverflow.com/comment/31937321
has comment: http://stackoverflow.com/comment/31937456
has comment: http://stackoverflow.com/comment/31937657
has comment: http://stackoverflow.com/comment/31937808
has comment: http://stackoverflow.com/comment/31937658
type: Answer
has comment: http://stackoverflow.com/comment/31937721
has comment: http://stackoverflow.com/comment/31937419
has comment: http://stackoverflow.com/comment/31937302
has comment: http://stackoverflow.com/comment/31937990
has comment: http://stackoverflow.com/comment/31937252
has comment: http://stackoverflow.com/comment/31940683
score: 0
answers question: http://stackoverflow.com/q/21206326
has body: The problem here is that you uninstalled Java 6. When you installed Eclipse, the .app file was configured to run on Java 6, and when that is gone, it won't work. The solution is to reinstall Eclipse.
has comment: http://stackoverflow.com/comment/31937595
has comment: http://stackoverflow.com/comment/31937836
has comment: http://stackoverflow.com/comment/31937154

http://stackoverflow.com/comment/32016682
comment on: http://stackoverflow.com/q/21252251
has text: @Jorge_B In my case, there is JSON being sent in request body, in case of any error, that JSON I need to log into the database, but I'm unable to get requestBody.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21286440
tagged with: jvm
favorite count: 0
has body: if one computer installed more than one jdk and jre, I want to know, when I excute "java" command in dos, how "java" command find which jre it should use? I saw a answer in somewhere, he said there there step to search jre: search the current directory which java.exe placed to find the JRE directory search the parent directory to find JRE directory search the JRE directory based on the [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment] information in registry It is right?
has answer: http://stackoverflow.com/a/21286519
has title: how "java" command in dos find which jre to use
answer count: 4
has answer: http://stackoverflow.com/a/21286953
has comment: http://stackoverflow.com/comment/32076236
possible better answer: http://stackoverflow.com/a/21286519
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21286639
has comment: http://stackoverflow.com/comment/32076240
tagged with: java
has answer: http://stackoverflow.com/a/21286531
upvote count: 1
downvote count: 1
type: Question
score: 0
has answer: http://stackoverflow.com/a/21286639

http://stackoverflow.com/comment/32008561
type: Comment
type: QuestionComment
has text: @user2310289: The performance benefit isn't in the array assignment, but in avoiding the `synchronized`, which locks the entire array for a single assignment.
comment on: http://stackoverflow.com/q/21247283
score: 0

http://stackoverflow.com/comment/32023040
comment on: http://stackoverflow.com/q/21256219
type: QuestionComment
has text: no errors but file is not copying
score: 0
type: Comment

http://stackoverflow.com/comment/32008024
comment on: http://stackoverflow.com/q/21246733
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis: Question updated.
score: 0

http://stackoverflow.com/comment/32130755
type: QuestionComment
comment on: http://stackoverflow.com/q/21316931
has text: If you execute System.err.println(new File(".").getAbsoluteFile()) you will get the working directory. Similarly System.err.println(new File("./data/rasterData.dat").getAbsoluteFile()) would give you the actual location of that mysterious file. Please try.
score: 1
type: Comment

http://stackoverflow.com/comment/31915026
has text: Are users allowed to use other special character like `{ OR [ OR * OR $`?
type: Comment
comment on: http://stackoverflow.com/q/21195031
score: 0
type: QuestionComment

http://stackoverflow.com/q/21258313
favorite count: 0
has title: Camel File processing
has answer: http://stackoverflow.com/a/21258753
has answer: http://stackoverflow.com/a/21276840
has answer: http://stackoverflow.com/a/47015413
tagged with: file-uri
answer count: 4
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/21276840
upvote count: 2
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21258753
tagged with: configuration
has answer: http://stackoverflow.com/a/68471477
tagged with: apache-camel
tagged with: routes
has body: I'm using Camel (2.11.0) to try and achieve the following functionality: If a file exists at a certain location, copy it to another location and then begin processing it If no such file exists, then I don't want the file consumer/poller to block; I just want processing to continue to a direct:cleanup route I only want the file to be polled once! Here's what I have so far (using Spring XML): <route id="my-route <from uri="file:///home/myUser/myApp/fizz?include=buzz_.*txt"/> ${body} == null <to uri="direct:cleanup" /> <to uri="file:///home/myUser/myApp" /> <to uri="bean:shouldOnlyGetHereIfFileExists?method=doSomething" /> </route> With the above configuration, if there is no file at /home/myUser/myApp/fizz, then Camel just waits/blocks until there is one. Instead, I want it to just give up and move on to direct:cleanup. And if there is a file, I see it getting processed inside the shouldOnlyGetHereIfFileExists bean, but I do not see it getting copied to /home/myUser/myApp; so it's almost as if the element is being skipped/ignored altogether! Any ideas? Thanks in advance!
downvote count: 0

http://stackoverflow.com/comment/32111087
type: AnswerComment
score: 0
has text: It's a nice idea, but if the os does not support gui, then your file manager also can't have a gui. So at least JFrame can't be used.
type: Comment
comment on: http://stackoverflow.com/a/21305775

http://stackoverflow.com/comment/32145802
type: QuestionComment
comment on: http://stackoverflow.com/q/21325370
score: 0
has text: Aniket you are exactly right...I created a node,,,but i want to Iterate for various nodes,,,Thats why i wanted to know how this will be heplfull in acheiving it
type: Comment

http://stackoverflow.com/a/21346001
has body: You could use a different name for your field using gson's Field Naming Support public class Whatever { private int success; @SerializedName("return") private OtherType returnValue; ... }
score: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21345965
upvote count: 3
answers question: http://stackoverflow.com/q/21345965
type: Answer
downvote count: 0

http://stackoverflow.com/q/21216892
has comment: http://stackoverflow.com/comment/31953631
tagged with: executorservice
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21217158
tagged with: task
type: Question
has body: I try to end a ExecutorService with executorService.shutdown(); and if that didn't worked, with executorService.shutdown();. The Problem is, that the executorService can't be stopped and the program is still running. Here is my class which shall start a WatchService to watch a directory for changes: public class FileWatcher { /** * This Class starts a WatchService to get changes on a specific folder. */ Path dir; private final ConfigManager configManager; private final FileHandler fileHandler; private ExecutorService executorService; public FileWatcher(ConfigManager configManager, FileHandler fileHandler) { this.configManager = configManager; this.fileHandler = fileHandler; } public void start() { dir = configManager.getConfig().getJdfPath(); //executorService = Executors.newFixedThreadPool(1); executorService = Executors.newSingleThreadExecutor(); Runnable runWatcher; runWatcher = new Runnable() { @Override public void run() { try { startWatcher(); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } }; executorService.execute(runWatcher); } private void startWatcher() throws IOException, InterruptedException { /** * Create a new WatchService which detects created and modified files. To * let it detect deleted files add ENTRY_DELETE to dir.register(). */ WatchService watcher = FileSystems.getDefault().newWatchService(); WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_MODIFY); while (!Thread.currentThread().isInterrupted()) { key = waitForEvents(watcher, key); } } private WatchKey waitForEvents(WatchService watcher, WatchKey key) { /** * The WatchService tells the FileHandler the Filename of the changed or * new file in the given folder. */ try { key = watcher.take(); } catch (InterruptedException e) { executorService.shutdown(); } catch (ClosedWatchServiceException e) { executorService.shutdown(); } for (WatchEvent&lt;?&gt; event : key.pollEvents()) { fileHandler.setPath((Path) event.context()); } key.r…
tagged with: java
has answer: http://stackoverflow.com/a/21217158
tagged with: watchservice
possible better answer: http://stackoverflow.com/a/21216981
has title: Can't stop a ExecutorService
answer count: 2
tagged with: scheduled-tasks
score: 0
has answer: http://stackoverflow.com/a/21216981

http://stackoverflow.com/comment/32920922
type: AnswerComment
has text: Very nice! I knew someone would come up with a better solution than mine eventually. Certainly *not* simpler to understand, (took me a while to work through all the possibilities in my head and convince myself there were no races,) but very thorough, and without the problem of safely removing the locks from the map. Thank you!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21339300

http://stackoverflow.com/q/21244110
favorite count: 0
has answer: http://stackoverflow.com/a/21244693
has comment: http://stackoverflow.com/comment/32002842
accepted answer: http://stackoverflow.com/a/21244693
type: AnsweredQuestion
has title: Hibernate / SQLException: field doesn't have default value
downvote count: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/32002971
tagged with: mysql
has answer: http://stackoverflow.com/a/66438466
type: Question
score: 3
has body: mySQL Table generated using: CREATE TABLE `actors` ( `actorID` INT(11) NOT NULL, `actorName` VARCHAR(255) NOT NULL, PRIMARY KEY AUTO_INCREMENT (actorID) ); Mapped class: @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "actorID", length = 11, unique = true, nullable = false) private int actorID; .... Error: ERROR: Field 'actorID' doesn't have a default value This error is hit when trying to create a new Actor object, and saving it to the database. I've tried using other generation strategies, and dropping/rebuilding tables / entire database, as per the answers to similar questions. No luck so far. Thank you for your time, Samuel Smith EDIT: Dropping the table and recreating it using the SQL syntax shown by shippi seemed to solve the problem for me.
upvote count: 3
possible better answer: http://stackoverflow.com/a/33682147
answer count: 3
has answer: http://stackoverflow.com/a/33682147

http://stackoverflow.com/q/21259795
possible better answer: http://stackoverflow.com/a/21259849
tagged with: byte
has title: What is the java preferred way of serving byte data without copying it
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21259948
score: 1
tagged with: java
tagged with: stream
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/21259849
tagged with: arrays
has body: For my case I have a class that holds a large amount of byte data in a single array.You can say; byte myData[];//myData.length = very large number What will I do is I will provide data for other classes/user via this class. However each request is partially included in myData array. For a request, it has starting index and ending index. When a user wants this request, I need to return the following: System.arrayCopy(myArray,startIndex , requestBuffer , endIndex , requestBuffer.length); return requestBuffer; What I want to ask is; is there anyway of doing this without copying data because it may cause me in trouble like out of memory exeption when requests are too many.
has answer: http://stackoverflow.com/a/21260122
accepted answer: http://stackoverflow.com/a/21260122
answer count: 3
upvote count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32029145

http://stackoverflow.com/comment/32148097
type: Comment
type: QuestionComment
has text: if you want to understand linked list, go took at the wikipedia page on it, there are diagrams and sample code. this is not a good representation of linked list implementation
comment on: http://stackoverflow.com/q/21326539
score: 0

http://stackoverflow.com/q/21323708
tagged with: java
has title: Java TLS client can't find certificate when accessing soap service
tagged with: ssl
type: Question
answer count: 1
tagged with: tomcat
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21469891
accepted answer: http://stackoverflow.com/a/21469891
tagged with: client-certificates
downvote count: 0
tagged with: web-services
has body: I have a java app that runs inside Tomcat. It is trying to access a TLS client certificate authenticated SOAP service. All certificates being used are self-signed. I specify the trustStore and keyStore via the Java Options in Tomcat and I have also tried doing it in code for all the needed properties before creating my service. Both keyStore and trustStore are JKS with RSA certificates. I have verified the certificates exist in the server's trustStore and that the self client certificate exists in the client keyStore and that the hashes are the same. Client side: c:\Program Files\Java\jre7\bin&gt;keytool -list -keystore c:\tomcat\certs\tomcat.keystore Enter keystore password: Keystore type: JKS Keystore provider: SUN Your keystore contains 1 entry tomcat, Jan 20, 2014, PrivateKeyEntry, Certificate fingerprint (SHA1): 78:F3:30:A0:40:B0:CC:8D:86:1F:99:FF:7C:3B:85:7C:6D:C7:F2:D2 Server side: C:\Program Files (x86)\Java\jre7\bin&gt;keytool -list -keystore c:\tomcat\certs\tomcat.truststore Enter keystore password: Keystore type: JKS Keystore provider: SUN Your keystore contains 1 entry clientcert, Jan 23, 2014, trustedCertEntry, Certificate fingerprint (SHA1): 78:F3:30:A0:40:B0:CC:8D:86:1F:99:FF:7C:3B:85:7C:6D:C7:F2:D2 When I start Tomcat I see the loading of the keystore like this: keyStore is : c:\tomcat\certs\tomcat.keystore keyStore type is : JKS keyStore provider is : init keystore init keymanager of type SunX509 *** found key for : tomcat chain [0] = [ [ Version: V3 Subject: CN=Name, OU=Engineering, O=MyOrg, ST=NJ, C=US ... At the end of server hello I see the certificate DN that I expect and was loaded from the keystore above: *** CertificateRequest Cert Types: RSA, DSS, ECDSA Cert Authorities: &lt;CN=Name, OU=Engineering, O=MyOrg, ST=NJ, C=US&gt; [read] MD5 and SHA1 hashes: len = 115 ... Then immediately after the ServerHelloDone I see an empty Certificate chain with no "matching alias: mycert" logging like I would expect to see. *** ServerHelloDone [read] MD5 an…
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/21258032
has comment: http://stackoverflow.com/comment/32026077
has comment: http://stackoverflow.com/comment/32029020
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21258605
favorite count: 0
linked to: http://stackoverflow.com/q/11016092
tagged with: class
has title: How can get an instance from .class file in java
tagged with: instance
upvote count: 3
accepted answer: http://stackoverflow.com/a/21258605
type: AnsweredQuestion
score: 3
has body: Frankly, I do not know even it is possible or not. But what I am trying to do is just like below. I made a class file from ClassFile.java via javac command in terminal. Then I want to get an instance from .java file or .class file. Next, I made another project in eclipse, As you guess this project path and upper file path are completely different. For instance, ClassFile.java/class file can be located in '~/Downloads' folder, the other hand, new eclipse project can be in '~/workspace/'. So I read file which referred in step 1 by FileInputStream. From here, I just paste my code. public class Main { private static final String CLASS_FILE_PATH = "/Users/juneyoungoh/Downloads/ClassFile.class"; private static final String JAVA_FILE_PATH = "/Users/juneyoungoh/Downloads/ClassFile.java"; private static Class getClassFromFile(File classFile) throws Exception { System.out.println("get class from file : [" + classFile.getCanonicalPath() + " ]"); Object primativeClz = new Object(); ObjectInputStream ois = null; ois = new ObjectInputStream(new FileInputStream(classFile)); primativeClz = ois.readObject(); ois.close(); return primativeClz.getClass(); } public static void main(String[] args) throws Exception { getClassInfo(getClassFromFile(new File(CLASS_FILE_PATH))); } } just like your assumption, this code has errors. For example, it shows : java.io.StreamCurruptedException: invalid stream header : CAFEBABE this there any way to get object instance from .class file or .java file? P.S. I wish do not use extra libraries.
tagged with: reflection
has comment: http://stackoverflow.com/comment/32025999
tagged with: java
tagged with: .class-file
type: Question

http://stackoverflow.com/comment/32176137
has text: I guess if there is no way to just print interval
comment on: http://stackoverflow.com/q/21342006
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32219551
type: AnswerComment
comment on: http://stackoverflow.com/a/21331477
type: Comment
has text: @SuperMrBlob Have added a couple of sections, "Generating the 'change events'" and "Using those change events" that should cover those issues
score: 0

http://stackoverflow.com/a/21312321
has body: SET DATESTYLE = "DMY, DMY"; SELECT * FROM xxx WHERE Date::date BETWEEN '01-01-2014' AND '06-01-2014' ORDER BY Date::date LIMIT 3; Also, mind using the type date for storing dates, and not varchar!
score: 0
accepted answer of: http://stackoverflow.com/q/21310660
type: Answer
answers question: http://stackoverflow.com/q/21310660
type: AcceptedAnswer

interface
tags question: http://stackoverflow.com/q/21327500
tags question: http://stackoverflow.com/q/21343058
tag name: interface
tags question: http://stackoverflow.com/q/21333460
tags question: http://stackoverflow.com/q/21268392
tags question: http://stackoverflow.com/q/21220134
tags question: http://stackoverflow.com/q/21304169
tags question: http://stackoverflow.com/q/21263607
tags question: http://stackoverflow.com/q/21305905
tags question: http://stackoverflow.com/q/21215435
tags question: http://stackoverflow.com/q/21281203
tags question: http://stackoverflow.com/q/21270151
type: Tag
tags question: http://stackoverflow.com/q/21340963
tags question: http://stackoverflow.com/q/21298913
tags question: http://stackoverflow.com/q/21210312
tags question: http://stackoverflow.com/q/21349833
tags question: http://stackoverflow.com/q/21325971
tags question: http://stackoverflow.com/q/21259376
tags question: http://stackoverflow.com/q/21325708
tags question: http://stackoverflow.com/q/21205446
tags question: http://stackoverflow.com/q/21258118

http://stackoverflow.com/a/21297857
answers question: http://stackoverflow.com/q/21292284
upvote count: 2
has body: When a message is read by Logstash, Logstash treat the message as a Event. An event will have a timestamp and message log. Thus, the @timestamp field is requisite. Therefore, if you want to delete the @timestamp field, it will causes an error. Logstash can't output the event to the elasticsearch. Exception in thread "LogStash::Runner" org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `tv_sec' for nil:NilClass at RUBY.sprintf(file:/tmp/logstash-1.2.1-flatjar.jar!/logstash/event.rb:239) at org.jruby.RubyString.gsub(org/jruby/RubyString.java:3062) at RUBY.sprintf(file:/tmp/logstash-1.2.1-flatjar.jar!/logstash/event.rb:225) at RUBY.receive(file:/tmp/logstash-1.2.1-flatjar.jar!/logstash/outputs/elasticsearch.rb:153) So far, not all @-prefix fields causes error, only remove @timestamp will cause this error.
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21292284
type: Answer

http://stackoverflow.com/q/21242000
linked to: http://stackoverflow.com/q/24941078
has body: I got a new mac and installed the same xampp web server as my old one. Everything has been fine except when I call a java file : $str_exec = "java -jar HelloWorld.jar"; exec($str_exec, $output,$result); $output is now an empty array(), and $result = 5 I've tried absolute paths, permissions on everything, changing the user and group in https.conf (none of which I had to do before!) I swear nothing has changed except I'm now using a macbook pro instead of an air. The files have always matched our main server files. The only thing appearing in the error log is: dyld: Symbol not found: __cg_jpeg_resync_to_restart Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO Expected in: /Applications/XAMPP/xamppfiles/lib/libJPEG.dylib in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO Help please!! I've gone through all the similar threads to this issue on here and can't find anything on the internet anywhere! Gnh
accepted answer: http://stackoverflow.com/a/21420476
has comment: http://stackoverflow.com/comment/32313568
answer count: 1
downvote count: 0
favorite count: 0
score: 3
tagged with: php
tagged with: macos
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21420476
upvote count: 3
has title: php exec on java jar file output is empty array
has comment: http://stackoverflow.com/comment/32314484
type: Question
tagged with: xampp
tagged with: java

http://stackoverflow.com/comment/32040683
has text: In this case I'm updating a properties file. It could probably be done in Maven but the commands to update it come from a file containing 'sed' commands, so antrun seems the easiest way to read that file and get the sed commands executed before the tests run.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21265735

http://stackoverflow.com/comment/31975371
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21228818
has text: Try going to window => show view => other => Servers => servers then click ok. Then after go to the server tab next to your console tab, right click on the white space in you server tab and select new => Server , that should show a list of servers you can use, under apache, select it and add the tomcat server, I hope it helps.

http://stackoverflow.com/q/21345022
has title: Hadoop is not showing my job in the job tracker even though it is running
downvote count: 0
tagged with: hadoop-streaming
possible better answer: http://stackoverflow.com/a/21348975
favorite count: 0
has answer: http://stackoverflow.com/a/21348975
tagged with: hadoop-yarn
type: AnsweredQuestion
tagged with: java
score: 9
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/21355549
linked to: http://stackoverflow.com/q/39637326
upvote count: 9
has body: Problem: When I submit a job to my hadoop 2.2.0 cluster it doesn't show up in the job tracker but the job completes successfully. By this I can see the output and it is running correctly and prints output as it is running. I have tried muliple options but the job tracker is not seeing the job. If I run a streaming job using the 2.2.0 hadoop it shows up in the task tracker but when I submit it via the hadoop-client api it does not show up in the job tracker. I am looking at the ui interface on port 8088 to verify the job Environment OSX Mavericks, Java 1.6, Hadoop 2.2.0 single node cluster, Tomcat 7.0.47 Code try { configuration.set("fs.defaultFS", "hdfs://127.0.0.1:9000"); configuration.set("mapred.jobtracker.address", "localhost:9001"); Job job = createJob(configuration); job.waitForCompletion(true); } catch (Exception e) { logger.log(Level.SEVERE, "Unable to execute job", e); } return null; etc/hadoop/mapred-site.xml mapreduce.framework.name yarn mapred.job.tracker localhost:9001 etc/hadoop/core-site.xml hadoop.tmp.dir /tmp/hadoop-${user.name} A base for other temporary directories. fs.default.name hdfs://localhost:9000
accepted answer: http://stackoverflow.com/a/21355549
answer count: 2

http://stackoverflow.com/a/21344050
has comment: http://stackoverflow.com/comment/32180073
downvote count: 0
has comment: http://stackoverflow.com/comment/32179910
has comment: http://stackoverflow.com/comment/32179933
has comment: http://stackoverflow.com/comment/32179895
has comment: http://stackoverflow.com/comment/32179862
type: Answer
answers question: http://stackoverflow.com/q/21343936
has comment: http://stackoverflow.com/comment/32179904
score: 3
upvote count: 3
has body: In java, all objects are passed by copy of reference, meaning if you pass a to your function and then change the value assigned to reference a, the original value will be unchanged, because you don't actually have access to the original reference, but a copy of it. You need to actually return a reference to the new object to let it escape the function. For example: public BigInteger mod(BigInteger a, BigInteger b){ // .... create new value x return x; } By the way, as per the Wikipedia page, you can pretty much apply the following: function gcd(a, b) while b ≠ 0 t := b b := a mod b a := t return a
has comment: http://stackoverflow.com/comment/32179877
has comment: http://stackoverflow.com/comment/32179786
has comment: http://stackoverflow.com/comment/32179946

http://stackoverflow.com/q/21254291
tagged with: python
tagged with: build
type: AnsweredQuestion
has title: How to install delete-project plugin in gerrit?
score: 12
has answer: http://stackoverflow.com/a/31144177
tagged with: java
has body: I want to install delete-project plugin to my gerrit server. As per the latest version, I should clone it from google source and use buck build. I cloned it and my buck is also ready. What are the steps to be followed to build the delete project plugin and add it to my gerrit server. I tried buck build . in the cloned source of delete-project. But, I am getting the following error Traceback (most recent call last): File "/home/gerrit/buck/src/com/facebook/buck/parser/buck.py", line 872, in &lt;module&gt; main() File "/home/gerrit/buck/src/com/facebook/buck/parser/buck.py", line 867, in main buildFileProcessor.process(build_file.rstrip()) File "/home/gerrit/buck/src/com/facebook/buck/parser/buck.py", line 800, in process build_env['BUILD_FILE_SYMBOL_TABLE']) File "/home/gerrit/delete-project/././BUCK", line 1, in &lt;module&gt; gerrit_plugin( NameError: name 'gerrit_plugin' is not defined BUILD FAILED: Parse error for BUCK file ././BUCK: End of input at line 1 column 1 Please help
possible better answer: http://stackoverflow.com/a/36860794
tagged with: gerrit
has answer: http://stackoverflow.com/a/21722062
has answer: http://stackoverflow.com/a/36860794
type: Question
upvote count: 12
accepted answer: http://stackoverflow.com/a/21722062
downvote count: 0
has answer: http://stackoverflow.com/a/66670157
favorite count: 0
has answer: http://stackoverflow.com/a/32084389
answer count: 5

http://stackoverflow.com/comment/31938123
has text: the eclipse .app is configured to use java 6, and it won't use the java 7 you installed
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21207570

http://stackoverflow.com/a/21265033
has body: If you are seeing NullPointerException, then Check if your "myMap" has properly initialized and have at least not empty. If you are seeing IndexOutOfRangeException, then Two arguments "from" and "to" should be in the range of map size. from >= 0 to &lt;= map's max size
score: 1
answers question: http://stackoverflow.com/q/21264702
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/32147068
type: AnswerComment
score: 0
has text: Thanks csmckelvey!!! Very useful, but how do I make the same code without a set like if I use If and Else or switch?
type: Comment
comment on: http://stackoverflow.com/a/21325040

http://stackoverflow.com/q/21204266
has body: As the title suggest, I need help to create a database. What kind of database of database doesn't matter, I just need it to work! The program is a "musiclist" which you can add songs, remove songs, and edit songs. I have been programming for about a month, so I would appreciate if you could also explain how the database methods works etc. instead of just give me the answer :-). The database needs to store the data of 3 ArrayLists. The 3 arraylists all store Strings, and I connect the arraylists using an index of a JList(Model). The functions that I need is: Store the 3 Arraylists to an database. Probably its a problem that the arraylists are connected with Index like song(index 1), artist(index 1) need to be stored together. I need to be able to remove from the database at a specific index. I need to be able to edit from the database, at a specific index. I need to be able to call content from individually arraylists for instance: get content from song(index 5), so add all 3 arraylist to 1 string isn't an option. I'm not sure its a good idea use 3 arraylists to store the data, so if there's any better alternatives, I would be glad to know :-) When I call the data from the database, the data should be called to the method addString(). This method takes 3 strings, and add them to the same index. So I guess the database shouldn't contain any kind of index. The "edit" method is found in editSong();, and the "remove" method is found in ite.addActionListener. The 3 array is: fl, which contains song name; art, which contains artist name;youurl, which contains youtube url. Here's the code: public class MusicList extends JFrame{ public JTextField af; private JList jl; private JButton add; private JButton edit; private JButton test; private JPanel jp; private JScrollPane sp; private JTextField artist; private JButton save; private JButton listb; private JPopupMenu jpo; private JMenuItem ite; private JButton editsave; private JButton editlist; private JTextField youtube; priva…
answer count: 1
has comment: http://stackoverflow.com/comment/140223330
type: UnansweredQuestion
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/31931354
has title: Need help to create an database (Java)
type: Question
has answer: http://stackoverflow.com/a/21204370
tagged with: arraylist
score: 0

http://stackoverflow.com/q/21214627
tagged with: android
has answer: http://stackoverflow.com/a/62178163
linked to: http://stackoverflow.com/q/4239880
tagged with: menu
score: 18
tagged with: http://stackoverflow.com/tag/xml
answer count: 11
has answer: http://stackoverflow.com/a/78591870
tagged with: java
has answer: http://stackoverflow.com/a/21214649
linked to: http://stackoverflow.com/q/11982826
has title: Android options menu not displaying
has comment: http://stackoverflow.com/comment/33907982
has answer: http://stackoverflow.com/a/49610752
has answer: http://stackoverflow.com/a/31335860
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/39573839
upvote count: 18
has answer: http://stackoverflow.com/a/47814115
has body: I'm new to Android and I've been trying to add a simple add button as mentioned below list_menu.xml &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@+id/menu_insert" android:icon="@android:drawable/ic_menu_add" android:title="@string/menu_insert" /&gt; &lt;/menu&gt; MyActivity.java @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.list_menu, menu); return true; } I read in Dummies series book that ic_menu_add is already there in resources and I don't need to add it, but when I run this code it does not display. I've tried to add a custom icon with same name still there is no button. Can someone help me with it please.
has answer: http://stackoverflow.com/a/24204508
downvote count: 0
has comment: http://stackoverflow.com/comment/31950240
has answer: http://stackoverflow.com/a/21214780
has answer: http://stackoverflow.com/a/58480569
has comment: http://stackoverflow.com/comment/63128366
favorite count: 0
has answer: http://stackoverflow.com/a/57376515
type: Question

http://stackoverflow.com/comment/32009737
score: 0
type: Comment
type: QuestionComment
has text: @Hovercraft Full Of Eels i tried the JRadioButtons and a buttonGroup and still didnt work
comment on: http://stackoverflow.com/q/21247566

http://stackoverflow.com/comment/32049602
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21270159
has text: No input streams needed here.

http://stackoverflow.com/comment/32200580
score: 1
type: AnswerComment
type: Comment
has text: Thank you for your very informative answer. So which approach would you personally consider the most appropriate when dealing with an array of some descendants of `JComponent`? I also have one *unrelated* question to ask. You used `EventQueue.invokeLater(...)` in your example. Tutorials that I've seen want us to use `SwingUtilities.invokeLater(...)`. Is one any more suitable than the other?
comment on: http://stackoverflow.com/a/21349183

http://stackoverflow.com/q/21243378
favorite count: 0
tagged with: promise
tagged with: angularjs
type: UnansweredQuestion
score: 6
upvote count: 6
has answer: http://stackoverflow.com/a/21244798
has title: Execute multiple tasks asynchronously and return first successful result in JavaScript function
tagged with: java
has answer: http://stackoverflow.com/a/21273983
type: Question
tagged with: javascript
has answer: http://stackoverflow.com/a/21245093
tagged with: groovy
answer count: 3
has comment: http://stackoverflow.com/comment/32006034
downvote count: 0
has body: I have to write a javaScript function that return some data to the caller. In that function I have multiple ways to retrieve data i.e., Lookup from cache Retrieve from HTML5 LocalStorage Retrieve from REST Backend (bonus: put the fresh data back into cache) Each option may take its own time to finish and it may succeed or fail. What I want to do is, to execute all those three options asynchronously/parallely and return the result whoever return first. I understand that parallel execution is not possible in JavaScript since it is single threaded, but I want to at least execute them asynchronously and cancel the other tasks if one of them return successfully result. I have one more question. Early return and continue executing the remaining task in a JavaScript function. Example pseudo code: function getOrder(id) { var order; // early return if the order is found in cache. if (order = cache.get(id)) return order; // continue to get the order from the backend REST API. order = cache.put(backend.get(id)); return order; } Please advice how to implement those requirements in JavaScript. Solutions discovered so far: Fastest Result JavaScript ES6 solution Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise Promise.race(iterable) Returns a promise that resolves when the first promise in the iterable resolves. var p1 = new Promise(function(resolve, reject) { setTimeout(resolve, 500, "one"); }); var p2 = new Promise(function(resolve, reject) { setTimeout(resolve, 100, "two"); }); Promise.race([p1, p2]).then(function(value) { // value == "two" }); Java/Groovy solution Ref: http://gpars.org/1.1.0/guide/guide/single.html import groovyx.gpars.dataflow.Promise import groovyx.gpars.dataflow.Select import groovyx.gpars.group.DefaultPGroup import java.util.concurrent.atomic.AtomicBoolean /** * Demonstrates the use of dataflow tasks and selects to pick the fastest result of concurrently run calculations. * It shows a waz to cancel the slower ta…

http://stackoverflow.com/comment/32147918
score: 0
comment on: http://stackoverflow.com/q/21326621
has text: Buy a proper certificate from a trusted certificate authority.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21298123
has comment: http://stackoverflow.com/comment/32097590
downvote count: 0
upvote count: 28
has comment: http://stackoverflow.com/comment/32097619
has body: You more often think of classes as being generic, but methods can be generic too. A common example is Arrays.asList. Most of the time, you don't have to use the syntax with angle brackets &lt;...&gt;, even when you're invoking a generic method, because this is the one place in which the Java compiler is actually capable of doing basic type inference in some circumstances. For example, the snippet given in the Arrays.asList documentation omits the type: List&lt;String&gt; stooges = Arrays.asList("Larry", "Moe", "Curly"); But it's equivalent to this version in which the generic type is given explicitly: List&lt;String&gt; stooges = Arrays.&lt;String&gt;asList("Larry", "Moe", "Curly");
has comment: http://stackoverflow.com/comment/32097804
accepted answer of: http://stackoverflow.com/q/21297979
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21297979
type: Answer
score: 28

http://stackoverflow.com/a/21337132
type: Answer
has comment: http://stackoverflow.com/comment/32223232
has comment: http://stackoverflow.com/comment/32235910
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21336883
score: 7
has comment: http://stackoverflow.com/comment/32228520
answers question: http://stackoverflow.com/q/21336883
has body: What is the meaning of the @JoinColumn(name="passport_fk") of Customer? This means that passport_fk field will be created inside Customer table, since it belongs here, this table is treated as the owner of the relationship (you seem to get that though). How about passport in the mappedBy of Passport Since this is annotated with mappedBy it shows that this si NOT the owner, and that the Owner is Customer (the field that is annotated). name attribute is telling Hibernate where to find the information about the FK mapping (inside Customer there is a getPassport method). No additional fields will be created in Passport.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32193560
upvote count: 7

http://stackoverflow.com/a/21188886
accepted answer of: http://stackoverflow.com/q/21188831
type: Answer
answers question: http://stackoverflow.com/q/21188831
has body: You can break; the loop if the condition in if is true and the control goes in for (;;) { Scanner in = new Scanner(System.in); int a = in.nextInt(); if (a &lt;= 0) { break; } else { System.out.println("Continue"); }
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/21281717
answers question: http://stackoverflow.com/q/21281269
score: 0
type: Answer
has body: You are encrypting the whole file in memory and then writing it. What you should do is writing it little by little, in a multiple part operation. I think you should look at: Java 256-bit AES Password-Based Encryption take a look at the second answer. The method public void WriteEncryptedFile (File input, File output) should do exactly what you need to do. Hope this helps.

http://stackoverflow.com/comment/32212662
score: 0
type: Comment
has text: If you plan to never use the service again, it is a good idea to clean it up. But imagine the following: `for (int i=0; i < myTasks.length; ++i) service.run(myTasks[i]);` In worst case this will destroy and rebuild the service 100 times, because threading does not guarantee anything regarding the order of execution.
type: AnswerComment
comment on: http://stackoverflow.com/a/21353791

http://stackoverflow.com/comment/32032964
has text: @Maxbester yes it will change the sign.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21261286

http://stackoverflow.com/q/21340736
answer count: 1
has comment: http://stackoverflow.com/comment/32173707
has comment: http://stackoverflow.com/comment/32173656
has comment: http://stackoverflow.com/comment/32173546
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/32173514
has title: Failed to Send Email using SMTP in Android?
has answer: http://stackoverflow.com/a/21340981
tagged with: java
has comment: http://stackoverflow.com/comment/32173483
type: Question
has body: I am newbie in Android and I have followed this tutorial SMTP link another SMTP tutorial But unfortunately I failed to send emails from emulator/device S3,every time I try I am getting "CATCH" block message. This is class that extends from Activity ImageView submitBtn = (ImageView)findViewById(R.id.askscreen_submit_btn); submitBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub try { // CALL GetText method to make post method call m = new Mail("abc@gmail.com","password"); sendEmail(v); } catch (Exception ex) { content.setText(" url exeption! "); } } }); } public void sendEmail(View view){ String[] toArr = {"abc@gmail.com"}; // This is an array, you can add more emails, just separate them with a coma m.setTo(toArr); // load array to setTo function m.setFrom("abc@gmail.com"); // who is sending the email m.setSubject("subject"); m.setBody("your message goes here"); try { //m.addAttachment("/sdcard/myPicture.jpg"); // path to file you want to attach if(m.send()) { // success Toast.makeText(AskfatwaActivity.this, "Email was sent successfully.", Toast.LENGTH_LONG).show(); } else { // failure Toast.makeText(AskfatwaActivity.this, "Email was not sent.", Toast.LENGTH_LONG).show(); } } catch(Exception e) { // some other problem Toast.makeText(AskfatwaActivity.this, "There was a problem sending the email.", Toast.LENGTH_LONG).show(); } } Can someone please help me what is the reason?
tagged with: smtp
has comment: http://stackoverflow.com/comment/32173613
tagged with: android

http://stackoverflow.com/comment/31993662
type: Comment
comment on: http://stackoverflow.com/a/21235372
score: 0
has text: Thanks man, I solved my problem, it wasn't the configuration in the idea as you said, I was the gwt compiler, that was configured to 2048. Thank you!
type: AnswerComment

http://stackoverflow.com/comment/32003639
comment on: http://stackoverflow.com/a/21241426
score: 0
type: AnswerComment
has text: I am finding my code does not work for selecting a shoe size :http://pastebin.com/6K1RpPKL
type: Comment

http://stackoverflow.com/comment/32145371
type: Comment
has text: I've seen that sort of thing happen when your code (what you're stepping through) is out of sync with the class files (that are actually running)
comment on: http://stackoverflow.com/q/21325205
score: 0
type: QuestionComment

http://stackoverflow.com/a/21241765
type: Answer
has comment: http://stackoverflow.com/comment/31998525
has comment: http://stackoverflow.com/comment/31998831
has comment: http://stackoverflow.com/comment/31998461
upvote count: 9
answers question: http://stackoverflow.com/q/21241740
has comment: http://stackoverflow.com/comment/31998531
has comment: http://stackoverflow.com/comment/31998788
downvote count: 0
has body: You should use the 1st one. The 2nd one might overflow, if the value of lowerBound + upperBound goes past the boundary values for that type.
score: 9
has comment: http://stackoverflow.com/comment/31998666

http://stackoverflow.com/a/21334408
upvote count: 2
has body: Should this: if (score &gt; scorePreferences.getInt("highscore", 0)... ...not be something like: if (score &gt; highscorePreferences.getInt("highscore", 0)... The key "highscore" is in your preferences set with that same name. It looks like you are reading that key from the "score" preferences instead. It's not there, so the default of 0 is always being used.
score: 2
accepted answer of: http://stackoverflow.com/q/21334131
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32161370
type: Answer
answers question: http://stackoverflow.com/q/21334131

http://stackoverflow.com/comment/32166743
type: AnswerComment
has text: It is good practice. There is zero benefit to create a new array for each recursion when its only purpose is to have all elements added to another array. If it doesn't cost anything to do it the right way, you should.
comment on: http://stackoverflow.com/a/21327738
type: Comment
score: 2

http://stackoverflow.com/q/21228236
tagged with: serialization
type: UnansweredQuestion
tagged with: zk
tagged with: java
has answer: http://stackoverflow.com/a/21234990
downvote count: 1
type: Question
upvote count: 0
has body: I am using ZK Framework i want to serialize Window component or Window Object in String and save into the database and again get it from database and deserialize it . How can i do that?
score: -1
has title: Java Searlize a Window Component in String and save in DB?
answer count: 1
favorite count: 0

http://stackoverflow.com/q/21243877
tagged with: osgi
tagged with: netbeans
answer count: 0
type: UnansweredQuestion
tagged with: maven
has title: Error when import org.osgi.util.tracker.ServiceTracker
has comment: http://stackoverflow.com/comment/32002936
tagged with: java
has comment: http://stackoverflow.com/comment/32002610
type: Question
has body: I have a OSGi project and I am using Maven. In a bundle I need to import org.osgi.util.tracker.ServiceTracker, but for some inexplicable reason Netbeans keep telling me that package org.osgi.util.tracker does not exist. But it does. See this screenshot: I clearly have felix framework in my dependencies. It does exist on my hard drive, its path is set correctly. I can unzip the jar and navigate to the very class I want to import which really is in the appropriate package (as seen in the folder tree). What the hell is happening? :( Edit: Business's pom.xml is this: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 library-parent org.lib 1.0-SNAPSHOT org.lib business 1.0-SNAPSHOT bundle business OSGi Bundle org.apache.felix org.osgi.core junit junit test ${project.groupId} model ${project.groupId} integration ${project.groupId} utils org.apache.felix org.apache.felix.framework 4.2.1 jar org.apache.felix maven-bundle-plugin 2.3.7 true org.lib.business.BusinessActivator org.lib.business org.lib.business.*
has comment: http://stackoverflow.com/comment/32002415
tagged with: apache-felix
score: 0

http://stackoverflow.com/a/21196067
answers question: http://stackoverflow.com/q/21196041
has body: You loop as long as i is larger or equal to zero, which it will always be, as you don't change i from zero. You need to put in an upper limit, or have some check inside the loop where you break out of the loop.
downvote count: 0
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/a/21295937
has comment: http://stackoverflow.com/comment/32113448
has comment: http://stackoverflow.com/comment/32094549
accepted answer of: http://stackoverflow.com/q/21294680
has body: You can write the code as follow, using the contract of an interface to do the job, look after methods that attend your condition. public class HomeWork { public static void main(String[] args) { int[] arr=new int[] {100, 37, 49}; Condition[] conditions= new Condition[]{ new Negative(), new Prime(), new PerfectSquare() }; for (Condition condition : conditions) { System.out.println(condition.makeYourCondition(arr)); } } } interface Condition { boolean makeYourCondition(int[] input); } class Negative implements Condition { @Override public boolean makeYourCondition(int[] input) { for (int i : input) { if(i&lt;0) return true; } return false; } } class Prime implements Condition { @Override public boolean makeYourCondition(int[] input) { //TODO PUT YOUR CONDITION return false; } } class PerfectSquare implements Condition { @Override public boolean makeYourCondition(int[] input) { //TODO PUT YOUR CONDITION return false; } }
type: AcceptedAnswer
score: -4
type: Answer
downvote count: 4
upvote count: 0
answers question: http://stackoverflow.com/q/21294680

http://stackoverflow.com/comment/32150623
comment on: http://stackoverflow.com/q/21328038
type: QuestionComment
has text: @Juvanis and variables should be private, is not it ? There is no sense to use public variable and *eters ?
score: 0
type: Comment

actionscript-3
tags question: http://stackoverflow.com/q/21298960
tags question: http://stackoverflow.com/q/21318595
tags question: http://stackoverflow.com/q/21208185
tags question: http://stackoverflow.com/q/21304788
type: Tag
tag name: actionscript-3

http://stackoverflow.com/comment/31960488
type: QuestionComment
has text: Thanks for your answer. I would like to convert the content of 'if' in a method and is taken off from 'Sum' in such a way as to exploit the parallel programming for each method without having to rewrite all of the code twice. If I'm wrong section of the forum tell me how I can fix it. If my request is not appreciated I delete all and I am sorry.
comment on: http://stackoverflow.com/q/21218816
score: 0
type: Comment

http://stackoverflow.com/comment/31980379
score: 1
comment on: http://stackoverflow.com/a/21222950
type: AnswerComment
type: Comment
has text: No, the roles are not static, you have to read up on what the roles actually in Spring Security are. It's a wide misconception on their part and rather confusing. The role you assign wherever in your application is just a name that has to start with ROLE_ prefix, which actually is not a role, but in fact an authority. Under expanding I mean an example like this: http://slackspace.de/articles/roles-permissions-with-spring-security-3/

http://stackoverflow.com/q/21281130
has title: Object showing instead of String when received through a stream
favorite count: 0
has comment: http://stackoverflow.com/comment/32067410
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/21281276
has body: Hopefully I don't need to flood this post with my code, but if needed, please ask. Also, I only used getPassword().toString() for testing purposes, and I don't use it in any of my applications. Client-Side: Grab password from JPasswordField passfield, send it as a String through ObjectOutputStream out Server-Side: Receive String through ObjectInputStream in, print it to console Easy enough, but the problem I'm having is that instead of the String showing, it prints an object ([C@6af3a631) The way I'm sending and receiving objects is pretty simple: Client: out.writeObject(passfield.getPassword().toString()) Server: Object data; while((data = in.readObject) != null) { if(data instanceof String) { System.out.println(data); } } If I send "hey" instead of passfield.getPassword().toString()), the String prints out just fine. I have been getting pretty familiar with ObjectOutputStream, and I've never encountered this problem, so I'm guessing it might have to do with the JPasswordField This is a small step towards helping me understand bigger problem (packet containing password is sent just fine, packet is received just fine, but the password var comes in as null).
has comment: http://stackoverflow.com/comment/32069212
has comment: http://stackoverflow.com/comment/32066926
has comment: http://stackoverflow.com/comment/32068328
has comment: http://stackoverflow.com/comment/32067076
tagged with: stream
tagged with: swing
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32067089
accepted answer: http://stackoverflow.com/a/21281276
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32066969
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/32066990
tagged with: client-server
upvote count: 0
answer count: 1

http://stackoverflow.com/a/21371960
has body: I think you are using camel-http component, you need to use camel-http4 component instead.
answers question: http://stackoverflow.com/q/21317519
score: 0
type: Answer

http://stackoverflow.com/a/21353738
has comment: http://stackoverflow.com/comment/32297520
has body: In order to use other methods, you should change the GetMethod. E.g: // "rest/candidates/?" GetMethod getMethod = new GetMethod(API_URL + "rest/candidates?" + "confidence=" + CONFIDENCE + "&amp;support=" + SUPPORT + "&amp;text=" + URLEncoder.encode(text.text(), "utf-8")); Etc.
answers question: http://stackoverflow.com/q/21311993
has comment: http://stackoverflow.com/comment/32239488
has comment: http://stackoverflow.com/comment/32288237
type: Answer
has comment: http://stackoverflow.com/comment/32271529
has comment: http://stackoverflow.com/comment/32287462
score: 0
has comment: http://stackoverflow.com/comment/32337075

http://stackoverflow.com/q/21299618
tagged with: swing
has title: JScrollPane Column Header with Frozen, and Scrollable Components
type: Question
has comment: http://stackoverflow.com/comment/32103257
has comment: http://stackoverflow.com/comment/32100775
tagged with: jscrollpane
answer count: 1
downvote count: 0
favorite count: 0
has body: I have a JScrollPane with a column header consisting of multiple components. One of the components needs to be statically positioned, while the other components need to scroll like normal. The only thing I could think to do was add a listener to the scrollbar which sets the location of the frozen component like this: frozenHeader.setLocation(scrollViewport.getVisibleRect().getLocation()). However, the location won't actually update until the scrollbar is no long scrolling, so it looks rather unappealing. And yes, I've tried calling revalidate() followed by repaint() on both the frozenHeader, and its parent. Here is an example to reproduce what I'm talking about: import java.awt.Color; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; /** * * @author brian */ public class TestScroll extends JFrame { private JScrollPane scrollPane; private JPanel viewport; private JPanel colHeader; // This should be frozen private JPanel frozenHeader; // This should scroll private JPanel scrollHeader; public TestScroll() { this.setSize(new Dimension(500, 400)); this.setResizable(false); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Set up the scroll pane scrollPane = new JScrollPane(); viewport = new JPanel(); viewport.setPreferredSize(new Dimension(1000, 400)); scrollPane.setViewportView(viewport); // Set up the scroll panes column header colHeader = new JPanel(new GridBagLayout()); frozenHeader = new JPanel(); // Width is equal to the frame's width, as it should stay in the same location frozenHeader.setPreferredSize(new Dimension(500, 30)); frozenHeader.setBackground(Color.RED); scrollHeader = new JPanel(); // Width equal to viewportview's as it should scroll scrollHeader.setPreferredSize(new Dimension(1000, 30)); scrollHeader.setBackground(Color.BLUE); JLabel label = new JLabel("Text"); scrollHeader.add(label); GridBagConstraints c = new GridB…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32100073
has comment: http://stackoverflow.com/comment/32100322
has answer: http://stackoverflow.com/a/21300735
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/36520550
type: Comment
has text: @Springrbua that is a great answer that solved my problem, thanks
comment on: http://stackoverflow.com/q/21336398
score: 0
type: QuestionComment

http://stackoverflow.com/a/60491176
type: Answer
answers question: http://stackoverflow.com/q/21198411
has body: right click on project folder click -> runAs -> run Configuration -> click on arguments tab -> add -xmx512M press Enter -xmx2048M Apply and Run.
has comment: http://stackoverflow.com/comment/107013404
score: 0

http://stackoverflow.com/comment/32159742
comment on: http://stackoverflow.com/a/21333608
type: Comment
score: 0
has text: +1 especially for **Otherwise, you should export the constants with a noninstantiable utility class.**
type: AnswerComment

http://stackoverflow.com/comment/31923966
has text: but the table are in the JScrollPane so if i tried to put the table in a normal JPanel i am going to lose the JScrollPane so is there a way to Control the layout for the JScrollPane
type: Comment
comment on: http://stackoverflow.com/a/21199368
score: 0
type: AnswerComment

http://stackoverflow.com/a/21258927
has body: Setup: CREATE TABLE table_name (id integer, description text); INSERT INTO table_name(id, description) values (1, '12'); Demo: testdb=&gt; SELECT id, description FROM table_name; id | description ----+------------- 1 | 12 (1 row) Yup, I'd say you have a number in your description column because there's a number in your description column.
downvote count: 0
answers question: http://stackoverflow.com/q/21257976
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/21330021
tagged with: android-studio
has body: I'm getting this error when I press "run app". I been searching for a fix the last two days, can you help me? I have Android Studio 0.4.3 installed, this issue started when my school update Java on my school computer. org.gradle.tooling.GradleConnectionException: Could not create an instance of Tooling API implementation using the specified Gradle distribution 'http://services.gradle.org/distributions/gradle-1.9-all.zip'.: Could not create an instance of Tooling API implementation using the specified Gradle distribution 'http://services.gradle.org/distributions/gradle-1.9-all.zip'. buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.7.+' } } apply plugin: 'android' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.0.0" defaultConfig { minSdkVersion 11 targetSdkVersion 19 } buildTypes { release { runProguard false proguardFile getDefaultProguardFile('proguard-android.txt') } } productFlavors { defaultFlavor { proguardFile 'proguard-rules.txt' } } } dependencies { compile 'com.android.support:appcompat-v7:+' compile 'com.android.support:appcompat-v7:18.0.+' } This did not solve the issue: Problems with Gradle in Android Studio
type: UnansweredQuestion
tagged with: android
has title: Gradle error when pressing "run app" - Android Studio 0.4.3 [ Could not create an instance of Tooling API ]
has comment: http://stackoverflow.com/comment/32153827
score: 3
tagged with: android-gradle-plugin
upvote count: 3
has comment: http://stackoverflow.com/comment/32154089
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21330597
linked to: http://stackoverflow.com/q/21213487
has comment: http://stackoverflow.com/comment/32154399
has comment: http://stackoverflow.com/comment/32154255
linked to: http://stackoverflow.com/q/20820707
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32154143
favorite count: 0

http://stackoverflow.com/comment/31938798
comment on: http://stackoverflow.com/a/21208474
type: Comment
score: 0
has text: @ziggy this is just a hardcoded solution with **only** searches for the specific id you mention in your post. It's not going to work I'm afraid.
type: AnswerComment

http://stackoverflow.com/comment/31946105
type: Comment
type: QuestionComment
score: 1
has text: "It runs fine but the output is not correct". Isn't that a bit like "the operation was a success but the patient died"?
comment on: http://stackoverflow.com/q/21212124

http://stackoverflow.com/q/21323651
downvote count: 0
accepted answer: http://stackoverflow.com/a/21323697
linked to: http://stackoverflow.com/q/9700179
answer count: 3
has comment: http://stackoverflow.com/comment/32142754
favorite count: 0
linked to: http://stackoverflow.com/q/519520
linked to: http://stackoverflow.com/q/137975
score: 5
has answer: http://stackoverflow.com/a/21323754
duplicate of: http://stackoverflow.com/q/519520
has answer: http://stackoverflow.com/a/21323697
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/10510894
tagged with: oop
has title: Singleton using Static Members and Methods?
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/21323863
possible better answer: http://stackoverflow.com/a/21323754
type: Question
has body: We can replicate a Singleton behavior my making a Class with Static Methods and Member Elements. Other than serialization What's the harm of implementing a singleton using static Body only.

http://stackoverflow.com/comment/31964195
score: 0
type: QuestionComment
type: Comment
has text: -1: Pastebins die, SO is forever. Edit the code into the question.
comment on: http://stackoverflow.com/q/21222278

http://stackoverflow.com/q/21280324
has body: I have an exception that I throw from the server side that I wish to catch on the client side. The exception should be sent over REST using Jersey. This is what I have so far: Define my Exception: public class MyException extends Exception implements Serializable { private static final long serialVersionUID = 1L; public MyException () { super(); } public MyException (String msg) { super(msg); } public MyException (String msg, Exception e) { super(msg, e); } } Define my exception in a class which implements the ExceptionMapper: @Provider public class TestMapper implements ExceptionMapper&lt;MyException&gt; { @Override public Response toResponse(MyExceptionexception){ return Response.status(Status.BAD_REQUEST).entity(exception.getMessage()).build(); } } This is my resource class, where the request from the server goes into: @PUT @Path("calculate") public void calculateMethod(String id) throws MyException{ //Other code... throw new MyException("custom error message string"); } } And finally, from the client side makes the REST call as follows: public void calculateMethodClient(String id) throws MyException{ client().put("/test/", "calculate", id); } When this client method gets called, I have surrounded with Try/Catch to test: public boolean testClient(){ try { client.calculateMethodClient((String) id); return true; } catch (MyException) { return false; } catch (UniformInterfaceException e){ return false; } } I have put a breakpoint in both catch blocks but it only ever hits the UniformInterfaceException catch. This is not what I want as the server side can fail for a variety of reasons and I want to be able to define the error message in 'MyException' each time. Could someone please explain how I can get this to work?
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/21280409
favorite count: 0
tagged with: rest
type: UnansweredQuestion
has title: Catch Rest Exception on Client
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/q/21194294
answer count: 4
type: AnsweredQuestion
has title: Java Websocket Client without a Browser
accepted answer: http://stackoverflow.com/a/21231344
tagged with: java
has answer: http://stackoverflow.com/a/22116914
has answer: http://stackoverflow.com/a/45165197
has body: I am working on a project that requires real-time interaction between users. I want to have a HTML5 web client (simple enough) and also a local client (preferably Java) with both being able to connect to the server. I have done some research and have not found a conclusive answer to whether or not the local client can connect to the server without a browser. Question: Is there any way to connect from a local Java client to a websocket server without a browse? I have seen some browser wrappers in other languages that might make this possible. If not, I am open to suggestions. Thanks.
type: Question
downvote count: 0
tagged with: websocket
linked to: http://stackoverflow.com/q/7257068
favorite count: 0
has answer: http://stackoverflow.com/a/21200960
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/21231344
tagged with: client
upvote count: 11
possible better answer: http://stackoverflow.com/a/21200960
has comment: http://stackoverflow.com/comment/31913838
score: 11

http://stackoverflow.com/q/21222507
linked to: http://stackoverflow.com/q/513832
has title: How can I search for a specific string in a object array?
upvote count: 0
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
has comment: http://stackoverflow.com/comment/31964002
possible better answer: http://stackoverflow.com/a/21222612
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21222612
tagged with: java
has answer: http://stackoverflow.com/a/21222537
downvote count: 1
type: Question
has body: I need write a method that searches an object array of Club Members for a specific member and returns true if the member is found. This is what I have now. public boolean isMember (String name){ boolean found = false; int arrayIndex = 0; while(arrayIndex &lt; members.length &amp;&amp; !found){ if(members[arrayIndex] == name){ found = true; } arrayIndex++; } return found; }
tagged with: arrays
score: -1
accepted answer: http://stackoverflow.com/a/21222537
answer count: 2

http://stackoverflow.com/comment/32174158
has text: Looks like your variable `blazing` isn't available to your toString() method. From the code you posted above, `blazing` appears to belong only to the `above100degrees method`. You could make `blazing` a class level variable so it can be seen elsewhere
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21341061

http://stackoverflow.com/a/21283445
score: 0
type: Answer
has body: You can't. References to objects are passed by-value in Java. You can't have a method which changes where the reference of the calling object is pointing to. But what you could do is add a public boolean isReleased() method to class ABC and replace if(abc == null) with if (abc.isReleased()). Any methods which don't work anymore after an object is released should throw a custom exception when they are called after calling release(). That would be much better debuggable than the NullPointerException you would get when all references to the object would be nulled instead.
answers question: http://stackoverflow.com/q/21283346

http://stackoverflow.com/a/21283919
score: 0
has body: Try: if (!a.equals(b)) { ...
type: Answer
has comment: http://stackoverflow.com/comment/32072538
answers question: http://stackoverflow.com/q/21283869

http://stackoverflow.com/a/21315600
has comment: http://stackoverflow.com/comment/32128030
has comment: http://stackoverflow.com/comment/32127908
has comment: http://stackoverflow.com/comment/32139624
answers question: http://stackoverflow.com/q/21315549
has comment: http://stackoverflow.com/comment/32134929
has comment: http://stackoverflow.com/comment/32130150
has comment: http://stackoverflow.com/comment/32128113
downvote count: 0
has comment: http://stackoverflow.com/comment/32131043
type: Answer
score: 6
upvote count: 6
has body: Your runtime classpath shouldn't reference src/test/resources. Maven will copy everything over to target so you should be able to get it with "/dbunit/clear_db.xml"

http://stackoverflow.com/comment/32158967
comment on: http://stackoverflow.com/q/21333032
score: 0
type: QuestionComment
type: Comment
has text: Do you need to get these arguments from code or command line?

http://stackoverflow.com/a/21280702
answers question: http://stackoverflow.com/q/21280516
has comment: http://stackoverflow.com/comment/32066508
has body: If you will call the function repaint() of some component, you will need to do a getter method for that component like this: View v= new View(); v.getMyPanel().repaint(); //returns the panel and repaint it v.getMyPanel().revalidate(); //returns the panel and revalidates it
downvote count: 1
has comment: http://stackoverflow.com/comment/32066295
score: -1
upvote count: 0
type: Answer

http://stackoverflow.com/comment/32062467
comment on: http://stackoverflow.com/q/21265519
has text: Have you considered e.g. k-medoids, where each cluster is represented by a **member**, i.e. in your case a **representative time series**?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21239053
linked to: http://stackoverflow.com/q/10071204
has body: I have written multiple apps in eclipse using the SDK. I have also worked with C++ before. Now I am being asked to arrange for some old C++ code to be wrapped up into a java library, or at least have a java interface, such that other android programmers (with no knowledge of C++) can employ it in their code. I have seen a variety of examples and discussions of making C++ code into complete stand alone apps using the NDK, but never a library. It would be even better if the android programmer that uses my library didn't even need to know about, or install, the NDK themselves. Can someone confirm that what I am trying to do is even possible. And if so, how?
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31993682
has comment: http://stackoverflow.com/comment/31996636
has answer: http://stackoverflow.com/a/21240431
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: c++
has comment: http://stackoverflow.com/comment/31994857
has comment: http://stackoverflow.com/comment/31994726
has title: C++ library for android
tagged with: java
upvote count: 1
tagged with: eclipse
downvote count: 1
has answer: http://stackoverflow.com/a/21243620
tagged with: android-ndk
has comment: http://stackoverflow.com/comment/31993603
type: Question
has comment: http://stackoverflow.com/comment/32210308

http://stackoverflow.com/a/21197585
has body: It looks like you're trying to make a trigonometric function here. Dont remember the name but i can tell that b is meant to be squared? If so, use the Math.pow(numberToSquare, theSquareNumber) The one line Will look like this: Double x1 = (-b + Math.sqrt(Math.pow(b, 2) - 4*a*c))/(2*a)
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21197438

http://stackoverflow.com/q/21206421
tagged with: eclipse
has body: I have a problem. I had project in eclipse. I changed my IDE to netbeans. Now i have problem, because in eclipse i had two source folder: src/resources/main src/java All my jars i have in src/java, so i added src/java to my source in netbeans. But netbeans cant find class with "main" function in this project when this class is in src/java. Set main class in properties doesnt work. But when i move it to src/resources/main it works fine. Is it possible to have main class in src/java? Because i dont want change my structure
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21206539
possible better answer: http://stackoverflow.com/a/21206472
type: AnsweredQuestion
tagged with: netbeans
has answer: http://stackoverflow.com/a/21206472
score: 1
has title: Netbeans: "main" class in java project
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/21206539
tagged with: java

http://stackoverflow.com/q/21205843
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21205895
type: AnsweredQuestion
favorite count: 0
tagged with: synchronization
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/31934270
has title: synchronization in java (object and static methods)
answer count: 1
has answer: http://stackoverflow.com/a/21205895
has comment: http://stackoverflow.com/comment/31933847
tagged with: java
has body: I have few queries regarding Synchronization in Java. I have read a lot of content online and have feeded myself with lot of information and so with multiple doubts. I will list down my queries, so please anyone help me out with my doubts. Object level synchronization : 1) For following code sample. public synchronized void a(){ //todo } } What will be the LOCK used. Will it automatically be lock on "this" as we have it in case below sample code ? public void a(){ synchronized (this) { //TODO } } 2) We have multiple methods code blocks locking on "this". public void a(){ synchronized (this) { //TODO } } public synchronized void b(){ synchronized (this) { //TODO } } So does this means that if code block of b() is locked, then any other thread wont be able to access a() as well at the same time as they have a lock on the object(this)? Class level synchronization : 3) For the following code public static void c(){ synchronized (Main.class) { //todo } }public static void d(){ synchronized (Main.class) { //todo } }public static void e(){ //no syncronization here } Question 1 : IF c() is locked will any other thread be able to access d() which has synchronized block as well ? Question 2: If c() is under lock, will any other thread will be able to access e() which is a non synchronized method ?
tagged with: jakarta-ee

http://stackoverflow.com/a/21242055
upvote count: 1
has body: In public void TileClicked (Tile tile) you can only use tileShowface once when SelectedTile == null The fist time you enter this method you set the SelectedTile = tile so the next time you enter this method the statement if (SelectedTile == null) is false so you can't call the tileShowface method twice unless you set the SelectedTile back to null Maybe you should use a different counter to know if this is the first tile the player clicks or the second. And after 2 clicks on different tiles set this counter back to zero
type: Answer
answers question: http://stackoverflow.com/q/21239703
downvote count: 0
score: 1

http://stackoverflow.com/comment/31932493
comment on: http://stackoverflow.com/a/21199143
type: AnswerComment
has text: I want to detect if a pixel is transparent in texture drawn I add the following line to the creation of the SurfaceView and nothing. getHolder().setFormat(PixelFormat.RGBA_8888)
score: 0
type: Comment

http://stackoverflow.com/comment/32003082
score: 0
comment on: http://stackoverflow.com/q/21243818
type: Comment
type: QuestionComment
has text: @Kallja I just dived into FtlProcessingController with my coworker, and we actually found out that the System.out gets closed somewhere inside, like you said. I didn't even know such a thing was possible, and it's pretty embarrassing to work with now...

http://stackoverflow.com/comment/32041634
type: QuestionComment
type: Comment
score: 0
has text: It should not be JButton[][] grid; //names the grid, but it should be MyButton[][] grid; You have overriden JButton class.
comment on: http://stackoverflow.com/q/21266532

http://stackoverflow.com/comment/31915365
comment on: http://stackoverflow.com/a/21194037
has text: Real time java is largely unsupported now. There is one commercial provider, but it is important to remember that real time != low latency. Real time means consistent latency (or low worst case latency)
score: 2
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32140808
score: 0
type: AnswerComment
has text: Do you have an example of such a tutorial?
type: Comment
comment on: http://stackoverflow.com/a/21315968

http://stackoverflow.com/a/31687338
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21245796
upvote count: 1
score: 1
has body: I encountered this problem with Java 1.6. Running under Java 1.7 fixed my particular rendition of the problem. I think the underlying cause was that the server I was connecting to must have required stronger encryption than was available under 1.6.

http://stackoverflow.com/comment/31957517
comment on: http://stackoverflow.com/q/21218987
has text: Make it public perhaps.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21336093
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: java
score: -4
type: Question
has title: Need help keep on getting error but don't know how to fix it
has body: import java.util.Comparator; public class Person implements Comparable&lt;Person&gt; { public static void main(String[] args) { } public int compareTo(Person other) { int diff = getLastName().compareTo(other.getLastName()); if (diff == 0) diff = getFirstName().compareTo(other.getFirstName()); return diff; } } these are the errors I keep on getting Cannot find symbol on line 11,11,13 and 13
downvote count: 4
has answer: http://stackoverflow.com/a/21336124
upvote count: 0

http://stackoverflow.com/q/21332578
possible better answer: http://stackoverflow.com/a/21332663
has comment: http://stackoverflow.com/comment/32193923
type: AnsweredQuestion
score: -5
has answer: http://stackoverflow.com/a/21332966
has body: Can someone pls let me know the output of this code? public Class A { public int count = 5; public void test() { // some code } } public Class B extends A { public int count = 10; public void test() { //some code } } public Class Check { A a = new A(); A b = new B(); public void myTestMethod() { a.count; //should call A? a.test; //should call A? b.count; //which count is called here? compiler error? b.test; //should call B? } }
type: Question
accepted answer: http://stackoverflow.com/a/21332966
has comment: http://stackoverflow.com/comment/32158108
tagged with: java
downvote count: 5
tagged with: parent-child
answer count: 2
has comment: http://stackoverflow.com/comment/32157967
upvote count: 0
tagged with: inheritance
favorite count: 0
has title: Is it possible to access child class variable through parent class reference?
has answer: http://stackoverflow.com/a/21332663
has comment: http://stackoverflow.com/comment/32158043
has comment: http://stackoverflow.com/comment/32196107

http://stackoverflow.com/a/21329299
answers question: http://stackoverflow.com/q/21329025
has body: Because of Type Erasure, you will not be able to get the type(in case of Empty List).As JLS says on Type Erasure : 4.6. Type Erasure Type erasure is a mapping from types (possibly including parameterized types and type variables) to types (that are never parameterized types or type variables). We write |T| for the erasure of type T. The erasure mapping is defined as follows: The erasure of a parameterized type (§4.5) G&lt;T1,...,Tn&gt; is |G|. The erasure of a nested type T.C is |T|.C. The erasure of an array type T[] is |T|[]. The erasure of a type variable (§4.4) is the erasure of its leftmost bound. The erasure of every other type is the type itself. Type erasure also maps the signature (§8.4.2) of a constructor or method to a signature that has no parameterized types or type variables. The erasure of a constructor or method signature s is a signature consisting of the same name as s and the erasures of all the formal parameter types given in s. The type parameters of a constructor or method (§8.4.4), and the return type (§8.4.5) of a method, also undergo erasure if the constructor or method's signature is erased. The erasure of the signature of a generic method has no type parameters. In case of Non Empty List: ...... public static void main(String[] args) throws ClassNotFoundException { List&lt;MyObject&gt; list= new ArrayList&lt;MyObject&gt;(); list.add(new MyObject()); System.out.println("the type of the list is: "+classTypeOfList(list)); } public static &lt;T&gt; String classTypeOfList(List&lt;T&gt; list) throws ClassNotFoundException { return list.get(0).getClass().getCanonicalName(); } OUTPUT the type of the list is: MyObject
accepted answer of: http://stackoverflow.com/q/21329025
has comment: http://stackoverflow.com/comment/32172788
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3

http://stackoverflow.com/comment/32055927
comment on: http://stackoverflow.com/q/21273458
has text: @RodrigoBento thanks, I already get that, It is not like my requirement. I want to select many from `OneToMany unidirection mapping`.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21315549
tagged with: maven
tagged with: resources
type: Question
has answer: http://stackoverflow.com/a/21581256
tagged with: dbunit
has title: How to access common resource files from multiple projects
has answer: http://stackoverflow.com/a/21485989
tagged with: java
score: 15
answer count: 8
upvote count: 15
has answer: http://stackoverflow.com/a/21627549
downvote count: 0
possible better answer: http://stackoverflow.com/a/21315600
has answer: http://stackoverflow.com/a/21587517
has answer: http://stackoverflow.com/a/21315600
favorite count: 0
accepted answer: http://stackoverflow.com/a/21627549
has answer: http://stackoverflow.com/a/21605591
has answer: http://stackoverflow.com/a/21620768
has answer: http://stackoverflow.com/a/21520104
has body: In one of my projects I have resources stored in /src/test/resources (typical maven directory structure). Those resources are being used by an utility class stored in the project. The utility class itself is being used from other projects (other projects depend on this one). I would access the resource like that: final InputStream inputStreamDobs = ClassLoader.class.getResourceAsStream("/dbunit/clear_db.xml"); but since I use it from different projects the path is not correct - it is relative to current project that is being built/tested, not the one where utility class and resources are. Any thought how to approach this? I need to avoid absolute paths - would like to have a way of defining relative path to the utility class. I also don't want to replicate resources over multiple projects. Cheers. EDIT: To give a context I have a definition of tables in XML file that needs to be cleared after Integration Tests (clear whole DB schema). Integration Tests sits in multiple project, but the clear script and resource file is the same for all of them and sits in common parent project. EDIT2: Bonus question: I would like to access common DTD file (let's call it tables.dtd) that need to be accessed from XML files from multiple other projects. (it will sit in common parent project). Currently I have it duplicated over multiple project, and I refer to it from XML using directive: &lt;!DOCTYPE dataset SYSTEM "src/test/resources/dbunit/dobs.dtd"&gt; How to point it to a file in different project?
type: AnsweredQuestion

http://stackoverflow.com/comment/31963401
has text: Nothing more, sadly =/
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21222085
score: 0

http://stackoverflow.com/a/21305993
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21305172
answers question: http://stackoverflow.com/q/21305172
type: AcceptedAnswer
downvote count: 0
has body: They will each have different initialization times because MySql will parse each type of call differently to create the plan. After thet (for comparison purposes) they will all have the same plan and execution time will be the same from then on.

http://stackoverflow.com/q/21236105
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31988921
has answer: http://stackoverflow.com/a/21236174
has body: I have a directory which contains xml Files : 20140110-093721565_TOTO.xml 20140110-093821565_TATA.xml 20140110-094021565_TOTO.xml 20140110-091021565_TOTO.xml 20140110-093921565_TATA.xml .... 20140110-091021565_TETE.xml The first part of the file name represents the time the file was generated : 20140110-09102156 20140110 = Date 09102156 = Hour and the last part is used to identify the file : TOTO What I want is to list the last version of each files like : 20140110-091021565_TOTO.xml 20140110-093821565_TATA.xml How can I define a FileNameFilter ?
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31988223
tagged with: java
has answer: http://stackoverflow.com/a/21236431
accepted answer: http://stackoverflow.com/a/21236431
type: Question
has title: How to list latest files in a directory using FileNameFilter
has answer: http://stackoverflow.com/a/21236161
tagged with: java-io
possible better answer: http://stackoverflow.com/a/21236161
answer count: 3
tagged with: file-io

http://stackoverflow.com/a/21297278
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21297241
downvote count: 0
type: Answer
has body: When comparing char values, it's confusing to compare a char to an int value as you've done here: if(code==7&amp;&amp;prm.substring(4).equals("bG")) // specifically, code==7 You need to find the character '7', not the ASCII character whose int value is 7, "bel". Try if(code == '7' &amp;&amp; prm.substring(4).equals("bG")) You'll want to add an additional restriction that prm.length() == 6, to enforce that the promotion code must be 6 characters long.

http://stackoverflow.com/q/21217414
has comment: http://stackoverflow.com/comment/31954491
tagged with: file-io
type: Question
has comment: http://stackoverflow.com/comment/31954627
score: 1
has answer: http://stackoverflow.com/a/21217468
answer count: 2
has title: Read and write a file using filereader and filewriter
upvote count: 1
tagged with: java
tagged with: filewriter
has body: I'm writing a simple Java application and I'm stuck with filereader and filewriter. My problem is how to search "birds" and output dove, pigeon and parrot. Sample text file. { :birds: 1a:dove 2a:pigeon } ${ :reptiles: 1a:snake 2a:crocodile } ${ :birds: 1a:parrot 2a:dove } Code: import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class bspReader { public static void main(String[] args) { bspReader fileReaderService = new bspReader(); fileReaderService.performExecute("birds"); } public void performExecute(String inputPattern) { List&lt;String[]&gt; matches = new ArrayList&lt;String[]&gt;(); try { FileInputStream fileInputStream = new FileInputStream("C:/desktop"); DataInputStream dataInputStream = new DataInputStream(fileInputStream); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(dataInputStream)); String strLine; while ((strLine = bufferedReader.readLine()) != null) { } } catch (Exception e) { e.printStackTrace(); } } }
has answer: http://stackoverflow.com/a/21218166
downvote count: 0
type: UnansweredQuestion
favorite count: 0

http://stackoverflow.com/comment/32008211
has text: Updated the answer with some links.
type: AnswerComment
comment on: http://stackoverflow.com/a/21232753
type: Comment
score: 1

http://stackoverflow.com/a/21339669
type: Answer
score: 1
has body: A common problem with Maven is that sometimes you have dependencies conflicts, especially when you inherit dependencies from a parent POM. The parent POM might define a version of the library, and your POM define a newer one. From here, there are two possibilities: -The class not found is included in the older version, but not in the new one, and the new is the one that is being used. In fact, this could happen without the need of conflicting dependencies to exist: you can just have included the newest version instead of the old one. -The class not found is included in the newer version, but the dependency management causes the old version to be the one used. Check your dependencies map, and you will find if there is any conflict between versions.
upvote count: 1
answers question: http://stackoverflow.com/q/21339499
has comment: http://stackoverflow.com/comment/32173811
accepted answer of: http://stackoverflow.com/q/21339499
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31901843
has text: Excuse-me, I missed some spaces
type: AnswerComment
comment on: http://stackoverflow.com/a/21187800
type: Comment
score: 0

http://stackoverflow.com/a/21232886
score: 1
has comment: http://stackoverflow.com/comment/31982210
upvote count: 1
has comment: http://stackoverflow.com/comment/32317571
downvote count: 0
has body: Create a subclass of CheckedTreeSelectionDialog and add addCheckStateListener, use the below code. // When user checks a checkbox in the tree import org.eclipse.jface.viewers.CheckStateChangedEvent; import org.eclipse.jface.viewers.CheckboxTreeViewer; import org.eclipse.jface.viewers.ICheckStateListener; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog; public class MyCheckedTreeSelectionDialog extends CheckedTreeSelectionDialog { public MyCheckedTreeSelectionDialog(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider) { super(parent, labelProvider, contentProvider); } @Override protected CheckboxTreeViewer getTreeViewer() { CheckboxTreeViewer treeViewer = super.getTreeViewer(); treeViewer.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { if (event.getChecked()) { // Given element is checked } else { // Given element is un-checked // Your message here } } }); return treeViewer; } }
has comment: http://stackoverflow.com/comment/32534440
has comment: http://stackoverflow.com/comment/32378914
answers question: http://stackoverflow.com/q/21232675
has comment: http://stackoverflow.com/comment/32364843
type: Answer
has comment: http://stackoverflow.com/comment/32322784
has comment: http://stackoverflow.com/comment/32534765

http://stackoverflow.com/comment/60166723
has text: Why does it matter if you have an internet connection or not `distanceBetween` does not make a network call
comment on: http://stackoverflow.com/a/21199031
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21293631
has comment: http://stackoverflow.com/comment/32089521
type: Answer
has body: onListItemClick only called if row has not click-able child in it. Code snipt from code final int pos = position; btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub wallpapers.remove(pos); notifyDataSetChanged(); } }); Your view has onClickListener, so onListItemClick will not work any more. But There is workaround for such things, you make whole view click-able and set position as Tag of view.
has comment: http://stackoverflow.com/comment/32089487
has comment: http://stackoverflow.com/comment/32089435
answers question: http://stackoverflow.com/q/21293268
score: 0

http://stackoverflow.com/a/21287403
score: 0
type: Answer
has body: Using your example, simply specify which group you want when printing, which for your purposes would be group 2: System.out.println(matcher.group(2).toString()); Additionally, considering you get "no output", you should ensure your input string "test" actually contains what you think it does. I recommend this based on the fact that your code does work and it should print the entire match as is.
answers question: http://stackoverflow.com/q/21287278

http://stackoverflow.com/q/21293856
score: 0
has answer: http://stackoverflow.com/a/21325014
linked to: http://stackoverflow.com/q/14251509
accepted answer: http://stackoverflow.com/a/21325014
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21490541
has body: I'm trying to use the Java Spatial Index Library, but can't get the examples to load. When I try to open the following file, from the examples, in Eclipse Kepler, Eclipse complains about TIntProcedure not being able to be resolved: package net.sourceforge.jsi.examples; import gnu.trove.*; import java.util.ArrayList; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.infomatiq.jsi.Rectangle; import com.infomatiq.jsi.SpatialIndex; import com.infomatiq.jsi.rtree.RTree; public class Contains { private static final Logger log = LoggerFactory.getLogger(Contains.class); public static void main(String[] args) { new Contains().run(); } private void run() { // Create and initialize an rtree SpatialIndex si = new RTree(); si.init(null); // We have some points or rectangles in some other data structure. // The rtree can handle millions of these. Rectangle[] rects = new Rectangle[] { new Rectangle(0, 0, 0, 0), new Rectangle(0, 1, 0, 1), new Rectangle(1, 0, 1, 0), new Rectangle(1, 1, 1, 1), }; // Add our data to the rtree. Every time we add a rectangle we give it // an ID. This ID is what is returned by querying the rtree. In this // example we use the array index as the ID. for (int i = 0; i &lt; rects.length; i++) { si.add(rects[i], i); } // Now see which of these points is contained by some // other rectangle. The rtree returns the results of a query // by calling the execute() method on a TIntProcedure. // In this example we want to save the results of the query // into a list, so that's what the execute() method does. class SaveToListProcedure implements TIntProcedure { private List&lt;Integer&gt; ids = new ArrayList&lt;Integer&gt;(); @Override public boolean execute(int id) { ids.add(id); return true; }; private List&lt;Integer&gt; getIds() { return ids; } }; SaveToListProcedure myProc = new SaveToListProcedure(); si.contains(new Rectangle(-0.5f, -0.5f, 1.5f, 0.5f), myProc); List&lt;Integer&gt; ids = myProc.getIds(); for (Integer id :…
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/21490541
answer count: 2
has title: TIntProcedure cannot be resolved
tagged with: jar

http://stackoverflow.com/comment/31933865
comment on: http://stackoverflow.com/a/21205515
score: 0
has text: No, VAOs are what store the enabled/disabled attribute pointer state. Initially, VAOs start out with all attribute pointers disabled. GLSL programs definitely use the attributes, but VAOs control whether or not to use (enable) a data pointer for each attribute.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21248197
answers question: http://stackoverflow.com/q/21234374
upvote count: 1
has comment: http://stackoverflow.com/comment/32586088
downvote count: 0
score: 1
has body: There's a couple of things that do not work in your code. First the code to build the tree can be much simplified like this: public JTreeEvents() throws ClassNotFoundException, SQLException { // ... fill the array list from the database .. for (String path: arrayList) { DefaultMutableTreeNode currentParent = root; String[] pathComponents = path.split("/"); for (String comp: pathComponents) { DefaultMutableTreeNode child = findChild(currentParent, comp); if (child == null) { child = new DefaultMutableTreeNode(comp); currentParent.add(child); } currentParent = child; } } model = new DefaultTreeModel(root); jtree = new JTree(model); // ... build the rest of the GUI components } private DefaultMutableTreeNode findChild(DefaultMutableTreeNode parent, String s) { for (int i=0; i&lt;parent.getChildCount(); i++) { DefaultMutableTreeNode child = (DefaultMutableTreeNode) parent.getChildAt(i); if (s.equals(child.getUserObject())) return child; } return null; } The second thing is that JPanel comes by default with no layout, so you need to add one explicitely, before adding any component to it: this.setLayout(new BorderLayout()); So the full code of JTreeEvent becomes, after getting rid of all the unused variable declarations: public class JTreeEvents extends JPanel { private String driver = new String("com.mysql.jdbc.Driver"); private String url = new String("jdbc:mysql:"); private String user = new String("root"); private String password = new String("128"); private Connection dbCon; List&lt;String&gt; arrayList; PreparedStatement ps = null; java.sql.Statement s; ResultSet r; DefaultMutableTreeNode root = new DefaultMutableTreeNode("/"); DefaultTreeModel model; JTree jtree; JTextField jtf; public JTreeEvents() throws ClassNotFoundException, SQLException { Class.forName(driver); dbCon = DriverManager.getConnection(url, user, password); s = dbCon.createStatement(); r = s.executeQuery("SELECT * FROM project p where p.name='MyFolder4'"); arrayList = new ArrayList&lt;String&gt;();…
type: Answer

cygwin
tags question: http://stackoverflow.com/q/21241341
type: Tag
tag name: cygwin

http://stackoverflow.com/comment/31935773
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21206962
score: 2
has text: http://stackoverflow.com/questions/2238272/java-thread-affinity probably should answer your question.

http://stackoverflow.com/a/21252927
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21242268
answers question: http://stackoverflow.com/q/21242268
has body: You can use CheckBox column without writing custom renderer/editor, just overriding getColumnClass() method of TableModel. Here is simple example for your with CheckBox column: import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; public class Example extends JFrame { public static void main(String... s){ new Example(); } public Example(){ DefaultTableModel model = new DefaultTableModel(4,4) { @Override public boolean isCellEditable(int row, int column) { return column == 3; } @Override public Class&lt;?&gt; getColumnClass(int columnIndex) { if(columnIndex == 3){ return Boolean.class; } return super.getColumnClass(columnIndex); } }; JTable t = new JTable(model); add(new JScrollPane(t)); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); } }
type: Answer
score: 3
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/q/21212766
tagged with: yourkit
tagged with: profiling
has body: In my application, a new JVM is launched when ever a new resource is created. I am able to profile the newly launched JVM by connecting it in yourkit. Right now I am able to connect to JVM only after it is ready and after that I am able to profile it but i want to profile the JVM methods while is is coming up i.e profile the methods calls of the JVM while it is initializing. Is there any way i can achieve this? Reason for this is, some methods which are only invoked during initialization are causing some problem and those can't be profiled once the JVM is created and is ready. Thanks
tagged with: jvm
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21213083
has title: Method level profiling of newly launched JVM
score: 0
has comment: http://stackoverflow.com/comment/31946777
tagged with: java
has answer: http://stackoverflow.com/a/21327454
type: UnansweredQuestion

http://stackoverflow.com/comment/31956781
type: QuestionComment
comment on: http://stackoverflow.com/q/21218557
score: 0
type: Comment
has text: Basically you create a new [BufferedImage](http://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferedImage.html#getGraphics%28%29) and then draw other images into the buffer with [drawImage()](http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics.html#drawImage%28java.awt.Image,%20int,%20int,%20int,%20int,%20java.awt.image.ImageObserver%29)

http://stackoverflow.com/comment/31991298
comment on: http://stackoverflow.com/q/21237503
type: QuestionComment
type: Comment
has text: parameter input for Iterables.find - Iterables
score: 0

http://stackoverflow.com/q/21211502
has answer: http://stackoverflow.com/a/21211526
has body: I understand how mostly everything works in a loop in Java but I came to a realization that I am failing to understand one thing which is The Order a Loop Operates. Basically I am failing to understand this because of this simple but boggling piece of code that was displayed in my class, the code is displayed below. public class Test { public static void main (String[] args) { int sum = 0; for (int k = 1; k &lt; 10; k += 2) { sum += k; System.out.print(sum + " "); } } } The output the program puts out is 1 4 9 16 25 Now I understand how it repeats and spits out the numbers but how does it go about even creating 1. Now you can say it created 1 by taking k and adding it to sum but shouldn't k be equaling 3? It goes k = 1; This sets k equal to 1. k &lt; 10; Checks if k is less than 10. Then the question is when k += 2; Shouldn't k now equal to 3 but instead sum is now somehow equal to 1 after this operation occurred of adding 2 to 1, 2 + 1 = 3 but 3 + 0 = 1? How does this even go about. My rationalizing for this is that any program I thought was to interpret code line by line or uniformly and not jumping around. Overall my question is, how is sum equal to 1 when k is actually equal to 3.
tagged with: loops
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21211534
type: Question
answer count: 8
downvote count: 2
has answer: http://stackoverflow.com/a/21692088
accepted answer: http://stackoverflow.com/a/21211536
has answer: http://stackoverflow.com/a/21211549
has answer: http://stackoverflow.com/a/21211795
upvote count: 3
has answer: http://stackoverflow.com/a/21211544
has title: Trying To Understand The For Loop Completely
has answer: http://stackoverflow.com/a/21211536
possible better answer: http://stackoverflow.com/a/21211534
favorite count: 0
has answer: http://stackoverflow.com/a/21211553

http://stackoverflow.com/comment/31947843
has text: would return Integer.toBinaryString(dotwosComp); work?
comment on: http://stackoverflow.com/a/21213445
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31988092
type: Comment
type: QuestionComment
has text: Manifest added. It displays the toast immeddiately instead of waiting the set amount of time. I find it very odd that this worked a couple hours ago and now not anymore..
score: 0
comment on: http://stackoverflow.com/q/21235567

http://stackoverflow.com/q/21329662
tagged with: red-black-tree
score: 32
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32155774
type: AnsweredQuestion
tagged with: java
tagged with: treemap
has answer: http://stackoverflow.com/a/21331561
accepted answer: http://stackoverflow.com/a/21331561
has body: I was going through the source code of TreeMap in JAVA. As per JAVA doc: A Red-Black tree based NavigableMap implementation. The map is sorted according to the natural ordering of its keys, or by a Comparator provided at map creation time, depending on which constructor is used. This implementation provides guaranteed log(n) time cost for the containsKey, get, put and remove operations. Algorithms are adaptations of those in Cormen, Leiserson, and Rivest's Introduction to Algorithms. In the source code I found that an Inner Class Entry was used as a node. static final class Entry<K,V> implements Map.Entry<K,V> { K key; V value; Entry<K,V> left = null; Entry<K,V> right = null; Entry<K,V> parent; boolean color = BLACK; .... As for the defination of Red-Black tree. From Wikipedia I found: A red–black tree is a type of self-balancing binary search tree, a data structure used in computer science. The self-balancing is provided by painting each node with one of two colors (these are typically called 'red' and 'black', hence the name of the trees) in such a way that the resulting painted tree satisfies certain properties that don't allow it to become significantly unbalanced. When the tree is modified, the new tree is subsequently rearranged and repainted to restore the coloring properties. The properties are designed in such a way that this rearranging and recoloring can be performed efficiently. I tried to analyse the souce code but couldn't understand the following: Suppose I am already having two keys "C" and "E" in the Tree and then I am adding "D". How the nodes will be arranged (Using natural ordering). How is self-balancing of Tree is implemented in the java source code. I tried searching for detail implementationof TreeMap but was unable to find any article such as the following article I have found for HashMap Since yesterday I am hanging on this Tree :( Can someone please help me get down...
answer count: 1
has title: Explanation of Red-Black tree based implementation of TreeMap in JAVA
favorite count: 0
upvote count: 33

http://stackoverflow.com/comment/32173390
type: QuestionComment
comment on: http://stackoverflow.com/q/21339088
score: 0
has text: @DavidLevesque Thank you again for a very insightful answer. I added `DROP TABLE IF EXISTS facilityAddresses;` to the sql that creates the database and unearthed a new error, which I have written up in an edited version of my original post above. Are you willing to please help me get this to work? I am trying not to post multiple questions on this, and I have been working on this problem for days now.
type: Comment

http://stackoverflow.com/q/21303628
score: 0
tagged with: resourcebundle
answer count: 2
has title: In the Struts , How 'replacement values for message' in ActionMessage can be picked from ResourceBundle
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32107126
has answer: http://stackoverflow.com/a/21304000
has comment: http://stackoverflow.com/comment/32106992
has body: What I did to achieve it. Action File: ResourceBundle rb = ResourceBundle.getBundle("com.....ApplicationResources"); String title=rb.getString("entity.member"); messages.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("message.save",title )); Application Resource : entity.member=Member entity.Locker=Locker message.save={0} saved successfully What I want is: There is a short route to replace 'replacement values for message' with hard coded word 'Member'. like messages.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("message.save","Member" )); But 1. MessageResources resources = getServlet().getInternal().getMessageResources("com....ApplicationResources") 2. ResourceBundle rb = ResourceBundle.getBundle("com.....ApplicationResources"); 3. String title = getResources(request).getMessage(getLocale(request), "entity.member"); messages.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("message.save",title )); Above three are the long routes to replace 'replacement values for message' with respective language wording. Looking for short route like I had for hard coding.
has answer: http://stackoverflow.com/a/21308831
type: Question
tagged with: java
tagged with: struts
tagged with: messageformat

http://stackoverflow.com/comment/31918990
has text: Even so, it really doesn't sound like you're using `toString()` as intended. It's really not meant for that.
comment on: http://stackoverflow.com/a/21197210
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21283867
downvote count: 0
has comment: http://stackoverflow.com/comment/32072411
has comment: http://stackoverflow.com/comment/32072834
accepted answer: http://stackoverflow.com/a/21284329
favorite count: 0
has comment: http://stackoverflow.com/comment/32072101
has comment: http://stackoverflow.com/comment/32072058
has comment: http://stackoverflow.com/comment/32072243
has comment: http://stackoverflow.com/comment/32071807
has comment: http://stackoverflow.com/comment/32072461
has comment: http://stackoverflow.com/comment/32071808
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32072117
has comment: http://stackoverflow.com/comment/32071690
has comment: http://stackoverflow.com/comment/32075309
upvote count: 7
has comment: http://stackoverflow.com/comment/32072312
has comment: http://stackoverflow.com/comment/32071959
type: Question
has comment: http://stackoverflow.com/comment/32072322
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/32072452
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32072918
has answer: http://stackoverflow.com/a/21284329
has comment: http://stackoverflow.com/comment/32075740
has comment: http://stackoverflow.com/comment/32071903
has body: I have a strange problem with variable initialization. There is following code: public void test() { StringBuilder buf; org.junit.Assert.assertFalse((buf = new StringBuilder("qwe3")).toString().isEmpty()); org.junit.Assert.assertEquals("", buf.toString()); // The local variable buf may not have been initialized } What??? Variable is initialized, what is wrong? also when I change org.junit.Assert.assertFalse to my own local method error disappears. private static void assertFalse(final boolean o) throws Exception { } I am using jdk 1.7.0_51 if that matters. Class code is here
has title: Strange variable initialization error
has comment: http://stackoverflow.com/comment/32073018
answer count: 1

http://stackoverflow.com/comment/52033397
type: Comment
type: AnswerComment
has text: @Joop Eggen will it also work in case of a stored procedure, `lp_dyn:LOOP` I have this in a dynamic stored procedure I have to write, but it gives me an error when I escape it with '//'
comment on: http://stackoverflow.com/a/21263929
score: 0

http://stackoverflow.com/q/21211964
type: Question
has comment: http://stackoverflow.com/comment/31947929
tagged with: keylistener
has comment: http://stackoverflow.com/comment/31947004
has comment: http://stackoverflow.com/comment/31945240
has comment: http://stackoverflow.com/comment/31945307
score: 0
has body: I am looking for a way to create a searchbox linked to a jlist, so that when the user types a sequence of characters, it will search and match to a JList item, then highlight that item. I have created a jtextfield and added a keylistener. This part of the code works properly, but only for the first character the user types. I am trying to expand this to any number of characters the user types. Any ideas how to achieve that? Thank you in advance String[] feedStrings = {"aaa", "abc", "opo","oiuu"} JList feedList = new JList(feedStrings); feedList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); feedList.setLayoutOrientation(JList.VERTICAL); feedList.setVisibleRowCount(4); JTextField searchbox = new JTextField(); searchbox.setColumns(8); searchbox.setVisible(true); searchbox.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { String text = "" + e.getKeyChar(); StringBuffer buffer = new StringBuffer(); buffer.append(text); String strbuf = buffer.toString(); int index = feedList.getNextMatch(strbuf, 0, Position.Bias.Forward); System.out.println(index); feedList.setSelectedIndex(index); } });
answer count: 1
has answer: http://stackoverflow.com/a/21213048
favorite count: 0
has comment: http://stackoverflow.com/comment/31945317
type: UnansweredQuestion
tagged with: jlist
has title: Search for a JList
tagged with: java
upvote count: 1
tagged with: swing
tagged with: jtextfield
downvote count: 1

http://stackoverflow.com/q/21297925
downvote count: 0
score: 1
tagged with: java
tagged with: methods
linked to: http://stackoverflow.com/q/1514910
has title: removeDuplicates method not remove all of the duplicated integers in a list
type: Question
has comment: http://stackoverflow.com/comment/32098716
tagged with: nested-loops
has comment: http://stackoverflow.com/comment/32099926
linked to: http://stackoverflow.com/q/2435156
has comment: http://stackoverflow.com/comment/32097856
has comment: http://stackoverflow.com/comment/32097553
answer count: 3
has comment: http://stackoverflow.com/comment/32097444
upvote count: 1
has body: I am working on an assignment and i have everything working well, I have a list that I have randomly created, and now I have to call a method that removes any duplicated integers in the list. My list size is 100, and when I call my removeDuplicates method it removes most of the duplicates but does not remove all of them. I am wondering if someone can take a look at my method and see why it is doing this. Thanks. Here is my code: int size = A.size(); for (int i = 0; i &lt; size -1; i++) { for (int j = i + 1; j &lt; size;) { if (A.get(i) == A.get(j)) { A.remove(j); size--; } else j++; } } Here is my full class: public class Utility { public static void selectionSort(List&lt;Integer&gt; A) { int smIndex, sm; for (int i = 0; i &lt; A.size(); i++) { sm = A.get(i); smIndex = i; for (int k = i; k &lt; A.size(); k++) { if (sm &gt; A.get(k)) { sm = A.get(k); smIndex = k; } } if (smIndex == i) ; else { int temp = A.get(i); A.set(i, A.get(smIndex)); A.set(smIndex, temp); } } } public static void removeDuplicates(List&lt;Integer&gt; A) { /*for (int i = 0; i &lt; A.size() -1; i++) { for (int j = i + 1; j &lt; A.size();) { if (A.get(i) == A.get(j)) { A.remove(j); } else j++; } }*/ for (int i = 0; i &lt; A.size(); i++) { for (int j = 0; j &lt; A.size(); j++) { if (i == j) ; else if (A.get(i) == A.get(j)) { A.remove(A.get(j)); j = j-1; } else ; } } } } This is the test program ( I am just hard coding the 100 for now until i get the remove duplicates figured out): public class PA1Test extends StopWatch { public static void main(String[] args) { int n = 100; List&lt;Integer&gt; list = new Vector&lt;Integer&gt;(); for (int i = 0; i &lt; n; i++) { list.add((int) (Math.random()*2*n)); } start(); selectionSort(list); stop(); System.out.println("Execution Time: " + getElapsedTime() + " milliseconds"); if (n &gt; 100) { removeDuplicates(list); System.out.println(list); } else { System.out.println(list); removeDuplicates(list); System.out.println(list); } } }
has comment: http://stackoverflow.com/comment/32097227
has comment: http://stackoverflow.com/comment/32097309
has answer: http://stackoverflow.com/a/21299465
has answer: http://stackoverflow.com/a/21298146
has comment: http://stackoverflow.com/comment/32098505
favorite count: 0
has answer: http://stackoverflow.com/a/21299136
type: UnansweredQuestion
tagged with: list

jtable
tags question: http://stackoverflow.com/q/21205791
tags question: http://stackoverflow.com/q/21205389
tags question: http://stackoverflow.com/q/21211042
tags question: http://stackoverflow.com/q/21241860
tags question: http://stackoverflow.com/q/21236101
tags question: http://stackoverflow.com/q/21242268
tags question: http://stackoverflow.com/q/21324844
tags question: http://stackoverflow.com/q/21320732
type: Tag
tags question: http://stackoverflow.com/q/21186136
tags question: http://stackoverflow.com/q/21312408
tags question: http://stackoverflow.com/q/21288936
tags question: http://stackoverflow.com/q/21334940
tag name: jtable
tags question: http://stackoverflow.com/q/21187310
tags question: http://stackoverflow.com/q/21194556
tags question: http://stackoverflow.com/q/21347647
tags question: http://stackoverflow.com/q/21254977
tags question: http://stackoverflow.com/q/21296241
tags question: http://stackoverflow.com/q/21340941
tags question: http://stackoverflow.com/q/21228464
tags question: http://stackoverflow.com/q/21199849
tags question: http://stackoverflow.com/q/21282946
tags question: http://stackoverflow.com/q/21219494

http://stackoverflow.com/comment/32008981
comment on: http://stackoverflow.com/q/21247543
has text: @HovercraftFullOfEels a final class is just what it says. `final class MyClass{...}`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21241065
type: Answer
has comment: http://stackoverflow.com/comment/32790643
upvote count: 1
has comment: http://stackoverflow.com/comment/32790659
downvote count: 0
has body: Just to get it out of the way so that we're not asking you the same basic questions. Did you go off the instructions at https://devcenter.heroku.com/articles/newrelic and pay close attention to the Java configuration at https://devcenter.heroku.com/articles/newrelic#java-configuration? That should get you going in the right direction. Let us know if this does the trick or if you need further help. There is a ticket associated with this that we can continue to troubleshoot further, if needed.
score: 1
answers question: http://stackoverflow.com/q/21231687

http://stackoverflow.com/comment/32071334
type: QuestionComment
score: 0
has text: I see the point of volatile but what if I don't have such reference but I retrieve shared objects from a map<Id,Shared>? How can I use here volatile? Shall I use map<Id,AtomicReference<Shared>> with the immutable approach?
type: Comment
comment on: http://stackoverflow.com/q/21283293

http://stackoverflow.com/q/21312426
has comment: http://stackoverflow.com/comment/32122207
answer count: 2
accepted answer: http://stackoverflow.com/a/21312880
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21312880
possible better answer: http://stackoverflow.com/a/21312738
has body: I am looking for a snippet in java that replaces the "..", "/" or "\" or ":" - FileSeperator characters with "" in a fileName property passed from UI. This should be OS independent. Also I dont want to remove the "single dot", only "two dots" Currently i wrote a snippet private static void filter(){ // should not remove the Single Dot String fileName = "/user/../142552/ReportFile.txt" fileName = fileName.replaceAll("[/|\\|..|:|]",""); System.out.println("fileName " + fileName); } Output fileName user142552ReportFiletxt Expected Output fileName user142552ReportFile.txt
has title: Java replaceAll to replace special characters
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
linked to: http://stackoverflow.com/q/1099859
has comment: http://stackoverflow.com/comment/32124534
type: Question
has comment: http://stackoverflow.com/comment/32122618
has answer: http://stackoverflow.com/a/21312738

http://stackoverflow.com/comment/31993746
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21221085
type: QuestionComment
has text: Looks like a regression indeed. It works with 2.11.1. But then for some strange reasons restlet does not appear to work with 2.11.1. Maybe the way I use it.

http://stackoverflow.com/comment/32066427
type: Comment
has text: If you do it using Java MongoDB driver or Spring the update operation will be atomic. Note however that you can encounter a lost update. "your" connection issues a find query, manipulate the BSON as Java object. Meanwhile some other connection can update the document your object represents. So once you issue an update. The previous updated data will be lost.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21279874

http://stackoverflow.com/comment/31933292
comment on: http://stackoverflow.com/q/21205321
type: Comment
type: QuestionComment
has text: Then Howard Guo has your solution, and you should accept his answer. Give your Ran class a Ran variable and pass a reference to the next Ran variable link via a setter method. But don't use infinite recursion without a good reason, and without a good stopping condition.
score: 0

character
tags question: http://stackoverflow.com/q/21254187
tags question: http://stackoverflow.com/q/21248634
tag name: character
type: Tag

http://stackoverflow.com/q/21334940
score: 1
tagged with: java
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/32162287
has comment: http://stackoverflow.com/comment/32162363
tagged with: arraylist
tagged with: jtable
upvote count: 1
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32163103
has comment: http://stackoverflow.com/comment/32162480
has comment: http://stackoverflow.com/comment/32162164
linked to: http://stackoverflow.com/q/9554636
has comment: http://stackoverflow.com/comment/32162630
has comment: http://stackoverflow.com/comment/32164167
has body: private void tblRoleMouseClicked(java.awt.event.MouseEvent evt) { if(evt.getClickCount() == 2) { int row = tblRole.getSelectedRow(); int column = tblRole.getSelectedColumn(); new ViewStaff().setVisible(true); } } how to get the data in ViewStaff JFram based on double click in JTable??? After I double clicked to the JTable, then pop out a JFrame. Inside that JFrame, I want to show out the details that I double clicked it...the data inside JTable I already stored in ArrayList. List&lt;Admin&gt; adminList = new ArrayList&lt;Admin&gt;();
has comment: http://stackoverflow.com/comment/32162366
downvote count: 0
answer count: 0
has title: how to get the data in jframe based on double click in jtable

http://stackoverflow.com/q/21340127
possible better answer: http://stackoverflow.com/a/21340330
has answer: http://stackoverflow.com/a/21340330
accepted answer: http://stackoverflow.com/a/21340268
answer count: 2
downvote count: 0
favorite count: 0
has body: I am trying to make a TimeLine somewhat similar to Facebook or Instagram. More closer to Instagram. In Images loading i am using library UniversalImageLoader. Each of my ListView item row is probably more than 600dp in height. Usually I am fetching 5 items at a time. The problem that occurs now is, The images when scroll a little fast replace each other. Since the views are being reused. It takes about 3-4 seconds for images to show up otherwise wrong images will be displayed in listView Row. 1- If anyone can know how to optimise/fix this fast scroll ImageOverlap issue Otherwise, 2- What is the way to record EntireView , let's say in some "ArrayList" and placing it at current position. Noting that there are quite other stuff happening too , not only mediaDp being changed. if (convertView == null) { view = inflator.inflate(R.layout.timeline_list_row, parent, false); viewHolder.userDp = (RoundedImageView) view.findViewById(R.id.userDp); viewHolder.mediaDp = (ImageView) view.findViewById(R.id.imagePostedMedia); /************ Set holder with LayoutInflater ************/ view.setTag(viewHolder); final ViewHolder newHolder = viewHolder; } else viewHolder = (ViewHolder) view.getTag(); imageLoader.displayImage(media.imagePath, viewHolder.mediaDp);
tagged with: android
has answer: http://stackoverflow.com/a/21340268
type: AnsweredQuestion
tagged with: universal-image-loader
linked to: http://stackoverflow.com/q/18131959
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Fast Scroll In ListView optimizing using UniversalImageloader or using references of Views

http://stackoverflow.com/a/21272891
type: Answer
upvote count: 1
has body: It's hard to tell without knowing the assignment specifications but it seems to me that you really want the putThings() functionality to be a part of the constructor. What you need to do is declare private int size; at the very beginning of the entire class (before the constructor). You declare it with no value just so that the compiler knows that this object (the DistributeBot) will have an attribute called size that is a private int . You can declare your attributes as public, default, private, or protected. In most cases, you should set your attributes to private so you can't accidentally tinker with them outside of the class in which the object was created. Default would just be int size; In order to modify a private variable, you create getters and setters conventionally named getVariable() and setVariable(type var) where getVariable returns a variable of whatever type the variable being retrieved is and setVariable is a void function that sets the variable. This privacy 'encapsulates' the attributes (or the methods, like you have done already) in a class so that, like I mentioned earlier, no one can call them from outside of the class in which the object was created. So in between the constructor and the beginning of the class you will put private int size; and then in your constructor you should change the paramaters to add (int size) to it. public class DistributeBot extends RobotSE { private int size; //note that although you can't see it unless you scroll to the right //the constructor now has 'int size' as the last parameter public DistributeBot(City aCity, int aStreet, int anAvenue, Direction aDirection, int numThings, int size) { super(aCity, aStreet, anAvenue, aDirection, numThings); //you technically DON'T have to do this next line if you //don't create the attribute 'size' for this class but you //probably should. It's hard to tell from your description. this.setSize(size); //notice how below I use 'this.size' because this //object officially has an …
score: 1
accepted answer of: http://stackoverflow.com/q/21272668
answers question: http://stackoverflow.com/q/21272668
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32053790

http://stackoverflow.com/comment/32138274
type: AnswerComment
type: Comment
has text: This is kind of erroneous, sorry. `getSelectedObjects` only returns a single element array and according to the doc is implemented for compatibility reasons with ItemSelectable. Also you don't need to call toString if an object is in a String concatenation expression: it is called automatically.
score: 0
comment on: http://stackoverflow.com/a/21320817

http://stackoverflow.com/q/21326931
possible better answer: http://stackoverflow.com/a/21327956
upvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/32149804
favorite count: 0
has title: Could not execute JDBC batch update:Exception in thread "main" org.hibernate.exception.ConstraintViolationException:
has answer: http://stackoverflow.com/a/21327956
score: 2
has answer: http://stackoverflow.com/a/21327903
accepted answer: http://stackoverflow.com/a/21327903
downvote count: 0
tagged with: java
tagged with: hibernate
tagged with: mysql
has body: I am new to hibernate programming Please help me out, I have problem while executing the below files.I am using MySQL Database. My error is SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Hibernate: insert into UserDetails (userName) values (?) Hibernate: insert into UserDetails (userName) values (?) Hibernate: insert into UserDetails (userName) values (?) Hibernate: insert into vehicle (vehiName) values (?) Hibernate: insert into vehicle (vehiName) values (?) Hibernate: insert into UserDetails_vehicle (UserDetails_userID, vehi_vehiID) values (?, ?) Hibernate: insert into UserDetails_vehicle (UserDetails_userID, vehi_vehiID) values (?, ?) Hibernate: insert into UserDetails_vehicle (UserDetails_userID, vehi_vehiID) values (?, ?) Exception in thread "main" org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:188) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133) at com.annt.java.UserTest.main(UserTest.java:34) Caused by: java.sql.BatchUpdateException: Duplicate entry '1' for key 'vehi_vehiID' at com.mysql.jdbc.PreparedStatement.execut…
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/39911426

http://stackoverflow.com/comment/32179589
score: 0
has text: @chuckj That would be equivalent to iterating the array, discarding any negative numbers. Then, using the standard sort logic.
type: QuestionComment
comment on: http://stackoverflow.com/q/21343780
type: Comment

http://stackoverflow.com/a/21238382
has body: Your code is correct in that it will sort the array. However it will always require N*(N-1) passes over the array. This is not the typical algorithm used to implement a bubble sort. The typical algorithm uses repeat loop with a test for sorted. This is somewhat more efficient because it terminates as soon as the array is sorted (consider the case where you start with a sorted array). Read the Wikepedia article on bubble sort it demonstrates this very well. A somewhat improved version pseudocode version of Bubble Sort goes something like this: procedure bubbleSort( A : list of sortable items ) n = length(A) repeat swapped = false for i = 1 to n-1 inclusive do if A[i-1] &gt; A[i] then swap(A[i-1], A[i]) swapped = true end if end for n = n - 1 until not swapped end procedure The lesson here is that while your algorithm and the Wikepedia algorithm both have the same big O characteristics, a small change in the way they have been implemented can make a significant difference in their actual performance characteristics.
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21237877
score: 2

http://stackoverflow.com/q/21252905
has comment: http://stackoverflow.com/comment/32017521
possible better answer: http://stackoverflow.com/a/21252981
has answer: http://stackoverflow.com/a/21252981
has answer: http://stackoverflow.com/a/21252950
has title: Array that prints something every two columns
accepted answer: http://stackoverflow.com/a/21253077
downvote count: 6
score: -6
has comment: http://stackoverflow.com/comment/32017477
has comment: http://stackoverflow.com/comment/32017611
has answer: http://stackoverflow.com/a/21252951
tagged with: java
answer count: 5
has body: I know that I can do for (int i=0; i&lt;5; i++) { Can I make an array that prints something every two columns? The following is wrong. for(int i=0; i&lt;5; i+2) { or int k=2 for(int i=0; i&lt;5; i+k){
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/21253077
has answer: http://stackoverflow.com/a/21253141
favorite count: 0
type: Question

http://stackoverflow.com/comment/32050995
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21271480
score: 0
has text: Player p=(Player) ArrayList.get(1) and then access the P object variables ? is that what you want to do... that's what your questions title says maybe for(Object p : roster){Player x=(Player)roster.get(x); if (x.isAllstarts){some_counter++}}

http://stackoverflow.com/a/21286328
answers question: http://stackoverflow.com/q/21286109
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21286109
upvote count: 1
has body: Because the static field ObjectSizeFetcher.instrumentation was null when you called ObjectSizeFetcher.getObjectSize(x). You should call method ObjectSizeFetcher.premain(String args, Instrumentation inst) before, with a non-null inst argument.
type: AcceptedAnswer

http://stackoverflow.com/comment/32104019
type: Comment
has text: this cause `Resource Not Found Exception` because you can't set `char` to `TextView`, you must cast to String then set to `TextView`
type: AnswerComment
comment on: http://stackoverflow.com/a/21301984
score: 0

http://stackoverflow.com/q/21276265
linked to: http://stackoverflow.com/q/18381327
has comment: http://stackoverflow.com/comment/32103538
upvote count: 2
has comment: http://stackoverflow.com/comment/32104269
has comment: http://stackoverflow.com/comment/32103580
has comment: http://stackoverflow.com/comment/32103733
tagged with: webview
tagged with: youtube
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21301927
has answer: http://stackoverflow.com/a/21301927
tagged with: java
accepted answer: http://stackoverflow.com/a/21278140
type: Question
answer count: 2
has body: I am fetching the youtube id from my server and i make as youtube embed url,after that i am showing that youtube url in listview,while click the listitem the youtube video has to be play in webview,that is my requirement,i tried all the ways its not working for me,its displaying the blank page like this i am fetching from my server and make as youtube url app1.setUrlWiki("http://www.youtube.com/embed/"+json.getString("youtube_url")+"?fs=0"); this is my mainactivity.java lv2 =(ListView)findViewById(R.id.listV_main); lv2.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; a, View v, int position, long id) { Object o = lv2.getItemAtPosition(position); Application1 obj_itemDetails = (Application1)o; Intent intent1=new Intent(PoojaVideos.this,WebViewActivity.class); //Log.d("test","strContactList: "+strContactList); //intent1.putExtra("firstKeyName", Uri.parse(((Application1) o).getUrlWiki())); String link = Uri.parse(((Application1) o).getUrlWiki()).toString(); intent1.putExtra("firstKeyName", link); startActivity(intent1); } }); from there i am sending the url to webview activity according to the click webviewactivity.java audio alone coming ,but video is not showing public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.webview); //wv = (WebView) findViewById(R.id.webView); mContentView = (FrameLayout) findViewById(R.id.main_content); wv = (WebView) findViewById(R.id.webView); mCustomViewContainer = (FrameLayout) findViewById(R.id.fullscreen_custom_content); wv.getSettings().setJavaScriptEnabled(true); wv.getSettings().setPluginsEnabled(true); wv.setWebChromeClient(new WebChromeClient() { }); final String mimeType = "text/html"; final String encoding = "UTF-8"; String html = getHTML(); System.out.println(".................."+html); wv.loadDataWithBaseURL("", html, mimeType, encoding, ""); } public String getHTML() { Intent intent1= getIntent(); // gets the prev…
has comment: http://stackoverflow.com/comment/32103605
downvote count: 0
has title: Showing youtube video in webview its displaying the Blank page;while clicking the play button the screen will becomes blank
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/21278140

http://stackoverflow.com/q/21281470
tagged with: spring-aop
answer count: 1
has title: Extracting the annotation value using java reflection?
tagged with: spring
has comment: http://stackoverflow.com/comment/32072974
has body: I have below classes. I autowired someDao in service class as @Autowired SomeDao someDao. I call the logic in service as someDao.getName(2); SomeServiceImpl.java public class SomeServiceImpl{ @Autowired SomeDao someDao //call dao methods using someDao } SomeDao.java public interface SomeDao{ String getName(Int id); } SomeDaoImpl.java public class SomeDaoImpl implements SomeDao{ @CustomAnnotation("somevalue") public String getName(int id){ //logic } } SomeAspect.java @Around("execution(public * *(..)) &amp;&amp; @annotation(com.mycompany.CustomAnnotation)") public Object procedeNext(ProceedingJoinPoint call) throws Throwable { //Access annotation value MethodSignature signature = (MethodSignature) call.getSignature(); Method method = signature.getMethod(); CustomAnnotation myAnnotation = method.getAnnotation(CustomAnnotation.class); String name = myAnnotation.value(); //here i am expecting name value "somevalue" but it is returning null } CustomAnnotation has @Retention(RetentionPolicy.RUNTIME). In above aspect, String name = myAnnotation.value(); should give me somevalue but it is giving null. Any suggestion? But if I keep @CustomAnnotation("somevalue") in interface then it gives value. Is it good to annotate interface methods?
has answer: http://stackoverflow.com/a/21284454
tagged with: reflection
score: 0
tagged with: java
tagged with: java-ee-7
accepted answer: http://stackoverflow.com/a/21284454
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32073323

http://stackoverflow.com/q/21312003
has title: How to secure Axis2 web services?
has comment: http://stackoverflow.com/comment/32121670
has body: is that secure everyone can access wsdl through the apache home page of Axis2 web services?
score: 0
tagged with: web-services
answer count: 1
has answer: http://stackoverflow.com/a/21312329
tagged with: java
tagged with: apache-axis
type: AnsweredQuestion
tagged with: apache
accepted answer: http://stackoverflow.com/a/21312329
type: Question

http://stackoverflow.com/comment/31957646
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21217724
has text: Post the `module.xml`.

http://stackoverflow.com/comment/32149949
type: Comment
comment on: http://stackoverflow.com/a/21327846
has text: it doesnt break the app, though it is not displaying the integer where i need it to be
type: AnswerComment
score: 0

http://stackoverflow.com/q/21278072
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/6279374
tagged with: mysql
type: Question
has body: I noticied that non of hibernate's ilike queries works with German umlauts such as ü, ö etc... As far as I understand it is a MySQL's issue. I searched for the solutions and it seems there are only two: Replace all the umlautes with the appropriate character sets. For example, ü with ue etc... Semi-solution because I don't know how to implement it with hibernate described here and here So the questions are: what is the better way and how to implement #2 with hibernate? Thank you in advance
downvote count: 0
tagged with: utf-8
favorite count: 0
type: UnansweredQuestion
has title: Hibernate's like or ilike restrictions and German umlauts
linked to: http://stackoverflow.com/q/2607130
score: 3
answer count: 0
upvote count: 3

http://stackoverflow.com/comment/32156593
type: Comment
type: QuestionComment
has text: How are you even able to get the file name in the first case? It shouldn't even work.
score: 0
comment on: http://stackoverflow.com/q/21331704

http://stackoverflow.com/a/21238152
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21237221
has comment: http://stackoverflow.com/comment/31992723
has body: It seems you are taking a message as a starting point and trying to transform it. Another aproach could be to start by defining a list of words which are likely to be changed (sale, viagra, etc) and then generate all possible similar words. As a measure of similarity you can take a Levenshtein distance.
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31992240
answers question: http://stackoverflow.com/q/21237221
type: AcceptedAnswer

http://stackoverflow.com/q/21244114
has answer: http://stackoverflow.com/a/21244203
tagged with: java
score: 13
type: Question
has answer: http://stackoverflow.com/a/21244274
has body: I am trying to learn about the Spring framework for Java and I am not sure where about's I am supposed to put the applicationContext.xml file for configuring the spring beans. My directory structure is as follows: Do I put in .settings? Or should it be put at the top level within springapp? Thanks for the help.
has answer: http://stackoverflow.com/a/21244175
has answer: http://stackoverflow.com/a/21244192
downvote count: 0
favorite count: 0
tagged with: spring
accepted answer: http://stackoverflow.com/a/21244175
has title: Where do I place the applicationContext.xml file within Spring project directory
answer count: 4
upvote count: 13
tagged with: spring-mvc
possible better answer: http://stackoverflow.com/a/21244203
type: AnsweredQuestion

http://stackoverflow.com/q/21300023
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21300096
has answer: http://stackoverflow.com/a/21300081
has comment: http://stackoverflow.com/comment/32100727
score: 2
has body: I need to know what is difference between using ! operator and ==false in if statement. I know output will be same for both. Am expecting to know internal jvm performance or any memory usage for using false value like that. By using ! operator if(!MyUtil.isFieldEmpty(String value)){ System.Out.println("Not Empty"); } By using ==false if(MyUtil.isFieldEmpty(String value) == false){ System.Out.println("Not Empty"); } MyUtil.java public static boolean isFieldEmpty(String value){ if ((value == null) || (value.trim().length() == 0) || value.equals("null")) { return true; } else { return false; } } Thanks!!!
has answer: http://stackoverflow.com/a/21300105
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21300061
downvote count: 0
answer count: 7
has title: Difference between using unary operator ! and (== false) in if statement
has answer: http://stackoverflow.com/a/21300164
has answer: http://stackoverflow.com/a/21300292
favorite count: 0
has answer: http://stackoverflow.com/a/21300066
has comment: http://stackoverflow.com/comment/32100814

http://stackoverflow.com/comment/31961639
type: Comment
type: QuestionComment
has text: so I must deal with my json object and not an array? would show me an example? is that I am new to json and only managed to do with only a customer and not a number ..
comment on: http://stackoverflow.com/q/21220963
score: 0

http://stackoverflow.com/comment/32142588
comment on: http://stackoverflow.com/q/21323543
type: Comment
type: QuestionComment
has text: What is the problem with a dedicated thread that blocks? IMHO a lot cleaner than polling. Also please remeber that the object being written needs to implement serializable.
score: 1

http://stackoverflow.com/comment/32090186
comment on: http://stackoverflow.com/q/21289922
score: 0
type: Comment
type: QuestionComment
has text: In order to be sure, try a different workload... let each thread compute something, so you can be sure there's no blocking.

http://stackoverflow.com/q/21344447
has title: Web Services with complex data type interface instead POJO class as service parameter/return types
answer count: 0
downvote count: 0
has body: How do I specify interface as parameter/return type instead concrete java POJO class for an web service operation. ? @XmlSeeAlso annotation doesn't work either. Data type interface: public interface MyInput { public String getName() ; public void setName(String name); } public interface MyOutput{ public String getResult() ; public void setResult(String result); } Data Type implementation: public class MyInputDataType implements MyInput { private String name; ... public String getName(){ return this.name ; } public void setName(String name){ this.name = name } } public class MyOutputDataType implements MyOutput{ private String result; ... public String getResult(){ return this.result; } public void setResult(String result){ this.result= result } } Web service contract: @WebService(name="MyWebService", portName="MyWebService", targetNamespace="http://somename.org", serviceName="MyWebService") public interface MyWebService { @WebMethod public MyOutput executeOperation(MyInput input) ; } Web service implementation: @WebService( portName="MyWebService", name="MyWebService", targetNamespace="http://somename.org", serviceName="MyWebService", endpointInterface="MyWebService") public class MyWebServiceImpl implements MyWebService { public MyOutput executeOperation(MyInput input) { MyOutput output = new MyOutputDataType(); output.setResult("executeOperation with input: " + input.getName() ); return output; } } Deployed in WL 12c (JEE 6), JDK7 Exception : Exception Description: An error occurred unmarshalling the document Internal Exception: org.xml.sax.SAXParseException; lineNumber: 0; columnNumber: 0; Exception Description: The instance creation method [MyInput.&lt;Default Constructor&gt;], with no parameters, does not exist, or is not accessible. Internal Exception: java.lang.NoSuchMethodException: MyInput.&lt;init&gt;() Descriptor: XMLDescriptor(MyInput --&gt; [])] at com.sun.xml.ws.server.sei.TieHandler.readRequest(TieHandler.java:251) at com.sun.xml.ws.db.DatabindingImpl…
tagged with: web-services
type: Question
tagged with: jakarta-ee
score: 1
tagged with: java
upvote count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/29519323
has comment: http://stackoverflow.com/comment/47218331
has body: You may want to make sure your phone is unplugged. When it is plugged in, I have noticed this happening and the solution for me (which may be Mac specific) is to unplug my phone from the computer.
downvote count: 0
answers question: http://stackoverflow.com/q/21246983
type: Answer
score: 2
upvote count: 2

web-services
tags question: http://stackoverflow.com/q/21280257
type: Tag
tags question: http://stackoverflow.com/q/21196171
tags question: http://stackoverflow.com/q/21185802
tags question: http://stackoverflow.com/q/21263566
tags question: http://stackoverflow.com/q/21235828
tags question: http://stackoverflow.com/q/21287476
tags question: http://stackoverflow.com/q/21349152
tags question: http://stackoverflow.com/q/21306004
tags question: http://stackoverflow.com/q/21189170
tags question: http://stackoverflow.com/q/21187557
tags question: http://stackoverflow.com/q/21306889
tags question: http://stackoverflow.com/q/21291856
tags question: http://stackoverflow.com/q/21283909
tags question: http://stackoverflow.com/q/21258431
tags question: http://stackoverflow.com/q/21295940
tags question: http://stackoverflow.com/q/21300940
tags question: http://stackoverflow.com/q/21323708
tags question: http://stackoverflow.com/q/21278783
tags question: http://stackoverflow.com/q/21239879
tags question: http://stackoverflow.com/q/21316869
tags question: http://stackoverflow.com/q/21202379
tags question: http://stackoverflow.com/q/21229840
tags question: http://stackoverflow.com/q/21294675
tags question: http://stackoverflow.com/q/21286742
tags question: http://stackoverflow.com/q/21250540
tags question: http://stackoverflow.com/q/21327516
tags question: http://stackoverflow.com/q/21240777
tags question: http://stackoverflow.com/q/21218318
tags question: http://stackoverflow.com/q/21239336
tags question: http://stackoverflow.com/q/21223159
tags question: http://stackoverflow.com/q/21229804
tags question: http://stackoverflow.com/q/21249886
tags question: http://stackoverflow.com/q/21275115
tags question: http://stackoverflow.com/q/21235967
tags question: http://stackoverflow.com/q/21303760
tags question: http://stackoverflow.com/q/21330263
tags question: http://stackoverflow.com/q/21282090
tags question: http://stackoverflow.com/q/21269462
tags question: http://stackoverflow.com/q/21221969
tags question: http://stackoverflow.com/q/21197112
tags question: http://stackoverflow.com/q/21278681
tags question: http://stackoverflow.com/q/21280648
tags question: http://stackoverflow.com/q/21262439
tags question: http://stackoverflow.com/q/21268320
tags question: http://stackoverflow.com/q/21230220
tags question: http://stackoverflow.com/q/21344447
tags question: http://stackoverflow.com/q/21332444
tags question: http://stackoverflow.com/q/21332118
tags question: http://stackoverflow.com/q/21233818
tags question: http://stackoverflow.com/q/21325530
tags question: http://stackoverflow.com/q/21203886
tag name: web-services
tags question: http://stackoverflow.com/q/21305482
tags question: http://stackoverflow.com/q/21285263
tags question: http://stackoverflow.com/q/21230745
tags question: http://stackoverflow.com/q/21235085
tags question: http://stackoverflow.com/q/21289217
tags question: http://stackoverflow.com/q/21214095
tags question: http://stackoverflow.com/q/21334086
tags question: http://stackoverflow.com/q/21312003
tags question: http://stackoverflow.com/q/21191079
tags question: http://stackoverflow.com/q/21269968
tags question: http://stackoverflow.com/q/21303941

http://stackoverflow.com/a/21302094
downvote count: 0
type: Answer
has body: I provide my code here. public static int[][] readArray(String path) throws IOException { //1,0,1,1,0,1,0,1,0,1 int[][] result = new int[3][10]; BufferedReader reader = new BufferedReader(new FileReader(path)); String line = null; Scanner scanner = null; line = reader.readLine(); if(line == null) { return result; } String pattern = createPattern(line); int lineNumber = 0; MatchResult temp = null; while(line != null) { scanner = new Scanner(line); scanner.findInLine(pattern); temp = scanner.match(); int count = temp.groupCount(); for(int i=1;i&lt;=count;i++) { result[lineNumber][i-1] = Integer.parseInt(temp.group(i)); } lineNumber++; scanner.close(); line = reader.readLine(); } return result; } public static String createPattern(String line) { char[] chars = line.toCharArray(); StringBuilder pattern = new StringBuilder();; for(char c : chars) { if(',' == c) { pattern.append(','); } else { pattern.append("(\\d+)"); } } return pattern.toString(); }
answers question: http://stackoverflow.com/q/21300156
score: 1
upvote count: 1

http://stackoverflow.com/comment/31932453
has text: What does the data look like?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21195844
score: 0

http://stackoverflow.com/a/21222344
score: 1
has comment: http://stackoverflow.com/comment/31975519
has comment: http://stackoverflow.com/comment/31965078
answers question: http://stackoverflow.com/q/21221863
has comment: http://stackoverflow.com/comment/31964409
downvote count: 0
has body: You can open several views with the same id by using a unique secondary id for each view and using IWorkbenchPage.showView(viewId, secondardId, IWorbenchPage.VEW_ACTIVATE); All the views will be placed in the folder defined for the view id. You would do something like this in the perspective factory to set this up: IFolderLayout folder = layout.createFolder(folderId, IPageLayout.BOTTOM, 0.75f, layout.getEditorArea()); folder.addPlaceholder(viewId);
type: Answer
has comment: http://stackoverflow.com/comment/31988624
upvote count: 1
has comment: http://stackoverflow.com/comment/31964514

http://stackoverflow.com/q/21334876
has title: Java client sending multiple requests instead of one
upvote count: 1
type: Question
has body: I'm setting up a basic client server program. Right now the client is simply sending an object with a command string in it to the server and the server is acknowledging it. This is done using a JFrame with buttons on it. It seems to work ok, except the client seems to be sending multiple requests instead of just one. Inner class within my Client code: private class CommandHandler implements ActionListener{ FTPCommand c; ObjectOutputStream oos; @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (cmd == "DIR"){ c = new FTPCommand("DIR"); } if (cmd == "CHDIR"){ String newDirectory = JOptionPane.showInputDialog("Please enter directory to change to:"); c = new FTPCommand("CHDIR", newDirectory); } try { oos = new ObjectOutputStream(sock.getOutputStream()); oos.writeObject(c); oos.flush(); //System.out.println("Command: " + c.getCommand() + ", sent successfully"); } catch (IOException e1) { e1.printStackTrace(); } } } Server: public void run(){ ObjectInputStream in; try { in = new ObjectInputStream(sock.getInputStream()); FTPCommand cmd = (FTPCommand) in.readObject(); System.out.println("Received command: " + cmd.getCommand() + " at " + System.currentTimeMillis()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } So if I click on the DIR button just once, this is the output I get, although sometimes it might just be one or two lines: Received command: DIR at 1390572358017 Received command: DIR at 1390572365578 Received command: DIR at 1390572377229 Why is it sending multiple requests?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32162293
tagged with: client-server
answer count: 2
has comment: http://stackoverflow.com/comment/32162787
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21408881
has comment: http://stackoverflow.com/comment/32162185
accepted answer: http://stackoverflow.com/a/21408881
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21335858
has answer: http://stackoverflow.com/a/21335858

http://stackoverflow.com/q/21257455
has title: Whats an easy way to totally ignore ssl with java url connections?
has comment: http://stackoverflow.com/comment/70317313
has answer: http://stackoverflow.com/a/21257694
answer count: 1
favorite count: 0
upvote count: 28
has comment: http://stackoverflow.com/comment/32026190
linked to: http://stackoverflow.com/q/1201048
linked to: http://stackoverflow.com/q/6353849
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21257694
tagged with: java
downvote count: 1
tagged with: https
type: Question
tagged with: ssl
score: 27
has body: I'm building an application that periodically checks some rss feeds for new content. Some of these feeds are only reachable via https and some have self signed or somehow broken certificates. I want to be able to check them never the less. Please note that security is not an issue in this application the goal is to access the content with minimal effort. I'm using this code to circumvent most of the certificate issues: /** * Sets timeout values and user agent header, and ignores self signed ssl * certificates to enable maximum coverage * * @param con * @return */ public static URLConnection configureConnection(URLConnection con) { con.setRequestProperty( "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); con.setConnectTimeout(30000); con.setReadTimeout(40000); if (con instanceof HttpsURLConnection) { HttpsURLConnection conHttps = (HttpsURLConnection) con; TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted( java.security.cert.X509Certificate[] certs, String authType) { } public void checkServerTrusted( java.security.cert.X509Certificate[] certs, String authType) { } } }; HostnameVerifier allHostsValid = new HostnameVerifier() { @Override public boolean verify(String arg0, SSLSession arg1) { return true; } }; // Install the all-trusting trust manager try { SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc .getSocketFactory()); HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid); con = conHttps; } catch (Exception e) { } } return con; } this works for most of the sites, but on one I still get this exception: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpa…

http://stackoverflow.com/a/21264464
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32082629
has comment: http://stackoverflow.com/comment/32072407
has body: AFAIK That command doesn't accept full JNDI references, it expects a datasource name. You can view your datasource names with /subsystem=datasources:read-resource(recursive=true) Edit: ok, so the problem you have is with remote lookup. If you look at this thread, you can see that unfortunately: Remote lookup of datasources is not supported in AS7. Edit2: so you're not doing a remote lookup after all. Both this: &lt;jee:jndi-lookup id="datasource" jndi-name="java:jboss/datasources/xx3_oracle_tu_2"/&gt; and this: &lt;bean id="datasource" class="org.springframework.jndi.JndiObjectFactoryBean"&gt; &lt;property name="jndiName" value="java:jboss/datasources/xx3_oracle_tu_2" /&gt; &lt;/bean&gt; should do. JNDI env property you should not use, that's meant for remote lookups.
has comment: http://stackoverflow.com/comment/32080741
type: Answer
has comment: http://stackoverflow.com/comment/32072051
has comment: http://stackoverflow.com/comment/32068748
has comment: http://stackoverflow.com/comment/32079707
has comment: http://stackoverflow.com/comment/32077859
has comment: http://stackoverflow.com/comment/32070752
has comment: http://stackoverflow.com/comment/32065209
upvote count: 1
has comment: http://stackoverflow.com/comment/32063941
has comment: http://stackoverflow.com/comment/32073999
answers question: http://stackoverflow.com/q/21261676
has comment: http://stackoverflow.com/comment/32066451
has comment: http://stackoverflow.com/comment/32086141
has comment: http://stackoverflow.com/comment/32080423

http://stackoverflow.com/comment/31922666
has text: char != String There are no references since they are value types.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21199220
type: AnswerComment

http://stackoverflow.com/comment/32204294
has text: Fixed your title again. You won't get anywhere by just restating your assumptions in your title, and a more precise title will lead to more precise answers. @BalusC please note.
type: Comment
comment on: http://stackoverflow.com/q/21223257
score: 1
type: QuestionComment

http://stackoverflow.com/a/21283290
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21283254
has body: String str[]= new string[] {"Welcome"}; should be String str[]= new String[] {"Welcome"};

http://stackoverflow.com/comment/32098799
comment on: http://stackoverflow.com/a/21294067
type: AnswerComment
has text: @user3190757: Yes, you can do that. But warning ahead, Firefox might face the same situation whenever it updates, which breaks Selenium normally more frequently than Chrome.
score: 0
type: Comment

http://stackoverflow.com/comment/32059944
has text: @Makoto `String summer2 = "Summer";` is a String literal.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21276896
score: 0

http://stackoverflow.com/a/21327163
has body: It is either simply a limitation of the decompiler, or perhaps this method was obfuscated. Although, usually entire .apks are obfuscated, not just a method. Maybe if you say which .apk this is, it would suggest the more likely answer.
has comment: http://stackoverflow.com/comment/32149777
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21326925
upvote count: 1
type: Answer

http://stackoverflow.com/comment/32139667
type: QuestionComment
comment on: http://stackoverflow.com/q/21321854
has text: Why aren't you using a `JTextArea` with a `JScrollPane`?
score: 5
type: Comment

http://stackoverflow.com/q/21236245
has body: I have 2 activities in my application, Activity1 and Activity2.When the app launches Acitivity1 is the the one that is called.Clicking on a button in Activity1 should take you to Activity2. In Acivity2,some data processing is done then i send back data to Activity1 using an intent like this: Intent in=new Intent(getApplicationContext(), Activity1.class); in.putExtra("data", data); startActivity(in); Then getting back to Activity1 i obtain the intent data: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity1); String data =(getIntent().getExtras().getString("data")); The problem here is that the first time the app launches it checks for the intent data and it does not exist so i get the nullpointerexception error.how can i make sure it checks for the intent data when Activity2 is the previous class?
has comment: http://stackoverflow.com/comment/31988714
linked to: http://stackoverflow.com/q/10407159
has answer: http://stackoverflow.com/a/21236448
has answer: http://stackoverflow.com/a/21236347
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21236656
type: Question
has answer: http://stackoverflow.com/a/21236324
has title: how to handle a getIntent() method with java nullpointerexception
score: 0
has comment: http://stackoverflow.com/comment/31988422
has answer: http://stackoverflow.com/a/21236293
tagged with: nullpointerexception
answer count: 5
tagged with: android

http://stackoverflow.com/a/21206858
has body: Following is a code to find sum of digits of a number &amp; length of number : int sum=0; int length=0; while(input!=0) { sum+=input%10; input/=10; length++; }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21205828

soa
type: Tag
tags question: http://stackoverflow.com/q/21291856
tag name: soa
tags question: http://stackoverflow.com/q/21235085

http://stackoverflow.com/comment/31965819
has text: exactly addHeaderView is method in ListView
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21223328
type: Comment

http://stackoverflow.com/comment/31983702
type: AnswerComment
comment on: http://stackoverflow.com/a/21233336
has text: First: Caused by: javax.naming.NameNotFoundException: queueConnectionFactory at org.apache.activemq.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:235) Second: Caused by: javax.naming.NameNotFoundException: ${queueConnectionFactory} at org.apache.activemq.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:235)
type: Comment
score: 0

http://stackoverflow.com/a/21201469
downvote count: 0
has body: ParameterStyle.Bare and ParameterStyle.Wrapped affects your wsdl definitions of request and response messages only. Lets take an example, we have a webservice with a method "test" which has 2 input "string1" and "string2" and it is returning a string as "rstring". ParameterStyle.BARE Your parameter's name will be visible as part name in your wsdl. Request message: &lt;message name="test"&gt; &lt;part name="string1" element="tns:string1"/&gt; &lt;part name="string2" element="tns:string2"/&gt; &lt;/message&gt; Response message: &lt;message name="testResponse"&gt; &lt;part name="rstring" element="tns:rstring"/&gt; &lt;/message&gt; In your xsd test and testResponse will be defined like below, and your wsdl element directly referring elements under test and test response from xsd. &lt;xs:complexType name="test"&gt; &lt;xs:sequence&gt; &lt;xs:element name="string1" type="xs:string" minOccurs="0"/&gt; &lt;xs:element name="string2" type="xs:string" minOccurs="0"/&gt; &lt;/xs:sequence&gt; &lt;xs:complexType name="testResponse"&gt; &lt;xs:sequence&gt; &lt;xs:element name="rstring" type="xs:string" minOccurs="0"/&gt; &lt;/xs:sequence&gt; ParameterStyle.WRAPPED In this style your request and response message will be wrapped in single input as "parameter" and output as "result". and they will refer that particular element in xsd for all elements within. Request message: &lt;message name="test"&gt; &lt;part name="parameters" element="tns:test"/&gt; &lt;/message&gt; Response message: &lt;message name="testResponse"&gt; &lt;part name="result" element="tns:testResponse"/&gt; &lt;/message&gt; In your xsd test and testResponse will be defined as same as above, &lt;xs:complexType name="test"&gt; &lt;xs:sequence&gt; &lt;xs:element name="string1" type="xs:string" minOccurs="0"/&gt; &lt;xs:element name="string2" type="xs:string" minOccurs="0"/&gt; &lt;/xs:sequence&gt; &lt;xs:complexType name="testResponse"&gt; &lt;xs:sequence&gt; &lt;xs:element name="rstring" type="xs:string" minOccurs="0…
type: Answer
score: 13
upvote count: 13
accepted answer of: http://stackoverflow.com/q/21191079
answers question: http://stackoverflow.com/q/21191079
type: AcceptedAnswer

http://stackoverflow.com/comment/32149445
comment on: http://stackoverflow.com/q/21321229
score: 0
type: Comment
has text: What is your problem? If you don't want to use methods which are not related to stack, just don't use them. Why do they disturb you?
type: QuestionComment

http://stackoverflow.com/comment/32031049
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21260667
has text: Yes, *if* it actually makes sense logically for `Emoticon` to be an `ImageIcon`.
score: 0

http://stackoverflow.com/a/21346544
has comment: http://stackoverflow.com/comment/32184166
upvote count: 1
type: Answer
downvote count: 0
has body: Change r.setFailureList(Arrays.asList(twoStr.split(","))); r.setSuccessList(Arrays.asList(oneStr.split(","))); as r.setFailureList(new ArrayList&lt;String&gt;(Arrays.asList(twoStr.split(",")))); r.setSuccessList(new ArrayList&lt;String&gt;(Arrays.asList(oneStr.split(","))));
answers question: http://stackoverflow.com/q/21346543
score: 1

permissions
tag name: permissions
tags question: http://stackoverflow.com/q/21260980
type: Tag

http://stackoverflow.com/a/21265710
type: AcceptedAnswer
downvote count: 0
has body: Just need to remove the delimeter and double quote it. Put the \w equivalent in the regex. Note that if your input comes from an edit box that's single line, you can replace the \A and \z anchors with ^$ but, I use \A and \z when I have to dither newlines. # "\\A(?=[-\\w]*[A-Z])(?=[-\\w]*[a-z])(?=[-\\w]*[0-9])\\S{4,}\\z" \A (?= [-\w]* [A-Z] ) (?= [-\w]* [a-z] ) (?= [-\w]* [0-9] ) \S{4,} \z
type: Answer
answers question: http://stackoverflow.com/q/21265330
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21265330
score: 1

http://stackoverflow.com/a/21285139
score: 1
accepted answer of: http://stackoverflow.com/q/21284815
answers question: http://stackoverflow.com/q/21284815
has body: Script that you have pasted runs tomcat as root user and it's definitely not what you want to do. This is what you should do: create user say tomcatuser change owner of tomcat directory and all resources directories to this user (chown -R tomcatuser:tomcatuser &lt;directory&gt;) start service as this user by: sudo -u tomcatuser &lt;command&gt;
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32078795
type: Answer
downvote count: 0

sensors
type: Tag
tags question: http://stackoverflow.com/q/21345615
tag name: sensors
tags question: http://stackoverflow.com/q/21320006

http://stackoverflow.com/a/21315968
has comment: http://stackoverflow.com/comment/32140808
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21312507
type: Answer
accepted answer of: http://stackoverflow.com/q/21312507
has comment: http://stackoverflow.com/comment/32129022
score: 3
has body: The Qualifier should be in the producer method: @Produces @ProductTypeA public ProductA getProductA(InjectionPoint injectionpoint) { this.test="testD"; System.out.println("-----------------------------"); System.out.println("injectionpoint.getAnnotated() = "+injectionpoint.getAnnotated()); return new ProductA(injectionpoint); }
upvote count: 3

http://stackoverflow.com/comment/32313636
type: AnswerComment
has text: @YoungDeezie I've updated my answer. Please be more careful next time, happy coding :).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21337271

http://stackoverflow.com/comment/32107185
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21299998
has text: thanks guys... @rlegendi I am not sure I can follow you. Unbinding the other one in Preferences in the sense? I haven't used the Ctrl+Shift+O option in preferences, if thats wat you mean...
score: 0

http://stackoverflow.com/comment/32021949
comment on: http://stackoverflow.com/a/21255566
type: AnswerComment
score: 0
type: Comment
has text: If I post this as a tweet : 'any.thing.u.want://p.example.com' that link will not be clickable. That is because the twitter thinks that it is not a URL.

http://stackoverflow.com/q/21325414
tagged with: java
has answer: http://stackoverflow.com/a/21325532
has body: I am finding the longest non-repeating string in the input list. Code is here. My question is assume the input list was too huge to fit in memory. How to solve this question if input cannot fit in memory, (ie lets say input is a never ending string of words of a news paper) ? Can / if yes then, how can one use Hadoop/Map reduce concepts (any url's appreciated)
type: Question
score: 3
tagged with: mapreduce
tagged with: hadoop
upvote count: 3
answer count: 2
tagged with: distributed
downvote count: 0
has comment: http://stackoverflow.com/comment/32146630
has answer: http://stackoverflow.com/a/21325629
favorite count: 0
has title: Large scale processing to find unique longest word in very large list of string?
type: UnansweredQuestion

http://stackoverflow.com/a/21283620
has comment: http://stackoverflow.com/comment/32082024
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32072509
answers question: http://stackoverflow.com/q/21283406
has body: According to the HTTP standard, status 406 (Not Acceptable) means The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request. Your controller method says @RequestMapping(method=RequestMethod.GET, value="/isUsernameTaken/{username}", headers={"Accept=application/xml"}) So your controller will serve only requests that request Accept=application/xml. Requests for all other representations of the resource will result in in 406 response status. I conclude that your client request (GET) is not asking for application/xml. Your client asks for a ResponseEntity&lt;Boolean&gt; from the RestTemplate. So the Accept header sent to the server will list the media types of all the message-converters of the client that can convert a Boolean. Your only message converter is jaxbMarshaller. I'm not familiar with that converter, but I guess you have not correctly configured its Spring-bean so it will convert from a Boolean.
downvote count: 0
has comment: http://stackoverflow.com/comment/32075449
upvote count: 2

http://stackoverflow.com/q/21201922
tagged with: arguments
has body: I am trying to create a App base on user input with ArrayList. But there is some problem that I need to understand first. PS: I want to try with normal value first before going into user input. And this is just a rough sketch up to make me understand how to use multiple arguments in a arraylist. This is the Student package test; import java.text.SimpleDateFormat; import java.util.Date; public class Student { private String name; private Date DOB; private String[] friend; private String school; public Student(String name, Date DOB, String[] friend, String school) { this.name = name; this.DOB = DOB; this.friend = friend; this.school = school; } public void display() { System.out.println("Name : " + name); SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy"); System.out.println("Released Date : " + df.format(DOB)); System.out.println("Best Friend : " + friend[0] + ", " + friend[1]); System.out.println("Director : " + school); } public String getName() { return name; } } This is the StudentApp package test; import java.util.ArrayList; public class StudentApp { private ArrayList&lt;Student&gt; students = new ArrayList&lt;Student&gt;(); public void start() { addStudent(); } public void addStudent() { System.out.println("- Add Student Info -"); students.add(/* Need to ask the user to input their information like their name,DOB,friend,school*/); } } how can I add in values to the arraylist if there is multiple arguments needed? (String, Date, String[], String). Because when I tried adding some value with the correct arguments needed into the students.add, it will show me an error saying The method add(int, Student) in the type ArrayList is not applicable for the arguments (String, null, String, String)
accepted answer: http://stackoverflow.com/a/21202105
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21201954
has answer: http://stackoverflow.com/a/21202105
type: Question
has answer: http://stackoverflow.com/a/21201956
tagged with: arraylist
score: 0
has title: ArrayList with multiple arguments (User input)
answer count: 3
possible better answer: http://stackoverflow.com/a/21201954

http://stackoverflow.com/comment/32131263
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21315943
has text: Now I added it with the escaped characters. It will not shout when the field is empty, but you can check that programmatically probably.
score: 0

http://stackoverflow.com/comment/32124801
has text: Yes, I' d like to know if methods like i.e. sum too use an internal iteration.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21313525

http://stackoverflow.com/q/21219042
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31960064
has answer: http://stackoverflow.com/a/21223346
has title: Java 7 Multithread Fork Join Scheduler
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21223346
tagged with: multithreading
has comment: http://stackoverflow.com/comment/31957920
has body: I wrote a multithreaded program using Java fork/join framework in jre 1.7. This program aims to find certain points which satisfy specified condition in all nodes of a Quadtree(each leaf node in the quadtree can be filled with unrestricted number of points, e.g, can be zero or 1000). I tested the speedup of the multithreaded program compared to a serial program on a 16-core processor machine, while the speedup only turned to be 1.3-1.5. Below is pseudo code: public class QuadtreeFindMultiThread extends RecursiveTask&lt;IntArrayList&gt; { private Quadtree T; private ObjectArrayList&lt;Node&gt; leaf_nodes; private ObjectArrayList&lt;Entry&gt; candidatePoints; private static int POINT_THRESHOLD = 50; private static int NODE_THRESHOLD = 1; public QuadtreeFindMultiThread(Quadtree T) { this.T = T this.leaf_nodes = T.get_nonempty_leaf_nodes(); this.candidatePoints = new IntArrayList(); } private QuadtreeFindMultiThread(Quadtree T, IntArrayList leaf_nodes) { this.T = T; this.leaf_nodes = leaf_nodes; // reference copy this.candidatePoints = new IntArrayList(); } private IntArrayList QuadtreeFind() { //... //... return candidatePoints; } private int getPointNum(){ int count = 0; for(Node node:this.leaf_nodes){ count += node.getAllPoints().size(); } return count; } @Override public IntArrayList compute() { if (this.getPointNum() &lt;= POINT_THRESHOLD || this.leaf_nodes.size() &lt;= NODE_THRESHOLD) {// trivial problem, solve by single thread this.candidatePoints = QuadtreeFind(); } else {// START: divide and conquer // Divide Step: partition this.leaf_nodes by direction: NW, NE, SW, SE Partition leaf_nodes to four quadrants: leaf_nodes_NW, leaf_nodes_NE, leaf_nodes_SW, leaf_nodes_SE // Conquer Step QuadtreeFindMultiThread thread_NW = new QuadtreeFindMultiThread( this.T, leaf_nodes_NW); QuadtreeFindMultiThread thread_NE = new QuadtreeFindMultiThread( this.T, leaf_nodes_NE); QuadtreeFindMultiThread thread_SW = new QuadtreeFindMultiThread( this.T, leaf_nodes_SW); QuadtreeJoinMulti…
possible better answer: http://stackoverflow.com/a/21220050
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21220050
has comment: http://stackoverflow.com/comment/31957728

http://stackoverflow.com/q/21300459
has body: I have a webview in my activity and i am displaying a form in this webview. I want to finish the activity when user clicks on the Submit button of the form. How can i do this. Or in Another way you can say that i want to get the id of the button when users click on that in java and perform the finish Activity method. I have gone through this link Detect click on HTML button through javascript in Android WebView Thank for considering..
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21313148
has answer: http://stackoverflow.com/a/21303149
tagged with: android-websettings
has title: How to finish the activity when user clicks on the submit button on webView
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/4065312
tagged with: android-webview
tagged with: java
score: 0

http://stackoverflow.com/a/21333293
has comment: http://stackoverflow.com/comment/32159193
downvote count: 0
has comment: http://stackoverflow.com/comment/32159177
type: Answer
score: 7
upvote count: 7
answers question: http://stackoverflow.com/q/21333260
has body: Cannot be done. When you override a method, you can't break the original contract and decide to throw a checked exception. You can make MyCustomizedException unchecked. You can throw it, but you can't require that users handle it the way you can with a checked exception. The best you can do is add it to the javadocs and explain.

http://stackoverflow.com/comment/31921879
type: Comment
comment on: http://stackoverflow.com/q/21198799
score: 1
has text: Decide based on what makes the code clearer. Often, using a variable helps because you can give the constant expression a name that means something.
type: QuestionComment

http://stackoverflow.com/a/21278227
has comment: http://stackoverflow.com/comment/32063905
has comment: http://stackoverflow.com/comment/32067419
downvote count: 0
has body: The issue comes from the asynchronous start of iPOJO. When you create your instance, not everything is available. I’ve several question: Why are you using the iPOJO API to declare your type and instance ? Can’t you just use the annotations ? In that case it will just create everything smoothly. If you really need / want to use the API, don’t create the instance like you do, but expose an instance declaration: http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/ipojo-advanced-topics/ipojo-factory-service.html#deleting-instances. The declaration waits until the factory is valid to create the instance.
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/32065329
upvote count: 1
has comment: http://stackoverflow.com/comment/32064151
answers question: http://stackoverflow.com/q/21254994

http://stackoverflow.com/q/21206706
upvote count: 3
has body: Given a java object which is serialised into a JSON string with Jackson. Is it possible to control the serialisation process to generate different JSON outputs from the same object? compressed: { "a":"123", "s":"100" } or normal: { "altitude":"123", "speed":"100" } EDIT: The goal I want to achieve with this to have a long JSON format which is good for debugging (human-readable) and have a compressed format which is providing the smallest footprint.
has title: Get different JSON representations of the same object
type: Question
score: 3
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/21206898
answer count: 2
possible better answer: http://stackoverflow.com/a/21206874
has answer: http://stackoverflow.com/a/21206874
downvote count: 0
tagged with: jackson
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21206898

http://stackoverflow.com/q/21203886
has answer: http://stackoverflow.com/a/21204019
accepted answer: http://stackoverflow.com/a/21204019
has answer: http://stackoverflow.com/a/21205351
favorite count: 0
tagged with: rest
downvote count: 2
has comment: http://stackoverflow.com/comment/31930568
upvote count: 1
tagged with: web-services
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31930638
possible better answer: http://stackoverflow.com/a/21205351
score: -1
type: Question
answer count: 2
has title: simple restful java web service application
has body: I want to develop a simple application using java and RESTful web service that manages (add/delete/modify) a simple student table (Id, name, address, department). Where i should start ? Examples, sample code ? Thanks for your help..

http://stackoverflow.com/comment/32138707
comment on: http://stackoverflow.com/a/21319223
type: Comment
has text: But if it's null you're first assigning and then comparing (precedence priorities). So if it's null this will throw an exception. I'd first compare and once I've checked it's not null, then assign.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21299143
has body: I would like to let the sprite where I left it in the screen, and drag the camera in the world. But the sprite sticks to the camera, and is still at the bottom of the screen when I drag the camera. This is not happening with a tilemap (the .tmx file), and a renderer : the camera can drag over the tilemap, and the tilemap does not stick to the camera. With a spriteBatch tough, the sprite stays at the bottom of the screen. Here is my code: map = MyLoader.manager.get("data/mMap.tmx"); float unitScale = 1 / 64f; renderer = new OrthogonalTiledMapRenderer(map, unitScale); @Override public void render() { Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); camera.update(); renderer.setView(camera); renderer.render();//tilemap works fine //sprite //batchMap.setProjectionMatrix(camera.combined);//wrong batchMap.begin(); if ( scrFactoryMap.maps.size() &gt; 0 ) { scrFactoryMap.getMap(0).draw(batchMap);//sprite sticks to the camera } str = "string"; font.draw(batchMap, str, 50,50);//font sticks to the camera batchMap.end(); } private void slerpCamera(){ //... camera.position.add( camX, camY, 0 ); camera.update(); }
tagged with: spritebatch
tagged with: opengl
tagged with: java
tagged with: render
accepted answer: http://stackoverflow.com/a/21299556
type: Question
has title: Sprite sticks to the camera in libgdx?
type: AnsweredQuestion
tagged with: libgdx
has answer: http://stackoverflow.com/a/21299556
score: 0
answer count: 1

http://stackoverflow.com/comment/32161031
has text: I was wanting something like one-line or 2- line code.:P
comment on: http://stackoverflow.com/a/21333830
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32127577
score: 0
type: QuestionComment
type: Comment
has text: So I uses JVisualVM to monitor the application. Everything looks normal and I can't find any memory leaks. However, I caught this exception when inserting into deal: `com.datastax.driver.core.exceptions.WriteTimeoutException: Cassandra timeout during write query at consistency ONE (1 replica were required but only 0 acknowledged the write)`. So I guess this is more of a Cassandra problem. After I abort this insertion I continue inserting into allocated with the same instance (no restart of the program) and I get to push data in there very fast. Maybe I have to go with another table scheme.
comment on: http://stackoverflow.com/q/21314284

http://stackoverflow.com/comment/32053190
score: 0
has text: Okay just change the method signatures for `setSquare` and `positionRobot` to take an `int` and you can pass in `size` and use it in each method.
type: Comment
comment on: http://stackoverflow.com/q/21272668
type: QuestionComment

http://stackoverflow.com/q/21317792
tagged with: java
has body: Well i created a receiver class to start an intent. When user confirms the required things after couple of seconds app throws exception. This is logcat output 01-23 20:18:32.541: E/AndroidRuntime(7603): Process: com.ppero196.thumbnail.file.deleter:remote, PID: 7603 01-23 20:18:32.541: E/AndroidRuntime(7603): java.lang.RuntimeException: Unable to start receiver com.ppero196.thumbnail.file.deleter.reminderreciever: java.lang.IllegalArgumentException: contentView required: pkg=com.ppero196.thumbnail.file.deleter id=2131492903 notification=Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x0 kind=[null]) 01-23 20:18:32.541: E/AndroidRuntime(7603): Caused by: java.lang.IllegalArgumentException: contentView required: pkg=com.ppero196.thumbnail.file.deleter id=2131492903 notification=Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x0 kind=[null]) 01-23 20:18:32.541: E/AndroidRuntime(7603): at com.ppero196.thumbnail.file.deleter.reminderreciever.onReceive(reminderreciever.java:25) From i gathered i need ContentView somwhere, but i don't know where. This is my reminder class: package com.ppero196.thumbnail.file.deleter; import java.util.Calendar; import android.app.Activity; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class reminder extends Activity { EditText valor1; String myEditValue; public static int day; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.remind); getActionBar().setDisplayHomeAsUpEnabled(true); Button buttonStart = (Button)findViewById(R.id.start); buttonStart.setOnClickListener(new Button.OnClickListener(){ @Override public void onClick(View arg0) { …
has comment: http://stackoverflow.com/comment/32132134
tagged with: broadcastreceiver
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32132304
tagged with: notifications
has title: Receiver throws IllegalArgument exception
type: Question
tagged with: android
tagged with: android-intent
score: 0

http://stackoverflow.com/a/21344501
answers question: http://stackoverflow.com/q/21344394
has body: The method append() you are calling is a method for the TextArea control. You need the setText() method for the TextField control instead. Sources: http://docs.oracle.com/javase/tutorial/uiswing/components/textarea.html http://docs.oracle.com/javase/tutorial/uiswing/components/textfield.html
score: 0
type: Answer

http://stackoverflow.com/q/21261025
possible better answer: http://stackoverflow.com/a/21261635
has answer: http://stackoverflow.com/a/21261635
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jndi
has body: I have been stuck at a point for so long. I am trying to authenticate a user from an LDAP directory using LDAP via JNDI, but the code attached below returns nothing for "results" i.e. the search method (marked with **) returns null. I tried to debug the code, but did not understand what exactly is going on behind the "search" function of "DirContext" class. Can anybody help please? public class Authenticate { @SuppressWarnings({ "unchecked", "rawtypes", "unused" }) public static void main(String[] args) throws NamingException { final String ldapAdServer = "ldap://iauth.tum.de:389/cn=someuser,ou=users,ou=data,ou=prod,ou=iauth,dc=tum,dc=de"; final String ldapUsername = "cn=someuser,ou=users,ou=data,ou=prod,ou=iauth,dc=tum,dc=de"; final String ldapPassword = "somepassword"; Hashtable env = new Hashtable(); env.put(Context.SECURITY_AUTHENTICATION, "none"); if(ldapUsername != null) { env.put(Context.SECURITY_PRINCIPAL, ldapUsername); } if(ldapPassword != null) { env.put(Context.SECURITY_CREDENTIALS, ldapPassword); } env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, ldapAdServer); DirContext ctx = new InitialDirContext(env); NamingEnumeration&lt;SearchResult&gt; results = null; SearchControls controls = new SearchControls(); controls.setSearchScope(SearchControls.SUBTREE_SCOPE); **results = ctx.search("", "(objectClass=Person)", controls);** while (results.hasMoreElements()) { SearchResult searchResult = (SearchResult) results.next(); Attributes attributes = searchResult.getAttributes(); Attribute attr = attributes.get("cn"); } } } Since the search method of "DirContext" (marked in **), returns nothing, I can never enter the while loop. Can anybody tell where exactly I am being wrong.
has answer: http://stackoverflow.com/a/21263896
score: 0
has title: JNDI LDAP returns nothing
accepted answer: http://stackoverflow.com/a/21263896
answer count: 2
tagged with: ldap

http://stackoverflow.com/a/21201484
has body: The easiest way is to loop over it and convert each item into a new list of strings yourself. ArrayList&lt;Object&gt; list = new ArrayList&lt;Object&gt;(); list.add(1); list.add("Java"); list.add(3.14); List&lt;String&gt; strings = new ArrayList&lt;String&gt;(); for (Object object : list) { strings.add(object != null ? object.toString() : null); }
has comment: http://stackoverflow.com/comment/31928501
has comment: http://stackoverflow.com/comment/31926435
has comment: http://stackoverflow.com/comment/31926819
score: 1
has comment: http://stackoverflow.com/comment/31926460
has comment: http://stackoverflow.com/comment/31926622
answers question: http://stackoverflow.com/q/21201415
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21201415
has comment: http://stackoverflow.com/comment/31928144
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31928677

http://stackoverflow.com/comment/32001165
score: 0
comment on: http://stackoverflow.com/q/21242479
type: Comment
type: QuestionComment
has text: If it has JDBC support it will work. fI assume you know that MS Access is not really meant for this sort of thing and will not be able to scale to handle any serious volume or load.

http://stackoverflow.com/q/21299038
accepted answer: http://stackoverflow.com/a/27060086
score: 20
linked to: http://stackoverflow.com/q/21051689
answer count: 1
tagged with: java-8
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/32210701
has title: Root hasn't been set Error with Java 8 Eclipse
has answer: http://stackoverflow.com/a/27060086
type: AnsweredQuestion
upvote count: 20
downvote count: 0
has body: Recently I installed Java 8 build 124 for my JavaFX application and I started getting these errors: javafx.fxml.LoadException: Root hasn't been set. Use method setRoot() before load. /Users/jonathan/Projects/Dominion/target/classes/dominion/application/controller/main_overview_tab.fxml:13 at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2613) at javafx.fxml.FXMLLoader.access$100(FXMLLoader.java:104) at javafx.fxml.FXMLLoader$RootElement.constructValue(FXMLLoader.java:1320) at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:740) at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2723) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409) at dominion.application.controller.MainOverviewTab.initView(MainOverviewTab.java:64) at dominion.application.controller.MainOverviewTab.initializeController(MainOverviewTab.java:55) at dominion.application.controller.GameSetupController.&lt;init&gt;(GameSetupController.java:37) at dominion.application.controller.DashboardController.&lt;init&gt;(DashboardController.java:40) at dominion.application.controller.MainController.&lt;init&gt;(MainController.java:37) at dominion.application.Dominion.start(Dominion.java:18) 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.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) javafx.fxml.LoadException: Root hasn't been set. Use method setRoot() before load. /Users/jonathan/Projects/Dominion/target/classes/dominion/application/controll…
favorite count: 0
tagged with: javafx-8
type: Question
tagged with: macos
linked to: http://stackoverflow.com/q/19972735
has comment: http://stackoverflow.com/comment/32102901

http://stackoverflow.com/comment/32005395
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21245449
has text: @EJP if you have a large object and a long method where setting to `null` would help I would suggest breaking the method so the variable just goes out of scope.

http://stackoverflow.com/a/21263689
answers question: http://stackoverflow.com/q/21263263
type: AcceptedAnswer
score: 1
type: Answer
upvote count: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21263263
has body: The problem is here , you are trying to cast the activity(this) to OnClickListener mBtn1.setOnClickListener((OnClickListener) this); The solution is to make your activity implements OnClickListener and create the unimplemented method

http://stackoverflow.com/comment/32174223
type: Comment
type: QuestionComment
has text: Thank you for your question - I've clarified my question
score: 0
comment on: http://stackoverflow.com/q/21341027

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

http://stackoverflow.com/a/21274259
score: 2
accepted answer of: http://stackoverflow.com/q/21273950
has body: HttpGet httpPost = new HttpGet(url);
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21273950
upvote count: 2
type: Answer

http://stackoverflow.com/a/67337238
answers question: http://stackoverflow.com/q/21276059
type: Answer
score: 0
has body: I have solved this Problem using addBatch and executeBatch as following: statement.addBatch("DELETE FROM public.session_event WHERE id = " + entry.getKey()); statement.executeBatch();

http://stackoverflow.com/a/21313455
type: Answer
has body: You should look on Guava lib, there a nice explanation of why you shouldn't have any null on Collections. https://code.google.com/p/guava-libraries/wiki/UsingAndAvoidingNullExplained Some example of use. public class OptionalInteger { final static Optional&lt;Integer&gt; NULL = Optional.absent(); public static void main(String[] args) { final ArrayList&lt;Optional&lt;Integer&gt;&gt; list = Lists.newArrayList(); for (int i = 21; i &lt; 36; i++) { list.add(Optional.fromNullable(i)); } list.add(10, NULL); list.add(12, NULL); System.out.println(list); Collections.sort(list, new Comparator&lt;Optional&lt;Integer&gt;&gt;() { @Override public int compare(Optional&lt;Integer&gt; o1, Optional&lt;Integer&gt; o2) { if(!o1.isPresent()) return 1; if(!o2.isPresent()) return -1; return o1.get().compareTo(o2.get()); } }); System.out.println(list); } }
score: 0
answers question: http://stackoverflow.com/q/21312876

http://stackoverflow.com/q/21286746
accepted answer: http://stackoverflow.com/a/21286860
has title: How to interaction with a webpage in Java?
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/21286860
tagged with: interaction
tagged with: http://stackoverflow.com/tag/html
answer count: 1
downvote count: 0
has body: Now, I am a beginner in Java. I have somehow managed to understand the following code. import java.net.*; import java.io.*; public class URLConnectionReader { public static void main(String[] args) throws Exception { URL yahoo = new URL("http://www.yahoo.com/"); URLConnection yc = yahoo.openConnection(); BufferedReader in = new BufferedReader( new InputStreamReader( yc.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); } } I actually got that with quite some effort so please do understand I am a beginner. I want to interact with the webpage. From the code, I understood whatever information of the webpage will be simply displayed. I just need your help to advice me wha should I study next. I want my webpage to go to the webpage, login Then click on a button Do a comparision between two columns and report it to me if it isn't equal. I did do reading on HTTP and I know webinteraction is possible. People have code out there that is above my understanding. I don't know much about inheritence or encapsulation [still learning](incase it is required) Using the code I provided, is it possible to add on my requirements? Cause people are giving one lined codes or 30 lined code...please realize I am not so good in it. I did do research .I just want someone to give me direction. I am starting to get confused due to so many methods. I think someone told me php is easier on this matter, but in php I don't even know anything. (I know it is OOPS language but still) Any sort of guidance is truely appreciated.
favorite count: 0

http://stackoverflow.com/comment/32056049
comment on: http://stackoverflow.com/q/21274346
score: 0
type: Comment
type: QuestionComment
has text: Unfortunately, they haven't updated the [homepage](http://jasmin.sourceforge.net/) for almost ten years. I own the book.

http://stackoverflow.com/a/21206836
has comment: http://stackoverflow.com/comment/31935772
has comment: http://stackoverflow.com/comment/31935826
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/21206777
type: Answer
has comment: http://stackoverflow.com/comment/31937326
has comment: http://stackoverflow.com/comment/31935991
has body: You assign no data to your variables at all in your scanning loop, and not only that, but you read from the Scanner twice while checking it for data only once, a dangerous thing to do. while(in.hasNext()){ // **** checking once **** while(in.next() != null){ // **** read in and waste a token here! System.out.println(elements++); } in.nextLine(); // **** read in and waste a line here rows++; } in.close(); I would: Use two Scanner variables, one, fileScanner, to read in each line of text in the file,... And one called lineScanner to read in each token on the line. I'd use an outer while loop, that checks fileScanner.hasNextLine(), and then calls nextLine() to read the line into a String, say called line. I'd then create a new Scanner with the line of String created, and assign it into a lineScanner variable. I'd use an inner while loop that loops while lineScanner.hasNext(), and reads in the data into your your variables. I'd close the inner lineScanner at the end of the outer while loop so as not to waste resources. Alternatively, you could use String#split(...) to split the tokens in the line read in, and then parse the Strings into numbers. For example, public List&lt;RowData&gt; loadDistances(String fname) throws FileNotFoundException, NumberFormatException { File file = new File(fname); Scanner fileScanner = new Scanner(file); List&lt;RowData&gt; rowList = new ArrayList&lt;RowData&gt;(); while (fileScanner.hasNextLine()) { String line = fileScanner.nextLine(); String[] tokens = line.split("\\s+"); if (tokens.length != 3) { // throw some custom exception } int rowNumber = Integer.parseInt(tokens[0].trim()); int xData = Integer.parseInt(tokens[1].trim()); double yData = Double.parseDouble(tokens[2].trim()); rowList.add(new RowData(rowNumber, xData, yData)); } if (fileScanner != null) { fileScanner.close(); } return rowList; } Edit By using a line Scanner, I recommend creating a second Scanner, passing in the line obtained from the first Scanner, and extracting data…
upvote count: 4

http://stackoverflow.com/a/21243763
has body: Instead of this: event = new KeyEvent((Component) event.getSource(), KeyEvent.KEY_RELEASED, event.getWhen(), event.getModifiersEx() | KeyEvent.SHIFT_DOWN_MASK, event.getKeyCode(), KeyEvent.CHAR_UNDEFINED); I should have done this: event = new KeyEvent((Component) event.getSource(), event.getID(), event.getWhen(), event.getModifiersEx() | KeyEvent.SHIFT_DOWN_MASK, event.getKeyCode(), KeyEvent.CHAR_UNDEFINED); Note that instead of KeyEvent.KEY_RELEASED I have event.getID().
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21237666

http://stackoverflow.com/comment/32099474
comment on: http://stackoverflow.com/q/21299231
has text: Code that shows client writing to the socket and server reading from the socket?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31991074
has text: But, you need to use my latest code. refer my answer. use `append` instead of `html` on js part
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21231882

http://stackoverflow.com/a/21237055
downvote count: 2
has body: You need the source attached to your library. There's no point for Eclipse to take you to the .class file since all you would see is a bunch of compiled jamble-wamble (that's just a word I came up with). Eclipse will only navigate to Java source files.
has comment: http://stackoverflow.com/comment/31990225
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31991792
answers question: http://stackoverflow.com/q/21235807
has comment: http://stackoverflow.com/comment/31990723
has comment: http://stackoverflow.com/comment/31990333
has comment: http://stackoverflow.com/comment/31989994
has comment: http://stackoverflow.com/comment/31990560
upvote count: 2

http://stackoverflow.com/comment/32044548
comment on: http://stackoverflow.com/q/21262030
type: Comment
type: QuestionComment
has text: Have you looked at the tutorials in java and C? this should be easy for you...
score: 0

http://stackoverflow.com/q/21302240
type: AnsweredQuestion
tagged with: oop
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32104466
accepted answer: http://stackoverflow.com/a/21302321
has comment: http://stackoverflow.com/comment/32104374
has comment: http://stackoverflow.com/comment/32106277
possible better answer: http://stackoverflow.com/a/21302523
type: Question
has answer: http://stackoverflow.com/a/21302523
has title: Understanding methods in Java
has body: I am new to Java.This was a example on OOP.I have a class file named "Automobile.java" and the driver program saved as AutomobileTest.java.My question is when a object is created in AutomobileTest.java how does it know that it has to access the methods and variables from Automobile.java. This is my code: Automobile.java class Automobile{ public int numWheels; public String colour; public boolean engineRunning; public double mileage; public int numSeats; public Automobile(int wheels,int seats,String vehicleColour){ numWheels=wheels; numSeats=seats; colour=vehicleColour; engineRunning=false; mileage=0.0; } public void startEngine(){ engineRunning=true; } public void stopEngine(){ engineRunning=false; } public double drive(double numMiles){ return mileage+=numMiles; } public String toString(){ String s="numWheels="+numWheels+"\nNumber of seats = "+numSeats+ "\nColour:" +colour+ "\nEngineRunning: " + engineRunning; return s; } } AutomobileTest.java public class AutomobileTest{ public static void main (String args[]){ Automobile ferrari=new Automobile(4,2,"red"); System.out.println(ferrari); System.out.println("Engine started"); ferrari.startEngine(); System.out.println(ferrari); } }
favorite count: 0
has comment: http://stackoverflow.com/comment/32104430
linked to: http://stackoverflow.com/q/215497
has comment: http://stackoverflow.com/comment/32104641
answer count: 4
has answer: http://stackoverflow.com/a/21302651
has answer: http://stackoverflow.com/a/21303214
has comment: http://stackoverflow.com/comment/32104370
upvote count: 2
has comment: http://stackoverflow.com/comment/32104547
has comment: http://stackoverflow.com/comment/32104638
has answer: http://stackoverflow.com/a/21302321
downvote count: 1

http://stackoverflow.com/comment/31987078
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21235372
has text: I have already tried this. -Xms128m -Xmx1024m -XX:MaxPermSize=250m -XX:ReservedCodeCacheSize=64m -XX:+UseCodeCacheFlushing -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true

http://stackoverflow.com/q/21334078
tagged with: java
type: Question
answer count: 2
tagged with: mocking
downvote count: 0
favorite count: 0
has body: I have a XML and XSD file. the XML file is generated using Java on tomcat/ubuntu platform. Its used for integration between system. second system is using XSD to validate my XML and it say that my XML is not correct. I would like to slowly fix the XML file, but there is a time issue. They want my XML to be correct with XSD sooner than ASAP. Is there any tool/algoritm that can take my XML and the XSD. Add mock fields that are not there. What I want: my not yet correct XML goes into a method and XML correct with XSD is returned. It sounds like some testing framework should be able to do that. Please help.
linked to: http://stackoverflow.com/q/8968701
has answer: http://stackoverflow.com/a/21336415
tagged with: junit
has comment: http://stackoverflow.com/comment/68579026
possible better answer: http://stackoverflow.com/a/21344360
tagged with: http://stackoverflow.com/tag/xml
has title: How to "Auto-Repair" XML based on XSD?
accepted answer: http://stackoverflow.com/a/21336415
has answer: http://stackoverflow.com/a/21344360
upvote count: 1
tagged with: xsd
type: AnsweredQuestion
score: 1

http://stackoverflow.com/a/21217251
answers question: http://stackoverflow.com/q/21217090
has comment: http://stackoverflow.com/comment/31954342
has body: Try This Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance(); Connection connection=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost/DatabaseName","userName","password");
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/21220300
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31960072
has body: I need to know how to debug this. 01-19 17:36:09.206: E/AndroidRuntime(487): FATAL EXCEPTION: main 01-19 17:36:09.206: E/AndroidRuntime(487): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.aoutsu/com.example.aoutsu.AddNewItem}; have you declared this activity in your AndroidManifest.xml? 01-19 17:36:09.206: E/AndroidRuntime(487): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405) 01-19 17:36:09.206: E/AndroidRuntime(487): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379) 01-19 17:36:09.206: E/AndroidRuntime(487): at android.app.Activity.startActivityForResult(Activity.java:2827) 01-19 17:36:09.206: E/AndroidRuntime(487): at android.app.Activity.startActivity(Activity.java:2933) 01-19 17:36:09.206: E/AndroidRuntime(487): at com.example.aoutsu.HomePage$1.onClick(HomePage.java:50) 01-19 17:36:09.206: E/AndroidRuntime(487): at android.view.View.performClick(View.java:2485) 01-19 17:36:09.206: E/AndroidRuntime(487): at android.view.View$PerformClick.run(View.java:9080) 01-19 17:36:09.206: E/AndroidRuntime(487): at android.os.Handler.handleCallback(Handler.java:587) 01-19 17:36:09.206: E/AndroidRuntime(487): at android.os.Handler.dispatchMessage(Handler.java:92) 01-19 17:36:09.206: E/AndroidRuntime(487): at android.os.Looper.loop(Looper.java:123) 01-19 17:36:09.206: E/AndroidRuntime(487): at android.app.ActivityThread.main(ActivityThread.java:3683) 01-19 17:36:09.206: E/AndroidRuntime(487): at java.lang.reflect.Method.invokeNative(Native Method) 01-19 17:36:09.206: E/AndroidRuntime(487): at java.lang.reflect.Method.invoke(Method.java:507) 01-19 17:36:09.206: E/AndroidRuntime(487): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 01-19 17:36:09.206: E/AndroidRuntime(487): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 01-19 17:36:09.206: E/AndroidRuntime(487): at dalvik.system.NativeStart.main(Native Method) This is my…
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/21220334
has comment: http://stackoverflow.com/comment/31960017
tagged with: java
has comment: http://stackoverflow.com/comment/31959979
score: -1
answer count: 2
upvote count: 0
accepted answer: http://stackoverflow.com/a/21220341
has comment: http://stackoverflow.com/comment/31960136
favorite count: 0
has comment: http://stackoverflow.com/comment/31960013
has answer: http://stackoverflow.com/a/21220334
tagged with: android
has answer: http://stackoverflow.com/a/21220341
has title: Android app force closed

http://stackoverflow.com/q/21184604
type: Question
tagged with: jakarta-ee
has title: how to get static connection object in case of pooling?
tagged with: apache
has body: Iam unable to understand how to get connection in other classes (iam using connection pooling using DBCP) MyServlet //NOT A COmplete Code class MyServlet extends HttpServlet { public Datasource getDatasource(){ Class.forName(driver).newInstance(); ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(connectUri, username, password); PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, new GenericObjectPool(null), null, "SELECT null", false, true); connectionPool = new GenericObjectPool(poolableConnectionFactory); connectionPool.setMaxActive(10); connectionPool.setMaxIdle(4); return new PoolingDataSource(connectionPool); } Now I have something like method getConnection inside MyServlet public static Connection getConnection () { } A) How do I use datasource inside getConnection() static ethod ? I dont want to make getDatasource() as static method and then use since I feel using static dangerous when we use pooling mechanism B) Please show me a way to get ultimately static getConnection() and also satisfies pooling merchanism perfectly..
score: 0
tagged with: apache-commons-dbcp
answer count: 1
has answer: http://stackoverflow.com/a/21184771
type: UnansweredQuestion
tagged with: connection-pooling
tagged with: java

subdirectory
tags question: http://stackoverflow.com/q/21320365
tag name: subdirectory
type: Tag

http://stackoverflow.com/a/21196182
upvote count: 1
type: Answer
has body: I think you should call it as java mytetris.Tetris
answers question: http://stackoverflow.com/q/21196120
downvote count: 0
score: 1

http://stackoverflow.com/comment/32052882
has text: Well it is not working though...col is empty...No i have no exceptions when i use AsyncTask.execute(). I have a java.util.concurrent.TimeoutException when i use AsyncTask.execute().get(1, TimeUnit.MILLISECONDS);
type: Comment
comment on: http://stackoverflow.com/q/21272216
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32181722
type: AnswerComment
type: Comment
has text: This isn't necessarily the case for your book, but I remember when I was in college some of the code in the books I had for class just didn't work as written. I remember one book that was clearly translated to Java from C, but poorly. So many of the methods didn't work without a bit of manipulation.
score: 1
comment on: http://stackoverflow.com/a/21345090

http://stackoverflow.com/q/21246579
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/32007393
score: 0
has body: I'm trying to call from a Fragment an OnClick method from the parent activity in another package. The code for the onClick methods are: public static void Back(View v) { mPager.setCurrentItem(mPager.getCurrentItem() - 1, true); } public static void Next(View v) { mPager.setCurrentItem(mPager.getCurrentItem() + 1, true); } And here's the code for the Fragment where I want to call these methods from public class Level1Question1 extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View rootView = inflater.inflate(R.layout.fragment_a, container, false); Button buttonQuestion = (Button) rootView.findViewById(R.id.buttonQuestion); What do I do here? return rootView;
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32009054
has title: Using OnClick from another activity in another package
has comment: http://stackoverflow.com/comment/32008862
tagged with: onclick
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32009010
has comment: http://stackoverflow.com/comment/32007568

http://stackoverflow.com/comment/32069666
comment on: http://stackoverflow.com/a/21282360
score: 0
type: AnswerComment
has text: O Yes! That's the point. It means that Java exhibits late binding behavior?
type: Comment

http://stackoverflow.com/comment/31931179
type: QuestionComment
type: Comment
has text: Dont care about the Order. You are not able to discover the big-bang of deserialization except readObject/writeObject.
comment on: http://stackoverflow.com/q/21204242
score: 0

http://stackoverflow.com/comment/31964325
type: Comment
score: 0
type: AnswerComment
has text: You can refer to private members inside of the class - that's not a problem
comment on: http://stackoverflow.com/a/21222659

http://stackoverflow.com/comment/32003363
type: AnswerComment
has text: Please see the revised edition, you'll notice you'll get an error when you run compile it.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21243930

http://stackoverflow.com/comment/32277184
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21334209
type: QuestionComment
has text: No, I am using Eclipse.

http://stackoverflow.com/q/21278307
tagged with: spring-data-rest
has comment: http://stackoverflow.com/comment/42626445
has comment: http://stackoverflow.com/comment/32088128
tagged with: websocket
upvote count: 34
has answer: http://stackoverflow.com/a/63408616
has comment: http://stackoverflow.com/comment/47038319
has comment: http://stackoverflow.com/comment/42633138
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/30967370
has comment: http://stackoverflow.com/comment/32087186
downvote count: 0
type: UnansweredQuestion
has title: How to mix spring-data-rest with spring websocket into a single implementation
score: 34
tagged with: java
favorite count: 0
has body: I'd like to synchronize the state to all the clients interested in particular entity changes. So I'd like to achieve something like: exposing CRUD API on entity (via HTTP/REST and websockets) and routing the response (of the modifying calls) to websockets topic So technically, I'd be interested in ideas to mix spring-data-rest with spring websockets implementation to achieve something like spring-data-websocket. There are a two solutions coming to my mind, and in fact both would be: spring-data-rest to expose my entities via REST/HTTP API websocket controllers (used for the modification calls on entities) The websocket controllers would look like this: @Controller public class EntityAWebSocketController { @MessageMapping("/EntityA/update") @SendTo("/topic/EntityA/update") public EntityA update(EntityA entityA) throws Exception { // persist,.... return entityA; } } Scenario 1: Websocket API called from REST/HTTP API Rules: client request is always REST/HTTP API response is REST/HTTP API for all the operations moreover for modifying operations the websocket message comes as well Technically, could be achieved, by: calling the websocket controllers from the spring-rest-data events (namely in the AfterCreateEvent, AfterSaveEvent, AfterLinkSaveEvent, AfterDeleteEvent) Still the solution seems quite sick to me, as I'd need to go for: client A --HTTP request--> Server (spring-data-rest controller) Server (AfterXXXEvent in the spring-data-rest controller) --websocket message--> Spring websocket controller Spring websocket controller --websocket message via topic--> all Clients interested in the topic Server (spring-data-rest controller) --HTTP response--> client A Scenario 2: Websocket API independent from REST API Rules: client request is REST/HTTP API for non-modifying operations only response is REST/HTTP API for non-modifying operations only client sends websocket message for all the modifying operations websocket message is sent to client for all the modifying operatio…
type: Question
answer count: 2

http://stackoverflow.com/q/21325792
tagged with: paint
score: 0
has answer: http://stackoverflow.com/a/21326097
tagged with: java
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/32146628
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32146675
has title: Java JFrame rectangle
linked to: http://stackoverflow.com/q/21298002
type: Question
tagged with: jframe
has comment: http://stackoverflow.com/comment/32146506
linked to: http://stackoverflow.com/q/20844144
has body: So, I've been learning Java and I'm still pretty new, so bear with me. My latest goal is graphical programs, and this one is a test on keyboard control. For some reason, this program won't display a rectangle. Normally paint() runs on its own, but for some reason it isn't. I've looked at other programs that I made that work, and others on the web, and I still can't figure it out. import java.awt.*; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JFrame; public class App extends JFrame{ public static int keyVal = 0; public static void main(String[] args) { new App(); while(true){ System.out.println(keyVal); Wait.ms(50); } } public App(){ JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setTitle("Pong"); f.setSize(300,400); f.setLocationRelativeTo(null); f.addKeyListener(new KeyListener(){ public void keyPressed(KeyEvent e){ keyVal = e.getKeyCode(); } public void keyReleased(KeyEvent e){ keyVal = 0; } public void keyTyped(KeyEvent e){} }); f.setVisible(true); } public void paint(Graphics g){ g.setColor(Color.orange); while(true){ g.drawRect(20, 20, 100, 60); } } }
has comment: http://stackoverflow.com/comment/32146845

http://stackoverflow.com/q/21205024
type: Question
score: 0
tagged with: client-server
has body: I have a TCP/IP socket server which send multiple response to client based on client's requirement ( like send update whenever DB has an update). client sends xml and server too respond xml. I stumbled on Netty yesterday. I want to know whether Netty can support my multiple response server application?
has answer: http://stackoverflow.com/a/21208307
answer count: 1
has title: Can netty send more than one response per client request
tagged with: netty
type: UnansweredQuestion
tagged with: tcp
tagged with: java

http://stackoverflow.com/q/21265735
has answer: http://stackoverflow.com/a/21265862
has comment: http://stackoverflow.com/comment/32040683
has comment: http://stackoverflow.com/comment/32041178
has title: How to execute Maven's antrun between testCompile and test phases (before Surefire executes)?
type: Question
answer count: 2
score: 2
possible better answer: http://stackoverflow.com/a/21265888
downvote count: 0
has answer: http://stackoverflow.com/a/21265888
tagged with: maven-3
favorite count: 0
accepted answer: http://stackoverflow.com/a/21265862
has comment: http://stackoverflow.com/comment/32040320
has comment: http://stackoverflow.com/comment/32043579
tagged with: maven-antrun-plugin
upvote count: 2
tagged with: maven
tagged with: maven-surefire-plugin
has body: In my Maven build, I have a small block of Ant code that needs to run right before the Surefire kicks in to perform a few configurations. The code is executed with antrun, but I can't get antrun to be executed right before Surefire. Here is the relevant section of the output of my build: [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ com...tests --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 7 source files to C:\...\com...tests\target\test-classes [INFO] [INFO] --- maven-surefire-plugin:2.16:test (default-test) @ com...tests --- [INFO] Surefire report directory: C:\...\com...tests\target\surefire-reports Basically I need antrun to execute between maven-compiler-plugin:3.1:testCompile and maven-surefire-plugin:2.16:test . I tried binding the antrun to the test phase and place it before the surefire plugin in the POM file, but it always executes after the Surefire plugin. I also tried to configure it to run in the testCompile phase, and place it after the maven-compiler-plugin plugin, but no success either.. it executes after surefire. Does anyone know how to get it to execute in between these two?? Thank you! Eduardo
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/32382380
comment on: http://stackoverflow.com/a/21347007
type: Comment
score: 0
type: AnswerComment
has text: I found out that I was not properly URL encoding one of my parameters. When I fixed this I still get an error, but it is different. I get HTTP code = 400 and an JSON error "Invalid Grant"

http://stackoverflow.com/q/21287443
tagged with: signal-processing
has body: So I am implementing The Maximum Response (MR) Filter Bank - MR8. I am using this as a reference: http://www.robots.ox.ac.uk/~vgg/research/texclass/filters.html And so far I have written the 38 filters, but have no idea how to compute the maximum filter response from the 6 rotations of each edge and bar filter variations. What is a filter response? Is it the result from the filter application or something else? What is a maximum response? How to compute the maximum responses for the edge and bar filters?
type: Question
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/30741335
has title: What is a maximum filter response in MR8 filter bank?
has answer: http://stackoverflow.com/a/21306398
accepted answer: http://stackoverflow.com/a/21306398
upvote count: 7
has answer: http://stackoverflow.com/a/30741335
tagged with: opencv
type: AnsweredQuestion
score: 7
tagged with: java
tagged with: image-processing

http://stackoverflow.com/comment/31904752
comment on: http://stackoverflow.com/q/21189452
type: Comment
has text: there is a private constructor here: private ServerFace() throws Exception{ }
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31958844
type: Comment
type: QuestionComment
has text: /definitions/portType/operation[@name=sayHello]/*
comment on: http://stackoverflow.com/q/21219544
score: 0

http://stackoverflow.com/comment/31928227
comment on: http://stackoverflow.com/q/21201903
has text: and PClass implements Serializable.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21266826
has title: Play framework: scala template, if statement issue
tagged with: scala
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21268996
type: Question
tagged with: if-statement
has answer: http://stackoverflow.com/a/21268996
score: 0
tagged with: playframework
answer count: 1
has body: I can't figure out why this doesn't work, here is my template code: @workuserForm: Form[WorkUser],queues: List[Queue]) @import helper._ @import helper.twitterBootstrap._ @main("User Form"){ @helper.form(action = routes.Users.saveWorkUser() , 'class -&gt; "form-horizontal"){ @for(queue &lt;- queues){ @repeat(workuserForm("queues"), min = 0){ wuQueue =&gt; @wuQueue("id").value @queue.id @if(wuQueue("id").value == queue.id){ checked } } } The output I get: 1 1 1 2 1 3 2 1 2 2 2 3 3 1 3 2 3 3 Where I should get: 1 1 checked 1 2 1 3 2 1 2 2 checked 2 3 3 1 3 2 3 3 checked My models: public class WorkUser { public String showName; public List&lt;Queue&gt; queues = new ArrayList&lt;Queue&gt;(); } public class Queue extends Model { public long id; public String name; } My controller ( where I call the scala template) public class Users extends Controller { private static final Form&lt;WorkUser&gt; workuserForm = Form.form(WorkUser.class); public static Result newWorkUser() { List&lt;Queue&gt; queues = Queue.findAll(); WorkUser workUserAux = new WorkUser(); workUserAux.queues = queues; Form&lt;WorkUser&gt; filledForm = workuserForm.fill(workUserAux); return ok(views.html.workUser.render(filledForm,queues)); } } It seems that the problem is in the if statement but i can't solve it , I've tried all.

http://stackoverflow.com/comment/31965698
comment on: http://stackoverflow.com/q/21223419
score: 0
type: Comment
type: QuestionComment
has text: The error message I wrote "Could not open the file for some reason." always prints and causes a Exception thread in main

http://stackoverflow.com/comment/31898154
has text: Because the language designers decided thusly. Would you like a quote from the JLS with that?
type: Comment
type: QuestionComment
score: 7
comment on: http://stackoverflow.com/q/21186232

http://stackoverflow.com/q/21336305
tagged with: jpanel
has comment: http://stackoverflow.com/comment/32167736
has answer: http://stackoverflow.com/a/21336531
upvote count: 3
accepted answer: http://stackoverflow.com/a/21336531
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/21336890
has body: I have a problem with Paint- Repaint-Mechanism in Swing java.: i want to create GraphicEditor, which can create a rectangle and shape with the Mouse. The application should look like this My Code Look like this : public class MiniGrafikEditor extends JFrame implements ActionListener { private Vector rectList; private Rectangle currentRect; private Color color = Color.green; private static int v = 0 ; JPanel bp; public static void main(String[] args) { MiniGrafikEditor wnd = new MiniGrafikEditor(); } public MiniGrafikEditor() { super("Rechtecke zeichnen"); rectList = new Vector(); currentRect = new Rectangle(0, 0, 0, 0); setLayout(new BorderLayout()); addWindowListener(new MyWindowListener()); addMouseListener(new MyMouseListener()); addMouseMotionListener(new MyMouseMotionListener()); bp = new JPanel(); bp.setBackground(Color.gray); add("North", bp); JRadioButton b = null; bp.add(b = new JRadioButton("Rechteck")); b.addActionListener(this); bp.add(b = new JRadioButton("kreis")); b.addActionListener(this); bp.add(b = new JRadioButton("Standard")); b.addActionListener(this); setLocation(200, 200); setSize(400, 300); setVisible(true); } public void actionPerformed(ActionEvent e) { String label = ((JRadioButton) e.getSource()).getLabel(); bp.repaint(); if (label.equals("Rechteck")) { v=1; bp.repaint(); } if (label.equals("Blue")) { color = Color.blue; bp.repaint(); } Graphics g = getGraphics(); drawRects(g); } public void drawRects(Graphics g) { Rectangle r; Enumeration e; g.clearRect(0, 0, getSize().width, getSize().height); g.setColor(color); for (e = rectList.elements(); e.hasMoreElements();) { r = (Rectangle) e.nextElement(); g.drawRect(r.x, r.y, r.width, r.height); } if (currentRect != null &amp;&amp; (currentRect.x &gt; 0 || currentRect.y &gt; 0)) { g.drawRect(currentRect.x, currentRect.y, currentRect.width, currentRect.height); } bp.repaint(); } class MyMouseListener extends MouseAdapter { public void mousePressed(MouseEvent event) { bp.repaint(); if(v==1){ curre…
has title: Paint- Repaint-mechanism in Swing
tagged with: repaint
type: AnsweredQuestion
tagged with: paint
downvote count: 0
tagged with: java
tagged with: swing
type: Question
score: 3
possible better answer: http://stackoverflow.com/a/21336890

http://stackoverflow.com/q/21194081
has comment: http://stackoverflow.com/comment/31913783
tagged with: reflection
tagged with: scala
accepted answer: http://stackoverflow.com/a/21194578
tagged with: gradle
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
has body: I have a gradle project that has a scala subproject, say scalamodule. I want to be able to run the scala subproject as an application (this is part of the build/release process but it's irrelevant right now). Now if I use the Gradle application plugin and then run gradle :scalamodule:run the command that gets executed is something similar to this: java -cp /home/giovanni/Projects/someproject/classes/main:/home/giovanni/.gradle/caches/modules-2/files-2.1/com.wordnik/swagger-codegen_2.10/2.0.11/77ee00b1d13b23c4cb24cb43f8bb23b2ad9a492b/swagger-codegen_2.10-2.0.11.jar:/home/giovanni/.gradle/caches/modules-2/files-2.1/org.json4s/json4s-jackson_2.10/3.2.5/8d8839d9ea00caa5aab522c53f3bacbd7189cd7c/json4s-jackson_2.10-3.2.5.jar:/home/giovanni/.gradle/caches/modules-2/files-2.1/io.backchat.inflector/scala-inflector_2.10/1.3.5/7a6c4ca65263cfae1a841332df88f1f526d337b5/scala-inflector_2.10-1.3.5.jar:/home/giovanni/.gradle/caches/modules-2/files-2.1/commons-io/commons-io/2.3/cd8d6ffc833cc63c30d712a180f4663d8f55799b/commons-io-2.3.jar:/home/giovanni/.gradle/caches/modules-2/files-2.1/org.rogach/scallop_2.10/0.9.4/f262bb88c9f981413d19b295c4aa6e050da0b202/scallop_2.10-0.9.4.jar:/home/giovanni/.gradle/caches/modules-2/files-2.1/org.fusesource.scalate/scalate-core_2.10/1.6.1/202cab825c15fabf941ecbdfa49973c691462213/scalate-core_2.10-1.6.1.jar:/home/giovanni/.gradle/caches/modules-2/files-2.1/org.json4s/json4s-core_2.10/3.2.5/715bc4e4502a60baa9de6098f17143168e93c49f/json4s-core_2.10-3.2.5.jar:/home/giovanni/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-databind/2.2.2/3c8f6018eaa72d43b261181e801e6f8676c16ef6/jackson-databind-2.2.2.jar:/home/giovanni/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-reflect/2.10.1/2c96f085955741faeb4f8da709e88d6feb91194e/scala-reflect-2.10.1.jar:/home/giovanni/.gradle/caches/modules-2/files-2.1/org.fusesource.scalate/scalate-util_2.10/1.6.1/1f566e429a343310858ce261565e25e9376587d0/scalate-util_2.10-1.6.1.jar:/home/giovanni/.…
answer count: 1
has answer: http://stackoverflow.com/a/21194578
tagged with: scalate
has comment: http://stackoverflow.com/comment/31913422
has title: Gradle application plugin and Scala
linked to: http://stackoverflow.com/q/5798440

graphics2d
tags question: http://stackoverflow.com/q/21300526
tag name: graphics2d
tags question: http://stackoverflow.com/q/21344190
tags question: http://stackoverflow.com/q/21191481
tags question: http://stackoverflow.com/q/21323260
type: Tag

http://stackoverflow.com/comment/31941855
has text: I cant because , It wont work when I m overridding the equals and hascode of my List type. say my list is of type List<Favorite> instead of List<String>.
comment on: http://stackoverflow.com/a/21207911
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21249146
answers question: http://stackoverflow.com/q/21249104
accepted answer of: http://stackoverflow.com/q/21249104
type: AcceptedAnswer
downvote count: 0
has body: You could try the method Character.isDigit(). Also note that you can cast a char to a int by using (int)c: public static void main(String[] args) throws IOException { String alpha = "ABCDEFG1234567890"; for (int i = 0; i &lt; alpha.length(); i++) { char c = alpha.charAt(i); if (Character.isDigit((c))) { System.out.println(c); } else { System.out.println((int)c - 55); // Cast to 'int' } } } Output: 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/32088899
type: AnswerComment
has text: Thanks, also pointed out the file structure needed, which I didn't know
comment on: http://stackoverflow.com/a/21288533
type: Comment
score: 0

size
tags question: http://stackoverflow.com/q/21292248
type: Tag
tag name: size
tags question: http://stackoverflow.com/q/21246906
tags question: http://stackoverflow.com/q/21346013

http://stackoverflow.com/comment/32076860
has text: And what Maven plugin are you using to generate the classes?
score: 0
comment on: http://stackoverflow.com/q/21286677
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/123308413
comment on: http://stackoverflow.com/a/21223004
type: Comment
has text: wow! Exactly what I was looking for. You just saved me a lot of working hours
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32024170
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21233521
has text: You're not setting the response in `HttpServletResponse`. You're not using it at all. You seem to be writing to merge.xml but you're not using it? I'm struggling to see the scope of your project - what is this method being used for?

http://stackoverflow.com/q/21197255
type: AnsweredQuestion
tagged with: java
has title: Is adding a method to a Java annotation safe for backward compatibility
has comment: http://stackoverflow.com/comment/31919094
type: Question
has comment: http://stackoverflow.com/comment/31919080
answer count: 2
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/31919581
possible better answer: http://stackoverflow.com/a/21197570
has comment: http://stackoverflow.com/comment/31919064
has body: I have an annotation that is available in a library. Is it safe for me to add a new value to this annotation in a subsequent release without breaking those that compiled against the previous version of the library ? For example: // version 1 @Retention(RetentionPolicy.RUNTIME) public @interface MyAnnotation{ String firstValue(); String secondValue(); } If I add a method called "String thirdValue()", I assume a default value will be required since the legacy annotation users will not define that property. // version 2 @Retention(RetentionPolicy.RUNTIME) public @interface MyAnnotation{ String firstValue(); String secondValue(); String thirdValue() default "third"; } At runtime, I have some code that will attempt to read all values: Class myClass = MyObject.class; MyAnnotation annotation = myClass.getAnnotation(MyAnnotation.class); String firstValue = annotation.firstValue(); String secondValue = annotation.secondValue(); String thirdValue = annotation.thirdValue(); The java specification isn't clear about whether or not this is safe. http://docs.oracle.com/javase/specs/jls/se7/html/jls-13.html section "13.5.7. Evolution of Annotation Types" just mentions that annotations behave as interfaces.
has comment: http://stackoverflow.com/comment/31919031
accepted answer: http://stackoverflow.com/a/31721504
favorite count: 0
has comment: http://stackoverflow.com/comment/31936167
tagged with: annotations
has answer: http://stackoverflow.com/a/21197570
has answer: http://stackoverflow.com/a/31721504

http://stackoverflow.com/comment/32099700
type: Comment
has text: What's the point of starting a JVM and not giving it a program to execute?
score: 3
comment on: http://stackoverflow.com/q/21299405
type: QuestionComment

http://stackoverflow.com/comment/32107832
score: 0
comment on: http://stackoverflow.com/q/21302434
type: Comment
has text: @Yves Yes, absolutely, set of integer numbers.
type: QuestionComment

http://stackoverflow.com/comment/32414248
has text: Thanks Sandeep, it seems to me too that this is the only way. I have already implemented something similar.
type: AnswerComment
comment on: http://stackoverflow.com/a/21473183
score: 0
type: Comment

http://stackoverflow.com/a/21256211
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/21255878
has body: In the beginning you create BigNumber x = null and in the end you return it. But in between, I cannot seem to find any place where it is set? So the whole function "optimizes" to public BigNumber add(BigNumber number2){ return null; } That is what you do and that is why it is returning null, always.
type: Answer
score: 2

http://stackoverflow.com/comment/36120209
type: AnswerComment
has text: The best answer I have ever found the last day! Thank you!
type: Comment
score: 2
comment on: http://stackoverflow.com/a/21252588

http://stackoverflow.com/comment/32116758
type: QuestionComment
comment on: http://stackoverflow.com/q/21308839
has text: As mikkel mentioned, it's probably not loaded by spring. A common error in this type of scenarios is that there's a typo in the path to the file that does contain the property, but the `PropertyPlaceholderConfigurer` ignores the error as it's configured to ignore files that doesn't exist.
score: 0
type: Comment

http://stackoverflow.com/comment/32009621
type: Comment
comment on: http://stackoverflow.com/a/21247875
score: 0
type: AnswerComment
has text: Can you be more specific? Are you getting errors? The result is unexpected? I would recommend you to learn to debug your programs, you could use a debugger, or simply use `System.out.println` statements with helpful information, like `System.out.println("winner: " + win)` in the places you think convenient.

http://stackoverflow.com/comment/32229076
type: Comment
has text: You need use the original camel context to setup the NotifyBuilder.
comment on: http://stackoverflow.com/a/21328040
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32061162
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21277653
has text: R.I.P Formation, 2014.

http://stackoverflow.com/a/21186913
has body: It is making Á as á because of using lowercase. try using this if(charArr[i] == 'á')
answers question: http://stackoverflow.com/q/21186818
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/31936177
type: Comment
comment on: http://stackoverflow.com/a/21207105
score: 0
has text: You did not gave any details, how your `jTextFields` are organize Array, ArrayList ? Are names.. nothing..
type: AnswerComment

http://stackoverflow.com/a/21228860
answers question: http://stackoverflow.com/q/21228733
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: You are setting the visibility of logoff to false when you are logging off: logoff.setVisible(false); But you are setting visibility of logout to true when logging in: logout.setVisible(true); While still the visibility of logoff is false!
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32130842
accepted answer of: http://stackoverflow.com/q/21228733

http://stackoverflow.com/q/21275620
has answer: http://stackoverflow.com/a/21275926
linked to: http://stackoverflow.com/q/910374
tagged with: java
has answer: http://stackoverflow.com/a/21275828
score: 6
has answer: http://stackoverflow.com/a/21275770
has answer: http://stackoverflow.com/a/21276456
type: Question
type: AnsweredQuestion
has body: From the question Why does Java have transient fields?. I am able to understand the transient. But, not able to evaluate to using transient keyword at the time of designing. public class A implements Serializable { public String s; public transient ts; } If i do the same thing in alternative way.. public class A implements Serializable { public String s; //public transient ts;//removing this variable. } And use another class and define method inside the class and define the variable ts and do the operation and persist the value of s as business defines. QUESTION I didn't find any real time example in the web where i will take decision to define a variable transient. How could i take the decision to define transient at the time of designing? Is there any realtime scenario that helps me to understand?
answer count: 6
accepted answer: http://stackoverflow.com/a/21275926
tagged with: transient
has answer: http://stackoverflow.com/a/21275726
has title: Any real time example for transient variable in java
has comment: http://stackoverflow.com/comment/32058219
has comment: http://stackoverflow.com/comment/32059414
has answer: http://stackoverflow.com/a/21275753
downvote count: 0
tagged with: serializable
favorite count: 0
possible better answer: http://stackoverflow.com/a/21275753
upvote count: 6

http://stackoverflow.com/q/21280038
answer count: 9
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/66627974
has answer: http://stackoverflow.com/a/21280137
score: 25
has comment: http://stackoverflow.com/comment/32065466
tagged with: java
has answer: http://stackoverflow.com/a/21280072
has answer: http://stackoverflow.com/a/21280181
has answer: http://stackoverflow.com/a/21280568
type: Question
has answer: http://stackoverflow.com/a/45633625
upvote count: 26
has title: Java Error - Illegal Modifier for Parameter - Only final Permitted
downvote count: 1
has answer: http://stackoverflow.com/a/48247767
has answer: http://stackoverflow.com/a/57350375
favorite count: 0
has answer: http://stackoverflow.com/a/21280135
has body: What's wrong with the below Code public static void main(String[] args){ public static final String Name = "Robin Wilson"; } String Reference Name shows Compilation Error - Java Error - Illegal Modifier for Parameter Name - Only final Permitted Am okay with the below given suggestions, but I want to understand why its not permitted, though both are static?

http://stackoverflow.com/comment/32118820
comment on: http://stackoverflow.com/q/21310024
type: Comment
has text: Hello mr paul.cioroianu , I know this is not a tutorial site... Currently I don't have any approch, that why I posted like that..
score: 0
type: QuestionComment

http://stackoverflow.com/q/21237514
has comment: http://stackoverflow.com/comment/31991120
type: AnsweredQuestion
has title: Hibernate Exception: Missing Column (column exists)
type: Question
has answer: http://stackoverflow.com/a/21237875
tagged with: java
tagged with: hibernate
score: 4
has comment: http://stackoverflow.com/comment/31991438
has comment: http://stackoverflow.com/comment/31991479
upvote count: 4
has body: Okay, so within the database we have a table called distributionCompanies, created like so: CREATE TABLE `distributionCompanies` ( `distributionCompanyID` INT(11) NOT NULL, `distributionCompanyName` VARCHAR(255) NOT NULL, PRIMARY KEY (distributionCompanyID) ); I'm trying to map this table to a class using Hibernate: @Entity @Table(name = "distributionCompanies") public class DistributionCompany implements DatabaseObject { @Id @GeneratedValue @Column(name = "distributionCompanyID", length = 11, unique = true, nullable = false) private int distributionCompanyID; .... However, when running, I hit this issue: Initial SessionFactory creation failedorg.hibernate.HibernateException: Missing column: distributionCompanyID_distributionCompanyID in database2.distributionCompanies This isn't the only table in the database, and I've managed to map other classes successfully using the same method, so I'm a little stumped as to why this is causing an issue. Thank you for your time, Samuel Smith EDIT: In response to Xavi's comment, I temporarily removed another mapping for the column, and the error went away, so the bad-egg probably lays in the following code: @ManyToOne(targetEntity = DistributionCompany.class) @JoinTable(name = "distributionCompanies", joinColumns = { @JoinColumn(name = "distributionCompanyID", nullable = false) }) private int distributionCompanyID;
tagged with: sql
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21237875
has comment: http://stackoverflow.com/comment/31991172

http://stackoverflow.com/comment/32050017
has text: Could you take a look at the project settings? Which path is indicated for the sources?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21270063

http://stackoverflow.com/comment/32078621
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21287424
has text: Yes, I agree that it's dangerous (to say the least) to have a class with public methods that you have to never call, despite them looking like (and often acting like) what you want. I'm inclined to believe them, though, when they say particular methods are atomic.

http://stackoverflow.com/a/21208437
has body: Don't use setLocation, setBounds, null layouts or absolute positioning. Instead use the layout managers including perhaps nested JPanels, each using its own layout manager to achieve pleasing easy to maintain GUI's. For more help, show a picture of what you're trying to achieve, what you actually are achieving, and post a minimal working example, code that is small, that compiles and runs, and shows us your problem. e.g., import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.util.HashMap; import java.util.Map; import javax.swing.*; @SuppressWarnings("serial") public class InputForm extends JPanel { private static final int COLUMNS = 10; private static final int GAP = 3; private static final Insets LABEL_INSETS = new Insets(GAP, GAP, GAP, 15); private static final Insets TEXTFIELD_INSETS = new Insets(GAP, GAP, GAP, GAP); private String[] labelTexts; private Map&lt;String, JTextField&gt; fieldMap = new HashMap&lt;String, JTextField&gt;(); public InputForm(String[] labelTexts) { this.labelTexts = labelTexts; setLayout(new GridBagLayout()); for (int i = 0; i &lt; labelTexts.length; i++) { String text = labelTexts[i]; JTextField field = new JTextField(COLUMNS); fieldMap.put(text, field); addLabel(text, i); addTextField(field, i); } } public String[] getLabelTexts() { return labelTexts; } private void addTextField(JTextField field, int row) { GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = 1; gbc.gridheight = 1; gbc.gridx = 1; gbc.gridy = row; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = TEXTFIELD_INSETS; gbc.weightx = 1.0; gbc.weighty = 1.0; add(field, gbc); } private void addLabel(String text, int row) { GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = 1; gbc.gridheight = 1; gbc.gridx = 0; gbc.gridy = row; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.BOTH; gbc.insets = LABEL_INSETS; gbc.weightx = 1.0; gbc.weighty = …
type: Answer
accepted answer of: http://stackoverflow.com/q/21208396
has comment: http://stackoverflow.com/comment/31938668
has comment: http://stackoverflow.com/comment/31938623
upvote count: 5
score: 5
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21208396
downvote count: 0
has comment: http://stackoverflow.com/comment/31939825

http://stackoverflow.com/a/21254444
score: 0
has body: You are right guys ! It was a version mismatch. I also changed my spring webflow schema version to http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd as I'm using SWF 2.1.1.RELEASE PS: It's also important to verify spring jars downloaded by maven, and compare their versions to the ones declared in schema location. (If spring-webflow 2.1.1 is used, the schema location must declare spring-webflow-config-2.0 not spring-webflow-config-2.3, same thing for the other spring jars/schema declarations)
type: Answer
answers question: http://stackoverflow.com/q/21235058

http://stackoverflow.com/comment/32157428
score: 3
type: QuestionComment
comment on: http://stackoverflow.com/q/21332183
has text: The problem for is that I am stuck and cannot get it to work...
type: Comment

http://stackoverflow.com/comment/32120143
has text: can you add the exception stack? may be it's just the internet permission missing
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21311020

http://stackoverflow.com/a/21312649
answers question: http://stackoverflow.com/q/21310952
type: Answer
has body: You have to initialize your output variable as an empty String. Furthermore you are always replacing the contents of the output variable with the last char you've just encoded. So you have to add every char to the output with += instead of =. So here is the fixed solution: public static String encodeString(String input) { String output = ""; // initialize as empty String for (int i = 0; i &lt; input.length(); i++) { char c = input.charAt(i); if (c &gt;= 'a' &amp;&amp; c &lt;= 'm') { c += 13; } else if (c &gt;= 'n' &amp;&amp; c &lt;= 'z') { c -= 13; } output += " " + c; // add all chars to the String instead of replacing the whole String with "="! } return output; } I beautified your code a bit, so everybody can see what it really does. Use an IDE!
score: 0

http://stackoverflow.com/a/21204682
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21204334
has body: If you see source code of System Class it has following class variable private static Properties props; As for properties class you can think of it as a HashMap. It actually extends HashMap. public class Properties extends Hashtable&lt;Object,Object&gt; When you call setProperty(String key, String value) it actually does props.setProperty(key, value); This is just the summary(Security manager checks are also involved). Now why did I say it is per JVM instance? When you start a Java process a separate JVM instance is created that runs your process. Also since props is a Class variable(not an instance variable) just one copy of it will be present in the corresponding Class instance which will be set when that class is loaded. Now this is under the assumption that you do not have any of your custom class loaders in which case behavior might be different. But for simplistic scenario, System.setProperty() and System.getProperty() will set system properties that you can access via any class running as a part of that java process(JVM).
upvote count: 5
score: 5

http://stackoverflow.com/q/21270672
has body: I have an app that serializes and reads/writes some custom objects in Java. One of my clients has a particular file (only one) that is throwing a EOFException whenever the file is read into the ObjectInputStream constructor. java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source) java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source) java.io.ObjectInputStream.readStreamHeader(Unknown Source) java.io.ObjectInputStream.(Unknown Source) EDIT: Sorry, my mistake. I forgot to mention that I am receiving the file through this code: File folder = new File(path); File[] files = folder.listFiles(); So, the File does exist as far as File#listFiles() is retrieving it. So file in the code below is received from the loop: for(File file : files) Thus, the IOException shouldn't be from the file being missing (because why would listFiles() return it?). END-EDIT I figured this may be due to a glitch from a failed-partial-write of the object, so I added code to delete the problem file if there is a EOFException: try (InputStream is = new FileInputStream(file); ObjectInputStream ois = new ObjectInputStream(is);) { // Do stuff... } catch (IOException e) { if(e instanceof EOFException) { file.delete(); } ErrorHandler.handleError(e); } Although this code executes successfully, it does not actually delete the file. (I still see the error in logs constantly). So, I opted to have my client manually search for and delete this file. He searched, found it, and deleted it. He confirmed to me that it successfully deleted the file. However, even after he manually deleted it, this error still pops up! Although this is a Java program, my suspicion is this is a Windows file-system glitch so Java won't have much to do with this. Does anyone have experience with "ghost" files that seem to be there but aren't? Or that seem to get deleted but don't? This is a confusing problem. Impossible for me to reproduce.
has comment: http://stackoverflow.com/comment/32049538
upvote count: 2
has answer: http://stackoverflow.com/a/21271290
has comment: http://stackoverflow.com/comment/32049259
answer count: 1
has comment: http://stackoverflow.com/comment/32050369
favorite count: 0
tagged with: serialization
tagged with: file-io
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/32052767
has comment: http://stackoverflow.com/comment/32049233
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32049562
has comment: http://stackoverflow.com/comment/32056114
tagged with: objectinputstream
type: Question
has title: EOFException from ObjectInputStream constructor

http://stackoverflow.com/a/21259491
type: Answer
has body: Both of these options set properties within the JDBC driver. In the first case, hibernate.jdbc.fetch_size sets the statement's fetch size within the JDBC driver, that is, the number of rows fetched when there is more than one row of result on select statements. In the second case, hibernate.jdbc.batch_size determines the number of updates (inserts, updates, and deletes) that are sent to the database at one time for execution. This parameter is necessary to do batch inserts, but must be coupled with the ordered inserts parameter and the JDBC driver's capability to rewrite the inserts into a batch insert statement. See this link.
upvote count: 29
answers question: http://stackoverflow.com/q/21257819
type: AcceptedAnswer
downvote count: 0
score: 29
accepted answer of: http://stackoverflow.com/q/21257819

http://stackoverflow.com/comment/31902006
has text: I have a null pointer exception on the line that is commented out. I have created an object from a stax parser class called read. I then created a list in this GUI class, and I am setting it equal to the list in the parser class that contains the list of xml data. It worked before, but for some reason it has started throwing me a null pointer.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21187855

http://stackoverflow.com/comment/32149202
type: Comment
type: AnswerComment
has text: Oddly enough the comment below from the OP is now deleted, but it indicated what I mention above.
score: 0
comment on: http://stackoverflow.com/a/21326156

http://stackoverflow.com/a/48128571
type: Answer
answers question: http://stackoverflow.com/q/21273887
has body: You can do this as long as Netty doesn't close the Channel. Its better you call close() yourself when you're done. Here's a sample: https://stackoverflow.com/a/48128514/2557517
score: 0

http://stackoverflow.com/q/21211820
possible better answer: http://stackoverflow.com/a/21211868
type: Question
type: AnsweredQuestion
has title: Sorting 2D string array in Java
accepted answer: http://stackoverflow.com/a/21211923
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/21211923
has comment: http://stackoverflow.com/comment/31944985
has comment: http://stackoverflow.com/comment/31944944
tagged with: arrays
tagged with: sorting
score: 0
has body: I am using Arrays.Sort() function in java to sort a names in 2D array storing names and corresponding numbers. I want number to remain in the same indices as to the corresponding names. How do I do it? Thanks in advance. CODE String[][] contact = new String[3][3]; contact[0][0] = "b"; contact[0][1] = "c"; contact[0][2] = "a"; contact[1][0] = "2"; contact[1][1] = "3"; contact[1][2] = "1"; Arrays.sort(contact[0]); Example: b c a 2 3 1 OUTPUT: a b c 2 3 1 I want to get: a b c 1 2 3
has comment: http://stackoverflow.com/comment/31945097
has comment: http://stackoverflow.com/comment/31944959
has answer: http://stackoverflow.com/a/21211868
has comment: http://stackoverflow.com/comment/31945091

http://stackoverflow.com/comment/32065053
comment on: http://stackoverflow.com/a/21247469
score: 0
has text: I have to use an applet and not a java web start because I'm planning to use java methods in my javascript...
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32006726
score: 0
comment on: http://stackoverflow.com/a/21223551
has text: I am using GlassFish 4. There is no way this could be.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21290023
favorite count: 0
has title: How to exclude nested dependency in maven
tagged with: maven
tagged with: dependency-management
tagged with: spring
type: AnsweredQuestion
score: 3
has body: I have this dependency tree: [INFO] +- org.springframework.ws:org.springframework.ws:jar:2.1.0.RELEASE:compile [INFO] | +- org.springframework:org.springframework.aop:jar:3.1.1.RELEASE:compile [INFO] | | \- org.aopalliance:com.springsource.org.aopalliance:jar:1.0.0:compile [INFO] | +- org.springframework:org.springframework.oxm:jar:3.1.1.RELEASE:compile [INFO] | \- org.springframework.ws:org.springframework.xml:jar:2.1.0.RELEASE:compile [INFO] | \- org.apache.ws:com.springsource.org.apache.ws.commons.schema:jar:1.3.2:compile And I want to exclude (last one): org.apache.ws:com.springsource.org.apache.ws.commons.schema:jar:1.3.2 which is (according to its pom): org.apache.ws.commons.schema XmlSchema So I define in root artifact (org.springframework.ws): org.springframework.ws org.springframework.ws 2.1.0.RELEASE org.apache.ws.commons.schema XmlSchema And nothing really changes. Artifact I wanted to exclude is still present. Anyone can help me how to make it working?
has answer: http://stackoverflow.com/a/21290302
upvote count: 3
tagged with: spring-ws
tagged with: java
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/21290302
answer count: 1

http://stackoverflow.com/comment/31913081
has text: @JVMATL You can google on **multi word compare and swap**. It's at the very least referenced in a recent JDK9 preliminaries for addition to the JDK http://jsr166-concurrency.10961.n7.nabble.com/JDK9-concurrency-preliminaries-td10493.html.
comment on: http://stackoverflow.com/a/21193139
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/comment/32145896
has text: Actually i wanted to acheive linked list implementation by using this,,,,i inserted one data into a node,,,but forstoring the next data i should point tothe same class,,,but with a different instance of the class,,,can that be done???
comment on: http://stackoverflow.com/a/21325400
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25385726
downvote count: 1
has comment: http://stackoverflow.com/comment/39634745
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21332765
has body: I fixed this issue by making videoPlayer null in onDestroy of Activity. Edit: Tried in onStop and it works fine. @MickeyTin, Thanks..
score: 1

deserialization
type: Tag
tags question: http://stackoverflow.com/q/21328122
tags question: http://stackoverflow.com/q/21209240
tags question: http://stackoverflow.com/q/21263558
tags question: http://stackoverflow.com/q/21226758
tags question: http://stackoverflow.com/q/21287780
tag name: deserialization
tags question: http://stackoverflow.com/q/21191815
tags question: http://stackoverflow.com/q/21239100
tags question: http://stackoverflow.com/q/21284253
tags question: http://stackoverflow.com/q/21324205
tags question: http://stackoverflow.com/q/21213985

compiler-errors
tags question: http://stackoverflow.com/q/21195518
tags question: http://stackoverflow.com/q/21266532
tag name: compiler-errors
tags question: http://stackoverflow.com/q/21264188
type: Tag
tags question: http://stackoverflow.com/q/21209426
tags question: http://stackoverflow.com/q/21298913
tags question: http://stackoverflow.com/q/21317005
tags question: http://stackoverflow.com/q/21186232
tags question: http://stackoverflow.com/q/21199832
tags question: http://stackoverflow.com/q/21340018
tags question: http://stackoverflow.com/q/21345335
tags question: http://stackoverflow.com/q/21197382

http://stackoverflow.com/comment/32004067
comment on: http://stackoverflow.com/a/21244320
has text: The problem I have with GridBagLayout is that there seems to be no way to make the grid a static size - that is, how do I make it so it is always a 5 x 4 grid, and the grid does not add or remove columns when I'm applying moves to the board. Also, when I run the code, it only shows the top left corner. For instance, the center block is supposed to span 2 columns and 2 rows and the top left corner of the block is supposed to be at the first row/first column. It only shows the 1 x 1 component occupying the first row/first column.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/21298632
type: UnansweredQuestion
tagged with: insertion
has comment: http://stackoverflow.com/comment/32105788
has comment: http://stackoverflow.com/comment/32098477
has title: Adding onto an array to input new information based on user input
tagged with: java
has comment: http://stackoverflow.com/comment/32100001
has comment: http://stackoverflow.com/comment/32098579
has comment: http://stackoverflow.com/comment/32102123
has comment: http://stackoverflow.com/comment/32098677
has body: This is for AP Computer Science. I've got this situation where I need to insert into an array, but to do that I need to increase the storage space in the array. Just curious as to how to pull this off, and why the curriculum didn't just use an ArrayList! public class MainClass { public static PhoneExtension[] extensions = new PhoneExtension[] { new PhoneExtension( "Janice", "464" ), new PhoneExtension( "Peter", "760" ), new PhoneExtension( "Nicholas", "762" ), new PhoneExtension( "Michael", "465" ), new PhoneExtension( "Ryan", "564" ), new PhoneExtension( "Pamela", "467" ), new PhoneExtension( "Christine", "763" ) }; public static void printDirectory() { for ( PhoneExtension ext : extensions ) System.out.println( ext ); } //My code public static void newExtension( String name, String extension, int index ) { if( 0 &lt;= index &amp;&amp; 0 &lt;= extensions.length ) { int i; for( i = 7 ; i &gt; index ; i-- ) { extensions[i+1]=extensions[i]; } PhoneExtension x = new PhoneExtension( name, extension ); extensions[index]= x; } } public static void main( String[] args ) { //New inputs and execution } }
type: Question
has comment: http://stackoverflow.com/comment/32099024
tagged with: arrays
has comment: http://stackoverflow.com/comment/32140213
score: 0
has comment: http://stackoverflow.com/comment/32130983
has comment: http://stackoverflow.com/comment/32143225
answer count: 0
linked to: http://stackoverflow.com/q/13197702

http://stackoverflow.com/q/21276434
type: AnsweredQuestion
upvote count: 5
tagged with: java
tagged with: eclipse
type: Question
score: 5
accepted answer: http://stackoverflow.com/a/21278983
answer count: 1
downvote count: 0
tagged with: eclipse-plugin
has body: I am trying to install the eCobertura plugin for Eclipse. In doing so, I found the update site http://ecobertura.johoop.de/update/. But it's not working for me, probably due to some firewall issues. Is there a bundle I can download and install as a Local Site?
favorite count: 0
has title: Cobertura Eclipse Plugin Local site - Download as Zip
tagged with: cobertura
tagged with: ecobertura
has answer: http://stackoverflow.com/a/21278983

http://stackoverflow.com/comment/31900810
comment on: http://stackoverflow.com/q/21187126
has text: @peeskillet See, i am a c programmer; i got a task to make a program in java in netbeans; i dont know much of it. But i work with the gui use C coding logics and check for the syntax, so i dont know much depth of java. what i am doing is; i have a lot of screens to work on: it is a big sort of software. i have made 12 java files and 3-4 frames in each of them. It is like 1st login in 1 java file and then choose what to do and then according to what you choose it opens that java file. All are mostly same (except 10-20 lines of code) and in each one i have 3-4 frames for different screens..
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21330961
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21331188
has answer: http://stackoverflow.com/a/21331207
tagged with: java
has answer: http://stackoverflow.com/a/21346042
has title: string.length not working properly in java
type: Question
upvote count: 4
downvote count: 0
possible better answer: http://stackoverflow.com/a/21331099
tagged with: string-length
tagged with: string
has answer: http://stackoverflow.com/a/21331099
accepted answer: http://stackoverflow.com/a/21331207
answer count: 7
has answer: http://stackoverflow.com/a/21334324
favorite count: 0
has answer: http://stackoverflow.com/a/21331058
score: 4
has comment: http://stackoverflow.com/comment/32155572
has body: Hi I have a code that checks if a string is palindrome or not.the code is like this: package ProjeTarahi; import java.util.*; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; import java.lang.String; public class Main { public boolean CheckIsSymmetric(String s) { if (s.length()&lt;=1) { return true; } if (s.charAt(0)==s.charAt(s.length()-1)) { String sub = s.substring(1,s.length()-2); return CheckIsSymmetric(sub); } else { return false; } } public static void main(String args[])throws FileNotFoundException { Scanner sc=new Scanner(new FileInputStream(new File("in.txt"))); String input=sc.nextLine(); Main p=new Main(); if(p.CheckIsSymmetric(input)==true) { System.out.println("in reshte motegharen ast"); } else { System.out.println("infinite"); } } } I have written a code in c# that is exactly the same as the code above and its working very well but its not working properly in java and its output is always infinite. I stepped over my code and i think the problem is in the first if-statement of the CheckSymmetric() and it always jumps it but i don't know why.anybody can help me plz?
has answer: http://stackoverflow.com/a/21331088

http://stackoverflow.com/comment/105087442
comment on: http://stackoverflow.com/a/48958784
type: AnswerComment
has text: It breaks if you happen to have `import java.sql.Date` in your file: the `toInstant()` method of `java.sql.Date` always throws.
type: Comment
score: 0

search-engine
type: Tag
tag name: search-engine
tags question: http://stackoverflow.com/q/21347377

http://stackoverflow.com/a/56992400
answers question: http://stackoverflow.com/q/21191079
upvote count: 2
score: 2
downvote count: 0
has body: The document/literal wrapped style is the best approach and is also the default. Wrapped document style with literal encoding has the following advantages: There is no type encoding info. Everything that appears in the soap:body is defined by the Schema, so you can easily validate the message. You have the method name in the soap message. Document/literal is WS-I compliant, but without the WS-I restriction that the SOAP.body should have only one Child. The wrapped pattern meets the WS-I restriction that the SOAP messages SOAP.body has only one Child. But in few cases you might have to use another style. If you have overloaded operations, you cannot use the document/literal wrapped style. WSDL allows overloaded operations, but when you add the wrapped pattern to WSDL, you require an element to have the same name as the operation, and you cannot have two elements with the same name in XML. So you must use the document/literal, non-wrapped style or one of the RPC styles. Source: Which style of WSDL should I use?
type: Answer

http://stackoverflow.com/comment/31965777
has text: Okay so I created different JPanels as you said and had inside them JFrames (not JDialogs). I found and your post: http://stackoverflow.com/questions/13907202/adding-components-into-jpanel-inside-a-jframe?answertab=votes#tab-top So now I have a question. How can I dispose the JPanel? because it wouldn't let me do the same as JFrames (method.this.dispose().
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21219149

http://stackoverflow.com/comment/32501361
score: 1
type: AnswerComment
has text: the C# compiler detects that, though.
comment on: http://stackoverflow.com/a/21525234
type: Comment

http://stackoverflow.com/q/21331000
tagged with: servlets
upvote count: 1
tagged with: apache
downvote count: 0
tagged with: jsp
favorite count: 0
has body: Can the authentication be achieved by simply implementing a generic Login page in JSP? The purpose is to control access to content placed on the remote Apache server. Any important points to take care of? Please help.
answer count: 0
type: UnansweredQuestion
score: 1
has title: Implementation of user authentication while connecting to a remote Apache server over the Internet
tagged with: java
tagged with: authentication
type: Question

http://stackoverflow.com/a/21324423
score: 4
answers question: http://stackoverflow.com/q/21324308
has comment: http://stackoverflow.com/comment/32183283
has body: You can use Class.getDeclaredMethods(), with something like this public static int countGets(Class&lt;?&gt; cls) { int c = 0; for (java.lang.reflect.Method m : cls.getMethods()) { if (m.getName().startsWith("get")) { c++; } } return c; } public static int countSets(Class&lt;?&gt; cls) { int c = 0; for (java.lang.reflect.Method m : cls.getMethods()) { if (m.getName().startsWith("set")) { c++; } } return c; }
type: Answer
has comment: http://stackoverflow.com/comment/32183348
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/21206678
has comment: http://stackoverflow.com/comment/31937531
has comment: http://stackoverflow.com/comment/31935427
answer count: 0
type: UnansweredQuestion
has title: Class not found org.springframework.web.filter.RequestLoggingFilter
tagged with: spring
tagged with: java
has body: I got below error while running my webproject. java.lang.ClassNotFoundException: org.springframework.web.filter.RequestLoggingFilter at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1713) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558) 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.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260) at org.apache.catalina.core.ApplicationFilterConfig.&lt;init&gt;(ApplicationFilterConfig.java:107) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4746) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5399) 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$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) Any idea? Let me know if any other information is needed.
type: Question
score: 0

http://stackoverflow.com/comment/32102684
has text: @Gagan93 Sergio is right. You set the "command text" in the tag then read the tag in the `onClickListener`. This is only needed if you want to change the function of the button at runtime but, there are better ways of doing this in Android. You described what those SWING methods do, but not what you are trying to do. Sergio's answer gives you a direct solution to replicating those methods but Android has better ways of handling them. Note also that the reference to the button which raised the click event is passed to the click listener so the listener can test which control caused the event.
type: Comment
comment on: http://stackoverflow.com/a/21289961
type: AnswerComment
score: 1

http://stackoverflow.com/comment/31958106
has text: yeah it is showing only that ...
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21218371
score: 0

http://stackoverflow.com/q/21261574
has answer: http://stackoverflow.com/a/21289748
tagged with: multicore
score: 4
type: AnsweredQuestion
tagged with: multithreading
has body: I would like to take advantage of today's CPU mutli-core capabilities when using LIBSVM. What I'd like to know/understand is whether I can safely call LIBSVM services from multiple threads concurrently (e.g., call svm_train() on 8 different models with different parameters for the process of parameter tuning). The only reference I could find is this one at LIBSVM's site: Q: How can I use OpenMP to parallelize LIBSVM on a multicore/shared-memory computer? The thing is that it talks about parallelizing the algorithm (code) of the training function itself, but say nothing about calling the training function concurrently multiple times - which I would prefer since it gives me better control on the cross-validation &amp; parameter-tuning/grid-search process. Note: I'm using LIBSVM package itself (currently the java implementation and potentially python too).
type: Question
accepted answer: http://stackoverflow.com/a/21289748
tagged with: java
upvote count: 4
downvote count: 0
answer count: 1
has title: Is LIBSVM thread safe
favorite count: 0
tagged with: libsvm

http://stackoverflow.com/comment/32099639
comment on: http://stackoverflow.com/q/21299231
score: 0
has text: I print the string I'm sending, before I send it and it's all alright, with no white spaces.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31916813
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21196040
has text: Not exactly, it's Java with some extra syntax.
type: AnswerComment

http://stackoverflow.com/q/21328329
tagged with: api-design
has answer: http://stackoverflow.com/a/21330819
tagged with: api
score: 3
downvote count: 0
has title: How to expose an enum to public API without the implementation?
favorite count: 0
possible better answer: http://stackoverflow.com/a/31902850
has answer: http://stackoverflow.com/a/21328703
has answer: http://stackoverflow.com/a/31902850
answer count: 4
accepted answer: http://stackoverflow.com/a/21330819
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21328651
tagged with: enums
has body: I have a class which has a property whose type is an Enum. Example: enum CarType { TOYOTA("Japan"), AUDI("Germany"), BMW("Germany"); public final String country; private CarType(String country) { this.country = country; } } class Car { private CarType type; public CarType getType() { return type; } } The class Car is part of a library, and I would like to expose its functionality, so I create an interface which will be part of the public API, and have the class Car implement it: interface ICar { CarType getType(); } class Car implements ICar { private CarType type; @Override public CarType getType() { return type; } } The problem with this approach is that this would require the whole CarType enum to be published. The CarType enum might contain additional attributes and methods which I do not want to expose / publish (country in this example). What can I do if I want to hide the implementation of CarType but I still want to expose the possible values (the declared enum values) in a way so that the API users can reference them in switch and if statements like this: ICar car = ...; // Get an instance somehow. if (car.getType() == CarType.TOYOTA) System.out.println("It's Toyota."); Making the additional attributes and methods protected or private is not a good solution because then other parts of the library would also not be able to reference to them. Are there any good alternatives to this problem if I want to keep using Enums?

http://stackoverflow.com/a/22234824
score: 7
type: Answer
answers question: http://stackoverflow.com/q/21249935
upvote count: 7
has body: Is RelativeLayout a layout, you are inflating? If it is, then try to change line view = vi.inflate(R.layout.listitemrow, null); to this view = vi.inflate(R.layout.listitemrow, parent, false);
downvote count: 0

http://stackoverflow.com/comment/32067264
comment on: http://stackoverflow.com/q/21281269
score: 0
type: QuestionComment
type: Comment
has text: Don't keep all the bytes in memory at once.

http://stackoverflow.com/q/21281824
tagged with: java
tagged with: sharepoint
has answer: http://stackoverflow.com/a/21374276
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32226137
accepted answer: http://stackoverflow.com/a/21374276
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has title: Java XML Parser with Sharepoint xml (http get)
type: Question
has comment: http://stackoverflow.com/comment/32079111
has body: I need some ideas. I'm working on an desktop notification tool for a sharepoint site. I get the current newsfeed by http request: domain/_api/social.feed/my/timelinefeed(MaxThreadCount=1) I get the last post with all the comments and save it in a xml file like this: is here an area, where a person posted null null Kaito23 domain.de/something.... Hey, I posted something Comment1 Comment2 I tried like this, but it sets a lot of null pointer File stocks = new File(xmlFile); DocumentBuilderFactory dbFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(stocks); doc.getDocumentElement().normalize(); NodeList nodes = doc.getElementsByTagName("d:element"); Node node = nodes.item(0); Element element = (Element) node; permalink = getValue("d:Permalink", element); createdTime = getValue("d:CreatedTime", element); statusText = getValue("d:StatusText", element); // creatorName = getValue("d:Name", element); // areaName = getValue("d:Name", element); imageURL = getValue("d:ImageUri", element); } catch (Exception ex) { ex.printStackTrace(); } any ideas for me how to fix it? greetings Kaito

http://stackoverflow.com/q/21290155
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21290258
has title: Why is resize implemented the way it is?
tagged with: dictionary
type: AnsweredQuestion
tagged with: java
upvote count: 26
accepted answer: http://stackoverflow.com/a/21290258
type: Question
tagged with: hashmap
has body: I have several questions about rebuilding HashMaps when adding new key-values pair. I will ask questions based on these facts (they are true for Oracle JVM, not sure if they are correct for other JVMs): Resize rebuilds HashMap to have a bigger inner table array every time when you grow HashMap bigger than threshold (threshold = loadFactor*numberOfEntries). It does not matter in which bucket the newly created Entry is put - Map will still grow bigger. Even if all of the Entries go into one bucket (i.e. their keys' hashCode() return the same number). HashMap does not shrink when data is removed. Even if all keys are removed from HashMap, the inner size of it's table does not change. Now the questions: Are these facts correct? If they are, then: Why resize implemented this way? Is it the intention to grow the inner table even when it is obviously not necessary? Or a bug? Why it does not shrink?
score: 26
downvote count: 0
tagged with: resize

http://stackoverflow.com/a/21255505
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32021893
type: Answer
accepted answer of: http://stackoverflow.com/q/21255334
has comment: http://stackoverflow.com/comment/32025303
answers question: http://stackoverflow.com/q/21255334
downvote count: 0
score: 1
has body: May be it's just me but wouldn't : class DisasterLogger{ private static final Log logger = Logger.getLogger(DisasterLogger.class); //or any other way you provide the logger public void log(String message){ logger.log(MyLevel.DISASTER, message); } } simply work?
has comment: http://stackoverflow.com/comment/32022197
has comment: http://stackoverflow.com/comment/32022403
upvote count: 1

http://stackoverflow.com/q/21313696
tagged with: android
has body: im having a strange problem when receiving json results from the server. I have no idea what the problem is. The thing is that my String json result is corrupted, with strange symbols. The result is like this (taken from eclipse debug) Image : Another strange thing that happens is that when I change the URL of the service to an alternative one, it works and the data is not corrupted. The URLs are the same but once redirects everything to the other. The URL is use always is (example) http://www.hello.com The URL that works is http://www.hello.com.uy (cant post the exact link for security reasons) The second one redirects everything to the first one, its the only thing it does. I have tried changing the encoding to UTF-8 and it is still not working, here is the code (with one of the URLs commented) I have also tried using Dev HTTP Client extension from chrome to check the service and it works fine, no corrupted data. Also, it works perfectly on iOS so i think its just and android/java issue. DevClient: try { JSONObject json = new JSONObject(); HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, 10000); HttpConnectionParams.setSoTimeout(httpParams, 10000); HttpClient client = new DefaultHttpClient(httpParams); //String url = TAG_BASEURL_REST +"Sucursal"; String url = "http://www.-------.com/rest/Sucursal"; //String url = "http://www.--------.com.uy/rest/Sucursal"; HttpGet request = new HttpGet(url); request.setHeader("Accept", "application/json"); request.setHeader("Content-type", "application/json"); HttpResponse response = client.execute(request); HttpEntity entity = response.getEntity(); if (entity != null) { InputStream is = entity.getContent(); BufferedReader reader = new BufferedReader( new InputStreamReader(is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); String jsonRes = sb.toString(); JSONArray jO…
has answer: http://stackoverflow.com/a/21316033
upvote count: 1
has title: Corrupted Json in Android Eclipse
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32124606
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32127984
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/21316033
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32124516

http://stackoverflow.com/q/21212932
answer count: 1
has answer: http://stackoverflow.com/a/21212947
favorite count: 0
has title: Android casting double to int results in Zero always
type: UnansweredQuestion
tagged with: android
tagged with: java
downvote count: 2
type: Question
score: -2
has body: I am trying to convert a double value to an int (right now don't care if it rounds or drops the decimal). I have tried many method and searched and I always get the same result, the int is 0. for(double time=1;time&lt;100; time++){ Double sin = Double.valueOf(Math.sin(freq*time*2*Math.PI)/Math.exp(decay*time)); BigDecimal sinBD = new BigDecimal(sin); int nowProgress = lastProgress* sinBD.intValue(); Log.d("touch", "Time: " + time + " - BOUNCE PROGRESS: " + nowProgress + " SIN:" + sin + " " + sin.intValue() ); publishProgress(nowProgress); } Output is: D/touch ( 405): Time: 92.0 - BOUNCE PROGRESS: 0 SIN:-5.650622119921064E-54 0 D/touch ( 405): Time: 93.0 - BOUNCE PROGRESS: 0 SIN:-2.9583499774959883E-54 0 D/touch ( 405): Time: 94.0 - BOUNCE PROGRESS: 0 SIN:2.9429214663931283E-55 0 D/touch ( 405): Time: 95.0 - BOUNCE PROGRESS: 0 SIN:-1.0777191865157576E-56 0 D/touch ( 405): Time: 96.0 - BOUNCE PROGRESS: 0 SIN:-4.775752566124532E-56 0 D/touch ( 405): Time: 97.0 - BOUNCE PROGRESS: 0 SIN:-3.367948939041307E-56 0 D/touch ( 405): Time: 98.0 - BOUNCE PROGRESS: 0 SIN:-1.8316705209724932E-56 0 D/touch ( 405): Time: 99.0 - BOUNCE PROGRESS: 0 SIN:2.577602055706179E-57 0
upvote count: 0

http://stackoverflow.com/comment/32140007
type: Comment
has text: If you have more than one entry for a given time you will need to stick to using an ArrayList as a value I'm afraid... The idea is to replace your HashMap by a TreeMap.
comment on: http://stackoverflow.com/a/21321732
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31993334
comment on: http://stackoverflow.com/q/21238784
type: Comment
type: QuestionComment
score: 2
has text: Why don't you just extract the style of the action bar out into a resource XML? Here is an example: http://developer.android.com/training/basics/actionbar/styling.html. This will keep your code a little cleaner since all of the styling will be in a XML file instead of your java files.

http://stackoverflow.com/comment/31955127
type: AnswerComment
comment on: http://stackoverflow.com/a/21217469
score: 0
type: Comment
has text: @OliverBak: see edit to answer. You are in fact calling methods on the **wrong** GUI object.

http://stackoverflow.com/comment/31971595
type: QuestionComment
comment on: http://stackoverflow.com/q/21226758
score: 1
has text: http://stackoverflow.com/questions/21015649/serilization-in-java ????
type: Comment

android-gridview
type: Tag
tag name: android-gridview
tags question: http://stackoverflow.com/q/21243700

http://stackoverflow.com/q/21193428
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
has body: Hy Guys. I've read many questions here on SO about invalidating a cookie on a request and adding it to a response (I know that it can't be physical deleted). I've read this How do you remove...Cookie which is the closest to my problem. And none of the answers and suggestions helped me on my particular case (I think). I'm testing it on my machine so, my domain is my work domain. I have an eclipse with a tomcat server configured and another eclipse with a JBoss server configured. So, my case here is that I've made a Single Sign On system where I have a domain which is the single login system (say: myMachine.myCompany.com:8081/login lets name it login) and I have a system which uses this login and it will be on another address, right now everything is on my machine, so this other system ( myMachine.myCompany.com:8080/system/something/index.jsf lets name it app) My implementation workflow is: -The user access app from jboss -It go to a securityFilter that check everything on the request (/* on web.xml) to this application - The security filter check if the user has a cookie (jboss side) Cookie[] cookies = request.getCookies(); if(cookies != null){ for (Cookie cookie : cookies) { if (cookie.getName().equalsIgnoreCase("ssoSecurity")) { return cookie; } } } -If the user doesn't have the cookie I redirect him to the login (tomcat) -When the user logs in (enter data to be checked on database) I create a session to this user with a token to identify then later (when needed), cookie on the tomcat server: Cookie cookie = new Cookie("ssoSecurity", token); cookie.setDomain(domain); //.myCompany.com cookie.setVersion(0); cookie.setPath("/"); cookie.setSecure(request.isSecure()); cookie.setMaxAge(-1); //deleted when the browser close response.addCookie( cookie ); -Then the login redirect the user to the app, it will again be on securityFilter -After the securityFilter checks the cookie and find it, it gets its value (token) and call my securityClient (which is a JAR on my classpath…
has answer: http://stackoverflow.com/a/21235873
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/890935
tagged with: cookies
score: 1
tagged with: java
has title: Old new "delete/invalidade" Cookie on an application
upvote count: 1
type: Question
tagged with: jboss
accepted answer: http://stackoverflow.com/a/21235873

http://stackoverflow.com/comment/32009123
comment on: http://stackoverflow.com/q/21247566
score: 0
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve).
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21283769
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/21283198
has comment: http://stackoverflow.com/comment/32071699
type: Answer
has body: You may use java.util.Random. And please specify if you want any random number or just the number 1,2,3,4,5,6. If you wish random numbers then , this is a basic code: import java.util.*; public class randomnumber { public static void main(String[] args) { Random abc = new Random(); int[] a = new int[6]; int limit = 100,c=0; int chk = 0; boolean y = true; for(;c &lt; 6;) { int x = abc.nextInt(limit+1); for(int i = 0;i&lt;a.length;i++) { if(x==a[i]) { y=false; break; } } if(y) { if(c!=0)if(x == (a[c-1]+1))continue; a[c]=x; c++; } } for (Integer number : a) { System.out.println(number); } } } if you don't understand the last for loop , please tell , i will update it.
downvote count: 1

http://stackoverflow.com/comment/32089431
comment on: http://stackoverflow.com/q/21293446
has text: I believe that is what I'm using.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32061592
type: AnswerComment
has text: @RobinJonsson the RequestMappingHandlerMapping doesn't require editing the existing controllers
comment on: http://stackoverflow.com/a/21277551
type: Comment
score: 0

http://stackoverflow.com/q/21276136
has body: I am working on a web application using Java and Spring. I'm new at Spring, so as an opportunity to learn, I was basically given an existing application and was told to extend it. I am having trouble understanding how the @Autowired work. I understand the high-level concept of dependency injection, but I want to know how the @Autowired annotation knows which concrete implementation of an interface to inject? To put my question into context, I will explain the problem I am having: I have an interface called PostDao, and a class called PostDaoImpl which implements PostDao. I then have another class called PostDaoPublicImpl which extends PostDaoImpl. These classes exist in my persistence layer. I then have an interface called PostService, and a class called called PostServiceImpl which implement PostService. I then have another class called PostServicePublicImpl which extends PostServiceImpl. These classes exist in my services layer. In PostServiceImpl the following line injects the following object: @Autowired private PostDao postDao; //This injects an object of the class PostDaoImpl My problem is, in PostServicePublicImpl how do I have the same declaration as above, but have it inject an object of the class PostDaoPublicImpl: @Autowired private PostDao postDao; //This injects an object of the class PostDaoPublicImpl I feel as though if I understand how the @Autowired annotation works, then I will be able to solve this problem. Any help and suggestions to solve the problem would be greatly appreciated.
has title: Spring MVC - How does @Autowired work?
linked to: http://stackoverflow.com/q/3153546
type: UnansweredQuestion
tagged with: spring
tagged with: autowired
tagged with: spring-mvc
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/35230333
type: Question
score: 5
tagged with: dependency-injection
answer count: 3
has answer: http://stackoverflow.com/a/21276213
downvote count: 0
has answer: http://stackoverflow.com/a/21280757
favorite count: 0

http://stackoverflow.com/comment/31936284
has text: The href attribuite is optional since java 6u18 (as I Said before, please read carefully the question). I need to protect the jnlp! If I could use the Simple Solution I would not ask a questo here
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21207037

http://stackoverflow.com/comment/139119115
type: Comment
has text: long integers occupy more memory, so they can generate more cache misses. in this case usage of longs can lead to worse performance
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/49681318

http://stackoverflow.com/comment/32097133
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21297606
has text: The program will display a request to the user to enter the name of the file with the .txt extension. You can use the .next() method of the Scanner class to store that in the variable fileName1 (Or whatever you call the variable). Then, instead of hardcoding song.txt as the name of the file, you can use the variable where you stored the file name.

http://stackoverflow.com/comment/31952914
has text: I got confused with HttpSession for HibernateSession. Why do you want it this way?
type: QuestionComment
comment on: http://stackoverflow.com/q/21216433
type: Comment
score: 0

waveform
tag name: waveform
type: Tag
tags question: http://stackoverflow.com/q/21343504

http://stackoverflow.com/q/21185450
has comment: http://stackoverflow.com/comment/31896813
has comment: http://stackoverflow.com/comment/31896779
tagged with: java
type: Question
has title: Base64 encoding and decoding using different libraries
tagged with: base64
linked to: http://stackoverflow.com/q/7111577
has answer: http://stackoverflow.com/a/21185857
has comment: http://stackoverflow.com/comment/31896859
score: 0
tagged with: encoding
answer count: 1
tagged with: decoding
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31896850
tagged with: android
has body: I'm sending some data from Android client using built-in Base64 class: String auth = android.util.Base64.encodeToString ("someusername:somepassword".getBytes ("UTF-8"), android.util.Base64.NO_WRAP); This creates an Encoded string: c29tZXVzZXJuYW1lOnNvbWVwYXNzd29yZA== But when I try to decode this on Server, using a different library: String auth = com.sun.org.apache.xml.internal.security.utils.Base64.decode (header).toString (); I get: [B@5c92ac1c Can anyone tell me what am I doing wrong here? I cannot import Android's util to my Server code. Apologies if I'm missing something very trivial...

http://stackoverflow.com/q/21310594
score: 1
has title: Hadoop 2.2 chain MapReduce jobs Map -> Reducer -> Map -> Reducer
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32122995
accepted answer: http://stackoverflow.com/a/21312695
tagged with: java
has comment: http://stackoverflow.com/comment/32132464
tagged with: mapreduce
tagged with: hadoop
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32122118
has answer: http://stackoverflow.com/a/21312695
has comment: http://stackoverflow.com/comment/32126427
tagged with: chaining
has body: I have two MapReduce jobs, the output of the first Reducer is the input of the second Mapper : Map1 -&gt; Reduce1 -&gt; Map2 -&gt; Reduce2 For now Map2 reads from the files outputted by Reduce1. So Map1 -&gt; Reduce1 and Map2 -&gt; Reduce2 are independant. It works, but it would be easier and I think more optimized if the output of Reduce1 was directly the input of Map2. Is there a way to do that ? In this case Map2 would be just an identity mapper so it would be even better if I could do : Map1 -&gt; Reduce1 -&gt; Reduce2 Reduce1, Map2 and Reduce2 have the same input and output types. Thanks !
type: AnsweredQuestion

http://stackoverflow.com/comment/32031736
has text: Looks good :) (Although you typically don't have threads other than the UI thread that have a looper while they [can be useful](http://stackoverflow.com/questions/13368762/android-anrs-from-code-running-in-a-handler/13369215#13369215))
type: AnswerComment
comment on: http://stackoverflow.com/a/21256419
score: 0
type: Comment

http://stackoverflow.com/comment/32182748
has text: You need to export it as a runnable jar along with all the dependencies checked. http://stackoverflow.com/questions/11033603/how-to-create-a-jar-with-external-libraries-included-in-eclipse
type: Comment
comment on: http://stackoverflow.com/q/21345779
type: QuestionComment
score: 0

logic
tags question: http://stackoverflow.com/q/21226309
tags question: http://stackoverflow.com/q/21241591
tag name: logic
type: Tag
tags question: http://stackoverflow.com/q/21341971
tags question: http://stackoverflow.com/q/21341061
tags question: http://stackoverflow.com/q/21201156

http://stackoverflow.com/a/59485801
upvote count: 0
answers question: http://stackoverflow.com/q/21203189
has body: if you try to add the large size image for eg let say 4~6 mb and you are using the drawable,then you would get the error like->java.lang.RuntimeException: Canvas: trying to draw too large(537528960bytes) bitmap For java do this in your android studio, but the concept remains same for others also,do this to insert the image in your app in the background, applicable for both large and small size images. Basically move your image in the (hi-res) drawable to drawable-xxhdpi which would be finded by going in the app->res->mipmap. &lt;ImageView android:id="@+id/imageView2" android:layout_width="0dp" android:layout_height="0dp" android:adjustViewBounds="true" android:scaleType="centerCrop" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:srcCompat="@mipmap/imagename" /&gt;
type: Answer
downvote count: 1
score: -1

http://stackoverflow.com/q/21322276
has comment: http://stackoverflow.com/comment/32140405
type: UnansweredQuestion
tagged with: input
has body: I'm making a Java Game, and whenever I start it up, none of the keys work, until I press enter. Here's the key input code: if(KeyInput.currentKey(KeyInput.W)) player.setUp(); if(KeyInput.currentKey(KeyInput.A)) player.setLeft(); if(KeyInput.currentKey(KeyInput.S)) player.setDown(); if(KeyInput.currentKey(KeyInput.D)) player.setRight(); if(KeyInput.currentKey(KeyInput.UP)) player.setDirection(0); if(KeyInput.currentKey(KeyInput.RIGHT)) player.setDirection(1); if(KeyInput.currentKey(KeyInput.DOWN)) player.setDirection(2); if(KeyInput.currentKey(KeyInput.LEFT)) player.setDirection(3); if(KeyInput.currentKey(KeyInput.ENTER)) player.setPunching(); I have a class called KeyInput and the method currentKey just checks if there is a key being pressed down, and if there is, it checks if the key in the parameters is the current one. Here's that code: public class KeyInput { public static final int NUM_KEYS = 11; public static boolean keyState[] = new boolean[NUM_KEYS]; public static boolean prevKeyState[] = new boolean[NUM_KEYS]; public static int W = 0; public static int A = 1; public static int S = 2; public static int D = 3; public static int ENTER = 4; public static int UP = 5; public static int LEFT = 6; public static int DOWN = 7; public static int RIGHT = 8; public static int ESCAPE = 9; public static int SHIFT = 10; public static void setKey(int i, boolean b) { if(i == KeyEvent.VK_W) keyState[W] = b; else if(i == KeyEvent.VK_A) keyState[A] = b; else if(i == KeyEvent.VK_S) keyState[S] = b; else if(i == KeyEvent.VK_D) keyState[D] = b; else if(i == KeyEvent.VK_ENTER) keyState[ENTER] = b; else if(i == KeyEvent.VK_UP) keyState[UP] = b; else if(i == KeyEvent.VK_LEFT) keyState[LEFT] = b; else if(i == KeyEvent.VK_DOWN) keyState[DOWN] = b; else if(i == KeyEvent.VK_RIGHT) keyState[RIGHT] = b; else if(i == KeyEvent.VK_ESCAPE) keyState[ESCAPE] = b; else if(i == KeyEvent.VK_SHIFT) keyState[SHIFT] = b; } public static void update() { for(int i = 0; i &lt; NUM_KEYS; i++) { prevKeySta…
tagged with: java
has title: Key Input Doesn't Work Until Enter is Pressed
type: Question
has comment: http://stackoverflow.com/comment/32140393
has comment: http://stackoverflow.com/comment/32140444
score: 0
has answer: http://stackoverflow.com/a/21322360
answer count: 1
has comment: http://stackoverflow.com/comment/32140402
tagged with: key

http://stackoverflow.com/q/21218055
tagged with: object
has answer: http://stackoverflow.com/a/21218130
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21218220
answer count: 2
upvote count: 1
has body: I have a list of values in a text file, People.txt[ Name, ID, DOB, Sex Bill, 12, 12/12/1989, Male Cindy, 13, 12/11/1991, Female ] I had originally read the values into a string then transformed the string into an array at the ',' value using List&lt;String&gt; items = Arrays.asList(str.split("\\s*,\\s*")); but I want to try and find a way to either create an object containing the headings and sort them into lists or an array of associative arrays with indexes for all of the values. I'm fairly rookie at Java and I can't figure out how to transform the values into an array with headings.
tagged with: arrays
has answer: http://stackoverflow.com/a/21218220
favorite count: 0
has comment: http://stackoverflow.com/comment/31955726
possible better answer: http://stackoverflow.com/a/21218130
tagged with: regex
has comment: http://stackoverflow.com/comment/31955807
has title: Turning a list into an indexed array
type: AnsweredQuestion
downvote count: 0
type: Question

vector
tags question: http://stackoverflow.com/q/21270328
type: Tag
tags question: http://stackoverflow.com/q/21254501
tag name: vector
tags question: http://stackoverflow.com/q/21202634
tags question: http://stackoverflow.com/q/21240059
tags question: http://stackoverflow.com/q/21243973
tags question: http://stackoverflow.com/q/21213362

http://stackoverflow.com/comment/32012337
comment on: http://stackoverflow.com/q/21249198
has text: @Blender Check that the word just before the split is not Mr. Mrs. or another abbreviation?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21302878
has comment: http://stackoverflow.com/comment/32239900
has comment: http://stackoverflow.com/comment/32239957
has comment: http://stackoverflow.com/comment/32240527
has comment: http://stackoverflow.com/comment/32106478
has comment: http://stackoverflow.com/comment/32106365
type: Answer
has comment: http://stackoverflow.com/comment/32148551
has comment: http://stackoverflow.com/comment/32148333
answers question: http://stackoverflow.com/q/21302784
has comment: http://stackoverflow.com/comment/32105708
accepted answer of: http://stackoverflow.com/q/21302784
has comment: http://stackoverflow.com/comment/32106831
has comment: http://stackoverflow.com/comment/32148451
has body: Use ((.)\2+)+ as pattern: String pattern = "((.)\\2+)+"; System.out.println("a".matches(pattern)); // false System.out.println("1aaa".matches(pattern)); // false System.out.println("aa".matches(pattern)); // true System.out.println("aabb111".matches(pattern)); // true System.out.println("1111222".matches(pattern)); // true System.out.println("11222aaa".matches(pattern)); // true System.out.println("etc.".matches(pattern)); // false About the pattern: (...): capture matched part as group. (starting from 1) ((.)\2+)+ ^^ |+----- group 2 +----- group 1 (.): match any character (except newline) and capture it as group 2 (because it come after enclosing parenthesis). \2: backreference to the matched group. If (.) matched a character x, \2 matches another x (not any character, but only x). PATTERN+: matches one or more matches of PATTERN. (.)\2+: match repeating characters greedy.
upvote count: 12
has comment: http://stackoverflow.com/comment/32240086
has comment: http://stackoverflow.com/comment/32105633
has comment: http://stackoverflow.com/comment/32105667
score: 12
has comment: http://stackoverflow.com/comment/32105787
has comment: http://stackoverflow.com/comment/32240465
has comment: http://stackoverflow.com/comment/32105809
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21347970
type: Answer
has comment: http://stackoverflow.com/comment/32238065
has comment: http://stackoverflow.com/comment/39698960
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21335205
has body: Use the "dependsOnMethods" annotation on the test method. Sample:- @Test(dependsOnMethods="method2") public void method1(){ } Refer this answer and change the beforeInvocation() as below, public void beforeInvocation(IInvokedMethod method, ITestResult itr) { if (method.isTestMethod()) { //call any method } }
answers question: http://stackoverflow.com/q/21335205
score: 0

http://stackoverflow.com/a/29857082
type: Answer
answers question: http://stackoverflow.com/q/21235472
upvote count: 2
score: 1
downvote count: 1
has body: I had the same problem in the end it was the version of org.codehaus.jackson 1.9.x, when I switched from 1.9.x jackson to 2.x (fasterxml) in my pom.xml com.fasterxml.jackson.core jackson-core 2.2.3 com.fasterxml.jackson.core jackson-databind 2.2.3 com.fasterxml.jackson.core jackson-annotations 2.2.3 also is necesary : <mvc:annotation-driven />

jakarta-ee
tags question: http://stackoverflow.com/q/21215345
tags question: http://stackoverflow.com/q/21184297
tags question: http://stackoverflow.com/q/21335677
tags question: http://stackoverflow.com/q/21256504
tags question: http://stackoverflow.com/q/21184604
type: Tag
tags question: http://stackoverflow.com/q/21231129
tags question: http://stackoverflow.com/q/21187018
tags question: http://stackoverflow.com/q/21323005
tags question: http://stackoverflow.com/q/21328561
tags question: http://stackoverflow.com/q/21257464
tags question: http://stackoverflow.com/q/21256417
tags question: http://stackoverflow.com/q/21262661
tags question: http://stackoverflow.com/q/21287433
tags question: http://stackoverflow.com/q/21283909
tags question: http://stackoverflow.com/q/21249886
tags question: http://stackoverflow.com/q/21300060
tags question: http://stackoverflow.com/q/21337564
tags question: http://stackoverflow.com/q/21258803
tags question: http://stackoverflow.com/q/21312507
tags question: http://stackoverflow.com/q/21342909
tags question: http://stackoverflow.com/q/21275337
tags question: http://stackoverflow.com/q/21266432
tags question: http://stackoverflow.com/q/21340823
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/21249702
tags question: http://stackoverflow.com/q/21280146
tags question: http://stackoverflow.com/q/21191021
tags question: http://stackoverflow.com/q/21344447
tags question: http://stackoverflow.com/q/21256141
tags question: http://stackoverflow.com/q/21280582
tags question: http://stackoverflow.com/q/21222176
tags question: http://stackoverflow.com/q/21220758
tags question: http://stackoverflow.com/q/21301896
tags question: http://stackoverflow.com/q/21216166
tags question: http://stackoverflow.com/q/21290834
tags question: http://stackoverflow.com/q/21207360
tags question: http://stackoverflow.com/q/21215091
tags question: http://stackoverflow.com/q/21259264
tags question: http://stackoverflow.com/q/21310507
tags question: http://stackoverflow.com/q/21340310
tags question: http://stackoverflow.com/q/21262316
tags question: http://stackoverflow.com/q/21193843
tags question: http://stackoverflow.com/q/21258954
tags question: http://stackoverflow.com/q/21188271
tags question: http://stackoverflow.com/q/21252251
tags question: http://stackoverflow.com/q/21217935
tags question: http://stackoverflow.com/q/21267142
tags question: http://stackoverflow.com/q/21185208
tags question: http://stackoverflow.com/q/21329846
tags question: http://stackoverflow.com/q/21250935
tags question: http://stackoverflow.com/q/21244147
tags question: http://stackoverflow.com/q/21326807
tags question: http://stackoverflow.com/q/21313281
tags question: http://stackoverflow.com/q/21263489
tags question: http://stackoverflow.com/q/21294436
tags question: http://stackoverflow.com/q/21277528
tags question: http://stackoverflow.com/q/21226508
tags question: http://stackoverflow.com/q/21204245
tags question: http://stackoverflow.com/q/21241820
tags question: http://stackoverflow.com/q/21296826
tags question: http://stackoverflow.com/q/21253868
tags question: http://stackoverflow.com/q/21244512
tags question: http://stackoverflow.com/q/21316196
tags question: http://stackoverflow.com/q/21220812
tags question: http://stackoverflow.com/q/21237489
tags question: http://stackoverflow.com/q/21282242
tags question: http://stackoverflow.com/q/21216239
tags question: http://stackoverflow.com/q/21264585
tags question: http://stackoverflow.com/q/21220211
tags question: http://stackoverflow.com/q/21302993
tags question: http://stackoverflow.com/q/21314159
tags question: http://stackoverflow.com/q/21205843

http://stackoverflow.com/a/21337073
type: Answer
has comment: http://stackoverflow.com/comment/32169272
has comment: http://stackoverflow.com/comment/32169080
has body: The file is read once and cached for performance reasons. Edit: If you expect a file to be modified, keep the file outside your EAR file on the local file system, and use an environment/server variable to point to its path. Refer to the variable within your code to load the file.
has comment: http://stackoverflow.com/comment/32168719
score: 0
answers question: http://stackoverflow.com/q/21337037

http://stackoverflow.com/q/21197835
downvote count: 2
type: Question
possible better answer: http://stackoverflow.com/a/21197860
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/21197860
tagged with: split
has body: My code is as follows: package examen2; import java.io.*; import java.util.*; public class Examen2 { public static void main(String[] args) throws Exception { FileInputStream fis = new FileInputStream("dataIn.txt"); BufferedReader br = new BufferedReader(new InputStreamReader(fis)); TreeSet<Punct> set = new TreeSet(); String line; //problem in the while statement while (((line = br.readLine()).length() != 0)) { String[] splited = line.split("([^0-9\\n\\r\\-][^0-9\\n\\r\\-]*)"); int[] number = new int[splited.length]; for (int i=0, j=0; i<splited.length; i++) { number[j] = Integer.parseInt(splited[i]); j++; } set.add(new Punct(number[0], number[1])); Iterator it = set.iterator(); while (it.hasNext()) { System.out.print(it.next()); } System.out.println(); } br.close(); br = null; fis = null; } static class Punct implements Comparable { int x; int y; Punct() { x = 0; y = 0; } Punct(int x, int y) { this.x = x; this.y = y; } @Override public String toString() { return "(" + this.x + ":" + this.y + ")"; } @Override public boolean equals(Object o) { try { Punct other = (Punct)o; return (this.x==other.x && this.y==other.y); } catch (Exception ex) { System.out.println(ex.getMessage()); } return false; } @Override public int compareTo(Object t) { Punct other = (Punct)t; if (this.x == other.x && this.y == other.y) { return 0; } else if (Math.sqrt(Math.pow(this.x, 2)+Math.pow(this.y, 2))-Math.sqrt(Math.pow(other.x, 2)+Math.pow(other.y, 2))>0) { return 1; } else { return -1; } } @Override public int hashCode() { return super.hashCode(); //To change body of generated methods, choose Tools | Templates. } @Override protected void finalize() throws Throwable { super.finalize(); //To change body of generated methods, choose Tools | Templates. } @Override protected Object clone() throws CloneNotSupportedException { return super.clone(); //To change body of generated methods, choose Tools | Templates. } } } dataIn.txt content: 1 2 3 assfas 4 5 asfl;a 8 1 1 3 4 And it writes out this to…
answer count: 2
has answer: http://stackoverflow.com/a/21197856
upvote count: 0
favorite count: 0
tagged with: nullpointerexception
tagged with: file-io
has title: Java File Input - NullPointerException
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21197856

http://stackoverflow.com/a/21230075
type: Answer
has comment: http://stackoverflow.com/comment/31980061
accepted answer of: http://stackoverflow.com/q/21229469
score: 0
answers question: http://stackoverflow.com/q/21229469
has comment: http://stackoverflow.com/comment/31981177
type: AcceptedAnswer
has body: Before you optimize Lucene: SQL Server already has a full-text search feature. If this covers your use case then use it. It's the easiest way since SQL Server takes care of keeping the search index in sync with the database. If the SQL Server full-text search does not fit your use case then your application has to create its own search index and keep it in sync with the database. To do this you should: create / update the search index when your application starts update the search index when the application inserts, updates or deletes a title Lucene is flexible where it stores the search index. You can store it in a directory in your file system or in the database (or write you own storage provider). I recommend to store it in the file system as the performance is much better than when you store it in the database. If you don't have too many titles to index you could also use an in-memory search index which you recreate every time your application starts.
has comment: http://stackoverflow.com/comment/31980607

http://stackoverflow.com/comment/32150505
has text: try with resource available in java7 and higher.We do not know which version OP is using
type: AnswerComment
comment on: http://stackoverflow.com/a/21328147
type: Comment
score: 1

http://stackoverflow.com/comment/32035799
score: 0
type: Comment
type: QuestionComment
has text: `super(...)` is context independent. It always serves the same purpose, calling the super constructor with whatever arguments you pass to it.
comment on: http://stackoverflow.com/q/21263321

http://stackoverflow.com/comment/32098480
type: QuestionComment
type: Comment
has text: The stuff after it says "You must write the code to parse an encrypted message." so I did number 1 with a.length();. But I don't know what to use for the rest of them. I wanted to know what I can use to solve #2,3,4,5. It would be greatly appreciated. And tbh my teacher doesn't help much, I think you guys would be better help.
comment on: http://stackoverflow.com/q/21298566
score: 0

http://stackoverflow.com/q/21196144
has answer: http://stackoverflow.com/a/21196301
has answer: http://stackoverflow.com/a/21196175
favorite count: 0
accepted answer: http://stackoverflow.com/a/21196175
has comment: http://stackoverflow.com/comment/31917331
duplicate of: http://stackoverflow.com/q/442564
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21196301
downvote count: 2
upvote count: 1
has body: If I write synchronized(this) in two function of the same java class, but these two functions are maybe called by two threads, does this code still work? Some fake code maybe looks like: class A { public funA() synchronized (this) { // do some things here; } } public funB() { synchronized (this) { // do other things here; } } } Or do I need to add a variable to do it?
type: Question
has title: java synchronized (this) scope
tagged with: java
has comment: http://stackoverflow.com/comment/31917078
linked to: http://stackoverflow.com/q/442564
score: -1
answer count: 2

http://stackoverflow.com/comment/32097546
score: 1
type: Comment
type: QuestionComment
has text: I'm going to say `-1`, because `null` and `Exception` aren't `int`s. But this is completely dependent on style and context; there's no "correct" answer here.
comment on: http://stackoverflow.com/q/21298104

http://stackoverflow.com/a/21362470
type: Answer
has body: at least i found solution.i should pay attention to entity name.and it should be same as the server. DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(mUrl); File file = new File(mFileAdrress); FileInputStream fileInputStream = new FileInputStream(file); httpClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, System.getProperty("http.agent")); InputStreamBody inputStreamBody = new InputStreamBody( fileInputStream, file.getName()); MultipartEntityBuilder multipartEntity = MultipartEntityBuilder .create(); multipartEntity.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); multipartEntity.addPart("file", inputStreamBody); // file should be same as server final HttpEntity myEntity = multipartEntity.build(); class ProgressiveEntity implements HttpEntity { @Override public void consumeContent() throws IOException { myEntity.consumeContent(); } @Override public InputStream getContent() throws IOException, IllegalStateException { return myEntity.getContent(); } @Override public Header getContentEncoding() { return myEntity.getContentEncoding(); } @Override public long getContentLength() { return myEntity.getContentLength(); } @Override public Header getContentType() { return myEntity.getContentType(); } @Override public boolean isChunked() { return myEntity.isChunked(); } @Override public boolean isRepeatable() { return myEntity.isRepeatable(); } @Override public boolean isStreaming() { return myEntity.isStreaming(); } @Override public void writeTo(OutputStream outstream) throws IOException { class ProxyOutputStream extends FilterOutputStream { public ProxyOutputStream(OutputStream proxy) { super(proxy); } public void write(int idx) throws IOException { out.write(idx); } public void write(byte[] bts) throws IOException { out.write(bts); } public void write(byte[] bts, int st, int end) throws IOException { out.write(bts, st, end); } public void flush() throws IOException { out.flush(); } public void close() throws IOException { o…
accepted answer of: http://stackoverflow.com/q/21302999
answers question: http://stackoverflow.com/q/21302999
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/21243017
answer count: 2
has title: Having trouble setting the Java classpath from terminal
favorite count: 0
tagged with: terminal
has answer: http://stackoverflow.com/a/21243180
tagged with: macos
has body: My directories are structured as follows: /User/JAVA/MyProject/ In the MyProject folder, I have my Main.java and Helper.java files In the JAVA folder, I have two JAR files: jar1.jar and jar2.jar I would like to set my classpath to these two JARs so I can use them in my Main.java and Helper.java files. Very simple. To do this, I have tried the following (as well as numerous other variations) from my terminal: user:MyProject$ javac -cp "/User/JAVA/jar1.jar:/User/JAVA/jar2.jar:." Main.java EDIT: I am now using this command, as suggested, and receiving the same errors user:MyProject$ javac -cp "/User/JAVA/jar1.jar:/User/JAVA/jar2.jar:." Helper.java Main.java From what I've read, this should work. I have specified the absolute locations of the two JARs, I have separated them by a colon : (I am on OSX), and I have also included my current directory .. Then I have specified the file containing my main method with Main.java. Unfortunately, I keep receiving a "Cannot find symbol" for the classes' methods in the JARs when I try to compile. Furthermore, when I try System.out.println(System.getProperty("java.class.path"));, I receive the following output ., indicating my classpath is still set to my current directory. My error is this: /User/JAVA/MyProject/Helper.java:13 cannot find symbol symbol: variable StdOut location: class Helper To note: When I opened my project up in Eclipse and added the classpath via the IDE, everything worked as expected and no error messages appeared during compilation. Nevertheless, I still would like to figure out how to do this from terminal and without the IDE. What am I doing wrong, and how do I fix this? Thanks.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21243521
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32001297
has comment: http://stackoverflow.com/comment/32001273
score: 1
tagged with: java
tagged with: classpath
has comment: http://stackoverflow.com/comment/32002617
upvote count: 2

http://stackoverflow.com/a/21219867
type: Answer
answers question: http://stackoverflow.com/q/21219801
has body: YOU HAVE TO CHECK AndroidManifest.xml AND CHNAGE LAUNCHER ACTIVITY CONIGURATION <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
score: 0

http://stackoverflow.com/q/21260018
has title: creating object pools of different proeprties files?
tagged with: spring-3
type: UnansweredQuestion
tagged with: spring
has body: How can i create two object pools using two properties files? Currently i have it working using one properties file. ConnectionsFactory.java public class ConnectionsFactory implements PoolableObjectFactory { private Properties connectionProperties; public ConnectionsFactory(Properties connectionProperties) { this.connectionProperties= connectionProperties; } //here makeObject, destroyObject and validateObject methods have been overridden } ConnectionPool.java public class ConnectionPool { private GenericObjectPool objectPool; . private int maxActive = 50; private int maxIdle = -1; public SiperianClientPool(SiperianClientFactory factory) { this.objectPool = new GenericObjectPool(); this.objectPool.setFactory(factory); this.objectPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK); this.objectPool.setTestOnBorrow(true); this.objectPool.setTestOnReturn(true); this.objectPool.setMaxActive(this.maxActive); this.objectPool.setMaxIdle(this.maxIdle); } //here i provided two methods one to get the connection and the other to return the connection to the pool } connectionProperties.properties uname=xxx pwd=xxxx host=xxx java.naming.provider.url=someurl applicationContext.xml <constructor-arg ref="connectionsFactory"/> <constructor-arg ref="propertyFactory"/> classpath:conf/connectionProperties.properties Above cofiguration is working fine without any issues. So far i have only one properties file and all the properties are belongs to one geography. Now i need to change the properties file to support multiple geographies and each geography has its properties as below. connectionProperties_US.properties uname=xxx pwd=xxxx host=xxx connectionProperties_UK.properties uname=xxx pwd=xxxx host=xxx connectionProperties_Germany.properties uname=xxx pwd=xxxx host=xxx
has comment: http://stackoverflow.com/comment/32030153
has answer: http://stackoverflow.com/a/21273110
tagged with: java
has comment: http://stackoverflow.com/comment/32029581
type: Question
has comment: http://stackoverflow.com/comment/32029441
score: 0
answer count: 1

http://stackoverflow.com/comment/32100564
type: Comment
comment on: http://stackoverflow.com/a/21298837
score: 0
type: AnswerComment
has text: Your answer confuses me. I appreciate if you could give me some examples. I read the common JavaMail mistakes, but it didn't say anything about character conversion.

http://stackoverflow.com/q/21343374
tagged with: java
has comment: http://stackoverflow.com/comment/32178657
has body: Basically I'm creating a board game in java and have managed to create cells, using arrays, to look like a 10x10 grid. Now I've numbered them they go from left to right top to bottom (as pic) I'm creating a game similar to a snakes and ladders game but having its own twist. Question is: How to create a zigzag board similar to a snakes &amp; ladder board? That's how it currently looks: Code below is of whats required to create arrays and print them and number them. Object named Game: private Cell[][] cell = new Cell[10][10]; public Game(String nameIt) { super(nameIt); JPanel x = new JPanel(); x.setLayout(new GridLayout(10, 10, 2, 2)); for (int r = 0; ir&lt; 10; r++) for (int c= 0; c &lt; 10; c++) x.add(cell[r][c] = new Cell(r, c, this)); } Object named cell: private int row; private int col; private int cellNum; static int count = 0; public Cell(int row, int column, Game guy) { this.ro = row; this.col = column; this.parent = guy; count = count+1; cellNum = count; setBorder(new LineBorder(Color.BLUE, 1)); // Set cell's border } protected void paintComponent(Graphics p) { super.paintComponent(p); p.drawString(String.valueOf(" " + cellNo), 24, 24); }
has answer: http://stackoverflow.com/a/21343491
upvote count: 3
accepted answer: http://stackoverflow.com/a/21343491
has comment: http://stackoverflow.com/comment/32178747
answer count: 1
downvote count: 1
tagged with: arrays
favorite count: 0
tagged with: multidimensional-array
has title: Java board game
has comment: http://stackoverflow.com/comment/32178753
score: 2
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/32178939

http://stackoverflow.com/q/21316443
tagged with: java
tagged with: eclipse-jet
type: Question
has body: I am working on a java-based framework for a Home Automation System. One of the requirements for this home automation system is that developers should be able to easily extend the functionality. I thought that a great way to simplify things would be to allow developers to create a simple XML file that describes the features of their peripheral; namely the commands that it can handle and the events that it can broadcast. (Similar to the WHEN and THEN events in systems like Wig Wag: http://www.kickstarter.com/projects/wigwag/wigwag-scan-it-control-it-rule-it-share-it) I would like to parse the XML file that the developer provides and automatically generate Java code to interface with the rest of the system, sort of like what Google does with their R.java file in the Android SDK. (I realize that this is handled by APT and not Eclipse) Some solutions I have looked at: Eclipse Java Emitter Templates (JET) - JET is very complicated to use and the documentation is very poor/nonexistant. I got it to produce a Java Implementation file with a generate() method, but I cannot find out how to get the IDE to generate the Java code I defined in the template. I tried this tutorial: https://weblogs.java.net/blog/survivant/archive/2009/01/template_code_g.html but I could not get the Car example to work; I get this error: Errors occurred during the build. Errors running builder 'JET Builder' on project 'JETTest'. Bad directive in 'main.jet' at line 1 column 1 Bad directive in 'main.jet' at line 1 column 1 Bad directive in 'main.jet' at line 1 column 1 Bad directive in 'main.jet' at line 1 column 1 JAXB - This appears to be more for marshalling/unmarshalling Java objects, and does not solve my problem ANT Compiler - I got this to generate a class, but it is not quite as flexible I want (e.g. I want to be able to get the package name from the developer-defined XML, but the output directory is statically assigned in the ANT build.xml file.) Apache Velocity - glanced at it but I was alrea…
has comment: http://stackoverflow.com/comment/32131497
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32130041
has title: Java Code Generation for a Framework
type: UnansweredQuestion
tagged with: code-generation
has answer: http://stackoverflow.com/a/21316920
score: 2
upvote count: 2

class
tags question: http://stackoverflow.com/q/21337528
tags question: http://stackoverflow.com/q/21231730
tags question: http://stackoverflow.com/q/21221211
tags question: http://stackoverflow.com/q/21264752
tags question: http://stackoverflow.com/q/21273050
tags question: http://stackoverflow.com/q/21240135
tags question: http://stackoverflow.com/q/21268732
tags question: http://stackoverflow.com/q/21215151
tags question: http://stackoverflow.com/q/21240052
tags question: http://stackoverflow.com/q/21188844
tags question: http://stackoverflow.com/q/21239077
tags question: http://stackoverflow.com/q/21332183
tags question: http://stackoverflow.com/q/21274715
tags question: http://stackoverflow.com/q/21332556
tags question: http://stackoverflow.com/q/21288051
tags question: http://stackoverflow.com/q/21204589
tags question: http://stackoverflow.com/q/21271480
tags question: http://stackoverflow.com/q/21192751
tags question: http://stackoverflow.com/q/21281902
tags question: http://stackoverflow.com/q/21270568
tags question: http://stackoverflow.com/q/21216468
tags question: http://stackoverflow.com/q/21186037
type: Tag
tags question: http://stackoverflow.com/q/21345335
tags question: http://stackoverflow.com/q/21299833
tags question: http://stackoverflow.com/q/21233863
tags question: http://stackoverflow.com/q/21200086
tags question: http://stackoverflow.com/q/21204993
tags question: http://stackoverflow.com/q/21342979
tags question: http://stackoverflow.com/q/21347807
tags question: http://stackoverflow.com/q/21295883
tags question: http://stackoverflow.com/q/21217854
tags question: http://stackoverflow.com/q/21194275
tags question: http://stackoverflow.com/q/21241609
tags question: http://stackoverflow.com/q/21223421
tags question: http://stackoverflow.com/q/21222617
tag name: class
tags question: http://stackoverflow.com/q/21225735
tags question: http://stackoverflow.com/q/21196653
tags question: http://stackoverflow.com/q/21258032
tags question: http://stackoverflow.com/q/21261866
tags question: http://stackoverflow.com/q/21281014
tags question: http://stackoverflow.com/q/21216403
tags question: http://stackoverflow.com/q/21270151
tags question: http://stackoverflow.com/q/21225330
tags question: http://stackoverflow.com/q/21290834
tags question: http://stackoverflow.com/q/21240740
tags question: http://stackoverflow.com/q/21291322

http://stackoverflow.com/comment/32087236
type: Comment
comment on: http://stackoverflow.com/q/21271485
has text: You need a Spring-jersey integration jar which will make Jersey use your Spring beans instead of instantiating them itself. Are you doing this?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32159981
has text: Hmm, your treetable example worksforme (with the hack), both 6/7. Also, the sequence of events is the same for tree/table. What's your OS?
comment on: http://stackoverflow.com/a/21331396
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/21313014
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/29405376
answer count: 2
has body: I am getting the following error when trying to compile my Pig UDF with maven (or with my IDE IntelliJ for that matter) : cannot access org.apache.hadoop.io.WritableComparable class file for org.apache.hadoop.io.WritableComparable not found So I figured I'd add a dependency to hadoop-core to my POM file but still no change, though I checked and the WritableComparable class is in the jar. My UDF class looks like this : public class INCREMENTAL_UPDATE extends EvalFunc&lt;DataBag&gt; { TupleFactory tupleFactory = TupleFactory.getInstance(); BagFactory bagFactory = BagFactory.getInstance(); public DataBag exec(Tuple input) throws IOException { if (null == input || input.size() != 0) { return null; } try { DataBag inputbag = (DataBag) input.get(0); Iterator it = inputbag.iterator(); DataBag outputbag = bagFactory.newDefaultBag(); Tuple previousTuple = null; while (it.hasNext()) { Tuple currentTuple = (Tuple) it.next(); Tuple outputTuple = tupleFactory.newTuple(); for (int i = 0; i &lt; currentTuple.size(); i++) { Object currentvalue = currentTuple.get(i); if (currentvalue == null) { outputTuple.append(currentvalue); } else { outputTuple.append(previousTuple.get(i)); } } previousTuple = outputTuple; outputbag.add(outputTuple); } return outputbag; } catch (Exception e) { throw new IOException("UDF INCREMENTAL_UPDATE failed"); } } } I am yet to figure out if this would actually work, since I'm unsure if a UDF is distributed. If it is, that previousTuple probably would not work. But I can't even test that out because I can't compile because of the error above.
upvote count: 1
favorite count: 0
has title: Pig UDF not finding WritableComparable
has comment: http://stackoverflow.com/comment/32123845
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/22874006
tagged with: apache-pig

http://stackoverflow.com/q/21212577
score: 0
answer count: 1
has title: How to parse complex JSON string mix with JSON Arrays using GSON?
type: AnsweredQuestion
has body: Below is my JSON String and I am trying to parse this JSON String using GSON as I am finding it pretty easy to work with. { "HasChanged":true, "Version":1, "LastModifiedDate":1390561121310, "DATACENTERS": [ { "Name": "DC1", "TotalNumberOfServers":4, "PrimaryData":[{"0":"1", "1":"2", "2":"3", "3":"4"}], "SecondaryData":[{"0":"2", "1":"3", "2":"4", "3":"1"}], "MachineMapping":[{"3":"dc11115.dc1.domain.com"}, {"2":"dc11114.dc1.domain.com"}, {"1":"dc11113.dc1.domain.com"}, {"4":"dc11116.dc1.domain.com"}] }, { "Name": "DC2", "TotalNumberOfServers":4, "PrimaryData":[{"1":"1", "5":"2", "2":"3", "6":"4"}], "SecondaryData":[{"7":"1", "0":"8", "2":"5", "10":"9"}], "MachineMapping":[{"3":"dc21147.dc2.domain.com"}, {"2":"dc21146.dc2.domain.com"}, {"1":"dc21145.dc2.domain.com"}, {"4":"dc21148.dc2.domain.com"}] } ] } After parsing the above JSON String, I need to store each DataCenter data in the below data structure - Map&lt;String, Map&lt;String, String&gt;&gt; primaryData Map&lt;String, Map&lt;String, String&gt;&gt; secondaryData Map&lt;String, Map&lt;String, String&gt;&gt; machineMapping For PrimaryData tag in the JSON String- Here Key of `primaryData` map is `DC1` and value is {"0":"1", "1":"2", "2":"3", "3":"4"} which is for `PrimaryData` tag. Similarly, another Key of `primaryData` map is `DC2` and value is {"1":"1", "5":"2", "2":"3", "6":"4"} which is for `PrimaryData` tag. And also for SecondaryData tag in the JSON String- Here Key of `secondaryData` map is `DC1` and value is {"0":"2", "1":"3", "2":"4", "3":"1"} which is for `SecondaryData` tag. Similarly, another Key of `secondaryData` map is `DC2` and value is {"7":"1", "0":"8", "2":"5", "10":"9"} which is for `SecondaryData` tag. And also for MachineMapping tag in the JSON String- Here Key of `machineMapping` is `DC1` and value is {"3":"dc11115.dc1.domain.com"}, {"2":"dc11114.dc1.domain.com"}, {"1":"dc11113.dc1.domain.com"}, {"4":"dc11116.dc1.domain.com"} which is for MachineMapping tag. Similarly another key of `mach…
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
has answer: http://stackoverflow.com/a/21212813
accepted answer: http://stackoverflow.com/a/21212813

http://stackoverflow.com/comment/31947615
type: Comment
has text: ... I added another crazy answer, take a look!
comment on: http://stackoverflow.com/a/21212139
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32001183
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21243312
has text: "I have some libraries that override the libraries in the Android code" -- that does not work, as you do not control the classpath at runtime, and so the libraries in the framework will supersede your duplicates, for any matches of fully-qualified class name.

http://stackoverflow.com/comment/31946489
has text: This solution does not work for me. It freezes up the GUI but still writes to the system output, if I comment out the for loop in the run method of the ConnectionThread it will run the command, but then I loose the connection...
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21199510

http://stackoverflow.com/comment/32091980
type: AnswerComment
has text: Sorry I took a bit to get back to you; I didn't notice your edit. Anyway that worked perfectly so thank you very much! In the future I will know how to avoid this issue. Again thanks
type: Comment
comment on: http://stackoverflow.com/a/21223366
score: 0

http://stackoverflow.com/comment/31917915
score: 0
type: Comment
has text: Excellent! appears to connect now (there's no exception on the connection). Cheers
type: AnswerComment
comment on: http://stackoverflow.com/a/21195576

http://stackoverflow.com/a/21206873
has body: 1) Try this. ResultSet rs = st.executeQuery("select * from `" + value3 + "` where Name='" + value1 + "' and Password='"+ value2 + "'"); See here: MySQL Identifiers The identifier quote character is the backtick ("`") in MySQL. 2) Also, as you're not using PreparedStatement, if your Name or Password contains ' you will have issues. Your code is vulnerable to SQL injection. See also: PreparedStatement SQL injection
score: 3
answers question: http://stackoverflow.com/q/21206865
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31936386
has comment: http://stackoverflow.com/comment/31935596
downvote count: 0
has comment: http://stackoverflow.com/comment/31935642
type: Answer
has comment: http://stackoverflow.com/comment/31935664
has comment: http://stackoverflow.com/comment/31935706
accepted answer of: http://stackoverflow.com/q/21206865
upvote count: 3
has comment: http://stackoverflow.com/comment/31935564

http://stackoverflow.com/q/21214340
has answer: http://stackoverflow.com/a/21214379
has body: I am creating a test and having some issues. Here is the scenario. I use Selenium Web driver to fill out a form on Page1 and submit the form by clicking a button. Page2 starts loading... but the problem is, Page2 uses Google Analytics codes, and sometimes it takes forever for the page to stop loading. Even though the expected element is already present, Selenium web driver does not proceed until the whole web page is fully loaded. How do I make Selenium to move on to the next task or stop loading external javascript/css if the expected element is already present? I tried tweaking the following settings but no luck. driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS); driver.manage().timeouts().setScriptTimeout(30, TimeUnit.SECONDS); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); TEMPORARY SOLUTION: Scroll below for answer!
type: UnansweredQuestion
tagged with: selenium
has answer: http://stackoverflow.com/a/21306075
linked to: http://stackoverflow.com/q/44503576
has comment: http://stackoverflow.com/comment/114990354
tagged with: selenium-webdriver
upvote count: 9
linked to: http://stackoverflow.com/q/5453423
tagged with: java
has answer: http://stackoverflow.com/a/21522193
has answer: http://stackoverflow.com/a/21215833
score: 9
type: Question
has answer: http://stackoverflow.com/a/21224632
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/21215065
has answer: http://stackoverflow.com/a/21306228
has title: Make Selenium Webdriver Stop Loading the page if the desired element is already loaded?
favorite count: 0

http://stackoverflow.com/a/21305775
has comment: http://stackoverflow.com/comment/32111087
type: Answer
has body: Swing can only work with os supporting desktop (head / screen). In the case of headless os, I can't understand any use case of JFrame. So you'll either have to get rid of JFrame from your program (which seems logical (there is no desktop)) or run it on an os with a head :) Hope this helps.
answers question: http://stackoverflow.com/q/21305606
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32110973
score: 0
has comment: http://stackoverflow.com/comment/32110720
has comment: http://stackoverflow.com/comment/32110861

http://stackoverflow.com/a/21207602
type: Answer
answers question: http://stackoverflow.com/q/21207413
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/121455374
accepted answer of: http://stackoverflow.com/q/21207413
has body: You can use SimpleDateFormat String dt = "01-JAN-2013"; DateFormat df = new SimpleDateFormat("dd-MMM-yyyy"); try { df.parse(dt); System.out.println("true"); } catch (ParseException e) { System.out.println("false"); }
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/21317192
tagged with: pom.xml
score: 2
upvote count: 2
tagged with: maven
has title: Could not load library: xuggle; version: 5; Using POM
has body: I'm attempting to use Xuggle and when trying to deploy, I'm getting the following error, below that is my POM file. Hopefully someone can tell me what I'm missing 13:55:34.965 [main] ERROR com.xuggle.ferry.JNILibraryLoader - Could not load library: xuggle; version: 5; Visit http://www.xuggle.com/xuggler/faq/ to find common solutions to this problem Exception in thread "main" java.lang.UnsatisfiedLinkError: no xuggle in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at com.xuggle.ferry.JNILibraryLoader.loadLibrary0(JNILibraryLoader.java:268) at com.xuggle.ferry.JNILibraryLoader.loadLibrary(JNILibraryLoader.java:171) at com.xuggle.ferry.JNILibrary.load(JNILibrary.java:161) at com.xuggle.ferry.FerryJNI.<clinit>(FerryJNI.java:16) at com.xuggle.ferry.Ferry.<clinit>(Ferry.java:25) at com.xuggle.xuggler.XugglerJNI.<clinit>(XugglerJNI.java:19) at com.xuggle.xuggler.Global.<clinit>(Global.java:238) at com.ngc.h264.H264.<clinit>(H264.java:23) 4.0.0 h264 h264 0.0.1-SNAPSHOT src maven-compiler-plugin 3.1 1.7 1.7 xuggle repo http://xuggle.googlecode.com/svn/trunk/repo/share/java/ org.jcodec jcodec 0.1.6-3 xuggle xuggle-xuggler 5.2 Additionally, looking at my Maven Dependencies I have the following: jcodec-0.1.6-3.jar xuggle-xuggler-5.2.jar slf4j-api-1.6.4.jar commons-cli-1.1.jar logback-core-1.0.0.jar logback-classic-1.0.0.jar Thoughts?
tagged with: xuggle
accepted answer: http://stackoverflow.com/a/21317644
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32131718
tagged with: java
has comment: http://stackoverflow.com/comment/32131297
type: Question
tagged with: xuggler
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/18077307
has answer: http://stackoverflow.com/a/21317644

http://stackoverflow.com/a/21322670
has body: Statements invoking undefined behavior1 are semantically as well as syntactically correct but make programs behave erratically. a[i++] = i; // Syntax (symbolic representation) and semantic (meaning) both are correct. But invokes UB. Another example is using a pointer without initializing it. Logical errors are also neither semantic nor syntactic. 1. Undefined behavior: Anything at all can happen; the Standard imposes no requirements. The program may fail to compile, or it may execute incorrectly (either crashing or silently generating incorrect results), or it may fortuitously do exactly what the programmer intended.
answers question: http://stackoverflow.com/q/21322554
has comment: http://stackoverflow.com/comment/32141643
has comment: http://stackoverflow.com/comment/32141703
score: 5
has comment: http://stackoverflow.com/comment/32141823
has comment: http://stackoverflow.com/comment/32141388
has comment: http://stackoverflow.com/comment/32141618
upvote count: 5
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/32141662

http://stackoverflow.com/comment/32069353
has text: you can give save_update also . It will save or update inner set when parent set is saving or updating
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21282325
score: 0

http://stackoverflow.com/a/21212290
has comment: http://stackoverflow.com/comment/31946452
type: Answer
has body: If dec() is your own method that removes a second it's perfectly normal that only one sec is removed when you hit the button. If you want to see the timer that goes down you should separate in two thread using swingworker. So in one thread you make the count down and after every second that you remove, make a publish to update the gui.
has comment: http://stackoverflow.com/comment/31945826
has comment: http://stackoverflow.com/comment/31945978
has comment: http://stackoverflow.com/comment/31945962
answers question: http://stackoverflow.com/q/21211495
score: 0

http://stackoverflow.com/q/21333117
score: 5
has comment: http://stackoverflow.com/comment/32164507
tagged with: coldfusion
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21336095
type: Question
has comment: http://stackoverflow.com/comment/32160695
has comment: http://stackoverflow.com/comment/32159282
upvote count: 5
has comment: http://stackoverflow.com/comment/32159576
tagged with: hmac
has body: I'm working with Shopify at the moment and using their webhook notifications so I can save stuff to our database. Within their webhook headers, they provide a header of: X-Shopify-Hmac-Sha256 which is: Each Webhook request includes a X-Shopify-Hmac-SHA256 header which is generated using the app's shared secret (looks like: '267bb1719a8e6ff75c4f2d709be0ca11'), along with the data sent in the request. This is jolly wonderful; However, I'm really struggling to calculate the value of the X-Shopify-Hmac-Sha256. I have a .cfm page which the webhook hits and I pass through the getHTTPRequestData to a function like thus: &lt;cfscript&gt; variables.stArgs = {}; variables.stArgs.stWebHookData = getHTTPRequestData(); application.stObj.stShopify.oShopifyWebHookBusiness.receiveWebHook(argumentCollection=variables.stArgs); &lt;/cfscript&gt; I then stole some code from StackOverflow and Ben Nadel, but neither seem to end up giving me the value that I want. Currently I'm using Ben Nadels code like thus: local.data = arguments.stWebHookData.toString(); local.macClass = createObject( "java", "javax.crypto.Mac" ); local.secretkeySpec = createObject( "java", "javax.crypto.spec.SecretKeySpec" ).init(toBinary(toBase64(arguments.key)),'HmacSHA256'); local.mac = local.macClass.getInstance('HmacSHA256'); local.mac.init(local.secretkeySpec ); local.hashedBytes = local.mac.doFinal(toBinary(toBase64(local.data))); return lcase( binaryEncode( local.hashedBytes, "base64" ) ); (arguments.key is the shared secret) Somewhere along the way, I am going wrong. Have I completely misunderstood what I am meant to be doing. This looks so easy in PHP.
accepted answer: http://stackoverflow.com/a/21336095
downvote count: 0
tagged with: shopify
answer count: 1
has comment: http://stackoverflow.com/comment/32162492
favorite count: 0
has title: coldfusion calculating HMAC256 of a getHTTPRequestData

http://stackoverflow.com/a/21941127
has comment: http://stackoverflow.com/comment/133151916
answers question: http://stackoverflow.com/q/21241683
has body: When you configure a bean as follows: @Bean @StepScope public MyInterface myBean() { return new MyInterfaceImpl(); } You are telling Spring to use the proxy mode ScopedProxyMode.TARGET_CLASS. However, by returning the MyInterface, instead of the MyInterfaceImpl, the proxy only has visibility into the methods on the MyInterface. This prevents Spring Batch from being able to find the methods on MyInterfaceImpl that have been annotated with the listener annotations like @BeforeStep. The correct way to configure this is to return MyInterfaceImpl on your configuration method like below: @Bean @StepScope public MyInterfaceImpl myBean() { return new MyInterfaceImpl(); } We have added a warning log message on startup that points out, as we look for the annotated listener methods, if the object is proxied and the target is an interface, we won't be able to find methods on the implementing class with annotations on them.
has comment: http://stackoverflow.com/comment/33254738
upvote count: 66
type: AcceptedAnswer
downvote count: 0
score: 66
has comment: http://stackoverflow.com/comment/44797941
type: Answer
has comment: http://stackoverflow.com/comment/33341788
accepted answer of: http://stackoverflow.com/q/21241683
has comment: http://stackoverflow.com/comment/33248906

directed-acyclic-graphs
type: Tag
tag name: directed-acyclic-graphs
tags question: http://stackoverflow.com/q/21258348

http://stackoverflow.com/comment/34599543
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21258905
has text: check the Java version being used. you may get the problem whe you are adding a new JRE (Window->Preferences->Installed JREs, same location as the not working one), making it the default and deleting the old (misbehaving one). With the new (from the same location) JRE starting Java applications in debug will work fine.

http://stackoverflow.com/comment/32183200
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21346048
has text: I write that this.registerBlock((Block[][]) blocks); It still gives me the same error! How would I fix that?
score: 0

http://stackoverflow.com/comment/32174116
comment on: http://stackoverflow.com/a/21338153
type: AnswerComment
type: Comment
score: 1
has text: You don't save any data unless all data is valid. That is what happens. First validate, handle exceptions, and then save, and handle exceptions.

http://stackoverflow.com/comment/32142315
type: QuestionComment
score: 0
has text: @CurtisSpence I think what Hovercraft is trying to say is, the compiler will output more than just the error, it will output the location of the error and normally provides some additional information that might be helpful in diagnosing the problem
comment on: http://stackoverflow.com/q/21323260
type: Comment

http://stackoverflow.com/q/21249053
has comment: http://stackoverflow.com/comment/32011643
downvote count: 0
tagged with: seed
upvote count: 3
answer count: 3
has title: Please explain me the role of seed in class Random in java.util
has answer: http://stackoverflow.com/a/21249081
has answer: http://stackoverflow.com/a/21249397
favorite count: 0
has answer: http://stackoverflow.com/a/21249284
accepted answer: http://stackoverflow.com/a/21249284
type: AnsweredQuestion
score: 3
has body: Whenever we create an object of Random class in java. We either of the constructor Random() Random(long seed) What is the purpose of seed here in the 2nd constructor and how can I use it to my benefit i.e. manipulate its use?
tagged with: java
possible better answer: http://stackoverflow.com/a/21249081
type: Question
tagged with: random

http://stackoverflow.com/q/21227076
answer count: 1
has comment: http://stackoverflow.com/comment/31972993
has comment: http://stackoverflow.com/comment/31973261
has comment: http://stackoverflow.com/comment/31973344
tagged with: android
has comment: http://stackoverflow.com/comment/31973156
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31973225
has answer: http://stackoverflow.com/a/21228100
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/31972944
has title: In which method of ViewGroup should I perform modification of the layout of its subviews?
score: 0
accepted answer: http://stackoverflow.com/a/21228100
has body: Please Note: I'm creating everything programmatically, so I'm not looking anywhere to mingle with the LayoutInflater service or its tricks. Because at the base, I do not want to create a single layout.xml of what I want to achieve here. Let's say I have a RelativeLayout and I've added a TextView and ImageView on this layout. Now, I want to know which method should I override where the RelativeLayout has already completed developing its final dimensions and which I can use to perform layout modifications of the TextView and ImageView. I've tried many methods like overriding onLayout, onMeasure, onAttachedToWindow, etc. I also tried attaching the onGlobalLayoutListener on the ViewTreeGroup of RelativeLayout and tried setting the layoutParams of its subviews. But, I can use this observer only once and then I've to remove it otherwise it gets called 2,000 times every 3 seconds. But nothing seems to work properly. Can anyone shed some light onto achieving this ? Note2 : Kindly do not comment as "what have you tried so far?". I've tried many things as I said before, and I cannot paste all what I've tried. But still I'll give an important information on how I'm modifying the layoutParams of a view so that you can get an idea. RelativeLayout rl = //assumed generated programmatically. TextView tv = //assumed generated programmatically. rl.setPadding(0,0,0,0); //i remove all the padding rl.addView(tv); //now once added I modify its layoutParams RelativeLayout.LayoutParams rlp = (RelativeLayout.LayoutParams)tv.getLayoutParams(); rlp.leftMargin = rl.getWidth() - 100; rlp.width = 100; rlp.height = LayoutParams.MATCH_PARENT; //thats and I do the above in an overridden method of RelativeLayout and expect the TextView to appear at the right-most end with width 100 and height equal to the container layout's height. Further, overriding onLayoutParams of RelativeLayout works, but it doesn't work properly for tableView cells. Here's an example //Definition of custom RelativeLayout publ…

http://stackoverflow.com/comment/32004123
type: AnswerComment
comment on: http://stackoverflow.com/a/21244891
type: Comment
score: 0
has text: Interesting answer, but it does not address the question.

http://stackoverflow.com/comment/32174051
has text: images will receive click if u define onClick in xml not in onCreate, i havn't clearely got ur prob but i must say this is not a good sol
score: 0
comment on: http://stackoverflow.com/q/21340873
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31944535
has text: CountDownTimer is an object that I have created. This will feed create a time like "00:01:25" and then I have a dec() method that removes a second. The problem is somewhere with the JButton and action event relationship I think.
type: QuestionComment
comment on: http://stackoverflow.com/q/21211495
score: 0
type: Comment

http://stackoverflow.com/q/21186435
type: Question
answer count: 2
tagged with: spring-annotations
tagged with: spring
has comment: http://stackoverflow.com/comment/31902341
has answer: http://stackoverflow.com/a/21192662
tagged with: java
has comment: http://stackoverflow.com/comment/31901232
upvote count: 1
accepted answer: http://stackoverflow.com/a/21192662
has body: Here is my problem : I have an annotation : @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface DummyAnnotation { String dummyParam1(); String dummyParam2(); } My service is : @Component public class DummyService { @DummyAnnotation(dummyParam1="#otp",dummyParam2="#transactionId") public void dummy(String otp, String transactionId){ } } My aspect is trying to validate the two arguments and throw exception if the validation don't successed : @Around(value = "@annotation(annotation)") public Object verifyOtp(final ProceedingJoinPoint jointPoint, final DummyAnnotation annotation) throws Throwable { String transactionId = annotation.dummyParam1(); String otp = annotation.dummyParam2(); Boolean otpValid = otpService.verify(transactionId, otp); if (otpValid) { return jointPoint.proceed(); } else { throw new AuthentificationForteException(); } } How can i get this working because Spring EL is not working and in my Aspect i have dummyAnnotation.dummyParam1() Equal to "#otp" and not to the value of my argument String otp . Thanks in advance .
has title: Custom Annotation with dynamic argument
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21239163
downvote count: 0
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/21239163

http://stackoverflow.com/comment/32186425
comment on: http://stackoverflow.com/a/21311083
has text: I appreciate your effort. Thank you very much.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21201631
has answer: http://stackoverflow.com/a/21201660
accepted answer: http://stackoverflow.com/a/21201660
has title: Converting Vector to HashSet in Java
has comment: http://stackoverflow.com/comment/31926744
has comment: http://stackoverflow.com/comment/31926773
type: AnsweredQuestion
tagged with: java
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/31926691
has comment: http://stackoverflow.com/comment/31926895
score: 0
has body: Could someone explain, how the following code printed the Vector elements (in which order they were printed)? Code: import java.util.HashSet; import java.util.Vector; class Test { public static void main(String [] args) throws Exception { Vector data = new Vector(); data.add("apple"); data.add("mango"); data.add("papaya"); data.add("cherry"); data.add("banana"); data.add("apple"); System.out.println(getData(data)); } public static Vector getData(Vector v) { return new Vector(new HashSet(v)); } } Output: [banana, cherry, papaya, apple, mango]
answer count: 1
has comment: http://stackoverflow.com/comment/31926782

http://stackoverflow.com/q/21284308
has answer: http://stackoverflow.com/a/21284563
has answer: http://stackoverflow.com/a/21284500
type: AnsweredQuestion
tagged with: biginteger
has comment: http://stackoverflow.com/comment/32072491
tagged with: java
tagged with: loops
has comment: http://stackoverflow.com/comment/32072747
type: Question
has title: Permutation with BigInteger
tagged with: for-loop
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/32072719
accepted answer: http://stackoverflow.com/a/21284500
answer count: 3
has answer: http://stackoverflow.com/a/21284496
has comment: http://stackoverflow.com/comment/32072714
favorite count: 0
has body: Permutation with BigInteger works fine upto 4 digits (3456 P 1234) when i give 5 digit input to n and r, it is not working. i have changed my input type as BigInteger n = scan.nextBigInteger();I edited my code as ` import java.math.BigInteger; import java.util.Scanner; public class cvic { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("Enter n and r: "); BigInteger n = scan.nextBigInteger(); BigInteger r = scan.nextBigInteger(); System.out.println("nPr = "+fact(n).divide(fact(n.subtract(r)))); } static BigInteger fact(BigInteger num) { BigInteger fa = BigInteger.ONE; for(BigInteger inte = BigInteger.ONE; inte.compareTo(num) &lt;= 0; inte = inte.add(BigInteger.ONE)){ fa = fa.multiply(inte); } return fa; } } `
has comment: http://stackoverflow.com/comment/32072583
downvote count: 2
possible better answer: http://stackoverflow.com/a/21284496

http://stackoverflow.com/comment/31956224
type: Comment
comment on: http://stackoverflow.com/a/21215562
has text: @MarkoTopolnik No timely guarantee; but it is the part of garbage collection. you can't expect finalizers to be called for sure, but you can expect safe handle's `Finalize` will be called for sure **before the object's memory is reclaimed**
type: AnswerComment
score: 0

http://stackoverflow.com/q/21210760
has body: I have class Client and method called listRooms(). public synchronized RoomInfo[] listRooms() { sendMessage(new Message("@refresh")); try { System.out.println("#1"); wait(); System.out.println("#2"); } catch (InterruptedException e) { e.printStackTrace(); return null; } if( m_RoomListMessage == null ) return null; RoomInfo[] rooms = new RoomInfo[ m_RoomListMessage.getInteger(0) ]; for(int i=0; i&lt;rooms.length; i++) { rooms[i] = new RoomInfo( m_RoomListMessage.getString(3*i + 1), m_RoomListMessage.getBoolean(3*i + 2), m_RoomListMessage.getInteger(3*i+3) ); } return rooms; } I also have class Listener (extends Thread) which listens for incoming messages from server. As the message arrives listener thread reads Message (using ObjectInputStream) and then calls next method. public synchronized void processMessage(Message aMessage) { if( aMessage.type.equals("@roomlist") ) { m_RoomListMessage = aMessage; notify(); System.out.println("notificiran xD"); return; } MessageHandler handler = m_MessageHandlers.get(aMessage.type); if( handler == null ) { System.out.println("No MessageHandler for: " + aMessage.type); return; } handler.onMessage(aMessage); } The problem is it waits forever. processMessage() is never called after I sent @refresh message and my server shows that it sent message containing list of all rooms on server, also method is called from Listener thread but listRooms() is called from object LobbyView (extends View which extends JPanel) attached to object of ClientWindow (extends JFrame), so it is different thread. And I don't know why is it blocked. So Listener obviously cannot call processMessage but I don't know why or I have some wrong understanding of threads in Java :D EDIT: It also indicates that Listener thread is blocked for some reason...
tagged with: java
type: Question
has title: Multithread blocking in Java
has comment: http://stackoverflow.com/comment/31942963
tagged with: wait
tagged with: notify
score: 0
has answer: http://stackoverflow.com/a/21210802
answer count: 1
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/31942983

http://stackoverflow.com/comment/32062729
has text: Check your codebase. If the code you have posted is correct then your codebase also has a `OnQueryResultSentListener` interface as a top level interface.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21278028
type: Comment

http://stackoverflow.com/q/21298067
upvote count: 1
type: AnsweredQuestion
tagged with: object
tagged with: algorithm
score: 1
tagged with: java
tagged with: comparison
type: Question
has answer: http://stackoverflow.com/a/21298092
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm working something similar to an audit log, which requires logging the fields that are different between 2 given objects. For example, I have these 2 objects, oldFoo and newFoo of class Foo. Let's say this class has more than 20 fields. I wanted to know what fields are different - what are the fields in newFoo that were previously null in oldFoo but no loner are? What are the fields in newFoo whose values were changed or set to null. Of course, I can always do it the dumb way like this: Map&lt;String, List&lt;Map&lt;String, Object&gt;&gt; diff (Foo oldFoo, Foo newFoo) { Map&lt;String, List&lt;Map&lt;String, Object&gt;&gt; ret = new HashMap&lt;String, List&lt;Map&lt;String, Object&gt;&gt;(); List&lt;Map&lt;String, Object&gt;&gt; added = new ArrayList&lt;Map&lt;String, Object&gt;&gt;(); List&lt;Map&lt;String, Object&gt;&gt; changed = new ArrayList&lt;Map&lt;String, Object&gt;&gt;(); List&lt;Map&lt;String, Object&gt;&gt; removed = new ArrayList&lt;Map&lt;String, Object&gt;&gt;(); if (newFoo.getField1() != null &amp;&amp; oldFoo.getField1() == null) { added.add(new HashMap&lt;String, Object&gt;().put("fieldName", "field1") .put("oldValue", "") .put("newValue", newFoo.getField1()); } else if (newFoo.getField1() == null &amp;&amp; oldFoo.getField1() != null) { removed.add(new HashMap&lt;String, Object&gt;().put("fieldName", "field1") .put("oldValue", oldFoo.getField1()) .put("newValue", ""); } else if (newFoo.getField1() != null &amp;&amp; oldFoo.getField1() != null &amp;&amp; !newFoo.getField1().equals(oldFoo.getField1()) { changed.add(new HashMap&lt;String, Object&gt;().put("fieldName", "field1") .put("oldValue", oldFoo.getField1()) .put("newValue", newFoo.getField1()); } //keep going for *MORE THAN 20* fields... :( //... ret.put("CHANGED", changed); ret.put("ADDED", added); ret.put("REMOVED", removed); return ret; } But I'm sure there has to be a smart way out there. Any suggestion? * Update 1 * I'm trying to avoid using reflection as much as I possibly can.
accepted answer: http://stackoverflow.com/a/21298092
has title: Determine the differences between 2 objects

http://stackoverflow.com/q/21237866
type: AnsweredQuestion
tagged with: java
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/21238021
has title: Java Poll or Listen to URL for response [Java SE]
has body: I have a module which requests status(technically a JSON object) from an FHEM server(home automation) using a simple HTTP post. How can i poll the requestState method so as to continuously listen (like every 125ms) on the URL for changes in status? [note: i am not using any server, this is a plain Java program called from a Main function.] To give an illustration: public static boolean requestState(){ HttpPost post = new HttpPost("http://localhost:8083/fhem?cmd=jsonlist+device1"); try{ HttpResponse response = client.execute(post); BufferedReader rd = new BufferedReader( new InputStreamReader(response.getEntity().getContent())); StringBuffer result = new StringBuffer(); String line = ""; while ((line = rd.readLine()) != null) { result.append(line); } //response is a JSONObject JSONObject o = new JSONObject(result.toString()); //get the status from the JSON object System.out.println(o.getJSONObject("Result").get("STATE")); String STATE = o.getJSONObject("Result").get("STATE"); if(STATE.equals("OPEN")) return false; else return true; } catch(Exception e){ e.printStackTrace(); } } What i would like to achieve is: keep listening to URL parse response to judge the status if status == OPEN soundAlarm(); Thanks in advance!
accepted answer: http://stackoverflow.com/a/21238021
score: 0
tagged with: polling
answer count: 1

http://stackoverflow.com/a/21327580
type: Answer
has body: Marker interfaces as the name suggest are used for just an indication and they mark the class implementing that interface. Now in your code you can take some actions on it like (instance instanceof Marker) At most places Annotations can be used for Markers For example if @Test on a class shows that this class is a Test class and should be executed. Same can be achieved with an interface. @Test //sort of marking class ClassToTest{ } or class ClassToTest implements Test{ } The above examples are synonymous in the way what they are trying to achieve. For checking the presence in the first case you will try to check the presence of @Test annotation and in second case you will make instanceof check. With marker interfaces you also get an advantage that if you store all the instances of test, then you can have a type safe collection List&lt;Test&gt; or if you want to make a type safe method that will only accept the instances of Test void method(Test testInstance){ }
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21327500
downvote count: 0

http://stackoverflow.com/q/21236101
tagged with: jtable
accepted answer: http://stackoverflow.com/a/21236555
has comment: http://stackoverflow.com/comment/31989453
upvote count: 1
has body: I'm trying to resize a JTable column without affecting the rest of the columns in the table but every time I try to do this all the other columns also change size: final JTableHeader header = (JTableHeader) e.getSource(); header.getTable().setAutoResizeMode(JTable.AUTO_RESIZE_OFF); TableColumn column = header.getColumnModel().getColumn(3); for (int col = 0; col &lt; header.getColumnModel().getColumnCount() ; col++) { if (col == column.getIndex()) { header.getColumnModel().getColumn(col).setPreferredWidth(header.getColumnModel().getColumn(col).getPreferredWidth()+100); break; } } columnModel.getTable().doLayout();
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/31989538
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/31989659
tagged with: java
has title: How to resize a single JTable column without affecting the other table columns
answer count: 1
downvote count: 0
tagged with: tablecolumn
tagged with: resize
favorite count: 0
has answer: http://stackoverflow.com/a/21236555

http://stackoverflow.com/comment/31902834
has text: No. Use separate connections for every client.
comment on: http://stackoverflow.com/q/21188057
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/32074168
has text: Aye, i'm just not the one who pulls that trigger unfortunately. downtime=badtime (rightly or wrongly). Since the certificates have been changed though, perhaps i could just fiddle with the keystore certificates
type: AnswerComment
comment on: http://stackoverflow.com/a/21268878
score: 0
type: Comment

http://stackoverflow.com/comment/32069838
comment on: http://stackoverflow.com/a/21282509
score: 0
has text: removed and same result.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/21279038
has comment: http://stackoverflow.com/comment/32103999
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32063560
tagged with: subtraction
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21279187
has body: I'm getting 0 instead of 1 1 1 1 1. class learn package learn2; import java.io.*; public class learn { public static void main(String[] args) throws IOException{ InputStreamReader ISR=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(ISR); int myArray[]=new int[5]; int sum= 0; int pro = 0; for(int u=0;u&lt;5;u++) { if (myArray[u]&gt;0) { sum= sum= sum = myArray[u]; pro = pro* myArray[u]; } System.out.println("enter a number"); String x=br.readLine(); int x1=Integer.parseInt(x); myArray[u]=x1; } for (int u1=0;u1&lt;5;u1++) { System.out.println("You Enter" + myArray[u1] ); } System.out.print("the sum of all positive numbers is: " + sum ); System.out.println("the product of all positive numbers is: " + pro); } }
type: Question
has answer: http://stackoverflow.com/a/21279261
has title: Input 5 numbers then show all the positive and negative that you entered
has comment: http://stackoverflow.com/comment/32064109
tagged with: arrays
tagged with: bufferedreader

http://stackoverflow.com/q/21264501
has answer: http://stackoverflow.com/a/23115509
has title: Using Odata4j to create abstract syntax tree for Query Parameter expressions
type: Question
has body: Im exposing REST services through use of Sprint MVC 4.0 framework and I try following Odata specification for the Query Parameters such as $filter, $search and $orderBy. Each of these contains expressions that I need to parse, build abstract syntax trees and validate. They are all retrieved as String. I do not need all the constructions that are defined in the Odata grammer (http://docs.oasis-open.org/odata/odata/v4.0/cos01/abnf/odata-abnf-construction-rules.txt), I just pick the ones that are relevant for my uses cases (very few actually) I would like some tip on how to parse and build the abstract tree in a easy way and if Odata4j might be used as a Utility library to do this job for me? I would like to avoid dragging bunch of new dependencies to odata4j, since I will only use small piece of the code.
tagged with: java
tagged with: odata4j
downvote count: 0
answer count: 1
tagged with: odata
favorite count: 0
type: UnansweredQuestion
score: 2
upvote count: 2

http://stackoverflow.com/q/21307507
favorite count: 0
has comment: http://stackoverflow.com/comment/32378322
upvote count: 1
accepted answer: http://stackoverflow.com/a/21391619
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32120124
type: Question
has comment: http://stackoverflow.com/comment/32151599
has title: search for substring in lucene
tagged with: lucene
has body: i have so many fields to get data from lucene. one of that field is: NTF_com.cisco.vportal.1.TranscodingStatus and its value is: FAILED:DEPLOY_FALSE:bdecc8c3-0389-47b7-bbe5-04a2611e4be9:dms.job.transform.input.format.unsupported.error:dms.job.transform.error.type.permanent now i want to check to search as weather this value contain FAILED or not. i tried with the WildcardQuery but its not working for me i put it as org.apache.lucene.index.Term term=neworg.apache.lucene.index.Term("NTF_com.cisco.vportal.1.TranscodingStatus", "FAILED*"); Query wquery=new WildcardQuery(term); but not getting proper result. i just want to check that weather this field contain substring which i passed on it.
has comment: http://stackoverflow.com/comment/32258925
has answer: http://stackoverflow.com/a/21391619
has comment: http://stackoverflow.com/comment/32130829
has comment: http://stackoverflow.com/comment/32348128
has comment: http://stackoverflow.com/comment/32119878
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32116158

http://stackoverflow.com/q/21335820
has body: I created my main JFrame and added a button with click event that will show my JDialog named AddProductGUI. AddProductGUI addProductGUI = new AddProductGUI(); addProductGUI.AddNewProduct(); JOptionPane.showMessageDialog(contentPane, "message"); My code for AddNewProduct(), my constructor just position each component. public void AddNewProduct() { addProductGUI = new AddProductGUI(); addProductGUI.setAlwaysOnTop(true); addProductGUI.setDefaultCloseOperation(DISPOSE_ON_CLOSE); addProductGUI.txtProductID.setText(""); addProductGUI.txtCode.setText(""); addProductGUI.txtName.setText(""); addProductGUI.txtBrand.setText(""); addProductGUI.setVisible(true); } AddNewProduct() method simply just shows the JDialog and sets the textfields without text. My problem is when my AddProductGUI appears the my message dialog also appear. How can I make my message dialog appear only after closing JDialog?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21335990
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/21335990
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/32163936
upvote count: 3
answer count: 1
downvote count: 0
has title: Running a statement after closing JDialog
favorite count: 0
tagged with: jdialog

http://stackoverflow.com/comment/32032000
has text: oh, since it's a `Set<String>` try - `driver.getWindowHandles().iterator().next()`
type: AnswerComment
comment on: http://stackoverflow.com/a/21237199
score: 0
type: Comment

bufferedimage
tags question: http://stackoverflow.com/q/21191481
tags question: http://stackoverflow.com/q/21279535
tags question: http://stackoverflow.com/q/21344733
tag name: bufferedimage
tags question: http://stackoverflow.com/q/21302611
tags question: http://stackoverflow.com/q/21204627
tags question: http://stackoverflow.com/q/21217722
tags question: http://stackoverflow.com/q/21320550
type: Tag

http://stackoverflow.com/a/21488170
has body: By default Apache canonicalises URL's before passing them further, and apparently tomcat alone does it differently. To prevent mod_proxy from modifying your URL's, add nocanon keyword to ProxyPass directive. Note, that both spaces and commas are considered to be unsafe in RFC 1738 and should not be used unescaped.
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21296519
score: 1

http://stackoverflow.com/q/21316032
score: 0
tagged with: x509
type: Question
tagged with: java
tagged with: jax-ws
has title: JAX-WS Mutual Auth Failure after ClientKeyExchange
has comment: http://stackoverflow.com/comment/32134645
has body: The short of it.... I have a JAX-WS service residing on a web server using SSL and requiring mutual authentication. First to test that mutual authentication is working properly, I import the client certificate into the browser. I then point the browser to the protected site and it successfully connects and retrieves content. Then I wrote the java code to connect to the service on the same web site. I import the same certificate into a java keystore file (jks), I receive a TLSv1 Alert: fatal, handshake_failure. I did a -Djavax.net.debug=ssl:handshake and found that the ClientHello and ServerHello were successfull. Then it proceeds to do the ClientKeyExchange, and I see the SESSION KEYGEN. Then it goes to CertificateVerify and that is when the fatal, handshake_failure occurs. I am at a loss for why the browser works and the java application does not. I am running on Java 1.6.0_45, though I have tried this same code on Java 7 to the same result. See below for more details. The long of it.... This is long, I include my code for loading the key and truststores and I finally include the javax.net.debug output. To support the loading of the keystore and truststore dynamically, I created a Custom SocketFactory. public abstract class AbstractSSLSocketFactory extends SSLSocketFactory { private static final Logger logger = Logger.getLogger(AbstractSSLSocketFactory.class); protected AbstractSocketFactoryAdapter adapter = null; @Override public Socket createSocket(Socket arg0, String arg1, int arg2, boolean arg3) throws IOException { return this.adapter.getFactory().createSocket(arg0, arg1, arg2, arg3); } @Override public String[] getDefaultCipherSuites() { String[] cipherSuites = null; try { cipherSuites = this.adapter.getFactory().getDefaultCipherSuites(); } catch (ServiceSecurityException e) { logger.error("There was an error retrieving the SSLSocketFactory", e); } return cipherSuites; } @Override public String[] getSupportedCipherSuites() { String[] cipherSuites = null; try …
has comment: http://stackoverflow.com/comment/32129114
tagged with: mutual-authentication
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/a/21260726
upvote count: 1
answers question: http://stackoverflow.com/q/21260630
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21260630
score: 1
type: Answer
has body: Let me answer by turning your question a bit upside-down: Integer i1 = new Integer(2); Integer i2 = new Integer(2); Integer i3 = new Integer(2); i3 = i1 + i2; vs. int i1 = 2; int i2 = 2; int i3 = 2; i3 = i1 + i2; In both cases the exact same thing happens to the i3 variable: its value gets overwritten and its address stays the same. The only difference is in the meaning of those values. NB. Since the Integer instances you use don't escape the method, the actual native code may not make any allocations at all and may be exactly equivalent in both cases.

http://stackoverflow.com/comment/32004057
score: 0
type: AnswerComment
type: Comment
has text: @Servy are you reading his answer backward? It's not highly opinionated at all. Interlanguage IS for advanced developers and he provided the poster with a solution which is to stick to a single language
comment on: http://stackoverflow.com/a/21244722

http://stackoverflow.com/q/21254693
type: Question
tagged with: java
score: -1
has body: In these codes I get information of how many Job is available (JobCount) and in the next JFrame I want to put JobCount times JToggleButtton. but the JobCount doesn't pass correctly. How can I make it so it can pass information from frames? public class NewJFrame extends javax.swing.JFrame { public NewJFrame() { initComponents(); } public int PeopleCount; public int JobCount; public JFrame2 jf2; private void PJCountjButtonActionPerformed(java.awt.event.ActionEvent evt) { PeopleCount=(int)(PeopleCountjSpinner.getValue()); JOptionPane.showMessageDialog(null, "peoplecount="+PeopleCount); JobCount=(int)(JobCountjSpinner.getValue()); jf2=new JFrame2(); jf2.setVisible(true); jf2.c1=this; this.setVisible(false); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new NewJFrame().setVisible(true); } }); } public class JFrame2 extends javax.swing.JFrame { int j; public NewJFrame c1 = new NewJFrame(); JPanel contentpane; JButton show; public JButton[] jbarray = new JButton[c1.JobCount]; public int array[][] = new int[c1.PeopleCount][c1.JobCount]; public JFrame2() { initComponents(); JOptionPane.showMessageDialog(null, "peoplecount="+c1.PeopleCount); this.setDefaultCloseOperation(this.EXIT_ON_CLOSE); this.setBounds(10, 01, 500, 400); this.contentpane = new JPanel(); this.show = new JButton("Show array"); contentpane.add(show); for (j = 0; j &lt; c1.JobCount; j++) { this.jbarray[j] = new JButton("job" + (j + 1)); contentpane.add(jbarray[j]); } this.setContentPane(contentpane); this.setVisible(true); }} // Variables declaration - do not modify private javax.swing.JSpinner JobCountjSpinner; private javax.swing.JButton PJCountjButton; private javax.swing.JSpinner PeopleCountjSpinner; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; // End of variables declaration }
linked to: http://stackoverflow.com/q/9554636
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/32020356
has answer: http://stackoverflow.com/a/21255288
has title: Pass information from JFrames
favorite count: 0
has answer: http://stackoverflow.com/a/21271324
has answer: http://stackoverflow.com/a/21254978
has comment: http://stackoverflow.com/comment/32020647
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
downvote count: 1

http://stackoverflow.com/comment/32127984
comment on: http://stackoverflow.com/q/21313696
has text: Indeed the Content Encoding is gzip, you can also see that in the image of dev client. Here is what entity.getContentEnconding().ToString() returned "Content-Encoding: gzip"
score: 0
type: QuestionComment
type: Comment

nullpointerexception
tags question: http://stackoverflow.com/q/21205416
tags question: http://stackoverflow.com/q/21195875
tags question: http://stackoverflow.com/q/21286829
tags question: http://stackoverflow.com/q/21286109
tags question: http://stackoverflow.com/q/21285453
tags question: http://stackoverflow.com/q/21331462
tags question: http://stackoverflow.com/q/21296241
tags question: http://stackoverflow.com/q/21258422
tags question: http://stackoverflow.com/q/21281130
tags question: http://stackoverflow.com/q/21267372
tags question: http://stackoverflow.com/q/21297520
tags question: http://stackoverflow.com/q/21287577
type: Tag
tags question: http://stackoverflow.com/q/21266037
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/21305382
tags question: http://stackoverflow.com/q/21275002
tags question: http://stackoverflow.com/q/21198573
tags question: http://stackoverflow.com/q/21201629
tags question: http://stackoverflow.com/q/21205156
tags question: http://stackoverflow.com/q/21223593
tags question: http://stackoverflow.com/q/21230256
tags question: http://stackoverflow.com/q/21222250
tags question: http://stackoverflow.com/q/21273950
tags question: http://stackoverflow.com/q/21318347
tags question: http://stackoverflow.com/q/21322436
tags question: http://stackoverflow.com/q/21288433
tags question: http://stackoverflow.com/q/21297782
tags question: http://stackoverflow.com/q/21326476
tags question: http://stackoverflow.com/q/21242939
tags question: http://stackoverflow.com/q/21305431
tags question: http://stackoverflow.com/q/21311230
tags question: http://stackoverflow.com/q/21238968
tags question: http://stackoverflow.com/q/21211169
tags question: http://stackoverflow.com/q/21197835
tags question: http://stackoverflow.com/q/21224445
tags question: http://stackoverflow.com/q/21236245
tags question: http://stackoverflow.com/q/21230284
tags question: http://stackoverflow.com/q/21267851
tags question: http://stackoverflow.com/q/21349733
tags question: http://stackoverflow.com/q/21321633
tags question: http://stackoverflow.com/q/21203708
tags question: http://stackoverflow.com/q/21328099
tags question: http://stackoverflow.com/q/21255684

http://stackoverflow.com/a/21305252
has comment: http://stackoverflow.com/comment/32109979
score: 8
answers question: http://stackoverflow.com/q/21305215
downvote count: 0
upvote count: 8
type: Answer
has body: In Java - "References to objects are passed by Value". Any change you make in the doMore() method will not be reflected in your original array because you are reassigning the passed reference there... ( Please use camelCase for naming methods/fields. i.e, use doMore() instead of domore). public void run() { int[] arr = new int [3]; // arr points to an integer array of size 3 doMore(arr); } private static void doMore(int[] arrNew) { // arrNew is copy of arr so it also points to the same integer array of size 3. So, any changes made by arrNew are as good as changes made by arr (and yes data of arr is changed..) // TODO Auto-generated method stub int [] arrNew = new int [3]; // you are making arrNew point to new integer array of size 3. So, now arrNew points to a new object and not to the one pointed by arr. for(int i=0; i&lt;arrNew.length;i++){ arrNew[i]=77; } }
has comment: http://stackoverflow.com/comment/32110167

http://stackoverflow.com/q/21265285
score: 5
tagged with: dependency-injection
tagged with: jersey
has answer: http://stackoverflow.com/a/21366128
upvote count: 5
has body: I am new to Jersey 2. So far I worked with Jersey 1.x and Spring and would like to use HK2 implementation. After reading the tutorial I wrote the following: @ManagedBean @Path("products") @Produces({ MediaType.APPLICATION_JSON }) public class ProductResource { @Inject ProductManager productManager; @GET public GenericResponseData&lt;List&lt;Product&gt;&gt; getProducts(@QueryParam("condition") Condition condition, @QueryParam("keywords") String keywords) { GenericResponseData&lt;List&lt;Product&gt;&gt; res = new GenericResponseData&lt;List&lt;Product&gt;&gt;(); res.setObject(productManager.getProducts(condition, keywords)); return res; } } @Contract public interface ProductManager { public List&lt;Product&gt; getProducts(Condition condition, String keywords); } @Service public class MyProductManager implements ProductManager { @Override public List&lt;Product&gt; getProducts(Condition condition, String keywords) { return null; } } However I get the following exception: org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee What is wrong?
tagged with: jersey-2.0
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/21268330
favorite count: 0
has title: org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25621702
tagged with: hk2
tagged with: java
type: Question

http://stackoverflow.com/a/21219148
has comment: http://stackoverflow.com/comment/31957802
answers question: http://stackoverflow.com/q/21219131
upvote count: 3
type: Answer
has body: map[y] is null, that's why you are getting this exception. When you initialize an array, it allocates the size and all the positions (indexes) are null. You need to make all the indexes to refer to an object of the declared array type. i.e here it would be String
has comment: http://stackoverflow.com/comment/31957840
downvote count: 0
score: 3

http://stackoverflow.com/comment/37913928
has text: I haven't tried Java 7, I may try that in the future. I would *prefer* to use Java 8 hardfloat because of the speed difference (hardware floating vs software floating.) Thanks for pointers, I will be sure to try these out. As for why you can't comment, that's because you are below 50 rep. It's in place to protect the site from being spammed via comments, as that would be an easy place to strike. Read here if you want to know a little more: http://stackoverflow.com/help/privileges/comment
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24488418

http://stackoverflow.com/comment/32171493
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21339088
score: 0
has text: @DavidLevesque Thank you for being the first to see the typo. I had changed `locations` to `facilities`. I have just made the change to the code above, which reveals the real error. Can you please help me resolve it? I have been looking at this for a couple days and cannot figure it out.

http://stackoverflow.com/q/21321586
has comment: http://stackoverflow.com/comment/32175160
has comment: http://stackoverflow.com/comment/32151208
type: Question
has comment: http://stackoverflow.com/comment/32150750
has body: I'm trying to use Volley as a DBA layer to call a webservice that hadles JSON objects. Because this layer is below the activity and another service layer, it doesn't seem to be working properly. I'll try to explain my setup: MainActivity: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ProductService productService = new ProductService(); productService.getProduct(); } ProductService.java: public void getProduct() { JsonObjectRequest req = new JsonObjectRequest("http://echo.jsontest.com/name/Milk/price/1.23/", null, createMyReqSuccessListener(), createMyReqErrorListener()); ApplicationController.getInstance().addToRequestQueue(req); } private Response.Listener&lt;JSONObject&gt; createMyReqSuccessListener() { return new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { Log.v("response", response.toString()); } }; } private Response.ErrorListener createMyReqErrorListener() { return new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { return; } }; } I hope that is clear enough. In the end, I would like to use the ProductService::getProduct() from an activity and the the actual JSON response from the webservice in a variable which I can later use. However, at the moment, the line Log.v("response", response.toString()); doesn't even execute. What am I doing wrong?
has answer: http://stackoverflow.com/a/58474510
answer count: 2
has comment: http://stackoverflow.com/comment/32175012
downvote count: 0
has comment: http://stackoverflow.com/comment/32176418
has comment: http://stackoverflow.com/comment/32139630
has title: Get Android Volley response in another class
has answer: http://stackoverflow.com/a/21322252
has comment: http://stackoverflow.com/comment/32154026
favorite count: 0
has comment: http://stackoverflow.com/comment/32154071
tagged with: android-volley
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32172839
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1

http://stackoverflow.com/comment/31896072
type: Comment
comment on: http://stackoverflow.com/a/21184958
score: 0
has text: Couldn't agree more! It applies to comments too - when working on my own projects, I comment everything as much for the benefit of ConfusedFutureMe as I do for the benefit of HypotheticalFutureCodeveloper.
type: AnswerComment

http://stackoverflow.com/a/21308920
answers question: http://stackoverflow.com/q/21308822
downvote count: 0
type: Answer
has body: I think it is only possible if you separate the mapping definition from the entities so that you can replace it. Thus you can not use annotation based mapping. Instead I would suggest to use xml based mapping and create different xml mapping files for each client. Since you have about 500 clients you might want to create groups of clients who all share the same mapping file. At least I think it will be very hard to maintain the different clients needs with one entity model and it will lead to a complex code structure. E.g. if you add properties to the enties that can be null for some clients than you will also add a lot more null checks to your code. One null check for each client specific property.
upvote count: 3
score: 3

http://stackoverflow.com/a/21190872
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31907357
has comment: http://stackoverflow.com/comment/35411313
has comment: http://stackoverflow.com/comment/31907810
has comment: http://stackoverflow.com/comment/32103927
type: Answer
has comment: http://stackoverflow.com/comment/32104590
has comment: http://stackoverflow.com/comment/31958488
has comment: http://stackoverflow.com/comment/31908029
upvote count: 19
score: 19
accepted answer of: http://stackoverflow.com/q/21190553
has body: You can find an explanation for circle/rectangle collision below, but please note that this type of collision might not be necessary for your needs. If, for example, you had a rectangle bounding box for your character the algorithm would be simpler and faster. Even if you are using a circle, it is probable that there is a simpler approach that is good enough for your purposes. I though about writing the code for this, but it would take too long so here is only an explanation: Here is a example movement of your character circle, with its last (previous) and current positions. Wall rectangle is displayed above it. Here is that same movement, dotted lines represent the area the circle sweeps in this move. The sweep area is capsule shaped. It would be difficult to calculate the collision of these two object, so we need to do this differently. If you look at the capsule on the previous image, you will see that it is simply the movement line extended in every direction by the radius of the circle. We can move that "extension" from the movement line to the wall rectangle. This way we get a rounded rectangle like on the image below. The movement line will collide with this extended (rounded) rectangle if and only if the capsule collides with the wall rectangle, so they are somehow equivalent and interchangeable. Since this collision calculation is still non-trivial and relatively expensive, you can first do a fast collision check between the extended wall rectangle (non-rounded this time) and the bounding rectangle of the movement line. You can see these rectangles on the image below - they are both dotted. This is a fast and easy calculation, and while you play the game there will probably NOT be an overlap with a specific wall rectangle >99% of the time and collision calculation will stop here. If however there is an overlap, there is probably a collision of the character circle with wall rectangle, but it is not certain as will be demonstrated later. Now you need to calc…
has comment: http://stackoverflow.com/comment/32104494
answers question: http://stackoverflow.com/q/21190553
has comment: http://stackoverflow.com/comment/31917920

http://stackoverflow.com/comment/32031016
type: Comment
comment on: http://stackoverflow.com/a/21260388
score: 1
has text: @NickHolt maybe "attack" is a bit strong but essentially if you allow user-provided input to be part of your expression then you have no guarantee it will even _compile_ - the classic example for XPath is that there's no way to include both single and double quotes within one string literal (double quoted strings can contain single quotes and vice versa, but there's no escaping mechanism to allow one string to contain both types). With a variable resolver the actual XPath expression is a compile time constant - while it may match nothing at least you know it won't throw an exception.
type: AnswerComment

http://stackoverflow.com/a/21230586
score: 0
has comment: http://stackoverflow.com/comment/31978720
has comment: http://stackoverflow.com/comment/31980129
type: Answer
has body: Eclipse is written mostly in JAVA. So when the debug point is hit there is a lot of stuff which eclipse does so that we can get the information we need to debug. This necessarily takes time. Also eclipse is smart enough to have a check if there are bereakpoints are not. SO when there are no breakpoints the application runs as if its in normal run mode. But when there are breakpoints, eclipse retrieves the values of various properties at that break point and displays it to us. Hence the extra time is justified.
answers question: http://stackoverflow.com/q/21229966

http://stackoverflow.com/q/21295920
has answer: http://stackoverflow.com/a/21296066
tagged with: java
has comment: http://stackoverflow.com/comment/32093519
downvote count: 3
has comment: http://stackoverflow.com/comment/32094001
type: Question
accepted answer: http://stackoverflow.com/a/21296006
has comment: http://stackoverflow.com/comment/32093976
tagged with: long-integer
score: -1
tagged with: int
answer count: 2
possible better answer: http://stackoverflow.com/a/21296066
has answer: http://stackoverflow.com/a/21296006
tagged with: variables
favorite count: 0
has comment: http://stackoverflow.com/comment/32093516
has comment: http://stackoverflow.com/comment/32093664
upvote count: 2
type: AnsweredQuestion
has body: I am making a program and i need a way to make variables go over 10 billion and int only stores up to 999 million for me so i decided to use a long instead of a int and it turn out it only stores up to 999 million as well. int TotalWorldPop = 7200000000; gives me the "literal is out of range" error long TotalWorldPop = 7200000000; gives me the "literal is out of range" error as well but int TotalWorldPop = 999999999 is ok for me
has title: How do i store numbers bigger than 10 billion

http://stackoverflow.com/q/21284751
downvote count: 4
upvote count: 0
score: -4
has comment: http://stackoverflow.com/comment/32073400
has title: onScroll method not working
has body: public class showManga extends Activity implements GestureDetector.OnGestureListener{ GestureDetectorCompat detector; TextView text; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); text=(TextView)findViewById(R.id.text); setContentView(R.layout.image); this.detector=new GestureDetectorCompat(this,this); } @Override public boolean onTouchEvent(MotionEvent event) { this.detector.onTouchEvent(event); return super.onTouchEvent(event); } @Override public boolean onDown(MotionEvent arg0) { // TODO Auto-generated method stub return false; } @Override public boolean onFling(MotionEvent start, MotionEvent finish, float velocityX, float velocityY) { // TODO Auto-generated method stub return false; } @Override public void onLongPress(MotionEvent arg0) { // TODO Auto-generated method stub } @Override public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2, float arg3) { // TODO Auto-generated method stub text.setText("scroll"); return true; } @Override public void onShowPress(MotionEvent arg0) { // TODO Auto-generated method stub } @Override public boolean onSingleTapUp(MotionEvent arg0) { // TODO Auto-generated method stub return false; } } I don't understand why this code not working. I checked everything. It seems right to me. Please help me. The onScroll method not working.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21284780
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/32073221
tagged with: android
answer count: 1
accepted answer: http://stackoverflow.com/a/21284780
tagged with: java

http://stackoverflow.com/q/21212921
has comment: http://stackoverflow.com/comment/31947179
has title: Firebase reference object cannot be resolved to a type
tagged with: firebase
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21213359
upvote count: 1
type: Question
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/21213359
favorite count: 0
has body: I just start building my Android app by following this docs: https://www.firebase.com/docs/reading-data.html After setting up libraries and permission, I start typing the very few lines of code. And immediately I got a list of compile errors as shown below: I then tried typing "dataRef." and Ctr+Space, there was no Default Proposals but a a red message saying "dataRef can not be resolved to a type". dataRef is the reference to firebase database (just like the one in the docs's snippet) So what was wrong? Ps: I also tried cleaning the project. I believe that my Firebase library is the latest, as its name is "firebase-client-jvm-LATEST" and I just downloaded it today. I din't add any xml or build anything yet. Below is my MainActivity.java: package com.biz.nah; import com.firebase.client.DataSnapshot; import com.firebase.client.Firebase; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Create a reference to database String url = "https://nah.firebaseio.com"; Firebase dataRef = new Firebase(url); dataRef.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot snapshot) { // Do some stuff once } @Override public void onCancelled() { System.err.println("Listener was cancelled"); } }); } @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; } }
tagged with: android

http://stackoverflow.com/a/21246825
has body: This method generates the String you want to print. As you did not mention the way you want to listen to, it is omitted. public String truck(int n) { String truck = "&lt;o&gt;&lt;o&gt;-&lt;o&gt;~|#|¬"; StringBuilder sb = new StringBuilder(); for (int i = n; i--&gt;0;) sb.append(' '); sb.append(truck); return sb.toString(); } The loop in more ordinary form is: for (int i = 0; i &lt; n; i++) sb.append(' '); (I prefer the former when applicable, because the computation for n is done only once, and I have to specify the loop variable only once in the loop declaration.)
has comment: http://stackoverflow.com/comment/32007655
has comment: http://stackoverflow.com/comment/32007664
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21246767
has comment: http://stackoverflow.com/comment/32008006

http://stackoverflow.com/q/21325777
downvote count: 1
has comment: http://stackoverflow.com/comment/32146662
has comment: http://stackoverflow.com/comment/107375464
linked to: http://stackoverflow.com/q/1262447
has comment: http://stackoverflow.com/comment/107375508
has answer: http://stackoverflow.com/a/21327715
has body: Recently I was trying to solve a design problem in Java for a scenario, wherein A Child inherits some properties from Father and some Mother. For example: "Child" class has to inherit few properties/behaviors such as faceCut, snoringWhileAsleep and height from "Father" class and few other properties hairColor from "Mother" class. Not all properties of Father and Mother are inherited by Child. How Java design patter could resolve this problem?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32146647
duplicate of: http://stackoverflow.com/q/1262447
has answer: http://stackoverflow.com/a/21325933
has title: How to Java design: Child inherits some properties from Father and some Mother
favorite count: 0
type: Question
answer count: 2
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32146810
upvote count: 1
tagged with: design-patterns

http://stackoverflow.com/a/21241745
has body: Shouldn't it be setContentView(R.layout.saved_activity);
score: 0
answers question: http://stackoverflow.com/q/21241661
type: Answer

http://stackoverflow.com/q/21349030
has comment: http://stackoverflow.com/comment/32195174
has comment: http://stackoverflow.com/comment/32195576
has comment: http://stackoverflow.com/comment/51559501
tagged with: spring
has title: Custom HTTP Message Converter Not Being Used, 415 Unsupproted Media Type
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/25881212
type: Question
score: 12
has answer: http://stackoverflow.com/a/21349499
upvote count: 12
has comment: http://stackoverflow.com/comment/32188338
has body: I am creating a test application to achieve conversion from XML String to Employee object before being passed to the controller. I don't want to use JAXB converter because the purpose is to test Custom HTTP Message Converter which I am going to use in my actual use case that involves XML parsing using SAX parser and some complex rules. Here are the key steps performed: Creation of Employee.java Class : Domain Object Creation of EmployeeManagementController.java class : Spring MVC Controller for Managing Employee Creation of EmployeeConverter.java : Custom Converter for Converting XML String to Employee Object. Creation of employee-servlet.xml : Spring Configuration file Creation of web.xml : The Deployment Descriptor Employee.java @Component @XmlRootElement(name="employee") @XmlAccessorType(XmlAccessType.FIELD) public class Employee{ @XmlElement(name="name") String name; @XmlElement(name="designation") String designation; @XmlElement(name="skill") String skill; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDesignation() { return designation; } public void setDesignation(String designation) { this.designation = designation; } public String getSkill() { return skill; } public void setSkill(String skill) { this.skill = skill; } } EmployeeManagementController.java @Controller @RequestMapping(value="/emp") public class EmployeeManagementController { @RequestMapping(value="/add/employee", method=RequestMethod.POST, consumes="text/html") public void addEmployee(@RequestBody Employee employee){ System.out.println("Employee Name : "+employee.getName()); System.out.println("Employee Designation : "+employee.getDesignation()); System.out.println("Employee Skill : "+employee.getSkill()); } } EmployeeConverter.java @Component public class EmployeeConverter extends AbstractHttpMessageConverter { @Override protected Employee readInternal(Class<? extends Employee> arg, HttpInputMessage inputMsg) throws IOException, …
downvote count: 0
tagged with: rest
answer count: 1
has comment: http://stackoverflow.com/comment/32195686
accepted answer: http://stackoverflow.com/a/21349499
favorite count: 0

http://stackoverflow.com/comment/32189040
has text: One possibility is to use dedicated search engine / index like Elasticsearch. http://www.elasticsearch.org/
comment on: http://stackoverflow.com/q/21347995
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21291422
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21290834
has comment: http://stackoverflow.com/comment/32099276
downvote count: 0
has body: If you are trying to share libs within multiple web apps you need to let these libs inside JBOSS's shared library folder. JBOSS will load then at startup. See this: Where to put a shared library in JBoss AS 5? It's not possible for a webapp access another webapp classloader. The app classloader, has access to 3 classloaders: Its own classloader Container classloader Bootstrap classloader(which loads the Java SDK classes).

http://stackoverflow.com/q/21284175
linked to: http://stackoverflow.com/q/14729206
has answer: http://stackoverflow.com/a/51516115
has body: This is my annotation class and i want userId and groupId column both as primary key. I have found more questions (Question) about this, but didn't found relevant answer. I have less reputation, so I am not able to comment on posts, So I am putting my question here. This is my code.. import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import org.hibernate.annotations.NaturalId; @Entity @Table(name="user_group") public class user_group { @Column(name="serviceProvider") private String serviceProvider; @Column(name="enterpriseId") private String enterpriseId; @Column(name="department") private String department; @Column(name="trunkGroupName") private String trunkGroupName; @Id @Column(name="userId") private String userId; @Column(name="groupId") private String group; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getGroup() { return group; } public void setGroup(String group) { this.group = group; } public String getServiceProvider() { return serviceProvider; } public void setServiceProvider(String serviceProvider) { this.serviceProvider = serviceProvider; } public String getEnterpriseId() { return enterpriseId; } public void setEnterpriseId(String enterpriseId) { this.enterpriseId = enterpriseId; } public String getDepartment() { return department; } public void setDepartment(String department) { this.department = department; } public String getTrunkGroupName() { return trunkGroupName; } public void setTrunkGroupName(String trunkGroupName) { this.trunkGroupName = trunkGroupName; } }
answer count: 2
accepted answer: http://stackoverflow.com/a/21288349
tagged with: composite-primary-key
has comment: http://stackoverflow.com/comment/74280994
linked to: http://stackoverflow.com/q/10422680
possible better answer: http://stackoverflow.com/a/51516115
favorite count: 0
tagged with: hibernate-annotations
has title: how to make two column as a primary key in hibernate annotation class
has comment: http://stackoverflow.com/comment/32100474
downvote count: 2
score: 11
upvote count: 13
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/21288349
linked to: http://stackoverflow.com/q/3585034
type: Question
linked to: http://stackoverflow.com/q/11836440
has comment: http://stackoverflow.com/comment/32072228

http://stackoverflow.com/comment/32135842
comment on: http://stackoverflow.com/a/21272021
score: 0
has text: Thank you for your help Mr.Tony ....just one thing i would like to know .....i am not able to do m.put(temp,value) as there is an error that int cannot be converted to Integer(incompatible types) ....how to resolve this???
type: Comment
type: AnswerComment

http://stackoverflow.com/a/21255805
has body: Static methods or variables does not need a reference to the object. You can call it even reference to the object is null.
upvote count: 1
answers question: http://stackoverflow.com/q/21255684
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/32142127
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21323226
has text: This is clever, but the other answer is a bit simpler. Thank you!
type: AnswerComment

http://stackoverflow.com/comment/32004930
type: Comment
comment on: http://stackoverflow.com/q/21245140
has text: Sorry all, thank you very much alike, had a route with an accent that was the problem.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32081843
has text: Where would I put String name = customer.name; ?
type: Comment
comment on: http://stackoverflow.com/a/21289439
score: 0
type: AnswerComment

http://stackoverflow.com/q/21270434
has comment: http://stackoverflow.com/comment/32049410
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32048874
downvote count: 1
accepted answer: http://stackoverflow.com/a/21270852
type: Question
possible better answer: http://stackoverflow.com/a/21270707
score: -1
has answer: http://stackoverflow.com/a/21270707
answer count: 2
upvote count: 0
has body: assume I have " activity_main.xml " it has a button called " @+id/clickAndAdd ". and I have another XML file called " second.xml " it has a EditText called " @+id/myEditText " How can I add " @+id/myEditText " in my " activity_main.xml " every time I click on " @+id/clickAndAdd " thank you.
favorite count: 0
has answer: http://stackoverflow.com/a/21270852
tagged with: android
has title: How can I Add EditText every time I click on the Button?
has comment: http://stackoverflow.com/comment/32048784

http://stackoverflow.com/comment/31988944
type: QuestionComment
has text: It seems it looks after version 0.0.0? Maybe there is no version entered?
comment on: http://stackoverflow.com/q/21236493
type: Comment
score: 1

http://stackoverflow.com/q/21211090
has comment: http://stackoverflow.com/comment/31943625
tagged with: javasound
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31943706
has comment: http://stackoverflow.com/comment/31943674
tagged with: audio
has answer: http://stackoverflow.com/a/21225015
linked to: http://stackoverflow.com/q/9656462
score: 1
upvote count: 3
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/31943655
type: Question
has title: Java play multiple Clips simultaneously
tagged with: clip
has answer: http://stackoverflow.com/a/23487878
has comment: http://stackoverflow.com/comment/31943664
has comment: http://stackoverflow.com/comment/31978284
answer count: 2
has body: So my application should play the WAV file every time I click on the panel. But the problem right now is, it waits for the first one to finish before it plays the second one. I want to be able to have them play simultaneously. The reason I put Thread.sleep(500) is because if I don't, then it won't play the sound at all :( import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.FloatControl; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; import javax.swing.JFrame; @SuppressWarnings("serial") public class SoundEffectPlayer extends JFrame { /* * Jframe stuff */ public SoundEffectPlayer() { this.setSize(400, 400); this.setTitle("Mouse Clicker"); this.addMouseListener(new Clicker()); this.setVisible(true); } private class Clicker extends MouseAdapter { public void mouseClicked(MouseEvent e) { try { playSound(1); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } } /* * Directory of your sound files * format is WAV */ private static final String DIRECTORY = "file:///C:/Users/Jessica/Desktop/audio/effects/sound 1.wav"; /* * The volume for sound effects */ public static float soundEffectsVolume = 0.00f; /* * Loads the sound effect files from cache * into the soundEffects array. */ public void playSound(int ID) throws InterruptedException { try { System.out.println("playing"); Clip clip; URL url = new URL(DIRECTORY); AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(url); clip = AudioSystem.getClip(); clip.open(audioInputStream); clip.setFramePosition(0); FloatControl gainControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN); gainControl.setValue(soundEffectsVolume); clip.start(); System.o…
favorite count: 0

http://stackoverflow.com/q/21298574
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21298709
has body: For example , I develop a connection pool as a server , and on the other application I want to use the connection existing in the pool , How can I get it ? they are in two processes ? and have different life circle ?
has comment: http://stackoverflow.com/comment/32098717
has title: How to transfer object through two processes?
favorite count: 0
type: Question
score: -2
tagged with: java
downvote count: 3
tagged with: process
upvote count: 1

jvm
tags question: http://stackoverflow.com/q/21310011
tags question: http://stackoverflow.com/q/21195340
tags question: http://stackoverflow.com/q/21222300
tags question: http://stackoverflow.com/q/21329430
type: Tag
tags question: http://stackoverflow.com/q/21227665
tags question: http://stackoverflow.com/q/21283116
tags question: http://stackoverflow.com/q/21254384
tags question: http://stackoverflow.com/q/21272877
tags question: http://stackoverflow.com/q/21333032
tags question: http://stackoverflow.com/q/21262911
tags question: http://stackoverflow.com/q/21218430
tags question: http://stackoverflow.com/q/21212766
tags question: http://stackoverflow.com/q/21186726
tag name: jvm
tags question: http://stackoverflow.com/q/21230165
tags question: http://stackoverflow.com/q/21248645
tags question: http://stackoverflow.com/q/21312828
tags question: http://stackoverflow.com/q/21258067
tags question: http://stackoverflow.com/q/21334778
tags question: http://stackoverflow.com/q/21263666
tags question: http://stackoverflow.com/q/21336303
tags question: http://stackoverflow.com/q/21186232
tags question: http://stackoverflow.com/q/21289922
tags question: http://stackoverflow.com/q/21290559
tags question: http://stackoverflow.com/q/21330076
tags question: http://stackoverflow.com/q/21218533
tags question: http://stackoverflow.com/q/21199058
tags question: http://stackoverflow.com/q/21299405
tags question: http://stackoverflow.com/q/21235109
tags question: http://stackoverflow.com/q/21234053
tags question: http://stackoverflow.com/q/21286440

http://stackoverflow.com/comment/31992357
comment on: http://stackoverflow.com/q/21189981
score: 0
has text: This is a question for @rhens http://stackoverflow.com/questions/20656540/copy-pdf-form-with-pdfcopy-not-working-in-itextsharp-5-4-5-0/20659958#20659958
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/97562791
type: QuestionComment
comment on: http://stackoverflow.com/q/21318300
has text: are you find a solution?
score: 0
type: Comment

http://stackoverflow.com/a/21336649
downvote count: 0
has comment: http://stackoverflow.com/comment/32167910
answers question: http://stackoverflow.com/q/21336141
has comment: http://stackoverflow.com/comment/32166167
type: Answer
upvote count: 1
score: 1
has body: I think you have two problems here: You don't override paintComponent() properly. This is a protected method, not public. If you add @Override annotation on this method then the compiler will complain. This is a really good reason for adding this annotation every time you need to override some method. Ball class extends from gamePanel so when you call super.paintComponent(g) in the first class it will call paintComponent(g) on its ancestor. If you add balls inside gamePanel then you'll get an endless loop that will probably cause a stack overflow. Off-topic Always follow Java Code Conventions.

httpurlconnection
tags question: http://stackoverflow.com/q/21232288
tags question: http://stackoverflow.com/q/21286836
tags question: http://stackoverflow.com/q/21228773
tags question: http://stackoverflow.com/q/21217994
tags question: http://stackoverflow.com/q/21304416
tags question: http://stackoverflow.com/q/21232549
tags question: http://stackoverflow.com/q/21311671
tags question: http://stackoverflow.com/q/21299769
tags question: http://stackoverflow.com/q/21190174
tags question: http://stackoverflow.com/q/21339569
tag name: httpurlconnection
tags question: http://stackoverflow.com/q/21234493
tags question: http://stackoverflow.com/q/21213864
type: Tag

http://stackoverflow.com/comment/32033288
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21261993
has text: Have you tried what happens on "Ctrl-Enter"? I can remember darkly something with this and linebreaks in JTextPane ...

ondraw
type: Tag
tags question: http://stackoverflow.com/q/21274367
tag name: ondraw

http://stackoverflow.com/q/21322922
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32206174
has answer: http://stackoverflow.com/a/21322966
type: Question
linked to: http://stackoverflow.com/q/18544133
has answer: http://stackoverflow.com/a/21323061
has body: I have the json: {"test": [{"param1": "param"}], "test2": "test", "test3": "test2"} how can I get fromGson to parse the arrays in a json correctly so that it populates the arrays into an array of a particular object type. So test should map to TestObject[] test; test2 -&gt; String test2; test3 -&gt; String test3; I tried gson.fromJson(response, TestData.class); that gave me an error: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 664 ( that the fromJson is not parsing the array in the json correctly). I also tried going through this post: Parsing JSON array into java.util.List with Gson But got confused. but that did not work
has answer: http://stackoverflow.com/a/21323003
has title: How to use fromGson with arrays
score: 0
answer count: 3
tagged with: java
tagged with: gson

http://stackoverflow.com/comment/32105447
type: Comment
type: QuestionComment
score: 0
has text: Do the repeated characters have to be adjacent?
comment on: http://stackoverflow.com/q/21302784

relative-path
type: Tag
tags question: http://stackoverflow.com/q/21326214
tag name: relative-path

http://stackoverflow.com/a/21217158
answers question: http://stackoverflow.com/q/21216892
has body: shutDown() will only tell the executor to not accept any new tasks &amp; cancels all tasks that are not runnuing yet. Tasks that are running are allowed to finish. You are looping indefinitely in while (!Thread.currentThread().isInterrupted()) { key = waitForEvents(watcher, key); } because an InterruptedException is not setting the interrupted flag. If you change try { key = watcher.take(); } catch (InterruptedException e) { executorService.shutdown(); } catch (ClosedWatchServiceException e) { executorService.shutdown(); } To try { key = watcher.take(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (ClosedWatchServiceException e) { Thread.currentThread().interrupt(); } and add executorService.shutdown(); after the while loop (or keep it where it is) you should have no problem.
has comment: http://stackoverflow.com/comment/31954154
accepted answer of: http://stackoverflow.com/q/21216892
has comment: http://stackoverflow.com/comment/31954665
has comment: http://stackoverflow.com/comment/31954415
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/31984173
score: 0
has text: Finally, there are such inner classes which do not require enclosing instances.
type: AnswerComment
comment on: http://stackoverflow.com/a/21233897
type: Comment

http://stackoverflow.com/comment/31949790
comment on: http://stackoverflow.com/q/21214511
score: 0
type: Comment
type: QuestionComment
has text: still i'm looking for sample to get the list of available wifi connections

http://stackoverflow.com/comment/32122059
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21311450
has text: I don't have an exception. The list just comes out empty like if no results were found in the database. I have other queries to other tables that work flawlessly

http://stackoverflow.com/comment/32175486
comment on: http://stackoverflow.com/a/21327738
type: Comment
has text: Ok im not getting an NPE if i use /FOLDER_NAME in stead of / for the directory. But now it does nothing, it doesnt even run the for loop, as i have used println to check
score: 0
type: AnswerComment

http://stackoverflow.com/q/21247776
tagged with: animation
tagged with: swing
has title: Java Swing: how to smoothly animate/move component
has comment: http://stackoverflow.com/comment/32009380
has answer: http://stackoverflow.com/a/21318572
tagged with: components
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32021297
downvote count: 0
score: 6
has answer: http://stackoverflow.com/a/58090689
type: Question
upvote count: 6
favorite count: 0
has body: I am trying to figure out how to animate a swing component to go from point a to point b. Here is a baby example of code which makes a red JPanel move from left to right : import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; public class MovingSquareExample { private static final JPanel square = new JPanel(); private static int x = 20; public static void createAndShowGUI(){ JFrame frame = new JFrame(); frame.getContentPane().setLayout(null); frame.setSize(500,500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(square); square.setBounds(20,200,100,100); square.setBackground(Color.RED); Timer timer = new Timer(1000/60,new MyActionListener()); timer.start(); frame.setVisible(true); } public static class MyActionListener implements ActionListener{ @Override public void actionPerformed(ActionEvent arg0) { square.setLocation(x++, 200); } } public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable(){ @Override public void run(){ createAndShowGUI(); } }); } } It works fine, it's just that I looks a little choppy. The motion for the analogous example with a draggable square (see Draggable Components in Java Swing) appears much smoother so I believe there should be a way to make this look better. Any suggestions would be much appreciated.
linked to: http://stackoverflow.com/q/9849950
answer count: 2

http://stackoverflow.com/q/21301543
has title: hibernate3.LocalDataSourceConnectionProvider cannot be cast to ConnectionProvider
has answer: http://stackoverflow.com/a/21302367
tagged with: spring
possible better answer: http://stackoverflow.com/a/21302367
tagged with: spring-mvc
type: AnsweredQuestion
has body: 2.4release , hibernate 3.3.2ga . while creating sessionfactory. I'm getting following error. Please provide me a solution com.bean.OrderDetailsVO com.bean.OrderVO org.hibernate.dialect.SQLServer2008Dialect true Caused by: org.hibernate.HibernateException: Could not instantiate connection provider [org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider] at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiator.java:192) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1] at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:114) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1] at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:54) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1] at org.hibernate.service.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:69) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1] at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:176) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1] ... 90 more Caused by: java.lang.ClassCastException: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider cannot be cast to org.hibernate.service.jdbc.connections.spi.ConnectionProvider at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiator.java:189) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1] ... 94 more
score: 0
has comment: http://stackoverflow.com/comment/32104317
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/21365849
tagged with: spring-orm
type: Question
has comment: http://stackoverflow.com/comment/32104170
answer count: 2
has answer: http://stackoverflow.com/a/21365849

http://stackoverflow.com/comment/32093259
has text: JSP (Java Server Pages) is a server side technology used for presentation layer for the web applications. It cannot run client-sided.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21295765
type: Comment

http://stackoverflow.com/q/21199969
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21199982
has answer: http://stackoverflow.com/a/21200103
has comment: http://stackoverflow.com/comment/31924155
downvote count: 0
has comment: http://stackoverflow.com/comment/31924012
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31924960
tagged with: android
has title: Randomly place objects in an activity
linked to: http://stackoverflow.com/q/2481455
has comment: http://stackoverflow.com/comment/31923948
has body: So I'm new to java, and I have the basics of object placement down. I'm trying to design an app in which 5 objects are randomly placed in a certain activity. How would I go about randomly placing these objects? Thanks!
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/31978012
score: 0
type: Comment
has text: i have tried declaring the script type but no no results. did i have to use out,write("some code\r\n") instead of out.write("some code\n");
type: AnswerComment
comment on: http://stackoverflow.com/a/21230425

http://stackoverflow.com/comment/31945408
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21210372
has text: The work the code is doing is persisting the object. This is REST as in representational state transfer. The entire job of this application is to validate the data sent and get it into the database. "operating on invalid data" doesn't matter. If somethings invalid the whole thing is going to fail. It is not spring mvc. There is no UI (in this war at least). Spring is only doing the dependency injection and transaction boundaries here.
score: 0

http://stackoverflow.com/a/21290519
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: Use the method 'equals' for string comparison. E.g. answer.equals("deposit").
answers question: http://stackoverflow.com/q/21290441

http://stackoverflow.com/comment/52519899
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21200198
has text: This is exactly what I want to implement but the settings.xml aint showing up. The app isnt crashing though. any help?
type: AnswerComment

http://stackoverflow.com/comment/32007083
type: AnswerComment
score: 0
type: Comment
has text: This will work provided that you will always keep one or more whitespace characters between each css property-value pair.
comment on: http://stackoverflow.com/a/21246183

testing
tags question: http://stackoverflow.com/q/21288667
tags question: http://stackoverflow.com/q/21195450
tags question: http://stackoverflow.com/q/21219955
tags question: http://stackoverflow.com/q/21228772
tags question: http://stackoverflow.com/q/21335205
tag name: testing
tags question: http://stackoverflow.com/q/21186621
type: Tag
tags question: http://stackoverflow.com/q/21194644
tags question: http://stackoverflow.com/q/21198551
tags question: http://stackoverflow.com/q/21185532
tags question: http://stackoverflow.com/q/21313084

http://stackoverflow.com/a/21200577
has comment: http://stackoverflow.com/comment/31925130
answers question: http://stackoverflow.com/q/21200421
has comment: http://stackoverflow.com/comment/31939926
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31964566
has comment: http://stackoverflow.com/comment/31925023
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33656613
has comment: http://stackoverflow.com/comment/31968419
has comment: http://stackoverflow.com/comment/31925097
accepted answer of: http://stackoverflow.com/q/21200421
has body: Typically in a Writer, the flush() and close() are there to cleanup any additional writes that may not have been committed or sent to the stream. By simply redirecting all of the write methods directly to the append methods in the Appendable you won't have to worry about flush() and close() unless your Appendable implements Closeable and/or Flushable. A good example is something like BufferedWriter. When you are calling write() on that, it may not be sending all of the bytes to the final output/stream immediately. Some bytes may not be sent until you flush() or close() it. To be absolutely safe, I would test the wrapped Appendable if it is Closeable or Flushable in the corresponding method and cast it and perform the action as well. This is a pretty standard design pattern called the Adapter pattern. Here is what is likely a good implementation for this adapter: http://pastebin.com/GcsxqQxj
has comment: http://stackoverflow.com/comment/31924980

http://stackoverflow.com/q/21248984
has body: i am trying to do this tutorial it's for JNI https://netbeans.org/kb/docs/cnd/beginning-jni-linux.html i already did everything in there, but i am having this trouble Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /home/usr/NetBeansProjects/JNIDemoCdl/dist/libJNIDemoCdl.so at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1846) at java.lang.Runtime.load0(Runtime.java:795) at java.lang.System.load(System.java:1061) at jnidemojava.Main.&lt;clinit&gt;(Main.java:13) Java Result: 1 i am kind of stuck with JNI for a time now, and i could use some help, thanks
has title: JNI Tutorial, cant'load library
type: Question
has comment: http://stackoverflow.com/comment/32039485
tagged with: java-native-interface
has comment: http://stackoverflow.com/comment/32011637
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32040692
favorite count: 0
has answer: http://stackoverflow.com/a/30784607
linked to: http://stackoverflow.com/q/12695668
has answer: http://stackoverflow.com/a/21289177
tagged with: c++
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/21216413
type: Question
score: 1
tagged with: java
has title: Can't find bundle for base name org.fife.ui.rsyntaxtextarea.RSyntaxTextArea, locale sv_SE
tagged with: rsyntaxtextarea
tagged with: locale
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21216502
has body: I am trying out an example for RSyntaxTextArea found here http://fifesoft.com/rsyntaxtextarea/examples/example1.php import java.awt.*; import javax.swing.*; import org.fife.ui.rtextarea.*; import org.fife.ui.rsyntaxtextarea.*; /** * A simple example showing how to use RSyntaxTextArea to add Java syntax * highlighting to a Swing application.&lt;p&gt; * * This example uses RSyntaxTextArea 2.0.1.&lt;p&gt; * * Project Home: http://fifesoft.com/rsyntaxtextarea&lt;br&gt; * Downloads: https://sourceforge.net/projects/rsyntaxtextarea */ public class TextEditorDemo extends JFrame { private static final long serialVersionUID = 1L; public TextEditorDemo() { JPanel cp = new JPanel(new BorderLayout()); RSyntaxTextArea textArea = new RSyntaxTextArea(20, 60); textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); textArea.setCodeFoldingEnabled(true); textArea.setAntiAliasingEnabled(true); RTextScrollPane sp = new RTextScrollPane(textArea); sp.setFoldIndicatorEnabled(true); cp.add(sp); setContentPane(cp); setTitle("Text Editor Demo"); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); setLocationRelativeTo(null); } public static void main(String[] args) { // Start all Swing applications on the EDT. SwingUtilities.invokeLater(new Runnable() { public void run() { new TextEditorDemo().setVisible(true); } }); } } this exception is thrown Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError at org.fife.ui.rsyntaxtextarea.RSyntaxTextAreaUI.&lt;clinit&gt;(RSyntaxTextAreaUI.java:37) at org.fife.ui.rsyntaxtextarea.RSyntaxTextArea.createRTextAreaUI(RSyntaxTextArea.java:723) at org.fife.ui.rtextarea.RTextAreaBase.init(RTextAreaBase.java:630) at org.fife.ui.rtextarea.RTextArea.init(RTextArea.java:854) at org.fife.ui.rsyntaxtextarea.RSyntaxTextArea.init(RSyntaxTextArea.java:1784) at org.fife.ui.rtextarea.RTextAreaBase.&lt;init&gt;(RTextAreaBase.java:117) at org.fife.ui.rtextarea.RTextArea.&lt;init&gt;(RTextArea.java:215) at org.fife.ui.rsyntaxtextarea.RSyntaxTe…
upvote count: 1
tagged with: swing

gson
tags question: http://stackoverflow.com/q/21330069
tags question: http://stackoverflow.com/q/21288900
tags question: http://stackoverflow.com/q/21212577
tags question: http://stackoverflow.com/q/21255184
tags question: http://stackoverflow.com/q/21206864
tags question: http://stackoverflow.com/q/21322922
tags question: http://stackoverflow.com/q/21239100
tags question: http://stackoverflow.com/q/21247998
tags question: http://stackoverflow.com/q/21324764
tags question: http://stackoverflow.com/q/21274183
tags question: http://stackoverflow.com/q/21346739
tags question: http://stackoverflow.com/q/21345116
tag name: gson
tags question: http://stackoverflow.com/q/21328122
tags question: http://stackoverflow.com/q/21347670
tags question: http://stackoverflow.com/q/21238569
tags question: http://stackoverflow.com/q/21209240
tags question: http://stackoverflow.com/q/21227077
tags question: http://stackoverflow.com/q/21263558
tags question: http://stackoverflow.com/q/21324205
tags question: http://stackoverflow.com/q/21345965
type: Tag
tags question: http://stackoverflow.com/q/21341578
tags question: http://stackoverflow.com/q/21285230

http://stackoverflow.com/comment/32174320
score: 0
type: AnswerComment
has text: @Alexey thanks but I have no idea how to do it - fairly new to the whole JSP thing, under pressure for a project deadline. As I said, I have a working java class with microsoft access, All i want to do is acheive the same functionality within JSP , as the project I am doing is a web application, but just struggling
type: Comment
comment on: http://stackoverflow.com/a/21340747

http://stackoverflow.com/q/21228818
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/31975136
answer count: 2
linked to: http://stackoverflow.com/q/5066088
has answer: http://stackoverflow.com/a/21228965
has title: Eclipse Kepler Server not Creating
has answer: http://stackoverflow.com/a/21229024
score: 0
has comment: http://stackoverflow.com/comment/31975223
has body: I was earlier using eclipse juno on linux enviroment. Now I have shifted to windows and installed eclipse kepler. I have already installed apache tomcat6 and its running successfully in browser.I am trying to run jsp files in eclipse by making server but tomcat is not showing. I followed this way window preferences server runtime enviroment add but apache is not showing at all.Please see the screenshot EDIT I have even tried to download additional adapters but in the list tomcat is not there.Please see the below screenshot
has comment: http://stackoverflow.com/comment/31975153
has comment: http://stackoverflow.com/comment/31975139
has comment: http://stackoverflow.com/comment/31975371
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31975092

http://stackoverflow.com/a/21248035
has body: This has to do with the internal implementation of JSONObject. The class itself has an instance field of type java.util.Map with the name map. When you parse the String {"sender":{"id":"test test"},"recipients":{"id":"test1 test1"} } with JSONObject, you actually have 1 root JSONObject, two nested JSONObjects, one with name sender and one with name recipients. The hierarchy is basically like so JSONObject.map -&gt; "sender" -&gt; JSONObject.map -&gt; "id" -&gt; "test test", "recipients" -&gt; JSONObject.map -&gt; "id" -&gt; "test test1" Gson serializes your objects by mapping each field value to the field name. Listen to this man. And this one.
answers question: http://stackoverflow.com/q/21247998
upvote count: 3
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/32009852
score: 3

http://stackoverflow.com/comment/32162937
comment on: http://stackoverflow.com/q/21335254
score: 0
type: Comment
type: QuestionComment
has text: What are you trying to accomplish? This code looks like you are trying to do something in the background every five seconds. Is that correct? If so, when is this work starting up, and when will this work ever stop?

http://stackoverflow.com/a/21262566
answers question: http://stackoverflow.com/q/21255000
type: Answer
has body: My first guess would be that new DocFlavor.INPUT_STREAM ("application/octet-stream") isn't what you want. You may want to try the code from this answer: https://stackoverflow.com/a/18962278/34088
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/q/21276965
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/21306444
has body: I am trying to get values from database using servlet in which i am using JSON object to send the data to my JSP in my JSP, jQuery handles the receiving data.i am able to get data but just the last value of the database not all the values here is all my code any help is Thankful. jQuery: Servlet : String sql1 = "SELECT * FROM state WHERE country_ref="+countryref+" PreparedStatement pst1 = db.getConnection().prepareStatement(sql1); ResultSet j = pst1.executeQuery(); JSONObject obj = new JSONObject(); pw.println("["); while (j.next()) { state_id = j.getString(1); state = j.getString(2); country_ref = j.getString(3); obj.put("stateId", state_id); obj.put("stateName", state); } pw.println(obj); pw.println("]"); JSP: -select- america UK Africa when i try to console.log(data); here is the result here i am getting only one value(last value of column) instead of getting all the values from database.
linked to: http://stackoverflow.com/q/11587001
has title: how to fetch all the values using JSON,JQuery,Servlet?
tagged with: servlets
type: Question
possible better answer: http://stackoverflow.com/a/21278310
answer count: 2
tagged with: jsp
has answer: http://stackoverflow.com/a/21306444
tagged with: jquery
score: 0
has comment: http://stackoverflow.com/comment/32060300
has answer: http://stackoverflow.com/a/21278310
has comment: http://stackoverflow.com/comment/32060799
has comment: http://stackoverflow.com/comment/32060920

http://stackoverflow.com/comment/32004353
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/21245037
has text: Could you please post the exact exception with its stacktrace?
type: Comment

http://stackoverflow.com/comment/31957332
type: Comment
type: QuestionComment
has text: Have you tried debugging and seeing if `about()` is actually being called?
score: 0
comment on: http://stackoverflow.com/q/21218862

http://stackoverflow.com/a/21263628
has body: I figured out how to do it. The following lines need to be added to the build.xml, under the tab Files of the corresponding project on NetBeans: <echo message="Signing ${dist.dir}/MyAppet.jar..."/> <arg value="-verbose" /> <arg value="-keystore" /> <arg value="C:/Program Files/Java/jdk1.7.0_25/bin/MyKeyStore.jks" /> <arg value="-storepass" /> <arg value="mystorepassword" /> <arg value="-keypass" /> <arg value="mykeypassword" /> <arg value="C:/Users/Charles/Documents/MyNetBeansProjects/MyProject/dist/MyApplet.jar" /> <arg value="MySelfSignatureAlias" /> I hope this is useful to other users!
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21238954
answers question: http://stackoverflow.com/q/21238954

http://stackoverflow.com/comment/32049232
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21268897
has text: You could move the code from ModuleBase/../typeA to a seperate project and reference it.
score: 0

http://stackoverflow.com/a/26442530
score: 2
has body: It can clearly be done. How about something like below for a simple SPMV (Sparse matrix vector multiplication), with the sparse matrix represented in the coordinate COO format (the simplest sparse format out there): class COO { int x, y, value; } public static ArrayList&lt;Integer&gt; spmv(List&lt;COO&gt; values, ArrayList&lt;Integer&gt; v) { final ArrayList&lt;Integer&gt; result = new ArrayList&lt;&gt;(Collections.nCopies(v.size(), 0)); values.stream().forEach( coo -&gt; result.set(coo.x, result.get(coo.x) + coo.value * v.get(coo.y)) ); return result; } But I sincerely suggest you use something pre-coded, if you don't want to spend the next 3 years of your life understanding the performance implications of sparse matrix operations. This is quite a large research/optimisation topic and there are many factors to consider like (just off the top of my head): scheduling / reordering of matrix values to improve cache performance using an optimal storage format for specific problems (e.g. see this survey on netlib) There are many implementations out there that can achieve orders of magnitude improvements in performance versus hand crafted implementation. To name a few, check out: Intel MKL Sparse BLAS Nvidia's cuBLAS I would just write bindings to those if they don't exist already, although something like la4j looks quite promising.
answers question: http://stackoverflow.com/q/21317219
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31937076
type: QuestionComment
has text: Think why it is printing every time for each argument, you will guess right
type: Comment
comment on: http://stackoverflow.com/q/21207574
score: 0

http://stackoverflow.com/comment/70184756
type: Comment
has text: There is no **protoc.exe**!
comment on: http://stackoverflow.com/a/21327450
score: 0
type: AnswerComment

http://stackoverflow.com/a/21219473
upvote count: 1
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/21219374
has body: you are not passing object of C2 class to constructor of C1 class. as you are not passing object of c2 class you should get a NullPointerException when you call sayHi(...) please look at rearranged code block public static void main(String[] args){ class2 c2 = new class2(); c2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); c2.setSize(200,100); c2.setLocationRelativeTo(null); c2.setVisible(true); class1 c1 = new class1(c2); c1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); c1.setSize(200,100); c1.setLocationRelativeTo(null); c1.setVisible(true); }

http://stackoverflow.com/q/21303784
tagged with: arrays
has comment: http://stackoverflow.com/comment/32107206
tagged with: android
has answer: http://stackoverflow.com/a/21303857
possible better answer: http://stackoverflow.com/a/21303858
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/32107197
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21303858
tagged with: datahandler
has title: Android XML dataHandler getResources() is undefined
type: Question
has body: I'm relatively new to Java and I'm trying to create a dataHandler for an xml. But I get an error: "The method getResources() is undefined for the type CasusHandler". What am I forgetting? import android.content.res.Resources; public class CasusHandler { public String[] casus; public void setCasusArray() { Resources res = getResources(); this.casus = res.getStringArray(R.array.casus); } public String[] getCasusArray() { return this.casus; } }
accepted answer: http://stackoverflow.com/a/21303857
tagged with: java
score: 0
answer count: 2

http://stackoverflow.com/a/21318124
downvote count: 0
has body: A simple solution. André Schild has already given a valuable input. VerticalLayout vlMain = new VerticalLayout(); vlMain.setSizeFull(); HorizontalLayout hlFooter = new HorizontalLayout(); hlFooter.setHeight("50px"); // if you want you can define a height. hlFooter.addComponent(new Label("Test1")); // adding a simple component. You might want to set alignment for that component vlMain.addComponent(mainComponent); vlMain.setExpandRatio(mainComponent, 1.0f); // "give" the main component the maximum available space vlMain.addComponent(hlFooter);
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21316247
accepted answer of: http://stackoverflow.com/q/21316247
type: AcceptedAnswer

http://stackoverflow.com/a/52926126
score: 1
has body: Suppose we create a static variable K and in the main function we create three objects: ob1 ob2 ob3; All these objects can have the same value for variable K. In contrast if the variable K was an instance variable then it could have different values as: ob1.k ob2.k ob3.k
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21204589

http://stackoverflow.com/comment/32143988
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21324109
type: AnswerComment
has text: In our project we put them into ...main/webapp/WEB-INF/jsp

http://stackoverflow.com/a/21230558
has comment: http://stackoverflow.com/comment/31981698
has body: I'll post the complete code I have come up with to validate your test-case (including a simple executable demo): Annotations: package annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target( {ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) public @interface NotNull { } import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target( {ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) public @interface Size { int min() default 0; int max(); } The Predefined class: public class Predefined { @NotNull @Size(min = 1, max = 25) public UUID phone; @NotNull @Size(min = 1, max = 40) public UUID company; public Predefined(UUID phone, UUID company) { this.phone = phone; this.company = company; } } The validator class which iterates through the declared fields and checks their annotation and field/value mappings: public class PredefinedValidator { public boolean validate(Predefined predefined, Map&lt;UUID, String&gt; mappings) { if (predefined == null) return false; for (Field field :predefined.getClass().getDeclaredFields()) { if (field.getType().equals(UUID.class)) { try { Annotation[] annotations = field.getDeclaredAnnotations(); UUID uuid = (UUID)field.get(predefined); if (!this.validateField(uuid, annotations, mappings)) return false; } catch (IllegalArgumentException | IllegalAccessException ex) { Logger.getLogger(PredefinedValidator.class.getName()).log(Level.SEVERE, null, ex); } } } return true; } private boolean validateField(UUID field, Annotation[] annotations, Map&lt;UUID, String&gt; mapping) { boolean containsSize = false; boolean containsNotNull = false; int minSize = -1; int maxSize = -1; // fetch which annotations are available for the provided field for (Annotation annotation : annotations) { if (annotation instanceof S…
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21229156
type: Answer
has comment: http://stackoverflow.com/comment/31979797
accepted answer of: http://stackoverflow.com/q/21229156
downvote count: 0
score: 1

android-scrollview
type: Tag
tags question: http://stackoverflow.com/q/21194745
tag name: android-scrollview

http://stackoverflow.com/q/21201831
accepted answer: http://stackoverflow.com/a/21201893
possible better answer: http://stackoverflow.com/a/21201933
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31928407
has title: What's the difference between these 2 ifs?
tagged with: java
has answer: http://stackoverflow.com/a/21201843
has body: if(loadFactor != null &amp;&amp; !(trialExists(loadFactor)) and if(!(loadFactor == null || trialExists(loadFactor)) I was asked in a review to make 1st if changed to 2nd. How does it make any difference.
type: Question
upvote count: 4
score: 4
has answer: http://stackoverflow.com/a/21201893
has answer: http://stackoverflow.com/a/21201929
has comment: http://stackoverflow.com/comment/31927057
downvote count: 0
has answer: http://stackoverflow.com/a/21201933
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/31927141

http://stackoverflow.com/q/21212761
type: UnansweredQuestion
tagged with: loops
has body: What I want: Once a value is reached on the sensor, the program should wait for some seconds, and then go into a while loop that is true until a certain sensor value is reached. Once out the while loop the rest of the code continues processing and storing values into some sql database. What I've tried: Threads, Handlers, and Runnables ... too many attempts to post the code. My Problem: the while loop iterations. It always runs just 1 time. Results: Nothing close to my desired resul
has answer: http://stackoverflow.com/a/21212786
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/31946653
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31946882
has title: How to implement a wait function inside my onSensorChanged method
favorite count: 0
tagged with: while-loop
has comment: http://stackoverflow.com/comment/31946969
tagged with: android
upvote count: 0

http://stackoverflow.com/a/21414338
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21326019
has body: This fixed my issue: setSelectedFile(f); final JList list = SwingUtils.getDescendantOfType(JList.class, this, "Enabled", true); list.requestFocus();
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/21326019

http://stackoverflow.com/q/21330267
type: Question
has title: Spring 3.2 servlet 3.0 Java Config (no web.xml) how to create custom 404 handler
tagged with: spring
answer count: 1
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/21334263
tagged with: java
tagged with: servlets
score: 8
downvote count: 0
type: UnansweredQuestion
has body: What options do I have to catch and handle 404 without using web.xml. This is how I define my Servlet: @Order(1) public class MyWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { // 10MB private static final int MAX_UPLOAD_SIZE_IN_MB = 10 * 1024 * 1024; @Override protected Class&lt;?&gt;[] getRootConfigClasses() { return new Class[] { RootConfiguration.class }; } @Override protected Class&lt;?&gt;[] getServletConfigClasses() { return new Class[] { WebConfiguration.class }; } @Override protected String[] getServletMappings() { return new String[] { "/" }; } @Override protected Filter[] getServletFilters() { return new Filter[] { new SiteMeshFilter() }; } @Override protected void customizeRegistration(ServletRegistration.Dynamic registration) { MultipartConfigElement multipartConfigElement = new MultipartConfigElement("/tmp", MAX_UPLOAD_SIZE_IN_MB, MAX_UPLOAD_SIZE_IN_MB * 2, MAX_UPLOAD_SIZE_IN_MB / 2); registration.setMultipartConfig(multipartConfigElement); } } My application is all configured in java code, @ControllerAdvice works fine with all other exceptions like: BindException.class, MethodArgumentNotValidException.class, MissingServletRequestParameterException.class, MissingServletRequestPartException.class, HttpMessageNotReadableException.class, TypeMismatchException.class however @ControllerAdvice public class SomeClass { ... @ExceptionHandler(value = { ResourceNotFoundException.class, NoSuchRequestHandlingMethodException.class }) public ModelAndView handle404() { ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("/errors/404"); modelAndView.addObject("exception", "404 NOT FOUND!"); return modelAndView; } ... } does NOT catch 404 I have also tried HttpStatus... without any luck when I call /someUrlThatDoesNotExist : [DEBUG] 2014-01-24 10:03:16,639 org.springframework.security.web.FilterChainProxy doFilter - /someUrlThatDoesNotExist reached end of additional filter chain; proceeding with original chai…
favorite count: 0
upvote count: 8

http://stackoverflow.com/a/21352823
upvote count: 2
has body: ---- Listener for Entity removal (includes cascading deletes) ----- package com.acme.model.aspects; import javax.annotation.PostConstruct; import javax.persistence.PreRemove; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; import org.springframework.util.Assert; import org.springframework.data.domain.Persistable; import com.acme.PermissionService; @Component public class ObjectIdentityListener { private static final Logger LOG = LoggerFactory.getLogger(ObjectIdentityListener.class); static private PermissionService permissionService; @Autowired(required = true) @Qualifier("permissionService") public void setSearchService(PermissionService _permissionService) { permissionService = _permissionService; } @PreRemove public void preRemove(Object object) { if(object instanceof Persistable) { LOG.info("Deleting object identity for class {} id {} ", persistable.getClass(), persistable.getId()); permissionService.deleteObjectIdentity((Persistable) object); } } @PostConstruct public void init() { Assert.notNull(permissionService, "'permissionService' is required"); } } ---- Delete method for permissionService ---- public void deleteObjectIdentity(Persistable persistable) { try{ MutableAcl acl = (MutableAcl) mutableAclService.readAclById(identity(persistable)); mutableAclService.deleteAcl(acl.getObjectIdentity(), true); } catch (NotFoundException e){ LOG.info("Could not find ACL for target {}", persistable); } }
score: 2
has comment: http://stackoverflow.com/comment/32260516
answers question: http://stackoverflow.com/q/21340310
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32080416
type: Comment
comment on: http://stackoverflow.com/a/21288568
score: 0
type: AnswerComment
has text: what i meant is that in some systems HT is considered as another "core" in the processor. AFAIK in this case `Runtime.getRuntime().availableProcessors()` could get 2 times greater number.

http://stackoverflow.com/q/21218868
tagged with: java
score: 84
downvote count: 1
has title: Explain why constructor inject is better than other options
has answer: http://stackoverflow.com/a/30503616
type: Question
duplicate of: http://stackoverflow.com/q/7779509
has answer: http://stackoverflow.com/a/21218921
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/73542301
has answer: http://stackoverflow.com/a/34228255
has body: In a Pro Spring 3 Book, Chapter 4 - Introduction IOC and DI in Spring - Page 59, In "Setter Injection vs. Constructor Injection" section, a paragraph says Spring included, provide a mechanism for ensuring that all dependencies are defined when you use Setter Injection, but by using Constructor Injection, you assert the requirement for the dependency in a container-agnostic manner" Could you explain with examples
answer count: 7
linked to: http://stackoverflow.com/q/39890849
has answer: http://stackoverflow.com/a/21220710
favorite count: 0
upvote count: 85
type: UnansweredQuestion
tagged with: required
tagged with: spring
has answer: http://stackoverflow.com/a/21219440
has answer: http://stackoverflow.com/a/22391398
has answer: http://stackoverflow.com/a/21219567
linked to: http://stackoverflow.com/q/7779509

http://stackoverflow.com/comment/31969304
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21225220
has text: Since eventually someone will mention [CloseShieldInputStream](http://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/input/CloseShieldInputStream.html) I will go ahead and post a comment :D. Just wrap `System.in` with it and close the `Scanner` as intended.

http://stackoverflow.com/comment/31924758
type: QuestionComment
has text: Looked at this but no totally following. I'll add addition criteria.
comment on: http://stackoverflow.com/q/21200363
score: 0
type: Comment

http://stackoverflow.com/comment/32170863
comment on: http://stackoverflow.com/a/21338934
type: Comment
score: 0
type: AnswerComment
has text: @JonasLibbrecht, using `replace()` will not replace the entire string or make the other one goes lost. It will replace only the given pattern with the given string.

http://stackoverflow.com/q/21268320
type: UnansweredQuestion
score: 0
has title: Press a button to carry out an async http get request and flash success on current page if successful (http.OK)
tagged with: web-services
tagged with: java
type: Question
tagged with: playframework
answer count: 1
has answer: http://stackoverflow.com/a/21269936
has body: I have a button in play framework web app that links to a routes.Application.refresh I need it to trigger a separate HTTP GET request say, http://somehost/restful/refresh?id=123 If the GET request results in a success/200 response, then flash a success note onto the current page where the button we pressed lives. How can I do this? Here is the myapp.controller.Application.java :- public static Result refresh() { flash("success", "cache refreshed successfully on somehost"); return GO_HOME ; }

http://stackoverflow.com/a/21297653
type: Answer
has comment: http://stackoverflow.com/comment/32097012
has body: An important note I would like to make is this: You are not using the benefit of integers. Integers are 32 bits long, which are 32 digits in base 2. Now, you are using an integers as 1 digit in base 10. By doing this, you are only using 0.0000002% of the memory in a useful way. Use the full range that integers support. The point would be to make an array of integers, but where each integer effectively represents 32 bits of the actual number you want to hold. Adding them together then just goes component-wise, and take care of overflow by using a carry. To fix the problem as you are facing it now: Align your arrays right. Do not add leading zeroes as Mike Koch suggests, but align them properly, by basically accessing the array elements from back to front, instead of from front to back, as you are doing now. By looking at your code, you have attempted that, but you are having trouble with ArrayIndexOutOfBoundsExceptions I guess. Access both components of the array like this: int[] number0 = ...; int[] number1 = ...; int max = Math.max(number0.length + number1.length) + 1; int[] result = new int[max]; int carry = 0; for (int i = 0; i &lt; max; ++i) { int c0 = i &lt; number0.length ? number0[number0.length - i - 1] : 0; int c1 = i &lt; number1.length ? number1[number1.length - i - 1] : 0; int sum = c0 + c1 + carry; carry = sum / 10; sum -= carry; result[result.length - i - 1] = sum; }
has comment: http://stackoverflow.com/comment/32130821
has comment: http://stackoverflow.com/comment/32097369
has comment: http://stackoverflow.com/comment/32096829
has comment: http://stackoverflow.com/comment/32096927
score: 0
answers question: http://stackoverflow.com/q/21297571
has comment: http://stackoverflow.com/comment/32096823
has comment: http://stackoverflow.com/comment/32097467
has comment: http://stackoverflow.com/comment/32096733
has comment: http://stackoverflow.com/comment/32097310

http://stackoverflow.com/comment/31981687
type: Comment
type: QuestionComment
has text: @Naman Use multiply instead of Pow(2)
score: 1
comment on: http://stackoverflow.com/q/21229119

http://stackoverflow.com/a/21211655
type: Answer
accepted answer of: http://stackoverflow.com/q/21210761
answers question: http://stackoverflow.com/q/21210761
has body: You cannot have two different invocations of your code listening on the same adapter and port number. This is the way the TCP/IP stack works. If you did, how would the stack know which process gets the connection? SO_REUSEADDR has nothing to do with this. From What exactly does SO_REUSEADDR do? This socket option tells the kernel that even if this port is busy (in the TIME_WAIT state), go ahead and reuse it anyway. If it is busy, but with another state, you will still get an address already in use error. It is useful if your server has been shut down, and then restarted right away while sockets are still active on its port. You should be aware that if any unexpected data comes in, it may confuse your server, but while this is possible, it is not likely. In other words, if you've closed the socket but it's still waiting for the connection to quiesce (receive the FIN/ACK or timeout) you can immediately grab it again. You can never have two processes connected to the same endpoint at the same time.
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21245564
score: 1
tagged with: java
type: Question
tagged with: berkeley-db
upvote count: 1
favorite count: 0
type: UnansweredQuestion
has body: Other than bare-bones autogen stuff, I cannot find any documentation or samples that show how to actually use the ReplicatedRepositoryBuilder in Carbonado. In particular, the coding pattern to wire up on both the master and replica process sides. I am using BDB-JE 5.0.58 with Carbonado 1.2.3. Here is the typical doc I found. Questions, assuming I have a master producing process and a second client replica process which continually reads from the one-way replicated repository side: are both processes supposed to have an instance of ReplicatedRepositoryBuilder with roles somehow reversed? can either side execute resync(), even though I only want that driven from the master side? how is replication being done, given these are simple library databases? Is there a listener under the covers on each end, doing what amounts to an in-process thread replaying changes? Is this going on at both ends? is the replica client side supposed to do Repository actions through ReplicatedRepositoryBuilder.getReplicaRepositoryBuilder.build(), or just a normal BDBRepositoryBuilder.build()? I don't see how it is supposed to get a replication-friendly replica Repository handle to work from. I would be ecstatic at just a simple java code example of both the producer and consumer sides, as they would look sitting in different processes on locahost, showing a make-change => resync => other-side-sees-it sequence. // master producing process RepositoryBuilder masterBuilder = new BDBRepositoryBuilder(); // ... set some props RepoitoryBuilder replicaBuilder = new BDBRepositoryBuilder(); // ... set some props ReplicatedRepositoryBuilder builder = new ReplicatedRepositoryBuilder(); builder.setMaster(true); builder.setMasterRepositoryBuilder(masterBuilder); builder.setReplicaRepositoryBuilder(replicaBuilder); Repository repository = builder.build(); // master CRUD and query done via this handle ... do some CRUD to 'repository' ... ResyncCapability capability = repository.getCapability(ResyncCapability…
answer count: 0
has title: Where is jdoc or samples for Carbonado ReplicatedRepositoryBuilder
downvote count: 0

http://stackoverflow.com/comment/32028603
type: Comment
comment on: http://stackoverflow.com/q/21258294
score: 0
type: QuestionComment
has text: @Saint please post your complete Dispatcher-servlet.xml and web.xml file It seams that error is in your action value of tag

http://stackoverflow.com/q/21344261
accepted answer: http://stackoverflow.com/a/21344514
tagged with: swing
has body: I have a Swing program that executes 2D animations using Swing Timers. With each button click there are several timers created to animate several different components - some of them moving off the screen and others moving on. (I do not know ahead of time what animations will need to be executed with each button click, but it isnt a problem to distinguish between the two "types" of animations at runtime - they're initiated from different methods, and thus its easy to imagine adding them to two different "queues" - a queue of outgoing items and a queue of incoming items. Having done so, I could then implement the basic strategy of calling a That said - that all only makes sense to me intuitively, heuristically - I haven't figured out how to implement it in practice. What would those "queues" actually be, and what class would hold and later execute them?? Presumably one that implements Runnable, creating a second thread that can execute the animations with tighter control on how they proceed? Or does the event-dispatch thread give me the ample control here: Is there a way to use SwingUtilities.invokeAndWait() (or something like it) to collect all the animations to be performed, while assigning priority to those of a certain class, or that are marked in a certain way?
type: AnsweredQuestion
tagged with: java
type: Question
has title: Grouping animations for sequential execution
answer count: 1
has answer: http://stackoverflow.com/a/21344514
score: 0

http://stackoverflow.com/comment/32187455
type: AnswerComment
score: 0
has text: It is a valid subsitute but i m getting confused with List<Object> arguement,which is been said as subtype of List<? super Number> (where List<Object> can be the valid super and not List<Number>)
type: Comment
comment on: http://stackoverflow.com/a/21348500

http://stackoverflow.com/comment/32065816
has text: I recommend to neither use single-seater class names nor class names that are used elsewhere already.
type: QuestionComment
comment on: http://stackoverflow.com/q/21280303
score: 0
type: Comment

http://stackoverflow.com/comment/32078795
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21285139
type: AnswerComment
has text: Right answer! I finally had to redeploy my application. Thank you!

http://stackoverflow.com/q/21315981
score: -1
tagged with: boot
has body: First I wan't to say that I tried to find my answers on stackoverflow with no success. Second, I tested my code on my Samsung S3 4G 4.1.2. I have some question with the code I produced. ---Exlaination : The code starts ClsAutoStart at BOOT_COMPLETED, which starts a service, SvcFirst, which register a BroadcastReceiver synchronized with NEW_OUTGOING_CALL action. In the onReceive() method, I start the activity. You understood that the activity is supposed to popup when the is a call (no condition yet). ---Questions : This works but I DO NOT have the exact expected behaviour so I have some questions : 1- Everything goes well ONLY if I first open the activity AFTER installation and BEFORE reboot. Then, after that, every piece of code does what it has to. Could anyone explain me why I have to launch the activity in order it to work ? How to avoid it ? 2- The reason why I use this method to do things is because I don't want my application to appear in the application list (for the user). I wan't the activity to be launched by the onReceive method. I tried to remove the following lines from the manifest file but I go back to question "1" : if I can't previously launch the activity, it doesn't work (no possibility to launch anything because the lines are removed). <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> Could anyone explain me why I doesn't work and how to correct it ? Is this the correct way to do "hide" my application ? On stackoverflow, I found many answers ... this is one of them (question "3" is one of the others ...). 3- I removed the previous lines (question "2) and add the following one in the receiver section (of BOOT_COMPLETED action) in my manifest file but it still doesn't change anything. Any clue ? <category android:name="android.intent.category.HOME" /> ---Code : manifest file : <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> <…
answer count: 1
tagged with: service
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21316430
tagged with: android
has title: Start service at boot time and launch activity from onReceive method of BR
tagged with: java
downvote count: 1
type: Question
tagged with: broadcastreceiver
upvote count: 0

http://stackoverflow.com/comment/31933876
score: 0
comment on: http://stackoverflow.com/q/21205816
type: QuestionComment
has text: You should never have a return statement inside of a finally block. This can over-write things that were done in the try block, and can lead to really convoluted logic.
type: Comment

http://stackoverflow.com/q/21199600
has title: How to read a XML file using getResourceAsStream
has comment: http://stackoverflow.com/comment/31923377
tagged with: parsing
has answer: http://stackoverflow.com/a/21199679
tagged with: jframe
has body: I am trying to read an xml configuration in the below class.It is Working when Running It .But When i Export it into a Runnable Jar.The file is not being read ..?? public KeyTranslator() { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); String sPath = "res/config.xml"; //InputStream is = (InputStream) Thread.currentThread().getContextClassLoader().getResourceAsStream(sPath); //InputStream is = this.getClass().getResourceAsStream((sPath); try { DocumentBuilder builder = factory.newDocumentBuilder(); if (AppFrame.jar == null) { this.myDoc = builder.parse( new File((AppFrame.basePath+sPath).replace('\\', '/')) );//ensure seperator is '/' as linux is picky } else { this.myDoc = builder.parse(AppFrame.jar.getInputStream(AppFrame.jar.getJarEntry(sPath))); } } I googled &amp; found the getResourceAsStream method.But it seems to throw FileNotFoundException.&amp; i Don't know how to add InputSream in my Code ??? So Help me in the Right Direction :) Thanks for your Help ... Note The Method i Tried has been Commented
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21204536
accepted answer: http://stackoverflow.com/a/21204536
linked to: http://stackoverflow.com/q/1464291
score: 0
possible better answer: http://stackoverflow.com/a/21199675
answer count: 3
has answer: http://stackoverflow.com/a/21199675
tagged with: executable-jar
has comment: http://stackoverflow.com/comment/31923478

http://stackoverflow.com/q/21282946
downvote count: 0
tagged with: string
tagged with: jsch
has title: Java, String to JTable
favorite count: 0
possible better answer: http://stackoverflow.com/a/21283074
has body: I have a program that using JSCH runs a command on a server and get the following results out rcpt 7554 Jan-21 01-03:43:27 ? /usr/bin/Program ncuser2 7202 Jan-21 01-04:22:08 ? /usr/bin/Program lyn 6277 Dec-17 36-02:14:51 ? /usr/bin/Program 10.15.1.104:0.0 lyn 6268 Dec-17 36-02:15:17 ? /usr/bin/Program 10.15.1.104:0.0 These results are stored in one string. What I need to do is convert/Output these results into a JTable. What I cant work out is how to get what's in the single string above into multiple cells of a JTable in Swing so it looks like this User | PID | Launch | Runtime | TTYP | Program | ----------------------------------------------- rcpt | 7554| Jan-21 |01-03:43:27 | ? |/usr/bin/Program ncuser2| 7202| Jan-21 |01-04:22:08 | ? |/usr/bin/Program lyn| 6277| Dec-17 |36-02:14:51 | ? |/usr/bin/Program 10.15.1.104:0.0 lyn| 6268| Dec-17 |36-02:15:17 | ? |/usr/bin/Program 10.15.1.104:0.0 The main issue I am having is finding a way of splitting the string, I want to do it on space, looking at this. Even if I could split it into variables for every space I could possibly work it out but at the moment I don't have a clue!
has answer: http://stackoverflow.com/a/21284223
has answer: http://stackoverflow.com/a/21283074
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/21284223
has comment: http://stackoverflow.com/comment/32072364
tagged with: jtable
answer count: 2

http://stackoverflow.com/a/21231772
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21231064
downvote count: 0
answers question: http://stackoverflow.com/q/21231064
has body: With SWT, disable items it is not possible for a ComboBox, you can remove them. You could use JComboBox from Swing to disable items. You can bridge Swing components creating a SWT_AWT frame and a AWT panel like this java.awt.Frame frame = SWT_AWT.new_Frame(); java.awt.Panel panel = new java.awt.Panel(new java.awt.BorderLayout()); and then add the Swing JComboBox to the panel. panel.add(jComboBox); Here's a tutorial for embedding Swing into SWT http://www.java2s.com/Tutorial/Java/0280__SWT/EmbededSwingAWTcomponentstoSWT.htm
type: Answer
has comment: http://stackoverflow.com/comment/31980336

http://stackoverflow.com/comment/31991013
has text: I've changed your sentence about sieve. This is not a sieve in any way. You in fact test here all the (odd) numbers below max, with an inlined `IsPrime` code (as trial division algorithm). But overall, +1 for at least having an *optimal* trial division here, unlike the other answers.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21231364

http://stackoverflow.com/comment/31997593
type: AnswerComment
has text: @PeterLawrey To answer on that question. I have already ran it couple of time before measure it.. Currently I am running 500 times for warming up then I start measuring the call as shown in my `DemoTest class`. I can increase the warmup number to see whether it affects any performance or not..
type: Comment
comment on: http://stackoverflow.com/a/21241236
score: 0

http://stackoverflow.com/comment/31932899
comment on: http://stackoverflow.com/a/21205178
type: AnswerComment
has text: I've updated my answer, please copy it again and display me the error you get in catch.
score: 0
type: Comment

http://stackoverflow.com/a/21258331
score: 0
type: Answer
has body: Whats harm in doing this? Integer i = 42; List&lt;Integer&gt; emptyList = Collections.emptyList(); Collection&lt;Integer&gt; result = addToCollection(i, emptyList); In java 8 it will be taken care.
answers question: http://stackoverflow.com/q/21258160

http://stackoverflow.com/comment/32041934
has text: @user3220565 You could always look at my answer below. ;)
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21266597

http://stackoverflow.com/comment/32147491
comment on: http://stackoverflow.com/a/21308379
score: 0
type: AnswerComment
has text: I am setting my ProjectPath and classpath like this :
type: Comment

selenium
tags question: http://stackoverflow.com/q/21330079
tags question: http://stackoverflow.com/q/21281902
tags question: http://stackoverflow.com/q/21214340
tags question: http://stackoverflow.com/q/21231125
tags question: http://stackoverflow.com/q/21276350
tags question: http://stackoverflow.com/q/21338021
tags question: http://stackoverflow.com/q/21344590
tags question: http://stackoverflow.com/q/21302275
tags question: http://stackoverflow.com/q/21283299
tags question: http://stackoverflow.com/q/21336296
tags question: http://stackoverflow.com/q/21278079
tags question: http://stackoverflow.com/q/21298500
tag name: selenium
tags question: http://stackoverflow.com/q/21273360
tags question: http://stackoverflow.com/q/21260364
tags question: http://stackoverflow.com/q/21241310
tags question: http://stackoverflow.com/q/21263367
tags question: http://stackoverflow.com/q/21312773
tags question: http://stackoverflow.com/q/21270640
tags question: http://stackoverflow.com/q/21236979
tags question: http://stackoverflow.com/q/21264944
tags question: http://stackoverflow.com/q/21253778
tags question: http://stackoverflow.com/q/21255338
tags question: http://stackoverflow.com/q/21307813
type: Tag
tags question: http://stackoverflow.com/q/21272862
tags question: http://stackoverflow.com/q/21249220
tags question: http://stackoverflow.com/q/21288645
tags question: http://stackoverflow.com/q/21226985
tags question: http://stackoverflow.com/q/21241074
tags question: http://stackoverflow.com/q/21328037
tags question: http://stackoverflow.com/q/21248125

http://stackoverflow.com/comment/31949012
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21213922
has text: :( . have you got ssl exception on your side.

http://stackoverflow.com/a/21269676
has comment: http://stackoverflow.com/comment/32047728
upvote count: 7
downvote count: 0
has body: As far as i could see, all classes that are used to establish a PieChart, like PieChart.Data and of course the ObservableList are already designed so that they will update the PieChart the moment something changes, be it the list itself or values inside the Data Objects. See the binding chapters how this is done. But you don't need to write your own bindings for the PieChart. The code below should do what you want. Use addData(String name, double value) to create a new Data object for your pie chart, or update an existing one which has the same name like the first parameter of the method. The PieChart will automatically play a animation when changes are made to the list (new Data object added) or a Data object got changed. //adds new Data to the list public void naiveAddData(String name, double value) { pieChartData.add(new Data(name, value)); } //updates existing Data-Object if name matches public void addData(String name, double value) { for(Data d : pieChartData) { if(d.getName().equals(name)) { d.setPieValue(value); return; } } naiveAddData(name, value); }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32048155
score: 7
answers question: http://stackoverflow.com/q/21268973
type: Answer
accepted answer of: http://stackoverflow.com/q/21268973

http://stackoverflow.com/q/21301770
score: 1
tagged with: file-upload
favorite count: 0
linked to: http://stackoverflow.com/q/9953483
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32103877
tagged with: java
tagged with: file
tagged with: fileoutputstream
upvote count: 1
has title: How to Upload audio from sd-card to server in android
type: Question
has comment: http://stackoverflow.com/comment/32103930
has answer: http://stackoverflow.com/a/21302033
has comment: http://stackoverflow.com/comment/32103821
has comment: http://stackoverflow.com/comment/32103975
has comment: http://stackoverflow.com/comment/32103845
answer count: 1
downvote count: 0
has body: I am trying to upload audio file from particular folder of SD-Card to server. but when i try to do that i am getting following error. error: /mnt/sdcard/AudioRecorder: open failed: EISDIR (Is a directory) and my full logcat is as below. 01-23 12:44:18.920: E/Debug(6164): error: /mnt/sdcard/AudioRecorder: open failed: EISDIR (Is a directory) 01-23 12:44:18.920: E/Debug(6164): java.io.FileNotFoundException: /mnt/sdcard/AudioRecorder: open failed: EISDIR (Is a directory) 01-23 12:44:18.920: E/Debug(6164): at libcore.io.IoBridge.open(IoBridge.java:448) 01-23 12:44:18.920: E/Debug(6164): at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:78) 01-23 12:44:18.920: E/Debug(6164): at iqualtech.skirr.Record_AudioPG.doAudioFileUpload(Record_AudioPG.java:295) 01-23 12:44:18.920: E/Debug(6164): at iqualtech.skirr.Record_AudioPG.stopRecording(Record_AudioPG.java:271) 01-23 12:44:18.920: E/Debug(6164): at iqualtech.skirr.Record_AudioPG.access$0(Record_AudioPG.java:265) 01-23 12:44:18.920: E/Debug(6164): at iqualtech.skirr.Record_AudioPG$4.onClick(Record_AudioPG.java:124) 01-23 12:44:18.920: E/Debug(6164): at android.view.View.performClick(View.java:3517) 01-23 12:44:18.920: E/Debug(6164): at android.view.View$PerformClick.run(View.java:14155) 01-23 12:44:18.920: E/Debug(6164): at android.os.Handler.handleCallback(Handler.java:605) 01-23 12:44:18.920: E/Debug(6164): at android.os.Handler.dispatchMessage(Handler.java:92) 01-23 12:44:18.920: E/Debug(6164): at android.os.Looper.loop(Looper.java:154) 01-23 12:44:18.920: E/Debug(6164): at android.app.ActivityThread.main(ActivityThread.java:4624) 01-23 12:44:18.920: E/Debug(6164): at java.lang.reflect.Method.invokeNative(Native Method) 01-23 12:44:18.920: E/Debug(6164): at java.lang.reflect.Method.invoke(Method.java:511) 01-23 12:44:18.920: E/Debug(6164): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809) 01-23 12:44:18.920: E/Debug(6164): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java…

http://stackoverflow.com/comment/32063679
comment on: http://stackoverflow.com/a/21279145
type: AnswerComment
score: 0
type: Comment
has text: Events and Layouts aren't components. There's nothing wrong with using them.

http://stackoverflow.com/q/21248921
answer count: 2
has answer: http://stackoverflow.com/a/21249138
has comment: http://stackoverflow.com/comment/32011391
downvote count: 0
has body: Is is possible to get a list (and catch) of the concrete exceptions that can be thrown by a method? I am calling an API that uses a hierarchy of exceptions, but only declares the top level exception to a method. I want to be able to provide specific behaviour based on the exception, but I don't want to have to trace through the code to find the concrete exceptions that can be thrown. There may be added complications that the API contains a number of layers separated by interfaces. Simple example: public interface MyInterface { void doShakyStuff() throws Exception; } public class MyImpl implements MyInterface { public void doShakyStuff() throws Exception{ double rand = Math.random(); if( rand &gt; 0.1 ){ throw new IOException(); } if( rand &gt; 0.5 ){ throw new IllegalAccessException(); } else{ throw new InterruptedException(); } } } I want to be able to create the following try/catch as completely as possible and then tweak afterwards: public class MyClass{ private MyInterface interface; public void doStuff(){ try{ interface.doShakyStuff(); }catch(IOException e){ // ... } catch( IllegalAccessException e){ // ... } catch( InterruptedException e){ // ... } catch(Exception e){ // something else } } }
possible better answer: http://stackoverflow.com/a/21248965
favorite count: 0
accepted answer: http://stackoverflow.com/a/21249138
has answer: http://stackoverflow.com/a/21248965
has title: How to get a list of concrete Exceptions thrown by a method in Eclipse
has comment: http://stackoverflow.com/comment/32051341
tagged with: exception
upvote count: 1
has comment: http://stackoverflow.com/comment/32010965
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/32011027

http://stackoverflow.com/comment/32181757
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21345246
score: 0
has text: Not related to your problem but you might want to remove your name and student ID from the source code when posting it online.

http://stackoverflow.com/comment/32291281
type: Comment
comment on: http://stackoverflow.com/a/21348166
score: 0
type: AnswerComment
has text: Hi I added my logic to tableCol.setLabelProvider() with override on getImage. Now the problem that in someCase I want in my code to remove the image ( visible = false) . How I can get the cell and then to update the image ?

http://stackoverflow.com/a/21227171
accepted answer of: http://stackoverflow.com/q/21226096
type: AcceptedAnswer
score: 0
type: Answer
has body: It looks like you do not have permissions to make changes to /usr/local. /usr is normally owned by root. The only way you can install there is to either use sudo or login as root. If you do not have root access, contact the support forum to request for this or that gradle is installed by support. $ ls -lrt /usr total 8 drwxrwxr-x 7 root admin 238 16 May 2011 bin drwxr-xr-x 4 root wheel 136 29 Jun 2011 etc gradle can run from anywhere. So instead do this. You will have access to your home directory (~). The home directory can be substituted for another directory. cd ~ #Go to home directory mkdir gradle #Create gradle directory cd gradle #Enter gradle directory wget http://services.gradle.org/distributions/gradle-1.10-bin.zip #Download gradle unzip -q gradle-1.10-bin.zip #Unzip gradle echo "export GRADLE_HOME=~/gradle" &gt; ~/.profile echo "export PATH=$GRADLE_HOME/bin:$PATH" &gt; ~/.profile source ~/.profile #Re-read your profile Then your can run gradle --version to check that it is working. Run which gradle to check that the path is ~/gradle/bin
has comment: http://stackoverflow.com/comment/32025656
has comment: http://stackoverflow.com/comment/31978841
has comment: http://stackoverflow.com/comment/32020850
has comment: http://stackoverflow.com/comment/31977016
answers question: http://stackoverflow.com/q/21226096

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/21337121
tags question: http://stackoverflow.com/q/21337593
type: Tag
tags question: http://stackoverflow.com/q/21184950
tags question: http://stackoverflow.com/q/21334778
tags question: http://stackoverflow.com/q/21231806

http://stackoverflow.com/comment/32143463
has text: @DonRoby I was not able to call the methods or the testString.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21324020

http://stackoverflow.com/comment/32099305
type: AnswerComment
comment on: http://stackoverflow.com/a/21246056
has text: I implemented your suggestion and it worked!I have included my answer below. Thanks a lot man,I would have taken a hell lot of more time without your guidance.Really appreciate it :)
type: Comment
score: 1

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/21301581
tag name: osx-mavericks
tags question: http://stackoverflow.com/q/21205031
tags question: http://stackoverflow.com/q/21231561
tags question: http://stackoverflow.com/q/21214745

http://stackoverflow.com/a/21323069
score: -1
answers question: http://stackoverflow.com/q/21286677
has comment: http://stackoverflow.com/comment/32145721
has comment: http://stackoverflow.com/comment/32530553
has comment: http://stackoverflow.com/comment/32147660
downvote count: 1
has comment: http://stackoverflow.com/comment/32145714
type: Answer
has body: http://mojo.codehaus.org/gwt-maven-plugin/compile-mojo.html says generateDirectory Folder where generated-source will be created (automatically added to compile classpath). ${project.build.directory}/generated-sources/gwt So Maven should be able to compile your project correctly. However as Nick point target/generated-sources/gwt included as a source directory in your IDE you will have compilation problems. You need to update your question with more specific details as you have not been clear exactly where in the target folder the classes are generated; or what is giving you compilation errors (Maven or your IDE - and which IDE are you using)
upvote count: 0

http://stackoverflow.com/q/21302611
upvote count: 8
type: Question
answer count: 1
tagged with: x11
has answer: http://stackoverflow.com/a/21309150
accepted answer: http://stackoverflow.com/a/21309150
favorite count: 0
has comment: http://stackoverflow.com/comment/32105142
score: 8
downvote count: 0
tagged with: bufferedimage
tagged with: graphics
type: AnsweredQuestion
has body: I have the following code for creating raster images. BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); Graphics g = img.getGraphics(); g.setColor(backgroundColour); g.fillRect(0, 0, width, height); This runs on my Windows machine and on a local Ubuntu machine, but when transferred to a server attempts to call an X11 server, with the stack trace shown . How can I prevent this? Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable. at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:62) at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:178) at java.security.AccessController.doPrivileged(Native Method) at sun.awt.X11GraphicsEnvironment.&lt;clinit&gt;(X11GraphicsEnvironment.java:142) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:190) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82) at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1164) at java.awt.image.BufferedImage.getGraphics(BufferedImage.java:1154) at org.xmlcml.cml.converters.molecule.fragments.Cml2PngTool.renderMolecule(Cml2PngTool.java:94) at org.xmlcml.cml.converters.molecule.fragments.Cml2PngTool.renderMolecule(Cml2PngTool.java:61) at org.xmlcml.cml.converters.molecule.fragments.FragmentGenerator.add2DCoordsAndRender(FragmentGenerator.java:180) at org.xmlcml.cml.converters.molecule.fragments.FragmentGenerator.write2dImage(FragmentGenerator.java:169) at org.xmlcml.cml.converters.molecule.fragments.FragmentGenerator.output2dImages(FragmentGenerator.java:486) at org.xmlcml.cml.converters.molecule.fragments.FragmentGenerator.generateMoieties(FragmentGenerator.java:443) at org.xmlcml.cml.converters.molecule.fragments.FragmentGenerator.createMoietiesAndFragments(FragmentGenerator.java:125) at org.xmlcm…
has title: How can I stop BufferedImage.getGraphics() opening an X11 device?
tagged with: java

http://stackoverflow.com/a/47205363
downvote count: 0
has body: 27.3.5 JSP limitations When running a Spring Boot application that uses an embedded servlet container (and is packaged as an executable archive), there are some limitations in the JSP support. With Tomcat it should work if you use war packaging, i.e. an executable war will work, and will also be deployable to a standard container (not limited to, but including Tomcat). An executable jar will not work because of a hard coded file pattern in Tomcat. With Jetty it should work if you use war packaging, i.e. an executable war will work, and will also be deployable to any standard container. Undertow does not support JSPs. Creating a custom error.jsp page won’t override the default view for error handling, custom error pages should be used instead. source
type: Answer
score: 4
answers question: http://stackoverflow.com/q/21243690
upvote count: 4

http://stackoverflow.com/q/21261142
has answer: http://stackoverflow.com/a/21263335
tagged with: websocket
has body: I am learning how to make realtime applications in java.I am using activemq which uses stomp as a wired format to send WebSockets messages between the WebSocket server running within the ActiveMQ broker and the Web browser. Its easy to notify the client that he/she is connected to the server but is it possible to notify a listening java server program that a client has connected to the server?.
has title: Getting notified when a client is connected to the server in java
type: AnsweredQuestion
tagged with: activemq-classic
possible better answer: http://stackoverflow.com/a/21263335
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21267453
accepted answer: http://stackoverflow.com/a/21267453
tagged with: stomp
score: 0
answer count: 2

http://stackoverflow.com/a/21213796
has body: I agree that this question needs clarification, but to answer your question, all objects in Java are inherited from the Object class, thus a variable of type Object can reference anything. Object obj = new BigInteger[1]; Object obj = new BigInteger[1][1]; Object obj = new BigInteger[1][1][1]; . . .
answers question: http://stackoverflow.com/q/21213668
score: 0
type: Answer

http://stackoverflow.com/comment/32090578
type: AnswerComment
has text: Simply pressing Esc should remove it as well.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21293917

http://stackoverflow.com/q/21228900
has title: How to update the PNR Capcha added in the Indian Railways Site
favorite count: 0
upvote count: 8
possible better answer: http://stackoverflow.com/a/21229193
tagged with: android
tagged with: httpresponse
type: AnsweredQuestion
has body: I have a PNR Inquiry app on Google Play. It was working very fine. But recently Indian Railwys added captcha to their PNR Inquiry section and because of this I am not able to pass proper data to the server to get proper response. How to add this captcha in my app in form of an imageview and ask the users to enter captcha details also so that I can send proper data and get proper response. Indian Railways PNR Inquiry Link Here is my PnrCheck.java which I was using earlier. Please help what modifications should be done here.. import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.Socket; import java.net.URL; import java.util.ArrayList; import java.util.List; import org.apache.http.Header; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.HttpVersion; import org.apache.http.entity.InputStreamEntity; import org.apache.http.impl.DefaultHttpClientConnection; import org.apache.http.message.BasicHttpEntityEnclosingRequest; import org.apache.http.params.BasicHttpParams; import org.apache.http.params.HttpParams; import org.apache.http.params.HttpProtocolParams; import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.BasicHttpProcessor; import org.apache.http.protocol.ExecutionContext; import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpRequestExecutor; import org.apache.http.protocol.RequestConnControl; import org.apache.http.protocol.RequestContent; import org.apache.http.protocol.RequestExpectContinue; import org.apache.http.protocol.RequestTargetHost; import org.apache.http.protocol.RequestUserAgent; import org.apache.http.util.EntityUtils; public class PNRStatusCheck { public static void main(String args[]) { try { String pnr1 = "1154177041"; String reqStr = "lccp_pnrno1=" + pnr1 + "&amp;submitpnr=Get+Status"; PNRStatusCheck check = new PNRStatusCheck(); Stri…
downvote count: 1
has comment: http://stackoverflow.com/comment/31982223
has answer: http://stackoverflow.com/a/21374140
type: Question
score: 7
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: httprequest
answer count: 2
has answer: http://stackoverflow.com/a/21229193
accepted answer: http://stackoverflow.com/a/21374140

http://stackoverflow.com/q/21306711
score: 0
has body: Please help me if this is possible to do. I am having .EXE file on server i want to run that file in web browser. Please guide me how can i implement this?
has title: Can we open .exe file in browser from server?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21306836
has answer: http://stackoverflow.com/a/21306824
tagged with: java
type: Question
answer count: 2
tagged with: javascript
tagged with: applet
linked to: http://stackoverflow.com/q/3152482
has comment: http://stackoverflow.com/comment/32112358
has comment: http://stackoverflow.com/comment/32112349

http://stackoverflow.com/a/21299467
answers question: http://stackoverflow.com/q/21299107
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21299107
type: Answer
score: 2
downvote count: 0
has body: The best way is to use a Map. Check is the map contains a key of the String. If it doesn't create a new List and add it to the map. If it does, then just add the String the list already in the map. public static Map&lt;String, List&lt;String&gt;&gt; getMap(List&lt;String&gt; list) { Map&lt;String, List&lt;String&gt;&gt; map = new HashMap&lt;&gt;(); for (String s: list) { if (!map.containsKey(s)) { List&lt;String&gt; mapList = new ArrayList&lt;&gt;(); mapList.add(s); map.put(s, mapList); } else { ((List&lt;String&gt;)map.get(s)).add(s); } } return map; } Here's running example import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class TestLIst { public static void main(String[] args) { List&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("A"); list.add("B"); list.add("A"); list.add("B"); list.add("C"); list.add("D"); Map&lt;String, List&lt;String&gt;&gt; map = getMap(list); printMapAsLists(map); } public static Map&lt;String, List&lt;String&gt;&gt; getMap(List&lt;String&gt; list) { Map&lt;String, List&lt;String&gt;&gt; map = new HashMap&lt;&gt;(); for (String s: list) { if (!map.containsKey(s)) { List&lt;String&gt; mapList = new ArrayList&lt;&gt;(); mapList.add(s); map.put(s, mapList); } else { ((List&lt;String&gt;)map.get(s)).add(s); } } return map; } public static void printMapAsLists(Map&lt;String, List&lt;String&gt;&gt; map) { for (List&lt;String&gt; list : map.values()) { System.out.println(list); } } } Output [D] [A, A] [B, B] [C]
upvote count: 2

http://stackoverflow.com/comment/32133266
type: Comment
type: QuestionComment
has text: The set of solutions is a linear space that's a span of one or more basis vectors. Any linear combination of those basis vectors is a solution to your set of equations. Your question reduces to: "I've got a matrix representing a set of equations, how do I get the basis vectors out of it". Once you realize this, your question becomes a math question and is off-topic here.
score: 0
comment on: http://stackoverflow.com/q/21316730

http://stackoverflow.com/comment/31901193
type: Comment
type: QuestionComment
has text: Try using `JToggleButton`
comment on: http://stackoverflow.com/q/21187552
score: 0

http://stackoverflow.com/a/21281517
score: 4
answers question: http://stackoverflow.com/q/21273385
has body: It should probably be called a "colon colon separator": Brian Goetz* calls it "colon colon" and since he was the specification lead for the lambda JSR I suppose we can consider him as an authoritative source. The specification #3.11 classifies :: as a separator. *source: the road to lambda @ Javaone 2013 around 04:00.
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/32073090
downvote count: 0
has comment: http://stackoverflow.com/comment/32071990
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21273385

http://stackoverflow.com/comment/32110905
type: AnswerComment
score: 0
has text: thank you so much this makes a bit more sense now ill try this and let you know if I run into problems, but thank you so much.
type: Comment
comment on: http://stackoverflow.com/a/21294550

http://stackoverflow.com/comment/38025853
type: AnswerComment
type: Comment
has text: So, it is only possible to connect by providing username and password?
comment on: http://stackoverflow.com/a/21300276
score: 0

http://stackoverflow.com/comment/32139654
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21320547
has text: @JoeBarr Did you also change the foreach loop which changing the above?

http://stackoverflow.com/q/21299216
has comment: http://stackoverflow.com/comment/32099432
upvote count: 0
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/21300347
type: Question
score: -2
tagged with: arrays
has title: How can I convert this to work with array lists instead of arrays?
answer count: 1
linked to: http://stackoverflow.com/q/157944
favorite count: 0
has body: This code takes a random sampling of numbers, plugs them into an array, counts the odd numbers, and then lets the user pick an integer to see if it matches. This works great now with just arrays, but I want to convert it to work with ArrayLists. What's the easiest way to do this? import java.util.Scanner; import java.util.Random; public class ArrayList { public static void main(String[] args) { // this code creates a random array of 10 ints. int[] array = generateRandomArray(10); // print out the contents of array separated by the delimeter // specified printArray(array, ", "); // count the odd numbers int oddCount = countOdds(array); System.out.println("the array has " + oddCount + " odd values"); // prompt the user for an integer value. Scanner input = new Scanner(System.in); System.out.println("Enter an integer to find in the array:"); int target = input.nextInt(); // Find the index of target in the generated array. int index = findValue(array, target); if (index == -1) { // target was not found System.out.println("value " + target + " not found"); } else { // target was found System.out.println("value " + target + " found at index " + index); } } public static int[] generateRandomArray(int size) { // this is the array we are going to fill up with random stuff int[] rval = new int[size]; Random rand = new Random(); for (int i = 0; i &lt; rval.length; i++) { rval[i] = rand.nextInt(100); } return rval; } public static void printArray(int[] array, String delim) { // your code goes here for (int i = 0; i &lt; array.length; i++) { System.out.print(array[i]); if (i &lt; array.length - 1) System.out.print(delim); else System.out.print(" "); } } public static int countOdds(int[] array) { int count = 0; // your code goes here for (int i = 0; i &lt; array.length; i++) { if (array[i] % 2 == 1) count++; } return count; } public static int findValue(int[] array, int value) { // your code goes here for (int i = 0; i &lt; array.length; i++) if (array[i] == value) return i; retu…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32099407

http://stackoverflow.com/a/21280098
has comment: http://stackoverflow.com/comment/32067526
has comment: http://stackoverflow.com/comment/32067674
has comment: http://stackoverflow.com/comment/32068556
answers question: http://stackoverflow.com/q/21279838
downvote count: 0
has comment: http://stackoverflow.com/comment/32068487
type: Answer
has body: Its working for me Try to modify this : private void savePrivateExternalFile(String fileURL, String fName) { HttpURLConnection connection = null; URL url = null; try { url = new URL(fileURL); connection = (HttpURLConnection) url.openConnection(); connection.addRequestProperty(BConstant.WEB_SERVICES_COOKIES, cookie); connection.setDoOutput(true); connection.connect(); } catch (IOException e1) { e1.printStackTrace(); } File folderDir = null; folderDir = new File(getExternalFilesDir("Directory Name") + "/Files"); File file = new File(folderDir, fName); if (file.exists()) { file.delete(); } if ((folderDir.mkdirs() || folderDir.isDirectory())) { try { InputStream inputStream = connection.getInputStream(); BufferedInputStream bufferedInputStream = null; bufferedInputStream = new BufferedInputStream(inputStream, 1024 * 5); FileOutputStream fileOutputStream = new FileOutputStream( folderDir + "/" + fName); byte[] buffer = new byte[1024]; int len1 = 0; while ((len1 = inputStream.read(buffer)) != -1) { fileOutputStream.write(buffer, 0, len1); } bufferedInputStream.close(); fileOutputStream.close(); inputStream.close(); connection.disconnect(); } catch (Exception e) { e.printStackTrace(); } } Use this if you want to open Downloaded file : File file = new File(getExternalFilesDir("Directory Name")+ "/Files/" + fileName); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file),"application/pdf"); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(intent); Add this line in your Manifest file: &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
score: 2
upvote count: 2

http://stackoverflow.com/q/21293227
has comment: http://stackoverflow.com/comment/32088671
score: 0
has answer: http://stackoverflow.com/a/21293362
has body: Hi I am working on Spring MVC 4.0. When I try to access login page by URL http://localhost:8080/bookstore-web-0.0.1-SNAPSHOT/bookstore/authentication/login, it shows 404 error. And logs shows below warning WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/bookstore-web-0.0.1-SNAPSHOT/bookstore/authentication/login] in DispatcherServlet with name 'appServlet']] Here bookstore-web-0.0.1-SNAPSHOT is my .war file. I did following mapping in my web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> contextConfigLocation /WEB-INF/spring/root-context.xml, /WEB-INF/spring/appServlet/security-config.xml org.springframework.web.context.ContextLoaderListener appServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring/appServlet/servlet-context.xml 1 springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /bookstore/* REQUEST FORWARD appServlet /bookstore/* Controller Is: package com.abhendra.bookstore; @Controller public class AuthenticationController { private static final Logger logger = LoggerFactory.getLogger(AuthenticationController.class); /** * Simply selects the home view to render by returning its name. */ @RequestMapping(value = "/authentication/login", method = RequestMethod.GET) public String home(Locale locale, Model model) { logger.info("Welcome home! The client locale is {}.", locale); System.out.println("In Controller!!!!!!!!!!!!!!!!!!!!!!"); return "login"; } } I have also done component-scan entry in my root-context.xml file. like: <context:component-scan base-package="com.abhendra.bookstore, com.abhendra.core" /> <context:annotation-config /> I am not getting where am I doing mistake. Thanks In advance.
has comment: http://stackoverflow.com/comment/32088649
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
tagged with: java
linked to: http://stackoverflow.com/q/11692837
type: Question
has title: 404- PageNot Found in Spring MVC
answer count: 1

http://stackoverflow.com/q/21258431
tagged with: rest
answer count: 1
has comment: http://stackoverflow.com/comment/32028688
has comment: http://stackoverflow.com/comment/32062805
has comment: http://stackoverflow.com/comment/32031253
has body: Currently working on server sent events of html5 now. I made a servlet and set the response.setContentType("text/event-stream"); as this. Now I get the update from this servlet on my client side and my client side code is as follows: &lt;script &gt; if(typeof(EventSource)!=="undefined") { var url = 'http://localhost:8080/KnockOut/DateFeed.jsp'; eventSource = new EventSource(url); eventSource.onmessage = function (event) { var theParagraph = document.createElement('p'); theParagraph.innerHTML = event.data.toString(); document.body.appendChild(theParagraph); } } else { document.getElementById("result").innerHTML="Sorry, your browser does not support server-sent events..."; } &lt;/script&gt; But when I change the url to call a rest full webservice written in java, it shows some error and I am note able to get the updated output. The REST webservice code is: @GET public String getXml(@Context HttpHeaders header, @Context HttpServletResponse response) { response.setHeader("cache-control", "no-cache"); response.setContentType("text/event-stream"); return "dataas: " + (new java.util.Date()).toString() + "x\n\n"; } please help me.
has comment: http://stackoverflow.com/comment/32064208
has comment: http://stackoverflow.com/comment/32063348
has comment: http://stackoverflow.com/comment/32073646
has comment: http://stackoverflow.com/comment/32072584
tagged with: web-services
has comment: http://stackoverflow.com/comment/32072180
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32058506
has comment: http://stackoverflow.com/comment/32027770
has answer: http://stackoverflow.com/a/23759483
has comment: http://stackoverflow.com/comment/32056889
tagged with: java
has title: server sent events using serverside as java rest webservice
type: Question
has comment: http://stackoverflow.com/comment/32065681
accepted answer: http://stackoverflow.com/a/23759483
score: 0

http://stackoverflow.com/a/21346553
answers question: http://stackoverflow.com/q/21346457
type: Answer
has body: The termination value of the for loop being 'enimies.size()' will be problematic since this is evaluated every time the loop is run through. Since the loop makes the size smaller, the termination value decreases by one every time i increases by one, essentially making the loop terminate twice as fast as it would if the 'enimies.size()' value wasn't changing. Therfore, it's best to use non-changing values as for-loop termination values. The other answers supply sufficient enough information to fix the error, but this is just an extra tip for the future.
score: 0

http://stackoverflow.com/a/21504498
answers question: http://stackoverflow.com/q/21279864
type: Answer
has body: I am working on a solution that uses SCP and SSH to allow TeamCity to copy the war file to the Tomcat server and then run some custom bash scripts to finish up the deploy. Similar to this proposed solution. Teamcity control application deploy? Currently running into SSH problems but should get them worked out soon. There is also the option of using the Tomcat Management capabilities to upload a the war file. http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Deploy_A_New_Application_Remotely I've had this working in test environments using curl to make the request.
score: 0

http://stackoverflow.com/q/21193453
type: Question
tagged with: hadoop
has title: How to access secure kerberized hadoop using just java API
has body: I am pretty new to Kerberos. I am using a shared Hadoop cluster. My admin has provided me with a username and a password and the location of the KDC server. Is it possible to use just the JAVA GSS API and the Hadoop USerGroupInformation class to access the Hadoop cluster. For a non-kerberos hadoop cluster, this would be the code snippet I would use to, say read a file from HDFS : String uname = &lt;Some username&gt;; UserGroupInformation ugi = UserGroupInformation.createRemoteUser(uname); ugi.doAs(new PrivilegedExceptionAction&lt;Void&gt;(){ public Void run() throws Exception { HdfsConfiguration hdfsConf = new HdfsConfiguration(); ... SETUP Configuration ... FileSystem fs = FileSystem.get(hdfsConf); ... Use 'fs' to read/write etc ... } }); Now for a secure cluster, I am also provided the kerberos password for the user.. Could someone please provide me with what are the exact changes I need to make to the above code snippet to first access the KDC and do a kinit and then proceed with the HDFS operation Please remember, in the environment I am planning to deploy the Java app, I might not have 'kinit' installed locally, so invoking the kinit process from within java is not an option. Thanks in advance..
has answer: http://stackoverflow.com/a/28203992
has answer: http://stackoverflow.com/a/21642921
tagged with: security
tagged with: kerberos
answer count: 2
tagged with: jaas
score: 3
downvote count: 0
favorite count: 0
type: UnansweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/31993513
tagged with: java

http://stackoverflow.com/comment/31927912
type: AnswerComment
type: Comment
score: 1
has text: But it is totally restricted to exactly this format of the formular And I guess this is wath peter.petrov wanted to demonstrate.
comment on: http://stackoverflow.com/a/21202246

http://stackoverflow.com/comment/31974052
type: Comment
comment on: http://stackoverflow.com/a/21228030
type: AnswerComment
has text: @user3214036: Don't add the code to the comments - edit it into your question.
score: 0

http://stackoverflow.com/q/21304106
has comment: http://stackoverflow.com/comment/32108125
has comment: http://stackoverflow.com/comment/32109524
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/32108176
tagged with: parse-platform
answer count: 0
has comment: http://stackoverflow.com/comment/32114674
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32109288
has comment: http://stackoverflow.com/comment/32108346
has title: How to check total number of ParseQuery objects?
type: Question
has comment: http://stackoverflow.com/comment/32147877
tagged with: java
has body: I have a load-more ListView and I want to check if the current list is equal to the total number of ParseQuery objects in my class. I've tried try { query.count(); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } but it forced my app to crash. Do you have any idea how to accomplish that? public void updateData() { mListView = (ListView)getView().findViewById(R.id.animal_list); final ParseQuery&lt;Animal&gt; query = ParseQuery.getQuery(Animal.class); query.setCachePolicy(CachePolicy.NETWORK_ELSE_CACHE); query.orderByAscending("animal"); query.setLimit(mListView.getCount() + 5); query.findInBackground(new FindCallback&lt;Animal&gt;() { @Override public void done(List&lt;Animal&gt; animals, ParseException error) { if(animals != null){ mAdapter.clear(); mProgressBar.setVisibility(View.INVISIBLE); for (int i = 0; i &gt; animals.size(); i++) { mAdapter.add(animals.get(i)); if(animals.size() &gt; 20){ //here //I've set it manually with hard-coded num. 20 query.cancel(); RelativeLayout footie = (RelativeLayout) getView().findViewById(R.id.footerview); mListView.removeFooterView(footie); } } } } }); } My LogCat: 01-23 10:59:46.619: E/AndroidRuntime(16659): FATAL EXCEPTION: AsyncTask #1 01-23 10:59:46.619: E/AndroidRuntime(16659): java.lang.RuntimeException: An error occured while executing doInBackground() 01-23 10:59:46.619: E/AndroidRuntime(16659): at android.os.AsyncTask$3.done(AsyncTask.java:200) 01-23 10:59:46.619: E/AndroidRuntime(16659): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274) 01-23 10:59:46.619: E/AndroidRuntime(16659): at java.util.concurrent.FutureTask.setException(FutureTask.java:125) 01-23 10:59:46.619: E/AndroidRuntime(16659): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308) 01-23 10:59:46.619: E/AndroidRuntime(16659): at java.util.concurrent.FutureTask.run(FutureTask.java:138) 01-23 10:59:46.619: E/AndroidRuntime(16659): at java.util.concurrent.ThreadPoolExecutor.r…
has comment: http://stackoverflow.com/comment/32109099
tagged with: listview

http://stackoverflow.com/q/21189385
has comment: http://stackoverflow.com/comment/32132805
type: UnansweredQuestion
tagged with: spring
score: 11
has title: Code quality rule for finding non threadsafe singleton spring implementations
has body: Is there any Checkstyle, PMD or Findbugs rule which could find the following non threadsafe spring singleton implementation? private String helperVar; public String getValue(String value) { helperVar = value; return convertValue(); } private String convertValue() { return helperVar.trim(); } I know this sample is horrible but it is the easiest way to show what I mean. When executing the getValue method from the bean in a single execution it would work fine. But when executing it in a multi user environment it would lead to unpredictable errors/behaviour. Is there a way to find these occurences without going through the code manually? Are there any static code checkers which could check this and each variation of it automatically?
tagged with: pmd
tagged with: java
has comment: http://stackoverflow.com/comment/31904785
has comment: http://stackoverflow.com/comment/31921508
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31904634
downvote count: 0
tagged with: findbugs
favorite count: 0
has answer: http://stackoverflow.com/a/21226010
has comment: http://stackoverflow.com/comment/31912247
has comment: http://stackoverflow.com/comment/31938848
upvote count: 11
has answer: http://stackoverflow.com/a/21313677
tagged with: checkstyle

http://stackoverflow.com/comment/31950694
comment on: http://stackoverflow.com/q/21214949
score: 0
type: Comment
type: QuestionComment
has text: +1 to the Q for not being "Please do this for me even though I haven't tried"

http://stackoverflow.com/a/21209050
downvote count: 3
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21208325
has comment: http://stackoverflow.com/comment/31941422
has body: Straight from the documentation: To provide customized error handling, implement ErrorListener interface and use the setErrorListener method to register an instance of the implmentation with the Transformer. The Transformer then reports all errors and warnings through this interface. If an application does not register its own custom ErrorListener, the default ErrorListener is used which reports all warnings and errors to System.err and does not throw any Exceptions. Applications are strongly encouraged to register and use ErrorListeners that insure proper behavior for warnings and errors. For transformation errors, a Transformer must use this interface instead of throwing an Exception: it is up to the application to decide whether to throw an Exception for different types of errors and warnings. Note however that the Transformer is not required to continue with the transformation after a call to fatalError(TransformerException exception). Now in your case , since your TransformThis class is implementing ErrorListener. you should be able to transform Errors with the following : transformer.setErrorListener(this);
score: -2
has comment: http://stackoverflow.com/comment/31944933

http://stackoverflow.com/q/21244626
downvote count: 8
answer count: 2
has answer: http://stackoverflow.com/a/21244658
has answer: http://stackoverflow.com/a/21244858
tagged with: program-entry-point
tagged with: println
has comment: http://stackoverflow.com/comment/32003653
has comment: http://stackoverflow.com/comment/32003643
has body: Say I have allot of code like.. " System.out.println("This is code"); System.out.println("This is code"); System.out.println("This is code"); System.out.println("This is code"); " This same code keeps coming up in my program can I shorten it all into one line I can just use to call it in the future??
score: -6
favorite count: 0
has title: How do I recall code in java without rewriting it?
has comment: http://stackoverflow.com/comment/32003613
type: UnansweredQuestion
tagged with: java
type: Question
upvote count: 2

http://stackoverflow.com/comment/31978554
has text: OK, so your XML file isn't well-formed and you are getting an error telling you it's not well formed. What more do you want?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21227824

http://stackoverflow.com/q/21231885
tagged with: java
has title: How to send cookies over URL connection
type: Question
score: 0
answer count: 1
tagged with: urlconnection
has comment: http://stackoverflow.com/comment/31981507
type: UnansweredQuestion
has body: I am trying to set Cookies and request headers via URL connection. Here is the client side code UUID = request.getHeader("UUID"); conn.addRequestProperty("Cookie", iPlanetDirectoryPro); conn = url.openConnection(); conn.setDoOutput(true); objOstr = new OutputStreamWriter(conn.getOutputStream()); objOstr.write(res); One server side i am trying a retrieve the cookie using "iPlanetDirectoryPro" as the cookie name. But i am getting null. What is the mistake i am doing here? If i set as conn.addRequestProperty("iPlanetDirectoryPro", iPlanetDirectoryPro); then what is the difference between cookie-and-string-in-request-header https://stackoverflow.com/questions/21226475/difference-between-cookie-and-string-in-request-header
has answer: http://stackoverflow.com/a/21232129
tagged with: cookies

http://stackoverflow.com/comment/32069619
type: AnswerComment
score: 0
type: Comment
has text: Remove the spaces in the end of the property
comment on: http://stackoverflow.com/a/21282509

http://stackoverflow.com/comment/32100233
type: QuestionComment
comment on: http://stackoverflow.com/q/21299679
score: 0
has text: ooooh that's cool, definitely spending my next 15 mins on that article
type: Comment

http://stackoverflow.com/q/21330747
has title: How to get the image to cell in TableViewer?
accepted answer: http://stackoverflow.com/a/21348166
upvote count: 1
type: Question
tagged with: java
has body: I created a TableViewer ( jface ). I want in some cases to hidden the image.( to control on the visible of the image ) The logic is done in different class and not in the tableViewer. How I can get the cell and then the to control the image visibility ? .( I know the name of the cell and it is always the first cell in the tableviewer ) //The gridViewer Class public class MyGridViewer extends TableViewer { public MyGridViewer (Composite parent) { super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); final Table table = this.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); this.setContentProvider(new MyModelProvider()); } } @Override protected void inputChanged(Object input, Object oldInput) { removeColumn(); tableCol = new TableViewerColumn(this, SWT.NONE); column = tableCol.getColumn(); column.setText(dataColumnHeader.getName()); column.setWidth(100); column.setResizable(true); column.setMoveable(true); tableCol.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { DataRow r = (DataRow) element; DataCell c = r.getDataCellByName(dataColumnHeader.getName()); if (c != null &amp;&amp; c.getValue() != null) { return c.getValue().toString(); } return null; } @Override public Image getImage(Object element) { //Add my imgae } }); editingSupport = new StringCellEditingSupport(this, dataColumnHeader); tableCol.setEditingSupport(editingSupport); super.inputChanged(input, oldInput); }
downvote count: 0
answer count: 1
score: 1
has answer: http://stackoverflow.com/a/21348166
favorite count: 0
tagged with: jface
type: AnsweredQuestion

http://stackoverflow.com/q/21339543
answer count: 1
has comment: http://stackoverflow.com/comment/32171871
tagged with: preferences
has body: So I am trying to update values in my timers.java class when a preference is changed. Here is the value in my timers.java final boolean soundEnabledPref = sharedPref.getBoolean(spawnTimers.KEY_PREF_SOUND, false); I have called that in the onCreate and if I change a preference, go back 2 screens to main.java and then relaunch timers.java the change will work, however if i just go into preferences and then back out to timers.java the change does not take effect Here is my settingsFragment.java import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.os.Bundle; import android.preference.PreferenceFragment; public class settingsFragment extends PreferenceFragment implements OnSharedPreferenceChangeListener { public static final String KEY_PREF_SOUND_SETTINGS = "pref_key_sounds_settings"; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences); onSharedPreferenceChanged(null, ""); } @Override public void onResume() { super.onResume(); // Set up a listener whenever a key changes getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); } @Override public void onPause() { super.onPause(); // Unregister the listener whenever a key changes getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this); } @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (key.equals(KEY_PREF_SOUND_SETTINGS)) { boolean soundEnabledPref = sharedPreferences.getBoolean(spawnTimers.KEY_PREF_SPAWNSOUND, false); } } } im guessing what i have in onSharedPreferenceChanged is not correct? Not really sure what i need to put into the If statement to get the value change of the boolean back to timers.java any help would be greatly appreciated! Thanks! EDIT: someone posted an answer which sort of fixed the problem I have changed my o…
has comment: http://stackoverflow.com/comment/32172493
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21339872
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32171285
has title: onSharedPreferenceChanged not updating preference
score: 0
has comment: http://stackoverflow.com/comment/32172158
has comment: http://stackoverflow.com/comment/32172570
has answer: http://stackoverflow.com/a/21339872

http://stackoverflow.com/q/21294160
has comment: http://stackoverflow.com/comment/32106418
has answer: http://stackoverflow.com/a/71086308
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: apache-camel
accepted answer: http://stackoverflow.com/a/21312964
answer count: 2
downvote count: 0
favorite count: 0
has body: I see that this question has been asked a number of times but none of post helped or had a conclusive solution. I am splitting a message and then aggregating it using Aggregator2. The code was throwing exception because oldExchange was always null. So to test I designed a small code. I read an orders,xml file which looks like this <Orders xmlns="http://some/schema/Order"> 1 2 3 5 6 My camel Context Looks like this <camel:route> <camel:from uri="file:src/data/catask/test?noop=true"/> <camel:log message="${body}"></camel:log> <camel:split> <camel:xpath>//te:Orders/*</camel:xpath> <camel:to uri="direct:logQueries"/> <camel:to uri="direct:aggegateQueries"/> </camel:split> </camel:route> <camel:route> <camel:from uri="direct:logQueries"/> <camel:log message="After the call : \n ${body}"></camel:log> </camel:route> <camel:route> <camel:from uri="direct:aggegateQueries"/> <camel:aggregate strategyRef="aggrTask" completionInterval="8000" > <camel:correlationExpression> <camel:xpath>//te:Order</camel:xpath> </camel:correlationExpression> <camel:to uri="file:src/data/catask/output?fileName=output.xml"/> </camel:aggregate> </camel:route> My Aggregation Strategy class looks like this public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { if (oldExchange == null) { System.out.println("Returning new exchange"); return newExchange; } String oldBody = oldExchange.getIn().getBody(String.class); String newBody = newExchange.getIn().getBody(String.class); oldExchange.getIn().setBody(oldBody + "+" + newBody); return oldExchange; } The problem is that when the aggregated result is saved in output.xml file it contains only the last record it read from Orders.xml. i.e. 6 I looked into it further and found that this was happening because after the first call oldExchange should have some value but it turns out it is always null. I think that because it is reading everything from a single file and splitting it, there is only exchange. > Any suggestions?? UPDATE 1: Per Claus …
has title: Apache Camel - Split and aggregate - Old Exchange is always null
has answer: http://stackoverflow.com/a/21312964
score: 2
upvote count: 2
possible better answer: http://stackoverflow.com/a/71086308
tagged with: spring

http://stackoverflow.com/comment/32129881
type: Comment
comment on: http://stackoverflow.com/q/21316533
type: QuestionComment
has text: how deep you want to go? from java to assembly??
score: 1

http://stackoverflow.com/comment/32162823
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21335313
type: AnswerComment
has text: An `AsyncTask` is rarely the right answer in a service, as the point behind an `AsyncTask` is to allow some work to be done on the main application thread, which is almost never needed in a service.

http://stackoverflow.com/q/21205321
has title: a recursive instantiating of objects?
answer count: 1
has answer: http://stackoverflow.com/a/21205396
has comment: http://stackoverflow.com/comment/31933735
accepted answer: http://stackoverflow.com/a/21205396
has comment: http://stackoverflow.com/comment/31932948
favorite count: 0
has comment: http://stackoverflow.com/comment/31932957
has body: public class ran { ran obj1 = new ran();//will this create a recursive instantiating of objects?? public String s = null; public static void main(String[] args) { ran obj2 = new ran(); obj2.s = "main"; obj2.obj1.s = "secondary"; System.out.println(obj2.obj1.s); } } the above code gives a stack overflow error..so what is exactly happening here? the obj2 is instantiated ,with it is instantiated obj1,and obj1 then again instantiates another object of ran class and a chain is formed?? if so then is there a workaround without making obj1 as static ? on special behest of buddy hovercraft.. edit to question=i was trying to replicate a self referential structure ,like the one used in c/c++ in linked lists
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31933182
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31933205
has comment: http://stackoverflow.com/comment/31933162
type: Question
has comment: http://stackoverflow.com/comment/31932903
score: 3
has comment: http://stackoverflow.com/comment/31932972
has comment: http://stackoverflow.com/comment/31932900
upvote count: 3
has comment: http://stackoverflow.com/comment/31933292
has comment: http://stackoverflow.com/comment/31933102

http://stackoverflow.com/a/24660072
type: Answer
answers question: http://stackoverflow.com/q/21304937
has body: the issue was with the site which was handling login log out . The form values were stored in there till the authentication was completed. while returning the values after authentication process it failed to return all the values.
score: 0

http://stackoverflow.com/a/21199389
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31981758
type: Answer
has comment: http://stackoverflow.com/comment/31957632
accepted answer of: http://stackoverflow.com/q/21193985
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21193985
has comment: http://stackoverflow.com/comment/31930025
has body: You really need to restructure your app. You can't do it the way you want. Try creating a JDialog set it up as you like with input fields and an OK/Cancel button. Then to show the dialog do: MyDialog dialog = new MyDialog(null, true); //true = modal //dialog.setModalityType(ModalityType.DOCUMENT_MODAL); //or specify modal here dialog.setVisible(true); //waits until dialog is closed if (dialog.wasAccepted()) { //grab values from dialog dialog.getCanvas(); } In the dialog you would have: private boolean accepted = false; public boolean wasAccepted() {return accepted;} public Canvas getCanvas() {return canvas;} public ? getWhateverElseYouWant() {return ...;} The OK button would: accepted=true; dispose(); The Cancel button would: accepted=false; dispose(); The JDialog will pump events while it's visible. So the setVisible() function will halt execution until the dialog is closed. That should work better, and then you can return many user input fields. You can even change the JDialog constructor to pass default value(s) in.
has comment: http://stackoverflow.com/comment/31989867
has comment: http://stackoverflow.com/comment/31934559

magic-numbers
tag name: magic-numbers
tags question: http://stackoverflow.com/q/21313846
type: Tag

http://stackoverflow.com/a/21220341
accepted answer of: http://stackoverflow.com/q/21220300
type: Answer
answers question: http://stackoverflow.com/q/21220300
upvote count: 2
has body: The problem is that Android can't find a method called com.example.aoutsu.AddNewItem, so at least one of those applies: 1) The class com.example.aoutsu is not defined 2) You've called incorrectly your package and should be the above 3) You've not defined this Activity in your AndroidManifest.xml file. By the way, to debug those exceptions, always try to find a line that references to any of your files. In this case: 01-19 17:36:09.206: E/AndroidRuntime(487): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.aoutsu/com.example.aoutsu.AddNewItem}; have you declared this activity in your AndroidManifest.xml? Then simply put that text in google ant try to find something that probably thousands of users before you have happened.
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32034483
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21262528
has text: The OP didn't ask how to maintain order. The OP asked why it is.

http://stackoverflow.com/q/21198074
has comment: http://stackoverflow.com/comment/31920584
answer count: 3
accepted answer: http://stackoverflow.com/a/21198101
has title: why my code "Bouncing ball" doesn't work?
upvote count: 0
has answer: http://stackoverflow.com/a/21198162
tagged with: user-interface
tagged with: events
has comment: http://stackoverflow.com/comment/31921229
favorite count: 0
has body: I'm trying to write a code a bout a bouncing ball, but i'm stuck in how to make the ball bounced. The code seems correct, no wrong messages from eclipse and yet the ball doesn't move. Any help/hint is appreciate. Here's my code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class BouncingBallTest extends JFrame { private JButton jbtStart = new JButton("Start"); private JButton jbtStop = new JButton("Stop"); private Ball canvas = new Ball(); public BouncingBallTest() { JPanel panel = new JPanel(); // Use the panel to group buttons panel.add(jbtStart); panel.add(jbtStop); add(canvas, BorderLayout.CENTER); // Add canvas to centre add(panel, BorderLayout.SOUTH); // Add panel to south // register listener jbtStart.addActionListener(new StartBouncingBallTest()); jbtStop.addActionListener(new StopBouncingBallTest()); } // the main method public static void main(String[] args) { JFrame frame = new BouncingBallTest(); frame.setTitle("Bouncing Ball Test"); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(470, 300); frame.setVisible(true); } class StartBouncingBallTest implements ActionListener { // inner class @Override public void actionPerformed(ActionEvent e) { canvas.StartBouncingBallTest(); } } class StopBouncingBallTest implements ActionListener { // inner class @Override public void actionPerformed(ActionEvent e) { canvas.StopBouncingBallTest(); } } class Ball extends JPanel { private int radius = 10; private int x; private int y; private int dx = 3; private int dy = 3; private Timer timer = new Timer(20, new TimerListener()); public void StartBouncingBallTest() { if (x &gt; 0 &amp;&amp; y &gt; 0) { x += dx; y += dy; } else if (x == 0) { x -= dx; y += dy; } else if (y + (2 * radius) &gt; getHeight()) { x += dx; y -= dy; } else if (y == 0) { x += dx; y -= dy; } else if (x + (2 * radius) &gt; getWidth()) { x -= dx; y += dy; } repaint(); timer.start(); } public void StopBouncingBallTest() { t…
possible better answer: http://stackoverflow.com/a/21198119
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21198119
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/21198101
tagged with: swing
type: Question
tagged with: actionlistener
score: -2

http://stackoverflow.com/a/21294356
has body: It is incredibly trivial. In your algorithm, you swap indicies i and j if inList[i] has a larger value than inList[j]. Simply change the boolean logic when you swap them (i.e. i is smaller than j). ... for (int i=0; i&lt;(inList.length-1); i++) { for (int j=i+1; j&lt;inList.length; j++) { if (inList[i].compareTo(inList[j]) &lt; 0) { // &lt;--Changing the operator to LT temp = inList[i]; inList[i] = inList[j]; inList[j] = temp; } }
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21294213
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21294213
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/21222864
has comment: http://stackoverflow.com/comment/31966097
score: 1
has title: PrimeFaces components are not displayed
favorite count: 0
linked to: http://stackoverflow.com/q/6028105
has answer: http://stackoverflow.com/a/21225561
has comment: http://stackoverflow.com/comment/31968036
accepted answer: http://stackoverflow.com/a/21225561
has body: I'm developing an application using JSF with PrimeFaces. I've a problem in the Facelets page where < p:xxx > tags are not displayed in the page. Every < p: xxx > tags are diplayed like a simple inputText. This is the start of my xhtml page and this part of the web.xml page Faces Servlet /faces/* *.jsf *.xhtml I've got also the primefaces-4.0.jar in the folder WEBContent/WEB-INF/lib/primefaces-4.0.jar
type: AnsweredQuestion
tagged with: jsf
has comment: http://stackoverflow.com/comment/31968404
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/18940644
has comment: http://stackoverflow.com/comment/31966605
tagged with: primefaces
tagged with: http://stackoverflow.com/tag/xhtml
duplicate of: http://stackoverflow.com/q/18940644
has comment: http://stackoverflow.com/comment/31965519
tagged with: servlets
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/32165930
type: AnswerComment
has text: Yes, for example if in strings.xml, you have pref_sound and then in preference set android:key="@string/pref_sound", you can use it here as: boolean soundEnabledPref = sharedPref.getBoolean(getString(R.string.pref_sound), true);
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21336413

http://stackoverflow.com/comment/31926811
comment on: http://stackoverflow.com/q/21201678
has text: Probably not, because your pc is probably on private network. You could do it if they both were on same network, ie. wifi.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/21270354
accepted answer: http://stackoverflow.com/a/21270449
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/32055156
upvote count: 0
has title: troublesome regular expression in java
has body: i was hoping someone could help me understand why this happens: String s = "tbody\n" +"a\n" +"/tbody"; Pattern p = Pattern.compile("tbody[^(/tbody)]+/tbody"); Matcher m = p.matcher(s); while(m.find()){ System.out.println("found: \n\n"+m.group()); } Output is: found: tbody a /tbody But if String s = "tbody\n" +"ao\n" +"/tbody" (I added an o after the a) it prints nothing. Can anyone tell me what I am missing? I'm using NetBeans 7.4.
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/1732348
has answer: http://stackoverflow.com/a/21270449
tagged with: regex
has comment: http://stackoverflow.com/comment/32049151
downvote count: 1
has comment: http://stackoverflow.com/comment/32054437
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32048678

http://stackoverflow.com/a/21299334
answers question: http://stackoverflow.com/q/21299107
upvote count: 1
downvote count: 0
has body: You could try the following solution. See comments for more information about what it is doing. public static void main(String args[]) throws java.io.IOException { List&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("A"); list.add("B"); list.add("A"); list.add("B"); list.add("C"); list.add("D"); Collections.sort(list); // Sort 'list' List&lt;ArrayList&lt;String&gt;&gt; arrays = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(); // Store final results int k = 0; // To keep index of the arrays in 'arrays' for (int i = 0; i &lt; list.size();) { // No increment since it is incremented by 'i += count' inside the body int count = Collections.frequency(list, list.get(i)); // Get number of occurrences of an element arrays.add(new ArrayList&lt;String&gt;()); // When its a new String, add a new ArrayList for (int j = 0; j &lt; count; j++) { arrays.get(k).add(list.get(i)); // Add 'number of occurrences' times the String } i += count; // Increment to skip elements that were already added (repeated elements) k++; } // Just to print the final array for (ArrayList&lt;String&gt; arr : arrays) { for (String s : arr) { System.out.print(s + " "); } System.out.println(); } } Output: A A B B C D
type: Answer
score: 1

http://stackoverflow.com/a/21263295
downvote count: 0
score: 1
upvote count: 1
has body: public class MainActivity extends Activity { should be public class MainActivity extends Activity implements OnClickListener { There can be other reasons for the crash as well in which case it is better you post the stacktrace. You can do as below using annonymous inner class mBtn1.setOnClickListener(new OnClickListener() { public void onClick(View v) { // do something } });
type: Answer
answers question: http://stackoverflow.com/q/21263263

http://stackoverflow.com/comment/32004519
has text: I need to get a string "Mon Jan 20 18:26:25 BRT 2014" and convert to "dd/MM/yyyy". Your answer is not right.
comment on: http://stackoverflow.com/a/21244960
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21319128
has comment: http://stackoverflow.com/comment/32134897
has comment: http://stackoverflow.com/comment/32134942
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32134773
tagged with: performance
score: 1
accepted answer: http://stackoverflow.com/a/21319411
has comment: http://stackoverflow.com/comment/32134682
tagged with: java
tagged with: optimization
answer count: 2
has comment: http://stackoverflow.com/comment/32134955
downvote count: 0
possible better answer: http://stackoverflow.com/a/21319267
tagged with: sorting
has title: Efficient way to sort a list by several comparators in Java
has answer: http://stackoverflow.com/a/21319267
favorite count: 0
has comment: http://stackoverflow.com/comment/32135035
has body: Sorry for my English. I have something like this: class SomeClass&lt;T&gt; { private List&lt;T&gt; elements; private List&lt;Comparator&lt;T&gt;&gt; comparators; public SomeClass(List&lt;T&gt; elements) { this.elements = elements; this.comparators = new ArrayList&lt;Comparator&lt;T&gt;&gt;(); } public void addComparator(Comparator&lt;T&gt; comparator) { comparators.add(comparator); } public List&lt;T&gt; getSortedElements() { return sorted(new ArrayList&lt;T&gt;(elements)); } // !!! At the moment I use very inefficient way // !!! to sort elements by several comparators. private List&lt;T&gt; sorted(List&lt;T&gt; toSort) { // I need to use stable sort. // Collections.sort(...) is guaranteed to be stable for (Comparator&lt;T&gt; comparator : comparators) { Collections.sort(toSort, comparator); } return toSort; } } Can I optimize sorted() method ? Maybe this can be done using a single sorting of collection by using combined comparator? (instead of sorting several times with each of comparators) (But I have to use a stable sort, and last-added comparators have a higher priority than comparators added at the beginning) UPDATE: I use sorting by several comparators to sort elements by different attributes (for example, by priority, name, etc.)
has answer: http://stackoverflow.com/a/21319411
has comment: http://stackoverflow.com/comment/32134708
type: AnsweredQuestion

digital-signature
tags question: http://stackoverflow.com/q/21225888
tag name: digital-signature
type: Tag
tags question: http://stackoverflow.com/q/21263419

http://stackoverflow.com/comment/31991416
has text: @njzk2 Yes, for get and put operations it would be similar. For other operations it becomes more complicated, see my comment to DwB answer.
score: 0
comment on: http://stackoverflow.com/q/21237220
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21305396
has comment: http://stackoverflow.com/comment/32110282
downvote count: 1
has comment: http://stackoverflow.com/comment/32113215
type: Answer
has comment: http://stackoverflow.com/comment/32113555
upvote count: 0
has body: use arr = (int[]) att.clone(); or you can use Array.copyOf method too!!! instead of arr=att
answers question: http://stackoverflow.com/q/21305215
score: -1

http://stackoverflow.com/q/21268239
has title: How should I process really really large amounts of text in Java?
tagged with: text-processing
accepted answer: http://stackoverflow.com/a/21268461
type: AnsweredQuestion
has body: I'm trying to tokenize a large amount of text in Java. When I say large, I mean entire chapters of books at a time. I wrote the first draft of my code by using a single page from a book and everything worked fine. Now that I'm trying to process entire chapters things aren't working. It processes part of the chapter correctly and then it just stops. Below is all of the relevant code File folder = new File(Constants.rawFilePath("eng")); FileHelper fileHelper = new FileHelper(); BPage firstChapter = new BPage(); BPage firstChapterSpanish = new BPage(); File[] allFiles = folder.listFiles(); //read the files into memory ArrayList&lt;ArrayList&lt;String&gt;&gt; allPages = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(); //for the english for(int i=0;i&lt;allFiles.length;i++) { String filePath = Constants.rawFilePath("/eng/metamorph_eng_"+String.valueOf(i)+".txt"); ArrayList&lt;String&gt; pageToAdd = fileHelper.readFileToMemory(filePath); allPages.add(pageToAdd); } String allPagesAsString = ""; for(int i=0;i&lt;allPages.size();i++) { allPagesAsString = allPagesAsString+fileHelper.turnListToString(allPages.get(i)); } firstChapter.setUnTokenizedPage(allPagesAsString); firstChapter.tokenize(Languages.ENGLISH); folder = new File(Constants.rawFilePath("spa")); allFiles = folder.listFiles(); //for the spanish for(int i=0;i&lt;allFiles.length;i++) { String filePath = Constants.rawFilePath("/eng/metamorph_eng_"+String.valueOf(i)+".txt"); ArrayList&lt;String&gt; pageToAdd = fileHelper.readFileToMemory(filePath); allPages.add(pageToAdd); } allPagesAsString = ""; for(int i=0;i&lt;allPages.size();i++) { allPagesAsString = allPagesAsString+fileHelper.turnListToString(allPages.get(i)); } firstChapterSpanish.setUnTokenizedPage(allPagesAsString); firstChapterSpanish.tokenize(Languages.SPANISH); fileHelper.writeFile(firstChapter.getTokenizedPage(), Constants.partiallyprocessedFilePath("eng_ch_1.txt")); fileHelper.writeFile(firstChapterSpanish.getTokenizedPage(), Constants.partiallyprocessed…
has comment: http://stackoverflow.com/comment/32045184
linked to: http://stackoverflow.com/q/4645020
has comment: http://stackoverflow.com/comment/32045573
has comment: http://stackoverflow.com/comment/32045530
type: Question
has comment: http://stackoverflow.com/comment/32045460
has comment: http://stackoverflow.com/comment/32044911
answer count: 1
has comment: http://stackoverflow.com/comment/32045104
tagged with: performance
has comment: http://stackoverflow.com/comment/32044848
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32044868
has answer: http://stackoverflow.com/a/21268461
has comment: http://stackoverflow.com/comment/33481755

http://stackoverflow.com/a/21260399
score: 1
upvote count: 1
has body: The parameter dir is not where your executable is located. It is the directory where it will be executed. &lt;exec executable="C:/Program Files/Java/jdk1.7.0_25/bin/jarsigner.exe"&gt; If you want to keep the exec like it was, you'll need to set resolveexecutable parameter to true. From Ant manual: When this attribute is true, the name of the executable is resolved firstly against the project basedir and if that does not exist, against the execution directory if specified. On Unix systems, if you only want to allow execution of commands in the user's path, set this to false. since Ant 1.6
answers question: http://stackoverflow.com/q/21238954
downvote count: 0
has comment: http://stackoverflow.com/comment/32035580
type: Answer

http://stackoverflow.com/a/21299582
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21299460
answers question: http://stackoverflow.com/q/21299460
type: Answer
score: 1
has body: I think in.nextInt() does not automatically go to the next line. So you are reading the rest of that first line as blank. Try replacing in.reset() with in.nextLine()
upvote count: 1

http://stackoverflow.com/comment/32001693
has text: Does it run? It's possible IntelliJ just can't figure out the impl for your persistence repo.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21243330

excel
tags question: http://stackoverflow.com/q/21278813
tags question: http://stackoverflow.com/q/21227964
tags question: http://stackoverflow.com/q/21325941
tags question: http://stackoverflow.com/q/21199849
tags question: http://stackoverflow.com/q/21184478
tags question: http://stackoverflow.com/q/21300634
tag name: excel
tags question: http://stackoverflow.com/q/21328972
tags question: http://stackoverflow.com/q/21306863
tags question: http://stackoverflow.com/q/21302057
tags question: http://stackoverflow.com/q/21216432
tags question: http://stackoverflow.com/q/21195449
tags question: http://stackoverflow.com/q/21326217
tags question: http://stackoverflow.com/q/21251986
tags question: http://stackoverflow.com/q/21284880
tags question: http://stackoverflow.com/q/21196970
tags question: http://stackoverflow.com/q/21285515
type: Tag
tags question: http://stackoverflow.com/q/21345574
tags question: http://stackoverflow.com/q/21287535
tags question: http://stackoverflow.com/q/21193588
tags question: http://stackoverflow.com/q/21221942
tags question: http://stackoverflow.com/q/21254977
tags question: http://stackoverflow.com/q/21277967

http://stackoverflow.com/q/21199644
type: Question
has body: I set up a server/client chat program. What's supposed to happen is a server is setup that can A) read from clients, A2) take what's read from clients and send it to all other clients or B) take input from the console to write to clients. The clients can read from the server and ask it to send messages (which are also read from the console). There are three files : Maim.java (will be used for other purposes later; now is just boilerplate for the Server class) Host.java (server) Client.java (client) You're supposed to open one terminal and run Maim which starts a server, then open another terminal and run Client, which runs the client. However, messages are NOT being transmitted between the two, which is odd because streams and sockets are being successfully set up and if you allow 'null's to be sent ( i.e.: (message = in.readLine()) vs. ((message = in.readLine()) != null) ), 'null's WILL be sent. But only 'null's and nothing else. Anyways, here's the code : Maim : import java.io.*; import java.util.*; public class Maim { static final int port = 9001; static final String localhost = "localhost"; public static void main(String[] args) throws IOException { Scanner nameReader = new Scanner(System.in); System.out.println("What will your name be ? (Currently this feature is unused)"); new Host(nameReader.nextLine()).setUpServer(); } } Host : import java.net.*; import java.io.*; import java.util.*; public class Host { Socket clientReader; String name; private ArrayList&lt;ClientReader&gt; clients; public Socket getSocket() { return clientReader; } public Host(String name) { this.name = name; } public void setUpServer(){ clients = new ArrayList&lt;ClientReader&gt;(); try { ServerSocket server = new ServerSocket(Maim.port); System.out.println("Server set up without fail. Now awaitting clients."); this.clientReader(server); } catch (IOException e) { System.out.println("Failure setting up server on host's network."); e.printStackTrace(); } } public void clientReader(ServerSock…
has title: Server/client not sending or receiving data through socket [Java]?
has comment: http://stackoverflow.com/comment/31923506
tagged with: chat
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21199767
has comment: http://stackoverflow.com/comment/31923465
has answer: http://stackoverflow.com/a/21199740
type: UnansweredQuestion
tagged with: sockets
tagged with: client
tagged with: java
has comment: http://stackoverflow.com/comment/31923622

http://stackoverflow.com/a/21234219
score: 1
downvote count: 0
has body: Best way do it use profiles, as said above. You can use multiple xml-files, where file name is parametrized ${env} variable. root xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" <import resource="classpath:etc/abc-${env}.xml" /> ... <beans abc-three.xml:(if ${env} == three) classpath:/resources/one.sql classpath:/resources/two.sql classpath:/resources/three.sql abc-two.xml:(if ${env} == two) classpath:/resources/one.sql classpath:/resources/two.sql
type: Answer
answers question: http://stackoverflow.com/q/21233726
upvote count: 1

http://stackoverflow.com/a/21340919
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21340136
has body: In the project properties under Java Build Path -> Order and Export make sure that "Android Private Libraries" and "Android Dependencies" are checked. Then clean and try again.

http://stackoverflow.com/a/21305340
type: Answer
has body: You probably wanted to just make the thread sleep, and that is the name of the method you needed to call. You called Object#wait(), which is a thread coordination method, and you used an explicit timeout on it (a rather short one). My guess is that NetBeans is warning you about that timeout because normally we use Object#wait without a timeout, and if we use the timeout, we don't wait in a loop. Now, NetBeans will also warn you about using Thread.sleep() in a loop because normally, if you want to schedule a repeated task (that is what you are doing), you will use a ScheduledExecutorService. That service is able to serve a lot of different scheduled tasks around your application, all with a single thread. Writing Thread.sleep() explicitly in a loop needlessly hogs a whole thread (a heavyweight system resource) to do nothing but sleep most of the time.
accepted answer of: http://stackoverflow.com/q/21305107
answers question: http://stackoverflow.com/q/21305107
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/31992665
type: QuestionComment
has text: Just read, what encapsulation is: http://en.wikipedia.org/wiki/Encapsulation_%28object-oriented_programming%29
comment on: http://stackoverflow.com/q/21238467
score: 0
type: Comment

http://stackoverflow.com/comment/31966936
comment on: http://stackoverflow.com/a/21217867
type: Comment
has text: If Species is a class and Snake has a field type Species, then it is probably a snake n --- 1 species relationship. Not aggregation or composition. Just a many to 1 relationship. This is assuming maybe a zoo application which might have many snakes of the same species.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31956342
type: Comment
type: QuestionComment
has text: It will thrown an Exception. Read the source.
score: 0
comment on: http://stackoverflow.com/q/21218364

http://stackoverflow.com/q/21228384
has title: Count occurrences of elements inside array? (Java)
tagged with: element
answer count: 7
has body: I have been working on trying to figure out this algorithm for about 6 hours now and can't seem to come up with a solution. I am trying to count the occurrences of elements inside an array and may two more separate arrays. One for the unique instances, and one for how many times these instances occurs. I found some other thinks on here about array lists and hashMaps, but I am only able to use arrays. For example, I have this array (already sorted): {cats, cats, cats, dog, dog, fish} I am trying to get make an array for the instances, so: {cats, dog, fish} And finally, how many times these instances occur: {3, 2, 1} Here is the code i have so far: public void findArrs( String[] words ) { int counter = 1; for(int i = 0; i &lt; words.length - 1; i++){ if(!(words[i].equals(words[i+1]))){ counter++; } } String[] unique = new String[counter]; int[] times = new int[counter]; for(int i = 0; i &lt; words.length; i++){ } } This is all the code I have after all my attempts.
favorite count: 0
has answer: http://stackoverflow.com/a/28321794
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31974340
has answer: http://stackoverflow.com/a/21229050
has answer: http://stackoverflow.com/a/39545494
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/21228564
type: Question
has comment: http://stackoverflow.com/comment/31974717
has answer: http://stackoverflow.com/a/21228843
tagged with: arrays
downvote count: 0
tagged with: find-occurrences
has answer: http://stackoverflow.com/a/21229298
has comment: http://stackoverflow.com/comment/31974469
has answer: http://stackoverflow.com/a/21229252

http://stackoverflow.com/comment/35020418
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22871825
type: Comment
has text: Of course: https://github.com/tsabirgaliev/javaee-6-maven/blob/master/src/test/resources/arquillian.xml

http://stackoverflow.com/q/21238199
favorite count: 0
tagged with: security
has comment: http://stackoverflow.com/comment/31993641
has comment: http://stackoverflow.com/comment/31993409
has comment: http://stackoverflow.com/comment/31992489
has title: Java 1.7.51 internet restrictions for applets
linked to: http://stackoverflow.com/q/19440354
has answer: http://stackoverflow.com/a/21264128
has comment: http://stackoverflow.com/comment/31993381
upvote count: 5
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31992451
has comment: http://stackoverflow.com/comment/31992490
tagged with: java
has answer: http://stackoverflow.com/a/21247298
has body: In the previous months I developed a sandbox Java applet for an academic project. I wasn't able to sign it with a trusted Certificate Authority because of the restricted budget. With the release of Java 1.7.51 I found that the new security restrictions forbid the execution of the applet, because of the lack of signature. Until now, I have found two rough solutions to this problem: ask the user to include the applet page on his/her exception lists; ask the user to set the Java security level to "Medium" (which, of course, is a risky manoeuvre). Is there a way to overcome the restrictions imposed by Java with a self-signed applet without asking the user to change the security settings? I would deeply thank you for your answers, since the option to buy a trusted certificate remains an expensive one.
type: Question
linked to: http://stackoverflow.com/q/18914650
answer count: 2
score: 5
tagged with: restrictions
tagged with: applet
has comment: http://stackoverflow.com/comment/31992198
tagged with: self-signed
has comment: http://stackoverflow.com/comment/31992433

http://stackoverflow.com/comment/32098327
score: 0
type: Comment
type: QuestionComment
has text: I am not sure it can be considered an operator. After all operators are like functions that act over operands. And what are the operands the `::` operator act upon? I think it is more a syntax feature, like the `[]` or `<>`.
comment on: http://stackoverflow.com/q/21273385

http://stackoverflow.com/q/21235109
has comment: http://stackoverflow.com/comment/31986465
tagged with: jvm
possible better answer: http://stackoverflow.com/a/21235242
has answer: http://stackoverflow.com/a/21235242
linked to: http://stackoverflow.com/q/4401396
accepted answer: http://stackoverflow.com/a/21235372
upvote count: 1
tagged with: gwt
has title: GWT Compiler: Error: Could not create the Java Virtual Machine
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31986205
type: Question
answer count: 2
has body: If anyone could help me with this problem. I was running the application on Windows 64 bits e it was working fine, but I changed the computer and now it's running on 32 bits. This error could be about this or it is some configuration? EDIT: Could not reserve enough space for object heap
downvote count: 0
has answer: http://stackoverflow.com/a/21235372
favorite count: 0

http://stackoverflow.com/a/21339819
score: 0
type: Answer
has body: varAppend must be an int in textView.setText(getString(varAppend)) String android.content.res.Resources.getString(int id) throws NotFoundException public String getString (int id) Added in API level 1 Return the string value associated with a particular resource ID. It will be stripped of any styled text information. Parameters: id The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier Try Using getResources().getIdentifier() but the documentation says: use of this function is discouraged. It is much more efficient to retrieve resources by identifier than by name.
answers question: http://stackoverflow.com/q/21339565

http://stackoverflow.com/q/21189870
has body: In our team we are getting JUnit test results reports with Jenkins plugin. But we only get skipped tests (the ones with the Java annotation with @Ignore) at the package level. For the main report result window, we only get Fail and Total. Check these images: Main Test Result Report You can see there are 138 skipped tests, but no one is shown at package level in the columns. Only Fail and Total columns are shown: Package Test Result Report At the package level, skipped tests are shown indeed in the columns: Failed, Skip and Total. Is it possible to see the Skip column in the Main Test Result Report? Thanks in advance, Tomas.
tagged with: continuous-integration
has title: JUnit skipped tests NOT appearing in main report columns but appear in packages reports columns
tagged with: junit
downvote count: 0
favorite count: 0
answer count: 0
tagged with: jenkins
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: jenkins-plugins

http://stackoverflow.com/q/21328099
has comment: http://stackoverflow.com/comment/32150565
has title: NullPointerException when trying to use image resource
has comment: http://stackoverflow.com/comment/32150728
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/21329176
has body: I made a game in Java. It works completly fine in Eclipse. I exported it as a Runnable JAR. When double-clicking on it's icon, it doesn't open. So I tried running the JAR from the command line. I get a NullPointerException error, in a line of code that's trying to retrieve an image resource (as I said, it works fine inside Eclipse). This is the line of code where the error happens: ball = new ImageIcon(this.getClass().getResource("sprites/ball.PNG")); I have no idea what's wrong. Here is the structure of my project: Any ideas? I'm starting to get desperate. Thanks a lot for your help. EDIT: I tried adding a / to the beginning of sprites/ball.PNG . Didn't help. Also tried to change PNG to png. Didn't work either. Checked inside the JAR, the image is inside. I'm on Windows. Here is the stacktrace: Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.&lt;init&gt;&lt;Unknown Source&gt; at instPanel.&lt;init&gt;&lt;instPanel.java:17&gt; at Main.&lt;init&gt;&lt;Main.java:23&gt; at Main.main&lt;Main.java:38&gt; EDIT: Could the fact that I'm using (default package) be a problem?
tagged with: jar
has comment: http://stackoverflow.com/comment/32151051
has comment: http://stackoverflow.com/comment/32150685
has answer: http://stackoverflow.com/a/21328218
has comment: http://stackoverflow.com/comment/32150377
has answer: http://stackoverflow.com/a/21328462
has answer: http://stackoverflow.com/a/55632910
tagged with: nullpointerexception
possible better answer: http://stackoverflow.com/a/21328218
has answer: http://stackoverflow.com/a/21329176
favorite count: 0
has comment: http://stackoverflow.com/comment/32150468
downvote count: 0
has comment: http://stackoverflow.com/comment/32151230
answer count: 5
has answer: http://stackoverflow.com/a/21329456
linked to: http://stackoverflow.com/q/9853522
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32150673
has comment: http://stackoverflow.com/comment/32150984
tagged with: project
tagged with: java

http://stackoverflow.com/a/27510432
has comment: http://stackoverflow.com/comment/43594561
upvote count: 6
has comment: http://stackoverflow.com/comment/53020550
has comment: http://stackoverflow.com/comment/43595521
has body: I came up with another solution to rerun just failed test using maven & cucumber. 1) Record test failures using a RunNotifier public class RerunningCucumber extends Cucumber { private final String className; @SuppressWarnings("rawtypes") public RerunningCucumber(Class clazz) throws InitializationError, IOException { super(clazz); className = clazz.getSimpleName(); } @Override public void run(RunNotifier notifier) { notifier.addListener(new RunListener(){ public void testFailure(Failure failure) throws Exception { Throwable error = failure.getException(); if (error instanceof AssertionError){ //Nothing. This is a normal failure. Continue return; } //No! A wild exception has appeared! //Let's run this test again. RerunningCucumber.addFile(className); } }); super.run(notifier); } private static final String filename = "target/rerun.properties"; private static final Set<String> addedClasses = new HashSet<String>(); public static synchronized void addFile(String className) throws IOException{ //First find the file if (addedClasses.contains(className)){ return; } File file = new File(filename); if (!file.exists()){ //Need to create the file PrintWriter writer = new PrintWriter(file, "UTF-8"); writer.print("retryclasses=**/"+className+".class"); writer.close(); } else { PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(file, true))); out.print(",**/"+className+".class"); out.close(); } addedClasses.add(className); } } 2) Use custom class as a runner for the cucumber tests. This will run the tests, and whenever there is a failure, output the failed class to a file. Trick is to keep features short and create a lot of test classes to avoid repeating tests. @RunWith(RerunningCucumber.class) @CucumberOptions(features = {"classpath:features/testFeature.feature}, format = { "html:target/cucumber-html-report/testFeature.html", "json:target/cucumber-json-report/testFeature.json"}, tags = {"@testFeature"}) public class RunTestFeature { } 3) Add a Rerun profile to m…
type: Answer
score: 6
answers question: http://stackoverflow.com/q/21334207
downvote count: 0
has comment: http://stackoverflow.com/comment/110777211

http://stackoverflow.com/comment/32136917
type: QuestionComment
comment on: http://stackoverflow.com/q/21319370
score: 0
type: Comment
has text: ok using spring and hibernate what is the syntax for that? can you write a quick example or send a link to somewhere that gives a good example of what your talking about?

http://stackoverflow.com/q/21311162
has comment: http://stackoverflow.com/comment/32123580
has body: I understand the menu items to click etc but my paths for dependencies are different on one PC to another which causes no end of problems. Is there a 'cheat sheet' of settings I need to change after importing to get the project working on the second computer? Or can it be clever enough to look in the right places somehow?
has comment: http://stackoverflow.com/comment/32128430
upvote count: 1
answer count: 1
tagged with: github
favorite count: 0
has title: What is the correct method for publishing and pulling an Android Studio Gradle project to and from GitHub?
has comment: http://stackoverflow.com/comment/32126082
has comment: http://stackoverflow.com/comment/32128096
tagged with: android
has comment: http://stackoverflow.com/comment/32128269
has comment: http://stackoverflow.com/comment/32125325
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32129211
tagged with: gradle
type: Question
has answer: http://stackoverflow.com/a/21327618
accepted answer: http://stackoverflow.com/a/21327618

http://stackoverflow.com/comment/32177641
type: AnswerComment
score: 0
type: Comment
has text: @ike_love That will work too, but we already have the object; there is no need to call `getClass()` when `isInstance` will work directly on the object itself. The `isAssignableFrom` method is best used when you have the `Class` object but not the object itself.
comment on: http://stackoverflow.com/a/21339477

http://stackoverflow.com/comment/32069427
has text: @user509375 I can't reproduce your warning.
type: Comment
comment on: http://stackoverflow.com/a/21282415
score: 0
type: AnswerComment

http://stackoverflow.com/a/21263658
answers question: http://stackoverflow.com/q/21263169
accepted answer of: http://stackoverflow.com/q/21263169
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 7
upvote count: 7
has body: The padding property is not a valid property in a Label in JavaFX 2.2. In JavaFX 8, Label inherits from Region (via Control) and so inherits the padding property. So I suspect SceneBuilder is looking at JavaFX 8 in order to determine the properties. In JavaFX 2.2 there is a labelPadding property which can be set from CSS, so use

http://stackoverflow.com/q/21323353
has answer: http://stackoverflow.com/a/21323388
favorite count: 0
tagged with: android-asynctask
upvote count: 2
accepted answer: http://stackoverflow.com/a/21323489
downvote count: 2
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21323489
has title: NetworkOnMainThreadException questions?
score: 0
answer count: 2
has body: I have a class/activity called EditTrip_Activity.java in my Android project and I keep getting this NetworkOnMainThreadException. I have gotten this before and fixed it by putting my code in the doInBackground() of an AsyncTask. I am doing a similar thing here, but it doesn't seem to work and I'm not sure why... EditTrip_Activity.java public class EditTrip_Activity extends Activity { EditText txtTripName; EditText txtStartLoc; EditText txtEndLoc; EditText txtDistTravelled; EditText txtCreatedAt; Button btnSave; Button btnDelete; String tripid; // Progress Dialog private ProgressDialog pDialog; // JSON parser class JSONParser_Helpers2 jsonParser = new JSONParser_Helpers2(); // single product url private static final String url_product_details = "http://10.0.2.2/android_connect/get_product_details.php"; // url to update product private static final String url_update_product = "http://10.0.2.2/android_connect/update_product.php"; // url to delete product private static final String url_delete_product = "http://10.0.2.2/android_connect/delete_product.php"; // JSON Node names private static final String TAG_SUCCESS = "success"; private static final String TAG_TRIPS = "trips"; private static final String TAG_TRIPID = "tripid"; private static final String TAG_TRIPNAME = "tripName"; private static final String TAG_STARTINGLOCATION = "startingLoc"; private static final String TAG_ENDINGLOCATION = "endingLoc"; private static final String TAG_DISTANCETRAVELLED = "distanceTravelled"; private static final String TAG_CREATEDAT = "date"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.edit_trip); // save button btnSave = (Button) findViewById(R.id.btnSave); btnDelete = (Button) findViewById(R.id.btnDelete); // getting product details from intent Intent i = getIntent(); // getting product id (pid) from intent tripid = i.getStringExtra(TAG_TRIPID); // Getting complete product details in background thread new Get…
possible better answer: http://stackoverflow.com/a/21323388

http://stackoverflow.com/a/21228079
type: Answer
has comment: http://stackoverflow.com/comment/31981327
has body: You can use the MulticastSocket Class to do this.Here is the example http://docs.oracle.com/javase/tutorial/networking/datagrams/broadcasting.html
score: 0
answers question: http://stackoverflow.com/q/21227761

http://stackoverflow.com/q/21299096
has title: JFreeChart - How to show real-time on the X-Axis of a TimeSeries chart
has answer: http://stackoverflow.com/a/21307289
tagged with: java
linked to: http://stackoverflow.com/q/31902373
type: Question
upvote count: 2
tagged with: real-time
linked to: http://stackoverflow.com/q/21253757
answer count: 1
has body: I want to show live data on a TimeSeries chart with real time shown on the x-axis (or at least have the speed of the time the same as real-time). Here is a SSCCE of the problem with random numbers as the live input. The time shown on the x-axis is much faster than real-time (assuming it is shown in hh:mm:ss format): public class DynamicTimeSeriesChart extends JPanel { private DynamicTimeSeriesCollection dataset; private JFreeChart chart = null; public DynamicTimeSeriesChart(final String title) { dataset = new DynamicTimeSeriesCollection(1, 2000, new Second()); dataset.setTimeBase(new Second(0, 0, 0, 1, 1, 1990)); // date 1st jan 0 mins 0 secs dataset.addSeries(new float[1], 0, title); chart = ChartFactory.createTimeSeriesChart( title, "Time", title, dataset, true, true, false); final XYPlot plot = chart.getXYPlot(); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis.setFixedAutoRange(200000); // proportional to scroll speed axis = plot.getRangeAxis(); final ChartPanel chartPanel = new ChartPanel(chart); setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); add(chartPanel); } public void update(float value) { float[] newData = new float[1]; newData[0] = value; dataset.advanceTime(); dataset.appendData(newData); } public static void main(String[] args) { JFrame frame = new JFrame("testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final DynamicTimeSeriesChart chart = new DynamicTimeSeriesChart("random numbers"); frame.add(chart); frame.pack(); frame.setVisible(true); Timer timer = new Timer(100, new ActionListener() { public void actionPerformed(ActionEvent e) { EventQueue.invokeLater(new Runnable() { @Override public void run() { chart.update((float) (Math.random() * 10)); } }); } }); timer.start(); } }
favorite count: 0
linked to: http://stackoverflow.com/q/5048852
score: 2
downvote count: 0
type: UnansweredQuestion
tagged with: jfreechart
tagged with: timeserieschart

http://stackoverflow.com/comment/85320790
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/49138793
has text: I believe you have two challenges: build application which could work on all systems and Java is good choice also you can use other languages which runs on JVM, second app should interact with all these operating system platforms, and this is hell.
score: 1

http://stackoverflow.com/a/21277451
has comment: http://stackoverflow.com/comment/32062590
type: AcceptedAnswer
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21277188
has body: From Spring 3.2.x reference and introduction blog post: Prior to Spring 3.1, the context:property-placeholder namespace element registered an instance of PropertyPlaceholderConfigurer. It will still do so if using the spring-context-3.0.xsd definition of the namespace. That is, you can preserve registration of PropertyPlaceholderConfigurer through the namespace, even if using Spring 3.1; simply do not update your xsi:schemaLocation and continue using the 3.0 XSD. So, my guess is that your XMLs are not using the proper XSD version.
answers question: http://stackoverflow.com/q/21277188
downvote count: 0

http://stackoverflow.com/a/21218248
answers question: http://stackoverflow.com/q/21184541
has body: When you think "polling" or "update at intervals", use a ScheduledExecutorService to execute "check for data update" tasks at regular intervals. You do not need a daemon thread to do that, and, in my experience, working with scheduled tasks makes for code that is easier to maintain. E.g. in this case it will separate the stored_data from Threads which is a good thing because Threads do not own data (data is contained in objects which do not have to be threads, e.g. you can pass the stored_data variable to the Runnable that is executed by the thread). When you think "event driven", a daemon thread is appropriate because it will process the events as soon as they occur (no delay). You can decide to let the daemon thread do the work for the event, or create tasks for the event and let those tasks be executed by an ExecutorService like a CachedThreadPool. Have a look at the "Watching a directory" tutorial on how to receive file-system events for such a daemon thread.
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/comment/32103282
type: AnswerComment
has text: Thanks alot @GrIsHu i have tried this before not working but after your answer its doing just fine ..dont know its a maricle or something else...
type: Comment
comment on: http://stackoverflow.com/a/21300052
score: 0

http://stackoverflow.com/comment/32105434
comment on: http://stackoverflow.com/a/21302148
score: 0
type: AnswerComment
has text: so how to preserve my arraylists as when i press home come back to my app lists are empty
type: Comment

http://stackoverflow.com/comment/32057704
score: 0
type: AnswerComment
has text: I know but you can use like this : if(!list.get(0).containsValue(number)); where 0 will be your index when you add object to arraylist
type: Comment
comment on: http://stackoverflow.com/a/21275225

http://stackoverflow.com/a/21305880
has comment: http://stackoverflow.com/comment/32110846
has comment: http://stackoverflow.com/comment/32110921
has comment: http://stackoverflow.com/comment/32112925
has comment: http://stackoverflow.com/comment/32110989
has body: I think you are missing the xml version tag. Try to set xml version tag before calling androidHttpTransport.setXmlVersionTag("&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;"); androidHttpTransport.call(SOAP_ACTION, envelope); Sample Code: public static String webServiceForScriptTimeLimit() { String scriptTimeLimitResponse = null; try { SoapObject request = new SoapObject(NAMESPACE, SCRIPT_TIMELIMIT_METHOD_NAME); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); envelope.dotNet = true; envelope.implicitTypes = true; envelope.enc = SoapSerializationEnvelope.ENC2003; envelope.xsd = SoapEnvelope.XSD; envelope.xsi = SoapEnvelope.XSI; envelope.setOutputSoapObject(request); envelope.setAddAdornments(false); HttpTransportSE ht = new HttpTransportSE(SOAP_ADDRESS); ht.debug = true; ht.call(SOAP_ACTION_TIME_LIMIT, envelope); final SoapPrimitive response = (SoapPrimitive) envelope .getResponse(); scriptTimeLimitResponse = response.toString(); } catch (Exception ex) { FileLog.logInfo( "Exception ---&gt; WS_ERROR ---&gt; WebServiceUtility: webServiceForScriptTimeLimit() - " + ex.toString(), 0); } return scriptTimeLimitResponse; }
has comment: http://stackoverflow.com/comment/32147843
score: 0
answers question: http://stackoverflow.com/q/21305482
has comment: http://stackoverflow.com/comment/32116285
has comment: http://stackoverflow.com/comment/32110942
has comment: http://stackoverflow.com/comment/32110771
has comment: http://stackoverflow.com/comment/32111743
type: Answer

http://stackoverflow.com/comment/31968535
type: QuestionComment
has text: I'd say that's a dupe. I'm learning Java; moving from JavaScript -- That's a new concept to me.
comment on: http://stackoverflow.com/q/21224991
score: 0
type: Comment

http://stackoverflow.com/a/21318639
has comment: http://stackoverflow.com/comment/32134407
type: Answer
answers question: http://stackoverflow.com/q/21318422
has body: It depends on how your Algorithms are designed for parallel and concurrent solutions. There is no a criteria where parallel must be better than concurrent or viceversa. By example if your concurrent solution has many synchronized blocks it can drop your performance, in the other case maybe the communication in your parallel algorithm is minimum then there is no overhead on network. If you can get a copy o the book of Peter Pacheco it can clear some ideas:http://www.cs.usfca.edu/~peter/ipp/
score: 0

http://stackoverflow.com/q/21283649
has title: having issue in Removeall method of collection with POJO
type: Question
has body: Java collection I have two Array list one is lstreminder, and other is lstpresent, there is code below for more specification: lstintprsnt = new ArrayList&lt;Integer&gt;(); lstreminder = DAORemider.getLatestReminder(u.getName()); if (lstpresent == null || lstpresent.isEmpty()) { lstpresent = lstreminder; System.out.println("i m in if" + lstpresent); } else { System.out.println("i m in else" + lstpresent.size()); lstreminder.removeAll(lstpresent); /* at this position listreminder will be empty and do not execute loop, but still it hold values and executed loo, but if I try this with an Integer arraylist then its work fine, means it not executed loop, because it doesnt have any value */ for (Reminder r : lstreminder) { System.out.println("lst" + r.getReminderid()); lstpresent.add(r); } System.out.println("i m in else" + lstpresent); } System.out.println("out " + lstpresent); ServletActionContext.getContext().getSession().put("lstpresent", lstpresent); lstpresent.clear();
answer count: 1
score: -1
has answer: http://stackoverflow.com/a/21283836
downvote count: 1
favorite count: 0
upvote count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32071390

http://stackoverflow.com/a/21189493
answers question: http://stackoverflow.com/q/21189361
downvote count: 0
type: Answer
has body: Seems overly complex to use a builder for such a utility method. A series of static methods with apt overload signatures would do the trick fine. Not "oh my god the sky is collapsing" complexity, granted, but most consumers might consider statics "easier". Of course, if you find yourself needing 4 overloads with (String, String, String), things change I guess...
score: 1
upvote count: 1

http://stackoverflow.com/comment/32034350
has text: Edit your answer and it'll be perfect :)
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21262280
type: Comment

http://stackoverflow.com/q/21186037
tagged with: class
has comment: http://stackoverflow.com/comment/31899079
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/21186948
has title: identifier 'sqlBean' resolved to null
has comment: http://stackoverflow.com/comment/31898388
favorite count: 0
has body: I'm currently working on an sql Class for JSF website. But I've got this annoying error while trying to access my class : action="#{sqlBean.createAccount}": Target Unreachable, identifier 'sqlBean' resolved to null Here is the code : Java class: package com.tutorial; import java.sql.*; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; @ManagedBean(eager = true) @RequestScoped public class SqlBean { Connection connec; Statement flux; ResultSet res; SqlBean() { try { Class.forName("com.mysql.jdbc.Driver"); connec = DriverManager.getConnection("jdbc:mysql://localhost/epiMarket", "root", "seN?/g0u"); flux = connec.createStatement(); } catch(Exception e) { System.out.print("imposible to connect sql"); } } ResultSet command(String cmd) { try { res = flux.executeQuery(cmd); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return res; } public String createAccount() { try { flux.executeQuery("insert into epi_user values('', #{registerBean.name}, #{registerBean.surname}, '', #{registerBean.date}, #{registerBean.phone}, #{registerBean.login}, #registerBean.password)"); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return ("Register"); } } here is where i access it : &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"&gt; &lt;ui:composition template="/WEB-INF/templates/BasicTemplate.xhtml"&gt; &lt;ui:define name="content"&gt; &lt;div id="formulaire"&gt; &lt;h:form&gt; &lt;h:panelGrid columns="6"&gt; &lt;h:outputText value="Name"&gt;&lt;/h:outputText&gt; &lt;h:inputText value="#{registerBean.name}"&gt;&lt;/h:inputText&gt; &lt;h:outputText value="Surname"&gt;&lt;/h:outputText&gt; &lt;h:inputText value="#{registerBean.surname}"&gt;&lt;/h:inp…
has comment: http://stackoverflow.com/comment/31898280
type: AnsweredQuestion
tagged with: jsf
upvote count: 1
has comment: http://stackoverflow.com/comment/31899362
has answer: http://stackoverflow.com/a/21186948
type: Question
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/xhtml
has comment: http://stackoverflow.com/comment/31898704

http://stackoverflow.com/q/21309081
score: 1
tagged with: java
tagged with: apache-camel
possible better answer: http://stackoverflow.com/a/21375596
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21310143
downvote count: 0
has body: I have a question about camel and timers. I have several timers and one of them I want update in runtime. I'm using osgi blueprint to configure proper periods. So how can I change timer(with name which I know) for example from route?
has title: Camel runtime timer change
tagged with: apache-servicemix
favorite count: 0
accepted answer: http://stackoverflow.com/a/21310143
upvote count: 1
has answer: http://stackoverflow.com/a/21375596
type: AnsweredQuestion

http://stackoverflow.com/comment/32184293
type: Comment
type: QuestionComment
has text: what is line number **62** in `map.java`
score: 2
comment on: http://stackoverflow.com/q/21346603

http://stackoverflow.com/q/21223159
linked to: http://stackoverflow.com/q/3247746
tagged with: web-services
linked to: http://stackoverflow.com/q/6244993
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31974550
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21233640
accepted answer: http://stackoverflow.com/a/21233640
has comment: http://stackoverflow.com/comment/31967224
has title: Securing a webservice with https in an OSGi bundle
tagged with: security
score: 0
has body: I want to secure the communication for a webservice component published with endpoint.publish() in an OSGi bundle. Therefor I'm struggling with three questions. How can I use a certificate in a truststore to build a https publisher using just the IP? As this bundle is running on an embedded computer without a machines name known to the client consuming the service. How do I load the *.jks keystore in my bundle? As there's another classpath I can't find the *.jks file using e.g. new File(./truststore.jks). Yes, I found similiar questions here, but they didn't work. I wan't to implement some kind of authentication. For now I send a username and password in the header files (that's the reason I want to secure the communication at first). Is there a way not to check the username/password in the header in every webservice method call? As I have about 20 published methods and copying the same check-code is odd. Runtime is Java 1.6, equinox 3.7.1. The client is another web application (using php). In general, are there best practises for secure publishing webservices (in respect to OSGi bundles especially)? Thanks in advance!
has comment: http://stackoverflow.com/comment/31984071
answer count: 1
tagged with: osgi

http://stackoverflow.com/q/21267616
has comment: http://stackoverflow.com/comment/32044757
answer count: 0
tagged with: dynamic
tagged with: java
has body: I specifically want to change the width of all scrollbars (JScrollBar) dynamically - is this possible? I was thinking that it would be best to write a custom ScrollbarUI, but I haven't been able to find any information on altering a ComponentUI dynamically. edit: My approach so far is to have a static int that's referenced for the scrollbar width, which I then change. This predictably does nothing, as the scrollbars have no reason to think they need to be repainted. I want to avoid having a list of all scrollbars in my application, as this would sort of defeat the purpose of changing the ScrollbarUI; however, it may be necessary. In summary, I'm looking to change the width of every scrollbar in my application dynamically using ComponentUI. I was able to solve this problem from this answer: How to set a default preferred size (redefining UI) in a *ComponentUI class (Swing app)?
type: Question
has comment: http://stackoverflow.com/comment/32043743
has comment: http://stackoverflow.com/comment/32043636
linked to: http://stackoverflow.com/q/12642369
has comment: http://stackoverflow.com/comment/32044798
score: 0
has title: Can I change a custom ComponentUI dynamically?
tagged with: user-interface
type: UnansweredQuestion

http://stackoverflow.com/comment/32180487
comment on: http://stackoverflow.com/q/21344507
type: Comment
type: QuestionComment
score: 1
has text: please attach whole dependency:tree

http://stackoverflow.com/comment/31946123
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21212402
has text: Are you looking for diagonals that start from the four corners, or any possible diagonal?

http://stackoverflow.com/comment/31927816
has text: There is no downcasting happening here.
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/21202293

http://stackoverflow.com/comment/31931814
comment on: http://stackoverflow.com/a/21204671
has text: thank, the second way is working! How can I now close the first frame afterwards?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21284569
accepted answer: http://stackoverflow.com/a/21285158
tagged with: hibernate
has title: ManyToOne Multiple Join Columns, One is Default Value
upvote count: 3
answer count: 1
tagged with: jpa
has body: Class A has a composite primary key which is created using an Embeddable. In Class B, I reference Class A from a ManyToOne relationship. However, Class B only has one of the columns of the composite primary key from Class A. For the other value, I would like it to be a default value. Is this possible? I've tried using multiple join columns but that doesn't work because the second column doesn't exist anywhere in the table. I've also thought that maybe there is a solution that uses Transient but I'm not really sure how that would work.
favorite count: 0
tagged with: spring
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
score: 3
has answer: http://stackoverflow.com/a/21285158

http://stackoverflow.com/a/21265176
score: 0
type: AcceptedAnswer
has body: Your usage of PdfCopy.setMergeFields() is correct and your merging code is fine. The issues you described are because of bugs that have crept into 5.4.5. They should be fixed in rev. 6152 and the fixes will be included in the next release. Thanks for bringing this to our attention.
type: Answer
accepted answer of: http://stackoverflow.com/q/21189981
answers question: http://stackoverflow.com/q/21189981

http://stackoverflow.com/comment/31908380
comment on: http://stackoverflow.com/q/21191481
type: Comment
has text: I don't know how it exactly works underneath, but in some cases, you might see the code drawing the content on the fly on the screen. Ie: you can already see unfinished drawing cycles.
score: 0
type: QuestionComment

http://stackoverflow.com/q/21313104
linked to: http://stackoverflow.com/q/2520821
has comment: http://stackoverflow.com/comment/32130410
has comment: http://stackoverflow.com/comment/32123699
tagged with: java
score: 0
tagged with: noclassdeffounderror
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32123559
has comment: http://stackoverflow.com/comment/32130196
has body: I have put the rest-assured-2.2.0.jar in my Eclipse workspace (for an Android app) and added it to the buildpath of the project as referenced library. Then I imported: import com.jayway.restassured.RestAssured; import static com.jayway.restassured.RestAssured.*; import static com.jayway.restassured.matcher.RestAssuredMatchers.*; import static org.hamcrest.Matchers.*; But still if I do RestAssured.given(); I get Caused by: java.lang.NoClassDefFoundError: com.jayway.restassured.internal.ResponseParserRegistrar If I look inside the jar file I can find a ResponseParserRegistrar.class file on the right place, so it does exist. If I try to import it it does not complain: import com.jayway.restassured.internal.ResponseParserRegistrar; But it still gives the error. What did I forget or do wrong? EDIT Now I've created a blank new Android app with the following MainActivity: package com.example.testrestassured; import com.example.testrestassured.R; import android.app.Activity; import android.os.Bundle; import com.jayway.restassured.RestAssured; import com.jayway.restassured.RestAssured.*; import com.jayway.restassured.internal.ResponseParserRegistrar; import com.jayway.restassured.matcher.RestAssuredMatchers.*; public class MainActivity extends Activity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_layout); RestAssured.given(); } } The project has only one referenced library: rest-assured-2.2.0.jar (correct spelling). Still I get the same problem E/AndroidRuntime(13142): Caused by: java.lang.NoClassDefFoundError: com.jayway.restassured.internal.ResponseParserRegistrar EDIT Changing to rest-assured-2.3.0.jar (new version) and adding json-schema-validator-2.3.0.jar and it's big list of dependencies did not fix it either. I've tried to find the runtime classpath, but I can't find it in the menus of ADT.
has title: NoClassDefFoundError: ResponseParserRegistrar
has comment: http://stackoverflow.com/comment/32130075
has comment: http://stackoverflow.com/comment/32124146
type: UnansweredQuestion
tagged with: rest-assured
has comment: http://stackoverflow.com/comment/32123598
has comment: http://stackoverflow.com/comment/32288057
has comment: http://stackoverflow.com/comment/32130248
type: Question
answer count: 2
tagged with: android
has answer: http://stackoverflow.com/a/21313194
has answer: http://stackoverflow.com/a/21314088

executorservice
type: Tag
tags question: http://stackoverflow.com/q/21256274
tag name: executorservice
tags question: http://stackoverflow.com/q/21241036
tags question: http://stackoverflow.com/q/21231135
tags question: http://stackoverflow.com/q/21268784
tags question: http://stackoverflow.com/q/21216892

http://stackoverflow.com/comment/31983146
type: Comment
type: QuestionComment
has text: I want concat some other string with randomUUIDString with this and further i want to split cancat string again
comment on: http://stackoverflow.com/q/21233382
score: 0

http://stackoverflow.com/q/21269461
score: 19
type: Question
has answer: http://stackoverflow.com/a/21269597
has comment: http://stackoverflow.com/comment/32047495
linked to: http://stackoverflow.com/q/8208546
has title: How does Java handle division by zero?
accepted answer: http://stackoverflow.com/a/21269611
has comment: http://stackoverflow.com/comment/32047138
has comment: http://stackoverflow.com/comment/32047292
possible better answer: http://stackoverflow.com/a/21269623
has comment: http://stackoverflow.com/comment/32047416
duplicate of: http://stackoverflow.com/q/8208546
has comment: http://stackoverflow.com/comment/32047168
has answer: http://stackoverflow.com/a/21269623
has comment: http://stackoverflow.com/comment/32047193
has body: Does it simply check if divisor is different from zero every time there is division done (even in JIT-ed code)? I mean how VM manages to throw an exception without being previously killed by the OS?
has comment: http://stackoverflow.com/comment/32047090
has answer: http://stackoverflow.com/a/21269611
has comment: http://stackoverflow.com/comment/32047551
downvote count: 1
upvote count: 20
tagged with: java
has comment: http://stackoverflow.com/comment/32047325
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32047133
tagged with: divide-by-zero
has comment: http://stackoverflow.com/comment/32047228
favorite count: 0
has answer: http://stackoverflow.com/a/21270280

http://stackoverflow.com/q/21316076
has answer: http://stackoverflow.com/a/21316179
accepted answer: http://stackoverflow.com/a/21316179
answer count: 3
has answer: http://stackoverflow.com/a/21325506
linked to: http://stackoverflow.com/q/3061759
favorite count: 0
has body: interface Base&lt;T extends Base&gt; { T method(); } Against this pattern design interface Base { Base method(); } The only, I guess, with method() in Base I can get the specific type. Are there more benefits?
possible better answer: http://stackoverflow.com/a/21316148
has comment: http://stackoverflow.com/comment/32129040
has title: What is the benefit of this design pattern?
upvote count: 12
downvote count: 0
tagged with: java
tagged with: design-patterns
type: Question
type: AnsweredQuestion
tagged with: oop
has answer: http://stackoverflow.com/a/21316148
score: 12

http://stackoverflow.com/a/21341389
downvote count: 0
answers question: http://stackoverflow.com/q/21341027
has body: Is this what you are looking for? public class KPM { /** * Search the data byte array for the first occurrence of the byte array pattern within given boundaries. * @param data * @param start First index in data * @param stop Last index in data so that stop-start = length * @param pattern What is being searched. '*' can be used as wildcard for "ANY character" * @return */ public static int indexOf( byte[] data, int start, int stop, byte[] pattern) { if( data == null || pattern == null) return -1; int[] failure = computeFailure(pattern); int j = 0; for( int i = start; i &lt; stop; i++) { while (j &gt; 0 &amp;&amp; ( pattern[j] != '*' &amp;&amp; pattern[j] != data[i])) { j = failure[j - 1]; } if (pattern[j] == '*' || pattern[j] == data[i]) { j++; } if (j == pattern.length) { return i - pattern.length + 1; } } return -1; } /** * Computes the failure function using a boot-strapping process, * where the pattern is matched against itself. */ private static int[] computeFailure(byte[] pattern) { int[] failure = new int[pattern.length]; int j = 0; for (int i = 1; i &lt; pattern.length; i++) { while (j&gt;0 &amp;&amp; pattern[j] != pattern[i]) { j = failure[j - 1]; } if (pattern[j] == pattern[i]) { j++; } failure[i] = j; } return failure; } }
type: Answer
upvote count: 7
score: 7
has comment: http://stackoverflow.com/comment/95867454

http://stackoverflow.com/comment/31966017
type: QuestionComment
has text: Where are the images stored in relationship to the project? Are they stored within the source/resources or one the file system relative to where the program is executed...?
comment on: http://stackoverflow.com/q/21223502
type: Comment
score: 0

http://stackoverflow.com/comment/32089683
score: 1
type: Comment
type: QuestionComment
has text: Im all good with that, but HOW do I do this in Spring MVC? I assume I am using freemarker, but how do I get to the engine from a controller.
comment on: http://stackoverflow.com/q/21293337

http://stackoverflow.com/comment/31918086
comment on: http://stackoverflow.com/a/21196668
type: Comment
score: 1
has text: Oh! thank you very much! is this that I want! Thank you so much!
type: AnswerComment

http://stackoverflow.com/a/21267242
has comment: http://stackoverflow.com/comment/32124597
downvote count: 0
answers question: http://stackoverflow.com/q/21185802
score: 1
has comment: http://stackoverflow.com/comment/32113547
upvote count: 1
has comment: http://stackoverflow.com/comment/32055960
has body: Disclaimer: though I managed to use PayPal web services API around 2 years ago, it was kind of cumbersome to do, so I'll advise you to use REST API, since it looks like PayPal fails to keep web service API consistent. However, I'll try to give you hints on how to use web service API from PayPal: It seems you are doing everything right, the problem is in PayPalSvc.wsdl file, because it references eBLBaseComponents.xsd file which should be located next to PayPalSvc.wsdl file. If you navigate to url in browser https://www.paypalobjects.com/wsdl/eBLBaseComponents.xsd you'll see that that file exists at that location. Same goes for CoreComponentTypes.xsd and EnhancedDataTypes.xsd files which are also referenced by PayPalSvc.wsdl file. Now, I quickly tried to use Apache CXFs wsdl2java utility to generate client classes and it gave me the same error you have. I don't know why those utilities are expecting those xsd files to be located in https://www.paypalobjects.com/wsdl/PayPalSvc.wsdl/ location. So, what you can do to bypass this problem is to: Download PayPalSvc.wsdl, CoreComponentTypes.xsd, eBLBaseComponents.xsd and EnhancedDataTypes.xsd files to your computer Put them all into single folder on your computer Run the utility again pointing to the local PayPalSvc.wsdl file If file not found error is shown, try to find that file on the web, download it and try again In case of any problems - add comments, I (or somebody else) will try to help Hope this helps...
has comment: http://stackoverflow.com/comment/32123353
type: Answer
has comment: http://stackoverflow.com/comment/32106075
has comment: http://stackoverflow.com/comment/32066579

http://stackoverflow.com/a/21581256
type: Answer
has body: Maybe one of these approaches: Either: You outsource the xml files AND the java classes (like the utility class) that need access to them into a seperate library which you can then include into your several other projects (conveniently as maven dependencies). Or: You put these xml files into a seperate VCS-tree or repository and you include them in your project tree (e.g. as an "external" in SVN). So you can update this reference seperately in your projects, but you only have to maintain one source file.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21315549
upvote count: 2

http://stackoverflow.com/comment/32076762
has text: apache httpd can't run java services, unless you want to run the thing in CGI mode and fire up a JVM for every request. That's why there's tomcat.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21286742

http://stackoverflow.com/q/21316634
tagged with: int
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21316717
has comment: http://stackoverflow.com/comment/32130301
tagged with: variables
has comment: http://stackoverflow.com/comment/32129862
has body: I've ran into a few problems with my code. I'll highlight the errors in bold (asterisks **) :) Thanks in advance (code highlighted has this error: x cannot be resolved to a variable") package com.cmnatic.reborn.gui; public class Bitmap { public final int width; public final int height; public final int[] pixels; public Bitmap(int width, int height) { this.width = width; this.height = height; pixels = new int[width * height]; } public void draw(Bitmap bitmap, int xOffs, int yOffs) { for (int y = 0; y&lt;bitmap.height; y++) { int yPix = y+yOffs; if (yPix&lt;0 || yPix&gt;=height) continue; for(int xPix = 0; **x**&lt;bitmap.width; x++) { int **xPix** = **x+x0ffs**; if (xPix&lt;0 || xPix&gt;=width) continue; pixels[xPix+yPix*width] = bitmap.pixels[x + y * bitmap.width]; } } } } Also, I've got an odd problem which I'm not sure about: (code below highlighted has the following error: "Duplicate local variable xPix" for(int xPix = 0; **x**&lt;bitmap.width; x++) { int **xPix** = **x+x0ffs**; if (xPix&lt;0 || xPix&gt;=width) continue; Thanks in advance, CMNatic
has answer: http://stackoverflow.com/a/21316698
type: UnansweredQuestion
has title: x cannot be resolved to a variable
tagged with: pixel
tagged with: java
type: Question

http://stackoverflow.com/q/21324358
has comment: http://stackoverflow.com/comment/32144179
has comment: http://stackoverflow.com/comment/32143953
score: 0
has comment: http://stackoverflow.com/comment/32144390
has comment: http://stackoverflow.com/comment/32144294
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32144164
has comment: http://stackoverflow.com/comment/32143979
tagged with: java
has title: How can I know, how many EditText user add?
has answer: http://stackoverflow.com/a/21324473
has answer: http://stackoverflow.com/a/21324532
has body: I inflate an EditText and I setId(i++) | static int i = 0; and this is the code : buttonAdd.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View addOne = layoutInflater.inflate(R.layout.row, null); final EditText textOut = (EditText)addOne.findViewById(R.id.textout); Button buttonRemove = (Button)addOne.findViewById(R.id.remove); buttonRemove.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ((LinearLayout) addOne.getParent()).removeView(addOne); } }); container.addView(addOne); textOut.setId(i++); }}); so, if I add an EditText, the Id will be 0 and if I add another EditText, the Id will be 1 .. etc so, the user can select how many EditText he want, right ? if the user add 3 EditText for example How can my code knows ? for example, if I want sum all the values of EditText, and the user add 3 EditTixt I will do this ( EditText one = (EditText)findViewById(0) ) + ( EditText dodo = (EditText)findViewById(1) ) + ( EditText dodo = (EditText)findViewById(2) ) But, if I don't know how many EditTixt the user will add ! what can I do ? thank you.
type: Question
answer count: 2

http://stackoverflow.com/comment/31903993
type: AnswerComment
type: Comment
has text: @crush because that does not work, `A` is a type parameter, not a concrete type.
score: 1
comment on: http://stackoverflow.com/a/21189135

http://stackoverflow.com/comment/32004607
comment on: http://stackoverflow.com/q/21245140
score: 0
type: Comment
type: QuestionComment
has text: Sorry, returns false, my fail.

http://stackoverflow.com/comment/87289000
score: 0
type: Comment
has text: What if we don't have any DB to store this much value?can we use hash table and BST in that scenario?
comment on: http://stackoverflow.com/a/21247635
type: AnswerComment

http://stackoverflow.com/q/21245687
tagged with: tomcat7
type: Question
tagged with: java
tagged with: jboss
has comment: http://stackoverflow.com/comment/32731741
has answer: http://stackoverflow.com/a/21312306
answer count: 1
downvote count: 0
has title: resteasy-cdi breaks deployment to Tomcat 7
tagged with: tomcat
favorite count: 0
tagged with: resteasy
has comment: http://stackoverflow.com/comment/32749164
has comment: http://stackoverflow.com/comment/32007646
has body: I am developing a simple REST server using resteasy 3.0.6.Final, which is deployed to tomcat 7.0.50. According to the official doc, there are basically two ways to do it: using ServletContainerInitializer, which is implemented in the package resteasy-servlet-initializer. using web.xml and servlet dispatcher. I have tried the approaches and they both worked for me. Now I want to add CDI support using WELD, and to do that I need to add the dependency org.jboss.resteasy resteasy-cdi 3.0.6.Final to my war/WEB-INF/lib. However, this breaks the deployment. Tomcat shows only the following error message in catalina.out: Jan 20, 2014 10:24:06 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Error filterStart Jan 20, 2014 10:24:06 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Context [/storage] startup failed due to previous errors There are many suggestions online about removing resteasy-cdi. So Why is resteasy-cdi breaking the deployment? Is there a ticket documenting the problem? How can I integrate resteasy with WELD otherwise? Thanks for any help. Update 1 After a session of debugging, the issue turns out to be very simple: resteasy-cdi needs a concrete CDI implementation to work, which means I should include org.jboss.weld.servlet weld-servlet in my build. Another note is on configuring WELD mentioned in the official doc. When I include these two listeners in my web.xml, org.jboss.weld.servlet.WeldInitialListener org.jboss.weld.servlet.WeldTerminalListener I got the following error in my localhost.log Jan 20, 2014 11:55:40 PM org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context initialized event to listener instance of class org.jboss.weld.servlet.WeldInitialListener java.lang.IllegalStateException: Singleton is not set. Is your Thread.currentThread().getContextClassLoader() set correctly? I am not sure if the doc is wrong, but replacing the listeners with org.jboss.weld.environment.servlet.Listene…
has comment: http://stackoverflow.com/comment/32798634
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/21312306
has comment: http://stackoverflow.com/comment/32005658
upvote count: 2

http://stackoverflow.com/q/21207679
answer count: 2
score: 5
has body: I am using Kaltura API in my android App. I can use several API calls but each time I am trying to use a method includes in commons-codec-1.4.jar I get error and the App crashes. This is my LogCat: 01-18 19:38:27.863: E/AndroidRuntime(21488): FATAL EXCEPTION: main 01-18 19:38:27.863: E/AndroidRuntime(21488): java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString 01-18 19:38:27.863: E/AndroidRuntime(21488): at org.apache.commons.codec.digest.DigestUtils.md5Hex(DigestUtils.java:226) 01-18 19:38:27.863: E/AndroidRuntime(21488): at com.kaltura.client.KalturaClientBase.signature(KalturaClientBase.java:583) 01-18 19:38:27.863: E/AndroidRuntime(21488): at com.kaltura.client.KalturaClientBase.extractParamsFromCallQueue(KalturaClientBase.java:491) 01-18 19:38:27.863: E/AndroidRuntime(21488): at com.kaltura.client.KalturaClientBase.doQueue(KalturaClientBase.java:247) 01-18 19:38:27.863: E/AndroidRuntime(21488): at com.kaltura.client.services.KalturaMediaService.add(KalturaMediaService.java:65) 01-18 19:38:27.863: E/AndroidRuntime(21488): at adi.apps.wedding.MyProfile.onClick(MyProfile.java:120) 01-18 19:38:27.863: E/AndroidRuntime(21488): at android.view.View.performClick(View.java:4240) 01-18 19:38:27.863: E/AndroidRuntime(21488): at android.view.View$PerformClick.run(View.java:17721) 01-18 19:38:27.863: E/AndroidRuntime(21488): at android.os.Handler.handleCallback(Handler.java:730) 01-18 19:38:27.863: E/AndroidRuntime(21488): at android.os.Handler.dispatchMessage(Handler.java:92) 01-18 19:38:27.863: E/AndroidRuntime(21488): at android.os.Looper.loop(Looper.java:137) 01-18 19:38:27.863: E/AndroidRuntime(21488): at android.app.ActivityThread.main(ActivityThread.java:5103) 01-18 19:38:27.863: E/AndroidRuntime(21488): at java.lang.reflect.Method.invokeNative(Native Method) 01-18 19:38:27.863: E/AndroidRuntime(21488): at java.lang.reflect.Method.invoke(Method.java:525) 01-18 19:38:27.863: E/AndroidRuntime(21488): at com.android.internal.os.ZygoteInit$Me…
has title: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString
downvote count: 0
has comment: http://stackoverflow.com/comment/31937294
favorite count: 0
tagged with: kaltura
tagged with: android
possible better answer: http://stackoverflow.com/a/26298516
has comment: http://stackoverflow.com/comment/45220892
has answer: http://stackoverflow.com/a/26298516
has comment: http://stackoverflow.com/comment/31939015
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21538477
type: Question
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/31937354
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/21538477
linked to: http://stackoverflow.com/q/9126567

http://stackoverflow.com/comment/31913659
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21192636
has text: yes "gateway known as"
score: 0

http://stackoverflow.com/comment/32182155
comment on: http://stackoverflow.com/a/21343491
has text: @YouSof `cout << numbers[i][j]` prints out the element at row index `i` and column index `j`. So, for example, based on your image (https://i.sstatic.net/x4551.png), the element in row number 4 and column number 8 is 49. it is equivalent to `System.out.print(numbers[i][j]);` in Java
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32052970
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21261379
has text: Ready is a very basic program and Andrew you post this on alot of my stuff lol but i dont think they choose tis in there curriculum
score: 0

http://stackoverflow.com/comment/32148883
comment on: http://stackoverflow.com/a/21327152
score: 0
type: Comment
has text: @NarendraPathai True. I'm on the way to get the link.
type: AnswerComment

http://stackoverflow.com/a/21267553
answers question: http://stackoverflow.com/q/21267457
downvote count: 1
has comment: http://stackoverflow.com/comment/32046476
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/32043901
has body: If your question is how to send/receive messages over a socket, the following is one way to do it. To send: String message = "..." // message to send output = new DataOutputStream(socket.getOutputStream()); output.writeInt(message.getBytes().length); // first you send how long the message is output.write(message.getBytes(), 0, message.getBytes().length); // then you send the message And to read: DataInputStream input = new DataInputStream(socket.getInputStream()); if(input.available() &gt; 0) { // important - makes sure the code doesn't "block" and wait for input byte[] bytes = new byte[input.readInt()]; // makes a byte[] of the size of the message it's going to read input.read(bytes,0,bytes.length); // reads the actual message to the byte array String message = new String(bytes,0,bytes.length,"UTF-8"); // convert the message back into a String } You should see Socket#getOutputStream() and Socket#getInputStream(), and then use methods in the DataInputStream and DataOutputStream class. input.ava As for your other question, if you want a client to be able to send messages to specific other client(s), the client must know exactly which client(s) it wants to send the message to. When the client sends a message to the server, that information has to be part of the message. The server would use that to selectively send the message to specific Sockets. There would have to be a system in place of course. For example, for a chat app each client might have a username. You could have a global class HashSet&lt;User&gt; variable - where a User has a Socket and a String (username). The client's message to the server could then be a (series of) username(s) followed by the actual message. The server would then iterate through the HashSet&lt;User&gt; and send the actual message only to Users with matching usernames. Source: I'm making a chat app right now as well, and this is how I'm doing it. That's not to say there aren't other ways, or even better ways.
has comment: http://stackoverflow.com/comment/32045869
score: -1

http://stackoverflow.com/q/21254093
upvote count: 5
has answer: http://stackoverflow.com/a/25952292
has title: running Hibernate 4.3 with JMX (without spring)
has body: I'm running a java webapp (wicket 6.13) using Hibernate 4.3 and Guice 1.0 I'm trying to configure Hibernate so that I can access runtime information via the JMX framework. I'm not using spring, can anyone indicate how I enable the JMX on hibernate 4.3 manually. I've poked around the JmxService, JmxServiceInitiator, JmxServiceImpl, StandardServiceRegistryImpl I've also found the following settings in AvailableSettings: "hibernate.jmx.enabled"; "hibernate.jmx.usePlatformServer"; "hibernate.jmx.agentId"; "hibernate.jmx.defaultDomain"; "hibernate.jmx.sessionFactoryName"; I've added the jmx.enabled true setting to my hibernate.cfg.xml file but this has had no effect. I'm still not sure how to go about this. Any help much appreciated
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21567731
tagged with: jmx
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/38798389
has answer: http://stackoverflow.com/a/21508660
tagged with: java
tagged with: hibernate
type: Question
possible better answer: http://stackoverflow.com/a/38798389
accepted answer: http://stackoverflow.com/a/21508660
score: 5

http://stackoverflow.com/a/21324804
has body: This works if you return different response when it is successful and it doesn't include key "error". JSONObject jsonObject = new JSONObject(response); bool isError = false; //I checke for one error you can do same for other errors and warning as well. You can directly check this from array. if(jsonObject.has("error")) { String error = jsonObject.getString("error"); if(errror == "no user_id passed") { isError = true; } } if(!isError) { //continue what you were doing. }
has comment: http://stackoverflow.com/comment/32144747
score: 0
has comment: http://stackoverflow.com/comment/32144948
type: Answer
has comment: http://stackoverflow.com/comment/32144693
answers question: http://stackoverflow.com/q/21324476

http://stackoverflow.com/comment/32045184
type: Comment
comment on: http://stackoverflow.com/q/21268239
type: QuestionComment
has text: @keshlam I don't get an error message. I haven't been able to find a bug. It will process the first 2 or 3 pages without any problem. Even when I step through the code it doesn't look like anything is going wrong and I can step all the way through.
score: 0

jframe
tags question: http://stackoverflow.com/q/21189688
tags question: http://stackoverflow.com/q/21346013
tags question: http://stackoverflow.com/q/21298547
tags question: http://stackoverflow.com/q/21274414
tags question: http://stackoverflow.com/q/21325792
tags question: http://stackoverflow.com/q/21309485
tag name: jframe
tags question: http://stackoverflow.com/q/21223055
tags question: http://stackoverflow.com/q/21199600
tags question: http://stackoverflow.com/q/21339367
tags question: http://stackoverflow.com/q/21304396
tags question: http://stackoverflow.com/q/21199595
tags question: http://stackoverflow.com/q/21192908
tags question: http://stackoverflow.com/q/21228932
tags question: http://stackoverflow.com/q/21252467
tags question: http://stackoverflow.com/q/21217446
tags question: http://stackoverflow.com/q/21213854
tags question: http://stackoverflow.com/q/21225569
tags question: http://stackoverflow.com/q/21228509
tags question: http://stackoverflow.com/q/21281014
tags question: http://stackoverflow.com/q/21215298
tags question: http://stackoverflow.com/q/21244147
tags question: http://stackoverflow.com/q/21286659
tags question: http://stackoverflow.com/q/21339505
tags question: http://stackoverflow.com/q/21343942
tags question: http://stackoverflow.com/q/21331998
tags question: http://stackoverflow.com/q/21254693
tags question: http://stackoverflow.com/q/21225395
tags question: http://stackoverflow.com/q/21232632
tags question: http://stackoverflow.com/q/21325201
tags question: http://stackoverflow.com/q/21323837
tags question: http://stackoverflow.com/q/21324782
tags question: http://stackoverflow.com/q/21196381
tags question: http://stackoverflow.com/q/21340018
tags question: http://stackoverflow.com/q/21334940
type: Tag
tags question: http://stackoverflow.com/q/21215056
tags question: http://stackoverflow.com/q/21215355
tags question: http://stackoverflow.com/q/21325678
tags question: http://stackoverflow.com/q/21330682
tags question: http://stackoverflow.com/q/21217093

http://stackoverflow.com/comment/32083408
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21287087
has text: @luanjot I've rewritten the code now, care to take a look at it?
score: 0

http://stackoverflow.com/comment/32061025
has text: This is correct ... if the OP even had a valid JSON Object.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21277558
type: AnswerComment

http://stackoverflow.com/a/21344757
has comment: http://stackoverflow.com/comment/32180962
has comment: http://stackoverflow.com/comment/32181128
accepted answer of: http://stackoverflow.com/q/21344065
answers question: http://stackoverflow.com/q/21344065
upvote count: 3
type: AcceptedAnswer
has body: It is a missing functionality, which could have been simple, as the entries themselves are not compressed. The easiest way, requiring a rewrite though, is the zip FileSystem: since java 7 you may use a zip file as a virtual file system: writing, renaming and moving files in them. An example. You copy a file from the normal file system into the zip file system, and later rename the file in the zip. // Create the zip file: URI zipURI = URI.create("jar:file:" + fullFilename); // "jar:file:/.../... .zip" Map&lt;String, Object&gt; env = new HashMap&lt;&gt;(); env.put("create", "true"); FileSystem zipFS = FileSystems.newFileSystem(zipURI, env, null); // Write to aFile1.txt: Path pathInZipfile = zipFS.getPath("/aFile1.txt"); BufferedWriter out = Files.newBufferedWriter(pathInZipfile, StandardCharsets.UTF_8, StandardOpenOption.CREATE_NEW); out.write("Press any key, except both shift keys\n"); out.close(); // Rename file: Path pathInZipfile2 = zipFS.getPath("/aFile2.txt"); Files.move(pathInZipfile, pathInZipfile2); zipFS.close(); In principle you could also keep your old code - without renaming. And use a zip file system just for renaming.
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/comment/32021369
has text: although switch statements with String cases have been implemented in Java SE 7
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21255198

http://stackoverflow.com/comment/112636322
comment on: http://stackoverflow.com/a/27751912
type: Comment
has text: The problem calling the proto type Person instead of ProtoPerson, is you will already have an API or Domain or DB object called Person that you are mapping from. So if you don't give the protobuf object a unique name then you have to use fully qualified types in your code.
score: 0
type: AnswerComment

http://stackoverflow.com/a/52581541
has comment: http://stackoverflow.com/comment/92098714
has body: The is related but not exactly what you asked. But I needed it and I can imagine others do to. So I had the problem in Node.js where I wanted to split a reject into call into a log and reject for clarity reject(error) into appLogger.log(error, 'error') reject(error) In normal mode, I did find and replace Find: reject(error) Replace: appLogger.log(error, 'error')\n reject(error) Then in regex mode I did a second find and replace: Find: \\n Replace \n
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21219884

http://stackoverflow.com/a/21301420
score: 0
answers question: http://stackoverflow.com/q/21301190
type: Answer
has body: START C:\temp\My_PDF_File.pdf use this command for opening from command line other wise use class desktop

http://stackoverflow.com/q/21230601
has title: ITextRenderer is not accepting the special symbols of html
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: itext
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31985680
has answer: http://stackoverflow.com/a/21276252
has body: I am using ITextRenderer to generate the pdf using HTML String, though its generate the pdf but give me error when the HTML String contain html entity like &deg,&nbsp** and so on symbol which output error as org.xml.sax.SAXParseException: The entity "deg" was referenced, but not declared. like for example String myString= **1L of water at 100°C is mixed with 1 L of water at 0°** and my java code is StringBuffer buf = new StringBuffer(); buf.append(myString); try { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.parse(new StringBufferInputStream(buf.toString())); ITextRenderer renderer = new ITextRenderer(); renderer.setDocument(doc, null); renderer.getFontResolver(); renderer.layout(); java.io.OutputStream os = response.getOutputStream(); renderer.createPDF(os); os.flush(); os.close(); } catch (Exception ex) { ex.printStackTrace(); } even added meta tag like and also some stuff like <?xml version=\'1.0\' encoding=\'UTF-8\'?> Still the same error. Any help Thanks in advance.
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21276252
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/q/21297315
accepted answer: http://stackoverflow.com/a/21330052
type: Question
has title: Hibernate Validator for proxied collection
tagged with: jpa
answer count: 2
tagged with: bean-validation
upvote count: 1
possible better answer: http://stackoverflow.com/a/21301527
has answer: http://stackoverflow.com/a/21301527
favorite count: 0
type: AnsweredQuestion
downvote count: 0
has body: I was trying to use the hibernate @Size validation on a OneToMany collection which is lazy initialized. If i am creating the parent entity with the children added in this collection, the validation is applied on trying to persist. But if i simply find the parent entity and then do a getChildren(), the validation is not applied at all. I even tried putting the annotation on the getter. so i am using @Size(max=1) but still hibernate doesn't throw any exception even if children are more than 1. even EAGER fetch does not help. As of now i had to put validation logic myself in the getter but obviously this is not the clean way. kindly let me know if someone has faced this issue before and if there is any elegant way of doing this.
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/21330052

http://stackoverflow.com/q/21321633
downvote count: 0
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/32139449
favorite count: 0
type: Question
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/32139584
has comment: http://stackoverflow.com/comment/32139284
has title: Cant access variable that was initialized in try/catch statment
has body: I am making a sound class for my game and after trying and trying i cant seem to get rid of the NullPointerException. This is happening because I cant access a variable in a try/catch statement. Here is the code: package util; import java.applet.*; import java.net.URL; public class Sound { private AudioClip audio; private URL file; public Sound(String srcfile) { try { this.file = new URL(srcfile); } catch(Exception e){} this.audio = Applet.newAudioClip(file); } public void Play() { this.audio.play(); } public void Loop() { this.audio.loop(); } public void Stop() { this.audio.stop(); } public AudioClip getAudio() { return audio; } public void setAudio(AudioClip audio) { this.audio = audio; } } Here is the error(no longer getting): Exception in thread "main" java.lang.NullPointerException at sun.applet.AppletAudioClip.&lt;init&gt;(Unknown Source) at java.applet.Applet.newAudioClip(Unknown Source) at util.Sound.&lt;init&gt;(Sound.java:19) at main.Blocks.run(Blocks.java:38) at main.Blocks.main(Blocks.java:26) After revising the old code her is the new code: package util; import java.applet.*; import java.net.URL; public class Sound { private AudioClip audio; public Sound(String srcfile) { try { this.audio = Applet.newAudioClip(new URL("file://" + srcfile)); } catch(Exception e) { Log.log(e.getMessage(), Log.ERROR); e.printStackTrace(); System.exit(1); } } public void Play() { this.audio.play(); } public void Loop() { this.audio.loop(); } public void Stop() { this.audio.stop(); } public AudioClip getAudio() { return audio; } public void setAudio(AudioClip audio) { this.audio = audio; } } I am calling Play(); but nothings happening Here is how I'm calling the method: Sound snd = new Sound("res/dev/sound.wav"); snd.Play(); Any help would be appreciated.
upvote count: 1
answer count: 1
tagged with: try-catch
has comment: http://stackoverflow.com/comment/32139290
tagged with: java
has answer: http://stackoverflow.com/a/21321726

http://stackoverflow.com/comment/31999930
score: 1
has text: In which class should i put this string? It doesn't have sense to put it in the DB class and don't want to put it on a class created just to hold variables([globar variables in java](http://stackoverflow.com/questions/4646577/global-variables-in-java)).
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21223652

http://stackoverflow.com/a/21291441
upvote count: 1
answers question: http://stackoverflow.com/q/21291366
downvote count: 0
type: Answer
has body: Post Increment(variable++) : First execute the statement then increase the value by one. Pre Increment (++variable) : First increase the value by one then execute the statement. For System.out.println(++g+" "+ ++h); this the output is of 1 1 2 2 . . . this format.
score: 1

http://stackoverflow.com/a/21217897
has comment: http://stackoverflow.com/comment/31957176
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21217806
type: Answer
has body: Myself, I would use a GridBagLayout for something like this. For instance, while this is not a perfect renditioning of your problem, and I use JTextFields where you use JLists, you get the idea: import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.util.HashMap; import java.util.Map; import javax.swing.*; @SuppressWarnings("serial") public class InputForm extends JPanel { private static final int COLUMNS = 10; private static final int GAP = 3; private static final Insets LABEL_INSETS = new Insets(GAP, GAP, GAP, 15); private static final Insets TEXTFIELD_INSETS = new Insets(GAP, GAP, GAP, GAP); private String[] labelTexts; private Map&lt;String, JTextField&gt; fieldMap = new HashMap&lt;String, JTextField&gt;(); public InputForm(String[] labelTexts) { this.labelTexts = labelTexts; setLayout(new GridBagLayout()); for (int i = 0; i &lt; labelTexts.length; i++) { String text = labelTexts[i]; JTextField field = new JTextField(COLUMNS); fieldMap.put(text, field); addLabel(text, i); addTextField(field, i); } } public String[] getLabelTexts() { return labelTexts; } private void addTextField(JTextField field, int row) { GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = 1; gbc.gridheight = 1; gbc.gridx = 1; gbc.gridy = row; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = TEXTFIELD_INSETS; gbc.weightx = 1.0; gbc.weighty = 1.0; add(field, gbc); } private void addLabel(String text, int row) { GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = 1; gbc.gridheight = 1; gbc.gridx = 0; gbc.gridy = row; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.BOTH; gbc.insets = LABEL_INSETS; gbc.weightx = 1.0; gbc.weighty = 1.0; add(new JLabel(text), gbc); } public String getFieldText(String key) { String text = ""; JTextField field = fieldMap.get(key); if (field != null) { text = field.getText(); } return text; } private static void createAndShowGui(…
answers question: http://stackoverflow.com/q/21217806
score: 2
has comment: http://stackoverflow.com/comment/31955485
has comment: http://stackoverflow.com/comment/31957493
has comment: http://stackoverflow.com/comment/31957502
downvote count: 0
has comment: http://stackoverflow.com/comment/31957266
has comment: http://stackoverflow.com/comment/31956188
has comment: http://stackoverflow.com/comment/31955523

http://stackoverflow.com/q/21189981
type: Question
has comment: http://stackoverflow.com/comment/31978318
possible better answer: http://stackoverflow.com/a/27246055
has answer: http://stackoverflow.com/a/27246055
has answer: http://stackoverflow.com/a/21265176
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27250760
answer count: 3
tagged with: itext
has body: I am working on the task of merging some input PDF documents using iText 5.4.5. The input documents may or may not contain AcroForms and I want to merge the forms as well. I am using the example pdf files found here and this is the code example: public class TestForms { @Test public void testNoForms() throws DocumentException, IOException { test("pdf/hello.pdf", "pdf/hello_memory.pdf"); } @Test public void testForms() throws DocumentException, IOException { test("pdf/subscribe.pdf", "pdf/filled_form_1.pdf"); } private void test(String first, String second) throws DocumentException, IOException { OutputStream out = new FileOutputStream("/tmp/out.pdf"); InputStream stream = getClass().getClassLoader().getResourceAsStream(first); PdfReader reader = new PdfReader(new RandomAccessFileOrArray( new RandomAccessSourceFactory().createSource(stream)), null); InputStream stream2 = getClass().getClassLoader().getResourceAsStream(second); PdfReader reader2 = new PdfReader(new RandomAccessFileOrArray( new RandomAccessSourceFactory().createSource(stream2)), null); Document pdfDocument = new Document(reader.getPageSizeWithRotation(1)); PdfCopy pdfCopy = new PdfCopy(pdfDocument, out); pdfCopy.setFullCompression(); pdfCopy.setCompressionLevel(PdfStream.BEST_COMPRESSION); pdfCopy.setMergeFields(); pdfDocument.open(); pdfCopy.addDocument(reader); pdfCopy.addDocument(reader2); pdfCopy.close(); reader.close(); reader2.close(); } } With input files containing forms I get a NullPointerException with or without compression enabled. With standard input docs, the output file is created but when I open it with Acrobat it says there was a problem (14) and no content is displayed. With standard input docs AND compression disabled the output is created and Acrobat displays it. Questions I previously did this using PdfCopyFields but it's now deprecated in favor of the boolean flag mergeFields in the PdfCopy, is this correct? There's no javadoc on that flag and I couldn't find documentation about i…
linked to: http://stackoverflow.com/q/19839445
linked to: http://stackoverflow.com/q/20656540
accepted answer: http://stackoverflow.com/a/21265176
has comment: http://stackoverflow.com/comment/31992357
tagged with: acrofields
has title: iText mergeFields in PdfCopy creates invalid pdf
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/31990995

http://stackoverflow.com/comment/32113985
comment on: http://stackoverflow.com/a/21305515
score: 0
type: AnswerComment
type: Comment
has text: The synchronized `HashMap` is a good starting point. Make sure to get familiar with concurrency synchronization basics (google is your friend). But as Jon said, this is a rather large topic and out of scope regarding the original question. Good luck.

http://stackoverflow.com/comment/32162961
type: QuestionComment
comment on: http://stackoverflow.com/q/21335359
type: Comment
has text: What exactly your requirement is?
score: 0

http://stackoverflow.com/comment/32020250
score: 5
comment on: http://stackoverflow.com/q/21254633
type: QuestionComment
has text: Please share your equals implementation...
type: Comment

http://stackoverflow.com/q/21326668
tagged with: eclipse
tagged with: launch
has title: Eclipse won't even try to open, possibly issue caused by JAVA_HOME reset
has answer: http://stackoverflow.com/a/21328206
has body: I've been having problems getting eclipse working on my 2010 Mavericks Macbook. The original problem that I was having (not the current problem) was the "You have to have Java SE 6 installed" message. I tried following the solution in this thread: Eclipse Kepler for OS X Mavericks request Java SE 6 and found that the jdk1.7.0_51.jdk file didn't exist. Before posting here I also tried setting the JAVA_HOME as suggested on another thread using this command: export JAVA_HOME /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home And found that interestingly enough, it changed the startup problem - instead of showing the SE 6 error, it wouldn't even try to open (the application icon wouldn't even briefly show on the dock) and it would lag a little bit when an open command (double-click, cmd-down arrow, opening from spotlight, etc) was used. I decided to make a thread (Eclipse does not recognize Java 7 on Mavericks, can&#39;t find jdk.1.7.0_51 to fix issue) where greg-449 pointed out that I downloaded the wrong file (runtime environment instead of development kit). Sure enought the jdk1.7.0_51.jdk file appeared, and I followed the instructions in the first thread I linked to above. But I'm still getting the issue where Eclipse seems like it won't even attempt to open. I tried setting JAVA_HOME to what appeared to be the actual "home" directory (/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home) but I'm still getting the same issue. Anyone know how to fix this? Did I screw up badly somewhere along the way? Any answer is appreciated.
tagged with: crash
downvote count: 0
has answer: http://stackoverflow.com/a/21327188
has answer: http://stackoverflow.com/a/21327895
favorite count: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/21327188
possible better answer: http://stackoverflow.com/a/21327895
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/21301581
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/19563766
score: 1
tagged with: java

http://stackoverflow.com/comment/31972993
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21227076
has text: I do not want just a simple right alignment. the example I gave it just one way to get the customisation of subview, however, I'll be doing more complex stuffs, which are beyonds the static rules of android's enumeration.
score: 0

http://stackoverflow.com/q/21255826
has comment: http://stackoverflow.com/comment/32022457
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32022566
tagged with: libraries
tagged with: http://stackoverflow.com/tag/jpeg
has title: extract image from image
has answer: http://stackoverflow.com/a/21256061
tagged with: java
type: Question
answer count: 2
has body: Is it possible to extract an image from a jpeg, png or tiff file? NOT PDF! Suppose I have a file containing both text and images in jpeg format (so it's basically a picture); I want to be able to extract the image only programmatically (preferably using Java). If anyone knows useful libraries please let me know. I have already tried AspriseOCR and tesseract-ocr, they have been successful at extracting text only (obviously). Thank you.
score: 0
has comment: http://stackoverflow.com/comment/32023646
has answer: http://stackoverflow.com/a/21274728
tagged with: ocr

http://stackoverflow.com/comment/31927100
score: 1
has text: `if (X && Y)` means if X is false it will return false without evaluating Y, too.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21201843

http://stackoverflow.com/q/21184950
has comment: http://stackoverflow.com/comment/31896854
has comment: http://stackoverflow.com/comment/31901579
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31895841
tagged with: java
has body: I'm getting the above error when trying retrieve some data from a MySQL statement, as the error states the error is in line 118; here is the MySQL: .prepareStatement("SELECT orderr.* FROM orderr JOIN person ON orderr.personID = person.personID WHERE person.first_name = ?",java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY, Integer.MIN_VALUE); Code near line 118: int index = 0; if (rs.next()) { index++; rs.beforeFirst(); while (rs.next()) { for (int i = 1; i &lt; 4; i++) { // retrive column data from order message.append(rs.getInt(i)); //table and append to sb. if(i != 3)message.append(" "); &lt;---line 118. } if(rs.next()){ rs.absolute(index); message.append("\n"); } } } The exact error I get is: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2367) at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130) at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114) at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:415) at java.lang.StringBuffer.append(StringBuffer.java:237) at stl.Sql.printPersonsOrders(Sql.java:118) at stl.Main.main(Main.java:19) This error only occurs when I have added the same data twice to the table and then try and retrieve, the amount of data should only be one or two rows.
tagged with: mysql
has title: Out of memory java heap spcae with MySQL
accepted answer: http://stackoverflow.com/a/21188490
type: Question
has comment: http://stackoverflow.com/comment/31896216
has comment: http://stackoverflow.com/comment/31900465
score: 0
tagged with: heap-memory
has comment: http://stackoverflow.com/comment/31897744
has comment: http://stackoverflow.com/comment/31896589
answer count: 1
has comment: http://stackoverflow.com/comment/31897443
has comment: http://stackoverflow.com/comment/31896353
has answer: http://stackoverflow.com/a/21188490
has comment: http://stackoverflow.com/comment/31895801
has comment: http://stackoverflow.com/comment/31900684

http://stackoverflow.com/comment/32064642
type: QuestionComment
has text: possible duplicate of [How to fill map, configured with spring, from properties file](http://stackoverflow.com/questions/15416156/how-to-fill-map-configured-with-spring-from-properties-file)
score: 0
comment on: http://stackoverflow.com/q/21278951
type: Comment

http://stackoverflow.com/comment/32144612
has text: Since you're working in parallel (threads) this is perfectly fine to create a new Object for every call. It'll be a good candidate for GC once the method (call) has finished execution.
comment on: http://stackoverflow.com/q/21324764
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/comment/32021132
type: Comment
comment on: http://stackoverflow.com/a/21255072
score: 0
type: AnswerComment
has text: sry its Collections.rotate

http://stackoverflow.com/comment/32023294
type: Comment
has text: @Fildor that's the same but requires to have a reference to an `Activity` which you should not need to have within that executor.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21256419

http://stackoverflow.com/comment/32135182
has text: check out the File class, InputStreams, OutputStreams, FileReader and FileWriter. There are some other helpful Readers and Writers which will make reading and writing files easier.
score: 0
comment on: http://stackoverflow.com/q/21319375
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32111889
has text: I see it in the spring-web.4.0.0.Release jar
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21283721

http://stackoverflow.com/comment/32148235
comment on: http://stackoverflow.com/a/21326293
type: Comment
score: 0
has text: Thanks for the thorough answer and way to get around it. I really appreciate it.
type: AnswerComment

slf4j
tags question: http://stackoverflow.com/q/21335805
tags question: http://stackoverflow.com/q/21231055
tags question: http://stackoverflow.com/q/21307968
tags question: http://stackoverflow.com/q/21281048
tags question: http://stackoverflow.com/q/21329953
tag name: slf4j
tags question: http://stackoverflow.com/q/21306839
type: Tag

http://stackoverflow.com/a/21214441
has body: Your code is quite tangled but the main problems are: You're adding Buttons to a JPanel with a GridBagConstraints instance as the 'constraints' arguments, but you haven't set the GridBagLayout on this panel You're trying to switch to a card in the CardLayout-panel that you haven't added ("add") You say that it looks like a FlowLayout but you haven't set any GridBagConstraints that make it look different than that. I've refactored your code a bit and fixed these problems mentioned above. If you can provide more detail about the goals you're trying to achieve we may be able to give a better answer. import java.awt.*; import java.awt.event.*; import javax.swing.*; public final class GUI extends JPanel implements ActionListener { // buttons private JButton newButton, findButton; JPanel panels; public void addComponentToPane(Container pane) { pane.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; createPanels(); pane.add(panels, c); } private void createPanels() { JPanel mainMenu = createMainMenu(); panels = new JPanel(new CardLayout()); panels.add(mainMenu, "mainWindow"); panels.add(new JLabel("Add card"), "add"); panels.add(new JLabel("Find card"), "find"); } private JPanel createMainMenu() { GridBagConstraints c = new GridBagConstraints(); c.gridx = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.HORIZONTAL; JPanel mainMenu = new JPanel(new GridBagLayout()); // add mainMenu.add(newButton = new JButton("Add"), c); newButton.setActionCommand("new"); newButton.addActionListener(this); // find mainMenu.add(findButton = new JButton("Find"), c); findButton.setActionCommand("find"); findButton.addActionListener(this); return mainMenu; } public void actionPerformed(ActionEvent e) { CardLayout allpanels = (CardLayout) (panels.getLayout()); switch (e.getActionCommand()) { case "new": allpanels.show(panels, "add"); break; case "find": allpanels.show(panels, "find"); break; } } private static void cr…
has comment: http://stackoverflow.com/comment/32029808
answers question: http://stackoverflow.com/q/21201103
accepted answer of: http://stackoverflow.com/q/21201103
type: AcceptedAnswer
score: 0
type: Answer

maven
tags question: http://stackoverflow.com/q/21341505
tags question: http://stackoverflow.com/q/21231909
tags question: http://stackoverflow.com/q/21285598
tags question: http://stackoverflow.com/q/21190441
tags question: http://stackoverflow.com/q/21259019
tags question: http://stackoverflow.com/q/21314023
tags question: http://stackoverflow.com/q/21334987
tags question: http://stackoverflow.com/q/21250550
tags question: http://stackoverflow.com/q/21232720
type: Tag
tags question: http://stackoverflow.com/q/21278766
tags question: http://stackoverflow.com/q/21313014
tags question: http://stackoverflow.com/q/21238716
tags question: http://stackoverflow.com/q/21309252
tags question: http://stackoverflow.com/q/21338021
tags question: http://stackoverflow.com/q/21256855
tags question: http://stackoverflow.com/q/21337698
tags question: http://stackoverflow.com/q/21236493
tags question: http://stackoverflow.com/q/21209398
tags question: http://stackoverflow.com/q/21307910
tags question: http://stackoverflow.com/q/21270009
tags question: http://stackoverflow.com/q/21243877
tags question: http://stackoverflow.com/q/21203054
tags question: http://stackoverflow.com/q/21336062
tags question: http://stackoverflow.com/q/21274732
tags question: http://stackoverflow.com/q/21268494
tags question: http://stackoverflow.com/q/21228056
tags question: http://stackoverflow.com/q/21293446
tags question: http://stackoverflow.com/q/21290739
tags question: http://stackoverflow.com/q/21283475
tags question: http://stackoverflow.com/q/21186570
tags question: http://stackoverflow.com/q/21340136
tags question: http://stackoverflow.com/q/21310730
tags question: http://stackoverflow.com/q/21302318
tags question: http://stackoverflow.com/q/21204299
tags question: http://stackoverflow.com/q/21321353
tags question: http://stackoverflow.com/q/21278942
tags question: http://stackoverflow.com/q/21317314
tags question: http://stackoverflow.com/q/21345177
tags question: http://stackoverflow.com/q/21345607
tags question: http://stackoverflow.com/q/21309983
tags question: http://stackoverflow.com/q/21235241
tags question: http://stackoverflow.com/q/21234674
tags question: http://stackoverflow.com/q/21304212
tags question: http://stackoverflow.com/q/21205193
tags question: http://stackoverflow.com/q/21261539
tags question: http://stackoverflow.com/q/21320576
tags question: http://stackoverflow.com/q/21290023
tags question: http://stackoverflow.com/q/21285312
tags question: http://stackoverflow.com/q/21186649
tags question: http://stackoverflow.com/q/21255740
tags question: http://stackoverflow.com/q/21340508
tags question: http://stackoverflow.com/q/21224771
tags question: http://stackoverflow.com/q/21200189
tags question: http://stackoverflow.com/q/21282432
tags question: http://stackoverflow.com/q/21284022
tags question: http://stackoverflow.com/q/21338102
tags question: http://stackoverflow.com/q/21218071
tags question: http://stackoverflow.com/q/21239480
tags question: http://stackoverflow.com/q/21334207
tags question: http://stackoverflow.com/q/21288667
tags question: http://stackoverflow.com/q/21195965
tags question: http://stackoverflow.com/q/21221597
tags question: http://stackoverflow.com/q/21268897
tags question: http://stackoverflow.com/q/21230681
tags question: http://stackoverflow.com/q/21276316
tags question: http://stackoverflow.com/q/21304710
tags question: http://stackoverflow.com/q/21224978
tags question: http://stackoverflow.com/q/21228138
tags question: http://stackoverflow.com/q/21332017
tags question: http://stackoverflow.com/q/21239573
tags question: http://stackoverflow.com/q/21287521
tags question: http://stackoverflow.com/q/21256478
tags question: http://stackoverflow.com/q/21294454
tags question: http://stackoverflow.com/q/21243619
tags question: http://stackoverflow.com/q/21265735
tags question: http://stackoverflow.com/q/21305376
tags question: http://stackoverflow.com/q/21342560
tags question: http://stackoverflow.com/q/21334086
tags question: http://stackoverflow.com/q/21321814

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/21336920

http://stackoverflow.com/comment/32073400
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21284751
score: 1
has text: -1 for very (un)explicit title. (not working is not really more explicit)

http://stackoverflow.com/comment/32020742
type: QuestionComment
has text: remove custom/clean frame -> add custom 2 -> repaint frame
comment on: http://stackoverflow.com/q/21254845
score: 0
type: Comment

http://stackoverflow.com/comment/31995153
has text: @JordyV What are your needs?
score: 0
comment on: http://stackoverflow.com/a/21239599
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31915826
score: 0
has text: See also this simpler MVC [example](http://stackoverflow.com/a/3072979/230513).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21191056

http://stackoverflow.com/comment/31949503
has text: @BrianRoach I know the OP was, but I was responding the rightfold's statement that the JVM has no unsigned data types, which is not completely correct.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/21213058
type: AnswerComment

http://stackoverflow.com/comment/86246840
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/49325107
has text: This answer is legitimate and work for search and replace in IntelliJ IDEA, PHPStorm and WebStorm where the user wants to replace an instance of `\n` with actual new line. Please do not downvote useful answers.
score: 1

http://stackoverflow.com/q/21228740
has comment: http://stackoverflow.com/comment/31974927
answer count: 2
linked to: http://stackoverflow.com/q/7180198
tagged with: grid-layout
has answer: http://stackoverflow.com/a/21228862
accepted answer: http://stackoverflow.com/a/21228862
upvote count: 1
has title: How do I keep a JButton from changing size?
possible better answer: http://stackoverflow.com/a/21228929
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/32005597
favorite count: 0
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21228929
tagged with: swing
has body: I'm trying to make a simple game where you can set out tiles that make up a celtic design and I can't seem to make the buttons stay the same size. Here's the code: public class CTGContent { public static JPanel content = new JPanel(); private static JButton board[][] = new JButton[20][20]; static private Random random = new Random(); public static int CTGcolumn = random.nextInt(14)+1; public static int CTGRow = 15; private static GridLayout boardLayout; public final int getBoardWidth(){ return CTGcolumn*40; } public final int getBoardHeight(){ return CTGRow*40; } public static void initializeBoard(){ int row = 0; int column = 0; int defaultCOL = 0; int defaultROW = 0; boardLayout = new GridLayout(CTGRow, CTGcolumn); content.setLayout(boardLayout); Random determine = new Random(); while (row &lt; CTGRow){ column = 0; while (column &lt; CTGcolumn){ board[row][column] = new JButton(new ImageIcon("images\\template.gif")); board[row][column].setPreferredSize(new Dimension(40, 40)); board[row][column].setMaximumSize(new Dimension(40, 40)); board[row][column].setMinimumSize(new Dimension(40, 40)); content.add(board[row][column]); column++; } row++; } } private static void build(){ initializeBoard(); JFrame window = new JFrame("testing the menubar"); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setContentPane(content); content.add(new JLabel("My Label")); window.pack(); window.setVisible(true); } public CTGContent() { } public CTGContent(JFrame window){ initializeBoard(); window.add(content); } public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater( new Runnable() { @Override public void run() { // TODO Auto-generated method stub build(); } }); } } It starts off the right size usually but then for some reason if I resize the window or something they change size with it. I need them to stay the same size no matter what. How can I do that?
type: Question
tagged with: jbutton
linked to: http://stackoverflow.com/q/7229226

http://stackoverflow.com/comment/32008370
score: 0
has text: You will still need to show us what you've done wrong. These snippets above are of no use to us.
comment on: http://stackoverflow.com/q/21247208
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21349404
score: 0
answers question: http://stackoverflow.com/q/21349350
type: Answer
has body: These are called as Anonymous Classes. See this link.

http://stackoverflow.com/comment/31943636
type: QuestionComment
has text: The error should be telling you exactly what is wrong, that you're calling the method incorrectly. Note that this has nothing to do with "Eclipse" and all to do with the method signature of your `putExtra(...)` method.
comment on: http://stackoverflow.com/q/21211143
type: Comment
score: 0

http://stackoverflow.com/q/21190174
has comment: http://stackoverflow.com/comment/31906641
has comment: http://stackoverflow.com/comment/31906665
tagged with: httpurlconnection
has body: I am trying to log into my google account using HttpURLConnection. I don't know the right way to set it up, I am not sure it could be done with java.net.*, otherwise how should I proceed? my code: public static void main(String[] args) { try { URL myURL = new URL("https://accounts.google.com/ServiceLogin?user=***&amp;pass=***"); try { URLConnection myURLConnection = myURL.openConnection(); myURLConnection.setDoOutput(true); OutputStreamWriter out = new OutputStreamWriter(myURLConnection.getOutputStream()); BufferedReader in = new BufferedReader(new InputStreamReader(myURLConnection.getInputStream())); String str; while((str = in.readLine()) != null) System.out.println(str); } catch(IOException x) { System.err.format("error %s%n", x); } } catch(Exception x) { System.err.format("error %s%n", x); } } The code displays my google login account content page instead of my account home page.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31906719
has answer: http://stackoverflow.com/a/21191312
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21190683
tagged with: java
has comment: http://stackoverflow.com/comment/31906382
has comment: http://stackoverflow.com/comment/31906530
has title: HttpURLConnection connect to my google account
score: -1
has comment: http://stackoverflow.com/comment/31906588
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/31905930
has comment: http://stackoverflow.com/comment/31906496
has comment: http://stackoverflow.com/comment/31906120
favorite count: 0
has comment: http://stackoverflow.com/comment/31906827

http://stackoverflow.com/comment/32122920
score: 3
has text: No, you have id="...". You need fx:id="...". (I mentioned this in the comments under the question too ;).)
comment on: http://stackoverflow.com/a/21295607
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32070809
type: Comment
has text: @NoCanDo It takes time, but it will make sense soon enough. Don't worry if its still not 100% clear yet. . keep trying.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21281388

http://stackoverflow.com/q/21340456
type: Question
has comment: http://stackoverflow.com/comment/32173083
has title: Printing at specific paper position from JAVA ui
score: 0
tagged with: printing
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32246533
has body: I already have a ui that collects all the information I need to print over a Pre-printed paper (invoices). And I need to print collected informacion in specific places of the paper. So far I've been generating from the program, an excel file that is used for this purpose. I would like to know if there is a way to avoid the excel file, and print directly from the ui. Thanks in advance.
tagged with: java
has comment: http://stackoverflow.com/comment/32172999

http://stackoverflow.com/a/21287825
score: 0
answers question: http://stackoverflow.com/q/21287278
type: Answer
has body: Pattern pattern = Pattern.compile("(?i)(<title.*?>)(.+?)( )"); Matcher matcher = pattern.matcher(test); while (matcher.find()) { System.out.println(matcher.group().toString()); } Above is very costly operation. you can simply use indexof on string String str=" Page title1 "; int index=str.indexOf(" "); int lastIndex=str.indexOf(" "); String literal=str.substring(index+5,lastIndex);

http://stackoverflow.com/q/21217290
has body: I have a class, with a bunch of println's, and then I have a switch. the point is that the user has 3 options, 1 of them is wrong and takes him back to the start. I tried recreating the class from inside the class, but it didnt work, because when it would finish the recent class, it would go back to the previous class and finish it. Maybe the solution is simple, and I just don't know how to do it, I have been programing for 2 weeks in school... If you need an example, I can type one, but its just a switch with 3 cases inside it, where 2 of them say diferent things, but break the switch anyway, and the 3rd says something else, but restarts. Any sugestions? Switch (choice1){ case 1: System.out.println("Blabla"); break; case 2: System.out.println("Blabla"); break; case 3: System.out.println("Blabla"); break; default: System.out.println("That is not a valid number."); break;} There... its just a switch... EDIT: Just so you know, as I said, I don't really know much about programing with java yet, so I don't think I can fix this without some code help. SOLVED! by myself. Look down Switch (choice1){ case 1: System.out.println("Blabla"); break; case 2: System.out.println("Blabla"); break; case 3: System.out.println("Blabla"); break; default: System.out.println("That is not a valid number."); nameoftheclass nameoftheobject = new nameofthemethod(); break;} if (choice1 &gt;2) {} else {rest of the code...}
score: -2
tagged with: java
tagged with: switch-statement
type: Question
downvote count: 2
has comment: http://stackoverflow.com/comment/31954351
has comment: http://stackoverflow.com/comment/31954629
favorite count: 0
has comment: http://stackoverflow.com/comment/31954265
answer count: 3
has answer: http://stackoverflow.com/a/21217533
has comment: http://stackoverflow.com/comment/31954418
has comment: http://stackoverflow.com/comment/31954332
has comment: http://stackoverflow.com/comment/31954962
upvote count: 0
possible better answer: http://stackoverflow.com/a/21217341
has title: How do I Restart this class? or unload and load it?
has comment: http://stackoverflow.com/comment/31954874
has answer: http://stackoverflow.com/a/21217341
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31954393
has answer: http://stackoverflow.com/a/21468417
accepted answer: http://stackoverflow.com/a/21468417

http://stackoverflow.com/comment/32071193
type: Comment
comment on: http://stackoverflow.com/a/21283375
score: 0
has text: thanks for the explanation, i made the changes , but the program still crashes with teh NullPointer at GetLat
type: AnswerComment

http://stackoverflow.com/a/21299082
has body: You are trying to pass int where the method asks for a String parameter. int diceNumber = 0; diceScore.setText(diceNumber); try this. diceScore.setText(String.valueOf(diceNumber));
score: 0
answers question: http://stackoverflow.com/q/21299010
type: Answer

http://stackoverflow.com/comment/31933883
type: Comment
comment on: http://stackoverflow.com/a/21205396
score: 1
has text: Please move main out of Ran, give Ran its own class
type: AnswerComment

http://stackoverflow.com/comment/31938642
comment on: http://stackoverflow.com/a/21207542
type: AnswerComment
score: 0
type: Comment
has text: It worked. Thanks. Nice that you put the list of accepted format. It will be easy to extend.

http://stackoverflow.com/comment/32151638
type: Comment
type: QuestionComment
has text: Who else works with this files besides your application? Who produces them? Other process? Is it managed by you or its 3rd party software?
comment on: http://stackoverflow.com/q/21328328
score: 0

http://stackoverflow.com/comment/56773112
has text: Is specifying each attribute necessary? Like, if I want Ctrl+S, do you need to specify that alt="UP"?
comment on: http://stackoverflow.com/a/21209628
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32123233
type: AnswerComment
score: 0
type: Comment
has text: @Akumu so you genius, can you tell me a way to treat 'null' sometimes as 24 sometimes as 34 etc. ?
comment on: http://stackoverflow.com/a/21312943

http://stackoverflow.com/q/21311450
score: 0
answer count: 2
tagged with: sql
has title: HQL returns no results but generated SQL works perfectly on SQL Developer
tagged with: oracle-sqldeveloper
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32121470
has answer: http://stackoverflow.com/a/21311507
has body: So I have this query private static final String GET_LOCK_HISTORY1 = "select lh from UserLockHistoryEntity lh "; which is executed using this code List<UserLockHistoryEntity> result = getQuery(GET_LOCK_HISTORY1).list(); This returns an empty array. On the console I get the generated SQL which is select userlockhi0_.USER_LOCK_HISTORY_ID as USER_LOC1_15_, userlockhi0_.LOCK_TYPE as LOCK_TYP2_15_, userlockhi0_.TIMESTAMP as TIMESTAM3_15_, userlockhi0_.LOCKED_USER_ID as LOCKED_U4_15_, userlockhi0_.COMPANY_ID as COMPANY_5_15_, userlockhi0_.PARTNER_ID as PARTNER_6_15_, userlockhi0_.IP_ORIGIN as IP_ORIGI7_15_, userlockhi0_.LOCKED_BY_USER as LOCKED_B8_15_, userlockhi0_.LOCKED_BY_TYPE as LOCKED_B9_15_, userlockhi0_.LOCK_REASON as LOCK_RE10_15_ from ONCPRTDEV.USER_LOCK_HISTORY userlockhi0_ and I paste it on SQL developer which returns me 8 rows (all table records) Bellow it's my mapping file <?xml version="1.0"?> <column name="USER_LOCK_HISTORY_ID" /> <generator class="assigned" /> <column name="LOCK_TYPE" /> pt.vdf.onc.core.common.type.user.UserLockType <column name="TIMESTAMP" /> <column name="LOCKED_USER_ID" /> <column name="COMPANY_ID" /> <column name="PARTNER_ID" /> <column name="IP_ORIGIN" /> <column name="LOCKED_BY_USER" /> <column name="LOCKED_BY_TYPE" /> pt.vdf.onc.core.common.type.user.UserLockByType <column name="LOCK_REASON" /> pt.vdf.onc.core.common.type.user.UserLockReason and entity public class UserLockHistoryEntity implements java.io.Serializable { private Long id; private UserLockType lockType; private String timestamp; private Long userId; private Long companyId; private Long partnerId; private String ipOrigin; private Long lockedByUser; private UserLockByType lockedByType; private UserLockReason lockedReason; //getters and setters here (removed them for simplicity) } Table definition: USER_LOCK_HISTORY_ID NUMBER(38,0) LOCK_TYPE NUMBER(38,0) TIMESTAMP DATE LOCKED_USER_ID NUMBER(38,0) COMPANY_ID NUMBER(38,0) PARTNER_ID NUMBER(38,0) IP_ORIGIN VARCHAR2(30 BYTE) …
has comment: http://stackoverflow.com/comment/32121388
has comment: http://stackoverflow.com/comment/32122059
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/32121677
tagged with: hql
type: Question
has answer: http://stackoverflow.com/a/21313591

http://stackoverflow.com/q/21301868
type: Question
has body: I found similar questions but no satisfactory answers. In addition, most answers were rather old as well, so I wonder if the combination eclipse / Junit got better in the meantime. Instead of packing projects into test suites, I would like to spread tests cases all over the place in the package structure (I'm programming in Java). Then right clicking on whatever package (on the package explorer) should bring the option Run As -> JUnit Test and run all the unit tests in that package and below (recursively). In this way, I wouldn't have to care about maintaining the test structure, it would be in the packages themselves. I've seen that this works only with end packages (with no children), but not recursively. Do you have any ideas? I'm using eclipse Kepler (4.3.0), JUnit 4 and Java 1.6.
downvote count: 0
answer count: 1
tagged with: junit
favorite count: 0
has comment: http://stackoverflow.com/comment/32107572
type: UnansweredQuestion
has title: How can I run all junit tests in a package and below (recursively) by right clicking the package on eclipse and selecting "Run as JUnit test"
has answer: http://stackoverflow.com/a/21302711
score: 3
upvote count: 3
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/31896566
score: 0
type: Comment
has text: "app even not opens mainActivity" do you get some kind of error or crash or just a blank screen?
type: QuestionComment
comment on: http://stackoverflow.com/q/21185400

http://stackoverflow.com/comment/31913922
has text: We know that `HashSet` use `equals` and `hashCode` if you override equals with lowerCase in `ABC` you are saying that a `ABC` with `city= NEW YORK` is the same as `city = new York` and perhaps you don't want that! It's better idea to make your own wrapper collection insenstive or make a wrapper class to `ABC` an `InsensitiveABC`
comment on: http://stackoverflow.com/q/21194274
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/21323429
favorite count: 0
has body: I am having trouble with a program I'm writing. It is supposed to be a kind of guessing game. the program will create a random 4 digit number with digits that do not repeat anywhere. then the user will be asked to input a 4 digit number. the program will then compare this number to the random one it made. for ever digit that is the same and in the correct position it will make a variable (lets just say A) increase by one (1A, 2A, 3A...). for every number that is correct but in the wrong position, it will increase another variable (lets say B) in the same way. The user will get 5 tries to guess correctly with the two variable from before printed after each incorrect answer. I decided to store the both numbers in an int array and try to compare them that way (moving along each element of the array and checking for a match) right now I am having trouble getting the 2 numbers into arrays. one prints out [1, 2, 3, 4] while the users guess prints out [1 2 3 4] I'm not sure if this will make a difference but I can't seem to figure out why. Also I am not sure if this is the simplest way to compare two numbers, nor do I really know how to if I got them into arrays. Maybe if statements like this? Some guidence would be really helpful. int x = 0; int y = 0; if (random[0] == guess[0]){ x+1; } else if (random[0] == guess[1] || random[0] == guess[2] || random[0] == guess[3]) y+1; here is what I have so far, I was trying to split the string from the user and store it as an int but it say "Cannot invoke intAt(int) on the primitive type int" import java.util.Arrays; import java.util.Random; import java.util.Scanner; public class Game { public static void main(String[] args) { // create scanner object Scanner keyboard = new Scanner(System.in); // give user the game rules System.out.println("The computer has chosen a unique 4 digit number (No digits in the number repeat)\n" + "Each time you guess incorectly you will get a hint. You must guess the number correctly in 5 tries or fewer t…
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21323630
tagged with: java
type: Question
answer count: 2
tagged with: arrays
downvote count: 0
has title: Comparing two 4 digit integers, digit by digit
accepted answer: http://stackoverflow.com/a/21323630
tagged with: int
tagged with: compare
possible better answer: http://stackoverflow.com/a/21323536
score: 1
has answer: http://stackoverflow.com/a/21323536
tagged with: parsing

http://stackoverflow.com/q/21247174
has comment: http://stackoverflow.com/comment/32009314
linked to: http://stackoverflow.com/q/3001836
has comment: http://stackoverflow.com/comment/32008358
has comment: http://stackoverflow.com/comment/32008346
linked to: http://stackoverflow.com/q/7215411
has comment: http://stackoverflow.com/comment/32008239
has body: static int fn = 0; static int sn = 0; static boolean running = false; public static void run() { while (running == true) { fn = numbers[0]; sn = numbers[1]; if (sign == 0) { input.setText(String.valueOf(fn)); } } } static class one implements ActionListener { public void actionPerformed(ActionEvent e) { if (Display.sign == 0) { Display.numbers[0] = Display.numbers[0] *10; Display.numbers[0] = Display.numbers[0] +1; } } } This is the code for a calculator that I am programming (not all of it of course). This is the part where I display the number on the screen which I have done, but weirdly this works up until 10 characters So after I get the program to display 1111111111 I want to do it once more and it gives me this weird number -1773790777. I am confused about how the program comes up with this. As you can see, above Display.numbers[] is the array I am storing the two numbers in. So to go over a place I multiply the number in the array by 10 then add 1. So how does this give me a negative number in the first place and what can I do to solve this problem?
favorite count: 0
has answer: http://stackoverflow.com/a/21248138
accepted answer: http://stackoverflow.com/a/21247219
has title: Interesting thing happening when I take a number, multiply it by 10, and then add 1
downvote count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/21248138
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32008315
duplicate of: http://stackoverflow.com/q/7215411
tagged with: arrays
has answer: http://stackoverflow.com/a/21247219
score: -1
tagged with: string
tagged with: integer-overflow

http://stackoverflow.com/comment/31947602
type: Comment
has text: (And you can isolate the least-significant 1 in a binary number by ANDing the number with it's 2's complement.)
comment on: http://stackoverflow.com/q/21213271
score: 0
type: QuestionComment

http://stackoverflow.com/a/21230096
answers question: http://stackoverflow.com/q/21228056
has comment: http://stackoverflow.com/comment/32019393
accepted answer of: http://stackoverflow.com/q/21228056
type: Answer
has body: To understand this, you need to view the two parts of the OSGi landscape: services and (Java) classes/interfaces. Related to services, activation, deactivation and updates are handled by the contract between the client (user) and the service provider. The client must track changes to the available services and release the use of a service as soon as it is notified that the service is going to be removed. Furthermore, it can track the availability of other services to update its reference as soon as a better service becomes available. Note that the OSGi environment is a cooperative one: non-one forces the using bundle to actually release the reference to the service. Therefore, incorrect behaviour can result to unexpected results. As such: for services, the user of the service is responsible for handling the dynamics of the availability of services. Related to Java classes/interfaces, meaning class loading, the handling is done by the framework itself. When a bundle that provides classes to other bundles (as announced via its Export-Package manifest entry), is un-installed, the classes the bundle provided remain available to the bundles already using them. Only by implicitly telling the framework to update the wiring of classes between bundles (via a "refresh" action on the org.osgi.service.packageadmin.PackageAdmin service, normally provided via some kind of framework console), changes are made to the classes imported by a bundle. In that case the using bundle may be deactivated by the framework, re-wired to other classes provided by different bundles and activated again. As such: for class loading, the framework will not change the initial wiring unless explicitly told to do so. For that bundles must be aware that they can be started, loaded, stopped and unloaded at any time to handle the changing context. Maybe some scenarios make this somewhat more clear: Assume there is an interface definition Log in bundle LogInterface. This interface provides one method: logMe…
has comment: http://stackoverflow.com/comment/31983065
has comment: http://stackoverflow.com/comment/31982941
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21316886
upvote count: 4
has title: How to listen to 'page loaded after a redirect' event in the WebEngine?
downvote count: 0
score: 4
favorite count: 0
tagged with: javafx-2
answer count: 0
type: UnansweredQuestion
has body: I've been trying to automatize downloading a JDK distribution from oracle.com with WebEngine/WebView and experiencing issues with handling redirect at one of the pages. The problem is that it does not generate any kind of event I am aware of when the page is loaded. I track down the occurring redirect by using webEngine.locationProperty(), so when this property changes I notice the redirect going on. But it is not being followed by a change of the webEngine.getLoadWorker().stateProperty() and the element I require is not loaded. I resolved the issue by starting a thread which is watching my specific element to appear by running jQuery selector, i.e. webEngine.executeScript("$('#sso_username').length &gt; 0"). Is there a better way to do this, may be to listen for some property to change when the page after a redirect will load?
tagged with: webview
type: Question
tagged with: java

http://stackoverflow.com/comment/32024977
score: 0
comment on: http://stackoverflow.com/q/21253569
has text: @BalusC So, in this case, what option would you suggest? Will implementing different alternatives in the different web-components work?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21199510
has comment: http://stackoverflow.com/comment/31924174
has comment: http://stackoverflow.com/comment/31947392
has comment: http://stackoverflow.com/comment/31947659
score: 0
has body: See this code, but you must implement the parameters yourself: public class ConnectionThread extends Thread { public static final HOST = "www.example.com"; public static final PORT = 24239; private String command; private boolean lookahead = false; private boolean allowChangeLookahead = true; private boolean canRetrieveResult = false; Private String result; orivate Socket s = new Socket(HOST, PORT); public void run() { for(;;) { // Infinite loop sleep(500); // Avoid low perfomance related problems. if(lookahead) { allowChangeLookahead = false; try { PrintWriter out = new PrintWriter(s.getOutputStream(), true); BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream())); out.println(command); result = in.readLine(); canRetrieveResult = true; } catch(Exception e) { // Something occured... } lookahead = false; allowChangeLookAhead = true; } } } public synchronized void command(String cmd) { command = cmd; for(;;) { // Don't worry, not infinite if(allowChangeLookahead) { lookahead = true; break; } } } public synchronized String getResult() { for(;;) { if(canRetrieveResult) { return result; } } } } Meanwhile, in main sequence... ConnectionThread conThread = new ConnectionThread(); conThread.start(); // ... // Code of method that responds to command if(calledCommand) { conThread.command(theCommand); result = conThread.getResult(); } That's it! And remember to write the server, ask me if you want help.
has comment: http://stackoverflow.com/comment/31946489
has comment: http://stackoverflow.com/comment/31945435
type: Answer
has comment: http://stackoverflow.com/comment/31923175
answers question: http://stackoverflow.com/q/21199254
has comment: http://stackoverflow.com/comment/31923831
has comment: http://stackoverflow.com/comment/31947543
has comment: http://stackoverflow.com/comment/31945526
has comment: http://stackoverflow.com/comment/31947427

http://stackoverflow.com/q/21283346
has title: How to set the instance to null inside class?
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/21283445
type: UnansweredQuestion
has body: I want to create a release() method in my class. After calling release(), how can I set that instance to null? I mean this: ABC abc = new ABC(); abc.release(); if(abc == null) Log.d("That's what I want"); then I want to check if abc is null. How do I do this?
has comment: http://stackoverflow.com/comment/32070673
downvote count: 0
has comment: http://stackoverflow.com/comment/32070674
score: 1
has answer: http://stackoverflow.com/a/21283411
has comment: http://stackoverflow.com/comment/32071037
tagged with: java
has comment: http://stackoverflow.com/comment/32070823
has answer: http://stackoverflow.com/a/21284076
has answer: http://stackoverflow.com/a/21283397
tagged with: garbage-collection
type: Question
tagged with: null
has answer: http://stackoverflow.com/a/21283394
has answer: http://stackoverflow.com/a/21283456
has answer: http://stackoverflow.com/a/21283531
upvote count: 1

http://stackoverflow.com/comment/32102413
has text: Updated to get rid of extra methods I didn't paste in since it's not relevant.
comment on: http://stackoverflow.com/q/21300960
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31939117
type: AnswerComment
has text: @CasimiretHippolyte, the only difference is it forces no dashes or both dashes
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21208474

http://stackoverflow.com/comment/31895041
type: QuestionComment
has text: And you tried like... nothing? At all? `"I need to implement a logic"` - that's nice of you to say! But is there any question, or are you simply looking for a naive worker to do it?
comment on: http://stackoverflow.com/q/21184422
score: 0
type: Comment

keyboard
tags question: http://stackoverflow.com/q/21320258
tag name: keyboard
tags question: http://stackoverflow.com/q/21206059
tags question: http://stackoverflow.com/q/21197186
tags question: http://stackoverflow.com/q/21262548
type: Tag
tags question: http://stackoverflow.com/q/21313035
tags question: http://stackoverflow.com/q/21345498

http://stackoverflow.com/a/21340224
answers question: http://stackoverflow.com/q/21340055
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/32173175
has body: I would rename that class to UrlToHtml and write a single JUnit test class UrlToHtmlTest. Part of the reason why you're having problems testing this is that the class is poorly designed and implemented: You should pass in the URL you want to scrape, not hard code it. You should return the content as a String or List, not print it to a file. You might want to throw that exception rather than catch it. Your logging isn't exactly "handling" the exceptional situation. Let it bubble out and have clients log if they wish. You don't need that private data member; return the contents. That lets you make this method static. Good names matter. I don't like what you have for the class or the method. Why are you writing this when you could use a library to do it? Here's what the test class might look like: public class UrlToHtmlTest { @Test public void testUrlToHtml() { try { String testUrl = "http://www.google.com" ; String expected = ""; String actual = UrlToHtml.url(testUrl); Assert.assertEquals(expected, actual); } catch (Exception e) { e.printStackTrace(); Assert.fail(); } } }
has comment: http://stackoverflow.com/comment/32173155
downvote count: 0
has comment: http://stackoverflow.com/comment/34571543

http://stackoverflow.com/comment/32365892
comment on: http://stackoverflow.com/q/21302219
has text: I do not have any other jdk installed
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21248377
tagged with: android
tagged with: facebook
tagged with: java
tagged with: eclipse
downvote count: 1
type: Question
upvote count: 0
score: -1
has body: I'm trying to learn and add some basic Facebook functionality to my Android App (an address book). What I'm eventually going to do is import a friends profile picture. I've currently only copy/pasted what I need from the "FriendPickerSample" example project, which is just a button that brings up a friend picker fragment, and, if I remember correctly, it places the names you picked into a list. I've altered it to come up when an imageview is clicked, and it'll just Toast the single name that is chosen. When I try to bring up the friend picker, I get a null pointer exception, and I don't understand why. Here's the log: FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.JDE.RAB/com.JDE.RAB.PickFriendsActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) at android.app.ActivityThread.access$2300(ActivityThread.java:125) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4627) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at com.facebook.widget.PickerFragment.onCreateView(PickerFragment.java:152) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:871) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1083) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:635) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1431) a…
has comment: http://stackoverflow.com/comment/32010337
answer count: 1
linked to: http://stackoverflow.com/q/4388992
favorite count: 0
has answer: http://stackoverflow.com/a/21248945
has title: Trying to add a Facebook Friend Picker, but get null pointer exception
type: UnansweredQuestion

http://stackoverflow.com/a/21250901
type: Answer
has body: Change your code showH.setVisability(view.VISABLE); showV.setVisability(view.VISABLE); to showH.setVisability(View.VISIBLE); showV.setVisability(View.VISIBLE);
answers question: http://stackoverflow.com/q/21250436
score: 0

taglib
tags question: http://stackoverflow.com/q/21259191
tag name: taglib
type: Tag
tags question: http://stackoverflow.com/q/21265211

http://stackoverflow.com/comment/32086098
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21291283
has text: @SotiriosDelimanolis: (Comment here rather than on my now-deleted answer.) Looks like my answer makes sense for the *actual* code, but I agree it doesn't make as much sense for the *posted* code ;)
score: 0

http://stackoverflow.com/a/21247495
has comment: http://stackoverflow.com/comment/32009080
accepted answer of: http://stackoverflow.com/q/21247434
answers question: http://stackoverflow.com/q/21247434
type: Answer
has comment: http://stackoverflow.com/comment/32009265
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32009063
has comment: http://stackoverflow.com/comment/32009223
upvote count: 1
has body: In your constructor webSite = ""; should be this.webSite = ""; or this.webSite = webSite; Previously you were referencing the constructor parameter named webSite, not the instance field. As such, the instance field remained null, which is the default value for an instance variable of a reference type.
type: AcceptedAnswer

http://stackoverflow.com/comment/31983996
type: Comment
has text: Can I see the uploaded file in server folder location?
score: 0
comment on: http://stackoverflow.com/q/21232288
type: QuestionComment

http://stackoverflow.com/q/21212631
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
linked to: http://stackoverflow.com/q/18898039
has body: The app I am working on has a login/register which connects to a mysql database, At first I was running everything on the UI Thread I later found out it was not working because of the against running long code on Android's UI Thread. I attempted to edit my code to run the long task on a new Thread that i added. . Now my app registers the I see the result in mysql but my app keeps closing because of this error android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. the error is understandable but I don't know how to run the View or Views back to the UI Thread. I've done some research about the runOnuithread but I dont know where to place it in my code, or weather I placed the new Thread I added before in the wrong place to begin with please can anyone help my fix this here is a snippet of the code public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.register); // Importing all assets like buttons, text fields inputFullName = (EditText) findViewById(R.id.registerName); inputEmail = (EditText) findViewById(R.id.registerEmail); inputPassword = (EditText) findViewById(R.id.registerPassword); btnRegister = (Button) findViewById(R.id.btnRegister); btnLinkToLogin = (Button) findViewById(R.id.btnLinkToLoginScreen); registerErrorMsg = (TextView) findViewById(R.id.register_error); // Register Button Click event btnRegister.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { /** According with the new StrictGuard policy, running long tasks on the Main UI thread is not possible So creating new thread to create and execute http operations */ new Thread (new Runnable() { @Override public void run() { // String name = inputFullName.getText().toString(); String email = inputEmail.getText().toString(); String password = inputPassword.getText().toString(); UserFunctions userFunction = new UserFunctions(); JSONObject json = …
has answer: http://stackoverflow.com/a/21212662
accepted answer: http://stackoverflow.com/a/21212662
score: 0
answer count: 1
tagged with: android
has title: how to use run runOnUithread?
type: AnsweredQuestion

http://stackoverflow.com/q/21231546
has comment: http://stackoverflow.com/comment/31979963
has comment: http://stackoverflow.com/comment/31981262
favorite count: 0
has comment: http://stackoverflow.com/comment/31980507
has answer: http://stackoverflow.com/a/21231704
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/21231704
answer count: 1
tagged with: gwt
tagged with: java
has body: I have a WAR file of some GWT application. No source project. I need to do some modifications in this application like adding new buttons to the actionbar etc. I've unrared WAR file and inside WEB-INF/classes there are .classes and .java files as well. So the source code of Java classes is available. JavaScript files under deferredjs folder are obfuscated. Sadly I'm not a GWT expert. So the question is: is it possible to modify existing GWT application having WAR with .java files? And how to do it? Thanks.
has comment: http://stackoverflow.com/comment/32006384
downvote count: 0
has title: Modify existing GWT application
type: AnsweredQuestion
score: 2

http://stackoverflow.com/a/21340031
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/32178298
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32173106
accepted answer of: http://stackoverflow.com/q/21339505
answers question: http://stackoverflow.com/q/21339505
upvote count: 1
has body: "The issue: The JPanel shows up completely blank throughout the time period the processing is going on. Once the processing is done, then all the data shows up." What's happening is that everything is occurring on one thread, the Event Dispatch Thread (EDT). In order for an event to occur, like your JPanel updating, the process before it needs to complete. As stated about the EDT: " Tasks on the event dispatch thread must finish quickly; if they don't, unhandled events back up and the user interface becomes unresponsive." To work around this, you'll want to run your long process in a background thread. You should have look at Concurrency in Swing - the section on Worker Threads and SwingWorker in particular.

http://stackoverflow.com/q/21331463
type: Question
has comment: http://stackoverflow.com/comment/32157560
score: 3
has body: I have an Eclipse RCP application that I would like to install a plugin into. I know the plugin works with the application, and with older versions of the application I could just drop the plugin JAR into plugins/ folder and it would be available next time I loaded the application. However, with the current version, the JAR doesn't seem to get picked up when I put it in the plugins/ folder. I've tried running the application with the --clean flag, but that doesn't help. How do I tell the application that I want to install the plugin? Update: Got it working by adding the plugin to the config.ini - I've not needed to do that before, previously it would just be picked up when I placed it in the plugins/ folder. Is there a configuration option that disables the detection of new plugins from the plugins/ folder?
has title: Installing Eclipse RCP Plugins
tagged with: java
tagged with: eclipse
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/24767293
has comment: http://stackoverflow.com/comment/32156353
tagged with: eclipse-plugin
favorite count: 0
tagged with: eclipse-rcp
possible better answer: http://stackoverflow.com/a/21340566
has comment: http://stackoverflow.com/comment/32156296
has answer: http://stackoverflow.com/a/21340566
has comment: http://stackoverflow.com/comment/32157470
linked to: http://stackoverflow.com/q/1489648
has comment: http://stackoverflow.com/comment/32156222
linked to: http://stackoverflow.com/q/7769730
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/32157239
has answer: http://stackoverflow.com/a/24767293
has comment: http://stackoverflow.com/comment/32157336

http://stackoverflow.com/comment/32068564
type: Comment
comment on: http://stackoverflow.com/a/21281112
type: AnswerComment
has text: thank you @lejlot ,the numbers just for describing, the real numbers are more than these numbers,and it means that i should put each document separately in my train array? if you could please show me with an example
score: 0

http://stackoverflow.com/a/47299075
downvote count: 0
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21328371
has body: with @Keerthivasan Approach here is the complete working code. only problem was that answer cannot use the method like that as it is protected method. here is the working code. ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); int count = resultSetMetaData.getColumnCount(); for (int x = 1; x &lt;= count; x++) { Method method = null; try { method = com.mysql.jdbc.ResultSetMetaData.class.getDeclaredMethod("getField", int.class); method.setAccessible(true); com.mysql.jdbc.Field field = (com.mysql.jdbc.Field) method.invoke(resultSetMetaData, x); if (field.isPrimaryKey()) { System.out.println("-----------PK---------------------"); } else { System.out.println("+++++++++++++++NPK++++++++++++++++++"); } } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } }
has comment: http://stackoverflow.com/comment/81552640
type: Answer

http://stackoverflow.com/comment/31972415
comment on: http://stackoverflow.com/a/21218110
has text: but the output here looks 22.1.* , I need it to be *.22.1 like the Arabic letters.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32131519
has text: Hi yes now it works. Thanks a ton! Btw what does trim() do? first i heard it
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21317318

http://stackoverflow.com/q/21347457
type: Question
answer count: 1
has body: How do i explain this code to a class of Java Card Beginners in a way they will understand it perfectly: private void getBalance(APDU apdu) { byte[] buffer = apdu.getBuffer(); // inform system that the applet has finished // processing the command and the system should // now prepare to construct a response APDU // which contains data field short le = apdu.setOutgoing(); if (le &lt; 2) { ISOException.throwIt((byte) 0x6A86); } // informs the CAD the actual number of bytes // returned apdu.setOutgoingLength((byte) 2); // move the balance data into the APDU buffer // starting at the offset 0 buffer[0] = (byte) (balance &gt;&gt; 8); buffer[1] = (byte) (balance &amp; 0xFF);//How do i explain what happens here // send the 2-byte balance at the offset // 0 in the apdu buffer apdu.sendBytes((short) 0, (short) 2); }
favorite count: 0
has comment: http://stackoverflow.com/comment/32185916
has comment: http://stackoverflow.com/comment/32185811
has title: Explanation of how binary operator '&' Works in Java Card
has answer: http://stackoverflow.com/a/21347568
has comment: http://stackoverflow.com/comment/32247603
has comment: http://stackoverflow.com/comment/32185824
has comment: http://stackoverflow.com/comment/32187907
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/32185753
has comment: http://stackoverflow.com/comment/32185839
score: 3
tagged with: javacard
upvote count: 5
tagged with: java
linked to: http://stackoverflow.com/q/842817

http://stackoverflow.com/comment/31910859
has text: Isn't it easier to add an interface/method that modifies the list, and not to rely on a reflection voodoo?
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21192523

http://stackoverflow.com/a/21263879
type: Answer
answers question: http://stackoverflow.com/q/21263652
has body: Change 'return true' to 'break' Edit: switch(item.getItemId()) { case R.id.action_black: bkgr.setBackgroundResource(R.color.black); break; case R.id.action_red: bkgr.setBackgroundResource(R.color.red); break; case R.id.action_hello: TextView tv = (TextView) findViewById(R.id.hello1); tv.setText("What up people?"); break; default: break; return super.onOptionsItemSelected(item); }
has comment: http://stackoverflow.com/comment/32040540
score: 0

http://stackoverflow.com/comment/36434110
comment on: http://stackoverflow.com/q/21289923
type: QuestionComment
has text: hey can you post your code? how to do it with java? i also want to post from swing java application.?
score: 0
type: Comment

http://stackoverflow.com/q/21268694
tagged with: awt
has answer: http://stackoverflow.com/a/21292251
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21292251
possible better answer: http://stackoverflow.com/a/24462236
has title: Loading some TrueType Font from TTF file in Java causes FontFormatException: Font name not found
has answer: http://stackoverflow.com/a/24462236
type: AnsweredQuestion
has body: I am attempting to create a java.awt.Font instance from a TTF file on my system, but only some fonts are able to load without error. The code below is some test code I found online. When run on my system, it is able to load 285 fonts successfully (ex. Arial.ttf), but fails on 83 fonts, (ex. AmericanTypewriter.ttf). All errors are of the form FontFormatException: Font name not found with no embedded cause. Are there known issues with java.awt.Font and format compatibility? I can't find anything after much Googling. public static void main(String[] args) { String rootPath = "/Library/Fonts"; File root = new File(rootPath); if (root.canRead()) { String[] fontFiles = root.list(); Font font = null; for (String fontFile : fontFiles) { try { System.out.println(fontFile); font = Font.createFont(Font.TRUETYPE_FONT, new File(root + "/" + fontFile)); System.out.println(font); } catch (Exception e) { e.printStackTrace(); } } } } My environment is Java 7, OS X Mavericks (10.9.1). java version "1.7.0_40" Java(TM) SE Runtime Environment (build 1.7.0_40-b43) Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode) Any help here would be greatly appreciated.
tagged with: fonts
tagged with: java
tagged with: truetype
type: Question
upvote count: 4
answer count: 2
score: 4

http://stackoverflow.com/q/21330613
tagged with: unknown-host
answer count: 2
has answer: http://stackoverflow.com/a/22145364
downvote count: 0
has comment: http://stackoverflow.com/comment/33341585
tagged with: amazon-web-services
has title: What can be the best approach to handle java.net.UnknownHostException for AWS users?
favorite count: 0
has comment: http://stackoverflow.com/comment/33602602
tagged with: exception
has answer: http://stackoverflow.com/a/29169638
upvote count: 3
type: Question
type: AnsweredQuestion
score: 3
has body: My application sends message to Amazon Simple Notification Service (SNS) topic but sometime (6/10) I get java.net.UnknownHostException:sqs.ap-southeast-1.amazonaws.com. The reason of exception is described in the amazon web services discussion forums, please look: https://forums.aws.amazon.com/thread.jspa?messageID=499290&amp;#499290. My problem is similar to what described in forums of amazon but my rate of publishing messages to topic is very dynamic. It can be 1 message/second or 1 message/minute or no message in an hour. I am looking for a cleaner, better and safe approach, which guaranties sending of message to SNS topic. Description of problem in detail: Topic_Arn= arn of SNS topic where application wants to publish message msg = Message to send in topic // Just a sample example which publish message to Amazon SNS topic class SimpleNotificationService { AmazonSNSClient mSnsClient = null; static { createSnsClient() } private void static createSnsClient() { Region region = Region.getRegion(Regions.AP_SOUTHEAST_1); AWSCredentials credentials = new BasicAWSCredentials(AwsPropertyLoader.getInstance().getAccessKey(), AwsPropertyLoader.getInstance().getSecretKey()); mSqsClient = new AmazonSQSClient(credentials); mSqsClient.setRegion(region); } public void static publishMessage(String Topic_Arn, String msg) { PublishRequest req = new PublishRequest(Topic_Arn, msg); mSnsClient.publish(req); } } class which calls SimpleNotificationService class MessagingManager { public void sendMessage(String message) { String topic_arn = "arn:of:amazon:sns:topic"; SimpleNotificationService.publishMessage(topic_arn, message); } } Please note that this is a sample code, not my actual code. Here can be class design issue but please ignore those if they are not related to problem. My thought process says to have try-catch block inside sendMessage, so when we catch UnknownHostException then again retry but I am not sure how to write this in safer, cleaner and better way. So MessagingManage…
accepted answer: http://stackoverflow.com/a/22145364
tagged with: java
linked to: http://stackoverflow.com/q/6484275
possible better answer: http://stackoverflow.com/a/29169638
tagged with: amazon-sqs

http://stackoverflow.com/comment/32123661
type: AnswerComment
has text: hi i added the if statement in a new method in the ball class then i called it in the action performed methods and nothing happens. the bats still go off the screen. public void batBoundary() { if(x < 10 | x > 140 | y < 10 | y > 140) { xa = xa * -1; //switch direction of ball(bounce) ya = ya * -1; } }
type: Comment
comment on: http://stackoverflow.com/a/21312225
score: 0

http://stackoverflow.com/comment/32118694
type: QuestionComment
comment on: http://stackoverflow.com/q/21310497
score: 0
has text: `b may be equal to more than 2 integers` ,Sorry. Not possible.
type: Comment

http://stackoverflow.com/q/21318347
has answer: http://stackoverflow.com/a/21318378
answer count: 3
tagged with: composition
has body: In the below example I encountered java.lang.NullPointerException Brief overview: Class STANDALONE is related to class FACULTY by composition, because STANDALONE has an instance variable that holds a reference to a FACULTY object. I am trying to utilize the use of Composition and getting the below error. Please advice. FYI: This is the piece of the code where I have the problem. public abstract class person { // getters setters } public class faculty extends person { public faculty(){super();} public void someMethod(){ //some stuff "method calls" } } public class standalone { //composition has-a relationship public faculty faculty; public void facultyInfo(){ // Compiler is complaining about this line faculty.someMethod();} } public class MainOne { public static void main(String[] args) { standalone stand = new standalone(); //Compiler is complaining about this line stand.facultyInfo(); } } Exception: Exception in thread "main" java.lang.NullPointerException at first_.standalone.facultyStuff(standalone.java:22) at first_.MainOne.main(MainOne.java:13)
has comment: http://stackoverflow.com/comment/32133126
accepted answer: http://stackoverflow.com/a/21318378
possible better answer: http://stackoverflow.com/a/21318399
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21318399
tagged with: java
tagged with: methods
has answer: http://stackoverflow.com/a/21318474
type: Question
has title: Can't Access class methods using Composition?
tagged with: program-entry-point
score: 0
tagged with: nullpointerexception

http://stackoverflow.com/a/77298638
answers question: http://stackoverflow.com/q/21345121
has body: Coral language Function LargestNumber(integer num1,integer num2,integer num3) returns integer largestNum // LargestNumber function definition with 3 parameters // check if num3 is largest if num3 > num1 and num3 > num2 largestNum = num3 // check if num2 is largest elseif num2 > num1 and num2 > num3 largestNum = num2 // check if num1 is largest else largestNum = num1 Function SmallestNumber(integer num1,integer num2,integer num3) returns integer smallestNum // SmallestNumber function definition with 3 parameters // check if num3 is smallest if num3 < num1 and num3 < num2 smallestNum = num3 // check if num2 is smallest elseif num2 < num1 and num2 < num3 smallestNum = num2 // check if num1 is smallest else smallestNum = num1 Function Main() returns nothing integer n1 integer n2 integer n3 // Input 3 numbers by user n1 = Get next input n2 = Get next input n3 = Get next input // call function LargestNumber with 3 arguments Put "largest: " to output Put LargestNumber(n1, n2, n3) to output Put "\n" to output // call function SmallestNumber with 3 arguments Put "smallest: " to output Put SmallestNumber(n1, n2, n3) to output
score: 0
type: Answer

http://stackoverflow.com/a/21341376
has body: String stringOne = "JAVA"; String stringTwo = "DJDFKWAUERHFGJAVAORKFLASOWE"; int begin=stringTwo.indexOf(stringOne); int end=begin+stringOne.length(); if(begin==-1){ //not found }
type: Answer
answers question: http://stackoverflow.com/q/21341311
upvote count: 3
score: 3
downvote count: 0

http://stackoverflow.com/comment/32028061
has text: It would help if you could tell us the exact line the NullPointerException is being thrown from (not just the line number which is not very useful in snippets of code). Can you reduce your code to a small example to better demonstrate and isolate the problem? Posting an [SSCCE](http://sscce.org/) would be best.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21258422

http://stackoverflow.com/q/21190868
upvote count: 3
answer count: 1
has answer: http://stackoverflow.com/a/22351975
favorite count: 0
has title: Reading 3 of 9 extended bar codes using zxing - in Android
tagged with: android
type: AnsweredQuestion
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31946902
tagged with: java
tagged with: zxing
has body: I am working on replacing an expensive set of bespoke bar code readers with a nice and simple android app. I am calling the zxing package, and am able to read most bar codes, apart from Code 3 of 9 extended, which is the current standard barcode in our business (with over 2000 barcodes already in circulation). Is there a way of extending the zxing package to include Code 3 of 9 Extended bar codes?? My current code, which opens the google goggles app and successfully displays QR code and most 1D barcodes information via a Toast call, and I have tried explicitly defining which codes to read but have commented that line out as without it, the scanner should read all possible codes (just for testing): mGetScanButton = (Button) findViewById(R.id.buttonScan); mGetScanButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent("com.google.zxing.client.android.SCAN"); //intent.putExtra("SCAN_FORMATS", "CODE_39,CODE_93,CODE_128,DATA_MATRIX,ITF,CODABAR,EAN_13,EAN_8,UPC_A,QR_CODE" ); startActivityForResult(intent, 0); } }); public void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == 0) { if (resultCode == RESULT_OK) { // The Intents Fairy has delivered us some data! String contents = intent.getStringExtra("SCAN_RESULT"); //code below will be deleted after testing //String format = intent.getStringExtra("SCAN_RESULT_FORMAT"); // Toast call to display code when read Toast.makeText(this, contents, Toast.LENGTH_LONG).show(); // Handle successful scan } else if (resultCode == RESULT_CANCELED) { // Handle cancel } } } Your assistance is much appreciated, I would prefer not to ask the staff to replace all the bar codes... although this may be required! Example of Code 39 extended - encoded number = 25 EDIT : My app is actually opening the Google Goggle app rather than the Barcode Scanner app from zxing! I have now installed the correct Barcode Scanner app, and it works. Many thanks all…
has comment: http://stackoverflow.com/comment/31978790
tagged with: barcode-scanner
type: Question
has comment: http://stackoverflow.com/comment/31908775
accepted answer: http://stackoverflow.com/a/22351975

http://stackoverflow.com/q/21279364
has body: consider the following class structure: @Entity public class A {} @Entity public class B {} public class SubA extends A { private B b; } i want to persist a SubA instance to the database, but JPA is detecting that the member b is an entity and requires me to annotated it accordingly (@OneToOne(cascade = CascadeType.PERSIST)). i'd like to treat the member b as a plain serialized field and not an entity, i.e. save a 'snapshot' of the instance and not a reference to the corresponding record of B. i could of course just serialize the instance of B my self and save it as a byte array for example, but i was hoping there's a more elegant solution built-in JPA.
type: Question
has title: saving an entity class as a serialized field
answer count: 2
has answer: http://stackoverflow.com/a/21284834
tagged with: jpa
score: 0
tagged with: eclipselink
accepted answer: http://stackoverflow.com/a/21284834
has answer: http://stackoverflow.com/a/21279593
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21279593

http://stackoverflow.com/q/21336062
tagged with: maven
tagged with: spring
has answer: http://stackoverflow.com/a/21336607
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/32169376
tagged with: java
has comment: http://stackoverflow.com/comment/32164603
type: Question
has title: Server fails to start, Spring throws BeanDefinitionParsingException
linked to: http://stackoverflow.com/q/15394118
answer count: 1
has comment: http://stackoverflow.com/comment/32164482
score: 0
has comment: http://stackoverflow.com/comment/32165193
has body: I am working on a Spring MVC project that is using Maven. The server fails to start and throws this error while trying to. I am using Spring 4 and the error occurs when I include this piece of code in mvc-dispatcher-servlet.xml <mvc:resources mapping="/resources/**" location="/resources/" /> I want Spring to server static resources like JS and CSS without going through Dispatcher Servlet. org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Cannot locate BeanDefinitionParser for element [resources] Here are my file configuations: web.xml: <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> my club mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher / contextConfigLocation /WEB-INF/mvc-dispatcher-servlet.xml org.springframework.web.context.ContextLoaderListener mvc-dispatcher-servlet.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:security="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"> <context:component-scan base-package="com.mkyong.controller" /> <mvc:annotation-driven></mvc:annotation-driven> <mvc:resources mapping="/resources/**" loca…
has comment: http://stackoverflow.com/comment/32164910
type: UnansweredQuestion

http://stackoverflow.com/a/21302985
has body: I assume with set CLASSPATH=C:\ProjectWorkSpace\myProject\build\myProject\WEB-INF\lib\selenium-server-standalone-2.32.0.jar; C:\ProjectWorkSpace\myProject\build\myProject\WEB-INF\lib\jsoup-1.7.2.jar; You wanted to also add jsoup-1.7.2.jar; to the CLASSPATH variable, but you can't just extend a command over multiple lines like that. If you want to write this on multiple lines, each line (except for the last one of course) must end with the so called "line continuation character" which tells Windows that the command (in your case the SET) isn't finished yet, even though the line is. This character is ^ in Windows (comparable to the \ in Linux/Unix shell scripts) So what you need is: set CLASSPATH=C:\ProjectWorkSpace\myProject\build\myProject\WEB-INF\lib\selenium-server-standalone-2.32.0.jar; ^ C:\ProjectWorkSpace\myProject\build\myProject\WEB-INF\lib\jsoup-1.7.2.jar; ^ C:\ProjectWorkSpace\myProject\build\myProject\WEB-INF\lib\xstream-1.1.3.jar; ^ .... ^ .... ^ C:\ProjectWorkSpace\myProject\web\WEB-INF\classes; java -Xmx1024m -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=128m com.myProject.batch.PropertyRatesUpdaterBatchJob (btw: you have C:\ProjectWorkSpace\myProject\web\WEB-INF\classes twice in your list) You must make sure that there is no whitespace whatsoever after the ^ otherwise this will not work. Btw: you shouldn't be using the CLASSPATH variable anymore. It's better to explicitly define a classpath using the -cp (or -classpath parameter for the java command). In recent (up-to-date) versions of Java for Windows you don't need to specify each element in the classpath variable. Quote from http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html As a special convenience, a class path element that contains a base name of * is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR So you can get rid of all the lines and just use: java -cp C:\ProjectWorkSpace\myProject\build\myProject\WEB-INF\lib\*…
has comment: http://stackoverflow.com/comment/32107121
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21301953
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21301953

http://stackoverflow.com/comment/31974091
comment on: http://stackoverflow.com/q/21228022
score: 0
type: Comment
type: QuestionComment
has text: Yepp, but sometimes, Googlebot plays "Firefox" to look whether people are doing seo spaming etc ...

http://stackoverflow.com/q/21311150
has answer: http://stackoverflow.com/a/21321329
score: 0
answer count: 2
tagged with: console-input
tagged with: console
has comment: http://stackoverflow.com/comment/32119914
has answer: http://stackoverflow.com/a/21311520
type: AnsweredQuestion
has body: First I'm a noob to Java so don't be mad at me if I'm acting stupid - Thanks. As I said I'm trying to learn Java. Right now I'm trying to learn the right scanner for this mini-game, but I'm getting confused because people tell me to do it in two different ways. I just wan't to know which one to use and where I can use the other one. First Example: Scanner input = new Scanner(System.in); Second Example: Scanner input = new Scanner(System.in); String userInput = input.nextLine(); Please tell me how to make the " right " scanner for my mini-game and explain when I should use the other one. If you know which one to use, another way to create a scanner for this or just wanna share the scanners and how to use them - then please add it as an answer.
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/21292329
accepted answer: http://stackoverflow.com/a/21311520
possible better answer: http://stackoverflow.com/a/21321329
has title: Java: The right way to make a scanner

http://stackoverflow.com/a/21257307
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21242540
has body: When you run maven install on your multimodule project the maven reactor plugin will by default run install on parent project and then on the 3 or 4 sub module projects. Since you want to club all three wars together I would suggest create one more sub module named clubbedWars somejars servletsAndJsps springMVCapp angularJsApp clubbedWars Now add all the other modules as dependeny in this module clubbedWars. This module’s install will get run last after all other modules install has run. Now simply use copy-dependency and assembly plugin of maven in this module to club all these three wars together and install them in clubbedWars war or zip.

http://stackoverflow.com/comment/32103821
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21301770
score: 0
has text: It doesn't find the file path so returning null value!

http://stackoverflow.com/comment/32534440
score: 0
type: Comment
has text: I have put debug point but it is not coming this debug point when I check or uncheck.
type: AnswerComment
comment on: http://stackoverflow.com/a/21232886

http://stackoverflow.com/comment/31908938
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21191182
type: Comment
has text: The concept itself is a little different. You have to create those proto files because they are your contract description. Thinking on a scenario on which you have a system's integration with a partner, for example, it's easier just to send him your .proto files on which he'll create his messages and communicate to you. You will also have more scrict control over your contract changes. Play around a little bit with it and you'll get the main idea quickly. :)

http://stackoverflow.com/comment/32112959
score: 0
type: AnswerComment
has text: To be clear: you *don't* know how many String objects are being created in the pool once you get outside these simple examples. If N different .class files containing the same String literal get loaded by the classloader, then ... one String is created in the pool.
type: Comment
comment on: http://stackoverflow.com/a/21305043

http://stackoverflow.com/q/21327355
favorite count: 0
has answer: http://stackoverflow.com/a/21327471
has answer: http://stackoverflow.com/a/53882244
type: UnansweredQuestion
has body: I am working in the Multiple thread environment where i have multiple thread for the one class which exist in the one package. I am using log4j for logging purpose. Right now I can make a log in the one text file. But I want to make multiple log against my each thread. Like for First Thread my log file will be different , for second thread my log file will be different and so on. The method i have search out for logging is , we can use only one appender for one package in log4j. Can we use multiple appender for one package. Or any other technique which i can use to solve my problem. Here is my log4j properties file log4j.logger.com.ef.zoomanalyzer=DEBUG, Analyzer_Log log4j.appender.Analyzer_Log=org.apache.log4j.RollingFileAppender log4j.appender.Analyzer_Log.File=C:/AnalyzerLog/Analyzer.log log4j.appender.Analyzer_Log.MaxFileSize=1000KB log4j.appender.Analyzer_Log.MaxBackupIndex=10 log4j.appender.Analyzer_Log.layout=org.apache.log4j.PatternLayout
has answer: http://stackoverflow.com/a/21327515
upvote count: 3
tagged with: java
tagged with: multithreading
tagged with: logging
has comment: http://stackoverflow.com/comment/32149196
type: Question
score: 3
has title: Multiple Appender of Log4j for the same Package
linked to: http://stackoverflow.com/q/1172113
answer count: 3
downvote count: 0
tagged with: log4j

http://stackoverflow.com/a/21287764
type: AcceptedAnswer
has body: http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html#read(byte[]) states: This method blocks until input data is available, end of file is detected, or an exception is thrown. In other words, it is being filled when it has the data to be filed with. When you open a connection, the data are ready to be read. That is why InputStream does not have to wait for anything.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21287636
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21287636

http://stackoverflow.com/comment/32105612
score: 0
type: Comment
has text: I would be curious to see if ByteSet would perform better than BitSet on a high-level programming language, which would be the case if BitSet use a Byte to define a Bit
type: QuestionComment
comment on: http://stackoverflow.com/q/21302434

http://stackoverflow.com/a/21205037
downvote count: 1
type: AcceptedAnswer
has body: I think your best bet would be to return a common interface or superclass of both objects. If no such interface or class exists you could make one that defines the contract that both Foo and Bar will satisfy and the callers of getResult rely on. If the two classes are completely disjoint I would recommend not using such a getResult since it isn't very meaningful in that case.
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21204993
upvote count: 3
answers question: http://stackoverflow.com/q/21204993

http://stackoverflow.com/a/21241204
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21241060
answers question: http://stackoverflow.com/q/21241060
score: 1
has body: If you can get a point on the slider you could use. Color color = robot.getPixelColor((int)coord.getX(), (int)coord.getX()) The pseudo code would look like Robot robot = new Robot(); int xValue = slider.getLocationOnScreen().x + (int)(slider.getValue()/(double)(slider.getMaximum()-slider.getMinimum()) * slider.getWidth() +.5);//Calculates distance of the sliders' position). int yValue = slider.getLocationOnScreen().y + slider.getHeight()/2;//Calculates a y-value to extract the pixel from. Color color = robot.getPixelColor(xValue,yValue);
upvote count: 1

http://stackoverflow.com/q/21271803
type: Question
has answer: http://stackoverflow.com/a/21272000
has answer: http://stackoverflow.com/a/21271904
tagged with: java
has comment: http://stackoverflow.com/comment/32051759
possible better answer: http://stackoverflow.com/a/21272000
downvote count: 4
answer count: 2
has body: I'm having a hard time figuring this out. What is hashCode as I never fully understood it. Example: int m = 2; int b = "APA".hashCode() % 3000; int v = "KLK".hashCode() % 3000; for (int x = 0; x &lt;= v; x++) m = (m ^ x) % b; return m; What is the return value? Maybe this will make me fully understand hashCode.
favorite count: 0
has title: What is hashCode used for?
accepted answer: http://stackoverflow.com/a/21271904
has comment: http://stackoverflow.com/comment/32052262
score: -2
has comment: http://stackoverflow.com/comment/32051420
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32051454
upvote count: 2
has comment: http://stackoverflow.com/comment/32051423

http://stackoverflow.com/a/21405009
has comment: http://stackoverflow.com/comment/32389262
type: Answer
accepted answer of: http://stackoverflow.com/q/21285263
answers question: http://stackoverflow.com/q/21285263
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/32388470
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32387929
has body: Ok, so I didn't managed to find out why CallerService throws mentioned exception because even after decompiling mentioned paypal_base.jar, the code is quite cumbersome and it's hard to find out what's going on under the hood. It looks like it's outdated or something, because I can't find reference to this JAR anywhere on the net except for several places. But I really suggest you to stick to original documentation provided by PayPal. I tried myself and here's what I've found: Follow the Paypal API SDK and Downloads link from mentioned article, then click Merchant link under Classic APIs category (if you dig on the net, you'll find that PayPal Merchant API should be used for ExpressCheckout requests). Click Java button above and download SDK using either Maven (preferred) or simply using download link on the bottom of the page. Add downloaded JAR(s) to your project and remove other PayPal JARs because downloaded Merchant API jar should contain all necessary classes. Now everything is up to guessing :) So in your code snippet above you have formed instance of SetExpressCheckoutRequestType and you need some invocation code which takes your instance of SetExpressCheckoutRequestType and returns instance of SetExpressCheckoutResponseType. I used feature Search -> References -> Workspace in Eclipse to find where SetExpressCheckoutRequestType is used in Merchant API jar. This search showed that (besides other places) there is class named SetExpressCheckoutReq which has method setSetExpressCheckoutRequest(SetExpressCheckoutRequestType) Then I again used search feature to search for usages of SetExpressCheckoutReq class and found that there is class PayPalAPIInterfaceServiceService with method setExpressCheckout(SetExpressCheckoutReq setExpressCheckoutReq) which returns needed SetExpressCheckoutResponseType. Right next to setExpressCheckout(SetExpressCheckoutReq setExpressCheckoutReq) method, there is method which takes also ICredential parameter and has following signature: …

http://stackoverflow.com/comment/32003757
type: AnswerComment
score: 0
type: Comment
has text: That should be `doStuff()`. It's up to you, of course, but I'd recommend following at least the [basic naming conventions](https://en.wikipedia.org/wiki/Naming_convention_%28programming%29#Java).
comment on: http://stackoverflow.com/a/21244658

http://stackoverflow.com/comment/32290707
has text: So logging works. Seems like grizzly isn't talking much. So i'll try to work with the jersey logging https://jersey.java.net/documentation/latest/user-guide.html#tracing. But thanks so far.
type: AnswerComment
comment on: http://stackoverflow.com/a/21340908
type: Comment
score: 0

http://stackoverflow.com/comment/32156980
has text: @Kojotak how can I use `jstl` instead of `<%=request.getUserPrincipal().getName().toString()%>`?
type: AnswerComment
comment on: http://stackoverflow.com/a/21329436
score: 0
type: Comment

http://stackoverflow.com/comment/32163742
comment on: http://stackoverflow.com/a/21322065
type: AnswerComment
score: 0
type: Comment
has text: Thanks for you answer. then I'll have that remake my database estructure?? Tnank..

http://stackoverflow.com/q/21189465
type: Question
has comment: http://stackoverflow.com/comment/31904572
has body: Alright, I believe I have this program CounterTester.java down but in my output the program is increasing the way I want it to but it is not decreasing the way I want it to. Any suggestions thank you. /** * This program is used to test the Counter class. It constructs the a counter * using both constructors provided by the Counter class. * */ public class CounterTester { static int myCount; public CounterTester() { int init = 1; myCount = init; } public CounterTester(int i) { } public static void main(String[] args) { CounterTester counter = new CounterTester(); //create a new counter with a step value of 1 counter.increase(myCount); //add 1 System.out.println("Expected Count: 1 -----&gt; Actual Count: " + counter.getCount()); counter.increase(myCount++); //add 1 System.out.println("Expected Count: 2 -----&gt; Actual Count: " + counter.getCount()); counter.decrease(); //subtract 1 System.out.println("Expected Count: 1 -----&gt; Actual Count: " + counter.getCount()); counter = new CounterTester(10); //create a new counter with a step value of 10 System.out.println("Expected Count: 0 -----&gt; Actual Count: " + counter.getCount()); counter.increase(myCount++); //add 10 System.out.println("Expected Count: 10 ----&gt; Actual Count: " + counter.getCount()); counter.decrease(); //subtract 10 System.out.println("Expected Count: 0 -----&gt; Actual Count: " + counter.getCount()); counter.decrease(); //subtract 10 System.out.println("Expected Count: -10 -----&gt; Actual Count: " + counter.getCount()); } private String getCount() { return ""+myCount; } private void decrease() { myCount--; } private void increase(int i) { myCount++; } public void reset() { } } Thank you in advance.
upvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/31904541
has answer: http://stackoverflow.com/a/21189605
favorite count: 0
has title: CounterTester.java The Output is Correct but it is not decreasing correctly
has comment: http://stackoverflow.com/comment/31906165
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21197831
has comment: http://stackoverflow.com/comment/31904783
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21189483
tagged with: java

http://stackoverflow.com/comment/32134782
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21319031
has text: you mean many to many relation. If so here is a way http://stackoverflow.com/questions/10294338/many-to-many-hibernate-mapping-for-additional-property-in-the-join-table

http://stackoverflow.com/comment/31944071
type: Comment
has text: I found it! Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/users","root","1234"); PreparedStatement st = (PreparedStatement) con.prepareStatement("INSERT INTO user (username,age,school,password) VALUES (?,?,?,?)"); st.setString(1, user); st.setString(2, age); st.setString(3, school); st.setString(4, password); st.executeUpdate(); st.close(); con.close();
comment on: http://stackoverflow.com/a/21207167
score: 1
type: AnswerComment

http://stackoverflow.com/comment/32002523
has text: Don't you want it to return false if everything else is not true though?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21243930

http://stackoverflow.com/a/21348158
score: 6
accepted answer of: http://stackoverflow.com/q/21345203
upvote count: 6
answers question: http://stackoverflow.com/q/21345203
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32256771
type: Answer
has body: Regarding your first question: is it a ManyToOne? It depends. If several orders can have the same shipping address, then it's a ManyToOne. If only one order can have a given shipping address, then it's a OneToOne. Same for billing address. I'm not sure making the association bidirectional is a good idea. I probably wouldn't do it in this case. But if you want to make it bidirectional, then you have to make them bidirectional. You indeed have two different associations here. The mapping would thus look like the following: @OneToMany(mappedBy = "shippingAddress") private Set&lt;Order&gt; shippedOrders; @OneToMany(mappedBy = "billingAddress") private Set&lt;Order&gt; billedOrders; or, if the association is in fact a OneToOne (see answer to the first question): @OneToOne(mappedBy = "shippingAddress") private Order shippedOrder; @OneToOne(mappedBy = "billingAddress") private Order billedOrder;

http://stackoverflow.com/comment/32170195
score: 0
has text: thanks! exactly what i was looking for,+1 for working like a charm
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21325313

http://stackoverflow.com/comment/31952826
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21216432
has text: I think debugging your code will help...

http://stackoverflow.com/q/21334068
type: Question
score: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: I want to know is it possible to save bargraph,piechart developed using jfreechart in excel sheet directly.If possible can anyone guide as to how this can be done.I know that using jfreechart we can save bargraph,piechart in .png,jpeg format but is it possible to directly save it in excel sheet.
has answer: http://stackoverflow.com/a/21334117
tagged with: java
upvote count: 1
tagged with: jfreechart
has title: Saving charts in Excel sheets
downvote count: 1

http://stackoverflow.com/comment/32130438
type: Comment
has text: @chrisedwards can you edit your post and post the same it would be much easier
comment on: http://stackoverflow.com/a/21316487
score: 0
type: AnswerComment

http://stackoverflow.com/a/21328197
answers question: http://stackoverflow.com/q/21328007
downvote count: 0
has body: It looks like you're trying to use the new try with resources in Java 7. To do that, you use () around your resources: try ( FileReader fr = new FileReader("mikuname.txt"); BufferedReader br = new BufferedReader(fr); ) { String str; while ((str = br.readLine()) != null){ System.out.println(str + "\n"); } // You don't need this, it's done by the try: br.close(); } ...and of course, you have to make sure you're using Java 7, and you have to use it in a proper context (within a method or within either an instance or static initializer).
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/31960710
score: 0
type: Comment
type: QuestionComment
has text: @Dave, exactly my thinking. I will use the same set-up for enemies.
comment on: http://stackoverflow.com/q/21220535

http://stackoverflow.com/a/21314797
score: 0
answers question: http://stackoverflow.com/q/21313177
type: Answer
has body: You can multiply the number of solutions you get with a given number of matches. You can also cache the number of solutions up to a give number. public static long solutionsFor(int matchCount) { long[] counts = new long[matchCount+1]; for(int i = 0; i &lt;= matchCount; i++) { long count = ... calculate count based on previous values ... counts[i] = count; } return counts[matchCount]; } The performance gain is that the cost is O(n) and you are likely to get your answer in a few milli-seconds for the largest problems which return a long.

http://stackoverflow.com/comment/31993076
score: 0
has text: @user2976267 i am saying it bcoz your method also should work. is your package name right for the cusotm view in xml??
type: AnswerComment
comment on: http://stackoverflow.com/a/21238497
type: Comment

http://stackoverflow.com/comment/49979418
comment on: http://stackoverflow.com/q/21195402
type: Comment
type: QuestionComment
has text: I have applied that same code with smack 4.1.1 but give me so much errors.... anybody can help with this?
score: 0

http://stackoverflow.com/comment/31921865
has text: Premature optimization. Math.sqrt(allEvil);
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21198799
type: QuestionComment

http://stackoverflow.com/q/21185459
answer count: 1
has answer: http://stackoverflow.com/a/21185485
tagged with: python
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21185485
has title: Python equivalent to java.io.File
type: Question
has body: I'm writing script to automate system administration tasks on my Linux system. This involves compressing, moving, deleting, renaming and searching a lot of files. I learned doing these in Python by looking up examples on Internet and here on Stackoverflow. The typical approach is to create a command string and pass it to the OS to have it executed. print Popen("cat /home/kshitiz/myfile", stdout=PIPE).stdout.read() The directory paths are handled as strings. Now consider following example: We have a program that asks user for a dir and a file and creates a path. If a user enters /home/kshitiz and myfile the path becomes /home/kshitizmyfile. In Python I must do jugglery with strings to deal with this. In Java I can simply do: new File(parentDir, filename) Since Python is supposed to be better at OS administration it surprises me that it doesn't have object oriented abstractions over the file system. What are the other approaches in Python to deal with the file system?
score: 0

http://stackoverflow.com/a/21317521
type: Answer
upvote count: 3
has body: no idea about your goal without detailed description, explanation JTextArea should be placed in JScrollPane set intial setPreferredSize for JTextArea, e.g. JTextArea(5, 10) you are put three JPanels (is there reason ??? for this components hierarchy) one to JScrollPane, JTextArea is placed directly into JPanel instead of to the JScrollPane then usage of ComponentListener is useless and contraproductive
score: 3
has comment: http://stackoverflow.com/comment/32131987
downvote count: 0
answers question: http://stackoverflow.com/q/21317267

http://stackoverflow.com/comment/31918136
has text: I'll get the following error message on executing `wsdl2java -d test your.wsdl`: `WSDLToJava Error: Non-unique body parts! In a port, operations must have unique operation signatures on the wire for successful dispatching. In port {http://pad.politio.it/ACSAuth}ACSAuth, operations "{http://pad.polito.it/ACSAuth}updateManager" and "{http://pad.polito.it/ACSAuth}bootstrap" have the same request body block {http://pad.polito.it/ACSAuth}AccessDB`
comment on: http://stackoverflow.com/q/21196171
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/21258422
favorite count: 0
has comment: http://stackoverflow.com/comment/32028167
possible better answer: http://stackoverflow.com/a/21262870
has body: I have a problem in my plugin (Bukkit for Minecraft) that makes this function throw a NullPointerException on line 733 (I cut many parts, the lines are separated), on the .get() method of the HashMap class. It could also be the condition just before, I don't really know or understand what's going on. Before I checked for .containsKey(), it errored on the .get(). private float getTempFromArmor(Player player) { float armorValue = 0.0F; ItemStack helmet = player.getEquipment().getHelmet(); ItemStack chestplate = player.getEquipment().getChestplate(); ItemStack leggings = player.getEquipment().getLeggings(); ItemStack boots = player.getEquipment().getBoots(); HashMap&lt;Material, Float&gt; helmetValues = new HashMap&lt;Material, Float&gt;(); helmetValues.put(Material.LEATHER_HELMET, 0.2F); helmetValues.put(Material.IRON_HELMET, -0.2F); helmetValues.put(Material.CHAINMAIL_HELMET, -0.1F); helmetValues.put(Material.GOLD_HELMET, 0.1F); helmetValues.put(Material.DIAMOND_HELMET, 0.0F); HashMap&lt;Material, Float&gt; chestplateValues = new HashMap&lt;Material, Float&gt;(); chestplateValues.put(Material.LEATHER_CHESTPLATE, 0.3F); chestplateValues.put(Material.IRON_CHESTPLATE, -0.3F); chestplateValues.put(Material.CHAINMAIL_CHESTPLATE, -0.15F); chestplateValues.put(Material.GOLD_CHESTPLATE, 0.15F); chestplateValues.put(Material.DIAMOND_CHESTPLATE, 0.0F); HashMap&lt;Material, Float&gt; leggingsValues = new HashMap&lt;Material, Float&gt;(); leggingsValues.put(Material.LEATHER_LEGGINGS, 0.2F); leggingsValues.put(Material.IRON_LEGGINGS, -0.2F); leggingsValues.put(Material.CHAINMAIL_LEGGINGS, -0.1F); leggingsValues.put(Material.GOLD_LEGGINGS, 0.1F); leggingsValues.put(Material.DIAMOND_LEGGINGS, 0.0F); HashMap&lt;Material, Float&gt; bootsValues = new HashMap&lt;Material, Float&gt;(); bootsValues.put(Material.LEATHER_BOOTS, 0.1F); bootsValues.put(Material.IRON_BOOTS, -0.1F); bootsValues.put(Material.CHAINMAIL_BOOTS, -0.05F); bootsValues.put(Material.GOLD_BOOTS, 0.05F); bootsValues.put(…
has comment: http://stackoverflow.com/comment/32026843
type: AnsweredQuestion
score: -5
has answer: http://stackoverflow.com/a/21262813
has title: HashMap get method returns NullPointerException
tagged with: java
tagged with: bukkit
has comment: http://stackoverflow.com/comment/32028286
type: Question
accepted answer: http://stackoverflow.com/a/21262813
answer count: 2
tagged with: hashmap
upvote count: 0
tagged with: minecraft
downvote count: 5
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/21262870
has comment: http://stackoverflow.com/comment/32028061

http://stackoverflow.com/q/21272216
has answer: http://stackoverflow.com/a/21273245
accepted answer: http://stackoverflow.com/a/21273245
has comment: http://stackoverflow.com/comment/32053064
score: 0
has comment: http://stackoverflow.com/comment/32052701
answer count: 2
has title: return an object from socket using asynctask
has comment: http://stackoverflow.com/comment/32052307
has body: I am trying to save a Collection which I get through a socket connection. I use AsyncTask to read the message from socket that has the Collection. My problem is that I cannot save this message. In OnpostExecute() the Log.d() messages are not being displayed. If I do ReceiveMsgAsyncTask().execute().get() the UI freezes. I have read many similar issues but I cannot find a solution. How can I save the message received from my socket?Thanks in advance.. private class ReceiveMsgAsyncTask extends AsyncTask&lt;Object, Void, Object&gt; { final Collection &lt;String&gt; col = new ArrayList&lt;String&gt;(); Socket socket = null ; ObjectInputStream in = null; @Override protected Object doInBackground(Object... arg0) { // TODO Auto-generated method stub; Object msg = null; try { socket = new Socket(host,50000); in = new ObjectInputStream(socket.getInputStream()); msg = in.readObject(); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally { try { in.close(); socket.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return msg; } protected void onPostExecute(Object result) { // TODO Auto-generated method stub Log.d("mesg","success"); super.onPostExecute(result); col.addAll((Collection&lt;?extends String&gt;)result); } Here is the Server's method that sends the Collection to client public void splitData(Master master,String client){ int chunk=0; int chunckStart=0; BufferedReader br = null; ObjectOutputStream out = null; try { String sCurrentLine; br = new BufferedReader(new FileReader("input")); int numberOflines=0; while ((sCurrentLine = br.readLine()) != null) { numberOflines++; } br.close(); br = new BufferedReader(new FileReader("input")); for (int i=1;i&lt;=master.numberOfWorkers;i++){ out = new ObjectOutputStream(…
has comment: http://stackoverflow.com/comment/32053077
tagged with: sockets
tagged with: android
has comment: http://stackoverflow.com/comment/32052882
tagged with: android-asynctask
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32053104
has comment: http://stackoverflow.com/comment/32052698
possible better answer: http://stackoverflow.com/a/21272911
has answer: http://stackoverflow.com/a/21272911
type: Question
has comment: http://stackoverflow.com/comment/32052936
has comment: http://stackoverflow.com/comment/32052853
tagged with: java

http://stackoverflow.com/comment/32142411
comment on: http://stackoverflow.com/a/21322419
has text: @Basilevs I have updated my answer to highlight this fact.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21339283
score: 0
has body: private CalculatorModel calcModel; public CalculatorHelper(){ calcModel=new CalculatorModel(); } is composition which is used here to separate concerns. The CalculatorHelper's concern is to know how to do addition, substraction, .. while the CalculatorModel knows the values, how to provide them to the outside and how to store them. CalculatorHelperhas therefore an instance ofCalculatorModel` to which it can delegate all the things it does not know about. E.g. public void setOperand1(double value){ calcModel.setOperand1(value); } The overall design is still questionable. First of all is it a bad encapsulation of a "calculator" because none of math operation reflect back to the model in any way. There needs to be a third class (CalculatorHelperHelper?) that knows how to deal with more than two operands. It is also questionable whether or not a CalculatorModel should have two values at once. Two separate value objects would IMO make a lot more sense and would result in more modular code that would also be easier to understand as composition of objects. The last point in this example is that encapsulating "storage" of values into CalculatorModel does not provide any real benefit here. It would if there was some kind of database backend or otherwise "complicated" logic that does not belong into CalculatorHelper. I would have taken more or less your approach in a simple real world scenario. Your code is not wrong. It's just a different approach. The code in the context of the book and given that it is an example to show some design techniques is ok for that purpose. I would just do it very much different if I was to write a calculator. OO design is on the other hand not right or wrong and people can argue a lot about what good design is.
type: Answer
answers question: http://stackoverflow.com/q/21338371

http://stackoverflow.com/comment/32078317
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21283375
has text: i apologize , its saved now

http://stackoverflow.com/q/21208292
has answer: http://stackoverflow.com/a/21208611
score: 0
linked to: http://stackoverflow.com/q/513832
answer count: 3
tagged with: sql
has comment: http://stackoverflow.com/comment/31938269
linked to: http://stackoverflow.com/q/767372
favorite count: 0
has comment: http://stackoverflow.com/comment/31938286
has comment: http://stackoverflow.com/comment/31938558
has answer: http://stackoverflow.com/a/21208544
has comment: http://stackoverflow.com/comment/31938362
downvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31938273
has body: I have this query( the parameters of the query are given by input: both table and name and password are string given by text field. //... ResultSet rs = st.executeQuery("select * " + "from `"+ table + "` " + "where Name='" + name + "' " + " and Password='" + password + "'"); and after this i don't understand why i can't enter in this if: else if (table=="products"){ // ... } and therefore I can not go along with the program
has comment: http://stackoverflow.com/comment/31938287
accepted answer: http://stackoverflow.com/a/21208892
tagged with: java
duplicate of: http://stackoverflow.com/q/513832
tagged with: mysql
has comment: http://stackoverflow.com/comment/31938313
has title: sql syntax in java with string
has comment: http://stackoverflow.com/comment/31938299
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/21208892
possible better answer: http://stackoverflow.com/a/21208544

http://stackoverflow.com/q/21215091
type: Question
tagged with: jakarta-ee
tagged with: performance
tagged with: monitoring
has title: Java EE Application counters monitoring
answer count: 2
has body: I have a Java EE application deployed on a WebLogic, I have set up a monitoring counters for it, and I got the following results: Actually I am not familiar with most of these counters, I have read about most of them but I didn't get how to determine if my app behave in a good way or bad way. My questions are: How can i know if am doing good (if my app behave in a good way)? is there any spacific numbers to start compare the system behavior from. What is the most important counter that i have to focus on them? Any Idea or Article to help me for understand this counters. Note: My Server Machine specs are:(OS:MS Windows server 2008, CPU : Core i7, RAM : 16GB) AND JVM Params (Xmx : 4096, Xms : 1024, -XX:MaxPermSize : 1200, -XX:NewSize : 1200) Thanks in Advance.
favorite count: 0
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/21215257
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21215222
downvote count: 1

http://stackoverflow.com/a/21226451
accepted answer of: http://stackoverflow.com/q/21225479
answers question: http://stackoverflow.com/q/21225479
has body: All you really need to make a "Linked List" is to have each Task contain a Task (The next one in the list). The problem is if you do it this way you can't take advantages of all the stuff built into Java Collections like sorting and iterators. On the other hand, if you are keeping it in a traditional linked list, you have to be iterating over the list anyway to find the one you want so why not just continue iterating over the rest and calling calculate on each. You probably don't even need it to be a linked list, pass a Task into calculateStartTime and call it good. I like what you are trying to do, but it might be more work than it's worth compared to the alternative.
type: AcceptedAnswer
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/31971484

http://stackoverflow.com/q/21229493
has comment: http://stackoverflow.com/comment/31976651
has answer: http://stackoverflow.com/a/21236218
answer count: 5
has title: How to store a downloaded file object from S3 to a local directory
type: AnsweredQuestion
tagged with: download
possible better answer: http://stackoverflow.com/a/21305156
has answer: http://stackoverflow.com/a/41206245
has answer: http://stackoverflow.com/a/21305156
tagged with: file
has answer: http://stackoverflow.com/a/47055619
accepted answer: http://stackoverflow.com/a/21236218
type: Question
has comment: http://stackoverflow.com/comment/125049551
has body: I'm trying to download a file from S3 using AWS SDK for Java and store the particular file in a local directory in my PC. The code I wrote for downloading the object is: public void download(String key) { S3Object obj=s3Client.getObject(new GetObjectRequest(bucketname,key)); } But what I actually want to do is to pass the local path as a parameter instead of key and store the downloaded file obj in that particular directory say /tmp/AWSStorage/ in my linux box. Can you please suggest a way of doing it?
tagged with: amazon-s3
tagged with: java
upvote count: 4
downvote count: 0
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/21231127

http://stackoverflow.com/a/21334801
type: Answer
accepted answer of: http://stackoverflow.com/q/21318558
answers question: http://stackoverflow.com/q/21318558
downvote count: 0
score: 1
has body: Opening a new browser tab (or window) is not the same as opening a new connection. Browsers are really good at re-using already open connections and the 20 seconds delay is evidence of that. You can verify this by printing out the remote IP + port in your server, it will be the same for both requests. In Firefox you can force a new connection by pressing ctrl+F5, Chrome probably has a similar feature. But you could also write a little (multi-threaded) client program that does the get-request: it is not that difficult to write and will come in handy when you need to test/debug other features of your server.
has comment: http://stackoverflow.com/comment/32169769
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/107375508
comment on: http://stackoverflow.com/q/21325777
score: 0
has text: P.S. I think I am saying what Malav said ...
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31917431
type: Comment
type: AnswerComment
has text: @user3056052 Many, many questions and answers have been asked about properly setting up and sharing database connections. Consider http://stackoverflow.com/questions/241454/best-way-to-manage-database-connection-for-a-java-servlet and https://www.google.com/search?q=servlet%20database%20connection
score: 0
comment on: http://stackoverflow.com/a/21193002

http://stackoverflow.com/a/21279736
has body: If you use a label provider based on StyledCellLabelProvider (perhaps one based on DelegatingStyledCellLabelProvider) you can specify COLORS_ON_SELECTION to retain normal colors on selection. If that is not good enough (don't have Windows here to test) you can override the paint method - again you can try using event.detail &amp;= ~SWT.SELECTED to suppress the normal selection handling or even handle the paint yourself.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21278512
downvote count: 0
has comment: http://stackoverflow.com/comment/32906062
type: Answer

http://stackoverflow.com/a/21194284
downvote count: 0
type: Answer
upvote count: 5
answers question: http://stackoverflow.com/q/21194240
score: 5
has body: You can't do this with if statement in Java, but with the switch statement. switch (value) { case 1: case 2: case 3: { //do something } } This will check if the value is equal to 1, 2 or 3.

http://stackoverflow.com/comment/32066323
type: Comment
comment on: http://stackoverflow.com/a/21279964
score: 0
type: AnswerComment
has text: You will need to close this question since its answered..by giving a tick to the right one

http://stackoverflow.com/comment/31935123
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21205845
type: Comment
has text: im using scene builder so i dont need to start the textArea that way, but ill try that static void println.

optaplanner
tags question: http://stackoverflow.com/q/21205981
tags question: http://stackoverflow.com/q/21281989
tag name: optaplanner
type: Tag

http://stackoverflow.com/comment/32001792
score: 0
comment on: http://stackoverflow.com/q/21243619
type: Comment
type: QuestionComment
has text: Check your installed JRE's, and which JRE maven is configured to use under Windows > preferences.

http://stackoverflow.com/a/21317576
accepted answer of: http://stackoverflow.com/q/21316869
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I'm supposing here that you have a good understand of java programming. Fisrtly, I think you should understand java for web. I recommend this book: Head First Servlets and JSP http://www.amazon.com/Head-First-Servlets-JSP-Certified/dp/0596516681/ Then you can learn web services with java: Java Web Services: Up and Running http://www.amazon.com/Java-Web-Services-Up-Running/dp/1449365116 Of course, there are many tutorials over the internet as well, but books give you a lot of background information.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21316869

http://stackoverflow.com/comment/32065687
type: Comment
type: QuestionComment
has text: Sorry for not being clear, both. In system only the 1.7 edition is listed but it is too unchecked.
comment on: http://stackoverflow.com/q/21263666
score: 0

http://stackoverflow.com/comment/31988449
score: 0
type: Comment
has text: Could you please add your error log?
type: QuestionComment
comment on: http://stackoverflow.com/q/21234674

http://stackoverflow.com/a/21609305
accepted answer of: http://stackoverflow.com/q/21278547
answers question: http://stackoverflow.com/q/21278547
score: 0
type: AcceptedAnswer
type: Answer
has body: The solution was actually quite simple. The clients needed to add the following in their {java.home}\lib\security\java.policy file: grant codeBase "https://mydomain.com:443" { permission java.io.SerializablePermission "enableSubclassImplementation"; }

http://stackoverflow.com/comment/32117118
comment on: http://stackoverflow.com/a/21309638
type: AnswerComment
score: 0
type: Comment
has text: Never the less, I would propose you to use <c:out> or similar instead.

http://stackoverflow.com/comment/134528375
score: 0
type: AnswerComment
type: Comment
has text: can't you just keep `<maven.compiler.source>11</maven.compiler.source>` and `<maven.compiler.target>11</maven.compiler.target>`?
comment on: http://stackoverflow.com/a/30940792

http://stackoverflow.com/a/21201575
accepted answer of: http://stackoverflow.com/q/21201383
has comment: http://stackoverflow.com/comment/31936998
answers question: http://stackoverflow.com/q/21201383
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: No. You can't do that. The reason being, the variable a in position 2 is a local variable, which can only be accessed with it's simple name, in the enclosing scope. From JLS &sect;6.4: A local variable (§14.4), formal parameter (§8.4.1), exception parameter (§14.20), and local class (§14.3) can only be referred to using a simple name (§6.2), not a qualified name (§6.6). Now, this clears that you can only access that variable with just a. But, you have another variable in method local class B which shadows that local variable a in position 2, which is again shadowed by local variable in position 4. Now in print statement, a would access the variable from nearmost enclosing scope, that is local variable at position 4. If you remove that variable, it will print the variable at position 3. And then if you remove it, it will print the variable at position 2. So, the point is, there is no way to access the local variable a at position 2, because that is shadowed.

http://stackoverflow.com/q/21202415
has answer: http://stackoverflow.com/a/21202501
linked to: http://stackoverflow.com/q/8759868
downvote count: 0
has comment: http://stackoverflow.com/comment/31928032
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/45935754
possible better answer: http://stackoverflow.com/a/21202473
tagged with: operator-precedence
has title: Java OR operator precedence
type: AnsweredQuestion
has body: How to chain conditional statements in Java in a way that if b is false, than do not check c? If a and c are false, and b is true, does c will be checked? if (a || b || c) I am looking for similar feature that PHP holds with difference between OR and ||
has answer: http://stackoverflow.com/a/21202473
tagged with: java
has answer: http://stackoverflow.com/a/21202440
has answer: http://stackoverflow.com/a/21202438
type: Question
score: 9
upvote count: 9
accepted answer: http://stackoverflow.com/a/21202438

http://stackoverflow.com/a/21261903
has comment: http://stackoverflow.com/comment/32035225
has comment: http://stackoverflow.com/comment/32033104
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21261866
has comment: http://stackoverflow.com/comment/32035254
has comment: http://stackoverflow.com/comment/32033137
has comment: http://stackoverflow.com/comment/32034637
answers question: http://stackoverflow.com/q/21261866
type: Answer
has comment: http://stackoverflow.com/comment/32033720
score: 8
downvote count: 0
has body: The fields are all within the Test class, so all the classes and fields within Test can see each other even when private. Essentially the private keyword says "Only stuff in Test can see me" and in this case everything is in Test.
has comment: http://stackoverflow.com/comment/32033127
has comment: http://stackoverflow.com/comment/32033766
has comment: http://stackoverflow.com/comment/32033397
upvote count: 8

http://stackoverflow.com/comment/32073821
score: 0
has text: @Iverie the lastIndexOf can only search for a particular fixed string. It can't search for a regex pattern. You will have to take the approach in Njol's answer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21283633

http://stackoverflow.com/q/21321316
downvote count: 0
score: 4
tagged with: fix-protocol
favorite count: 0
tagged with: quickfix
upvote count: 4
has answer: http://stackoverflow.com/a/21329801
type: UnansweredQuestion
has title: QuickFIXJ Logon Issue
has answer: http://stackoverflow.com/a/21321581
tagged with: hft
has body: Having issues w/QuickFixJ. The issue is that I can't correctly send a logon message. Additionally, I'm having a hard-time understanding how to setup the flow of messages. I'm not trying to execute trades, just retrieve market data. The error: 20140123-22:55:56: No responder, not sending message: Here's all my details: Incoming: cat incoming/* 8=FIXT.1.19=11035=A34=149=REDACTED-MD52=20140123-22:55:56.37256=NDXMD98=0108=30141=Y553=REDACTED100554=REDACTED1137=910=231?220140123-22:55:56.470 Outgoing: 20140123-22:55:50: Session FIXT.1.1:REDACTED-MD->NDXMD schedule is weekly, SUN 00:00:00-UTC - FRI 00:00:00-UTC 20140123-22:55:50: Created session: FIXT.1.1:REDACTED-MD->NDXMD 20140123-22:55:53: Initiated logon request 20140123-22:55:56: No responder, not sending message: 8=FIXT.1.19=11035=A34=149=REDACTED-MD52=20140123-22:55:56.37256=NDXMD98=0108=30141=Y553=REDACTED100554=REDACTED1137=910=231 8=FIXT.1.19=8135=A34=149=REDACTED-MD52=20140123-22:55:52.64356=NDXMD98=0108=30141=Y1137=910=114 8=FIXT.1.19=8335=549=NDXMD56=REDACTED-MD52=20140123-22:55:53.75134=158=Missing field. Type 55310=054 8=FIXT.1.19=11035=A34=149=REDACTED-MD52=20140123-22:55:56.37256=NDXMD98=0108=30141=Y553=REDACTED100554=REDACTED1137=910=231 And my stdout is: J an 23, 2014 10:55:37 PM REDACTED.REDACTEDMain main INFO: REDACTED startup Jan 23, 2014 10:55:49 PM quickfix.SessionSchedule <init> INFO: [FIXT.1.1:REDACTEDB-MD->NDXMD] weekly, SUN 00:00:00-UTC - FRI 00:00:00-UTC Successfully called onCreate for sessionId : FIXT.1.1:REDACTEDB-MD->NDXMD Jan 23, 2014 10:55:50 PM quickfix.mina.NetworkingOptions logOption INFO: Socket option: SocketTcpNoDelay=true Jan 23, 2014 10:55:50 PM quickfix.mina.NetworkingOptions logOption INFO: Socket option: SocketSynchronousWrites=false Jan 23, 2014 10:55:50 PM quickfix.mina.NetworkingOptions logOption INFO: Socket option: SocketSynchronousWriteTimeout=30000 Jan 23, 2014 10:55:51 PM quickfix.mina.initiator.IoSessionInitiator <init> INFO: [FIXT.1.1:REDACTEDB-MD->NDXMD] [web-fix.RE…
type: Question
tagged with: java
tagged with: financial
answer count: 3
has answer: http://stackoverflow.com/a/43322436

http://stackoverflow.com/a/21324207
score: 6
has comment: http://stackoverflow.com/comment/32342695
upvote count: 6
answers question: http://stackoverflow.com/q/21324036
has comment: http://stackoverflow.com/comment/32145115
has comment: http://stackoverflow.com/comment/32277280
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21324036
has comment: http://stackoverflow.com/comment/33313978
has body: Java does not natively support this behaviour. If you were to use Google Guava then you could do this: for (final Rect rect : Iterables.concat(map1.values(), map2.values())) { } You could also knock up a quick utility class. I've used varargs here so that the usage is nicer; the downside is that the compiler will throw lots of warnings as generic array creation and varargs methods are unchecked. public class CombinedIterable&lt;T&gt; implements Iterable&lt;T&gt; { public static &lt;T&gt; Iterable&lt;T&gt; concat(Iterable&lt;? extends T&gt;... iterables) { return new CombinedIterable&lt;T&gt;(iterables); } private final List&lt;Iterable&lt;? extends T&gt;&gt; iterables; private CombinedIterable(Iterable&lt;? extends T&gt;... iterables) { this.iterables = Arrays.asList(iterables); } @Override public Iterator&lt;T&gt; iterator() { return new Iterator&lt;T&gt;() { private final Iterator&lt;Iterable&lt;? extends T&gt;&gt; pos = iterables.iterator(); private Iterator&lt;? extends T&gt; iter = pos.next().iterator(); @Override public boolean hasNext() { if (iter.hasNext()) { return true; } if (pos.hasNext()) { iter = pos.next().iterator(); } return iter.hasNext(); } @Override public T next() { return iter.next(); } @Override public void remove() { throw new UnsupportedOperationException("Not supported."); } }; } } Usage is something like: final List&lt;String&gt; s1 = Arrays.asList(new String[]{"A", "B", "C"}); final List&lt;String&gt; s2 = Arrays.asList(new String[]{"D", "E", "F"}); final List&lt;String&gt; s3 = Arrays.asList(new String[]{"H", "I", "J"}); for (final String s : CombinedIterable.concat(s1, s2, s3)) { System.out.println(s); } And with the magic of import static for (final String s : concat(s1, s2, s3)) { System.out.println(s); } If you're into that sort of thing...
type: Answer
has comment: http://stackoverflow.com/comment/32352445
has comment: http://stackoverflow.com/comment/32342952
has comment: http://stackoverflow.com/comment/32279446
has comment: http://stackoverflow.com/comment/32157730
has comment: http://stackoverflow.com/comment/32161272
has comment: http://stackoverflow.com/comment/32144752

http://stackoverflow.com/comment/32052469
score: 1
comment on: http://stackoverflow.com/q/21272276
type: QuestionComment
has text: `System.currentTimeMillis()` is also a number that represents "now". What kind of date and time do you need?
type: Comment

http://stackoverflow.com/comment/31904689
type: QuestionComment
score: 0
has text: Out of curiosity: why do you want to read settings DB from native while there is a ready-to-use API available in Java?
comment on: http://stackoverflow.com/q/21188711
type: Comment

http://stackoverflow.com/a/58835201
type: Answer
answers question: http://stackoverflow.com/q/21329475
score: 2
upvote count: 2
downvote count: 0
has body: String.format("%s FOO %<s %<s", "test") Relative indexing is used when the format specifier contains a '<' ('\u003c') flag which causes the argument for the previous format specifier to be re-used. If there is no previous argument, then a MissingFormatArgumentException is thrown. formatter.format("%s %s %<s %<s", "a", "b", "c", "d") // -> "a b b b" // "c" and "d" are ignored because they are not referenced Source (search for 'Argument Index'): https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Formatter.html

http://stackoverflow.com/q/21184764
upvote count: 3
answer count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/21185333
type: AnsweredQuestion
tagged with: window
possible better answer: http://stackoverflow.com/a/21185117
downvote count: 0
has answer: http://stackoverflow.com/a/21185117
has body: I would like to close / hide the window after 30 seconds (or another specific time). I tried a bit with this code: Calendar cal = Calendar.getInstance(); cal.getTime().getTime(); but I couldn't really figure out how to get it to work. I'm using JavaFX 2. How can I specify an amount of time to wait before hiding the window with window.hide()?
type: Question
score: 3
has title: JavaFX 2 Window.hide after a specific time
favorite count: 0
tagged with: javafx-2
has answer: http://stackoverflow.com/a/21185333

http://stackoverflow.com/comment/32029344
type: QuestionComment
score: 1
has text: Because "you cannot create a generic array" in Java. This was a design choice which has to do with the mismatch between the reifiability of array types vs. non-reifiability of generic type parameters.
comment on: http://stackoverflow.com/q/21259918
type: Comment

http://stackoverflow.com/a/21226709
score: 4
type: Answer
answers question: http://stackoverflow.com/q/21226648
upvote count: 4
downvote count: 0
has body: I think, you should dynamically get and test a class description of your value: if (obj.getClass().equals(Boolean.class)) { //... } //... if (obj.getClass().equals(boolean[].class)) { //... } //... if (obj.getClass().equals(String.class)) { //... }

http://stackoverflow.com/q/21246488
has comment: http://stackoverflow.com/comment/32130922
tagged with: entitymanager
favorite count: 0
has comment: http://stackoverflow.com/comment/32017088
has comment: http://stackoverflow.com/comment/32033451
has body: I am using Servlet->EJB->JPA on Glassfish 4. Application deploys successfully. When I run the servlet, it updates the entity with id=1 in db, but doesn't do anything for the one with id=2. No exception is thrown. @WebServlet("/AnimalServlet") public class AnimalServlet extends HttpServlet { @EJB AnimalDAOLocal lOBAnimalDAO; protected void doGet(....) { Animal lOBAnimal = lOBAnimalDAO.getAnimal(1); // gets OK lOBAnimal.setName("Animal1"); // sets OK lOBAnimalDAO.mergeAnimal(lOBAnimal); // updates in DB OK lOBAnimal = lOBAnimalDAO.getAnimal(2); // gets OK lOBAnimal.setName("Animal2"); // sets OK lOBAnimalDAO.mergeAnimal(lOBAnimal); // doesn't update in DB. } And Session Bean Methods are : @Stateless(mappedName = "AnimalDAOMapped") public class AnimalDAO implements AnimalDAOLocal { @PersistenceContext EntityManager em; public Animal getAnimal(int id) { return em.find(Animal.class, id); } public void mergeAnimal(Animal pOBAnimal) { em.merge(pOBAnimal); } } Persistence Unit Settings : jdbc/animaltest net.test.model.Animal
has comment: http://stackoverflow.com/comment/32131313
has title: JPA Entity is not updated
score: 2
has comment: http://stackoverflow.com/comment/32035561
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/1069992
tagged with: java
has answer: http://stackoverflow.com/a/21320983
accepted answer: http://stackoverflow.com/a/21320983
has comment: http://stackoverflow.com/comment/32016837
has comment: http://stackoverflow.com/comment/32015333
type: Question
upvote count: 2
tagged with: jpa
has comment: http://stackoverflow.com/comment/32026862
possible better answer: http://stackoverflow.com/a/21261937
answer count: 2
has answer: http://stackoverflow.com/a/21261937
tagged with: eclipselink

http://stackoverflow.com/a/21214460
has comment: http://stackoverflow.com/comment/31949549
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21214417
upvote count: 2
has body: AFAIU null layouts translated to HTML could only result in the position:absolute; style. That would work even less well in HTML than it would in Swing. HTML is supposed to flow, and once the user starts increasing or decreasing the size of the text in their browser, it would fall apart.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21214417
has comment: http://stackoverflow.com/comment/31949480
has comment: http://stackoverflow.com/comment/31949642
has comment: http://stackoverflow.com/comment/31949700
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31949672

http://stackoverflow.com/comment/32101748
comment on: http://stackoverflow.com/a/21290633
score: 0
type: AnswerComment
has text: If things now work locally but not remotely the next problem is most likely network configuration. Verify that the computers can ping each other. Windows 8 may need a firewall rule to allow port 8888 to receive incoming TCP connections.
type: Comment

http://stackoverflow.com/a/21280195
accepted answer of: http://stackoverflow.com/q/21279430
has comment: http://stackoverflow.com/comment/32068485
answers question: http://stackoverflow.com/q/21279430
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: You can use: keytool -list to find the alias of the certificate you want to migrate, keytool -export -alias ... to export it into a file, keytool -import ... to import it into the new trust store. (The default password is changeit, except on some versions of OSX where it's changeme).
score: 2
downvote count: 0

http://stackoverflow.com/comment/32183682
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21346309
has text: Are you sure the minimum length of `values` is 4?
type: Comment

http://stackoverflow.com/a/39788897
downvote count: 1
answers question: http://stackoverflow.com/q/21245796
has comment: http://stackoverflow.com/comment/119463094
type: Answer
upvote count: 50
score: 49
has body: I faced the same problem and solved it by adding: System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2"); before openConnection method.

android-wifi
tags question: http://stackoverflow.com/q/21263251
tags question: http://stackoverflow.com/q/21279141
tag name: android-wifi
type: Tag
tags question: http://stackoverflow.com/q/21219474

http://stackoverflow.com/comment/31945013
type: QuestionComment
comment on: http://stackoverflow.com/q/21211853
score: 0
has text: If you specify a listener in your layout XML file with `android:onClick` the method (in code) MUST have a signature which includes a `View` as a parameter, e.g., `public void outComeButton(View v)`.
type: Comment

http://stackoverflow.com/a/21197350
type: Answer
has comment: http://stackoverflow.com/comment/31920082
answers question: http://stackoverflow.com/q/21196874
score: 0
has body: Maybe the DefaultListModel model is some kind of immutable, so you can not perform delete operation. Check that ;)

http://stackoverflow.com/comment/32050291
comment on: http://stackoverflow.com/q/21271107
has text: Actually,I generated this code, in method addEntityTwo(), there is already line: entity2.setEntity1(this), so I think that is not the problem, since it adds correctly in database, but I think objects are duplicated in session. Thanks, anyway.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21249486
favorite count: 0
accepted answer: http://stackoverflow.com/a/21309857
has comment: http://stackoverflow.com/comment/32102896
linked to: http://stackoverflow.com/q/14177186
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32096881
tagged with: java
has comment: http://stackoverflow.com/comment/32014731
has comment: http://stackoverflow.com/comment/32029728
type: Question
has comment: http://stackoverflow.com/comment/32030234
tagged with: libgdx
has comment: http://stackoverflow.com/comment/32097018
has title: Libgdx intersection of polygons
has answer: http://stackoverflow.com/a/21309857
has comment: http://stackoverflow.com/comment/32051877
score: 4
upvote count: 4
answer count: 1
has body: I'm learning libgdx by adding some more features to the open source jumper game from Mario Zechner. I'm trying to make some platforms with an angle and run into the problem of collision detection of rotated rectangles. I followed this solution and used Polygons along with my rectangle bounds. For testing purposes I don't set an angle yet. I just want to verify that bob jumps correctly off the platforms. But for some reason this doesn't work. the bounds are either too far to the left, above the platform, or not there at all. Am I not setting the polygon correctly? Would it be easier to use Box2d? I don't have any experience with that and I'm wondering if that's overkill for simple platforms. public PlatformClient(int platformType, float x, float y) { this.platformType = platformType; float x1 = x - Platform.PLATFORM_WIDTH/2; float y1 = y + Platform.PLATFORM_HEIGHT/2; this.polyBounds = new Polygon(new float[]{x1, y1, x1+Platform.PLATFORM_WIDTH, y1, x1+Platform.PLATFORM_WIDTH, y1-Platform.PLATFORM_HEIGHT, x1, y1-Platform.PLATFORM_HEIGHT}); polyBounds.setPosition(x-Platform.PLATFORM_WIDTH/2, y-Platform.PLATFORM_HEIGHT/2); } class Platform { public static final float PLATFORM_WIDTH = 2f; public static final float PLATFORM_HEIGHT = 0.35f; } In Bob class update the polygon bounds when he moves: public void update(float deltaTime) { ... position.add(velocity.x * deltaTime, velocity.y * deltaTime); bounds.x = position.x - BOB_WIDTH / 2; bounds.y = position.y - BOB_HEIGHT / 2; float newX = position.x - BOB_WIDTH / 2; float newY = position.y - BOB_HEIGHT / 2; polyBounds.setVertices(new float[]{ newX, newY, newX+BOB_WIDTH, newY, newX+BOB_WIDTH, newY-BOB_HEIGHT, newX, newY-BOB_HEIGHT}); } In World class: private void checkPlatformCollisions () { int len = platforms.size(); for (int i = 0; i &lt; len; i++) { PlatformClient platform = platforms.get(i); if (bob.position.y &gt;= platform.position.y) { if(Intersector.overlapConvexPolygons(bob.polyBounds, platform.polyBounds)) { Syste…
downvote count: 0
has comment: http://stackoverflow.com/comment/32058890

http://stackoverflow.com/a/21298737
has body: Here is working example of your code: package test; import javax.*; import javax.swing.*; import java.awt.event.*; import java.awt.image.ImageObserver; import java.awt.*; import java.text.AttributedCharacterIterator; public class GUI2 extends JPanel{ JButton button; JFrame frame; public GUI2() { button = new JButton("YO"); //panel = new JPanel(); frame = new JFrame(); //panel = new JPanel(); this.add(button); frame.add(this); //button.addActionListener(new Action()); // this.paint(null); frame.setSize(500, 500); frame.setLocation(500, 200); frame.setVisible(true); } public void paint(Graphics g) { g.setColor(Color.red); g.drawRect(250, 250, 200, 100); } public static void main(String[] args) { GUI2 test = new GUI2(); } } I have removed some statements but you can add them later
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21298547
has comment: http://stackoverflow.com/comment/32098859
has comment: http://stackoverflow.com/comment/32098855
has comment: http://stackoverflow.com/comment/32098769

http://stackoverflow.com/q/21229823
tagged with: for-loop
downvote count: 0
tagged with: multidimensional-array
answer count: 4
possible better answer: http://stackoverflow.com/a/21229850
has body: This code should be so simple, yet isn't working at all. It doesn't do anything. To my understanding it should print out a 10 by 10 grid of random numbers below 21. import java.util.Random; public class Map { static Random rnd = new Random(); public static int coords[][] = new int[10][10]; public static void main(String[] args){ System.out.println("dastardly"); Map.generate(); Map.show(); } public static void show() { for(int i = 0; i &gt;= 10; i++){ for(int j = 0; j &gt;= 10; j++){ System.out.print(coords[i][j]); } System.out.println(""); } } public static void generate() { for(int i = 0; i &gt;= 10; i++){ for(int j = 0; j &gt;= 10; j++){ coords[i][j] = rnd.nextInt(21); } } } } Can anybody tell me why it doesn't work?
favorite count: 0
has answer: http://stackoverflow.com/a/21229951
has title: Java for loops and 2D arrays
upvote count: 1
has answer: http://stackoverflow.com/a/21229859
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21229855
accepted answer: http://stackoverflow.com/a/21229855
has answer: http://stackoverflow.com/a/21229850
type: Question

http://stackoverflow.com/comment/32002596
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21244066
score: 1
has text: How are you bootstrapping your `DispatcherServlet`?

http://stackoverflow.com/q/21289930
has comment: http://stackoverflow.com/comment/32083413
has comment: http://stackoverflow.com/comment/32083210
tagged with: android
has comment: http://stackoverflow.com/comment/37298624
linked to: http://stackoverflow.com/q/20117884
favorite count: 0
has comment: http://stackoverflow.com/comment/32083004
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32733404
has body: I'm having trouble running the vitamio-sample from https://github.com/yixia/VitamioBundle. I am building it with Android Studio and it compiles fine and runs, but when it gets to this line: if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this)) return; It throws an exception when I run it on my Nexus 5 (and also on a Galaxy S4): 01-22 11:58:40.759 12323-12323/? E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: io.vov.vitamio.demo, PID: 12323 java.lang.UnsatisfiedLinkError: Couldn't load vinit from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/io.vov.vitamio.demo-1.apk"],nativeLibraryDirectories=[/data/app-lib/io.vov.vitamio.demo-1, /vendor/lib, /system/lib]]]: findLibrary returned null at java.lang.Runtime.loadLibrary(Runtime.java:358) at java.lang.System.loadLibrary(System.java:526) at io.vov.vitamio.Vitamio.&lt;clinit&gt;(Vitamio.java:258) at io.vov.vitamio.LibsChecker.checkVitamioLibs(LibsChecker.java:40) at io.vov.vitamio.demo.VitamioListActivity.onCreate(VitamioListActivity.java:40) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 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) The exception also happens when I'm running the v4.2.0 tree in my own app. Any …
type: Question
has comment: http://stackoverflow.com/comment/47428389
has title: Vitamio Sample Error - java.lang.UnsatisfiedLinkError: Couldn't load vinit findLibrary returned null
has answer: http://stackoverflow.com/a/24166567
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/32083548
has comment: http://stackoverflow.com/comment/32083415
has comment: http://stackoverflow.com/comment/37277548
tagged with: vitamio
has comment: http://stackoverflow.com/comment/32139555
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32082863

http://stackoverflow.com/comment/32163172
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21334883
has text: if exist() would return true in case file exist and false if doesn't and throw security exception IMHO could be much more clear and easy to understand than current design.

bytecode-manipulation
type: Tag
tags question: http://stackoverflow.com/q/21190458
tags question: http://stackoverflow.com/q/21274346
tag name: bytecode-manipulation

http://stackoverflow.com/comment/32048330
has text: Or use `System.nanoTime()` for greater resolution
type: Comment
score: 2
comment on: http://stackoverflow.com/a/21270137
type: AnswerComment

http://stackoverflow.com/a/21336329
type: Answer
has comment: http://stackoverflow.com/comment/32165306
score: 8
accepted answer of: http://stackoverflow.com/q/21336303
has body: Why doesn't the JVM recognize that a System.exit(0) will not allow any other code to execute, but complains about unreachable statements if a return will not allow code to be executed? It's not the JVM - it's the compiler. And the compiler doesn't know what library calls will do - it only knows the language rules. (In particular, JLS section 14.21, Unreachable Statements.) So for example: public int foo() { alwaysThrow(); // This is required. return 10; } private static void alwaysThrow() { throw new RuntimeException(); } vs public int foo() { throw new RuntimeException(); // Error: unreachable statement return 10; } That simple inlining changes the meaning of the code as far as the compiler's concerned. This could be "fixed" by having a return type of "never" - to indicate "this method never returns normally - it either hangs or throws an exception" but that's simply not part of the language (and would have its own complications). If you're interested, Eric Lippert has a couple of blog posts on this topic with regard to C# (which is in a similar position): part one, part two.
answers question: http://stackoverflow.com/q/21336303
has comment: http://stackoverflow.com/comment/32165327
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32164999
has comment: http://stackoverflow.com/comment/32165480
upvote count: 8

http://stackoverflow.com/comment/32133584
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21317884
has text: i was getting at, if your `Worker` is not aware of `Display`, you need to make it aware. Passing `Display` object into your `Worker` constructor would allow it to be used locally in that scope.

http://stackoverflow.com/comment/31952918
has text: Please rewrite the question into the question, instead of posting a image.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21216460
score: 1

http://stackoverflow.com/q/21276914
tagged with: generics
has body: I am trying to learn java generics. I wrote a method: public &lt;T&gt; T Gmethod(T a,Collection&lt;T&gt; list){ return a;} While calling this with Gmethod("A",list); is fine where list is type of Object, But calling it with Gmethod(new Object(),list);where list is type of String is error, Why?
score: 2
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/32060196
has answer: http://stackoverflow.com/a/21277391
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21276973
tagged with: java
has answer: http://stackoverflow.com/a/21277111
answer count: 3
accepted answer: http://stackoverflow.com/a/21277111
favorite count: 0
has title: Why calling a generic method with different types gives compilation error?
possible better answer: http://stackoverflow.com/a/21276973

http://stackoverflow.com/comment/32123725
score: 0
type: AnswerComment
has text: @bobbel: if I have that I wouldn't mind to sorted. But if I had to return the "5" in my array List I would like to have this '[null, null, null, 4, 5, null, null, 6, null]'.
type: Comment
comment on: http://stackoverflow.com/a/21312943

http://stackoverflow.com/comment/32149740
score: 2
comment on: http://stackoverflow.com/q/21327739
has text: Yes, both C and Java use pass-by-value. Pass-by-reference comes into the picture in other languages, basically.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31962531
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21221292
has text: Took me almost a minute to type "enum" all lowercase!
score: 0

mysql
tags question: http://stackoverflow.com/q/21202523
tags question: http://stackoverflow.com/q/21259549
tags question: http://stackoverflow.com/q/21304504
tags question: http://stackoverflow.com/q/21225695
tags question: http://stackoverflow.com/q/21346953
tags question: http://stackoverflow.com/q/21260273
tags question: http://stackoverflow.com/q/21290788
tags question: http://stackoverflow.com/q/21244110
tags question: http://stackoverflow.com/q/21333966
tags question: http://stackoverflow.com/q/21218887
tags question: http://stackoverflow.com/q/21319370
tags question: http://stackoverflow.com/q/21248095
tag name: mysql
tags question: http://stackoverflow.com/q/21282731
tags question: http://stackoverflow.com/q/21217546
tags question: http://stackoverflow.com/q/21348891
tags question: http://stackoverflow.com/q/21220799
tags question: http://stackoverflow.com/q/21201068
tags question: http://stackoverflow.com/q/21325318
tags question: http://stackoverflow.com/q/21252685
tags question: http://stackoverflow.com/q/21205157
tags question: http://stackoverflow.com/q/21193982
tags question: http://stackoverflow.com/q/21275379
tags question: http://stackoverflow.com/q/21305172
tags question: http://stackoverflow.com/q/21281083
tags question: http://stackoverflow.com/q/21207977
tags question: http://stackoverflow.com/q/21207049
tags question: http://stackoverflow.com/q/21264767
tags question: http://stackoverflow.com/q/21232884
tags question: http://stackoverflow.com/q/21291419
tags question: http://stackoverflow.com/q/21286485
tags question: http://stackoverflow.com/q/21328371
tags question: http://stackoverflow.com/q/21228873
tags question: http://stackoverflow.com/q/21285973
tags question: http://stackoverflow.com/q/21236713
tags question: http://stackoverflow.com/q/21218525
tags question: http://stackoverflow.com/q/21278531
tags question: http://stackoverflow.com/q/21346305
tags question: http://stackoverflow.com/q/21215345
tags question: http://stackoverflow.com/q/21208292
tags question: http://stackoverflow.com/q/21307937
tags question: http://stackoverflow.com/q/21285371
tags question: http://stackoverflow.com/q/21184297
tags question: http://stackoverflow.com/q/21204659
tags question: http://stackoverflow.com/q/21202763
tags question: http://stackoverflow.com/q/21297427
tags question: http://stackoverflow.com/q/21348472
tags question: http://stackoverflow.com/q/21257489
tags question: http://stackoverflow.com/q/21289942
tags question: http://stackoverflow.com/q/21327012
tags question: http://stackoverflow.com/q/21345204
tags question: http://stackoverflow.com/q/21232923
tags question: http://stackoverflow.com/q/21258107
type: Tag
tags question: http://stackoverflow.com/q/21241729
tags question: http://stackoverflow.com/q/21213779
tags question: http://stackoverflow.com/q/21345932
tags question: http://stackoverflow.com/q/21298580
tags question: http://stackoverflow.com/q/21185455
tags question: http://stackoverflow.com/q/21283339
tags question: http://stackoverflow.com/q/21265738
tags question: http://stackoverflow.com/q/21278072
tags question: http://stackoverflow.com/q/21208400
tags question: http://stackoverflow.com/q/21347091
tags question: http://stackoverflow.com/q/21193225
tags question: http://stackoverflow.com/q/21326931
tags question: http://stackoverflow.com/q/21263170
tags question: http://stackoverflow.com/q/21348177
tags question: http://stackoverflow.com/q/21184950
tags question: http://stackoverflow.com/q/21286174
tags question: http://stackoverflow.com/q/21258803
tags question: http://stackoverflow.com/q/21316022
tags question: http://stackoverflow.com/q/21347961
tags question: http://stackoverflow.com/q/21339759
tags question: http://stackoverflow.com/q/21285704
tags question: http://stackoverflow.com/q/21296649
tags question: http://stackoverflow.com/q/21211035
tags question: http://stackoverflow.com/q/21261546
tags question: http://stackoverflow.com/q/21263771
tags question: http://stackoverflow.com/q/21289637

http://stackoverflow.com/a/21236133
type: Answer
score: 2
downvote count: 0
has body: As I first tried to run your Code (replaced Log.d with System.out.println()) i got a ParseException: Unparseable date. Next I tried several parts of the date with their respective format string parts. Lastly the problem was the timezone part "+00:00" respectively "ZZZZZ". I read about the pattern letters in the documentation (http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html) and found: Z -> -0800 X -> 08; -0800; -08:00 So swapped your ZZZZZ with X and then it worked fine for me. Final format string: String fmt = "yyyy-MM-dd'T'HH:mm:ss.SSSSSSX";
answers question: http://stackoverflow.com/q/21235279
upvote count: 2

http://stackoverflow.com/comment/32155893
type: AnswerComment
has text: Ok, The problem is with gradle 1.7 you should have all files like `builder-model-0.7.0` so make sure after installing it again. Cheers !!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21330597

swing
tags question: http://stackoverflow.com/q/21280365
tags question: http://stackoverflow.com/q/21284689
tags question: http://stackoverflow.com/q/21345890
tags question: http://stackoverflow.com/q/21346281
tags question: http://stackoverflow.com/q/21295832
tags question: http://stackoverflow.com/q/21260842
tags question: http://stackoverflow.com/q/21209532
tags question: http://stackoverflow.com/q/21207837
tags question: http://stackoverflow.com/q/21271369
tags question: http://stackoverflow.com/q/21291386
tags question: http://stackoverflow.com/q/21219131
tags question: http://stackoverflow.com/q/21295247
tags question: http://stackoverflow.com/q/21271107
tags question: http://stackoverflow.com/q/21198679
tags question: http://stackoverflow.com/q/21349451
tags question: http://stackoverflow.com/q/21247244
tags question: http://stackoverflow.com/q/21274414
tags question: http://stackoverflow.com/q/21310024
tags question: http://stackoverflow.com/q/21298872
tags question: http://stackoverflow.com/q/21325792
tags question: http://stackoverflow.com/q/21252467
tags question: http://stackoverflow.com/q/21290238
tags question: http://stackoverflow.com/q/21337514
tags question: http://stackoverflow.com/q/21217446
tags question: http://stackoverflow.com/q/21309485
tags question: http://stackoverflow.com/q/21211495
tags question: http://stackoverflow.com/q/21347647
tags question: http://stackoverflow.com/q/21198074
tags question: http://stackoverflow.com/q/21284142
tags question: http://stackoverflow.com/q/21207072
tags question: http://stackoverflow.com/q/21214568
tags question: http://stackoverflow.com/q/21290591
tags question: http://stackoverflow.com/q/21254977
tags question: http://stackoverflow.com/q/21208396
tags question: http://stackoverflow.com/q/21296241
tags question: http://stackoverflow.com/q/21262649
tags question: http://stackoverflow.com/q/21195885
tags question: http://stackoverflow.com/q/21336305
tags question: http://stackoverflow.com/q/21336141
tags question: http://stackoverflow.com/q/21237193
tags question: http://stackoverflow.com/q/21200642
tags question: http://stackoverflow.com/q/21312670
tags question: http://stackoverflow.com/q/21246822
tags question: http://stackoverflow.com/q/21217722
tags question: http://stackoverflow.com/q/21214417
tags question: http://stackoverflow.com/q/21315315
tags question: http://stackoverflow.com/q/21228464
tags question: http://stackoverflow.com/q/21248609
tags question: http://stackoverflow.com/q/21311617
tags question: http://stackoverflow.com/q/21293930
tags question: http://stackoverflow.com/q/21343529
tags question: http://stackoverflow.com/q/21298371
tags question: http://stackoverflow.com/q/21254845
tags question: http://stackoverflow.com/q/21214829
tags question: http://stackoverflow.com/q/21187405
tags question: http://stackoverflow.com/q/21193985
tags question: http://stackoverflow.com/q/21247623
tags question: http://stackoverflow.com/q/21289897
tags question: http://stackoverflow.com/q/21208239
tags question: http://stackoverflow.com/q/21203346
tags question: http://stackoverflow.com/q/21234220
tags question: http://stackoverflow.com/q/21246405
tags question: http://stackoverflow.com/q/21200888
tags question: http://stackoverflow.com/q/21290288
tags question: http://stackoverflow.com/q/21245069
tags question: http://stackoverflow.com/q/21281130
tags question: http://stackoverflow.com/q/21266333
tags question: http://stackoverflow.com/q/21225569
tags question: http://stackoverflow.com/q/21206240
tags question: http://stackoverflow.com/q/21269532
tags question: http://stackoverflow.com/q/21258503
tags question: http://stackoverflow.com/q/21228509
tags question: http://stackoverflow.com/q/21247776
tags question: http://stackoverflow.com/q/21230374
tags question: http://stackoverflow.com/q/21265576
tags question: http://stackoverflow.com/q/21199849
tags question: http://stackoverflow.com/q/21224608
tags question: http://stackoverflow.com/q/21214640
tags question: http://stackoverflow.com/q/21245222
tags question: http://stackoverflow.com/q/21287661

http://stackoverflow.com/a/21188247
has body: What about Covariant return types instead of generics? public class ArrayBuffer extends Buffer { public ArrayBuffer(final int bufferDataType) { super(GL15.GL_ARRAY_BUFFER, bufferDataType); } public ArrayBuffer create() { super.create(); return this; } public ArrayBuffer bind() { super.bind(); return this; } } public class StaticDrawArrayBuffer extends ArrayBuffer { public StaticDrawArrayBuffer() { super(GL15.GL_STATIC_DRAW); } public StaticDrawArrayBuffer bind() { super.bind(); return this; } } AFAIK this should compile now: Buffer buffer = new Buffer().create().bind(); ArrayBuffer arrayBuffer = new ArrayBuffer().create().bind(); StaticDrawArrayBuffer staticDrawArrayBuffer = new StaticDrawArrayBuffer().create().bind()
has comment: http://stackoverflow.com/comment/31931235
score: 1
has comment: http://stackoverflow.com/comment/31902390
downvote count: 0
has comment: http://stackoverflow.com/comment/31907499
accepted answer of: http://stackoverflow.com/q/21187863
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31903695
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31906312
answers question: http://stackoverflow.com/q/21187863

http://stackoverflow.com/q/21216022
has answer: http://stackoverflow.com/a/21216110
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21216100
answer count: 4
has body: import java.awt.event.ActionEvent; import javax.swing.*; import java.awt.event.ActionListener; import java.awt.FlowLayout; import java.awt.Font; import java.awt.event.KeyListener; import java.awt.event.KeyEvent; import javax.swing.JTextField; public class Experting extends JFrame{ private JLabel label; private JButton nextQuestion; private JButton yesAnswer; private JButton noAnswer; private String array1[] ={ " Do you have cold ?", " Do you have headache ?", " Do you feel enter enter code here`code here dizzy ?", " Do you have fever ?", " Do you feel fatigue ?", " Have you seen mosquitoes in your bedroom recently; You don't sleep in a bed-net ?", " Have you had malaria before , If yes do you have similar symptoms as before ?", " Do you stay out at night sometimes", " Has someone in your house had malaria recently ?"," You have not taken malaria treatment for the past 7 days ?",` " Do you have chills or sweat much when asleep ?"," Do you vomit or have nausea ?"}; public Experting(){ super("Testing Experting"); setLayout(new FlowLayout()); label = new JLabel(array1);// this constructor add(label); the constructor does not work and i can't figure out this constructor does seem to work when i compile it gives an error as show in the title, can anyone pls help, thanks Richard.
tagged with: java
tagged with: swing
downvote count: 1
has answer: http://stackoverflow.com/a/21216054
type: Question
has comment: http://stackoverflow.com/comment/31952133
has answer: http://stackoverflow.com/a/21216057
score: -1
has title: Error being," constructor JLabel.JLabel is not applicable, formal and acutal arguments differ in lenghts"
upvote count: 0
tagged with: arrays
favorite count: 0
tagged with: jlabel

http://stackoverflow.com/q/21323890
has title: Why Does The Print Statement "=>" Come after you type in Input For The Scanner
type: UnansweredQuestion
has body: I am trying to create a text based adventure game and I am trying to add a feature where whenever the game requires your input, a little tick mark, "=>" will show next to where you put your input. With this code here, whenever I run it in Command Prompt (Windows 7), the input shows up and the little tick doesn't. After you put in your input, the tick then shows up, after the input. I would like to be able to have the tick mark and the input all on one line like this, "=> [use input]". Please Help! import java.io.IOException; import java.util.Scanner; import org.fusesource.jansi.AnsiConsole; public class Game { public static String BLACK = "\u001B[0;30m"; public static String RED = "\u001B[0;31m"; public static String GREEN = "\u001B[0;32m"; public static String YELLOW = "\u001B[0;33m"; public static String BLUE = "\u001B[0;34m"; public static String MAGENTA = "\u001B[0;35m"; public static String CYAN = "\u001B[0;36m"; public static String WHITE = "\u001B[0;37m"; public final static String ESC = "\033["; public static String name; public static String gender; public static void main(String[] args) { AnsiConsole.systemInstall(); check(); } public static void start() { Scanner a = new Scanner(System.in); System.out.println("###############################################################################"); System.out.println("# #"); System.out.println("# " + YELLOW + "^.^" + WHITE + " " + "Adventure Time Is Yes " + YELLOW + "^.^" + WHITE + " #"); System.out.println("# #"); System.out.println("###############################################################################"); //Get Name System.out.print("\n"); System.out.println("Hello young lad! What is thy " + RED + "name " + WHITE + "you were given at birth?"); System.out.print("=&gt; "); //Global Variable for Name name = a.next(); System.out.print("\n"); System.out.println("Hello " + RED + name + WHITE + "! Are you a Male or Female?"); System.out.print("=&gt; "); gender = a.next(); } public static void check() { Scann…
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21325332
has answer: http://stackoverflow.com/a/21323930
type: Question
answer count: 2
downvote count: 0
tagged with: input
favorite count: 0

http://stackoverflow.com/q/21323269
has body: I'm using Log4j 2 in my project to write son logs to a database table. These events are identified based on certain MDC key/value pair. My concern is about the unchecked LoggingException this appender can throw from its append method. These database logs are generated inside asynchronous, transactional process and I don't want the main process gets affected by a potential exception raised by the appender. How should I take care of it? Should I move the configuration based appender to a custom appender? Is there any guarantee that the appender won't rollback my business process in case of log event append error? thks in advance
tagged with: log4j2
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/21347538
tagged with: java
upvote count: 3
has answer: http://stackoverflow.com/a/21347538
answer count: 1
favorite count: 0
type: AnsweredQuestion
has title: How to handle log4j2 JDBCAppender exceptions?
downvote count: 0

http://stackoverflow.com/comment/32051573
comment on: http://stackoverflow.com/q/21271867
score: 0
type: Comment
type: QuestionComment
has text: @Jocob Kudria Yes, I am Talking about Gridworld.

http://stackoverflow.com/comment/32038659
type: Comment
has text: the thing is I have other tests to finish and I generally use PowerMockRunner and I have to say that I'm a newbie on test domain :). So trying to figure out the concepts of Mockito
comment on: http://stackoverflow.com/q/21262768
score: 0
type: QuestionComment

http://stackoverflow.com/a/21213032
score: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31947766
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21213004
has comment: http://stackoverflow.com/comment/31947739
upvote count: 2
answers question: http://stackoverflow.com/q/21213004
type: Answer
has body: You cannot do it like this - if you need to use getClass(), you have to do the whole reflection route. If the class is known at compile time, you can do this: Class1.Class2 obj2 = new Class1.Class2(); If the class is not known at compile time, you do this: Class inner = null; for (Class c : obj1.getClass().getDeclaredClasses()) { if ("myPackage.Class1.Class2".equals(c.getName())) { inner = c; break; } } Object obj2 = inner.newInstance();

http://stackoverflow.com/a/21349601
has comment: http://stackoverflow.com/comment/32189534
has comment: http://stackoverflow.com/comment/32189394
answers question: http://stackoverflow.com/q/21349568
has comment: http://stackoverflow.com/comment/32189297
has body: If you want to parse the JSON you can use the JSONObject.
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32189483
type: Answer

http://stackoverflow.com/q/21288592
has title: Learning to debug
has comment: http://stackoverflow.com/comment/32080175
tagged with: android
has comment: http://stackoverflow.com/comment/32080359
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32080243
linked to: http://stackoverflow.com/q/18964329
has answer: http://stackoverflow.com/a/21288735
linked to: http://stackoverflow.com/q/17604221
tagged with: java
has comment: http://stackoverflow.com/comment/32080074
type: Question
tagged with: logcat
tagged with: debugging
has comment: http://stackoverflow.com/comment/32080279
has body: Good morning, I am learning to debug applications and have create a test application which returns an "Unfortunately, LearningActivities has stopped." message when I press my button in the app. The app is pretty basic... Essentially, you type your text into n EditText field, and press the button and it should launch a second activity which displays that text in a TextView field. As soon as I press the button is when I am receiving the error. I have run a logcat on it and am looking for a little help in understanding what exactly I am looking at. 01-22 11:26:11.877: E/AndroidRuntime(23917): FATAL EXCEPTION: main 01-22 11:26:11.877: E/AndroidRuntime(23917): Process: com.rcd.learningactivities, PID: 23917 01-22 11:26:11.877: E/AndroidRuntime(23917): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rcd.learningactivities/com.rcd.learningactivities.secondActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x0 01-22 11:26:11.877: E/AndroidRuntime(23917): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2190) 01-22 11:26:11.877: E/AndroidRuntime(23917): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250) 01-22 11:26:11.877: E/AndroidRuntime(23917): at android.app.ActivityThread.access$700(ActivityThread.java:139) 01-22 11:26:11.877: E/AndroidRuntime(23917): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1411) 01-22 11:26:11.877: E/AndroidRuntime(23917): at android.os.Handler.dispatchMessage(Handler.java:102) 01-22 11:26:11.877: E/AndroidRuntime(23917): at android.os.Looper.loop(Looper.java:137) 01-22 11:26:11.877: E/AndroidRuntime(23917): at android.app.ActivityThread.main(ActivityThread.java:5083) 01-22 11:26:11.877: E/AndroidRuntime(23917): at java.lang.reflect.Method.invokeNative(Native Method) 01-22 11:26:11.877: E/AndroidRuntime(23917): at java.lang.reflect.Method.invoke(Method.java:515) 01-22 11:26:11.877: E/AndroidRuntime(23917): at com.android.intern…
score: 0
accepted answer: http://stackoverflow.com/a/21288735
answer count: 1

http://stackoverflow.com/comment/32070472
type: Comment
has text: Now that exception is not coming but my another child is not saving
type: AnswerComment
comment on: http://stackoverflow.com/a/21282325
score: 0

http://stackoverflow.com/comment/32072974
type: Comment
type: QuestionComment
has text: Wait, is `myAnnotation.value()` giving you `null` or is `myAnnotation` `null`?
comment on: http://stackoverflow.com/q/21281470
score: 0

http://stackoverflow.com/comment/32008985
has text: What is the length of your last String in your array? What do you think this does `s1.charAt(s1.length()-1)` if the length is 0?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21247573

http://stackoverflow.com/comment/32022406
has text: `t.getTest()` will be executed, but the result will not be used in any way.
type: Comment
comment on: http://stackoverflow.com/a/21255756
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31993721
has text: What JSON parser are you using?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21239100

http://stackoverflow.com/comment/32063905
type: Comment
comment on: http://stackoverflow.com/a/21278227
score: 0
type: AnswerComment
has text: Thanks. My number 1 goal is to be able to create, start, and stop the components dynamically. I don't think this is possible with annotations, is it? I tried this: InstanceDeclaration declaration = new DefaultInstanceDeclaration(b.getBundleContext(), "my-factory"); It shows no errors, but the author of the link you posted says that you can start and stop the declaration instance. Though, I did not find a start or stop method (declaration.start() showed a syntax error). What's going on?

http://stackoverflow.com/q/21335254
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21335313
has comment: http://stackoverflow.com/comment/32162937
tagged with: java
type: Question
has body: I'm new in android programming. Trying to get some useful data set from web json(network task) and parse it. So i choose for this Service, for making background job. How do i properly install repeated task with Handler.postDelayed(runnable, interval) not in the main thread? Help me please to figure this out?
has answer: http://stackoverflow.com/a/21335336
score: 0
has answer: http://stackoverflow.com/a/21335344
tagged with: android
tagged with: runnable
has comment: http://stackoverflow.com/comment/32163190
has answer: http://stackoverflow.com/a/21335475
has comment: http://stackoverflow.com/comment/32162751
answer count: 4
has title: Runnable in service working in a main thread

http://stackoverflow.com/comment/32128734
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21315895
score: 0
has text: Is configuredTaskData.get(i).getName() returning the same value everytime? Did you check that?

http://stackoverflow.com/q/21298176
downvote count: 0
accepted answer: http://stackoverflow.com/a/21298381
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21298381
has title: Fixing checkstyle error
has body: I need help with the checkstyle errors i keep getting in eclipse. I have tried everything the error is in my boolean method. It is stating that my nested if else is at 1 when it is supposed to be at zero. This is for all my if statements. Another error i had was that my method has 3 returns and checkstyle says the max is 2. I just want to rid myself of these errors can someone please help me. public class Password { private String potentialpassword; private static final String SPECIAL_CHARACTERS = "!@#$%^&amp;*()~`-=_+[]{}|:\";',./&lt;&gt;?"; /** * initializes the potential password and takes it as a string. * * @param potentialpassword * takes in the potential password * */ public Password(String potentialpassword) { super(); this.potentialpassword = potentialpassword; } /** * The purpose of this method is to validate whether the password meets the * criteria that was given * * @param potentialpassword * allows a string potential password to be accepted. * @return true or false if the method fits a certain guideline. * @precondition password has to be greater than 6 characters long. password * also cannot contain any whitespace and the digits cannot be * less than one. */ public static boolean isValid(String potentialpassword) { if (potentialpassword.length() &lt; 6) { return false; } else { char x; int count = 0; for (int i = 0; i &lt; potentialpassword.length(); i++) { x = potentialpassword.charAt(i); if (SPECIAL_CHARACTERS.indexOf(String.valueOf(x)) &gt;= 1) { return true; } if (Character.isWhitespace(x)) { return false; } if (Character.isDigit(x)) { count++; } else if (count &lt; 1) { return false; } } return true; } } /** * Print the potential string characters on a separate line. * * @return the potential password characters on each line. * * */ public String toString() { String potentialpassword = "w0lf@UWG"; for (int i = 0; i &lt; potentialpassword.length(); i++) { System.out.println(potentialpassword.charAt(i)); } return potentialpassword; } }
tagged with: eclipse
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32097931
tagged with: checkstyle
type: AnsweredQuestion

http://stackoverflow.com/a/21312880
has comment: http://stackoverflow.com/comment/32123379
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21312426
score: 4
accepted answer of: http://stackoverflow.com/q/21312426
has body: fileName.replaceAll("[/|\\|..|:|]","") That regular expression is suspect - it will remove all occurrences of the characters /, |, . and :, which I doubt is what you had in mind. Try something more like this instead: fileName.replaceAll("/|\\\\|:|\\.\\.","") Backslashes are a nightmare in Java regular expressions because you have to double them anyway in string literals, and then double them again in regular expressions (so you need \\\\ to match a single backslash). Also the dot on its own is special in regex (matching any single character) so to match a literal dot you need the regex \., which means the Java string literal \\.

data-structures
tags question: http://stackoverflow.com/q/21321229
tags question: http://stackoverflow.com/q/21220024
tag name: data-structures
tags question: http://stackoverflow.com/q/21293190
tags question: http://stackoverflow.com/q/21321562
tags question: http://stackoverflow.com/q/21295325
tags question: http://stackoverflow.com/q/21206038
tags question: http://stackoverflow.com/q/21237221
tags question: http://stackoverflow.com/q/21277865
tags question: http://stackoverflow.com/q/21320520
tags question: http://stackoverflow.com/q/21348284
tags question: http://stackoverflow.com/q/21301562
tags question: http://stackoverflow.com/q/21197607
type: Tag

http://stackoverflow.com/comment/31977433
has text: so this is not RTMP, its just uploading files :D
comment on: http://stackoverflow.com/q/21228791
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/50702331
type: Answer
has body: I used another workaround for this which will allow us to use dynamic xpath even with page factory. Solution: Add the xpath of any parent element that is static and reference child element with dynamic path. In your case, //td[contains(text(),'$SystemName'), parent element of td might be 'tr' or 'table'. If table is static, use below code: @FindBy(xpath = "&lt;..table xpath&gt;") public WebElement parentElement; public WebElement getDynamicEmement(String SystemName){ parentElement.findElement(By.xpath("//tr/td[contains(text(),'"+SystemName+"')]")) } Now in your script, access table first(so that its reference is loaded in memory) and then call the getDynamicElement method. waitForElement(parentElement) getDynamicElement("System-A")
score: 8
has comment: http://stackoverflow.com/comment/101308264
answers question: http://stackoverflow.com/q/21263367
downvote count: 0
upvote count: 8

http://stackoverflow.com/q/21299597
possible better answer: http://stackoverflow.com/a/24861867
tagged with: android
has answer: http://stackoverflow.com/a/24861867
accepted answer: http://stackoverflow.com/a/21300052
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/32100254
has comment: http://stackoverflow.com/comment/32100384
type: Question
score: 3
has title: android.support.v7.widget.GridLayout failed to instantiate
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/21300052
has body: I'm trying to use a GridLayout in my project, but ideally with the Android Support Library so I can target lower versions of the API. When I drag a GridLayout into the graphical layout designer, a message pops up asking explaining I need a compatibility library for API versions older than 14, and asks if I want to install this library. I hit "Install" and let Eclipse do its thing, but an error shows up in the Eclipse graphical layout designer: The following classes could not be instantiated: - android.support.v7.widget.GridLayout See the Error Log ( Window &gt; Show View) for more details." (here is screenshot ) From the error log, android.support.v7.widget.GridLayout failed to instantiate.
has answer: http://stackoverflow.com/a/37600623
answer count: 3
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/21256653
answers question: http://stackoverflow.com/q/21256616
score: 3
has body: No. The syntax of C++ and Java is similar but it is not the same and the libraries used are very different. If you want to port you will need to do it by hand.
upvote count: 3
type: Answer
downvote count: 0

http://stackoverflow.com/q/21254465
tagged with: path
has answer: http://stackoverflow.com/a/21254702
score: 2
has comment: http://stackoverflow.com/comment/32021508
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/32020443
has comment: http://stackoverflow.com/comment/32021651
has comment: http://stackoverflow.com/comment/32021755
has comment: http://stackoverflow.com/comment/32020243
type: Question
has comment: http://stackoverflow.com/comment/32021586
has comment: http://stackoverflow.com/comment/32022168
has comment: http://stackoverflow.com/comment/32020637
answer count: 1
tagged with: database
has comment: http://stackoverflow.com/comment/32021950
has comment: http://stackoverflow.com/comment/32022089
has body: I am trying to include a local database file in my Runnable Jar. The application is based on an exisiting open source project, in wich they had the file in the package together with the Class. Now I am moving the database file to a 'res' map I created in the root project folder. Editing the code to find the new path to the database file didn't work. This is the piece of code: private static String defaultDBFileLocation() { final URL geoDBFileURL = ClassLoader.getSystemClassLoader().getResource("res/GeoIP.dat"); // final URL geoDBFileURL = GeoIPServiceImpl.class.getResource("GeoIP.dat"); if (geoDBFileURL == null) { return null; } try { final URI geoDBFileURI = geoDBFileURL.toURI(); if (!geoDBFileURI.getScheme().equals("file")) { // class file loaded not from plain directory on filesystem, e.g. from jar, network, etc. return null; } final File geoDBFile = new File(geoDBFileURI); return geoDBFile.getPath(); } catch (URISyntaxException e) { return null; } catch (IllegalArgumentException e) { return null; } } The commmented line is the way the original creators used to get the file. The line above it is my new way. This method keeps returning null at this line: if (geoDBFileURL == null) Does anyone know what I am doing wrong here? Thanks
has comment: http://stackoverflow.com/comment/32020525
has comment: http://stackoverflow.com/comment/32021304
downvote count: 0
tagged with: url
has comment: http://stackoverflow.com/comment/32020806
favorite count: 0
has comment: http://stackoverflow.com/comment/32021814
has title: ClassLoader.getResource keeps returning null for existing resource
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/21218166
has comment: http://stackoverflow.com/comment/32146028
has comment: http://stackoverflow.com/comment/32190327
type: Answer
has comment: http://stackoverflow.com/comment/32190215
has comment: http://stackoverflow.com/comment/32191518
upvote count: 1
has comment: http://stackoverflow.com/comment/32075630
answers question: http://stackoverflow.com/q/21217414
has comment: http://stackoverflow.com/comment/32026176
has body: You file does not seem to be consistent for all the lines, 1 starts with '$' while one doesn't. There are 2 sequences in 1 line and in the other there is just one. For that, let's assuming the Strings and the inputPattern is contained within the 'curly braces' - {} To that effect we can easily Split the individual lines in your while loop with a suitable regex: Pattern regex = Pattern.compile("\\{([^}]*)\\}"); For every line within your while loop, let's put each matching group encountered within a list: while ((strLine = bufferedReader.readLine()) != null) { Matcher regexMatcher = regex.matcher(strLine); while (regexMatcher.find()) { if (regexMatcher.group().contains(inputPattern)) matchList.add(regexMatcher.group()); } } See the inputPattern being used to selectively check the group matching your requirement. To showcase the next steps, lets split each item in the matchList on a space and subsequently put this in a second list: List&lt;String&gt; birdList = new ArrayList&lt;String&gt;(); for (String str : matchList.toArray(new String[matchList.size()])) { System.out.println(str); birdList.addAll(Arrays.asList(str.split("\\s"))); } If I now print the elements of the resulting list ignoring the inputPattern and the braces, you would get you individual lines with dove, pigeon etc: for (String str : birdList.toArray(new String[birdList.size()])) { if (!str.matches("^.*?(\\{|\\}|birds).*$")) System.out.println(str); } Output: 1a:dove 2a:pigeon 1a:parrot 2a:dove Extract the words from your individual lines using another regex indexOf etc. Also, you an make it more generic and reduce the number of Collections I have used for the concept. EDIT: Complete source below: EDIT 2: Based on the changed source file above public static void main(String[] args) { StringManip fileReaderService = new StringManip(); fileReaderService.performExecute("birds"); } public void performExecute(String inputPattern) { try { StringBuilder builder = new StringBuilder(); FileInputStream fileInput…
has comment: http://stackoverflow.com/comment/32045644
downvote count: 0
score: 1

http://stackoverflow.com/q/21326341
favorite count: 0
has title: Why is Gin generating source files in the "target/classes" directory?
tagged with: maven
tagged with: gwt-gin
tagged with: gwt
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/28051289
has body: I am using Maven to build my GWT project. I am using Gin to generate some boilerplate code: package com.lokur.motd.client.events; import com.gwtplatform.dispatch.annotation.GenEvent; @GenEvent public class EditorChange { } But, when I run "mvn clean install" command, Maven is generating Gin related Java source in the target/classes/com/lokur/motd/client/events directory. Why are there .java files going into the classes directory? I'm using the Maven plug-ins below to generate Java source in the target/generated-sources folder: org.bsc.maven maven-processor-plugin 2.0.5 process process generate-sources org.codehaus.mojo build-helper-maven-plugin add-source generate-sources add-source target/generated-sources/apt In this case, two EditorChangeEvent.java files are getting generated: one in generated-sources folder; another in target/classes/<..package..> folder. Thus, causing below compilation failure: duplicate class: com.lokur.motd.client.events.EditorChangeEvent
possible better answer: http://stackoverflow.com/a/28064672
upvote count: 1
has answer: http://stackoverflow.com/a/28064672
has answer: http://stackoverflow.com/a/21545149
accepted answer: http://stackoverflow.com/a/21545149
tagged with: maven-2

http://stackoverflow.com/a/21349867
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32190061
has comment: http://stackoverflow.com/comment/32189969
answers question: http://stackoverflow.com/q/21349833
has comment: http://stackoverflow.com/comment/32189745
has body: An interface defines a new secondary datatype in Java. It (interface) is a group of final variables and abstract methods only. The members of an interface are "public" by default. Infact private and protected modifiers are not allowed in an interface. An interface is a reference type only its objects cannot be created. An interface can inherit another interface but cannot inherit any class. A class cannot inherit any interface but it (a class) can implement zero to many interfaces. If a class implements interfaces then 1) It has to override all the abstract methods of all the implemented interfaces. 2) Type compatibilty gets created between the interface and the class. It allows an interface reference can refer to object of implementing class. interface Iface { int x = 3;//final and public by default void f();//abstract and public by default } interface AnotherI extends Iface { //more declarations possible here } class InterfaceDemo implements Iface { public void f() { int i; for(i =0 ; i&lt; x; i++) System.out.println("Interfaces are widely used"); } public static void main(String args[]) { Iface ref = new InterfaceDemo(); ref.f();//allowed //ref.newMethodsOfClass();//not allowed } }
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/21230728
score: 2
has body: I got a class to extend NumberPicker component to introduce min &amp; max value: public class ExtendedNumberPicker extends NumberPicker { public ExtendedNumberPicker(Context context) { super(context); } public ExtendedNumberPicker(Context context, AttributeSet attrs) { super(context, attrs); processAttributeSet(attrs); } public ExtendedNumberPicker(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); processAttributeSet(attrs); } private void processAttributeSet(AttributeSet attrs) { //This method reads the parameters given in the xml file and sets the properties according to it this.setMinValue(attrs.getAttributeIntValue(null, "min", 0)); this.setMaxValue(attrs.getAttributeIntValue(null, "max", 0)); } } I put it into layout: &lt;com.example.myapp.component.ExtendedNumberPicker android:id="@+id/pick_hh" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_below="@+id/textView1" android:layout_marginTop="16dp" min="140" max="200" /&gt; In LogCat, it shows: Tag Text --------------------------- PropertyValuesHolder Can't find native method using JNI, use reflectionjava.lang.NoSuchMethodError: no method with name='setSelectorPaintAlpha' signature='(I)V' in class Lcom/example/myapp/component/ExtendedNumberPicker; PropertyValuesHolder Couldn't find setter/getter for property selectorPaintAlpha with value type int I know JNI is Java Native Interface, but I never use/see the property selectorPaintAlpha. What is it? How to resolve the issue?
tagged with: java-native-interface
tagged with: java
has comment: http://stackoverflow.com/comment/33349582
type: Question
has title: Can't find native method using JNI when extending Android component
downvote count: 0
favorite count: 0
tagged with: android
answer count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33328126

http://stackoverflow.com/comment/32114128
score: 0
type: Comment
has text: It states "the method keyPress in the type robot is not applicable for the arguments (KeyEvent)"
type: AnswerComment
comment on: http://stackoverflow.com/a/21307852

http://stackoverflow.com/comment/32091279
type: AnswerComment
comment on: http://stackoverflow.com/a/21294308
type: Comment
has text: @MiserableVariable Honestly, I don't know what OP meant it to be, but it has to be a `Class` (doesn't really look like it though).
score: 1

http://stackoverflow.com/q/21238954
upvote count: 2
has comment: http://stackoverflow.com/comment/31994025
has answer: http://stackoverflow.com/a/21263628
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21260399
has title: How to self-sign an applet with NetBeans?
tagged with: java
has answer: http://stackoverflow.com/a/21260399
type: Question
accepted answer: http://stackoverflow.com/a/21263628
has answer: http://stackoverflow.com/a/30107864
tagged with: sign
downvote count: 0
has body: In the previous months I developed a sandbox applet for an academic project. Due to the Java 1.7.51 security restrictions to applets, I have been trying to self-sign my applet with the hope that it can comply or overcome JRE's requisites for applets. I'm using NetBeans and I have taken as a point of departure some links that show how to self-sign a jar file. Unfortunately, I haven't been able to get it working. I have tried to add the following instructions on the build.xml file: &lt;target name="-post-jar" depends="signing_procedure"&gt; &lt;/target&gt; &lt;target name="signing_procedure" depends=""&gt; &lt;echo message="Signing ${dist.dir}/MyFile.jar"/&gt; &lt;exec dir="C:/Program Files/Java/jdk1.7.0_25/bin/" executable="jarsigner.exe"&gt; &lt;arg value="-verbose" /&gt; &lt;arg value="-keystore" /&gt; &lt;arg value="C:/Program Files/Java/jdk1.7.0_25/bin/MyKeyStore.jks" /&gt; &lt;arg value="-storepass" /&gt; &lt;arg value="mystorepass" /&gt; &lt;arg value="-keypass" /&gt; &lt;arg value="mykeypass" /&gt; &lt;arg value="C:/Users/Charles/Documents/ProjectsFolder/MyProject/dist/MyFile.jar" /&gt; &lt;arg value="MyAlias" /&gt; &lt;/exec&gt; &lt;/target&gt; I receive the following error message: Execute failed: java.io.IOException: Cannot run program "jarsigner.exe": error=2, The specified file is not found I would deeply thank you for your help, and much more if it is adressed to NetBeans!
tagged with: applet
tagged with: self-signed
answer count: 4
has comment: http://stackoverflow.com/comment/32001045
favorite count: 0
tagged with: netbeans
has answer: http://stackoverflow.com/a/26411487

http://stackoverflow.com/q/21235089
tagged with: eclipselink
answer count: 1
has body: i have a problem with the marshalling of a class having a bidirectional relation. The following example will produce invalid xml by marshalling a PhoneNumber instance. <?xml version="1.0" encoding="UTF-8"?> <phone-numbers> yvonne 12345 No exception is thrown during marshalling. Without the XmlElementWrapper annotation it works. Is it a bug or did i miss something? The other way around marshalling a Person instance is no problem with or without the XmlElementWrapper annotation. I am using EclispseLink MOXy 2.5.1 import java.io.StringReader; import java.io.StringWriter; import java.util.ArrayList; import java.util.List; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; import org.eclipse.persistence.jaxb.JAXBContextFactory; import org.eclipse.persistence.jaxb.MarshallerProperties; import org.eclipse.persistence.oxm.MediaType; import org.eclipse.persistence.oxm.annotations.XmlInverseReference; public final class XmlElementWrapperApp { @XmlRootElement(name = "person") static class PersonEntity { private String firstname; @XmlElementWrapper(name = "phone-numbers") @XmlElement(name = "phone") @XmlInverseReference(mappedBy = "person") private List<PhoneNumberEntity> phoneNumbers; public void setFirstname(String firstname) { this.firstname = firstname; } public String getFirstname() { return firstname; } public void setPhoneNumbers(List<PhoneNumberEntity> phoneNumbers) { this.phoneNumbers = new ArrayList<>(phoneNumbers); } public List<PhoneNumberEntity> getPhoneNumbers() { return phoneNumbers; } public void addPhoneNumber(PhoneNumberEntity phoneNumber) { if (phoneNumbers == null) { phoneNumbers = new ArrayList<>(); } this.phoneNumbers.add(phoneNumber); } } @XmlRootElement(name = "phonenumber") static class PhoneNumberEntity { private String…
tagged with: moxy
upvote count: 1
has title: XmlElementWrapper and bidirectional marshalling
accepted answer: http://stackoverflow.com/a/21236538
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21236538

http://stackoverflow.com/comment/31950558
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21214906
has text: @ErwinBolwidt Erm, I never said anything about an `Iterator`. Second, if the OP expects me to read their code, they should format it properly. Looking at it again, you're actually correct; but that's really not my problem as I shouldn't have to decipher the formatting.

admob
tags question: http://stackoverflow.com/q/21245924
tags question: http://stackoverflow.com/q/21196470
tags question: http://stackoverflow.com/q/21246158
tags question: http://stackoverflow.com/q/21269998
type: Tag
tag name: admob

http://stackoverflow.com/q/21268149
tagged with: java
has comment: http://stackoverflow.com/comment/32046138
answer count: 6
possible better answer: http://stackoverflow.com/a/21268253
tagged with: program-entry-point
has answer: http://stackoverflow.com/a/21268253
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/21268241
has answer: http://stackoverflow.com/a/21268318
accepted answer: http://stackoverflow.com/a/21268260
favorite count: 0
has title: In Java, is there a logical reason why I cannot say "java MyClass.class " from command line?
has comment: http://stackoverflow.com/comment/32044628
has comment: http://stackoverflow.com/comment/32044687
has comment: http://stackoverflow.com/comment/32044584
has answer: http://stackoverflow.com/a/21268250
tagged with: command-line
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32044820
has body: Maybe this question may be splitting hairs, but when I compile a file from command line like : javac MyClass.java then afterward I cannot run it by saying java MyClass.class I have to call: java MyClass What is the motivation for this notation?
upvote count: 1
has answer: http://stackoverflow.com/a/21269247
type: Question
has answer: http://stackoverflow.com/a/21268260

http://stackoverflow.com/a/21293609
score: 0
has comment: http://stackoverflow.com/comment/32268532
has body: ObjectMapper is actually java.io.Serializable, if you REALLY want to do this. I wouldn't necessarily recommend it, but it is possible. It is used by some on Android, to reduce cost of re-creating mapper instances (due to the way Dalvik swaps out apps).
type: Answer
answers question: http://stackoverflow.com/q/21292867
has comment: http://stackoverflow.com/comment/32268501
has comment: http://stackoverflow.com/comment/32090742
has comment: http://stackoverflow.com/comment/32090363

eclipse-rcp
tags question: http://stackoverflow.com/q/21239860
tags question: http://stackoverflow.com/q/21278149
tags question: http://stackoverflow.com/q/21331463
tags question: http://stackoverflow.com/q/21310741
type: Tag
tags question: http://stackoverflow.com/q/21285171
tags question: http://stackoverflow.com/q/21256728
tags question: http://stackoverflow.com/q/21274977
tags question: http://stackoverflow.com/q/21256206
tags question: http://stackoverflow.com/q/21247306
tags question: http://stackoverflow.com/q/21339889
tags question: http://stackoverflow.com/q/21254535
tags question: http://stackoverflow.com/q/21343933
tags question: http://stackoverflow.com/q/21221863
tags question: http://stackoverflow.com/q/21207421
tags question: http://stackoverflow.com/q/21290881
tags question: http://stackoverflow.com/q/21292074
tag name: eclipse-rcp
tags question: http://stackoverflow.com/q/21310743

http://stackoverflow.com/a/21307706
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32116238
type: Answer
has body: In your settings.xml, you have: <EditTextPreference android:key="@id/pref_key_apiBaseUri" android:title="@string/pref_apiBaseUri_title" android:defaultValue="@string/pref_apiBaseUri_default" android:persistent="true" android:inputType="text" android:singleLine="true" /> You must specify a string for key, as the docs for android:key say: This attribute is required for preferences that persist a data value. It specifies the unique key (a string) the system uses when saving this setting's value in the SharedPreferences. It seems that your pref_key_apiBaseUri is an empty String. Change it to a valid String and move to strings.xml: KEY then use as: <EditTextPreference android:key="@string/pref_key_apiBaseUri" ... OR keep it as it is, and just add + in front of id tag, which will create id which in turn will be used as key: <EditTextPreference android:key="@+id/pref_key_apiBaseUri" ...
has comment: http://stackoverflow.com/comment/32115902
has comment: http://stackoverflow.com/comment/79663547
accepted answer of: http://stackoverflow.com/q/21306677
score: 4
answers question: http://stackoverflow.com/q/21306677
upvote count: 4
has comment: http://stackoverflow.com/comment/32114351

http://stackoverflow.com/comment/32050024
has text: @Austin run curl with `-v` ... what's the return code there?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21268600
score: 1

http://stackoverflow.com/q/21244773
type: Question
has answer: http://stackoverflow.com/a/21247469
downvote count: 0
tagged with: java-web-start
tagged with: jnlp
answer count: 1
tagged with: applet
favorite count: 0
has comment: http://stackoverflow.com/comment/32004014
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21247469
has title: Error Event when trying to open applet on a browser
score: 1
tagged with: java
has body: I have done a few Java programs but this is the first one that I'm trying to run as an applet so I might have some basic error. I compiled all the classes and put them together in a jar file called final. I followed a few tutorials to make a JNLP file that I called jnlp (yeah, I know, I'm very original:) and on which I called to my jar file and I called the JNLP file from an HTML file. Those are the last lines of the java console output: (before them, the console is filled with my JNLP file) at sun.plugin2.applet.JNLP2Manager.loadJarFiles(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) preloader: Added pending event 2: ErrorEvent[url=null label=JNLP not an applet, nor a JavaFX application cause=JNLP not an applet, nor a JavaFX application Here is the JNLP file: <?xml version="1.0" encoding="UTF-8"?> Encryption Software Atlantis Atlantis <icon href="encrypt_logo.jpg"/> <offline-allowed/> <j2se version="1.6+" href= "http://java.sun.com/products/autodl/j2se"/> <jar href="final.jar" main="true" /> <update check="background"/> Here is the JS used to launch the applet:

http://stackoverflow.com/q/21300927
has body: I am testing a component using camel test kit. I send the data to the endpoint using template.sendBodyAndHeaders(theEndpoint, data, headers); and after this statement I assert the mocked endpoints using assertMockEndpointsSatisfied(); But the problem is the endpoint takes some times(based on the input) for processing, thus my assert condition fail because the mocked queue haven't received data yet. In order to solve the problem, I tried using 1. Thread.sleep(1000L); But as I said that processing time changes with the input, it fails at times. I cannot increase time since it may be performance issue when testing with smaller input. Also tried, 2. synchronized (this) { this.wait(); assertMockEndpointsSatisfied(); } synchronized (this) { template.sendBodyAndHeaders(theEndpoint, data, headers); template.notify(); } But this is a deadlock. I know the code is wrong and wont ever work. But multithreading is new to me, I have read about wait/notify still not able to come up with right solution. Any idea how we can make this wait/notify work or any other solution to this problem which actually asserts only after the processing completes not not based on hardcorded timeout value?
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21328040
tagged with: apache-camel
type: Question
has comment: http://stackoverflow.com/comment/32103926
has comment: http://stackoverflow.com/comment/32116841
downvote count: 0
has comment: http://stackoverflow.com/comment/32104411
has comment: http://stackoverflow.com/comment/32106180
has title: component testing using camel framework with multithreading
answer count: 1
has comment: http://stackoverflow.com/comment/32106648
has comment: http://stackoverflow.com/comment/32114029
favorite count: 0
has comment: http://stackoverflow.com/comment/32106306
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/comment/31920373
has text: I suggest use a set and then a while as set.size smaller than 6
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21197930

http://stackoverflow.com/comment/32076020
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21286263
has text: Do you know any other free hosting site?
score: 0

http://stackoverflow.com/comment/32148551
has text: @falsetru: Seen it a lot of times, but I forget it on account of lack of use & as I said, it get's confusing as I move down. Anyways, thanks once again.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21302878

http://stackoverflow.com/comment/31981820
has text: it works in .Net by converting DIB to Byte[] then to Bitmap using this class 'BITMAPINFOHEADER' that i found too in JNA Library. - IntPtr ptr = GlobalLock(frontimg); - byte[] buffer = HGlobalToByteArray(ptr); - GlobalUnlock(frontimg);
comment on: http://stackoverflow.com/q/21185392
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21291689
has body: I got some problem here. I use osmdroid to display maps and I need some functions like add map marker and draw a path between markers. For adding markers on map I use this instructions // Global declaration ArrayList&lt;OverlayItem&gt; world_overlay; ItemizedIconOverlay&lt;OverlayItem&gt; world_items; MapController citymap_controller; // this code is in function world_overlay = new ArrayList&lt;OverlayItem&gt;(); for(int i = 0; i &lt; States.length; ++i) { GeoPoint cur_geo = new GeoPoint(latitude[i], longtitude[i]); OverlayItem cur_item = new OverlayItem(States[i], States[i], cur_geo); world_overlay.add(cur_item); } world_items = new ItemizedIconOverlay&lt;OverlayItem&gt;(this, world_overlay, null); mapView.getOverlays().add(world_items); but I got some strange thing. If i use this snippet in function onCreate it works fine all markers are added. If I use this code in click handler of button on main screen it doesn't work. Program continues running without any problem, but markers are not displayed. This handler is implemented because other instructions are work fine. The problem is only in displaying markers. Does someone know what's wrong?
score: 0
has title: Osmdroid markers aren't displayed on button click
answer count: 1
tagged with: osmdroid
has answer: http://stackoverflow.com/a/23854231
has comment: http://stackoverflow.com/comment/33362337
accepted answer: http://stackoverflow.com/a/23854231
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/21200093
score: -1
has answer: http://stackoverflow.com/a/21200561
downvote count: 1
has comment: http://stackoverflow.com/comment/31924654
has body: I'm learning threads so I wanted to make a program which has two types of threads: one that writes random numbers and the other one which checks if the current number matches some specific number. The threads call write() and read(int) methods from the Numbers class. To make things more clear, I want my main program to look like this: Numbers n = new Numbers(); new WritingThread(n); new ReadingThread(n,3); new ReadingThread(n,5); So the output would be something like this: 2 7 3 !!! MATCH !!! 8 5 !!! MATCH !!! 1 ... The thing is that threads are not executed in order. I want to first execute the WritingThread, and then all the ReadingThreads. Because this way a new random number would be written and only one thread would have the chance to check if the numbers match. Here is the code: class Numbers: public class Numbers { int number; boolean written = false; public synchronized void write() { while (written) try { wait(); } catch (InterruptedException e1) { e1.printStackTrace(); } number = (int) (Math.random() * 10); System.out.print("\n" + number); written = true; notifyAll(); } public synchronized void check(int n) { while (!written) try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } System.out.print(" Reading thread: " + Thread.currentThread().getName()); if (n == number) System.out.print(" !!! MATCH !!! "); notify(); written = false; } } class WritingThread: public class WritingThread extends Thread { Numbers n; WritingThread(Numbers n){ this.n = n; start(); } public void run(){ while(true){ n.write(); } } } class ReadingThread: public class ReadingThread extends Thread{ Numbers n; int number; public ReadingThread(Numbers n, int number){ this.n = n; this.number = number; start(); } public void run(){ while(true){ n.check(number); } } } And the output: 3 Reading thread: Thread-2 3 Reading thread: Thread-1 !!! MATCH !!! 0 Reading thread: Thread-2 5 Reading thread: Thread-1 0 Reading thread: Thread-2 0 Reading thread: Thread-1 5 Reading thread:…
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/31924201
tagged with: multithreading
has comment: http://stackoverflow.com/comment/31924372
has comment: http://stackoverflow.com/comment/31924415
has title: Java threads in order
has comment: http://stackoverflow.com/comment/31924385
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31924393
tagged with: java
has comment: http://stackoverflow.com/comment/31924863
type: Question
has comment: http://stackoverflow.com/comment/31924206
has comment: http://stackoverflow.com/comment/31924403
answer count: 1
accepted answer: http://stackoverflow.com/a/21200561

http://stackoverflow.com/q/21201302
has answer: http://stackoverflow.com/a/21201467
has comment: http://stackoverflow.com/comment/31926402
type: UnansweredQuestion
type: Question
linked to: http://stackoverflow.com/q/12235110
has comment: http://stackoverflow.com/comment/31926185
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/21201908
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31927053
tagged with: modular-arithmetic
has body: I want to efficiently calculate ((X+Y)!/(X!Y!))% P (P is like 10^9+7) This discussion gives some insights on distributing modulo over division. My concern is it's not necessary that a modular inverse always exists for a number. Basically, I am looking for a code implementation of solving the problem. For multiplication it is very straightforward: public static int mod_mul(int Z,int X,int Y,int P) { // Z=(X+Y) the factorial we need to calculate, P is the prime long result = 1; while(Z&gt;1) { result = (result*Z)%P Z--; } return result; } I also realize that many factors can get cancelled in the division (before taking modulus), but if the number of divisors increase, then I'm finding it difficult to efficiently come up with an algorithm to divide. ( Looping over List(factors(X)+factors(Y)...) to see which divides current multiplying factor of numerator). Edit: I don't want to use BigInt solutions. Is there any java/python based solution or any standard algorithm/library for cancellation of factors( if inverse option is not full-proof) or approaching this type of problem.
has comment: http://stackoverflow.com/comment/31926309
has answer: http://stackoverflow.com/a/21201466
tagged with: python
has title: Modular arithmetic: Division over factorials % Prime

http://stackoverflow.com/comment/32078262
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21285061
type: Comment
has text: Yes but if you don't calculate the mouse size to the new position it might land outside the "play area".

http://stackoverflow.com/q/21196970
score: 0
tagged with: java
has body: I am trying to populate an excel file which has names. I am quering a database and need to update excel values based on the names. I am having issues as I think the values get overwritten and only the last value is stored in the text. I am iterating the resultset and check for the name in the excel. If they match, I am populating the values. My code is below - Apologies for lot of SOPs public class ExcelWriteDB { /** * @param args */ public static void main(String[] args) { try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection connection2 = null; // Create a connection to the database connection2 = DriverManager.getConnection(""); Statement mystat2 = connection2.createStatement(); String query = ""; ResultSet result = mystat2.executeQuery(query); ResultSetMetaData rsmd2=result.getMetaData(); FileInputStream file = new FileInputStream(new File("source.xlsx")); XSSFWorkbook workbook = new XSSFWorkbook(file); XSSFSheet sheet = workbook.getSheetAt(2); while(result.next()){ Iterator&lt;Row&gt; rowIterator = sheet.iterator(); while (rowIterator.hasNext()) { Row row = rowIterator.next(); //For each row, iterate through all the columns Iterator&lt;Cell&gt; cellIterator = row.cellIterator(); Cell cell = row.getCell(0); Cell cell3 = row.createCell(2); if (cell != null) { switch (cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC: break; case Cell.CELL_TYPE_STRING: if(cell.getStringCellValue().equals(result.getString("NAME"))){ double UPB = Double.parseDouble(result.getString("UPB")); cell3.setCellValue(UPB); } break; } } } }// while(result.next()){ FileOutputStream out = new FileOutputStream(new File("ZXC.xlsx")); workbook.write(out); out.close(); file.close(); } catch (Exception e) { e.printStackTrace(); } } } I am sure I am missing something, but I am not sure what. Any help appreciated. Thanks.
type: UnansweredQuestion
has title: populating values in excel using java - excel has primary key values
type: Question
has answer: http://stackoverflow.com/a/21197248
answer count: 1
tagged with: excel

http://stackoverflow.com/comment/32313490
comment on: http://stackoverflow.com/q/21198612
score: 0
type: Comment
type: QuestionComment
has text: I do not get it. I can probaly access different party of the object but I do not get the data out of it. For example file1.get('filename') gives me ans = song_1 and of course that is correct.

http://stackoverflow.com/q/21330303
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21330511
has body: I've got the following piece of code: public ArrayList&lt;Crime&gt; loadCrimes() throws IOException, JSONException { ArrayList&lt;Crime&gt; crimes = new ArrayList&lt;Crime&gt;(); BufferedReader reader = null; try { // Open and read the file into a StringBuilder InputStream in = mContext.openFileInput(mFilename); //what if an exception gets thrown in the line below? reader = new BufferedReader(new InputStreamReader(in)); StringBuilder jsonString = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { // Line breaks are omitted and irrelevant jsonString.append(line); } // Parse the JSON using JSONTokener JSONArray array = (JSONArray) new JSONTokener(jsonString.toString()).nextValue(); // Build the array of crimes from JSONObjects for (int i = 0; i &lt; array.length(); i++) { crimes.add(new Crime(array.getJSONObject(i))); } } catch (FileNotFoundException e) { // Ignore this one; it happens when starting fresh } finally { if (reader != null) reader.close(); } return crimes; } First, I wondered why we call .close() just on the BufferedReader object and not on the InputStream and InputStreamReader objects. I checked the official Oracle documentation and skimmed through a couple of questions in stackoverflow and according to what I've read BufferedReader.close() takes care of releasing the resources acquired by InputStreamReader and InputStream, so I don't have to call .close() on them. Is this correct? Secondly, I thought what would happen if an exception got thrown after creating the InputStream object and before creating the BufferedReader object. That is, either the InputStreamReader(InputStream in) constructor or BufferedReader(Reader in) constructor throws an exception. In that case we have acquired a file resource with InputStream but the BufferedReader object is still null, so in the finally block, the .close() method will not be invoked and the InputStream will not release the resources it has acquired. Then I read the Oracle docume…
tagged with: java
has title: Releasing resources acquired by BufferedReader, InputStreamReader and InputStream
type: Question
tagged with: resources
score: 0
has answer: http://stackoverflow.com/a/21330511
answer count: 1
tagged with: exception

http://stackoverflow.com/a/21271135
score: 1
upvote count: 1
has body: Quoting the JSFiddle from the OP's comment: var salt = CryptoJS.lib.WordArray.random(128/8); // Key and iv should be based on the same value. In this example "1111" var key = CryptoJS.PBKDF2("1111", salt, { keySize: 128/32 }); var iv = key; // Not sure what should be here!! You are generating a key from a random salt (see first line), and using that same key as initialization vector... and yet you expect a constant result? (as expected, the result changes in each invocation). Fix it to use the exact same bytes for key and iv used by the SecretKeySpec and IvParameterSpec from the java code (which you can query using their getEncoded() methods). I do not know whether the AES SecretKeySpec uses PBKDF2 or another key derivation function -- but it should be easy to test. Find the one that matches and stick to it. Beware also that the default padding in CryptoJS is PKCS7 (see the docs on "block modes and padding"); this may differ strongly from the PKCS5 that you specify in your first line of Java code.
answers question: http://stackoverflow.com/q/21240950
downvote count: 0
type: Answer

http://stackoverflow.com/a/46111170
answers question: http://stackoverflow.com/q/21197053
upvote count: 6
type: Answer
downvote count: 0
score: 6
has body: Since Struts version 2.3.34 and 2.5.13 #context is not available anymore because of security reasons (see WW-4852) As a workaround you can use #request which is documented here &lt;s:if test="#request['struts.actionMapping'].name=='addaction'"&gt; do some stuff &lt;/s:if&gt;

http://stackoverflow.com/a/21213445
accepted answer of: http://stackoverflow.com/q/21213271
answers question: http://stackoverflow.com/q/21213271
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/31947843
has comment: http://stackoverflow.com/comment/31948031
downvote count: 0
has comment: http://stackoverflow.com/comment/31947903
score: 4
has comment: http://stackoverflow.com/comment/31948138
has body: 2's complement is just adding a 1 to the 1's complement. Now, you are adding a binary bit 1 and not an int 1. You will be storing the 2's complement in an int. Just add another int that contains binary 1. Getting two's complement is a little bit more involved. This involves bitwise addition. However, there is a trick to it that I had learned in highschool. Consider the number six in binary as 0110. The one's complement is 1001. The two's complement is 1010. The trick is this, find the right-most one. Having done that, flip the bits to the left of it, all the way to the end. Use Integer.toBinaryString() to see your answer. To store a bit 1 in an int, you'd do int bit = 0b0001 This will store a bit 1 in the lower-order bits of the int. PS: I haven't made an SSCCE. Please correct me if I am wrong
has comment: http://stackoverflow.com/comment/31947852
type: AcceptedAnswer

http://stackoverflow.com/a/41275811
has comment: http://stackoverflow.com/comment/79359121
has body: This is quite an old thread but for the sake of people who looking for a way to get RequestBody and ResponseBody from Interceptor. Here is how I got it working. RequestBody, can simply use IOUtils: String requestBody= IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8); ResponseBody, I had to used HttpServletResponseCopier: ServletLoggingFilter.HttpServletResponseCopier copier = (ServletLoggingFilter.HttpServletResponseCopier) response; String responseBody = new String(copier.getCopy());
answers question: http://stackoverflow.com/q/21193380
downvote count: 4
has comment: http://stackoverflow.com/comment/70739746
has comment: http://stackoverflow.com/comment/108789809
type: Answer
has comment: http://stackoverflow.com/comment/78370688
upvote count: 6
score: 2
has comment: http://stackoverflow.com/comment/95895069

http://stackoverflow.com/comment/31910436
type: QuestionComment
comment on: http://stackoverflow.com/q/21192536
type: Comment
has text: do you want to know parent reference entity whether delete or not?
score: 0

http://stackoverflow.com/a/21315691
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21315597
has body: This is the type of data that is expected in this field: InputType.TYPE_CLASS_TEXT: Means that you expect users to write a text. InputType.TYPE_NUMBER_VARIATION_PASSWORD: Means that you expect users to write a numeric password. This can be done also inside EditText in xml layout file using input type: &lt;EditText android:id="@+id/phone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/phone_hint" android:inputType="phone" /&gt;
type: Answer
upvote count: 1

w3c
type: Tag
tags question: http://stackoverflow.com/q/21245101
tag name: w3c
tags question: http://stackoverflow.com/q/21299987

http://stackoverflow.com/comment/31903322
type: Comment
comment on: http://stackoverflow.com/q/21187852
type: QuestionComment
score: 2
has text: Sign it with a proper certificate from a recognised CA?

http://stackoverflow.com/comment/71306511
type: AnswerComment
score: 0
type: Comment
has text: @VaheHarutyunyan that's correct, `Required` isn't "the only way", I'll update the answer. But using `Autowired` instead of `Required` still means your code is not container-agnostic.
comment on: http://stackoverflow.com/a/21219567

http://stackoverflow.com/a/21197696
upvote count: 6
accepted answer of: http://stackoverflow.com/q/21193516
has comment: http://stackoverflow.com/comment/78962059
has body: Confusing Question Your question could use some rewriting. If I make a select query – You should explain this and give the exact query statement. Red Herring Since dealing with two separate servers (database server, web app server), each with a different time zone setting, you should separate the question more cleanly. Indeed, the MySQL server seems to be just a red herring, a distraction. Instead of talking about the irrelevant MySQL server, you should have tested and reported the actual time. Easy to do… Just google "current time in utc". Thus the old sailors' adage: Use one compass or three, but never two. Time Zones Three-letter time zone codes are outmoded, being neither standardized nor unique. "IST" means "India Standard Time" and "Irish Standard Time", for example. Use time zone names, as seen in this slightly outdated list. In your case, +05:30, you could use "Asia/Kolkata", also known as "Asia/Calcutta" in the older tables. That is 5.5 hours ahead of UTC/GMT. Joda-Time The java.util.Date &amp; Calendar classes are notoriously bad and confusing, as you've come to see. Avoid them. Use either the open-source third-party Joda-Time or, in Java 8, the new java.time.* classes (inspired by Joda-Time). The code below uses Joda-Time 2.3 and Java 8 on a Mac with US west coast time zone. Baseline Let's establish that 1389975349000L ≈ 16:15 UTC ≈ 21:45 India. This agrees with EpochConverter.com, as the question stated. // Specify a time zone rather than depend on defaults. DateTimeZone timeZoneKolkata = DateTimeZone.forID( "Asia/Kolkata" ); long millis = 1389975349000L; DateTime dateTimeUtc = new DateTime( millis, DateTimeZone.UTC ); DateTime dateTimeKolkata = dateTimeUtc.toDateTime( timeZoneKolkata ); Dump to console… System.out.println( "millis: " + millis ); System.out.println( "dateTimeUtc: " + dateTimeUtc ); System.out.println( "dateTimeKolkata: " + dateTimeKolkata ); When run… millis: 1389975349000 dateTimeUtc: 2014-01-17T16:15:49.000Z dateTimeKolkata: 2014-01-17…
type: Answer
has comment: http://stackoverflow.com/comment/31927478
has comment: http://stackoverflow.com/comment/78967738
score: 6
has comment: http://stackoverflow.com/comment/53611009
downvote count: 0
answers question: http://stackoverflow.com/q/21193516
has comment: http://stackoverflow.com/comment/31927359
type: AcceptedAnswer

http://stackoverflow.com/comment/64843643
comment on: http://stackoverflow.com/q/21281269
type: Comment
type: QuestionComment
has text: You very likely do NOT want to be using ECB mode. http://crypto.stackexchange.com/questions/20941/why-shouldnt-i-use-ecb-encryption
score: 0

http://stackoverflow.com/comment/31960958
type: Comment
type: QuestionComment
has text: @Darkhogg Ah yeah, I see the other issue here now. Granted, the problem he's going to hit *after* that *is* a dupe.
score: 0
comment on: http://stackoverflow.com/q/21220718

http://stackoverflow.com/q/21235634
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/9432912
linked to: http://stackoverflow.com/q/9432912
tagged with: java
tagged with: servlets
type: Question
has body: Can anyone explain RequestDispatcher forward method and RequestDispatcher include method difference with live example also when we use RequestDispatcher forward and RequestDispatcher include with proper example? Thanks in advance.
answer count: 1
has title: RequestDispatcher forward vs RequestDispatcher include
score: 0
has answer: http://stackoverflow.com/a/21235766

http://stackoverflow.com/comment/32156198
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21330020
has text: @PopoFibo are you still here?
score: 0

http://stackoverflow.com/q/21234746
tagged with: java
has answer: http://stackoverflow.com/a/21235588
has title: How to tell to what file.txt stdout is redirected?
has comment: http://stackoverflow.com/comment/31985773
type: Question
downvote count: 0
has body: Context: I was told to use commands of the form System.out.println() in any Java class I create to log the progress of the class in use (i.e. at runtime). The content of the "()" gets written to a text file which can be inspected later. But where precisely is that log? The admin defined its name and location (i.e. fully qualified path) two years ago, but I have forgotten the definition, and would like to find it without asking the admin. How can I look up (in the ksh command line) where System.out.println() gets written? How can I create such a definition in the bash command line? -- The definition appears to retain its effect across logins. -- A couple of hours of googling have not answered these outrageously elementary questions.
tagged with: bash
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31987026
upvote count: 2
type: UnansweredQuestion
score: 2

http://stackoverflow.com/comment/32174172
type: AnswerComment
has text: Ah. In that case, I'd probably create a BFactory that has a method that takes your string and spits back the appropriate BInterface.
type: Comment
comment on: http://stackoverflow.com/a/21340972
score: 1

http://stackoverflow.com/q/21318407
downvote count: 1
has answer: http://stackoverflow.com/a/21318554
has answer: http://stackoverflow.com/a/21414719
type: Question
has title: GPS: reconsidering logic behing this answer
accepted answer: http://stackoverflow.com/a/21318554
has comment: http://stackoverflow.com/comment/32133585
has body: this is a follow up question that I think might help those who are wondering in details of Distance Computing: a follow up to this question : here The best answer gives us distance between 2 given point in Meter. public static float distFrom(float lat1, float lng1, float lat2, float lng2) { double earthRadius = 3958.75; double dLat = Math.toRadians(lat2-lat1); double dLng = Math.toRadians(lng2-lng1); double a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) * Math.sin(dLng/2) * Math.sin(dLng/2); double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); double dist = earthRadius * c; int meterConversion = 1609; return (float) (dist * meterConversion); } but my question starts here: as commented under the chosen answer " The earth is not a perfect sphere, so this solution results in a slight error ". is this true? if so then how precise is it? ( in Meter ) In solution like this, I see different inputs as the earth radius from 6360 to 6379 KM. is this gap really excusable in output ? Edit: Let's Imagine our two points are both located within a 5 KM distance.
linked to: http://stackoverflow.com/q/837872
answer count: 3
has comment: http://stackoverflow.com/comment/32133525
has comment: http://stackoverflow.com/comment/32133510
favorite count: 0
has comment: http://stackoverflow.com/comment/32133315
has comment: http://stackoverflow.com/comment/32133225
has answer: http://stackoverflow.com/a/21418914
has comment: http://stackoverflow.com/comment/32133388
has comment: http://stackoverflow.com/comment/32133779
tagged with: gps
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32133277
possible better answer: http://stackoverflow.com/a/21414719

http://stackoverflow.com/a/22361182
type: Answer
answers question: http://stackoverflow.com/q/21194831
score: 0
has comment: http://stackoverflow.com/comment/34497848
type: AcceptedAnswer
has body: Although I find it pretty weird, but if you insist on having only one variable of each type, then you will have no direct access to the first instantiated list. Assuming your panel and jli are defined globally, you can find the list by searching the child components of the panel: @Override public void actionPerformed(ActionEvent e) { Component[] components = panel.getComponents(); for (Component component : components) { // child component must be a JList, but not jli if(component instanceof JList &amp;&amp; !component.equals(jli)) { JList firstList = (JList) component; } } } I would still like to repeat that this code is a complete overhead that can be simply eliminated by introducing another JList variable. Instead of accessing the list directly, you will have to search for it, consuming cpu time. Also, what would you do if you would have a third JList? You couldn't then distinct the two inaccessible JLists from each other. If you still insist on having one variable, consider using a List of JLists: List&lt;JList&gt; allMyJLists = new LinkedList&lt;&gt;(); JList jli = new JList(); // first JList allMyJLists.add(jli); jli = new JList(); // second JList allMyJLists.add(jli); Now access first JList with allMyJLists.get(0); and the second one with allMyJLists.get(1);
accepted answer of: http://stackoverflow.com/q/21194831

heroku
tags question: http://stackoverflow.com/q/21231687
type: Tag
tag name: heroku

http://stackoverflow.com/comment/32082641
comment on: http://stackoverflow.com/q/21288971
type: Comment
type: QuestionComment
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/45822/discussion-between-raja-narayan-and-jon-skeet)
score: 0

http://stackoverflow.com/a/21338473
has comment: http://stackoverflow.com/comment/32240204
has comment: http://stackoverflow.com/comment/32257096
has comment: http://stackoverflow.com/comment/32241177
has comment: http://stackoverflow.com/comment/32169651
has comment: http://stackoverflow.com/comment/32267029
score: 2
accepted answer of: http://stackoverflow.com/q/21338137
downvote count: 0
has body: I think I get what you're saying. Basically the spawn position of the mobs, should be random, but a higher portion should be around the player. Well, you're going to want to come up with an exponential equation to work out the spawn distance from the player. So, you want to take the player distance, and seed it with a random value. To get this seed you want to generate a random number, and then multiply it by itself. This gives you the distance from the player to spawn the mob within. For example, if your playing square was 50x50. Player is at 0,0. Generate a random number from 0-5, multiply by itself. 0-1 = within 1 block 1-2 = within 4 blocks 2-3 = within 9 blocks 3-4 = within 16 blocks 4-5 = within 25 blocks This means you have a 60% chance of have the mobs spawn within the 40% of the playing area from where the player is. You'll need to tweak the exact formula you use yourself, and obviously come up with a suitable playing area size. This will actually work quite well, as it means if the player stands next to a wall, half the box is outside the playing area, in which case you would spawn the mob against the wall. So the mobs have a half-sized area to spawn, which will help prevent the player camping in a corner (which would give them a 1/4 sized spawn area).
answers question: http://stackoverflow.com/q/21338137
upvote count: 2
has comment: http://stackoverflow.com/comment/32249516
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/21240132
answers question: http://stackoverflow.com/q/21240004
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32041036
has comment: http://stackoverflow.com/comment/31995692
has comment: http://stackoverflow.com/comment/31995725
upvote count: 1
type: AcceptedAnswer
has body: I would change it like this: else if (textField.getText().charAt(i) == '-' &amp;&amp; i !=0) { result = Float.parseFloat(textField.getText().toString().substring(0, i)) - Float.parseFloat(textField.getText().toString().substring(i + 1, textField.length())); returnAnswer(decimalFormat.format(result)); } Then it will ignore the - if its the first character, but otherwise continue. Have tried this locally and it appears to work. Edit: It may be worth doing the same for the + symbol, just in case someone enters '+5*10'
accepted answer of: http://stackoverflow.com/q/21240004
type: Answer

http://stackoverflow.com/a/21257593
has body: Looking ta your code PreparedStatement pst = connection.prepareStatement(query); pst.setString(1, "harom"); pst.setBinaryStream(2, ois); PreparedStatement pst = connection.prepareStatement(query); pst.setString(1, "harom"); pst.setBinaryStream(2, ois); pst.execute(); why there are two same set of lines? is it a typo from you? it should be PreparedStatement pst = connection.prepareStatement(query); pst.setString(1, "harom"); pst.setBinaryStream(2, ois); pst.execute(); Also windowObject column should be blob/binary instead of text Other than that This error usually occurs because your JDBC driver implements an older version of the JDBC API than the one included in your JRE. These older versions are fine so long as you don't try and use a method that appeared in the newer API. I recommend upgrading it to the version that was released with your database version and try again.
has comment: http://stackoverflow.com/comment/32026184
has comment: http://stackoverflow.com/comment/32026259
score: 0
answers question: http://stackoverflow.com/q/21257489
has comment: http://stackoverflow.com/comment/32026493
has comment: http://stackoverflow.com/comment/32025948
has comment: http://stackoverflow.com/comment/32025877
type: Answer
has comment: http://stackoverflow.com/comment/32028385
has comment: http://stackoverflow.com/comment/32025533
has comment: http://stackoverflow.com/comment/32026903
has comment: http://stackoverflow.com/comment/32025986
has comment: http://stackoverflow.com/comment/32026343
has comment: http://stackoverflow.com/comment/32025581

http://stackoverflow.com/comment/31985156
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21234546
score: 0
has text: AsyncCallWS task = new AsyncCallWS(); this line gives me error

http://stackoverflow.com/comment/32111907
score: 0
type: Comment
type: QuestionComment
has text: No, you haven't included it at all. I want to see the signature of the method you're trying to call: its return type and parameters. It looks like it might be `render(Page<Computer>, String, String, String)` but it's hard to see because you've been using `` in your post instead of Stack Overflow's built-in code formatting... And we don't know the type of `list`, or how `render` is declared in code... if `list` is a generic type, that's almost certainly relevant.
comment on: http://stackoverflow.com/q/21292519

http://stackoverflow.com/q/21212629
has answer: http://stackoverflow.com/a/37275658
favorite count: 0
linked to: http://stackoverflow.com/q/18093928
tagged with: linux
has comment: http://stackoverflow.com/comment/31947254
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37014796
has comment: http://stackoverflow.com/comment/31946752
has comment: http://stackoverflow.com/comment/31947297
has comment: http://stackoverflow.com/comment/31947330
score: 21
tagged with: java
upvote count: 21
has answer: http://stackoverflow.com/a/40994237
has title: Could not find or load main class org.apache.hadoop.util.VersionInfo
has body: I followed "http://codesfusion.blogspot.com/2013/10/setup-hadoop-2x-220-on-ubuntu.html" to install hadoop on ubuntu. But, upon checking the hadoop version I get the following error: Error: Could not find or load main class org.apache.hadoop.util.VersionInfo Also, when I try: hdfs namenode -format I get the following error: Error: Could not find or load main class org.apache.hadoop.hdfs.server.namenode.NameNode The java version used is: java version "1.7.0_25" OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2) OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
has comment: http://stackoverflow.com/comment/45063482
type: Question
has comment: http://stackoverflow.com/comment/36991433
has comment: http://stackoverflow.com/comment/31947074
tagged with: hadoop
has answer: http://stackoverflow.com/a/21212877
has answer: http://stackoverflow.com/a/35942936
has answer: http://stackoverflow.com/a/48378909
has comment: http://stackoverflow.com/comment/31946505
tagged with: apache
has answer: http://stackoverflow.com/a/35695878
tagged with: ubuntu
has answer: http://stackoverflow.com/a/25896488
has answer: http://stackoverflow.com/a/21213033
linked to: http://stackoverflow.com/q/23017937
downvote count: 0
has answer: http://stackoverflow.com/a/39098202
answer count: 10
has answer: http://stackoverflow.com/a/63602280

http://stackoverflow.com/a/21265600
answers question: http://stackoverflow.com/q/21248443
has body: Can you first convert it to String object and then split it using * and then use just the numerical part of it in further steps? That would work. If you really wanted to get into it, you could create a custom class or a method that would do it behind the scenes for you.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21248443
type: Answer

http://stackoverflow.com/comment/31956306
type: QuestionComment
comment on: http://stackoverflow.com/q/21218200
has text: Your A array is only 8 elements, limiting you to an input of 256. `(10 ^ j)` is exclusive-ORing the two values, probably not what you want. And that's as far as I got.
score: 0
type: Comment

http://stackoverflow.com/q/21301040
score: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21301178
answer count: 5
accepted answer: http://stackoverflow.com/a/21302205
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21301069
upvote count: 2
has answer: http://stackoverflow.com/a/21301069
tagged with: java
has body: I would like to ask a question about algorithms: A and B are two ordered lists. I want to merge them into a third list C that will also be ordered. For example, if A= [2,4,7] and B = [4, 5, 8, 9, 10] then C = [2, 4, 4, 5, 7, 8, 9, 10]. I must start off by saying that as long as A and B have items not copied to C, a certain process continues. What I fail to understand is this: i) the first item in list A (called "First(A)", which has the value 2) is smaller than "First(B)", which is 4. So the first item in list (C), called "First(C)", is equal to 2. But the second item in list (C) (called "Second(C)") is the value that you get when you compare First(B) and second(A) -- they both have the same value of 4, so you use second(A) as the value of second(C). But remember, First(B) (which is 4) has still not been used, so you compare First(B) with Third(A), and so Third(C)=First(B). I do not know how to use this concept in my algorithm, see below. ii) Once all the items in the shorter list (ie. list A) has been used up, I must simply insert the remaining items of the longer list (ie. list B) into list (C). How exactly do I include this in my algorithm? My hopelessly inadequate algorithm so far is: while(A and B have items NOT copied to C) { if (First(A) &lt; First(B)) then (Return: First(C) = First(A)) else if (First(A) &gt; First(B)) then (Return: First(C) = First(B)) First(A) := Next(A) First(B) := Next(B) First(C) := Next(C) }
has answer: http://stackoverflow.com/a/21301419
type: Question
tagged with: algorithm
has answer: http://stackoverflow.com/a/21301202
has title: Algorithm to produce a list of ascending numbers
has answer: http://stackoverflow.com/a/21302205

http://stackoverflow.com/comment/32100996
type: Comment
score: 1
has text: This answer might be better suited for http://codereview.stackexchange.com/
comment on: http://stackoverflow.com/q/21300155
type: QuestionComment

http://stackoverflow.com/a/21286860
downvote count: 0
has body: If you actually need to interact with the website then selenium/webdriver is perfect for your needs: http://code.google.com/p/selenium/wiki/GettingStarted Sample Google search: package org.openqa.selenium.example; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.htmlunit.HtmlUnitDriver; public class Example { public static void main(String[] args) { // Create a new instance of the html unit driver // Notice that the remainder of the code relies on the interface, // not the implementation. WebDriver driver = new HtmlUnitDriver(); // And now use this to visit Google driver.get("http://www.google.com"); // Find the text input element by its name WebElement element = driver.findElement(By.name("q")); // Enter something to search for element.sendKeys("Cheese!"); // Now submit the form. WebDriver will find the form for us from the element element.submit(); // Check the title of the page System.out.println("Page title is: " + driver.getTitle()); } }
has comment: http://stackoverflow.com/comment/32077060
score: 4
accepted answer of: http://stackoverflow.com/q/21286746
has comment: http://stackoverflow.com/comment/32077181
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21286746
has comment: http://stackoverflow.com/comment/32077099
has comment: http://stackoverflow.com/comment/32077310
has comment: http://stackoverflow.com/comment/32076937
has comment: http://stackoverflow.com/comment/32077156
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/32077161
has comment: http://stackoverflow.com/comment/32077372

http://stackoverflow.com/comment/32032895
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21260388
has text: I added it now and updated the code stil not working. It should print 9 contents from the xml but it print only a object : com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList@1431340

http://stackoverflow.com/a/21349748
has body: The code shows that you declare the variable but doesn't show that you initialize it, like this: people_selected = new ArrayList&lt;PeopleDetails&gt;();
upvote count: 2
answers question: http://stackoverflow.com/q/21349733
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/31921170
type: QuestionComment
comment on: http://stackoverflow.com/q/21198215
has text: after reading different comments i think i have my answer that **i should be more specific with my returned types** when creating methods...
score: 0
type: Comment

http://stackoverflow.com/q/21337707
has comment: http://stackoverflow.com/comment/32171040
tagged with: java
has comment: http://stackoverflow.com/comment/32167824
type: Question
type: AnsweredQuestion
has title: Making sure the + means to append a string
possible better answer: http://stackoverflow.com/a/21337733
score: -1
has answer: http://stackoverflow.com/a/21337733
accepted answer: http://stackoverflow.com/a/21337765
answer count: 2
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21337765
has body: Is there a way to make sure that the + plus operator is used to concatenate a String as opposed to being used as an arithmetic operator, for example this won't work because inGame is a boolean and e.getSource() == list is also a boolean. System.out.println((e.getSource() == list) + inGame); but System.out.println(e.getSource() == list +""+ inGame); this will, is there someway for the top example to work e.g. a way to tell the compiler to use the operator as concatenate operator as opposed to the arithmetic one ?
upvote count: 0

http://stackoverflow.com/comment/31906693
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21190241
type: AnswerComment
has text: @Nick Holt (And Sotirios Delimanolis) thank you both for your replies. I ran the test through the HyperSudokuTest class and it worked! I was trying to run the BaseSudokuTest! I was wrong! Thank you both bery much!

http://stackoverflow.com/q/21293236
answer count: 1
has comment: http://stackoverflow.com/comment/32088591
has comment: http://stackoverflow.com/comment/32089041
has comment: http://stackoverflow.com/comment/32088771
has answer: http://stackoverflow.com/a/21293697
score: 2
type: AnsweredQuestion
downvote count: 0
has body: We have a java process that does some analysis on files and then writes those files to a directory. Recently we noticed the process slowing dramatically. The culprit was the output directory which had grown to over 1 million files. When we emptied the directory, the speed of the process sped up dramatically. Why would this be the case? This is a Windows Server 2012 machine. No processing is done on the files in the directory (other than writing to the directory after the process is completed).
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/21293697
tagged with: io
has comment: http://stackoverflow.com/comment/32088917
upvote count: 2
tagged with: java
has title: Large directories slow processing

http://stackoverflow.com/comment/32145000
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21324532
type: AnswerComment
has text: never mind i will provide you with some code , but i need to post your layout and full code , to can edit in it

http://stackoverflow.com/comment/32086800
has text: @SergeyGrinev -- added the line
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21266694

http://stackoverflow.com/comment/32071474
type: Comment
has text: Don't add image on the `Panel`. Go to the `JFrame` on which you are adding this `Panel` and follow the steps which I have mentioned in the answer.
comment on: http://stackoverflow.com/a/21283487
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32065744
type: QuestionComment
has text: At line 54 you have a cast problem just want to highlight that in case ActivityService.onCreate(LoginActivityService.java:54) 01-23
score: 0
comment on: http://stackoverflow.com/q/21280030
type: Comment

http://stackoverflow.com/comment/31937475
comment on: http://stackoverflow.com/a/21207824
has text: Why do you think it's not suitable for SO?
score: 2
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32144747
has text: then I fear you won't be able to check it this way unless you have the list of errors. if you have the list of errors then you can compare here.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21324804

http://stackoverflow.com/q/21263607
score: 89
accepted answer: http://stackoverflow.com/a/21263662
possible better answer: http://stackoverflow.com/a/62239792
has answer: http://stackoverflow.com/a/62239792
tagged with: multiple-inheritance
favorite count: 0
has comment: http://stackoverflow.com/comment/32036530
has body: I know that multiple inheritances between Interfaces is possible, e.g.: public interface C extends A,B {...} //Where A, B and C are Interfaces But is it possible to have a regular Class inherit from multiple Interfaces like this: public class A implements C,D {...} //Where A is a Class and C and D are interfaces
linked to: http://stackoverflow.com/q/13389384
has answer: http://stackoverflow.com/a/21263637
tagged with: interface
has answer: http://stackoverflow.com/a/21263688
has answer: http://stackoverflow.com/a/21263749
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/58916508
has answer: http://stackoverflow.com/a/21263662
has comment: http://stackoverflow.com/comment/32036736
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/32036494
upvote count: 91
has comment: http://stackoverflow.com/comment/32036606
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/21263686
has answer: http://stackoverflow.com/a/47739868
has title: Can a normal Class implement multiple interfaces?

http://stackoverflow.com/comment/32022178
has text: How did you package your program and create the jar? Did you try to include any JavaFX libraries with your program? See related [forum post](https://community.oracle.com/thread/2584290) (no real resolution I think). Does it work with a more modern Java version?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21252303
score: 0

http://stackoverflow.com/q/21255180
tagged with: java
has answer: http://stackoverflow.com/a/21256039
type: Question
answer count: 2
has title: How can I rewrite this to C?
tagged with: http://stackoverflow.com/tag/c
score: 0
has answer: http://stackoverflow.com/a/21255638
type: UnansweredQuestion
has body: how can I rewrite this to C? prefix + str.charAt(i) and str.substring(0, i) + str.substring(i+1, len) I tried something like this, but it's failed on str[3] int len; //prefix len = strlen(prefixP); char prefix[len]; strncpy(prefix, prefixP, len); //str len = strlen(strP); char str[len+1]; strncpy(str, strP, len); //prefix + znak len = strlen(prefix) + 1; char buffer[len]; sprintf(buffer,"%s%s", prefix, str[3]); printf("%s, %s, %s\n", prefix, str, buffer); and //str.substring(0, i) + str.substring(i+1, len) char subbuff[i+2]; memcpy(subbuff, str, i+1); subbuff[i + 1] = '\0'; printf("%s\n", subbuff); //substring 2 char subbuff2[abs(i-len) + 2]; memcpy(subbuff2, str, abs(i-len) + 1); subbuff[i + 1] = '\0';*/

http://stackoverflow.com/q/21202899
has answer: http://stackoverflow.com/a/21202969
answer count: 3
has comment: http://stackoverflow.com/comment/31929010
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21203031
upvote count: 0
has comment: http://stackoverflow.com/comment/31928983
has comment: http://stackoverflow.com/comment/31929667
tagged with: multithreading
has title: Class name Cannot be resolved to a type error - Multithreading
possible better answer: http://stackoverflow.com/a/21202969
type: AnsweredQuestion
tagged with: java
has body: I am learning Java Programming and I am a beginner. I am in Multithreading Concept now. When I execute the below program, I getting errors like Errors X cannot be resolved to a type X cannot be resolved to a type ThreadX cannot be resolved at ThreadTest.main(ThreadTest.java:20) Code public Class X implements Runnable { public void run() { for(int i=0;i&lt;=10;i++) { System.out.println("\tValue of ThreaadX : "+i); } System.out.println("End of ThreadX"); } } public class ThreadTest { public static void main(String[] args) { X runnable = new X(); Thread Threadx = new Thread(runnable); ThreadX.start(); System.out.println("END OF THREADX"); } } What mistake I did in the Main Method. I getting this error When I tried to create an object 'runnable' of the class X. Thanks in advance
has answer: http://stackoverflow.com/a/21202944
accepted answer: http://stackoverflow.com/a/21202944
linked to: http://stackoverflow.com/q/1333377
type: Question
score: -1
has comment: http://stackoverflow.com/comment/31928857

http://stackoverflow.com/comment/31953126
type: Comment
comment on: http://stackoverflow.com/a/21216544
has text: Ok now using a PushBackInputStream and the dis, pbs for the available, dis for rest ;)
score: 0
type: AnswerComment

http://stackoverflow.com/a/21264487
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21264395
has comment: http://stackoverflow.com/comment/32038026
has comment: http://stackoverflow.com/comment/32038258
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32068807
downvote count: 0
has comment: http://stackoverflow.com/comment/32068879
type: Answer
has body: I would suggest you just try to parse each specific format, catching ParseException and just moving onto the next format: private static final String[] patterns = { "yyyy-MM-dd HH:mm", "yyyy-MM-dd'T'HH:mm", "yyyy-MM-dd HH:mm" }; public static Date test(String value) throws ... { for (String pattern : patterns) { try { DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm"); return df.parse(value); } catch (ParseException e) { // No-op - move onto the next pattern } } // Do whatever you want here - throw ParseException, or return null } That's simple, but abuses exceptions. You could use the more obscure parse(String, ParsePosition) call instead: public static Date test(String value) throws ... { for (String pattern : patterns) { DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm"); Date date = df.parse(value, new ParsePosition(0)); if (date != null) { return date; } } // Do whatever you want here - throw ParseException, or return null } That may perform better - you'd have to benchmark it to say for sure. It's unfortunate that you have to recreate the SimpleDateFormat objects on each call, but that's an issue with it not being thread-safe. Another alternative is to use Joda Time - which is a much nicer API overall - but it's not very clear how you'd do the exception-free approach there. (It may well be possible, just a bit obscure again. I suspect that DateTimeFormatter.parseInto would be your friend here.)
accepted answer of: http://stackoverflow.com/q/21264395

http://stackoverflow.com/q/21231687
has body: Here is what I want to do. --> Deploy a play framework (2.2.1) Java web application on Heroku and use newrelic as an add on. **Issue /problem:** These are the steps i did so far. 1) I am able to add addon using the heroku command of addon "heroku addons:add newrelic:stark" I see the add on in the heroku resources. 2) Adding the newrelic.yml file. added the newrelic.yml file as attached and saved in the conf folder of the play framework (were the application.conf file is present). The file I picked up is from https://gist.github.com/anfuerer/6169040 (just updated licence and app info) 3) As its play 2.2.1, changed the built.sbt file to add dependencies. "com.newrelic.agent.java" % "newrelic-agent" % "3.4.0", "com.newrelic.agent.java" % "newrelic-api" % "3.4.0" 4) My Procfile which is required for heroku has the JAVA_OPTS specified and the JAVA_OPTS is set by using the command heroku config:set JAVA_OPTS=”-Xmx384m -Xss512k -XX:+UseCompressedOops -Dfile.encoding=UTF-8 -javaagent:target/staged/newrelic-agent-3.4.0.jar -Dnewrelic.bootstrap_classpath=true -Dnewrelic.config.file=./conf/newrelic.yml newrelic.config.log_level=finer newrelic.debug=true” 5) obviously all the changes are added to git and committed before pushing to heroku by command "git heroku push master". 6) some basic sanity test.. I see my config after heroku config command as - JAVA_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops -Dfile.encoding=UTF-8 -javaagent:target/staged/newrelic-agent-3.4.0.jar -Dnewrelic.bootstrap_classpath=true -Dnewrelic.config.file=./conf/newrelic.yml newrelic.config.log_level=finer newrelic.debug=true NEW_RELIC_APP_NAME: test_application NEW_RELIC_LICENSE_KEY: 000000000000000000000000000000000 (changed offcourse) NEW_RELIC_LOG: stdout PATH: .jdk/bin:.sbt_home/bin:/usr/local/bin:/usr/bin:/bin REPO: /app/.sbt_home/.ivy2/cache SBT_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops Also tried to check by "heroku run env | grep NEW_RELIC" which gives me output - NEW_RELIC_LOG=stdout NEW_…
favorite count: 0
tagged with: newrelic-platform
accepted answer: http://stackoverflow.com/a/21398144
tagged with: playframework-2.2
score: 4
type: AnsweredQuestion
tagged with: java
tagged with: newrelic
has title: adding new relic addon to heroku play framework 2.2.1 java app
type: Question
tagged with: heroku
has answer: http://stackoverflow.com/a/21398144
upvote count: 4
answer count: 2
possible better answer: http://stackoverflow.com/a/21241065
has answer: http://stackoverflow.com/a/21241065
downvote count: 0

http://stackoverflow.com/a/21198994
has body: Apart from checking for an invalid number of tickets, your code does nothing with the entered number. You need to put the code to create and print a ticket in a for loop.
has comment: http://stackoverflow.com/comment/31922328
has comment: http://stackoverflow.com/comment/31922281
answers question: http://stackoverflow.com/q/21198873
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/31952766
type: QuestionComment
has text: How sensible is requiring an Internet connection to exploit advanced functionality actually depends on what your application does. While for a, say, web browser, expecting an Internet connection is reasonable, for a scientific calculus suite it might be not.
comment on: http://stackoverflow.com/q/21216401
score: 0
type: Comment

http://stackoverflow.com/a/21250284
answers question: http://stackoverflow.com/q/21250041
has comment: http://stackoverflow.com/comment/34528215
has body: You can wrap it with: if(A&gt;=B): calculate A-B else: calculate -(B-A)
upvote count: 3
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/a/21290817
has body: You could save which columns are visible based on the column name using the getColumnCount() and getColumnName(int column) methods. int numColumns = jTable.getColumnCount() for(int index = 0; index &lt; numColumns; index++) { String name = jTable.getColumnName(index); // add name to list and save after iteration }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21288936

http://stackoverflow.com/q/21336303
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21336329
tagged with: java
tagged with: unreachable-code
type: Question
has body: I have this very simple code snippet: static String getInput() throws IOException{ if(in.ready()){ return in.readLine().trim(); } System.err.println("Please provide more input in order to execute the program."); System.exit(0); return ""; } By what I think I know, there is no possible way that the JVM will execute the return statement at the end of the code. But if I comment this line out, java will complain about a missing return statement. Why doesn't the JVM recognize that a System.exit(0) will not allow any other code to execute, but complains about unreachable statements if a return will not allow code to be executed? I think the return statement at the end is redundant and might be confusing to other devs, so why won't java let me get rid of it?
answer count: 1
score: 0
has title: Unreachable return statement still throws error
has answer: http://stackoverflow.com/a/21336329
tagged with: jvm
has comment: http://stackoverflow.com/comment/32166255

http://stackoverflow.com/comment/32144087
has text: @Danny, Thanks, yes, i think the answer below your link is the closest one.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21292495
score: 0

http://stackoverflow.com/q/21283475
score: 1
has comment: http://stackoverflow.com/comment/32071077
possible better answer: http://stackoverflow.com/a/21283562
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21332635
answer count: 3
has body: Hi I am trying to setup a test project with maven + spring 4 + embedded tomcat I get the following error: INFO: Starting service Tomcat Jan 22, 2014 8:27:08 AM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.47 Jan 22, 2014 8:27:12 AM org.apache.catalina.core.ApplicationContext log INFO: No Spring WebApplicationInitializer types detected on classpath Jan 22, 2014 8:27:12 AM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext 08:27:12.127 [localhost-startStop-1] INFO o.s.web.context.ContextLoader - Root WebApplicationContext: initialization started 08:27:12.141 [localhost-startStop-1] ERROR o.s.web.context.ContextLoader - Context initialization failed org.springframework.context.ApplicationContextException: Failed to load custom context class [ org.springframework.web.context.support.AnnotationConfigWebApplicationContext ]; nested exception is java.lang.ClassNotFoundException: org.springframework.web.context.support.AnnotationConfigWebApplicationContext at org.springframework.web.context.ContextLoader.determineContextClass(ContextLoader.java:399) ~[spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:342) ~[spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:280) ~[spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) [tomcat-embed-core-7.0.47.jar:7.0.47] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) [tomcat-embed-core-7.0.47.jar:7.0.47] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-7.0.47…
has title: Error: Class not found AnnotationConfigWebApplicationContext
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21332635
has comment: http://stackoverflow.com/comment/32071032
tagged with: maven
has answer: http://stackoverflow.com/a/21283562
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21283721

http://stackoverflow.com/a/21216054
downvote count: 0
answers question: http://stackoverflow.com/q/21216022
type: Answer
score: 2
upvote count: 2
has body: JLabel's constructor accepts argument of type String and not an array of Strings. Either use one of the strings in your array : label = new JLabel(array1[index]); Or concatenate the strings into one String object.

http://stackoverflow.com/comment/32005159
has text: have u changed the size of listview, are u able to scroll it and see more items
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21245401
type: Comment

http://stackoverflow.com/q/21338933
downvote count: 0
favorite count: 0
tagged with: ajax
has answer: http://stackoverflow.com/a/21340897
tagged with: zk
has title: ZK inner class tree property not readable
tagged with: properties
linked to: http://stackoverflow.com/q/19477396
score: 2
type: AnsweredQuestion
upvote count: 2
has body: I have almost the same problem as this question: Property not readable on a inner class in a TreeModel But the same solution seems not applicable. I have a tree, and as I implemented my Entity, and my TreeModel, and they are working just fine, on my .zul file my "data" property isn't found on the treecell. Here's some of the code: -The structure implementation, that runs @AfterCompose: private void montarEstrutura(){ Unidade ub1 = new Unidade(); ub1.setParent(null); ub1.setNumero("NBase"); ub1.setDescricao("DBase"); Unidade ub2 = new Unidade(); ub2.setParent(ub1); ub2.setNumero("N002"); ub2.setDescricao("D002"); Unidade ub4 = new Unidade(); ub4.setParent(ub2); ub4.setNumero("N004"); ub4.setDescricao("D004"); Unidade ub6 = new Unidade(); ub6.setParent(ub4); ub6.setNumero("N006"); ub6.setDescricao("D006"); Unidade ub7 = new Unidade(); ub7.setParent(ub4); ub7.setNumero("N007"); ub7.setDescricao("D007"); Unidade ub8 = new Unidade(); ub8.setParent(ub4); ub8.setNumero("N008"); ub8.setDescricao("D008"); Unidade ub5 = new Unidade(); ub5.setParent(ub2); ub5.setNumero("N005"); ub5.setDescricao("D005"); Unidade ub3 = new Unidade(); ub3.setParent(ub1); ub3.setNumero("N003"); ub3.setDescricao("D003"); List<Unidade> lub3 = new ArrayList<Unidade>(); lub3.add(ub6); lub3.add(ub7); lub3.add(ub8); ub4.setUnidades(lub3); List<Unidade> lub2 = new ArrayList<Unidade>(); lub2.add(ub4); lub2.add(ub5); ub2.setUnidades(lub2); List<Unidade> lub1 = new ArrayList<Unidade>(); lub1.add(ub2); lub1.add(ub3); ub1.setUnidades(lub1); unidadeTreeModel = new UnidadeTreeModel(ub1); tree.setModel(unidadeTreeModel); } -The entity is pretty long, so I'll cut it: @Entity @Audited public class Unidade extends AbstractSuseTools{ private String numero; private String descricao; @OneToMany private List<Unidade> unidades = new LinkedList<Unidade>(); public String getNumero() { return numero; } public void setNumero(String numero) { this.numero = numero; } public String getDescricao() { return descricao; } public v…
has comment: http://stackoverflow.com/comment/32176830
has comment: http://stackoverflow.com/comment/32241298
accepted answer: http://stackoverflow.com/a/21340897
type: Question
tagged with: tree
tagged with: java
has answer: http://stackoverflow.com/a/21381506
has comment: http://stackoverflow.com/comment/32253447
answer count: 2
possible better answer: http://stackoverflow.com/a/21381506

http://stackoverflow.com/a/21326895
type: Answer
has body: I use following approach to finding memory leaks in Java. I've used jProfiler with great success, but I believe that any specialized tool with graphing capabilities (diffs are easier to analyze in graphical form) will work. Start the application and wait until it get to "stable" state, when all the initialization is complete and the application is idle. Run the operation suspected of producing a memory leak several times to allow any cache, DB-related initialization to take place. Run GC and take memory snapshot. Run the operation again. Depending on the complexity of operation and sizes of data that is processed operation may need to be run several to many times. Run GC and take memory snapshot. Run a diff for 2 snapshots and analyze it. Basically analysis should start from greatest positive diff by, say, object types and find what causes those extra objects to stick in memory. For web applications that process requests in several threads analysis gets more complicated, but nevertheless general approach still applies. I did quite a number of projects specifically aimed at reducing memory footprint of the applications and this general approach with some application specific tweaks and trick always worked well.
score: 0
answers question: http://stackoverflow.com/q/21326360

http://stackoverflow.com/comment/31960072
type: QuestionComment
score: 0
has text: Jesus. Stop saying PLEASE
comment on: http://stackoverflow.com/q/21220300
type: Comment

http://stackoverflow.com/comment/32090421
type: AnswerComment
comment on: http://stackoverflow.com/a/21270645
score: 0
type: Comment
has text: Thanks. Instead of anyString() I used anyObject(). anyString() would work as well.

http://stackoverflow.com/comment/31942881
comment on: http://stackoverflow.com/a/21206407
type: AnswerComment
type: Comment
score: 0
has text: ya, that's what I meant...don't think you could disable the actual divider itself. I assumed "JSplitPane divider = new JSplitPane()" ;)

http://stackoverflow.com/q/21289019
has title: Java Tutorial .isEmpty() Method
has answer: http://stackoverflow.com/a/21289102
type: Question
possible better answer: http://stackoverflow.com/a/21289096
has comment: http://stackoverflow.com/comment/32081005
has answer: http://stackoverflow.com/a/21289096
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21289102
has comment: http://stackoverflow.com/comment/32081318
has comment: http://stackoverflow.com/comment/32080978
has comment: http://stackoverflow.com/comment/32080902
type: AnsweredQuestion
has body: I have 3 Classes (Printer, PaperTray and Machine) and my Main Java class (HelloWorld). I am expecting to see "Load more paper!" as the output when this "myPrinter.print(2)" is called yet the output shows "My Printer is On!" twice, as though there is paper in the tray. I should only see the output showing the printer as on twice if there is enough paper being passed into loadPaper(which has been commented out for the time being until I get the load paper working): import printing.Printer; public class HelloWorld { public static void main(String[] args) { Printer myPrinter = new Printer(true, "MY PRINTER"); //myPrinter.loadPaper(3); myPrinter.print(2); } } From my Printer class: package printing; public class Printer extends Machine { private String modelNumber; private PaperTray paperTray = new PaperTray(); //printer now HAS paper tray public Printer(boolean isOn, String modelNumber) { super(isOn); //calls the constructor of the machine class - Super calls inherited parent this.modelNumber = modelNumber; } public void print(int copies) { String onStatus = ""; if(isOn) { onStatus = " is On!"; } else { onStatus = " is Off!"; } String textToPrint = modelNumber + onStatus; while(copies &gt; 0 &amp;&amp; !paperTray.isEmpty()) { System.out.println(textToPrint); copies--; paperTray.usePage(); } if(paperTray.isEmpty()) { System.out.println("Load more paper!"); } } //for each public void printColours() { String[] colours = new String[] {"Red", "Blue", "Green", "Yellow" }; //for current colour "in" colours for(String currentColour : colours) { if("Green".equals(currentColour)) { continue; } System.out.println(currentColour); } } public void print(String text) { System.out.println(text); } public String getModelNumber() { return modelNumber; } public void loadPaper(int count) { paperTray.addPaper(count); } } When ".isEmpty()" is called, the value of pages is -2 yet I believe ".isEmpty()" only works when the value is equal to 0 exactly? So this is where I am guessing my problem …
tagged with: java

http://stackoverflow.com/comment/31967437
comment on: http://stackoverflow.com/q/21222195
has text: I don't know exactly why, but anything done within the View class acts like the TreeMap and Model are empty. I add within the Controller and it works, and I can remove and clear if I am within the Controller.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32062227
comment on: http://stackoverflow.com/q/21278055
type: QuestionComment
type: Comment
has text: @R.J Now it gives me 3 digits after the decimal point, how can I get more?
score: 0

http://stackoverflow.com/q/21316869
tagged with: java
tagged with: web-services
tagged with: http
type: Question
has body: I usually write my web services using PHP + Mysql, in a simplified way: reading the POST/GET params, connecting to the MySQL database and finally printing a JSON. I'd like to check how to do this with a Java server, I've never programmed Java web servers and I'd like to know what should I study to learn to do it Thanks
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2131965
accepted answer: http://stackoverflow.com/a/21317576
has answer: http://stackoverflow.com/a/21317054
answer count: 2
downvote count: 1
tagged with: web
has answer: http://stackoverflow.com/a/21317576
favorite count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/32130632
linked to: http://stackoverflow.com/q/3736926
has title: How to write web services with Java
score: 2
possible better answer: http://stackoverflow.com/a/21317054
has comment: http://stackoverflow.com/comment/32130454

http://stackoverflow.com/comment/33317996
type: Comment
has text: The fix was not merged to the main repo yet, as far as I can see. I simply merged it myself in my local fork.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21533288

http://stackoverflow.com/comment/32036022
comment on: http://stackoverflow.com/a/21262948
type: Comment
has text: Well, that clearly answers my question. I just wish it solved my problem :-/
score: 0
type: AnswerComment

http://stackoverflow.com/q/21259962
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21262533
type: Question
has answer: http://stackoverflow.com/a/21262533
answer count: 2
has body: I'm trying to learn a bit more about MVC. So far I am doing okay with smaller programs. For my purposes I have been keeping all the business logic and 'results' in my model. At the moment I have 4 classes, my main class, a view class and a model and controller class. I'm now thinking of separating some of the business logic from my model class and putting it in a separate class. This is where I'm unsure of what the best practice would be. Should I be creating/referencing my new class in my model class or should I do it directly from my controller class. I'm not sure if it helps much but this is my current controller class: public class BrowseController { private BrowseModel m_model; private BrowseView m_view; public BrowseController(BrowseModel model, BrowseView view) { m_model = model; m_view = view; view.addRunListener(new RunListener()); view.addClearListener(new ClearListener()); } class RunListener implements ActionListener{ public void actionPerformed(ActionEvent e){ start(); } } class ClearListener implements ActionListener{ public void actionPerformed(ActionEvent e){ System.out.println("clear"); m_view.reset(); m_model.reset(); } } private void start(){ SwingWorker&lt;Void, Object[]&gt; worker = new SwingWorker&lt;Void, Object[]&gt;(){ @Override protected Void doInBackground() throws Exception { m_view.setStatus("Running"); HashSet&lt;String&gt; urls = m_view.getTargetUrls(); for (String url : urls){ m_model.processUrl(url); publish(m_model.getResults()); } return null; } @Override protected void done() { m_view.setStatus(m_model.getStatus()); } @Override protected void process(List&lt;Object[]&gt; resultList) { for(Object[] resultRow : resultList){ m_view.setResult(resultRow); } } }; worker.execute(); } } If there's anything else I should be providing just let me know, thanks.
has answer: http://stackoverflow.com/a/21260472
tagged with: controller
score: 0
tagged with: model
has title: MVC, should I be referencing additional classes from model or controller
accepted answer: http://stackoverflow.com/a/21260472
tagged with: model-view-controller

http://stackoverflow.com/q/21307642
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/67023556
upvote count: 3
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/650894
tagged with: junit4
tagged with: java
has title: How to specify label to a Parameterized junit run
has comment: http://stackoverflow.com/comment/32116815
accepted answer: http://stackoverflow.com/a/21325140
tagged with: eclipse
answer count: 2
has comment: http://stackoverflow.com/comment/32120080
favorite count: 0
tagged with: parameterized
has body: In Eclipse, while using the Parameterized runner in a junit test class, each run is noted by a number (0, 1, etc.) Is there a way to replace this number with a proper label? PS: I am using a JUNIT version 4.8 older than 4.11 so the @Parameters does not take any argument Test Case: @RunWith(value = Parameterized.class) public class TestClass { @Parameters public static Collection&lt;Object[]&gt; getLabels() { List&lt;Object[]&gt; labels = new ArrayList&lt;Object[]&gt;(); labels.add(new Object[] {"Toto"}); labels.add(new Object[] {"Titi"}); return labels; } private final String label; public TestClass(String label) { this.label = label; } @Test public void test1() { assertTrue(true); } } Result:
possible better answer: http://stackoverflow.com/a/67023556
has answer: http://stackoverflow.com/a/21325140
has comment: http://stackoverflow.com/comment/32120144

http://stackoverflow.com/comment/32276020
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21260566
has text: any solution for my problem? its not coming out from while loop in both server and client code module. Help me to fix this please
score: 0

http://stackoverflow.com/a/21276017
type: Answer
has comment: http://stackoverflow.com/comment/32059317
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32058676
accepted answer of: http://stackoverflow.com/q/21275974
answers question: http://stackoverflow.com/q/21275974
has comment: http://stackoverflow.com/comment/32058496
upvote count: 2
has body: split by any number of whitespaces or commas and then parse every resulting String to a number: String[] numberParts = input.split("[\\s,]+"); double[] doubles = new double[numberParts.length]; int i=0; for (String part : numberParts) { double value = Double.parseDouble(part); doubles[i++] = value; }
has comment: http://stackoverflow.com/comment/32058563
type: AcceptedAnswer

http://stackoverflow.com/comment/32372132
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21305381
type: AnswerComment
has text: jaganath , Thanks for your reply.it works grate but just for my knowledge i want to know why you use processArgs.push("/c") as an argument?

http://stackoverflow.com/q/21337826
has title: How do I avoid an ArrayIndexOutOfBounds?
has comment: http://stackoverflow.com/comment/32167978
answer count: 2
has comment: http://stackoverflow.com/comment/32168195
tagged with: arrays
downvote count: 0
accepted answer: http://stackoverflow.com/a/21337920
favorite count: 0
possible better answer: http://stackoverflow.com/a/21337940
has answer: http://stackoverflow.com/a/21337940
has comment: http://stackoverflow.com/comment/32167923
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/32167898
has comment: http://stackoverflow.com/comment/32168295
has answer: http://stackoverflow.com/a/21337920
type: Question
has body: I am trying to input a number, and have the program create a new array of that length. I will then input all the elements in the array one at a time. After that I type a single number, and the program will search the array for that number. Unfortunately, the code I wrote below throws an ArrayIndexOutOfBoundsException. How can I fix this? import java.io.*; public class aw { public static void main(String args [])throws IOException`` { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int z; boolean vince = false; System.out.print("Enter Element :"); int a = Integer.parseInt(in.readLine()); int [] jes = new int[a]; for(z=0; z&lt;jes.length; z++) { System.out.print("Numbers :"); jes[z] = Integer.parseInt(in.readLine()); } System.out.print("Enter search:"); int []x = new int [100]; x[100] = Integer.parseInt(in.readLine()); if(jes[z] == x[100]) { vince = true; if(vince == true) { System.out.print("Array "+jes[z]+ "Found at Index"+z); // here is my problem if i input numbers here it will out of bounds } } } }
score: 3
tagged with: java

http://stackoverflow.com/q/21266037
has comment: http://stackoverflow.com/comment/32040622
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21266120
tagged with: java
score: -4
tagged with: swing
has comment: http://stackoverflow.com/comment/32041059
accepted answer: http://stackoverflow.com/a/21266120
type: Question
downvote count: 4
tagged with: nullpointerexception
upvote count: 0
has title: NullPointerException, can't figure out way
answer count: 1
has body: My code is linked here. its kinda a lot and it's my first Java program outside of school projects. so its a little messy. sorry! I highlighted the parts I'm having trouble with. So I create a profile and then when I change the combobox selection (should I use ComboBoxItemStateChanged, or ComboBoxActionPreformed for this?) after adding 2 profiles I get a null pointer exception on the first profile at index 0 ctr F to profileComboBoxItemStateChanged and read the troubleshooting printout I did. and addProfileConfirmActionPerformed is where a profile is being created/added I have a feeling the issue is in there somewhere. UI/main class: http://pastebin.com/XyGWeXgq Profile Class: http://pastebin.com/WrpiSCav
favorite count: 0
has comment: http://stackoverflow.com/comment/32040677
has comment: http://stackoverflow.com/comment/32040982

http://stackoverflow.com/comment/32019809
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21254312
type: Comment
has text: Thank you Thomas, that was exactly the information I was looking for.

http://stackoverflow.com/q/21191306
type: Question
tagged with: sharing
score: 0
has body: Okay, So i have my main class public class ViewSpotActivity extends Activity {...} In onCreate() new GetSpotDetails().execute(); is called. Get Spot details looks like this: class GetSpotDetails extends AsyncTask&lt;String, String, JSONObject&gt; { /** * Before starting background thread Show Progress Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(ViewSpotActivity.this); pDialog.setMessage("Loading Spot details. Please wait..."); pDialog.setIndeterminate(false); pDialog.setCancelable(false); pDialog.show(); } /** * Getting details in background thread * */ protected JSONObject doInBackground(String... String) { JSONObject spot = null; // Check for success tag int success; try { // Building Parameters List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("pid", pid)); // getting details by making HTTP request // Note that details url will use GET request JSONObject json = jsonParser.makeHttpRequest( url_detials, "GET", params); // check your log for json response Log.d("Single Spot Details", json.toString()); // json success tag success = json.getInt(TAG_SUCCESS); if (success == 1) { // successfully received product details JSONArray spotObj = json .getJSONArray(TAG_SPOT); // JSON Array // get first product object from JSON Array int value = Integer.parseInt(pid); int n=0; while(Integer.parseInt(spotObj.getJSONObject((n)).getString(TAG_PID))!=value){ n++; } spot = spotObj.getJSONObject((n)); }else{ // product with pid not found } } catch (JSONException e) { e.printStackTrace(); } return spot; } /** * After completing background task Dismiss the progress dialog * **/ protected void onPostExecute(JSONObject spot) { if (spot != null) { setContentView(R.layout.view_spot); // pid found // Edit Text txtName = (TextView) findViewById(R.id.outputName); txtLong = (TextView) findViewById(R.id.outputLong); txtLat = (TextView) findViewById(R.id.outputLat); txtPavement =…
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21191477
tagged with: android
has title: Sharing Variable information between classes
accepted answer: http://stackoverflow.com/a/21191477
type: AnsweredQuestion
tagged with: java
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/21236431
type: Answer
has comment: http://stackoverflow.com/comment/31989042
accepted answer of: http://stackoverflow.com/q/21236105
upvote count: 2
answers question: http://stackoverflow.com/q/21236105
score: 2
has comment: http://stackoverflow.com/comment/31989783
has body: I'm not sure there is a way to provide filter that will restrict the result to just one in your case because the file names are ever variying. Here is one way to acheive what you wanted. File f = new File("C:\\"); // what ever directory you want. FilenameFilter totoFilter = new FilenameFilter() { public boolean accept(File dir, String name) { String lowercaseName = name.toLowerCase(); if (lowercaseName.endsWith("TOTO.xml")) return true; else return false; } }; FilenameFilter tataFilter = new FilenameFilter() { public boolean accept(File dir, String name) { String lowercaseName = name.toLowerCase(); if (lowercaseName.endsWith("TOTO.xml")) return true; else return false; }; String[] tataFiles = f.list(tataFilter); Arrays.sort(tataFiles, Collections.reverseOrder()); String[] totoFiles = f.list(totoFilter); Arrays.sort(totoFiles, Collections.reverseOrder()); System.out.println(tataFiles[0]); System.out.println(totoFiles[0]); } I have written an alternative logic that can help you extend what you want to achieve with less number of new lines even when you have to add types. This follows the approach I mentioned in the comment. All you have to do is add new sequence that defines another type of file to array list. File f = new File("C:\\"); // current directory ArrayList&lt;String&gt; sequence = new ArrayList&lt;&gt;(); sequence.add("TATA"); sequence.add("TOTO"); FilenameFilter filter = new FilenameFilter() { public boolean accept(File dir, String name) { String lowercaseName = name.toLowerCase(); if (lowercaseName.endsWith(".xml")) return true; else return false; } }; String[] totoFiles = f.list(filter); Arrays.sort(totoFiles, Collections.reverseOrder()); for (String type : sequence) { int i = 0; for (; i &lt; totoFiles.length; i++) { if (totoFiles[i].contains(type)) break; } System.out.println(totoFiles[i]); }
has comment: http://stackoverflow.com/comment/31989198
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31990120

http://stackoverflow.com/comment/32114165
comment on: http://stackoverflow.com/q/21301688
has text: @J_User: What are your requirements? What are you trying to achieve? Do you have access to the original files, or do you receive (from some external system perhaps) the images already decoded? Why do you think you have to write images as JPEG? And: Please update the question with this information, rather than answering in the comments.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21287009
has comment: http://stackoverflow.com/comment/32078042
answer count: 1
has comment: http://stackoverflow.com/comment/32077999
has title: inflater.inflate canot resolve location while creating menu
tagged with: android-layout
has answer: http://stackoverflow.com/a/21295153
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32077513
accepted answer: http://stackoverflow.com/a/21295153
type: Question
has comment: http://stackoverflow.com/comment/32077934
tagged with: android
has comment: http://stackoverflow.com/comment/32077701
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32078402
has body: I am trying to add data to my action bar, so I created a .xml file in the menu folder like the offical andriod page said, then I put this code in my activity: public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu items for use in the action bar MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_activity_actions, menu); return super.onCreateOptionsMenu(menu); } this is the main_activity_actions in my 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/ic_launcher" android:title="Search" android:showAsAction="ifRoom" /&gt; &lt;!-- Settings, should always be in the overflow --&gt; &lt;item android:id="@+id/action_settings" android:title="Settings" android:showAsAction="never" /&gt; &lt;/menu&gt; my imports are import java.text.DecimalFormat; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdSize; import com.google.android.gms.ads.AdView; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.View; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; The error I get is "main_activity_actions cannot be resolved or is not a field"

http://stackoverflow.com/a/21328032
answers question: http://stackoverflow.com/q/21328007
score: 1
has comment: http://stackoverflow.com/comment/32150471
has body: try always come with atleast one catch block try{ FileReader fr = new FileReader("mikuname.txt"); BufferedReader br = new BufferedReader(fr); String str; while ((str = br.readLine()) != null){ System.out.println(str + "\n"); } br.close(); }catch (Exception e){ //some exception information } check doc for more information about try..catch [link] http://docs.oracle.com/javase/tutorial/essential/exceptions/try.html
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21328007

http://stackoverflow.com/comment/31979659
comment on: http://stackoverflow.com/a/21231341
type: AnswerComment
score: 2
type: Comment
has text: +1 If you mention the "Null object design pattern", you may garner more upvotes. The SO community apparently thinks that the ability to write "design pattern" makes you one of the demi-gods of software development :)

http://stackoverflow.com/q/21243246
score: 0
accepted answer: http://stackoverflow.com/a/21265632
type: AnsweredQuestion
has body: I made a new class called CircleBug which is pretty much the same thing as BoxBug except it turns one time except 2, thus turning the bug in a "circle" instead of a box Here is BoxBug as found on the collegeboard gridworld manual: import info.gridworld.actor.Bug; public class BoxBug extends Bug { private int steps; private int sideLength; /** * Constructs a box bug that traces a square of a given side length * @param length the side length */ public BoxBug(int length) { steps = 0; sideLength = length; } /** * Moves to the next location of the square. */ @Override public void act() { if (steps &lt; sideLength &amp;&amp; canMove()) { move(); steps++; } else { turn(); turn(); steps = 0; } } } BoxBugRunner: import info.gridworld.actor.ActorWorld; import info.gridworld.grid.Location; import java.awt.Color; public class BoxBugRunner { public static void main(String[] args) { ActorWorld world = new ActorWorld(); BoxBug alice = new BoxBug(6); alice.setColor(Color.ORANGE); BoxBug bob = new BoxBug(3); world.add(new Location(7, 8), alice); world.add(new Location(5, 5), bob); world.show(); } } This is my code for Circle Bug and CircleBugRunner: package circlebug; import info.gridworld.actor.Bug; public class CircleBug extends Bug { private int steps; private int sideLength; public CircleBug(int length) { steps = 0; sideLength = length; } @Override public void act() { if (steps &lt; sideLength &amp;&amp; canMove()) { move(); steps++; } else { turn(); steps = 0; } } } Circle Bug runner: package circlebug; import info.gridworld.actor.ActorWorld; import info.gridworld.grid.Location; import java.awt.Color; public class CircleBugRunner { public static void main(String[] args) { ActorWorld world2 = new ActorWorld(); CircleBug alice2 = new CircleBug(6); alice2.setColor(Color.RED); CircleBug bob2 = new CircleBug(3); bob2.setColor(Color.BLUE); world2.add(new Location(6, 6), alice2); world2.add(new Location(3, 3), bob2); world2.show(); } } Here's my problem. When I run CircleBug, it only …
tagged with: java
tagged with: gridworld
has answer: http://stackoverflow.com/a/21265632
type: Question
has title: New to GridWorld - CircleBug
answer count: 1

http://stackoverflow.com/comment/32179669
comment on: http://stackoverflow.com/q/21343780
score: 0
type: QuestionComment
type: Comment
has text: @EduardoDennis When I usually ask these questions like this I give the interviewee the choice of languages as I believe a programmer can learn a language quickly, learning to be a good coder takes considerable time. I am trying to determine coding ability, not language proficiency.

http://stackoverflow.com/comment/32004016
type: QuestionComment
has text: Have you tried turning up the logging for `org.apache.catalina.session.JDBCStore` and watching the `catalina.out` for any insights? You can increase the log level in `TOMCAT_HOME/conf/logging.properties`
comment on: http://stackoverflow.com/q/21238245
score: 0
type: Comment

http://stackoverflow.com/comment/31949687
comment on: http://stackoverflow.com/a/21204996
type: AnswerComment
score: 0
has text: I found server.logs file inside `\AppData\Roaming\NetBeans\7.2\config\GF3\domain1\logs` it shows me error IOException: Access is denied. and some lines below that starts with at java.io..., at org.apache.., at com.sun.. and many more. what to do now.
type: Comment

http://stackoverflow.com/a/21236357
downvote count: 0
has body: iText will not help you much to convert pdf to image. You can use pdfbox to convert pdf to image. For more information click here
score: 4
answers question: http://stackoverflow.com/q/21235815
type: Answer
upvote count: 4

http://stackoverflow.com/q/21284299
tagged with: database
tagged with: eclipse
type: Question
upvote count: 2
has body: I am trying to run the SimulationStarted class with the moving average strategy in the open source edition of AlgoTrader. When I start the SimulationStarter in eclipse I get Exception in thread "main" com.algoTrader.service.SimulationServiceException: Error performing 'SimulationService.simulateWithCurrentParams()' --&gt; com.algoTrader.service.SimulationServiceException: Error performing 'SimulationService.runByUnderlayings()' --&gt; com.algoTrader.service.RuleServiceException: Error performing 'RuleService.initServiceProvider(String strategyName)' --&gt; com.espertech.esper.client.EPException: esper-mov.cfg.xml not found But it is running with the command java.exe -cp target/classes;../../AlgoTrader/code/target/classes;../../AlgoTrader/code/lib/;target/ -Dsimulation=true -DdataSource.dataSet=1year com.algoTrader.starter.SimulationStarter simulateWithCurrentParams If anyone knows how to fix it or any suggestions would be welcome. The whole exception output when I run the SimulationStarter in eclipse is: 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl initialized service provider: BASE 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl deployed module market-data on service provider: BASE 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl deployed module current-values on service provider: BASE 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl deployed module trades on service provider: BASE 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl deployed module portfolio on service provider: BASE 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl deployed module performance on service provider: BASE 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl deployed module algo on service provider: BASE 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl deployed module ib-market-data on service provider: BASE 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl deployed module ib-trades on service provider: BASE Exception in thread "main" com.algoTrader.service.SimulationServiceException: Error performing 'SimulationSer…
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24965883
tagged with: esper
score: 2
linked to: http://stackoverflow.com/q/21478252
type: UnansweredQuestion
tagged with: error-handling
has title: run AlgoTrader Simulation in Eclipse
tagged with: java

http://stackoverflow.com/comment/32010769
type: QuestionComment
comment on: http://stackoverflow.com/q/21248666
type: Comment
score: 0
has text: Is this in an app. with a GUI, or a command line app., or a servlet..? The answer changes a lot depending on the answer to that.

http://stackoverflow.com/comment/32006187
has text: @KevinMeredith Sorry, but what exactly do you mean by "low degree"? I googled that term, and didn't find anything. Is this a standard, well-defined term, or just a subjective measure? Because if it's the latter, the question is hard to answer without knowing where your subjective line is.
score: 1
comment on: http://stackoverflow.com/q/21243858
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21329384
has comment: http://stackoverflow.com/comment/32152929
has answer: http://stackoverflow.com/a/21329829
tagged with: java
accepted answer: http://stackoverflow.com/a/21329829
type: Question
tagged with: jsoup
has comment: http://stackoverflow.com/comment/32152633
has body: I'm trying to download this html I'm using this code: Document doc = null; try { doc =Jsoup.connect(link).userAgent("Mozilla").get(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Log.i ("html", doc.toString()); UPDATED: ASLO tried to use it: HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(link); HttpResponse response = null; try { response = client.execute(request); } catch (ClientProtocolException e1) { // e1.printStackTrace(); } catch (IOException e1) { // e1.printStackTrace(); } InputStream in = null; try { in = response.getEntity().getContent(); } catch (IllegalStateException e1) { // e1.printStackTrace(); } catch (IOException e1) { // e1.printStackTrace(); } BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); } catch (UnsupportedEncodingException e) { // e.printStackTrace(); } StringBuilder str = new StringBuilder(); String line = null; try { while((line = reader.readLine()) != null) { str.append(line); } } catch (IOException e1) { // e1.printStackTrace(); } try { in.close(); } catch (IOException e1) { // e1.printStackTrace(); } String html = str.toString(); Log.e("html", html); again responce like this one: I can't find any solution... Page can not be downloaded maybe because haven't cookie ... or what?
score: 0
answer count: 1
tagged with: download
has comment: http://stackoverflow.com/comment/32152980
tagged with: android
tagged with: http://stackoverflow.com/tag/html
has title: Can't download html
has comment: http://stackoverflow.com/comment/32153094
type: AnsweredQuestion

http://stackoverflow.com/a/21204263
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/21204242
upvote count: 1
has body: If they are also Serializable then, yes otherwise you'll get a NotSerializableException. If you explicitly want to not serialize a member object then declare it as transient. Regarding the order, I don't get what you mean by that. If you read a serialized object you'll get it in the exact same state it had at serialization.

http://stackoverflow.com/q/21241839
has title: Java code automated documentation /presentation
tagged with: documentation
upvote count: 0
answer count: 1
tagged with: creation
favorite count: 0
score: -1
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21241893
downvote count: 1
type: Question
has body: Is there a tool to create from custom Java code documentation similar to what you can find on this page? By this I mean listing in a clear way: methods of a class, different types of fields, inheritance, interfaces it implements etc. I want to do this for a library I created. I'm aware that all this information could be found inside the code, but sometimes you don't have time to open every single source file. Preferable html output.

http://stackoverflow.com/q/21274034
answer count: 0
tagged with: java
has title: Async task crashes during doInBackground()
type: Question
has comment: http://stackoverflow.com/comment/32055804
has comment: http://stackoverflow.com/comment/32055932
has comment: http://stackoverflow.com/comment/32056606
has comment: http://stackoverflow.com/comment/32055487
has body: I'm making a file manager app for android and am trying to implement a copy and paste feature using AsyncTask to copy the files. When I attempt to paste the items, the app crashes and reports: 01-22 16:27:48.065: E/AndroidRuntime(8494): FATAL EXCEPTION: AsyncTask #1 01-22 16:27:48.065: E/AndroidRuntime(8494): Process: com.example.myapp, PID: 8494 01-22 16:27:48.065: E/AndroidRuntime(8494): java.lang.RuntimeException: An error occured while executing doInBackground() 01-22 16:27:48.065: E/AndroidRuntime(8494): at android.os.AsyncTask$3.done(AsyncTask.java:300) 01-22 16:27:48.065: E/AndroidRuntime(8494): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) 01-22 16:27:48.065: E/AndroidRuntime(8494): at java.util.concurrent.FutureTask.setException(FutureTask.java:222) 01-22 16:27:48.065: E/AndroidRuntime(8494): at java.util.concurrent.FutureTask.run(FutureTask.java:242) 01-22 16:27:48.065: E/AndroidRuntime(8494): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 01-22 16:27:48.065: E/AndroidRuntime(8494): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 01-22 16:27:48.065: E/AndroidRuntime(8494): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 01-22 16:27:48.065: E/AndroidRuntime(8494): at java.lang.Thread.run(Thread.java:841) 01-22 16:27:48.065: E/AndroidRuntime(8494): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 1, size is 0 01-22 16:27:48.065: E/AndroidRuntime(8494): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) 01-22 16:27:48.065: E/AndroidRuntime(8494): at java.util.ArrayList.get(ArrayList.java:308) 01-22 16:27:48.065: E/AndroidRuntime(8494): at com.example.myapp.MoveFiles.doInBackground(MoveFiles.java:30) 01-22 16:27:48.065: E/AndroidRuntime(8494): at com.example.myapp.MoveFiles.doInBackground(MoveFiles.java:1) 01-22 16:27:48.065: E/AndroidRuntime(8494): at android.os.AsyncTask$2.call(AsyncTask.java:288) 01-22 16:27:…
has comment: http://stackoverflow.com/comment/32058958
score: 0
has comment: http://stackoverflow.com/comment/32055611
has comment: http://stackoverflow.com/comment/32055785
has comment: http://stackoverflow.com/comment/32055509
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32056058

http://stackoverflow.com/comment/32180501
has text: Try 3.1. Also, run help:effective-pom and see if someone's configuring something unhelpful to the war plugin.
comment on: http://stackoverflow.com/q/21344507
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/31915233
type: QuestionComment
has text: This class is called by a listener from web.xml: data.StartUpListener I am thinking this may be the reason why I get the wrong relative path
score: 0
comment on: http://stackoverflow.com/q/21194658
type: Comment

timer
tag name: timer
tags question: http://stackoverflow.com/q/21272833
tags question: http://stackoverflow.com/q/21298660
tags question: http://stackoverflow.com/q/21302993
tags question: http://stackoverflow.com/q/21298002
tags question: http://stackoverflow.com/q/21289140
tags question: http://stackoverflow.com/q/21252960
tags question: http://stackoverflow.com/q/21273031
type: Tag
tags question: http://stackoverflow.com/q/21219257
tags question: http://stackoverflow.com/q/21238029
tags question: http://stackoverflow.com/q/21296022
tags question: http://stackoverflow.com/q/21211495
tags question: http://stackoverflow.com/q/21219010
tags question: http://stackoverflow.com/q/21285695

http://stackoverflow.com/a/21188519
type: Answer
score: 6
has body: Guessing you are trying to read this value into your unit tests? Then you would have to configure the environment variables of the surefire plugin: org.apache.maven.plugins maven-surefire-plugin <jenkins.buildUrl>${env.BUILD_URL}</jenkins.buildUrl> As stated in this documentation: http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#environmentVariables Note that it's possible to do the same in other plugin, like the Maven Tomcat Plugin for example.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21187934
answers question: http://stackoverflow.com/q/21187934
upvote count: 6
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31903778
has comment: http://stackoverflow.com/comment/31903913

http://stackoverflow.com/a/21349220
has body: Declare servlet as provided javax.servlet servlet-api 2.5 provided or org.mortbay.jetty servlet-api 2.5-20081211 provided and exclude servlet from titan titan titan javax.servlet servlet-api
type: Answer
upvote count: 22
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21338102
has comment: http://stackoverflow.com/comment/32220883
answers question: http://stackoverflow.com/q/21338102
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38602335
score: 22

http://stackoverflow.com/a/38692305
has body: With the help of ConnectivityManager, you will get the network info based on trace whether WIFI is connected or not. Check below code (pass Activity context): public boolean IsInternetConnected(Context context) { ConnectivityManager connectivity = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivity != null) { NetworkInfo nInfo = connectivity.getActiveNetworkInfo(); if (nInfo != null) { //do your thing if (nInfo.getType() == ConnectivityManager.TYPE_WIFI) { // connected to wifi return true; } } return false; } return false; }
score: 0
answers question: http://stackoverflow.com/q/21279141
type: Answer

http://stackoverflow.com/q/21345740
linked to: http://stackoverflow.com/q/2442407
type: Question
tagged with: android-canvas
has answer: http://stackoverflow.com/a/21354293
accepted answer: http://stackoverflow.com/a/21354293
has title: How to set Canvas to use @dimen for size
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android-xml
tagged with: android
type: AnsweredQuestion
has body: I have the following XML: &lt;LinearLayout android:id="@+id/llColorSpect" android:layout_width="match_parent" android:layout_height="@dimen/color_scheme_height" android:orientation="vertical" android:background="@drawable/colorspect" android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginBottom="@dimen/seek_bar_margin" android:layout_below="@+id/tvBGColor" &gt; &lt;RelativeLayout android:id="@+id/rlColorSpect" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;ImageView android:id="@+id/ivSquare" android:layout_width="@dimen/title_text_pad" android:layout_height="@dimen/title_text_pad" android:layout_alignParentBottom="true" android:scaleType="fitXY" android:src="@drawable/esquare" /&gt; &lt;/RelativeLayout&gt; &lt;/LinearLayout&gt; Which displays the following output: I tried to setup a canvas so I can allow the user to drag the small square around the layout: import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.util.Log; import android.view.MotionEvent; import android.view.View; public class CanvasView extends View { private Bitmap bitmap; private Bitmap square; private float mScaleFactor = 1f; int x = 0; int y = 0; public CanvasView(Context c) { super(c); bitmap= BitmapFactory.decodeResource(c.getResources(), R.drawable.colorspect); square = BitmapFactory.decodeResource(c.getResources(), R.drawable.esquare); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.scale(mScaleFactor, mScaleFactor); canvas.drawBitmap(bitmap, 0, 0, null); canvas.drawBitmap(square, x, y, null); } @Override public boolean onTouchEvent(MotionEvent event) { float x = event.getX(); float y = event.getY();…
score: 1
tagged with: java

http://stackoverflow.com/a/21208118
answers question: http://stackoverflow.com/q/21207977
type: Answer
has body: This is known as the lost update problem. You could use a Exclusive lock. This will prevent other transactions from reading the locked data.
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/104610942
score: 0
type: Comment
has text: This does not quite answer the question. Empty `Location` headers might be regarded as valid redirections to the same URI that was requested initially. Also, if the server has a preferred choice, `300` responses _SHOULD_ provide a `Location` header in addition to the URLs in the response body. Furthermore, `301`, `302`, `303`, `307` and `308` don't really make any sense without a `Location` header.
comment on: http://stackoverflow.com/a/21321976
type: AnswerComment

http://stackoverflow.com/q/21345932
accepted answer: http://stackoverflow.com/a/21345976
answer count: 1
tagged with: jdbc
has comment: http://stackoverflow.com/comment/32183058
favorite count: 0
has body: all of the examples, unfortunately on the net are consumed of downloading a MySQL database to your computer rather than taking advantage of Online Database. What should I replace the following code to get data from an online db rather than a 3306 typical desktop MySQL; Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/DBNAME", "usrname", "pswd") ;
downvote count: 2
has answer: http://stackoverflow.com/a/21345976
upvote count: 1
has title: Setting up a connection to Online MySQL database
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32183028
tagged with: java
score: -1
tagged with: mysql
has comment: http://stackoverflow.com/comment/32182984
type: Question

http://stackoverflow.com/comment/32070114
has text: Changing the color is trivial (as long as you read up on it: http://developer.android.com/reference/android/widget/TextView.html#setTextColor(int)). Saving the state can be done in a million different ways: write to DB, to SharedPreferences, to a Sarver...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21282922

http://stackoverflow.com/comment/32121092
comment on: http://stackoverflow.com/q/21311456
type: Comment
has text: @ᴍarounᴍaroun Apparently I need reputation of 1500 to create the tag Skynet
score: 0
type: QuestionComment

http://stackoverflow.com/a/21233012
upvote count: 1
has comment: http://stackoverflow.com/comment/31988951
has comment: http://stackoverflow.com/comment/31982706
score: 1
has comment: http://stackoverflow.com/comment/31982611
has comment: http://stackoverflow.com/comment/31989598
has body: Use the Webservice to make the Connection to Mysql from your android app through json or xml.you can use SQlite database to connect the android app internally by the use of this package android.database.sqlite classes
downvote count: 0
answers question: http://stackoverflow.com/q/21232884
type: Answer

http://stackoverflow.com/comment/32024643
type: QuestionComment
score: 1
has text: You said, your classes just have `static` methods right? There is no polymorphism here. What kind of `if-else` condition do you have. We need some more code now. Or may be, a concrete problem statement.
comment on: http://stackoverflow.com/q/21257089
type: Comment

http://stackoverflow.com/comment/31898704
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21186037
has text: Please edit your post with the stacktrace if you can't figure out where the `NullPointerException` comes from. Also, what's the purpose of this site? If your answer is anything but "fooling around", please consult a [tutorial](http://docs.oracle.com/javaee/6/tutorial/doc/) before continuing.

http://stackoverflow.com/comment/32339784
type: Comment
has text: wait, why are you working with LocalServiceBaseImpl instead of LocalServiceImpl ?
type: AnswerComment
comment on: http://stackoverflow.com/a/21430250
score: 0

http://stackoverflow.com/q/21349733
has answer: http://stackoverflow.com/a/21349766
tagged with: arraylist
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/21349749
tagged with: android
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/32189384
has comment: http://stackoverflow.com/comment/32189584
possible better answer: http://stackoverflow.com/a/21349746
has comment: http://stackoverflow.com/comment/32189336
downvote count: 1
has answer: http://stackoverflow.com/a/21349746
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21349749
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/65862493
has title: ArrayList null pointer exception
has body: I have created an arraylist, and a ListView. I intend to iterate through the ListView, and checking whether they are checked or not, and then add the object (using ListView.getItem()) to my arraylist. however I get a NullPointerException. The ArrayList people_selected, is declared at top of class like this: ArrayList&lt;PeopleDetails&gt; selected_people; And my code: for (int i = 0; i &lt; people_list.getCount(); i++) { item_view = people_list.getAdapter().getView(i, null, null); chBox = (CheckBox) item_view.findViewById(R.id.checkBox);//your xml id value for checkBox. if (chBox.isChecked()) { selected_people.add((PeopleDetails) people_list.getItemAtPosition(i)); } } for(PeopleDetails person : selected_people){ SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(person.number, null, sms_message, null, null); } ///and now need to write party to file. I get an error at the line for(PeopleDetails person : selected_people) Saying "NullPointerException" . I take this to mean that the arraylist is null, and cannot figure out why it should be null. Have I declared it wrong at the top of my class? Or is my selection and add method faulty?
tagged with: listview
type: Question
linked to: http://stackoverflow.com/q/85190
has answer: http://stackoverflow.com/a/45735237
has answer: http://stackoverflow.com/a/21349748
answer count: 6

http://stackoverflow.com/a/21218562
type: Answer
score: 0
has body: In openCV samples codes (under cpp samples section), you can find a .cpp file named "bgfg_segm.cpp". Although that code is for motion tracking but i think that you can use to detect the spots also. There by pressing the "spacebar key", you can start/stop updation of background. Once you have decided your background, then anything extra will be detected as a spot on it. Strategy: Bring the cloth infront of webcam and once it is selected as a background, then press "spacebar key" to stop further changes in the background. Then, your program should be able to track any change in the color of your cloth. The code is below: #include "opencv2/core/core.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/video/background_segm.hpp" #include "opencv2/highgui/highgui.hpp" #include &lt;stdio.h&gt; using namespace std; using namespace cv; int main() { VideoCapture cap; bool update_bg_model = true; cap.open(0); namedWindow("image", CV_WINDOW_NORMAL); namedWindow("foreground mask", CV_WINDOW_NORMAL); namedWindow("foreground image", CV_WINDOW_NORMAL); namedWindow("mean background image", CV_WINDOW_NORMAL); // Declare "object " of class "BackgroundSubtractorMOG2" BackgroundSubtractorMOG2 bg_model;//(100, 3, 0.3, 5); Mat img, fgmask, fgimg; for(;;) { cap &gt;&gt; img; if( fgimg.empty() ) fgimg.create(img.size(), img.type()); //update the model bg_model(img, fgmask, update_bg_model ? -1 : 0); // "bg_model" is object of class "BackgroundSubtractorMOG2" as declared above. fgimg = Scalar::all(0); img.copyTo(fgimg, fgmask); Mat bgimg; bg_model.getBackgroundImage(bgimg); imshow("image", img); imshow("foreground mask", fgmask); imshow("foreground image", fgimg); if(!bgimg.empty()) imshow("mean background image", bgimg ); char k = (char)waitKey(30); if( k == 27 ) break; if( k == ' ' ) // Change the Background updation status by Spacebar key { update_bg_model = !update_bg_model; // initially "bool update_bg_model = true" if(update_bg_model) printf("Background update is on\n"); else…
answers question: http://stackoverflow.com/q/21206481

http://stackoverflow.com/a/21236427
downvote count: 0
has comment: http://stackoverflow.com/comment/32008624
type: Answer
has comment: http://stackoverflow.com/comment/37355864
answers question: http://stackoverflow.com/q/21230503
score: 44
has comment: http://stackoverflow.com/comment/37355305
upvote count: 44
has body: You haven't configured the maxTotal size of the pool, and the default value is only 8. You could change the JedisFactory constructor to: public JedisFactory() { JedisPoolConfig poolConfig = new JedisPoolConfig(); poolConfig.setMaxTotal(128); jedisPool = new JedisPool(poolConfig, RedisDBConfig.HOST, RedisDBConfig.PORT, RedisDBConfig.TIMEOUT, RedisDBConfig.PASSWORD); } Beware also of the default value of the WhenExhaustedAction (WHEN_EXHAUSTED_BLOCK), as it may not be your desired behavior. Jedis uses Apache Commons Pool, and you can read about its parameters here: GenericObjectPool

http://stackoverflow.com/a/21254708
type: Answer
has comment: http://stackoverflow.com/comment/32020587
has comment: http://stackoverflow.com/comment/32021259
score: 2
has comment: http://stackoverflow.com/comment/32021287
downvote count: 0
has comment: http://stackoverflow.com/comment/32021563
has comment: http://stackoverflow.com/comment/32021470
upvote count: 2
answers question: http://stackoverflow.com/q/21254501
has comment: http://stackoverflow.com/comment/32021503
has comment: http://stackoverflow.com/comment/32020737
has body: Java Docs states for used Constructor of DefaultTableModel as: public DefaultTableModel(Vector data, Vector columnNames) Constructs a DefaultTableModel and initializes the table by passing data and columnNames to the setDataVector method. Parameters: data - the data of the table, a Vector of Vectors of Object values columnNames - vector containing the names of the new columns And setDataVector() accepts dataVector(i.e.first arguement) as Vector of vectors of Object values So In your case first arguement in constructor (i.e. PropXMLParsing.getInstance().getHeader()) should be Vector<Vector<String>> UPDATE Sample Code JFrame frame = new JFrame("DemoFrame"); Vector<String> id = new Vector<String>(); id.add("1"); id.add("2"); id.add("3"); Vector<String> name = new Vector<String>(); name.add("A"); name.add("B"); name.add("C"); Vector<Vector<String>> dataVector = new Vector<Vector<String>>(); dataVector.add(id); dataVector.add(name); Vector<String> header = new Vector<String>(2); header.add("ID"); header.add("NAME"); TableModel model = new DefaultTableModel(dataVector,header); JTable table = new JTable(model); frame.add(new JScrollPane(table)); frame.setSize(300, 200); frame.setVisible(true); In case any of your dataVector or header is null table will not be displayed
has comment: http://stackoverflow.com/comment/32021059

http://stackoverflow.com/comment/32048275
score: 1
comment on: http://stackoverflow.com/q/21269796
type: Comment
type: QuestionComment
has text: File objects don't represent the content of the file, they only represent the name and location of the file. You cannot move a physical file by only manipulating File objects. You will need to copy the contents of the source file to the destination file (and then optionally delete the source file).

http://stackoverflow.com/a/21235369
answers question: http://stackoverflow.com/q/21231267
score: 0
has body: To improve matching, perform ratio and symmetry test before calculating homography. Check chapter 8-9 of "OpenCV 2 Computer Vision Application Programming Cookbook". It has detailed explanation and code example.
type: Answer

http://stackoverflow.com/q/21341311
type: Question
has answer: http://stackoverflow.com/a/21341458
has answer: http://stackoverflow.com/a/21341529
has comment: http://stackoverflow.com/comment/32174681
score: -1
has answer: http://stackoverflow.com/a/21341376
has answer: http://stackoverflow.com/a/21341374
downvote count: 1
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/32174621
has title: Locate index where string1 contains string 2?
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21341458
upvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/21341374
has body: I have two strings: stringOne and stringTwo. String stringOne = "JAVA"; String stringTwo = "DJDFKWAUERHFGJAVAORKFLASOWE"; I can easily locate if Java is in the second string (it is), where how would I index where it begins and ends? I want to initialize the beginning and end positions in integer variables: begPos = 14 and endPos = 18. What method would I use to do this? Somewhat the reverse of this, but I also have a third string: String stringThree = " "; It's a bunch of whitespace. I want to put "JAVA" in there according to the positions gained before. I can replace parts of a string with other parts of a string, but again I'm not sure how to replace a specific position. The end result should be: String stringThree = " JAVA "; Any ideas?

http://stackoverflow.com/comment/32181553
type: Comment
has text: Yes ... obviously. But I'm probably wasting my breath 'cos lots of others have given him a *complete* solution ...
comment on: http://stackoverflow.com/a/21345149
score: 1
type: AnswerComment

http://stackoverflow.com/comment/31937956
has text: @MichaelHunger That's part of the problem: Currently I have them absolute like "2014-07-01 18:27". An estimated average of 8 Lines a day with about 200 Lines connecting the stations. In short there are really a lot of these relations over a year. But If it will help I can convert them to something like "between station A and B on Weekdays at 10:27,14:27 and 18:27".
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21190410

http://stackoverflow.com/q/21337121
upvote count: 1
has comment: http://stackoverflow.com/comment/32166492
has title: Size of the objects depends on the contents it read
type: Question
accepted answer: http://stackoverflow.com/a/21337211
linked to: http://stackoverflow.com/q/88235
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32166671
favorite count: 0
tagged with: heap-memory
has comment: http://stackoverflow.com/comment/32166802
has answer: http://stackoverflow.com/a/21337211
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32167061
has body: If I have 2 inputStream objects that read/holds a 4gb and 4mb of file respectively. what will be the size of the objects? will the size of object depends of the content? I am facing the per gem error while processing huge size of Excel files.
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32166572

http://stackoverflow.com/q/21225508
accepted answer: http://stackoverflow.com/a/21225737
tagged with: objective-c
favorite count: 0
has title: Java equivalent from Obj C
has comment: http://stackoverflow.com/comment/31969463
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/31969938
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31969658
tagged with: java
has answer: http://stackoverflow.com/a/21225737
has comment: http://stackoverflow.com/comment/31969567
has body: What is the equivalent of this objc line in java? uint64_t lInt = 0xFFFFFFFF &lt;&lt; 10; lInt = ((uint64_t)mBytes[0] &lt;&lt; 24) + ((uint64_t)mBytes[1] &lt;&lt; 16); I wrote it like this but I think it is wrong. long lInt = 0xFFFFFFFFL &lt;&lt; 10; lInt = ((mBytes[0] &lt;&lt; 24) + (mBytes[1] &lt;&lt; 16);
has comment: http://stackoverflow.com/comment/31969484
type: Question
score: 0
has comment: http://stackoverflow.com/comment/31969911
answer count: 1

http://stackoverflow.com/q/21348008
has body: This code gets the file name, but I want to get the file path: private List &lt;String&gt; checkFiles(FTPClient clients){ List &lt;String&gt; it = new ArrayList &lt;String&gt;(); try { FTPFile[] ftpFiles = clients.listFiles(); int length = ftpFiles.length; for (int i = 0; i &lt; length; i++) { String name = ftpFiles[i].getName(); Calendar date = ftpFiles[i].getTimestamp(); Log.v("aasd", name ); it.add (name); } } catch(Exception e) { e.printStackTrace(); } return it ; }
has comment: http://stackoverflow.com/comment/32186707
answer count: 3
tagged with: android-listview
tagged with: android
has answer: http://stackoverflow.com/a/21348088
type: UnansweredQuestion
tagged with: ftp-client
tagged with: java
has title: How can one get a file's path from an ftp server?
has answer: http://stackoverflow.com/a/73238917
type: Question
score: 0
has answer: http://stackoverflow.com/a/21348924

http://stackoverflow.com/a/21255345
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21249140
answers question: http://stackoverflow.com/q/21249140
has comment: http://stackoverflow.com/comment/32058588
type: Answer
has body: if(driver.findElement(By.id("reports").size()!=0){ WebElement menuHoverLink = driver.findElement(By.id("reports")); actions.moveToElement(menuHoverLink).perform(); } else{ system.out.println("element not present -- so it entered the else loop"); } use this one -- if the element is not persent also testcase doesnt fail
upvote count: 5
has comment: http://stackoverflow.com/comment/32058766
score: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/31939780
type: Comment
has text: Now he's in the enpasse: whose answer should I accept? I'd say yours, for 2 reasons: 1) because it's deeper than mine. 2) you have less reputation points, so it's right to give some to you istead of me.
comment on: http://stackoverflow.com/a/21209062
score: 0
type: AnswerComment

http://stackoverflow.com/a/21218956
has comment: http://stackoverflow.com/comment/31957463
type: Answer
upvote count: 24
has body: For storing only the date, you need the DATE data type. MySQL has three data types for storing date and time values: DATE is used for values with a date part but no time part. MySQL retrieves and displays DATE values in 'YYYY-MM-DD' format. DATETIME type is used for values that contain both date and time parts. MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD hh:mm:ss' format. TIMESTAMP data type is used for values that contain both date and time parts. TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC. More details can be found in the official MySQL Reference Manual The DATE, DATETIME, and TIMESTAMP Types, where the above quote is from.
downvote count: 0
answers question: http://stackoverflow.com/q/21218887
score: 24
accepted answer of: http://stackoverflow.com/q/21218887
has comment: http://stackoverflow.com/comment/31957813
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31958484

http://stackoverflow.com/a/21259806
type: Answer
accepted answer of: http://stackoverflow.com/q/21237695
answers question: http://stackoverflow.com/q/21237695
upvote count: 1
score: 1
has body: The form fields have coordinates. You can get these coordinates using the getFieldPositions() method. This returns a series of FieldPosition objects (one for each widget that corresponds with a specific field) that will give you a page number and a rectangle value. Use those coordinates to determine the position of the table. Add the table at those coordinates using the writeSelectedRows() method.
type: AcceptedAnswer
downvote count: 0

tomcat
tags question: http://stackoverflow.com/q/21335704
tags question: http://stackoverflow.com/q/21191021
tags question: http://stackoverflow.com/q/21218318
tags question: http://stackoverflow.com/q/21317229
tags question: http://stackoverflow.com/q/21309121
tags question: http://stackoverflow.com/q/21213439
tags question: http://stackoverflow.com/q/21245687
tags question: http://stackoverflow.com/q/21338102
tags question: http://stackoverflow.com/q/21280658
tags question: http://stackoverflow.com/q/21241255
tags question: http://stackoverflow.com/q/21299942
tags question: http://stackoverflow.com/q/21222087
tags question: http://stackoverflow.com/q/21286174
tags question: http://stackoverflow.com/q/21222692
tags question: http://stackoverflow.com/q/21305482
tags question: http://stackoverflow.com/q/21275754
tags question: http://stackoverflow.com/q/21321897
tags question: http://stackoverflow.com/q/21287440
tags question: http://stackoverflow.com/q/21346643
tags question: http://stackoverflow.com/q/21238245
tags question: http://stackoverflow.com/q/21242733
tags question: http://stackoverflow.com/q/21237707
tags question: http://stackoverflow.com/q/21326360
tags question: http://stackoverflow.com/q/21348850
tags question: http://stackoverflow.com/q/21217935
tags question: http://stackoverflow.com/q/21236871
tags question: http://stackoverflow.com/q/21299970
tags question: http://stackoverflow.com/q/21198461
tags question: http://stackoverflow.com/q/21219111
tags question: http://stackoverflow.com/q/21244147
tags question: http://stackoverflow.com/q/21279864
tags question: http://stackoverflow.com/q/21253505
tags question: http://stackoverflow.com/q/21303941
tag name: tomcat
tags question: http://stackoverflow.com/q/21316421
tags question: http://stackoverflow.com/q/21326763
tags question: http://stackoverflow.com/q/21263341
tags question: http://stackoverflow.com/q/21229689
tags question: http://stackoverflow.com/q/21284815
tags question: http://stackoverflow.com/q/21317587
tags question: http://stackoverflow.com/q/21203074
tags question: http://stackoverflow.com/q/21346489
tags question: http://stackoverflow.com/q/21193428
tags question: http://stackoverflow.com/q/21323708
tags question: http://stackoverflow.com/q/21308352
tags question: http://stackoverflow.com/q/21274308
tags question: http://stackoverflow.com/q/21185834
type: Tag
tags question: http://stackoverflow.com/q/21249487
tags question: http://stackoverflow.com/q/21316431
tags question: http://stackoverflow.com/q/21339996
tags question: http://stackoverflow.com/q/21312322
tags question: http://stackoverflow.com/q/21293344
tags question: http://stackoverflow.com/q/21244206
tags question: http://stackoverflow.com/q/21296519
tags question: http://stackoverflow.com/q/21276124
tags question: http://stackoverflow.com/q/21256979
tags question: http://stackoverflow.com/q/21216487
tags question: http://stackoverflow.com/q/21201163
tags question: http://stackoverflow.com/q/21309983

http://stackoverflow.com/q/21258214
answer count: 3
linked to: http://stackoverflow.com/q/40025528
has body: there is a form having a drop down for country ,user will select the country ,then there is a drop down for time zone ,user will select the time zone which are available in country selected by the user.Then user will enter the local date( eg: 26-Dec-2014) and time( 23:11)(24 hours time) this entered date and time is for the selected country and time zone. now i have to convert this date and time to GMT time zone. how can i do this using joda time how the daylight saving time(DST) will be calculate? i have made a function which accepts the parameters as from time zone,to time zone,date public static String convertTimeZones( String fromTimeZoneString, String toTimeZoneString, String fromDateTime) { DateTimeZone fromTimeZone = DateTimeZone.forID(fromTimeZoneString); DateTimeZone toTimeZone = DateTimeZone.forID(toTimeZoneString); DateTime dateTime = new DateTime(fromDateTime, fromTimeZone); DateTimeFormatter outputFormatter = DateTimeFormat.forPattern("dd-MMM-yyyy HH:mm").withZone(toTimeZone); return outputFormatter.print(dateTime); } i want to pass the date to this function in a format (24-Feb-2014 12:34) but it is not taking this format
linked to: http://stackoverflow.com/q/19002978
has answer: http://stackoverflow.com/a/25878003
favorite count: 0
has title: convert one time zone to another using joda time
tagged with: timezone
type: UnansweredQuestion
tagged with: datetime
has comment: http://stackoverflow.com/comment/32028873
duplicate of: http://stackoverflow.com/q/20098644
has answer: http://stackoverflow.com/a/79335594
tagged with: java
has comment: http://stackoverflow.com/comment/32026742
linked to: http://stackoverflow.com/q/20098644
downvote count: 1
type: Question
tagged with: jodatime
has answer: http://stackoverflow.com/a/66363427
upvote count: 5
score: 4

http://stackoverflow.com/a/21605591
has body: I think you can use 2 below plugins for this purpose. if your project is web project, you can create 2 web projects, one of them contains config files and another project is your main project, now on you can overlay projects with maven-war-plugin There are many types for overlay, you can visit this page for more information maven-war-plugin overlay for jar files you can merge them to single one with maven-assembly-plugin maven-assembly-plugin
downvote count: 0
answers question: http://stackoverflow.com/q/21315549
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/21194466
score: 14
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21194561
has title: How can I make a Java cross-platform GUI application (Windows, Linux)? What tools should I use?
has answer: http://stackoverflow.com/a/21194546
tagged with: java
tagged with: cross-platform
type: Question
has answer: http://stackoverflow.com/a/21194541
downvote count: 0
has answer: http://stackoverflow.com/a/21194725
accepted answer: http://stackoverflow.com/a/21194725
upvote count: 14
has comment: http://stackoverflow.com/comment/37977383
possible better answer: http://stackoverflow.com/a/21194561
tagged with: linux
has comment: http://stackoverflow.com/comment/31913947
tagged with: windows
tagged with: user-interface
favorite count: 0
has answer: http://stackoverflow.com/a/21194792
has body: I'm new to Java GUI programming and I want to make a Java GUI application which can run both in Windows and Linux with the same code (the same executable/object file). Is that possible without any compatibility problems/errors/bugs? What else (like libraries, classes, packets) will I need to be able to design the GUI in Java? Should these libraries be present in every computer and every OS to be able for the application to run? Or the Java Virtual Machine (JVM) installed on a computer is enough?
answer count: 5

http://stackoverflow.com/q/21321611
has comment: http://stackoverflow.com/comment/32139273
score: -1
possible better answer: http://stackoverflow.com/a/21321915
has title: Read from textfile and store into an array (JAVA)
has body: public static Student[] getInput(Scanner scanner)throws FileNotFoundException { //change the array size by reading the input file Student[] classList=new Student[10]; int i; int numberOfStudents = scanner.nextInt(); while(scanner.hasNext()) { while(numberOfStudents &gt; classList.length) { //enlargeList(classList[i]); } for(i = 0; i &lt;= classList.length; i++){ String studentId = scanner.nextLine(); int mark = scanner.nextInt(); classList[i] = new Student(studentId, mark); } } return classList; } public static void main(String[] args) { if (args.length!=1) { System.out.println("Usage GradeManager inputFileName"); System.exit(1); } Scanner inFile=null; try{ //do the whole try block in the lab String fileName = args[0]; //Open a file with FileName and creaste a scanner using it inFile = new Scanner(new File(fileName)); Student[] classList=getInput(inFile); } catch (FileNotFoundException fe) { fe.printStackTrace(); }catch(Exception e) { e.printStackTrace(); }finally{ if(inFile!=null) inFile.close(); } } So I am trying read from a textfile that is as follows: 9 V0012345 98 V0023456 33 V0024615 51 V0089546 57 V0015348 61 V0054162 69 V0044532 87 V0031597 74 V0074615 78 First line is the number of students in the text file, all others are student number + their grade in the class. I'm trying to import these into the array classList[]. I am very new to java and object oriented stuff, so I'm sorry in advance if my code is garbage. I have omitted the enlargeList method as it works and I've tested it. Thanks
downvote count: 1
upvote count: 0
has answer: http://stackoverflow.com/a/21321684
has comment: http://stackoverflow.com/comment/32139285
accepted answer: http://stackoverflow.com/a/21321684
type: AnsweredQuestion
tagged with: java
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/21321915
answer count: 2

http://stackoverflow.com/a/21271758
type: Answer
answers question: http://stackoverflow.com/q/21271673
score: 0
has body: A few things: an array of size 10 integers means that you need to write new int[10] instead of new int[12] you declared sum inside of the for loop, so it is not accessible outside of that for loop (because there is no guarantee that it will even be declared). you are also redeclaring sum in every loop by writing int sum += myArray[i] - only declare once i &lt; 12 and i &lt; 10 can be changed to be i &lt; myArray.length to make it more general. public class WarmUp_01_22_2014{ public static void main(String[] args){ int[] myArray = new int[10]; // size 10, not 12 int sum = 0; // declare sum here for (int i = 0; i &lt; myArray.length; i++){ // &lt; myArray.length myArray[i] = 2; } for (int i = 0; i &lt; myArray.length; i++){ // &lt; myArray.length sum += myArray[i]; // add on to the sum, don't declare it here } System.out.println("The sum of the numbers in the array is " + sum); } }

http://stackoverflow.com/a/21331028
score: 3
downvote count: 0
has body: You can use something like this: static class Screener extends Thread { private static final long INTERVAL = 5000; public void run() { try { Thread.sleep(INTERVAL); BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())); ImageIO.write(image, "png", new File("/screenshot.png")); } catch (Exception e) { e.printStackTrace(); } } } public static void main(String[] args) { Screener screener = new Screener(); screener.start(); //do something... }
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/21331002

http://stackoverflow.com/a/21296006
score: 4
accepted answer of: http://stackoverflow.com/q/21295920
answers question: http://stackoverflow.com/q/21295920
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32093818
type: Answer
upvote count: 4
has body: A long can accommodate numbers as large as 263-1. But there's a trick to putting them into the primitive field. If you're entering the primitive literal, then you have to add an L at the end, as all numeric literals are treated as int (and it can only go up to ~2.1 billion). If you need numbers larger than that, use BigInteger.
downvote count: 0

http://stackoverflow.com/a/21210241
score: 2
answers question: http://stackoverflow.com/q/21210204
downvote count: 0
has body: Most probably because you're running this out of a jar, and there's no File object to get. Compare how you're loading your images with getResourceAsStream, which can find resources that are either unpacked as files (usually for development) or packaged into a jar. Use the same getResourceAsStream call in createFont.
has comment: http://stackoverflow.com/comment/31942980
upvote count: 2
has comment: http://stackoverflow.com/comment/31941980
type: Answer

http://stackoverflow.com/q/21238441
downvote count: 0
has answer: http://stackoverflow.com/a/21241417
tagged with: postgresql
tagged with: sql
answer count: 1
has title: How to work with custom SGBD types with jOOQ
favorite count: 0
has body: I'm wondering how to leverage the new range types you can find in the latests versions of PostgresSQL. I can find the jOOQ documentation on how to manage normal column with custom Java types, however I cannot find how to use custom-type column into custom Java Types. Is there a documentation, or a piece of existing code in jOOQ I can look into and try to contribute?
tagged with: jooq
accepted answer: http://stackoverflow.com/a/21241417
linked to: http://stackoverflow.com/q/39777764
type: AnsweredQuestion
tagged with: java
type: Question
score: 5
upvote count: 5

http://stackoverflow.com/a/21298740
has comment: http://stackoverflow.com/comment/32100684
has comment: http://stackoverflow.com/comment/32099488
has body: Start by thinking how you would solve this in your head. You would start at the left and look at each character until you found a '?'. Then you would note the letters until you found a '&amp;'. Bingo, first word. Continue until you have all the words. Now you know how many words you have (answer #2). Then you need to reverse the letters in each word. Now print them in the order you found them (answer #3). Now print them in reverse order - the last word first (answer #4). Now print the reversed list with spaces between them (answer #5). Sample code (please try to understand how it works and don't just copy it and hand it in - or your teacher will ask you to explain how it works): public static void main(final String[] args){ // example provided by Jason via Stackoverflow String message = "&amp;*#$@?ebyam,&amp;?siht&amp;=asdf???od&amp;failure???&amp;?on?nac&amp;the%%@?uoy&amp;horizon!"; System.out.println("#1: " + message.length()); List&lt;String&gt; words = new ArrayList&lt;String&gt;(); int questionPos = message.indexOf("?"); while(questionPos &gt; -1) { message = message.substring(questionPos + 1, message.length()); int ampersandPos = message.indexOf("&amp;"); questionPos = message.indexOf("?"); if(ampersandPos &gt; 0 &amp;&amp; (ampersandPos &lt; questionPos || questionPos == -1)) { String word = message.substring(0, ampersandPos); StringBuilder reversedWord = new StringBuilder(); for(int i = word.length() - 1; i &gt;= 0; i--) { reversedWord.append(word.charAt(i)); } words.add(reversedWord.toString()); } } System.out.println("#2: " + words.size()); System.out.println("#3:"); for(final String word : words) { System.out.println(word); } System.out.println("#4:"); for(int i = words.size() - 1; i &gt;= 0; i--) { System.out.println(words.get(i)); } System.out.print("#5: "); for(int i = words.size() - 1; i &gt;= 0; i--) { if(i &lt; words.size() - 1) { System.out.print(" "); } System.out.print(words.get(i)); } }
has comment: http://stackoverflow.com/comment/32099089
accepted answer of: http://stackoverflow.com/q/21298566
has comment: http://stackoverflow.com/comment/32099516
upvote count: 1
has comment: http://stackoverflow.com/comment/32098711
has comment: http://stackoverflow.com/comment/32099429
score: 1
has comment: http://stackoverflow.com/comment/32098777
answers question: http://stackoverflow.com/q/21298566
has comment: http://stackoverflow.com/comment/32100884
has comment: http://stackoverflow.com/comment/32098749
has comment: http://stackoverflow.com/comment/32098885
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32099362
type: Answer
has comment: http://stackoverflow.com/comment/32099466
has comment: http://stackoverflow.com/comment/32099524
has comment: http://stackoverflow.com/comment/32099442

http://stackoverflow.com/a/21338948
has body: This is essentially a Delegate Pattern by which the author has implemented the Calculator. The Calculator serves the abstraction of the real-life Calculator. By providing the helper/delegate class , I separate the behavior of the object.I am free to write my own implementation of add / subtract using a helper class. Calculator will serve as the Model of your calculations. Consider this , If you try to modify the behavior you need to change the whole Calculator class and distribute it to the Client. However , I don't have to modify the Calculator but only the Helper which the client does/might not ship. There is nothing wrong in what you have done - but consider this - what if you want to have Single instance of the Calculator - you can control instantion using helper class (in this case)
score: 0
answers question: http://stackoverflow.com/q/21338371
type: Answer

http://stackoverflow.com/comment/31963986
type: Comment
type: QuestionComment
score: 0
has text: I realize that, it's not really a problem with my code just how would I implement this. I know you guys don't like general questions but I did spend some time trying to find a way to do this and I was stuck. I can post my code if you really want it, but I don't see how it would change anything. Basically: double array with each element being a card field/slot. when a person places onto the double array, I want the GUI to update the corresponding JTextArea.
comment on: http://stackoverflow.com/q/21222438

http://stackoverflow.com/comment/32035549
score: 0
type: QuestionComment
type: Comment
has text: @AndonM.Coleman I do not plan on supporting those obsolete versions, though you may wonder why I support 2.x aswell, and honestly that is the part that I do not know. Would supporting 4.4 and 3.3 be enough already? If possible without flashing the screen.
comment on: http://stackoverflow.com/q/21263042

http://stackoverflow.com/comment/32087405
has text: The second sentence is incorrect. At **default security levels** in recent JREs, self-signed apps. are entirely blocked.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21289656
score: 1

http://stackoverflow.com/a/21332848
answers question: http://stackoverflow.com/q/21332018
score: 2
has body: You mean, can Checkstyle detect something like List list = new ArrayList(); as missing generic type arguments. No, Checkstyle can't do that because it works only on the Java source files, so it would not know if the List you are referencing has type parameters or not. Checkstyle would have to determine the binary class name of List, and locate its source, which may not even be available in many cases. FindBugs may be able to do that, as it works on the compiled .class files. I don't know of a FindBugs rule which covers exactly your case, but there are other FindBugs rules related to generics.
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21332018
type: Answer

http://stackoverflow.com/a/21345090
upvote count: 2
has comment: http://stackoverflow.com/comment/32181722
answers question: http://stackoverflow.com/q/21345002
type: Answer
has comment: http://stackoverflow.com/comment/32181505
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32181645
has comment: http://stackoverflow.com/comment/32182053
has comment: http://stackoverflow.com/comment/32182082
has comment: http://stackoverflow.com/comment/32181969
has body: Java is pass-by-value, so reassigning the parameters as you try to do will not work. What you need to do is to have the array itself and two integer indices as parameters: int randInt = generate.nextInt(j-i) + 1; //this is gonna generate a # within the range of the array (so if array is size 5, generates something 1-5) for ( i = 1; i &lt; j;i++){ swapReferences(temp, i, randInt); //and this is my attempt at swapping the references randInt = generate.nextInt(i) + 1 ; } static void swapReferences(int[] array, int a, int b){ int x = array[a]; array[a] = array[b]; array[b] = x; } You can mutate parameters such as arrays passed into a method, as is being done here, but you can't reassign the parameters themselves.
has comment: http://stackoverflow.com/comment/32181868

http://stackoverflow.com/q/21200951
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21201021
has title: how to overcome this exception?
score: -3
has comment: http://stackoverflow.com/comment/31925622
upvote count: 0
has body: i tried to execute this code but it is not running and getting the following error "Exception in thread "main" java.io.FileNotFoundException" and i don't know how to overcome.. class Showoccupancy{ public static void main(String args[]) throws FileNotFoundException { Scanner diskscanner = new Scanner(new File("Showoccupancy")); System.out.println("Room \t guests"); for(int roomnum =0; roomnum&lt;10; roomnum++) { System.out.print(roomnum); System.out.print( " \t "); System.out.print(diskscanner.nextInt()); } } } can any one give solution for it?
tagged with: java
type: Question
tagged with: r.java-file
downvote count: 3
answer count: 1
favorite count: 0

http://stackoverflow.com/a/21298862
type: Answer
score: 1
has body: I am no Java programmer, but as a real-time programmer I think both of your implementations are conceptually wrong. I might have misunderstood how Java synchronization works, though. In that case, please disregard this post and accept my apologies. Your first solution makes sure there is no concurrency between writers because you lock the access to the only function that allows to modify one element. You also lock access to the array as a whole, but only between readers (which is useless since the readers will not modify the data, and thus could safely read the array concurrently). However, you do not prevent concurrent access between readers and writers. It is possible that one (single) reader reads the value of an element that is being modified by a (single) writer. Besides, you return a reference to your member array instead of a copy, so the caller will access the actual data that are likely to be overwritten at any time by the writers. As a consequence, the array is not protected at all against read accesses during writes, even after you called your read accessor. The code might work if for some reason the actual access to an element of the array is atomic (which I very doubt, but again Java is not my cup of tea) or more likely because potential inconsistencies are rare and not easily detectable. Your application could go haywire if you run on a different environment or even change your code slightly so that it increases the occurences of concurrent read/writes or becomes more vulnerable to these inconsistencies. Your second solution uses the AtomicArray, that does the same as your precedent code, but adds a protection to concurrent reads on a single array value. It gets rid of the potential inconstistencies of the first solution (also because this time your reader function is forced to return a copy of the actual array), but reading the whole array is terribly inefficient, because your AtomicArray object will take and release the lock for each value read. A po…
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21247283

http://stackoverflow.com/a/21332080
has body: the xtext guys mark stuff that may be changed NOT as api. this is why you get this warning. it should work anyway. (although it is meant to be used for xbase languages only) P.S: you have to add a dependency to jdt.core too
has comment: http://stackoverflow.com/comment/32169738
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21330803
type: Answer
score: 1
answers question: http://stackoverflow.com/q/21330803
upvote count: 1

http://stackoverflow.com/comment/32087950
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21292495
score: 1
has text: Technically the probability of getting 1 out of [0,1] (assuming doubles) is very small and unless you try billions of time you are unlikely to get 1 anyway...

http://stackoverflow.com/comment/35803533
type: Comment
comment on: http://stackoverflow.com/q/21193701
score: 0
type: QuestionComment
has text: Not quite a duplicate of http://stackoverflow.com/questions/8238661/how-to-convert-date-time-from-one-time-zone-to-another-time-zone as the OP seems to be specifically asking about Jodatime.

http://stackoverflow.com/comment/89150460
type: Comment
comment on: http://stackoverflow.com/a/21228953
has text: With Spring 5+, WebMvcConfigurerAdapter is deprecated, you need to implement WebMvcConfigurer (interface).
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32057686
comment on: http://stackoverflow.com/q/21274414
score: 0
has text: Text descriptions only go so far. Provide ASCII art (or an image with a simple drawing) of the GUI as it should appear in smallest size and (if resizable) with extra width/height.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21220611
upvote count: 2
answer count: 1
tagged with: neo4j
has title: I am having trouble upgrading to Neo4j 1.9 to 2.0
tagged with: macos
has answer: http://stackoverflow.com/a/21222753
favorite count: 0
type: UnansweredQuestion
has body: See the bash scripts - My Java SDK and JRE are upgraded to version 7 - I am stumped. charless-mbp:~ charlesdibsdale$ java -version java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode) charless-mbp:~ charlesdibsdale$ neo4j stop Instance running via launchd with PID 3196, stopping it... charless-mbp:~ charlesdibsdale$ neo4j start WARNING! You are using an unsupported version of the Java runtime. Please use Oracle(R) Java(TM) Runtime Environment 7. Using additional JVM arguments: -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Dneo4j.ext.udc.source=homebrew Detected installation in launchd, starting it... See here for more details.
score: 2
downvote count: 0
tagged with: java
type: Question

http://stackoverflow.com/a/21335065
type: Answer
has body: You probably don't want a for loop inside a while loop to handle this. I would just have a variable to track how many invalid inputs you've received, increment it when they enter something invalid, reset it to zero if they enter something valid, and kick them out if it gets too high. eg: import java.util.Scanner; public class BasicCalculator { public static void main(String[] args) { Scanner input = new Scanner(System.in); double numONE = 0.0; double numTWO = 0.0; double upperLimit = 0.0; double lowerLimit = 0.0; int invalid = 0; System.out.println("MENU"); System.out.println("1. +"); System.out.println("2. -"); System.out.println("3. *"); System.out.println("4. /"); System.out.println("5. Generate a random number."); System.out.println("6. Quit"); System.out.println("What would you like to do?"); int menuSelect = input.nextInt(); //Selects an item from the menu while(invalid &lt; 3){ if(menuSelect == 1 || menuSelect == 2 || menuSelect == 3 || menuSelect == 4){ System.out.println("Enter first number."); numONE = input.nextDouble(); //Stores input as numONE System.out.println("Enter second number."); numTWO = input.nextDouble(); //Stores input as numTWO invalid = 0; } if(menuSelect == 1){ System.out.println(numONE + numTWO); //Adds two numbers } else if(menuSelect == 2){ System.out.println(numONE - numTWO); //Subtracts second number from first number } else if(menuSelect == 3){ System.out.println(numONE * numTWO); //Multiplies two numbers } else if(menuSelect == 4){ if(numTWO != 0){ System.out.println(numONE / numTWO); //Divides first number by second number } else if(numTWO == 0){ System.out.println("I'm sorry, you cannot divide by zero."); } } else if(menuSelect == 5){ System.out.println("Enter upper limit."); upperLimit = input.nextDouble(); System.out.println("Enter lower limit."); lowerLimit = input.nextDouble(); double randomVal = (lowerLimit + (int)(Math.random() * ((upperLimit - lowerLimit)+1))); System.out.println(randomVal); //Displays a random integer betw…
answers question: http://stackoverflow.com/q/21334920
has comment: http://stackoverflow.com/comment/32163297
score: 0
has comment: http://stackoverflow.com/comment/32163230

http://stackoverflow.com/a/78767164
has body: Working solution for Intellij Community or Ultimate. Click Regex button - in the end
type: Answer
answers question: http://stackoverflow.com/q/21219884
score: 0

http://stackoverflow.com/comment/32008225
has text: Your `createCircle()` method does nothing.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21247137

http://stackoverflow.com/comment/32012222
has text: @SotiriosDelimanolis I have updated my post,please have a look
comment on: http://stackoverflow.com/q/21249170
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32095473
score: 0
has text: @d3n13d1 I'm not sure I understand. I created another activity titled ScreenShot.java and then I placed an Intent in the onClick() to start the ScreenShot.class. Inside ScreenShot.class I have the takeScreenShot method.When I click all I get is a blank activity starting.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21292836

http://stackoverflow.com/comment/32109925
type: Comment
comment on: http://stackoverflow.com/a/21300276
type: AnswerComment
has text: Just to confirm, this works. Username and password are windows credentials. Java client implemented to ignore certs.
score: 0

http://stackoverflow.com/q/21281014
tagged with: class
score: 0
answer count: 1
tagged with: jframe
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21284339
tagged with: java
has body: I have a problem about passing object attributes from a class to another. I have two class: AggiungiEs that is a jframe interface where I can select values through three spinners and assign them to variables, String serie = String.valueOf(spinner.getValue()); String ripetizioni = String.valueOf(spinner_1.getValue()); String recupero = String.valueOf(spinner_2.getValue()); then I want to create an object with those variables and pass this object to a second class method that is addEsercizioScheda. GestoreEsercizi gE = new GestoreEsercizi(); EsercizioScheda esercizio = new EsercizioScheda(nomeEs, gruppoMuscolare, allenamento, serie, ripetizioni, recupero); gE.addEsercizioScheda(esercizio, idScheda); The problem is that their value doesn't appear in the second class: when I print them it returns me "null"... public void addEsercizioScheda(EsercizioScheda esercizioScheda, String idScheda) { [.......SOME STUFF TO WRITE IN A XML FILE] Element IDEsercizio = ultimoElemento.getChild("ID"); IDEsercizio.setText(UUID.randomUUID().toString()); Element nodoEsercizi = new Element("Esercizi"); ultimoElemento.addContent(nodoEsercizi); nodoEsercizi.addContent("\n"); // va a capo ad ogni cambio di tag Element nodoEsercizioScheda = new Element("EsercizioScheda"); nodoEsercizi.addContent(nodoEsercizioScheda); nodoEsercizioScheda.addContent("\n"); // va a capo ad ogni cambio di tag Element nodoIDEsercizioScheda = new Element("ID").setText(UUID.randomUUID().toString()); nodoEsercizioScheda.addContent(nodoIDEsercizioScheda); nodoEsercizioScheda.addContent("\n"); Element nodoIDAllenamento = new Element("IDAllenamento").setText("DA MODIFICARE"); nodoEsercizioScheda.addContent(nodoIDAllenamento); nodoEsercizioScheda.addContent("\n"); // va a capo ad ogni cambio di tag Element nodoSerie = new Element("Serie").setText(esercizioScheda.serie); nodoEsercizioScheda.addContent(nodoSerie); nodoEsercizioScheda.addContent("\n"); // va a capo ad ogni cambio di tag Element nodoRipetizioni = new Element("…
tagged with: methods
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/32066904
has title: Pass object attribute from a class to a method of another class

http://stackoverflow.com/q/21211697
tagged with: aggregation
type: UnansweredQuestion
has body: I am having some troubles with Composition and Aggregation relationships in UML, I do understand the whole/part relationship so if a class cannot exist without its whole then it makes it a strong composition relationship and if it still can exist without its whole then it makes it a weak aggregation relationship. However sometimes it gets a little more tricky than that when dealing with real software requirements. I have a class diagram below with all necessary, attributes, operations and properties included which are all correctly shown in UML standards however I am unsure about my relationships: 1 Interface and 6 classes Could someone confirm if my relationships are correct or not? Many Thanks
tagged with: relationships
score: 1
tagged with: java
tagged with: uml
has answer: http://stackoverflow.com/a/21217867
type: Question
answer count: 2
downvote count: 0
has title: Trouble with Composition and Aggregation relationships UML
upvote count: 1
tagged with: composition
has answer: http://stackoverflow.com/a/21230007
favorite count: 0

http://stackoverflow.com/comment/32107391
has text: True, thats a possibility :p I thought he thought this was wrong because when using the ProjectionMatrix and his camera is in position 0,0, it would appear like if the world started in the middle of the screen. So he tought that it was wrong :p but actually he just needed to move his camera. Not very good at explaining..
type: AnswerComment
comment on: http://stackoverflow.com/a/21299556
score: 0
type: Comment

http://stackoverflow.com/q/21316979
has answer: http://stackoverflow.com/a/21317225
has comment: http://stackoverflow.com/comment/32130773
score: 0
tagged with: swing
linked to: http://stackoverflow.com/q/17874717
has body: I'm designing a simple GUI ( Using WindowBuilder Pro in Eclipse) that just shows "Hello World" in the textArea after pressing the button (Testing). However, when I press the button, it doesn't show up in the text area! Can somebody adjust the code or at least tell me what to do? public class TextA { private JFrame frame; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { TextA window = new TextA(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public TextA() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); JTextArea textArea = new JTextArea(); textArea.setBounds(113, 44, 226, 96); frame.getContentPane().add(textArea); JButton btnTesting = new JButton("Testing"); btnTesting.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JTextArea textArea = new JTextArea(); textArea.setText("Hello World!"); } }); btnTesting.setBounds(168, 167, 117, 29); frame.getContentPane().add(btnTesting); } }
tagged with: java
has answer: http://stackoverflow.com/a/21317197
answer count: 3
has comment: http://stackoverflow.com/comment/32130813
has title: Button doesn't show up the text in text area
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5621338
tagged with: jtextarea
has answer: http://stackoverflow.com/a/21317187
has comment: http://stackoverflow.com/comment/32130602
type: Question

http://stackoverflow.com/a/21225790
answers question: http://stackoverflow.com/q/21225695
has body: You should handle SQLException ,Runtime Exception and Exception, then update webservice response with Corresponding Error Message as the parameter(Status - 'Sucess/Failure', ErrorMessage - 'Reason for Failure'). In the jquery extract the value from the parameters and display it to user.
has comment: http://stackoverflow.com/comment/31970413
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31970185
type: Answer
accepted answer of: http://stackoverflow.com/q/21225695

http://stackoverflow.com/q/21309177
has comment: http://stackoverflow.com/comment/32172521
has body: I faced the problem of multiple for-each loops in Hadoop, is it even possible? What code I have now for reducer class: public class R_PreprocessAllSMS extends Reducer&lt;Text, Text, Text, Text&gt;{ private final static Text KEY = new Text(); private final static Text VALUE = new Text(); @Override public void reduce(Text key, Iterable&lt;Text&gt; values, Context context) throws IOException, InterruptedException { int sum = 0; for (Text value : values) { String[] splitString = value.toString().split("\t"); sum += Integer.parseInt(splitString[1]); } if (sum &gt; 100) { for (Text value : values) { String[] splitString = value.toString().split("\t"); System.out.println(key.toString() + splitString[0] + " " + splitString[1]); KEY.set(key); VALUE.set(splitString[0] + "\t" + splitString[1]); context.write(KEY, VALUE); } } } } But I want to have a possibility to search through given values for the second time and to emit those which we need. If it's not possible, what is the recommended way of doing that in Hadoop you'd advice? Thanks.
has title: Multiple for-each loops in Hadoop reducer
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21309452
type: Question
has answer: http://stackoverflow.com/a/21312440
accepted answer: http://stackoverflow.com/a/21312440
tagged with: java
has comment: http://stackoverflow.com/comment/32203887
has comment: http://stackoverflow.com/comment/32174585
has answer: http://stackoverflow.com/a/21309452
tagged with: mapreduce
tagged with: hadoop
score: 0
answer count: 2

http://stackoverflow.com/a/21266384
has comment: http://stackoverflow.com/comment/32045188
has comment: http://stackoverflow.com/comment/32045396
score: 2
has comment: http://stackoverflow.com/comment/32045868
has comment: http://stackoverflow.com/comment/32042270
upvote count: 2
has comment: http://stackoverflow.com/comment/32044688
downvote count: 0
has comment: http://stackoverflow.com/comment/32043077
has comment: http://stackoverflow.com/comment/32045142
answers question: http://stackoverflow.com/q/21262768
has comment: http://stackoverflow.com/comment/32045439
has body: A list is a value object. It's not something we should mock. You can write this whole test without mocking anything, if you're prepared to build a list that has a size in excess of 100. Also, I prefer to use JUnit's ExpectedException mechanism, because it lets you check which line of the test method threw the exception. This is better than passing an argument to the @Test annotation, which only lets you check that the exception was thrown somewhere within the method. public class FooBarTest { @Rule public ExpectedException exceptionRule = ExpectedException.none(); private FooBar toTest = new FooBar(); @Test public void getMethodThrowsException_whenListHasTooManyElements() { List&lt;String&gt; listWith101Elements = new ArrayList&lt;String&gt;(Arrays.asList(new String[101])); exceptionRule.expect(Exception.class); toTest.getMethod(listWith101Elements); } }
has comment: http://stackoverflow.com/comment/32045485
has comment: http://stackoverflow.com/comment/32044494
type: Answer
has comment: http://stackoverflow.com/comment/32045115
has comment: http://stackoverflow.com/comment/32045557

http://stackoverflow.com/comment/32085169
has text: There are **many** QA in SO on post or pre increment.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21291366
type: Comment

http://stackoverflow.com/comment/32076838
has text: hm ok. and can I run it on the tomcat of xampp?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21286742

http://stackoverflow.com/a/21288812
type: AcceptedAnswer
downvote count: 0
has body: I prefer non static methods in DAO for the following reasons Making them non static makes it easier to inject values using frameworks like Spring Writing unit test cases is not easier for static methods since they cannot be overridden Also if you want to extend the functionality of your DAO overriding of static methods is not possible.
type: Answer
score: 6
upvote count: 6
accepted answer of: http://stackoverflow.com/q/21262961
answers question: http://stackoverflow.com/q/21262961

http://stackoverflow.com/comment/32169791
comment on: http://stackoverflow.com/a/21336415
type: Comment
has text: @IAdapter, you are too vague with details to agree or disagree... on my end. First, you assume that the "current structure" is valid... how would a generic tool know that? Two XMLs may overlap in specific areas, yet different models may lead into, or tail off the same... Generally speaking, there's a big chance for generating all possible combinations to be very expensive (computationally speaking)... If you can share concrete examples, we could have a better conversation... :)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32007276
type: QuestionComment
score: 0
has text: Come off it. It's a compiler switch. Put it with the other compiler switches. This is not a mystery.
type: Comment
comment on: http://stackoverflow.com/q/21244956

http://stackoverflow.com/comment/31964057
score: 0
comment on: http://stackoverflow.com/q/21222250
type: Comment
type: QuestionComment
has text: @Felix210591 You can print the content to the log. `Log.d("Content", listeExpo.toString());`

http://stackoverflow.com/comment/32132899
type: QuestionComment
comment on: http://stackoverflow.com/q/21318224
has text: I can sort of see a DocumentFilter working for this, but it would seem to me to be a bit kludgy. Must it be a JTextArea? Would a single column JTable work as well? That would seem a little easier to me. The menu would add a new row, and the table cell editor would only allow edits between the parenthesis, possibly here also via a DocumentFilter. Your posting a [minimal example](http://stackoverflow.com/help/mcve) would greatly help us help you better and quicker.
score: 0
type: Comment

http://stackoverflow.com/q/21239919
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32007959
has comment: http://stackoverflow.com/comment/31995259
answer count: 0
tagged with: java
has title: Not Printing On Click of Buffered Image
has body: I've recently written up a script that will let me check if an Buffered-image has been clicked, but what I have, seems to no be working, I am wondering if I have done anything wrong in the process of making it, It doesn't print the "Clicked On Button" line, doesn't show anything in console about it either. frame.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { Point clicked = e.getPoint(); BufferedImage bounds = Icon.guiIcons[0]; if (((Shape) bounds).contains(clicked)) { System.out.println("Clicked on Inventory Button"); }else{ invIsOpen = false; } } });
type: Question
score: 0
has comment: http://stackoverflow.com/comment/31995112

http://stackoverflow.com/comment/31932957
type: QuestionComment
comment on: http://stackoverflow.com/q/21205321
score: 3
has text: don't want to achieve anything.just poking around with java.is it such a bad thing to do(the poking ,not the asking of this question) :P
type: Comment

http://stackoverflow.com/q/21320006
has title: Shake sensor is not working
type: Question
tagged with: shake
score: 0
has body: I want my shake sensor to work.On shaking my android phone to make something happen, right now nothing happens when i shake my phone. My code is as below: private SensorManager mSensorManager; private float mAccel; // acceleration apart from gravity private float mAccelCurrent; // current acceleration including gravity private float mAccelLast; // last acceleration including gravity and oncreate: mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); mSensorManager.registerListener(mSensorListener, mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL); mAccel = 0.00f; mAccelCurrent = SensorManager.GRAVITY_EARTH; mAccelLast = SensorManager.GRAVITY_EARTH; on acitvity private final SensorEventListener mSensorListener = new SensorEventListener() { public void onSensorChanged(SensorEvent se) { float x = se.values[0]; float y = se.values[1]; float z = se.values[2]; mAccelLast = mAccelCurrent; mAccelCurrent = FloatMath.sqrt(x*x + y*y + z*z); float delta = mAccelCurrent - mAccelLast; mAccel = mAccel * 0.9f + delta * 0.1f; // perform low-cut filter } public void onAccuracyChanged(Sensor sensor, int accuracy) { if(mAccel &gt; 0.1) { Toast toast = Toast.makeText(getApplicationContext(), "Device has shaken.", Toast.LENGTH_LONG); toast.show(); } } };
tagged with: sensors
answer count: 1
has answer: http://stackoverflow.com/a/21325313
tagged with: gravity
tagged with: android
accepted answer: http://stackoverflow.com/a/21325313
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/32100073
score: 0
comment on: http://stackoverflow.com/q/21299618
type: QuestionComment
has text: Ahh, think I'm going to need to see some example code that replicates what your talking about...
type: Comment

http://stackoverflow.com/comment/32104123
has text: I am not sure how to read and write these objects to Parcel.
comment on: http://stackoverflow.com/q/21301989
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32040067
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21246315
score: 1
has text: Did you try following the Alfresco documentation? How far did you get? What problems did you hit? (Alfresco ought to work just fine with LDAP no matter what format your LDAP server stores its passwords in)

http://stackoverflow.com/comment/32001888
type: QuestionComment
has text: I got the problem fixed using getSize() instead, but what are some good alternatives you know?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21238110

http://stackoverflow.com/comment/32080968
has text: Hi.. can you try it out this way - complete the while loop before you start with the for loop (this way you read all the data into the list and then start iterating over the objects in the list). I can't paste the code here because the comments have a word limit and formatting code in comments is quite difficult. Also, I'm not sure what the Employee A class is about.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21243627

http://stackoverflow.com/a/57756221
score: 0
has body: You need dependency: org.jboss jboss-remote-naming https://mvnrepository.com/artifact/org.jboss/jboss-remote-naming/ For WildFly you can use org.wildfly.naming.client.WildFlyInitialContextFactory form: org.wildfly wildfly-naming-client https://mvnrepository.com/artifact/org.wildfly/wildfly-naming-client You can use bom file for import: org.wildfly wildfly-ejb-client-bom pom https://mvnrepository.com/artifact/org.wildfly/wildfly-ejb-client-bom
answers question: http://stackoverflow.com/q/21213693
type: Answer

http://stackoverflow.com/comment/31928717
type: Comment
comment on: http://stackoverflow.com/a/21202668
has text: `libraries to go with your project` and `external jars that your project can use` it seems redundant. no?
type: AnswerComment
score: 0

http://stackoverflow.com/q/21230084
has title: How to open any file(pdf, doc) INSIDE a browser without open/save dialog in java
type: UnansweredQuestion
tagged with: iframe
tagged with: java
has answer: http://stackoverflow.com/a/21230561
has body: i have tried it with iframe works well only for pdf(but save option will be disable through browser settings only) can any one give an idea, about this. (Is there any open source plugins.)
tagged with: doc
type: Question
answer count: 2
tagged with: jquery
score: 0
has answer: http://stackoverflow.com/a/21230123
has comment: http://stackoverflow.com/comment/32019438
tagged with: http://stackoverflow.com/tag/pdf

http://stackoverflow.com/comment/32039527
type: Comment
type: QuestionComment
has text: i am trying to create a hashmap that can be converted to json string later using gson. but for my need, i need to create that map, and not the json string. i just need to know that this map "can" be converted to json string using gson with having extra 'map's
score: 0
comment on: http://stackoverflow.com/q/21247998

jboss5.x
tags question: http://stackoverflow.com/q/21266541
tag name: jboss5.x
tags question: http://stackoverflow.com/q/21227665
tags question: http://stackoverflow.com/q/21334733
tags question: http://stackoverflow.com/q/21305376
type: Tag

http://stackoverflow.com/a/49681318
downvote count: 1
has body: The most intuitive method I can think of: calculate the sum (or difference) as a long, then convert that sum to an int and see if its value has changed. long longSum = (long) a + b; int sum = (int) longSum; if (sum == longSum) { // sum contains the correct result } else { // overflow/underflow } Remember that on modern 64 bit processors, working with longs is no less efficient than working with ints (the opposite may be true). So if you have a choice between checking for overflows or using longs, go for the latter.
has comment: http://stackoverflow.com/comment/139119115
score: 5
upvote count: 6
answers question: http://stackoverflow.com/q/21233582
type: Answer

http://stackoverflow.com/comment/31952781
type: AnswerComment
score: 0
has text: Ok, give me 1 second.
comment on: http://stackoverflow.com/a/21215984
type: Comment

http://stackoverflow.com/comment/31936562
type: QuestionComment
score: 0
has text: well considering that a tweet is limited to 140 (?, not sure) characters, I would argue that this is fast enough. remember: first nail it, then scale it :)
comment on: http://stackoverflow.com/q/21207292
type: Comment

http://stackoverflow.com/comment/32155750
has text: @RichardTingle That's a very good point about `byte` not being big enough, didn't think about that...you could do some bit shifting (is that the right term) and use 4/8 bytes per position or some such...about here I'm thinking there has to be an easier way to do this...
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21330954

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/21319589
tags question: http://stackoverflow.com/q/21192527
tags question: http://stackoverflow.com/q/21242939
tag name: android-actionbar
tags question: http://stackoverflow.com/q/21246481

http://stackoverflow.com/a/21196194
has comment: http://stackoverflow.com/comment/31917534
type: Answer
has comment: http://stackoverflow.com/comment/31917288
answers question: http://stackoverflow.com/q/21195340
has body: The JVM basically simulates a CPU for a Java program. Just as a CPU executes assembled opcodes natively on the hardware, the JVM executes Java opcodes, but strictly in software. What does this exactly mean? is the bytecodes are ISA for JVM and JVM in-turn support ISA of processors. An ISA (Instruction Set Architecture) specifies the entire set of disciplines and techniques that apply to writing low-level software that runs directly on the CPU. It includes a set of opcodes, which are uncomposable direct CPU commands. The JVM recognizes its own set of bytecodes (i.e. 8-bit opcodes) that direct the JVM to carry out interpreter-primitive instructions. So, yes, the bytecode specification makes up part of the JVM's ISA. The JVM iterates through the list of opcodes executing them one by one using its own memory to emulate hardware components (e.g. stack, register, main memory) and using primitive arithmetic and logic operations to emulate the ALU. These emulated components also make up the JVM's ISA. This is the basic construction of any interpreter, give or take. However, to improve the runtime of Java applications, the JVM compiles "hotspots" to machine-specific code for optimal performance. Hotspots are sections of the code that are ran frequently. This is known as "Just-In-Time" compilation, and can be done while the program is executing. This technique brings Java's performance a lot closer to that of compiled languages. JIT is used in the .NET framework as well. Each operating system has its own JVM implementation, which may also vary by the device's ISA. For example, you may have a JVM written for Linux-Arm, Linux-x86, or Windows-x86. The JVM itself may be written in a platform-independent (sort of anyway) language like C, but its JIT compiler must support compilation to the device's instruction set.
score: 4
has comment: http://stackoverflow.com/comment/42529312
upvote count: 4
has comment: http://stackoverflow.com/comment/31978455
downvote count: 0

http://stackoverflow.com/a/21327738
has comment: http://stackoverflow.com/comment/32175486
type: Answer
has comment: http://stackoverflow.com/comment/32188638
score: 3
upvote count: 3
has body: Here is a recursive solution. I didn't test it but it should work I think: public void getHandles(FileHandle begin, Array&lt;FileHandle&gt; handles) { FileHandle[] newHandles = begin.list(); for (FileHandle f : newHandles) { if (f.isDirectory()) { Gdx.app.log("Loop", "isFolder!"); getHandles(f, handles); } else { Gdx.app.log("Loop", "isFile!"); handles.add(f); } } } Start it with getHandles(Gdx.file.external("/")). The handler to the root directory. Just use one Array. Pass it to the method and the method will fill it with all handlers. UPDATE: You need to call it with the right handle! Since it does matter if you are on an Android device or on the desktop. According to this question Libgdx How to get a list of files in a directory? Call it like this: FileHandle dirHandle; if (Gdx.app.getType() == ApplicationType.Android) { dirHandle = Gdx.files.internal("data"); } else { dirHandle = Gdx.files.internal("./bin/data"); } Array&lt;FileHandle&gt; handles = new Array&lt;FileHandle&gt;(); getHandles(dirHandle, handles); If you use internal. Else use absolute instead of external. If you pass it an empty FileHandle it will not work. According to the wiki: Desktop (Windows, Linux, Mac OS X) On a desktop OS, the filesystem is one big chunk of memory. Files can be referenced with paths relative to the current working directory (the directory the application was executed in) or absolute paths. Ignoring file permissions, files and directories are usually readable and writable by all applications. Moreover: External: External files paths are relative to the SD card root on Android and to the home directory of the current user on desktop systems. Checked the function with an internal an absolute and also with an external. As mentioned take care that the external is relative to your user directory! e.g. C:/Users/user/... Just pass the right handle to it.
accepted answer of: http://stackoverflow.com/q/21320365
answers question: http://stackoverflow.com/q/21320365
downvote count: 0
has comment: http://stackoverflow.com/comment/32163648
has comment: http://stackoverflow.com/comment/32162391
has comment: http://stackoverflow.com/comment/32166743
has comment: http://stackoverflow.com/comment/32174349
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32190426

http://stackoverflow.com/q/21315160
tagged with: java
has comment: http://stackoverflow.com/comment/32128500
has comment: http://stackoverflow.com/comment/32127375
type: Question
has comment: http://stackoverflow.com/comment/32127104
tagged with: ubuntu
score: 0
tagged with: sftp
tagged with: ssh
has title: Permission denied error for "ls" operation on SFTP server through Java API
has comment: http://stackoverflow.com/comment/32128517
has comment: http://stackoverflow.com/comment/32128275
type: UnansweredQuestion
has body: I've an SFTP server with appropriate credentials setup. I've an admin user on that machine, which has certain rights to perform certain actions. So, I've edited the sudoers file to add action like this sudo visudo -f /etc/sudoers # Added the below line at end of file admin ALL=NOPASSWD: /bin/ls I want to list down a directory and get the count of files in that directory through Java API. SFTPv3Client client = null; try { client = new SFTPv3Client(connection); // connection is successful. } catch (IOException e) { e.printStackTrace(); } Vector list = null; try { list = client.ls(directoryName); } catch (IOException e) { e.printStackTrace(); // throws IOException } I've used ch.ethz.ssh2.SFTPv3Client jar. I'm able to connect to server and also authenticate through username and password. But, when listing down the directory, I face below error ch.ethz.ssh2.SFTPException: Permission denied (SSH_FX_PERMISSION_DENIED: The user does not have sufficient permissions to perform the operation.) Does anybody have an idea about the cause of this issue ?
tagged with: ioexception
answer count: 0

http://stackoverflow.com/comment/32069269
has text: According to the JavaDoc for find() method: Attempts to find the next subsequence of the input sequence that matches the pattern. This method starts at the beginning of this matcher's region, or, if a previous invocation of the method was successful and the matcher has not since been reset, at the first character not matched by the previous match. If the match succeeds then more information can be obtained via the start, end, and group methods. @return true if, and only if, a subsequence of the input sequence matches this matcher's pattern. So you need to call find().
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21280914

http://stackoverflow.com/comment/32388470
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21405009
has text: But surprised, not able to execute expressCheckout , getting response.getAck()as FAILURE.

http://stackoverflow.com/q/21281736
linked to: http://stackoverflow.com/q/21281470
has answer: http://stackoverflow.com/a/21281952
has comment: http://stackoverflow.com/comment/32068082
tagged with: annotations
tagged with: spring
type: Question
type: AnsweredQuestion
tagged with: java
has title: annotating methods in implementation classes or interfaces?
accepted answer: http://stackoverflow.com/a/21281952
answer count: 1
has body: I am using Java1.7 and spring3. I have below classes. MyInterface.java public interface MyInterface{ String getResult(); } MyInterfaceImpl.java public class MyInterfaceImpl implements MyInterface{ @MyCustomAnnotation public String getResult(){ //some logic } } I annotated method in Impl class. Is it good practice to annotate methods in implementation class? Or do i need to annotate methods in the interface itself? Thanks!
score: 0
has comment: http://stackoverflow.com/comment/32068142

http://stackoverflow.com/comment/31910652
type: QuestionComment
type: Comment
has text: @CommonsWare I'm not passing a `String[]` from Javascript to Java
comment on: http://stackoverflow.com/q/21191724
score: 0

http://stackoverflow.com/a/21285038
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21283339
type: Answer
answers question: http://stackoverflow.com/q/21283339
downvote count: 0
score: 1
has body: I don't know, how you are putting user object in your Model while rendering the form, which eventually comes to your POST method of "/Profile/{userId}". The id of your user object becoming 0. That's why saveOrUpdate method saves your user again. To verify it, you can add the line below, before going into saveProfileDetails method: user.setUserId(userId); And your problem will be fixed. You can also fix this problem by putting @SessionAttributes("user"), before the owning controller of your "/Profile/{userId}"'s GET and POST method. See also: Using @SessionAttributes to store model attributes
has comment: http://stackoverflow.com/comment/32145979
upvote count: 1

http://stackoverflow.com/a/21256710
has comment: http://stackoverflow.com/comment/32027967
has comment: http://stackoverflow.com/comment/32023778
has comment: http://stackoverflow.com/comment/32023842
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21256573
has comment: http://stackoverflow.com/comment/32023976
has body: Take a look at your if statements if(b == nope); You've added a ; at the end of each statement. This means that both blocks of code within the {...} braces are being executed regardless of what the if statements might want. Remove the ; from the end of each statement Ps- Unless you have a very particular need to use raw AWT, I'd consider taking a look at Swing or if you're really adventurous, JavaFX, as they are more modern GUI APIs
type: Answer
upvote count: 6
score: 6
accepted answer of: http://stackoverflow.com/q/21256573

http://stackoverflow.com/comment/32098780
type: AnswerComment
score: 0
type: Comment
has text: That said, it would be much *simpler* to just store a single value representing the biggest value seen thus far. :)
comment on: http://stackoverflow.com/a/21297812

http://stackoverflow.com/comment/31974808
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21228641
has text: possible duplicate of [Shrinking an ArrayList to a new size](http://stackoverflow.com/questions/1184636/shrinking-an-arraylist-to-a-new-size)

eclipse-plugin
tags question: http://stackoverflow.com/q/21260657
tags question: http://stackoverflow.com/q/21290881
tags question: http://stackoverflow.com/q/21254535
tags question: http://stackoverflow.com/q/21279503
type: Tag
tags question: http://stackoverflow.com/q/21234745
tags question: http://stackoverflow.com/q/21299998
tags question: http://stackoverflow.com/q/21294416
tags question: http://stackoverflow.com/q/21207421
tags question: http://stackoverflow.com/q/21239860
tags question: http://stackoverflow.com/q/21219242
tags question: http://stackoverflow.com/q/21311944
tags question: http://stackoverflow.com/q/21331463
tags question: http://stackoverflow.com/q/21310741
tags question: http://stackoverflow.com/q/21310743
tags question: http://stackoverflow.com/q/21206964
tags question: http://stackoverflow.com/q/21278149
tags question: http://stackoverflow.com/q/21232675
tags question: http://stackoverflow.com/q/21247306
tags question: http://stackoverflow.com/q/21256728
tags question: http://stackoverflow.com/q/21276434
tags question: http://stackoverflow.com/q/21221863
tag name: eclipse-plugin
tags question: http://stackoverflow.com/q/21193006

http://stackoverflow.com/comment/32034866
type: Comment
type: QuestionComment
has text: In that case, do I need to make more modifications to connect Eclipse' s Java debugger to the tomcat server? If so, where would I make the change(s) and what would the change(s) be?
comment on: http://stackoverflow.com/q/21262292
score: 0

http://stackoverflow.com/a/54841000
downvote count: 0
has body: On brand new Ubuntu 18.10 install i ran into the same issue when a preview of a markdown file is rendered in pycharm (community edition). I downloaded an oracle JRE (jre1.8.0_201) and used that instead of the jre that is shipped with pycharm but i got the same problem again. Then added the -Dprism.verbose=true option which revealed that libgtk-x11-2.0.so.0 is missing. Finally sudo apt-get install libgtk2.0-0 resolved the issue. Thanks, Paul
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/21185156
score: 3

http://stackoverflow.com/a/21206130
answers question: http://stackoverflow.com/q/21206073
upvote count: 3
downvote count: 0
has body: BlockingQueue&lt;Thread&gt; threads = thing.getQueueA(); // works BlockingQueue&lt;Thread&gt; threads = thing.getQueueB(); // does not work On the other side of things: @Override public &lt;T extends Runnable&gt; BlockingQueue&lt;T&gt; getQueueA() { return new ArrayBlockQueue&lt;Thread&gt;(); // no worky } @Override public BlockingQueue&lt;? extends Runnable&gt; getQueueB() { return new ArrayBlockQueue&lt;Thread&gt;(); // works }
score: 3
type: Answer

http://stackoverflow.com/comment/32274563
has text: @Benbai: this is working fine if only one datebox is there in a single page.In case of multiple datebox in a single page, its not working fine. Like I have selected date from first datebox and then select second datebox.When i click CLear button of Second datebox, it clears the value of first datebox.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21351693

http://stackoverflow.com/comment/31935899
comment on: http://stackoverflow.com/q/21198203
has text: The answer they gave you is correct. There's no way of managing the client side timeout. I would suggest you to deeply revise your strategy, maybe using a DB based handshake for task that has an unpredictably long duration. Making an user wait 4 or 5 minutes in front af a spinning browser is not acceptable.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21308825
has answer: http://stackoverflow.com/a/23725305
linked to: http://stackoverflow.com/q/20478014
upvote count: 3
answer count: 2
downvote count: 0
tagged with: jar
favorite count: 0
has comment: http://stackoverflow.com/comment/63169532
tagged with: exe
possible better answer: http://stackoverflow.com/a/23725305
has title: How to run java application file (exe not jar) without installing jdk nor jre
tagged with: java
tagged with: portability
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21308984
score: 3
accepted answer: http://stackoverflow.com/a/21308984
linked to: http://stackoverflow.com/q/1332548
has body: (I already examined the answers here and here, but that doesn't answers my question) I copied Java's folders (JRE &amp; JDK) to a local folder and I manage to run .jar application by this command: SomeFolder\Java\jre6\bin\javaw.exe -jar SomeApp.jar But how can I run .exe application (e.g. eclipse.exe) by a similar way in two cases: The application required only JRE The application required also JDK p.s. unfortunately "portableapps.com" solution is not acceptable.

http://stackoverflow.com/q/21277004
has body: I have a project that runs fine in eclipse. However, when exporting it to jar (both executable jar and regular jar), I'm getting the above exception when running it. My classpath contains: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;classpath&gt; &lt;classpathentry kind="src" path="src"/&gt; &lt;classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/&gt; &lt;classpathentry kind="lib" path="libs/commons-io-2.4.jar"/&gt; &lt;classpathentry kind="lib" path="libs/commons-math3-3.2-javadoc.jar"/&gt; &lt;classpathentry kind="lib" path="libs/commons-math3-3.2.jar"/&gt; &lt;classpathentry kind="lib" path="libs/Jama-1.0.3.jar"/&gt; &lt;classpathentry kind="lib" path="libs/jcommon-1.0.21.jar"/&gt; &lt;classpathentry kind="lib" path="libs/jfreechart-1.0.17.jar"/&gt; &lt;classpathentry kind="output" path="bin"/&gt; &lt;/classpath&gt; And as you can see, the third entry is the right lib. Why does this happen?
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32060104
type: Question
has answer: http://stackoverflow.com/a/21277215
has comment: http://stackoverflow.com/comment/32060087
accepted answer: http://stackoverflow.com/a/21277215
possible better answer: http://stackoverflow.com/a/21277218
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32060182
has title: org/apache/commons/io/FileUtils - NoClassDefFoundError
has answer: http://stackoverflow.com/a/21277218

http://stackoverflow.com/q/21291856
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/32101160
type: Question
has title: How to use transactions and rollbacks in an SOA architecture
has body: I'm currently working on a SOA project. I have to develop several processing chains, that is to say a web-services that chain web-services inside an ESB in Java. Since every web-service to chain can throw different exception, I thought about using Transactions to be able to rollback the web-services behaviors. However, I have no idea if this is even possible in an SOA environnement when every service is different. I searched it and found some information about AtomicTransactions but I'm not sure it's can be used to solve my problem. To conclude, my questions are is it actually possible to rollback services? And if so, how can I set it up? Thanks in advance.
has comment: http://stackoverflow.com/comment/32089320
answer count: 2
upvote count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/21341776
accepted answer: http://stackoverflow.com/a/21341776
has comment: http://stackoverflow.com/comment/32133350
tagged with: web-services
tagged with: esb
tagged with: soa
possible better answer: http://stackoverflow.com/a/38870126
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/38870126
downvote count: 0
tagged with: transactions

http://stackoverflow.com/q/21261996
score: 0
tagged with: sql
answer count: 1
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/21262048
has comment: http://stackoverflow.com/comment/32033260
linked to: http://stackoverflow.com/q/7535317
has title: java program - database output not showing backslashes
type: AnsweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/32040232
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21262048
has body: How can I replace the single backslashes "\"in the string filepath with either double backslashes "\" or a single slash "/" ? I need it so that i can execute the desktop method in java properly here is the code: JButton btnAdd = new JButton("Add"); btnAdd.setBounds(101, 560, 89, 23); frmAddContract.getContentPane().add(btnAdd); btnAdd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { try{ String cntr = ContractNo.getText(); String en = EngagerName.getText(); String cont = contNo.getText(); String mo = month.getText(); String d = day.getText(); String yr = year.getText(); String dte = yr + "-" + mo + "-" + d; String cla = cladd.getText(); String tm = tme.getText() + ":00"; String evadd = eventadd.getText(); String filepath = textField_fp.getText(); String ref = refer.getText(); String SQL = "insert into cis "+ "values ('"+cntr+"','"+en+"','"+ cont+"','"+cla+"','"+dte+"','"+tm+"','"+ evadd+"','"+filepath+"','"+ref+"');"; PreparedStatement stmt = conn.prepareStatement(SQL); stmt.executeUpdate(); JOptionPane.showMessageDialog(null, "Addition of Contract Successful!"); frmAddContract.setVisible(false); PreparedStatement show = conn.prepareStatement("select * from kusinanikambal.cis;"); ResultSet rs = show.executeQuery(); System.out.println(rs.getRowId("engager")); } catch(Exception e){ JOptionPane.showMessageDialog(null, e); } } });
tagged with: java

http://stackoverflow.com/comment/31927034
score: 2
comment on: http://stackoverflow.com/q/21201728
has text: Be aware that you can have a line of code which is syntactically correct when used in the correct situation, which, when used in an incorrect situation is still bound to give you compile errors. There is much more than syntax to processing a program.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32049300
score: 0
has text: To be honest your -cp doesn't look much like a directory containing java classes or a jar to me, so it is hard to say. But you should really pass the path parameters to the File object itself and use currentLoc.getPath() or something like getAbsolutePath() as your cp parameter (that can also help you with any platform specific issues in the path). Therefore I suggest moving the File to within the for loop.
type: AnswerComment
comment on: http://stackoverflow.com/a/21270159
type: Comment

http://stackoverflow.com/comment/32134700
type: QuestionComment
has text: Can you provide some more detail? What do your tables look like? What would you like your join table to look like? What have you tried?
score: 1
comment on: http://stackoverflow.com/q/21319031
type: Comment

http://stackoverflow.com/q/21232720
has answer: http://stackoverflow.com/a/21232930
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31982025
linked to: http://stackoverflow.com/q/17674784
tagged with: eclipse
type: Question
has title: How to include only one dependency project classes in final jar
has comment: http://stackoverflow.com/comment/31981871
has body: I use Maven to build my MyProject. There are several other projects which are used as library projects for 'MyProject'. In pom.xml of MyProject, I defined those library projects as dependencies of MyProject. One of the Library project is named "OneLibProject": com.xxx.OneLibProject OneLibProject 1.0.0-SNAPSHOT jar ... Under MyProject root path, after I run : maven clean install a MyProject.jar is generated. But those classes defined in library projects(dependencies) are not included in this MyProject.jar. Each library project also have its own pom & can generate its own jar. Now, what I want to do is I want to have my pom.xml in "MyProject" to be configured so that the generated MyProject.jar file contains the classes of OneLibProject and classes of MyProject. Other library project classes are not included. How to achieve this?
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/31982496
has comment: http://stackoverflow.com/comment/31982150

http://stackoverflow.com/q/21316169
has answer: http://stackoverflow.com/a/21316888
answer count: 1
has comment: http://stackoverflow.com/comment/32129200
has comment: http://stackoverflow.com/comment/32129198
has comment: http://stackoverflow.com/comment/32129764
has comment: http://stackoverflow.com/comment/32129501
has comment: http://stackoverflow.com/comment/32129264
tagged with: scripting
has body: How can i execute java code from my java program? Is there a framework I could use to programatically execute them? please help, thanks. My java class public class test { public static compute(int one, int two){ // compute goes here } public static void main(String[] args) { //read from file //execute the commands } } my text file : contains java code fragments doesn't consists the whole java file. System.out.println("Start of my program"); @do("compute my two int"){ val = compute(15,25); System.out.println(val); }
has comment: http://stackoverflow.com/comment/32130789
has comment: http://stackoverflow.com/comment/32129386
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32129117
has comment: http://stackoverflow.com/comment/32129967
type: Question
has comment: http://stackoverflow.com/comment/32129260
tagged with: java
linked to: http://stackoverflow.com/q/4463440
has title: How can I execute java code from plain text?
has comment: http://stackoverflow.com/comment/32129366
has comment: http://stackoverflow.com/comment/32129784
has comment: http://stackoverflow.com/comment/32129670
has comment: http://stackoverflow.com/comment/32129695
score: 0
duplicate of: http://stackoverflow.com/q/4463440

http://stackoverflow.com/comment/32152501
comment on: http://stackoverflow.com/q/21329215
type: Comment
type: QuestionComment
score: 1
has text: @Ingo actually you can, by making it more specific (for example return String in a subclass, instead of Object as in the base class)

http://stackoverflow.com/q/21343384
answer count: 1
favorite count: 0
tagged with: jlabel
tagged with: swing
has title: Refreshing Image in JLabel doesnt work
tagged with: refresh
type: AnsweredQuestion
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21343439
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21343439
has body: Hi, I have a problem with refreshing an image, added to JLabel. It is something like control light which give us information about status online/offline. When we start application and server is on, its going to call this method and change light to green. We can of course click button "go offline" and make it offline all time. Then the light is red. By now everything works fine, but when we click "go online", the program is online but the image is still red. In every place its called by the same method. Just this light doesn't work, because connecting and disconnecting works fine. I give you some code: Method which just change the image: public void changeLight(String name){ BufferedImage imgtmp; try { System.out.println("CHANGE LIGHT: "+name); imgtmp = ImageIO.read(new File(name)); panelMenuOnline.remove(panelMenuOnlineLight); panelMenuOnlineLight = new JLabel(new ImageIcon(imgtmp)); panelMenuOnline.add(panelMenuOnlineLight); } catch (IOException e) { e.printStackTrace(); } } button definition in the same class: panelMenuButOn = new Guzik("GO ONLINE"){ @Override public void actionPerformed(ActionEvent e) { if(!Pang.game.online){ Pang.game.haveToBeOffline = false; if(Client.checkConnection()) { JOptionPane.showMessageDialog(this, "Successfully connected"); Pang.game.online=true; changeLight(imgGREEN); } else { JOptionPane.showMessageDialog(this, "Connection refused"); } } else { JOptionPane.showMessageDialog(this, "Successfully disconnected"); setText("GO ONLINE"); Pang.game.haveToBeOffline = true; Pang.game.online=false; changeLight(imgRED); } } }; and i have also thread which (if I don't made him offline) testing connection and change control light: public void run() { while(true){ Pang.game.online=Client.checkConnection(); if(Pang.game.online){ Pang.game.frame.panelMenuButOn.setText("GO OFFLINE"); Pang.game.frame.changeLight(Pang.game.frame.imgGREEN); } else { Pang.game.frame.panelMenuButOn.setText("GO ONLINE"); Pang.game.frame.changeLight(Pang.game.frame.imgRED);…
tagged with: image
upvote count: 2

http://stackoverflow.com/comment/32028610
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21258468
has text: Ok , ive addded it. I dont think it needed.
score: 0

http://stackoverflow.com/q/21322353
has comment: http://stackoverflow.com/comment/32140907
has comment: http://stackoverflow.com/comment/32140727
tagged with: java
has comment: http://stackoverflow.com/comment/32141063
tagged with: swing
linked to: http://stackoverflow.com/q/21265576
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/32140763
linked to: http://stackoverflow.com/q/29745778
downvote count: 0
tagged with: jpanel
has answer: http://stackoverflow.com/a/21322873
has comment: http://stackoverflow.com/comment/32141019
has answer: http://stackoverflow.com/a/21322558
answer count: 2
linked to: http://stackoverflow.com/q/15986677
has title: Java JPanel getGraphics()
tagged with: paintcomponent
possible better answer: http://stackoverflow.com/a/21322558
favorite count: 0
score: 8
has body: Since Java only supports single inheritance, I desire to paint directly on an instance of a JPanel that is a member of the class Panel. I grab an instance of Graphics from the member and then paint whatever I desire onto it. How can I not inherit from JComponent or JPanel and still utilize getGraphics() for painting on this without overriding public void paintComponent(Graphics g)? private class Panel { private JPanel panel; private Graphics g; public Panel() { panel = new JPanel(); } public void draw() { g = panel.getGraphics(); g.setColor(Color.CYAN); g.draw(Some Component); panel.repaint(); } } The panel is added to a JFrame that is made visible prior to calling panel.draw(). This approach is not working for me and, although I already know how to paint custom components by inheriting from JPanel and overriding public void paintComponent(Graphics g), I did not want to inherit from JPanel.
has comment: http://stackoverflow.com/comment/32140625
upvote count: 8
accepted answer: http://stackoverflow.com/a/21322873
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32140961

http://stackoverflow.com/q/21312408
tagged with: database
tagged with: jtable
score: 0
has title: Mulitiple delete record from jtable through id which is link to database
linked to: http://stackoverflow.com/q/4526779
answer count: 1
has answer: http://stackoverflow.com/a/21317274
has comment: http://stackoverflow.com/comment/32122117
type: UnansweredQuestion
tagged with: java
tagged with: swing
has body: My question: How to allow user to perform multiple delete from jtable through button.The table is linked to my database.I have created a table model in another class and link to my SalesReceiptTable. I am able to delete one row from both the db and table when the user click the delete button. Should i do looping for the rowSelected ?? //Button to perform delete JButton btnDelete = new JButton("Delete"); btnDelete.setFont(new Font("Tahoma", Font.PLAIN, 13)); btnDelete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int rowSelected=SalesReceiptTable.getSelectedRow(); if(rowSelected&gt;=0) { String id = SalesReceiptTable.getValueAt(rowSelected, 7).toString(); SalesReceipt1 e1=new SalesReceipt1(Integer.parseInt(id)); e1.deleteSalesReceipt(); ArrayList&lt;SalesReceipt1&gt; result= SalesReceipt1.retrieveAllSalesReceipt(); SalesReceiptTableModel model= new SalesReceiptTableModel(result); SalesReceiptTable.setModel(model); } else{ JOptionPane.showMessageDialog(null,"No record selected","Alert", JOptionPane.ERROR_MESSAGE); } //My sql statement in my entity class public boolean deleteSalesReceipt(){ boolean success = false; DBController db = new DBController(); String dbQuery; db.getConnection(); dbQuery = "DELETE FROM SalesReceipt WHERE salesReceiptId ='" + salesReceiptId +"'"; if (db.updateRequest(dbQuery) == 1){ success = true; } db.terminate(); return success; }
type: Question

http://stackoverflow.com/a/21346731
answers question: http://stackoverflow.com/q/21346695
type: Answer
has comment: http://stackoverflow.com/comment/32228590
has body: Try this out public class QuadraticFormula { int A = 1; int B = -7; int C = 10; public static void main(String[] args) { QuadraticFormula formula = new QuadraticFormula(2, 8, 4); System.out.println(formula.findSolutions()); }//Brought in the static void as Eclipse continually insisted this was neccesary. There is a main file I am supposed to be referencing //The file name is QuadraticFormulaMain.java and is in the same directory. Is there a way I should be writing this to reference it? public QuadraticFormula(int A, int B, int C) { this.A = A; this.B = B; this.C = C; } //Sets integers to easily testable numbers //Runs and Prints out the solution found below private static int discriminant(int A, int B, int C) { //sets the discriminate with appropriate equation return (B * B) - (4 * A * C); } private int numberOfSolutions(int A, int B, int C) { //The actual numerOfSolutions, checks if the discriminant is positive negative or zero if (discriminant(A, B, C) &gt; 0) { return 2; } else if (discriminant(A, B, C) == 0) { return 1; } else { return 0; } } //This performs the find Solutions String mentioned in the beginning //For whatever reason All return statements are showing errors, but says Eclipse has a quick fix. //This is a lie as all it says is "No Suggestions Avalible" private String findSolutions() { if (numberOfSolutions(A, B, C) == 1) { return ("There is one solution and it is" + plusSolution(A, B, C)); } else if (numberOfSolutions(A, B, C) == 2) { return "There are two solutions and they are " + plusSolution(A, B, C) + "and" + minusSolution(A, B, C); } else { System.out.println("There are no solutions"); return "There are no solutions"; } } private static double plusSolution(int A, int B, int C) { return ((B * -1) + Math.sqrt((B * B) - (4 * A * C))) / (2 * A); } private static double minusSolution(int A, int B, int C) { return ((B * -1) - Math.sqrt((B * B) - (4 * A * C))) / (2 * A); } } What I did was make a valid construtor public QuadraticFormula(...) When you…
has comment: http://stackoverflow.com/comment/32228891
score: 0

http://stackoverflow.com/a/21322252
upvote count: 3
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21321586
score: 3
has body: What I would try is this: Declare getProduct as public void getProduct(Response.Listener&lt;JSONObject&gt; listener, Response.ErrorListener errlsn) { JsonObjectRequest req = new JsonObjectRequest("http://echo.jsontest.com/name/Milk/price/1.23/",null, listener, errlsn); ApplicationController.getInstance().addToRequestQueue(req); } And than call in your activity like this: productService.getProduct( new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { variableFromActivity = response; //Or call a function from the activity, or whatever... } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { //Show error or whatever... } });

http://stackoverflow.com/q/21347728
favorite count: 0
has body: I'm reading this book, and it's going over static typing, which, after reading the chapter a little bit, I understand as: Static typing in OOP is defined as explicitly declaring the class an object is an instance of, so that it is predetermined (at compile time, before runtime i.e. Foo var). The opposite of this is generic programming, where the actual id of the object is yet-to-be-determined (i.e. id var). Something to keep in mind is that static typing is never necessary (straight from the book), it only improves readability, and eases the debugging process by showing what an object can and cannot do, what it can “see”. Generic programming, however, is sometimes necessary for things like arrays, where you might need...And this is where I'm confused. Is it actually necessary? I know that in Java you can enforce the type of objects contained in an array like: ArrayList&lt;Double&gt;, but in Objective-C, and I've done minimal research on this, there is no such method, and therefore, all NSArrays contain ids at compile time. If this feature (strangely called generics, even though it's static typing and not generic typing), is unavailable in Objective-C, does that mean that generic programming is sometimes necessary?
upvote count: 1
has comment: http://stackoverflow.com/comment/32197177
type: AnsweredQuestion
tagged with: java
tagged with: type-safety
has comment: http://stackoverflow.com/comment/32186604
tagged with: static-typing
has answer: http://stackoverflow.com/a/21347958
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32186578
has title: Is generic programming ever necessary?
score: 0
accepted answer: http://stackoverflow.com/a/21347958
answer count: 1
tagged with: objective-c
tagged with: generics

http://stackoverflow.com/comment/31914873
has text: @ErnestFriedman-Hill good catch, still not working though. I got to the point I have the code running without errors, but without opening any GUI either (which it should).
comment on: http://stackoverflow.com/q/21193930
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21222176
has comment: http://stackoverflow.com/comment/31963613
type: Question
tagged with: jakarta-ee
score: 0
has comment: http://stackoverflow.com/comment/31963489
has comment: http://stackoverflow.com/comment/31963521
answer count: 0
type: UnansweredQuestion
has body: I am working on a hibernate app wherein in the DAO I run the following query @SuppressWarnings("unchecked") public Collection&lt;Owner&gt; findOwners(String lastName) { return sessionFactory.getCurrentSession().createQuery("from Owner owner where owner.lastName like :lastName") .setString("lastName", lastName + "%").list(); } Fetch the owners from the db and display in the jsp. My POJO class @Entity @Table(name="OWNERS") public class Owner extends Person implements Serializable{ @Column(name="ADDRESS") private String address; @Column(name="CITY") private String city; @Column(name="TELEPHONE") private String telephone; @OneToMany(fetch=FetchType.LAZY, mappedBy="owner", cascade=CascadeType.ALL) private Set&lt;Pet&gt; pets; public String getAddress() { return this.address; } public void setAddress(String address) { this.address = address; } public String getCity() { return this.city; } public void setCity(String city) { this.city = city; } public String getTelephone() { return this.telephone; } public void setTelephone(String telephone) { this.telephone = telephone; } protected void setPetsInternal(Set&lt;Pet&gt; pets) { this.pets = pets; } protected Set&lt;Pet&gt; getPetsInternal() { //A null should not be returned; if returned will throw a NullPointerException if (this.pets == null) { this.pets = new HashSet&lt;Pet&gt;(); } return this.pets; } public List&lt;Pet&gt; getPets() { List&lt;Pet&gt; sortedPets = new ArrayList&lt;Pet&gt;(getPetsInternal()); PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true)); //returns an immutable list of sortedPets return Collections.unmodifiableList(sortedPets); } /*public void addPet(Pet pet) { getPetsInternal().add(pet); pet.setOwner(this); } */ /** * Return the Pet with the given name, or null if none found for this Owner. * * @param name to test * @return true if pet name is already in use */ public Pet getPet(String name) { return getPet(name, false); } /** * Return the Pet with the given name, or null…
tagged with: java
tagged with: hibernate
tagged with: orm
has title: Setting the values in POJO Class after fetching the values from db via hibernate

http://stackoverflow.com/comment/32019602
score: 1
has text: http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html
comment on: http://stackoverflow.com/q/21254187
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31925854
score: 1
has text: Change code of the form `catch (Exception e) { ..` to `catch (Exception e) { e.printStackTrace(); // very informative! ..`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21201068

sorting
tags question: http://stackoverflow.com/q/21343780
tags question: http://stackoverflow.com/q/21189541
tags question: http://stackoverflow.com/q/21215893
tags question: http://stackoverflow.com/q/21298318
tags question: http://stackoverflow.com/q/21275555
tags question: http://stackoverflow.com/q/21214712
tags question: http://stackoverflow.com/q/21243192
tags question: http://stackoverflow.com/q/21247573
tags question: http://stackoverflow.com/q/21193277
tags question: http://stackoverflow.com/q/21224526
tags question: http://stackoverflow.com/q/21324959
tags question: http://stackoverflow.com/q/21211820
type: Tag
tags question: http://stackoverflow.com/q/21319128
tags question: http://stackoverflow.com/q/21294213
tags question: http://stackoverflow.com/q/21195235
tags question: http://stackoverflow.com/q/21325022
tag name: sorting
tags question: http://stackoverflow.com/q/21225775
tags question: http://stackoverflow.com/q/21189029
tags question: http://stackoverflow.com/q/21334739
tags question: http://stackoverflow.com/q/21346021
tags question: http://stackoverflow.com/q/21324417
tags question: http://stackoverflow.com/q/21260589

http://stackoverflow.com/q/21190818
type: Question
tagged with: escaping
accepted answer: http://stackoverflow.com/a/21191131
tagged with: java
has comment: http://stackoverflow.com/comment/31907095
score: 0
has comment: http://stackoverflow.com/comment/31907067
has comment: http://stackoverflow.com/comment/31907206
answer count: 1
tagged with: jsp
has body: When trying to run the following bit of code: &lt;c:out value="${&lt;%=StringEscapeUtils.escapeXml(variable.content)%&gt;}" I am getting the following exception: The function escapeXml must be used with a prefix when a default namespace is not specified. Do you have any idea in how to fix it or workaround it?
has answer: http://stackoverflow.com/a/21191131
type: AnsweredQuestion
has title: escaping xml chars in jsp exception

http://stackoverflow.com/q/21349913
has comment: http://stackoverflow.com/comment/32202073
has comment: http://stackoverflow.com/comment/32241368
has body: I have an Address library (internal) that I am using, which contains an Address class. The Address class already contains a @NotEmpty validation on the postalCode. In my app I need to expand the constraints to be on city and state/province as well. I've seen suggestions on configuring it through xml, and then rebuilding the validation factory, as well as adding a custom constraint. I tried the latter with no avail (@StrictAddress is my custom constraint): public addressDTO saveAddress(@StrictAddress @RequestBody Address address) with the isValid method of the validator like so: public boolean isValid(Address address, ConstraintValidatorContext constraintContext) { if (null == address.getStreet() || address.getStreet().trim().isEmpty()) { return false; } else if (null == address.getCity() || address.getCity().trim().isEmpty()) { return false; } else if (null == address.getStateProv() || address.getStateProv().trim().isEmpty()) { return false; } else if (null == address.getPostalCode() || address.getPostalCode().trim().isEmpty()) { return false; } else if (null == address.getCountry() || address.getCountry().trim().isEmpty()) { return false; } else { return true; } } When running with this setup, I get no indication that validation was ever done (it should have failed). When I replace the @StrictAddress with the standard @Valid, then I get the original validation error on the postalCode. What am I missing? And is this a good way to approach this?
tagged with: java
has title: Override a constraint in an external jar
score: 0
tagged with: bean-validation
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/32190164
type: Question

http://stackoverflow.com/q/21343780
tagged with: sorting
has answer: http://stackoverflow.com/a/21343955
has answer: http://stackoverflow.com/a/21343824
accepted answer: http://stackoverflow.com/a/21343927
has comment: http://stackoverflow.com/comment/32179339
answer count: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/32179411
has answer: http://stackoverflow.com/a/21343927
has comment: http://stackoverflow.com/comment/32179560
has answer: http://stackoverflow.com/a/21344036
has comment: http://stackoverflow.com/comment/32179354
has comment: http://stackoverflow.com/comment/32179385
upvote count: 2
has comment: http://stackoverflow.com/comment/32179337
has comment: http://stackoverflow.com/comment/32179516
has comment: http://stackoverflow.com/comment/32179652
has comment: http://stackoverflow.com/comment/32179669
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/32179589
has body: This was given to me in a recent programming interview. I am given an unsorted array of integers with negative and positive values, and required to sort them but only for the positive values. I was wondering what some of your solutions might be without using Google. After getting home I found Arrays.sort() sorts the array in ascending order but I am not sure how to output to new array with only the positive values, as this was a requirement. I am able to print them by just printing if they are greater than -1, but how would I input them into new array without having to loop through the array and count the number of positive values to get the size of the new array, instantiate new array, then loop again to add them to new array.. This solution seems not optimal, is there a better way ? the output needs to be a new array with only positive values, that is sorted Below is what I have so far: import java.util.Arrays; public class Test { public static void main(String[] args) { // TODO Auto-generated method stub int[] unsorted = { -3, 95, -4, 20, 5, 6, 8 }; int[] sorted = unsorted; Arrays.sort(sorted); for (int s: sorted) { if (s &gt; -1) System.out.println(s); } } }
has answer: http://stackoverflow.com/a/21344120
tagged with: java
has answer: http://stackoverflow.com/a/21344042
has answer: http://stackoverflow.com/a/21346072
type: Question
has comment: http://stackoverflow.com/comment/32179629
possible better answer: http://stackoverflow.com/a/21344036
has title: sorting positive integers in unsorted array
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/32179498

list
type: Tag
tags question: http://stackoverflow.com/q/21228559
tags question: http://stackoverflow.com/q/21249220
tags question: http://stackoverflow.com/q/21237572
tags question: http://stackoverflow.com/q/21195235
tags question: http://stackoverflow.com/q/21262043
tags question: http://stackoverflow.com/q/21277587
tags question: http://stackoverflow.com/q/21249827
tags question: http://stackoverflow.com/q/21271802
tags question: http://stackoverflow.com/q/21241653
tags question: http://stackoverflow.com/q/21282785
tag name: list
tags question: http://stackoverflow.com/q/21248590
tags question: http://stackoverflow.com/q/21207868
tags question: http://stackoverflow.com/q/21251809
tags question: http://stackoverflow.com/q/21190153
tags question: http://stackoverflow.com/q/21297925
tags question: http://stackoverflow.com/q/21342033
tags question: http://stackoverflow.com/q/21185312
tags question: http://stackoverflow.com/q/21201846
tags question: http://stackoverflow.com/q/21328038
tags question: http://stackoverflow.com/q/21293268
tags question: http://stackoverflow.com/q/21201415
tags question: http://stackoverflow.com/q/21215681
tags question: http://stackoverflow.com/q/21220873
tags question: http://stackoverflow.com/q/21218364
tags question: http://stackoverflow.com/q/21222398
tags question: http://stackoverflow.com/q/21228641
tags question: http://stackoverflow.com/q/21292248

http://stackoverflow.com/comment/32039763
has text: Ok.. I'll post it then. For at least the points :)
comment on: http://stackoverflow.com/q/21248443
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21258803
has answer: http://stackoverflow.com/a/21259261
answer count: 4
accepted answer: http://stackoverflow.com/a/21278624
type: AnsweredQuestion
tagged with: jpa
has answer: http://stackoverflow.com/a/21259734
tagged with: jpql
linked to: http://stackoverflow.com/q/4750371
type: Question
linked to: http://stackoverflow.com/q/10202456
has comment: http://stackoverflow.com/comment/32027769
score: 0
has body: I have for example 2 entities. A entity (Mysql Table name="A") B entity (Mysql Table name="B") I want fetch data from A table where it is not in the B table. I wrote sql and it is working. SELECT * FROM A LEFT OUTER JOIN B ON A.id = B.a_id WHERE B.id IS null How to realize it with JPQL?
tagged with: java
has answer: http://stackoverflow.com/a/21278624
tagged with: mysql
possible better answer: http://stackoverflow.com/a/21259016
has comment: http://stackoverflow.com/comment/32028697
has title: how to create jpql with left outer join
has answer: http://stackoverflow.com/a/21259016
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/32027899

http://stackoverflow.com/comment/33545341
type: QuestionComment
has text: no, this is not an active form elements. and Acrofields class is not parse it corrected. Is any other option for extract not active forms elements?
comment on: http://stackoverflow.com/q/21285072
score: 0
type: Comment

http://stackoverflow.com/q/21188841
accepted answer: http://stackoverflow.com/a/21194084
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31904190
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31903490
has comment: http://stackoverflow.com/comment/31904000
has title: how to save state of view in listview
tagged with: listview
score: 0
tagged with: android-listview
answer count: 1
has comment: http://stackoverflow.com/comment/31904053
has answer: http://stackoverflow.com/a/21194084
has body: In my app, I display a check list using a ListView. Every row in my check list is represented by a model, which is an object of the ChecklistenPunkt class. There are three different types of rows: a headline an additional text a question The third type has two Buttons in it which are linked by two OnClickListeners: The first Button is for a positive answer, the second one for a negative answer. When the view is build, both of them are gray, indicating that this question is not yet answered. If the left Buttonis clicked it turns green and the second one is getting a dark gray background. If the right Button is clicked it turns red and the first one is getting a dark gray background. When a Button is clicked the answering state is saved as an ChecklistenPunktStatus. This is an Enum which has three entries (okay, not okay, not answered). Here is a little image of the Buttons in three rows, showing the different states: Here is my adapter code: public class ChecklisteAdapter extends ArrayAdapter<Object> { private List<ChecklistenPunkt> list; private SparseArray<ChecklistenPunktStatus> sparseArray; private Context context; public ChecklisteAdapter(Context context, List<ChecklistenPunkt> objects) { super(context, 0); list = objects; sparseArray = new SparseArray<ChecklistenPunktStatus>(); for (int i = 0; i < list.size(); i++) { sparseArray.put(i, ChecklistenPunktStatus.NICHT_SELEKTIERT); } this.context = context; } @Override public int getCount() { return list.size(); } @Override public ChecklistenPunkt getItem(int position) { return list.get(position); } @Override public int getItemViewType(int position) { ChecklistenPunkt p = (ChecklistenPunkt) list.get(position); return p.getTyp(); } @Override public int getViewTypeCount() { return 3; } @Override public View getView(final int position, View convertView, ViewGroup parent) { View v = null; int type = getItemViewType(position); if (convertView == null) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemSer…
tagged with: android

http://stackoverflow.com/comment/32186817
score: 0
type: Comment
type: QuestionComment
has text: It seems rahul that some script is running on fb which is commented the data of the fb.If you try to view the page(page.asXml()) you will find that all the SPAN which are showing the data is commented.
comment on: http://stackoverflow.com/q/21345866

http://stackoverflow.com/a/21251026
answers question: http://stackoverflow.com/q/21250973
downvote count: 0
type: Answer
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/32014461
has body: Integer uses caching of small values in range of -128 to 127, and so you get same instance for small values such as 100. For the values outside this range, a new Integer instance is created and returned.

http://stackoverflow.com/a/21311001
has body: I think this is your type value (type="com.mytest.MyPropertyTester") in your propertyTester definition. The object to be tested must be an instance of the type (or adapt to) before the tester will be called (the help is very vague about this!). Use type="org.eclipse.core.runtime.IAdaptable" which will match most objects or type="org.eclipse.core.resources.IResource" to just match resources.
has comment: http://stackoverflow.com/comment/42954217
downvote count: 0
has comment: http://stackoverflow.com/comment/42954122
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21310743
accepted answer of: http://stackoverflow.com/q/21310743
type: Answer
score: 6
upvote count: 6

http://stackoverflow.com/comment/31903859
comment on: http://stackoverflow.com/a/21188426
type: Comment
has text: @igor It will rollback on runtime exceptions and whatever else you tell it to rollback on. It's not generally good practice to catch anything other than `Exception` and `RuntimeException` types.
score: 0
type: AnswerComment

http://stackoverflow.com/a/68063092
answers question: http://stackoverflow.com/q/21241683
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/132884266
downvote count: 0
has body: as suggested by pojo-guy Solution is to implement StepExecutionListener and Override beforeStep method to set stepExecution @Override public void beforeStep(StepExecution stepExecution) { this.stepExecution = stepExecution; }
type: Answer

http://stackoverflow.com/comment/32002188
has text: _Please comment on_ is not a good way to start an SO question. Do you have a specific question for us to answer?
type: Comment
comment on: http://stackoverflow.com/q/21243858
type: QuestionComment
score: 5

http://stackoverflow.com/a/21340195
upvote count: 1
answers question: http://stackoverflow.com/q/21340165
downvote count: 0
score: 1
has body: You have to use toCharArray to get a char[] back; the problem is where you put it after you extract it. Change your array variable to be a char[][], and define it as such: char[][] array = new char[2][5]; Note that the result won't exactly be {{H},{E},{L},{L},{O}},{{W},{O},{R},{L},{D}}; it'd be more like {{H, E, L, L, O}},{{W, O, R, L ,D}}.
type: Answer

http://stackoverflow.com/a/21433866
accepted answer of: http://stackoverflow.com/q/21330915
type: Answer
score: 0
has body: Turns out I had a JQuery statement in one of the Ajax calls that disabled the file input field. When this was removed the file became available again on the server side. So disabling the file input field causes it to become unavailable for some reason.
answers question: http://stackoverflow.com/q/21330915
type: AcceptedAnswer

http://stackoverflow.com/comment/32097956
has text: Use two parameter form of `indexOf` and start searching at previously found position + 1.
comment on: http://stackoverflow.com/q/21298187
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/21329234
tagged with: swing
tagged with: integration
type: Question
type: AnsweredQuestion
has body: I tried to integrate javaFX application into Swing application, and successfully done. But the problem is, I cannot resolve the problem that javaFX related panel is flashing(repainting so slow) when mouseover a button. Is there any solution, or will I try to integrate Swing into javaFX? Which will be annoying. private void initFX(JFXPanel fxPanel) throws IOException { // This method is invoked on the JavaFX thread scene = createScene(); fxPanel.setScene(scene); } public MainFrame() { Panel container = new Panel(); container.setLayout(null); try { final JFXPanel panel = new JFXPanel(); Insets insets = container.getInsets(); container.add(panel); JApplet mapApplet = (JApplet)Class.forName("samples.mainApp.MainApplet").newInstance(); container.add(mapApplet); //Display Applet add(container); mapApplet.setBounds(800, 0, 566, 720); panel.setBounds(0, 0, 800, 720); mapApplet.init(); mapApplet.start(); Platform.runLater(new Runnable() { @Override public void run() { try { initFX(panel); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { e.printStackTrace(); } //button.setVisible(false); catch (Exception e) { e.printStackTrace(); } } private Scene createScene() throws IOException { root = new Group(); scene = new Scene(root, Color.ALICEBLUE); Button btn1 = new Button("Connect"); root.getChildren().addAll(btn1); }
has answer: http://stackoverflow.com/a/21329694
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/21329694
has comment: http://stackoverflow.com/comment/32157747
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32155944
favorite count: 0
has title: JavaFX flashes(repainting so lately) onmouseover with integration Swing
has comment: http://stackoverflow.com/comment/32153325
score: 2
upvote count: 2

http://stackoverflow.com/comment/32144963
type: QuestionComment
comment on: http://stackoverflow.com/q/21305453
has text: What are your values for maxMemSize and maxFileSize?
score: 0
type: Comment

http://stackoverflow.com/q/21190458
has comment: http://stackoverflow.com/comment/31981336
has answer: http://stackoverflow.com/a/21202878
type: Question
has comment: http://stackoverflow.com/comment/31906738
has answer: http://stackoverflow.com/a/37858766
downvote count: 0
has comment: http://stackoverflow.com/comment/31919642
has title: Attach proxy to an existing object?
tagged with: javassist
tagged with: proxy
possible better answer: http://stackoverflow.com/a/37858766
answer count: 3
has body: My plan is to write a annotation based caching framework which caches the return values of methods. When a method gets called the first time with a specific parameter, then the cache should store the methods return value. When the same method gets called a second time with the same parameter then the method should return the previously calculated result from the cache and not execute its code again. My annotations looks like this: @Cached(cacheProvider = HashMapCacheProvider.class) public Product getProduct(String productId){ // Scraping the product from a website ... return product; } At the moment my little framework is working already fine. I'm using Javassist to create proxy objects of classes which are containing annotated methods. In order to create a new cached object I'm using this code: public static &lt;T&gt; T newCachedInstance(Class&lt;T&gt; clazz) throws InstantiationException, IllegalAccessException { ProxyFactory factory = new ProxyFactory(); factory.setSuperclass(clazz); factory.setFilter(new MethodFilter() { public boolean isHandled(Method m) { // ignore finalize() return !m.getName().equals("finalize"); } }); Class&lt;T&gt; c = factory.createClass(); T proxy = c.newInstance(); ((ProxyObject) proxy).setHandler(new CachedMethodHandler()); return proxy; } The problem is, that I can just create new cached objects by this method and not by the constructor of their classes. Therefore I'm searching a solution to attach already existing objects to the caching mechanism. And here is my question: Is it possible to attach a proxy to an existing object? In my understanding this should not be possible without updating all existing references to this object. My other approach is to use bytecode manipulation in order to manipulate the code of the annotated methods like this: public class Hello { public void say() { System.out.println("Hello"); } } public class Test { public static void main(String[] args) throws Exception { ClassPool cp = ClassPool.getDefault(); …
accepted answer: http://stackoverflow.com/a/21202878
tagged with: bytecode-manipulation
favorite count: 0
has answer: http://stackoverflow.com/a/37925171
has comment: http://stackoverflow.com/comment/31928572
upvote count: 7
has comment: http://stackoverflow.com/comment/31959996
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31906783
has comment: http://stackoverflow.com/comment/31936684
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/31929518

http://stackoverflow.com/q/21259264
linked to: http://stackoverflow.com/q/1532461
has comment: http://stackoverflow.com/comment/32028392
accepted answer: http://stackoverflow.com/a/21260343
answer count: 1
tagged with: jackson
has body: I am pulling a RESTful API in JSON format and traverse through the nodes retrieve the info that I am looking for. But there is one specific node that always start with "null" even if the JSON document looks fine and that specific node doesn't contain any null value. I am novice on using Jackson for parsing JSON document and I can't find out why the specific node always return "null" in front of the node value? The node I have problem with is the StationName, which return for example nullHägerstensåsen:. The result that I hope to retrieve is Hägerstensåsen: without the "null". The raw JSON document from the RESTful service: { "Departure": { "xmlnsxsi": "http://www.w3.org/2001/XMLSchema-instance", "xmlnsxsd": "http://www.w3.org/2001/XMLSchema", "xmlns": "http://www1.sl.se/realtidws/", "LatestUpdate": "2014-01-21T11:34:36.7189974+01:00", "ExecutionTime": "00:00:00.0937512", "Buses": {}, "Metros": { "Metro": [ { "SiteId": "9262", "TransportMode": "METRO", "StationName": "Hägerstensåsen", "GroupOfLine": "Tunnelbanans röda linje", "DisplayRow1": "14 Fruängen 2 min", "DisplayRow2": "14 Fruängen 12 min, 14 Fruängen 23 min" }, { "SiteId": "9262", "TransportMode": "METRO", "StationName": "Hägerstensåsen", "GroupOfLine": "Tunnelbanans röda linje", "DisplayRow1": "14 Mörby centrum 2 min.", "DisplayRow2": "14 Mörby centrum 12 min. 14 Mörby centrum 22 min." } ] }, "Trains": {}, "Trams": {}, "TrainError": { "HasError": "true", "FaultCode": "Client", "ErrorLevel": "Error", "ErrorCode": "1000", "ErrorSource": "/realtidws/RealTimeService.asmx/GetDepartures", "ErrorMessage": "Connection string is missing" }, "TramError": { "HasError": "true", "FaultCode": "Client", "ErrorLevel": "Error", "ErrorCode": "1000", "ErrorSource": "/realtidws/RealTimeService.asmx/GetDepartures", "ErrorMessage": "Connection string is missing" } } } My code for parsing the nodes: ... result = null; JsonNode node = mapper.readTree(slRealTimeClient.getJson(depatureSite)); node = node.path("Departure").path("Metro…
has title: Travesing JSON with Jackson always return null for one specific node
has comment: http://stackoverflow.com/comment/32029130
has comment: http://stackoverflow.com/comment/32028808
type: AnsweredQuestion
score: 0
type: Question
tagged with: jakarta-ee
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32028420
has answer: http://stackoverflow.com/a/21260343

http://stackoverflow.com/a/21292413
answers question: http://stackoverflow.com/q/21291961
type: Answer
upvote count: 4
has body: "This code works fine with the regular property tag in beans xml file. But I try to rewrite bean xml configuration using p-namespace I get this error. I can't figure out whats wrong" Looks like you haven't added the p namespace to your xml xmlns:p="http://www.springframework.org/schema/p"
downvote count: 0
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/21291961

http://stackoverflow.com/q/21315276
score: 0
answer count: 1
favorite count: 0
has title: getting error file not found in spring
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/21315369
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32127357
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has body: I am making a simple program in spring getting this error . ---- 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 'studentbean' defined in class path resource [META-INF/test.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'name' of bean class [test]: Bean property 'name' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1361) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) at org.sprin…
has comment: http://stackoverflow.com/comment/32127305
accepted answer: http://stackoverflow.com/a/21315369

http://stackoverflow.com/a/21274175
has comment: http://stackoverflow.com/comment/32095022
has comment: http://stackoverflow.com/comment/32270187
has comment: http://stackoverflow.com/comment/32094966
has body: I think you don't have the WEB-INF/tags folder which Roo would install in your project. i.e there is no form in the tags folder in your WEB-INF. Please double check it
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21273624

http://stackoverflow.com/comment/32116742
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/21308891
type: Comment
has text: Additional info: Use UTC (not GMT) to store the data. You can get the value to save by calling `getMillis()`. When you want to display the data, use the millisecond value plus the target time zone.

http://stackoverflow.com/a/21247612
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21247405
has body: public static int[] range(int[] a, int low, int high) { Arrays.sort(a); // sort the aray first int length = 0; // number of numbers within the range for (int i = 0; i &lt; a.length; i++) { // check all ints in the array // if the int is in the range, add 1 to the length if (low &lt;= a[i] &amp;&amp; high &gt;= a[i]) { length++; } } // determine array size with number of numbers found within the range int[] rangeArray = new int[length]; for (int i = 0; i &lt; a.length; i++) // for every int in the array { if (low &lt;= a[i] &amp;&amp; high &gt;= a[i]) // if number is between the range { rangeArray[i] = a[i]; // add it to the range array } } return rangeArray; } public static void main(String args[]) { int[] array = {2, 8, 7, 3, 4}; int[] rangeArray = range(array, 1, 5); System.out.print( Arrays.toString(rangeArray) ); } Output: [2, 3, 4]

http://stackoverflow.com/q/21312121
has title: ExceptionMapper not invoked if receiving invalid JSon
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/27146650
tagged with: jersey-2.0
tagged with: jax-rs
tagged with: jackson
has comment: http://stackoverflow.com/comment/32123816
linked to: http://stackoverflow.com/q/24397647
has answer: http://stackoverflow.com/a/21313693
has comment: http://stackoverflow.com/comment/32123073
accepted answer: http://stackoverflow.com/a/21313693
has comment: http://stackoverflow.com/comment/32122557
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27146650
has comment: http://stackoverflow.com/comment/118256578
has body: I am using Jersey 2.5.1 with Jackson 2.2. for building JSON Rest web services. I kind of got it up and running also with 2 ExceptionMappers but for a "not-json" request the application is not throwing any exception! ExceptionMapper Will be invoked if e.g. a NullPointerException is thrown ExceptionMapper Will be invoked if there s a problem with the JSon Mapping My Problem: 1. Request Body: {} works 2. Request Body: {} with an application side NullPointer invoked the first exception mapper 3. Request Body: "jibberish" does not invoke anything (not caught by any ExceptionMapper) cause no Exception is thrown. Unfortunately the response body is sth like : Unrecognized field "xxx" (class com.sample.MyDto), not marked as ignorable (9 known properties... ....> but I want to customize the error msg since I am always returning a JSon object.
type: Question
tagged with: jersey
tagged with: java

http://stackoverflow.com/q/21208396
possible better answer: http://stackoverflow.com/a/21208744
downvote count: 0
favorite count: 0
tagged with: jlabel
has comment: http://stackoverflow.com/comment/31938954
has answer: http://stackoverflow.com/a/21208437
has comment: http://stackoverflow.com/comment/31938484
has comment: http://stackoverflow.com/comment/31938554
type: AnsweredQuestion
tagged with: null-layout-manager
score: 1
tagged with: java
has body: I have all of the labels working correctly but the userLabel[3] is not positioning properly No matter what I do, the label "Color:" always shows up on the frame with a x-coordinate of 0 and a y-coordinate that is half way down the frame. JLabel[] userLabel = new JLabel[4]; for(int p = 0; p &lt; userLabel.length; p++){ userLabel[p] = new JLabel(); userLabel[p].setSize(100,50); frameSetUp.add(userLabel[p]); } userLabel[0].setText("Width of Frame:"); userLabel[1].setText("Height of Frame:"); userLabel[2].setText("# OF Balls:"); userLabel[3].setText("Color:"); userLabel[0].setLocation(10,35); userLabel[1].setLocation(10,85); userLabel[2].setLocation(10,135); userLabel[3].setLocation(0,0); //no matter what coordinates I change this too, it wont reposition Image: [IMG]http://i41.tinypic.com/23jfo9l.png[/IMG] http://i41.tinypic.com/23jfo9l.png
upvote count: 1
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/31938458
accepted answer: http://stackoverflow.com/a/21208437
has answer: http://stackoverflow.com/a/21208744
answer count: 2
has title: setLocation of Label
has comment: http://stackoverflow.com/comment/31938610

http://stackoverflow.com/a/21217598
type: Answer
answers question: http://stackoverflow.com/q/21211169
score: 0
has body: I think you forgot to initialize the button object before using it. btnChart = (Button) findViewById(R.id.buttonId);

http://stackoverflow.com/comment/32166505
comment on: http://stackoverflow.com/a/21323811
has text: It is a clever idea but in order for this to work I would have to distribute two jar files to my user initially. The wrapper and the current version of the main application.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40475361
has text: I have a similar requirement. Don't want a full web server, just to parse an HTTP request. Any library that can do this (in isolation without the need to start a socket server and...).
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21313643

http://stackoverflow.com/a/21307689
downvote count: 0
has body: Line numbers are compiled into the .class files and getting them is certainly more work than not doing so. You can get a stacktrace without throwing an exception via Thread#getStackTrace() but that should have roughly the same cost as creating an exception (you don't need to throw and catch it). Collecting the information can be quite expensive as mentioned in How Expensive is Thread.getStackTrace()? But excessive logging alone can already slow down the system drastically. Is this a performance issue in a high performance system to include the file line number? You should test it. If it is not already a performance issue without line numbers, chances are that it is no issue with. It all depends on where and how often you log. The documentation also mentions line numbers Generating the line number information is not particularly fast. Thus, its use should be avoided unless execution speed is not an issue.
answers question: http://stackoverflow.com/q/21306839
score: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/21306839
type: AcceptedAnswer
upvote count: 5

http://stackoverflow.com/comment/32295091
type: Comment
type: QuestionComment
has text: @StaxMan: Thanks for your response. Since for my purposes I only need to track modules, I basically did eactly what you suggest, which wasn't very difficult for my limited needs. If you'd like to make your comment an answers, I'll accept it.
comment on: http://stackoverflow.com/q/21292867
score: 0

http://stackoverflow.com/q/21343807
has comment: http://stackoverflow.com/comment/32179409
has comment: http://stackoverflow.com/comment/32179391
has answer: http://stackoverflow.com/a/21343844
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21343836
has answer: http://stackoverflow.com/a/39524168
has answer: http://stackoverflow.com/a/21343859
has comment: http://stackoverflow.com/comment/32179389
has title: A easier and efficient way to do this?
tagged with: java
has answer: http://stackoverflow.com/a/21343861
type: Question
has body: Ok, id consider myself knowing the basics and some advanced Java but still dont have the courage to start programming my ideas that I have. This is a simple programme i came up with that basically outputs the amount of specific letter your text has (i think i worded that wrong...) this is my code: public class gene { public static void main(String[] args) { String[] phrases = {"hello", "egg", "learning", "ferrero", "rocher", "Horologe", "Twinling"}; int a=0; int b=0; int c=0; int d=0; int e=0; int f=0; int g=0; int h=0; int i=0; int j=0; int k=0; int l=0; int m=0; int n=0; int o=0; int p=0; int q=0; int r=0; int s=0; int t=0; int u=0; int v=0; int w=0; int x=0; int y=0; int z=0; for(int ii =0; ii &lt;phrases.length; ii++){ char[] charphrases = phrases[ii].toCharArray(); for(int iii = 0; iii&lt;charphrases.length; iii++){ switch(charphrases[iii]){ case ('a'): a++; break; case ('b'): b++; break; case ('c'): c++; break; case ('d'): d++; break; case ('e'): e++; break; case ('f'): f++; break; case ('g'): g++; break; case ('h'): h++; break; case ('i'): i++; break; case ('j'): j++; break; case ('k'): k++; break; case ('l'): l++; break; case ('m'): m++; break; case ('n'): n++; break; case ('o'): o++; break; case ('p'): p++; break; case ('q'): q++; break; case ('r'): r++; break; case ('s'): s++; break; case ('t'): t++; break; case ('u'): u++; break; case ('v'): v++; break; case ('w'): w++; break; case ('x'): x++; break; case ('y'): y++; break; case ('z'): z++; break; } } } System.out.println("A:" + a + "\n" + "B:" + b + "\n" +"C:" + c + "\n" +"D:" + d + "\n" +"E:" + e + "\n" +"F:" + f + "\n" +"G:" + g + "\n" +"H:" + h + "\n" +"I:" + i+ "\n" +"J:" + j + "\n" +"K:" + k + "\n" +"L:" + l + "\n" +"M:" + m + "\n" +"N:" + n + "\n" +"O:" + o + "\n" +"P:" + p + "\n" +"Q:" + q + "\n" +"R:" + r+ "\n" +"S:" + s + "\n" +"T:" + t + "\n" +"U:" + u + "\n" +"V:" + v + "\n" +"W:" + w + "\n" +"X:" + x + "\n" +"Y:" + y + "\n" +"Z:" + z + "\n" + z); } } As you can see, its it VERY long for such …
has answer: http://stackoverflow.com/a/21344134
answer count: 6
has comment: http://stackoverflow.com/comment/32180523
score: 0

http://stackoverflow.com/a/21206072
score: 1
accepted answer of: http://stackoverflow.com/q/21205569
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32094281
has body: I don't think you need a revolute joint for this, but a rope joint (b2RopeJoint). A revolute joint will make the two object rotate around a single point. The rope joint will keep one swinging from another like a pendulum. You need to make the pendulum attach with a single rope joint to a static body. Then cut the rope joint when you want it to fall. If gravity is turned on and you don't have any retarding forces, the pendulum should continue indefinitely (or for a really long time depending on numerics). Take a look at this post that was just done for something like this. Note that the code is also posted on github here. In that case, there were two extra rope joints added to constrain the body so that it could not move beyond the end of the initial swing. I don't think you need those. To create the pendulum yourself, use something like: // Calculate the local position of the // top of screen in the local space // of the ground box. CCSize scrSize = CCDirector::sharedDirector()-&gt;getWinSize(); b2Vec2 groundWorldPos = b2Vec2((scrSize.width/2)/PTM_RATIO,(scrSize.height)/PTM_RATIO); b2Vec2 groundLocalPos = m_pGround-&gt;GetLocalPoint(groundWorldPos); // Now create the main swinging joint. b2RopeJointDef jointDef; jointDef.bodyA = m_pGround; jointDef.bodyB = body; jointDef.localAnchorA = groundLocalPos; jointDef.localAnchorB = b2Vec2(0.0f,0.0f); jointDef.maxLength = (groundWorldPos-body-&gt;GetWorldCenter()).Length(); jointDef.collideConnected = true; world-&gt;CreateJoint(&amp;jointDef); NOTE This is in C++, not java (for libgdx), but the approach should be sound and you just have to map the "->" onto the "." where needed. In my example, it ended up looking like this (image liberated from other posted answer): Was this helpful?
has comment: http://stackoverflow.com/comment/31938638
answers question: http://stackoverflow.com/q/21205569
type: Answer
has comment: http://stackoverflow.com/comment/32092390
upvote count: 1
has comment: http://stackoverflow.com/comment/31937094

http://stackoverflow.com/q/21186645
tagged with: parallel-processing
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21187003
tagged with: java
type: Question
has title: ThreadPoolExecutor and Android's thread priority
accepted answer: http://stackoverflow.com/a/21187003
downvote count: 0
answer count: 1
has body: I'd like to make a ThreadPollExecutor that executes tasks with a given priority Process.setThreadPriority(int). How should I do it? Adding the call to setThreadPriority at the start of each runnable sent to the thread poll? I've also considered using a custom thread factory like this: private final static class ProcessPriorityThreadFactory implements ThreadFactory { private final int threadPriority; public ProcessPriorityThreadFactory(int threadPriority) { super(); this.threadPriority = threadPriority; } @Override public Thread newThread(Runnable r) { return new Thread(new PriorityChangeWrapper(r, threadPriority)); } private final static class PriorityChangeWrapper implements Runnable { private final Runnable originalRunnable; private final int threadPriority; public PriorityChangeWrapper(Runnable originalRunnable, int threadPriority) { super(); this.originalRunnable = originalRunnable; this.threadPriority = threadPriority; } @Override public void run() { Process.setThreadPriority(threadPriority); originalRunnable.run(); } } } What is the best solution for this problem? Thanks
favorite count: 0
upvote count: 2
tagged with: multithreading
tagged with: android

http://stackoverflow.com/comment/32026158
has text: you should ask that as a separate question
comment on: http://stackoverflow.com/q/21254203
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32180747
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21344712
has text: Yes, didn't looked at this :) Thanks.
type: AnswerComment

http://stackoverflow.com/comment/73341557
score: 0
type: AnswerComment
has text: Great answer though slight correction - ReplaySubject can also specify a buffer in the create(), which will be the number of items to emit on subscription
type: Comment
comment on: http://stackoverflow.com/a/21325167

http://stackoverflow.com/comment/32228790
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21346736
has text: @user3234240 Hahaha, no problem. I was there not too long ago. [codingBat](http://codingbat.com/) has some really good practice problems and immediate feedback. That's probably your best bet to just work on syntax. If you're still trying to understand objects and the language, the [java tutorials](http://docs.oracle.com/javase/tutorial/java/concepts/index.html) are really good. They have lots of tutorials on more specific concepts or packages that you may want to learn about. I was there a lot about a year ago learning the basics of swing.

http://stackoverflow.com/q/21325983
favorite count: 0
has answer: http://stackoverflow.com/a/21326041
tagged with: classcastexception
tagged with: android
type: AnsweredQuestion
has body: I want to create a method to add data into sqlite database which take HashMap&lt;String,Person&gt; as argument in a class. From another class, I want to add person details in HashMap&lt;String,Person&gt; that can be used by my database handler class. I have search a lot and tried many examples for this, but couldn't get the solution. Now i'm bit confused how to do this. I am doing this in following manner now, and getting ClassCastException. Class 1 :PersonDataSource.java public long createContact(HashMap&lt;String, Contact&gt; queryValues) { ContentValues values = new ContentValues(); Contact val = Contact.class.cast(queryValues); values.put( MySQLiteHelper.COLUMN_FIRST_NAME, val.getFirstName()); values.put( MySQLiteHelper.COLUMN_LAST_NAME, val.getLastName()); values.put( MySQLiteHelper.COLUMN_NICK_NAME, val.getNickName()); values.put( MySQLiteHelper.COLUMN_BIRTHDATE, val.getBirthDate()); values.put( MySQLiteHelper.COLUMN_PRIMARY_CONTACT, val.getPrimaryContact()); long insertId = database.insert(MySQLiteHelper.TABLE_NAME, null, values); return insertId; } And form another class : datasource = new ContactDataSource(this); datasource.open(); Cursor phones = getContentResolver().query(Phone.CONTENT_URI, PROJECTION,null,null, Phone.DISPLAY_NAME); while (phones.moveToNext()) { String name=phones.getString(phones.getColumnIndex(Phone.DISPLAY_NAME)); String phoneNumber = phones.getString(phones.getColumnIndex(Phone.NUMBER)); Person data = new Person(); data.setNickName(name); data.setPrimaryContact(phoneNumber); HashMap&lt;String, Person&gt; map = new HashMap&lt;String, Person&gt;(); map.put("data", data); long id = datasource.createContact(map); Log.e(CLASS_NAME, "Contact id :" + String.valueOf(id)); } phones.close(); datasource.close(); How can i solve this ?
score: 1
tagged with: java
type: Question
tagged with: hashmap
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/21326041
has title: how to add and get class's object values in HashMap
upvote count: 1
tagged with: sqlite

http://stackoverflow.com/comment/32025533
type: Comment
has text: added driver which i am using
type: AnswerComment
comment on: http://stackoverflow.com/a/21257593
score: 0

http://stackoverflow.com/comment/31934650
type: AnswerComment
comment on: http://stackoverflow.com/a/21206263
has text: @SillyFreak The JIT can optimise dynamically based on the class actually used. If the class was sub-classed it can still inline the method.
type: Comment
score: 1

http://stackoverflow.com/a/21249116
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21245072
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32054243
has comment: http://stackoverflow.com/comment/32041861
type: Answer
has comment: http://stackoverflow.com/comment/32064514
has comment: http://stackoverflow.com/comment/32071202
has body: Here first you should check the total no of items For eg: 20 items then initially setLimit =5 and in your "Loadmore "Async task, you should skip previous values like "setSkip".So that it doesnt load the previous 5 items and query the next 5 items So like that ,you can check the last block is loaded or not and once 20 items are loaded,remove the footer. I hope this helps.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21245072

http://stackoverflow.com/q/21334793
has comment: http://stackoverflow.com/comment/32161936
has answer: http://stackoverflow.com/a/21334911
has answer: http://stackoverflow.com/a/42618082
tagged with: java
has comment: http://stackoverflow.com/comment/32163188
has comment: http://stackoverflow.com/comment/32162579
has answer: http://stackoverflow.com/a/21335275
tagged with: api
has comment: http://stackoverflow.com/comment/66319136
downvote count: 1
has comment: http://stackoverflow.com/comment/32162212
has comment: http://stackoverflow.com/comment/32161865
has comment: http://stackoverflow.com/comment/32162135
tagged with: java-io
favorite count: 0
upvote count: 9
possible better answer: http://stackoverflow.com/a/21334911
has body: IMO having both of these methods is redundant and really unclear! i can't quite understand why both of these methods are designed in Files API ?? Files.exist(..) returns true if file really exist and false if not exist or not having permission. so why in the hell there is a Files.notExist(..) ?? Oracle Docs says !Files.exists(…) is not equivalent to Files.notExists(…)!? maybe there is something that i couldn't understand well!! what is benefit of using notExist() when there is an exist() method?
has comment: http://stackoverflow.com/comment/32161914
has comment: http://stackoverflow.com/comment/32161920
has comment: http://stackoverflow.com/comment/32161972
has answer: http://stackoverflow.com/a/21334883
accepted answer: http://stackoverflow.com/a/21334883
answer count: 4
score: 8
type: AnsweredQuestion
has title: Why both Files.exists(…) and Files.notExists(…)?
type: Question

http://stackoverflow.com/q/21281149
tagged with: trading
upvote count: 2
has title: Running the SimulationStarter class in the AlgoTrader
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/21281453
tagged with: java
tagged with: indexoutofboundsexception
tagged with: eclipse
type: Question
answer count: 2
tagged with: algorithm
downvote count: 0
has answer: http://stackoverflow.com/a/21283473
has body: I am trying to run the SimulationStarted class with the moving average strategy in the open source edition of AlgoTrader. When I start the SimulationStarter I get ArrayIndexOutOfBoundsException. I am trying to run it through eclipse. From AlgoTrader they run it with the following command java.exe -cp target/classes;../../AlgoTrader/code/target/classes;../../AlgoTrader/code/lib/*;target/* -Dsimulation=true -DdataSource.dataSet=1year com.algoTrader.starter.SimulationStarter simulateWithCurrentParams So is it even possible to run it through eclipse or this is the only way? If anyone has any ideas or suggestions it will be much appreciated. Here is the code for the SimulationStarter and ServiceLocator classes. package com.algoTrader.starter; import org.apache.commons.math.*; import org.apache.log4j.Logger; import com.algoTrader.ServiceLocator; import com.algoTrader.service.SimulationServiceImpl; import com.algoTrader.util.MyLogger; public class SimulationStarter { private static Logger logger = MyLogger.getLogger(SimulationServiceImpl.class.getName()); public static void main(String[] args) throws ConvergenceException, FunctionEvaluationException { ServiceLocator.serverInstance().init("beanRefFactorySimulation.xml"); if ("simulateWithCurrentParams".equals(args[0])) { ServiceLocator.serverInstance().getSimulationService().simulateWithCurrentParams(); } else if ("optimizeSingleParamLinear".equals(args[0])) { String strategyName = args[1]; for (int i = 2; i &lt; args.length; i++) { String[] params = args[i].split(":"); String parameter = params[0]; double min = Double.parseDouble(params[1]); double max = Double.parseDouble(params[2]); double increment = Double.parseDouble(params[3]); ServiceLocator.serverInstance().getSimulationService().optimizeSingleParamLinear(strategyName, parameter, min, max, increment); } } ServiceLocator.serverInstance().shutdown(); } } And the service locator class package com.algoTrader; import com.algoTrader.entity.StrategyImpl; import com.algoTr…
possible better answer: http://stackoverflow.com/a/21283473
has answer: http://stackoverflow.com/a/21281453
favorite count: 0

http://stackoverflow.com/q/21222278
accepted answer: http://stackoverflow.com/a/21229611
tagged with: lwjgl
upvote count: 1
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/21224046
tagged with: 2d
tagged with: opengl
has comment: http://stackoverflow.com/comment/31964575
tagged with: java
tagged with: scaling
score: 0
answer count: 2
has body: I am making a platformer which I started developing with default java functions, but now am switching to OpenGL for everything. I have done everything like I always do with OpenGL, and what I did works fine in my other OpenGL projects. Now my problem is that LWJGL/OpenGL is scaling my textures in a very strange way. It seems to be related to my screen's aspect ratio. (8:5) I already had to flip the screen to make it the right way round, but as you can see the text is working fine, it's just the textured rect, and it isn't even straight on the bottom. Here are the most important snippets from the two classes which actually use OpenGL: Metamorph.java (main class) public static void initGL() { glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, Display.getWidth(), 0, Display.getHeight(), 1, -1); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glMatrixMode(GL_MODELVIEW); glClearColor(0, 0, 0, 1); glDisable(GL_DEPTH_TEST); } public void render() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glScalef(1.0f, -1.0f, 1.0f); glTranslatef(0f, -720f, 0f); //glScalef(1280f/800, 720f/500, 1f); renderer.render(); Display.update(); Display.sync(60); } Renderer.java (rendering stuff) private void renderMainMenuWithGL() { //System.out.println("Main Menu!"); glColor4f(1, 1, 1, 1); try { Texture bg = loadTexture("mockery"); bg.bind(); } catch (Exception e) { e.printStackTrace(); } //drawQuad(0, 0, 1280, 720, 0, 0, 1280, 720); glPushMatrix(); { glBegin(GL_QUADS); glTexCoord2f(0, 0);glVertex2f(0, 0); glTexCoord2f(0, 1);glVertex2f(0, 720); glTexCoord2f(1, 1);glVertex2f(1280, 720); glTexCoord2f(1, 0);glVertex2f(1280, 0); glEnd(); } glPopMatrix(); TrueTypeFont f = loadFont(MAINFONT, Font.PLAIN, 50); TrueTypeFont fb = loadFont(MAINFONT, Font.PLAIN, 48); int sel = -1; if(Mouse.getX() &gt; 1000 &amp;&amp; Mouse.getX() &lt; 1240 &amp;&amp; Mouse.getY() &gt; 282.5F &amp;&amp; Mouse.getY()&lt; 737.5F) sel = Math.round((Mouse.getY() - 337.5F)/7…
has answer: http://stackoverflow.com/a/21229611
favorite count: 0
has comment: http://stackoverflow.com/comment/31964195
has title: LWJGL/OpenGL scaling textures weirdly
has comment: http://stackoverflow.com/comment/31964588
has comment: http://stackoverflow.com/comment/31964363
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21224046

http://stackoverflow.com/q/21186176
has answer: http://stackoverflow.com/a/21205968
tagged with: android
score: 0
accepted answer: http://stackoverflow.com/a/21205968
type: AnsweredQuestion
has body: I am printing a receipt using Zebra printer ( Android SDK). I have checked the documentation of the SDk but could not find any utility class that can help in setting of font size/name/height. Currently i am hard-coding the parameters and creating a .lbl file but i think that is not a good approach. So, is their any utility class that would generate the script for .lbl file depending on set of parameters i provided to it.
tagged with: zebra-printers
tagged with: java
has title: Support for Fonts in Zebra Android SDK
type: Question
answer count: 1

http://stackoverflow.com/q/21243818
has body: I'm currently working on an application that generates and validates .xml files based on some template files. The method I call to generate those files goes like this: FtlProcessingController ctrl = new FtlProcessingController(); ctrl.process(TEMPLATES, OUTPUT_DIRECTORY, root, metadata); I'm not the author of this FtlProcessingController class, but the process method basically takes the template files from the TEMPLATES directory, fills them with what's inside the root object (a tree of Answer objects) and the metadata object (a Map of additional data), and ouputs the .xml files to OUTPUT_ DIRECTORY. Briefly, the main code looks like this: // Prepare files and data FtlProcessingController ctrl = new FtlProcessingController(); ctrl.process(TEMPLATES, OUTPUT_DIRECTORY, root, metadata); // Validate XML files The problem is any console output after the process call does not work; nothing shows up in the console. I tried surrounding the call with some test output and saving the PrintStream for a reset: System.out.println("Console"); PrintStream stdOut = System.out; FtlProcessingController ctrl = new FtlProcessingController(); ctrl.process(TEMPLATES, OUTPUT_DIRECTORY, root, metadata); // Test Exception was thrown here. System.setOut(stdOut); System.out.println("Console again"); but I only get: Console I know for sure that there is no infinite loop or System.exit() in this call, since the files are successfully generated. I even tried throwing an Exception right after the call to confirm that, and the Exception was thrown normally. My question is: independently of what the process method does or doesn't do with System.out, shouldn't I be able to print again on the console after the System.setOut(stdOut) call? What could be possibly messing up the standard output so that the saved PrintStream doesn't work? Thanks! Full main code, for the curious: public static void main(String[] args) { try { // Parse answers Answer root = AnswerUtils.fromJSON(JSON_FILE, Answer.class); Modu…
has comment: http://stackoverflow.com/comment/32002779
linked to: http://stackoverflow.com/q/8941298
answer count: 1
downvote count: 0
tagged with: printstream
tagged with: console
favorite count: 0
accepted answer: http://stackoverflow.com/a/21244409
has comment: http://stackoverflow.com/comment/32003082
has comment: http://stackoverflow.com/comment/32003141
has title: Console output not working after method call
has comment: http://stackoverflow.com/comment/32002321
tagged with: output
upvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32002518
score: 1
has answer: http://stackoverflow.com/a/21244409
tagged with: java
has comment: http://stackoverflow.com/comment/32003375

http://stackoverflow.com/comment/32142796
has text: so I need to change the relative layout to surfaceview?
type: AnswerComment
comment on: http://stackoverflow.com/a/21296991
score: 0
type: Comment

http://stackoverflow.com/comment/31932389
has text: @SamuelLiz: See my updated answer, it should solve your problem. Depending on what you are actually trying to do, you *may not need* the `view.SetZOrderOnTop (...)` and `setFormat (PixelFormat.RGBA_8888)` lines.
comment on: http://stackoverflow.com/a/21199143
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21333462
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21333837
tagged with: java
type: Question
tagged with: api
answer count: 1
has title: application email service, send identical emails from public api and website
has body: in a student project we are currently developing a website which service is also accessibly via native Android and Windows Phone Apps. The mobile apps access the service through a public RESTful API written in JAVA which is running on the same server as the website. The website is written in PHP and independent from the API, but they both use the same database (MySQL). We wanted to extend the functionality of the API and allow registration for the service in the mobile apps. The problem is that the user receives an email with a confirmation link as soon as he registers for the service. What is the best approach to ensure that the emails sent by the API are identical to the ones sent by the website? The easiest way we figured out doing this would be just using the same templates for both, website and API, but in that case we need to manually keep those templates in sync. Is there a better way than the one above?
accepted answer: http://stackoverflow.com/a/21333837
tagged with: email
score: 0
tagged with: php

http://stackoverflow.com/a/21312808
type: Answer
score: 2
type: AcceptedAnswer
downvote count: 0
has body: Move your bean declaration to your main application context, not the one where you have DispatcherServlet.
answers question: http://stackoverflow.com/q/21312623
accepted answer of: http://stackoverflow.com/q/21312623
upvote count: 2

http://stackoverflow.com/comment/32107966
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21303532
has text: @DineshxK i do not want to be mean, but adding Spring JUST for this is way to much.
score: 0

http://stackoverflow.com/comment/32028441
type: QuestionComment
has text: @nakkeru What is there to understand? Play computer and write down what's happening. If your string is `ABC` you're building the output string like this: `"A" + ""`, `"B" + "A"`, `"C" + "BA"`. Easy enough. If you add the character at the *end* of your output string it's this: `"" + "A"`, `"A" + "B"`, `"AB" + "C"`
score: 2
comment on: http://stackoverflow.com/q/21259298
type: Comment

http://stackoverflow.com/comment/32068556
type: Comment
comment on: http://stackoverflow.com/a/21280098
type: AnswerComment
has text: Argh I can not vote good to your answer because I have no reputation, but thanks!!!
score: 0

http://stackoverflow.com/comment/32178373
type: Comment
has text: Yes instead of "actual value" there was business logic which i assumed returned a string, but instead was a Message object. Thanks for the sanity check
type: AnswerComment
comment on: http://stackoverflow.com/a/21343159
score: 0

http://stackoverflow.com/comment/31922357
comment on: http://stackoverflow.com/a/21199001
has text: nvm Thank you so much @PakkuDon i will let you know if i face more problem
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32152026
score: 1
has text: You can't they get erased on compilation.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21329025

http://stackoverflow.com/comment/31945750
has text: thank you. sometimes all we need is some fresh eyes to look over code
score: 0
comment on: http://stackoverflow.com/q/21212124
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21213084
type: Question
tagged with: java
tagged with: jitterbit
upvote count: 1
has title: Jitterbit upserting large csv tab-delimited file
type: UnansweredQuestion
answer count: 0
downvote count: 0
tagged with: salesforce
has body: I have a problem with upserting csv file data using jitterbit, into a salesforce instance. I am going to provide as much information as I can here, but if there is anything else the experts would like to know, please ask me to provide. I am not sure what to do to resolve this. I would appreciate some suggestions. Thank you very much. The error in jitterbit, when uploading csv, is: Failure to deploy - "The file "tran9015s.jtr" does not exist. Looked for it here: "1503/1495/jtr/tran9015s.jtr". [GENERIC_EXCEPTION_OTHER]"` This is quite a large file (>400 MB), which is in csv format, tab delimited. I am using jitterbit 6.0.4.3. Operating system: Mac OS X Maverick (with all relevant updates up-to-date) java : version 7 update 45 I had installed the jitterbit cloud data loader client, just today. I am trying upload the contents of the csv file into my company's salesforce instance. I had logged into jitterbit, chose new upsert, and then selected the appropriate salesforce object. I then selected an external ID field. Then I selected the file to upsert. In the preview pane which followed, I had made sure that is the right file I would like to upload. Then I chose file type delimited file, with header. It is a tab delimited file, so I added \t as delimiter. I skipped the scheduling options, maintaining it as "none", and chose "Map and Finish" After linking all the approipriate fields, I then clicked on "Finish" and then "Run Upsert" Then as it is "deploying project data", error occurs. I have checked my java version, to make sure it is up to date. I have uninstalled and reinstalled Java, and uninstalled and reinstalled jitterbit - still not fixed. restarting PC did not fix the problem. I have a Microsoft 7 machine at work, and it also gives me the same error. Googling has not been helpful, as no results could be found. From the entire error message below, it might be that there is something wrong with Java, but I am not sure, and would appreciate some opinion and suggestion…
score: 1
favorite count: 0

http://stackoverflow.com/a/21316070
downvote count: 0
has body: You have not provided the source code so i m providing the code assuming that hidden input contain ID attribute. HtmlHiddenInput hidden = (HtmlHiddenInput) page.getElementById("Hidden_Id"); hidden.setValueAttribute("Updated_Value");
score: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21314032
accepted answer of: http://stackoverflow.com/q/21314032
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/32130127

http://stackoverflow.com/q/21192636
has title: in java using regex how can i find last 3 words from a position in string
tagged with: regex
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21192746
has comment: http://stackoverflow.com/comment/31910578
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/21192746
favorite count: 0
tagged with: pattern-matching
has body: in java using regex how can i find last 3 words from a position in string for example i have an string It is situated near the Bara Imambara and on the connecting road stands an imposing gateway known as Rumi Darwaza. The building is also known as the Palace of Lights because of its decorations and chandeliers during special festivals, like Muharram i want to find last 3 words before "Rumi Darwaza" which i already found and have position 50 in the string.
has comment: http://stackoverflow.com/comment/31913659

http://stackoverflow.com/a/21234718
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21234546
has body: Because you creating the new object in "static" method. You should add the modifier "static" to AsyncCallWS class such as : public static class AsyncCallWS extends AsyncTask&lt;String, Void, Void&gt; { ...... }
answers question: http://stackoverflow.com/q/21234546
score: 1
upvote count: 1
type: AcceptedAnswer

interceptor
tags question: http://stackoverflow.com/q/21197112
tag name: interceptor
type: Tag

http://stackoverflow.com/q/21220024
has comment: http://stackoverflow.com/comment/31959882
has comment: http://stackoverflow.com/comment/31959912
favorite count: 0
has comment: http://stackoverflow.com/comment/31959686
has comment: http://stackoverflow.com/comment/31959563
accepted answer: http://stackoverflow.com/a/21220081
has body: I am trying to rapidly publish messages to my server via Websockets. For each message the server gets I store it in the form "timestamp: message" in my HashMap. I need HashMaps for returning the history of messages in chronological order with the timestamp needed. (Any other data structure recommendation is welcome.) It so happens that when I rapidly publish messages, two or more messages have the same timestamp and hence I cannot save them. I'm already using System.currentTimeMillis(). I cannot go into Nanoseconds are I read the value is arbitrary and often unreliable. I have tried appending a static AtomicInteger variable at the end of the timestamps and it works but, when I return the messages to my user I need to return a JSON and again I'm not able to store duplicate key. How can I tackle this problem?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31959588
has comment: http://stackoverflow.com/comment/31959994
has comment: http://stackoverflow.com/comment/31959601
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/31959754
has answer: http://stackoverflow.com/a/21220081
has comment: http://stackoverflow.com/comment/31959865
type: Question
score: 3
tagged with: hashmap
has comment: http://stackoverflow.com/comment/31959737
has comment: http://stackoverflow.com/comment/31959679
tagged with: duplicates
tagged with: data-structures
has title: Duplicate millisecond timestamp issue
has comment: http://stackoverflow.com/comment/31959797
has comment: http://stackoverflow.com/comment/31959866
has comment: http://stackoverflow.com/comment/31959670
has comment: http://stackoverflow.com/comment/31959953
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/32034238
score: 0
has text: Can yo examplain that a little more or even show a code exmaple. If I declare a variabel it is final like this. myInterface a = new myInterface(); -- final in this instance. If I add more to the interface down the road then i do not have to change anything in my code because my variable will have access to even the new methods even if they are create with default or static and do supply some code. Because interface appear to be able to supply code as well in some cases. This I had not seen before. Doug
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21248086

http://stackoverflow.com/q/21227947
accepted answer: http://stackoverflow.com/a/21228151
type: Question
has comment: http://stackoverflow.com/comment/31973718
tagged with: java
has answer: http://stackoverflow.com/a/21228208
score: 0
has title: How to update JList?
answer count: 3
tagged with: jlist
has answer: http://stackoverflow.com/a/21230434
has body: What I want from this program is when pressing on first button, it will display the array assigned and when pressing on the second button is to clear the list and display the array assigned, I've been looking up solution online and many people are suggesting the use of list model, any tips are appreciated. import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class tester extends JFrame{ private JList list = new JList(); private JButton b1 = new JButton("Array1"); private JButton b2 = new JButton("Array2"); public tester(){ final String [] Array1 = {"1", "2", "3", "4"}; final String [] Array2 = {"one", "two", "three", "four"}; JPanel p1 = new JPanel(); p1.add(new JScrollPane(list)); p1.add(b1); p1.add(b2); add(p1, BorderLayout.CENTER); b1.addActionListener(new ActionListener (){ public void actionPerformed(ActionEvent e){ DefaultListModel Model1 = (DefaultListModel)list.getModel(); for(int i = 0; i &lt; Array1.length; i++){ Model1.addElement(Array1[i]); } } }); b2.addActionListener(new ActionListener (){ public void actionPerformed(ActionEvent e){ DefaultListModel Model2 = (DefaultListModel)list.getModel(); for(int i = 0; i &lt; Array2.length; i++){ Model2.addElement(Array2[i]); } } }); } public static void main (String [] args){ tester t1= new tester(); t1.pack(); t1.setLocationRelativeTo(null); t1.setTitle("Test"); t1.setVisible(true); t1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
possible better answer: http://stackoverflow.com/a/21228208
type: AnsweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/21228151

http://stackoverflow.com/a/21231278
answers question: http://stackoverflow.com/q/21230819
upvote count: 2
has comment: http://stackoverflow.com/comment/31980107
has comment: http://stackoverflow.com/comment/31979827
accepted answer of: http://stackoverflow.com/q/21230819
has comment: http://stackoverflow.com/comment/31988234
has comment: http://stackoverflow.com/comment/31986461
has comment: http://stackoverflow.com/comment/31985281
has comment: http://stackoverflow.com/comment/31980021
has body: If you have the need to create a JSW (wrapper.conf) the simplest solution would be to use the appassembler-maven-plugin which can create such files.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31985688
score: 2
has comment: http://stackoverflow.com/comment/34326672

http://stackoverflow.com/q/21288355
has answer: http://stackoverflow.com/a/21293331
has body: I have a button which changes it's color when hovered over, but i want to make this color transition seem smooth. How can i achieve this effect? buttonLogin.setOnMouseEntered(new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent e){ buttonLogin.setStyle("-fx-background-color: " + "rgba(1, 147, 255, 0.3);" + "\n-fx-border-color: " + "rgba(1, 147, 255, 0.5);"); } }); buttonLogin.setOnMouseExited(new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent e){ buttonLogin.setStyle("-fx-background-color: " + "rgba(255, 255, 255, 0.5);" + "\n-fx-border-color: " + "rgba(255, 255, 255, 0.8);"); } }); I tried using fadetransitions, animation but i found it hard to understand. Can someone please explain?
linked to: http://stackoverflow.com/q/17676274
type: UnansweredQuestion
upvote count: 1
tagged with: properties
tagged with: java
tagged with: javafx
tagged with: transition
type: Question
downvote count: 0
has title: javafx node style transition
answer count: 1
score: 1
favorite count: 0

http://stackoverflow.com/a/21288735
has comment: http://stackoverflow.com/comment/32082223
score: 2
type: AcceptedAnswer
downvote count: 0
has body: One of the big elements of debugging is being able to sort through the junk of log files and find the information that is relevant to you. Typically, this is any part of the log that describes any part of the app that you wrote. In this case, that would be this line right here: 01-22 11:26:11.877: E/AndroidRuntime(23917): at com.rcd.learningactivities.secondActivity.onCreate(secondActivity.java:16) It looks like whatever is happening on line 16 in src/com/rcd/learningactivities/secondActivity is failing because it can't find the resource (I'm assuming that it can't find the TextView. Look at the code and compare it to the respective XML. Do the IDs match? Are you calling the correct method in your Java to programatically write to the text view? Have you built the TextView object correctly in your XML?) There could be a large number of reasons that it's not working correctly, but the key to finding it out is on line 16 of your second activity Java file. Good luck, and happy hunting!
answers question: http://stackoverflow.com/q/21288592
type: Answer
accepted answer of: http://stackoverflow.com/q/21288592
upvote count: 2

http://stackoverflow.com/q/21193657
has answer: http://stackoverflow.com/a/21198208
has answer: http://stackoverflow.com/a/21193804
linked to: http://stackoverflow.com/q/13674673
has comment: http://stackoverflow.com/comment/31912611
has comment: http://stackoverflow.com/comment/31912857
has comment: http://stackoverflow.com/comment/31912703
has comment: http://stackoverflow.com/comment/31912902
has answer: http://stackoverflow.com/a/21193702
has body: I don't want to change this code, I'm only interested in JVM, OS or kernel customization/configuration for best results! I have one second loop (1000 x 1ms) public static void main(String[] args) throws InterruptedException { long start = System.nanoTime(); for (int i = 0; i &lt; 1000; i++ ) { Thread.sleep(TimeUnit.MILLISECONDS.toMillis(1)); } long duration = System.nanoTime() - start; System.out.println("Loop duration " + duration / TimeUnit.MILLISECONDS.toNanos(1) + " ms."); } On my Fedora 20 with kernel 3.12 this loop needs 1055 ms. This is pretty good result, average is more than 1100ms. Is possible to make this code faster with custom JVM flags or OS configuration? Loop duration 1055 ms.
type: Question
upvote count: 4
answer count: 8
has answer: http://stackoverflow.com/a/21193732
tagged with: benchmarking
tagged with: for-loop
score: 4
has comment: http://stackoverflow.com/comment/31912685
has comment: http://stackoverflow.com/comment/31912392
has comment: http://stackoverflow.com/comment/31913559
has answer: http://stackoverflow.com/a/21193812
has title: How long it takes for one second in Java? Measure latency time in Java
has comment: http://stackoverflow.com/comment/31912576
tagged with: real-time
accepted answer: http://stackoverflow.com/a/21198208
has answer: http://stackoverflow.com/a/21193714
has comment: http://stackoverflow.com/comment/31912419
downvote count: 0
linked to: http://stackoverflow.com/q/504103
has comment: http://stackoverflow.com/comment/31912728
favorite count: 0
has comment: http://stackoverflow.com/comment/31913481
possible better answer: http://stackoverflow.com/a/21193714
has comment: http://stackoverflow.com/comment/31912872
has answer: http://stackoverflow.com/a/21194037
has comment: http://stackoverflow.com/comment/31912687
has comment: http://stackoverflow.com/comment/32078103
has answer: http://stackoverflow.com/a/21193726
has comment: http://stackoverflow.com/comment/31912439
has comment: http://stackoverflow.com/comment/31912558
has comment: http://stackoverflow.com/comment/31913405
has comment: http://stackoverflow.com/comment/32077930
has comment: http://stackoverflow.com/comment/31912569
has comment: http://stackoverflow.com/comment/31912490
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31915311
tagged with: performance
tagged with: java
has comment: http://stackoverflow.com/comment/31912377

http://stackoverflow.com/comment/31985603
has text: @user3215014 You will need to use JNI to create a function, in C++, for Java to call. From that new function, call your existing C++ code, and format the results for Java. You will then package both the existing C++ code and your new C++ Java function into a single library, for which Java will then load and invoke.
type: Comment
comment on: http://stackoverflow.com/a/21233972
type: AnswerComment
score: 2

http://stackoverflow.com/comment/32158286
score: 0
type: Comment
type: QuestionComment
has text: Updated the question. It's outputting the same result all the time.
comment on: http://stackoverflow.com/q/21332743

rcp
tags question: http://stackoverflow.com/q/21285171
tags question: http://stackoverflow.com/q/21238358
type: Tag
tags question: http://stackoverflow.com/q/21185923
tag name: rcp
tags question: http://stackoverflow.com/q/21304996
tags question: http://stackoverflow.com/q/21328271

http://stackoverflow.com/comment/32266270
type: AnswerComment
type: Comment
has text: There is no particular reason to have static anything in this case, you may wish to enforce a singleton, but that is different. By all other classes, I presume, based on your XML, that you mean to have PaginasGlobales, PaginasClientes, etc. - is that correct?
comment on: http://stackoverflow.com/a/21321933
score: 0

http://stackoverflow.com/a/21236253
answers question: http://stackoverflow.com/q/21234220
score: 5
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31995300
has body: the transparent background on the image is the main thing The reason it's not transparent is that you are explicitly filling it with the default color which is non-transparent :-) Graphics g = bufferedImage.getGraphics(); say("" + g.getColor()); g.fillRect(0, 0, iconW, iconH); output: java.awt.Color[r=255,g=255,b=255] So either don't fill, or use a fully/partly transparent Color. I don't know why neither magenta nor blue show up in this program; if someone cares to tell me that, I'd appreciate it (already answered in earlier posts) magenta is not showing because the label is !opaque by default: meaning that its background is not filled with its background color blue is not showing because you set it to the frame which is covered by its contentPane: by default, the latter is a plain JPanel which opacity defaults to true, that is it fills its area with its background To see the blue, either set it as background color to the contentPane or change its opacity: frame.getContentPane().setBackground(Color.blue); // or frame.setBackground(Color.YELLOW); ((JComponent) frame.getContentPane()).setOpaque(false);
upvote count: 5

http://stackoverflow.com/a/21301045
type: Answer
has body: try using wsdl2java with ant. http://axis.apache.org/axis2/java/core/tools/CodegenToolReference.html http://axis.apache.org/axis/java/ant/axis-wsdl2java.html# Something related to wsdl2java i had asked earlier (incase u face a similar issue). https://stackoverflow.com/questions/19502425/binding-xml-for-wsdl2java-two-declarations-cause-a-collision-in-the-objectfacto
score: 0
answers question: http://stackoverflow.com/q/21300940

http://stackoverflow.com/comment/32062067
type: Comment
type: QuestionComment
has text: @TheLostMind Instead of paraphrasing your code, can you show the actual names of the interfaces and methods? That might make the question (and answers) more relevant.
comment on: http://stackoverflow.com/q/21278028
score: 0

http://stackoverflow.com/q/21291283
has comment: http://stackoverflow.com/comment/32086400
has comment: http://stackoverflow.com/comment/32085047
tagged with: generics
has answer: http://stackoverflow.com/a/21291423
favorite count: 0
has comment: http://stackoverflow.com/comment/32085823
upvote count: 2
has comment: http://stackoverflow.com/comment/32086098
has comment: http://stackoverflow.com/comment/32086189
score: 2
type: AnsweredQuestion
has body: Consider this example: interface A&lt;T&gt; {} interface B&lt;T&gt; extends A&lt;T&gt; { void run(); } class Test { public void main(String[] args) { A&lt;SomeType&gt; a = ...; if (a instanceof B) ((B&lt;SomeType&gt;) a) //warning: "Type safety: unchecked cast" .run(); } } Why does that give an unchecked cast warning? Is there a way this cast could be dangerous, or can I simply ignore this warning? Note, that I can't use if (a instanceof B&lt;SomeType&gt;), because that gives the following compiler error: Cannot perform instanceof check against parameterized type B&lt;SomeType>. Use the form B&lt;?> instead since further generic type information will be erased at runtime And, if I use if (a instanceof B&lt;?&gt;), that still gives the same warning.
tagged with: java
has answer: http://stackoverflow.com/a/21291636
accepted answer: http://stackoverflow.com/a/21291636
possible better answer: http://stackoverflow.com/a/21291423
has comment: http://stackoverflow.com/comment/32085729
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32085983
downvote count: 0
has title: Why does this give an unchecked cast warning?
has comment: http://stackoverflow.com/comment/32086273
has comment: http://stackoverflow.com/comment/32085027

http://stackoverflow.com/comment/31962562
type: Comment
has text: So, the java session only stores a small string on the client side. And such string is used to retrieve all stored objects on the server side?
comment on: http://stackoverflow.com/a/21221610
score: 0
type: AnswerComment

http://stackoverflow.com/q/21213072
type: AnsweredQuestion
tagged with: return
accepted answer: http://stackoverflow.com/a/21213114
possible better answer: http://stackoverflow.com/a/21213097
tagged with: java
has body: I am very new to java and was playing around with code. I was curious how I might print a return value in class B using System.out.print in class A. I do not want to use System.out.print in class B. I already know how to do it that way. -------- CLASS A ---------------------------------------- import java.util.Scanner; public class Moregot { public static void main(String[] args){ Scanner scan = new Scanner(System.in); Give giveObj = new Give(); System.out.println("Enter your First Name "); String fNamed = scan.nextLine(); System.out.println("Enter your Last Name "); String lNamed = scan.nextLine(); System.out.println("Enter your Age "); int theAge = scan.nextInt(); Give.setInfomation(fNamed, lNamed, theAge); System.out.println("Your Name is " + giveObj.getfN() + " "+ giveObj.getlN() + " and you are age "+ giveObj.getOld()); } } -------- CLASS B ---------------------------------------- package Practice2; public class Give { private String _fName, _lName; private int _age; public static void setInfomation(String fNam, String lNam, int old) { String _fName = fNam; String _lName = lNam; int _age = old; } public String getfN(){ return _fName; } public String getlN(){ return _lName; } public int getOld(){ return _age; } }
downvote count: 1
has answer: http://stackoverflow.com/a/21213090
type: Question
has answer: http://stackoverflow.com/a/21213114
score: -1
tagged with: printing
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/31947280
favorite count: 0
has answer: http://stackoverflow.com/a/21213097
has comment: http://stackoverflow.com/comment/31947170
has title: Printing Return values from other class

http://stackoverflow.com/q/21312038
answer count: 1
type: UnansweredQuestion
tagged with: java
tagged with: servlets
has title: Ajax XMLHttpRequest invokes servlet doFilter or not
type: Question
has answer: http://stackoverflow.com/a/21312894
has body: I'm trying an ajax call from jsp page like below, Change Content Here for the first time servlet filter is called but during ajax calls i can't see doFilter called. url-mapping for filter is mapped for all incoming requests to server as *. Why Servlet filter is not invoked for Ajax calls here?
tagged with: javascript
tagged with: jquery
tagged with: ajax
has comment: http://stackoverflow.com/comment/32121744
score: 0

http://stackoverflow.com/q/21340112
type: UnansweredQuestion
tagged with: memory-leaks
tagged with: java
tagged with: garbage-collection
tagged with: com4j
type: Question
has answer: http://stackoverflow.com/a/21533288
score: 0
answer count: 1
has body: I have a Java project which works with one dll library via COM. I have Windows 7 and I use 32bit Java 1.6. I use 2012/04/26 release of com4j as a bridge. It works. The problem is that I have a serious memory leak which makes operation of my program almost impossible. I have subscribed to some COM events. When the next event arrives I observe the raise of Heap memory used, and GC never helps to decrease it. If I use COM4J.cleanUp() - memory usage stops its growth, but the events no longer arrive. Heap memory used by my program raises very fast, while in fact no my own objects being allocated. Snapshots difference in VisualVM: http://postimg.org/image/cxg77ft8j/ Heap Memory raise in VisualVM: http://postimg.org/image/m52g63b51/ Looks like the problem is with DirectByteBuffer, Cleaner, Variant and Finalizer instances. I do not create them by myself. This is something inside com4j. Any suggestions?
has title: Com4j leaks with DirectByteBuffer, Cleaner, Finalizer, Variant instances

http://stackoverflow.com/comment/32100517
has text: still its not working,its not entering the action class..before that program terminates..
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21299869
type: Comment

http://stackoverflow.com/comment/31930309
has text: The error is on the server side (Internal Server Error: 500). If you can get more precise error information from the server, that would help. Most likely your request isn't in the format the server expects.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21203411
score: 0

http://stackoverflow.com/q/21296519
has comment: http://stackoverflow.com/comment/32202923
has body: I am struggling with a problem in ProxyPass. I have tried using Apache and Nginx to setup Proxypass with tomcat. Everything is fine, apart from when there is any character in the URL. I don't know whether it is a bug in Apache or what, the request URI I am getting in my program from Apache as proxy is different from using Tomcat without proxy. I am using "request.getRequestURI()" in Java Servlet. For example, if the URL is /movies/logs, logs Use Apache or Nginx setup ProxyPass or Mod_jk I got: /movies/logs,%20logs If I use Tomcat directly, I got: /movies/logs%2C%20logs Ideally, I want the URL to be the same one as I received in Tomcat. Can someone help me fix the problem? Thanks so much in advance!
score: 0
tagged with: java
type: Question
tagged with: apache
tagged with: tomcat
tagged with: servlets
tagged with: proxy
has title: Using Apache ProxyPass or Mod_jk with Tomcat when there are special characters in the URL path
answer count: 1
has answer: http://stackoverflow.com/a/21488170
type: UnansweredQuestion

http://stackoverflow.com/q/21320214
tagged with: java
has comment: http://stackoverflow.com/comment/32136767
has answer: http://stackoverflow.com/a/21327759
type: Question
has comment: http://stackoverflow.com/comment/52088643
possible better answer: http://stackoverflow.com/a/32098367
tagged with: android-viewpager
has body: I've seen some similar posts here but no appropriate answer. I use the event onpageselected in a viewpager to execute a function. This function is network dependent so it can take some time. But then the slide animation looks laggy. mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int i, float v, int i2) { } @Override public void onPageSelected(int i) { makeSomeHeavyTask(); } @Override public void onPageScrollStateChanged(int i) { } }); Heavy Task: public void makeSomeHeavyTask() { handler.post(new QueryRunnable()); } Is there a way to solve this? Thanks
has title: Android: Viewpager OnPageChangeListener onpageselected disturbs slide animation
has answer: http://stackoverflow.com/a/32098367
accepted answer: http://stackoverflow.com/a/21327759
has comment: http://stackoverflow.com/comment/32137137
tagged with: listview
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32137508
linked to: http://stackoverflow.com/q/4489399
tagged with: android
type: AnsweredQuestion
score: 3
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/32136854
upvote count: 3

http://stackoverflow.com/comment/32178903
has text: ... but I can upvote yours, IMHO it is excellent answer for this question.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21343439

http://stackoverflow.com/comment/32166682
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21321223
has text: Which documentation generator are you using? We use Jackson for Json serialisation, who doesn't need response objects to be wrapperd in a JResponse.
type: Comment

http://stackoverflow.com/comment/32117067
type: QuestionComment
type: Comment
score: 1
has text: correct me if i'm wrong, but i think acos will gave you angle in radians, so you should get answer in range (0,+PI), have try pass yor result to Math.toDegrees() function
comment on: http://stackoverflow.com/q/21309444

http://stackoverflow.com/comment/32014280
comment on: http://stackoverflow.com/a/21250646
has text: This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/21277865
has answer: http://stackoverflow.com/a/21284285
upvote count: 3
has answer: http://stackoverflow.com/a/21281482
accepted answer: http://stackoverflow.com/a/21282552
has body: I have a set of objects. This objects calculate some numbers based on request parameters. Let's call them calculators. Each calculator has description where specified type of requests that this calculator the most suitable for. For example, Calculator1 : with this parameters : price &gt; 10, gender = male, geo_id = 1, 2 or 3. Calculator2 : with this parameters : price &lt; 5, gender = male, geo_id = 1, 2. For request : price = 11, gender = male, geo_id = 2 I should get calculator1 like the most suitable and then calculator2. For request : price = 4, gender = male, geo_id = 2 I should get calculator2 and then calculator1. For request : price = 3, gender = female, geo_id = 5 I should get only the second one. Now I'm doing it with Lucene, but it's not really fit for this task. Can you recommend me some library or approach?
answer count: 4
favorite count: 0
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21282552
has comment: http://stackoverflow.com/comment/32063236
has comment: http://stackoverflow.com/comment/32063368
has comment: http://stackoverflow.com/comment/32065248
possible better answer: http://stackoverflow.com/a/21281211
type: Question
score: 3
tagged with: java
tagged with: search
has title: Finding the most suitable objects by set of parameters in java
has comment: http://stackoverflow.com/comment/32064712
has comment: http://stackoverflow.com/comment/32065640
has answer: http://stackoverflow.com/a/21281211
tagged with: data-structures

http://stackoverflow.com/comment/32142578
type: Comment
comment on: http://stackoverflow.com/a/21323339
type: AnswerComment
has text: 1) you said to change plabel to DrawingPanel which it already is 2) i have neverheard of "magic numbers"
score: 0

http://stackoverflow.com/a/21286282
has body: public final static void writeObject(Object x,String name) throws IOException{ try { FileOutputStream fileOut = new FileOutputStream(name+".ser"); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(x); out.close(); fileOut.close(); }catch(IOException i) { i.printStackTrace(); }} public final static Object readObject(String filename) throws IOException, ClassNotFoundException{ ArrayList oldlist = null; try { FileInputStream fileIn = new FileInputStream(filename); ObjectInputStream in = new ObjectInputStream(fileIn); oldlist = (ArrayList) in.readObject(); in.close(); fileIn.close(); return oldlist; }catch(IOException i) { writeObject(list, "list"); update_list(current_link); System.exit(0); //i.printStackTrace(); return 0; }catch(ClassNotFoundException c) { c.printStackTrace(); return null; }}
answers question: http://stackoverflow.com/q/21285370
score: 0
type: Answer

http://stackoverflow.com/comment/31957715
type: QuestionComment
has text: you can't work with network in `UI` thread on 3+, you need `AsyncTask` class to do this
comment on: http://stackoverflow.com/q/21219037
score: 0
type: Comment

http://stackoverflow.com/comment/32104466
type: QuestionComment
type: Comment
has text: because you've created object represented by _Automobile.java_ (`Automobile class`)
score: 0
comment on: http://stackoverflow.com/q/21302240

http://stackoverflow.com/comment/102934113
type: AnswerComment
comment on: http://stackoverflow.com/a/45770644
type: Comment
has text: @FearX this answer is out-of-date, as are most of the answers here. The listed command will install the _latest_ openjfx, which is incompatible with Java 8. I'm about to post an answer that should solve the problem... if you're using Ubuntu (otherwise you can use Oracle JDK 8, if that's compatible with your philosophy etc.) You need to specifcally request the Java 8 version.
score: 4

http://stackoverflow.com/comment/32173292
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21340622
has text: @SLaks Yeah. If someone wanted to I suppose they could pull it from the apk.

http://stackoverflow.com/a/21244409
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21243818
answers question: http://stackoverflow.com/q/21243818
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32003338
has body: It is possible that the method you call reassigns the System.out stream, which can be done with the System.setOut(PrintStream) method. If that is the case and output is no longer visible in the Java console it maybe that the output is written to a log file. This approach for logging is, however, an extremely bad idea and one shouldn't do it especially in a library that others may end up using. An idea even worse than that would be to actually close the System.out stream. I can't think of any scenario justifying doing this.
type: Answer

http://stackoverflow.com/comment/34808913
comment on: http://stackoverflow.com/q/21235967
score: 0
type: QuestionComment
has text: Have you tried running with -Djavax.net.debug=all ? Follow through the trace carefully and it will become very apparent what your next question to ask should be :-)
type: Comment

garbage-collection
tags question: http://stackoverflow.com/q/21210978
tags question: http://stackoverflow.com/q/21195911
tags question: http://stackoverflow.com/q/21206655
tags question: http://stackoverflow.com/q/21187196
tags question: http://stackoverflow.com/q/21230165
tags question: http://stackoverflow.com/q/21283346
tag name: garbage-collection
tags question: http://stackoverflow.com/q/21326360
tags question: http://stackoverflow.com/q/21194962
tags question: http://stackoverflow.com/q/21248645
type: Tag
tags question: http://stackoverflow.com/q/21247106
tags question: http://stackoverflow.com/q/21236491
tags question: http://stackoverflow.com/q/21340112
tags question: http://stackoverflow.com/q/21264862
tags question: http://stackoverflow.com/q/21264157

http://stackoverflow.com/q/21330064
has comment: http://stackoverflow.com/comment/32154192
type: Question
tagged with: object
has title: Convert Object to BuffredInputStream in JAVA
tagged with: bufferedinputstream
has answer: http://stackoverflow.com/a/21330346
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21330117
has answer: http://stackoverflow.com/a/21330109
has comment: http://stackoverflow.com/comment/32153782
type: UnansweredQuestion
has body: Hi i used the below code to convert my object into Input stream. But I actually wanted to convert my object into BufferedInputStream. What changes should i make to my code ? ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(obj); oos.flush(); oos.close(); InputStream is = new ByteArrayInputStream(baos.toByteArray());
tagged with: java

http://stackoverflow.com/a/21337143
accepted answer of: http://stackoverflow.com/q/21336500
type: AcceptedAnswer
has body: Is the file listed under package/project Homework? If not, reading your error-message correctly, you're trying to run something that doesn't exist. At the same time, as said above, you could be experiencing filepath issues. Creating a new project and copy-pasting your code (refactored copy) is usually the quickest solution.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32166926
answers question: http://stackoverflow.com/q/21336500
has comment: http://stackoverflow.com/comment/32167447

http://stackoverflow.com/comment/32077692
type: QuestionComment
has text: Maybe you could paste your own piece of code - it would be helpful...
comment on: http://stackoverflow.com/q/21287087
score: 0
type: Comment

http://stackoverflow.com/comment/32017429
comment on: http://stackoverflow.com/a/21252529
type: AnswerComment
type: Comment
score: 1
has text: onAttach() is Called when the fragment has been associated with the activity (the Activity is passed in here). look at fragment [life cycle](http://developer.android.com/guide/components/fragments.html#Adding)

unit-testing
tags question: http://stackoverflow.com/q/21209061
tags question: http://stackoverflow.com/q/21292868
tags question: http://stackoverflow.com/q/21295316
tags question: http://stackoverflow.com/q/21195450
tags question: http://stackoverflow.com/q/21294454
tags question: http://stackoverflow.com/q/21234122
tags question: http://stackoverflow.com/q/21228131
tags question: http://stackoverflow.com/q/21238474
tags question: http://stackoverflow.com/q/21316985
tags question: http://stackoverflow.com/q/21316750
tags question: http://stackoverflow.com/q/21226985
tags question: http://stackoverflow.com/q/21295505
tags question: http://stackoverflow.com/q/21262768
tags question: http://stackoverflow.com/q/21308513
tags question: http://stackoverflow.com/q/21269649
tags question: http://stackoverflow.com/q/21185922
tags question: http://stackoverflow.com/q/21194523
type: Tag
tags question: http://stackoverflow.com/q/21258179
tag name: unit-testing
tags question: http://stackoverflow.com/q/21316182
tags question: http://stackoverflow.com/q/21219942
tags question: http://stackoverflow.com/q/21216584

http://stackoverflow.com/comment/31961118
has text: so how should I choose an Intelligent algorithm for Sudoku ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21220689

http://stackoverflow.com/comment/32157470
has text: The dropins suggestion didn't work.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21331463
type: Comment

http://stackoverflow.com/comment/32241469
has text: Affe, but then I still need to match the messageType to the typetoken. Or is it possible that gson guesses it on its own then?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21345116
type: Comment

http://stackoverflow.com/comment/31980222
has text: When searching the Interwebs, I found [this post](http://www.postgresql.org/message-id/Pine.LNX.4.44.0408122234060.4697-100000@freewebz.com). At first glance, they talk about a corrupt index in which case [`REINDEX`](http://www.postgresql.org/docs/current/static/sql-reindex.html) should fix it.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21231604

http://stackoverflow.com/comment/32029835
type: AnswerComment
comment on: http://stackoverflow.com/a/21260085
type: Comment
has text: I thought there might have been an exception for this but on the other hand i prefer to keep it simple, so that helps. Thank you all guys.
score: 0

arrays
tags question: http://stackoverflow.com/q/21345246
tags question: http://stackoverflow.com/q/21289982
tags question: http://stackoverflow.com/q/21227954
tags question: http://stackoverflow.com/q/21339000
tags question: http://stackoverflow.com/q/21283198
tags question: http://stackoverflow.com/q/21201914
tags question: http://stackoverflow.com/q/21297571
tags question: http://stackoverflow.com/q/21320547
tags question: http://stackoverflow.com/q/21230496
tags question: http://stackoverflow.com/q/21243545
type: Tag
tags question: http://stackoverflow.com/q/21343138
tags question: http://stackoverflow.com/q/21337826
tags question: http://stackoverflow.com/q/21203428
tags question: http://stackoverflow.com/q/21300584
tags question: http://stackoverflow.com/q/21343374
tags question: http://stackoverflow.com/q/21245650
tags question: http://stackoverflow.com/q/21194644
tags question: http://stackoverflow.com/q/21345609
tags question: http://stackoverflow.com/q/21298324
tags question: http://stackoverflow.com/q/21323921
tags question: http://stackoverflow.com/q/21218055
tags question: http://stackoverflow.com/q/21344934
tags question: http://stackoverflow.com/q/21248590
tags question: http://stackoverflow.com/q/21189855
tags question: http://stackoverflow.com/q/21323425
tags question: http://stackoverflow.com/q/21267018
tags question: http://stackoverflow.com/q/21294213
tags question: http://stackoverflow.com/q/21269727
tags question: http://stackoverflow.com/q/21341061
tags question: http://stackoverflow.com/q/21206777
tags question: http://stackoverflow.com/q/21334025
tags question: http://stackoverflow.com/q/21273586
tags question: http://stackoverflow.com/q/21249079
tags question: http://stackoverflow.com/q/21262043
tags question: http://stackoverflow.com/q/21271351
tags question: http://stackoverflow.com/q/21212129
tags question: http://stackoverflow.com/q/21346343
tags question: http://stackoverflow.com/q/21242008
tags question: http://stackoverflow.com/q/21341466
tags question: http://stackoverflow.com/q/21269802
tags question: http://stackoverflow.com/q/21253716
tags question: http://stackoverflow.com/q/21227326
tags question: http://stackoverflow.com/q/21239601
tags question: http://stackoverflow.com/q/21310721
tags question: http://stackoverflow.com/q/21340165
tags question: http://stackoverflow.com/q/21257933
tags question: http://stackoverflow.com/q/21247174
tags question: http://stackoverflow.com/q/21290141
tags question: http://stackoverflow.com/q/21220876
tags question: http://stackoverflow.com/q/21277687
tags question: http://stackoverflow.com/q/21224981
tags question: http://stackoverflow.com/q/21208424
tags question: http://stackoverflow.com/q/21323037
tags question: http://stackoverflow.com/q/21345002
tags question: http://stackoverflow.com/q/21265942
tags question: http://stackoverflow.com/q/21215861
tags question: http://stackoverflow.com/q/21342033
tags question: http://stackoverflow.com/q/21197930
tags question: http://stackoverflow.com/q/21237036
tags question: http://stackoverflow.com/q/21241740
tags question: http://stackoverflow.com/q/21258901
tags question: http://stackoverflow.com/q/21288050
tags question: http://stackoverflow.com/q/21214266
tags question: http://stackoverflow.com/q/21325949
tags question: http://stackoverflow.com/q/21207574
tags question: http://stackoverflow.com/q/21228384
tags question: http://stackoverflow.com/q/21226175
tags question: http://stackoverflow.com/q/21227239
tags question: http://stackoverflow.com/q/21299216
tags question: http://stackoverflow.com/q/21316887
tags question: http://stackoverflow.com/q/21247434
tags question: http://stackoverflow.com/q/21281668
tags question: http://stackoverflow.com/q/21308921
tags question: http://stackoverflow.com/q/21225775
tags question: http://stackoverflow.com/q/21210312
tags question: http://stackoverflow.com/q/21288929
tags question: http://stackoverflow.com/q/21247104
tags question: http://stackoverflow.com/q/21278521
tags question: http://stackoverflow.com/q/21186726

http://stackoverflow.com/a/21304840
answers question: http://stackoverflow.com/q/21304396
score: 5
downvote count: 0
type: Answer
upvote count: 5
has body: Just before staring of JasperViewer change the look and feel as below. try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); JasperViewer viewer = new JasperViewer(mainPrint,false); viewer.setVisible(true); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); }

orthogonal
tags question: http://stackoverflow.com/q/21345910
type: Tag
tag name: orthogonal

http://stackoverflow.com/a/21322555
has comment: http://stackoverflow.com/comment/32141843
upvote count: 2
has comment: http://stackoverflow.com/comment/32141341
has comment: http://stackoverflow.com/comment/32141152
has comment: http://stackoverflow.com/comment/32141468
type: Answer
has comment: http://stackoverflow.com/comment/32140989
has comment: http://stackoverflow.com/comment/32141635
has body: This answer relates to the original Question and numerous updates ... prior to the final "rewrite". However, European countries use the extended character sets for obscure characters that are outside the specified range for UTF-8. I know this is a common problem. Also restated as: However, European countries use character encodings to support characters not supported in UTF-8. BOTH of these are incorrect from two respects. UTF-8 is not a character set. It is a character encoding, and it encodes the entire Unicode code space. There are no "obscure characters" that are commonly used in European countries that do not have corresponding Unicode code points, and therefore cannot be encoded in UTF-8. And this: However, European countries use character encodings not supported in UTF-8. This is just plain nonsensical. It makes no sense to talk about character encodings not supported in other character encodings. Each encoding is distinct, and any overlap of their bit patterns is ... an artefact of their respective histories. (You don't seem to understand the difference between a code point aka character, and an encoding.) And even ignoring these issues, you are still trying to say that there are European characters that UTF-8 does not handle with ... which is simply FALSE, no matter how you try to say it. In short, your question is based on misconceptions, and therefore cannot be answered ... apart from pointing out the misconceptions. The problems you are seeing are most likely caused by either: a bug in the way you are handling the data upstream of the rendering to HTML, a mismatch between the data you are sending and the content type you are using, or browsers that are incapable of displaying glyphs that correspond to the characters that you are using. Probably one of the first two ... If you think I'm "talking rubbish", please provide specific examples of the characters that you are talking about.
has comment: http://stackoverflow.com/comment/32141190
score: 1
has comment: http://stackoverflow.com/comment/32140938
has comment: http://stackoverflow.com/comment/32141079
downvote count: 1
has comment: http://stackoverflow.com/comment/32141224
has comment: http://stackoverflow.com/comment/32141179
answers question: http://stackoverflow.com/q/21322492
has comment: http://stackoverflow.com/comment/32141274
has comment: http://stackoverflow.com/comment/32141204
has comment: http://stackoverflow.com/comment/32141255
has comment: http://stackoverflow.com/comment/32141042

http://stackoverflow.com/a/21311941
has comment: http://stackoverflow.com/comment/32153598
type: Answer
has comment: http://stackoverflow.com/comment/32156034
answers question: http://stackoverflow.com/q/21309528
upvote count: 3
has comment: http://stackoverflow.com/comment/32158260
score: 3
downvote count: 0
has body: Interesting fact If you pick a value from the combobox then the editor works as expected (next click on an editable cell will open the combobox of that cell as you wish), but if you close the combobox without selecting a value then it behaves as you describe. So the issue seems to be the combobox doesn't stop editing until you select a value or focus in some other component. Consequently the first click to another cell makes its own editor request focus instead of start editing. Explanation Looking closer at DefaultCellEditor implementation the problem is only an ActionListener is attached to the combobox causing a fireEditingStopped() call through the EditorDelegate when an item is selected but nothing happens when the combobox is closed or cancelled without selecting a value: public DefaultCellEditor(final JComboBox comboBox) { editorComponent = comboBox; comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE); delegate = new EditorDelegate() {...} comboBox.addActionListener(delegate); // delegate is the ActionListener } protected class EditorDelegate implements ActionListener, ItemListener, Serializable { ... public void actionPerformed(ActionEvent e) { DefaultCellEditor.this.stopCellEditing(); // This will finally call fireEditingStopped(); } } Solution Make your own TableCellEditor using a combobox as editor and attach a PopupMenuListener to call fireEditingStopped() or fireEditingCanceled() as needed. For instance: class ComboBoxEditor extends AbstractCellEditor implements TableCellEditor { private JComboBox editor; private int clickCountToStart = 2; private Object selectedValue; public ComboBoxEditor(Object[] selectableValues) { editor = new JComboBox(selectableValues); editor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { selectedValue = editor.getSelectedItem(); ComboBoxEditor.this.fireEditingStopped(); } }); editor.addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenu…

http://stackoverflow.com/q/21302383
has comment: http://stackoverflow.com/comment/32104746
has comment: http://stackoverflow.com/comment/32104645
score: -3
tagged with: jdbc
has answer: http://stackoverflow.com/a/21302977
accepted answer: http://stackoverflow.com/a/21302527
type: AnsweredQuestion
tagged with: java
downvote count: 3
possible better answer: http://stackoverflow.com/a/21302977
has comment: http://stackoverflow.com/comment/32104823
has comment: http://stackoverflow.com/comment/32104754
has body: i want to store string value in array or in in separate variable using java please short out my problem Thanks String a1,a2,a3; while (resultSet.next()) { isFound=true; jLabel2.setText("hello"); String s1=resultSet.getString("Court_Num"); System.out.println(s1); output s1=: 101 102 103 Desired out put: a1=101 a2=102 a3=103
type: Question
has comment: http://stackoverflow.com/comment/32104672
has title: how to retrieve value in array from mysql table in java?
has answer: http://stackoverflow.com/a/21302527
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/32104859
favorite count: 0

http://stackoverflow.com/comment/132615792
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21234213
has text: That is wrong. N+m is average. Wrist case is m*n

http://stackoverflow.com/q/21297427
type: Question
tagged with: java
tagged with: hibernate
score: 0
answer count: 1
tagged with: high-availability
has body: I'm trying to understand if it's possible to change my hibernate config and use a single instance of MySQL (rather than the multiple MySQL instances I currently have): I have a Java app using hibernate, talking to 2 schemas, config example as follows: @Entity @Table(name="Foo", schema="SchemaA") public class FooSchemaA @Entity @Table(name="Bar", schema="SchemaB") public class BarSchemaB &lt;bean name="datasource" class="com.mchange.v2.c3p0.ComboPooledDataSource"&gt; &lt;property name="driverClass" value="com.mysql.jdbc.Driver"/&gt; &lt;property name="jdbcUrl" value="jdbc:mysql://localhost:3306/SchemaA"/&gt; &lt;property name="user" value="root"/&gt; &lt;property name="password" value="password"/&gt; &lt;/bean&gt; The complexity comes in that I have the Java app running 5 times (on different boxes). I don't require the Java apps to be sharing data so host 5 separate MySQL instances (with identical schemas), one on each box. I'm now trying to move to an HA solution. If I keep the current config I'd end up with 10 MySQL instances. It just doesn't feel right.. is there a better way?
tagged with: database-design
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21306964
linked to: http://stackoverflow.com/q/10192241
has title: Single MySQL instance + Hibernate Config vs Multiple MySQL instances
tagged with: mysql

http://stackoverflow.com/a/21334354
type: Answer
score: 2
has body: It looks like you use same key for your sharedpreferences that is why the values override. I would recommend using sqlite for storing top scores.
downvote count: 0
answers question: http://stackoverflow.com/q/21334131
upvote count: 2

http://stackoverflow.com/comment/32059625
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21260873
has text: I added a loop like this before but getting the videolength is the critical one.. can you help me in getting the value of videolength.

http://stackoverflow.com/a/21221580
has comment: http://stackoverflow.com/comment/31982358
type: Answer
answers question: http://stackoverflow.com/q/21216546
has body: The recommended approach IMO is to use Deferred Binding to pick the GWT compatible version of your FileHandler or other GWT specific implementations. Extract the common interface for all versions and in your GWT module file you point to correct GWT implementation. You can then instantiate your specific implemenation using GWT.create : MyInterface implemenation = GWT.create(MyInterface.class); more in depth info on the gwtproject site. Deferred Binding is a technique used by the GWT compiler to create and select a specific implementation of a class based on a set of parameters. In essence, deferred binding is the GWT answer to Java reflection. It allows the GWT developer to produce several variations of their applications custom to each browser environment and have only one of them actually downloaded and executed in the browser.
score: 0
has comment: http://stackoverflow.com/comment/31982565

http://stackoverflow.com/comment/32081594
has text: Yes, initially i read each line(when i try to display it in console it will be in garbage form, Is it because console is unable to display a text which is in UTF-8?) and tried to match using String.contains(word)
comment on: http://stackoverflow.com/q/21288971
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21238486
accepted answer of: http://stackoverflow.com/q/21238238
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21238238
has body: <TextView android:id="@+id/lblIP" android:layout_width="0dp" android:layout_weight="1" android:gravity="center" android:text="@string/ip" /> <TextView android:id="@+id/lblPort" android:layout_width="0dp" android:layout_weight="1" android:gravity="center" android:text="@string/port" />
upvote count: 1
score: 1

http://stackoverflow.com/comment/31929777
has text: Do you want to keep track of how many times each of the buttons was clicked and execute the actions for that button that many times eventually, when all 3 have been clicked?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21203384
type: Comment

http://stackoverflow.com/comment/31967871
score: 1
comment on: http://stackoverflow.com/a/21224198
type: AnswerComment
type: Comment
has text: Fixed what? Are you sure the images are loading?

http://stackoverflow.com/comment/32082376
type: AnswerComment
has text: `convert operands to byte arrays` I can't find such method though (only find the one to convert from byte to LargeInteger). What is the method that you found?
comment on: http://stackoverflow.com/a/21289680
type: Comment
score: 0

http://stackoverflow.com/q/21204334
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/31931715
type: Question
has answer: http://stackoverflow.com/a/21204519
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/50017163
has answer: http://stackoverflow.com/a/21204409
has comment: http://stackoverflow.com/comment/31931234
upvote count: 35
has title: System.setProperty and System.getProperty
downvote count: 0
has comment: http://stackoverflow.com/comment/31931389
possible better answer: http://stackoverflow.com/a/21204682
accepted answer: http://stackoverflow.com/a/21204519
has answer: http://stackoverflow.com/a/21204682
has body: I didn't understand when I used System.setProperty to define a parameter, where the data is stored? If say that I used System.setProperty in one java file, then can I use the properties anywhere? But this is not true, I can't use it anywhere, only in the same java file I called setProperty. I really do not know why and what the function of this method is.
score: 35
has comment: http://stackoverflow.com/comment/31931325

http://stackoverflow.com/comment/32161061
type: Comment
has text: You could add to the constructor of A and hold onto a Class<T> object and use that to get the enum constants.
comment on: http://stackoverflow.com/q/21334055
score: 1
type: QuestionComment

http://stackoverflow.com/a/71953357
upvote count: 7
downvote count: 0
has body: Both methods are used to save entities to the database. Flushing is the process of synchronizing the state of the persistence context with the underlying database. When using saveAndFlush method, data immediately flush to the database and to do it with the save method we need to call flush() method explicitly. Using flush can read saved changes at a later step during the same transaction but before the commit. So still can rollback if no need to commit.
type: Answer
answers question: http://stackoverflow.com/q/21203875
score: 7

http://stackoverflow.com/comment/31904661
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21189237
type: AnswerComment
has text: @ElliottFrisch Thanks for the route and explanation!

http://stackoverflow.com/comment/31951651
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21215595
has text: @LazyOne the command i tried in cmd on win 8 is : telnet 192.168.48.132 22 is it true ? if it's true ... i get this error :could not open the connection on port 22
score: 0

http://stackoverflow.com/a/21265098
downvote count: 0
type: Answer
score: 1
has body: I am looking out for the easiest but not a very rigid back-end solution Have you considered AppEngine? Here's a tutorial about how to get app engine working for you fast You can store up to 5 GB of blob storage for free, should be more than enough for experimenting. If you go over you can pay the $0.13/GB/mo extra for blob storage, which is more than reasonable.
answers question: http://stackoverflow.com/q/21264585
upvote count: 1

http://stackoverflow.com/q/21270063
has title: Eclipse imports these java projects incorrectly (main, site, test paradigm)
tagged with: java-package
tagged with: ide
has comment: http://stackoverflow.com/comment/32049946
has comment: http://stackoverflow.com/comment/32076967
has comment: http://stackoverflow.com/comment/32050017
answer count: 0
type: UnansweredQuestion
has body: I encounter a few projects that have a set of folders in the src directory: main, site and test. A few levels under main eventually I encounter the com.x.x. package, all the files have package names that start with the com folder, not the main folder. So when the project is imported into eclipse, whether as "existing project" or with "maven" , the result is that all the files in the project have errors because they can't find references to the other files in the package. I'm wondering if this is a file structure paradigm that I just need to be aware of and import a certain way, or if I just need to restructure the projects insight appreciated
tagged with: java
tagged with: eclipse
type: Question
score: 0

http://stackoverflow.com/q/21240052
favorite count: 0
has answer: http://stackoverflow.com/a/21244975
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/31995764
tagged with: java
tagged with: class
type: Question
has body: I'm trying to update a web app to use DBCP. Things are running great locally (typical Tomcat on Windows installation). However, on the DEV server (EC2 LINUX AMI; Tomcat as a Service) I am getting the following Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory] I have narrowed this down (I think) to the /lib folder originally not having tomcat-jdbc.ja. I have since added this jar, and restarted the Tomcat instance with the following... sudo service tomcat7 restart However, I still get the same ClassNotFoundException. How can I get the Tomcat service to recognize tomcat-dbcp.jar? EDIT - Here's the stack trace when after running sudo service tomcat7 start Jan 20, 2014 5:30:35 PM org.apache.catalina.startup.ClassLoaderFactory validateFile WARNING: Problem with JAR file [/usr/share/java/tomcat7/log4j.jar], exists: [false], canRead: [false] Jan 20, 2014 5:30:35 PM org.apache.catalina.startup.ClassLoaderFactory validateFile WARNING: Problem with JAR file [/usr/share/java/tomcat7/log4j.jar], exists: [false], canRead: [false] Jan 20, 2014 5:30:36 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: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib Jan 20, 2014 5:30:37 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Jan 20, 2014 5:30:37 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] Jan 20, 2014 5:30:37 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 1404 ms Jan 20, 2014 5:30:37 PM org.apache.catalina.core.St…
has comment: http://stackoverflow.com/comment/31996224
has title: ClassNotFoundException after adding the jar to the lib folder of a Tomcat Service installation
answer count: 1
downvote count: 0
tagged with: jar

http://stackoverflow.com/a/21200100
type: AcceptedAnswer
has body: When you instantiate class B, you're using a reference variable to the type of A. From this reference, you can only access methods declared in A. That reference can also point to other classes that inherit from A, that would not have the methods declared in B, so the compiler doesn't let you call methods only declared in a subclass from a reference to a superclass.
type: Answer
accepted answer of: http://stackoverflow.com/q/21200086
score: 0
answers question: http://stackoverflow.com/q/21200086

http://stackoverflow.com/a/21217569
score: 0
has comment: http://stackoverflow.com/comment/31954888
answers question: http://stackoverflow.com/q/21217512
type: Answer
has body: Look at your second for loop for(int b = 0; b &lt; arr[a].length;) { you should do it like this for(int b = 0; b &lt; arr[a].length; b++) { - You forgot the b++

http://stackoverflow.com/a/21325400
has comment: http://stackoverflow.com/comment/32145896
downvote count: 0
has body: Node1 node = node1.getNextNode(); Here node will copy the reference value of nextNode which will be pointing to a Node1 object.
type: Answer
answers question: http://stackoverflow.com/q/21325370
score: 1
upvote count: 1

libgdx
tags question: http://stackoverflow.com/q/21200456
tags question: http://stackoverflow.com/q/21238638
tags question: http://stackoverflow.com/q/21197599
tags question: http://stackoverflow.com/q/21246479
tags question: http://stackoverflow.com/q/21306457
tags question: http://stackoverflow.com/q/21349871
tags question: http://stackoverflow.com/q/21199272
tags question: http://stackoverflow.com/q/21299143
tags question: http://stackoverflow.com/q/21242116
tags question: http://stackoverflow.com/q/21262548
tags question: http://stackoverflow.com/q/21229026
tag name: libgdx
tags question: http://stackoverflow.com/q/21205569
tags question: http://stackoverflow.com/q/21347067
tags question: http://stackoverflow.com/q/21309842
tags question: http://stackoverflow.com/q/21278675
tags question: http://stackoverflow.com/q/21335521
tags question: http://stackoverflow.com/q/21318030
tags question: http://stackoverflow.com/q/21345910
type: Tag
tags question: http://stackoverflow.com/q/21204258
tags question: http://stackoverflow.com/q/21243545
tags question: http://stackoverflow.com/q/21293923
tags question: http://stackoverflow.com/q/21278229
tags question: http://stackoverflow.com/q/21340735
tags question: http://stackoverflow.com/q/21340354
tags question: http://stackoverflow.com/q/21259837
tags question: http://stackoverflow.com/q/21320365
tags question: http://stackoverflow.com/q/21190553
tags question: http://stackoverflow.com/q/21280435
tags question: http://stackoverflow.com/q/21343334
tags question: http://stackoverflow.com/q/21313575
tags question: http://stackoverflow.com/q/21259234
tags question: http://stackoverflow.com/q/21273569
tags question: http://stackoverflow.com/q/21336398
tags question: http://stackoverflow.com/q/21253405
tags question: http://stackoverflow.com/q/21249486
tags question: http://stackoverflow.com/q/21314970
tags question: http://stackoverflow.com/q/21284616
tags question: http://stackoverflow.com/q/21292690

http://stackoverflow.com/comment/32044346
has text: debug process : a/ figure out the cause for the exception (dataTable is null, you saw that). b/ look where dataTable is initialized and where it is used. c/ see that dataTable initialization is made **after** dataTable is used. voilà.
comment on: http://stackoverflow.com/q/21267851
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21249714
has title: receive commands uing Bluetoothsocket connection
has comment: http://stackoverflow.com/comment/32020872
has comment: http://stackoverflow.com/comment/32029207
accepted answer: http://stackoverflow.com/a/21276439
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32020124
answer count: 1
has comment: http://stackoverflow.com/comment/32027760
has comment: http://stackoverflow.com/comment/32026638
has answer: http://stackoverflow.com/a/21276439
score: 0
has body: I am trying to open a connection with my laptop which has bluetooth from my phone. Server program is running in my laptop. My intention was to establish a connection with my laptop to send some inputs continuously on the same created socket. Connection was successfully established and a byte was sent to the server running in my laptop but after pressing send button nothing was sent. The below code works fine for the first attempt. When i am trying to resend using the same connection byte value was not sent. When i launching my application for second time my phone gets hanged. I am looking for memory issues but i couldn't find any memory issues. Did i miss something ? Do i need to do something. public class BluetoothActivity extends Activity { private TextView myLabel; private EditText myTextbox; private BluetoothAdapter mBluetoothAdapter; private BluetoothSocket mmSocket; private BluetoothDevice mmDevice; private OutputStream mmOutputStream; private BufferedOutputStream mbuffStream; private ProgressDialog progressBar; private int progressBarStatus; private Context mContext; private TextView devicesLabel; private TextView devices; private final static int MAX_VALUE = 100; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_bluetooth); mContext = this; Button openButton = (Button) findViewById(R.id.open); Button sendButton = (Button) findViewById(R.id.send); Button closeButton = (Button) findViewById(R.id.close); myLabel = (TextView) findViewById(R.id.label); devicesLabel = (TextView) findViewById(R.id.devicelabel); devices = (TextView) findViewById(R.id.devices); myTextbox = (EditText) findViewById(R.id.entry); mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); // Open Button openButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { openBTConnection(); } catch (IOException e) { e.printStackTrace(); } } }); // Send Button sendButton.setOnC…
tagged with: android-bluetooth
tagged with: android

http://stackoverflow.com/a/21520104
upvote count: 2
answers question: http://stackoverflow.com/q/21315549
type: Answer
score: 2
has body: Can you try using Maven Overlays? We had faced similar situation in the past, and very much resolved using overlays. Usually, overlays are used to share common resources across multiple web applications.
downvote count: 0

http://stackoverflow.com/q/21185883
downvote count: 8
score: -8
has comment: http://stackoverflow.com/comment/31897519
has comment: http://stackoverflow.com/comment/31897695
tagged with: parsing
tagged with: methods
linked to: http://stackoverflow.com/q/2992071
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31897498
has answer: http://stackoverflow.com/a/21186001
tagged with: math
tagged with: java
possible better answer: http://stackoverflow.com/a/21186039
type: Question
has title: Java - How to write a code that Solve equation inside a String?
answer count: 2
has answer: http://stackoverflow.com/a/21186039
upvote count: 0
has body: How to make a string that can solve an equation, for example : if we have String x = "a=3;b=4;c=a*b"; it must return "c=12" for an answer
tagged with: string
has comment: http://stackoverflow.com/comment/31897813
favorite count: 0
has comment: http://stackoverflow.com/comment/31898198
accepted answer: http://stackoverflow.com/a/21186001
has comment: http://stackoverflow.com/comment/31897539
has comment: http://stackoverflow.com/comment/31897554

http://stackoverflow.com/q/21324764
score: 5
accepted answer: http://stackoverflow.com/a/21324879
has body: I am using Java Callable Future in my code. Below is my main code which uses the future and callables - Below is my main code which uses the future and callables - public class TimeoutThread { public static void main(String[] args) throws Exception { ExecutorService executor = Executors.newFixedThreadPool(5); Future&lt;String&gt; future = executor.submit(new Task()); try { System.out.println(future.get(3, TimeUnit.SECONDS)); } catch (TimeoutException e) { } executor.shutdownNow(); } } Below is my Task class which implements the Callable interface in which I am making a REST URL call to my SERVERS using RestTemplate. And then deserialize the JSON String using GSON. class Task implements Callable&lt;String&gt; { private static RestTemplate restTemplate = new RestTemplate(); @Override public String call() throws Exception { String url = "some_url"; String response = restTemplate.getForObject(url, String.class); TestResponse jsonResponse = new Gson().fromJson(response, TestResponse.class); } } So my question is how should I declare GSON here? Should it be declared as static global variable in Task class? Bcoz currently I am parsing JSON using gson and for every call I am making new Gson() which would be expensive?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21324878
tagged with: gson
type: Question
possible better answer: http://stackoverflow.com/a/21324878
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/32144612
has answer: http://stackoverflow.com/a/21324879
answer count: 3
has comment: http://stackoverflow.com/comment/32145349
favorite count: 0
has answer: http://stackoverflow.com/a/21324921
has title: How should I declare GSON to deserialize the JSON String?

http://stackoverflow.com/q/21224477
has comment: http://stackoverflow.com/comment/31967724
has comment: http://stackoverflow.com/comment/31967678
has comment: http://stackoverflow.com/comment/31967686
type: Question
has body: It does not allow me to enter my choice whether I want to enter another grade or not, It should allow me to enter my choice of either yes or no and if I enter yes it should allow me to enter another grade except it simply refuses to take user input? import java.util.Scanner; public class ExaminationGrades { public static void main(String[] args) { Scanner scan = new Scanner (System.in); double grade; String ch; do { System.out.println("Enter your grade: "); grade = scan.nextDouble(); if (grade &lt;40) { System.out.println("you failed"); } else if (grade &gt;=40 &amp;&amp; grade &lt;50) { System.out.println("Pass"); } else if (grade &gt;=50 &amp;&amp; grade &lt;60) { System.out.println("2:2"); } else if (grade &gt;=60 &amp;&amp; grade &lt;70){ System.out.println("2:1"); } else if (grade &gt;=70 &amp;&amp; grade &lt;=100){ System.out.println("1:1"); } else System.out.println("invalid entry"); System.out.println("Would you like to enter another?"); ch = scan.nextLine(); } while(ch =="no"); scan.close(); } }
has comment: http://stackoverflow.com/comment/31967767
has comment: http://stackoverflow.com/comment/31967700
score: 0
accepted answer: http://stackoverflow.com/a/21224512
has comment: http://stackoverflow.com/comment/31967698
has comment: http://stackoverflow.com/comment/31967701
answer count: 1
duplicate of: http://stackoverflow.com/q/513832
has title: Why is this code not working (basic)
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21224512

http://stackoverflow.com/q/21247208
has comment: http://stackoverflow.com/comment/32008509
type: Question
has comment: http://stackoverflow.com/comment/32008533
has title: Display pop-up message window in Java?
upvote count: 2
has body: I read about JDialogs and JOptionPane messages but I still can't get it to work. I have a GUI class that extends JFrame. All I want to do is have a popup at the beginning of my program which informs the user about a couple of things. In my main I create the following gui: GUI g = new GUI(); Right after that I was to display the window. I have tried the following in the main method: JOptionPane.showMessageDialog(g, "work?"); JOptionPane.showMessageDialog(frame, "work?"); //(frame was used in documentation example so I tried it) I also tried to add the pop up into the GUI class with the following JOptionPane.showMessageDialog(this, "work?"); //(I'm not exactly sure what the Frame Owner parameter is supposed to be, unless I'm confusing this with JDialog.) In any case, how would I make this window appear? Every single one of the methods I tried compiled, and nothing happened. public class GUI extends JFrame implements ActionListener{ private Container background; private static buttons etc... private static JLabel disp,edisp; private static JTextArea info; //setting up the GUI for my program, adding action listeners, I can post more if necessary } And then I have the main where I want to call the pop up window public static void main(String[] args){ GUI g = new GUI(); JOptionPane.showMessageDialog(g,"Work?"); }
has comment: http://stackoverflow.com/comment/32008370
has comment: http://stackoverflow.com/comment/32008345
answer count: 1
favorite count: 0
tagged with: jdialog
has answer: http://stackoverflow.com/a/21247230
has comment: http://stackoverflow.com/comment/32008833
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32008339
has comment: http://stackoverflow.com/comment/32008894
has comment: http://stackoverflow.com/comment/32008319
score: 2
tagged with: joptionpane
has comment: http://stackoverflow.com/comment/32008875
downvote count: 0
has comment: http://stackoverflow.com/comment/32008330
tagged with: java
tagged with: swing

http://stackoverflow.com/q/21220812
score: 8
favorite count: 0
linked to: http://stackoverflow.com/q/600095
has comment: http://stackoverflow.com/comment/31963758
upvote count: 8
type: UnansweredQuestion
tagged with: maven
tagged with: spring
linked to: http://stackoverflow.com/q/317687
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/21221039
tagged with: java
type: Question
tagged with: jakarta-ee
has body: I am creating an application where I have separated the project in different modules such as (domain, repository, service and web) as well as many general purpose maven projects for mail sending, text formatting etc. I am also using Spring. Currently I have the Spring application context file only in the web project. However, since I am creating general pupose projects for text formatting etc that encapsulates libraries (e.g. freemarker) from the actual application I don't like that I have to specify library dependent configuration in the Spring application context file in the web project. The question is whether or not it is correct to have a separate Spring applicaiton context file for each module and then import the context files in the projects where I use them. Is this the correct way to do it, or are there better ways? I am interested in how to solve this when I use XML files, not JavaConfig.
answer count: 2
downvote count: 0
has title: Should each module in a Maven project have its own Spring application context?
has comment: http://stackoverflow.com/comment/31961129
has comment: http://stackoverflow.com/comment/31963231
has comment: http://stackoverflow.com/comment/31963255
linked to: http://stackoverflow.com/q/5113579
has answer: http://stackoverflow.com/a/21222553

http://stackoverflow.com/comment/31961450
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21220837
type: Comment
has text: But, where to do I add the code to show "Validation in process". saveUsernameIfNotDuplicate should be performed in background.

http://stackoverflow.com/comment/31981261
type: Comment
comment on: http://stackoverflow.com/a/21230711
has text: Thanks for looking into this issue. I tried giving absolute path but still facing the same issue.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31947746
has text: I'm new to programming. Not familiar with that but am interested in how it can be implemented. Been looking it over and it seems to be what I looking for, just need a little help getting it going.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21213271
type: Comment

http://stackoverflow.com/comment/32184926
type: QuestionComment
comment on: http://stackoverflow.com/q/21346953
has text: yep, give it a host access by what name? Although the wild card % is there
score: 0
type: Comment

http://stackoverflow.com/a/21285277
accepted answer of: http://stackoverflow.com/q/21282242
answers question: http://stackoverflow.com/q/21282242
score: 0
type: AcceptedAnswer
type: Answer
has body: That kind of abstraction would be useful for handling any kind of cross-cutting concerns, similar to aspects. For example, I might want all my filters to log that they are being applied to the request and then log any exceptions that passed by them so that I can know for any given request which filters acted on it. To put the exact same logging code in all of my filters would be a violation of DRY. To try and hook aspects into filters would be overly complicated. I cannot think of a better way than inheritance to achieve that goal. Another example is that I might have a set of filters which are only applied to certain users or types of requests. A simple base filter class which had an abstract getUsersToApplyFor() would make that very easy to implement. What I would NOT use this approach for is to setup custom filter chains through inheritance. For example, I would not create a base class which modified the request and response in one way and a child class which then additionally modified the request and response in another way, and the two modifications are unrelated to each other. As you pointed out, that would be better left in the web.xml where it would be clearer for future developers.

http://stackoverflow.com/a/21277932
type: Answer
answers question: http://stackoverflow.com/q/21277792
score: 0
has body: The compilation error comes from your quotes “ ”, they should be normal unformatted " "

http://stackoverflow.com/comment/32065031
type: Comment
type: QuestionComment
has text: remove web-inf `protected void doPost(HttpServletRequest request, HttpServletResponse response throws ServletException, IOException { RequestDispatcher rd = request.getRequestDispatcher("/WebPages/Signup.jsp"); rd.forward(request, response); }`
comment on: http://stackoverflow.com/q/21279636
score: 0

http://stackoverflow.com/comment/31978293
has text: Unfortunately, it doesn't work. I have specified security realm and domain as You proposed. In domain:remoting I have `<subsystem xmlns="urn:jboss:domain:remoting:2.0"><http-connector name="http-remoting-connector" connector-ref="default" security-realm="MyRealm"/>`. Your version causes server crash on startup. Then I filled jboss-ejb3.xml and jboss-ejb-client.properties as You suggested, and left only `java.naming.factory.url.pkgs=org.jboss.ejb.client.naming` and `java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory`. Now, I have exception on Context initialization
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21221026

http://stackoverflow.com/comment/32029153
type: QuestionComment
has text: Thankz it worked... I didnt notice properly
type: Comment
comment on: http://stackoverflow.com/q/21258067
score: 0

http://stackoverflow.com/q/21300132
has answer: http://stackoverflow.com/a/21300349
has comment: http://stackoverflow.com/comment/32100892
has body: I have an array of 10,000 elements and i want to loop through and find a particular number say '6573'. Example for(int i=0;i&lt;=user.length;i++) { if(user[i]=="6573") System.out.println("Found it!!!"); } Could you please suggest a way to improve the performance of the code. Thanks
has answer: http://stackoverflow.com/a/24587212
has answer: http://stackoverflow.com/a/21300917
tagged with: java
has comment: http://stackoverflow.com/comment/32100942
has answer: http://stackoverflow.com/a/21300166
has comment: http://stackoverflow.com/comment/32100894
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/32100891
has answer: http://stackoverflow.com/a/21300618
answer count: 6
has title: Java for loop - code efficiency
score: 0
has answer: http://stackoverflow.com/a/21300190
linked to: http://stackoverflow.com/q/716597
type: UnansweredQuestion

http://stackoverflow.com/comment/45247240
type: Comment
comment on: http://stackoverflow.com/a/21355549
has text: @AdrieanKhisbe, not trying to be pedantic, but `mapreduce.job.tracker` doesn't seem to exist at all. Try putting it into google (in quotes).
type: AnswerComment
score: 0

http://stackoverflow.com/q/21266527
tagged with: java
has title: Can someone help me fix this code
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/32041539
answer count: 1
has answer: http://stackoverflow.com/a/21266591
accepted answer: http://stackoverflow.com/a/21266591
tagged with: android
has body: Please help fix this i wont load the SharedPreferences if you can please post a reply with the code in it please its just a clicking app and i want it to save the score from the clicks everytime it just loads from 0 please help me fix the code import android.R.string; import android.os.Bundle; import android.preference.PreferenceManager; import android.app.Activity; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { int counter; Button add; TextView display; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LoadPrefs(); counter = 0; add = (Button) findViewById(R.id.button1); display = (TextView) findViewById(R.id.textView1); add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub counter++; display.setText("You Have " + counter); SavePrefs("click", display.getText().toString()); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } private void LoadPrefs(){ SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); String name = sp.getString("click", "You Have zero"); } private void SavePrefs(String key, boolean value){ SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); Editor edit = sp.edit(); edit.putBoolean(key, value); edit.commit(); } private void SavePrefs(String key, String value){ SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); Editor edit = sp.edit(); edit.putString("click", "You Have zero"); edit.commit(); } }
downvote count: 4
upvote count: 0
score: -4
type: AnsweredQuestion

http://stackoverflow.com/comment/31938682
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21208474
has text: Interesting, i have never seen specific numbers used before. How do those translate in the expression?
type: AnswerComment

http://stackoverflow.com/comment/31969395
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21225380
has text: Please **stop** adding the [tag:console] to your questions, and please ***read*** the tag pop-ups before adding them to a post. This is so far the 3rd of your posts from which I have removed this irrelevant tag!
score: 0

http://stackoverflow.com/comment/32098868
has text: Hai Clay, CaptureActivity is more or less the same as https://github.com/zxing/zxing/blob/master/android/src/com/google/zxing/client/android/CaptureActivity.java
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21273031
score: 0

http://stackoverflow.com/a/75859512
score: 0
type: Answer
has body: I had the same error, but it was with a straightforward FX app, and I checked that this dependency was the main cause of this error: org.openjfx javafx-graphics 17.0.1 linux Once I have commented, and also commented, this "requires javafx.graphics;" from module-info, the app starts as expected... Yes, it was weird, but it was how it working here
answers question: http://stackoverflow.com/q/21185156

http://stackoverflow.com/comment/32081723
comment on: http://stackoverflow.com/a/21288305
score: 0
type: AnswerComment
has text: So your script can consist of only one file?
type: Comment

http://stackoverflow.com/q/21342479
tagged with: android
type: UnansweredQuestion
has body: Hey i have a problem with my android application.I'm trying to download text from given url to Editable box but when i'm running application and hit the button it stops working. I checked multiple times and it's problem with the jsoup.The device has internet connection. Here's the code public void sendMessage(View view) throws IOException { EditText tf = (EditText) findViewById(R.id.editText1); String kupa = tf.getText().toString(); Document doc = Jsoup.connect(kupa).get(); String title = doc.text(); TextView tv = (TextView) findViewById(R.id.textView1); tv.setText(title); } cheers guys
score: 0
has title: Rename in file error eclipse java
tagged with: java
type: Question
tagged with: jsoup
answer count: 1
has answer: http://stackoverflow.com/a/21342938

http://stackoverflow.com/comment/32000941
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21242696
type: Comment
has text: I did say *might have been* (Like ancient JDKs) more efficient and I know it results in two different stack traces now. I really have no idea why some one would write `throw null;` but it was in some ancient Sun code.

http://stackoverflow.com/a/21258269
score: 0
answers question: http://stackoverflow.com/q/21257933
type: Answer
has body: try this.... Use a temporary array to sort each row. Use that array to find the max and min values of each row. int[][] num = {{1, 4, 3, 0, 5}, {2, 4, 7, 8, 10}, {3, 9, 60, 20, 4}}; int row, col; for (row = 0; row &lt; 3; row++) { int temp[]=num[row]; int sum = 0; for (col = 0; col &lt; temp.length; col++) { for(int j=0;j&lt;temp.length;j++){ if(temp[col]&lt;temp[j]){ int a=temp[col]; temp[col]=temp[j]; temp[j]=a; } } } System.out.println("ROW"+row+": min="+temp[0]+" max="+temp[temp.length-1]); }

http://stackoverflow.com/comment/31924869
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21199702
has text: Note that there are multiple buffers -- the buffer in question is the PrintWriter's buffer. The socket buffer IMHO cannot be directly controlled from within Java as its the OS that handles it.

http://stackoverflow.com/comment/31904796
comment on: http://stackoverflow.com/q/21187448
type: Comment
type: QuestionComment
has text: a custom TreeNodeVisitor one
score: 0

http://stackoverflow.com/a/21187593
accepted answer of: http://stackoverflow.com/q/21185400
has comment: http://stackoverflow.com/comment/32047652
answers question: http://stackoverflow.com/q/21185400
downvote count: 0
has comment: http://stackoverflow.com/comment/32000054
has body: webview.setWebViewClient(new MyWebViewClient ()); private class MyWebViewClient extends WebViewClient { @Override public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) { handler.proceed("me@test.com", "mypassword"); } } This is most voted solution there I am not sure where to set the URL to open.Please suggest.
score: 26
has comment: http://stackoverflow.com/comment/32012327
has comment: http://stackoverflow.com/comment/31972383
has comment: http://stackoverflow.com/comment/31915623
upvote count: 26
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/21229389
possible better answer: http://stackoverflow.com/a/21229435
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21229435
upvote count: 1
type: Question
tagged with: android-inflate
downvote count: 0
accepted answer: http://stackoverflow.com/a/21229444
answer count: 2
has body: I made these codes. every time I click on the button, an EditText inflate in scroll layout. How can I get the ID for each EditText I inflate it ? to take the value of each of them ? ScrollView scrollview; LinearLayout linearLayout; LinearLayout.LayoutParams layoutParams; //EditText hello; static int i = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button sum_1 = (Button)findViewById(R.id.sum); scrollview = (ScrollView)findViewById(R.id.scrollview); linearLayout = (LinearLayout)findViewById(R.id.gamehistory); Button b = (Button)findViewById(R.id.Button01); layoutParams = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); b.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { EditText hello = new EditText(MainActivity.this); hello.setText("enter value" + i++); linearLayout.addView(hello, layoutParams); hello.setId(i++); } });
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/21229444
has title: How can I set an ID for each EditText I inflate it?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31976270

http://stackoverflow.com/q/21339342
has body: I want to connect to a remote server from thread and keep sending strings. If the connection gets refused the thread should keep polling the port until the server is up again. How can I handle this exception and keep my thread fro crashing? The server may not be up for long time but thread should run indefinitely. public void SendMessage(String message){ try { socket = new Socket(actuatorAddress, destPort.get()); outToServer = socket.getOutputStream(); out = new DataOutputStream(outToServer); out.flush(); out.write(message.getBytes()); } catch (IOException ex) { System.out.println(ex.getMessage()); } catch (Exception e) { System.out.println(e.getMessage()); } } I changed some part of the code as below. For first time called Connect function and then subsequently called Send Message function through thread. The delay added to reconnecting helped reduce time lag recurred due to connecting to non existing server. Still think that there might be a better solution to the basic problem. public boolean ConnectToActuator() { try { if(actuatorAddress.isReachable(2000)){ socket = new Socket(); socket.setPerformancePreferences(1, 2, 0); socket.setTcpNoDelay(false); socket.setSendBufferSize(32); socket.connect(new InetSocketAddress(actuatorAddress, destPort.get())); outToServer = socket.getOutputStream(); out = new DataOutputStream(outToServer); connected = true; disconnectedTimeout = 0; } }catch (ConnectException e) { // TODO Auto-generated catch block System.out.println(e.getMessage()); }catch (IOException ex) { connected = false; System.out.println(ex.getMessage()); } return connected; } public boolean SendToActuator(String message) { if(connected == false){ //socket.isOutputShutdown() disconnectedTimeout++; if(disconnectedTimeout&gt;20){ disconnectedTimeout = 0; ConnectToActuator(); } else { return connected; } } try { out.flush(); out.writeBytes(message); disconnectedTimeout = 0; connected = true; } catch (UnknownHostException uhe) { connected = false; System.out.println(u…
type: Question
has comment: http://stackoverflow.com/comment/32174109
has comment: http://stackoverflow.com/comment/32174275
has comment: http://stackoverflow.com/comment/32174049
downvote count: 0
has answer: http://stackoverflow.com/a/21340930
has comment: http://stackoverflow.com/comment/32174469
tagged with: exception
answer count: 3
has answer: http://stackoverflow.com/a/21339845
favorite count: 0
has comment: http://stackoverflow.com/comment/32170998
tagged with: serversocket
has comment: http://stackoverflow.com/comment/32175525
has title: Connect to remote port(Server) from thread in polling
type: UnansweredQuestion
tagged with: sockets
has answer: http://stackoverflow.com/a/21341606
upvote count: 1
score: 1
tagged with: java
tagged with: thread-safety

http://stackoverflow.com/comment/32154020
comment on: http://stackoverflow.com/a/21328909
has text: How do you use 'new GeoClusterFacetBuilder(facetName, facetField, facetFactor);' I get a compile error when I useit under setFacets
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/70735408
answers question: http://stackoverflow.com/q/21185156
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/125048634
upvote count: 1
has body: I was having this problem too. The issue for me was that I downloaded the aaarch64 version my fx global libraries. All you have to do is to download the x64 version of it. Try running your code again, it will probably work, it did for me. :) Link to download the fx lib files: https://gluonhq.com/products/javafx/
type: Answer

http://stackoverflow.com/q/21287493
has answer: http://stackoverflow.com/a/21288056
answer count: 3
has answer: http://stackoverflow.com/a/21287695
downvote count: 0
has body: I am just a beginner in java coding i was just writing a simple program : user is given a menu he has to enter number between 1-4 if user enters correct number, required task is done if wrong number is entered,user is again asked for input. Below is my program class menu { public static void main(String [] args) throws java.io.IOException { int choice; do { System.out.println("HELP MENU: "); System.out.println("IF STATEMENT: 1 "); System.out.println("WHILE: 2 "); System.out.println("DO WHILE: 3 "); System.out.println("SWITCH: 4 "); choice = System.in.read(); System.out.println(choice); } while( choice &lt; 1 || choice &gt; 4); System.out.println("\n"); System.out.println(choice); switch (choice) { case 1: System.out.println("if statement is selected"); break; case 2: System.out.println("while statement is selected"); break; case 3: System.out.println("do while statement is selected"); break; case 4: System.out.println("switch statement is selected"); break; } } } OUTPUT: +++++++ E:\study\javacode&gt;java menu HELP MENU: IF STATEMENT: 1 WHILE: 2 DO WHILE: 3 SWITCH: 4 4 52 HELP MENU: IF STATEMENT: 1 WHILE: 2 DO WHILE: 3 SWITCH: 4 13 HELP MENU: IF STATEMENT: 1 WHILE: 2 DO WHILE: 3 SWITCH: 4 10 HELP MENU: IF STATEMENT: 1 WHILE: 2 DO WHILE: 3 SWITCH: 4 what ever user is entering through keyboard ,the code keeps on iterating through do-while loop.i identified the cause by printing the input value and what i found is that input value is taken wrong by the code.Please help to solve this
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21287617
score: 2
tagged with: java
type: Question
tagged with: do-while
has title: Issues with do-while loop

http://stackoverflow.com/a/21349839
upvote count: 22
downvote count: 0
has body: java.util.Date is independent of the timezone. When you print cal_Two though the Calendar instance has got its timezone set to UTC, cal_Two.getTime() would return a Date instance which does not have a timezone (and is always in the default timezone) Calendar cal_Two = Calendar.getInstance(TimeZone.getTimeZone("UTC")); System.out.println(cal_Two.getTime()); System.out.println(cal_Two.getTimeZone()); Output: Sat Jan 25 16:40:28 IST 2014 sun.util.calendar.ZoneInfo[id="UTC",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null] From the javadoc of TimeZone.setDefault() Sets the TimeZone that is returned by the getDefault method. If zone is null, reset the default to the value it had originally when the VM first started. Hence, moving your setDefault() before cal_Two is instantiated you would get the correct result. TimeZone.setDefault(TimeZone.getTimeZone("UTC")); Calendar cal_Two = Calendar.getInstance(TimeZone.getTimeZone("UTC")); System.out.println(cal_Two.getTime()); Calendar cal_Three = Calendar.getInstance(); System.out.println(cal_Three.getTime()); Output: Sat Jan 25 11:15:29 UTC 2014 Sat Jan 25 11:15:29 UTC 2014
score: 22
answers question: http://stackoverflow.com/q/21349475
type: Answer

http://stackoverflow.com/comment/31918603
type: QuestionComment
comment on: http://stackoverflow.com/q/21197035
score: 1
has text: The text on image is too small to read. Post code
type: Comment

http://stackoverflow.com/comment/129557337
has text: Hi. Have you any news on this old subject? I've the same one : beans are created with XML files on Karaf but I've not found a JMX access to get the number of active connections. Thanks.
comment on: http://stackoverflow.com/q/21294570
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31936987
score: 1
type: QuestionComment
has text: @JuanManuel I don't have any code that handles the key events :/
type: Comment
comment on: http://stackoverflow.com/q/21207511

http://stackoverflow.com/q/21233586
type: UnansweredQuestion
tagged with: tcp
has comment: http://stackoverflow.com/comment/31987257
upvote count: 1
has answer: http://stackoverflow.com/a/21234955
has comment: http://stackoverflow.com/comment/31983572
has comment: http://stackoverflow.com/comment/31986707
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31986887
has body: My TCP Server public static void main(String argv[]) throws Exception { ServerSocket server = new ServerSocket(3333); System.out.println("Server started"); while (true) { Socket socket = server.accept(); BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream())); System.out.println("Received: " + input.readLine() + "\n"); } } My TCP Client. public static void main(String[] args) throws IOException { for (int i = 1; i &lt; 50000; i++) { Socket clientSocket = new Socket("localhost", 3333); DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream()); outToServer.writeBytes(i + "\n"); clientSocket.close(); System.out.println(i); } } The loop in TCP client runs till 16374 and stopped, throwing this exception. ... ... ... 16372 16373 16374 Exception in thread "main" java.net.SocketException: No buffer space available (maximum connections reached?): connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391) at java.net.Socket.connect(Socket.java:579) at java.net.Socket.connect(Socket.java:528) at java.net.Socket.&lt;init&gt;(Socket.java:425) at java.net.Socket.&lt;init&gt;(Socket.java:208) at mawia.test.Client.main(Test.java:11) What is wrong with my code? Why do I get this error? How to solve this problem?
has comment: http://stackoverflow.com/comment/31983938
type: Question
answer count: 2
downvote count: 0
favorite count: 0
tagged with: sockets
has comment: http://stackoverflow.com/comment/31983867
has title: Simple TCP Client-Server application throws exception
has answer: http://stackoverflow.com/a/21234079

http://stackoverflow.com/a/21263929
has comment: http://stackoverflow.com/comment/32045375
has body: In hibernate the escape of the colon : is done with a backslash: SET @rownum \:= 0; SELECT rnum FROM ( ... Or in java: String sql = "SET @rownum \\:= 0; SELECT rnum FROM ( ...";
upvote count: 8
has comment: http://stackoverflow.com/comment/52034884
has comment: http://stackoverflow.com/comment/52034983
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/114019778
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/52040137
has comment: http://stackoverflow.com/comment/32041267
accepted answer of: http://stackoverflow.com/q/21263771
has comment: http://stackoverflow.com/comment/52033397
answers question: http://stackoverflow.com/q/21263771
downvote count: 0

http://stackoverflow.com/comment/32103531
comment on: http://stackoverflow.com/q/21283316
has text: Ok, but if I mock the owner I also have to mock the person and som whens for that. This results in alot of code cluttering up the test. And it takes longer time writing. What is the thing that is built into Mockito?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32051223
comment on: http://stackoverflow.com/a/21271631
has text: No, you won't. You create a single instance in your `writeStudentInfo` and simply pass a "pointer" to that instance to each method. If I give you an ice cream, does it create a new instance of the ice cream? (I wish it did...)
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/a/21254702
has body: You should use Thread.currentThread().getContextClassLoader() (javadoc) instead of the system class loader, which is "the default delegation parent for new ClassLoader instances, and is typically the class loader used to start the application" (reference).
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21254465

http://stackoverflow.com/comment/32107455
type: AnswerComment
has text: @DavidWallace the problem is with division and later casting. it works for specific case of division by 2, but fails for other numbers. Example: (int)(((float)1)/3 * 3). To lesser importance - it is also less efficient than the alternative solution, due to the need to cast and work with floating points arithmetics - which are slower on some machines.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21303770

http://stackoverflow.com/q/21258503
type: Question
has comment: http://stackoverflow.com/comment/32027161
linked to: http://stackoverflow.com/q/10888367
tagged with: swing
has body: I am trying to integrate JavaFX in an existing Swing application. I am following this tutorial, so before actually integrating it into the existing application, I can have an environment with reduced complexity and try if it is working before moving further. I was following the tutorial at the official website of Oracle/JavaFX at http://docs.oracle.com/javafx/2/swing/swing-fx-interoperability.htm . Especially, I was also downloading the source code of the example SwingInterop.zip and still getting the same exception: run: Exception in thread "Thread-1" java.lang.UnsatisfiedLinkError: com.sun.glass.ui.win.WinApplication._submitForLaterInvocation(Ljava/lang/Runnable;)V at com.sun.glass.ui.win.WinApplication._submitForLaterInvocation(Native Method) at com.sun.glass.ui.win.WinApplication.submitForLaterInvocation(WinApplication.java:215) at com.sun.glass.ui.InvokeLaterDispatcher.run(InvokeLaterDispatcher.java:101) I've found a thread in StackOverflow (UnsatisfiedLinkError when running mvn jfx:run with IntelliJ) which might be the one I'm looking for. Is this what I need to do? I tried but it didn't work, probably because I did not do it properly? It has to do with performing the operation in the correct thread,because as far as I understand Swing and JavaFX are running in two different threads: the portion of code (which is the one in the example, not even written by me) which leeds to this issue might be : @Override public void init() { tableModel = new JTableDataInOut(); // create javafx panel for charts chartFxPanel.setPreferredSize(new Dimension(PANEL_WIDTH_INT, PANEL_HEIGHT_INT)); //create JTable JTable table = new JTable(tableModel); table.setAutoCreateRowSorter(true); table.setGridColor(Color.DARK_GRAY); SwingInterop.DecimalFormatRenderer renderer = new SwingInterop.DecimalFormatRenderer(); renderer.setHorizontalAlignment(JLabel.RIGHT); for (int i = 0; i &lt; table.getColumnCount(); i++) { table.getColumnModel().getColumn(i).setCellRenderer(renderer); } JScrollPan…
tagged with: netbeans
has comment: http://stackoverflow.com/comment/32031770
has comment: http://stackoverflow.com/comment/32035094
has comment: http://stackoverflow.com/comment/32031625
score: 0
tagged with: java
tagged with: javafx
linked to: http://stackoverflow.com/q/19716240
has comment: http://stackoverflow.com/comment/32036935
has comment: http://stackoverflow.com/comment/32032298
has comment: http://stackoverflow.com/comment/32031722
has comment: http://stackoverflow.com/comment/32030013
has title: Unable to integrate JavaFX inside Java Swing
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32038614
tagged with: java-7
answer count: 0

http://stackoverflow.com/comment/31960574
type: AnswerComment
comment on: http://stackoverflow.com/a/21219820
type: Comment
has text: You're mixing up `long` and `int`. `0xFFFFFFFFL` is a perfectly valid nonnegative signed long. `Long.MAX_VALUE` is `0x7FFFFFFFFFFFFFFFL`, a much bigger number.
score: 1

http://stackoverflow.com/comment/31978137
has text: no way to check -_- when i click on that eclipse.exe it is showing "A java run time environment(jre) or jdk must be available in order to run Eclipse. no java virtual machine was found after searching the following location.......in your Current PATH
score: 0
comment on: http://stackoverflow.com/a/21230014
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31962961
comment on: http://stackoverflow.com/a/21219149
type: Comment
score: 0
type: AnswerComment
has text: This is a scientific term. "in vivo" means "within the living" as opposed to "in vitro" which is in the petri dish. What I mean is to create the JDialog while the program is running only when needed.

schedule
tags question: http://stackoverflow.com/q/21219010
tag name: schedule
type: Tag

http://stackoverflow.com/q/21203218
has title: Creating custom XML from XPaths stored in text file
has answer: http://stackoverflow.com/a/21242688
tagged with: sax
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: xpath
tagged with: java
tagged with: dom
type: Question
accepted answer: http://stackoverflow.com/a/21242688
has body: I have a text file that contains xpaths from some other (source) xml file. But, now I want to use those xpaths to create my custom xml file . Below are files as above :- Source.xml <?xml version="1.0" encoding="UTF-8"?> My Page HomePage UserName Password Generated xpaths using java stored in text file:- source-xpaths.txt //html[1]/head[1]/title[1]="My Page" //html[1]/body[1]/a[1][@href='abc.html'] //html[1]/body[1]/a[1]="HomePage" //html[1]/body[1]/form[1][@id='my form'] //html[1]/body[1]/form[1][@name='form 22'] //html[1]/body[1]/form[1][@class='forms'] //html[1]/body[1]/form[1]/table[1][@id='table1'] //html[1]/body[1]/form[1]/table[1]/tbody[1]/tr[1]/td[1]/a[1]="UserName" //html[1]/body[1]/form[1]/table[1]/tbody[1]/tr[1]/td[1]/input[1][@type='textbox'] //html[1]/body[1]/form[1]/table[1]/tbody[1]/tr[1]/td[1]/input[1][@id='username'] //html[1]/body[1]/form[1]/table[1]/tbody[1]/tr[1]/td[1]/input[1][@name='uname'] //html[1]/body[1]/form[1]/table[1]/tbody[1]/tr[1]/td[1]/input[1][@class='login'] //html[1]/body[1]/form[1]/table[1]/tbody[1]/tr[2]/td[1]/a[1]="Password" //html[1]/body[1]/form[1]/table[1]/tbody[1]/tr[2]/td[1]/input[1][@type='textbox'] //html[1]/body[1]/form[1]/table[1]/tbody[1]/tr[2]/td[1]/input[1][@id='password'] //html[1]/body[1]/form[1]/table[1]/tbody[1]/tr[2]/td[1]/input[1][@name='pwd'] //html[1]/body[1]/form[1]/table[1]/tbody[1]/tr[2]/td[1]/input[1][@class='login'] Now, I want my custom xml to be formed from this xpaths as below:- abc.html textbox username uname login textbox</text> password pwd login //etc etc.... In short, I want all text in or tags to be parent node and all corresponding attributes to be their child nodes. How can I create custom xml in java? Any help is appreciated... :)
has comment: http://stackoverflow.com/comment/31997202
score: 0
answer count: 1

http://stackoverflow.com/comment/31987390
has text: @Pureferret: The output I'm looking for is - "Steak: 2" ; "Tuna Salad : 3"; "Tomato Soup: 2". I'm new to java and I find it kinda hard to understand some things, I would just like to how this works and what I'm doing wrong here
score: 0
comment on: http://stackoverflow.com/q/21234341
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32036704
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21263795
type: QuestionComment
has text: Do you have EL enabled?

http://stackoverflow.com/comment/31931668
comment on: http://stackoverflow.com/q/21204500
score: 0
has text: There are real life example when inner classes are exposed.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32188423
score: 0
type: Comment
type: QuestionComment
has text: Can't you just annotate the classes with the foreign key constraint? Does JPA actually *verify* its presence in the database?
comment on: http://stackoverflow.com/q/21349061

http://stackoverflow.com/q/21276984
tagged with: android
has comment: http://stackoverflow.com/comment/32060210
has title: Array-OutOfBound Exception in android
has answer: http://stackoverflow.com/a/21277092
type: UnansweredQuestion
has body: i'm new to android and got stuck up in horizontal swipe. let me explain in detail, i have couple of datas in ListView if the user clicks the ListView item- Detailed description page gets opened, here i need to swipe the "Detailed Description" page horizontally. i downloaded and tested some of the tutorials using pageIndicator library. finally was able to get ListView data but when clicked on list item it gets force close, the error in logcat says OutOfBound Exception Please help me, thanks. Logcat Exception 01-22 12:28:46.530: E/AndroidRuntime(1084): FATAL EXCEPTION: main 01-22 12:28:46.530: E/AndroidRuntime(1084): java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 01-22 12:28:46.530: E/AndroidRuntime(1084): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257) 01-22 12:28:46.530: E/AndroidRuntime(1084): at java.util.ArrayList.get(ArrayList.java:311) 01-22 12:28:46.530: E/AndroidRuntime(1084): at com.jokes.LayoutTwo.onCreateView(LayoutTwo.java:70) 01-22 12:28:46.530: E/AndroidRuntime(1084): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500) 01-22 12:28:46.530: E/AndroidRuntime(1084): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927) LayoutTwo.java @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.samples, null); TextView txttitle = (TextView) root.findViewById(R.id.titles); ///////// The exception arises in below line /////// txttitle.setText(Common.rowItems.get(Common.itemnumber).get("strtitle")); TextView txtDescription = (TextView) root.findViewById(R.id.description); txtDescription.setText(Common.rowItems.get(Common.itemnumber).get("strDesc")); Intent in = getActivity().getIntent(); String strtitle = in.getStringExtra("strtitle"); String strDesc = in.getStringExtra("strDesc"); return root; } But i have given the array length correctly in MainActivity. MainActivi…
tagged with: java
tagged with: listview
type: Question
has comment: http://stackoverflow.com/comment/32060144
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/21277155
score: 0

http://stackoverflow.com/comment/32148191
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21288349
has text: I don't really understand that. Adding @Column doesn't make much sense in this case. Remember you're mapping a composite id. You should query the id fields navigating to them with a dot, through the id property, with statements like select id.userid or id.group from user_group.

http://stackoverflow.com/comment/31896867
has text: When you say 'single query', do you mean 'single insert statement'?
comment on: http://stackoverflow.com/q/21185455
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32070638
has text: Can't help without checking your source code or at least the important parts
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21281495
score: 0

http://stackoverflow.com/comment/31937654
type: QuestionComment
comment on: http://stackoverflow.com/q/21207895
has text: `System.out.println("The number of attemt is " + ++wrong);`
score: 0
type: Comment

http://stackoverflow.com/comment/31927075
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21201846
has text: ok , i Would edit the first post and write the code i tried (though) it's not written in good shape and is wrong, but i will.

http://stackoverflow.com/comment/32021089
comment on: http://stackoverflow.com/q/21254940
type: QuestionComment
type: Comment
has text: @RohitJain - Changes that I have to do to regex is not provided in that duplicate
score: 0

http://stackoverflow.com/a/21446185
has body: I stumbled upon this fix http://ucanaccess.sourceforge.net/site.html Install UCanAccess-2.0.1-bin.zip and include all the files. I encountered some minor bugs such as not being able to pass ' and " into Access, but it successfully allows 64bit computers to connect 32bit Access. Hope this helps you Access programmers!
accepted answer of: http://stackoverflow.com/q/21289516
answers question: http://stackoverflow.com/q/21289516
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32369008
type: Answer

http://stackoverflow.com/q/21244243
score: 0
has title: Is it possible for javax.xml.transform.Transformer.transform method to write an incomplete/invalid XML doc without throwing an Exception
tagged with: exception
has comment: http://stackoverflow.com/comment/32003154
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/32026420
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32004252
type: Question
has comment: http://stackoverflow.com/comment/32003339
tagged with: java
tagged with: transform
has body: I have a method that updates a specific node's text content in a XML document. Is it possible for the below method to write an invalid/incomplete XML document without throwing an exception? Transformer doc: http://docs.oracle.com/javase/7/docs/api/javax/xml/transform/Transformer.html private static void updateUserNode(String nodeMatchValue, String updateNodeValue, String fileName) throws Exception { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.parse(fileName); NodeList list = doc.getElementsByTagName("user"); for (int i = 0; i &lt; list.getLength(); i++) { Node node = list.item(i); if (node == null) continue; if (nodeMatchValue.equals(node.getTextContent())) { node.setTextContent(updateNodeValue); } } TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(new File(AppProperties.tmpDir + fileName.substring(fileName.lastIndexOf("/") + 1))); transformer.transform(source, result); } Thank you, Tom
has comment: http://stackoverflow.com/comment/32035555
has comment: http://stackoverflow.com/comment/32003372

http://stackoverflow.com/a/21311081
score: 2
has body: Using Collections to min/max List&lt;Float&gt; myList = new ArrayList&lt;Float&gt;(); System.out.print("Please enter your first temperature"); myList.add(scan.nextFloat()); System.out.print("Please enter your second temperature"); myList.add(scan.nextFloat()); System.out.print("Please enter your third temperature"); myList.add(scan.nextFloat()); System.out.println(Collections.min(myList)); System.out.println(Collections.max(myList)); You can also use a loop to get your input instead of using System.out.print
answers question: http://stackoverflow.com/q/21310851
downvote count: 0
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/32119946

http://stackoverflow.com/q/21230347
has comment: http://stackoverflow.com/comment/31983352
tagged with: maven
has answer: http://stackoverflow.com/a/21238908
type: AnsweredQuestion
has body: Is there a way to package storm and cassandra into an executable jar so that as part of running the jar a single node storm and cassandra will be deployed and serve the program. thanks.
score: 1
tagged with: java
has title: Packaging storm and cassandra into an executable jar using maven
upvote count: 1
accepted answer: http://stackoverflow.com/a/21238908
tagged with: apache-storm
type: Question
has comment: http://stackoverflow.com/comment/31978141
answer count: 1
downvote count: 0
favorite count: 0
tagged with: cassandra

http://stackoverflow.com/a/55594499
score: 16
upvote count: 16
type: AcceptedAnswer
downvote count: 0
has body: The answer to disable SerializationFeature.FAIL_ON_EMPTY_BEANS is global, and you therefore might not wish to apply it. The answer to add any serialisation annotation showed the correct (as in: the Javadoc of SerializationFeature.FAIL_ON_EMPTY_BEANS suggests it) way to fix it, but only with a hackish or an unrelated annotation. By merely adding… @JsonSerialize … to my class (not even parenthesēs after it, lest alone arguments!) I was able to produce the same effect (as, again, indicated by the Javadoc of SerializationFeature.FAIL_ON_EMPTY_BEANS).
type: Answer
answers question: http://stackoverflow.com/q/21246733
accepted answer of: http://stackoverflow.com/q/21246733

http://stackoverflow.com/comment/32001488
score: 0
type: Comment
has text: I can't see a question here.
type: QuestionComment
comment on: http://stackoverflow.com/q/21240869

http://stackoverflow.com/q/21316750
answer count: 0
score: 0
tagged with: java
has title: How can I utilize two default scoped objects in a test without making it public?
has comment: http://stackoverflow.com/comment/32360572
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/32130148
type: Question
has body: Consider two classes that sit in two packages: package com.foobar.barers; abstract class BaseFooBarer&lt;T&gt; extends BaseBarer{ ... } and package com.foobar.unbarers; abstract class BaseFooUnbarer&lt;T&gt; extends BaseUnbarer{ ... } Now anything thing that can be "barred" by a BaseBarer should be able to be "unbarred" by a BaseUnbarer. But a BaseFooBarer also contains the method "BarredFoo getBarredFoo()" and "void setFoo(Foo foo)". A BaseFooUnbarer contains the method "Foo getFoo()" and "void setBarredFoo(BarredFoo barredFoo)". Given that I have several implementations of BaseFooBarer and their corresponding BaseFooUnbarer, I thought it would be easiest to test it using a parameterized junit test. Unfortunately, since they sit in separate packages I can't place the test in a package that can access both. So I'm left with either making five nearly identical tests starring the public implementations or making these things public. Now I have no desire in making them public because I don't want anybody extending them other than the implementations in my jar. I also don't want five redundant tests in my code. Is there any pattern in Java that will allow me to have my cake and eat it too? There's a limitation in which I'm unable to move these classes into one package, so I can't take the easy way out.
tagged with: scope
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32130432

http://stackoverflow.com/a/21223346
has comment: http://stackoverflow.com/comment/31966798
has body: There isn't much documentation for this framework. It certainly is easy to misunderstand the purpose. This framework is for the recursive decomposition of balanced trees (DAG.) It doesn't tolerate misuse very well since it was originally designed as an experiment in a research paper. The framework wants to split left, right. Left.fork(), right.compute(), left.join(). This way it walks down the leaves of a balanced tree. Forked tasks go back into its deque hopefully stolen by other threads. When all goes as planned each thread forks enough tasks for other threads and is kept busy. What you are doing is putting three tasks back into the deque and then processing one quad. This doesn't spread the work around very well. What you can end up with is several threads having many tasks pending instead of many threads having few pending tasks. This framework is incapable of load balancing properly. There is also the problem of join(). Join() requires a context switch to free the thread for other work. This framework cannot do a context switch so it creates a “continuation thread” for each join() and then issues a wait() for the joining thread. With many joins, you may have a lot of create/destroy overhead. The Java8 version does away with the “continuation thread” but ends up stalling frequently (especially the way you are doing it.) Try redesigning to process a DAG and see what happens. With 16 threads it should work well.
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/21219042
has comment: http://stackoverflow.com/comment/31990345
type: Answer
answers question: http://stackoverflow.com/q/21219042

http://stackoverflow.com/comment/31909503
type: AnswerComment
score: 0
type: Comment
has text: Cool! Let me know if you find your solution or starts developing yours, I'd like to take a look :)
comment on: http://stackoverflow.com/a/21191182

http://stackoverflow.com/q/21273508
type: Question
has body: https://i.sstatic.net/y6U5d.png The above is a relative layout, I want to be able to make it go up using the arrow marker only. Usually I'd be using a 2d engine to do things like this (coming from making games). I'm not that used to views and such but they seem a little limiting (Like setY doesn't work on some devices..., or placing views off screen resizes them) Anyhow how would one place this half off screen then allow it to come into view? It's easy to do on iPhone and seems like a hassle on Android (Some tutorials have a gazillion lines of code, I just want something simple..)
tagged with: java
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21274169
has answer: http://stackoverflow.com/a/21275302
has title: Animating part of a view from the bottom of the screen

http://stackoverflow.com/a/21304874
score: 0
has body: [SPACE] [ActiveMQ Session Task] [createreviseswpart_0:69:1:1:1] DEBUG 10:33:55 (CreateReviseSWPart.java:348) - Checkin Exception::java.net.SocketException: Connection reset Looking at the javadoc for SocketException it states that Thrown to indicate that there is an error creating or accessing a Socket. This is most likely caused by a TCP error. In your case it seems that the connection has been closed by the server end of the connection. This could be for many many reasons... Try debugging the network traffic with a tool like Wireshark to view the actual packets. Hav you tried accessing the 2GB file using another tool (wget/curl/a webbrowser?).
answers question: http://stackoverflow.com/q/21304711
type: Answer

http://stackoverflow.com/q/21307967
has answer: http://stackoverflow.com/a/21308082
score: 2
upvote count: 2
tagged with: java
has title: From Calendar to GregorianCalendar without cast
type: Question
has answer: http://stackoverflow.com/a/21308098
has body: I'd like to get a GregorianCalendar object from an instanceof a Calendar. Obviously I could just cast the Calendar object because in most cases the real implementation of an abstract Calendar is the GregorianCalendar. But if I don't know what is the real implementation and I'd like to force the creation of a GregorianCalendar version of that other Calendar? How can I do? I looked for many search engines but i found nothing.
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/32113281
comment on: http://stackoverflow.com/a/21282117
type: AnswerComment
has text: @sabby What do you mean by form names?
score: 0
type: Comment

http://stackoverflow.com/a/21255288
downvote count: 1
has comment: http://stackoverflow.com/comment/32033152
score: 0
has comment: http://stackoverflow.com/comment/32033301
has comment: http://stackoverflow.com/comment/32032960
answers question: http://stackoverflow.com/q/21254693
has body: What peeskillet said is correct. private int jobCount; public int getJobCount() { return jobCount; } public void setJobCount(int jobCount) { this.jobCount = jobCount; } Followed by: public class JFrame2() { int passedJobCount = c1.getJobCount(); } That is how you use private variables correctly. For further reading, check out Oracle's Tutorial on Member Declarations.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/32033795
has comment: http://stackoverflow.com/comment/32033428

http://stackoverflow.com/q/21241210
upvote count: 32
has answer: http://stackoverflow.com/a/29444911
favorite count: 0
has comment: http://stackoverflow.com/comment/31998556
type: UnansweredQuestion
score: 32
tagged with: spring
has comment: http://stackoverflow.com/comment/32003898
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/8565051
has comment: http://stackoverflow.com/comment/31997452
type: Question
has title: compatibility of spring 4.0.0 with hibernate 4.30
duplicate of: http://stackoverflow.com/q/8565051
has answer: http://stackoverflow.com/a/21244329
has answer: http://stackoverflow.com/a/25109098
downvote count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31999174
has comment: http://stackoverflow.com/comment/31997665
has body: I am using Spring 4.0.0 RELEASE jars, hibernate-coe 4.3.0 jar in my spring + hibernate project. I am facing an error with org.hibernate.engine.FilterDefinition is not found. Actually in old hibernate core jars, we are having this class but not in 4.3.0 version. In fact we are having org.hibernate.engine.spi.FilterDefinition in 4.3.0 version. But I am not sure how this class is dependent in run time. Mean while I am using glassfish server to my application. Please let me know the compatibility of spring 4.0.0 and hibernate 4.3.0 versions and suggest me the latest compatible versions of these two. My code is: dispatcher-servlet is having com.venkat.homeapp.entity.CustomerEntity ${hibernate.dialect} ${hibernate.show_sql} My controller class is: @Controller @RequestMapping("/") @ComponentScan("com.venkat.homeapp.service") public class HomeAppController { @Autowired private CustomerService customerService; : : } The log which I can see is: INFO: WebModule[null] ServletContext.log():No Spring WebApplicationInitializer types detected on classpath INFO: WebModule[null] ServletContext.log():Initializing Spring FrameworkServlet 'HomeApp' INFO: FrameworkServlet 'HomeApp': initialization started INFO: Refreshing WebApplicationContext for namespace 'HomeApp-servlet': startup date [Mon Jan 20 23:42:45 IST 2014]; root of context hierarchy INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/HomeApp-servlet.xml] INFO: Loading properties file from class path resource [jdbc.properties] INFO: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'homeAppController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.venkat.homeapp.service.CustomerService com.venkat.homeapp.controller.HomeAppController.customerServ…

http://stackoverflow.com/a/21245200
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21232483
accepted answer of: http://stackoverflow.com/q/21232483
has body: To have the test resources (HTML files) moved to target directory follow the default project structure as described in Source code or Testing, i.e. src/test/resources that contains files to include in test jar here.
has comment: http://stackoverflow.com/comment/32062278
score: 0

http://stackoverflow.com/a/21228988
has body: JSon is text, so you cannot use an ObjectOutputStream. The POST method uses the first line of the content as the arguments, so you would need a blank line before the actual content: OutputStream stream = connection.getOutputStream(); stream.write('\r'); stream.write('\n'); out = new OutputStreamWriter(stream, "UTF-8"); out.write(data.toString()); out.flush(); out.close(); EDIT: actually we need CR LF, so println() may not work.
type: Answer
answers question: http://stackoverflow.com/q/21228773
score: 0

http://stackoverflow.com/q/21241658
answer count: 2
has title: How many integers can be stored in this 2-dimensional array?
has answer: http://stackoverflow.com/a/21241684
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21241684
tagged with: multidimensional-array
upvote count: 2
has body: I'm studying for my exams and I've bumped into a problem I can't solve. The question here is "How many different int-values can be stored in the two dimensional array "arr" after running the code?" int[][] arr = new int[3][]; arr[0] = new int[5]; for (int i = 1; i &lt; arr.length; i++) { arr[i] = arr[i-1]; } I thought the answer was 7, and here's why: You create the 2-D array "arr" and immediately declare that it has 3 open values in 1 dimension. Then you say that the the first open value becomes an array itself, containing 5 open values. Then finally, the for-loop says that the second value of the original array becomes the first value and the same goes for the third value of the original array. (These values weren't initialized, so it boils down to 0 becoming 0 since that's the standard value for an integer) Which gives 7. Though the answer should be 5 according to my book, and I can't find why. Thanks in advance!
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21241842
tagged with: java
has answer: http://stackoverflow.com/a/21241842
type: Question
has comment: http://stackoverflow.com/comment/31998633

http://stackoverflow.com/comment/31980420
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21230161
type: Comment
has text: @MadProgrammer *"thought is was fun splashing water onto my socks"* ..Whatta'ya'mean by 'thought'? I **still** think that's fun. :)

http://stackoverflow.com/q/21208049
has comment: http://stackoverflow.com/comment/31937950
upvote count: 1
has comment: http://stackoverflow.com/comment/31938031
tagged with: java
has body: I want a boolean method that takes two arrays and returns true when the all the numbers in the first array there are in the second array. If at least one number doesn't match, then returns false. Here is my code but something is off. public static boolean noMoreRolls(int[] paramArrayOfInt1, int[] paramArrayOfInt2) { boolean test[] = new boolean[paramArrayOfInt1.length]; int total = 0; boolean end = false; for (int i = 0; i &lt; paramArrayOfInt1.length; i++) { for (int j = 0; j &lt; paramArrayOfInt2.length; j++) { if (paramArrayOfInt1[i] == paramArrayOfInt2[j]) test[i] = true; } if (test[i] == true) total++; } if (total == test.length) { end = true; } return end; } Thanks in advance. EDIT: Sorry for the misleading and the wrong way to put the things down. The 2 arrays don't have the same length. An example to understand my code: Array 1: [ 6, 6, 1, 2, 3,] / Array 2: [ 2 ,3 ], it should returns false. Array 1: [ 2 ] / Array 2: [ 5, 5, 4, 4, 2], it should returns true.
tagged with: methods
has answer: http://stackoverflow.com/a/21208133
type: Question
has title: Is there a better way to write this method?
downvote count: 5
score: -4
has comment: http://stackoverflow.com/comment/31938055
has comment: http://stackoverflow.com/comment/31937930
has comment: http://stackoverflow.com/comment/31937937
answer count: 1
has comment: http://stackoverflow.com/comment/31938042
has comment: http://stackoverflow.com/comment/31938200
favorite count: 0
has comment: http://stackoverflow.com/comment/31937916
has comment: http://stackoverflow.com/comment/31937897
has comment: http://stackoverflow.com/comment/31938010
type: UnansweredQuestion

http://stackoverflow.com/comment/32109465
type: AnswerComment
score: 0
type: Comment
has text: @Navin and HaraldK Sorry, this is completely irrelevant quest. Is it possible to find the byte[] of an image directly? Since am not reading any file(image) from disk or any location. Am receiving images as BufferedImage . Attempting to read its bytes and trying something differently.
comment on: http://stackoverflow.com/a/21301893

http://stackoverflow.com/a/21257171
has comment: http://stackoverflow.com/comment/32030498
downvote count: 0
answers question: http://stackoverflow.com/q/21257104
score: 4
type: Answer
upvote count: 4
has body: Straight from the JavaDoc: Like most collection implementations EnumMap is not synchronized. If multiple threads access an enum map concurrently, and at least one of the threads modifies the map, it should be synchronized externally. This is typically accomplished by synchronizing on some object that naturally encapsulates the enum map. If no such object exists, the map should be "wrapped" using the Collections.synchronizedMap(java.util.Map&lt;K, V&gt;) method. This is best done at creation time, to prevent accidental unsynchronized access: Map&lt;EnumKey, V&gt; m = Collections.synchronizedMap(new EnumMap&lt;EnumKey, V&gt;(...));

http://stackoverflow.com/comment/31970353
has text: when using android i would do that in the onAttach method for a fragment, however not sure on the best way to do that here
score: 0
comment on: http://stackoverflow.com/q/21226046
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32455738
comment on: http://stackoverflow.com/a/21499263
type: AnswerComment
has text: @swirlobt My friend is that you want
score: 0
type: Comment

google-play
tags question: http://stackoverflow.com/q/21268595
type: Tag
tag name: google-play
tags question: http://stackoverflow.com/q/21309423

http://stackoverflow.com/a/21342966
answers question: http://stackoverflow.com/q/21326607
has comment: http://stackoverflow.com/comment/32178468
has comment: http://stackoverflow.com/comment/32180149
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32779632
type: Answer
has body: I'm not sure of the spot offhand, but TileMill does this and is open source (http://github.com/mapbox/tilemill). It may defer to Mapnik for the de-dupe. One thing to keep in mind is that once you've determined a tile is a duplicate, you can also discount all tiles below it in the "pyramid" -- for example, a single tile is four tiles in the next zoom level down, and each of those is another four in the next zoom etc.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21326607

http://stackoverflow.com/a/21236174
has body: I am not sure It is what you need, but i think you can retrieve data and time from file name, parse it to Date time and get the biggest one, so it will be the last version, right?
score: 0
has comment: http://stackoverflow.com/comment/31988443
has comment: http://stackoverflow.com/comment/31988413
answers question: http://stackoverflow.com/q/21236105
type: Answer

http://stackoverflow.com/comment/32043656
type: Comment
comment on: http://stackoverflow.com/q/21267372
type: QuestionComment
has text: @nachokk Correct. It's Swing
score: 0

http://stackoverflow.com/comment/32150558
type: AnswerComment
comment on: http://stackoverflow.com/a/21327230
type: Comment
score: 0
has text: "you don't want to write your own versioning" you meant "you want to write your own versioning"? Can you elaborate here.

http://stackoverflow.com/a/21352933
answers question: http://stackoverflow.com/q/21348016
has body: Simply set your HttpServletResponse's status code to 302 and the Location header to the URI you want response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY); // or SC_FOUND response.setHeader("Location", "some uri");
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32206721
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21348016
has comment: http://stackoverflow.com/comment/32206910
type: Answer
has comment: http://stackoverflow.com/comment/32206871

http://stackoverflow.com/a/21296122
has body: from the top of my Head try this: mAusisImage = (ImageView) child.findViewById(R.id.ausis_image); guessing that second setOnClickListener will throw NPE as well, just do the same with that view guessing that the ImageView is within R.layout.layout_mainscreen_submenu_seismometer, but due to the short code snippet i cant be sure :)
score: 0
answers question: http://stackoverflow.com/q/21296083
type: Answer

http://stackoverflow.com/q/21217264
answer count: 4
has answer: http://stackoverflow.com/a/21217374
has answer: http://stackoverflow.com/a/21217364
linked to: http://stackoverflow.com/q/40480
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31954326
has comment: http://stackoverflow.com/comment/31954395
possible better answer: http://stackoverflow.com/a/21217345
downvote count: 0
score: 1
tagged with: java
has title: HashMap memory allocation is not clear
has comment: http://stackoverflow.com/comment/31954222
type: Question
has answer: http://stackoverflow.com/a/21217349
accepted answer: http://stackoverflow.com/a/21217349
tagged with: hashmap
upvote count: 1
has body: According to android's developers site it seems like the method public V put (K key, V value) will use the given value object as reference, while the method public void putAll (Map&lt;? extends K, ? extends V&gt; map) will copy each of the supplied map elements to a new value object. The android source does not reveal the internals of each of these methods. Is my understanding correct?
favorite count: 0
has answer: http://stackoverflow.com/a/21217345
tagged with: android

keyevent
tags question: http://stackoverflow.com/q/21307776
type: Tag
tags question: http://stackoverflow.com/q/21260842
tag name: keyevent
tags question: http://stackoverflow.com/q/21204894
tags question: http://stackoverflow.com/q/21206059
tags question: http://stackoverflow.com/q/21237666

http://stackoverflow.com/a/21260693
answers question: http://stackoverflow.com/q/21260630
score: 2
downvote count: 0
upvote count: 2
has body: Primitive is not an object - no.
type: Answer

http://stackoverflow.com/q/21300722
tagged with: jstl
has title: ClassNotFoundException for JSTL jar when I try to migrate JBoss 7.1 application to JSF 2.2
answer count: 0
tagged with: jsf
type: UnansweredQuestion
tagged with: java
type: Question
has body: I am trying to migration JSF 2.2 in JBoss 7.1.1 Final. I already install modules suggested from this website (JSF 2.2inJBoss 7.1.1 Final). modules javax.servlet-api-3.0.1.jar javax.servlet.jsp.jstl-api-1.2.1.jar jsf-api-2.2.1.jar jsf-impl-2.2.1.jar When I use javax.servlet.jsp.jstl-api-1.2.1.jar as JSTL module, I got following exception: Caused by: java.lang.ClassNotFoundException: javax.servlet.jsp.jstl.core.ConditionalTagSupport from [Module "javax.servlet.jstl.api:main" from local module loader @84da23 (roots: D :\java\JBoss-7.1.1\modules)] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) ... 26 more 12:37:15,915 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."jsf-cdi.war".POST_MODULE: org.jboss.msc.service.St artException in service jboss.deployment.unit."jsf-cdi.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "jsf-cdi.war" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor$Worker.run…
has comment: http://stackoverflow.com/comment/32108829
has comment: http://stackoverflow.com/comment/32108102
tagged with: jsf-2.2
tagged with: jboss
score: 0

http://stackoverflow.com/a/21198699
upvote count: 1
answers question: http://stackoverflow.com/q/21198679
downvote count: 0
has body: You need to use the selected file as the Scanner source rather than the system InputStream Scanner in = new Scanner(file);
type: Answer
score: 1

http://stackoverflow.com/a/21330234
downvote count: 0
has comment: http://stackoverflow.com/comment/32209270
has body: I have googled for "Java_java_util_zip_Deflater_deflateBytes+0x269" as the most salient part from your report, and this is where it took me: https://bugs.openjdk.java.net/browse/JDK-8028216 It says that it is a known bug, reported against Java 7 Update 45.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21330076
score: 2

http://stackoverflow.com/comment/31979707
type: QuestionComment
has text: That's what I did maartinus.. I ran it for the first time and after it completed, and then I ran it again to measure the performance.. And still I got the same numbers..
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21231135

http://stackoverflow.com/q/21311517
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/32120971
tagged with: java
has body: I have a file jav1.jar. If I run it it downloads jav2.jar from internet and then it starts with Process sp = Runtime.getRuntime().exec("cmd /c start javaw -jar jav2.jar"); What do I need to do in order to terminate jav1.jar but keep jav2.jar running? Is it possible? I still can not do it. I dont know how to terminate jav1.jar. System.exit(0); does nothing. When I terminate jav2.jar from task manager, it will also terminate jav1.jar. Also If I correctly terminate jav2.jar, jav1.jar will close. Does anybody have a solution?
linked to: http://stackoverflow.com/q/931536
type: Question
linked to: http://stackoverflow.com/q/402330
has comment: http://stackoverflow.com/comment/32126285
tagged with: jar
downvote count: 0
has comment: http://stackoverflow.com/comment/32120755
has title: Java runs .jar and terminate itself
score: 2
has comment: http://stackoverflow.com/comment/35338106
favorite count: 0
has comment: http://stackoverflow.com/comment/32120601
has comment: http://stackoverflow.com/comment/32120611
upvote count: 2

http://stackoverflow.com/a/21198703
upvote count: 1
has comment: http://stackoverflow.com/comment/31932547
has body: This isn't working because you are not using the file obtained from the JFileChooser. Try changing: Scanner in = new Scanner(System.in); To Scanner in = new Scanner(file);
score: 1
answers question: http://stackoverflow.com/q/21198679
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31927467

http://stackoverflow.com/q/21314700
linked to: http://stackoverflow.com/q/20669862
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32127787
has comment: http://stackoverflow.com/comment/32126470
has comment: http://stackoverflow.com/comment/32126638
tagged with: cloud
tagged with: amazon-ec2
answer count: 1
downvote count: 0
has title: How to run a Jar in Amazon EC2?
tagged with: amazon-web-services
favorite count: 0
has comment: http://stackoverflow.com/comment/32127839
linked to: http://stackoverflow.com/q/16564305
has comment: http://stackoverflow.com/comment/32126311
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32127194
has comment: http://stackoverflow.com/comment/32126620
has body: I am fairly new to Amazon. I have a Java file which reads GBs of crawled data and I am running this using AWS ToolKit for Eclipse. The disadvantage here is, I have to keep my machine running for weeks if I need to read the entire crawled data and that is not possible. Apart from that, I can't download GBs of data in to my local PC (Because it is reading data). Is there any way that I can upload the Jar to Amazon, and Amazon run it without engaging with my computer? I have heard about web crawlers running in Amazon for weeks without downloading data into the developers machine, and without letting the developer to turn on his machine without shutting down for months. The feature I am asking is just like "job flows" in Amazon Elastic Map-Reduce. You upload the code, it runs it inside. It doesn't matter whether you keep "your" machine turned on or not.
has comment: http://stackoverflow.com/comment/32128014
has comment: http://stackoverflow.com/comment/32126697
type: Question
score: 5
has answer: http://stackoverflow.com/a/21315660
accepted answer: http://stackoverflow.com/a/21315660
upvote count: 5
tagged with: java

http://stackoverflow.com/comment/32083832
type: QuestionComment
comment on: http://stackoverflow.com/q/21290664
has text: Integer caching, look it up.
score: 0
type: Comment

http://stackoverflow.com/comment/31922625
comment on: http://stackoverflow.com/q/21199138
score: 0
has text: then the hint should be 1A1B
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21235928
has comment: http://stackoverflow.com/comment/31987911
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21235874
answers question: http://stackoverflow.com/q/21235874
type: Answer
has comment: http://stackoverflow.com/comment/31987963
has body: You do not need entities for querying, but they can make your life easier. You can use regular SQL for queries. You can also have some entities defined, but query only for a subset of their data - i.e. a projection query. You can also use JPA constructor command with projection queries to map directly to your result objects: List&lt;MyClass&gt; dtos = em.createQuery("SELECT NEW com.example.MyClass( e.name, e.data) FROM Entity e").resultList(); EDIT: With annotated entities you can use features of JPQL that are not available in SQL, e.g. path navigation. Properly annotated entities can clarify the DB mapping. An entity does not need to map all columns of a table, you can use any subset you like, as long as it includes the id.
score: 5
upvote count: 5

http://stackoverflow.com/a/21241958
score: 0
answers question: http://stackoverflow.com/q/21238896
has body: The example you give is inappropriate use of call by reference. In the function modify void modify (int *i) { int a = 5; i = &amp;a; } You declare a local variable a which is on the stack. When it goes out of scope, its address is meaningless. So assigning address of a to i has no effect on what i points to. So what makes call by reference work is you can modify the value of what i points to in the function. For example: void modify (int *i) { int a = 5; *i = a; } Therefore in the main function, you can call it like: int b = 2; int *i = &amp;b; std::cout &lt;&lt; *i &lt;&lt; std::endl; //This will print 2 modify(i); std::cout &lt;&lt; *i &lt;&lt; std::endl; //This will prints 5
type: Answer
has comment: http://stackoverflow.com/comment/31999431

http://stackoverflow.com/a/21226010
has body: This might not be acceptable to you but I sometimes employ runtime bean reflection to validate code consistency. For your use case I would first make all of my beans use constructor based injection and make all member fields final. I believe findbugs even has some immutable bean checkers. Second to do the code consistency for your use case I would use either Spring BeanPostProcessor or just a class that implements ApplicationContextAware and then walks the ApplicationContext. Now you just check the beans that get loaded in the application context that are yours (just check the package name of the beans class) to make sure that all the fields are final. Yes you will need a more lax security manager or enable your security policy to allow private variable reflection but for most this is not a problem especially if your already using something like hibernate. If there is a field that is not final ie invalid code you just throw an exception and your Spring app will not start. For various exceptions to the rule you could use custom annotations for fields that need not be final or classes thats need to ignore the rule. You might be concerned with performance or that Spring constructor injection is not powerful enough but Spring already does an enormous amount of reflection anyway on boot up and constructor based injection has gotten rather powerful these days such that you can even do property place holder values with @Value(${PROP}).
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21189385

http://stackoverflow.com/comment/32062934
type: QuestionComment
comment on: http://stackoverflow.com/q/21278521
score: 0
has text: Does your endLatitudeStr equals endLongitudeStr?
type: Comment

http://stackoverflow.com/comment/31907746
comment on: http://stackoverflow.com/q/21190422
has text: What version of java are you using? It may be related to this bug: http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-June/014580.html
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/34965362
answers question: http://stackoverflow.com/q/21326080
has body: Add below depenedency in your pom. org.hibernate hibernate-core 4.1.9.Final org.hibernate hibernate-ehcache 4.1.9.Final net.sf.ehcache ehcache-core Refer to this link: https://dzone.com/articles/hibernate-4-and-ehcache-higher
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/21346489
tagged with: tomcat
has comment: http://stackoverflow.com/comment/32184116
tagged with: servlets
has comment: http://stackoverflow.com/comment/32184233
answer count: 2
has comment: http://stackoverflow.com/comment/32184189
has comment: http://stackoverflow.com/comment/32184250
favorite count: 0
accepted answer: http://stackoverflow.com/a/21851601
has comment: http://stackoverflow.com/comment/32185773
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/48258025
tagged with: java
tagged with: hibernate
has body: i got this erore and i don't know what's wrong i just want to check the username &amp; password and then enter a page that shows it login or not package cse; import java.io.IOException; import java.security.NoSuchAlgorithmException; import java.util.Date; import java.util.Random; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @SuppressWarnings("serial") @WebServlet(urlPatterns = {"/LogIn"}) public class LogIn extends HttpServlet { @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { String username = request.getParameter("username"); String password = request.getParameter("password"); User signedInUser = User.login(username, password); if(!signedInUser.equals(null)){ HttpSession s = request.getSession(); s.setAttribute("signedInKey", (new Date()).getTime() + (new Random()).nextInt(999999999)); request.setAttribute("user", signedInUser); String url = "http://localhost:8080/java_project/test.jsp"; response.sendRedirect(url); } String url = "http://localhost:8080/java_project/notLogIn.jsp"; response.sendRedirect(url); } } and this is the error 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 root cause java.lang.NoClassDefFoundError: org/hibernate/Session ir.ac.shirazu.cse.LogIn.doPost(LogIn.java:25) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) root cause java.lang.ClassNotFoundException: org.hibernate.Sessio…
downvote count: 3
upvote count: 1
has title: how to fix "HTTP Status 500- Servlet exception threw an exception"
type: Question
possible better answer: http://stackoverflow.com/a/48258025
has comment: http://stackoverflow.com/comment/32184275
has answer: http://stackoverflow.com/a/21851601
score: -2
has comment: http://stackoverflow.com/comment/38478296

android-dialog
type: Tag
tags question: http://stackoverflow.com/q/21218907
tag name: android-dialog

http://stackoverflow.com/a/21187625
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21187398
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21187398
has body: It turns out there is a problem with the input WSDLs. They are valid but something is wrong because Netbeans does not generate any java file. I've tested again with a known good WSDL and it works, so the procedure I followed is correct. UPDATE: I was using a local WSDL input file, and due to a bug in the SDK, if the file path contains whitespaces, the stub generation fails. In NetBeans no error is shown.

http://stackoverflow.com/q/21198325
tagged with: quartz-scheduler
type: Question
downvote count: 0
answer count: 1
has body: Once I enable clustering in Quartz, it will distribute the cron jobs to the various servers in the cluster. That's fine normally, but there's actually one job that I'd like to have executed on every server in the cluster every time it's scheduled to run. Is there a way to mark a quartz cron job to indicate that it should run on all servers in a cluster?
favorite count: 0
upvote count: 2
has title: quartz scheduler jobs that execute on all servers in a cluster
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21246272
accepted answer: http://stackoverflow.com/a/21246272
tagged with: java

http://stackoverflow.com/a/21215027
answers question: http://stackoverflow.com/q/21214201
has comment: http://stackoverflow.com/comment/34130595
type: Answer
has body: Have you considered using a Trie? This will provide almost the same complexity as your hashmap to get an item. But in some cases it will be faster. For example, with the following strings: hello, world, house, foo, bar, balloon. Getting the value associated to hello only requires to compare the 2 first characters, only one for world and 3 for bar and balloon. Using a hashmap you would compute a hash using all characters.
upvote count: 3
score: 3
downvote count: 0

http://stackoverflow.com/comment/32061446
type: AnswerComment
comment on: http://stackoverflow.com/a/21270137
score: 0
has text: Read my comments one more time, don`t use `currentTimeMillis`!
type: Comment

http://stackoverflow.com/a/21208517
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21208479
has body: Thats right the static fields are loaded when the class get loaded i.e when the program starts and it remains until the program is terminated and all the objects that are created share the same value that is present in static variables
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/21208479

http://stackoverflow.com/comment/32100474
comment on: http://stackoverflow.com/q/21284175
score: 0
type: QuestionComment
type: Comment
has text: i already try those solution but it's not helping. i even mapped the user_groupId class in my hibernateUtil class. but it shows this Exception: "user_group_id is not mapped [select b.userId, a.trunkGroupName from com.avis.Hibernate.user_group a, user_group_id b where b.userId='4167758224@broadconnect.ca' and a.trunkGroupName ='BC51743/BC51743_TRK01']" . that's the problem

http://stackoverflow.com/a/21211871
answers question: http://stackoverflow.com/q/21211331
score: 1
upvote count: 1
has body: Think in terms of observable behavior: that is, behavior you can actually see or measure from "outside" the program somehow. For instance, System.out.println("hello") has the observable behavior of printing "hello" to stdout. Of course, some actions are less direct. Given this snippet: if (i &lt; 0) { i++; } System.out.println(i); ... the action i++ doesn't have a directly observable outcome. However, if you can put your program into a state where i &lt; 0, you can then observe the outcome that the printed number is one greater than the one the program would have had, if not for the if block. With that in mind, what's the observable outcome of this code: public void tick1(boolean up) { int i = 1; if (up) { i++; } } vs, what's the observable outcome of this code: public void tick2(boolean up) { int i = 1; } As you can maybe see, their observable outcomes are the same: nothing changes. Even if i is at its maximum value and up is true, tick1 will not throw an exception -- it will just overflow i, and then do nothing with the result. In fact, if you had: public void tick3(boolean up) { // don't even declare i } ... this third variant has exactly the same observable outcome: nothing changes, still. Your IDE is trying to tell you that there is probably one of two situations going on in your code: you meant to use the variable (to some observable end), but didn't; in this case, you should use it you didn't meant to use the variable; in which case you might want to simplify the code by just removing it The code you posted is essentially in the same situation. Now, if you simplified the tick1 and tick2 to get tick3, your IDE might then tell you that up is unused. Consider this last variant: public void tick4() { // don't take any arguments or do anything } Even though this last variant has different compile-time behavior (it takes one less arg), actually has the same runtime behavior as the first three.
downvote count: 0
type: Answer

http://stackoverflow.com/q/21229632
has answer: http://stackoverflow.com/a/21229701
has comment: http://stackoverflow.com/comment/31976413
has title: Retrieve data from List of arrays
tagged with: arrays
tagged with: arraylist
score: 0
answer count: 3
upvote count: 1
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21229666
possible better answer: http://stackoverflow.com/a/21229701
has body: I am declaring an list of arrays of integers. List&lt;int[]&gt; list = new ArrayList&lt;&gt;(); I populate it: for (int i=0; i&lt;10; i++){ for (int j=1; j&lt;10; j++){ int[] currentadding = {i,j}; list.add(currentadding); } } How do I read the values stored?
tagged with: java
has comment: http://stackoverflow.com/comment/31976447
has answer: http://stackoverflow.com/a/21229707
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21229666

http://stackoverflow.com/a/21237112
has body: To put a new integer array into your table use myhash.put(word, new Integer[]{ n_line,n_times}); However, I'd advise to create a new object for the value, e.g. //Note that I ommitted stuff like modifiers, constructors etc. for simplicity's sake //In most cases you'd want to expand that class and add what's missing (left to you as an excercise) class WordCounter { int lines; int time; } Hashtable&lt;String,WordCounter &gt; myhash =new Hashtable&lt;&gt;(); As a side note, keep in mind that Hashtable is slower than HashMap since it synchronizes access, so unless you need that exact behavior you might try and use HashMap or ConcurrentHashMap instead.
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/31991189
has comment: http://stackoverflow.com/comment/31990286
score: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21237036
has comment: http://stackoverflow.com/comment/31990213
answers question: http://stackoverflow.com/q/21237036

http://stackoverflow.com/a/26005771
downvote count: 0
score: 4
has body: You need to extract the tenant ID from the path parameter in the request, so as long as it's OK to instantiate your DAOs for each request, you can implement a Factory. public WidgetMapperFactory implements Factory&lt;WidgetMapper&gt; { private final ContainerRequestContext containerRequestContext; @Inject public WidgetMapperFactory(ContainerRequestContext containerRequestContext) { this.containerRequestContext = containerRequestContext; } public WidgetMapper provide() { UriInfo uriInfo = containerRequestContext.getUriInfo(); List&lt;String&gt; matchedUris = uriInfo.getMatchedURIs(); int tenantId = 1; // Actually work it out from the matched URIs return new WidgetMapper(tenantId); } public void dispose() { // Do any clean up you need } } Then bind the factory: public MyResourceConfig extends ResourceConfig { public MyResourceConfig() { register(new AbstractBinder() { @Override protected void configure() { bindFactory(WidgetMapperFactory.class).to(WidgetMapper.class).in(RequestScoped.class); } }); } } You can then inject WidgetMapper in a Resource class, and the WidgetMapper doesn't have any knowledge it's being used in a web service.
answers question: http://stackoverflow.com/q/21258312
type: Answer
upvote count: 4

http://stackoverflow.com/a/21339434
downvote count: 0
answers question: http://stackoverflow.com/q/21338949
has body: Guava has an elegant solution to this: //general purpose function to get A, can be used in transform(), etc private static final Function&lt;ObjectA, Integer&gt; GET_A = new Function&lt;&gt;() { @Override public Integer apply(ObjectA a) { return a.getA(); } } Integer highestIndex = Collections.max(Collections2.transform(list, GET_A)); Or, if you need the element with the highest index, ObjectA highest = Ordering.natural().onResultOf(GET_A).max(list); Then to extend this to ObjectB you just need to implement a GET_B function. Going back to your helper method (which is basically irrelevant now that you have a one-liner): public &lt;T&gt; Integer getHighestIndex(List&lt;? extends T&gt; list, Function&lt;? super T, Integer&gt; indexPlucker) { return Collections.max(Collections2.transform(list, indexPlucker)); }
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/comment/32076785
has text: Thanks, that might work but in case you have hundrets of objects in your model, to write such parser for each of them is a bit tedious, there has to be some general solution, I would expect even some really simple one like a flag set somewhere, I just cannot find it.
comment on: http://stackoverflow.com/a/21285964
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21318781
has title: Toggle a switch based off dialog button choice in Android application
has answer: http://stackoverflow.com/a/21318997
tagged with: android
favorite count: 0
downvote count: 0
tagged with: android-alertdialog
type: AnsweredQuestion
has body: I am attempting to build my first Android application, and I'm stuck already. I have two toggle switches, and when they're turned on, a dialog window appears. I would like the "Cancel" button to turn the switch back off. I've tried toggleButton.setChecked(false), Switch.setChecked(false), etc., but because these switches were created in an XML file, there's no object to execute that method on/with. How do I go about toggling these switches within my program? I have my onClick listener in my main activity, and the dialog creation as a different class. This may be wrong, but it works up to this point. MainActivity.java: package com.example.arduinoautomation; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Switch; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void lampToggle(View view) { // Is the toggle on? boolean on = ((Switch) view).isChecked(); if (on) { lampOnDialog lamp_on = new lampOnDialog(); lamp_on.message = "Lamp is on."; lamp_on.show(this.getFragmentManager(),"switch"); } else { // Disable vibrate } } public void lightToggle(View view) { // Is the toggle on? boolean on = ((Switch) view).isChecked(); if (on) { lampOnDialog light_on = new lampOnDialog(); light_on.message = "Light is on"; light_on.show(this.getFragmentManager(), "switch"); } else { // Disable vibrate } } @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; } } lampOnDialog.java: package com.example.arduinoautomation; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.content.DialogInterface; import android.os.Bundle; public class lampOnDialog extends DialogFragment { String mes…
score: 1
tagged with: java
tagged with: switch-statement
type: Question
accepted answer: http://stackoverflow.com/a/21318997
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/32190256
has text: The above code run on my system,ur content "This is the third post of this page" is scrapped.I also observed fb behavior that code is commented during view source code but if u save the source code as .html and open the file u will see all the code as uncommented.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21348631

http://stackoverflow.com/comment/31938010
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21208049
has text: damnit guys, I just wrote a reply to this
score: 0

http://stackoverflow.com/comment/32034196
comment on: http://stackoverflow.com/q/21261869
score: 0
type: Comment
type: QuestionComment
has text: Possible duplicate http://stackoverflow.com/questions/12641666/springs-jdbctemplate-and-transactions

http://stackoverflow.com/q/21215345
has comment: http://stackoverflow.com/comment/31951268
has body: I'm creating a forum website for my college project. Now just like the format of stackoverflow( ;) ), each question and answers will have comment facility. I'm expecting the size of questions and answers to be large and thus I don't want to use database like MYSQL. So what I'm planning to do is to create an XML file for each question within the 'question' tags and when some answers it append an 'answer' tag with it. Now can anyone help me on how to access the data from such XML files. I'm open to suggestions which tell me how to store the questions, and answers and the comments by some other way rather than with XML file. Thanks in advance.
has comment: http://stackoverflow.com/comment/31951002
has comment: http://stackoverflow.com/comment/31951399
has answer: http://stackoverflow.com/a/21218182
accepted answer: http://stackoverflow.com/a/21218182
score: 0
has comment: http://stackoverflow.com/comment/31951167
has comment: http://stackoverflow.com/comment/31951198
has comment: http://stackoverflow.com/comment/31951104
answer count: 1
has comment: http://stackoverflow.com/comment/31951055
has title: How to store and access large and frequently used data in XML?
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/31951019
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31951210
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/31951172
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/a/21208034
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21207971
has body: MM is month whereas mm is munutes. y is for year and Y is used for Week year. Try yyyyddMM_HHmmss instead of YYYYddMM_HHmmss
downvote count: 0

http://stackoverflow.com/comment/31969083
type: QuestionComment
comment on: http://stackoverflow.com/q/21225220
has text: Hm. One second, I'll print the stack trace...
score: 0
type: Comment

http://stackoverflow.com/comment/32134949
type: Comment
has text: Take a look at this post. http://stackoverflow.com/questions/1395551/convert-a-json-string-to-object-in-java
comment on: http://stackoverflow.com/q/21318950
score: 0
type: QuestionComment

http://stackoverflow.com/a/21252529
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: type cast into parent activity: write this code in onActivityCreated inside your fragment not in constructor: user_id =((ItemDetailActivity )getActivity()).getUser_id(); It's about fragment's life-cycle. onActivityCreated is called when fragment becomes part of the activity and this is the first callback from where getActivity() doesn't return null
has comment: http://stackoverflow.com/comment/32017245
has comment: http://stackoverflow.com/comment/32016983
type: Answer
has comment: http://stackoverflow.com/comment/32016871
answers question: http://stackoverflow.com/q/21252503
has comment: http://stackoverflow.com/comment/32017429
has comment: http://stackoverflow.com/comment/32017398
has comment: http://stackoverflow.com/comment/32016947
accepted answer of: http://stackoverflow.com/q/21252503
score: 4
has comment: http://stackoverflow.com/comment/32016974

http://stackoverflow.com/comment/32172687
has text: Thanks, that is certainly how it written right now. But fact is that i need to write all this cases hardcoded, I thought I could do something more elegant using collections.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21340099
type: AnswerComment

http://stackoverflow.com/a/21275299
has comment: http://stackoverflow.com/comment/32062857
answers question: http://stackoverflow.com/q/21266487
score: 0
type: Answer
has body: The JsArray is (by extending it) a JavaScriptObject by itself. The JsArray can however not hold the Java/GWT based String objects, due to that these aren't real JavaScript Strings. To let the JsArray contain Strings, use the JsArrayString. This one handles strings at native level. JsArrayString jas = JsArrayString.createArray().cast();

http://stackoverflow.com/comment/32115362
type: QuestionComment
has text: http://stackoverflow.com/questions/16433095/does-hard-coding-of-string-affect-performance. check answer by Raghav Sood
comment on: http://stackoverflow.com/q/21308623
score: 1
type: Comment

http://stackoverflow.com/q/21217806
tagged with: layout-manager
accepted answer: http://stackoverflow.com/a/21217897
answer count: 1
has body: I created a Form with Y.AXIS ordered Boxes. Every box contains a JLabel and a JList. This boxes contents are X.Axis ordered. (picture) How can i add a vertical spacer between the boxes, to make it more readable. How can i split the label and the list for having the label more on the left and the list more on the right I'm also open for other ideas making this form more readable. Here is the code I'm working with. createCustomJList is returning a JList String ean = (String) table.getModel().getValueAt(selection[0], 0); JPanel addinfo= new JPanel(); String[] operations=new String[{"ROHTABAK","HERSTELLER","WARENGRUPPE","MARKENLOGO"}; Box moreInfo[] = new Box[4]; for(int i=0;i&lt;operations.length;i++){ moreInfo[i] = Box.createHorizontalBox(); moreInfo[i].add(new JLabel(operations[i])); moreInfo[i].add(createCustomJList(database.customgetter(operations[i],ean))); addinfo.add(moreInfo[i]); } BoxLayout layout = new BoxLayout(addinfo, BoxLayout.Y_AXIS); addinfo.setLayout(layout); JOptionPane.showMessageDialog(null, addinfo, "Naehere Infos", JOptionPane.OK_CANCEL_OPTION); EDIT: I tried the solution with the gridlayout, but used JLists instead. Is there a way to have something like a black border around a jlist? SOLVEDEDIT: list.setBorder(new LineBorder(Color.darkGray, 1)); ENDRESULT:
favorite count: 0
upvote count: 2
tagged with: swing
has answer: http://stackoverflow.com/a/21217897
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
tagged with: java
tagged with: forms
tagged with: boxlayout
type: Question
has title: Java Swing BoxLayout
has comment: http://stackoverflow.com/comment/31958465
downvote count: 0

http://stackoverflow.com/comment/31955485
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21217897
type: Comment
has text: would like to stay on the jlist, because there can be more entries and it's more generic :-/

http://stackoverflow.com/q/21334055
has answer: http://stackoverflow.com/a/21334183
accepted answer: http://stackoverflow.com/a/21334183
has comment: http://stackoverflow.com/comment/32160997
tagged with: generics
has comment: http://stackoverflow.com/comment/32160938
favorite count: 0
linked to: http://stackoverflow.com/q/18251369
has answer: http://stackoverflow.com/a/21340627
downvote count: 1
has comment: http://stackoverflow.com/comment/32161571
type: AnsweredQuestion
tagged with: enums
has comment: http://stackoverflow.com/comment/32162834
score: 1
tagged with: java
has body: Consider the code below... public class Test { public interface I {} public enum E1 implements I {M, N} public enum E2 implements I {O, P} public static class A&lt;T extends Enum&lt;T&gt; &amp; I&gt; { void test() { // how to print the enum constants here ? System.out.println("... "); } } public static class B extends A&lt;E2&gt; {} public static void main(final String[] args) { A&lt;E1&gt; a = new A&lt;E1&gt;(); B b = new B(); a.test(); b.test(); } } How to access the T class in test ? e.g. how to print the enum constants ?
has comment: http://stackoverflow.com/comment/32161061
type: Question
upvote count: 2
has title: Java generics type
linked to: http://stackoverflow.com/q/1626901
has answer: http://stackoverflow.com/a/21335183
possible better answer: http://stackoverflow.com/a/21340627
has comment: http://stackoverflow.com/comment/32161052
answer count: 3

http://stackoverflow.com/q/21347187
has body: I know the formula of finding minimum number of node in a AVL tree is S(h) = S(h-1) + S(h-2) + 1 However, I don't really get how to use this function, say if we have a AVL height of 6. The answer tells me that Minimum = 7 + 4 + 1 =12. But how do you get this number? I mean when you plug in 6 isn't it (6-1) + (6-2) + 1? Can anyone explain to me how to solve this? My teacher haven't talk about this yet but I really want to figure this out myself in order to be prepared for the test next week.
has answer: http://stackoverflow.com/a/34246385
has answer: http://stackoverflow.com/a/43024693
answer count: 9
downvote count: 0
has answer: http://stackoverflow.com/a/34770585
linked to: http://stackoverflow.com/q/12985226
tagged with: avl-tree
has comment: http://stackoverflow.com/comment/32185339
has answer: http://stackoverflow.com/a/21347246
has comment: http://stackoverflow.com/comment/32185361
has answer: http://stackoverflow.com/a/23723777
has answer: http://stackoverflow.com/a/77253505
has answer: http://stackoverflow.com/a/27192361
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21347225
possible better answer: http://stackoverflow.com/a/34770585
score: 10
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/21347225
tagged with: java
has title: Minimum number of node in AVL tree?
has answer: http://stackoverflow.com/a/70402954
upvote count: 10

http://stackoverflow.com/comment/31978616
type: Comment
has text: In installation procedure is described how to set environment variables. Look this: http://docs.oracle.com/javase/tutorial/essential/environment/paths.html
comment on: http://stackoverflow.com/a/21230014
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32009011
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21247444
has text: Does it work on [Java 8](https://jdk8.java.net/)? I recall that there were many bugs in the JavaFX 2.2 color picker which are only fixed in the Java 8 branch and are not fixed on the JavaFX 2.2 branch.
score: 0

http://stackoverflow.com/comment/32056137
type: Comment
has text: But is my sub-directory on classpath? Also, if I have to support 20 languages, then I would have to include 20*2=40 lines in <value> ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21269534

http://stackoverflow.com/comment/32132897
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21318224
score: 0
has text: putting some code will be helpful

http://stackoverflow.com/comment/32024988
score: 0
has text: It is a little bit weird as you actually specify what exacly you want in `HelperBase helper = HelperBase.getHelper(HELPER_TYPE.Type_A);`. Why cannot you just write `HelperBase helper = new Helper1();` ? If you want abstraction, just use a factory...
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21257089

http://stackoverflow.com/q/21333567
has comment: http://stackoverflow.com/comment/32160027
tagged with: rest
has title: Calling Restful Web service using jQuery ajax doesnt work
has comment: http://stackoverflow.com/comment/32160191
has body: I am using restful web service and trying to query it from jquery ajax call RESTAPI @GET @Path("/dynamicReports") @Produces("application/json") public String getDynamicFilters() { String JsonStr=null; JSONObject json=new JSONObject(); JSONObject tempjson=new JSONObject(); tempjson.put("number", 200); json.put("response", tempjson); JsonStr=json.toString(); System.out.println("inputJson : "+JsonStr); Response.ok().header("Access-Control-Allow-Origin", "*").build(); return JsonStr; } My jquery ajax call $.ajax({ type: "GET", dataType:"jsonp", crossDomain: true, url: "http://url:port/DynamicReportsService/dynamicReports", success: function(data1) { console.log("response:" + data1); }, error: function(jqXHR, textStatus, errorThrown) { $("#loadingimageid").remove(); alert('generateReportFromMR:Error in processing!'); console.log(jqXHR); } }); In browser if i try the url it gives me {"response":{"number":200}}. but ajax call gives an error and in web console it shows the json with error.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32160353
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21505084
accepted answer: http://stackoverflow.com/a/21505084
has comment: http://stackoverflow.com/comment/32159940
score: 0
answer count: 1
tagged with: jquery

http://stackoverflow.com/comment/31959971
type: QuestionComment
type: Comment
has text: @Sazzadur Rahaman I had seen that but it didn't work. I created a simple example as Hovercraft Full Of Eels suggested and everything was working fine. So I kept looking at my code and finally, in the action of the button, I was updating my initial table and that caused the problem. Thank you all for your time!
comment on: http://stackoverflow.com/q/21219494
score: 0

http://stackoverflow.com/q/21200456
has title: Creating a Pixmap in LibGDX can't find file
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/21200546
accepted answer: http://stackoverflow.com/a/21200546
type: Question
tagged with: libgdx
answer count: 1
downvote count: 0
has body: This code keeps throwing io.FileNotFoundException: spriteBatch = new SpriteBatch(); spriteMap = new Texture(new Pixmap(new FileHandle("Sprites.png"))); spriteMap.setFilter(TextureFilter.MipMapLinearNearest, TextureFilter.MipMapLinearNearest); spriteMap.setWrap(TextureWrap.ClampToEdge, TextureWrap.ClampToEdge); sprites = new TextureRegion(spriteMap).split(16, 16); any ideas what's wrong? i have also tried spriteMap = new Texture(new Pixmap(Gdx.files.internal("Sprites.png"))); but no luck...Sprites.png is just right in the package this class is in
favorite count: 0

http://stackoverflow.com/comment/32046725
comment on: http://stackoverflow.com/a/21268770
score: 0
type: AnswerComment
has text: Thanks, I will now make them into practise.
type: Comment

http://stackoverflow.com/a/21196706
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31918619
has body: Based on the clarification on the comment. Open the pom.xml file. and navigate to the dependency heirarchy tab. This will show you all the dependencies for your project. When you do see a repetitive jar file (downloaded as part of a transitive dependency) you have a choice. Either remove your own dependency definition from the pom.xml or Right click on the jar (transitive) and select exclude. You can also alternatively check your dependency tree through the command line. For example, to find out why Commons Collections 2.0 is being used by the Maven Dependency Plugin, we can execute the following in the project's directory: mvn dependency:tree -Dverbose -Dincludes=commons-collections Here is the official Maven dependency plugin EDIT : Straight from the Maven dependency plugin page. I thought it would make the answer more descriptive rather than clicking several links. A very good example shown on the official page about resolving-conflicts-using-the-dependency-tree For example, to find out why Commons Collections 2.0 is being used by the Maven Dependency Plugin, we can execute the following in the project's directory: mvn dependency:tree -Dverbose -Dincludes=commons-collections The verbose flag instructs the dependency tree to display conflicting dependencies that were omitted from the resolved dependency tree. In this case, the goal outputs: [INFO] [dependency:tree] [INFO] org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT [INFO] +- org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4:compile [INFO] | \- commons-validator:commons-validator:jar:1.2.0:compile [INFO] | \- commons-digester:commons-digester:jar:1.6:compile [INFO] | \- (commons-collections:commons-collections:jar:2.1:compile - omitted for conflict with 2.0) [INFO] \- org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-8:compile [INFO] \- org.codehaus.plexus:plexus-velocity:jar:1.1.3:compile [INFO] \- commons-collections:commons-collections:jar:2.0:compile Thus we…
answers question: http://stackoverflow.com/q/21196574
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21196574

http://stackoverflow.com/a/21298201
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21209994
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21209994
type: Answer
score: 1
upvote count: 1
has body: No that's fine. Your other choice is to create a wrapper object like class MedianAnswer { boolean success; double median; } and return that instead, and to check medianAnswer.success to see if it found the median. An additional option is to throw MedianNotFoundException and to catch it. You do similar with IllegalArgumentException.

http://stackoverflow.com/q/21247283
has comment: http://stackoverflow.com/comment/32008467
downvote count: 0
has title: fast reading/writing from/to int array concurrently
has comment: http://stackoverflow.com/comment/32008561
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/2236184
has answer: http://stackoverflow.com/a/21296403
has answer: http://stackoverflow.com/a/21298862
tagged with: java
tagged with: concurrency
has body: I need a fast way to read/write from/to an int array, concurrently. The write is needed per index. The reading operation is only needed for the complete array after all writes are done. I started with a synchronized version: public final class SynchronizedIntArray { private final int[] elements = new int[1000000]; public synchronized void set(int index, int value) { elements[index] = value; } public synchronized int[] getAll() { return elements; } } The performance isn't good. I searched for a better solution online and found AtomicIntegerArray public final class ConcurrentIntArray { private final AtomicIntegerArray elements = new AtomicIntegerArray(1000000); public void set(int index, int value) { elements.set(index, value); } public int[] getAll() { int[] intArray = new int[elements.length()]; for (int i = 0; i &lt; intArray.length(); i++) { intArray[i] = elements.get(i); } return intArray; } } But i am wondering why there is no method to get the complete int array from the AtomicIntegerArray at once. The performance is still much better than the synchronized version, but do i really need to copy it in this way? Is there even a faster alternative than AtomicIntegerArray for my problem?
type: Question
possible better answer: http://stackoverflow.com/a/21298862
has comment: http://stackoverflow.com/comment/32008616
upvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/21247345
has comment: http://stackoverflow.com/comment/32008510
accepted answer: http://stackoverflow.com/a/21247345
favorite count: 0

http://stackoverflow.com/comment/32010614
type: AnswerComment
score: 0
type: Comment
has text: @HaagenDaaS when you need them for something (and they already have a value that you need). If you calculated the random number in your `main` method and needed to pass it to your `computersTurn` method, you should make that a parameter.
comment on: http://stackoverflow.com/a/21248596

http://stackoverflow.com/q/21190641
favorite count: 0
has comment: http://stackoverflow.com/comment/31906830
has body: I have a method that if the array[x][y] cell is not empty, throws an exception: CellNotEmptyException. I need to run that method, and if it throws the exception, i need to re-run it, until it will find an empty cell, and for a max of 5 times. If it doesnt find an empty cell within 5 times, it has to clean the array, and then re-run!! Is there a way? Thank you
downvote count: 1
has title: Java looping a method if it throws exception
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31906789
tagged with: java
has comment: http://stackoverflow.com/comment/31907046
has comment: http://stackoverflow.com/comment/31906779
score: -1
tagged with: loops
has answer: http://stackoverflow.com/a/21190737
type: Question
upvote count: 0
answer count: 1
tagged with: exception
accepted answer: http://stackoverflow.com/a/21190737

http://stackoverflow.com/a/21289506
has comment: http://stackoverflow.com/comment/32083547
score: 5
has comment: http://stackoverflow.com/comment/32083674
answers question: http://stackoverflow.com/q/21289293
has body: AES-GCM is available in TLS v1.2. See [The Transport Layer Security (TLS) Protocol Version 1.2][1], section 6.2.3.3. TLSv1.1 did not add any cipher suites, and TLSv1.0 never had AES-GCM or the elliptic curve gear. (The elliptic curve stuff showed up in TLSv1.2 also). The latest public build 80 of Java 7 does support TLSv1.2 after changing code to use SSLContext.getInstance("TLSv1.2") in case of socket programming or just declaring the -Dhttps.protocols=TLSv1.2 in case of HTTP programming. does not support the AES-GCM cipher suite even under TLSv1.2, according to a request implemented only in a commercial build 191 of Java 7, https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8180834 Its interesting that the TLS_ECDHE_ECDSA_* cipher suites are showing up in your dump since they are TLSv1.2 ciphers.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/93642150
has comment: http://stackoverflow.com/comment/32083401
downvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/21289293
upvote count: 7

http://stackoverflow.com/a/21335313
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21335254
has body: The exception name NetworkOnMainThreadException says it all. You should not do networking in the main thread. There are a lot of solutions for this problem using AsyncTask is one of them. Here is an example from AndroidDevelopers: private class DownloadFilesTask extends AsyncTask&lt;URL, Integer, Long&gt; { protected Long doInBackground(URL... urls) { int count = urls.length; long totalSize = 0; for (int i = 0; i &lt; count; i++) { totalSize += Downloader.downloadFile(urls[i]); publishProgress((int) ((i / (float) count) * 100)); // Escape early if cancel() is called if (isCancelled()) break; } return totalSize; } protected void onProgressUpdate(Integer... progress) { setProgressPercent(progress[0]); } protected void onPostExecute(Long result) { showDialog("Downloaded " + result + " bytes"); } } Another option is to use a Service. Here you can find a good tutorial on services.
has comment: http://stackoverflow.com/comment/32162946
has comment: http://stackoverflow.com/comment/32162823

http://stackoverflow.com/q/21195208
has answer: http://stackoverflow.com/a/21195303
accepted answer: http://stackoverflow.com/a/21228127
answer count: 3
upvote count: 1
tagged with: methods
tagged with: java
has body: The program jumps out of the method when it gets to list[counter] = fi.nextInt(); why? Scores.txt contains "0 0 0 0 0 0 0 0 0 0" at the moment, and for some reason it is wiped blank every time the program runs. There is no Exceptions in the console, I am using eclipse. Code: int[] getValues() throws Exception{ Scanner fi = new Scanner(new File("./src/oppgave_2_v2/Scores.txt")); int[] list = new int[10]; for(int counter = 0; counter &lt; list.length; counter++){ list[counter] = fi.nextInt(); } fi.close(); return list; }
has comment: http://stackoverflow.com/comment/31916139
has comment: http://stackoverflow.com/comment/31915292
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21195268
downvote count: 0
has title: Java Scaning from file, ends method?
has answer: http://stackoverflow.com/a/21228127
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/21195268
type: Question

http://stackoverflow.com/comment/32029555
type: QuestionComment
has text: @StefanBeike Noone here has mentioned intantiating the `List` type.
comment on: http://stackoverflow.com/q/21259918
score: 0
type: Comment

http://stackoverflow.com/comment/31978794
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21229839
has text: @Will HTTP status 404, and WARNING: No mapping found for HTTP request with URI [/TermBreak/WEB-INF/index.html] in DispatcherServlet with name 'dispatcher'

http://stackoverflow.com/a/21308484
answers question: http://stackoverflow.com/q/21308434
has comment: http://stackoverflow.com/comment/32120015
accepted answer of: http://stackoverflow.com/q/21308434
type: AcceptedAnswer
upvote count: 6
has body: The two alternatives of the conditional must return a value and it must be of the same type, which becomes the value of the overall expression. System.out.println() is void. In the second case the two alternatives are ints (valid) and the type of the expression is int. And, thanks to the comment from Marko Topolnik: The conditional is not a shorthand for an if..then..else; it is an expression thus it cannot occupy the place of a statement.
has comment: http://stackoverflow.com/comment/32125116
score: 6
type: Answer
downvote count: 0

http://stackoverflow.com/q/21334207
has comment: http://stackoverflow.com/comment/32161193
downvote count: 0
upvote count: 11
favorite count: 0
has answer: http://stackoverflow.com/a/70959861
type: UnansweredQuestion
tagged with: maven
score: 11
has answer: http://stackoverflow.com/a/41100332
has comment: http://stackoverflow.com/comment/32162166
has answer: http://stackoverflow.com/a/27402055
tagged with: cucumber-junit
tagged with: java
has answer: http://stackoverflow.com/a/55032527
type: Question
has answer: http://stackoverflow.com/a/70941126
linked to: http://stackoverflow.com/q/11719898
has body: I have a Cucumber-JVM, JUnit, Selenium setup. I initiate the run by running RunSmokeTests.java using JUnit within Eclipse. I have also set up a maven profile to run the tests from command line, and possibly Jenkins in the future. When the tests are run then some of them may fail sometimes, mainly due to the application taking longer than expected. I would then have to re-run these scenarios. At the moment I run them by manually attaching @rerun tag to the ones that failed and then running RunReruns.java, which is similar to RunSmokeTest.java but with @rerun tag. With the increasing number of automated tests it is time consuming to tag the tests and start the run and clear the tags. Is there a automated way with Cucumber-JVM to re-run failed tests? RunSmokeTests.java package testGlueClasses; import cucumber.api.junit.Cucumber; import org.junit.runner.RunWith; @RunWith(Cucumber.class) @Cucumber.Options(features = "src/test/java", strict = true, format = { "html:target/CucumberReport", "json:target/JSON/Cucumber.json", "FrameworkCore.CustomTestReporter" }, tags = { "@SmokeTest" }, glue = { "FrameworkCore", "MyApp.Utils", "MyApp.StepDefinitions" }) public class RunSmokeTests { } Maven snippet: smoke <include.tests> **/RunSmokeTests.java </include.tests>
has title: Rerunning failed cucumber tests using cucumber-jvm
linked to: http://stackoverflow.com/q/40785891
has answer: http://stackoverflow.com/a/27510432
answer count: 6
tagged with: cucumber-jvm

http://stackoverflow.com/comment/31932595
has text: check working code http://stackoverflow.com/a/21205169/2380114
score: 0
comment on: http://stackoverflow.com/q/21195402
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21222475
has answer: http://stackoverflow.com/a/21222765
tagged with: parsing
tagged with: android-resources
has title: Accessing a resource "R.string" variably
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21222667
type: Question
has body: In my R.string file I have some questions = R.string.question1, R.string.question2, etc. When the user clicks a button, with only a number as the text, I want to pull that number(num) and access the string at the correct position (R.string.question[num]) OnClickListener clickQuestion2 = new OnClickListener(){ @Override public void onClick(View arg0) { String num = "R.string"+".question"+((Button)arg0).getText().toString(); int myQuestion = Integer.parseInt(num); question.setText(myQuestion); int myOption1 = R.string.question2_1; int myOption2 = R.string.question2_2; int myOption3 = R.string.question2_3; int myOption4= R.string.question2_4; option1.setText(myOption1); option2.setText(myOption2); option3.setText(myOption3); option4.setText(myOption4); Here's the onClickListener for the button. I've tried a couple ways, but nothing seems to work. The error tells me "R.string.question2", for example, is an invalid string. So I know I'm passing it the string for the resource I want, I just don't know how to tell it I want it to read that string, find that resource and parse the int that comes with it. Basically the same as with int myOption1 = R.string.question2_1; does. These are the possible answers to the question being pulled from R.string.question(x), and these work. How can I get that int for the resource, but change the resource each time a button is clicked. If that makes sense, thanks for the help! EDIT: "question" is a TextView as well as option1, option2, etc.
tagged with: java
answer count: 2
score: 0
tagged with: android

http://stackoverflow.com/q/21274366
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/32055989
has title: Maintain Session attributte while open new url in webview Android
has comment: http://stackoverflow.com/comment/32055962
tagged with: java
has answer: http://stackoverflow.com/a/21519363
has comment: http://stackoverflow.com/comment/32056437
accepted answer: http://stackoverflow.com/a/21519363
has body: I have a Java/Jsp web application where at search_list.jsp page I am setting the result in the session object like this -- &lt;% Object resultdata = req.getSession().getAttribute("search_result"); if(resultdata == null) { resultdata = (SearchResult)getSearchResult(); request.getSession().setAttribute("search_result", resultdata); } %&gt; From web browser when I hit another page and comeback to search_list.jsp retrieving of result object from session works fine , but same scenario always return > resultdata null in android native webview. Following is the code of webview from android native app. public class HomeActivity implements OnClickListener { public WebView mWebView; public String sessionCookie = null; protected void onCreate(Bundle savedInstanceState) { mWebView = (WebView) findViewById(R.id.webView1); WebSettings webSettings = mWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webSettings.setLoadsImagesAutomatically(true); mWebView.loadUrl(appPrefer.getAppURL()); mWebView.setWebViewClient(new WebViewClient()); } public void saveSession() CookieSyncManager cookieSyncManager = CookieSyncManager.createInstance(mWebView.getContext()); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setAcceptCookie(true); if(mWebView!=null) { sessionCookie = cookieManager.getCookie(getCurrentURLLoad()); } } private void addSession(String url) { CookieSyncManager cookieSyncManager = CookieSyncManager.createInstance(mWebView.getContext()); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setAcceptCookie(true); if (sessionCookie != null) { cookieManager.setCookie(url, sessionCookie); CookieSyncManager.getInstance().sync(); } } This is button click of native where (its kind of shortcut to go result back) i am loading search_list.jsp again for show result. But at web level we already search and shows results and viewing the profile.jsp page. So on click of nativ…
has comment: http://stackoverflow.com/comment/32055988
linked to: http://stackoverflow.com/q/11224454
type: Question
has comment: http://stackoverflow.com/comment/32056043
tagged with: session
tagged with: jsp
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/32056118
favorite count: 0
has comment: http://stackoverflow.com/comment/32056080
upvote count: 5
downvote count: 2
tagged with: webview
has comment: http://stackoverflow.com/comment/32056016
has comment: http://stackoverflow.com/comment/32056013

http://stackoverflow.com/comment/31912760
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21193769
has text: Of course, we can help you with both technologies, but it seems you still have to tell us what you're trying to do :-)
score: 0

treetable
tags question: http://stackoverflow.com/q/21280365
type: Tag
tag name: treetable

http://stackoverflow.com/comment/32121466
has text: http://stackoverflow.com/questions/109383/how-to-sort-a-mapkey-value-on-the-values-in-java here shows how to use a value comparator in a TreeMap
score: 1
comment on: http://stackoverflow.com/q/21311958
type: Comment
type: QuestionComment

frames
tags question: http://stackoverflow.com/q/21311641
tag name: frames
type: Tag

http://stackoverflow.com/comment/32069634
comment on: http://stackoverflow.com/q/21186057
has text: The problem is that when I call `await()` in the test, the javafx-thread is blocked which means that the GUI is not going to be updated.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32041024
has text: @SCoder - I have added an answer to your other question: http://stackoverflow.com/questions/16444464/how-to-map-same-value-to-two-different-fields-in-jaxb-while-marshalling-and-unma/21266066#21266066
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21242513
score: 0

http://stackoverflow.com/q/21326621
favorite count: 0
has answer: http://stackoverflow.com/a/21326690
has comment: http://stackoverflow.com/comment/32147918
type: UnansweredQuestion
has body: I have some file links in my web page in my local server. I want when the users click on that link the file will be open then user will modify the file content and save the file(the modified content will be saved to the original file). As "file" protocol is not supported I have used applet(self signed) for that using code Desktop.getDesktop().open(new File(filePath)); But now every time the browser showing a warning. Is the any other solution as there are more than 40 users it is not possible to do some manual hack and the file type may varies. I have tried a Window registry hack But it is showing a dialog to associate the file type to a program. OS: Windows Browser: IE/FireFox/Chrome File: any type of file If it is possible by installing a exe/plugin ? I need one time setup only.
tagged with: python
has title: Open local file for direct editing and save from local server
tagged with: java
downvote count: 3
upvote count: 1
type: Question
score: -2
tagged with: javascript
tagged with: .net
answer count: 1
has comment: http://stackoverflow.com/comment/32148079

http://stackoverflow.com/a/21260863
answers question: http://stackoverflow.com/q/21260589
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: You can also use hasMoreElements() and nextElement() class sort{ public static void main(String args[]) { String a ="this is a kiran"; StringTokenizer st =new StringTokenizer(a); ArrayList&lt;String&gt; f=new ArrayList&lt;String&gt;(); // use String type list while (st.hasMoreElements()){ // add all by iterating st f.add((String) st.nextElement()); // add tokens to list } Collections.sort(f); System.out.println("after sorting "+f); } }

http://stackoverflow.com/a/21254054
upvote count: 1
has body: Assuming you are using Selenium Webdriver? From the API: WebElement findElement(By by) Find the first WebElement using the given method. This method is affected by the 'implicit wait' times in force at the time of execution. The findElement(..) invocation will return a matching row, or try again repeatedly until the configured timeout is reached. findElement should not be used to look for non-present elements, use findElements(By) and assert zero length response instead. So your code will probably look something like this: List&lt;WebElement&gt; allElements = driver.findElements(By.xpath("123")); if (allElements == null || allElements.size() == 0) { System.out.printIn ("missing link..") } else { System.out.printIn ("link found") }
has comment: http://stackoverflow.com/comment/32019706
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21253778
answers question: http://stackoverflow.com/q/21253778
type: Answer
score: 1

http://stackoverflow.com/comment/32069566
type: AnswerComment
has text: `A a = new B();` assigns the variable of superclass `a` to the subclass instance of `B`. However, without polymorphic behaviour, the compiler will early bind the call to `A.print`. (Whereas late binding would result in `B.print`)
comment on: http://stackoverflow.com/a/21282360
type: Comment
score: 1

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/21224771
tags question: http://stackoverflow.com/q/21243619
tags question: http://stackoverflow.com/q/21314023

http://stackoverflow.com/q/21271378
has comment: http://stackoverflow.com/comment/32050632
has answer: http://stackoverflow.com/a/21271486
has comment: http://stackoverflow.com/comment/32050723
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21271486
has title: Arraylist of Custom Object
tagged with: java
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/32050750
has comment: http://stackoverflow.com/comment/32050663
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/32050672
answer count: 1
has body: This is a fairly simple question, but I am a beginner and I've been stuck on this part for hours now. I am not looking for an easy way out, but instead I just want to understand what is happening to my code and why it isn't working. My problem was: Create a node class with a random number and the current time. Create a storage class and store those nodes in a list/array. Use the main class to create 50 nodes and display. When I run it 50 times and get my list, I made the list print out the time so that I could check to see if my code was running, and they all have the same time. It means that different nodes aren't being stored into my list, and are instead being wiped out each time the loop runs. Why is that? My code is attached: Main: public class NodeSort { public static void main(String[] args) { int c = 0; while (c &lt; 50) { Storage.add(); c++; } } } Node: public class Node { public static int num; public static long time; public Node() { num = Random.getNum(); time = System.nanoTime(); } public static long getTime() { return time; } public static int getNum() { return num; } } Storage: public class Storage { public static ArrayList&lt;Node&gt; list = new ArrayList&lt;&gt;(); public static void add() { list.add(new Node()); } When I do get time for x = 1-50, it prints out the same time 50 times instead of 50 different ones.

http://stackoverflow.com/a/21303858
answers question: http://stackoverflow.com/q/21303784
score: 0
has body: you need to pass the Context to you class so you could call getResurces what you should do is the following : public class CasusHandler { public String[] casus; public void setCasusArray(Context context ) { Resources res = context.getResources(); this.casus = res.getStringArray(R.array.casus); } public String[] getCasusArray() { return this.casus; } } Hope that helps
type: Answer

http://stackoverflow.com/comment/88486990
comment on: http://stackoverflow.com/a/21378844
type: Comment
has text: Do You know if it's possible to have a `EventProcessingMode` set to `STREAM` in a Drools project/artifact with Your solution? I've asked [the question on SO](https://stackoverflow.com/questions/50724360/set-event-processing-to-stream-with-rules-from-a-maven-project-kiescanner), but I need the answer asap. Thanks!
score: 0
type: AnswerComment

http://stackoverflow.com/q/21191551
upvote count: 2
answer count: 5
type: UnansweredQuestion
tagged with: sockets
has body: Why is my while loop freezing up my program? gameLoop() is holding up my other programs processes. while (running) { if (Key.up) { player.moveCharacter(1, playerSpeed); } else if (Key.down) { player.moveCharacter(2, playerSpeed); } else if (Key.left) { player.moveCharacter(3, playerSpeed); } else if (Key.right) { player.moveCharacter(4, playerSpeed); } } // listen for log in data while (true) { try { int direction = socketIn.readByte(); // player direction // sent from server int px = socketIn.readByte(); // player px int py = socketIn.readByte(); // player py String username = socketIn.readUTF(); // player username player = new Player(direction, px, py, username); // create break; } catch (IOException e) { e.printStackTrace(); break; } } game.gameLoop(player); game.gameLoop(player); calls my game loop as you can see, however when it's run my game seizes to continue it's other processes. Can anybody tell me why this is happening? Do I need to put it on a thread?
has comment: http://stackoverflow.com/comment/31908836
has comment: http://stackoverflow.com/comment/31908435
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/21191627
tagged with: loops
has answer: http://stackoverflow.com/a/38471463
type: Question
has title: While Loop Stalling Program
has answer: http://stackoverflow.com/a/21192100
tagged with: while-loop
downvote count: 0
has answer: http://stackoverflow.com/a/21191596
favorite count: 0
has answer: http://stackoverflow.com/a/21191760

http://stackoverflow.com/comment/31981575
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21218318
has text: thanks guys, where would I get wsdl?
score: 0

http://stackoverflow.com/q/21254628
has comment: http://stackoverflow.com/comment/32024657
type: Question
has body: I'm working on getting itext to output my UTF-8 encoded text correctly in fact the input file contains symbols like ° and Latin caracters (é,è,à...) . But i didn't find a solution this is the code i'm using : BufferedReader input = null; Document output = null; System.out.println("Convert text file to pdf"); System.out.println("input : " + args[0]); System.out.println("output : " + args[1]); try { // text file to convert to pdf as args[0] input = new BufferedReader (new FileReader(args[0])); // letter 8.5x11 // see com.lowagie.text.PageSize for a complete list of page-size constants. output = new Document(PageSize.LETTER, 40, 40, 40, 40); // pdf file as args[1] PdfWriter.getInstance(output, new FileOutputStream (args[1])); output.open(); output.addAuthor("RealHowTo"); output.addSubject(args[0]); output.addTitle(args[0]); BaseFont courier = BaseFont.createFont(BaseFont.COURIER, BaseFont.CP1252, BaseFont.EMBEDDED); Font font = new Font(courier, 12, Font.NORMAL); Chunk chunk = new Chunk("",font); output.add(chunk); String line = ""; while(null != (line = input.readLine())) { System.out.println(line); Paragraph p = new Paragraph(line); p.setAlignment(Element.ALIGN_JUSTIFIED); output.add(p); } System.out.println("Done."); output.close(); input.close(); System.exit(0); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } Any idea will be appreciated.
answer count: 2
possible better answer: http://stackoverflow.com/a/21255037
has answer: http://stackoverflow.com/a/21259711
has answer: http://stackoverflow.com/a/21255037
has title: Set encoding when converting text file to pdf using itext
score: 6
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21259711
upvote count: 6
type: AnsweredQuestion
tagged with: java
tagged with: itext

http://stackoverflow.com/q/21283328
has answer: http://stackoverflow.com/a/21283431
score: 0
tagged with: regex
has answer: http://stackoverflow.com/a/21285195
has comment: http://stackoverflow.com/comment/32070918
type: UnansweredQuestion
tagged with: java
has title: Extraction of multiple tags on a line
has comment: http://stackoverflow.com/comment/32072252
type: Question
has body: I'll try to be clear in my explanation ^ ^. I input a text that I read file line by line (and I've tried word by word). Once I read I apply a regular expression that works, but the output file does not suit me I get this type of output: Sarkozy Muscat , le secrétaire général , devant Sarkozy Muscat I will wish: Sarkozy Muscat Sarkozy Muscat And I can not understand where the problem ... I feel that from the moment it matches my pattern several times it takes me a line line the entire line and not just tags ... Is my regular expression that is not good or does it come out of my way to read my files? my code : public static void main(String[] args) throws IOException { // TODO Auto-generated method stub File file = new File( monfichier); String fileContent = readFileAsString(file.getAbsolutePath()); countNE countne = new countNE(); String result = countne.countNE(fileContent); System.out.println(result); } public String countNE(String fileContent) throws java.io.IOException { int i = 0; Hashtable<String, Integer> table = new Hashtable(); int nbOcc = 0; String regPerson = " .?\\w*.? "; Pattern pPers = Pattern.compile(regPerson); Matcher m = pPers.matcher(fileContent); String result = ""; while (m.find()) { String person = m.group(); // System.out.println(person + " " + i); // System.out.println(person); i++; result += person + "\n"; } return result; } public static String readFileAsString(String filePath) throws java.io.IOException { String chaine = ""; // lecture du fichier texte try { InputStream ips = new FileInputStream(filePath); InputStreamReader ipsr = new InputStreamReader(ips); BufferedReader br = new BufferedReader(ipsr); String ligne; while ((ligne = br.readLine()) != null) { chaine += ligne + "\n"; } br.close(); } catch (Exception e) { System.out.println(e.toString()); } System.out.println(chaine); return chaine; } } Thanks for your help
answer count: 2

http://stackoverflow.com/a/25436991
type: Answer
score: 16
upvote count: 16
accepted answer of: http://stackoverflow.com/q/21317399
answers question: http://stackoverflow.com/q/21317399
type: AcceptedAnswer
has body: It doesn't appear to be one. Fortunately, it's not too difficult to put one together. public enum Comparison { EQ("="), GTE(">="), GT(">"), LT("<"), LTE("<="); private final String value; private Comparison(String text) { this.value = text; } public String getValue() { return this.value; } }
downvote count: 0

http://stackoverflow.com/comment/32142754
has text: I din't found my answer in that thread. I believe the other thread is about demerits of singleton. I am asking why we can't replace the commin used implementation with static body.
comment on: http://stackoverflow.com/q/21323651
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/21196957
answer count: 2
has answer: http://stackoverflow.com/a/21197424
has body: I've the following error when I start my Spring project in my web browser in the "console": GET http://localhost:8080/lbagno/$%7Bresource%7D [HTTP/1.1 404 Not Found 6ms] And when I see the console mode of Tomcat, I've the following message : WARNING: No mapping found for HTTP request with URI [/lbagno/${resource}] in DispatcherServlet with name 'mvc-dispatcher' And I don't understand why. Do you have a solution ? Thank you Architecture of the 'lbagno' project : -- src -- main -- java -- resources -- css -- normalMode header.css -- webapp -- WEB-INF -- /pages -- mvc-dispatcher-serclet.xml -- web.xml -- pom.xml -- target -- apache-tomcat-maven-plugin -- classes -- dependency -- lbagno -- maven-archiver -- surefire -- tomcat -- lbagno.war Structure of the lbagno.war - META-INF - /maven - MANIFEST.MF - WEB-INF - classes - com - css - normalMode - header.css - images - normalMode -css - header.css - mvc-dispatcher-servlet.xml - lib - pages - mvc-dispatcher-servlet.xml - web.xml - index.jsp mvc-dispatcher-servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="com.myblog.controller" /> /WEB-INF/pages/ .jsp <mvc:annotation-driven/> <mvc:resources mapping="/resources/**" location="/src/main/resources/css/normalMode/"/> </beans> web.xml Archetype Created Web Application mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher / header.jsp <%@ taglib uri="http://www.springframework.org/tags" prefix="sp…
has answer: http://stackoverflow.com/a/21197357
has title: Spring and tag mvc resources, can't reach .css
has comment: http://stackoverflow.com/comment/31919191
score: 0
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
tagged with: java
type: Question

http://stackoverflow.com/comment/32200253
comment on: http://stackoverflow.com/q/21346281
type: Comment
score: 0
has text: @Teeg - Yes, as long as `GridLayout` is used.
type: QuestionComment

http://stackoverflow.com/comment/32055459
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21274030
has text: use HttpSessionAttributeListener instead of HttpSessionBindingListener

wicket-6
tags question: http://stackoverflow.com/q/21276316
type: Tag
tag name: wicket-6

http://stackoverflow.com/q/21215982
answer count: 1
tagged with: java
upvote count: 0
has title: What is the complixity of simple Set, Get, toString function?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31952122
has answer: http://stackoverflow.com/a/21216037
has comment: http://stackoverflow.com/comment/31952248
has body: This is the first time that I've heard of complexity for simple function so I am confused. Am I right? This is my Class, I need to write the complexity for each function but I think it's all O(1). public class PolyNode { private int _power; private double _coefficient; private PolyNode _next; public PolyNode (int power, double coefficient) { if (power &lt; 0) { _power = 0; _coefficient = 0; _next = null; } else { _power = power; _coefficient = coefficient; _next = null; } } public PolyNode(int power, double coefficient,PolyNode next) { if (power &lt; 0) { _power = 0; _coefficient = 0; _next = next._next; } else { _power = power; _coefficient = coefficient; _next = next._next; } } public PolyNode(PolyNode p) { _power = p._power; _coefficient = p._coefficient; _next = p._next; } public int getPower() { return _power; } public double getCoefficient() { return _coefficient; } public PolyNode getNext() { return _next; } public void setCoefficient (double coefficient) { _coefficient = coefficient; } public void setNext(PolyNode next) { _next = next; } public String toString() { String st = ""; if (_coefficient == 0) return ""; else if (_power == 0) { st += _coefficient; return st; } else if (_power == 1 &amp;&amp; _coefficient != 1 &amp;&amp; _coefficient != -1) return _coefficient + "x"; else if (_coefficient == 1 || _coefficient == -1) { if (_coefficient == 1 &amp;&amp; _power != 0) { if (_power == 1) return "x"; else return "x^" + _power; } else if (_coefficient == 1 &amp;&amp; _power == 0) return "1"; else if (_coefficient == -1 &amp;&amp; _power != 0) return "-x^" + _power; else if (_coefficient == -1 &amp;&amp; _power == 0) return "-1"; } return _coefficient + "x^" +_power; } }
favorite count: 0
type: Question
downvote count: 2
has comment: http://stackoverflow.com/comment/31952099
score: -2

http://stackoverflow.com/comment/31926146
has text: I do _not_ recommend using the same approach for XML files and simpler text files. For a simple text file, you can probably use regular expressions (see this [tutorial](http://docs.oracle.com/javase/tutorial/essential/regex/)). But XML files are structured and have a syntax, and attempting to use regular expressions to parse those is generally a bad idea and could bring on the apocal&^#$&*@&&7&#^@ --um, never mind.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21201186
type: Comment

http://stackoverflow.com/a/21309153
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21308803
downvote count: 1
has body: for example 480 screen size devices:Apply in oncreate method: Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth(); if(width==480){ if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }
score: -1

http://stackoverflow.com/a/21332576
score: 0
answers question: http://stackoverflow.com/q/21330330
type: Answer
has body: Standard roo web-scaffold has no support for manage one-to-many relation in the "one" side. If you need do it this way you must modify the create and update page by hand: modify the create.jspx and update.jspx to generate the required html to manage the "children" list modify the *Controler.java to push-in the "update" and "create" methods to handle the "children" list. Also, you can look at gvNIX which includes support to generate master-details views using shell commands.

http://stackoverflow.com/a/21192453
answers question: http://stackoverflow.com/q/21191499
has comment: http://stackoverflow.com/comment/31927374
has comment: http://stackoverflow.com/comment/31932478
upvote count: 0
has comment: http://stackoverflow.com/comment/31932584
has comment: http://stackoverflow.com/comment/31931927
has comment: http://stackoverflow.com/comment/31930634
type: Answer
has comment: http://stackoverflow.com/comment/31933444
downvote count: 1
has body: Use Bouncy Castle's CMSSignedHelper. See How to get the hash algorithm name using the OID in Java?. (I'm not going to repeat the answer because its on Stack Overflow's site).
score: -1

http://stackoverflow.com/a/21309638
has comment: http://stackoverflow.com/comment/32118183
score: 0
has body: Try: &lt;% String a = "some text"; %&gt;// assume some values to a &lt;input type="text" value="&lt;%= a %&gt;"&gt;
answers question: http://stackoverflow.com/q/21309513
has comment: http://stackoverflow.com/comment/32117899
type: Answer
has comment: http://stackoverflow.com/comment/32117750
has comment: http://stackoverflow.com/comment/32121448
has comment: http://stackoverflow.com/comment/32117118

http://stackoverflow.com/comment/31945526
type: Comment
comment on: http://stackoverflow.com/a/21199510
has text: @BumSkeeter Repaired. Thanks for the note.
type: AnswerComment
score: 0

http://stackoverflow.com/q/21245457
downvote count: 0
possible better answer: http://stackoverflow.com/a/21246150
has answer: http://stackoverflow.com/a/24149882
tagged with: android
has title: Loading of ScriptC script failed / cannot load library - Renderscript Android
favorite count: 0
tagged with: android-support-library
upvote count: 2
accepted answer: http://stackoverflow.com/a/24149882
type: AnsweredQuestion
score: 2
has body: I get the following error message: 01-19 23:31:16.436: E/RenderScript(30603): Unable to open shared library (/data/data/com.example.android.rs.hellocompute//lib/librs.mono.so): Cannot load library: reloc_library[1313]: 1222 cannot locate '_Z9rsForEach9rs_script13rs_allocationS0_'... 01-19 23:31:16.436: E/RenderScript(30603): Unable to open system shared library (/system/lib/librs.mono.so): (null) 01-19 23:31:16.444: D/AndroidRuntime(30603): Shutting down VM 01-19 23:31:16.444: W/dalvikvm(30603): threadid=1: thread exiting with uncaught exception (group=0x40018560) 01-19 23:31:16.585: E/AndroidRuntime(30603): FATAL EXCEPTION: main 01-19 23:31:16.585: E/AndroidRuntime(30603): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.rs.hellocompute/com.example.android.rs.hellocompute.HelloCompute}: android.support.v8.renderscript.RSRuntimeException: Loading of ScriptC script failed. 01-19 23:31:16.585: E/AndroidRuntime(30603): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1696) 01-19 23:31:16.585: E/AndroidRuntime(30603): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1716) 01-19 23:31:16.585: E/AndroidRuntime(30603): at android.app.ActivityThread.access$1500(ActivityThread.java:124) 01-19 23:31:16.585: E/AndroidRuntime(30603): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:968) 01-19 23:31:16.585: E/AndroidRuntime(30603): at android.os.Handler.dispatchMessage(Handler.java:99) 01-19 23:31:16.585: E/AndroidRuntime(30603): at android.os.Looper.loop(Looper.java:130) 01-19 23:31:16.585: E/AndroidRuntime(30603): at android.app.ActivityThread.main(ActivityThread.java:3806) 01-19 23:31:16.585: E/AndroidRuntime(30603): at java.lang.reflect.Method.invokeNative(Native Method) 01-19 23:31:16.585: E/AndroidRuntime(30603): at java.lang.reflect.Method.invoke(Method.java:507) 01-19 23:31:16.585: E/AndroidRuntime(30603): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(Zygot…
tagged with: java
has answer: http://stackoverflow.com/a/21246150
type: Question
answer count: 2
tagged with: renderscript

http://stackoverflow.com/comment/31981881
has text: possible duplicate of [First hadoop project error: "Input path does not exist"](http://stackoverflow.com/questions/15191832/first-hadoop-project-error-input-path-does-not-exist)
comment on: http://stackoverflow.com/q/21232242
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21231806
has answer: http://stackoverflow.com/a/21232113
has comment: http://stackoverflow.com/comment/31981455
has comment: http://stackoverflow.com/comment/31981498
accepted answer: http://stackoverflow.com/a/21231986
has comment: http://stackoverflow.com/comment/31980466
score: 0
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/31980730
has comment: http://stackoverflow.com/comment/31981072
tagged with: optimization
possible better answer: http://stackoverflow.com/a/21231973
tagged with: heap-memory
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21231986
has answer: http://stackoverflow.com/a/21231973
has comment: http://stackoverflow.com/comment/31980984
has comment: http://stackoverflow.com/comment/31980949
has body: Ok, I have a problem in a particular situation that my program get the out of memory error from heap space. Let's assume we have two ArrayList, the first one contains many T objects, the second one contains W object that are created from the T objects of first List. And we cycle through it in this way (after the cycle the list : public void funct(ArrayList&lt;T&gt; list) { ArrayList&lt;W&gt; list2 = new ArrayList&lt;W&gt;(); for (int i = 0 ; i &lt; list.size() ; i++) { W temp = new W(); temp.set(list.get(i)); temp.saveToDB(); list2.add(temp); } // more code! from this point on the `list` is useless } My code is pretty similar to this one, but when list contains tons of objects I often get the heap space out of memory (during the for cycle), I'd like to solve this problem. I do not know very well how the GC works in java, but surely in the previous example there are a lot of possible optimization. Since the list is not used anymore after the for cycle I thought as first optimization to change from for loop to do loop and empty the list as we cycle through it: public void funct(ArrayList&lt;T&gt; list) { ArrayList&lt;W&gt; list2 = new ArrayList&lt;W&gt;(); while (list.size() &gt; 0) { W temp = new W(); temp.set(list.remove(0)); temp.saveToDB(); list2.add(temp); } // more code! from this point on the `list` is useless } Is this modification useful? How can I do a better optimization to the above code? and how can I prevent heap space out of memory error? (increasing the XMX and XMS value is not a possibility).
type: Question
tagged with: out-of-memory
tagged with: heap-size
has title: Java optimization to prevent heapspace out of memory

http://stackoverflow.com/comment/32075831
type: QuestionComment
type: Comment
has text: Thanks for your reply. Yes this looks similar (and I read it too, along with many many other articles) but the problem there is not really solved. First, the maven-dependency-plugin does not work for me and I do not know why. Second, I do not want to pass all the profile names as command line argument to maven, to archive the build of multiple executables. I would prefer an inline-POM solution. Other developers probably don't know, that these arguments should be passed.
comment on: http://stackoverflow.com/q/21285598
score: 0

http://stackoverflow.com/q/21294945
has title: Error=Unable to find instrumentation info for: ComponentInfo{ }
tagged with: android
has comment: http://stackoverflow.com/comment/32270935
type: UnansweredQuestion
upvote count: 49
tagged with: android-espresso
type: Question
has answer: http://stackoverflow.com/a/31185948
has answer: http://stackoverflow.com/a/64731883
has comment: http://stackoverflow.com/comment/35401794
has answer: http://stackoverflow.com/a/25869236
has answer: http://stackoverflow.com/a/65734210
score: 49
tagged with: java
has answer: http://stackoverflow.com/a/31476158
has body: I am trying to stand up espresso tests but I keep getting this error: INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{com.mikeestrada.test/android.test.InstrumentationTestRunner} It worked once, but I can't get the reports to recreate correctly. They are just blank, didn't test anything. I've tried a plethora of commands including adb shell am instrument -w -r com.mikeestrada.test/android.test.InstrumentationTestRunner and adb shell am instrument -w -r com.mikeestrada.test/com.google.android.apps.common.testing.testrunner.GoogleInstrumentation TestRunner Here are my code snippets: AndroidManifest.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.myapplication" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="7" 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.myapplication.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;instrumentationandroid:name="com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner" android:targetPackage="com.mikeestrada.test"/&gt; TestStartScreen.java package com.mikeestrada.test; import android.test.ActivityInstrumentationTestCase2; import android.test.ActivityUnitTestCase; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.LargeTest; import android.view.View; import com.example.myapplication.MainActivity; import com.example.myapplication.R; import com.google.android.apps.common.testing.ui.espresso.Espresso; import com.google.android…
linked to: http://stackoverflow.com/q/14269687
has comment: http://stackoverflow.com/comment/32227334
has answer: http://stackoverflow.com/a/23394559
downvote count: 0
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/26233058

http://stackoverflow.com/a/21189135
has comment: http://stackoverflow.com/comment/31909584
has comment: http://stackoverflow.com/comment/31903975
has comment: http://stackoverflow.com/comment/31909607
has comment: http://stackoverflow.com/comment/31904087
has comment: http://stackoverflow.com/comment/31903973
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31903888
accepted answer of: http://stackoverflow.com/q/21189072
type: Answer
answers question: http://stackoverflow.com/q/21189072
has comment: http://stackoverflow.com/comment/31903887
score: 7
has comment: http://stackoverflow.com/comment/31903993
upvote count: 7
has comment: http://stackoverflow.com/comment/31904183
has body: You can do this using reflection: public class Creator&lt;A&gt; { A a, b; public Creator(Class&lt;A&gt; childrenType) throws IllegalAccessException, InstantiationException { a = childrenType.newInstance(); b = childrenType.newInstance(); } } Note: This assumes that the class that you use has a no-arguments constructor. edit You substantially edited your original question. For the requirement that the type A should only be a GeneralClassifier or a subclass of that, add a constraint to the type parameter: public class Creator&lt;A extends GeneralClassifier&gt; { For the requirement that the class A does not have a no-argument constructor: Then you have to lookup the constructor that you want to use and call it with the appropriate arguments. You will have to know in advance what constructor you have to call. Suppose that you want to call a constructor that takes a String. Then it would be something like this: Constructor&lt;A&gt; constr = childrenType.getConstructor(String.class); a = constr.newInstance("Hello"); b = constr.newInstance("Bye"); See the API docs of class java.lang.Class and the package java.lang.reflect.

http://stackoverflow.com/a/21289453
has body: Is the file going to be ASCII-encoded? If so, every character you write will be 1 byte. Add up the string lengths as you go, and if the total number of characters goes greater than 64k, you know to stop. Don't forget to include newlines between strings, in case you're doing that.
score: 0
answers question: http://stackoverflow.com/q/21289412
type: Answer

http://stackoverflow.com/q/21262763
type: Question
has title: how to access a method from private static class
has comment: http://stackoverflow.com/comment/32035954
has body: im trying to put all stopwords on a hashset, i dont want to add it one by one so im trying to put in a txt file and have my scanner scan it. the problem is i think my code does not reach my scanner here is my code: import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.*; public class StopWords { public static final Set&lt;String&gt; stopWords = new HashSet&lt;String&gt;(); private static class scan { public scan()throws IOException { Scanner s = null; try{ s = new Scanner(new BufferedReader(new FileReader("stopwords.txt"))); while (s.hasNext()) { //System.out.println(s.next()); stopWords.add(s.next()); } }finally{ if (s != null) { s.close(); } } } } } im running my main on other class and im just calling this class. thanks in advance
has comment: http://stackoverflow.com/comment/32034804
has answer: http://stackoverflow.com/a/21263441
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21262853
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32034762
tagged with: java

supercsv
tags question: http://stackoverflow.com/q/21284026
type: Tag
tag name: supercsv

http://stackoverflow.com/comment/32131069
type: Comment
has text: No problem. I'm also not too familiar with the particulars behind gzipping content, but I had run into this issue before so I knew exactly what was going on. Good luck!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21316033

http://stackoverflow.com/comment/31903600
score: 0
type: AnswerComment
has text: Yes that's plausible. Now the unsychronized thread kicks in every 15 mins (ScheduledExecutorService) creating a new Map, while the synchronized threads run many times a second. But wouldn't the new Map not have the writes to the original Map.
type: Comment
comment on: http://stackoverflow.com/a/21188638

http://stackoverflow.com/q/21227239
type: Question
has body: I'm writing code for a small monster game based on 2DArray. But I can't proceed further until ArrayStoreException get handled. I want to do the following task by using java.util.Arrays &amp; Arrays.fill. Don't suggest another way. Just want to resolve this. Any help would be highly appreciated. Thanks in advance.... package PlayWithStars; import java.util.Arrays; public class Monster { static char battleBoard[][] = new char[10][10]; public void buildBattleBoard() { for (char[] row : battleBoard) { Arrays.fill(battleBoard,'*'); } } public void redrawBoard() { for (int k=1 ; k&lt;=30 ; k++) { // System.out.print("-"); // to print ------------------ } // System.out.println(); for (int i = 0; i &lt; battleBoard.length; i++) { for (int j = 0; j &lt; battleBoard[i].length; j++) { System.out.println("|"+battleBoard[i][j]+"|"); } System.out.println(""); for (int k=1 ; k&lt;=30 ; k++) { // System.out.print("-"); // to print ------------------ } // } public static void main(String[] args) { Monster m = new Monster(); m.buildBattleBoard(); } }
tagged with: arrays
downvote count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31972403
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21227268
upvote count: 1
has answer: http://stackoverflow.com/a/30442904
has comment: http://stackoverflow.com/comment/31972436
has answer: http://stackoverflow.com/a/21227351
score: 1
tagged with: java
has title: Failed to resolve "java.lang.ArrayStoreException"

http://stackoverflow.com/a/21236896
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21236857
has comment: http://stackoverflow.com/comment/31991044
accepted answer of: http://stackoverflow.com/q/21236857
type: Answer
has body: The VK_ values are static fields in the KeyEvent class. Here is a list of all the values.
has comment: http://stackoverflow.com/comment/31989895
has comment: http://stackoverflow.com/comment/31989878
score: 4

http://stackoverflow.com/q/21190283
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36298227
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/55353659
downvote count: 1
type: Question
score: 5
tagged with: tablespace
has body: I have two tablespaces: one for data and one for index. I can't change this configuration. How can I specify in Hibernate the index tablespace? I've read Hibernate Oracle Tablespace Annotation, but it's not the same problem. I need to specify the tablespace for data and a different tablespace for indexes.
answer count: 2
has title: How to specify separate tablespaces for data and indexes?
possible better answer: http://stackoverflow.com/a/55353659
favorite count: 0
has answer: http://stackoverflow.com/a/24249562
accepted answer: http://stackoverflow.com/a/24249562
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/31907035
linked to: http://stackoverflow.com/q/1274408
upvote count: 6

http://stackoverflow.com/q/21273458
answer count: 1
tagged with: jpql
accepted answer: http://stackoverflow.com/a/21274565
score: 0
has comment: http://stackoverflow.com/comment/32055927
has comment: http://stackoverflow.com/comment/32055454
has body: Is it possible to use LAZY loding in OneToMany unidirection mapping? In my example, BookShelf have a list of Book as LAZY loading. I need to retrieve bookList by BookShelf's ID, again. I would like to know possible way selet many from OneToMany unidirection mapping. Book.java @Entity public class Book implements Serializable { @Id private String id; .... } BookShelf.java @Entity public class BookShelf implements Serializable { @Id private String id; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "BOOK_SHELF_ID", referencedColumnName = "ID") private List&lt;Book&gt; bookList; } I would like to find book list by BookShelf using JPQL, not native query.
has title: How to use LAZY loading for OneToMany Unidirection in JPA 2.0?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21274565
tagged with: java
linked to: http://stackoverflow.com/q/19864999
type: Question
tagged with: jpa

http://stackoverflow.com/q/21269335
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: How to deactivate or hook linking in ant-contrib cpptasks?
tagged with: c++
score: 2
answer count: 0
tagged with: java
has body: I have a project which uses ant as build tool and cpptasks for the compilation and linking process because it wants to support different compilers and platforms. I use the Embarcadero C++ Builder XE 4, which is a successor of the Borland C++ Builder which is supported by cpptasks. But I found some bugs in the linker logic of cpptasks, know it's unsupported these days and don't want to fix those bugs myself and build a new library etc. I would rather fix the problems with a workaround in some way other users with the same compiler could benefit from. I thought of some little shell script or something which could be versioned with the project itself. My problem now is that it seems like the compilation works, only the linking fails because of wrong path and quotation handling of the linker logic of cpptasks. Is there any way I could deactivate linking of the "cc" task of cpptasks to implement it on my own? Or any hook I could use to interact with the linking after it generated it's response file for ilink32? It uses wrong quotes with paths containing a space, which is the default with XE 4, and this way I could simply correct the answer file. Thanks for any suggestions.
tagged with: ant-contrib
type: Question
tagged with: ant

http://stackoverflow.com/a/21211304
score: -2
has comment: http://stackoverflow.com/comment/31945501
downvote count: 2
has comment: http://stackoverflow.com/comment/31944321
has comment: http://stackoverflow.com/comment/31944282
has comment: http://stackoverflow.com/comment/31945145
has comment: http://stackoverflow.com/comment/31944516
has comment: http://stackoverflow.com/comment/31944560
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/21211042
has comment: http://stackoverflow.com/comment/31944382
has comment: http://stackoverflow.com/comment/31944449
has body: I did as you guys asked: took the panel, copied it to a blank project, deleted everything but the constructor and the auto-generated part. Here's what's left: public class ScorePanel extends javax.swing.JPanel { private DefaultTableModel dtm; private JScrollPane jScrollPane1; private JTable scoreTable; public ScorePanel() { initComponents(); dtm = (DefaultTableModel) scoreTable.getModel(); for(int i = dtm.getRowCount() - 1; i &gt;= 0; i--) dtm.removeRow(i); dtm.addRow (new Object[]{"a", "b", "c"}); scoreTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); //scoreTable.getColumnModel().getColumn(0).setHeaderValue("Test"); this.add(scoreTable); } private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); scoreTable = new javax.swing.JTable(); setMaximumSize(new java.awt.Dimension(640, 480)); setMinimumSize(new java.awt.Dimension(640, 480)); setPreferredSize(new java.awt.Dimension(640, 480)); scoreTable.setAutoCreateRowSorter(true); scoreTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null}, {null, null, null}, {null, null, null} }, new String [] { "Name", "Score", "Time" } ) { Class[] types = new Class [] { java.lang.String.class, java.lang.Integer.class, java.lang.String.class }; boolean[] canEdit = new boolean [] { false, false, false }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); scoreTable.setRowSelectionAllowed(false); scoreTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jScrollPane1.setViewportView(scoreTable); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(170, 170, 170) .addComponent(titleLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PR…
has comment: http://stackoverflow.com/comment/31944552

http://stackoverflow.com/comment/70317313
type: Comment
has text: See also http://stackoverflow.com/q/1201048/32453
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21257455

http://stackoverflow.com/comment/32100086
has text: @AleksandrM- actually Display tag create automatically this url(parameter name)
score: 0
comment on: http://stackoverflow.com/q/21283273
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21196043
has comment: http://stackoverflow.com/comment/31917640
answer count: 0
type: UnansweredQuestion
has title: How do I write a visual JavaBean?
tagged with: java
has comment: http://stackoverflow.com/comment/31917447
type: Question
score: 0
has body: I am developing a JavaBean which extends Canvas. It is very simple and I use it in jsp file using &lt;jsp:plugin&gt; tag. I use google chrome to connect to page I receive. InvocationTargetException here is the code package exsys.nurse_desktop; import java.awt.*; import java.io.Serializable; public class NurseDesktopControl extends Canvas implements Serializable { public NurseDesktopControl() { setSize(100, 100); setBackground(Color.blue); System.out.println("constructor"); } public void paint(Graphics g) { System.out.println("painting"); } } I need detailed step by step how to write basic visual JavaBean, including how to compile it and then how to use it in jsp with .
tagged with: jsp
tagged with: javabeans

http://stackoverflow.com/a/21203461
upvote count: 3
has body: Try storing it in a variable. int max_i = 0; int max = Votes[max_i]; for ( int i = 0 ; i &lt; 5 ; i++) { if ( max &lt; Votes[i] ) { max_i = i; max = Votes[max_i]; } }
answers question: http://stackoverflow.com/q/21203428
has comment: http://stackoverflow.com/comment/32017504
downvote count: 0
has comment: http://stackoverflow.com/comment/31929837
score: 3
type: Answer

http://stackoverflow.com/q/21321451
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21321468
type: UnansweredQuestion
has body: How would you put your first name and last name together with a period(.) in the middle and assign it to a String of FullName. FullName = +FirstName '.'+ LastName; It has got a big red 'X' next to the line. The error is The method FirstName() is undefined for the type Username The method LastName() is undefined for the type Username The operator + is undefined for the argument type(s) String Syntax error on token ""."", delete this token. Any suggestions?
tagged with: java
has title: User Class Information

http://stackoverflow.com/comment/32006556
type: QuestionComment
has text: Yes, I am using the pool correctly. The code I am showing is simply a short cut of what you have (I have tried it both ways). Clarified this extensively on this node-mysql issue: https://github.com/felixge/node-mysql/issues/712.
comment on: http://stackoverflow.com/q/21244512
score: 0
type: Comment

http://stackoverflow.com/comment/62734639
type: AnswerComment
comment on: http://stackoverflow.com/a/34896224
score: 0
has text: That's the ticket. I'm used to having to unscrew VMware components (hello, XP still exists.) I'm not used to having to dumb down java.
type: Comment

http://stackoverflow.com/a/21496551
has comment: http://stackoverflow.com/comment/56277417
score: 3
answers question: http://stackoverflow.com/q/21303448
upvote count: 3
downvote count: 0
has body: What you want is a program transformation system (PTS). A PTS reads source code, builds a program representation (usually an abstract syntax tree or AST), applies transformations (often stated in "if you see this, replace it by that" target langauge "surface" syntax) to the tree, and can regenerate valid source text (often prettyprinted) from the modified AST. An example surface syntax might be written literally as follows (syntax varies per system): \x ** 2 ==&gt; \x * \x Usually a set of transformation rules working in cooperation, controlled by a metaprogram, are needed to achieve a more complex result. How metaprograms are written vary radically across the PTS. You generally have to configure the PTS to parse/prettyprint the target language of choice. Stratego, TXL, and DMS (my tool) all have Java parsers/prettyprinters already and all have surface syntax rewrites. Given the choice of PTS, you would generate your source code, then launch a process to run the tool, using a set of transformations and corresponding metaprogram that you provide to achieve the specific code changes you want. Stratego, I believe, has a Java implementation, and you might be able to integrate it into your application, avoiding the separate process. A complication is that often the transformations you want to do, require name resolution, type information, or some understanding of dataflow in the code. Stratego and TXL do not have this information built in, so you have to compute it on demand by writing additional transformations; that's actually a little hard because the language semantics are complex. Our tool, DMS, has these facilities already complete for Java with some incompleteness on the data flow. If your problem is really just name substitution, and the names are unique in your generated code, then you might get away with transformations like: uniquename1 ==&gt; replacementpath1 e.g. foo.bar ==&gt; baz.bar.foo (If this is really enough, you might get away with just text string s…
type: Answer

http://stackoverflow.com/comment/31997387
type: Comment
type: QuestionComment
has text: @Affe: I have a REST service deployed on one of my servers so I am hitting that rest service using REST Template..
comment on: http://stackoverflow.com/q/21241036
score: 0

http://stackoverflow.com/comment/38449545
type: QuestionComment
comment on: http://stackoverflow.com/q/21238466
score: 0
has text: As I said, if one replace the JBOss configuration to stricly use own log4 (see link above), the LogLevel cannot be changed via JMX any more - just try it.
type: Comment

http://stackoverflow.com/comment/31957822
type: Comment
type: QuestionComment
has text: @AbhishekBansal I tried every possible case on my machine and for no case it fails but when I upload it to submission then it fails and for that I don't have test cases apparently there is some bug in this.
score: 0
comment on: http://stackoverflow.com/q/21215893

http://stackoverflow.com/q/21188667
tagged with: po
tagged with: java
type: Question
tagged with: gnu
linked to: http://stackoverflow.com/q/14464153
score: 4
linked to: http://stackoverflow.com/q/12476090
answer count: 1
linked to: http://stackoverflow.com/q/6576320
favorite count: 0
has answer: http://stackoverflow.com/a/21189488
accepted answer: http://stackoverflow.com/a/21189488
has title: Avoid .properties files GNU Gettext java
has body: First, my issue is similar to those two : JAVA gettext commons error reading .po file in java I want to use GNU Gettext utility for internationnalizing my app. I managed to get it working by creating a translations.properties file with the proper key-value pair but it wont get my translations_fr_CA.properties even if I explicitly set the locale to fr_CA or Locale.CANADA_FRENCH. This was my first issue. Second and most important issue : I can't get rid of the .properties file which is crap as I can't use the nice gettext complete msgid . I managed to compile my .po file to a .class with msgfmt --java2 [...] but the ResourceBundle won't load without a .properties file. Here is a zip of my current testing project : java_gettext_testing.zip I included gnu.gettext.GettextResource in the zip to make it simpler. You can compile with javac test/*.java and run with java test.test Thanks for any help!
upvote count: 4
tagged with: gettext
tagged with: internationalization
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/21230393
has body: From the article on Java Classloader in Wikipedia: The Java Classloader is part of the JRE that loads classes dynamically into the JVM. Usually classes are only loaded on demand. The Java run time system does not need to know about files and file systems because of classloaders. Delegation is an important concept to understand when learning about classloaders. When the JVM is started, three classloaders are started: Bootstrap class loader - loads the core Java classes Extensions class loader - code specified in extension directories System class loader - code in the classpath All software libraries that do not get loaded by these class loaders (external jar files) are loaded on demand.
score: 0
answers question: http://stackoverflow.com/q/21230116
type: Answer

http://stackoverflow.com/comment/32060353
type: QuestionComment
comment on: http://stackoverflow.com/q/21277056
score: 0
has text: Let me check on that!
type: Comment

http://stackoverflow.com/comment/31988277
score: 0
type: AnswerComment
type: Comment
has text: Error: Could not create the Java Virtual Machine. Error occurred during initialization of VM Error: A fatal exception has occurred. Program will exit. Could not reserve enough space for object heap
comment on: http://stackoverflow.com/a/21235242

http://stackoverflow.com/q/21277179
tagged with: java
has title: Deferencing Null pointer
downvote count: 2
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32060433
has answer: http://stackoverflow.com/a/21277348
accepted answer: http://stackoverflow.com/a/21277348
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/32060538
has comment: http://stackoverflow.com/comment/32060685
has comment: http://stackoverflow.com/comment/32060728
has body: public class Model { public static Connection getConnection() { Connection conn = null; try { Class.forName("oracle.jdbc.OracleDriver"); conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "System", "system"); } catch(ClassNotFoundException e) { e.printStackTrace(); } catch(SQLException e) { e.printStackTrace(); } return conn; } public static class Cart { public String itmName=""; public int howmany=0; public static long itmQty=0, itmID=0; public double itmPrice=0.0, itmCost=0.0, totalSum=0.0; } public static ArrayList&lt;Cart&gt; getCartDatabase(String user) throws Exception { Connection conn = getConnection(); String sql = "select * from userCarts where userID = '" + user + "'"; PreparedStatement pstmt = conn.prepareStatement(sql); ResultSet rst = pstmt.executeQuery(); ArrayList&lt;Cart&gt; al = null; Cart crt=null; while(rst.next()) { System.out.println("CPoint"); try { long p = rst.getLong("itemID"); crt.itmID = p; // This is the line thats creating the error System.out.println(p + " is long! I guess..."); } catch(NullPointerException e) { System.out.println("NPE Caught in Model"); } System.out.println("CP 1 " + crt.itmID); ArrayList&lt;row&gt; alr=null; try { alr = Model.getStoreInventory(); } catch(Exception e) { e.printStackTrace(); } System.out.println("CP 2"); for(int i=0; i&lt;alr.size(); i++) { crt.itmName = alr.get(i).itmName; crt.itmPrice = alr.get(i).itmPrice; crt.itmQty = alr.get(i).itmQty; } System.out.println("CP 3"); crt.howmany = rst.getInt("howmany"); crt.itmCost = crt.itmPrice*crt.howmany; al.add(crt); } return al; } } When I try to access this method of getCartFromDatabase, it gives a NullPointerException however I don't understand why it would do this. Moreover, I tried to make the class as a non static class too, but still it gave the same error: "Possible deferencing Null Pointer"
type: Question
has comment: http://stackoverflow.com/comment/32060555
score: -2

http://stackoverflow.com/a/21256109
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21255699
answers question: http://stackoverflow.com/q/21255699
has body: If you want to serialize objects than they must be Serializable. Since a javafx.scene.control.Button is not serializable you must find another way to save the button's state somewhere else. E.g. by introducing a memento class that safes the state: public class ButtonMemento implements Serializable { private static final long serialVersionUID = 1L; private boolean text; /* * Creates a memento that safes the given button's current state. */ public ButtonMemento(Button button){ this.text = button.getText(); // extend to record more properties of the button } /* * Used to apply the current mementos state to a button */ public void applyState(Button button){ button.setText(text); // extend to apply more properties to the button } } The ButtonMemento class is a way to safe the state of an object that is not serializable and restore it later. final HashMap&lt;String, ButtonMemento&gt; mapButton = new HashMap&lt;&gt;(); for(Button b : buttons){ String mapKey = ...; mapButton.put(mapKey, new ButtonMemento(b)); } try { FileOutputStream fileOut = new FileOutputStream("Resources/"); ObjectOutputStream objStream = new ObjectOutputStream(fileOut); objStream.writeObject(mapButton); objStream.close(); fileOut.close(); System.out.println("Serialized HashMap mapButtons has been stored" + " in /tmp/store"); } catch (IOException i) { i.printStackTrace(); } Maybe you can implement somthing like a BeanMemento that can store the properties of a bean that are serializable and therefore can be used with every object that fulfills the java bean specification.
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/32153992
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21329176
has text: What do you mean 'package the project again'?
type: AnswerComment

http://stackoverflow.com/q/21292322
tagged with: closest
tagged with: java
linked to: http://stackoverflow.com/q/12774618
type: Question
linked to: http://stackoverflow.com/q/14286484
tagged with: mouseevent
tagged with: arraylist
has title: Geometry: Closest Pair of Points
score: 0
tagged with: points
answer count: 1
has body: I am a bit stuck on my homework in java for this week. The problem sounds like this: "Write a program that lets the user click on the panel to dynamically create points. Initially, the panel is empty. When a panel has two or more points, highlight the pair of closest points. Whenever a new point is created, a new pair of closest points is highlighted. Display the points using small circles and highlight the points using filled circles. (Hint: Store the points in an ArrayList)" In the code under I have tried to make an ArrayList of the CircleMouse class, but I do not know if this is the "correct" way to do it? Also, how do I display the circles in the panel when the are in the ArrayList? import java.awt.*; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.util.ArrayList; import javax.swing.*; class ClosestPairOfPoints extends JFrame { /** FRIE VARIABLER **/ int x, y; /*** ARRAYLIST MED ALLE SIRKLENE ***/ public ArrayList&lt;CircleMouse&gt; arrCircle = new ArrayList &lt;CircleMouse&gt;(); public ClosestPairOfPoints() { /*** PANEL FOR Å HOLDE PÅ SIRKLENE ***/ JPanel circlePanel = new JPanel(); circlePanel.setSize(500, 400); circlePanel.setLocation(0, 0); circlePanel.setBackground(Color.PINK); /*** HENTER CIRCLEMOUSE KLASSEN INN ***/ CircleMouse circleMouse = new CircleMouse(); circlePanel.addMouseListener(circleMouse); circlePanel.addMouseMotionListener(circleMouse); /*** LEGGER PANELET INN I FRAMEN ***/ add(circlePanel); } /*** CIRCLEMOTION KLASSEN ***/ class CircleMouse extends JPanel implements MouseListener, MouseMotionListener { public void paintComponent (Graphics g) { super.paintComponent(g); g.setColor(Color.BLUE); g.drawOval(x, y, 15, 15); } @Override public void mouseDragged(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseMoved(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseClicked(MouseEvent e) { x = e.getX(); y = e.get…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21292466

http://stackoverflow.com/a/21243756
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21242116
score: 19
has body: There is already an abstraction in libgdx that works on all current supported platforms (Android, Desktop, HTML5, and iOS aswell). Net#openURI Gdx.net.openURI("http://stackoverflow.com/questions/21242116/opening-urls-with-the-browser-robovm-ios"); (This is the implementation of RoboVM: RoboVM IOSNet#openURI just as a reference, use the abstraction. No need to make platform specific code when libgdx already did it for you ;) )
upvote count: 19
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21242116

http://stackoverflow.com/comment/31976617
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21229723
has text: What are the characteristics of both: RAM, HDD, SSD, Processor(s), other SW running,etc, etc ?

odt
tags question: http://stackoverflow.com/q/21315502
type: Tag
tag name: odt

http://stackoverflow.com/q/21254031
score: 0
has title: SQLite username check with EditText value
tagged with: android
tagged with: sqlite
has answer: http://stackoverflow.com/a/21254640
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21254640
has body: Hi i have bit problem in login actually i"m trying to tesing login by checking username from databse and edit text value but its not working . the following is my codes . i'm bit confussed about to get the EditTextvalue package com.example.employeemanager; import android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class Login extends Activity { SQLiteDatabase db; EditText unameedt; String unam; String pass; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.login); Button logbtn = (Button) findViewById(R.id.loginbtn); Button signup = (Button) findViewById(R.id.signup); EditText unameedt = (EditText) findViewById(R.id.editText1); EditText passedt = (EditText) findViewById(R.id.editText2); db = openOrCreateDatabase("Employeemanager", MODE_PRIVATE, null); unam = unameedt.getText().toString(); pass = passedt.getText().toString(); logbtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { Cursor c = db.rawQuery( "SELECT username, password from Employee", null); if (c != null) { if (c.moveToFirst()) { do { String uname = c.getString(c .getColumnIndex("username")); String upass = c.getString(c .getColumnIndex("password")); if (uname.equals(unam)) { StartActivity(new Intent(Login.this, Home.class)); } } while (c.moveToNext()); } } } }); signup.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(Login.this, Emp_signup.class)); } }); } }
tagged with: java
has answer: http://stackoverflow.com/a/21254067
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/21254067

http://stackoverflow.com/q/21212482
has body: I'm doing a lab work for my parallel and concurrent programming class in Java. For now, I'm trying to use piped streams to communicate between threads. I'm using PipedWriter and PipedReader from the java.io library. For some reason, some of the message i'm sending through is lost when communicating between the threads. To be more specific, here's a screenshot. http://screencloud.net/v/bicK As you can see, I'm getting some exotic symbols as well, which doesn't usually bode too well :) Here's my thread class package lab2_string; import java.io.*; public class StringRunnable implements Runnable{ int threadNr; PipedReader in; PipedWriter out; String msg = ""; @Override public void run() { readStream(); System.out.println("Thread nr: " + threadNr); System.out.println("Message: " + msg); writeToStream(); } public StringRunnable(PipedReader rs, PipedWriter ws, int threadNr){ try{ out = ws; in = rs; this.threadNr = threadNr; }catch (Exception e) { System.out.println("Error:" + e); } } public void writeToStream(){ try{ out.write(msg); out.flush(); out.close(); }catch (Exception e) { System.out.println("Error:" + e); } } public void readStream(){ try{ while(in.read()!=-1){ char c = (char) in.read(); msg = msg + c; }in.close(); }catch (Exception e) { System.out.println("Error:" + e); } } } And my main program class package lab2_string; import java.io.*; public class Lab2 { public static void main(String[] args) { try{ PipedWriter pwOut1 = new PipedWriter(); PipedReader pwIn1 = new PipedReader(pwOut1); PipedWriter pwOut2 = new PipedWriter(); PipedReader pwIn2 = new PipedReader(pwOut2); PipedWriter pwOut3 = new PipedWriter(); Thread t1; Thread t2; t1 = new Thread(new StringRunnable(pwIn1,pwOut2,1)); t2 = new Thread(new StringRunnable(pwIn2,pwOut3,2)); t1.start(); t2.start(); pwOut1.write("Andrew"); pwOut1.flush(); pwOut1.close(); }catch (Exception e) { System.out.println("Error:" + e); } } } Please help me understand what's causing this, and how can I fix it !
type: AnsweredQuestion
has title: Losing data through piped streams in java
tagged with: java
has answer: http://stackoverflow.com/a/21212508
tagged with: stream
type: Question
score: 0
answer count: 1
tagged with: string
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/21212508
tagged with: io

http://stackoverflow.com/comment/31975259
comment on: http://stackoverflow.com/a/21228843
score: 0
type: AnswerComment
type: Comment
has text: Yeah, but in a comment the OP said "I can only use arrays and loops", so I only used arrays and loops in my answer, but suggested they look at Vectors instead, Lists<String> would probably be better though (it's been a while since I programmed in java - generics didn't exist back then).

http://stackoverflow.com/q/21230991
has comment: http://stackoverflow.com/comment/31979530
has comment: http://stackoverflow.com/comment/31979826
has body: This is the design view where it got problem retrieving back Volunteer volunteer = Volunteer.Volunteer(); tf_fName = new JTextField(); tf_fName.setBounds(300, 113, 159, 20); add(tf_fName); tf_fName.setColumns(10); tf_fName.setText(volunteer.getFirstName()); This is the error received. What can I do to prevent this from happening? Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at volunteer.ui.VolunteerView$1.actionPerformed(VolunteerView.java:57) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) This is the entity class. public static Volunteer Volunteer(){ Volunteer users = null; ResultSet rs = null; DBController db = new DBController(); String dbQuery; //Step 1 -connect to database db.getConnection(); //step 2 - declare the SQL statement dbQuery = "SELECT * FROM volunteer"; This part is retrieving back the information. // step 3 - using DBController, use updateRequest method rs = db.readRequest(dbQuery); try{ while (rs.next()){ int ID = rs.getInt("id"); String firstName = rs.getString("firstName"); String lastName = rs.getString("lastName"); String sex = rs.getString("sex"); String language = rs.getString("language"); String dob = rs.getString("dob"); String address = rs.getString("address"); String address2 = rs.getString("address2"); users = new Volunteer(ID, firstName, lastName, sex, language, dob, address, address2); } } catch (Exception e) { e.printStackTrace(); } // step 4 - close connection db.terminate(); return users; } UPDATE : This is the constructor public Volunteer(String firstName, String lastName, String sex, String language, String dob, String address, String address2) { super(); this.firstName = firstName; this.lastName = lastName; this.sex = sex; this.language = language; this.dob = dob; this.address = address; this.address2 = address2; } Line 57 points to JPanel contentPane = new Profile(myFrame); myFrame.getContentPane().removeAll(); //this is line 57 myFrame.setContentPane(contentPane); myFrame.setVisible(…
has comment: http://stackoverflow.com/comment/31979036
has comment: http://stackoverflow.com/comment/31983460
has comment: http://stackoverflow.com/comment/31987039
has comment: http://stackoverflow.com/comment/31978966
has comment: http://stackoverflow.com/comment/31979550
has comment: http://stackoverflow.com/comment/31979778
has comment: http://stackoverflow.com/comment/31979212
has comment: http://stackoverflow.com/comment/31985321
has comment: http://stackoverflow.com/comment/31979254
has comment: http://stackoverflow.com/comment/31980097
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31979522
has comment: http://stackoverflow.com/comment/31979399
has comment: http://stackoverflow.com/comment/31980142
type: Question
has comment: http://stackoverflow.com/comment/31979386
has title: Java null exception
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/31979111
has comment: http://stackoverflow.com/comment/31979500
score: 0

http://stackoverflow.com/comment/31981902
comment on: http://stackoverflow.com/q/21232242
type: Comment
type: QuestionComment
score: 0
has text: Check out the accepted answer here : http://stackoverflow.com/a/15191954/1173560

http://stackoverflow.com/comment/32175323
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21341672
has text: thanks can you give an example plesae
type: AnswerComment

http://stackoverflow.com/q/21261676
has body: I'am trying to migrate websphere 7 to JBoss 7.1 and i have several problem to configure my datasource, here is my whole config(database is oracle 10g) : Jboss deployement looks fine JBAS010400: Bound data source [jboss/datasources/xx3_oracle_tu_2] My standalone-full.xml : jdbc:oracle:thin:@************:1521:***** oracle UD1XXBD ******* oracle.jdbc.OracleDriver Seems ok about oracle driver: JBAS010403: Deploying JDBC-compliant driver class oracle.jdbc.OracleDriver (version 1.0) Here is my bean in spring xml file : org.jboss.naming.remote.client.InitialContextFactory remote://localhost:4447 user ****** false org.jboss.ejb.client.naming The only error i have is : Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: jboss/datasources/xx3_oracle_tu_2 -- service jboss.naming.context.java.jboss.exported.jboss.datasources.xx3_oracle_tu_2 On Jboss web admin console, no problems datasource appears. Also with jboss-cli script and this command line, everything seems ok : jboss-cli.bat -c --command=/subsystem=datasources/data-source=xx3_oracle_tu_2:test-connection-in-pool { "outcome" => "success", "result" => [true] } I don't understand why this command line does not work : jboss-cli.bat -c --command=/subsystem=datasources/data-source=java\:jboss\/datasources\/xx3_oracle_tu_2:test-connection-in-pool Am i missing something about JBoss 7.1 JNDI configuration ? Thanks by advance for your help ! EDIT : don't declare jboss/datasources and declare it like this in your standalone file and jboss-web file: java:/xx3_oracle_tu_2
type: Question
has title: JBoss 7.1 - declare datasource and access via JNDI
score: 0
answer count: 1
tagged with: jboss7.x
tagged with: oracle-database
tagged with: spring
has answer: http://stackoverflow.com/a/21264464
type: UnansweredQuestion
tagged with: java

generics
tags question: http://stackoverflow.com/q/21339381
tags question: http://stackoverflow.com/q/21321223
tags question: http://stackoverflow.com/q/21231251
tags question: http://stackoverflow.com/q/21345116
tags question: http://stackoverflow.com/q/21233138
tags question: http://stackoverflow.com/q/21209830
tags question: http://stackoverflow.com/q/21191136
tags question: http://stackoverflow.com/q/21284913
tags question: http://stackoverflow.com/q/21258160
tags question: http://stackoverflow.com/q/21294680
tags question: http://stackoverflow.com/q/21297979
tags question: http://stackoverflow.com/q/21277587
tags question: http://stackoverflow.com/q/21302219
tags question: http://stackoverflow.com/q/21315534
tags question: http://stackoverflow.com/q/21291283
tags question: http://stackoverflow.com/q/21347728
tags question: http://stackoverflow.com/q/21228619
tags question: http://stackoverflow.com/q/21342696
tags question: http://stackoverflow.com/q/21247945
type: Tag
tags question: http://stackoverflow.com/q/21206073
tags question: http://stackoverflow.com/q/21196672
tags question: http://stackoverflow.com/q/21329025
tags question: http://stackoverflow.com/q/21187863
tags question: http://stackoverflow.com/q/21240380
tags question: http://stackoverflow.com/q/21204614
tags question: http://stackoverflow.com/q/21203803
tags question: http://stackoverflow.com/q/21295013
tags question: http://stackoverflow.com/q/21342033
tags question: http://stackoverflow.com/q/21284859
tags question: http://stackoverflow.com/q/21318650
tags question: http://stackoverflow.com/q/21334055
tags question: http://stackoverflow.com/q/21276914
tags question: http://stackoverflow.com/q/21212161
tags question: http://stackoverflow.com/q/21346847
tags question: http://stackoverflow.com/q/21237405
tags question: http://stackoverflow.com/q/21339745
tags question: http://stackoverflow.com/q/21348555
tags question: http://stackoverflow.com/q/21292936
tags question: http://stackoverflow.com/q/21314970
tags question: http://stackoverflow.com/q/21317542
tags question: http://stackoverflow.com/q/21338949
tag name: generics
tags question: http://stackoverflow.com/q/21348443
tags question: http://stackoverflow.com/q/21209436
tags question: http://stackoverflow.com/q/21329658

http://stackoverflow.com/comment/31978141
score: 0
type: QuestionComment
has text: Do you plan to use Zookeeper for eventually using a cluster of nodes in the future? If not, I would build a LocalCluster in a "main" java and build an Exec jar and it should work.
comment on: http://stackoverflow.com/q/21230347
type: Comment

http://stackoverflow.com/a/21204200
has comment: http://stackoverflow.com/comment/31943232
has body: Either set the request.pomFile or request.baseDirectory so the Invoker knows from which directory or file Apache Maven should be executed.
type: Answer
answers question: http://stackoverflow.com/q/21200189
has comment: http://stackoverflow.com/comment/31940983
has comment: http://stackoverflow.com/comment/32203314
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31938340
has comment: http://stackoverflow.com/comment/31952698
has comment: http://stackoverflow.com/comment/31945245
has comment: http://stackoverflow.com/comment/31942120
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21200189

http://stackoverflow.com/q/21263091
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has answer: http://stackoverflow.com/a/21263332
type: UnansweredQuestion
has body: Is it possible to write a short code inside a java doc comment? I don't mean a simple line of code, I mean a short method like: public static void main() { doSomething(); }
linked to: http://stackoverflow.com/q/541920
has title: Writing code in javadoc comment
score: 0
duplicate of: http://stackoverflow.com/q/541920
tagged with: java
has comment: http://stackoverflow.com/comment/32035405
tagged with: javadoc
type: Question

http://stackoverflow.com/q/21261379
answer count: 0
has body: i have a code that needs buttons and text fields to show above graphics but dont understand JPANELS at the moment the graphic hides theese options later i will be using a if statement that will take the season and draw image acordingly import java.awt.*; import java.applet.*; import java.util.*; import javax.swing.*; import java.awt.event.*; public class Weather extends JApplet implements ActionListener { JButton Enter , Exit; JTextField location; JLabel city; JRadioButton time; JComboBox Seasons; Random rand = new Random(); int P = rand.nextInt(100) + 1;//Random Precipitation int H = rand.nextInt(50) + 1;//Random Heat public void init () { getContentPane() .setLayout (new FlowLayout ()); Enter =new JButton ("Enter"); Exit =new JButton ("exit"); city = new JLabel ("What city?"); location = new JTextField (20); //location entry field Seasons = new JComboBox (); Seasons.addItem ("Summer"); Seasons.addItem ("Fall"); Seasons.addItem ("Winter"); Seasons.addItem ("Spring"); time = new JRadioButton ("check if night?"); getContentPane().add (city); getContentPane().add (location); getContentPane().add (Seasons); getContentPane().add (time); } public void paint (Graphics g) { super.paintComponent(g); painter.paint(g); //Precipitation Bar g.setColor (Color.black); g.drawRect (40, 170, 100, 20);//outline of bar g.setColor (Color.blue); g.fillRect (40+1, 170+4, P, 14 ); //indicator bar (+4 puts space beetween outline bar) //Temparature Bar g.setColor (Color.red); g.fillRect (170+4 ,50,14,100);//Covers in g.setColor (Color.black); g.drawRect (170, 50, 20, 100);//outline of bar g.setColor (Color.white); g.fillRect (170 +4, 50+1, 16, 100 - H); //indicator bar (+4 puts space beetween outline bar) } public void actionPerformed (ActionEvent ae) { } }
type: UnansweredQuestion
upvote count: 1
tagged with: swing
tagged with: jbutton
has title: Adding graphic to sub JPANEL and Buttons to other
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32052970
tagged with: graphics
downvote count: 0
tagged with: jpanel
has comment: http://stackoverflow.com/comment/32032337
has comment: http://stackoverflow.com/comment/32034826
has comment: http://stackoverflow.com/comment/32033810
has comment: http://stackoverflow.com/comment/32032077
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32033226

http://stackoverflow.com/q/21315230
has comment: http://stackoverflow.com/comment/36075380
score: 1
tagged with: java
tagged with: javafx
upvote count: 1
tagged with: google-chrome
type: Question
has body: This is my current system configuration: Opensuse 12.3 x64 Nvidia Gefore 9600gt with Proprietary drivers Tried both the Oracle Java 7u45 and 7u51 (Installed according to: SDB:Installing Java - openSUSE) Google Chrome and Firefox (Latest versions for both) I am not able to run any Java FX browser app. When the app starts loading, i just get a gray box inside the browser screen. I've reproduced this with the JavaFX Ensemble sample app as well as my own apps. This is the exception i get on the Java Console when trying to load the Ensemble app: ---- FetchDocListTask docsUrl = http://download.oracle.com/javafx/2/api/ java.lang.NullPointerException at com.sun.prism.es2.ES2SwapChain.&lt;init&gt;(ES2SwapChain.java:79) at com.sun.prism.es2.ES2ResourceFactory.createPresentable(ES2ResourceFactory.java:40) at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:59) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) at com.sun.prism.render.RenderJob.run(RenderJob.java:37) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:108)at java.lang.Thread.run(Thread.java:744) CacheEntry[http://download.oracle.com/otndocs/products/javafx/2/samples/Ensemble/Ensemble.jn lp]: updateAvailable=true,lastModified=Wed Dec 31 18:00:00 CST 1969,length=0 CacheEntry[http://download.oracle.com/otndocs/products/javafx/2/samples/Ensemble/Ensemble.jnlp]: updateAvailable=true,lastModified=Wed Dec 31 18:00:00 CST 1969,length=0
has comment: http://stackoverflow.com/comment/32749850
has comment: http://stackoverflow.com/comment/38140375
answer count: 2
has answer: http://stackoverflow.com/a/27605054
tagged with: firefox
downvote count: 0
has title: Java FX apps won't run on the browser with Linux
favorite count: 0
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32778457
has answer: http://stackoverflow.com/a/24110297

http://stackoverflow.com/comment/32423205
has text: What does this even mean?
score: 0
comment on: http://stackoverflow.com/q/21333205
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21190241
has comment: http://stackoverflow.com/comment/31906303
score: 9
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31906693
upvote count: 9
has comment: http://stackoverflow.com/comment/31906367
type: Answer
has comment: http://stackoverflow.com/comment/31906520
has comment: http://stackoverflow.com/comment/31906551
has body: You've stated that BaseSudokuTest has an abstract method and is therefore abstract itself. Assuming you are running your tests through BaseSudokuTest, Junit uses reflection to create an instance of your test class. You cannot instantiate abstract classes, whether directly or through reflection. Move your abstract method to some other class. Your JUnit test class cannot be abstract. Or rather run your HyperSudokuTest class. It will have inherited the @Test methods from BaseSudokuTest.
accepted answer of: http://stackoverflow.com/q/21190019
has comment: http://stackoverflow.com/comment/31906232
answers question: http://stackoverflow.com/q/21190019

http://stackoverflow.com/comment/32070153
type: Comment
comment on: http://stackoverflow.com/a/21282832
has text: @Pshemo I just ask to know other cases!
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32139744
comment on: http://stackoverflow.com/q/21321295
score: 0
has text: Err, and which is line 78? Obviously you are dereferencing a null reference at that line. Probably because of your strange practice of catching exceptions and then letting the code proceed as though they didn't happen. Was there a prior exception? Creating the ServerSocket for example?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31910429
has text: @RenéLink, apologies, my mistake.
score: 0
comment on: http://stackoverflow.com/q/21189736
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21298822
type: Answer
has comment: http://stackoverflow.com/comment/32099099
score: 1
upvote count: 1
has body: Just try the insert and handle the failure. Any other approach is vulnerable to timing-window problems.
answers question: http://stackoverflow.com/q/21298561
downvote count: 0
has comment: http://stackoverflow.com/comment/32177293

http://stackoverflow.com/comment/31995949
has text: It is much easier with library.
comment on: http://stackoverflow.com/a/21240317
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34698875
type: Comment
type: QuestionComment
has text: Finally found a solution for it YAY!. The problem is with the background tag in theme, should be windowBackground instead.
comment on: http://stackoverflow.com/q/21273553
score: 0

http://stackoverflow.com/a/21327211
downvote count: 1
score: 3
upvote count: 4
has body: Jenkins + maven-release-plugin + settings.xml = painful Check the following locations for any mention or overrides of settings.xml file: Jenkins instance-level config general Maven section Maven release plugin section job-level config general Maven section Maven release plugin section pom.xml file maven-release-plugin section profiles section In addition, things can get fussy depending on how you're running the job in Jenkins: freestyle job with Maven goals Maven job using regular "Build" button with "release:prepare" goals Maven build using "Run Maven Release" button Try experimenting with different job types.
has comment: http://stackoverflow.com/comment/38642567
type: Answer
answers question: http://stackoverflow.com/q/21293696

http://stackoverflow.com/a/21200546
has comment: http://stackoverflow.com/comment/31925080
has comment: http://stackoverflow.com/comment/31924939
accepted answer of: http://stackoverflow.com/q/21200456
score: 3
has comment: http://stackoverflow.com/comment/31925145
upvote count: 3
has body: While using this: spriteMap = new Texture(new Pixmap(Gdx.files.internal("Sprites.png"))); be totally sure you have a file called "Sprites.png" (with the capital 'S') inside your assets folder. assets/Sprites.png If you have a folder between, for example data (created with the Libgdx-setup-ui by default). then you would need to put it aswell. assets/data/Sprites.png If you are sure the file is there. Then: If running from eclipse, refresh your project (f5), it may be unsynchronized) If this only happens in the Desktop project, then maybe your assets folder is not correctly linked. Edit: You edited your question :p Sprites.png is just right in the package this class is in thats your problem, Gdx.files.internal looks into the Android assets folder. not the folder in which the class is in.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31976700
has comment: http://stackoverflow.com/comment/31924911
type: Answer
has comment: http://stackoverflow.com/comment/32274423
answers question: http://stackoverflow.com/q/21200456
has comment: http://stackoverflow.com/comment/31924961
has comment: http://stackoverflow.com/comment/31924899

http://stackoverflow.com/comment/32150121
comment on: http://stackoverflow.com/a/21303231
score: 0
type: AnswerComment
type: Comment
has text: i need to upload a progress bar.thanks for your code but in java upload part where could i upload my progress data?thanks

http://stackoverflow.com/a/21277922
type: Answer
has body: Just to sum up: How is this output possible? I didnt call the super class constructor, but how come "Making an Animal" printed Here. Superclasses their constructors are called automatically before executing the code in the current constructor (same effect as explicitly calling super() on the first line), even if you don't explicitly add this Why am I getting Compilation Error? You're not using the correct quotes. Use " instead of your calligraphy stuff. You can verify they're different with this: System.out.println((int) '"'); // 34 System.out.println((int) '”'); // 8221
answers question: http://stackoverflow.com/q/21277792
score: 0

http://stackoverflow.com/comment/31931013
has text: @AniketThakur Also see the Javadoc link I've posted where you can see the JDBC versions and what changed. Java SE 7 comes with JDBC 4.1
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21202574

http://stackoverflow.com/comment/31929948
comment on: http://stackoverflow.com/a/21202574
has text: Java 6 was JDBC 4.0, which introduced automatic driver loading, it simply looks like that page wasn't updated.
type: AnswerComment
score: 1
type: Comment

try-with-resources
tags question: http://stackoverflow.com/q/21254547
tag name: try-with-resources
type: Tag
tags question: http://stackoverflow.com/q/21281867

http://stackoverflow.com/comment/33310810
type: Comment
type: AnswerComment
has text: @LucasWilson-Richter that depends on whether you are in full control of that code or not. Also "should" is a very strong term - what if all I need is a revised toString on an existing class?
score: 0
comment on: http://stackoverflow.com/a/21525234

http://stackoverflow.com/q/21221801
downvote count: 0
has title: Cell Editing in PrimeFaces get null
score: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/21732692
has body: I have a problem: when I'm trying to edit a cell i'm getting null in oldValue and newValue. Here is a code for XHTML: &lt;h:form id="tabela"&gt; &lt;p:contextMenu for="tabelaPrzypomnien" widgetVar="cMenu"&gt; &lt;p:menuitem value="Edit Cell" icon="ui-icon-search" onclick="PF('carsTable').showCellEditor();return false;"/&gt; &lt;p:menuitem value="Hide Menu" icon="ui-icon-close" onclick="PF('cMenu').hide()"/&gt; &lt;/p:contextMenu&gt; &lt;p:dataTable id="tabelaPrzypomnien" value="#{obslugaUzytkownikow.listaZadan}" var="zadania" rows="10" rowsPerPageTemplate="5,10,15" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" paginator="true" lazy="true" editable="true" editMode="cell" widgetVar="carsTable"&gt; &lt;f:facet name="header"&gt; In-Cell Editing &lt;/f:facet&gt; &lt;p:ajax event="cellEdit" listener="#{obslugaZadan.onCellEdit}"/&gt; &lt;p:column headerText="id grupy"&gt; &lt;h:outputText value="#{zadania.id_grupy}" /&gt; &lt;/p:column&gt; &lt;p:column headerText="Temat" sortBy="temat"&gt; &lt;p:cellEditor&gt; &lt;f:facet name="output"&gt; &lt;h:outputText value="#{zadania.temat}" /&gt; &lt;/f:facet&gt; &lt;f:facet name="input"&gt; &lt;p:inputText value="#{zadania.temat}" style="width:96%" /&gt; &lt;/f:facet&gt; &lt;/p:cellEditor&gt; &lt;/p:column&gt; &lt;p:column headerText="Deadline" sortBy="deadline"&gt; &lt;h:outputText value="#{zadania.deadline}" /&gt; &lt;/p:column&gt; &lt;/p:dataTable&gt; and ObslugaZadan Bean, onCellEdit method: public void onCellEdit(CellEditEvent event) { Object oldValue = event.getOldValue(); Object newValue = event.getNewValue(); System.out.println(oldValue + " i druga: " + newValue + " event: " + (String) event.getColumn().getHeaderText()); if(newValue != null &amp;&amp; !newValue.equals(oldValue)) { System.out.println("rsedtcyfvubi" + oldValue + " i druga: " + newValue); } } Console info after update: INFO: null i druga: null event: Temat So: var even…
tagged with: jsf
upvote count: 1
answer count: 1
tagged with: primefaces
tagged with: java
type: UnansweredQuestion

instantiation
type: Tag
tags question: http://stackoverflow.com/q/21200086
tag name: instantiation

http://stackoverflow.com/comment/31982611
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21233012
type: Comment
has text: can you provide a sample code or link to any basic connectivity with MySQL?

http://stackoverflow.com/a/21418195
downvote count: 1
has comment: http://stackoverflow.com/comment/52968921
has body: "The exclusive bitmask of each pairing of players must equal zero for auto-match" essentially means that the exclusiveBitMask must be the exact same between players. The usefulness would be limited. That doesn't mean you couldn't create a bit mask that represents role A and role B if the relationships were that simple. But it would mean it would match players with either role A or B and it would need to be filtered. If role A could also match with role C then the user would have to select a filter that matches A+B or A+C but not both.
score: 0
answers question: http://stackoverflow.com/q/21345656
type: Answer
upvote count: 1

http://stackoverflow.com/a/21229298
answers question: http://stackoverflow.com/q/21228384
type: Answer
has body: Make unique, times as instance variable so that you can retrieve them from another class using getter methods. Note: Modified code can be found through comments (for line "Added line". for block between "Added code starts here" to "Added code ends here"). I tried to explain the implementation in code. Please let me know through comments if I need to work more on my documentation skills public class someClass(){ private String[] unique; private int[] times; //Added code starts here public String[] getUnique(){ return this.unique; } public int[] getTimes(){ return this.times; } //Added code ends here //Below implementation would work as intended only when words array is sorted public void findArrs( String[] words ) { int counter = 1; for(int i = 0; i &lt; words.length - 1; i++){ if(!(words[i].equals(words[i+1]))){ counter++; } } unique = new String[counter]; times = new int[counter]; //Added line. unique[0] = words[0]; for(int i=0,j=0; i &lt; words.length&amp;&amp;j &lt; counter; i++){ //Added code starts here if(!(unique[j].equals(words[i]))){ j++; //increment count when latest element in unique array is not equal to latest element in words array unique[j] = words[i]; //add newly found unique word from words array to unique array times[j] = 1; //make the count to 1 for first non repeated unique word } else{ times[j]++; //increment the count every time the string repeats } //Added code ends here } } }
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/21219956
type: AnsweredQuestion
has title: App getting error while trying to report error
tagged with: java
has comment: http://stackoverflow.com/comment/31959494
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21220048
has body: so I'm using the androidhive tutorial to make a server for my app and connect to it. I have it so the server will send back different messages depending on what was sent in but I'm getting an error with it and I can't figure out why. Here is the class that the error occurs in: class CreateNewSpot extends AsyncTask&lt;String, String, String&gt; { /** * Before starting background thread Show Progress Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(NewSpotActivity.this); pDialog.setMessage("Creating Spot.."); pDialog.setIndeterminate(false); pDialog.setCancelable(false); pDialog.show(); } /** * Creating product * */ protected String doInBackground(String... args) { String name = inputName.getText().toString(); String longitude = inputLong; String latitude = inputLat; String pavement = spinner_pavement.getSelectedItem().toString(); String traffic = spinner_traffic.getSelectedItem().toString(); String environment = spinner_enviro.getSelectedItem().toString(); // Building Parameters List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("name", name)); params.add(new BasicNameValuePair("longitude", longitude)); params.add(new BasicNameValuePair("latitude", latitude)); params.add(new BasicNameValuePair("pavement", pavement)); params.add(new BasicNameValuePair("traffic", traffic)); params.add(new BasicNameValuePair("environment", environment)); // getting JSON Object // Note that create product url accepts POST method JSONObject json = jsonParser.makeHttpRequest(url_create, "POST", params); // check log cat fro response Log.d("Create Response", json.toString()); // check for success tag try { int success = json.getInt(TAG_SUCCESS); switch(success){ case 0: //name is empty! break; case 1: // successfully created product Intent i = new Intent(getApplicationContext(), AllSpotsActivity.class); startActivity(i); // closing this screen finish(); break; case 2: //name has b…
tagged with: android
has answer: http://stackoverflow.com/a/21220048

android-screen-support
tag name: android-screen-support
tags question: http://stackoverflow.com/q/21221588
type: Tag

http://stackoverflow.com/tag/pdf
tags question: http://stackoverflow.com/q/21297905
tags question: http://stackoverflow.com/q/21310597
tags question: http://stackoverflow.com/q/21253025
tags question: http://stackoverflow.com/q/21229736
tags question: http://stackoverflow.com/q/21301190
tags question: http://stackoverflow.com/q/21288569
tags question: http://stackoverflow.com/q/21230084
tags question: http://stackoverflow.com/q/21315502
tags question: http://stackoverflow.com/q/21227964
type: Tag
tag name: pdf
tags question: http://stackoverflow.com/q/21189981
tags question: http://stackoverflow.com/q/21279548
tags question: http://stackoverflow.com/q/21311738
tags question: http://stackoverflow.com/q/21335129
tags question: http://stackoverflow.com/q/21255000
tags question: http://stackoverflow.com/q/21254367
tags question: http://stackoverflow.com/q/21247835
tags question: http://stackoverflow.com/q/21319338
tags question: http://stackoverflow.com/q/21309991
tags question: http://stackoverflow.com/q/21285072
tags question: http://stackoverflow.com/q/21325643

http://stackoverflow.com/q/21229608
tagged with: jcheckbox
has title: Adding a JPopupMenu to an array of JCheckBoxes
score: 0
has comment: http://stackoverflow.com/comment/31977042
has comment: http://stackoverflow.com/comment/31979168
has comment: http://stackoverflow.com/comment/32023143
type: UnansweredQuestion
tagged with: swing
tagged with: jpopupmenu
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31979128
type: Question
has comment: http://stackoverflow.com/comment/32020307
has body: I am trying to add JPopupMenu (on right click) to an array of check boxes and am doing it in below way: JPanel Pane = new JPanel(); Pane.setLayout(new BoxLayout(Pane, BoxLayout.PAGE_AXIS)); m_popMenu = new JPopupMenu(); JMenuItem item = new JMenuItem("Setup"); item.addActionListener(this); m_popMenu.add(item); for (int k = 0; k &lt; 5; k++) { checkBoxes[k] = new JCheckBox(List[k]); //in List i have names for CheckBoxes checkBoxes[k].addActionListener(this); //For popupmenu item checkBoxes[k].addMouseListener(this); Pane.add(checkBoxes[k]); checkBoxes[k].add(m_popMenu); } This code does what I need exactly but GUI has some problems. If only two check boxes are there, check boxes gets aligned with more space and if I right click to open popup menu the alignment changes properly. Whenever I open popup by right click (for the first time) the checkboxes reduce space between them. Why does this happen?
has comment: http://stackoverflow.com/comment/31977743
has comment: http://stackoverflow.com/comment/31981795

http://stackoverflow.com/q/21308504
tagged with: liferay
has comment: http://stackoverflow.com/comment/32327619
answer count: 1
downvote count: 0
has title: Cannot view asset in workflow liferay
has comment: http://stackoverflow.com/comment/32291152
has body: I created a portlet with workflow on liferay portal CE 6.2.0 and added single approver workflow to it after deployment. It works successfully and i can view notification, assign to someone and approve it or reject. But when I click on view button it says "asset not found" I couldn't figure out what I missed. I have the following in my code. In LocalServiceImpl assetEntryLocalService.updateEntry(userId, timesheet.getGroupId(), date, date, Timesheet.class.getName(), timesheet.getPrimaryKey(), timesheet.getUuid(), 0, serviceContext.getAssetCategoryIds(), serviceContext.getAssetTagNames(), true, null, null, null, null, ContentTypes.TEXT_HTML, timesheet.getProject(), timesheet.getTaskType(), timesheet.getProject() + " : " + timesheet.getTaskType(), null, 0, 0, 0, false); In AssetRenderer public String render(RenderRequest request, RenderResponse response, String template) throws Exception { if (template.equals("full_content")) { request.setAttribute("TIMESHEET_ENTRY", _timesheet); return "/html/" + template + ".jsp"; } else { return null; } } In AssetRendererFactory public AssetRenderer getAssetRenderer(long classPK, int type) throws PortalException, SystemException { Timesheet timesheet = TimesheetLocalServiceUtil.getTimesheet(classPK); return new TimesheetAssetRenderer(timesheet); } Is there anything wrong in what I am doing? I had added the following in my portlet.xml &lt;asset-renderer-factory&gt;com.timesheet.asset.TimesheetAssetRendererFactory&lt;/asset-renderer-factory&gt; Is it some other function that i need to override? I found that the error is thrown from liferay-portal / portal-web / docroot / html / portlet / asset_publisher / view_content.jsp at the below given code point if (!assetEntry.isVisible() &amp;&amp; (assetRenderer.getAssetRendererType() == AssetRendererFactory.TYPE_LATEST_APPROVED)) { throw new NoSuchModelException(); } Here I could find that even if I set visible to true in my updateEntry method call, it is being set to false. I dont know what …
favorite count: 0
has comment: http://stackoverflow.com/comment/32324914
has comment: http://stackoverflow.com/comment/32333336
has comment: http://stackoverflow.com/comment/32325233
accepted answer: http://stackoverflow.com/a/21430250
tagged with: liferay-6
has comment: http://stackoverflow.com/comment/32127536
upvote count: 1
has comment: http://stackoverflow.com/comment/32324761
has comment: http://stackoverflow.com/comment/32324868
has comment: http://stackoverflow.com/comment/32144383
has comment: http://stackoverflow.com/comment/32318555
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32144426
score: 1
has comment: http://stackoverflow.com/comment/32278871
tagged with: java
has comment: http://stackoverflow.com/comment/32329601
type: Question
has answer: http://stackoverflow.com/a/21430250
has comment: http://stackoverflow.com/comment/32327741

http://stackoverflow.com/comment/32045547
comment on: http://stackoverflow.com/q/21268480
has text: @JuanManuel They do not. I've marked down the println outputs and there is not pattern to when the box is blank.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21205446
has answer: http://stackoverflow.com/a/21233368
type: Question
score: 0
tagged with: groovy
has body: hoping to use groovy to write a groovy.text.Template for Asciidoctor markup. So far : //----------------------------------- public class AsciidocTemplate implements groovy.text.Template { boolean includeHeaderFooter = true; Asciidoctor asciidoctor = create(); org.asciidoctor.Options asciidoctorJOptions=["backend": "html","header_footer":includeHeaderFooter] def payload=""; Map binding = [:] public AsciidocTemplate() { } // end of constructor public AsciidocTemplate(def payload) { this.payload = payload; } // end of constructor // use doctor to transform the template public Writable process() { def output = asciidoctor.render(this.payload, asciidoctorJOptions); Writer ou = output; return ou; } // end of make Writable make() { return process(); //output as Writable; } // end of make // ----------------------------------- The render() returns a string, how do we convert that string into an object that implements the Writable interface, i just dont get it. Also can't see how to use/read/store the returned 'Writable' object either :-P
answer count: 1
accepted answer: http://stackoverflow.com/a/21233368
tagged with: interface
type: AnsweredQuestion
has title: How to code Writable Interface in groovy
tagged with: writable
tagged with: java

http://stackoverflow.com/q/21331444
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/32156302
has comment: http://stackoverflow.com/comment/32166786
has title: Listen for sms delete android
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/28384342
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/21331574
has answer: http://stackoverflow.com/a/21331574
has body: I'm looking for a listener for when user deletes sms from the inbox. any listener for delete sms in android My question is duplicate but the thread hasn't an answer.
tagged with: android
has comment: http://stackoverflow.com/comment/32157474
accepted answer: http://stackoverflow.com/a/28384342
linked to: http://stackoverflow.com/q/5025372
upvote count: 3
has comment: http://stackoverflow.com/comment/32157039
has comment: http://stackoverflow.com/comment/32157119
type: AnsweredQuestion

http://stackoverflow.com/a/21343439
has body: You're not just changing the Icon shown by the JLabel, but changing JLabels entirely, and I recommend that you don't do that. Instead,... Read in your Images and create your ImageIcons on program creation, not each time you need to change the light. Use just one JLabel to hold the icon. When you want to change the light, call a method that doesn't require a String. A boolean might do well if the light is only in 2 states. And then swap out ImageIcons in the one JLabel. Don't go swapping JLabels mid program when this is not needed. Code lines like this: Pang.game.frame.panelMenuButOn.setText("GO OFFLINE");, suggest that you are using static fields and methods. If so, you will want to re-configure your program so that it does not do this, so that it uses instance methods and fields for most everything. I agree with Ross Drew -- all your Swing calls should be made on the Swing Event Dispatch Thread (or EDT) only. 1+ to his answer. For example, import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; import java.util.EnumMap; import javax.imageio.ImageIO; import javax.swing.*; @SuppressWarnings("serial") public class StopLightApp extends JPanel { private static final String IMG_PATH = "http://urbannight.files.wordpress.com/2012/09/" + "red-orange-green-traffic-lights.jpg?w=300&amp;h=240"; private static final int PAD = 13; private JLabel stopLightLabel = new JLabel(); private EnumMap&lt;LightColor, Icon&gt; lightIconMap = new EnumMap&lt;LightColor, Icon&gt;( LightColor.class); private LightColor lightColor = LightColor.RED; public StopLightApp() throws IOException { URL stopLightImgUrl = new URL(IMG_PATH); BufferedImage stopLightImg = ImageIO.read(stopLightImgUrl); for (int i = 0; i &lt; LightColor.values().length; i++) { BufferedImage smlLightImg = specializedForThisImageGetSubImage( stopLightImg, i); Icon smlIcon = new ImageIcon(smlLightImg); li…
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32179824
score: 4
has comment: http://stackoverflow.com/comment/32178903
accepted answer of: http://stackoverflow.com/q/21343384
type: Answer
has comment: http://stackoverflow.com/comment/32179527
has comment: http://stackoverflow.com/comment/32179493
answers question: http://stackoverflow.com/q/21343384
has comment: http://stackoverflow.com/comment/32190756

http://stackoverflow.com/comment/52034983
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21263929
has text: @Joop Eggen Yeah! My bad, I meant `\\\`. but this doesn't work inside of a stored proc.

http://stackoverflow.com/a/21298888
upvote count: 2
answers question: http://stackoverflow.com/q/21298863
type: Answer
score: 2
downvote count: 0
has body: The root logger should be set to ERROR, set DEBUG only to the logger of the class you are interested in.

http://stackoverflow.com/a/21188071
has comment: http://stackoverflow.com/comment/31971887
has comment: http://stackoverflow.com/comment/31971907
score: 0
answers question: http://stackoverflow.com/q/21188010
has comment: http://stackoverflow.com/comment/31971868
has comment: http://stackoverflow.com/comment/31971880
type: Answer
has comment: http://stackoverflow.com/comment/31970805
has comment: http://stackoverflow.com/comment/31971903
has body: It looks like column txn_date does not exist in table ES_STMT_TRANSACTIONS. If you provide your schema, it will be easier to see where the problem lies.

http://stackoverflow.com/comment/31950833
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21215141
type: QuestionComment
has text: Also i am using 64 bit java

http://stackoverflow.com/q/21262250
favorite count: 0
has answer: http://stackoverflow.com/a/21262278
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21262280
tagged with: tostring
score: 3
upvote count: 3
has title: toString method printing null variables, cant understand why (Java)
tagged with: java
has answer: http://stackoverflow.com/a/21262317
type: Question
has body: I haven't found any help on here so I'm gonna just ask. public Ride(String n, int tr, double hr , int nr){ String name = n; int ticketsRequired = tr; double heightRequirement = hr; int numberOfRiders = nr; } public String toString(){ String info; info = this.name + " Requiring " + this.ticketsRequired + " tickets with a height restriction of " + heightRequirement; return info; } That is in once class, then i try to call it in a main method in another program within my package via this: r1 = new Ride("Death run",0, 5.2, 5); System.out.println( r1.toString()); Which will return this null Requiring 0 tickets with a height restriction of 0.0 I'm sure that I'm missing something simple but this is driving me insane.
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/32034031

http://stackoverflow.com/comment/31970883
comment on: http://stackoverflow.com/q/21211974
score: 0
type: Comment
type: QuestionComment
has text: Leco's comments solved my problem! thanks man

http://stackoverflow.com/q/21237270
has comment: http://stackoverflow.com/comment/31990726
type: UnansweredQuestion
tagged with: addition
has comment: http://stackoverflow.com/comment/31990398
tagged with: object
linked to: http://stackoverflow.com/q/27581
has answer: http://stackoverflow.com/a/21237522
has comment: http://stackoverflow.com/comment/31991057
tagged with: java
has answer: http://stackoverflow.com/a/21237414
has comment: http://stackoverflow.com/comment/31990431
has comment: http://stackoverflow.com/comment/31990407
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31990365
has title: Recognizing duplicates in HashSet
has comment: http://stackoverflow.com/comment/31990323
tagged with: hashset
score: 0
has body: So, I have this code written in Java: import java.util.HashSet; class Interval{ long from; long to; public Interval(long from, long to) { this.from = from; this.to = to; } public boolean equals(Interval other) { return from == other.from &amp;&amp; to == other.to; } } public class Test { public static void main(String[] args) { HashSet&lt;Interval&gt; mySet = new HashSet&lt;Interval&gt;(); mySet.add(new Interval(1,2)); mySet.add(new Interval(1,2)); for(Interval in : mySet) { System.out.println(in.from + " " + in.to); } } } The problem is that the set doesn't recognize that there is already an interval from 1 to 2. I defined the function equals, but still it doesn't work. I tried implementing the Comparable interface and overloading the compareTo function, but again nothing. Can somebody tell me how can I solve this problem? Thank you!

http://stackoverflow.com/a/21273918
score: 0
has comment: http://stackoverflow.com/comment/32055195
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32055325
type: Answer
has comment: http://stackoverflow.com/comment/32055201
has comment: http://stackoverflow.com/comment/32055259
has comment: http://stackoverflow.com/comment/32055269
accepted answer of: http://stackoverflow.com/q/21273878
has comment: http://stackoverflow.com/comment/32055339
answers question: http://stackoverflow.com/q/21273878
has body: You're doing modulo 12 on the number of hours between Hours.hoursBetween(dob1, now1).getHours() % 12 So 12 % 12 = 0

http://stackoverflow.com/comment/31916378
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21195662
has text: it really depend on what you want in the result document, what is the input and output of your search, if you want to search for a product and get a list of stores and locations then I guess you'll have to create a document per product as well, meaning (number of product * number of stores) documents

http://stackoverflow.com/comment/32188269
type: AnswerComment
comment on: http://stackoverflow.com/a/21338560
type: Comment
has text: One thing I spot is that you clear the display in init2D/initText2D, i.e. whenever you switch between the modes you discard everything drawn before. Thus when the Button starts to draw its text it clears the two rectangles that were drawn before.
score: 0

http://stackoverflow.com/comment/32161865
type: Comment
comment on: http://stackoverflow.com/q/21334793
score: 1
has text: Which package are you working in? java.io.* does not have a File class with a notExists() method.
type: QuestionComment

http://stackoverflow.com/q/21223593
has title: NullPointerException Android - Unable to start activity
tagged with: java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21223630
tagged with: nullpointerexception
type: Question
has answer: http://stackoverflow.com/a/21223609
tagged with: android
possible better answer: http://stackoverflow.com/a/21223630
has body: Not quite sure why im getting the following error since the code is lifted from another page and working fine there... 01-19 22:38:06.443: E/AndroidRuntime(27945): FATAL EXCEPTION: main 01-19 22:38:06.443: E/AndroidRuntime(27945): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fooditemmonitor/com.example.fooditemmonitor.CurrentItems}: java.lang.NullPointerException 01-19 22:38:06.443: E/AndroidRuntime(27945): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2295) 01-19 22:38:06.443: E/AndroidRuntime(27945): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349) 01-19 22:38:06.443: E/AndroidRuntime(27945): at android.app.ActivityThread.access$700(ActivityThread.java:159) 01-19 22:38:06.443: E/AndroidRuntime(27945): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316) 01-19 22:38:06.443: E/AndroidRuntime(27945): at android.os.Handler.dispatchMessage(Handler.java:99) 01-19 22:38:06.443: E/AndroidRuntime(27945): at android.os.Looper.loop(Looper.java:176) 01-19 22:38:06.443: E/AndroidRuntime(27945): at android.app.ActivityThread.main(ActivityThread.java:5419) 01-19 22:38:06.443: E/AndroidRuntime(27945): at java.lang.reflect.Method.invokeNative(Native Method) 01-19 22:38:06.443: E/AndroidRuntime(27945): at java.lang.reflect.Method.invoke(Method.java:525) 01-19 22:38:06.443: E/AndroidRuntime(27945): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046) 01-19 22:38:06.443: E/AndroidRuntime(27945): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862) 01-19 22:38:06.443: E/AndroidRuntime(27945): at dalvik.system.NativeStart.main(Native Method) 01-19 22:38:06.443: E/AndroidRuntime(27945): Caused by: java.lang.NullPointerException 01-19 22:38:06.443: E/AndroidRuntime(27945): at com.example.fooditemmonitor.CurrentItems.onCreate(CurrentItems.java:22) 01-19 22:38:06.443: E/AndroidRuntime(27945): at android.app.Activity.performCreate(Activity.java…
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21223609

http://stackoverflow.com/comment/32047325
type: QuestionComment
has text: @ITroubs when JITed, it does
comment on: http://stackoverflow.com/q/21269461
score: 0
type: Comment

http://stackoverflow.com/comment/32201773
score: 0
has text: DeltaSpike implements CDI portable extensions and yes, it should be portable. Remember to enable the interceptors in `beans.xml`.
comment on: http://stackoverflow.com/a/21328931
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32056251
score: 0
comment on: http://stackoverflow.com/q/21274477
type: Comment
has text: Folks over at http://gaming.stackexchange.com/ might have more experience with bukkit-specific questions.
type: QuestionComment

http://stackoverflow.com/comment/31899438
score: 0
type: Comment
type: QuestionComment
has text: please check my above code i have given before update table code
comment on: http://stackoverflow.com/q/21186143

http://stackoverflow.com/comment/54472803
type: QuestionComment
has text: @Typo do you have any idea what exactly could have caused it?
comment on: http://stackoverflow.com/q/21194275
score: 0
type: Comment

http://stackoverflow.com/q/21256141
has comment: http://stackoverflow.com/comment/32023978
has comment: http://stackoverflow.com/comment/32022982
tagged with: css
has body: i'm trying to make &lt;p:inputTextArea/&gt; looks better, now when page is loaded i can see: and when i click that TextArea : here is the code: &lt;p:inputTextarea rows="6" value="#{bean.object.value}"style="width: 100%;" /&gt; How can i make that area would adjust its size to text ? rows="6" is working for a little data but it looks terrible when more chars are written
answer count: 4
has comment: http://stackoverflow.com/comment/32023859
has answer: http://stackoverflow.com/a/24520512
has comment: http://stackoverflow.com/comment/32023931
has answer: http://stackoverflow.com/a/21256980
has answer: http://stackoverflow.com/a/26527991
accepted answer: http://stackoverflow.com/a/21256980
possible better answer: http://stackoverflow.com/a/30941353
has comment: http://stackoverflow.com/comment/32022931
type: AnsweredQuestion
tagged with: jsf
tagged with: primefaces
tagged with: java
has title: How to make primefaces inputTextArea fit to text?
type: Question
upvote count: 4
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/32023370
downvote count: 0
has answer: http://stackoverflow.com/a/30941353
has comment: http://stackoverflow.com/comment/32024079
score: 4
favorite count: 0

http://stackoverflow.com/a/21203440
answers question: http://stackoverflow.com/q/21203400
score: 3
has comment: http://stackoverflow.com/comment/31930543
upvote count: 3
has body: Well yes - look at the declaration of the method you're implementing: void actionPerformed(ActionEvent e) It isn't declared to throw any checked exceptions. So you can't add a checked exception such as IOException with a throws clause. You'll have to either handle the exception in your listener, or convert it to an unchecked exception and throw that. (Your exception handling is already far from ideal - within the method, you catch IOException and swallow it completely silently... failing to close the file in that case. You should close the reader in a finally block or using a try-with-resources statement if you're using Java 7, and you should at least log the exception, potentially telling the user about it. Continuing as if nothing had gone wrong is a really bad idea.)
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31929969
has comment: http://stackoverflow.com/comment/31929854
type: Answer
has comment: http://stackoverflow.com/comment/31929823
accepted answer of: http://stackoverflow.com/q/21203400
downvote count: 0

http://stackoverflow.com/a/21237837
answers question: http://stackoverflow.com/q/21237781
upvote count: 2
has body: You have one call of sc.hasNext() and 2 sequential calls of sc.next(). String s = sc.next(); String s1 = sc.next(); The second call obviously causes exception when the last element has been read by the first call.
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/31947547
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21213143
has text: Not enough information. Are you sure the parser and visitor are supposed to be generated? Did you look in the correct directories? Perhaps you should review the documentation and/or issue tracker once more.

http://stackoverflow.com/a/21218367
upvote count: 1
answers question: http://stackoverflow.com/q/21218109
type: AcceptedAnswer
has body: You can configure your persistence.xml file to "create" the database tables during the deployment time, based on annotations made in the entity classes. This option generates a DDL (Data Definition Language) file that is processed by the JPA framework to generate the tables. In JPA use the following property to trigger the table generation: &lt;properties&gt; &lt;property name="eclipselink.ddl-generation" value="create-tables"/&gt; &lt;/properties&gt; If you need to drop and recreate the table during each deploy you can use: &lt;properties&gt; &lt;property name="eclipselink.ddl-generation" value="drop-and-create-tables"/&gt; &lt;/properties&gt;
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21218109

http://stackoverflow.com/q/21304261
type: Question
tagged with: java
score: 0
linked to: http://stackoverflow.com/q/2393179
answer count: 1
has answer: http://stackoverflow.com/a/21322128
tagged with: serialization
duplicate of: http://stackoverflow.com/q/2393179
has title: Reading data from a serialised file throws java.io.StreamCorruptedException:
type: UnansweredQuestion
tagged with: file
has body: I am dumping an arraylist of object into a file.I am serialising object by object and logging into a file instead of whole arraylist serialisation because no. of arraylist can be mor than one. The process is working fine and data is appending in the file but during the deserialisation i can retrieve only first arraylist objects and as soon as second arraylist objects come it throws java.io.StreamCorruptedException: invalid type code: AC . My each arraylist have same type of objects. I have tried to search a lot but none of the tricks like reset, AppendableObjectoutputstream are working. My serialising code is: public static void dumplogInFile(ArrayList&lt;HtmlElementObject&gt; sanitizelog) { try { String fileName = "c:\\temp\\ auditinfo.ser"; FileOutputStream fileOut = new FileOutputStream(fileName , true); ObjectOutputStream out = new ObjectOutputStream(fileOut); for(HtmlElementObject eachobj : sanitizelog) { out.writeObject(eachobj); out.reset() ; } out.close(); fileOut.close(); System.out.printf("Serialized data is saved in /tmp/auditinfo.ser"); //logElementData.clear(); }catch(IOException i) { i.printStackTrace(); } } here number of arraylist will be more instead of one as it works like that if webservice will fail then it will dump the data in file. My Deserialising Code to read data from file public static ArrayList&lt;HtmlElementObject&gt; extractLogFromFile() { HtmlElementObject v ; ArrayList&lt;HtmlElementObject&gt; extractLogList = new ArrayList&lt;HtmlElementObject&gt;(); try { FileInputStream fileIn = new FileInputStream("c:\\temp\\ auditinfo.ser"); ObjectInputStream in = new ObjectInputStream(fileIn); // ObjectInputStream in = new ObjectInputStream(fileIn); /* ArrayList&lt;HtmlElementObject&gt; arr = (ArrayList&lt;HtmlElementObject&gt;) in.readObject(); // for (HtmlElementObject a : arr) // { //a = (HtmlElementObject) in.readObject(); //extractLogList.add(a); //}*/ int count =0; while( (v = (HtmlElementObject)in.readObject()) != null) { System.out.print…

http://stackoverflow.com/comment/31966441
comment on: http://stackoverflow.com/a/21211408
has text: That's a different error, caused by a different problem. It's possible that you have the CLASSPATH environment variable set, interfering with how classes are loaded. If the class was successfully compiled and you're in the right directory, `java -classpath . P` should work even if CLASSPATH is set.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21221858
has body: I have been given this on a mock programming exam and I am not too good with this type of thing, can someone explain to me how I would go through something like the following? change the values to the one in the question if you feel like it explains it better. It is the final else which is really throwing me off. Thank you for the help. public int function( int a, int b) { if (a&lt;=0){ return b; } else if (b&lt;=0) { return function( a-2, 0); } else { return function (function (a-1, b-1), b-1); }
score: 0
has comment: http://stackoverflow.com/comment/31963031
has comment: http://stackoverflow.com/comment/31962996
accepted answer: http://stackoverflow.com/a/21222200
has comment: http://stackoverflow.com/comment/31962956
has answer: http://stackoverflow.com/a/21221938
has comment: http://stackoverflow.com/comment/31962912
has answer: http://stackoverflow.com/a/21222200
tagged with: recursion
type: AnsweredQuestion
has title: Can someone trace me through this using the values (1,1)
tagged with: java
has comment: http://stackoverflow.com/comment/31962945
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21221938
tagged with: function

http://stackoverflow.com/q/21299970
tagged with: tomcat
has answer: http://stackoverflow.com/a/21300281
favorite count: 0
score: 2
upvote count: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21300281
tagged with: java
has title: couldnt connect to discovered master - hazelcast
type: Question
has body: I am trying to set up a hazelcast topic for pub/sub between two tomcat instances. To start with, I have just a servlet which initializes Hazelcast and creates the topic when tomcat starts. This servlet will also publish messages to the topic when invoked through HTTP GET. Here is my init() method in the servlet: Config cfg = new Config(); System.out.println("hzapp: Creating hazelcast instance..."); hzInstance = Hazelcast.newHazelcastInstance(cfg); System.out.println("hzapp: Created hazelcast instance."); topic = hzInstance.getTopic("my-topic"); System.out.println("hzapp: Adding listener to the topic..."); topic.addMessageListener(new HzMessageListener()); System.out.println("hzapp: listener added to the topic."); The doGet(req, res) method of the servlet just publishes a message to the topic like this: String message = request.getParameter("message"); System.out.println("hzapp: publishing message: " + message); topic.publish(message); System.out.println("hzapp: published message: " + message); The HzMessageListener does nothing but prints the received message: public void onMessage(Message&lt;String&gt; message) { System.out.println("hzapp: Message Received: " + message.getMessageObject()); } Now, the issue I am facing is that, when I start tomcat, it gives me the below error: INFO: Starting Servlet Engine: Apache Tomcat/6.0.36 hzapp: Creating hazelcast instance... Jan 23, 2014 10:43:26 AM com.hazelcast.instance.DefaultAddressPicker INFO: Prefer IPv4 stack is true. Jan 23, 2014 10:43:26 AM com.hazelcast.instance.DefaultAddressPicker INFO: Picked Address[192.168.1.10]:5702, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0%0,localport=5702], bind any local is true Jan 23, 2014 10:43:26 AM com.hazelcast.system INFO: [192.168.1.10]:5702 [dev] Hazelcast Community Edition 3.1.4 (20140111) starting at Address[192.168.1.10]:5702 Jan 23, 2014 10:43:26 AM com.hazelcast.system INFO: [192.168.1.10]:5702 [dev] Copyright (C) 2008-2013 Hazelcast.com Jan 23, 2014 10:43:26 AM com.haz…
answer count: 1
downvote count: 0
tagged with: hazelcast

http://stackoverflow.com/q/21312670
answer count: 2
has answer: http://stackoverflow.com/a/21313032
tagged with: textarea
favorite count: 0
type: AnsweredQuestion
has title: how to scan lines of JTextArea?
possible better answer: http://stackoverflow.com/a/21313032
downvote count: 3
upvote count: 1
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/21312898
score: -2
has body: As the title says, I want to scan a textArea. Is it possible to scan both numbers and strings? One more thing, I use setBounds for the position of the textArea, but it doesn't work. import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextArea; public class TextArea { JFrame frame = new JFrame(); JPanel panel = new JPanel(); JTextArea area = new JTextArea(4, 10); public TextArea() { area.setBounds(110, 250, 40, 40); //doesn't work frame.add(panel); panel.add(area); frame.setTitle("Area"); frame.setVisible(true); frame.setSize(900, 580); frame.setLocationRelativeTo(null); } public static void main(String[] args) { new TextArea(); } }
accepted answer: http://stackoverflow.com/a/21312898
tagged with: java
has comment: http://stackoverflow.com/comment/32122774

http://stackoverflow.com/comment/32261834
comment on: http://stackoverflow.com/q/21271111
type: QuestionComment
type: Comment
score: 0
has text: Not clear what you want to match. Can you provide an example? Do you want to match all words you enumerated? Or everything except for those words?

http://stackoverflow.com/comment/32125894
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21314458
has text: The problem with the URL is that is shows the password, which is the main thing I'm trying to avoid.

http://stackoverflow.com/q/21280652
has comment: http://stackoverflow.com/comment/32098391
tagged with: concurrency
has title: Testing simple Semaphore usage in Java
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/21247283
score: 3
upvote count: 3
tagged with: java
has body: I have fields that manage information that multiple threads potentially work with. Access to these fields is critical so I instantiated a semaphore: Semaphore semaphore = new Semaphore(1); Every method tries to acquire the semaphore, essentially locking if none is available: public void method() { semaphore.acquire(); doStruff(); cleanUp() } //Other methods using the same basic layout as the method above. public void cleanUp() { //watch for state consistency and do some clean up semaphore.release(); } How would I go about testing the above knowing that: I don't want to use timed testing, using Thread.sleep(x) due to the inherent problems with that method such as the dependence on the clock and lack in trust of that method. I cannot use MultithreadedTC, at least not that I know of, since one thread will always be executing, hence, the metronome won't advance to the next tick. I don't want to modify existing code to add bits just for testing purposes. The code should stay clear of additions from testing. I would want something solid that I can run multiple times and use in regression testing. As I am not the only one using the code, it should be Java native and not use a scripting language such as ConAn. The bit of code is small enough that I can, with a good certainty, say that it won't deadlock or the condition detailed above violated. However, a good test case could lend more weight to it and certainly add more confidence.
has answer: http://stackoverflow.com/a/34407456
type: Question
tagged with: junit4
has answer: http://stackoverflow.com/a/21295486

http://stackoverflow.com/a/21220861
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21220808
has comment: http://stackoverflow.com/comment/31961792
downvote count: 0
has body: I think you have exception in last line. Exactly here ids[randomNumber] You should check random generated number, because it can be greater then ids.length. Use rand.nextInt(ids.length); It will generate random number from 0 to ids.length.

http://stackoverflow.com/comment/32033274
type: Comment
has text: In my experience transitioning to annotations/JavaConfig can be done smoothly and incrementally. After a couple of years of development you barely have any XML at all. You can include the xml files as resources in the modules and import them directly from the parent xml as shown in here http://stackoverflow.com/a/5115384/1148030 or from web.xml as in @MariuszS answer.
comment on: http://stackoverflow.com/a/21221039
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31957951
comment on: http://stackoverflow.com/a/21219175
type: AnswerComment
score: 0
type: Comment
has text: It has came up with a NPE again :-/

http://stackoverflow.com/q/21185834
tagged with: java
tagged with: drools-guvnor
has comment: http://stackoverflow.com/comment/31898724
has comment: http://stackoverflow.com/comment/31932511
type: Question
has body: I have a Centos VM on which tomcat is running. So I was trying to deploy drool-workbench war from http://192.168.56.102:8080/manager/ But I have encounter following errors: 2014-01-17 17:32:05,279 [http-bio-8080-exec-11] ERROR Can't initialize FileSystemProviders java.util.ServiceConfigurationError: org.uberfire.java.nio.file.spi.FileSystemProvider: Provider org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider could not be instantiated: org.uberfire.java.nio.IOException: java.net.BindException: Address already in use 2014-01-17 17:32:05,335 [http-bio-8080-exec-11] ERROR Failed to setup Repository 'uf-playground' org.jboss.weld.exceptions.WeldException: WELD-000049 Unable to invoke [method] @PostConstruct public org.uberfire.backend.server.io.ConfigIOServiceProducer.setup() on org.uberfire.backend.server.io.ConfigIOServiceProducer@2c4c74
tagged with: drools
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31897353
score: 1
tagged with: tomcat
has comment: http://stackoverflow.com/comment/31918290
favorite count: 0
has comment: http://stackoverflow.com/comment/32623820
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21309908
has title: Unable to deploy drool-workbench on tomcat 7

http://stackoverflow.com/comment/32162148
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21334543
has text: I can't understand what you are trying to do. I can't find the root module view nor the child modules. My guess is that you want to mark the checkbox (with #{modules.view}) of the row selected by the user. Is that correct?

filtering
tags question: http://stackoverflow.com/q/21184666
tag name: filtering
type: Tag

http://stackoverflow.com/a/21244676
score: 0
answers question: http://stackoverflow.com/q/21244526
type: Answer
has body: You cannot do int j = Math.pow(j,i) inside System.out.print. What is your logic there? You can simply print by System.out.print(Math.pow(j,i));

http://stackoverflow.com/comment/31947294
has text: I think you should remove requirements 3 and 5, which would make it easier. Why would you want the values to be reassigned anyway?
comment on: http://stackoverflow.com/a/21212139
score: 0
type: Comment
type: AnswerComment

wifi
tag name: wifi
tags question: http://stackoverflow.com/q/21240305
tags question: http://stackoverflow.com/q/21220383
type: Tag
tags question: http://stackoverflow.com/q/21279141
tags question: http://stackoverflow.com/q/21287087

http://stackoverflow.com/a/26895045
type: Answer
has body: Why are you calling the event in the keyboard event? why not just check block[i].leftrighttop and down from the block[i+1] and then move it back the distance it traveled inwards eg. for(int i = 0; i &lt; Main.blocks.length - 2/*Because we will be checking i +1*/; i ++){ if((Main.blocks[i].left &gt; Main.blocks[i+1].left)&amp;&amp;(Main.blocks[i].left &lt; Main.blocks[i+1].left)){} } that would check the x pos of the blocks... now you can just tell it to move to the nearest point and do the same for the rest :) hopes it helps! i always did it in delphi7.
answers question: http://stackoverflow.com/q/21241591
score: 0

http://stackoverflow.com/q/21296990
upvote count: 1
has comment: http://stackoverflow.com/comment/32140683
tagged with: alt
tagged with: mnemonics
favorite count: 0
has comment: http://stackoverflow.com/comment/32096322
type: UnansweredQuestion
has body: We migrated our swing application from JAVA 1.4 to JAVA 5, the problem we are facing is that the ALT + Key is not working in Java 5 after an internal frame is closed. It works as long as any of the internal frames are not closed. It again works when it is minimized and maximized. What I understand is, it is not getting the focus back to the Menu bar or it is not repainting the Menu properly which causes the ALT+key not to work. Is there any specific reason for an already working code behaving like this, is this anyway related to the deprecated method setNextFocusableComponent which I don't think so. Thanks in advance.
has title: ALT + Key is not working in Java 5 swing after an internal frame is closed
has comment: http://stackoverflow.com/comment/32101675
answer count: 0
downvote count: 0
score: 1
tagged with: java
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/32095838
has comment: http://stackoverflow.com/comment/32098538
has comment: http://stackoverflow.com/comment/32096537

http://stackoverflow.com/comment/32148822
comment on: http://stackoverflow.com/q/21327175
type: Comment
type: QuestionComment
has text: Have you heard about [`onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)`](http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html#onUpgrade%28android.database.sqlite.SQLiteDatabase,%20int,%20int%29)?
score: 0

http://stackoverflow.com/a/21289102
has comment: http://stackoverflow.com/comment/32085664
type: Answer
score: 2
upvote count: 2
has body: Your isEmpty() method is wrong in PaperTray, it now returns true if pages &gt; 0 (when it is full), and returns false if pages &lt;= 0 (when it is empty). You need to switch the condition to pages == 0 or to be absolutely sure pages &lt;= 0.
accepted answer of: http://stackoverflow.com/q/21289019
has comment: http://stackoverflow.com/comment/32083640
answers question: http://stackoverflow.com/q/21289019
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32081431
downvote count: 0

http://stackoverflow.com/comment/31978452
type: Comment
has text: Yes but its in most cases. You should avoid.
type: AnswerComment
comment on: http://stackoverflow.com/a/21230425
score: 0

http://stackoverflow.com/q/21206240
tagged with: java
downvote count: 3
type: Question
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/31934937
favorite count: 0
has answer: http://stackoverflow.com/a/33672493
has title: Can I make the divider of a JSplitPane stay in fixed location?
has comment: http://stackoverflow.com/comment/31934978
has body: I am using a splitpane and I want to fix the divider, such that it doesn't move at all. Is it possible ?
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/21206407
score: 1

http://stackoverflow.com/q/21315534
tagged with: java
has title: What is the Difference between a declaration using Generic Class and Generic Collections type
has comment: http://stackoverflow.com/comment/32127939
linked to: http://stackoverflow.com/q/6279516
type: Question
upvote count: 4
tagged with: java-5
score: 4
has comment: http://stackoverflow.com/comment/32133596
answer count: 2
has answer: http://stackoverflow.com/a/21339280
downvote count: 0
tagged with: generics
has body: I will show you two style of declaration of generics. In part1, I'm using generic upper boundary declaration on List as follows: List&lt;? extends Animal&gt; totList = new ArrayList&lt;Animal&gt;(); But this will throw error like below if you try to add a Animal object to the list: Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method add(capture#1-of ? extends Animal) in the type List&lt;capture#1-of ? extends Animal&gt; is not applicable for the arguments (Animal) at GenericsType.main(GenericsType.java:39) But as in Part2, if I declare the list inside a generic class in the format below, no errors are thrown while adding (Animal objects) or (subclass of Animal objects) to the list. class GenericAnimal&lt;T extends Animal&gt; { List&lt;T&gt; genList = new ArrayList&lt;T&gt;(); } Why in part2, it didn't throw error and what is the difference between two style of declaration. Example Code: 1.Animal.java public class Animal { private String name; private int height; public void animalJump() { if(height&gt;100) { System.out.println(name+" with height-"+height+" can JUMP"); } else System.out.println(name+" with height-"+height+" cannot jump"); } public void setName(String name) { this.name = name; } public void setHeight(int height) { this.height = height; } public Animal(String name, int height) { setName(name); setHeight(height); } } 2.GenericsType.java import java.util.*; import Animal; import Animal.Cannine; import Animal.Feline; import Animal.Feline.Cat; import Animal.Cannine.Dog; public class GenericsType { public static List&lt;? extends Animal&gt; totList = new ArrayList&lt;Animal&gt;(); public static void processAllfunc1() { for(Animal a : totList) { a.animalJump(); } } public static void main(String args[]) { // Part 1 totList.add(new Animal("Animal1",21)); // Error: Unresolved compilation problem: processAllfunc1(); // Part 2 GenericAnimal&lt;Animal&gt; genericanimal = new GenericAnimal&lt;Animal&gt;(); genericanimal.genList.a…
favorite count: 0
has answer: http://stackoverflow.com/a/21315592
type: UnansweredQuestion

http://stackoverflow.com/q/21195832
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21196157
tagged with: java
type: Question
has body: Somewhere i got to see a code snippet like this // T1 for(i=0;i&lt;n;i++) { EJBLocator.getAbcRemote().updateByIndex(i); } and i thought probably a code like following will do a better job // T2 List&lt;Integer&gt; indexes = new XXXList&lt;&gt;(); for(i=0;i&lt;n;i++) { indexes.add(i); } EJBLocator.getAbcRemote().updateByIndexes(indexes); or even // T3 AbcRemore remote = EJBLocator.getAbcRemote(); for(i=0;i&lt;n;i++) { remote.updateByIndex(i); } Just wanted to know, on a performance scale, where will these 3 approaches lies ad why.
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
tagged with: ejb-3.0
has title: EJB performance
accepted answer: http://stackoverflow.com/a/21196157
has comment: http://stackoverflow.com/comment/31916479

http://stackoverflow.com/a/21259409
type: Answer
has body: When you POST a form to an HTTP server, the form's contents aren't sent as query parameters; instead, the form is (usually) uploaded as an entity of type application/x-www-form-urlencoded. Instead of using @RequestParam in your method, define a Java class that has fields corresponding to the form fields, and use @ModelAttribute FormClass form.
upvote count: 3
answers question: http://stackoverflow.com/q/21258294
score: 3
downvote count: 0

http://stackoverflow.com/q/21278519
has comment: http://stackoverflow.com/comment/32063292
upvote count: 2
has comment: http://stackoverflow.com/comment/32063447
tagged with: swing
accepted answer: http://stackoverflow.com/a/21281982
has comment: http://stackoverflow.com/comment/32063379
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32062752
tagged with: java
has comment: http://stackoverflow.com/comment/32067801
type: Question
tagged with: gridbaglayout
tagged with: html-table
answer count: 1
downvote count: 0
tagged with: layout-manager
has body: As far as i am aware the Swing Gridbag.gridwidth = 2; should work exactly as colspan does in HTML, that being force a column to stretch across providing one column that seperates into two on the next line etc However mine appears to be compressing the two columns underneath it into one forcing them on top of each other. public class MainClass extends JFrame { public static void main(String args[]) { new MainClass(); } public MainClass() { JPanel panel = new JPanel(new GridBagLayout()); this.getContentPane().add(panel); final JTextField nameInput = new JTextField(); final JLabel headerImage = new JLabel("test"); final JTextField volunteerID = new JTextField(); TitledBorder nameLabel; nameLabel = BorderFactory.createTitledBorder("Name"); nameInput.setBorder(nameLabel); TitledBorder fileNameLabel; fileNameLabel = BorderFactory.createTitledBorder("Volunteer ID/ FileName"); volunteerID.setBorder(fileNameLabel); JPanel constructorPanel = new JPanel(); constructorPanel.add(nameInput); JPanel resultsPanel = new JPanel(); resultsPanel.add(volunteerID); JPanel imagePanel = new JPanel(); imagePanel.add(headerImage); GridBagConstraints gbc = new GridBagConstraints(); // Constructors additional code //see below gbc.gridx = 0; gbc.gridy = 1; panel.add(constructorPanel, gbc); gbc.gridx = 1; gbc.gridy = 1; gbc.anchor = GridBagConstraints.NORTH; panel.add(resultsPanel, gbc); nameInput.setColumns(15); volunteerID.setColumns(15); this.pack(); this.setTitle("GiGgle Pics Settings Constructor"); this.setVisible(true); this.setResizable(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } The above produces the following: However when I add following code in the space marked additional code above gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 2; gbc.weightx = 1.0; gbc.fill = WIDTH; panel.add(imagePanel, gbc); I get this: Any help would be great
has title: Java Swing Gridbag panel wont colspan
favorite count: 0
has answer: http://stackoverflow.com/a/21281982
score: 2

http://stackoverflow.com/comment/34685091
has text: Can you please add the code for `escapeSequence(), it is missing from your example. I will give it a try today (I am jparsec's current maintainer...)
score: 0
comment on: http://stackoverflow.com/q/21327504
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21245796
downvote count: 0
has answer: http://stackoverflow.com/a/23614722
has answer: http://stackoverflow.com/a/62527025
favorite count: 0
has answer: http://stackoverflow.com/a/49724926
has answer: http://stackoverflow.com/a/43009185
has answer: http://stackoverflow.com/a/36785815
has comment: http://stackoverflow.com/comment/139658124
type: Question
has answer: http://stackoverflow.com/a/25657422
has answer: http://stackoverflow.com/a/31687338
has answer: http://stackoverflow.com/a/32015890
has answer: http://stackoverflow.com/a/66760506
has answer: http://stackoverflow.com/a/48529174
has comment: http://stackoverflow.com/comment/101812568
linked to: http://stackoverflow.com/q/46081424
has answer: http://stackoverflow.com/a/34900231
has answer: http://stackoverflow.com/a/24771630
linked to: http://stackoverflow.com/q/28908835
linked to: http://stackoverflow.com/q/21076179
score: 112
has title: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake during web service communicaiton
has comment: http://stackoverflow.com/comment/125565013
has answer: http://stackoverflow.com/a/33369622
has answer: http://stackoverflow.com/a/39788897
has answer: http://stackoverflow.com/a/21589728
has comment: http://stackoverflow.com/comment/62322511
has answer: http://stackoverflow.com/a/78505581
has answer: http://stackoverflow.com/a/33893943
tagged with: java
has comment: http://stackoverflow.com/comment/126342314
tagged with: ssl
type: UnansweredQuestion
has body: I am getting javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake exception when I try to do HTTPS Post of a web service through internet. But same code works for other internet hosted web services. I tried many things, nothing is helping me. I posted my sample code here. Can anyone please help me to resolve this problem? public static void main(String[] args) throws Exception { String xmlServerURL = "https://example.com/soap/WsRouter"; URL urlXMLServer = new URL(xmlServerURL); // URLConnection supports HTTPS protocol only with JDK 1.4+ Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress( "xxxx.example.com", 8083)); HttpURLConnection httpsURLConnection = (HttpURLConnection) urlXMLServer .openConnection(proxy); httpsURLConnection.setRequestProperty("Content-Type","text/xml; charset=utf-8"); //httpsURLConnection.setDoInput(true); httpsURLConnection.setDoOutput(true); httpsURLConnection.setConnectTimeout(300000); //httpsURLConnection.setIgnoreProxy(false); httpsURLConnection.setRequestMethod("POST"); //httpsURLConnection.setHostnameVerifier(DO_NOT_VERIFY); // send request PrintWriter out = new PrintWriter( httpsURLConnection.getOutputStream()); StringBuffer requestXML = new StringBuffer(); requestXML.append(getProcessWorkOrderSOAPXML()); // get list of user out.println(requestXML.toString()); out.close(); out.flush(); System.out.println("XML Request POSTed to " + xmlServerURL + "\n"); System.out.println(requestXML.toString() + "\n"); //Thread.sleep(60000); // read response BufferedReader in = new BufferedReader(new InputStreamReader( httpsURLConnection.getInputStream())); String line; String respXML = ""; while ((line = in.readLine()) != null) { respXML += line; } in.close(); // output response respXML = URLDecoder.decode(respXML, "UTF-8"); System.out.println("\nXML Response\n"); System.out.println(respXML); } Full stacktrace: Exception in thread "main" javax.net.ssl.SSLHandshakeException: Remote host closed connection during h…
has answer: http://stackoverflow.com/a/49001015
has answer: http://stackoverflow.com/a/47196134
has comment: http://stackoverflow.com/comment/59278489
has answer: http://stackoverflow.com/a/34891294
answer count: 22
has answer: http://stackoverflow.com/a/60718190
tagged with: webservice-client
has answer: http://stackoverflow.com/a/22629008
upvote count: 112

http://stackoverflow.com/q/21283958
has answer: http://stackoverflow.com/a/21285402
tagged with: dagger
has comment: http://stackoverflow.com/comment/32072320
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21285402
tagged with: anonymous-inner-class
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21420039
has title: How to inject an anonymous inner class with dagger?
has answer: http://stackoverflow.com/a/21420039
has body: It's posible inject an anonymous class? I'm having the following error: java.lang.IllegalArgumentException: No inject registered for members/com.acme.MyFragment$1. You must explicitly add it to the 'injects' option in one of your modules. Example: public class MyFragment extends Fragment { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); new MyTrask(getActivity()) { protected void onPostExecute(String result) { // Stuff } }.execute(); } } public class MyTask extends AsyncTask&lt;Void, Void, String&gt; { @Inject UserApi userApi; public MyTask(Context context) { App.getInstance().inject(this); } @Override protected String doInBackground(Void... params) { return "Hello World!"; } }
upvote count: 3
tagged with: java
type: Question
score: 3

http://stackoverflow.com/q/21313643
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40492645
type: UnansweredQuestion
tagged with: sockets
has answer: http://stackoverflow.com/a/28240318
has body: THE GOAL I'm trying to parse an HTTP POST request in order to retrieve the file sent with an HTML form. This is the form: &lt;form action="http://127.0.0.1:8081" method="post" enctype="multipart/form-data"&gt; &lt;input type="file" name="file" id="fileControl" /&gt; &lt;input type="submit" /&gt; &lt;/form&gt; HOW As a POST request is something similar to this: POST &lt;URL&gt; HTTP/1.1 &lt;HEADERS&gt; [BLANK LINE] ---------&lt;BOUNDARY&gt; &lt;HEADERS&gt; [BLANK LINE] &lt;file content&gt; -----------&lt;BOUNDARY&gt; I think it's relevant to parse what I receive on my socket. First, I read until the beginning of the file with BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); in.readLine(); Then, to save the file, this what I'm trying to do: FileOutputStream outputStream = new FileOutputStream(new File("/tmp/test")); while ((read = clientSocket.getInputStream().read(bytes)) != -1) { outputStream.write(bytes, 0, read); outputStream.flush(); } THE PROBLEM The problem is that I'm not reading through my BufferedReader anymore, and I don't get anything in read = clientSocket.getInputStream().read(bytes) THE QUESTION How should I save the file send over POST request? I don't want to use any webserver, nor any library/framework, only pure Java. If something isn't clear, I'll edit this post. Thanks in advance.
tagged with: java
tagged with: inputstream
downvote count: 1
tagged with: http
type: Question
has title: Parsing an HTTP POST request
has comment: http://stackoverflow.com/comment/32125006
has comment: http://stackoverflow.com/comment/40475361
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21314012

http://stackoverflow.com/comment/31896723
has text: First I need to ask what is "realm", its being use in setHttpAuthUsernamePassword function.If I am missing some value there before sharing logcat?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21185400

http://stackoverflow.com/comment/31988504
comment on: http://stackoverflow.com/q/21234674
has text: As an aside your command will (when successful) cause the exec-maven-plugin to be run twice. Once because you have activated the profile, and once because you explicitly call the `exec:java` goal. Calling `mvn clean install -Dpopulatedb` should be enough to have the exec-maven-plugin to be run as configured in the profile in your pom.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21204987
tagged with: java
has answer: http://stackoverflow.com/a/22918810
type: Question
tagged with: function
score: 4
has body: I have an activity that contains all the functions for controlling my database, and I want all other activities to use to these functions when interacting with the database. Below is an example of my problem. Clock script: public class Clock extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_clock); Data.createTable(); //&lt;&lt;&lt; } //... } Data script: public class Data extends Activity { SQLiteDatabase mydb; private static String DBNAME = "SHIFTS.db"; private static String TABLE = "MY_SHIFTS"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_data); } public void createTable() //&lt;&lt;&lt; { try { mydb = openOrCreateDatabase(DBNAME, Context.MODE_PRIVATE,null); mydb.execSQL("CREATE TABLE IF NOT EXISTS "+ TABLE +" (ID INTEGER PRIMARY KEY, STARTDATE TEXT, ENDDATE TEXT, LENGTH INTEGER, TYPE INTEGER);"); mydb.close(); } catch(Exception e) { Toast.makeText(getApplicationContext(), "Error in creating table", Toast.LENGTH_LONG).show(); } } // ... lots more functions } Error message: Cannot make a static reference to the non-static method createTable() from the type Data. And when I trying to make method static, it just causes more problems. Also if I try Data data = new Data(); data.createTable(); I get a NullPointerException. What is the problem here?
downvote count: 1
tagged with: android-activity
accepted answer: http://stackoverflow.com/a/21205038
has answer: http://stackoverflow.com/a/21205091
favorite count: 0
tagged with: static
upvote count: 5
has comment: http://stackoverflow.com/comment/31933111
possible better answer: http://stackoverflow.com/a/21205068
tagged with: android
has answer: http://stackoverflow.com/a/21205068
has answer: http://stackoverflow.com/a/21205038
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31932313
has title: Calling function from another activity

http://stackoverflow.com/comment/31998531
score: 0
type: Comment
type: AnswerComment
has text: @75inchpianist The program has to compute `lowerBound + upperBound` first. If that can't be held in an `int` type, then the result of that addition will be a negative `int`. Then it will still be negative when you divide by 2.
comment on: http://stackoverflow.com/a/21241765

http://stackoverflow.com/comment/32020737
has text: your first arguement should be Vector<Vector<String>> not the second one
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21254708
type: Comment

http://stackoverflow.com/a/21339726
has comment: http://stackoverflow.com/comment/32171880
score: 0
has body: As you can see in ResponseContentEncoding sources this exception occurs when the server answer contains a non handled content encoding header. So you need to adapt the server code to "serve" its answer with a proper content encoding.
answers question: http://stackoverflow.com/q/21339637
type: Answer

http://stackoverflow.com/q/21279542
has answer: http://stackoverflow.com/a/21280170
type: Question
has comment: http://stackoverflow.com/comment/32064933
has comment: http://stackoverflow.com/comment/32064445
has title: getstring and locale not always working
score: 0
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/32065239
accepted answer: http://stackoverflow.com/a/21280170
type: AnsweredQuestion
has body: I have an application with two languages so i have to values folders (values and values-ar) all the string values from values folder are displaying normally when calling them in getstring or in the xml; but when I call a string from values-ar (after setting locale) sometimes it's giving me string from values and sometimes a string from values-ar (I tried in the same code getString(R.string.load_more) and getString(R.string.all)) I checked if I have duplicate fields in values-ar that might not be translated but that's not the case. I've already set the locale like this: Locale locale ; Configuration config = new Configuration(); locale= new Locale("ar"); Locale.setDefault(locale); config.locale = locale; getBaseContext().getResources().updateConfiguration(config,getBaseContext().getResources().getDisplayMetrics()); What could be the problem? Thank you
tagged with: java

http://stackoverflow.com/comment/31960909
type: Comment
has text: You have copyright already. Unfortunately with something this trivial, proving that someone copied your code, is going to be difficult. Unless you wrote it in way that nobody sane would copy anyway???
type: QuestionComment
comment on: http://stackoverflow.com/q/21220531
score: 0

http://stackoverflow.com/a/21236258
has body: There ought to be a better way but the following are the most general ones in my opinion: Set the version of the Java Applet in your IDE to the lowest version you want to support and start programming. Check the libraries/functions you need and check in which version they have been added.
downvote count: 0
answers question: http://stackoverflow.com/q/21236099
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/32225027
comment on: http://stackoverflow.com/a/21359475
score: 0
type: AnswerComment
type: Comment
has text: Personally I think the entire swing UI default look is extremely ugly. If you're working on a Mac, then swing will default to using the Aqua Look and Feel, which is what Apple made, and includes all the "standard" buttons, toggles, and yes, tabbed panes that Apple made.

http://stackoverflow.com/a/30592243
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21277123
score: 5
has body: This is worked for me : RequestQueue mRequestQueue = Volley.newRequestQueue(getApplicationContext()); JsonObjectRequest request = new JsonObjectRequest(Method.GET, cityListUrl, null, new Listener&lt;JSONObject&gt;() { public void onResponse(JSONObject jsonResults) { //Any Call } }, new ErrorListener(){ public void onErrorResponse(VolleyError arg0) { //Any Error log } } ); int socketTimeout = 30000;//30 seconds - change to what you want RetryPolicy policy = new DefaultRetryPolicy(socketTimeout, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT); request.setRetryPolicy(policy); mRequestQueue.add(request);
upvote count: 5
has comment: http://stackoverflow.com/comment/62001491

http://stackoverflow.com/q/21337514
tagged with: java
has title: how to get the imagepath stored in database and set into a button
type: Question
tagged with: database
accepted answer: http://stackoverflow.com/a/21344540
tagged with: imageicon
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/20361363
favorite count: 0
has comment: http://stackoverflow.com/comment/32168410
has body: I have a GUI which have texfields and button to it . If I click the next button the cursor should navigate in the database and set the row values into my textfields and put the path into the button to create image icon. But it gives me this error. Code block: if (event.getSource() == next) { try { if (rs.next()) { lastnameT.setText(rs.getString("lname")); firstnameT.setText(rs.getString("fname")); middlenameT.setText(rs.getString("mname")); aliasT.setText(rs.getString("alias")); sexT.setSelectedItem(rs.getString("sex")); ageT.setText(rs.getString("age")); civilstatusT.setSelectedItem(rs.getString("civilstatus")); addressT.setText(rs.getString("address")); religionT.setSelectedItem(rs.getString("religion")); monthT.setSelectedItem(rs.getString("m")); dayT.setSelectedItem(rs.getString("d")); yearT.setSelectedItem(rs.getString("y")); eaT.setSelectedItem(rs.getString("EA")); weightT.setText(rs.getString("weight"));; heightT.setText(rs.getString("height")); hairT.setSelectedItem(rs.getString("hair")); hairColorT.setSelectedItem(rs.getString("haircolor")); colorEyesT.setSelectedItem(rs.getString("colorofeyes")); complexionT.setSelectedItem(rs.getString("complexion")); gangT.setText(rs.getString("gang")); marksT.setText(rs.getString("marks")); preparedbyT.setText(rs.getString("preparedBy")); verifiedT.setText(rs.getString("verifiedBy")); //btnNewButton.putClientProperty(rs.getString("image"),rs.getString("image")); btnNewButton.setIcon(new ImageIcon(rs.getString("image"))); // save.setIcon(new ImageIcon(file.getPath())); } else { JOptionPane.showMessageDialog(null, "No more records"); } } catch (Exception e) { JOptionPane.showMessageDialog(null,"Sa catch bumagsak"); System.out.print(e); } } Error: Uncaught error fetching image: java.lang.NullPointerException at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at sun.awt.image.FileImageSource.getDecoder(Unknown Source) at sun.awt.image.InputStreamImageSource.doFetc…
upvote count: 1
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21344540
score: 1

http://stackoverflow.com/a/21342243
score: 3
accepted answer of: http://stackoverflow.com/q/21335998
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21335998
has comment: http://stackoverflow.com/comment/32194796
has body: There are two problems with your code, and both of them are in your useLayout method. The first problem is that you are not comparing Stringss correctly on this line: if(currentLayout.layoutType == name) { name is a String, and I assume currentLayout.layoutType is too. Two Strings that are equal but not the same will not compare equal under ==. As a result of this, your layoutVariants list will quite probably be empty at the end of the for loop. This line should read: if(currentLayout.layoutType.equals(name)) { See also this question. The second problem is that you don't correctly handle the case that the layoutVariants list is empty. The problem is on this line: if(layoutVariants != null) { layoutVariants will never be null, so the else branch of this if statement will never execute. Because layoutVariants.size() will be zero, rand will always be zero. Trying to get the element at index 0 in an empty ArrayList will give you precisely the IndexOutOfBoundsException you are seeing. I imagine you want the else block to execute if the layout name given isn't recognised, in other words, if the layoutVariants list is empty, rather than null. In that case, change this line to if(!layoutVariants.isEmpty()) { Note the ! (not-operator) before layoutVariants. You want the code under the if statement to run if the layoutVariants element is not empty. EDIT in response to your comments: a null ArrayList is very much not the same as an empty one. null is a special value meaning that the variable doesn't have an object of a given type. Let's try a real-world analogy: a shopping bag. If you have an empty bag, or no bag at all, then you have no shopping either way. However, you can put things into an empty bag, and count how many items it contains, for example. If you don't have a bag, then it doesn't make sense to put an item in it, as there's no bag to put the item into. null represents the case where you don't have a bag. Similarly, a String is a collection of characters, and the …
type: Answer
has comment: http://stackoverflow.com/comment/32192507
upvote count: 3
has comment: http://stackoverflow.com/comment/32182448

http://stackoverflow.com/comment/32084127
type: Comment
has text: I saw your edit. It seems to be a good implementation of my answer, except in your servlet: maybe you should consider having business methods in beans instead of in the servlet itself. Anyway, it seems you can't edit my answer. But actually, you don't have to. I gave you a global idea of how to do it. Maybe you should mark it as resolved if my answer helped you
type: AnswerComment
comment on: http://stackoverflow.com/a/21258945
score: 0

http://stackoverflow.com/q/21256115
score: 0
has answer: http://stackoverflow.com/a/21257228
accepted answer: http://stackoverflow.com/a/21257228
has comment: http://stackoverflow.com/comment/32022789
has comment: http://stackoverflow.com/comment/32025692
has comment: http://stackoverflow.com/comment/32024684
has comment: http://stackoverflow.com/comment/32025395
has comment: http://stackoverflow.com/comment/32025448
type: AnsweredQuestion
tagged with: linked-list
tagged with: java
tagged with: loops
type: Question
has comment: http://stackoverflow.com/comment/32025780
has comment: http://stackoverflow.com/comment/32023048
has body: I'm having a trouble doing a loop for Linked List. I wanted to try to input ID and Name from the user, but it seems that the last inputted details are being overwrite throughout the whole linking thing. But when I use the instantiation (myLinkedList.insertFirstLink("name", id)), and it does work. Here's my code.. import java.io.*; import java.util.*; class Example { public static int ID; public static int ans; public static String name; public Example next; public Example(int ID, String name) { this.ID = ID; this.name = name; } public void display() { System.out.println("ID: "+ID + " - " + name); } public String toString() { return name; } public static void main(String args[]) throws IOException { BufferedReader inpt = new BufferedReader(new InputStreamReader (System.in)); int x = 0; LinkList myLinkedList = new LinkList(); while(x&lt;=2) { System.out.print("Enter Name: "); name = inpt.readLine(); System.out.print("Input ID#: "); ID = Integer.parseInt(inpt.readLine()); System.out.println(); myLinkedList.insertFirstLink(name, ID); x++; } /* myLinkedList.insertFirstLink("Vishera", 2341); myLinkedList.insertFirstLink("Bulldozer", 1234); myLinkedList.insertFirstLink("Allendale", 3214); myLinkedList.insertFirstLink("Wolfdale", 4312); */ myLinkedList.displayLink(); } } class LinkList { public Example head; public Example tail; public LinkList() { head = null; tail = head; } public boolean isEmpty() { return(head == null); } public void insertFirstLink(String name, int ID) { Example newLink = new Example(ID, name); if(head==null) { head = newLink; tail = head; } else { tail.next = newLink; tail = newLink; } } public void displayLink() { Example theLink = head; while(theLink != null) { theLink.display(); System.out.println("The Next Link: " + theLink.next); theLink = theLink.next; System.out.println(); } } } Thanks!
answer count: 1
has comment: http://stackoverflow.com/comment/32022984
has title: Linked List (Loop)

http://stackoverflow.com/q/21225775
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21225808
downvote count: 0
has comment: http://stackoverflow.com/comment/31969989
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31969981
type: Question
tagged with: arrays
has title: How do I sort custom objects alphabetically in an array in Java?
tagged with: sorting
answer count: 2
has comment: http://stackoverflow.com/comment/31970037
has comment: http://stackoverflow.com/comment/31970030
upvote count: 1
has comment: http://stackoverflow.com/comment/31970016
favorite count: 0
accepted answer: http://stackoverflow.com/a/21225808
has comment: http://stackoverflow.com/comment/31970473
possible better answer: http://stackoverflow.com/a/21226356
has answer: http://stackoverflow.com/a/21226356
has body: How would I sort my inventory array alphabetically? This is for a project that I am working on. I tried to use Arrays.sort(inventory); but it did not work. Could someone please tell me what I am doing wrong? Book class: //Filename: BookStore.java //Description: Purpose is to display what books are in stock and ISBN, title, author name, year, publishers name, and price. //Author Name: David Finocchi //Date: 01/19/2014 import java.util.Arrays; import java.text.DecimalFormat; class Book { protected long isbn; protected String title; protected String autName; protected int year; protected String pubName; protected double price; protected int quantity; // Constructor public Book(long isbn, String title, String autName, int year, String pubName, double price) { setIsbn(isbn); setTitle(title); setAut(autName); setYear(year); setPub(pubName); setPrice(price); } // methods for class variables public long getIsbn() { return isbn; } public void setIsbn(long isbn) { this.isbn = isbn; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getAut() { return autName; } public void setAut(String autName) { this.autName = autName; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public String getPub() { return pubName; } public void setPub(String pubName) { this.pubName = pubName; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getQuantity() { return quantity; } public void setQuantity(int quantity) { this.quantity = quantity; } public double calTotal() { return price; } //toString for the book array public String toString() { return "ISBM: " + isbn + "\n" + "Title: " + title + "\n" + "Author's Name: " + autName + "\n" + "Year Published: " + year + "\n" + "Publisher's Name: " + pubName + "\n" + "Price: $" + price + "\n\n"; } }// end class Book EBook class: class EBook extends Book { private String website; //cons…
has comment: http://stackoverflow.com/comment/31970014
has comment: http://stackoverflow.com/comment/31970343

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/21296241

http://stackoverflow.com/comment/32228513
comment on: http://stackoverflow.com/q/21321897
has text: check your server.xml to see whether this service is started
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21188673
type: Question
downvote count: 0
favorite count: 0
tagged with: bluetooth
tagged with: windows
answer count: 0
type: UnansweredQuestion
has body: I have 3rd party application on one computer (Comp A) that communicates with a 3rd party device via a bluetooth dongle. I would like to connect the 3rd party device to a different computer (comp B) by a real dongle attached to comp B, and reroute or clone the traffic or stream from the application on comp A, via TCP/IP, to bluetooth dongle in computer B. Then re-transmit the stream using a this dongle. In other words, I'm interested in establishing a virtual link between comp A and the bluetooth dongle in Comp B, such that any application on comp A will be invisible to the change. Note that I'm not interested in decoding the packet contents, but rather have a 1-1 copy or transfer the packets. What would be the best option to do so? I thought of two options: 1) create a virtual bluetooth dongle, configure the 3rd party to use this dongle, and then transmit the bit-stream that is sent by this dongle to the different computer. 2) Somehow clone or sniff the packets that are sent to the virtual driver and resend them by means of TCP/IP protocol to another computer. First, What would you recommended me to do? What building blocks are available (e.g, the virtual bluetooth windows driver)? I would be very helpful if you can send me some links/tips that will help in performing this task. Second, what programming language best suits for the task? I thought the Java would fit best since I later contemplate with replacing comp B by an android device. Finally, how long do you think it would take me, a beginner-intermediate programmer, to create this application? Thanks ahead!
upvote count: 1
score: 1
tagged with: java
has title: Rerouting Bluetooth traffic

http://stackoverflow.com/q/21189029
upvote count: 1
answer count: 1
favorite count: 0
has body: My code is not working properly. It is bubble sorting in Java. I know I can get any code from google but I think it is not good to me and google would not tell my why my code is not working. Here is the code: int temp=0; int x=10; int [] array = new int [x]; for(int i=0;i&lt;array.length-1;i++){ array[i]=i; //System.out.println(array[i]); if(array[i]&gt;array[i+1]){ temp=array[i+1]; array[i+1]=array[i]; array[i]=temp; } System.out.println(array[i]); } } }
has comment: http://stackoverflow.com/comment/31903777
has comment: http://stackoverflow.com/comment/31904446
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31903939
accepted answer: http://stackoverflow.com/a/21189094
has title: Bubble sorting in Java is not working properly. It shows only 0
score: -2
tagged with: sorting
has answer: http://stackoverflow.com/a/21189094
downvote count: 3

http://stackoverflow.com/q/21242528
favorite count: 0
has title: I want to inflate an xml file into MainActivity
has comment: http://stackoverflow.com/comment/31999927
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
downvote count: 2
has body: I have an xml file named " Editt.xml ",I want to inflate @+id/myEditText into MainActivity every time I click an Button from the activty_main named " @+id/Button01 " " Editt.xml " is this : <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/myEditText" android:layout_weight="1" /> and " activity_main " <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent">
type: Question
score: -2
tagged with: java
upvote count: 0
has answer: http://stackoverflow.com/a/21242676
answer count: 1

http://stackoverflow.com/comment/31957755
type: QuestionComment
has text: Make sure `text.txt` is where you think it is; also worth noting is that it should be `System.in` and that capitalization matters.
comment on: http://stackoverflow.com/q/21219085
score: 0
type: Comment

http://stackoverflow.com/comment/32123195
has text: Hi i'm using the latest 26.0
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21312773

http://stackoverflow.com/comment/32084417
type: AnswerComment
comment on: http://stackoverflow.com/a/21290258
type: Comment
has text: That question doesn't make sense. "Table buckets are added" is a synonym for "the hashmap growing." There's no way for a user of the hash map to "add table buckets"; table buckets are added when there are more entries.
score: 3

http://stackoverflow.com/a/21230561
type: Answer
answers question: http://stackoverflow.com/q/21230084
has body: Try PDFjs, it uses HTML5 to draw the pdf http://mozilla.github.io/pdf.js/
score: 0

http://stackoverflow.com/q/21342319
has comment: http://stackoverflow.com/comment/32177477
has body: I want to make a program like the example below. input : 2 output : (1) , (2); (1,2), (2,2); input : 3 output : (1),(2),(3); (1,2),(1,3),(2,3); (1,2,3) The formula is 2^n-1. I have tried only using for only. I want to get the all possibility. like : (1),(2); (1,1),(1,2),(2,1),(2,1),
upvote count: 0
has comment: http://stackoverflow.com/comment/32177046
has title: how to code to find probability in java or php
answer count: 1
has comment: http://stackoverflow.com/comment/32177349
favorite count: 0
has answer: http://stackoverflow.com/a/21342512
tagged with: php
score: -1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32176552
accepted answer: http://stackoverflow.com/a/21342512
tagged with: java
tagged with: probability
downvote count: 1
type: Question

http://stackoverflow.com/a/21275249
type: AcceptedAnswer
type: Answer
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/21275228
accepted answer of: http://stackoverflow.com/q/21275228
score: 5
has body: It's because the way how java compares strings by default in java (lexicographic order). You can define your own comparator for File objects and sort.

paintcomponent
tags question: http://stackoverflow.com/q/21232313
tags question: http://stackoverflow.com/q/21334342
tags question: http://stackoverflow.com/q/21280516
tags question: http://stackoverflow.com/q/21298872
tags question: http://stackoverflow.com/q/21290591
tag name: paintcomponent
tags question: http://stackoverflow.com/q/21268190
tags question: http://stackoverflow.com/q/21246822
tags question: http://stackoverflow.com/q/21336141
tags question: http://stackoverflow.com/q/21258058
tags question: http://stackoverflow.com/q/21214640
tags question: http://stackoverflow.com/q/21222937
tags question: http://stackoverflow.com/q/21238719
tags question: http://stackoverflow.com/q/21286659
tags question: http://stackoverflow.com/q/21322353
type: Tag

http://stackoverflow.com/comment/32055509
type: QuestionComment
comment on: http://stackoverflow.com/q/21274034
has text: where is line number 30 MoveFiles.java ?
score: 0
type: Comment

http://stackoverflow.com/comment/32046218
type: Comment
has text: @Hammy Stupid mistake by me - you have to remove the parentheses around the division to actually make that a double division.
comment on: http://stackoverflow.com/a/21268653
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31932225
type: Comment
type: QuestionComment
score: 0
has text: if my answer is helpful you can select my answer
comment on: http://stackoverflow.com/q/21203693

http://stackoverflow.com/comment/31985450
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21234636
type: Comment
has text: setOpaque(true) shows the magenta, but I still have the white background to the triangle on top of the magenta. I'd be happy to use a PNG without a background, but I don't know how to create one -- got any tools you use for that?

http://stackoverflow.com/a/21255748
has body: You can do either this way: In the dependency you can add the other projects to your project. Right click on project -> properties -> java build path -> projects. Add your project here. OR Make the classes of project into jar and add it to other project Dependencies should be added in classpath In run time, make sure the JAR files of the referenced projects is added in class path on both the cases.
answers question: http://stackoverflow.com/q/21255265
type: AcceptedAnswer
score: 30
has comment: http://stackoverflow.com/comment/98739084
type: Answer
upvote count: 31
has comment: http://stackoverflow.com/comment/60806474
accepted answer of: http://stackoverflow.com/q/21255265
downvote count: 1
has comment: http://stackoverflow.com/comment/42715884

http://stackoverflow.com/q/21246036
has comment: http://stackoverflow.com/comment/32006418
has comment: http://stackoverflow.com/comment/32007666
score: 1
tagged with: embedded-resource
tagged with: swing
has body: I already checked this duplicate question and other similar ones and it didn't help. I am trying to add an png to a button when it is clicked. The program is a variable sized tic-tac-toe game for school. Right now I have: private ImageIcon X_MARK = new ImageIcon("x.png"); private ImageIcon O_MARK = new ImageIcon("o.gif"); private JButton[][] cells; ... cells = new JButton[size][size]; JPanel board = new JPanel(new GridLayout(size, size)); board.setBorder(new LineBorder(Color.BLACK, 1)); ButtonListener listener = new ButtonListener(); for (int i = 0; i &lt; size; i++) for (int j = 0; j &lt; size; j++) { cells[i][j] = new JButton(); cells[i][j].addActionListener(listener); board.add(cells[i][j]); } JFrame ttt = new JFrame(); ttt.add(board); ttt.setTitle("Show GUI Components"); ttt.setSize(60*size, 60*size); ttt.setLocation(0, 0); ttt.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ttt.setVisible(true); ... class ButtonListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { int i, j; for (i = 0; i &lt; size; i++) for (j = 0; j &lt; size; j++) if (e.getSource() == cells[i][j]) { if ((i + j) % 2 == 0) { cells[i][j].setBackground(Color.GREEN); cells[i][j].setIcon(X_MARK); } else { cells[i][j].setBackground(Color.CYAN); cells[i][j].setIcon(O_MARK); } } } } That is all the relevant code I think. I am using Eclipse and I have x.png and o.png in the src folder and the bin folder of the the project. I have also tried a couple of variants I have seen on SO and google searches like, new ImageIcon("C:/Users/BigBoy/workspace_1/EventDriven/src/x.png");, new ImageIcon("src/x.png");, and some other ones involving getClass().getResource among other things. I don't know what else to try. I know I've done this in the past and didn't have this much trouble. I added .setBackground(Color.GREEN); just to make sure my clicks were registering properly and they are, the problem to me seems to be with the declaring/initializing of the ImageIcon. NOTE: Right n…
has comment: http://stackoverflow.com/comment/32007894
tagged with: jbutton
type: Question
linked to: http://stackoverflow.com/q/17535901
tagged with: java
accepted answer: http://stackoverflow.com/a/21246179
tagged with: jpanel
has comment: http://stackoverflow.com/comment/32006360
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/21246179
has comment: http://stackoverflow.com/comment/32006481
favorite count: 0
has comment: http://stackoverflow.com/comment/32006346
has comment: http://stackoverflow.com/comment/32006451
has comment: http://stackoverflow.com/comment/32006316
type: AnsweredQuestion
has title: JButton will not change update image when using .setIcon(ICON);
has comment: http://stackoverflow.com/comment/32006464
downvote count: 0

http://stackoverflow.com/comment/32030498
has text: There are no unwanted side effects in the scenario I described. Surely, the puts() will not be acknowledged in any logical fashion, but they do not need to be :)
score: 0
comment on: http://stackoverflow.com/a/21257171
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31937558
type: QuestionComment
comment on: http://stackoverflow.com/q/21200363
score: 0
type: Comment
has text: @MElliott as mentioned its not just for a phone number. Its for many use cases.

http://stackoverflow.com/a/21330525
score: 1
upvote count: 1
has body: Instead of these two lines listVarValue.remove(index); listVarValue.add(index, oldVal+" APPENDED TEXT"); You can use listVarValue.set(index,oldVal+" APPENDED TEXT")
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21330439

http://stackoverflow.com/q/21345777
tagged with: char
answer count: 2
has answer: http://stackoverflow.com/a/21371485
possible better answer: http://stackoverflow.com/a/21346188
accepted answer: http://stackoverflow.com/a/21371485
tagged with: string
favorite count: 0
has title: Put each character of an word inputted by the user into separate char variables in java
tagged with: textinput
has comment: http://stackoverflow.com/comment/32182691
has body: I'm a freshman in software engineering and I have a question that I really can't figure out( trust me I've been searching for a while now): I have to get a 4 letter word input from the user in a single input and then put each character of the word into different char variables in java. The thing is that the only variable types I can use are boolean, int, double and char because we havn't seen arrays and strings yet so we are not allowed to use them. ( e.g. I can't declare "String variable" and then use that "variable" in any way only the types I mentionned previously are accepted. I thought about using bitwise operators but we havn't seen them in the course so I would rather use a solution that don't involve them. But if you have a solution involving them it maybe useful too so anything would help! We can't use if, while, for or any loop concepts either( havn't seen it yet in the course). Thank you very much for your input guys!!. NOTE: It's my first question on the site so if there is something that is not specific enough or anything tell me I will take all constructive comments!
score: 2
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/3043306
tagged with: java
has answer: http://stackoverflow.com/a/21346188
type: Question
has comment: http://stackoverflow.com/comment/32228099
upvote count: 2

http://stackoverflow.com/comment/32184997
type: AnswerComment
has text: Or, you know, just call `List.toArray()`
type: Comment
comment on: http://stackoverflow.com/a/21346843
score: 0

http://stackoverflow.com/a/46057848
has body: If your springboot is building your project and running it in local server correctly then YES. What you need to do is to build the project using mvn -U clean package. Then in target folder you have your runnable xxxx.jar . Now what you have to do is put your xxxx.jar file in the server or where you want along with the src/main/webapp/WEB-INF/jsp/ *.jsp files in same hierarchy. then try java -jar xxxx.jar Your project will run with no issue. ` . ├── src │ └── main │ └── webapp │ └── WEB-INF │ ├── jsp │ │ ├── default.jsp │ │ ├── help.jsp │ │ ├── index.jsp │ │ ├── insert.jsp │ │ ├── login.jsp │ │ ├── modify.jsp │ │ ├── search.jsp │ │ └── show.jsp │ └── web.xml ├── xxx.jar └── xxx.jar.original` java -jar xxx.jar $java -jar xxx.jar . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.5.4.RELEASE) 2017-09-05 19:31:05.009 INFO 10325 --- [ main] com.myapp.app.DemoApplication : Starting DemoApplication v0.0.1-SNAPSHOT on dipu-HP with PID 10325 (/home/dipu/Documents/workspace-sts/jspjartest/xxx.jar started by dipu in /home/dipu/Documents/workspace-sts/jspjartest) 2017-09-05 19:31:05.014 INFO 10325 --- [ main] com.myapp.app.DemoApplication : No active profile set, falling back to default profiles: default 2017-09-05 19:31:05.138 INFO 10325 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e5e91e4: startup date [Tue Sep 05 19:31:05 IST 2017]; root of context hierarchy 2017-09-05 19:31:07.258 INFO 10325 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8090 (http) 2017-09-05 19:31:07.276 INFO 10325 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2017-09-05 19:31:07.278 INFO 10325 --- [ main] org.apache.catalina.core.StandardEn…
answers question: http://stackoverflow.com/q/21243690
upvote count: 8
type: Answer
downvote count: 1
score: 7
has comment: http://stackoverflow.com/comment/104195834
has comment: http://stackoverflow.com/comment/79094787

http://stackoverflow.com/comment/32055550
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21274091
has text: Try looking at this question/answer: http://stackoverflow.com/questions/5710394/round-double-to-two-decimal-places-in-java

http://stackoverflow.com/comment/31991348
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21237636
type: QuestionComment
has text: @duffymo Swing is kind of 2005 vintage stuff ;-)

http://stackoverflow.com/comment/32169769
comment on: http://stackoverflow.com/a/21334801
type: AnswerComment
score: 0
type: Comment
has text: I ended up just using chrome and safari

http://stackoverflow.com/comment/32043490
comment on: http://stackoverflow.com/a/21212662
type: AnswerComment
score: 0
has text: Thanks and my bad, but I finally got it Working you pointed me in the right direction.
type: Comment

http://stackoverflow.com/comment/32079707
has text: Only one instance (standalone mode)
type: AnswerComment
comment on: http://stackoverflow.com/a/21264464
type: Comment
score: 0

http://stackoverflow.com/comment/32128096
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21311162
has text: I'm under NDA so unfortunately I can't. But this has been an issue with all of the tests I have run on Android Studio in the past.

http://stackoverflow.com/comment/32122027
score: 0
type: AnswerComment
has text: @Jon The question is about implementing an app on a website page. If (the same way you would with HTML5, CSS3 and JS) you were to rewrite a version of the application in Flash it's an option (although not one I would recommend)
type: Comment
comment on: http://stackoverflow.com/a/21312256

http://stackoverflow.com/comment/32008097
score: 0
comment on: http://stackoverflow.com/a/21247015
has text: I added a -1 to the length of the array. It works like a charm now. Thanks a bunch! should be going to bed now.. :D will accept answer when the 5minute limit is over.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21191840
has title: How to detect a touch event outside the activity border
tagged with: android-activity
tagged with: view
has comment: http://stackoverflow.com/comment/31922704
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31924592
has body: I have activity A over activity B. Activity A does not fill the entire screen.(Its not dialog activity though)I want to close activity A when the touch event is detected outside the activity A border. how to detect a touch event outside the activity border? @Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_OUTSIDE) { Toast.makeText(getApplicationContext(), "Hi", 3000).show(); return true; } return false; } This code doesn't work as it works only for dialog activities. Please help..Thanks in advance :)
score: 3
tagged with: android-layout
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21192359
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/31909938

http://stackoverflow.com/comment/32116062
has text: Are you saving this file yourself? If so, you can just save the file using serialization and then deserialize the file back into a structure you can search, such as a HashTable (assuming you are storing them as a HashTable to begin with). You can do the same with XStream if you want a human-readable file. If this is an option, I will write up an answer for you.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21308894

http://stackoverflow.com/comment/32056654
comment on: http://stackoverflow.com/q/21254719
score: 0
type: Comment
type: QuestionComment
has text: @amitsingh ya i am still strucking in problem

http://stackoverflow.com/comment/32061310
has text: i am looking for better (super fast ) algorithm . Any suggestions will help me ??
type: QuestionComment
comment on: http://stackoverflow.com/q/21277653
score: 0
type: Comment

http://stackoverflow.com/comment/32084775
type: QuestionComment
comment on: http://stackoverflow.com/q/21291081
has text: You may want to look at this: http://stackoverflow.com/questions/2165006/simple-java-client-server-program
score: 0
type: Comment

http://stackoverflow.com/comment/32785925
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21337593
has text: You are doing something incorrect with your r_dsc variable. Based on your two addresses( ptr address = 0x2a14af70 and heap invalid = 0x2a152f70 ), that's exactly 32,768 bytes, which is the size of your r_dsc memory. There must be additional code you aren't showing where you access r_dsc

http://stackoverflow.com/a/21281952
upvote count: 1
has body: Classes don't inherit the annotation from interfaces, so you should be really careful using annotations on interfaces. Here is an example of what can happen if you are not careful: http://kim.saabye-pedersen.org/2013/05/spring-annotation-on-interface-or-class.html
score: 1
has comment: http://stackoverflow.com/comment/32068349
answers question: http://stackoverflow.com/q/21281736
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21281736

http://stackoverflow.com/comment/31924106
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21199832
has text: Java does not assign any default values to **local** variables.
score: 0

http://stackoverflow.com/a/21192171
has comment: http://stackoverflow.com/comment/31916645
has comment: http://stackoverflow.com/comment/31910110
score: 3
has comment: http://stackoverflow.com/comment/31922442
has comment: http://stackoverflow.com/comment/31910895
has body: You can organize it yourself. In getFirstName() you have some sequence of operations/actions being done. Either 1) The getFirstName() has to somehow poll its own status (because you said you don't want another process/thread to monitor it). But this sounds weird and more difficult to do. Also, it has this problem that if getFirstName() calls some long-running operation, then the polling will not work (as getFirstName() is busy with something else currently). or 2) Another process/thread can check the status of the getFirstName() processes. If the status is not DONE and some decent amount of time has elapsed, it will send out an email. The responsibility of the getFirstName() is to just set its status to DONE, once it is done and to STARTED once it has started. Also, each getFirstName() call probably needs to have some unique ID. That's basically it.
answers question: http://stackoverflow.com/q/21191941
downvote count: 0
has comment: http://stackoverflow.com/comment/31909850
has comment: http://stackoverflow.com/comment/31910440
has comment: http://stackoverflow.com/comment/31909983
has comment: http://stackoverflow.com/comment/31910684
type: Answer
upvote count: 3

http://stackoverflow.com/comment/31990528
comment on: http://stackoverflow.com/q/21230724
has text: You need to check for Exceptions after every JNI call in your native code. See http://developer.android.com/training/articles/perf-jni.html#exceptions
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21271793
has comment: http://stackoverflow.com/comment/32058850
has comment: http://stackoverflow.com/comment/32052048
tagged with: bitmap
type: Question
tagged with: java
score: 0
tagged with: arraylist
type: UnansweredQuestion
tagged with: android
has body: I have this problem. I have a list that displays some parsed images. When i click over a list item i get the error in the logcat !!! FAILED BINDER TRANSACTION !!!. I saw that could be a size problem of bitmap and i found this code: Bitmap resizedBitmap = Bitmap.createScaledBitmap(myBitmap, 960, 960, false); so in my case: @Override protected Void doInBackground(Void... params) { try { // Connect to the web site Document document = Jsoup.connect(BLOG_URL).get(); // Using Elements to get the class data //Elements img = document.select("div.news-col-0 img[src]"); // Locate the src attribute for(Element img : document.select("div.news-col-0 img[src]")) { String ImgSrc = img.attr("src"); // Download image from URL InputStream is = new java.net.URL(ImgSrc).openStream(); Bitmap resizedbitmap2 = Bitmap.createScaledBitmap(bitmap, 120, 120, true); //add Bitmap to an array bitmap.add(BitmapFactory.decodeStream(is)); } } catch (IOException e) { e.printStackTrace(); } return null; } of course doesn't work because my bitmap is an ArrayList&lt;Bitmap&gt; so i get the error in createScaledBitmap. Three simply questions; 1) Is this the problem? 2) Is the right place to put that code? 3) How can i solve having ArrayList&lt;Bitmap&gt;? thanks
has comment: http://stackoverflow.com/comment/32053751
has title: !!! FAILED BINDER TRANSACTION !!!bitmap list
answer count: 0

http://stackoverflow.com/a/62483348
has body: I ran into this problem and solved it by turning off the reader thread in TelnetClient: telnet = new TelnetClient(); telnet.setReaderThread(false); // This prevents the timeout bug telnet.connect("localhost", 2020); telnet.setSoTimeout(10000);
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21311276
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21311276
upvote count: 2

http://stackoverflow.com/comment/32083666
type: QuestionComment
has text: If you can include your sample files, we can try to reproduce the problem. (There's no need to include a UI for the sample program - just hard-code the filenames.)
comment on: http://stackoverflow.com/q/21288971
score: 0
type: Comment

http://stackoverflow.com/q/21274686
has title: How to train data correctly using libsvm?
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21281112
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/28745991
tagged with: svm
answer count: 3
upvote count: 0
has body: I want to use SVM (Support vector machine) in my program, but I could not get the true result. I want to know that how we must train data for SVM. What I am doing: Think that we have 5 document (the numbers are just an example), 3 of them is on first category and others (2 of them) are on second category, I merge the categories to each other (it means that the 3 doc that are in the first category will merge in one document), after that I made a train array like this: double[][] train = new double[cat1.getDocument().getAttributes().size() + cat2.getDocument().getAttributes().size()][]; and I will fill the array like this: int i = 0; Iterator&lt;String&gt; iteraitor = cat1.getDocument().getAttributes().keySet().iterator(); Iterator&lt;String&gt; iteraitor2 = cat2.getDocument().getAttributes().keySet().iterator(); while (i &lt; train.length) { if (i &lt; cat2.getDocument().getAttributes().size()) { while (iteraitor2.hasNext()) { String key = (String) iteraitor2.next(); Long value = cat2.getDocument().getAttributes().get(key); double[] vals = { 0, value }; train[i] = vals; i++; System.out.println(vals[0] + "," + vals[1]); } } else { while (iteraitor.hasNext()) { String key = (String) iteraitor.next(); Long value = cat1.getDocument().getAttributes().get(key); double[] vals = { 1, value }; train[i] = vals; i++; System.out.println(vals[0] + "," + vals[1]); } i++; } so I will continue like this to get the model : svm_problem prob = new svm_problem(); int dataCount = train.length; prob.y = new double[dataCount]; prob.l = dataCount; prob.x = new svm_node[dataCount][]; for (int k = 0; k &lt; dataCount; k++) { double[] features = train[k]; prob.x[k] = new svm_node[features.length - 1]; for (int j = 1; j &lt; features.length; j++) { svm_node node = new svm_node(); node.index = j; node.value = features[j]; prob.x[k][j - 1] = node; } prob.y[k] = features[0]; } svm_parameter param = new svm_parameter(); param.probability = 1; param.gamma = 0.5; param.nu = 0.5; param.C = 1; param.sv…
favorite count: 0
possible better answer: http://stackoverflow.com/a/21293974
accepted answer: http://stackoverflow.com/a/21281112
tagged with: libsvm
has answer: http://stackoverflow.com/a/21293974
downvote count: 1

http://stackoverflow.com/q/21221105
score: 0
has comment: http://stackoverflow.com/comment/31961912
tagged with: java
accepted answer: http://stackoverflow.com/a/21222038
has title: Why do I get a stack overflow error?
has comment: http://stackoverflow.com/comment/31961884
downvote count: 1
has comment: http://stackoverflow.com/comment/31961939
has comment: http://stackoverflow.com/comment/31962080
has comment: http://stackoverflow.com/comment/31961896
has comment: http://stackoverflow.com/comment/31961858
tagged with: stack-overflow
has comment: http://stackoverflow.com/comment/31961968
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21222038
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/31961989
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/31961907
has body: Here is the code .. I have to sort an already sorted array and to calculate it's execution time ...for quicksort it is n^2 cause it is the worst case. but for large input data let's say 7500 it gives me an overflow error :S what can i do in order to calculate the running time? public class Provo { public static void swap(int[] a, int i, int j) { int temp = a[i]; a[i] = a[j]; a[j] = temp; } public static int HoarePartition(int m, int d, int[] a) { int pivot = a[m]; int i = m + 1; int j = d; while (i &lt; j) { while (a[i] &lt; pivot) { i = i + 1; } while (a[j] &gt; pivot) { j = j - 1; } if (i &lt; j) swap(a, i, j); } swap(a, m, j); return j; } public static void quicksort(int m, int d, int[] a) { if (m &lt; d) { int s = HoarePartition(m, d, a); quicksort(m, s - 1, a); quicksort(s + 1, d, a); } } } and here is the main class import javax.swing.*; public class ascending { public static void main(String[] args){ String input=JOptionPane.showInputDialog("Shkruani nr e te dhenave"); int size=new Integer(input).intValue(); int[] r= new int[size]; int[] p = new int[size]; int majtas=0; int djathtas=size; for(int i=majtas;i&lt;djathtas;i++) {r[i]=i;} for(int i=majtas;i&lt;djathtas;i++) {p[i]=r[i];} long average; int n=100; long result=0; for(int j=1;j&lt;=n;j++) { long startTime = System.nanoTime(); Provo.quicksort(majtas,djathtas-1,p); long endTime = System.nanoTime(); result = result+(endTime-startTime); long a = endTime-startTime; System.out.println(j+": " +a); for(int i=majtas;i&lt;djathtas;i++) {p[i]=r[i];} } average=result/n; System.out.println("Koha e ekzekutimit te insertion sort eshte " + average + " nanosekonda "); } }
possible better answer: http://stackoverflow.com/a/21221441
has comment: http://stackoverflow.com/comment/31961928
has answer: http://stackoverflow.com/a/21221441

http://stackoverflow.com/q/21255964
has answer: http://stackoverflow.com/a/21256162
upvote count: 6
has comment: http://stackoverflow.com/comment/32022675
has body: As we know we can't create obj of any class until and unless the definition of the class is complete. So how are we able to create obj in main method of its own class? class Test { public static void main(String args[]) { Test test=new Test(); //yet class definition of Test class is not completed still it is permitted! why? } }
has title: Why is it possible to create object in main method of its own class?
has answer: http://stackoverflow.com/a/21256180
has comment: http://stackoverflow.com/comment/32022614
has comment: http://stackoverflow.com/comment/32022567
favorite count: 0
has answer: http://stackoverflow.com/a/21256142
downvote count: 5
type: UnansweredQuestion
answer count: 4
has comment: http://stackoverflow.com/comment/32022700
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32022578
has answer: http://stackoverflow.com/a/21256144

http://stackoverflow.com/q/21261566
type: Question
has title: Marshal model in different ways using JAXB
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21263416
tagged with: http://stackoverflow.com/tag/xml
score: 2
has comment: http://stackoverflow.com/comment/32032970
upvote count: 2
tagged with: java
tagged with: hibernate
has body: Sure, this question was asked before anywhere but didn't find a appropriate solution for it: Is there a possibility to marshal a model with JAXB to different XMLs or in different ways. I still serialize this model to JSON with Jackson where I can use @JsonView or JsonMixins to serialize it to different json layouts. Having this model: public class Customer { public int getId() { return id; } public void setId(int id) { this.id = id; } private int id; public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } private String lastName; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } private String firstName; } should be marshalled as: <customer> name <customer> or <customer> name name firstname <customer> I found this and this posting on stackoverflow but the suggestion is to use EclipseLink JAXB. But unfortunately Hibernate as a persistence provider is still in use. EclipseLink and Hibernate (both are O/R mapper) won't really work together - isn't it? Is there any possibilty to marshal a model to different xml using JAXB?
tagged with: jaxb

http://stackoverflow.com/comment/32146595
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21308558
has text: could you please post your ehcache.xml file

http://stackoverflow.com/comment/31921184
type: AnswerComment
has text: What do you mean by "replace the random with values.."? and what's a?
type: Comment
comment on: http://stackoverflow.com/a/21198162
score: 1

http://stackoverflow.com/comment/32236620
type: AnswerComment
score: 0
type: Comment
has text: Found! Your comment reminded me to have a look at the SwingX version I'm using. I'm using the 0.9 which has this _flash_ bug, it disappears in the 1.6. I think I should have done that check first. Then it works like I want using the 1.6 version and your `focusGained` hack. Thank you and sorry for missing that first step.
comment on: http://stackoverflow.com/a/21331396

http://stackoverflow.com/q/21216476
has answer: http://stackoverflow.com/a/58030461
favorite count: 0
tagged with: sockets
tagged with: port
type: AnsweredQuestion
tagged with: datainputstream
tagged with: java
possible better answer: http://stackoverflow.com/a/21216556
type: Question
linked to: http://stackoverflow.com/q/11982693
tagged with: network-programming
upvote count: 5
has title: Check if DataInputStream has content
has answer: http://stackoverflow.com/a/21216544
accepted answer: http://stackoverflow.com/a/21216544
score: 5
answer count: 3
downvote count: 0
has body: Is there a way to ask a DataInputStream, if it has content to read? .readByte() will just hang it, waiting for a byte to be read :( Or do I always have to send a Dummy-Byte, to make sure it always sees something?
has answer: http://stackoverflow.com/a/21216556

http://stackoverflow.com/comment/32081077
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21288546
score: 1
has text: @HotLicks Unfortunately, as in a few other questions today, people dealing with bytes, byte arrays and the like often seem to have not the slightest idea about very basic concepts, such as binary data representation. Amazing.

akka
type: Tag
tags question: http://stackoverflow.com/q/21313519
tags question: http://stackoverflow.com/q/21316431
tags question: http://stackoverflow.com/q/21184626
tag name: akka

http://stackoverflow.com/comment/31928812
score: 0
has text: yes. writeObject, which you used, is to store objects in a file if you want to load them into your program later, but this write everything in a compact way and not in a human-readable form.
type: Comment
comment on: http://stackoverflow.com/a/21201932
type: AnswerComment

http://stackoverflow.com/q/21304937
has comment: http://stackoverflow.com/comment/32582496
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24660072
tagged with: javascript
has answer: http://stackoverflow.com/a/21469450
score: 0
type: UnansweredQuestion
has body: I have this following code String contentTP = (String)e.nextElement(); logger.info("contentTP : " + contentTP); if (contentTP != null &amp;&amp; contentTP.startsWith("multipart/form-data")) { multi = new MultipartRequest(request, 1000 * 1024 * 1024); // 1GB parameters = multi.getParameters(); } String action = (String)parameters.get("formname"); String BaseURL = (String)parameters.get("BaseURL"); logger.info("BaseURL in MailSend servlet: " + BaseURL); String firstName = (String)parameters.get("firstName"); String lastName = (String)parameters.get("lastName"); String tid = (String)parameters.get("TID"); String from = (String)parameters.get("emailID"); String subject = (String)parameters.get("categoryvalue"); logger.info("parameter" + parameters); logger.info("firstName : " + (String)parameters.get("firstname")); logger.info("email : " + (String)parameters.get("emailID")); logger.info("Subject : " + (String)parameters.get("categoryvalue")); The flow is that there is a request form which is filled by the user and then data is entered in Database and mails are sent with the same data. I am getting a strange issue in it which is some of the values like subject in the parameter object is missing at times. Below are the log entries for success scenario and failure scenario for the entries of parameter hashtable. Success Scenario 2014-01-21 02:11:26,335 INFO servlets.MailSend parameter{m_technicaldetails=testing..., tsaa12=, tsaa11=, tsaa10=, actiondate5=, ntid=T-ID/S-ID:, actiondate4=, actiondate3=, actiondate2=, actiondate1=, tsvalue=, rsemail=E-mail:, message=testing ....., akamaiq3value=, da2=, da1=, vq3value=, emailID=SR1215@chrysler.com, notedate5=, status=, pnumber2=4324234, notedate4=, ftpdetailstext=FTP Details for the Assets, pnumber1=342, notedate3=, da3value=, notedate2=, vq5date=, notedate1=, vq7value=, TID=t3014sr, techq3value=, user1=User1:, formname=requestform, categoryvalue=Mobile, m_mobile=Support, itemtonotefull=Request Details - Additional Items to note…
tagged with: java
has title: jValue missing in parameter variable intermittently
linked to: http://stackoverflow.com/q/2422468

http://stackoverflow.com/comment/32070415
type: Comment
type: QuestionComment
has text: @MisterSmith I completely disagree. `BadPaddingException`s have *nothing* to do with whether streams are used or not. Streams are just a different way of feeding data into a `Cipher` object. Sure, this might be a better approach than throwing a gigabyte of data into the `doFinal()` method, but it has nothing to do with those exceptions.
score: 0
comment on: http://stackoverflow.com/q/21252078

http://stackoverflow.com/a/21358275
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21347272
answers question: http://stackoverflow.com/q/21347272
score: 5
type: AcceptedAnswer
has body: tl;dr Use modern java.time classes, specifically ZonedDateTime and ZoneId. See Oracle Tutorial. ZonedDateTime // Represent a date and time-of-day in a specific time zone. .now( // Capture the current moment as seen in the wall-clock time used by the people of a particular region (a time zone). ZoneId.of( "Pacific/Auckland" ) // Specify time zone using proper name in `Continent/Region` format. Never use 3-4 letter pseudo-zone such as IST or PST or EST. ) // Returns a `ZonedDateTime` object. .withZoneSameInstant( // Adjust from one time zone to another. Same point on the timeline, same moment, but different wall-clock time. ZoneId.of( "Africa/Tunis" ) ) // Returns a new fresh `ZonedDateTime` object rather than altering/“mutating” the original, per immutable objects pattern. .toString() // Generate text in standard ISO 8601 format, extended to append name of zone in square brackets. 2018-09-18T21:47:32.035960+01:00[Africa/Tunis] For UTC, call ZonedDateTime::toInstant. Avoid 3-Letter Time Zone Codes Avoid those three-letter time zone codes. They are neither standardized nor unique. For example, your use of "IST" may mean India Standard Time, Irish Standard Time, and maybe others. Use proper time zone names. The definition of time zones and their names change frequently, so keep your source up-to-date. For example the old "Asia/Calcutta" is now "Asia/Kolkata". And not just names; governments are notorious for changing the rules/behavior of a time zone, occasionally at the last minute. Avoid j.u.Date Avoid using the bundled java.util.Date and Calendar classes. They are notoriously troublesome and will be supplanted in Java 8 by the new java.time.* package (which was inspired by Joda-Time). java.time Instant Learn to think and work in UTC rather than your own parochial time zone. Logging, data-exchange, and data-storage should usually be done in UTC. Instant instant = Instant.now() ; // Capture the current moment in UTC. instant.toString(): 2018-09-18T20:48:43.354953Z Zone…
upvote count: 5

http://stackoverflow.com/q/21276502
tagged with: jfreechart
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21278553
favorite count: 0
tagged with: gantt-chart
type: UnansweredQuestion
tagged with: rendering
has body: I hope i will be able to get my message across in the right way and tell you what is that i am looking to achieve. I am using JFreeChart GanttChart in my Swing application to display the scheduling of tasks. Was able to prepare the right dataset and got the chart on the panel. It looks something like this. There is no problem as such with the overall functionality, but our task scheduling is done in shifts, so it doesn't take up the whole 24 hours in a day. Say for example, in our case the operating hours are only from 0800 hrs - 1600 hrs. My dataset conforms to this as well. As you can see in the image, Step 7 is a task with a duration of 2 hours, starts on 1500 hrs on 22nd Jan and ends at 0900 on the next day ( 1 hour on both days because the operating hours ends at 1600 and starts at 0800 only on the next day). But looking at the graph, makes step 7 to be one of the longest tasks in the event, just because the graph is also considering the non-operating hours into account. Is there a way to change the range axis / date axis to consider the time periods only in custom hours or trim down the non-operating hours (1600-0800 hrs in my case )?. Unfortunately, i don't have the JFreeChart Dev Guide to probe further. Below are my snippets for generating the dataset and creating the chart for (int i = 0; i &lt; tempList.size(); i++) { GanttChartPojo tempGCPojo = new GanttChartPojo(); tempGCPojo = tempList.get(i); s1.add(new Task(tempGCPojo.getTaskStepDesc(), tempGCPojo.getEST(), tempGCPojo.getEFT())); s2.add(new Task(tempGCPojo.getTaskStepDesc(), tempGCPojo.getLST(), tempGCPojo.getLFT())); } } } // Add the task series to a TaskSeriesCollection final TaskSeriesCollection collection = new TaskSeriesCollection(); collection.add(s1); collection.add(s2); Create Chart Code // create the chart... final JFreeChart chart = ChartFactory.createGanttChart( "Scheduling of Task Steps : Maintenance Event "+eventKey, // chart title "Task", // x axis label "Time", // y axis label dataset, …
score: 1
tagged with: java
has title: Changing the range axis on JFreeChart GanttChart - SegmentedTimeline for non-working hours
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/31981131
has text: It was kind of hidden truth inside `Calender`, logically you were attempting the right thing :), accept the answer if it worked for you.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21232230

http://stackoverflow.com/comment/31937658
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21207570
type: Comment
has text: Or maybe I can try this thing: https://discussions.apple.com/message/15246413#15246413 -> what do you think ?

http://stackoverflow.com/comment/32083547
type: AnswerComment
score: 0
has text: Thanks Bruno. I can only go on what the vendor states.
type: Comment
comment on: http://stackoverflow.com/a/21289506

powercommands
tags question: http://stackoverflow.com/q/21209309
tag name: powercommands
type: Tag

http://stackoverflow.com/q/21295416
answer count: 0
type: UnansweredQuestion
has title: Nullpointer onClickListener on toggleButton why?
tagged with: java
has comment: http://stackoverflow.com/comment/32092775
type: Question
has comment: http://stackoverflow.com/comment/32092747
has comment: http://stackoverflow.com/comment/32092891
has body: I have problems with Android 2.2 I'm checking in my old device my new app and i get a nullpointer on this tooglebutton, i don't known why, in other device using 4.0.4 works like a charm. I tried to Implement onClickListener to my class, and no results. The button is defined in the correct Xml layout. I post logcat's output, code and Xml. Thanks. public class Settings extends Activity { ToggleButton toggleFb; Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); toggleFb = (ToggleButton) findViewById(R.id.toggleFb); addListenerOnButtonFb(); } public void addListenerOnButtonFb() { toggleFb.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { fb = "1"; if (toggleFb.isChecked()) { noti = "1"; } else { noti = "0"; } } }); } LogCat 01-22 23:23:29.601: E/AndroidRuntime(5493): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651) 01-22 23:23:29.601: E/AndroidRuntime(5493): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667) 01-22 23:23:29.601: E/AndroidRuntime(5493): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 01-22 23:23:29.601: E/AndroidRuntime(5493): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935) 01-22 23:23:29.601: E/AndroidRuntime(5493): at android.os.Handler.dispatchMessage(Handler.java:99) 01-22 23:23:29.601: E/AndroidRuntime(5493): at android.os.Looper.loop(Looper.java:130) 01-22 23:23:29.601: E/AndroidRuntime(5493): at android.app.ActivityThread.main(ActivityThread.java:3687) 01-22 23:23:29.601: E/AndroidRuntime(5493): at java.lang.reflect.Method.invokeNative(Native Method) 01-22 23:23:29.601: E/AndroidRuntime(5493): at java.lang.reflect.Method.invoke(Method.java:507) 01-22 23:23:29.601: E/AndroidRuntime(5493): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 01-22 23:23:29.601: E/AndroidRuntime(5493): at …
score: 0
has comment: http://stackoverflow.com/comment/32092719
tagged with: android
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/32045396
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21266384
has text: Oh, I understand now what you are getting at. OK, but that's not an excuse to use mock a value object. Making a new list is still the better approach. I will edit my answer so that it's a `java.util.ArrayList` instead of a `java.util.Arrays.ArrayList` (which is actually what I had before my first edit).
type: AnswerComment

http://stackoverflow.com/q/21217561
has title: Invoke EJB from WildFly safely
has body: I'm trying to re-write my old application in enterprise, "business" way. So, I've got a Swing client with login module and my own server created from scratch. The client use ssl certificate to encrypt TCP connection to the server (I check client certificate on server and server certificate on client) and then server use database to authenticate and authorize the user. Now I'm trying to get it working with ejb hosted by WildFly 8 CR1. I want to use the same client-server keys pair to connect Swing client to WildFly server and then authenticate user with name and credentials stored in MySQL datasource. I have also roles stored in database and I want to use them to configure client principals. I have simple, basic EJB invocation: Context ctx = new InitialContext(); MyBeanRemote bean = (MyBeanRemote)ctx.lookup("AppName/module-0.0.1-SNAPSHOT/MyBean!my.app.MyBeanRemote"); ResultType result = bean.doSomething(); I have jndi.properties file java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory java.naming.provider.url=http-remoting://myServer:8080 jboss.naming.client.ejb.context=true java.naming.security.principal=app-user-name java.naming.security.credentials=password@123 And I have basic datasource configuration jdbc:mysql://localhost:3306/Mydb com.mysql.jdbc.Driver mysql-connector-java-5.1.28-bin.jar mysqlUser mysqlPass false false <share-prepared-statements>false</share-prepared-statements> Everything above works fine. I have read some guides but still haven't find the one describes how to use composite of: EJB (not web) + WildFly 8 (not JBoss 7) + encryption by SSL + authenticate and authorization via datasource with login client module Any help will be appreciated. Sorry for my english, I often use this language for reading, not writing:)
tagged with: ejb
has answer: http://stackoverflow.com/a/21221026
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: wildfly
upvote count: 7
tagged with: java
score: 7
tagged with: ssl
type: Question

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/21258422
tags question: http://stackoverflow.com/q/21216188
tags question: http://stackoverflow.com/q/21274477
tags question: http://stackoverflow.com/q/21273615
type: Tag
tags question: http://stackoverflow.com/q/21204273

http://stackoverflow.com/comment/32173304
type: AnswerComment
has text: and what about putting it in a native (NDK) part of the app
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21340622

http://stackoverflow.com/comment/31969314
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21225380
score: 0
has text: @MadProgrammer do you know if BufferedReader would work in this situation?

http://stackoverflow.com/comment/31955001
type: Comment
comment on: http://stackoverflow.com/q/21213439
has text: Also, try to add another roles to your user: admin-script and maybe manager-gui. Also, could you check the url from your browser, are your credentials work fine from browser?
score: 0
type: QuestionComment

http://stackoverflow.com/a/21244329
has body: This is the relevant error: Could not autowire field: private org.hibernate.SessionFactory com.venkat.homeapp.dao.impl.CustomerDAOImpl.sessionFactory; nested exception is java.lang.NoClassDefFoundError [Lorg/hibernate/engine/FilterDefinition; and this is the probable cause: class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt; class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt; see that you have both hibernate4 and hibernate3 things in there. Copied from this answer, I think you should use org.springframework.orm.hibernate4.LocalSessionFactoryBean instead of org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean From LocalSessionFactoryBean javadoc: NOTE: This variant of LocalSessionFactoryBean requires Hibernate 4.0 or higher. It is similar in role to the same-named class in the orm.hibernate3 package. However, in practice, it is closer to AnnotationSessionFactoryBean since its core purpose is to bootstrap a SessionFactory from annotation scanning.
answers question: http://stackoverflow.com/q/21241210
has comment: http://stackoverflow.com/comment/32016332
has comment: http://stackoverflow.com/comment/32015568
upvote count: 10
score: 10
has comment: http://stackoverflow.com/comment/32150453
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32029888
has text: @rook - There's no purpose... String literals are interned automatically..
score: 0
comment on: http://stackoverflow.com/q/21260072
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21217364
has body: Copies all of the mappings from the specified map to 'this' map. These mappings will replace any mappings that 'this' map had for any of the keys currently in the specified map. 'this' is map object with which you are calling this function.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21217264

http://stackoverflow.com/comment/31951088
type: QuestionComment
type: Comment
has text: Array's size is immutable in Java, and all method calls are pass by value of a reference, so you can't instantiate new array in a method, assign it to an argument and expect that the caller sees the new instance.
score: 0
comment on: http://stackoverflow.com/q/21215151

http://stackoverflow.com/comment/32115541
comment on: http://stackoverflow.com/a/21304571
type: Comment
score: 1
has text: This is not exactly what OP wants because this solution process the file and OP wants to discard all records if count is > 8K! With with solution (no tricks to count records faster) probably is better to create a previous step, check for 8K condition (just read record, without writes) and after use a [`JobExecutionDecider`](http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/core/job/flow/JobExecutionDecider.html) to check if job need to be continued or completed (this should make the job flow cleaner)
type: AnswerComment

http://stackoverflow.com/a/21187309
accepted answer of: http://stackoverflow.com/q/21186815
type: AcceptedAnswer
has body: I bet you have a NULL value in your database. Check the field for null before printing it out: while (res.next()) { String output = res.getString(3); if ( res.wasNull() ) System.out.println( "NULL" ); else System.out.println(output); }
answers question: http://stackoverflow.com/q/21186815
score: 0
type: Answer

http://stackoverflow.com/comment/32015117
score: 0
type: Comment
has text: the preview image seems stretched in landscape...is there a solution where i could both get the preview running full screen while keeping the image from getting stretched
comment on: http://stackoverflow.com/a/21232917
type: AnswerComment

http://stackoverflow.com/comment/32028781
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21259590
has text: PLease share Context.xml file

http://stackoverflow.com/q/21287806
type: UnansweredQuestion
has title: How to extract some information from an image in java?
tagged with: image-processing
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/32078785
has body: i want to extract some information from an image. example if an image has some text like ADDRESS:INDIA i want to find out text corresponding to ADDRESS and store it in my database how can i achieve this? i didn't get any information or help regarding this. any help will be appreciated.
has comment: http://stackoverflow.com/comment/32078835
answer count: 0

http://stackoverflow.com/q/21305334
favorite count: 0
possible better answer: http://stackoverflow.com/a/21305355
has comment: http://stackoverflow.com/comment/32109898
has answer: http://stackoverflow.com/a/21305359
downvote count: 1
type: AnsweredQuestion
tagged with: performance
has answer: http://stackoverflow.com/a/21305362
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/32110157
upvote count: 0
tagged with: null
has title: (!var) vs (var==null) in java / groovy
has answer: http://stackoverflow.com/a/21305355
accepted answer: http://stackoverflow.com/a/21305362
answer count: 3
tagged with: groovy
has body: What is recommended in java : if(!var){ } or if(var==null){ } and why? It is the same thing with Groovy?

http://stackoverflow.com/q/21202278
favorite count: 0
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31929347
tagged with: html-parsing
tagged with: java
duplicate of: http://stackoverflow.com/q/1732348
has answer: http://stackoverflow.com/a/21203255
has comment: http://stackoverflow.com/comment/31927794
type: Question
answer count: 2
downvote count: 2
score: -2
has comment: http://stackoverflow.com/comment/31928045
linked to: http://stackoverflow.com/q/1732348
has body: I want to parse html tags and tags' content. I can load html as a string with Java UrlConnection. I use this regex expression: <([A-Za-z][A-Za-z0-9]*)\\b[^>]*>(.*?)</\\1> but I cannot get all tags. Is there more flexible regex expression for getting all kind of tags. Note : I can do all these jobs with Jsoup easily. But i should not use any libraries. Bilgi Tarihçe Vizyon ve Misyon Eğitim Kadro Laboratuvarlar Sınıflar Komisyonlar Site Haritası is it possible to I get this output. tag : div content : id=footer ...etc. Thanks.
has answer: http://stackoverflow.com/a/21202313
has title: Parse HTML Tags with content by Regex in Java
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/comment/31969176
comment on: http://stackoverflow.com/a/21225302
type: Comment
has text: I'm quoting it to comment on it. Of course, `reader.close()` should be removed to fix the code.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32092011
score: 0
type: Comment
has text: I am still not sure what you mean, I tried copying your code but still couldn't get it to work. Also would I need to add the ActionListener as a new method or put it in the ActionPerformed. If I was not to set the JcomboBox in the ActionPerformed, where would I put it then?
type: AnswerComment
comment on: http://stackoverflow.com/a/21270856

http://stackoverflow.com/comment/31968969
type: Comment
comment on: http://stackoverflow.com/a/21225165
score: 1
has text: I've also seen `ImageIO.read((getCodeBase(), "relative/path/to/globe.jpg"))` but that's probably going beyond the scope of the question ;)
type: AnswerComment

http://stackoverflow.com/q/21196672
possible better answer: http://stackoverflow.com/a/21197218
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
score: 0
answer count: 2
tagged with: jpa
has body: javax.transaction.TransactionRequiredException' is never thrown in the corresponding try block ref: http://docs.oracle.com/javaee/6/api/javax/persistence/EntityManager.html#merge%28T%29 note: I dont want to declare throws new exception in my method signature how to handle exceptions? and I was thinking that .save .merge are used in all DAOs. So writing same code foe each DAO with just different object (but same pattern) would not be smart OOP. How to properly make generic .merge .save or thus all such repeated things. I couldnt find much stable examples on google though. any sample code ? private EntityManager entityManager; public Boards save(Boards board) { Boards boardToBeReturned = null; try{ boardToBeReturned = entityManager.merge(board); }catch (IllegalArgumentException e){ e.printStackTrace(); }catch (TransactionRequiredException e){ e.printStackTrace(); } return boardToBeReturned; } complete sample code for a class: package web.dao.impl.jpa; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContextType; import javax.transaction.TransactionRequiredException; import org.hibernate.Session; import org.springframework.stereotype.Repository; import web.dao.BoardsDAO; import web.entity.Boards; import web.entity.Users; @Repository public class BoardsDAOImpl implements BoardsDAO { /** * The JPA entity manager */ // @Autowired @PersistenceContext(type = PersistenceContextType.EXTENDED) private EntityManager entityManager; public Boards save(Boards board) { Boards boardToBeReturned = null; try{ boardToBeReturned = entityManager.merge(board); }catch (IllegalArgumentException e){ e.printStackTrace(); // }catch (TransactionRequiredException e){ // e.printStackTrace(); } return boardToBeReturned; } public Boards getBoardById(Long id){ Boards boardToBeReturned = null; System.out.println("board id entered for lookup was : "+id); try { boardToBeReturned=entityManager.find(Boards.clas…
has answer: http://stackoverflow.com/a/21197218
has title: JPA and spring handling of DAO with exceptions and generics
tagged with: generics
has answer: http://stackoverflow.com/a/21197233
accepted answer: http://stackoverflow.com/a/21197233

http://stackoverflow.com/comment/32170560
comment on: http://stackoverflow.com/a/21325597
type: AnswerComment
has text: So it solved the display problem, but the game never reaches the "you have won" anymore since lettersInWord.size() never becomes equal to zero. So I am guessing the null elements are counted towards the total then. Any idea as to how this may be fixed?
type: Comment
score: 0

http://stackoverflow.com/comment/31922042
comment on: http://stackoverflow.com/q/21198503
has text: @codeMagic what part should I filter so I can include the whole logcat?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31977518
has text: I think the OP is trying to figure out why h won't resize in relationship with the window...but that's just me...
score: 1
comment on: http://stackoverflow.com/a/21230206
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21190446
has body: You have to do like this &lt;c:forEach items="${list}" var="firstListElement" varStatus="counter"&gt; &lt;%-- auction id of list --%&gt; ${list.auctionId} &lt;%-- depot name of depotList item based on iteration count --%&gt; ${depotList[counter.count].depotName} &lt;%-- auctionId of userAuctionRelDolist2 item based on iteration count --%&gt; ${userAuctionRelDolist2[counter.count].auctionId} &lt;/c:forEach&gt; counter keeps tracking of the iteration count variable. Note: Since the forEach loop depends on the size of the first list. This will not work correctly when the size of the depotList or userAuctionrelDolist is greater than the size of the first list
answers question: http://stackoverflow.com/q/21190153
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/21261321
answers question: http://stackoverflow.com/q/21261188
has body: Simplest way... start from 1st element in 1st arrayList and shuffle the second arrayList and select the first element.. 2nd in arylist1-->2nd in arraylist2.. and so on.. Now add this data as key value pair in a map.. next time you create couples, shuffle the second arraylist again.. now for each couple made, first check if the person from the second arraylist exists for the same key in the map . If no, add the value to the List (value of map ) else again shuffle the list and try.. You will need a key, List in the map... Map&lt;String,List&gt; hm = new HashMap&lt;String, List&gt;(); List&lt;String&gt; l = new ArrayList&lt;String&gt;(); Collections.shuffle(arrayList2); Now its your turn to implement the logic.. And sorry, I can't give you code...
has comment: http://stackoverflow.com/comment/32032324
has comment: http://stackoverflow.com/comment/32032019
score: 0
type: Answer

http://stackoverflow.com/a/21349607
type: Answer
answers question: http://stackoverflow.com/q/21349568
score: 6
upvote count: 7
has body: You can try JSONObject for conversion of String to Json Format Try this way: JSONObject jsonObj = new JSONObject("Your String"); Use org.json
downvote count: 1
has comment: http://stackoverflow.com/comment/32189219
has comment: http://stackoverflow.com/comment/34313412
has comment: http://stackoverflow.com/comment/32189240
has comment: http://stackoverflow.com/comment/32189309

http://stackoverflow.com/q/21202490
tagged with: playframework
has title: Ebean Query by OneToMany Relationship
has answer: http://stackoverflow.com/a/21203066
accepted answer: http://stackoverflow.com/a/21203066
possible better answer: http://stackoverflow.com/a/39951789
favorite count: 0
has answer: http://stackoverflow.com/a/39951789
tagged with: ebean
score: 6
type: AnsweredQuestion
tagged with: playframework-2.0
downvote count: 0
tagged with: java
type: Question
answer count: 2
has body: I'm using Ebean with the Play 2 Framework and got two models: a user model and a book model. The user model is connected with the book model in a OneToMany Relationship. So every user can have many books or no book at all. The book model itself has properties too. Now I want to create a query in the user model, which returns only users, who have books with certain properties. For example: One property might be condition, like new or used. Now give me all users which have books in new condition. Is it possible to create such a query with the Ebean methods? Or do I have to use raw SQL?
upvote count: 6

http://stackoverflow.com/a/21208730
has comment: http://stackoverflow.com/comment/32043011
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31957188
has comment: http://stackoverflow.com/comment/32041463
has body: How can I tell hibernate validator to process the validation when I call the hibernate save or update methods in the dao, not when the transaction commits? Implement a hibernate entity listeners and register the event listener for every event type when you want to do the validation. Take a look at this question on how to configure event listeners with hibernate 4.
has comment: http://stackoverflow.com/comment/31970826
has comment: http://stackoverflow.com/comment/31940669
has comment: http://stackoverflow.com/comment/31948983
has comment: http://stackoverflow.com/comment/31940536
answers question: http://stackoverflow.com/q/21208594

http://stackoverflow.com/comment/32093920
comment on: http://stackoverflow.com/a/21295908
has text: yeah thx and i hope you can explain me how to do the recomended part, that mean where i have to use System.Load
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21297520
has body: I'm doing a collegeproject to make tetris, however I'm stuck at the moment. I have a nullpointerexception when I simply want to change a value of an array. Should be easy right? Apparently not... I'm not an advanced programmer yet, so if anyone could help me find the incorrect code, and specifically explain to me why it's wrong, it'll be appreciated. Here's my code: package tetris; import java.awt.Color; import java.awt.Graphics2D; import java.awt.event.KeyEvent; import engine.*; public class Tetris extends Game { private int x = 0, y = 0, maxWidth = 0, bSize = 25; private int[][] field; private boolean busy; private Blok blok = null; public Tetris() { title = "Tetris"; height = 600; width = 400; delay = 100; delay2 = 10; field = new int[20][10]; field[19][7] = 1; field[18][7] = 2; field[17][7] = 3; field[19][2] = 4; field[19][3] = 5; } public static void main(String arg[]) { GameApplication.start(new Tetris()); } @Override /** * Right Arrow: keycode 39 * Left Arrow: keycode 37 */ public void keyPressed(KeyEvent e) { if(e.getKeyCode() == 37) { if (tryMove(-1)) { x--; } } else if(e.getKeyCode() == 39) { if (tryMove(1)) { x++; } } else if(e.getKeyCode() == 40) { if (tryMove(0)) { y++; } } } @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub } @Override public void keyTyped(KeyEvent e) { // TODO Auto-generated method stub } @Override public void update() { if(!busy) { int random = (int) (Math.random()*7); //debug mode random = 0; /// System.out.println(random); blok = new Blok(random); y = 1; x = 3; busy = true; } if (!tryMove(0)){ field[y][x] = 1; busy = false; } else { y++; } scanLine(); } @Override public void update2() { } @Override public void draw(Graphics2D g) { g.fillRect(0, 0, width, height); g.setColor(Color.LIGHT_GRAY); g.fillRect(0, 0, 250, 500); for (int i = 0; i&lt;20; i++){ for (int j = 0; j&lt;10; j++){ if (field[i][j]&gt;0) { g.setColor(Color.black); g.fillRect(j*25,i*25,bSize,bSize); } } } if(busy) { maxWidth = blok.get…
linked to: http://stackoverflow.com/q/3404301
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21297530
tagged with: arrays
answer count: 1
score: 0
tagged with: nullpointerexception
has title: Java - NullPointerException, Changing array value
has answer: http://stackoverflow.com/a/21297530
type: AnsweredQuestion

http://stackoverflow.com/q/21266333
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32055610
tagged with: swing
has body: I have a Container pane and I'm using gridbaglayout. to set the color I pane.setbackground but i want to do this from another method, and action handling method. pane.setbackground won't work. what do i do? thanks. package mcve; import java.awt.Color; import java.awt.ComponentOrientation; import java.awt.Container; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class mcve extends JPanel implements ActionListener{ final static boolean shouldFill = true; final static boolean shouldWeightX = true; final static boolean RIGHT_TO_LEFT = false; static JFrame frame; static JButton color1, color2, exit; public static void addComponentsToPane(Container pane) throws IOException { if(RIGHT_TO_LEFT){ pane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } pane.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); if (shouldFill){ c.fill = GridBagConstraints.HORIZONTAL; } // here i can do it. pane.setBackground(Color.black); color1 = new JButton("color1"); c.fill = GridBagConstraints.HORIZONTAL; c.gridx=0; c.gridy=0; color1.setActionCommand("color1"); color1.addActionListener(new mcve()); pane.add(color1, c); color2 = new JButton("color2"); c.fill = GridBagConstraints.HORIZONTAL; c.gridx=1; c.gridy=0; color2.setActionCommand("color2"); color2.addActionListener(new mcve()); pane.add(color2, c); exit = new JButton("Exit"); c.fill = GridBagConstraints.HORIZONTAL; c.gridx=1; c.gridy=0; exit.setActionCommand("exit"); exit.addActionListener(new mcve()); pane.add(exit, c); } public void actionPerformed(ActionEvent e){ if ("exit".equals(e.getActionCommand())){ System.exit(0); } else if ("color1".equals(e.getActionCommand())){ // I DON'T KNOW } else if ("color2".equals(e.getActionCommand())){ // I DON'T KNOW } } private static void createAndSho…
has comment: http://stackoverflow.com/comment/32041114
upvote count: 0
has title: Java - How do I set a container pane color from another method?
tagged with: java
tagged with: jpanel
score: -1
type: Question
tagged with: containers
tagged with: colors
has comment: http://stackoverflow.com/comment/32041771
has answer: http://stackoverflow.com/a/21266790
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32041892

http://stackoverflow.com/comment/32075294
comment on: http://stackoverflow.com/a/21285767
has text: `In swing, we recommend using Swing timers rather than general-purpose timers for GUI-related tasks because Swing timers all share the same, pre-existing timer thread and the GUI-related task automatically executes on the event-dispatch thread. However, you might use a general-purpose timer if you don't plan on touching the GUI from the timer, or need to perform lengthy processing.`
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/21189072
tagged with: java
linked to: http://stackoverflow.com/q/195321
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31903867
downvote count: 0
has body: I have a class let's call it Creator which contains two instance fields. Those fields belong to a parent class A. In the Creator's constructor I want to pass a child of class A and then to create two objects from that passed type and assign the references to the two fields. How can I do something like that? I don't know how to make this generalization. EDIT: the class Creator shall only accept types that are children of A or A itself. So not any other general type. AND A does not have a no-argument constructor So like this, here GeneralClassifier is A and doesn't have a no-argument constructor: public class TwoLevelClassifier &lt;T&gt; { private GeneralClassifier firstCl, secondCl; //The passed type shall *only* be a GeneralClassifier or a child of it public TwoLevelClassifier( GeneralClassifier cl ) { firstCl = //create a new classifier that is of the type passed to the constructor secondCl = //create a new classifier that is of the type passed to the constructor } } I'm not sure, but maybe this feature is called generics in java?
favorite count: 0
has answer: http://stackoverflow.com/a/21189135
has answer: http://stackoverflow.com/a/21189237
has comment: http://stackoverflow.com/comment/31903941
upvote count: 2
possible better answer: http://stackoverflow.com/a/21189237
has comment: http://stackoverflow.com/comment/31903794
has title: How to create many objects by passing the object type?
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31903995
accepted answer: http://stackoverflow.com/a/21189135
linked to: http://stackoverflow.com/q/10470263

http://stackoverflow.com/a/21301766
has comment: http://stackoverflow.com/comment/32143411
downvote count: 0
score: 5
accepted answer of: http://stackoverflow.com/q/21301562
answers question: http://stackoverflow.com/q/21301562
has body: Trove bases it's Map on it's Set implementation. However, it has one critical method which is missing from Set which is a get() method. Without a get(Element) method, HashSet you cannot perform a lookup which is a key function of a Map. (pardon the pun) The only option Set has is a contains which could be hacked to perform a get() but it would not be ideal. You can have; a Set where the Entry is a key and a value. you define entries as being equal when the keys are the same. you hack the equals() method so when there is a match, that on a "put" the value portion of an entry is updated, and on a "get" the value portion is copied. Set could have been designed to be extended as Map, but it wasn't and it wouldn't be a good idea to use HashSet or the existing Set implementations to create a Map.
type: AcceptedAnswer
upvote count: 5
type: Answer

http://stackoverflow.com/comment/32122720
comment on: http://stackoverflow.com/a/21312738
type: Comment
has text: ".." removes the even the "." (Single dot)
score: 1
type: AnswerComment

http://stackoverflow.com/comment/32094653
comment on: http://stackoverflow.com/a/21273245
has text: My problem was on the server after all..Thank you all for the answers
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21219858
upvote count: 14
has body: From official docs I've observed that there are primarily two approaches. So, it depends on what you are sorting and what overloaded method from sort family of methods you are calling. Docs mention that for primitive types such as long, byte (Ex: static void sort(long[])): The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance. For Object types: (Ex: void sort(Object list[])) Guaranteed O(nlogn) performance The sorting algorithm is a modified mergesort (in which the merge is omitted if the highest element in the low sublist is less than the lowest element in the high sublist). This algorithm offers guaranteed n*log(n) performance. Hope that helps!
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31959280
accepted answer of: http://stackoverflow.com/q/21219777
has comment: http://stackoverflow.com/comment/31959359
type: Answer
answers question: http://stackoverflow.com/q/21219777
score: 14

http://stackoverflow.com/comment/31950288
type: Comment
has text: See my addon. That was my initial idea, except I don't know in the front how many items there will be, so I need to have `put` (insert) functionality. See my addon how to prevent array relocation.
comment on: http://stackoverflow.com/a/21214244
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31904780
score: 0
has text: Now you do. When I down-voted, you didn't. It was a code only answer.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21189506

http://stackoverflow.com/comment/31926277
has text: I dont know why the down vote, maybe because the OP was specifically requesting a regex solution who knows,.. people have their own reasons. I told you I admired your app and was good code indicating that I was not your downvoter.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21201101
type: Comment

http://stackoverflow.com/comment/32043605
type: QuestionComment
score: 1
has text: possible duplicate of [How to exclude the submit action from a list of parameters in struts2?](http://stackoverflow.com/questions/20764609/how-to-exclude-the-submit-action-from-a-list-of-parameters-in-struts2)
comment on: http://stackoverflow.com/q/21234295
type: Comment

http://stackoverflow.com/q/21292999
has comment: http://stackoverflow.com/comment/32088227
tagged with: arrays
score: 0
has comment: http://stackoverflow.com/comment/32088168
has body: I'm trying to add doubles into an array and when the user enters 0, the loops should stop. I'm not getting the program to stop when 0 is entered, it just keeps continuing asking for input. I already have the scanner and such declared. Also, when I can get the array to stop, the last value entered prints out to all the elements of the array. System.out.println("Enter some numbers; 0 to quit"); //condition for our sentinel boolean done = false; while (!done){ //value to be added into array double value = in.nextInt(); //condition to end the while loop if (value == 0){ break; } for (int i = 0; i &lt; nums.length; i++){ nums[i] = in.nextDouble(); } } System.out.println(Arrays.toString(nums));
answer count: 0
has title: Adding input to array with sentinel
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32088611
has comment: http://stackoverflow.com/comment/32092595
tagged with: java
tagged with: loops
type: Question

http://stackoverflow.com/q/21273067
has title: Nesting abstract beans in Spring and init-method does not seem to work
has body: I have the following construct Spring XML (Spring 3.1): ... ... ... And I am trying to separate out the init method into a higher level abstract bean: ... ... ... Somehow this does not work, i.e. startThreads() is never invoked in the second case. Does anybody know why? Does Spring support nested abstract beans? My idea for doing this is so I can override "taskRunnerLauncher" in unit tests and set it to "mock" or "java.lang.Object" and suppress startThreads() call (which starts new thread and making it a pain to test).
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21273137
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/21273299
has answer: http://stackoverflow.com/a/21273299
score: 0
accepted answer: http://stackoverflow.com/a/21273137
answer count: 2

http://stackoverflow.com/a/21230398
has body: Propably your servlet is in a package: config my.package.config
type: Answer
downvote count: 0
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21230351
accepted answer of: http://stackoverflow.com/q/21230351
upvote count: 1

http://stackoverflow.com/q/21185307
favorite count: 0
has body: I made a simple program using jSch to print the name of total files in a remote directory. In the directory, there are only 7 files but, on my console, I am getting two extra files with name . and ... From where these files came, or its a garbage??? My Java code: import com.jcraft.jsch.ChannelSftp; import com.jcraft.jsch.JSch; import com.jcraft.jsch.Session; import java.util.Vector; public class DownloadFileSFTP { public static void main(String[] s){ String user = "user"; String password = "1234"; String host = "remoteIP"; int port = 22; String sourcePath = "/home/remoteSFTP_Files/"; String destinationPath = "/home/user/SFTP_files/"; Session session = null; ChannelSftp sftp = null; try { JSch jsch = new JSch(); session = jsch.getSession(user, host, port); session.setPassword(password); session.setConfig("StrictHostKeyChecking", "no"); session.connect(); System.out.println("Session created"); sftp = (ChannelSftp) session.openChannel("sftp"); sftp.connect(); System.out.println("SFTP Channel connected"); Vector totalFiles = sftp.ls(sourcePath); for(int i = 0; i &lt; totalFiles.size(); i++){ ChannelSftp.LsEntry ls = (ChannelSftp.LsEntry) totalFiles.get(i); System.out.println("File Name: " + ls.getFilename()); } } catch (Exception e){ e.printStackTrace(); } finally { sftp.exit(); sftp.disconnect(); session.disconnect(); } } } O/P in my console: Session created SFTP Channel connected File Name: campMonitorHome.jsp File Name: asm-3.1.jar File Name: didLatest_dump.sql File Name: PieChartJson.java File Name: demoFile.txt File Name: . File Name: jquery.jqplot.min.css File Name: showgraphicalMonitor.jsp File Name: ..
tagged with: ssh
type: AnsweredQuestion
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/21185487
type: Question
score: 3
has answer: http://stackoverflow.com/a/21187279
answer count: 2
tagged with: sftp
possible better answer: http://stackoverflow.com/a/21187279
downvote count: 0
has title: From where two extra files named ( '.' and '..' ) came by getting file names from Vector in jSch SFTP
has answer: http://stackoverflow.com/a/21185487
tagged with: jsch

http://stackoverflow.com/q/21244694
type: Question
has answer: http://stackoverflow.com/a/21244722
tagged with: c#
has comment: http://stackoverflow.com/comment/32004733
tagged with: .net
has body: Me and two friends of mine are working on a programming project together but still separately, I want to add that we are all very new to programming. Now we are all going to write the same application but in different language because we are all self-taught in different languages. I will be writing the application in C#, friend 1 will be writing it in C++/CLI and friend 3 will be writing it in Java (or J#). Now the application we are going to make is going to be a "card game engine". It will be an application that will be able to load and play different types of the standard western 52-card deck games such as Poker or Blackjack etc. This actual application we will be writing separately but what we want to load the actual "card games" as external modules, I'm guessing we'd make separate assemblies for this? Now one of our requirements here is that these "card game" modules should be able cross-language, what I mean by that is that I should be able to for example use my "BlackJack C# Module" and load it in to his "C++ version" of the game engine and vice versa. So I have a two questions Is this even possible to do? From what I understand all .NET languages can compile under the same solution? If we write the "modules" as assemblies then they should be able to access some of methods and vice versa or am I wrong here? Since friend 2 isn't actually programming in a .NET language, is there an easy way to make a Java solution that will work with this? Could he perhaps write the "card game" modules as DLLs that we can then import into our separate projects? Or would it just be easier for him to write the application in J#?
score: 0
answer count: 1
has title: Sharing class methods inbetween .NET languages
type: UnansweredQuestion
tagged with: c++
tagged with: j#
tagged with: java
has comment: http://stackoverflow.com/comment/32004777

http://stackoverflow.com/comment/32102940
comment on: http://stackoverflow.com/q/21279503
score: 0
type: QuestionComment
has text: @PathuZ - Actually, if you do that, you reach gets over(kind of). If a question already has an accepted answer, why would people look into it(except for few enthusiastic folks)? Doing this would hamper your chances of getting a proper answer. That is why I recommend you to not do it.
type: Comment

http://stackoverflow.com/comment/32138970
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21320601
has text: @user3150201: A Graphics object is like a paintbrush with which to paint with *on to one specific canvas*. Here we get a Graphics object from a BufferedImage, and so when we pass that into the components `paintAll(Graphics g)` method, we essentially "paint" the component onto the BufferedImage.

http://stackoverflow.com/a/21266922
downvote count: 0
score: 1
has body: Any "simple" way would be more of a c++ question than a plugin or firebreath question. My guess is that you'd be far better off just making it an applet rather than a plugin if you want it mainly in java. There is nothing that I'm aware of that will make it easy for you to do what you want to do using FireBreath or NPAPI directly.
has comment: http://stackoverflow.com/comment/32056937
answers question: http://stackoverflow.com/q/21251147
has comment: http://stackoverflow.com/comment/34259887
has comment: http://stackoverflow.com/comment/32060215
upvote count: 1
type: Answer

http://stackoverflow.com/q/21323974
has comment: http://stackoverflow.com/comment/32145258
has body: This is my constructor of class RSBaseFilterEngine, and my program will create many instance of this class in different activity. public RSBaseFilterEngine(Context context) { rs = RenderScript.create(context); this.context = context; script = new ScriptC_BaseFilter(rs); } The problem is, if I get the instrance of this class more than 1 times, program will crash. The crash will occur when program is processing script = new ScriptC_BaseFilter(rs); And, the error log is Caused by: android.support.v8.renderscript.RSRuntimeException: Loading of ScriptC script failed. at android.support.v8.renderscript.ScriptC.&lt;init&gt;(ScriptC.java:69) at com.xxxxxxxxxxx.xxxxxxxx.algorithms.filter.ScriptC_BaseFilter.&lt;init&gt;(ScriptC_BaseFilter.java:41) at com.xxxxxxxxxxx.xxxxxxxx.algorithms.filter.ScriptC_BaseFilter.&lt;init&gt;(ScriptC_BaseFilter.java:35) at com.xxxxxxxxxxx.xxxxxxxx.algorithms.RSBaseFilterEngine.&lt;init&gt;(RSBaseFilterEngine.java:33) Why ScriptC_BaseFilter can't be created twice? Then, I changed code like this public RSBaseFilterEngine(Context context) { rs = RenderScript.create(context); this.context = context; script = new ScriptC_BaseFilter(rs); script.destroy(); script = new ScriptC_BaseFilter(rs); } As I expected, it crashed when program invoked this constructor in the first time. So, can anyone tell me why this hanppened? Whether there is some details I do not notice？Thanks. Ok, I will post entire logcat 01-28 10:50:58.637: E/RenderScript(26067): Could not create symlink /data/data/com.xxxxxxxxxxx.xxxxxxxx.algorithms.demo/cache/com.android.renderscript.cache/librs.basefilter#93xfAC.so -&gt; /data/data/com.xxxxxxxxxxx.xxxxxxxx.algorithms.demo//lib/librs.basefilter.so 01-28 10:50:58.637: E/RenderScript(26067): Unable to open shared library (/data/data/com.xxxxxxxxxxx.xxxxxxxx.algorithms.demo//lib/librs.basefilter.so): Symbol not found: load_library[1096]: Library '/system/lib/egl/libGLESv2S3D_adreno200.so' not found 01-28 10:50:58.657: E/RenderScript(26067)…
has answer: http://stackoverflow.com/a/21700033
type: Question
has answer: http://stackoverflow.com/a/21346261
tagged with: renderscript
tagged with: java
possible better answer: http://stackoverflow.com/a/21346261
answer count: 3
has comment: http://stackoverflow.com/comment/32808053
has comment: http://stackoverflow.com/comment/32275265
accepted answer: http://stackoverflow.com/a/21700033
has answer: http://stackoverflow.com/a/22058033
score: 0
has title: RenderScript: One ScriptC_XXXX can't be created twice?
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32272903

http://stackoverflow.com/a/21326208
accepted answer of: http://stackoverflow.com/q/21326160
upvote count: 2
type: AcceptedAnswer
has body: Sets.intersection from guava library. EDIT, re-using the map idea from musical_coder and the dog name as key: package com.stackoverflow.so21326160; import com.google.common.base.Function; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import java.util.Iterator; import java.util.Map; import java.util.Set; import lombok.Data; import lombok.EqualsAndHashCode; public class App { public static void main(final String[] args) { final Map&lt;String, Dog&gt; dogsJanuary = Maps.uniqueIndex(getDogsInJanuaryFromDB(), ToName.INSTANCE); final Map&lt;String, Dog&gt; dogsFebruary = Maps.uniqueIndex(getDogsInFebruaryFromDB(), ToName.INSTANCE); final Set&lt;String&gt; commonDogNames = Sets.intersection(dogsJanuary.keySet(), dogsFebruary.keySet()); for (final String commonDogName : commonDogNames) { final Dog january = dogsJanuary.get(commonDogName); final Dog february = dogsFebruary.get(commonDogName); // use the dogs } } static enum ToName implements Function&lt;Dog, String&gt; { INSTANCE; @Override public String apply(final Dog input) { return input == null ? null : input.getName(); } } }
has comment: http://stackoverflow.com/comment/32147502
has comment: http://stackoverflow.com/comment/32147195
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32147922
answers question: http://stackoverflow.com/q/21326160
has comment: http://stackoverflow.com/comment/32147419
downvote count: 0

http://stackoverflow.com/a/21327855
type: Answer
downvote count: 0
has body: You need to pass the name of your attribute as name="isTitles" request.getParameter() understands the name of the parameter
score: 6
answers question: http://stackoverflow.com/q/21327772
upvote count: 6

http://stackoverflow.com/comment/32029872
score: 0
type: AnswerComment
has text: Yes. It is returning short stacktrace string without ability to declare ExceptionMapper for it.
type: Comment
comment on: http://stackoverflow.com/a/21259776

http://stackoverflow.com/a/21260285
accepted answer of: http://stackoverflow.com/q/21260072
has body: The main benefit of that type of code is to prevent compile-time constants from being inlined. For instance, suppose you have a constant in one class and you have many other classes refer to that constant. Normally if you change the constant value, you'd need to recompile all the classes involved. Using intern() on the field will prevent inlining of the constant and means it would be sufficient to recompile just your constant class. In theory this approach would have inferior performance, although I have no idea how significant that might be. This SO question covers the same topic and is a useful read.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32030001
type: Answer
score: 13
upvote count: 13
answers question: http://stackoverflow.com/q/21260072
has comment: http://stackoverflow.com/comment/32030034

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/21279734
tags question: http://stackoverflow.com/q/21349694
tags question: http://stackoverflow.com/q/21199600
tags question: http://stackoverflow.com/q/21241661
tags question: http://stackoverflow.com/q/21186494
tags question: http://stackoverflow.com/q/21226924
tags question: http://stackoverflow.com/q/21308623
tags question: http://stackoverflow.com/q/21335894
tags question: http://stackoverflow.com/q/21196470
tags question: http://stackoverflow.com/q/21218720
tags question: http://stackoverflow.com/q/21273124
tags question: http://stackoverflow.com/q/21333232
tags question: http://stackoverflow.com/q/21332444
tags question: http://stackoverflow.com/q/21309795
tags question: http://stackoverflow.com/q/21189208
type: Tag
tags question: http://stackoverflow.com/q/21301956
tags question: http://stackoverflow.com/q/21242528
tags question: http://stackoverflow.com/q/21219518
tags question: http://stackoverflow.com/q/21227797
tags question: http://stackoverflow.com/q/21306863
tags question: http://stackoverflow.com/q/21258477
tags question: http://stackoverflow.com/q/21230555
tags question: http://stackoverflow.com/q/21317146
tags question: http://stackoverflow.com/q/21239480
tags question: http://stackoverflow.com/q/21318450
tags question: http://stackoverflow.com/q/21331174
tags question: http://stackoverflow.com/q/21307117
tags question: http://stackoverflow.com/q/21294961
tags question: http://stackoverflow.com/q/21269462
tags question: http://stackoverflow.com/q/21348899
tags question: http://stackoverflow.com/q/21190955
tags question: http://stackoverflow.com/q/21230745
tags question: http://stackoverflow.com/q/21347816
tags question: http://stackoverflow.com/q/21189617
tags question: http://stackoverflow.com/q/21237127
tags question: http://stackoverflow.com/q/21232142
tags question: http://stackoverflow.com/q/21230874
tags question: http://stackoverflow.com/q/21189662
tags question: http://stackoverflow.com/q/21215478
tags question: http://stackoverflow.com/q/21339025
tags question: http://stackoverflow.com/q/21280356
tags question: http://stackoverflow.com/q/21215330
tags question: http://stackoverflow.com/q/21300413
tags question: http://stackoverflow.com/q/21291605
tags question: http://stackoverflow.com/q/21233308
tags question: http://stackoverflow.com/q/21232875
tags question: http://stackoverflow.com/q/21270274
tags question: http://stackoverflow.com/q/21332000
tags question: http://stackoverflow.com/q/21227412
tags question: http://stackoverflow.com/q/21299740
tags question: http://stackoverflow.com/q/21231201
tags question: http://stackoverflow.com/q/21286962
tags question: http://stackoverflow.com/q/21203218
tags question: http://stackoverflow.com/q/21295416
tags question: http://stackoverflow.com/q/21317469
tags question: http://stackoverflow.com/q/21307221
tags question: http://stackoverflow.com/q/21253529
tags question: http://stackoverflow.com/q/21294032
tags question: http://stackoverflow.com/q/21195726
tags question: http://stackoverflow.com/q/21314322
tags question: http://stackoverflow.com/q/21220019
tags question: http://stackoverflow.com/q/21208428
tags question: http://stackoverflow.com/q/21197217
tags question: http://stackoverflow.com/q/21326763
tags question: http://stackoverflow.com/q/21229689
tags question: http://stackoverflow.com/q/21259258
tags question: http://stackoverflow.com/q/21198832
tags question: http://stackoverflow.com/q/21209369
tags question: http://stackoverflow.com/q/21341999
tags question: http://stackoverflow.com/q/21303784
tags question: http://stackoverflow.com/q/21255925
tags question: http://stackoverflow.com/q/21187855
tags question: http://stackoverflow.com/q/21348006
tags question: http://stackoverflow.com/q/21214627
tag name: xml
tags question: http://stackoverflow.com/q/21312323
tags question: http://stackoverflow.com/q/21334078
tags question: http://stackoverflow.com/q/21238238
tags question: http://stackoverflow.com/q/21198411

http://stackoverflow.com/q/21241310
downvote count: 0
has title: How best should I interact with a this from Selenium Java Webdriver
tagged with: selenium-ide
possible better answer: http://stackoverflow.com/a/21241426
has answer: http://stackoverflow.com/a/21241426
favorite count: 0
tagged with: selenium-webdriver
accepted answer: http://stackoverflow.com/a/21264643
tagged with: selenium
has body: I am trying to interact with the Nike shoe online shop, login and then select a shoe size from the list and then press add to cart button from Selenium's Java WebDriver: http://store.nike.com/us/en_us/pd/air-max-2014-running-shoe/pid-830258/pgid-774364 First of all I cannot seem to find the correct &lt;li&gt; element and select it - and need some advise on how to do it. I am finding my code does not work for selecting a shoe size : pastebin.com/6K1RpPKL (as guided by the kind user on the first response.
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21264643

http://stackoverflow.com/a/21220830
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21220718
has comment: http://stackoverflow.com/comment/31961507
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31961547
has comment: http://stackoverflow.com/comment/31961227
has body: k-mera's answer is correct, but consider using switch since it's asymptomatically more effective: public static void process( Scanner j, String input ) { int a = 0, c = 0, g = 0, t = 0; String ch; while( j.hasNext() ) { switch( ch = j.next() ) { case "A": a++; break; case "C": c++; break; case "G": g++; break; case "T": t++; break; default: System.out.println("A count: " + a); System.out.println("C count: " + c); System.out.println("G count: " + g); System.out.println("T count: " + t); return; } } } Additionally I'd rather use simple ( char ) System.in.read() if you need to read char by char there's no need in polluting your heap with redundant String instances which is exactly what Scanner.next() does unless you don't tokenise the input in a custom way.

http://stackoverflow.com/a/21324066
has comment: http://stackoverflow.com/comment/32143455
downvote count: 1
has comment: http://stackoverflow.com/comment/32206192
has comment: http://stackoverflow.com/comment/32143599
has comment: http://stackoverflow.com/comment/32163772
type: Answer
has comment: http://stackoverflow.com/comment/32161477
has comment: http://stackoverflow.com/comment/32143486
has body: There's a difference between an inner class and a static inner class. A static inner class is not associated with any instance of the outer class, hence why you can't access the enclosing classes' fields. However, a non-static inner class must be constructed using an instance of the outer class. So, your test code would look like: OuterClass outer = new OuterClass(); InnerClass inner = outer.new InnerClass();//Yes, with that exact syntax! EDIT For those saying the above does not compile, here's the exact message from Eclipse when trying to instantiate InnerClass directly: No enclosing instance of type OuterClass is accessible. Must qualify the allocation with an enclosing instance of type OuterClass(e.g. x.new A() where x is an instance of OuterClass).
upvote count: 2
answers question: http://stackoverflow.com/q/21324020
has comment: http://stackoverflow.com/comment/32161852
score: 1

http://stackoverflow.com/a/21314008
type: Answer
upvote count: 1
score: 1
has body: I suspect it's a Xalan stylesheet that makes heavy use of the Xalan calling convention for external Java methods. Since this calling convention maps XML namespaces to Java classes, it can cause a proliferation of namespaces.
answers question: http://stackoverflow.com/q/21309795
downvote count: 0

http://stackoverflow.com/q/21278149
tagged with: eclipse-plugin
has answer: http://stackoverflow.com/a/21278559
tagged with: eclipse-rcp
score: 0
type: UnansweredQuestion
tagged with: java
has body: I am working on Eclipse plugin development. Can anyone point out the difference between Platform Command Framework and Platform UI Command Design I am forced to know about them, but as a beginner am unable to differentiate them both. I hope this is a valid question to be asked here. The links provided are too advanced for me.
has title: Platform Command Framework vs Platform UI Command Design
type: Question
answer count: 1

http://stackoverflow.com/comment/32041151
type: QuestionComment
comment on: http://stackoverflow.com/q/21265942
has text: `if (i==9) break;` is redundant. If you take it out, `i` will be incremented to 10 and then the loop will exit because the `i<10` condition is no longer true. Which is what you want.
score: 1
type: Comment

http://stackoverflow.com/q/21316746
has title: Can i paint with graphics g on a Jpanel and if i can how does it work?
score: -2
has answer: http://stackoverflow.com/a/21316861
has answer: http://stackoverflow.com/a/21316867
tagged with: java
downvote count: 2
tagged with: swing
has comment: http://stackoverflow.com/comment/32130124
type: UnansweredQuestion
upvote count: 0
has body: Can i paint with graphics g on a Jpanel and if i can how does it work? JPanel Game = new JPanel(); Game.setLayout(null); Game.setLocation(0,0); Game.setSize(500,700); Game.setBackground(Color.WHITE); Game.setBorder(BorderFactory.createLineBorder(Color.black)); how can i add paintcomponent on this Jpanel
favorite count: 0
type: Question
answer count: 2

http://stackoverflow.com/comment/32005097
has text: And now I put face to desk... Thanks for the heads up.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21245372
type: Comment

http://stackoverflow.com/a/21214466
answers question: http://stackoverflow.com/q/21214417
type: Answer
has comment: http://stackoverflow.com/comment/31955358
score: 0
has body: Programming with NULL layout is acceptable when you are not resizing you window or you are not using changeListeners, so avoid using the null layout. Read this

http://stackoverflow.com/comment/32112338
comment on: http://stackoverflow.com/a/21279593
has text: FWIW AttributeConverters have been standard since JPA 2.1. Any JPA 2.1 implementation provides those
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32071501
type: QuestionComment
comment on: http://stackoverflow.com/q/21246714
has text: try to print the stack trace on the console:
score: 0
type: Comment

http://stackoverflow.com/q/21312828
has title: Why Heap total in the Java memory dump analyzer does not correspond to memory settings and the total JVM usage?
type: Question
linked to: http://stackoverflow.com/q/17085538
linked to: http://stackoverflow.com/q/318942
answer count: 3
downvote count: 0
tagged with: jvm
has answer: http://stackoverflow.com/a/21314114
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/21314114
possible better answer: http://stackoverflow.com/a/21320836
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21320836
linked to: http://stackoverflow.com/q/5667705
has body: We use Eclipse memory analyzer for Java (Tomcat Web application) dump. The total heap in the resulting piechart is shown as 86 Mb. At the same time the heap limit for that JVM is set at 1.5GB and we saw the total JVM usage going up to 2.8 GB. Why the deviation is so big?
tagged with: java
has answer: http://stackoverflow.com/a/21322229
tagged with: memory
has comment: http://stackoverflow.com/comment/32140327

http://stackoverflow.com/a/21241426
has comment: http://stackoverflow.com/comment/32003639
type: Answer
has comment: http://stackoverflow.com/comment/31998155
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21241310
downvote count: 0
has comment: http://stackoverflow.com/comment/31998242
has body: First off, you should get away from the IDE if you are wanting more robust test-writing like flash. For your login issue, this is simple. Using the getting started with selenium framework your test would look like: @Config(url="http://store.nike.com/us/en_us/pd/air-max-2014-running-shoe/pid-830258/pgid-774364") public class NikeTest extends AutomationTest { @Test public void testNike() { click (By.cssSelector("div.login.nav-section > a")) .setText(By.cssSelector("form[name='login-form] input[name='email']"), "<My Username>") .setText(By.cssSelector("form[name='login-form] input[name='password']"), "<My Password>") .click (By.cssSelector("form[name='login-form] button.exp-login-submit") // now we're logged in. // let's select a size of shoe. .click (By.cssSelector("div.exp-pdp-size-and-quantity-container > a.exp-pdp-size-dropdown") // now it's expanded. .selectOptionByText(By.cssSelector("select[name='skuAndSize']"), "10.5") // you can replace 10.5 with whatever option you need. } } Those are some CSS selectors you can use. Also per your Flash thing, i think you're out of luck buddy.. I hadn't heard of any very successful solution with automating flash. One key thing here: Make sure you know what element is receiving the click. Selenium IDE doesn't do a great job determining WHAT exact element is receiving the click. My guess is that it was trying either the or when it's the that actually makes the dropdown come down.

http://stackoverflow.com/comment/31989828
has text: Answer your own question (put the comment above as an answer) and accept it, this way it will be more useful to others.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21236149

http://stackoverflow.com/a/21225852
has body: if you want to do this without extending and creating you own LinkedList class try to pass the reference of LinkedList to the Task objects when they are created. example Task class. import java.util.LinkedList; public class Task { int startTime; private LinkedList&lt;Task&gt; taskList; public Task(LinkedList&lt;Task&gt; taskList){ this.taskList = taskList; } public void calculateStartTime(){ //your logic int duration = 10; //check if this task is the last element of the list if(taskList.size() &gt; 0 &amp;&amp; taskList.getLast() != this){ int index = taskList.indexOf(this); Task nextObject = taskList.get(index + 1); if(startTime + duration &gt; nextObject.getStartTime()){ nextObject.setStartTime(startTime + duration); nextObject.calculateStartTime(); } } } public int getStartTime(){ return startTime; } public void setStartTime(int startTime){ this.startTime = startTime; } }
score: 0
has comment: http://stackoverflow.com/comment/31970927
answers question: http://stackoverflow.com/q/21225479
type: Answer

http://stackoverflow.com/comment/31996970
comment on: http://stackoverflow.com/q/21214017
score: 0
type: QuestionComment
type: Comment
has text: I dont know from where to start.This is part of my project.It will b great help if you guide me.

http://stackoverflow.com/comment/32008239
has text: Read up on integer overflow.
type: QuestionComment
score: 8
type: Comment
comment on: http://stackoverflow.com/q/21247174

http://stackoverflow.com/comment/32133749
type: Comment
has text: As far as I know Java infers them whenever it can do so, are there any reasons why it would not be able to do so? (In this case, or in general, maybe some Java versions are worse at it?)
type: AnswerComment
comment on: http://stackoverflow.com/a/21318705
score: 0

http://stackoverflow.com/comment/32166373
has text: Sorry, I have been following error messages and I have no idea what to do there.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21337069

big-o
tags question: http://stackoverflow.com/q/21212725
type: Tag
tag name: big-o

http://stackoverflow.com/comment/32178097
type: Comment
comment on: http://stackoverflow.com/a/21340930
score: 0
type: AnswerComment
has text: 'socket' cannot possibly be null at the pint you're testing it. You're not costing the socket. This code does not retry anything. -1

http://stackoverflow.com/a/21347957
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33805788
has comment: http://stackoverflow.com/comment/33846012
has comment: http://stackoverflow.com/comment/33845168
has body: If you only want to do this in your life cycle class try putting it in a @ProcessAdditions method rather than @PostContextCreate. @ProcessAdditions runs later in the life cycle just before the model is rendered. Update: Even @PostAdditions is too early to do some UI operations. You need to wait for the application start complete event. You can subscribe to this event using the event broker in the @PostContextCreate method: @PostContextCreate public void postContextContext(IEventBroker eventBroker) { eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, new AppStartupCompleteEventHandler()); } private class AppStartupCompleteEventHandler implements EventHandler { @Override public void handleEvent(final Event event) { // TODO do UI operations here } } EventHandler is org.osgi.service.event.EventHandler. Update: If you want to use injection in the event handler you must create the handler using `ContextInjectionFactory': EventHandler handler = ContextInjectionFactory.make(AppStartupCompleteEventHandler.class, context); where context is the IEclipseContext. Note: You can't use this for a non-static inner class, instead use: EventHandler handler = new AppStartupCompleteEventHandler(); ContextInjectionFactory.inject(handler, context); This method does not support injection on the constructor.
has comment: http://stackoverflow.com/comment/33804575
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21343933

http://stackoverflow.com/comment/31970780
comment on: http://stackoverflow.com/a/21226288
score: 0
has text: I'm just curious, how have you added anything new that isn't already provided by the other answers?
type: Comment
type: AnswerComment

http://stackoverflow.com/q/21223192
has body: This is my main class: package Main; import java.awt.Canvas; import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferStrategy; import java.awt.image.BufferedImage; import java.awt.image.DataBufferInt; import javax.swing.ImageIcon; import javax.swing.JFrame; import Graphics.Render; import Graphics.Screen; public class Run extends Canvas implements Runnable { private static final long serialVersionUID = 1L; private int[] pixels; private Render render; private Screen screen; private BufferedImage img; private Thread MainThread; private static Image Icon; private static final int Fps = 60; private final static int Width = 800; private final static int Height = 600; private static Boolean Running = false; public Run() { Start(); ClassLoader cl = this.getClass().getClassLoader(); Icon = new ImageIcon(cl.getResource("Resources/Textures/Icon.png")).getImage(); screen = new Screen(Width, Height); img = new BufferedImage(Width, Height, BufferedImage.TYPE_INT_RGB); pixels = ((DataBufferInt) img.getRaster().getDataBuffer()).getData(); System.out.println("[System] Main Method Successfuly Loaded"); } public void run() { while (Running == true) { MainThread.start(); Render(); Update(); } } public synchronized void Start() { Running = true; if (Running == true) { System.out.println("[System] Starting..."); } } public synchronized void Stop() { Running = false; try { MainThread.join(); } catch (InterruptedException e) { e.printStackTrace(); System.exit(0); } } public synchronized void Render() { BufferStrategy bs = this.getBufferStrategy(); if (bs == null) { createBufferStrategy(3); return; } screen.render(); for (int i = 0; i &lt; Width * Height; i++) { pixels[i] = screen.pixels[i]; } Graphics g = bs.getDrawGraphics(); g.drawImage(img, 0, 0, Width, Height, null); g.dispose(); bs.show(); } public synchronized void Update() { } public static void main(String[] args) { JFrame Frame = new JFrame(); Run Run = new Run(); Frame.add(Run); Frame.pack(); Frame.setResizab…
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31967997
has title: I have been trying to draw pixels for a 3d game and I'm not getting any errors but it doen't work
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31969522

http://stackoverflow.com/comment/31894988
has text: if `DatabaseHandler` is subclass of `SQLiteOpenHelper` than delete `db.close();` from `onCreate`
score: 0
comment on: http://stackoverflow.com/q/21184351
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21226197
score: 10
has comment: http://stackoverflow.com/comment/31971495
downvote count: 0
has body: Use java.util Arrays class. Use copyOfRange(int[] original, int from, int to) method: newValues[] = Arrays.copyOfRange(values, 2, 6);
type: Answer
answers question: http://stackoverflow.com/q/21226175
upvote count: 10
has comment: http://stackoverflow.com/comment/31971315

http://stackoverflow.com/a/21337630
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32168061
type: Answer
answers question: http://stackoverflow.com/q/21337389
has comment: http://stackoverflow.com/comment/32167875
has body: In the case it's a short task (like you commented), I'd recommend putting it within an AsyncTask as a background thread. You can control anything about this separately, which will help you also debugging it. Services are more intended for long executing tasks, so I'd not recommend it at this scope (it's a bit harder even to communicate with other Activity's. Here you'll find the AsyncTask's documentation, and here a good example. The Blocking structure depends on your needs - but I don't think you'll need that in your case. Anyway, if you would need that, there're lots of thread-safe data structures you may use, you might find this helpful.
has comment: http://stackoverflow.com/comment/32167909
upvote count: 1

http://stackoverflow.com/a/21342234
answers question: http://stackoverflow.com/q/21342160
downvote count: 0
score: 4
has body: ConcurrentHashMap will do just fine. It has internal synchronization to prevent these sorts of problems. It also has other methods that you may find helpful, such as putIfAbsent. Its main disadvantage relative to Collections.synchronizedMap is a larger memory footprint.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32176534
type: Answer
accepted answer of: http://stackoverflow.com/q/21342160
upvote count: 4

http://stackoverflow.com/a/21341917
type: Answer
score: 2
downvote count: 0
has body: You can e.g. change your method to public static List&lt;String&gt; isValidFile(File file) When the file is valid return an empty list or null, otherwise return a list with the validation problems. The return value is your indication if validation failed or not.
accepted answer of: http://stackoverflow.com/q/21341864
upvote count: 2
answers question: http://stackoverflow.com/q/21341864
type: AcceptedAnswer

http://stackoverflow.com/q/21241074
tagged with: selenium-webdriver
score: 3
downvote count: 0
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/61712275
has answer: http://stackoverflow.com/a/31443294
type: Question
answer count: 2
tagged with: flash
favorite count: 0
upvote count: 3
linked to: http://stackoverflow.com/q/19329958
has body: I am aware a bunch of similar questions such as (Interact flash elements using WebDriver) have been asked in the past however it is still not clear how best to interact with a Flash Element on a page in association with Selenium's Java WebDriver. By default I know it doesnt support Flash, so I use it to log onto the site which is fine. Now I need to interact with a flash element as seen on this page : http://store.nike.com/us/en_us/product/free-tr-4-id/?piid=34979&amp;pbid=517639039 I want to be able to pick a shoe size from the Flash on the left hand side of the page, and then click the add to cart button. Can anybody who has achieved this please offer their guidance and opinion on the best way. I have tried https://code.google.com/p/flash-selenium/ however this appears to be old, or not compatible with the new Java WebDriver.
has comment: http://stackoverflow.com/comment/61711916
has title: How best should I interact with Flash from Selenium Java WebDriver
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21244083

http://stackoverflow.com/comment/31976728
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21229779
has text: But when i change the Position of the parent Frame then the position of the Dialog is not changing. :(
type: AnswerComment

http://stackoverflow.com/comment/32139899
has text: Thanks for the input, I tried putting Intent data = getIntent().getExtras(); into the onCreate method and got the error to switch the data type to a bundle. So I made it Intent data = getIntent(); data.getExtras(); but there was no change in my app, any suggestions?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21320602

http://stackoverflow.com/comment/31898724
type: QuestionComment
has text: It can also mean that your firewall is blocking it.
comment on: http://stackoverflow.com/q/21185834
score: 0
type: Comment

http://stackoverflow.com/comment/32022403
has text: @ymene you can make them static and they will be created when the class is loaded/application starts. Even if they are not static, creating objects in Java is usually very cheap, especially one like this.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21255505
type: Comment

http://stackoverflow.com/q/21218109
has title: JPA -create table by jpaql
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21218367
tagged with: java
tagged with: hibernate
type: Question
score: 0
has body: i want to write query that create or alter table and run it any relational database (which supports JDBC) without modification. for example "create table employee( name varchar(250), personalNo varchar(245) )" can JPA run it underlying DB? is there any other method for this?
tagged with: jpa
answer count: 1
tagged with: mybatis
accepted answer: http://stackoverflow.com/a/21218367

http://stackoverflow.com/q/21250183
has answer: http://stackoverflow.com/a/41520279
downvote count: 0
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/8636806
has answer: http://stackoverflow.com/a/21250315
score: 13
tagged with: hql
type: Question
has answer: http://stackoverflow.com/a/47469325
upvote count: 13
has title: how to update the table in java using hibernate without using hql and sql
has answer: http://stackoverflow.com/a/21250363
favorite count: 0
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21255673
has body: I have tried a lot to update my table using hql but i didn't find the solution , i have searched on internet too, I am new in java and hibernate please help me to find the solution. my code is written below. session.getTransaction().begin(); Query query = session.createQuery("update DocDetail set DocName = :docname" + " where Id = :docId"); query.setParameter("docname", "Jack"); query.setParameter("docId", 3); int result = query.executeUpdate(); session.getTransaction().commit(); but I got the following error. Exception in thread "AWT-EventQueue-0" org.hibernate.QueryException: query must begin with SELECT or FROM: update [update clinic.entity.DocDetail set DocName = :studentName where Id = :studentId] at org.hibernate.hql.classic.ClauseParser.token(ClauseParser.java:106) at org.hibernate.hql.classic.PreprocessingParser.token(PreprocessingParser.java:131) at org.hibernate.hql.classic.ParserHelper.parse(ParserHelper.java:51)

http://stackoverflow.com/q/21347141
has answer: http://stackoverflow.com/a/21347159
score: -1
has comment: http://stackoverflow.com/comment/32185208
has comment: http://stackoverflow.com/comment/32185199
answer count: 3
linked to: http://stackoverflow.com/q/513832
upvote count: 0
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
has body: The method I'm hoping to execute doesn't acknowledge whenever a "y" is inputed into the scanner. It doesn't execute the first part of the if statement, it immediately skips to the else. I'm not sure why it isn't working, is it because I have several scanners running at once? The goal is to use the for loop to store several answers into an array and then manipulate the array with another method. any help to why would be great! private static float[] assignMarkArray = {0,0,0}; public static void setAssignMark(int index, float value) { assignMarkArray[index] = value; } public static void setLabMark (int index, float value) { labMarkArray[index] = value; } public static void enterAssignGrades() { System.out.println("Do you have any assignment Marks? (y/n)"); Scanner sc = new Scanner(System.in); String input = sc.nextLine(); if (input == "y"){ for(int q = 0; q &lt; 3; q++) { System.out.println("Do you have a mark for A" + (q+1) + "(y/n)"); Scanner sc2 = new Scanner(System.in); String input2 = sc2.nextLine(); if (input2 == "y") { System.out.println("Enter your A" + (q+1) + " mark (Out of 100%): " ); Scanner sc3 = new Scanner(System.in); float gradeInput2 = sc3.nextFloat(); setAssignMark(q, gradeInput2); }else if (q==3) { sc.close(); sc2.close(); } else{ setAssignMark(q, 0); } } } else{ System.out.println("There are no assignment grades to mark"); sc.close(); } }
accepted answer: http://stackoverflow.com/a/21347159
has answer: http://stackoverflow.com/a/21347190
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32185255
has comment: http://stackoverflow.com/comment/32185233
tagged with: java
possible better answer: http://stackoverflow.com/a/21347190
has title: Why won't the if statement execute in my for loop?
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32185202
has answer: http://stackoverflow.com/a/21347188

http://stackoverflow.com/comment/31987330
type: QuestionComment
has text: First of all, I would fix `Uzer-Agent` with `User-Agent`. Then, you should not attempt to write a binary file with a `PrintWriter`, which is intended for text. Use a `OutputStream` instead.
score: 2
comment on: http://stackoverflow.com/q/21235663
type: Comment

http://stackoverflow.com/comment/32158036
score: 0
type: Comment
type: QuestionComment
has text: sounds fine for me, but how? I'm really new in this area... tell me how to get xml with soap, and how to test it... thanks
comment on: http://stackoverflow.com/q/21332364

http://stackoverflow.com/a/21302080
score: 0
answers question: http://stackoverflow.com/q/21297321
type: Answer
has body: Replacing while loop from your Java code with below seems to give "PT" as output. `while(cursor.hasNext()) { DBObject campaignDBO = cursor.next(); campaignJson = campaignDBO.get("activeCampaigns").toString(); int labelInt = campaignJson.indexOf("PT", -1); String label = campaignJson.substring(labelInt, labelInt+2); System.out.println(label); }`

http://stackoverflow.com/comment/32000681
has text: In theory throwing `null` might have been more efficient NPE (as noted by Peter http://stackoverflow.com/a/6591924/318174). I don't recall where I saw it and I can't seem to google the code.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21242696

http://stackoverflow.com/comment/32095664
has text: It definitely seems like something is getting messed up when I send the string to the server and back from the server. I'll look into it. Thank you for your help!
comment on: http://stackoverflow.com/a/21296844
type: AnswerComment
score: 0
type: Comment

pixel
tags question: http://stackoverflow.com/q/21316634
type: Tag
tags question: http://stackoverflow.com/q/21286695
tag name: pixel

http://stackoverflow.com/a/21204157
has comment: http://stackoverflow.com/comment/31931105
has comment: http://stackoverflow.com/comment/31931533
answers question: http://stackoverflow.com/q/21204099
has body: Just change your method signature to: public static String numberOfCharacters(String[] str, char a) { ///code }
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/21259918
has comment: http://stackoverflow.com/comment/32029555
has body: I want to store 4 Lists of Strings to an array within index 0-3 and be able to check wether the index is filled (!=null) or not. For that reason I need to initialize an Array of Type List, which fails in eclipse with message "Cannot create a generic array of List": // Does not work List&lt;String&gt;[] myArray = new List&lt;String&gt;[4]; // Does not work List&lt;String&gt;[] myArray = new ArrayList&lt;String&gt;[4]; Doing it like promoted at Convert an ArrayList to an object array : ArrayList&lt;List&lt;String&gt;&gt; myArrayList = new ArrayList&lt;List&lt;String&gt;&gt;(); myArrayList.add(new ArrayList&lt;String&gt;()); myArrayList.add(new ArrayList&lt;String&gt;()); myArrayList.add(new ArrayList&lt;String&gt;()); myArrayList.add(new ArrayList&lt;String&gt;()); // Does not work List&lt;String&gt;[] myArray = myArrayList.toArray(new List&lt;String&gt;[myArrayList.size()]); // Does not work List&lt;String&gt;[] myArray = myArrayList.toArray(new ArrayList&lt;String [myArrayList.size()]); But why is this not working?
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/32029328
has comment: http://stackoverflow.com/comment/32029505
linked to: http://stackoverflow.com/q/2745338
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/32029348
has title: Initialize an Array of List<String> Objects
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32029404
has answer: http://stackoverflow.com/a/21260026
has comment: http://stackoverflow.com/comment/32029344
linked to: http://stackoverflow.com/q/10227201
linked to: http://stackoverflow.com/q/5662394
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32032527

http://stackoverflow.com/a/27014983
type: Answer
score: 0
has body: The last answer is absolutely correct, however a fast track way is to delete the project reference from eclipse (make sure to keep unchecked delete source) and import your project folder again. This way the project configurations are reset by eclipse using the new jdk. But a wonderful post it did help me.
answers question: http://stackoverflow.com/q/21296620

http://stackoverflow.com/q/21227954
score: 1
favorite count: 0
has body: My apologize, I have a class on my Project, called test01.java. And i used the library from Tadaki Graphlib contained many class. On of them is Graph.java. Test01.java: public class test01 extends Graph{ public test01(String name, int n) { super(name); public test01(String name, int n) { super(name); graphLib.Vertex vList[] = new graphLib.Vertex[n]; for (int i = 0; i &lt; n; i++) { vList[i] = new graphLib.Vertex(String.valueOf(i)); addVertex(vList[i]); } int deg = 0; System.out.println("&lt;---------- Random val ----------&gt;"); addArc(vList[0], vList[1], String.valueOf(0)); deg++; addArc(vList[1], vList[0], String.valueOf(1)); deg++; System.out.println("Vertex-0 with Vertex-1"); System.out.println("Vertex-1 with Vertex-0"); int k = 2; int l; int m=0; Random randomval = new Random(); int isAvailInt [] = new int[n]; while (k&lt;n) { for(l=0;l&lt;k;l++){ isAvailInt [l]= Integer.parseInt(vList[l].toString()); m=isAvailInt[l]; } int chosen = randomval.nextInt(m); addArc(vList[k], vList[chosen], String.valueOf(k)); System.out.println("Vertex-"+k+" with Vertex-"+chosen+ " exp = " + String.valueOf(k)); k++; } }public static void main(String args[]) { int n; String num = JOptionPane.showInputDialog("Masukkan nilai jumlah iterasi = "); String degnum = null; n = Integer.parseInt(num); int deg []= new int [n]; test01 t = new test01("test",n); System.out.println("&lt;---------- Vertex-i = Degree-i ------------&gt;"); graphLib.Graph g= new Graph("test"); int [][]adj = g.getAdjacent(); System.out.println(adj[0][0]); for (int i=0; i&lt;t.getSize();i++){ for (int j=0; j&lt;t.getSize();j++){ } }} and one other class called Graph.java public class Graph extends GraphBase { int adjacent[][] = null; public Graph(String name) { this.name = name; vertexes = Utils.createVertexList(); arcs = Utils.createArcList(); a2vHead = new HashMap&lt;&gt;(); a2vTail = new HashMap&lt;&gt;(); v2a = new HashMap&lt;&gt;(); } public int[][] getAdjacent() { int n = vertexes.size(); adjacent = new int[n][];…
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21228030
tagged with: java
has answer: http://stackoverflow.com/a/21228037
has title: How to get array method from another array method from the other class
tagged with: methods
type: Question
answer count: 2
tagged with: arrays
downvote count: 0

hql
tag name: hql
tags question: http://stackoverflow.com/q/21255625
tags question: http://stackoverflow.com/q/21215693
tags question: http://stackoverflow.com/q/21223445
tags question: http://stackoverflow.com/q/21311450
tags question: http://stackoverflow.com/q/21250183
tags question: http://stackoverflow.com/q/21282731
type: Tag
tags question: http://stackoverflow.com/q/21265637
tags question: http://stackoverflow.com/q/21236759
tags question: http://stackoverflow.com/q/21269203
tags question: http://stackoverflow.com/q/21263170
tags question: http://stackoverflow.com/q/21259549

http://stackoverflow.com/comment/31973630
type: AnswerComment
has text: documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setValidating(false); documentBuilderFactory.setNamespaceAware(true); documentBuilderFactory.setIgnoringElementContentWhitespace(true); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); documentBuilder.setErrorHandler(new SimpleErrorHandler()); InputStream inputStream = new FileInputStream(xmlFile); InputSource inputSource = new InputSource(new InputStreamReader(inputStream, "utf-16")); documentBuilder.parse(inputSource);
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21227824

http://stackoverflow.com/q/21327012
has title: Execute multiple queries using a single JDBC Statement object
possible better answer: http://stackoverflow.com/a/21327137
downvote count: 0
has body: In JDBC, can I use single Statement object to call executeQuery(&quot;&quot;) multiple times? Is it safe? Or should I close the statement object after each query, and create new object for executing another query. E.G: Connection con; Statement s; ResultSet rs; ResultSet rs2; try { con = getConnection(); // Initially I was creating the Statement object in an // incorrect way. It was just intended to be a pseudocode. // But too many answerers misinterpretted it wrongly. Sorry // for that. I corrected the question now. Following is the // wrong way, commented out now. // s = con.prepareStatement(); // Following is the way which is correct and fits for my question. s = con.createStatement(); try { rs = s.executeQuery(&quot;.......................&quot;); // process the result set rs } finally { close(rs); } // I know what to do to rs here // But I am asking, should I close the Statement s here? Or can I use it again for the next query? try { rs2 = s.executeQuery(&quot;.......................&quot;); // process the result set rs2 } finally { close(rs2); } } finally { close(s); close(con); }
favorite count: 0
has answer: http://stackoverflow.com/a/21332157
answer count: 5
tagged with: sql
has comment: http://stackoverflow.com/comment/32157472
tagged with: jdbc
upvote count: 29
has comment: http://stackoverflow.com/comment/117743969
score: 29
accepted answer: http://stackoverflow.com/a/21332157
has answer: http://stackoverflow.com/a/21327506
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21327383
tagged with: java
has answer: http://stackoverflow.com/a/21327137
tagged with: mysql
has answer: http://stackoverflow.com/a/21327262

notnull
type: Tag
tags question: http://stackoverflow.com/q/21268392
tag name: notnull

http://stackoverflow.com/a/21270856
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21247104
has comment: http://stackoverflow.com/comment/32174758
has comment: http://stackoverflow.com/comment/32092011
has body: You need to create the JComboBox and add an ActionListener to it. Not create the ActionPerformed and inside that set the JComboBox. Try it like this: // fill with values from ResultSet rs (however you obtain it) ArrayList&lt;String&gt; schools = new ArrayList&lt;String&gt;(); while(rs.next()) schools.add(rs.getString("SchoolName")); // create the JComboBox final JComboBox&lt;String&gt; selectSchool = new JComboBox&lt;String&gt;(schools.toArray(new String[]{})); // add an actionlistener selectSchool.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // do something with e.g. printing the selection String school = (String) selectSchool.getSelectedItem(); System.out.println("You selected " + school); } }); edit: Or in a complete, very simple but working example: package sto; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import javax.swing.JComboBox; import javax.swing.JFrame; public class Main { public static void main(String[] args) { // create school list (in your example here would be the ResultSet) ArrayList&lt;String&gt; schools = new ArrayList&lt;String&gt;(); schools.add("School 1"); schools.add("School 2"); schools.add("School 3"); schools.add("School 4"); // create the JComboBox final JComboBox&lt;String&gt; selectSchool = new JComboBox&lt;String&gt;(schools.toArray(new String[]{})); // add an actionlistener selectSchool.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // do something with e.g. printing the selection String school = (String) selectSchool.getSelectedItem(); System.out.println("You selected " + school); } }); // create a JFrame and add the JComboBox JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(selectSchool); frame.pack(); frame.setVisible(true); } }
has comment: http://stackoverflow.com/comment/32174133

http://stackoverflow.com/comment/32114960
comment on: http://stackoverflow.com/a/21307495
has text: not really as what i need is PropertySources coming from several different places, not only from property files, and locations are only for class path resources.. i think this is what was already there before introducing PropertySourcesPlaceholderConfigurer in Spring 3.1 .. i wanted to utilize this new class in some clever way now..
score: 0
type: AnswerComment
type: Comment

performance
tags question: http://stackoverflow.com/q/21206962
tags question: http://stackoverflow.com/q/21257904
tags question: http://stackoverflow.com/q/21288440
tags question: http://stackoverflow.com/q/21289922
tags question: http://stackoverflow.com/q/21305334
tags question: http://stackoverflow.com/q/21191775
tags question: http://stackoverflow.com/q/21294241
tags question: http://stackoverflow.com/q/21219991
tags question: http://stackoverflow.com/q/21205883
tags question: http://stackoverflow.com/q/21233956
tags question: http://stackoverflow.com/q/21347670
tags question: http://stackoverflow.com/q/21211310
tags question: http://stackoverflow.com/q/21268239
tags question: http://stackoverflow.com/q/21208209
tags question: http://stackoverflow.com/q/21319128
tags question: http://stackoverflow.com/q/21335880
tags question: http://stackoverflow.com/q/21257162
tags question: http://stackoverflow.com/q/21229723
tags question: http://stackoverflow.com/q/21227665
tags question: http://stackoverflow.com/q/21340354
tags question: http://stackoverflow.com/q/21217883
tags question: http://stackoverflow.com/q/21241036
tags question: http://stackoverflow.com/q/21231135
tags question: http://stackoverflow.com/q/21257037
tags question: http://stackoverflow.com/q/21206655
tags question: http://stackoverflow.com/q/21314284
tags question: http://stackoverflow.com/q/21193766
tags question: http://stackoverflow.com/q/21187196
tags question: http://stackoverflow.com/q/21281668
tag name: performance
tags question: http://stackoverflow.com/q/21198799
tags question: http://stackoverflow.com/q/21318396
tags question: http://stackoverflow.com/q/21193657
tags question: http://stackoverflow.com/q/21342555
tags question: http://stackoverflow.com/q/21313177
tags question: http://stackoverflow.com/q/21329099
tags question: http://stackoverflow.com/q/21305107
type: Tag
tags question: http://stackoverflow.com/q/21215091
tags question: http://stackoverflow.com/q/21300132
tags question: http://stackoverflow.com/q/21199391
tags question: http://stackoverflow.com/q/21219777

http://stackoverflow.com/comment/32010331
score: 0
type: QuestionComment
type: Comment
has text: @HeronYang Yes, there is a big difference between running on Android and running on official Java platforms. Android is a copy of Java, but is not an official implementation and has not passed the requisite compatibility tests. The Android libraries are very close copies but not exact clones of Java. You should add a tag to the question for 'Android'.
comment on: http://stackoverflow.com/q/21235279

http://stackoverflow.com/a/21283599
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21283527
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21283527
has body: EditText x = (EditText) findViewById(R.id.myEditT); String your_text = x.getText().toString();

http://stackoverflow.com/comment/32012995
score: 2
type: Comment
type: QuestionComment
has text: Can you give an example input and an example wrong output?
comment on: http://stackoverflow.com/q/21250041

http://stackoverflow.com/comment/32022504
type: Comment
has text: It gives me 'null'. I don't know how to make it return the right result of the addition.
comment on: http://stackoverflow.com/q/21255878
score: 0
type: QuestionComment

http://stackoverflow.com/a/21259865
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21258880
has comment: http://stackoverflow.com/comment/32032211
upvote count: 3
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/44197831
accepted answer of: http://stackoverflow.com/q/21258880
has comment: http://stackoverflow.com/comment/32069299
has body: Auto deploy directory should be set in portal-ext.properties not in portal-setup-wizard.properties. Also I was missing app.server.parent.dir in build.user.properties file. It should be app.server.parent.dir=D:\Projects\Site\liferay-portal-6.2.0-ce-ga1

export
tags question: http://stackoverflow.com/q/21345779
type: Tag
tag name: export
tags question: http://stackoverflow.com/q/21231649

http://stackoverflow.com/a/21210372
has comment: http://stackoverflow.com/comment/31944601
type: Answer
has body: (Stack Overflow says this is too long to post as a comment, so posting it as an answer instead.) I thought a bit about what you're trying to do, and can't figure out what the motivation is. So now I'm curious. If you're receiving the object from some other piece of code and want it to be @Valid, you should be validating it before doing anything with it; not when calling save() or update(). You can either directly pass it to a validator or use the new method constraint support in Hibernate Validator 5 which will give you method validation using proxies. If you're constructing the object yourself and are trying to catch code errors when you persist, that's a code smell. Why don't you have constructors or builders that prevent the construction of an invalid entity in the first place? And if you do have them but just want the double check when you persist, what difference would it make if the failures happen at save() time or at transaction commit, since the whole thing should roll back anyway? You should also keep in mind that Hibernate does transactional write-behind and saves are deferred in the hope that they can be merged together to reduce chatter with the database. So if you want validation as a side-effect of saving, you should also expect that validation to be deferred or you're messing with semantics. Anyway, I'd try HV5 method constraints at the DAO level and skip the custom validator as a first approach.
answers question: http://stackoverflow.com/q/21208594
has comment: http://stackoverflow.com/comment/31945443
has comment: http://stackoverflow.com/comment/31944457
score: 0
has comment: http://stackoverflow.com/comment/31956523
has comment: http://stackoverflow.com/comment/31945408

http://stackoverflow.com/a/21295002
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32124412
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21294900
has comment: http://stackoverflow.com/comment/32129090
answers question: http://stackoverflow.com/q/21294900
has comment: http://stackoverflow.com/comment/32117686
upvote count: 2
has body: for(Annotation a : injectionPoint.getQualifiers()) { if(a instanseof MyCar) { MyCar myCar = (MyCar) a; a.mpg(); } }
type: AcceptedAnswer

http://stackoverflow.com/comment/31922437
has text: What specific 'new things' were of interest to you?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21199058

http://stackoverflow.com/a/21337030
has comment: http://stackoverflow.com/comment/32187963
has comment: http://stackoverflow.com/comment/32171497
has comment: http://stackoverflow.com/comment/32167023
has comment: http://stackoverflow.com/comment/32262240
downvote count: 0
type: Answer
has body: The following program works for me: Scanner scanner = new Scanner(dataFile); String line; int i = 0; while(scanner.hasNextLine()){ line = scanner.nextLine(); // System.out.println(line); // remove comment for debug i++; } System.out.println(i); scanner.close(); The changes from the original program are: Changed hasNext() and next() to hasNextLine() and nextLine(). In this case the default delimiter is fine Fixed a typo - system.out.println should be System.out.println Added a comment to print line (and check if the delimiter is OK) Added scanner.close()
answers question: http://stackoverflow.com/q/21336425
has comment: http://stackoverflow.com/comment/32166823
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32255189

http://stackoverflow.com/a/21216515
has comment: http://stackoverflow.com/comment/31953296
answers question: http://stackoverflow.com/q/21216420
has comment: http://stackoverflow.com/comment/31953141
upvote count: 1
has comment: http://stackoverflow.com/comment/31953368
score: 1
has comment: http://stackoverflow.com/comment/31953083
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31953198
type: Answer
accepted answer of: http://stackoverflow.com/q/21216420
has body: You should put the logic of determining whether or not check the checkbox inside your getView() override. You should not use the personHolder class anywhere outside the adapter - it is for it's use only in recycling views.

http://stackoverflow.com/a/21312306
score: 1
answers question: http://stackoverflow.com/q/21245687
accepted answer of: http://stackoverflow.com/q/21245687
type: AcceptedAnswer
downvote count: 0
has body: I've asked the Singleton is not set exception in the official weld forum and it is a bug in the docs. As you did, you should use the 'original' org.jboss.weld.environment.servlet.Listener.
type: Answer
upvote count: 1

tcp
tags question: http://stackoverflow.com/q/21291081
type: Tag
tags question: http://stackoverflow.com/q/21233586
tags question: http://stackoverflow.com/q/21218312
tags question: http://stackoverflow.com/q/21211235
tags question: http://stackoverflow.com/q/21274162
tags question: http://stackoverflow.com/q/21309266
tags question: http://stackoverflow.com/q/21205024
tags question: http://stackoverflow.com/q/21273887
tags question: http://stackoverflow.com/q/21255106
tags question: http://stackoverflow.com/q/21309553
tags question: http://stackoverflow.com/q/21215840
tag name: tcp

http://stackoverflow.com/comment/32104590
type: Comment
comment on: http://stackoverflow.com/a/21190872
has text: Actually my bullet, just for optical reason, is half the width and half the height of the Player and only 6 times as fast. So it can'T really be realised as a point i think. But i will have a look at the method. Thanks
score: 0
type: AnswerComment

http://stackoverflow.com/a/21283455
downvote count: 0
score: 1
has body: First of all you should make Shared immutable: class Shared{ private final String a; private final int b; //constructor, getters and NO setters } And if you have only one writer you can safely use volatile, there is no need in AtomicRefference. At the point where information is updated old object should not be modified, but rather a new created and assigned to a volatile refference.
has comment: http://stackoverflow.com/comment/32072618
has comment: http://stackoverflow.com/comment/32077580
has comment: http://stackoverflow.com/comment/32071023
has comment: http://stackoverflow.com/comment/32071869
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32101480
accepted answer of: http://stackoverflow.com/q/21283293
answers question: http://stackoverflow.com/q/21283293
type: Answer
has comment: http://stackoverflow.com/comment/32071167
has comment: http://stackoverflow.com/comment/32071089
has comment: http://stackoverflow.com/comment/32071260

http://stackoverflow.com/comment/31959649
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21192879
has text: @KaPra I added JSON request now.
score: 0

http://stackoverflow.com/comment/32037273
has text: yes they are both the same I just redacted the name earlier on.
comment on: http://stackoverflow.com/q/21263341
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31994248
has text: @csmckelvey So 65-90 would be the letters I'm looking for (Upper-case) any websites or anything that could show me how to integrate that into code? I don't wanna be taking up all your time with questions.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21239146
type: Comment

http://stackoverflow.com/a/21342263
answers question: http://stackoverflow.com/q/21334559
score: 0
type: Answer
has body: Sorry my mistake i forgot to send "\r\n" with each message.

http://stackoverflow.com/comment/104135510
type: Comment
comment on: http://stackoverflow.com/a/21226540
score: 2
has text: @theprogrammer Sure, you can think of it that way. It's special in the same way that `Content-Length` is special in that it's included in the specification(s).
type: AnswerComment

http://stackoverflow.com/a/21251260
accepted answer of: http://stackoverflow.com/q/21251134
has comment: http://stackoverflow.com/comment/32015210
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32015167
answers question: http://stackoverflow.com/q/21251134
upvote count: 14
type: Answer
has body: Compound operations are unsafe in concurrent environment. What compound operations are you performing? 1) You are checking whether Map contains a vector for a key 2) You are putting a new Vector if no value is found So this is a two step action and is compound, so it is unsafe. Why are they not safe? Because they are not atomic. Think of a scenario in which you have two threads. Consider this timeline: Thread 1 --- checks for == null -&gt; true puts a new Vector Thread 2 --- checks for ==null -&gt; true puts a new Vector Use putIfAbsent() method on ConcurrentHashMap, which provides you an atomic solution to what you are trying to perform. ConcurrentHashMap#putIfAbsent() References: Proper use of putIfAbsent
has comment: http://stackoverflow.com/comment/32015465
downvote count: 0
score: 14

http://stackoverflow.com/comment/32045183
score: 2
has text: Not here, edit your question.
comment on: http://stackoverflow.com/q/21268343
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21236640
has body: Seems like you're missing the dependency version in your pom.xml
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21236493

http://stackoverflow.com/a/48900817
answers question: http://stackoverflow.com/q/21185156
upvote count: 4
has body: I found a solution that worked for me, the stacktrace has more to it than this line: Graphics Device initialization failed for : es2, sw. scroll up and you will find a line that looks like follow: Caused by: java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/libglass.so Now download the new jdk from oracle, copy the missing file from there into the folder where the file is missing. I was missing 3 files in total that i copied, this may vary from person to person Hope this helps some of you guys
downvote count: 0
type: Answer
score: 4

http://stackoverflow.com/a/21246179
score: 4
accepted answer of: http://stackoverflow.com/q/21246036
has body: You need to understand resources which is what you will want to use. They are located relative to the class files. If the images are with the class files, then get your image as a resource Create an ImageIcon from the Image. i.e., something like: package whateverpackeyouareusing; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JOptionPane; public class DefaultFoo { public static void main(String[] args) throws IOException { String resource = "x.png"; URL url = Class.class.getResource(resource); BufferedImage img = ImageIO.read(url); Icon icon = new ImageIcon(img); JOptionPane.showMessageDialog(null, icon); } } Edit: A better example per Andrew Thompson: package some.package; import java.awt.Image; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JOptionPane; public class PlayWithImages { public static final String X_RESOURCE = "x.png"; private Icon xIcon; public PlayWithImages() throws IOException { URL xImgUrl = getClass().getResource(X_RESOURCE); Image xImg = ImageIO.read(xImgUrl); xIcon = new ImageIcon(xImg); } public Icon getXIcon() { return xIcon; } public static void main(String[] args) { try { PlayWithImages playWithImages = new PlayWithImages(); Icon xIcon = playWithImages.getXIcon(); JOptionPane.showMessageDialog(null, xIcon); } catch (IOException e) { e.printStackTrace(); } } }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32008164
type: Answer
has comment: http://stackoverflow.com/comment/32008080
has comment: http://stackoverflow.com/comment/32007621
has comment: http://stackoverflow.com/comment/32007440
answers question: http://stackoverflow.com/q/21246036
has comment: http://stackoverflow.com/comment/32008107
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/32046580
score: 0
type: Comment
has text: @Haven: It would be `List<List<MapView>>`, but you'd need to initialize sub-lists etc - it does get to be a bit of a pain. If the lengths are fixed, an array may well be simpler.
comment on: http://stackoverflow.com/a/21268770
type: AnswerComment

http://stackoverflow.com/q/21318528
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32134200
has title: Formatting mathematical functions
has comment: http://stackoverflow.com/comment/32133903
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I have whole bunch of mathematical functions being output from a program in this format: (704253724578.0182000000000000 .* (mydivide (mydivide (mydivide (mysqrt (- X13 X11)) (mydivide X18 X15)) (* (square (mydivide (* X1 X20) X19)) X2)) (mydivide (* (* X1 X20) (mydivide X25 X15)) X9))) + 77.2424201451314200 I need to write a script to convert them into somewhat readable formats like this: (704253724578.0182000000000000 * ( ((sqrt(X13-X11) / (X18/X15)) /((((X1*X20)/X19)^2) * X2))/ (((X1 * X20) * (X25 / X15)) / X9)) ) + 77.2424201451314200 Any ideas on what is the best way to go about doing this in java? Or are there any other better tools to do this besides java? Thanks!
has comment: http://stackoverflow.com/comment/32135861
has answer: http://stackoverflow.com/a/21319623
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32133443
favorite count: 0

http://stackoverflow.com/comment/40960016
type: Comment
comment on: http://stackoverflow.com/a/21722062
has text: Would you mind posting the full build log? The `subprocess` module might be failing because it's trying to run a program that doesn't exist.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31962713
type: Comment
has text: @Dark_Prince Yes, you can. I've updated my answer to cover that.
score: 2
comment on: http://stackoverflow.com/a/21220944
type: AnswerComment

http://stackoverflow.com/comment/31960843
has text: Thanks! I knew I was missing something. Do you have any suggestions for how to calculate an end statement to the game?
comment on: http://stackoverflow.com/a/21220699
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21231950
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21231909
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21231909
has body: You have to import jar manually to mvn repository: mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion= -Dpackaging=<packaging> , and then reference it within your pom: group-id artifact-id version jar
type: Answer

http://stackoverflow.com/a/21244901
has body: Without seeing the contents of TestShipment.java, I'll assume you have some dependency on the Shipment and ShipmentHW1 classes. As such, when you execute a program that uses the TestShipment class, you need to have the .class files for each of the three (and any other dependencies). So you will have to compile Shipment.java and ShipmentHW1.java as well before running your java command. If they are in the same package, you're good, if not, you will have to specify an appropriate value for the -cp option. When running java with a class name, you need to specify the fully qualified class name.
has comment: http://stackoverflow.com/comment/32004165
has comment: http://stackoverflow.com/comment/32004222
answers question: http://stackoverflow.com/q/21244748
score: 0
type: Answer

http://stackoverflow.com/comment/32146535
has text: They're actually spaces, not blanks. The format `"%" + numberOfBits + "s"` gives me a String of `numberOfBits` spaces (the `"s"` being space) and then the `replace` replaces the spaces with zeros, because where all the spaces are I will need zeros.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21325625

http://stackoverflow.com/comment/32017471
comment on: http://stackoverflow.com/a/21252588
type: AnswerComment
has text: @PaulVerest Mark the answer correct if it helped you. So that others can come to know which is the correct answer of the question.
score: 0
type: Comment

http://stackoverflow.com/comment/32185025
score: 0
has text: @JoshM Good call. Added it.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21346992

http://stackoverflow.com/q/21334778
has answer: http://stackoverflow.com/a/21336118
tagged with: heap-memory
tagged with: processbuilder
tagged with: out-of-memory
type: UnansweredQuestion
has body: I am working on a Java Web Application based on Java 6/Tomcat 6.0. It's a web based document management system. The customers may upload any kind of file to that web application. After uploading a file a new Thread is spawned, in which the uploaded file is analyzed. The analysis is done using a third party library. This third-party-libraries works fine in about 90% of the analyze-jobs, but sometimes (depending on the uploaded file) the logic starts to use all remaining memory, leading to an OutOfMemoryError. As the whole application is running in a single JVM, the OoM-Error is not only affecting the analyze-jobs, but has also impact on other features. In the worst case scenario, the application crashes completely or remains in an inconsistent state. I am now looking for a rather quick (but safe) way to handle those OoM-Errors. Replacing the library currently is no option (that's why I have neither mentioned the name of the library, nor what kind of analysis is done). Does anybody have an idea of what could be done to work around this error? I've been thinking about launching a new process (java.lang.ProcessBuilder) to have a new JVM. If the third-party-lib causes an OoM-Error there, it would not have effects on the web application. On the other hand, this would cause additional effort to synchronize the new Process with the Analysis-Part of the web application. Does anybody have any experience with such a system (especially with regards to the stability of the system)? Some more information: 1) The analysis part can be summarized as a kind of text extraction. The module receives a file reference as input and writes the analysis result into a text file. The resulting text-file is further processed within the web applications business logic. Currently the workflow is synchronous. The business logics waits for the third-party-lib to complete its job. There is no queuing or other asynchronous approach. 2) I am quite sure that the third-party-library causes the OoM-Error…
type: Question
has answer: http://stackoverflow.com/a/21335004
tagged with: java
has title: Workaround for handling expectable java.lang.OutOfMemoryError: Java heap space
score: 4
upvote count: 4
answer count: 2
downvote count: 0
tagged with: jvm
favorite count: 0

http://stackoverflow.com/q/21233138
linked to: http://stackoverflow.com/q/21231251
has comment: http://stackoverflow.com/comment/31982742
tagged with: generics
duplicate of: http://stackoverflow.com/q/21231251
upvote count: 3
possible better answer: http://stackoverflow.com/a/21233249
downvote count: 1
has answer: http://stackoverflow.com/a/21233249
has title: Why can't I add an instance of A to a collection declared as Set<? extends A>?
score: 2
linked to: http://stackoverflow.com/q/2776975
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21233181
has body: I have: class Document { ... } class DocumentCluster extends Document { ... } And I'm trying to define a set of documents this way: Set&lt;? extends Document&gt; docs = new HashSet&lt;Document&gt;(); However, when I'm trying to insert a document to my set: docs.add(d); I'm getting: The method add(capture#10-of ? extends Document) in the type Set&lt;capture#10-of ? extends Document&gt; is not applicable for the arguments (Document) What am I doing wrong?
tagged with: java
duplicate of: http://stackoverflow.com/q/2776975
has comment: http://stackoverflow.com/comment/31982727
linked to: http://stackoverflow.com/q/15045034
type: Question
answer count: 2
favorite count: 0
accepted answer: http://stackoverflow.com/a/21233181
has comment: http://stackoverflow.com/comment/31982687

http://stackoverflow.com/a/21241068
accepted answer of: http://stackoverflow.com/q/21240868
answers question: http://stackoverflow.com/q/21240868
score: 0
has body: I think you problem may be here while (input.hasNext()) { int num = Integer.parseInt(input.next()); if (input.next() == "") { The second line reads an input, but so does the next line. So when the loop is at the last element, the first line will read it, then the next line will try to read a next element that doesn't exist, hence NoSuchElementException. And don't compare strings with ==. Use equals() or equalsIgnoreCase()
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31997623

http://stackoverflow.com/comment/32155860
has text: Well the timer() method is synchronized but I dont know what to do here: else if(dest.pas == false){ // here plane must wait till airfield is not blocked and land - I dont know how to do this
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21330979

http://stackoverflow.com/q/21275956
tagged with: java
has comment: http://stackoverflow.com/comment/32058508
linked to: http://stackoverflow.com/q/1124548
linked to: http://stackoverflow.com/q/2033914
type: Question
has comment: http://stackoverflow.com/comment/32058591
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32058467
tagged with: android-activity
tagged with: activity-finish
has body: I have many activities and have to traverse through all activities from navigation drawer. I want to quit app from home screen whether there are many activities which have not been finished.For this purpose i used NavUtils as we can move to parent activity from "NavUtils.navigateUpFromSameTask(MyClass.this)" method. for example i have two activities here splashScreen.class and ManinActivity.class i startactivity from splashScreen activity by finishing the splashScreen &amp; splashscreen is parentclass of MainActivity &amp; by quitting app from mainactivity the app is finished in some mobiles but in some mobiles the app goes to parent activity's onCreate method so called splashScreen.I don't understand why this is happening.Help me if u know better procedure or if i'm doing something wrong here is my code of quitting app from MainActivity: NavUtils.navigateUpFromSameTask(MainActivity.this); and i start MainActivity from splashScreen like this: public void StartMainActivity() { Intent mainActivity = new Intent(splashScreen.this,MainActivity.class); startActivity(mainActivity); finish(); } here is manifest code: &lt;activity android:name=".MainActivity" android:label="StoneAge" android:parentActivityName="com.experlabs.brandappy.splashScreen"&gt; &lt;meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.experlabs.brandappy.splashScreen" /&gt; &lt;/activity&gt;
has answer: http://stackoverflow.com/a/21276083
has title: quit app by NavUtils in android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32059113
tagged with: android
has answer: http://stackoverflow.com/a/21277446
has comment: http://stackoverflow.com/comment/32059072
has comment: http://stackoverflow.com/comment/32058379

http://stackoverflow.com/comment/32225602
type: Comment
score: 1
has text: I do not understand why you would think an applet, or even the certificate it is signed with, would be blacklisted because of a valid (or even invalid, this would only cause a warning to the user) manifest property.. The reason you are using an asteriks is the reason why the asteriks is valid. You simply cannot force developers to create a different .jar for every domain the RIA is used from.
comment on: http://stackoverflow.com/a/21305544
type: AnswerComment

pmd
tags question: http://stackoverflow.com/q/21189385
tag name: pmd
type: Tag

http://stackoverflow.com/comment/31921556
has text: CritterInfo is some part of the interface that we're supposed to use. "The Critter interface defines the methods necessary for an animal // to participate in the critter simulation. It must return a // character when getChar is called that is used for displaying it on // the screen. The getMove method must return a legal move (one of // the constants NORTH, SOUTH, EAST, WEST, CENTER). "
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21198561

http://stackoverflow.com/comment/31932331
has text: JPG is Lossy compression ,[this](http://stackoverflow.com/questions/6064227/java-saving-original-jpeg-without-loss) might helpful for you.
type: Comment
comment on: http://stackoverflow.com/q/21204627
score: 0
type: QuestionComment

http://stackoverflow.com/a/21308876
type: Answer
accepted answer of: http://stackoverflow.com/q/21300109
answers question: http://stackoverflow.com/q/21300109
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32139152
type: AcceptedAnswer
upvote count: 1
has body: Challenge accepted if you mean the video URL is encrypted and not the video itself. And it is not like the video URL is encrypted, it is more like "obfuscated" since the structure of the data is visible. So to de-obfuscate: public class Q21300109 { public static final String urlEncoded = "%{3c%-69%$66%X72%!61%F6d%N65%Z20%@6d%[61%W72%J67%@69%U6e%@68%C65%J69%V67%R68%B74%D3d%-22%[30%G22%S20%P6d%A61%M72%~67%Y69%A6e%T77%V69%*64%D74%I68%+3d%R22%[30%Z22%L20%Q73%]63%A72%+6f%X6c%C6c%G69%F6e%U67%H3d%I22%Q6e%C6f%P22%[20%S66%P72%G61%F6d%A65%H62%Y6f%V72%?64%!65%#72%+3d%E22%Y30%X22%Q20%A77%T69%Q64%+74%C68%T3d%D22%H35%?34%L30%Q22%P20%O68%*65%K69%{67%H68%R74%+3d%H22%Z33%W30%@34%Y22%K20%S73%W72%P63%C3d%F22%*68%D74%Y74%H70%A3a%!2f%~2f%E6d%]70%~34%P75%L70%B6c%#6f%D61%M64%W2e%K63%#6f%U6d%R2f%O65%C6d%G62%?65%M64%Z2d%W34%!6b%@68%!71%T66%*7a%M37%~34%{6e%?67%N6a%-6e%[2e%A68%L74%G6d%B6c%B22%J3e%O3c%Y2f%T69%D66%E72%+61%S6d%H65%E3e"; public static void main(String... args) { String senc = urlEncoded; int offSet = senc.indexOf('%'); StringBuilder sb = new StringBuilder(); while (offSet &gt; -1) { String hex = senc.substring(offSet + 2, offSet + 4); // hex to char, see http://stackoverflow.com/a/10101779/3080094 char c = (char)Integer.parseInt(hex, 16); sb.append(c); offSet = senc.indexOf('%', offSet + 1); } System.out.println(sb.toString()); } } Which produces: &lt;iframe marginheight="0" marginwidth="0" scrolling="no" frameborder="0" width="540" height="304" src="http://mp4upload.com/embed-4khqfz74ngjn.html"&gt;&lt;/iframe&gt;
has comment: http://stackoverflow.com/comment/32137597

http://stackoverflow.com/a/21278118
upvote count: 7
answers question: http://stackoverflow.com/q/21277123
has body: Something like this RetryPolicy retryPolicy = new DefaultRetryPolicy( YOUR_TIMEOUT_MS, YOUT_MAX_RETRIES, YOUR_BACKOFF_MULT ); JsonObjectRequest request = new JsonObjectRequest(...); request.setRetryPolicy(retryPolicy); Or you could implement your own RetryPolicy.
downvote count: 0
type: Answer
score: 7

http://stackoverflow.com/a/70235368
upvote count: 1
has comment: http://stackoverflow.com/comment/136523890
has body: The string comparison function is incorrect: you only compare on the shortest length, returning 0 for A and AB. When a string is a prefix of the other, you should compare the lengths. The character comparison function is unnecessarily complicated and considers all characters outside of index to be identical to the first letter in index. You should only reorder lowercase letters according to the index string. private static int compare(String leftString, String rightString) { // return -1 if left string is less than right string else left string is greater than right string return 1 int len1 = leftString.length(); int len2 = rightString.length(); int min = Math.min(len1, len2); for (int i = 0; i &lt; min; i++) { int cmp = compareChar(leftString.charAt(i), rightString.charAt(i)); if (cmp != 0) { return cmp; } } return len1 == len2 ? 0 : (len1 &lt; len2 ? -1 : 1); } /* lexicographical comparison with custom order for lowercase letters */ private static int compareChar(char x, char y) { if (x == y) return 0; int indexofx = index.indexOf(x); int indexofy = index.indexOf(y); if (indexofx &gt;= 0) { x = (char)('a' + indexofx); } if (indexofy &gt;= 0) { y = (char)('a' + indexofy); } // if index is a permutation of the lowercase letters, // we can assume x != y return x &lt; y ? -1 : 1; } }
type: Answer
has comment: http://stackoverflow.com/comment/136521488
has comment: http://stackoverflow.com/comment/136517185
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/136524263
answers question: http://stackoverflow.com/q/21215893
has comment: http://stackoverflow.com/comment/136523465

http://stackoverflow.com/comment/32107022
has text: Can you create a war from your program, deploy it directly in JBoss and check?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21302676
score: 0

http://stackoverflow.com/q/21207069
tagged with: macos
favorite count: 0
type: UnansweredQuestion
has title: How to get the NSWindow * for a java Window
score: 2
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21207757
upvote count: 2
tagged with: nswindow
has body: If I have a Java Window object, what's the easiest way, possibly calling Mac-specific supplementary APIs, JNA, or JNI, to get the NSWindow * corresponding to it?
answer count: 1

http://stackoverflow.com/a/21290586
type: Answer
has body: Change the return type of the method or write variable which you need to print.
answers question: http://stackoverflow.com/q/21290478
score: 0

http://stackoverflow.com/comment/32062339
type: Comment
has text: @Duncan In the meantime I can't live without them :)
comment on: http://stackoverflow.com/a/21278130
type: AnswerComment
score: 0

http://stackoverflow.com/a/21239490
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21239148
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21239148
downvote count: 0
has body: You could use the Javax.units package, especially the Java Unit Class. This is a well-studied problem and for any non-trivial program you should always use an existing units library.

http://stackoverflow.com/a/21234011
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21233956
has body: Iterate on the ArrayList, for each element, check if it begins with jon. Time complexity is O(n).

http://stackoverflow.com/comment/31987963
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21235928
type: AnswerComment
has text: Because you can use JPQL with annotated entites and thus use path navigation for example.

http://stackoverflow.com/comment/32129862
type: QuestionComment
has text: xPix and x are two different variables.
comment on: http://stackoverflow.com/q/21316634
score: 0
type: Comment

http://stackoverflow.com/q/21325971
tagged with: abstract
tagged with: interface
has comment: http://stackoverflow.com/comment/32147056
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21326300
has answer: http://stackoverflow.com/a/21326300
has comment: http://stackoverflow.com/comment/32146940
has comment: http://stackoverflow.com/comment/32147241
has body: I am doing an exercise, the book is not helping me grasp the concept, neither are the online resources. This may seem really silly but I don't know what I'm missing!!! I am quite new to Java and have had a look at other examples on stack but to no avail :s I need to declare 3 interfaces. Each interface needs to declare a method with the same name as its interface. Then the abstract class is extended by 3 classes which implement the aforementioned interfaces.Each class needs to be instantiated. If anyone could explain the procedure to this I would be eternally grateful. interface antiLockBrakes{ public void antiLockBrakes(); } interface cruiseControl{ public void cruiseControl(); } interface powerSteering{ public void powerSteering(); } public abstract class Auto{ abstract class Model1 extends Auto implements antiLockBrakes{ public abstract void antiLockBrakes(); Model1 mod1 = new Model1(); mod1.antiLockBrakes(); } public static void main(String[] args){ } }
has comment: http://stackoverflow.com/comment/32147062
has answer: http://stackoverflow.com/a/21326647
type: Question
has comment: http://stackoverflow.com/comment/32146921
has title: Declaring an Interface and implementing in classes in an abstract class Java
tagged with: java
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21326647

http://stackoverflow.com/a/21316412
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/21316347
type: Answer
upvote count: 4
downvote count: 0
has body: With this line Recherche rech; you did not create a Recherche object; only a reference variable. And there is no object here either: rech = null; There is no call to the constructor to optimize out; there is no object and no int instance variable to optimize out. Adding a call to actually create an object will result in the compiler error for the constructor being private: rech = new Recherche(); // can't access private constructor
answers question: http://stackoverflow.com/q/21316347

http://stackoverflow.com/q/21243690
possible better answer: http://stackoverflow.com/a/31366376
has answer: http://stackoverflow.com/a/47205363
has answer: http://stackoverflow.com/a/31366376
linked to: http://stackoverflow.com/q/37206862
has body: I'm familiar with the Spring Boot JSP sample application However that example uses the WAR packaging. Is it possible to do the same with JAR ? My goal is to put JSPs under src/main/resources/jsp to simplify the structure of my app.
has answer: http://stackoverflow.com/a/65105278
has answer: http://stackoverflow.com/a/21244397
has answer: http://stackoverflow.com/a/37215633
tagged with: spring
has answer: http://stackoverflow.com/a/42880235
has answer: http://stackoverflow.com/a/43698874
upvote count: 40
type: AnsweredQuestion
tagged with: spring-boot
has title: Is it possible with Spring Boot to serve up JSPs with a JAR packaging?
has answer: http://stackoverflow.com/a/50846032
tagged with: java
score: 40
type: Question
has answer: http://stackoverflow.com/a/78838854
accepted answer: http://stackoverflow.com/a/21244397
has comment: http://stackoverflow.com/comment/102594609
downvote count: 0
has comment: http://stackoverflow.com/comment/32002577
answer count: 13
favorite count: 0
has answer: http://stackoverflow.com/a/46057848
has answer: http://stackoverflow.com/a/68619247
has answer: http://stackoverflow.com/a/61884305
has answer: http://stackoverflow.com/a/78619625

http://stackoverflow.com/q/21209236
has body: This is my repository : @Autowired private SessionFactory session; @Override public List getAllPersons() { return session.getCurrentSession().createQuery("from Person").list(); } @Override public List getAllUsers() { return session.getCurrentSession().createQuery("from user").list(); } And here my getAllpersons is working fine and returning values from the database "Person" But the other method getAllUsers is not returning anything from "user" but gives me null in the trace log and a NullpointerException on the website. log.setLevel(Level.TRACE); log.trace("fhfgh"); log.trace("session : " + session); log.trace(session.getCurrentSession().toString()); log.trace(session.getCurrentSession().createQuery("Select * from user").list()); TRACE: root - session : null How on earth can one method work and return values but the other not and cast NullpointerException and null in the sessoin factory?? this is my application context : <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/lan…
has comment: http://stackoverflow.com/comment/31940520
downvote count: 0
has comment: http://stackoverflow.com/comment/31952933
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31940502
tagged with: spring
tagged with: sessionfactory
answer count: 0
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31941068
has title: SessionFactory gives null value for one method but not for the other

http://stackoverflow.com/a/21283574
upvote count: 1
has comment: http://stackoverflow.com/comment/32071081
answers question: http://stackoverflow.com/q/21283527
has body: In XML, &lt;EditText android:id="@+id/myEditT" android:layout_height="wrap_content" android:layout_width="wrap_content"/&gt; &lt;Button android:id="@+id/myButton" android:layout_height="wrap_content" android:layout_width="wrap_content"/&gt; In Java, public void onCreate(Bundle saved){ super.onCreate(saved); setContentView(R.layout.your_xml); Button btn = (Button) findViewById(R.id.myButton); EditText edtText = (EditText) findViewById(R.id.myEdit); btn.setOnClickListener(new onClickListener( public void onClick(View v){ String value = edtText.getText().toString(); } )); }
score: 1
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32071097

http://stackoverflow.com/comment/80373635
score: 0
type: Comment
has text: like this list.add(new ListItem("யுத்தத்திலும் ப்ரனயதிலும் நியமங்கள் நோக்கில்லா \n\nபோரிலும் காதலிலும் சட்டங்களை நோக்க கூடாது")); document.add(list);
type: AnswerComment
comment on: http://stackoverflow.com/a/21259711

http://stackoverflow.com/comment/31898828
comment on: http://stackoverflow.com/q/21186342
score: 0
type: Comment
has text: @assylias Yeah that would also be an option. Now I could say that I always have to create a new runnable object but may be I take that to serious.
type: QuestionComment

http://stackoverflow.com/a/21293951
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21293428
type: Answer
answers question: http://stackoverflow.com/q/21293428
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32090175
has body: Just make it final: final String citazione = new String(data[position]);

http://stackoverflow.com/q/21210823
downvote count: 6
type: AnsweredQuestion
upvote count: 2
tagged with: java
has title: For Loop Isn't Working
score: -4
has body: I am testing a for-loop for smoothly moving an object on the screen. int yPosLeft = 339; int originalYPosLeft = yPosLeft; for(yPosLeft &lt; 30 + originalYPosLeft; yPosLeft++) { // Changes the value in the statement } However, the loop somehow makes the object's y position go into the negative millions forever and pretty much requires a force quit. Any suggestions? Update: I was stupid with this. Apologies for #BrainFart #Fixed
type: Question
accepted answer: http://stackoverflow.com/a/21210833
has answer: http://stackoverflow.com/a/21210835
answer count: 3
tagged with: for-loop
has answer: http://stackoverflow.com/a/21210902
possible better answer: http://stackoverflow.com/a/21210835
has comment: http://stackoverflow.com/comment/31943088
favorite count: 0
has answer: http://stackoverflow.com/a/21210833
has comment: http://stackoverflow.com/comment/31943066
has comment: http://stackoverflow.com/comment/31943045

http://stackoverflow.com/a/21261395
has comment: http://stackoverflow.com/comment/32032345
accepted answer of: http://stackoverflow.com/q/21261266
has comment: http://stackoverflow.com/comment/32032250
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32032575
has body: It's not correct. You won't be able to use your class - You cannot use the return value in your static factory method (right now it won't compile, but I guess the return value is supposed to be Parser). The visibility of the return value makes it inaccessible for anyone using your factory method. A workaround would be to factor out a public interface that the inner class implements and use this as the return value for your factory method.
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21261266

http://stackoverflow.com/q/21273878
possible better answer: http://stackoverflow.com/a/21274954
tagged with: jodatime
has answer: http://stackoverflow.com/a/21273918
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32055213
type: AnsweredQuestion
has title: Joda Time does not take AM/PM into account when using hours between, and 12 hour time not working
upvote count: 0
has body: I am writing a program to calculate age difference in java using Joda Time, and when calculating hoursBetween(), it does not take into account AM and PM. Here's my code: public static void main(String[] args) { Scanner scan = new Scanner(System.in); String DOB = ""; String NOW = ""; SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy hh:mm aa"); Date dob = null; Date now = null; try { System.out .println("Enter the date and time of your birth using the mm/dd/yyyy and the hh:mm AM/PM format: "); DOB = scan.nextLine(); System.out .println("Enter the date and time using the mm/dd/yyyy and the hh:mm AM/PM format: "); NOW = scan.nextLine(); dob = format.parse(DOB); now = format.parse(NOW); DateTime dob1 = new DateTime(dob); DateTime now1 = new DateTime(now); System.out.print("You are "); System.out.print(Years.yearsBetween(dob1, now1).getYears() + " years, "); System.out.print(Months.monthsBetween(dob1, now1).getMonths() % 12 + " months, "); System.out.print(Days.daysBetween(dob1, now1).getDays() % 60 + " days, "); System.out.print(Hours.hoursBetween(dob1, now1).getHours() % 12 + " hours, "); System.out.print("and " + Minutes.minutesBetween(dob1, now1).getMinutes() % 60 + " minutes old!"); } catch (Exception e) { e.printStackTrace(); } }} If my input for date of birth is "01/01/2014 12:00 AM" and my input for the current time is "01/01/2014 12:00 PM" the result is: "You are 0 years, 0 months, 0 hours, and 0 minutes old." When it should be 12 hours old. Is there a way to fix this? My guess is there is some way to implement the halfdayOfDay() method and invoke it on my DateTime's, but I haven't found it...Thanks for any help!(By the way, I am using 12 hour day's for input, but while parsing it still accepts 13:00, when it should max out at 12:00!)
favorite count: 0
accepted answer: http://stackoverflow.com/a/21273918
type: Question
tagged with: datetime
has comment: http://stackoverflow.com/comment/32055144
score: -2
linked to: http://stackoverflow.com/q/2179644
has answer: http://stackoverflow.com/a/21274954
tagged with: java
answer count: 2
downvote count: 2

http://stackoverflow.com/q/21264740
has comment: http://stackoverflow.com/comment/32044602
linked to: http://stackoverflow.com/q/6255106
has comment: http://stackoverflow.com/comment/32038656
answer count: 0
tagged with: java
type: Question
has body: Here is my code..have used multithreading concept in applet graphics im trying to ove the image in either direction and make the string appear in swirly colors.Its working in seperate class but not in multithreading.I can guess problem is in run method.please check the code ![][a busy cat] import java.applet.Applet; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; //guess problem is in this class...!! public class threadone extends Applet implements Runnable { int x; int ux1,ux2; private Image img; boolean running=true; Font f=new Font("TimesRoman", Font.BOLD + Font.ITALIC, 40); Color colors[]=new Color[50]; private Thread thread1,thread2; public void start() { img=getImage(getCodeBase(),"c232.gif"); Runnable job=new threadtwo(this); Runnable job2=new threadthree(this); thread1=new Thread(job); thread2=new Thread(job2); thread1.start(); thread2.start(); } public void destroy() { running=false; } public void stop() { running=false; } public void paint(Graphics g) { g.setFont(f); int i = 0; setForeground(colors[i]); g.drawString("flames",750,50); g.drawImage(img, x,250, this); ux1=ux2=0; } public void run() { } }` //this is second class in multithread have tried to move an image// public class threadtwo implements Runnable { threadone parent; public threadtwo(threadone parent) { this.parent=parent; } public void run() { while(true) { int x; int ux1 = 0,ux2 = 0; for (x = 5; x &lt;= 505; x+=4) { ux2 = x + 90; parent. repaint(); try { Thread.sleep(100); } catch (InterruptedException e) { if (ux1 == 0) ux1 = x; } for (x = 505; x &gt; 5; x -=4) { ux1 = x; parent. repaint(); try { Thread.sleep(100); } catch (InterruptedException e) { } if (ux2 == 0) ux2 = x + 90; } } } } } // this is third class in multithread have tried to implement swirly colors// import java.awt.Color; public class threadthree implements Runnable{ threadone parent; Color colors[]=new Color[50]; public threadthree(threadone parent) { this.parent=parent; } publi…
has comment: http://stackoverflow.com/comment/32039050
has title: trying to move an image on either direction and make string appear in swirly colors .Its not working using threads
score: 0
has comment: http://stackoverflow.com/comment/32038474
tagged with: applet
has comment: http://stackoverflow.com/comment/32038732
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/q/21285099
tagged with: authentication
has comment: http://stackoverflow.com/comment/32108135
tagged with: java
type: Question
has title: Submitting after login - Android app
has comment: http://stackoverflow.com/comment/32074318
score: 0
has body: I'm trying to to submit a form, but before this form I have to log in, so I should do 2 posts in a line, somebody has any idea in how to do that, there is what I have here: // Making HTTP request try { String redirectedUrl = getUrl(url); // defaultHttpClient HttpPost httpPost = new HttpPost(redirectedUrl); List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2); nameValuePairs.add(new BasicNameValuePair("username", login)); nameValuePairs.add(new BasicNameValuePair("password", password)); httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpClient.execute(httpPost); HttpEntity entity = response.getEntity(); String html = null; if (entity != null) { InputStream instream = entity.getContent(); try { html = streamToString(instream); } finally { instream.close(); } } The problem there is that when I log in, it just retrieve a response and I can't do anything with, I need to post inside the resource that is protected, somebody has any idea about what I should do. The getUrl function is shown below: private String getUrl(String url) throws ClientProtocolException, IOException { HttpGet httpget = new HttpGet(url); HttpContext context = new BasicHttpContext(); HttpResponse response = httpClient.execute(httpget, context); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) throw new IOException(response.getStatusLine().toString()); HttpUriRequest currentReq = (HttpUriRequest) context .getAttribute(ExecutionContext.HTTP_REQUEST); HttpHost currentHost = (HttpHost) context .getAttribute(ExecutionContext.HTTP_TARGET_HOST); return (currentReq.getURI().isAbsolute()) ? currentReq .getURI().toString() : (currentHost.toURI() + currentReq .getURI()); }
tagged with: http-post
tagged with: android
has comment: http://stackoverflow.com/comment/32074623
has comment: http://stackoverflow.com/comment/32074216
answer count: 0
type: UnansweredQuestion
tagged with: http-redirect

http://stackoverflow.com/a/21373526
type: Answer
has body: You can run test suite by adding a class having main function as below : public static void main(String[] args) { org.testng.TestNG.main(args); } Where arguments will be testNG arguments e.g. java -jar yourjar testng1.xml [testng2.xml testng3.xml ...]
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21328734
answers question: http://stackoverflow.com/q/21328734

http://stackoverflow.com/q/21300413
tagged with: log4j
tagged with: http://stackoverflow.com/tag/xml
has body: I have need of two instances of logger that bind with different xml files at one time execution but in my case when I bind the xml path with first invoked logger, it does not release the earlier added path. so I am not able to bind the another xml path. FYI: I am using System.setProperty("log4j.configurationFile","xml_path") to bind the xml path as i placed xml file at external directory. it works fine, logger dump file in well manner but when i try to bind the another xml path by above mentioned way, it does't accept. logger instance shows path of first xml file on inspecting config file property. so what i am doing wrong here.
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21305480
tagged with: classpath
type: Question
has title: logger instance with two xml file
score: 0
answer count: 1

http://stackoverflow.com/a/21456134
answers question: http://stackoverflow.com/q/21223257
type: Answer
has body: If you are using JBoss Weld for CDI , make sure that you added the @Model annotation or better yet a specific @Named annotation. To narrow down the issue and distinguish between a page parameter problem and a naming problem, add a fixed string to your bean (with getters) and write it to the page. If the string shows up its a page parameter issues, if it does not show up, its a bean naming/binding issue
upvote count: 0
score: -1
downvote count: 1

http://stackoverflow.com/a/21229307
has body: This was a dumb question.. I'll answer it in case others are under pressure to complete a port.. The Jersey/Jackson ContextResovler using JAXBContext has been removed. The new model for the ContextResovler uses the ObjectMapper. For an example see the ObjectMapperProvider in the Jersey examples directory.
answers question: http://stackoverflow.com/q/21220760
has comment: http://stackoverflow.com/comment/90799165
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21220760
upvote count: 2

http://stackoverflow.com/q/21260657
tagged with: eclipse-plugin
has answer: http://stackoverflow.com/a/21263424
accepted answer: http://stackoverflow.com/a/21263424
has answer: http://stackoverflow.com/a/24240397
has body: I am developing Eclipse plugin to run Gradle from Eclipse just as an application (using Eclipse LaunchConfiguration). But even after setting JAVA_HOME and GRADLE_HOME for this new process, it finishes with error. Below is what I got by passing additional --debug --stacktrace So for what file Access is denied and how to discover that? 21:50:18.828 [ERROR] [org.gradle.BuildExceptionReporter] 21:50:18.828 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception. 21:50:18.844 [ERROR] [org.gradle.BuildExceptionReporter] 21:50:18.844 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: 21:50:18.844 [ERROR] [org.gradle.BuildExceptionReporter] java.lang.ExceptionInInitializerError (no error message) 21:50:18.844 [ERROR] [org.gradle.BuildExceptionReporter] 21:50:18.844 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is: 21:50:18.844 [ERROR] [org.gradle.BuildExceptionReporter] java.lang.ExceptionInInitializerError 21:50:18.844 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.nativeplatform.filesystem.FileSystems.getDefault(FileSystems.java:22) 21:50:18.844 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.LayoutCommandLineConverter.convert(LayoutCommandLineConverter.java:39) 21:50:18.844 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.BuildActionsFactory.createAction(BuildActionsFactory.java:107) 21:50:18.844 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.createAction(CommandLineActionFactory.java:206) 21:50:18.859 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:196) 21:50:18.859 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174) 21:50:18.860 [ERROR] [org.gradle.BuildExceptionReporter] at or…
tagged with: java
tagged with: gradle
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/21360995
tagged with: eclipse
score: 0
answer count: 2
has title: Eclipse plugin development - Gradle fails to run from Eclipse launcher: java.io.IOException: Access denied
possible better answer: http://stackoverflow.com/a/24240397

http://stackoverflow.com/q/21231842
score: -3
has title: How do i know what CRUD operations are performing by my java application?
tagged with: java
downvote count: 3
type: Question
has comment: http://stackoverflow.com/comment/31980682
has body: I have an application which was closed to enhance and for audit purpose i want to know what are the DB operations performing by an java application. I dont want to enhance my application to provide those details but is there a way to know? any external tool that monitor db calls?
upvote count: 0
has answer: http://stackoverflow.com/a/21234594
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/32149835
type: Comment
has text: About the extra item - I added an extra guard statement in my answer above `if (start < str.length() - 1)` to take that into account
comment on: http://stackoverflow.com/a/21326156
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32046520
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21268317
type: Comment
has text: the socket knows the port. The way a socket works is you are technically always connected to client/server, the server simply writes things to the socket, you don't have to specify what port you want to use.

http://stackoverflow.com/q/21220535
has comment: http://stackoverflow.com/comment/31960710
favorite count: 0
has comment: http://stackoverflow.com/comment/31960495
has title: Character Moves Too Fast
score: 2
downvote count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31960666
type: Question
has comment: http://stackoverflow.com/comment/31960525
has body: I am developing a game where I have a speed variable and a player x and player y. Here is the up directional movement for my player: I use an if statement in my up method in order to check if the player is breaking the boundaries of my frame. public void createCharacter(Player player) { Character.player = player; speed = 1; character.setIcon(CharacterSheet.downRightLeg); Game.game.add(character); px = 200; py = 200; character.setBounds(px, py, 56, 63); } public static void up() { if (py - 2 &gt; 0) { player.setPlayerDirection(1); py -= speed; renderUpwardWalking(); character.setLocation(px, py); Game.user.setLocation(px, py - 50); } else if (py - 2 &lt; 0) { } } I call createCharacter at the beginning of the game when a player logs in. Can I set int speed to a double and give it a value like .5? I tried it and it didn't work. My character moves too fast for the game I'm making and I don't know how to slow him down.
has comment: http://stackoverflow.com/comment/31960696
tagged with: java
upvote count: 2

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/21280652
tags question: http://stackoverflow.com/q/21283293
tags question: http://stackoverflow.com/q/21213783
tags question: http://stackoverflow.com/q/21243368
tags question: http://stackoverflow.com/q/21342160
tags question: http://stackoverflow.com/q/21308558
tags question: http://stackoverflow.com/q/21222438
tags question: http://stackoverflow.com/q/21311022
tags question: http://stackoverflow.com/q/21186928
tags question: http://stackoverflow.com/q/21318422
tags question: http://stackoverflow.com/q/21192978
tags question: http://stackoverflow.com/q/21254264
type: Tag
tags question: http://stackoverflow.com/q/21286831
tags question: http://stackoverflow.com/q/21247283
tags question: http://stackoverflow.com/q/21286823
tags question: http://stackoverflow.com/q/21339326

http://stackoverflow.com/comment/32109579
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21301896
has text: I don't know about pure JavaEE. Would it be a problem to stick to proprietary features of JAX-RS implementations (i.e. Jersey)?

http://stackoverflow.com/comment/32072364
score: 0
type: QuestionComment
type: Comment
has text: Did u get your answer ?
comment on: http://stackoverflow.com/q/21282946

http://stackoverflow.com/comment/32046986
has text: You aren't making it clear on how to send a message just to certain people that are connected. All you are telling me is how to store names in an array and nothing about sending.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21268317

http://stackoverflow.com/comment/32184395
type: Comment
score: 1
has text: Just because floating point isn't accurate enough in general doesn't mean it isn't accurate enough in a specific case.
comment on: http://stackoverflow.com/q/21346694
type: QuestionComment

http://stackoverflow.com/comment/32129695
type: QuestionComment
has text: @BrianRoach thanks for response. actually this is a code fragment of java on plain text not full class file.
comment on: http://stackoverflow.com/q/21316169
score: 0
type: Comment

http://stackoverflow.com/comment/31936362
has text: yay! yet another useful method I can add to my toolkit! Hadn't seen singleton list before.
score: 0
comment on: http://stackoverflow.com/a/21207233
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/31956794
score: 0
type: Comment
has text: The JVM spec is the place to go. It's pretty ugly in places, though, and the real JVM is *very* picky. Are you sure you're supposed to use the JVM bytecode scheme, or just something like it?
type: QuestionComment
comment on: http://stackoverflow.com/q/21218533

http://stackoverflow.com/comment/32013890
score: 0
has text: I'm new in java how do you know that the project uses J2se 1.6 ? and what's different between j2se and jre and jdk ?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21250662

http://stackoverflow.com/q/21279503
tagged with: exception
has comment: http://stackoverflow.com/comment/32065393
has title: After running an Eclipse SWT application it shows many exceptions
upvote count: 2
has body: After running my SWT application it doesn’t have any error at the time of compilation. But after running it will shows the output for few sec and then the eclipse instance will become not responsive. Please help me to avoid exceptions I try to increase heap size.anybody is here to help me.....plzzzzzzzzzzzzzzzzzzzz here i will give my code. i think my logic also have a problem. but i dont know how to correct it. i just follow on book to do this.here it is a program for clock. and i did in each movement of second hand a new thread is created. i want to make it as one thread. it shows unable to create new native threads activator.java package com.packtpub.e4.clock.ui; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Tray; import org.eclipse.swt.widgets.TrayItem; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; /** * The activator class controls the plug-in life cycle */ public class Activator extends AbstractUIPlugin { // The plug-in ID public static final String PLUGIN_ID = "com.packtpub.e4.clock.ui"; //$NON-NLS-1$ // The shared instance private static Activator plugin; private TrayItem trayItem; private Image image; private Shell shell; /** * The constructor */ public Activator() { } /* * (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) */ public void start(BundleContext context) throws Exception { super.start(context); plugin = this; final Display display = Display.getDefault(); display.asyncExec(new Runnable() { public void run() { image = new Image(display, Activator.class.getResourceAsStream("/icons/sample.gif")); Tray tray = di…
tagged with: multithreading
tagged with: swt
has comment: http://stackoverflow.com/comment/32066293
accepted answer: http://stackoverflow.com/a/21302445
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32065969
has comment: http://stackoverflow.com/comment/32066462
has comment: http://stackoverflow.com/comment/32104727
has comment: http://stackoverflow.com/comment/32064393
has comment: http://stackoverflow.com/comment/32065166
type: Question
has answer: http://stackoverflow.com/a/21302445
has comment: http://stackoverflow.com/comment/32102203
has comment: http://stackoverflow.com/comment/32065444
has comment: http://stackoverflow.com/comment/32066786
linked to: http://stackoverflow.com/q/6754628
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32102940
has comment: http://stackoverflow.com/comment/32102444
has comment: http://stackoverflow.com/comment/32065677
has comment: http://stackoverflow.com/comment/32066139
tagged with: eclipse-plugin
favorite count: 0
has comment: http://stackoverflow.com/comment/32066846

http://stackoverflow.com/a/21326041
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32147218
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21325983
accepted answer of: http://stackoverflow.com/q/21325983
has comment: http://stackoverflow.com/comment/32147045
downvote count: 0
score: 2
has body: Use Contact val = (Contact) queryValues.get("data"); Instead of Contact val = Contact.class.cast(queryValues); This is because, you are trying to put a single contact into map as map.put("data", data); so when you will read this entry, you need to use map.get("data") because here key is data.

http://stackoverflow.com/q/21314991
tagged with: math
tagged with: java
tagged with: methods
type: Question
upvote count: 2
tagged with: random
answer count: 2
tagged with: for-loop
has answer: http://stackoverflow.com/a/21315109
accepted answer: http://stackoverflow.com/a/21315109
favorite count: 0
has answer: http://stackoverflow.com/a/21315123
downvote count: 0
has title: Arithmetic equation for array elements not working
has body: This is a program designed to estimate the value of pi using Buffons needle simulation. The problem I'm having here is that inside the method calcPi, the pi array's elements keep on showing up as 0 after the arithmetic equation inside the for loop. I've checked and the hitCounter and trial are both working.. Help? import java.util.Scanner; public class Darts { public static int trials() //User Inputs number of trials { int input; Scanner in = new Scanner(System.in); System.out.print("How many darts/trials? "); input = in.nextInt(); return input; } public static double [] randomX(int trial) // Randomly generates numbers for the x coordinate on the amounts of trials { double [] randNumArrayX = new double[trial]; for(int i = 0; i &lt; trial; i++) { randNumArrayX[i] = Math.random(); } return randNumArrayX; } public static double [] randomY(int trial) // Randomly generates numbers forthe y coordinate on the amounts of trials { double [] randNumArrayY = new double[trial]; for(int i = 0; i &lt; trial; i++) { randNumArrayY[i] = Math.random(); } return randNumArrayY; } public static int [] dartBoard(double [] randx, double [] randy) // determines whether the dark hit the board or not { int [] hitMiss = new int[randx.length]; int [] trials = new int[randx.length]; for(int i = 0; i &lt; randx.length; i++) { if( Math.pow(randx[i] , 2) + Math.pow(randy[i] , 2) &lt;= 1) { hitMiss[i] = 1; } else { hitMiss[i] = 0; } } return hitMiss; } public static double [] calcPi(int [] h) // Calculates pi using randomly generated numbers { int hitCounter = 0; double [] pi = new double[h.length]; for(int i = 0; i &lt; h.length; i++) { if(h[i] == 1) { hitCounter++; } pi[i] = 4*(hitCounter/(i + 1)); } return pi; } public static void print(double [] pi) // prints results { for(int i = 0; i &lt; 10; i++) { System.out.printf("%-7s%2d%-8s%-10.6f%n", "Trial [", i, "]: pi = ", pi[i]); } System.out.println("\t ....."); System.out.printf("%-17s%-10.6f%n", "Estimate of pi = ", pi[pi.length -1]); } public s…
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21315123

http://stackoverflow.com/comment/31975519
comment on: http://stackoverflow.com/a/21222344
score: 0
type: Comment
has text: Added folder setup to answer
type: AnswerComment

http://stackoverflow.com/q/21233053
type: Question
has answer: http://stackoverflow.com/a/21233115
tagged with: android-maps-v2
has comment: http://stackoverflow.com/comment/31994921
upvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/21233090
has title: Android thread exiting with uncaught exception
has answer: http://stackoverflow.com/a/21233090
has answer: http://stackoverflow.com/a/21251282
answer count: 5
tagged with: android
has body: I am developing a simple Map. I'm new to this. i had developed using the tutorials provided by maps developing My logcat error Looks like this 01-20 15:13:23.511: W/dalvikvm(28896): threadid=1: thread exiting with uncaught exception (group=0x417379a8) 01-20 15:13:23.520: E/AndroidRuntime(28896): FATAL EXCEPTION: main 01-20 15:13:23.520: E/AndroidRuntime(28896): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nuappz.gotcha/com.nuappz.gotcha.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment 01-20 15:13:23.520: E/AndroidRuntime(28896): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2306) 01-20 15:13:23.520: E/AndroidRuntime(28896): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358) 01-20 15:13:23.520: E/AndroidRuntime(28896): at android.app.ActivityThread.access$600(ActivityThread.java:156) 01-20 15:13:23.520: E/AndroidRuntime(28896): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340) 01-20 15:13:23.520: E/AndroidRuntime(28896): Caused by: java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist. You must have the following declaration within the &lt;application&gt; element: &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; 01-20 15:13:23.520: E/AndroidRuntime(28896): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source) 01-20 15:13:23.520: E/AndroidRuntime(28896): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source) 01-20 15:13:23.520: E/AndroidRuntime(28896): at com.google.android.gms.maps.internal.q.v(Unknown Source) 01-20 15:13:23.520: E/AndroidRuntime(28896): at com.google.android.gms.maps.internal.q.u(Unknown Source) 01-20 15:13:23.520: E/AndroidRuntime(28896): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)…
has answer: http://stackoverflow.com/a/21240299
has comment: http://stackoverflow.com/comment/31982639
score: -1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21251282
tagged with: java
has answer: http://stackoverflow.com/a/21251549
downvote count: 1

http://stackoverflow.com/comment/31916021
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21195147
type: Comment
has text: I fixed it man, thanks a lot. I'm gonna test it and post the updated code in a minute. Thanks again for your help.

http://stackoverflow.com/a/24249562
downvote count: 0
has comment: http://stackoverflow.com/comment/43601463
type: Answer
answers question: http://stackoverflow.com/q/21190283
score: 2
has body: I understand your challenge. I don't believe there is any easy way to do this from Hibernate. Here are some workarounds: Let Hibernate go ahead and create the index in the "wrong" tablespace, then afterwards run on your database statements to rebuild (move) the indexes to the correct tablespace, i.e.: ALTER INDEX some_index_name REBUILD TABLESPACE your_index_ts;. If you have a lot of indexes, this meta-script might assist you with finding and moving your misplaced indexes. The output will be ALTER statements like above. SELECT 'ALTER INDEX '||owner||'.'||index_name||' REBUILD TABLESPACE your_index_ts;' stmt FROM all_indexes WHERE table_owner='YOUR_SCHEMA' AND tablespace_name != 'YOUR_INDEX_TS'; In theory you could automate this and put it in a stored proc. Let me put the question like Tom Kyte would probably do: Why do you want indexes in a separate tablespace? What application or performance issue are you trying to solve? A perspective (feel free to disagree in comments): It's old school to insist that indexes are stored in a separate tablespace. Indeed, there could be some cases where this practice provides a benefit, but I have not seen this lately. The reasoning was that if you were doing mass DML, you would have IO contention between data and index if they were on the same disk, so the DBA forced them to be on different devices via different tablespaces. However if the DBA put the data and index tablespaces on the same disk, then it would negate the intention. These days, your datafiles tend to be spread out over many spindles (by ASM, or even on non-ASM by RAID sets, but even more so when running on SAN). With ASSM tablespaces (not confused with ASM or ASMM), Oracle these days does just fine with index segments in the same tablespace as table segments. And if you have to ever do TSPITR, having your entire schema in one tablespace makes things a bit easier. I might put LOBs in a separate tablespace, but that's not what you're asking. If your DBA says indexes ne…
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21190283
type: AcceptedAnswer

http://stackoverflow.com/a/21242292
has comment: http://stackoverflow.com/comment/127149912
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21238474
upvote count: 3
answers question: http://stackoverflow.com/q/21238474
has body: I think you'll want to do two things in general when you find yourself with too many mocks. These are not necessary easy, but you may find them helpful. 1) Try and make your methods and classes smaller. I think Clean Code says there are two rules, that classes should small. And that classes should be smaller then that. This makes some sense because as the units you are testing (methods and classes) get smaller, so will the dependencies. You will of course end up with more tests, but they will have less setup in each test. 2) Look at the Law of Demeter (https://en.wikipedia.org/wiki/Law_of_Demeter). There are a bunch of rules, but basically, you want to avoid long string of property/method calls. objA = objB.propertyA.SomeMethod().propertyC; If you need to mock out all of these objects just to get objA, the you will have a lot of setup. But if you can replace this with objA = objB.newProperty; then you only need to mock objB and it's one property. Neither of these are silver bullets, but hopefully you can use some of these ideas with your project.
type: AcceptedAnswer
downvote count: 1

http://stackoverflow.com/comment/31928275
type: Comment
has text: @Pureferret Who said the input will change? I assumed this is the input format. If you think it's bad answer (for 20 mins of coding), provide your own answer.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21202246

http://stackoverflow.com/a/21312716
has comment: http://stackoverflow.com/comment/32127806
has comment: http://stackoverflow.com/comment/32122770
has comment: http://stackoverflow.com/comment/32125464
score: 3
has comment: http://stackoverflow.com/comment/32126757
upvote count: 3
has comment: http://stackoverflow.com/comment/32141936
downvote count: 0
has body: JApplet has no paintComponent method, so you're not actually overriding anything. As good practice, you should use the @Override annotation to make cure you are making a valid override. JApplet does have a paint method though. Don't override paint in a JPanel. Instead override paintComponent and call super.paintComponent Don't use null layouts. Swing is made to be used with LayoutManagers. See Laying out components in a Container As @KevinWorkman suggested, the layout you want is BorderLayout UPDATE for your new post getContentPane() return a Container. You can make it = a JPanel You haven't declared any variables we can work with See the example below to see how BorderLayout would work for your Final class. import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.Font; import java.awt.GridBagLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class Final extends JFrame{ JPanel locationGui = new JPanel(); JPanel temp = new JPanel(); JPanel percip= new JPanel(); JPanel image = new JPanel(); public Final() { init(); } public void init() { Font font = new Font("impact", Font.PLAIN, 20); locationGui.setBackground(Color.RED); JLabel guiLabel = new JLabel("Location Gui"); guiLabel.setFont(font); locationGui.add(guiLabel); temp.setBackground(Color.BLUE); temp.setLayout(new GridBagLayout()); JLabel tempLabel = new JLabel("Temp"); tempLabel.setFont(font); temp.add(tempLabel); percip.setBackground(Color.GREEN); JLabel gLabel = new JLabel("Percip"); gLabel.setFont(font); percip.add(gLabel); image.setBackground(Color.ORANGE); image.setLayout(new GridBagLayout()); JLabel imageLabel = new JLabel("Image"); imageLabel.setFont(font); image.add(imageLabel); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.add(locationGui, BorderLayout.NORTH); contentPane.add(temp, BorderLayout.EAST); contentPane.add(percip, BorderLayout.…
answers question: http://stackoverflow.com/q/21311954
type: Answer
has comment: http://stackoverflow.com/comment/32125443

http://stackoverflow.com/q/21289121
has answer: http://stackoverflow.com/a/21289439
downvote count: 0
has comment: http://stackoverflow.com/comment/32081279
answer count: 1
score: 1
accepted answer: http://stackoverflow.com/a/21289439
favorite count: 0
tagged with: immutability
has title: Wondering if I'm doing this immutability exercise correctly
upvote count: 1
type: AnsweredQuestion
has body: My professor just went over mutable and immutable, and gave us this coding exercise to complete. 1) Create a Customer object called customer with initial values of 1 and "Cust1" respectively. 2) Display the customer object to the screen using the toString() method. 3) Create a String object reference called name and assign to it the customer's name. 4) Assign the value "Bo Beep" to the object reference name. 5) Display the customer object to the screen using the toString() method. The output should look like this. Customer{id=1, name=Cust1} Customer{id=1, name=Cust1} I currently have 2 seperate classes, here they are. I'm not sure whether I'm doing it correctly, I think I have done the first 2 right, but I'm not sure about 3-5. Any input is helpful, thanks! Here's my main class, package hw01; public class Main { static Customer customer = new Customer(1, "cust1"); static Customer name = new Customer(1, "Bo Peep"); public static void main(String[] args) { System.out.println(customer); System.out.print(customer); } } And here's my Customer class. package hw01; public class Customer { private int id; private String name; public Customer() { } public Customer(int id, String name) { this.id = id; this.name = name; } public int getId() { return id; } public String getName() { return name; } @Override public String toString() { return "Customer{" + "id=" + id + ", name=" + name + '}'; } }
has comment: http://stackoverflow.com/comment/32081121
tagged with: java
type: Question

http://stackoverflow.com/comment/32168232
comment on: http://stackoverflow.com/a/21336415
score: 0
type: AnswerComment
has text: I disagree, the requirement is just to make XSD pass with keeping current structure. Any XML that makes XSD pass is correct. I could write an app that loops throught all combinations are returns the one that works, but its a big project and I need it for today ;-) Thx for reply
type: Comment

http://stackoverflow.com/q/21342560
upvote count: 1
type: Question
has body: I have exported a jar file from one of my maven projects. This project has a dependency of apache common validations. after I have added the jar to libs folder of my android project, and also I have added the common validations jar files (made sure that they are in the same version both in the maven project and in the android project). Now when I run the app I am getting this error: 01-24 20:58:14.151: E/AndroidRuntime(1241): FATAL EXCEPTION: main 01-24 20:58:14.151: E/AndroidRuntime(1241): java.lang.NoClassDefFoundError: com.evappcom.validator.Validator 01-24 20:58:14.151: E/AndroidRuntime(1241): at com.evapp.protocols.BaseProtocol.emailValidation(BaseProtocol.java:176) 01-24 20:58:14.151: E/AndroidRuntime(1241): at com.evapp.protocols.PasswordLoginProtocol.isValidInput(PasswordLoginProtocol.java:30) 01-24 20:58:14.151: E/AndroidRuntime(1241): at com.evapp.activities.LoginActivity.doLogin(LoginActivity.java:88) 01-24 20:58:14.151: E/AndroidRuntime(1241): at com.evapp.activities.LoginActivity.access$0(LoginActivity.java:82) 01-24 20:58:14.151: E/AndroidRuntime(1241): at com.evapp.activities.LoginActivity$1.onClick(LoginActivity.java:56) 01-24 20:58:14.151: E/AndroidRuntime(1241): at android.view.View.performClick(View.java:4204) 01-24 20:58:14.151: E/AndroidRuntime(1241): at android.view.View$PerformClick.run(View.java:17355) 01-24 20:58:14.151: E/AndroidRuntime(1241): at android.os.Handler.handleCallback(Handler.java:725) 01-24 20:58:14.151: E/AndroidRuntime(1241): at android.os.Handler.dispatchMessage(Handler.java:92) 01-24 20:58:14.151: E/AndroidRuntime(1241): at android.os.Looper.loop(Looper.java:137) 01-24 20:58:14.151: E/AndroidRuntime(1241): at android.app.ActivityThread.main(ActivityThread.java:5041) 01-24 20:58:14.151: E/AndroidRuntime(1241): at java.lang.reflect.Method.invokeNative(Native Method) 01-24 20:58:14.151: E/AndroidRuntime(1241): at java.lang.reflect.Method.invoke(Method.java:511) 01-24 20:58:14.151: E/AndroidRuntime(1241): at com.android.interna…
accepted answer: http://stackoverflow.com/a/21342603
tagged with: eclipse
answer count: 1
downvote count: 0
has title: Maven created jar to android
tagged with: jar
favorite count: 0
has comment: http://stackoverflow.com/comment/32177093
tagged with: android
tagged with: maven
has answer: http://stackoverflow.com/a/21342603
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/32100463
comment on: http://stackoverflow.com/a/21299709
type: AnswerComment
has text: @ImGone98 This will depend on how you are updating your view, but we don't have enough to go on to know how this is done. Painting does just that, it paints the view, it should not be used to modify the state of the model
score: 0
type: Comment

http://stackoverflow.com/comment/32145010
has text: ya it was, but cheers you are not only the one who did this, there are many users reported similar issue :)
comment on: http://stackoverflow.com/a/21324579
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21270568
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21270660
tagged with: android
accepted answer: http://stackoverflow.com/a/21270715
type: AnsweredQuestion
has body: I am working with a function that takes a class type as parameter: I am trying to pass getSpans() the specific subclass of the Object "type." Spannable ss; Object type; int start; int end; //Assume above variables properly initialized. .... //getSpans(int start, int end, Class&lt;T&gt; type) ss.getSpans(start, end, ???);
tagged with: java
has answer: http://stackoverflow.com/a/21270715
has title: Passing objects subclass type
type: Question
tagged with: casting
possible better answer: http://stackoverflow.com/a/21270660
tagged with: class

http://stackoverflow.com/comment/31990209
comment on: http://stackoverflow.com/q/21236541
has text: The samples are [here](http://dynamicjasper.com/documentation-examples/getting-started/)
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21295013
tagged with: java
has answer: http://stackoverflow.com/a/21295042
type: Question
has body: I have this class as follows :- import java.util.*; public class QueueTest&lt;T&gt;{ Queue&lt;T&gt; q = new LinkedList&lt;T&gt;(); int capacity; public QueueTest(int capacity){ this.capacity = capacity; } **public &lt;T&gt; void put(T item) throws InterruptedException**{ while(q.size()== capacity){ System.out.println("Now Queue is full and i will wait"); wait(); } q.add(item); System.out.println("I added : "+item); notify(); } public T got() throws InterruptedException{ while(q.isEmpty()){ System.out.println("Now Queue is empty and i will wait "); wait(); } T item = q.remove(); System.out.println("I got : "+item); notify(); return item; } } the declaration of method put() cause this error ?? QueueTest.java:17: error: no suitable method found for add(T#1) q.add(item); and when I remove T , the class compiled without errors, but I don't know why ???
tagged with: type-parameter
score: 0
accepted answer: http://stackoverflow.com/a/21295042
answer count: 1
tagged with: generics
tagged with: multithreading
tagged with: collections
type: AnsweredQuestion
has title: Type parameter cause error

http://stackoverflow.com/a/21334636
has body: This is the correct way of executing a command in Java. Just to clear possible confusion: ProcessBuilder doesn't execute the program using a shell. That's the reason why you have to provide it with a list of arguments and not a single string (that would be parsed by a shell). There are two possibilities: either you want to run the Java program in a new JVM and then using the ProcessBuilder is the way to go or you don't mind if it is executed in the same JVM and then you can call the main method yourself as Sean suggests (possibly in a different thread) Another option, depending on the type of the application, would be to perform some acrobatics with an application server to start the app in it. If you use the ProcessBuilder just be careful about handling its input and output streams - if you don't handle them your application can hang: Java ProcessBuilder: Input/Output Stream This has been improved in Java 7.
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/21333087
type: Answer
accepted answer of: http://stackoverflow.com/q/21333087

loops
tags question: http://stackoverflow.com/q/21246767
tags question: http://stackoverflow.com/q/21191498
tags question: http://stackoverflow.com/q/21225395
tags question: http://stackoverflow.com/q/21310952
tags question: http://stackoverflow.com/q/21335556
tags question: http://stackoverflow.com/q/21296593
tags question: http://stackoverflow.com/q/21228344
tags question: http://stackoverflow.com/q/21292999
type: Tag
tags question: http://stackoverflow.com/q/21343138
tags question: http://stackoverflow.com/q/21326160
tags question: http://stackoverflow.com/q/21194644
tags question: http://stackoverflow.com/q/21259298
tags question: http://stackoverflow.com/q/21284519
tags question: http://stackoverflow.com/q/21188831
tags question: http://stackoverflow.com/q/21212761
tags question: http://stackoverflow.com/q/21191551
tags question: http://stackoverflow.com/q/21324036
tags question: http://stackoverflow.com/q/21248677
tags question: http://stackoverflow.com/q/21203428
tag name: loops
tags question: http://stackoverflow.com/q/21188476
tags question: http://stackoverflow.com/q/21284308
tags question: http://stackoverflow.com/q/21283869
tags question: http://stackoverflow.com/q/21218464
tags question: http://stackoverflow.com/q/21341466
tags question: http://stackoverflow.com/q/21256115
tags question: http://stackoverflow.com/q/21223806
tags question: http://stackoverflow.com/q/21333131
tags question: http://stackoverflow.com/q/21216432
tags question: http://stackoverflow.com/q/21242735
tags question: http://stackoverflow.com/q/21190641
tags question: http://stackoverflow.com/q/21211502
tags question: http://stackoverflow.com/q/21235048
tags question: http://stackoverflow.com/q/21247104

http://stackoverflow.com/comment/31949146
comment on: http://stackoverflow.com/a/21213933
type: AnswerComment
score: 0
type: Comment
has text: didnt help mch i got it another way, for (Ball ball : balls) { if (ball.get(i, j) > 0) { sb.append((char) (ball.get(i, j) + 48)); flag = false; break; } }

http://stackoverflow.com/comment/32045003
type: Comment
comment on: http://stackoverflow.com/a/21267941
has text: Love the design suggestions. I will follow them. Thanks again.
score: 0
type: AnswerComment

http://stackoverflow.com/a/21508660
has comment: http://stackoverflow.com/comment/98033093
type: AcceptedAnswer
upvote count: 9
answers question: http://stackoverflow.com/q/21254093
has comment: http://stackoverflow.com/comment/67951937
type: Answer
accepted answer of: http://stackoverflow.com/q/21254093
downvote count: 0
has comment: http://stackoverflow.com/comment/32500866
score: 9
has body: seems to be a bug after refactoring in hibernate. see https://hibernate.atlassian.net/browse/HHH-6190 for details Here's a workaround I've used, utilising a java dynamic proxy to represent the statistics interface from hibernate, and the default platform mbean server: @MXBean public interface StatisticsMXBean extends Statistics { } public void initStatistics(SessionFactory sessionFactory) { ObjectName statsName = new ObjectName("org.hibernate:type=statistics"); MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); final Statistics statistics = sessionFactory.getStatistics(); statistics.setStatisticsEnabled(true); Object statisticsMBean = Proxy.newProxyInstance(getClass().getClassLoader(), new Class&lt;?&gt;[] { StatisticsMXBean.class }, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return method.invoke(statistics, args); } }); mbeanServer.registerMBean(statisticsMBean, statsName); }

http://stackoverflow.com/a/21300449
has comment: http://stackoverflow.com/comment/32101425
has comment: http://stackoverflow.com/comment/32101539
answers question: http://stackoverflow.com/q/21300429
type: Answer
score: 11
has body: here is your problem: else if (guessdigit2 == lotterydigit1 &amp;&amp; guessdigit1 == lotterydigit2); Remove the semicolon (;) else if (guessdigit2 == lotterydigit1 &amp;&amp; guessdigit1 == lotterydigit2) Note: It is recommended to always write your if else statement with bracket { } to avoid any possible error in the future, and of course it was in the Java code conventions. (see this answer for clarification on braces issue) else if (guessdigit2 == lotterydigit1 &amp;&amp; guessdigit1 == lotterydigit2){ System.out.println("Match all digits: you win 3,000"); }
has comment: http://stackoverflow.com/comment/32101444
downvote count: 0
upvote count: 11

http://stackoverflow.com/q/21236149
has body: I am getting this exception. proguard.ParseException: Expecting opening '(' or separator ';' before '=' in line 48 of file 'D:\adt-bundle-windows-x86_64-20130717\adt-bundle-windows-x86_64-20130717\sdk\tools\proguard\proguard-android.txt', and line 47 -56 is below -keepclassmembers class com.sec.svoice.api.SVoice { private java.lang.long interface_handle = -1L; private java.lang.long sentinel_handle = -1L; private java.lang.String host; private java.lang.int port; private java.lang.String deviceId; public static final java.lang.int SP_ASR = 1; public static final java.lang.int SP_NLU = 2; static final java.lang.int[] seed; }
tagged with: java
has comment: http://stackoverflow.com/comment/31989828
has comment: http://stackoverflow.com/comment/31989199
type: Question
has answer: http://stackoverflow.com/a/21250646
answer count: 2
possible better answer: http://stackoverflow.com/a/21243471
has answer: http://stackoverflow.com/a/21243471
score: 0
tagged with: android
has title: proguard parse exception in android.txt file
accepted answer: http://stackoverflow.com/a/21250646
tagged with: proguard
type: AnsweredQuestion

http://stackoverflow.com/comment/32080781
comment on: http://stackoverflow.com/a/21286263
type: Comment
has text: Not 100% sure, but I think I've connected to a remote database in Heroku. Also, if you sign up for Amazon Web Services, they let you use it free for a year (with certain limits).
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32000695
has text: This looks very similar to [this question](http://stackoverflow.com/questions/18602953/getactionbar-setdisplayhomeasupenabledtrue-throws-nullpointerexception-on-n), so this might indeed be the cause.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21243047
type: Comment

http://stackoverflow.com/comment/32116356
score: 2
has text: 1. You are showing *server Java code* and claiming that only the client is in Java. 2. `synchronized` in `doGet` is surely the wrong thing to do. It will make your server in effect single-threaded.
comment on: http://stackoverflow.com/q/21309152
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21198929
type: Answer
has comment: http://stackoverflow.com/comment/31922568
has comment: http://stackoverflow.com/comment/31922845
has comment: http://stackoverflow.com/comment/31922534
has comment: http://stackoverflow.com/comment/31922712
has body: In the method Read_Data(...) you are increasing the value of c (which you initialized with 0) before you perform the operations. You must increase it at the end of the while-loop: while ((text = readFile.readLine()) != null){ // ... your stuff // ... c += 1; // At the end } Edit: In the method displayData(...) your for initialization and condition values are wrong. Try changing this line for (int i = 1; i &lt;= dc; i++) { to for (int i = 0; i &lt; dc; i++) { Edit 2: In bestSeller(...) method you are iterating j from 0 to 100 (array length). That causes an Exception, you may want to use the actual number of data read. for (int j = 0; j &lt; sortC - 1; j++) { for (int k = j + 1; k &lt; sortC; k++) { With this changes I get, for the option 3 (bestSeller), the expected output (after modifying volume values in the .txt) POP Beatles8 Let It Be 18.0 POP Beatles7 Let It Be 17.0 POP Beatles6 Let It Be 16.0 POP Beatles5 Let It Be 15.0 POP Beatles1 Let It Be 13.0 POP Beatles2 Let It Be 12.0 POP Beatles3 Let It Be 11.0 POP Beatles4 Let It Be 10.0
answers question: http://stackoverflow.com/q/21198573
score: 1
has comment: http://stackoverflow.com/comment/31922804
upvote count: 1
has comment: http://stackoverflow.com/comment/31922455
accepted answer of: http://stackoverflow.com/q/21198573
has comment: http://stackoverflow.com/comment/31922817
has comment: http://stackoverflow.com/comment/31922424
has comment: http://stackoverflow.com/comment/31922171
has comment: http://stackoverflow.com/comment/31922470
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31922633
has comment: http://stackoverflow.com/comment/31922874

http://stackoverflow.com/q/21201103
accepted answer: http://stackoverflow.com/a/21214441
has body: How do you use GridBagLayout and CardLayout together? I'm trying to add these buttons to a panel, but it breaks the GridBagLayout, here's what is in the doc; button = new JButton("Button 1"); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; pane.add(button, c); button = new JButton("Button 2"); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; c.gridx = 1; c.gridy = 0; pane.add(button, c); I'm trying to do: JPanel m = new JPanel(); button = new JButton("Button 1"); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; m.add(button, c); button = new JButton("Button 2"); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; c.gridx = 1; c.gridy = 0; m.add(button, c); windows = new JPanel(new CardLayout()); windows.add(m, "test"); pane.add(windows, c); However it reverts as though it's using flowlayout. What is it I'm missing? Any help is much appreciated. Full import javax.swing.*; import java.awt.*; import java.awt.event.*; public final class GUI extends JPanel implements ActionListener { // buttons private JButton newButton, findButton; JPanel panels; public void addComponentToPane (Container pane) { pane.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; JPanel mainMenu = new JPanel(); // add mainMenu.add(newButton = new JButton("Add"), c); newButton.setActionCommand("new"); newButton.addActionListener(this); // find mainMenu.add(findButton = new JButton("Find"), c); findButton.setActionCommand("find"); findButton.addActionListener(this); panels = new JPanel(new CardLayout()); panels.add(mainMenu, "mainWindow"); pane.add(panels, c); } public void actionPerformed(ActionEvent e) { CardLayout allpanels = (CardLayout)(panels.getLayout()); switch (e.getActionCommand()) { case "new": allpanels.show(panels, "add"); break; case "find": System.out.println("find"); break; } } private static void createGUI () { JFrame frame = new JFrame("Check"); frame.setDefaultCloseO…
tagged with: gridbaglayout
tagged with: cardlayout
has comment: http://stackoverflow.com/comment/31925871
type: AnsweredQuestion
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/31929746
type: Question
has answer: http://stackoverflow.com/a/21214441
score: 0
tagged with: swing
has title: GridBagLayout inside CardLayout
answer count: 1
tagged with: java

http://stackoverflow.com/comment/32158260
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21311941
type: Comment
has text: @kleopatra thanks for the feedback :) I didn't mention I've tried implementing the editor in this way and it solves this creepy behavior (at least for me). That's why I've concluded the explained reason. Anyway the reason you've posted makes sense and it's testable so it's widely better than mine.

http://stackoverflow.com/comment/50348149
comment on: http://stackoverflow.com/a/22114037
type: AnswerComment
type: Comment
score: 2
has text: Thanks! I was following the [JBoss Hibernate tutorial](http://docs.jboss.org/hibernate/orm/5.0/manual/en-US/html/ch01.html#tutorial-firstapp-helpers) where the snippet `new StandardServiceRegistryBuilder().build()` caused me this issue. After using `applySettings(configuration.getProperties())`, it worked.

http://stackoverflow.com/comment/32056163
type: AnswerComment
type: Comment
has text: u mean export the project to generate a war file and run on tomcat??
comment on: http://stackoverflow.com/a/21238763
score: 0

http://stackoverflow.com/a/21302443
type: Answer
answers question: http://stackoverflow.com/q/21301544
has body: In your Android Manifest you have not specified &lt;uses-library android:name="com.google.android.maps" /&gt; use android:name instead of android:class.Thus change the fragment in your layout as below &lt;fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.android.gms.maps.SupportMapFragment"/&gt; and use this in your java file to define mMap mMap = ((SupportMapFragment)getSupportFragmentManager() .findFragmentById(R.id.map)).getMap();
score: 0

http://stackoverflow.com/comment/81552615
type: Comment
score: 0
has text: Yeah, Now i get that. My apologies!
type: AnswerComment
comment on: http://stackoverflow.com/a/21329579

http://stackoverflow.com/comment/32065588
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21247469
type: AnswerComment
has text: I'm trying to make a website which anyone could register and log in to, and send a self encrypted message to some other user, something like Email but I want to do the encryption myself with java so I figured out I could use javascript and PHP to store the users'encrypted messages. It's more of a self-test project than a real useful website so I dn't really mind the security warnings.

http://stackoverflow.com/a/21250544
answers question: http://stackoverflow.com/q/21250448
downvote count: 0
has body: try this s = s.replaceAll(".* is (\\d+).*", "$1");
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/21202475
downvote count: 0
has body: After the first glance it seems that your sessionFactory don't know about the CustomerModel entity. Make sure it is added into the sessionFactory as a mapping file.
score: 1
has comment: http://stackoverflow.com/comment/31973614
has comment: http://stackoverflow.com/comment/31955536
has comment: http://stackoverflow.com/comment/31928302
has comment: http://stackoverflow.com/comment/31928352
answers question: http://stackoverflow.com/q/21202379
upvote count: 1
has comment: http://stackoverflow.com/comment/31929477
type: Answer

http://stackoverflow.com/q/21279636
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/32065031
has answer: http://stackoverflow.com/a/21280248
tagged with: jsp
accepted answer: http://stackoverflow.com/a/21280248
upvote count: 1
has answer: http://stackoverflow.com/a/21279964
favorite count: 0
has title: redirecting form jsp in Web-inf to servlet in javaResources through href in
has body: This is my Login.jsp page USERNAME: PASSWORD: Forgot Password Create New user ` And this is my SignupServlet: protected void doPost(HttpServletRequest request, HttpServletResponse response throws ServletException, IOException { RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/WebPages/Signup.jsp"); rd.forward(request, response); } } and this is my web.xml SignupServlet com.affiliate.servlet.SignupServlet SignupServlet /SignUp Login.jsp is in Webcontent/WEB-INF/WebPages/Login.jsp and SignupServlet in JavaResources/src/com.affiliate.servlet/SignupServlet but my Login is not redirecting to the SignupServlet. And i have doubt on my href and form action. Please help me in this regard.
has answer: http://stackoverflow.com/a/21281779
answer count: 4
linked to: http://stackoverflow.com/q/6180256
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/32064702
score: 1
has answer: http://stackoverflow.com/a/21280519
tagged with: java
possible better answer: http://stackoverflow.com/a/21279964

http://stackoverflow.com/a/57683502
downvote count: 0
answers question: http://stackoverflow.com/q/21289922
type: Answer
has body: If your environment are virtual or in other hand special cpu scheduling like docker, there is no way to get Java to automatically use find out many cores are available and use them all. You have to specify how many cores you want to use via On JDK &gt;= 10, use the following JDK options: -XX:ActiveProcessorCount=2 On JDK &gt;= 8, use the following JDK options: -XX:+UnlockExperimentalVMOptions &gt; -XX:ActiveProcessorCount=2
score: 1
upvote count: 1

http://stackoverflow.com/comment/32063447
comment on: http://stackoverflow.com/q/21278519
has text: `gridwidth = 2` only means the component *can* use two columns, it doesn't necessarily mean it fills them. You need to also set `weightx = 1.0` and `fill = HORIZONTAL` in order for the component to actually *use* the available space.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21206787
has comment: http://stackoverflow.com/comment/31943974
has comment: http://stackoverflow.com/comment/31941515
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31947525
type: Answer
answers question: http://stackoverflow.com/q/21200845
has body: One of the reasons for using Key Bindings is to avoid the use of nested if/else statements. Instead you create a unique Action for the key binding, then the action command is irrelevant. //theDesktop.getActionMap().put("f9ButtonRelease", ClassKeyReleaseHandler); theDesktop.getActionMap().put("f9ButtonRelease", ScreenShotReleaseHandler); This is the way all the default Actions are created in Swing.
accepted answer of: http://stackoverflow.com/q/21200845
upvote count: 3
score: 3

http://stackoverflow.com/a/21193824
answers question: http://stackoverflow.com/q/21193785
type: Answer
has comment: http://stackoverflow.com/comment/31912918
upvote count: 4
has comment: http://stackoverflow.com/comment/31912921
type: AcceptedAnswer
downvote count: 0
score: 4
has body: This is fairly straightforward. The problem is that "data" only exists in the scope of the "try" block. Outside of that, it is undefined. A simple solution might look like this: public static List&lt;String[]&gt; read(String document) throws IOException{ List&lt;String[]&gt; data = null; try{ CSVReader reader = new CSVReader(new FileReader(document)); data = reader.readAll(); reader.close(); } catch(IOException e){ e.printStackTrace(); } return data; }
accepted answer of: http://stackoverflow.com/q/21193785

http://stackoverflow.com/comment/31996644
has text: The best way to work around this is probably have the `GenericObject<T>` take another `Class<T>` as parameter and store it, and have a static auxiliary cast method (that suppresses unchecked warnings) that takes the `GenericObject<?>` and a `Class<T>` and casts it to `GenericObject<T>` after having verified the stored `Class<T>` value.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21240380

http://stackoverflow.com/comment/32042544
score: 0
type: Comment
has text: thank you so much man! i don't know i wasn't even thinking lol. thank you.
comment on: http://stackoverflow.com/a/21266790
type: AnswerComment

xpath
tags question: http://stackoverflow.com/q/21254501
tags question: http://stackoverflow.com/q/21311948
tag name: xpath
tags question: http://stackoverflow.com/q/21251722
tags question: http://stackoverflow.com/q/21345866
tags question: http://stackoverflow.com/q/21189736
tags question: http://stackoverflow.com/q/21263367
tags question: http://stackoverflow.com/q/21219544
tags question: http://stackoverflow.com/q/21258477
tags question: http://stackoverflow.com/q/21230745
tags question: http://stackoverflow.com/q/21230367
tags question: http://stackoverflow.com/q/21253778
tags question: http://stackoverflow.com/q/21203218
type: Tag
tags question: http://stackoverflow.com/q/21258468

http://stackoverflow.com/comment/32109934
comment on: http://stackoverflow.com/a/21220081
type: Comment
has text: I finally ended up storing the messages in the format `{timestamp+count: "Message"}` Marking this as the write answer for helping me lead to it.
type: AnswerComment
score: 0

http://stackoverflow.com/a/21293980
has body: By default the beans in the context are in singleton scope. So when you set the value for the property failureUrl in one controller, another controller will also see this new value when it gets the bean from the context.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21293637

http://stackoverflow.com/a/21256116
has body: I'll try to answer based on my experience: I use maven profiles for this. Especially since there are beans (classes) that are specific to only one app server at a time. See http://maven.apache.org/guides/introduction/introduction-to-profiles.html maven supports placeholders. One build for every single environment: dev/qa/prod,etc. All you need is the properties file. (this is similar to properties in ant) You do not need (usually, unless you have integration tests that are tight to the app server - and if you do, it seems wrong) an app server for the build itself.
upvote count: 2
has comment: http://stackoverflow.com/comment/32025496
type: Answer
answers question: http://stackoverflow.com/q/21255740
has comment: http://stackoverflow.com/comment/32100041
score: 2
downvote count: 0

http://stackoverflow.com/comment/32080279
type: Comment
type: QuestionComment
has text: Could you show us the `secondActivity.java` line 16?
score: 1
comment on: http://stackoverflow.com/q/21288592

http://stackoverflow.com/comment/32141970
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21323037
has text: No list unfortunately, although that would make things much easier. I need to use an array :o
score: 0

http://stackoverflow.com/comment/32039050
type: Comment
has text: i find working in applets easy rather than swing since im a beginner@Thompson
score: 0
comment on: http://stackoverflow.com/q/21264740
type: QuestionComment

http://stackoverflow.com/q/21329288
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I am using JUnit v4 as a test framework. I wanted to know how to set timeout at runtime in a Test Case? I am using a Parameterized test, in which I have a list of Scenarios, which contain timeout value and some other fields. Each of these Scenarios may have different timeouts. The timeout parameter is not helping me to achieve this. @Test(timeout = getTimeOut()) public void secureLoginWithLongUsername() { // Test case goes here } private final long getTimeOut() { // I am doing some processing here to calculate timeOut dynamically long timeOut = scenario.getTimeOut(); return timeOut; } @Parameters public static Collection&lt;Scenario[]&gt; getParameters() { List&lt;Scenario[]&gt; scenarioList = new ArrayList&lt;Scenario[]&gt;(); Configuration config = new Configuration(); List&lt;Scenario&gt; scenarios = config.getScenarios(); for (Scenario scenario : scenarios) { scenarioList.add(new Scenario[] { scenario }); } return scenarioList; } public class Configuration { private List&lt;Scenario&gt; scenarios; //Some processing here public List&lt;Scenario&gt; getScenarios() { return scenarios; } } public class Scenario { private long timeOut; private String name; //Some more fields here } Please help me to find an alternative to set the timeout dynamically.
score: 2
has comment: http://stackoverflow.com/comment/32152541
tagged with: java
has comment: http://stackoverflow.com/comment/32152670
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21333910
has title: How to set timeout at runtime in JUnit Test Case
downvote count: 0
has comment: http://stackoverflow.com/comment/32153106
has answer: http://stackoverflow.com/a/77764471
tagged with: junit

http://stackoverflow.com/q/21226037
has title: Translating specific cUrl request into/with Java
tagged with: curl
tagged with: java
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/21226427
score: 0
has body: I had an issue: I am trying to convert a curl request into java. Thusfar, I have tried the makeCurl JAR files as well as tried directly using Apache http. However, I can't figure out the conversion. I am new to both Java and Curl, so I know most of the issue is a lack of familiarity with the API. However, as this is time sensitive, I would really appreciate the help turning this relatively simple line of code into java. curl \ -H 'Authorization: Bearer O3YPXEJHQ6TWNFI7HIBEGLVDBZA2SEKN' \ 'https://api.wit.ai/message?q=my_message' Which returns: { "msg_id" : "e0d5c96d-ca14-43a8-bcf9-993e5c717155", "msg_body" : "my_message", "outcome" : { "intent" : "greetings", "entities" : { }, "confidence" : 0.525 } If I could get this return back into a string, I could finish the rest of the program. This one step has been a pain though. Thank you so much in advance for the help! -Andrew Update: Okay: I can now send the request, and it is being received by the server, though I am using the entirely wrong code. I tried the java.net.URL/URLConnection library, and used this: package curlHttp; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; public class curlStackTest { public static void main(String args[]) throws IOException { String stringUrl = "https://api.wit.ai/message?q=test"; URL url = new URL(stringUrl); URLConnection uc = url.openConnection(); uc.setRequestProperty("Authorization", "Bearer O3YPXEJHQ6TWNFI7HIBEGLVDBZA2SEKN"); InputStreamReader inputStreamReader = new InputStreamReader(uc.getInputStream()); // read this input } } Now i just need to figure out how to read the output coming back from the cUrl request...
tagged with: apache
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/a/21226190
has comment: http://stackoverflow.com/comment/31970618
type: Answer
has body: Try the following public static void main(String[] args) { int[] values = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }; int start = 2, end = 5; // Index int[] newValues = new int[end - start + 1]; // Create new array for (int i = start; i &lt;= end; i++) { newValues[i - start] = values[i]; // Assign values } // Print newValues for (int v : newValues) { System.out.print(v + " "); } } Output: 3 4 5 6
upvote count: 2
answers question: http://stackoverflow.com/q/21226175
score: 2
downvote count: 0

http://stackoverflow.com/a/21469450
has comment: http://stackoverflow.com/comment/32521582
answers question: http://stackoverflow.com/q/21304937
has comment: http://stackoverflow.com/comment/32504220
score: 0
has comment: http://stackoverflow.com/comment/32502400
has body: You mention you check that the requests are leaving the browser correctly populated. If ocasionally they cannot be read by the server, this is likely to be a bug in the multipart request parsing library. I think that you are using O'Reilly MultiPartRequest library to parse the request, which is known to have some subtle bugs and not maintained for years. If you are using a Servlet 3.0 or higher container, use it's native API instead, if in a previous servlet version then use Apache Commons File Upload. Also see this answer for further details.
type: Answer
has comment: http://stackoverflow.com/comment/32499035

http://stackoverflow.com/comment/32125123
type: Comment
type: QuestionComment
has text: @VextoR Programmers.SE is not the place for implementation questions, which this is. Furthermore, it is *always* helpful to people answering the question to know what you are working from, the problem domain and similar. Just because you didn't have code with it doesn't mean that its a P.SE question (and neither SO, nor P.SE are forums). Reading the [help/on-topic] on each of the sites is quite useful for getting an idea of where a particular question belongs.
comment on: http://stackoverflow.com/q/21311958
score: 0

http://stackoverflow.com/q/21349061
type: Question
has comment: http://stackoverflow.com/comment/32188358
downvote count: 0
has answer: http://stackoverflow.com/a/21351583
has comment: http://stackoverflow.com/comment/32188406
tagged with: sql
score: 3
answer count: 1
has comment: http://stackoverflow.com/comment/32188374
favorite count: 0
tagged with: jpa-2.0
has comment: http://stackoverflow.com/comment/32188473
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32189149
has title: Getting data from multiple tables without foreign keys in JPA 2.0
has comment: http://stackoverflow.com/comment/32188423
tagged with: postgresql-9.1
upvote count: 3
tagged with: java
has body: I've been stumbling upon followig issue for a couple of days now nad I can't make it to work. Here is the problem. I have four tables (A, B, C, D) which are not related to eachother via any kind of foreign key. Hovewer, they do have a column called, let's say, 'superId'. The task is to take all the records from the A table, find records from the other ones with matching 'superId' (if they exist) and return them via JPA's constructor expression. About JOINs. Since the tables have no relations, I can't do a left JOIN (or any other JOINs). I tried to use MULTISELECT with a success, but it only works if I do an implicit joins with 'a.superId = b.superId'. This causes problems, since the three tables might not have matching records which will make the query to return empty set. This won't fly. I have no other ideas, and this is crucial for my project to work. Please forgive me simple description of an issue - sending from my mobile.

http://stackoverflow.com/q/21215056
tagged with: menu
has body: I'm tasked to program a game. A quite simple one, I'm thinking a JFrame with 3 different panels, MenuPanel, GamePanel and HighScorePanel. Of course, when you start the game you see the MenuPanel, click "start" and GamePanel comes on. I'm thinking that the MenuPanel should handle the buttons and so on. And the frame should switch between the different panels that should be active. Now, my questions are; If the MenuPanel handles the buttons, how can it communicate with the frame so that the active panel will be switched if e.g. a "Play" button is pressed? Does this design have apparent flaws?
answer count: 0
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/31950569
has title: JFrame with different panels inside
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/31950691
type: Question
score: 0
has comment: http://stackoverflow.com/comment/31950801

http://stackoverflow.com/comment/38977220
comment on: http://stackoverflow.com/q/21271627
type: QuestionComment
has text: Your code looks OK, so it seems the problem is with loading the bitmap. Try loading this image into a regular ImageView using the same code: BitmapFactory.decodeResource(context.getResources(), R.drawable.retreatgoddess); Does that work?
score: 0
type: Comment

hibernate-criteria
tags question: http://stackoverflow.com/q/21191972
tag name: hibernate-criteria
type: Tag

canvas
tags question: http://stackoverflow.com/q/21317135
tag name: canvas
tags question: http://stackoverflow.com/q/21284243
tags question: http://stackoverflow.com/q/21239229
type: Tag

http://stackoverflow.com/comment/114990354
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21214340
has text: I suggest checking out this answer: https://stackoverflow.com/a/44504132/6094503

http://stackoverflow.com/a/21342360
has body: I would use the regex Content ID \[\d+\] ? Implement it like this: str.replaceAll("Content ID \\[\\d+\\] ?", ""); You can find an explanation and demonstration here: http://regex101.com/r/qD5rJ6
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32192446
has comment: http://stackoverflow.com/comment/32182525
answers question: http://stackoverflow.com/q/21342272

jtextfield
tags question: http://stackoverflow.com/q/21248609
tags question: http://stackoverflow.com/q/21190260
tags question: http://stackoverflow.com/q/21199595
tags question: http://stackoverflow.com/q/21205389
tags question: http://stackoverflow.com/q/21247566
tags question: http://stackoverflow.com/q/21205947
tags question: http://stackoverflow.com/q/21211964
tag name: jtextfield
type: Tag
tags question: http://stackoverflow.com/q/21187406
tags question: http://stackoverflow.com/q/21312023
tags question: http://stackoverflow.com/q/21295832
tags question: http://stackoverflow.com/q/21279042
tags question: http://stackoverflow.com/q/21283869

http://stackoverflow.com/comment/32068818
comment on: http://stackoverflow.com/q/21282187
type: Comment
type: QuestionComment
has text: I can't see the java in this. Am I missing something?
score: 0

http://stackoverflow.com/q/21214221
answer count: 1
has comment: http://stackoverflow.com/comment/31949562
has answer: http://stackoverflow.com/a/21245774
tagged with: cookies
tagged with: java
type: UnansweredQuestion
has title: Filter out special characters from the data added to HTTP headers
downvote count: 0
score: 1
has body: Cookie[] cookies = httpServletRequest.getCookies(); String cookieStr = getCookieString(cookies); if (cookieStr != null &amp;&amp; !cookieStr.trim().equals("")) { urlConn.setRequestProperty("Cookie", cookieStr); For security reasons (in cases where data enters my application through an untrusted source), I would like to create whitelist of safe characters that are allowed to appear in HTTP response headers and accept input composed exclusively of these characters. I am told The CR and LF characters are at the heart of an HTTP response splitting attack, as well as other characters, such as ':' (colon) and '=' (equal). Hence I would like to filter out these special characters from the data added to headers. Can anyone please suggest how I can possibly do this? I have read quite a few posts online, but I am not very clear on how I can achieve this. Please suggest.
favorite count: 0
type: Question
upvote count: 1

http://stackoverflow.com/q/21303377
has answer: http://stackoverflow.com/a/21303500
has body: Python has a nice feature where I just type "python" in sh and I get an interactive way of testing Python code. How do I do that with Java? I'm on Mac 10.9 if that makes any difference.
tagged with: command-line-interface
has comment: http://stackoverflow.com/comment/32108179
score: 0
has answer: http://stackoverflow.com/a/54998540
linked to: http://stackoverflow.com/q/2605032
favorite count: 0
has answer: http://stackoverflow.com/a/21303514
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32106416
answer count: 4
has answer: http://stackoverflow.com/a/21303492
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/32106498
downvote count: 2
linked to: http://stackoverflow.com/q/3265357
has title: How do I start java in "cli mode"
linked to: http://stackoverflow.com/q/3504396
type: Question

http://stackoverflow.com/comment/31947647
type: AnswerComment
comment on: http://stackoverflow.com/a/21212877
score: 0
type: Comment
has text: I did move the directory, exactly as mentioned in the tutorial.

http://stackoverflow.com/q/21256219
score: 5
linked to: http://stackoverflow.com/q/1146153
upvote count: 5
answer count: 3
has body: I am trying to copy a file from one folder to another folder. Here's what I have got in my code: public static void copyFile(String path) throws IOException{ newPath = path; File destination = new File ("E:/QA/chart.js"); FileUtils.copyFile(destination, new File(newPath)); } But it is not copying the desired file to its location. What is required, its copy chart.js from E drive and copy to the newPath variable location. Is there some other way to copy files from one place to another?
downvote count: 0
has comment: http://stackoverflow.com/comment/32023040
has answer: http://stackoverflow.com/a/21256352
has comment: http://stackoverflow.com/comment/32023026
favorite count: 0
has comment: http://stackoverflow.com/comment/32023028
has comment: http://stackoverflow.com/comment/32023538
has title: Copy file from one folder to another in Java
has answer: http://stackoverflow.com/a/21257319
has comment: http://stackoverflow.com/comment/32023017
has comment: http://stackoverflow.com/comment/32023113
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21256483
accepted answer: http://stackoverflow.com/a/21256352
possible better answer: http://stackoverflow.com/a/21257319
tagged with: java
tagged with: file-copying
type: Question

osmdroid
type: Tag
tag name: osmdroid
tags question: http://stackoverflow.com/q/21291689
tags question: http://stackoverflow.com/q/21244084

http://stackoverflow.com/comment/32130087
type: QuestionComment
has text: If the object has an ID, and it's the "same" object in both processes, I don't understand the problem. You can output whatever you want in your log messages... like the ID of an object. You could use an MDC or NDC as well.
score: 0
comment on: http://stackoverflow.com/q/21316624
type: Comment

http://stackoverflow.com/comment/31979584
has text: oh sorry forgot to add the code where I call that method. It somehow disapeared. I added that code.
type: AnswerComment
comment on: http://stackoverflow.com/a/21231256
score: 0
type: Comment

http://stackoverflow.com/a/21200103
score: 0
has body: you can programmatically add your buttons to your activity with random position without using xml layout and here an example set buttons in activity LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); Button okButton=new Button(this); okButton.setText("some text"); Random r = new Random(); okButton.setPadding(r.nextInt(), r.nextInt(), r.nextInt(), r.nextInt()) ll.addView(okButton, layoutParams); and here good thread to look at Set margins in a LinearLayout programmatically
type: Answer
answers question: http://stackoverflow.com/q/21199969

http://stackoverflow.com/a/21205464
type: Answer
answers question: http://stackoverflow.com/q/21205393
score: 0
has body: You should enable them before you draw and disable them when you are done drawing.

http://stackoverflow.com/comment/32002079
has text: I jsut don't know where the variable a is defined?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21238779

http://stackoverflow.com/q/21191481
has comment: http://stackoverflow.com/comment/31910207
has body: I've viewed several guides in Java game development and some of them modify a BufferedImage then display that to a Canvas. My question is, why not directly paint the image to the Canvas using Graphics2D? Why are we using a BufferedImage as a "3rd party" of a sort. Is there a benefit to this or could it be BufferedImages are used primarily for when you're working with an manipulating individual pixels?
type: AnsweredQuestion
downvote count: 0
has title: Why use BufferedImage over Graphics2D?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31908380
tagged with: bufferedimage
has answer: http://stackoverflow.com/a/21191766
accepted answer: http://stackoverflow.com/a/21191766
type: Question
upvote count: 1
tagged with: graphics2d
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/31901236
has text: As far as I known, a socket timeout is just an event that tells you a read is blocking too long. You can ignore this timeout event and continue to read: the socket connection has not changed. Have you tried this?
type: QuestionComment
comment on: http://stackoverflow.com/q/21186928
score: 0
type: Comment

http://stackoverflow.com/comment/32061785
has text: I'd second the answers and comments about "If it works, it's correct" and reflection. But I wanted to add that you may want to explore "object [serialization](http://www.vogella.com/tutorials/JavaSerialization/article.html)". I have a feeling that it is what you consider a "standard solution" ...
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21277904

http://stackoverflow.com/comment/32035476
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21259076
has text: But that wouldn't attempt to use the same certificate would it? especially since i'm not running https.

http://stackoverflow.com/a/21214996
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31950469
upvote count: 1
answers question: http://stackoverflow.com/q/21214906
downvote count: 1
accepted answer of: http://stackoverflow.com/q/21214906
score: 0
has body: No, it's perfectly fine to modify an object that is used as a value in a HashMap while your are iterating over the HashMap. The ConcurrentModificationException only comes up if you are adding or removing entries to/from the HashMap while you're iterating over it. As an aside, changing the value like you do is fine. But never modify an object that is the key of HashMap entry while it is in the HashMap. (To be precise, never modify it in such as way that its hashCode is changed and/or its equals method produces a different result) or else you may not be able to find your entry anymore.

http://stackoverflow.com/comment/32182255
comment on: http://stackoverflow.com/q/21345516
score: 0
type: Comment
type: QuestionComment
has text: Could you please paste your stack trace?

http://stackoverflow.com/comment/32149804
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21326931
score: 2
has text: "*Duplicate entry '1' for key 'vehi_vehiID'*" - you are inserting the same primary key value twice.

http://stackoverflow.com/comment/32078361
comment on: http://stackoverflow.com/a/21285061
type: Comment
score: 0
type: AnswerComment
has text: Yeah, that another little question: as you can see in the image I have a playfield and a blue bar with a button. It's actually a background image, so now when I randomly draw the mouse on the field it's painted across the whole JPanel. I want to limit that to only the 'wood' part of the image.

http://stackoverflow.com/comment/31992169
type: Comment
comment on: http://stackoverflow.com/a/21238227
has text: This won't work without changing the `DispatcherServlet`'s `servlet-mapping`.
type: AnswerComment
score: 0

http://stackoverflow.com/a/21317052
downvote count: 0
score: 3
has body: If you don't override toString() in your Storage class, System.out.println(storage); won't display anything helpful to you. You're not getting an error (or rather an exception) here.
upvote count: 3
answers question: http://stackoverflow.com/q/21316887
type: Answer

http://stackoverflow.com/a/21246942
type: Answer
has body: In Java bytes are interpreted as signed (along with ints, shorts, and longs). The unsigned byte value of 134 is bit-equivalent to the signed byte value of -122. If you wish to use the unsigned value of a byte, you can do so by storing this value in a signed integer with more than 8 bits, such as an int: byte test = (byte) 134; int unsignedByteValue = ((int) test) &amp; 0xff; // now unsignedByteValue == 134 The bitmask of 0xff ensures that only the lower 8 bits of unsignedByteValue are ones. Otherwise, a negative signed byte would result in a negative signed int by sign extension.
upvote count: 3
answers question: http://stackoverflow.com/q/21246786
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/32007989

http://stackoverflow.com/comment/80434068
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21259711
has text: I don't have time to answer all your questions @RageshDAntony If you go to the web site, you can download a trial version of pdfCalligraph from our closed source Maveb repository. You can also download a white paper containing several examples. Why do you need someone to spell everything out for you?
type: AnswerComment

http://stackoverflow.com/comment/32009556
has text: I could have sworn I had seen an answer here a month or so ago to another question that showed how to create such a converter, but I looked for a couple of hours on google and stackoverflow and still couldn't find it, so I asked this question here.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21247425
type: Comment

http://stackoverflow.com/comment/31988951
comment on: http://stackoverflow.com/a/21233012
has text: But can we connect without using PHP?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21267879
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has body: After a bit of fiddling and a suggestion by @BoristheSpider, this answer seems to work correctly, including having the same overflow problems related to 32 bit integers as in PHP. /** * Converts a string from one base to another base. The bases must be between * 2 and 36 inclusive. This function exhibits the same issues as the original * PHP version related to overflow in 32 bit integers. * * @param inputValue A string representation of a number. * @param fromBase The starting radix of a number between 2 and 36 inclusive. * @param toBase The ending radix of the number between 2 and 36 inclusive. * @return The inputValue converted into toBase base. * @see http://www.php.net/manual/en/function.base-convert.php */ public static String base_convert(final String inputValue, final int fromBase, final int toBase) { if (fromBase < 2 || fromBase > 36 || toBase < 2 || toBase > 36) { return null; } String ret = null; try { ret = Integer.toString(Integer.parseInt(inputValue, fromBase), toBase); } catch(Exception ex) {}; return ret; } And for bonus points, this function can be easily wrapped to provide PHP's bindec and decbin functionality: /** * Converts a decimal string into a binary string. * * @param inputValue A string representation of a decimal number. * @return A bit string representation of the inputValue. */ public static String decbin(final String inputValue) { return Util.base_convert(inputValue, 10, 2); } /** * Converts a binary string into a decimal string. * * @param inputValue A string representation of a binary number. * @return A decimal number string representation of the inputValue. */ public static String bindec(final String inputValue) { return Util.base_convert(inputValue, 2, 10); }
score: 1
accepted answer of: http://stackoverflow.com/q/21213162
answers question: http://stackoverflow.com/q/21213162

http://stackoverflow.com/q/21321247
has comment: http://stackoverflow.com/comment/32170376
score: 1
tagged with: java
tagged with: ssl
has body: I'm attempting to setup an SSL connection between a PHP client and a Java server. I don't know a whole lot about SSL and I'm getting very confused with this. The connection doesn't need to be trusted or verified, it just has to encrypt the data to make it safe for transfer. The PHP client is able to connect (acknowledges a connection) to the Java server, but upon the handshake between the two, I reveive the following error in Java: javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLHandshakeException: no cipher suites in common at sun.security.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1458) at sun.security.ssl.AppInputStream.read(AppInputStream.java:92) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177) at java.io.InputStreamReader.read(InputStreamReader.java:184) at java.io.BufferedReader.fill(BufferedReader.java:154) at java.io.BufferedReader.readLine(BufferedReader.java:317) at java.io.BufferedReader.readLine(BufferedReader.java:382) at com.test.ConnectionHandler.getRequest(ConnectionHandler.java:23) at com.test.Interaction.run(Interaction.java:35) at java.lang.Thread.run(Thread.java:722) Caused by: javax.net.ssl.SSLHandshakeException: no cipher suites in common at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1868) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:266) at sun.security.ssl.ServerHandshaker.chooseCipherSuite(ServerHandshaker.java:892) at sun.security.ssl.ServerHandshaker.clientHello(ServerHandshaker.java:620) at sun.security.ssl.ServerHandshaker.processMessage(ServerHandshaker.java:167) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868) at sun.security.ssl.Handshaker.process_record(Handshaker.java:804) at sun.security.ssl.SSLSocketImpl.readRecord(S…
accepted answer: http://stackoverflow.com/a/21371039
has comment: http://stackoverflow.com/comment/32152630
downvote count: 0
answer count: 1
favorite count: 0
tagged with: sockets
has title: SSL socket connection between PHP client and Java server
linked to: http://stackoverflow.com/q/15405581
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21371039
tagged with: encryption
upvote count: 1
tagged with: php
type: Question

http://stackoverflow.com/q/21270760
answer count: 2
has body: I want to read a json Array and put it, if possible, into an int tri-dimensional array. The data will look like this, I can change it's design to suit my needs as it is not done yet. The values are dumb but what is good to know is that (Caution mindf*ck ahead) I have to nest an unknown number of arrays containing integers, two times in an array that is repeated three times or less in the root node. I.E. int[3 or less][2][unknown int] = val I wrote the keys to improve readability, they may or may not be part of the actual json. { demand : { 0 : { 0 :{ 0 :22, 1 :32, 2 :21 }, 1 :{ 0 :2762, 1 :352, 2 :231 } }, 1 :{ 0 :{ 0 :222, 1 :232, 2 :621 }, 1 :{ 0 :272, 1 :37762, 2 :261 } } } } The point is that the keys and values are all integers and I would like to create an int [][][] with it. I think that the answer is in this doc : Jackson Full Databinding but I do not understand properly how it would work for my data. I'm thinking about some ObjectMapper.readValue(json, new TypeReference>() { })` and will continue to look into this but I don't have much hope. Thanks for any help! Edit Here is the actual valid JSON [ [ [ 22, 32, 21 ], [ 2762, 352, 231 ] ], [ [ 222, 232, 621 ], [ 272, 37762, 261]] ]
downvote count: 0
tagged with: jackson
favorite count: 0
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/21275318
possible better answer: http://stackoverflow.com/a/21277600
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21277600
score: 1
upvote count: 1
tagged with: primitive
has comment: http://stackoverflow.com/comment/32056406
type: Question
accepted answer: http://stackoverflow.com/a/21275318
has title: Jackson databind read json tri-dimensional array
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32056841

http://stackoverflow.com/a/21240911
type: Answer
has body: Follow this general approach: public static void main(String[] args) { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = null; try { db = dbf.newDocumentBuilder(); Document doc = db.parse("input.xml"); NodeList people = doc.getElementsByTagName("people"); people.item(0) .appendChild( createPersonElement(doc, "Tom", "Hanks", true, "tt001.jpg")); System.out.println(nodeToString(doc)); } catch (SAXException e) { // handle SAXException } catch (IOException e) { // handle IOException } catch (TransformerException e) { // handle TransformerException } catch (ParserConfigurationException e1) { // handle ParserConfigurationException } } private static Element createPersonElement(Document doc, String firstName, String lastName, Boolean access, String image) { Element el = doc.createElement("person"); el.appendChild(createPersonDetailElement(doc, "firstName", firstName)); el.appendChild(createPersonDetailElement(doc, "lastName", lastName)); el.appendChild(createPersonDetailElement(doc, "access", access.toString())); Element images = doc.createElement("images"); images.appendChild(createPersonDetailElement(doc, "img", image)); el.appendChild(images); return el; } private static Element createPersonDetailElement(Document doc, String name, String value) { Element el = doc.createElement(name); el.appendChild(doc.createTextNode(value)); return el; } This uses the following helper method to print the results: private static String nodeToString(Node node) throws TransformerException { StringWriter buf = new StringWriter(); Transformer xform = TransformerFactory.newInstance().newTransformer(); xform.transform(new DOMSource(node), new StreamResult(buf)); return buf.toString(); } This could be modified to update the original file instead.
answers question: http://stackoverflow.com/q/21240030
score: 0

http://stackoverflow.com/comment/32110299
has text: Does your input type element (type='file') in jsp have a 'name' attribute?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21305453
score: 1

http://stackoverflow.com/a/21229053
answers question: http://stackoverflow.com/q/21228791
type: Answer
has comment: http://stackoverflow.com/comment/31975687
accepted answer of: http://stackoverflow.com/q/21228791
downvote count: 0
has comment: http://stackoverflow.com/comment/31975510
score: 1
upvote count: 1
type: AcceptedAnswer
has body: you can try this long t0 = System.currentTimeMillis(); public void encode(byte[] data) { if (System.currentTimeMillis() - t0 &gt;= 5000) { t0 = System.currentTimeMillis(); // process the data and then send to RTMP server } else { // buffer data } }

http://stackoverflow.com/a/21345105
type: Answer
answers question: http://stackoverflow.com/q/21345065
score: 0
has body: I suspect you meant to use backslashes: Pattern p = pattern.compile("\\d+"); since the expression you wrote: "//d+" looks for two forward slashes followed by at least one instance of the letter d... The following code seems to behave in the way you wanted: public static void main (String[] args) throws java.lang.Exception { String s[]={"some text 123 and 234 some 456 numbers", "just text", "123 234"}; Pattern p = Pattern.compile("\\d+"); for(String ss: s) { Matcher m = p.matcher(ss); int flag = 0; while(m.find()){ System.out.print(m.group() + " "); flag = 1; } if(flag == 1) System.out.println(); } } Output: 123 234 456 123 234 Note - don't use println() for each number as it will generate a newline. Instead, I set a flag before the while loop; if I leave the loop and the flag is set, it means there were numbers in the string, and I need a newline (System.out.println();). Otherwise, no need for a newline (so a text only line doesn't result in an empty space). I was using an online Java compiler so couldn't test the file I/O part of your code - but I think this should help you...

http://stackoverflow.com/q/21209061
tagged with: arguments
tagged with: properties
tagged with: java
tagged with: unit-testing
has body: Requirement : I need to pass user details to my JUnit tests using Ant build file. Limitation : It's a large project with a number of build files and I'm not allowed to change much and so, passing the properties as JUnit arg is not an option. Alternative : Pass the parameters as Ant arguments, write them in a property file and read it in my tests. Since the Java property file is updated during runtime, I won't be able to access the resource object in a static way as below: Class A { private static Resources ab = new Resources(A.class); public static getResourceString(String id) { return ab.getResourceString(id); } } In my tests, accessing using A.getResourceString("user1"); I think, I'll need to use something like new A().getResourceString(id); after making the resource ab not static. But this does not seem to be the perfect way (assuming this will work). Is there any flaw with the above argument? Is there any other alternative? Note: sending parameters as Java or Junit arg is not an option.
type: Question
tagged with: ant
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21210012
type: UnansweredQuestion
has title: Using Ant to write to a property file to be used in JAVA

http://stackoverflow.com/a/21214364
score: -4
has body: Use might use this Thread.sleep((long)(1000/30-Gdx.graphics.getDeltaTime())); change the value of 30 to FPS you want.
type: Answer
accepted answer of: http://stackoverflow.com/q/21204258
answers question: http://stackoverflow.com/q/21204258
downvote count: 9
upvote count: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/70025036
has comment: http://stackoverflow.com/comment/43306660

http://stackoverflow.com/comment/31982614
has text: You can't alter a List in loops or using iterator.. Instead check if your list "contains" the object , if yes, remove it and set the flag.
score: 2
comment on: http://stackoverflow.com/q/21233123
type: Comment
type: QuestionComment

spring-java-config
tags question: http://stackoverflow.com/q/21331795
type: Tag
tags question: http://stackoverflow.com/q/21335182
tag name: spring-java-config
tags question: http://stackoverflow.com/q/21342788

http://stackoverflow.com/q/21274977
has answer: http://stackoverflow.com/a/21307267
tagged with: java
tagged with: eclipse-jdt
tagged with: eclipse
type: Question
tagged with: ide
tagged with: eclipse-rcp
has title: Eclipse RCP - what plugins/feature should be added to Eclipse product and how make it similar to Eclipse SDK/Standard
score: 0
answer count: 1
has body: There is Nodeclipse project http://www.nodeclipse.org/ that is a set of Eclipse plugins. I want to make Eclipse distribution for all major OSes that would have Eclipse SDK/Standard as base. There is an Eclipse plugin project with product definitions. I got hint that org.eclipse.ui.ide.workbench should be included (in .product?). What is full list of plugins to be included? (Where exactly to check?) How to accomplish building this Eclipse IDE distribution?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32057251
has comment: http://stackoverflow.com/comment/32057165

http://stackoverflow.com/comment/32051161
comment on: http://stackoverflow.com/q/21271673
score: 2
type: Comment
type: QuestionComment
has text: And remove the word `int` from before `sum += myArray[i];`

http://stackoverflow.com/q/21239573
score: 71
tagged with: dependencies
has answer: http://stackoverflow.com/a/23430661
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/31995802
has title: Maven dependency update on commandline
tagged with: maven
has answer: http://stackoverflow.com/a/69753230
answer count: 7
has answer: http://stackoverflow.com/a/21239652
upvote count: 71
tagged with: java
has answer: http://stackoverflow.com/a/57686053
tagged with: eclipse
has answer: http://stackoverflow.com/a/76807102
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21239613
has answer: http://stackoverflow.com/a/66825871
has body: I have a maven project that was built on the commandline for eclipse and one of the dependencies is constantly changing. How do I update this dependency on the commandline as I have heard that it is a bad idea to mix m2e plugin and commandline. Furthermore, I tried running mvn eclipse:eclipse on the command line and it messes up the project in eclipse removing the dependencies folder.

http://stackoverflow.com/comment/32159080
type: AnswerComment
type: Comment
has text: Well if you see me main method, you can that I have products in my GroceryList and that is what I want to print out...But cant figure out how to..
comment on: http://stackoverflow.com/a/21332434
score: 0

http://stackoverflow.com/comment/31932339
has text: As @Teepeemm said, Foo and Bar should share a common interface; otherwise you would break one of OOP principles by returning different objects (which then I suppose you would detect with an `instanceof` check)
score: 0
comment on: http://stackoverflow.com/q/21204993
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32088671
type: Comment
type: QuestionComment
score: 0
has text: Let's see your `servlet-context.xml` config.
comment on: http://stackoverflow.com/q/21293227

http://stackoverflow.com/comment/64486477
has text: @UnKnown Mine are aligned right. If your's aren't, ask a question and add a screenshot and small sample or some details of your setup.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21209628

http://stackoverflow.com/a/21275435
has body: You have misunderstood "batch size". Batch size means send "batch size" number of queries together in one go instead of sending each query as the code fires the query. Therefore in this case there will be 1000 insert queries, sent 50 times with 20 insert queries in each batch.
downvote count: 0
answers question: http://stackoverflow.com/q/21275379
type: Answer
has comment: http://stackoverflow.com/comment/32057639
score: 1
upvote count: 1

http://stackoverflow.com/comment/58637521
type: Comment
comment on: http://stackoverflow.com/a/21264427
score: 1
type: AnswerComment
has text: @MarkCramer I did notice my answer had a compile time error, which I've fixed. But other than that, I took the code from the question and this answer and it seems to work as expected. Could you perhaps create a question to provide an example of where it's not working for you?

http://stackoverflow.com/comment/32660569
has text: @Hannes - there is no need to write a plugin just to be able to share a resource between JARs, that mechanism already exists - classpath.
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21485989

http://stackoverflow.com/comment/32078382
comment on: http://stackoverflow.com/a/21282156
type: AnswerComment
has text: Indeed i was going to mark it as an answer,it's a logic problem
score: 0
type: Comment

http://stackoverflow.com/comment/32148268
type: Comment
comment on: http://stackoverflow.com/a/21322779
has text: Sorry, that `SELL_FAILURE` was copypast issue. Indeed I already wrote `TEST_LOG` there to deny anything BUT this marker. Though, it still gets logged to root...
type: AnswerComment
score: 0

http://stackoverflow.com/a/21197958
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21197930
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/21197930
has body: The problem lies in the interpretation of the varargs method Arrays.asList. It interprets the type to be int[], so that you receive back a List&lt;int[]&gt;, not a List&lt;Integer&gt;. So none of the numbers you pass in will be equal to an int[]. You could declare winningNumbers to be an array of Integers, so that the array will interpreted as you expect, and you receive a List&lt;Integer&gt; back. Your own findIfExist method works well also.

http://stackoverflow.com/q/21189541
has comment: http://stackoverflow.com/comment/31904975
has title: Collections.sort by a date property on the objects in a list
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21189657
tagged with: java
linked to: http://stackoverflow.com/q/5932720
type: Question
possible better answer: http://stackoverflow.com/a/21189977
tagged with: sorting
has answer: http://stackoverflow.com/a/21189977
has comment: http://stackoverflow.com/comment/31904660
score: 0
answer count: 2
duplicate of: http://stackoverflow.com/q/5932720
has answer: http://stackoverflow.com/a/21189657
has body: How do I use Collections.sort to sort list of objects with the following properties? I'd like to sort the list by date. public Comment { private Timestamp date; private String description; } Of course, there are getters and setters as well. Thanks!

http://stackoverflow.com/a/21208327
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21208180
type: Answer
accepted answer of: http://stackoverflow.com/q/21208180
downvote count: 0
score: 7
has body: I don't know much about servlets but the return statement is actually useless and will be removed by the compiler. The javadoc says "After using this method, the response should be considered to be committed and should not be written to." I guess you are referring to this. Imagine this snippet: if( anyErrorCondition(request) ) { response.sendError(HttpServletResponse.SC_FORBIDDEN); } // Further processing In this case, you should definitely use a return statement after calling sendError because you want to prevent further processing. This does not apply to your example which does not process the request after sending the error code but will instead reach the end of the method and return. Summing up: No, you don't need a return statement here, as long as you can guarantee that the request will not be processed after calling sendError.
upvote count: 7

http://stackoverflow.com/q/21239666
has answer: http://stackoverflow.com/a/21239733
type: Question
linked to: http://stackoverflow.com/q/65035
downvote count: 6
has comment: http://stackoverflow.com/comment/31994602
tagged with: finally
duplicate of: http://stackoverflow.com/q/65035
tagged with: exception
has comment: http://stackoverflow.com/comment/31994677
has comment: http://stackoverflow.com/comment/31994654
answer count: 1
score: -6
favorite count: 0
upvote count: 0
type: UnansweredQuestion
has body: I am study exceptions in Java and came across this snippet: public class Test { public int b() { try { System.out.println("try block"); return 0; } finally { System.out.println("Finally block!"); } } public static void main (String[] args) { Test t= new Test(); t.b(); } } Since the finally block is always executed and in this case you have a return 0 before it, will it still be executed? (What exactly would the output be).
has title: Java exceptions using finally
has comment: http://stackoverflow.com/comment/31994709
tagged with: java

http://stackoverflow.com/comment/32060930
comment on: http://stackoverflow.com/a/21277289
type: Comment
score: 0
has text: Oh, I liked that bit of the answer, just nit-picking.
type: AnswerComment

http://stackoverflow.com/comment/31992251
has text: I don't think that you can do this, as it would require a full rename refactoring on each instance name, which is a chore and will soon lead to confusion. However, you probably don't really want to do this anyway. Your example shows that you're using role names for some instance variables, this is a good practice, which you're going to break with your refactor. Although, replacing single letter variables is often a good idea.
score: 0
comment on: http://stackoverflow.com/q/21228261
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32008963
type: Comment
has text: what is this comment supposed to mean?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21247141

http://stackoverflow.com/comment/32228520
score: 0
type: AnswerComment
has text: based on this answer (http://stackoverflow.com/a/9108618/409976), then my understanding is that `Passport` would not have a foreign key constraint to `Customer`.
type: Comment
comment on: http://stackoverflow.com/a/21337132

http://stackoverflow.com/comment/32096733
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21297653
has text: So maybe add a method to reverse input, add zeroes to the end to re-size the smaller array, and then flip it back around to perform mathematical functions to it?

http://stackoverflow.com/comment/31935287
type: QuestionComment
score: 0
has text: What kind of result do you need?
comment on: http://stackoverflow.com/q/21206017
type: Comment

http://stackoverflow.com/comment/32084782
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21272021
has text: Please provide me with code as i have an assignment due and i find it very tough to do this

http://stackoverflow.com/comment/32003825
has text: Look into the concept of `classpath`.
comment on: http://stackoverflow.com/q/21244748
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/21237503
has comment: http://stackoverflow.com/comment/31991471
favorite count: 0
has answer: http://stackoverflow.com/a/21238001
has answer: http://stackoverflow.com/a/21237947
has comment: http://stackoverflow.com/comment/31991162
has comment: http://stackoverflow.com/comment/31992090
has comment: http://stackoverflow.com/comment/31991076
has comment: http://stackoverflow.com/comment/31990819
type: AnsweredQuestion
upvote count: 0
tagged with: guava
has comment: http://stackoverflow.com/comment/31991298
tagged with: java
type: Question
has title: How to convert Collection to Iterables?
score: -2
has comment: http://stackoverflow.com/comment/31990914
has body: I have method, which returns java.util.Collection I want to use Iterables.find How can I make it?
has comment: http://stackoverflow.com/comment/31991190
has comment: http://stackoverflow.com/comment/31991406
accepted answer: http://stackoverflow.com/a/21237947
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/31991295
has comment: http://stackoverflow.com/comment/31991243
possible better answer: http://stackoverflow.com/a/21238001

http://stackoverflow.com/a/21276561
has comment: http://stackoverflow.com/comment/32059422
has comment: http://stackoverflow.com/comment/32059719
score: 0
has comment: http://stackoverflow.com/comment/32059474
type: Answer
has comment: http://stackoverflow.com/comment/32059492
has comment: http://stackoverflow.com/comment/32059855
answers question: http://stackoverflow.com/q/21276424
has comment: http://stackoverflow.com/comment/32059358
has body: For the given code sample, it is only possible the reduce boilderplate by using reflection, like this: double total=0; for (int i=1; i&lt;=8;i++) if (parameters.getClass().getMethod("getParam"+i).invoke(parameters)==Boolean.TRUE) total+ = (double)data.getClass().getMethod("getParam"+i).invoke(data); return total;

http://stackoverflow.com/comment/32053790
type: AnswerComment
has text: Worked a treat, sorry for the lack of coherent formatting or description. My assignment questions are very vague and have been giving me a headache. Thanks Matthew, and all who commented.
type: Comment
comment on: http://stackoverflow.com/a/21272891
score: 1

http://stackoverflow.com/q/21248666
type: Question
tagged with: time
accepted answer: http://stackoverflow.com/a/21248796
has body: I'm looking for some help with a problem I've been having lately. I want to decrement from 200 down to 0, but I don't want it to be instant, but rather I want it to decrement over the course of a second. For example, at 0.5 seconds it would be at 100, 0.75 it would be a 50 and so on. If this is at all possible, I would love to hear from you guys! -Thanks so much, Brandon
score: 0
has comment: http://stackoverflow.com/comment/32010769
tagged with: java
has answer: http://stackoverflow.com/a/21248750
has comment: http://stackoverflow.com/comment/32010598
has comment: http://stackoverflow.com/comment/32010574
has answer: http://stackoverflow.com/a/21248796
has answer: http://stackoverflow.com/a/21248768
answer count: 4
possible better answer: http://stackoverflow.com/a/21248713
has comment: http://stackoverflow.com/comment/32010583
has comment: http://stackoverflow.com/comment/32010581
type: AnsweredQuestion
tagged with: decrement
has answer: http://stackoverflow.com/a/21248713
has title: Java decrement over time

http://stackoverflow.com/comment/32208876
comment on: http://stackoverflow.com/q/21349111
has text: You need to close stdin for system.in to signal EOF. Just use the file redirection feature of your shell. Btw this is no longer a programming question but a basic question about how stdin works, which is OS dependent.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32088367
has text: Could i used this in java or is it better to write a script in c++?
comment on: http://stackoverflow.com/a/21288766
type: AnswerComment
score: 0
type: Comment

xml-namespaces
tags question: http://stackoverflow.com/q/21348899
tag name: xml-namespaces
type: Tag
tags question: http://stackoverflow.com/q/21309795

http://stackoverflow.com/q/21330263
score: 0
answer count: 1
has body: Im trying to generate security with username token in axis2 with rampart. String securityPolicyPath = "/WEB-INF/policy.xml"; ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("/axis2-1.6.2/repository/", "/WEB-INF/conf/axis2.xml"); CalAddStub stub = new CalAddStub(ctx,"http://localhost:8090/RampartTest/services/CalAdd/"); ServiceClient sc = stub._getServiceClient(); sc.engageModule("rampart"); Options options = sc.getOptions(); options.setUserName("apache"); options.setPassword("password"); options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,loadPolicy(securityPolicyPath)); Add_cal add = new Add_cal(); add.setX(6); add.setY(9); System.out.println("id = " + stub.add_cal(add).get_return()); but I'm getting this exception. [INFO] Deploying Web service: version.aar - file:/C:/axis2-1.6.2/repository/services/version.aar Exception in thread "main" java.lang.NoClassDefFoundError: org/jaxen/JaxenException at org.apache.rampart.handler.WSDoAllSender.processBasic(WSDoAllSender.java:108) at org.apache.rampart.handler.WSDoAllSender.processMessage(WSDoAllSender.java:72) at org.apache.rampart.handler.WSDoAllHandler.invoke(WSDoAllHandler.java:72) at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340) at org.apache.axis2.engine.Phase.invoke(Phase.java:313) at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:427)
type: UnansweredQuestion
tagged with: web-services
has title: Secure axis2 with username token
has answer: http://stackoverflow.com/a/21330489
tagged with: rampart
tagged with: java
tagged with: apache-axis
type: Question
tagged with: apache

http://stackoverflow.com/a/21280348
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21278880
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21278880
has body: From the looks of the linked question, it is the title element of the information section. So for the JNLP shown at Structure of the JNLP File it would be Dynamic Tree Demo. ..if I'm making an applet, should it be "Applet-Name" instead of "Application-Name"? I doubt it. Note that one Jar might contain an hybrid application/applet - one that can be deployed either way. They would have the same title, so it unnecessary to distinguish between the two (in the title element or the manifest).

http://stackoverflow.com/comment/32020848
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21254985
has text: your loop never fails
type: Comment

http://stackoverflow.com/comment/32148505
type: AnswerComment
type: Comment
has text: Sorry, that doesent quite work for me. In this example this cant be seen but in my actual code the second result is based on the first one so they have to be in the same test. Imagine that there is an counter in first function and with every call it increments and when its > 2 then the function returns, otherwise it calls doSeconds().
comment on: http://stackoverflow.com/a/21318102
score: 0

error-handling
tags question: http://stackoverflow.com/q/21345609
tag name: error-handling
tags question: http://stackoverflow.com/q/21293045
tags question: http://stackoverflow.com/q/21284299
tags question: http://stackoverflow.com/q/21337100
tags question: http://stackoverflow.com/q/21283553
type: Tag

http://stackoverflow.com/comment/37051200
type: Comment
comment on: http://stackoverflow.com/a/22758739
score: 0
type: AnswerComment
has text: can u answer me on this question: http://stackoverflow.com/questions/24034598/flexicapture-processor-recognize-only-first-page-of-document

http://stackoverflow.com/a/21297675
accepted answer of: http://stackoverflow.com/q/21297614
score: 0
answers question: http://stackoverflow.com/q/21297614
type: Answer
has body: Because the two threads are running at once there is no guarantee or control at all as to which runs when or in what order. The get could run completely before the set, the set could run completely first, or they could run all mixed up. An even interleaving like you display above is very unlikely to happen. In that case the list has been filled fully by one thread, however the empty thread ran first and exited when it discovered there was nothing in the list. Add diagnostics to show when each thread starts and ends and you should see that. The results will vary with every run though. At the moment your notify does nothing as you have nothing waiting. To make the threads alternate then after each write or read you should notify and then wait. You would need to synchronize the whole block though and essentially you end up with a very complicated way to get the same result as one thread running.
has comment: http://stackoverflow.com/comment/32096901
has comment: http://stackoverflow.com/comment/32096845
has comment: http://stackoverflow.com/comment/32096736
has comment: http://stackoverflow.com/comment/32096728
type: AcceptedAnswer

http://stackoverflow.com/comment/32062453
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21278135
type: Comment
has text: Thanks. But I only get 3, sometimes 4, digits. How can I get more? Thanks in advance.

http://stackoverflow.com/a/21318705
has comment: http://stackoverflow.com/comment/32133900
has comment: http://stackoverflow.com/comment/32133833
type: AcceptedAnswer
score: 4
answers question: http://stackoverflow.com/q/21318650
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/32134245
accepted answer of: http://stackoverflow.com/q/21318650
has comment: http://stackoverflow.com/comment/32134415
downvote count: 0
has body: This is a call to a generic method with Integer passed in as a type parameter. See here: Java-syntax for explicitly specifiying generic arguments in method calls http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12
has comment: http://stackoverflow.com/comment/32133749

http://stackoverflow.com/q/21194275
has comment: http://stackoverflow.com/comment/54472803
has body: I'm new to the deployment of Java programs. I'm trying to make my Java class (.class) files into executable (.exe) files. My JRE and JDK version are 1.7.0_25. I had a source file and made it into an executable jar (.jar) with the command: java cfm NameOfJar.jar manifest.txt SourceFile.class When I ran the command: java -jar NameOfJar.jar the program ran fine. I then installed "Launch4J" and "JSmooth" for Windows and followed all directions to make an executable file. When I clicked on the executable file from Launch4J, nothing happened; when I clicked on the executable made from JSmooth, a Command Prompt window opened and closed quickly. When I ran the program through Command Prompt, this is what showed up: C:\Users\Jon\Documents&gt;NameOfExe.exe Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file) where options include: -d32 use a 32-bit data model if available ...more options here... -splash:&lt;imagepath&gt; show splash screen with specified image See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details. What did I do wrong in this process? How should I fix it? Thanks.
tagged with: deployment
has title: When I run my executable (.exe), it shows Java help menu
upvote count: 1
tagged with: executable
tagged with: java
type: UnansweredQuestion
tagged with: class
has comment: http://stackoverflow.com/comment/31913725
answer count: 0
downvote count: 0
tagged with: executable-jar
score: 1
favorite count: 0
type: Question

http://stackoverflow.com/q/21328804
tagged with: playframework
has body: I am using scala 2.2 with play-framework 2.2 I dont know either it is possible or not but I have to log-out all users forcefully from the site. I know this is not going to help me. Redirect("/").withNewSession
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/21354566
has comment: http://stackoverflow.com/comment/32172361
has comment: http://stackoverflow.com/comment/32184359
tagged with: scala
type: UnansweredQuestion
tagged with: session-cookies
has title: How to expire the session of all users from the admin panel
tagged with: session
tagged with: java
type: Question

http://stackoverflow.com/q/21241591
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26895045
has title: How do I test collision between two rectangles, one with multiple instances of its class?
tagged with: java
tagged with: lwjgl
type: Question
has body: This is more of a question of logic than code, I do believe. I have two rectangles (of class "RedBlock"), referenced by "Main.blocks[]" and another rectangle (of class "MainCharacter"), whose class this code comes from. The rectangle of class "MainCharacter" should stop moving when it collides with either of the rectangles in the "Block" array (named "blocks"). Since it is in a "for" loop, any "if" statement inside the block must be true for both instances of "Block" for it to keep the "MainCharacter' from moving. Also, since the code is run twice, the "movementSpeed" seems to be doubled, caused by the "setX()" method being called twice. My problem, therefore, is that I cannot test collision between one of the two blocks, but only between both blocks at the same time, and that I cannot accurately control the speed of the "MainCharacter" (as it is relative to the number of blocks). Can you tell me what I am doing wrong? If you have a superior form of collision detection at hand, feel free to include that in your answer. for (int i = 0; i &lt;= Main.blocks.length - 1; i++) { if (Main.blocks[i] != null) { if (Keyboard.isKeyDown(Keyboard.KEY_D)) { if (Math.abs(getRight() - Main.blocks[i].getLeft()) &lt; movementSpeed &amp;&amp; getBottom() &lt;= Main.blocks[i].getTop() &amp;&amp; getTop() &gt;= Main.blocks[i].getBottom()) { setX(getX() + Math.abs(getRight() - Main.blocks[i].getLeft())); } else { setX(getX() + movementSpeed); } } else if (Keyboard.isKeyDown(Keyboard.KEY_A)) { if (Math.abs(getLeft() - Main.blocks[i].getRight()) &lt; movementSpeed &amp;&amp; getBottom() &lt;= Main.blocks[i].getTop() &amp;&amp; getTop() &gt;= Main.blocks[i].getBottom()) { setX(getX() - Math.abs(getLeft() - Main.blocks[i].getRight())); } else { setX(getX() - movementSpeed); } } if (Keyboard.isKeyDown(Keyboard.KEY_S)) { if (Math.abs(getBottom() - Main.blocks[i].getTop()) &lt; movementSpeed &amp;&amp; getLeft() &lt;= Main.blocks[i].getRight() &amp;&amp; getRight() &gt;= Main.blocks[i].getLeft(…
tagged with: logic

http://stackoverflow.com/comment/31932377
score: 1
type: Comment
type: QuestionComment
has text: `JavaScript != Java` :)
comment on: http://stackoverflow.com/q/21205029

http://stackoverflow.com/comment/32143882
has text: +1 for the use of reflection.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21324308

http://stackoverflow.com/a/21205895
has comment: http://stackoverflow.com/comment/31933971
answers question: http://stackoverflow.com/q/21205843
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21205843
type: AcceptedAnswer
has body: Yes "this" is the lock Yes The lock is on Main.class so if the lock in c is already acquired d can't be accessed by another thread. in point 3. e() can always be accessed by multiple threads no matter what since its not synchronized. Hope that helps :)
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31934263
has comment: http://stackoverflow.com/comment/31934747

http://stackoverflow.com/q/21245140
score: 0
answer count: 3
tagged with: file
has comment: http://stackoverflow.com/comment/32004571
has comment: http://stackoverflow.com/comment/32004541
has answer: http://stackoverflow.com/a/21245324
tagged with: java
has comment: http://stackoverflow.com/comment/32004697
accepted answer: http://stackoverflow.com/a/21245218
possible better answer: http://stackoverflow.com/a/21245237
has comment: http://stackoverflow.com/comment/32004654
has answer: http://stackoverflow.com/a/21245237
type: AnsweredQuestion
has body: boolean flag = new File("C:/Users/Username/somefolder/.../somefolder/somename.ogg").isFile(); System.out.println("isFile: " + flag); Returns: isFile: false I want to appear as a file. What am I doing wrong?
has comment: http://stackoverflow.com/comment/32004607
tagged with: directory
type: Question
has comment: http://stackoverflow.com/comment/32004930
has comment: http://stackoverflow.com/comment/32004646
has title: New file recognized as folder
has answer: http://stackoverflow.com/a/21245218

http://stackoverflow.com/q/21334920
has comment: http://stackoverflow.com/comment/32162165
has title: How to implement a for loop inside a while loop?
tagged with: while-loop
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21335065
has answer: http://stackoverflow.com/a/21335354
type: Question
has body: sorry for asking such an in depth question, but I'm very lost. I am working on a problem and I am stuck. I am supposed to make a basic menu driven calculator that add, subtract, multiply, divide, or generate a random number between an upper and lower limit. I made that without too much difficulty, but now I need to change it so that after it performs an operation it starts over again and displays the menu. Also, if I enter an invalid response, it needs to let them try again until they enter a valid one UNLESS they enter an invalid response THREE TIMES IN A ROW; then it needs to display a message about trying again later and exiting the program. This is there I am stuck. I have tried every combination of for and while in the following code but i can not get this to work. I would really appreciate any pointers. Here are the requirements: The menu is repeatedly displayed until a valid option is entered If the user enters three invalid choices in a row, the program ends If the user enters two invalid choices, then a valid one, then another invalid one, the program does NOT end The program computes the correct answers for each menu option The program continues after a valid operation by re-displaying the menu The program ends when the user chooses the Quit option from the menu • The program does not end on division by zero – just display an error message and allow the user to retry And here is what i have thus far. import java.util.Scanner; public class BasicCalculator { public static void main(String[] args) { Scanner input = new Scanner(System.in); double numONE = 0.0; double numTWO = 0.0; double upperLimit = 0.0; double lowerLimit = 0.0; System.out.println("MENU"); System.out.println("1. +"); System.out.println("2. -"); System.out.println("3. *"); System.out.println("4. /"); System.out.println("5. Generate a random number."); System.out.println("6. Quit"); System.out.println("What would you like to do?"); int menuSelect = input.nextInt(); //Selects an item from the me…
has answer: http://stackoverflow.com/a/21335411
has answer: http://stackoverflow.com/a/21335140
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/21335140
tagged with: for-loop
has answer: http://stackoverflow.com/a/21335184
tagged with: nested-loops
answer count: 5
accepted answer: http://stackoverflow.com/a/21335411

http://stackoverflow.com/q/21201288
type: Question
has comment: http://stackoverflow.com/comment/31926226
has title: Assertion Error issue
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/21201352
favorite count: 0
has body: I have posted this elsewhere, no solution yet, so posting it here as well. The below mentioned code is not throwing an assertion error as I expected it to since num is less than 5. Hope someone can advise. Thank you. public class Wrong { public static void main(String[] args) { Wrong wrong = new Wrong(); wrong.methodE(3); } //AssertionError void methodE(int num) { assert(num&gt;5); } }
tagged with: ocpjp
has answer: http://stackoverflow.com/a/21201365
tagged with: exception
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2758224
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/31967637
type: Comment
comment on: http://stackoverflow.com/a/21224387
has text: Then I get: The method init(PApplet) in the type Ani is not applicable for the arguments (VIsualization.visualization) FYI visualization is what i named my class.
score: 0
type: AnswerComment

http://stackoverflow.com/a/21288280
answers question: http://stackoverflow.com/q/21288104
score: 0
type: Answer
has body: When someone connects with an app using Facebook Login, the app will be able to obtain an access token which provides temporary, secure access to Facebook APIs. An access token is an opaque string that identifies a user, app, or page and can be used by the app to make graph API calls. Access tokens are obtained via a number of methods, each of which are covered later in this document. The token includes information about when the token will expire and which app generated the token. Because of privacy checks, the majority of API calls on Facebook need to include an access token. There are different types of access tokens to support different use cases: User Access Token – The user token is the most commonly used type of token. This kind of access token is needed any time the app calls an API to read, modify or write a specific person's Facebook data on their behalf. User access tokens are generally obtained via a login dialog and require a person to permit your app to obtain one. App Access Token – This kind of access token is needed to modify and read the app settings. It can also be used to publish Open Graph actions. It is generated using a pre-agreed secret between the app and Facebook and is then used during calls that change app-wide settings. You obtain an app access token via a server-to-server call. Page Access Token – These access tokens are similar to user access tokens, except that they provide permission to APIs that read, write or modify the data belonging to a Facebook Page. To obtain a page access token you need to start by obtaining a user access token and asking for the manage_pages permission. Once you have the user access token you then get the page access token via the Graph API. Client Token - The client token is an identifier that you can embed into native mobile binaries or desktop apps to identify your app. The client token isn't meant to be a secret identifier because it's embedded in applications. The client token is used to access app-leve…

http://stackoverflow.com/comment/32168758
comment on: http://stackoverflow.com/a/21337920
type: Comment
type: AnswerComment
has text: @RyanCarlson yes sir i already checked it 100checked :) hehe .
score: 0

http://stackoverflow.com/a/21320544
accepted answer of: http://stackoverflow.com/q/21319450
upvote count: 26
type: Answer
downvote count: 0
has body: Most Spring MVC applications have one root context containing all service layer / DAO layer beans, and one servlet context per spring dispatcher servlet of the application, which contains (at least) the controllers of each servlet. The idea being that is that one application might have several servlet dispatchers, for example one for URL /shopping/* and the other for URL /reporting/*, each with it's own set of controllers. The controllers of one servlet dispatcher are isolated from each other, meaning although they are also Spring beans, they cannot be injected in each other. Service layer and DAO beans in the root context are visible in all servlet contexts, so Service layer beans can be injected in any controller, but not the other way around. The root context is said to be the parent of the controller servlet context/contexts. It's all meant to be a mechanism of isolating groups of beans from each other to ensure no unmeant dependencies are possible. Given this and going through the questions: If I'm trying to create TimeServiceWs bean inside root application context, as expected it doesn't see SimpMessagingTemplate bean and throws NoSuchBeanDefinitionException: Move the SimpleMessagingTemplate to the root context, it's a bean like a DAO that can be useful anywhere in the application so it should be in the shared root context. If I'm trying to create TimeServiceWs bean inside servlet context, then I'm unable to autowire it to any another service: If it's meant to be autowired to other services, leave it in the root context then. - If I move all my configurations to servlet context, all beans are successfully created, but I get java.lang.IllegalStateException: No WebApplicationContext found: Do the opposite, move basically all beans to the root context, and leave on the servlet context only the beans that are specific of that part of the application, many times only the controllers.
score: 26
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21319450
has comment: http://stackoverflow.com/comment/50802674
has comment: http://stackoverflow.com/comment/34578087

http://stackoverflow.com/comment/32174254
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21338153
type: Comment
has text: @Jakob Jenkov I didn't say throw. I said throw TO. Also, he isn't saving any data. He's displaying the data. Finally, edit your comments rather than double posting.

http://stackoverflow.com/comment/31939148
type: Comment
comment on: http://stackoverflow.com/a/21207036
type: AnswerComment
has text: Why is this interesting? Well my apartment might not allow animal pets, thus ruling out ANY kind of animal, or it might allow cats but not dogs, using certain types of animals but not others. Abstract types and generalities is used to specify rules and contracts.
score: 0

http://stackoverflow.com/a/21202668
type: AcceptedAnswer
has body: As the error says - there are 2 versions of a jar - android-support-v4.jar. Either make FB use your version of android-support-v4 or use FB's version of android-support-v4.jar in your project. The jar will be in project-name/libs folder.
type: Answer
has comment: http://stackoverflow.com/comment/31928559
has comment: http://stackoverflow.com/comment/31928479
has comment: http://stackoverflow.com/comment/31928739
has comment: http://stackoverflow.com/comment/31928481
has comment: http://stackoverflow.com/comment/31928917
has comment: http://stackoverflow.com/comment/31928958
answers question: http://stackoverflow.com/q/21202582
accepted answer of: http://stackoverflow.com/q/21202582
score: 0
has comment: http://stackoverflow.com/comment/31928717

http://stackoverflow.com/comment/32109769
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21301893
has text: @J_User, as my original answer stated, use getRGB() to read the bytes directly. The images is not stored as a JPEG internally, so the bytes you get (from getRGB) will not be in any compressed format. You can easily use the code above to write to a temp file or memory buffer then read it back out in JPEG format.
type: Comment

http://stackoverflow.com/comment/32019552
type: Comment
has text: I can't find the problem on that! Once you've defined the inputText as required, the actionListener will only be called if the this.attributeValue is not null (or empty). Are you getting something from that **System.out.println("this.attributevalue = " + this.attributeValue);**?
comment on: http://stackoverflow.com/a/21233966
type: AnswerComment
score: 0

http://stackoverflow.com/a/21347751
score: 2
answers question: http://stackoverflow.com/q/21347670
has comment: http://stackoverflow.com/comment/32203563
upvote count: 3
downvote count: 1
has body: There are a lot of object creations in the test for Java built-inserialization and that is probably a significant overhead. Can you try to put new Gson() inside the loop and run again. I still expect the Java built-in function to be slower because it copies more bytes and creates more objects than Gson. Update I ran your code with no modification on my machine and it turns out that Gson is much slower than Java built-in serialization. Serialization cost: 21163ms Gson cost: 72636ms
type: Answer

http://stackoverflow.com/comment/31998725
comment on: http://stackoverflow.com/q/21241721
score: 0
type: Comment
type: QuestionComment
has text: I am using an Artifactory Repo

http://stackoverflow.com/comment/42484994
comment on: http://stackoverflow.com/a/25312367
type: Comment
score: 0
type: AnswerComment
has text: @James_D Although I left this alone a while ago, I appreciate the effort.

http://stackoverflow.com/a/21291423
has comment: http://stackoverflow.com/comment/32086501
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32086660
answers question: http://stackoverflow.com/q/21291283
score: 4
upvote count: 4
has body: When this happens normally, it means that the cast isn't really checking anything. Here's a concrete example: import java.util.*; public class Test { public static void main(String args[]) { List&lt;String&gt; strings = new ArrayList&lt;String&gt;(); strings.add("Foo"); Object o = strings; if (o instanceof List) { List&lt;Integer&gt; integers = (List&lt;Integer&gt;) o; System.out.println("The cast 'worked'"); Integer firstInteger = integers.get(0); // ClassCastException } } } At execution time, there's no such thing as a List&lt;Integer&gt; - there's just a List which happens to contain Integer references, and a List which happens to contain String references, etc. So the only execution-time check a cast to List&lt;Integer&gt; performs is that it really is a List. In your actual code, you had: interface B&lt;T&gt; extends A { ... } That's using the raw type... which means that just because you've got a reference to an A&lt;Foo&gt; which is also a B, it doesn't need to really be a B&lt;Foo&gt;. When you're using raw types, all kinds of bets are off :) In the code you posted, with: interface B&lt;T&gt; extends A&lt;T&gt; { ... } you don't have a warning, because if you've genuinely got an A&lt;Foo&gt; which is a B, it must be a B&lt;Foo&gt;. (Of course, you could only have an A&lt;Foo&gt; via another unsafe cast, but that means the problem occurs earlier on.) See the Java Generics FAQ on type erasure and on raw types for more details.

http://stackoverflow.com/comment/32184976
type: Comment
has text: now i am getting this error in my logcat :- "java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pumaguard.pumaguard/com.pumaguard.pumaguard.map}: android.view.InflateException: Binary XML file line #8: Error inflating class fragment"
comment on: http://stackoverflow.com/a/21346887
type: AnswerComment
score: 0

http://stackoverflow.com/a/21329456
type: Answer
answers question: http://stackoverflow.com/q/21328099
score: 1
upvote count: 1
downvote count: 0
has body: I tried the code you gave and ran into the same problem with the uppercase PNG file. Later, when using 'ball.png', and using the below command: java -classpath test.jar MainClass I am able to access the image. What is the command you are using? Output of jar -tf Test.jar: META-INF/MANIFEST.MF .classpath Test.class sprites/ball.png .project

http://stackoverflow.com/q/21214511
score: 0
answer count: 1
tagged with: wifi-direct
has body: I going to develop desktop application to transfer data using wifi peer to peer connection. What I want to do is display available connections in my app and facilitate user to create connection with selected connection. (The connecting machine also running this application.) Need some kind of guidance to do this.
tagged with: windows
has answer: http://stackoverflow.com/a/21214544
accepted answer: http://stackoverflow.com/a/21214544
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31949517
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31949790
tagged with: wifip2p
tagged with: network-programming
has title: Creating a wifi peer to peer connection programmatically in Java on Windows?

http://stackoverflow.com/a/21218648
has body: This is the location of google-play-services_lib \sdk\extras\google\google_play_services\libproject\google-play-services_lib From your directory, you are one step away from it.If it's not there then maybe you need to restart your computer or change your sdk path and try to re-download it.
type: Answer
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21218410

http://stackoverflow.com/comment/32023113
type: QuestionComment
comment on: http://stackoverflow.com/q/21256219
has text: @X.L.Ant : I think he did invert it. Syntax FileUtils.copyFileToDirectory(srcFile, destDir);
score: 0
type: Comment

http://stackoverflow.com/comment/32122780
type: QuestionComment
comment on: http://stackoverflow.com/q/21309983
has text: Consider that the right phase it isn't package but `tomcat7:deploy`. So when I launch `mvn tomcat7:deploy`. I would like to change web.xml. But your second option could be ok. The replacing `web.xml` is similar to original one, it is slightly different.
score: 0
type: Comment

http://stackoverflow.com/comment/31910110
type: AnswerComment
has text: okie got that point. I already have a table reporting the status of the query i think am good there .But really not sure as to how I will spawn a thread in my AOP METHOD. Am quite new to this thread concept, could you please help me with an example?
type: Comment
comment on: http://stackoverflow.com/a/21192171
score: 0

http://stackoverflow.com/a/21249451
type: Answer
score: 4
has body: ShapeDrawable sd1 = new ShapeDrawable(new RectShape()); sd1.getPaint().setColor(CommonUtilities.color); sd1.getPaint().setStyle(Style.STROKE); sd1.getPaint().setStrokeWidth(CommonUtilities.stroke); sd1.setPadding(15, 10, 15, 10); sd1.getPaint().setPathEffect( new CornerPathEffect(CommonUtilities.corner)); ln_back.setBackgroundDrawable(sd1);
has comment: http://stackoverflow.com/comment/32013895
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21249411
has comment: http://stackoverflow.com/comment/40849833
answers question: http://stackoverflow.com/q/21249411
has comment: http://stackoverflow.com/comment/32018550

http://stackoverflow.com/comment/32153700
has text: @user755806 I've updated the example as abstraction definition was not 100% correct and I've further included an example of how the XML according to the schema will look like when dealing with XSD abstraction
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21327703

http://stackoverflow.com/q/21283198
has answer: http://stackoverflow.com/a/43848517
tagged with: java
has answer: http://stackoverflow.com/a/21283776
has answer: http://stackoverflow.com/a/21283466
type: Question
has answer: http://stackoverflow.com/a/21283910
tagged with: random
has title: Non-repeating random numbers inside array JAVA
tagged with: arrays
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/21283769
accepted answer: http://stackoverflow.com/a/21283910
has comment: http://stackoverflow.com/comment/32072607
favorite count: 0
has comment: http://stackoverflow.com/comment/32071126
has comment: http://stackoverflow.com/comment/32071255
has comment: http://stackoverflow.com/comment/32071817
score: 2
has answer: http://stackoverflow.com/a/21283239
possible better answer: http://stackoverflow.com/a/21283246
upvote count: 2
has comment: http://stackoverflow.com/comment/32071111
has body: I would like to generate 6 numbers inside an array and at the same time, having it compared so it will not be the same or no repeating numbers. For example, I want to generate 1-2-3-4-5-6 in any order, and most importantly without repeating. So what I thought is to compare current array in generated array one by one and if the number repeats, it will re-run the method and randomize a number again so it will avoid repeating of numbers. Here is my code: import javax.swing.*; public class NonRepeat { public static void main(String args[]) { int Array[] = new int [6]; int login = Integer.parseInt(JOptionPane.showInputDialog("ASD")); while(login != 0) { String output=""; for(int index = 0; index&lt;6; index++) { Array[index] = numGen(); for(int loop = 0; loop &lt;6 ; loop++) { if(Array[index] == Array[loop]) { Array[index] = numGen(); } } } for(int index = 0; index&lt;6; index++) { output += Array[index] + " "; } JOptionPane.showMessageDialog(null, output); } } public static int numGen() { int random = (int)(1+Math.random()*6); return random; } } I've been thinking it for 2 hours and still cant generate 6 numbers without repeating. Hope my question will be answered. Btw, Im new in codes so please I just want to compare it using for loop or while loop and if else.
has answer: http://stackoverflow.com/a/21283246
has comment: http://stackoverflow.com/comment/32070471
linked to: http://stackoverflow.com/q/16000196
has comment: http://stackoverflow.com/comment/32103025
has comment: http://stackoverflow.com/comment/32071624
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32070426

http://stackoverflow.com/comment/32061461
has text: Check your quotation marks!
score: 0
comment on: http://stackoverflow.com/q/21277792
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23223924
score: 0
has body: Thanks for the solution. Somehow the 4.3.5 does not take the connection (Dialect) information from the hibernate.cfg.xml, use hibernate.properties file for that.
type: Answer
answers question: http://stackoverflow.com/q/21282432

http://stackoverflow.com/comment/32105780
has text: @LouisWasserman "but you couldn't do it if the elements were noncontiguous and you had more than one to deal with" - thats exactly the case.
comment on: http://stackoverflow.com/q/21294241
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21232319
has body: Java has no built-in support for templating. Your choices are: use an existing templating framework / engine, build your own templating framework / engine (or similar), or write a lot of "string bashing" code ... like in your question. You may be able to write the above code a bit more concisely using String.format(...), MessageFormat and similar, but they don't get you very far ... unless your templating is very simple. By contrast, some languages have built-in support for string interpolation, "here" documents, or a concise structure building syntax that can be adapted to templating.
answers question: http://stackoverflow.com/q/21232185
score: 0
type: Answer

http://stackoverflow.com/comment/32094884
comment on: http://stackoverflow.com/a/21293331
type: Comment
score: 0
has text: Thanks for your reply. I found that solution too much of a hassle to achieve what i wanted and i didn't quite understand its aproach. Therefore i changed the color scheme so that it doesnt hurt the eyes when it isn't transitioned from color to color. Will have to stick with it till the newer version comes out :)
type: AnswerComment

http://stackoverflow.com/q/21222720
has title: Cannot load XSD since Java 7u40
has body: I have the following code which is part of a method to load an XSD from a resource stream (i.e the XSD is a local resource): // Instantiate the registry of available DOM implementations. DOMImplementationRegistry registry = null; try { registry = DOMImplementationRegistry.newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | ClassCastException e) { LOG.fatal("Error instantiating DOM implementation registry", e); return null; } // Get the DOM implementation for "LS" as we need this to be able to pass an input stream for parsing. final DOMImplementationLS domLS = (DOMImplementationLS)registry.getDOMImplementation("LS 3.0"); // Set up the input stream for input to the parser. final LSInput lsi = domLS.createLSInput(); lsi.setCharacterStream(new InputStreamReader(input)); // Load the schema from the input stream. final XMLSchemaLoader loader = new XMLSchemaLoader(); final XSModel model = loader.load(lsi); The last line where I attempt to create the XSModel always returns null for Java 7 Update 40+ but works perfectly for Java 7 Update 25 and earlier. What could be the cause and is there a solution? I am using Java 7 64-bit on Windows 7 64-bit.
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: java
type: Question
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/a/21250899
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21250548
type: Answer
has body: First of all, initialize the Text-To-Speech object in your activity class, and then make static method with the string parameter, which contains speak method of Text-To-Speech. And call this static method from your broadcastreceiver with the string you want to announce. public static void speakOut(String message) { System.out.println("Message is: " + message); tts.speak(message, TextToSpeech.QUEUE_ADD, null); }
accepted answer of: http://stackoverflow.com/q/21250548

http://stackoverflow.com/comment/32199341
type: Comment
has text: In the @BeforeClass, I've updated UserClassTest.java
comment on: http://stackoverflow.com/a/21344002
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32521582
type: AnswerComment
has text: there is no size limit for POST. servlets provide no api to get at the raw request but using programs like wireshark http://www.wireshark.org/ or command line utilities like netcat it's possible to log all the incoming requests to see if the data is arriving well on the server.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21469450

http://stackoverflow.com/q/21349479
has body: Maybe this question was asked here before, but I couldn't find it here. It is basic question for Java developers, but here it goes: lets say I have class A with attribute a. What is the difference between these 2 constructors: public abstract class A { protected String a; public A() { a = "text"; } } The second one: public abstract class A { protected String a; public A() { this.a = "text"; //Here is the same with this } }
possible better answer: http://stackoverflow.com/a/21349504
has answer: http://stackoverflow.com/a/21349500
upvote count: 2
has answer: http://stackoverflow.com/a/21349514
has comment: http://stackoverflow.com/comment/32188972
downvote count: 1
has title: Java constructor with and without "this" before attributes
favorite count: 0
has answer: http://stackoverflow.com/a/21349504
tagged with: constructor
answer count: 5
has comment: http://stackoverflow.com/comment/32188925
has comment: http://stackoverflow.com/comment/32188990
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21349511
has answer: http://stackoverflow.com/a/21349498
accepted answer: http://stackoverflow.com/a/21349498
type: Question

http://stackoverflow.com/a/21195268
answers question: http://stackoverflow.com/q/21195208
has body: You are probably not getting an int from the nextInt() method so it's throwing the exception. Print the stack trace to see what's happening. If the Scanner is seeing a String token from the file instead, just convert to an int with Integer.valueOf(fi.next());. Really, you should be checking if there's an int available with: hasNextInt() before actually doing nextInt().
has comment: http://stackoverflow.com/comment/31915770
score: 0
type: Answer

http://stackoverflow.com/comment/32068142
type: QuestionComment
score: 0
has text: My use case is http://stackoverflow.com/questions/21281470/extracting-the-annotation-value-using-java-reflection
type: Comment
comment on: http://stackoverflow.com/q/21281736

http://stackoverflow.com/comment/32071390
score: 1
comment on: http://stackoverflow.com/q/21283649
has text: What do you want to do? What is your question?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/34896224
downvote count: 0
answers question: http://stackoverflow.com/q/21218217
score: 52
has comment: http://stackoverflow.com/comment/62734639
has comment: http://stackoverflow.com/comment/114758970
upvote count: 52
type: Answer
has comment: http://stackoverflow.com/comment/138355912
has comment: http://stackoverflow.com/comment/79531323
has body: The problem is caused by Oracle disabling hash algorithms which are no longer considered to be secure. Take a look at JRE_HOME/lib/security/java.security It contains the following properties: jdk.certpath.disabledAlgorithms jdk.tls.disabledAlgorithms You can adjust them appropriately. For example, remove MD5 from the former and MD5withRSA from the latter. Hint for docker images: there is additional config file /etc/crypto-policies/back-ends/java.config in some docker images like keycloak in my case which overrides values in java.security
has comment: http://stackoverflow.com/comment/115279294
has comment: http://stackoverflow.com/comment/134930143

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/21190809
tags question: http://stackoverflow.com/q/21222465
type: Tag
tags question: http://stackoverflow.com/q/21223561

http://stackoverflow.com/comment/31906783
has text: @JoshM But even those won't modify existing instances, which is what the OP seems to want to do. I would use an existing caching framework and forget this sillyness.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21190458

java-2d
tags question: http://stackoverflow.com/q/21302586
tags question: http://stackoverflow.com/q/21331221
tags question: http://stackoverflow.com/q/21315315
tags question: http://stackoverflow.com/q/21289897
tags question: http://stackoverflow.com/q/21203392
tag name: java-2d
tags question: http://stackoverflow.com/q/21214568
tags question: http://stackoverflow.com/q/21348036
tags question: http://stackoverflow.com/q/21206847
tags question: http://stackoverflow.com/q/21249252
tags question: http://stackoverflow.com/q/21267412
type: Tag

http://stackoverflow.com/comment/32008085
type: AnswerComment
has text: It's probably got some "out of scope" variable references. I've updated the example to be more accurate to how a GUI should work
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21246599

http://stackoverflow.com/q/21339637
answer count: 3
has answer: http://stackoverflow.com/a/36022231
accepted answer: http://stackoverflow.com/a/21339727
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: I an posting to a service via Java and receiving an Unsupported Content-Coding: text/xml error. I know that the service successfully receives and processes my post and attempts to send back the appropriate response. The service, located on another computer, emits a log. I also sent that log to the vendor that wrote the daemon/service, and was told that the service complied with my request and that the problem is on the Java end. The problems seems to be setting up the txt/xml content type of the response, judging by the error message. Error Stack Trace: org.apache.http.client.ClientProtocolException at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:188) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106) at PkgNetAccelerator32.htsLink.createLink(htsLink.java:100) ... Caused by: org.apache.http.HttpException: Unsupported Content-Coding: text/xml at org.apache.http.client.protocol.ResponseContentEncoding.process(ResponseContentEncoding.java:98) at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:139) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:200) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:85) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186) ... 14 more Source Code: String strPathLocal = "http://192.168.20.65:8080/xml/link"; HttpPost httpPost = new HttpPost(strPathLocal); String xmlPost = "&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;&lt;Whatever&gt;...&lt;/Whatever&gt;"; StringEntity entity = new StringEntity(xmlPost); entity.setContentType("text/xml"); httpPost.setEntity(entity); CloseableHttpResponse response2 = httpclient.execute(httpPost); System.out.println(response2.getStatusLine()); HttpEntity enti…
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21339726
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21339727
possible better answer: http://stackoverflow.com/a/21339726
tagged with: httprequest
tagged with: apache
downvote count: 0
favorite count: 0
has title: Java: Unsupported Content-Coding: text/xml posting text/xml

http://stackoverflow.com/a/21310309
score: 5
downvote count: 0
type: Answer
has body: You can use a layout like BoxLayout to eliminate the space. GridBagLayout isn't the only layout out there. Recommended reading: http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html You can also call JButton functions like setBorder() and setBackground() to achieve the effects you mentioned. As always, the API is your best friend: http://docs.oracle.com/javase/7/docs/api/
upvote count: 5
answers question: http://stackoverflow.com/q/21310260
has comment: http://stackoverflow.com/comment/32159429

http://stackoverflow.com/comment/31946612
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21206229
has text: +1 You stole my question :) (not about length() but in general: why people usually put it in `for()` instead of saving and using the value?)
score: 0

http://stackoverflow.com/a/62239792
upvote count: 14
score: 14
has body: Yes, a class can implement multiple interfaces. Each interface provides contract for some sort of behavior. I am attaching a detailed class diagram and shell interfaces and classes. Ceremonial example: public interface Mammal { void move(); boolean possessIntelligence(); } public interface Animal extends Mammal { void liveInJungle(); } public interface Human extends Mammal, TwoLeggedMammal, Omnivore, Hunter { void liveInCivilization(); } public interface Carnivore { void eatMeat(); } public interface Herbivore { void eatPlant(); } public interface Omnivore extends Carnivore, Herbivore { void eatBothMeatAndPlant(); } public interface FourLeggedMammal { void moveWithFourLegs(); } public interface TwoLeggedMammal { void moveWithTwoLegs(); } public interface Hunter { void huntForFood(); } public class Kangaroo implements Animal, Herbivore, TwoLeggedMammal { @Override public void liveInJungle() { System.out.println("I live in Outback country"); } @Override public void move() { moveWithTwoLegs(); } @Override public void moveWithTwoLegs() { System.out.println("I like to jump"); } @Override public void eat() { eatPlant(); } @Override public void eatPlant() { System.out.println("I like this grass"); } @Override public boolean possessIntelligence() { return false; } } public class Lion implements Animal, FourLeggedMammal, Hunter, Carnivore { @Override public void liveInJungle() { System.out.println("I am king of the jungle!"); } @Override public void move() { moveWithFourLegs(); } @Override public void moveWithFourLegs() { System.out.println("I like to run sometimes."); } @Override public void eat() { eatMeat(); } @Override public void eatMeat() { System.out.println("I like deer meat"); } @Override public boolean possessIntelligence() { return false; } @Override public void huntForFood() { System.out.println("My females hunt often"); } } public class Teacher implements Human { @Override public void liveInCivilization() { System.out.println("I live in an apartment"); } @Overri…
downvote count: 0
answers question: http://stackoverflow.com/q/21263607
type: Answer

http://stackoverflow.com/comment/32163297
type: Comment
comment on: http://stackoverflow.com/a/21335065
has text: Yeah, I noticed a few minutes ago that I was missing the invalid reset for case 5. Wasn't sure if you wanted the menu reprinting or not
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32175342
has text: I think this is a good answer for PatGreens' other question, not this one.
comment on: http://stackoverflow.com/a/21341547
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32103032
has text: This will work. You could also just inject the `UserApi` into the fragment and pass it into the constructor of `MyTask`.
type: Comment
comment on: http://stackoverflow.com/a/21285402
score: 3
type: AnswerComment

http://stackoverflow.com/comment/31925500
score: 1
comment on: http://stackoverflow.com/q/21200877
type: Comment
type: QuestionComment
has text: So just remove the already installed version first using `apt-get autoremove openjdk-7-jre` and then again try to install it.

http://stackoverflow.com/q/21326925
has answer: http://stackoverflow.com/a/21327109
answer count: 2
accepted answer: http://stackoverflow.com/a/21327109
favorite count: 0
has comment: http://stackoverflow.com/comment/32149990
possible better answer: http://stackoverflow.com/a/21327163
tagged with: android
has title: Why can not de-compile this method from android apk?
has body: I used dex2jar tool to de-compile an apk file, All code can de-compile correctly but this method, // ERROR // public void sendPacket(byte[] paramArrayOfByte) { // Byte code: // 0: new 82 android/net/LocalSocket // 3: dup // 4: invokespecial 83 android/net/LocalSocket:&lt;init&gt; ()V // 7: astore_2 // 8: aload_2 // 9: new 85 android/net/LocalSocketAddress // 12: dup // 13: ldc 87 // 15: getstatic 93 android/net/LocalSocketAddress$Namespace:FILESYSTEM Landroid/net/LocalSocketAddress$Namespace; // 18: invokespecial 96 android/net/LocalSocketAddress:&lt;init&gt; (Ljava/lang/String;Landroid/net/LocalSocketAddress$Namespace;)V // 21: invokevirtual 100 android/net/LocalSocket:connect (Landroid/net/LocalSocketAddress;)V // 24: aload_2 // 25: invokevirtual 104 android/net/LocalSocket:getOutputStream ()Ljava/io/OutputStream; // 28: astore 7 // 30: aload_2 // 31: invokevirtual 108 android/net/LocalSocket:getInputStream ()Ljava/io/InputStream; // 34: astore 8 // 36: aload 7 // 38: aload_1 // 39: invokevirtual 113 java/io/OutputStream:write ([B)V // 42: aload 7 // 44: invokevirtual 116 java/io/OutputStream:flush ()V // 47: sipush 128 // 50: newarray byte // 52: astore 9 // 54: aload 8 // 56: aload 9 // 58: invokevirtual 122 java/io/InputStream:read ([B)I // 61: pop // 62: new 124 com/qualcomm/logkit/settings/ConfigPacket // 65: dup // 66: aload 9 // 68: invokespecial 126 com/qualcomm/logkit/settings/ConfigPacket:&lt;init&gt; ([B)V // 71: astore 11 // 73: aload 11 // 75: getfield 130 com/qualcomm/logkit/settings/ConfigPacket:msg_type B // 78: tableswitch default:+26 -&gt; 104, -127:+50-&gt;128, -126:+26-&gt;104, -125:+95-&gt;173 // 105: iconst_4 // 106: invokevirtual 133 java/io/OutputStream:close ()V // 109: aload 8 // 111: invokevirtual 134 java/io/InputStream:close ()V // 114: aload_2 // 115: ifnull +7 -&gt; 122 // 118: aload_2 // 119: invokevirtual 135 android/net/LocalSocket:close ()V // 122: aload_0 // 123: iconst_0 // 124: putfield 18 com/qualcomm/logkit/settings/UnixSock…
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/32148485
type: Question
has answer: http://stackoverflow.com/a/21327163
tagged with: decompiling

http://stackoverflow.com/q/21282763
has comment: http://stackoverflow.com/comment/32070527
type: Question
has title: Loading images in listview asynchronously with callback
has answer: http://stackoverflow.com/a/34511202
answer count: 2
has body: I'm using Parse in my app, and in order to load my 'profile' images, I need to retrieve a so called Parsefile. When the Parsefile is downloaded it uses a callback to notify when it's done. Now this is generally a nice way to do things but I encountered a problem with this when using a Listview and downloading the images with an Asynctask. The problem is as follows: In my ListView adapter in the getView method, I create an AsyncTask and execute it, this AsyncTask starts the retrieveProfileImage(callBack) function. In my callback I simply start a Runnable on the UI thread to update the ImageView in the View with the new (retrieved Image). The problem however as it seems, is the fact that as soon as I start my AsyncTask, the View is returned. So I can't set the other images to the correct row. I hope my code demonstrates my problem more clearly. The ListAdapter: public class FriendListAdapter extends ArrayAdapter&lt;Profile&gt; { private int resource; private Context context; private List&lt;Profile&gt; friends; private Profile fProfile; private Bitmap profileImageBitmap; private ProgressBar friendImageProgressBar; //ui private ImageView friendImage; public FriendListAdapter(Context context, int resource, List&lt;Profile&gt; objects) { super(context, resource, objects); this.context = context; this.resource = resource; this.friends = objects; } @Override public View getView(int position, View convertView, ViewGroup parent) { TextView friendName = null; friendImage = null; View rowView = convertView; if (rowView == null) { LayoutInflater inflater = ((Activity) context).getLayoutInflater(); rowView = inflater.inflate(R.layout.friendslist_row, null); friendName = (TextView) rowView.findViewById(R.id.fName); friendImage = (ImageView) rowView .findViewById(R.id.fImage); friendImageProgressBar = (ProgressBar) rowView.findViewById(R.id.friendImageProgressBar); } else { friendName = (TextView) convertView.findViewById(R.id.fName); friendImage = (ImageView) convertView.findView…
has comment: http://stackoverflow.com/comment/32069737
score: 0
tagged with: android-listview
tagged with: android
tagged with: android-asynctask
tagged with: parse-platform
linked to: http://stackoverflow.com/q/16789676
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21290502
tagged with: java

http://stackoverflow.com/comment/31915560
comment on: http://stackoverflow.com/q/21191056
has text: I would say not. It is an MVC. The M stands for model, or data, which is really the most important element. I would say the view is the least of all important. I have used MVC architecture for software that has zero views. (Server applications before MVC was cool.) Tetris, as with most games, has data that is trivial.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21217933
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31955520
tagged with: swipe
tagged with: java
has answer: http://stackoverflow.com/a/21218084
has comment: http://stackoverflow.com/comment/31955623
accepted answer: http://stackoverflow.com/a/21218084
type: Question
tagged with: layout
tagged with: touch
duplicate of: http://stackoverflow.com/q/9469951
score: 0
answer count: 1
has body: I have two activities with two different layouts.Right now i have to click a button to change to the other layout, but i wanna to swipe on the screen, is that possible?
linked to: http://stackoverflow.com/q/9469951
has title: How to use a method to swipe between activities?

http://stackoverflow.com/a/34165874
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21208997
score: 1
has body: you can try this for horizontal search String word = ""; for (String keyWord : words) { // STEP1: Find *************IF ******************* The word is in // the Array // CODE HERE boolean found = false; for (int i = 0; i &lt; puzzle.length; i++) { String rowString = ""; for (int j = 0; j &lt; puzzle[i].length; j++) { rowString += puzzle[i][j]; if (rowString.contains(keyWord) &amp;&amp; !found) { System.out.println(keyWord); int index = rowString.indexOf(keyWord); rowString.indexOf(keyWord); // int length = keyWord.length(); for (int ii = 0; ii &lt; keyWord.length(); ii++) { solutionArray[i][index + ii] = keyWord.charAt(ii); rowString += puzzle[i][j]; System.out.println(); // length--; } found = true; } } }

http://stackoverflow.com/a/21244175
has comment: http://stackoverflow.com/comment/32003213
answers question: http://stackoverflow.com/q/21244114
upvote count: 12
accepted answer of: http://stackoverflow.com/q/21244114
score: 12
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/128216568
has body: Put into directory WebContent/WEB-INF. Resources placed into WEB-INF folder are not accessible from web, they are application internal resources. This is good, because your applicationContext.xml shouldn't be accessible from web. Other good options are WebContent/WEB-INF/classes or just src (both are equal). Files and folders with . contains Eclipse configuration files, they are internal for Eclipse - do not use them.

http://stackoverflow.com/comment/32178683
type: AnswerComment
comment on: http://stackoverflow.com/a/21338662
score: 0
type: Comment
has text: If you are sure about this logic, then create bean for `holdAndReprocess` and for `doWork` with @Async and execute it from existing bean. Draft code added.

http://stackoverflow.com/q/21313870
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/32124819
linked to: http://stackoverflow.com/q/974583
has comment: http://stackoverflow.com/comment/32124808
has title: Pure Object oriented or not
type: UnansweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/32125484
type: Question
has comment: http://stackoverflow.com/comment/32125772
score: -1
has body: I just want to know weather java is purely object oriented programming or not, cause we have int, float e.t.c primitive datatypes in java, some people say java is not purely object oriented program, but i know primitive data types also objects of "Class" class. Now here comes my actual question, if primitive data types are also objects of "Class" class then we can not store and retrieve them by using any collection class? when we try to store any primitive type in any collection class why auto boxing taking place? that means as collection Documentation says if we able to store only object not primitive data types in the collection classes then, data types are no more treated as object..!! ??
has answer: http://stackoverflow.com/a/21314555
upvote count: 2
linked to: http://stackoverflow.com/q/8790809
answer count: 3
has answer: http://stackoverflow.com/a/21314019
tagged with: oop
has answer: http://stackoverflow.com/a/21315323

http://stackoverflow.com/comment/31984071
has text: I've answered the questions, but please keep to one question per - eh - question next time.
score: 0
comment on: http://stackoverflow.com/q/21223159
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32033912
type: AnswerComment
comment on: http://stackoverflow.com/a/21262278
type: Comment
has text: so why doesn't "this.name" in his toString() give a can't resolve error?
score: 0

http://stackoverflow.com/a/21343051
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32178236
upvote count: 2
answers question: http://stackoverflow.com/q/21342342
has body: I suggest you better create two separate Maven projects. Put the (static) Java sources into the first project. Put the dynamic stuff into the second project and add a reference to the first project: org.yourgroup sub-module-1 0.0.1-SNAPSHOT Now, build and install the first project: mvn install After that you should be able to build the second project.

http://stackoverflow.com/q/21316985
tagged with: svnkit
tagged with: mocking
tagged with: junit
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/876993
favorite count: 0
score: 2
type: AnsweredQuestion
has title: Java SVNKit Mock for JUnit tests
has body: I'm working on an SVN Monitor and I need to Mock an instance of a SVNRepository for testing. I've seen this code here in another question (Mock svn instance for testing svnkit tests) import static org.junit.Assert.*; import java.io.*; import org.apache.commons.io.FileUtils; import org.junit.*; import org.tmatesoft.svn.core.*; public class SVNTest { private static final String path = "/tmp/testrepo"; SVNURL tgtURL; @Before public void setUp() throws Exception { SVNRepositoryFactoryImpl.setup(); tgtURL = SVNRepositoryFactory.createLocalRepository( new File( path ), true , false ); } @After public void tearDown() throws IOException { FileUtils.deleteDirectory(new File(path)); } @Test public void test() { fail("Not yet implemented"); } } And it works like charm, but now I need to add SVNLogEntries to the repo... I've been looking in the API but I haven't found anything useful yet. Any Ideas?
upvote count: 2
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/21735715
tagged with: java
accepted answer: http://stackoverflow.com/a/21735715

http://stackoverflow.com/comment/32167703
comment on: http://stackoverflow.com/q/21336425
score: 0
type: Comment
type: QuestionComment
has text: @acoolguy: Why not just change both bits of code to print out the lines they're reading (with the notional line number)? I suspect you'll find that it really is a problem with the line separator - I very much doubt that Scanner just "stops" reading the file...

http://stackoverflow.com/q/21217368
tagged with: draggable
tagged with: drag
type: Question
tagged with: java
has body: I'm building an application that puts labels where the user clicks on a panel (jpanel2) and also allow it to move the placed labels. I can successfully place the labels but I'm not being able to move any of them. In fact, when I try to drag a label it just disappears, in all my tries. I also tried to invoke the repaint in jPanel2 and JFrame but still no success. JPanel 2 has no Layout (free design) as want to place the labels exactly where the mouse clicked. UPDATE Here is a minimal example of the problem happening. I cannot reduce the number of panels as I'll need to put more controls on the screen (such as a jtable, menu and toolbar). public class Example extends javax.swing.JFrame { static int count = 0; public Example() { initComponents(); } @SuppressWarnings("unchecked") private void initComponents() { jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setPreferredSize(new java.awt.Dimension(600, 600)); jPanel2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jPanel2MouseClicked(evt); } }); jPanel3.setMinimumSize(new java.awt.Dimension(0, 0)); jPanel3.setLayout(new java.awt.BorderLayout()); jPanel3.add(jLabel1, java.awt.BorderLayout.CENTER); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); javax.swing.GroupLayout jPanel1Layout = n…
upvote count: 2
has comment: http://stackoverflow.com/comment/31955526
answer count: 2
has title: JLabel disappears when trying to drag it
favorite count: 0
has comment: http://stackoverflow.com/comment/31954445
tagged with: jlabel
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31955704
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21218582
has answer: http://stackoverflow.com/a/21218856
tagged with: swing

http://stackoverflow.com/comment/96905492
has text: Overflow in `isOverflow(-47483648, -100000000)` is not detected.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/50387548

http://stackoverflow.com/a/21310504
has comment: http://stackoverflow.com/comment/32130832
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: First of all, GWT is a single page application. After you have requested the application, you'll only go to the server to recieve data. I would use a struts or SpringMVC application for the logon and request the GWT application after a successfull login. Your GWT application should have a shell. This shell has an area where you can change your views. Changing a view is initiated via a place controller. Take a look at the mobileWebApp example contained in the GWT SDK examples. Also, you will find a good documentation here: MVP and Places Documentation
answers question: http://stackoverflow.com/q/21308005

jpa
tags question: http://stackoverflow.com/q/21339088
tags question: http://stackoverflow.com/q/21321814
tags question: http://stackoverflow.com/q/21329658
tags question: http://stackoverflow.com/q/21257976
tags question: http://stackoverflow.com/q/21275379
tags question: http://stackoverflow.com/q/21242479
tags question: http://stackoverflow.com/q/21326807
tags question: http://stackoverflow.com/q/21235874
tags question: http://stackoverflow.com/q/21334016
tags question: http://stackoverflow.com/q/21204245
tags question: http://stackoverflow.com/q/21290807
tags question: http://stackoverflow.com/q/21296826
tags question: http://stackoverflow.com/q/21218109
tags question: http://stackoverflow.com/q/21265850
tags question: http://stackoverflow.com/q/21316196
tags question: http://stackoverflow.com/q/21220211
tags question: http://stackoverflow.com/q/21279364
tags question: http://stackoverflow.com/q/21284569
tags question: http://stackoverflow.com/q/21304827
tags question: http://stackoverflow.com/q/21252705
tags question: http://stackoverflow.com/q/21252080
tags question: http://stackoverflow.com/q/21242532
tags question: http://stackoverflow.com/q/21240736
tags question: http://stackoverflow.com/q/21271366
tags question: http://stackoverflow.com/q/21273458
tags question: http://stackoverflow.com/q/21330330
tags question: http://stackoverflow.com/q/21320547
tags question: http://stackoverflow.com/q/21246488
type: Tag
tags question: http://stackoverflow.com/q/21340343
tags question: http://stackoverflow.com/q/21196672
tags question: http://stackoverflow.com/q/21192536
tags question: http://stackoverflow.com/q/21322451
tags question: http://stackoverflow.com/q/21265262
tags question: http://stackoverflow.com/q/21232160
tags question: http://stackoverflow.com/q/21348177
tags question: http://stackoverflow.com/q/21319031
tags question: http://stackoverflow.com/q/21250627
tags question: http://stackoverflow.com/q/21258803
tags question: http://stackoverflow.com/q/21277665
tags question: http://stackoverflow.com/q/21343839
tag name: jpa
tags question: http://stackoverflow.com/q/21279587
tags question: http://stackoverflow.com/q/21345203
tags question: http://stackoverflow.com/q/21318450
tags question: http://stackoverflow.com/q/21310507
tags question: http://stackoverflow.com/q/21266049
tags question: http://stackoverflow.com/q/21203875
tags question: http://stackoverflow.com/q/21257947
tags question: http://stackoverflow.com/q/21297315
tags question: http://stackoverflow.com/q/21293866

http://stackoverflow.com/comment/32040712
comment on: http://stackoverflow.com/a/21264990
has text: that means its not a link. thats some strange file :\ because canomialpath resolves links
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21210939
accepted answer of: http://stackoverflow.com/q/21210923
has comment: http://stackoverflow.com/comment/31956003
has comment: http://stackoverflow.com/comment/31943414
has comment: http://stackoverflow.com/comment/31943912
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31949729
has comment: http://stackoverflow.com/comment/31943476
has comment: http://stackoverflow.com/comment/31955847
has body: The stacktrace is self-explanatory : Caused by: java.lang.NoSuchMethodException: calculateClickListener There is no method named calculateClickListener(View v) in your activity. Either change in your xml: android:onClick="calculateClickListener" to android:onClick="calculateClickHandler" Or in your java code : public void calculateClickHandler(View view) to public void calculateClickListener(View view)
has comment: http://stackoverflow.com/comment/31953854
has comment: http://stackoverflow.com/comment/31943374
has comment: http://stackoverflow.com/comment/31943454
type: Answer
has comment: http://stackoverflow.com/comment/31950228
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31952110
answers question: http://stackoverflow.com/q/21210923
has comment: http://stackoverflow.com/comment/31954309
has comment: http://stackoverflow.com/comment/31950128

http://stackoverflow.com/comment/32110043
type: AnswerComment
score: 0
has text: Yes you'are right I corrected it.
type: Comment
comment on: http://stackoverflow.com/a/21305332

http://stackoverflow.com/a/21235616
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/21227665
has body: In my opinion 10G Heap for Web Application server like JBoss Etc are very huge. Big heap size means, it need more Full GC Time. As u know in full GC time, it will freeze the world. Is there any specific reason to use such big memory? If you have big memory in a box, i recommend to run # of Jboss instance in a box and load balace by using reverse proxy. It will be more efficient.
score: 3
has comment: http://stackoverflow.com/comment/32012535

http://stackoverflow.com/a/21263355
answers question: http://stackoverflow.com/q/21263321
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21263321
score: 3
upvote count: 3
type: AcceptedAnswer
type: Answer
has body: The super(String) statement is an explicit super class constructor call. All java constructors must call one or another constructor from their super classes. By default the no-args constructor is invoked, but in this way you can explicitly specify which super class constructor to invoke. The Thread class constructor that takes a String argument creates a Thread with a specific name (as opposed to automatically generated names such as Thread-1). The easiest way for you to determine what the complete program does is to actually execute it. When the start() method of a Thread instance is called the thread begins to execute (the run() method eventually gets called). As you can see, in this case, the run() method of CustomThread1 class simply calls the show(String, int) method of its Shared instance, which prints whatever it is passed into the console.

http://stackoverflow.com/q/21210962
answer count: 1
downvote count: 0
tagged with: key
favorite count: 0
has body: I am trying to make a 2d Dungeon Crawlers style game in Java. I have set it so when the x key is pressed, a knight attacks. The problem I have is that when I press the x key, the knight is set to attack but it keeps on attacking and the knight is able to keep on killing skeletons. I am wondering if there would be an easy way to timeout the key press after 500 ms. Code public Knight k = new Knight(); private class TAdapter extends KeyAdapter { public void keyReleased(KeyEvent e) { k.keyReleased(e); } public void keyPressed(KeyEvent e) { k.keyPressed(e); } } //Code in Knight public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if ((key == KeyEvent.VK_X)) { Attacking = true; } } public void keyReleased(KeyEvent e) { int key = e.getKeyCode(); if ((key == KeyEvent.VK_X)) { Attacking = false; } }
type: AnsweredQuestion
tagged with: 2d
has title: Java 2d Games Key Listener Time Limit
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21211109
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/21211109

http://stackoverflow.com/q/21220882
tagged with: hashmap
tagged with: java
has comment: http://stackoverflow.com/comment/31961281
linked to: http://stackoverflow.com/q/7146990
answer count: 6
has answer: http://stackoverflow.com/a/21221292
type: Question
has body: I was asked this question in an interview to improve the code that was provided. The provided code used lot of if statements and therefore I decided to use HashMap as retrieval would be faster. Unfortunately, I was not selected for the position. I am wondering if someone knows a better way than what I did to improve the code? /* The following Java code is responsible for creating an HTML "SELECT" list of U.S. states, allowing a user to specify his or her state. This might be used, for instance, on a credit card transaction screen. Please rewrite this code to be "better". Submit your replacement code, and please also submit a few brief comments explaining why you think your code is better than the sample. (For brevity, this sample works for only 5 states. The real version would need to work for all 50 states. But it is fine if your rewrite shows only the 5 states here.) */ /* Generates an HTML select list that can be used to select a specific U.S. state. */ public class StateUtils { public static String createStateSelectList() { return " \n" + " Alabama \n" + " Alaska \n" + " Arizona \n" + " Arkansas \n" + " California \n" // more states here + " \n" ; } /* Parses the state from an HTML form submission, converting it to the two-letter abbreviation. We need to store the two-letter abbreviation in our database. */ public static String parseSelectedState(String s) { if (s.equals("Alabama")) { return "AL"; } if (s.equals("Alaska")) { return "AK"; } if (s.equals("Arizona")) { return "AZ"; } if (s.equals("Arkansas")) { return "AR"; } if (s.equals("California")) { return "CA"; } // more states here } /* Displays the full name of the state specified by the two-letter code. */ public static String displayStateFullName(String abbr) { { if (abbr.equals("AL")) { return "Alabama"; } if (abbr.equals("AK")) { return "Alaska"; } if (abbr.equals("AZ")) { return "Arizona"; } if (abbr.equals("AR")) { return "Arkansas"; } if (abbr.equals("CA")) { return "California"; } // more states he…
has answer: http://stackoverflow.com/a/21221002
has answer: http://stackoverflow.com/a/21220951
accepted answer: http://stackoverflow.com/a/21221294
downvote count: 0
has comment: http://stackoverflow.com/comment/31961354
favorite count: 0
has comment: http://stackoverflow.com/comment/31961322
has answer: http://stackoverflow.com/a/21221048
has title: Using if-condition or HashMap?
score: 1
has answer: http://stackoverflow.com/a/21221294
upvote count: 1
possible better answer: http://stackoverflow.com/a/21220948
has comment: http://stackoverflow.com/comment/31961327
has answer: http://stackoverflow.com/a/21220948
type: AnsweredQuestion

http://stackoverflow.com/a/21342059
has body: You need to put an absolute value when doing the difference. It is done using the math class. Math.abs(temp[0]-temp[1])] Do the same for the rest of the subtractions. EDIT-it makes more sense to let your method take an array as an argument
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21341971
has comment: http://stackoverflow.com/comment/32176946
score: 2
downvote count: 0

http://stackoverflow.com/a/21227974
has comment: http://stackoverflow.com/comment/31973737
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21227908
has body: Try initialize ImageView inside for loop like below for (int i = 0; i &lt; WirelessPin.arr_WirelessItems.length; i++) { // Other Stuff ImageView imageView = new ImageView(con);// Declare and initialize here imageView.setLayoutParams(new LayoutParams(140, 84)); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setImageBitmap(bmp); imageView.setTag(WirelessPin.arr_WirelessItems[i]); //// Code

http://stackoverflow.com/comment/32175433
score: 0
comment on: http://stackoverflow.com/q/21339509
type: QuestionComment
type: Comment
has text: Can you help me out here?

http://stackoverflow.com/q/21301562
tagged with: hashmap
has answer: http://stackoverflow.com/a/21301766
tagged with: java
has comment: http://stackoverflow.com/comment/32103690
has comment: http://stackoverflow.com/comment/32103641
type: Question
has comment: http://stackoverflow.com/comment/32103222
has comment: http://stackoverflow.com/comment/32103488
answer count: 1
downvote count: 0
tagged with: hashset
tagged with: data-structures
favorite count: 0
accepted answer: http://stackoverflow.com/a/21301766
has title: Is it possible to implement a MyHashMap backed by a given HashSet implementation?
upvote count: 3
has comment: http://stackoverflow.com/comment/32103238
has body: As we all known, in Sun(Oracle) JDK, HashSet is implemented backed by a HashMap, to reuse the complicated algorithm and data structure. But, is it possible to implement a MyHashMap using java.util.HashSet as its back? If possible, how? If not, why? Please note that this question is only a discussion of coding skill, not applicable for production scenarios.
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/32007390
type: Comment
type: QuestionComment
has text: You mean: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7-b147/java/util/Stack.java ? ;-)
score: 2
comment on: http://stackoverflow.com/q/21246637

http://stackoverflow.com/a/21249138
has comment: http://stackoverflow.com/comment/32051215
type: Answer
answers question: http://stackoverflow.com/q/21248921
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21248921
score: 2
has body: The answer is: no. The method declares what it throws. If it's only declaring a top-level exception (i.e. Exception in your example) ... then that's all your IDE is going to know about / tell you to catch. To find every subclass it could throw you'd have to look at the javadocs and/or code to find the subclasses or specific subclass being thrown that you're interested in. Ultimately if you're using an API that's throwing a superclass of an exception, and there's some reason you need to know the concrete subclass ... it's a badly designed API. The point of throwing the superclass when writing an API is that there's only a single line of logic to deal with it regardless of which subclass is really being thrown.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21188176
tagged with: java
tagged with: bit-manipulation
type: Question
tagged with: c#
upvote count: 6
has comment: http://stackoverflow.com/comment/31902739
has answer: http://stackoverflow.com/a/21188554
accepted answer: http://stackoverflow.com/a/21188554
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31902430
score: 6
has title: Unsigned shift right in C# Using Java semantics for negative numbers
has body: I'm trying to port Java code to C# and I'm running into odd bugs related to the unsigned shift right operator >>> normally the code: long l = (long) ((ulong) number) &gt;&gt; 2; Would be the equivalent of Java's: long l = number &gt;&gt;&gt; 2; However for the case of -2147483648L which you might recognized as Integer.MIN_VALUE this returns a different number than it would in Java since the cast to ulong changes the semantics of the number hence I get a different result. How would something like this be possible in C#? I'd like to preserve the code semantics as much as possible since its a pretty complex body of code.
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/32022863
comment on: http://stackoverflow.com/a/21255435
score: 1
type: AnswerComment
has text: i was just about to ask what's the difference^^ ok then ;)
type: Comment

http://stackoverflow.com/q/21301894
type: AnsweredQuestion
has title: How to Zoom in/out imageView on Click using java in Android?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21302413
upvote count: 1
has comment: http://stackoverflow.com/comment/32103862
type: Question
has body: i have followed this tutorial to zoom in imageview on touch but i have an activity that have 15 images and when i click on any one image it will open new Activity and will zoom in that clicked image on new Activity so my question is How can i pass clicked image src to nextActivity so that my single method will be applicable to zoom in for all images. On new Activity (Zoom in) when i clicked on it how can i zoom out that image again. I have followed this:Zoom in Its successfully zoom in an imageview but i have no idea how to write code for zoom out.Can someone please help me on this task. Any Tutorials will be appreciated but link must contain same code as it is in this url with some few changes for zoom out
accepted answer: http://stackoverflow.com/a/21302413
downvote count: 0
answer count: 1
favorite count: 0
tagged with: zooming
tagged with: android
tagged with: android-imageview

http://stackoverflow.com/q/21333054
answer count: 2
upvote count: 0
score: -2
tagged with: android
tagged with: sqlite
favorite count: 0
type: UnansweredQuestion
has title: How to make my app run in the background
downvote count: 2
tagged with: alarm
has comment: http://stackoverflow.com/comment/32158876
has answer: http://stackoverflow.com/a/21333287
has answer: http://stackoverflow.com/a/21333079
tagged with: java
has body: I am developing an application that takes a number of tasks from user and reminds him on time. So, I need to know how to run my application in the background and how to get the data from SQLite - Date&amp;Time- to set the alarm. The class of the task: public class Task { String name; String discrb; int day , month , year ,donecheck ,periocheck,hour,minute; public Task() { name=discrb=""; donecheck =day=month=year=periocheck =0; } }
type: Question

http://stackoverflow.com/q/21347366
tagged with: java
tagged with: jfreechart
type: Question
score: 0
has title: How to remove the section label boxes surrounding the section label in pie chart
answer count: 1
has comment: http://stackoverflow.com/comment/32203517
has answer: http://stackoverflow.com/a/21363641
type: UnansweredQuestion
has body: Is it possible to remove the section label boxes from the below pie chart.I searched alot but was not able to get an answer. ![enter image description here] [1] http://tinypic.com/view.php?pic=2vkhuyp&amp;s=5 the above link is for pie chart drawn using java.I mean i dont want the percent shown inside the pie chart surrounded with a box it should just show the percent for ex.14%

http://stackoverflow.com/comment/32082625
comment on: http://stackoverflow.com/q/21264456
has text: @75inchpianist - I saw your code. Compared to looping version, will it not create additional String arrays which will be local to each method call in recursion ? Looping version creates String array only once, if we include code suggested by dasblinkenlight.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21280925
downvote count: 0
has comment: http://stackoverflow.com/comment/32105644
has answer: http://stackoverflow.com/a/21280971
favorite count: 0
accepted answer: http://stackoverflow.com/a/21309519
tagged with: android
possible better answer: http://stackoverflow.com/a/21280971
upvote count: 2
has comment: http://stackoverflow.com/comment/32066860
type: AnsweredQuestion
has body: In an Android game, I have a cycle that runs about 15 million times where I permutate word fragments and check the results against a dictionary. I notice a lot of GC calls and my main suspect is StringBuilder.toString() which always creates a new String. I'm only moderately experienced in Java and not sure how to avoid this allocation and pass the internal char array somehow to contains() directly without any allocation or copying. Simplified pseudo-code fragment that describes my problem: static HashSet&lt;String&gt;dictionary; // loaded from text file String[7] wordParts = new String[7]; // pre-filled from player data StringBuilder sb = new StringBuilder(20); for (i=15 million times) { sb.setLength(0); for (j=2-7 times) { sb.append(wordParts[j]); } if (dictionary.contains(sb.toString()) { processValidWord(); } }
tagged with: java
has answer: http://stackoverflow.com/a/21309519
has title: Java: Avoiding StringBuilder.toString() to create new String by using custom class
has comment: http://stackoverflow.com/comment/32067232
has comment: http://stackoverflow.com/comment/32067954
type: Question
answer count: 2
score: 2

http://stackoverflow.com/q/21262292
score: 2
has comment: http://stackoverflow.com/comment/32034978
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/32034866
tagged with: apache-flex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32034291
tagged with: flash-builder
has body: I have a Flex/Java application. The build is done using Maven. My IDE is Flash Builder 4.7. The server is a tomcat wrapper (vFabric tcserver). Based upon the many google searches, I added the following lines in my wrapper.conf. wrapper.java.additional.11="-Xdebug" wrapper.java.additional.12="-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n" In my Flash Builder, I have set up a debug configuration to use port 8000 on host localhost and the connection type is Socket Attach. I am using Internet Explorer to do the debugging and I DO have the debug version of the Flash player as confirmed by some Flash player debugger web site. When I try to debug, the tomcat log shows that it is listening on port 8000. netstat shows that tcp 0.0.0.0:8000 is established (it would be listening when the debug is not in progress). Within Flash Builder, in the debug perspective, it shows that it is using port 8000. The problem that I am having is, I have set breakpoints in both the Flex part and the Java part of the application. The breakpoints in the Flex get right into the Debug mode without any problem. However, the breakpoints in the Java part don't break at all. What am I missing here? Any other modifications that I need to make in order to debug the Java part of the application? The application was created using Flex SDK 4.5.1A. When I tried to import the existing maven project, it said that I needed Flash Player 10.2. The version of my Flash Player debugger is 10.2. I understand that the current version of Flash player is 11.x. If I were to upgrade my Flash player debugger version to 11.x (whatever the current version is), would I still be able to debug the Flex/Java application?
has title: Remote Debug Java part of the Flex/Java application within Flash Builder 4.7
has comment: http://stackoverflow.com/comment/32033976
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21273117
favorite count: 0
has comment: http://stackoverflow.com/comment/32034535
accepted answer: http://stackoverflow.com/a/21273117
tagged with: remote-debugging

http://stackoverflow.com/comment/32174074
comment on: http://stackoverflow.com/q/21340941
score: 0
type: Comment
type: QuestionComment
has text: What peerskillet said. Or you can use `nowyFilm.isEmpty()` to check for a zero length string (or `!nowyFilm.isEmpty()` in your case).

http://stackoverflow.com/a/21232441
downvote count: 0
has comment: http://stackoverflow.com/comment/31982180
type: Answer
accepted answer of: http://stackoverflow.com/q/21232185
answers question: http://stackoverflow.com/q/21232185
has body: You can create your own small &amp; simply template engine with few lines of code: public static void main(String[] args) throws IOException { String title = "Princes"; String name = "Luna"; String community = "Stackoverflow"; InputStream stream = DemoMailCreater.class.getResourceAsStream("demo.mail"); byte[] buffer = new byte[stream.available()]; stream.read(buffer); String text = new String(buffer); text = text.replaceAll("§TITLE§", title); text = text.replaceAll("§NAME§", name); text = text.replaceAll("§COMMUNITY§", community); System.out.println(text); } and small text file e.g. in the same folder (package) demo.mail: Dear §TITLE§ §NAME§! This is a question to §COMMUNITY§-Community for simple approach how to code with Java multiline Strings? Like this one. But it must be simple approach without using of Template-Engine-Frameworks! Thx for ...
score: 5
upvote count: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/32007471
type: Comment
has text: There are no integers between 1 and 2. So what are you trying to generate actually?
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21246696

http://stackoverflow.com/a/21313580
answers question: http://stackoverflow.com/q/21281431
type: Answer
has body: I finally wrote my own single class implementation for sending notification through APNS. Below is the code, hoping it helps. Note that the payload formatting (title, text, sound, etc.) of the notification is not here, nor is the queueing for sending to a lot of smartphones. This implementation works with or without SOCKS proxies, see the code for details. public class APNSHelper { private static SSLContext sslContext; private static SSLSocketFactory sslSocketFactory; private static SSLSocket sslSocket; private static DataOutputStream dataOutputStream; private static final String KEYSTORE_TYPE = "PKCS12"; private static final String KEY_ALGORITHM = "sunx509"; private final static byte COMMAND = 0; private static long lastSucessfulSocketUsageMillis = 0L; private static void initSSL() throws Exception { Logger.debug("ApnsHelper.initSSL() begin"); try { FileInputStream stream = new FileInputStream(Constants.IOS_CERTIFICATE_PATH); final KeyStore lks = KeyStore.getInstance(KEYSTORE_TYPE); lks.load(stream, Constants.IOS_CERTIFICATE_PASSWORD.toCharArray()); final KeyManagerFactory lkmf = KeyManagerFactory.getInstance(KEY_ALGORITHM); lkmf.init(lks, Constants.IOS_CERTIFICATE_PASSWORD.toCharArray()); final TrustManagerFactory ltmf = TrustManagerFactory.getInstance(KEY_ALGORITHM); ltmf.init((KeyStore)null); sslContext = SSLContext.getInstance("TLS"); sslContext.init(lkmf.getKeyManagers(), ltmf.getTrustManagers(), null); sslSocketFactory = sslContext.getSocketFactory(); } catch(Exception e) { Logger.error("ApnsHelper.initSSL: " + e); throw e; } Logger.debug("ApnsHelper.initSSL() end"); } private static Socket getSocket() throws Exception { Logger.debug("ApnsHelper.getSocket() begin"); if (sslSocketFactory == null) initSSL(); if (sslSocket != null) { try { dataOutputStream.close(); sslSocket.close(); } catch(Exception e) { Logger.error("ApnsHelper.getSocket(): closing sslSocket: " + e); } dataOutputStream = null; sslSocket = null; } try { Socket infraSocket = null; if (Constants…
score: 0

hudson
type: Tag
tag name: hudson
tags question: http://stackoverflow.com/q/21235520

http://stackoverflow.com/comment/32086400
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21291283
has text: @SotiriosDelimanolis: See whether my update covers all the relevant bases. Happy to keep improving :)

http://stackoverflow.com/comment/32641185
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21552804
has text: Thanks! Good to hear you like the presentation. If you find something hard to understand or you stuck somewhere. Let me know...
type: AnswerComment

variables
tag name: variables
tags question: http://stackoverflow.com/q/21239839
tags question: http://stackoverflow.com/q/21260318
tags question: http://stackoverflow.com/q/21284519
tags question: http://stackoverflow.com/q/21339902
type: Tag
tags question: http://stackoverflow.com/q/21295920
tags question: http://stackoverflow.com/q/21261674
tags question: http://stackoverflow.com/q/21279391
tags question: http://stackoverflow.com/q/21211331
tags question: http://stackoverflow.com/q/21291386
tags question: http://stackoverflow.com/q/21294112
tags question: http://stackoverflow.com/q/21196653
tags question: http://stackoverflow.com/q/21289844
tags question: http://stackoverflow.com/q/21328349
tags question: http://stackoverflow.com/q/21346974
tags question: http://stackoverflow.com/q/21198799
tags question: http://stackoverflow.com/q/21212224
tags question: http://stackoverflow.com/q/21250623
tags question: http://stackoverflow.com/q/21316634
tags question: http://stackoverflow.com/q/21196499
tags question: http://stackoverflow.com/q/21337528
tags question: http://stackoverflow.com/q/21232323
tags question: http://stackoverflow.com/q/21225569

http://stackoverflow.com/q/21215396
has body: I would like to convert my final double value i.e ( 1.0 ) to be printed out like $1.00. How is this possible in Java? I imported java.lang.* DecimalFormat formatter = new DecimalFormat("#.00"); Not sure how to get the dollar sign in there. I didn't know if there was any other way to do this aside from going "$" + .....
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/13791409
tagged with: formatting
has title: Decimal and special formatting in Java
downvote count: 1
has comment: http://stackoverflow.com/comment/31951052
type: Question
tagged with: format
has answer: http://stackoverflow.com/a/21215451
score: -1
has answer: http://stackoverflow.com/a/21215424
tagged with: decimal
has answer: http://stackoverflow.com/a/21215450
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21215441
answer count: 4
duplicate of: http://stackoverflow.com/q/13791409
tagged with: numbers

http://stackoverflow.com/comment/31949059
type: QuestionComment
score: 3
has text: why do you want micro-optimization when you don't have more than 10 items. unless you are dealing with millions of data records, what you are thinking is not worthy. it may not even help you get 1ns optimization
comment on: http://stackoverflow.com/q/21214201
type: Comment

http://stackoverflow.com/q/21250854
tagged with: php
tagged with: collections
type: AnsweredQuestion
has body: I am a rookie PHP developer and have recently migrated from a Java developer. For my initial tutorials, I have started executing sample, demo PHP programs available on the web. I am currently practicing programs on PHP collections provided to us by the PHP framework and the SplDoubleLinkedList in particular. I have a class named Awards where I am trying to create a field, _dll of the type, SplDoubleLinkedList. The source code of my Awards class is given as follows: Awards.php &lt;?php /* * 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. */ /** * This is the Award class * * @author Razor */ class Award { $_dll = new SplDoublyLinkedList(); function executeCode() { $_dll-&gt;push(2); $_dll-&gt;push(3); $_dll-&gt;unshift(5); var_dump($_dll); } } The problem here is that despite copy-pasting the code from here, the compiler is returning me a syntax error on the line where I have declared the $_dll field. The error is, unexpected: variable $_dll. expected: function, const, use, var, }, VAR_COMMENT, static, abstract, final, private, protected, public Can anyone please tell me where exactly am I going wrong? Replies at the earliest will be highly appreciated. Thank you in advance.
tagged with: java
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/21251133
score: 0
has answer: http://stackoverflow.com/a/21251133
tagged with: linked-list
has title: Cannot Create Spldoublylinkedlist

hdfs
tags question: http://stackoverflow.com/q/21235198
tags question: http://stackoverflow.com/q/21225540
tag name: hdfs
type: Tag

http://stackoverflow.com/comment/32140839
type: Comment
has text: Clarification: A class declared within another class (nested or inner class) **can** be protected. So can a nested interface. The tutorial is not quite accurate here.
type: AnswerComment
comment on: http://stackoverflow.com/a/21322512
score: 0

http://stackoverflow.com/a/21293174
has body: You can use the setTheme() method on a Context. Be sure to pay attention to the note in the documentation- you need to call setTheme() before you instantiate any Views. If you change themes while your application is open, you will need to recreate your Activity for the changes to show.
has comment: http://stackoverflow.com/comment/32088612
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21292853
score: 3
answers question: http://stackoverflow.com/q/21292853
upvote count: 3

http://stackoverflow.com/comment/32126562
type: QuestionComment
comment on: http://stackoverflow.com/q/21314184
has text: So, this requirement is for all the three names separately. Middle Name is optional, but First Name and Last Name are mandatory. I have three separate fields. So I will be validating them separately with same rules for each of them.
score: 0
type: Comment

http://stackoverflow.com/comment/31922973
comment on: http://stackoverflow.com/q/21199058
score: 0
type: Comment
type: QuestionComment
has text: @MadProgrammer at least not without some ugly hacks

http://stackoverflow.com/comment/32066676
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21279187
type: AnswerComment
has text: thank you bro. sorry im kinda new here but the loop is set to 5. and the output should be enter a number 1 enter a number -1 enter a number 1 enter a number 2 enter a number -2 the sum of all positive numbers is: 4 the product of all positive numbers is: 2

http://stackoverflow.com/comment/32311706
type: Comment
has text: match.group(1) should give me Admit to Patient or Hello There or Get There by Noon.
comment on: http://stackoverflow.com/q/21271111
score: 0
type: QuestionComment

http://stackoverflow.com/q/21223555
has title: Implementing multiple iterators in same class
upvote count: 1
has body: I was looking back over at some code that I wrote where I'd needed to different iterators, and I noticed that I'd written the first iterator as normal, like this: private class Traverse implements Iterator { int pos = 0; boolean hasNextCalled = false; @Override public boolean hasNext() { hasNextCalled = true; if(pos&lt;size()) { return true; } else { return false; } } @Override public Card next() { return cards.get(pos++); } @Override public void remove() { if (!hasNextCalled) { throw new IllegalStateException("hasNext() must be called before remove()"); } if(pos&lt;1) { throw new IllegalStateException(); } cards.remove(--pos); hasNextCalled = false; } } and then implemented the second iterator by creating a new Traverse object but then overriding all the methods: public Iterator OddEvenIterator() { Iterator it = new Traverse(){ private int pos = 0; boolean hasNextCalled = false; @Override public boolean hasNext() { hasNextCalled = true; if (pos &lt; size()) { return true; } else { return false; } } @Override public Card next() { Card nextCard = cards.get(pos); pos+=2; boolean moreCards = hasNext(); if(moreCards==false) { pos=1; } return nextCard; } @Override public void remove() { if (!hasNextCalled) { throw new IllegalStateException("hasNext() must be called before remove()"); } if (pos &lt; 1) { throw new IllegalStateException(); } pos-=2; cards.remove(pos); hasNextCalled = false; } }; return it; } I can't remember why I did this but it feels like a bad way to do it. I was wondering if there was any effective difference between these two methods?
favorite count: 0
downvote count: 0
has answer: http://stackoverflow.com/a/21223615
accepted answer: http://stackoverflow.com/a/21223615
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: overriding
type: Question
tagged with: iterator
answer count: 1

http://stackoverflow.com/a/21214485
score: 0
type: Answer
has body: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.epstudios.Countdowner/com.epstudios.Countdowner._60}; have you declared this activity in your AndroidManifest.xml? You need to declare all activities that should be reachable with an Intent in the manifest.
has comment: http://stackoverflow.com/comment/31951960
answers question: http://stackoverflow.com/q/21210245

http://stackoverflow.com/a/21265034
score: 2
answers question: http://stackoverflow.com/q/21264702
has body: You probably want to use Map.entrySet(), not Map.values(). It will provide a set of key-value pairs, which is what you want. If you are expecting the entries to be in the order you inserted them with, use LinkedHashMap instead of HashMap. Also, unimportantly, consider getting rid of the enumeration, and just use new ArrayList(myMap.entrySet()).
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/21264702

http://stackoverflow.com/q/21265576
tagged with: swing
tagged with: jbox2d
has answer: http://stackoverflow.com/a/21291342
type: Question
has body: I'm creating a graphical front-end for a JBox2D simulation. The simulation runs incrementally, and in between the updates, the contents of the simulation are supposed to be drawn. Similar to a game except without input. I only need geometric primitives to draw a JBox2D simulation. This API seemed like the simplest choice, but its design is a bit confusing. Currently I have one class called Window extending JFrame, that contains as a member another class called Renderer. The Window class only initializes itself and provides an updateDisplay() method (that is called by the main loop), that calls updateDisplay(objects) method on the Renderer. I made these two methods myself and their only purpose is to call repaint() on the Renderer. Is the JPanel supposed to be used that way? Or am I supposed to use some more sophisticated method for animation (such that involves events and/or time intervals in some back-end thread)?
tagged with: 2d
possible better answer: http://stackoverflow.com/a/21266313
has title: Is this the correct way of using Java 2D Graphics API?
has answer: http://stackoverflow.com/a/21266313
answer count: 3
linked to: http://stackoverflow.com/q/3256269
upvote count: 1
tagged with: awt
favorite count: 0
has answer: http://stackoverflow.com/a/21266240
accepted answer: http://stackoverflow.com/a/21266240
linked to: http://stackoverflow.com/q/4637215
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/29745778
downvote count: 0
linked to: http://stackoverflow.com/q/3221472
score: 1
tagged with: java

http://stackoverflow.com/a/21196054
answers question: http://stackoverflow.com/q/21195937
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31918935
has body: The error message is self-explanatory. Your DNS isn't working properly. services.gradle.org resolves correctly on my machine.
has comment: http://stackoverflow.com/comment/31917307
has comment: http://stackoverflow.com/comment/31923139
downvote count: 0

http://stackoverflow.com/q/21328328
tagged with: java-io
answer count: 3
has answer: http://stackoverflow.com/a/21328679
has comment: http://stackoverflow.com/comment/32151638
has answer: http://stackoverflow.com/a/21328751
favorite count: 0
tagged with: delete-file
has answer: http://stackoverflow.com/a/21329010
linked to: http://stackoverflow.com/q/6072828
type: AnsweredQuestion
has title: Delete files only if ALL are deletable - spare the innocent
has body: Suppose I have I directory structure like the following: MyDirectory > File1 > File2 > File3 > UndeletableFile > File4 Suppose also that I have already implemented a recursive algorithm for deleting the content of a folder and then the folder itself and/or used one of the excellent suggestions here Now here's the catch to which I can't seem to find a solution after some searching on the web and on SO: I want to delete the entire folder, but I want to do it only if it will succeed for every file and subfolder that is in there. The current implementation (of java.io.File.delete() to be precise) will delete a file immediately upon being called on it and then move on to the next file. If the deletion of a folder fails halfway through like in the example above there will be UndeletableFile and File5 as well as MyDirectory left on the system. Is there a convenince method or a best practise algorithm for this case? The goal is to let the deletable files live if the operation would fail halfway through. After all they shouldn't die if their home will survive, right? What I have thought about so far: Maybe it would be smart to just rename all files first instead of deleting them, like so MyDirectory > File1temp > File2temp > ... After that if the process fails I could traverse the directory again and re-rename all files back to normal and if it succeeds I could delete them for good. But this seams very inefficient to me, isn't there a better solution? It seems to me like this should be a common problem, please provide a link if I have overlooked something
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/779519
upvote count: 1
possible better answer: http://stackoverflow.com/a/21328751
has comment: http://stackoverflow.com/comment/32151997
type: Question
tagged with: algorithm
accepted answer: http://stackoverflow.com/a/21328679
downvote count: 0

http://stackoverflow.com/comment/31984997
type: QuestionComment
comment on: http://stackoverflow.com/q/21234384
has text: Possibly duplicate of http://stackoverflow.com/questions/4268353/is-there-a-simple-and-safe-way-to-convert-a-printwriter-into-a-printstream
score: 0
type: Comment

http://stackoverflow.com/q/21274024
tagged with: jcr
type: Question
answer count: 1
tagged with: jackrabbit
has answer: http://stackoverflow.com/a/21303580
score: 0
has comment: http://stackoverflow.com/comment/32086830
has title: Meet issue with org.apache.jackrabbit.core.security.simple.SimpleLoginModule create when cq5 login module
type: UnansweredQuestion
tagged with: aem
has body: I want to write login module for my CQ5 application so i apply this API I put this api to my servlet code but it doesn't work. Any one show me the right way ? Here is my implementation: @SlingServlet(paths = { "/bin/app/signin" }, methods = { "POST" }, metatype = true) public class SigninServlet extends SlingAllMethodsServlet { public static final Logger LOG = LoggerFactory .getLogger(SigninServlet.class); private static final long serialVersionUID = 1L; @SuppressWarnings("unchecked") @Override protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html; charset=UTF-8"); response.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); out.println("{message : start}"); Session session = JcrUtils.getSession(request); try { UserManager userManager = AccessControlUtil.getUserManager(session); //check if contain input username. Authorizable authorizable = userManager.getAuthorizable("admin"); //create credential from input username and password Credentials credential = new SimpleCredentials("admin", "admin".toCharArray()); Principal principal = authorizable.getPrincipal(); Map&lt;String, String&gt; sharedState = new HashedMap(); Map&lt;String, String&gt; options = new HashedMap(); options.put(LoginModuleConfig.PARAM_ADMIN_ID, "admin"); options.put(LoginModuleConfig.PARAM_PRINCIPAL_PROVIDER_CLASS, "org.apache.jackrabbit.core.security.principal.DefaultPrincipalProvider"); SimpleLoginModule sim = new SimpleLoginModule(); Subject subject = new Subject(); subject.getPrincipals().add(principal); subject.getPublicCredentials().add(credential); sim.initialize(subject, null, sharedState, options); sim.login(); } catch (Exception e) { out.println("{error message: " + e.getMessage() + "}"); LOG.warn(e.getMessage()); } out.flush(); } }
has comment: http://stackoverflow.com/comment/32100496
tagged with: sling
tagged with: java

http://stackoverflow.com/a/21676373
has body: Finally I found the problem. Because of some jar conflict application can't properly Identified the End point mapping. I have added Jboss-classloading.xml, then it is working fine.
answers question: http://stackoverflow.com/q/21325530
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21325530

http://stackoverflow.com/a/21189705
downvote count: 0
has body: (Edit) To pass strings back to Java you need to use NewStringUTF. Like this: jstring jStringParam = getEnv()->NewStringUTF("android_id"); jstring jandroid_id = (jstring) env->CallStaticObjectMethod(secClass,secMid,contentObj,jStringParam); // Remember to release when done! getEnv()->DeleteLocalRef(jStringParam); (Initial issue) jobject obj not attached to an instance public final static native String nGetID(); is defined as static, meaning that it won't be "attached" to any object instance. While in your JNI function The line jclass act = env->GetObjectClass(obj); - you pass in jobject obj. Try declaring nGetID() without static, that should do the trick. Is there any reason why you want it static?
has comment: http://stackoverflow.com/comment/31975291
has comment: http://stackoverflow.com/comment/31975733
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21188711
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21188711
type: Answer
has comment: http://stackoverflow.com/comment/31978008
score: 2

http://stackoverflow.com/comment/31896823
has text: There is [`psutil`](https://pypi.python.org/pypi/psutil), or just use the `os` and `subprocess` modules directly.
comment on: http://stackoverflow.com/a/21185485
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21334300
answer count: 2
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/10576386
has answer: http://stackoverflow.com/a/21479067
has comment: http://stackoverflow.com/comment/32172732
type: UnansweredQuestion
has body: I am writing a Java client side application which needs to access the Google tasks API. I am following the instructions from the page https://developers.google.com/accounts/docs/OAuth2InstalledApp and I have managed to get an authorization code. However, when I try to get an access token I keep getting an error 400 "Bad request". I was testing using the Poster add-on for Firefox. I send a post request to https://accounts.google.com/o/oauth2/token with content: code=&lt;the-code-i-got-in-step1&gt;&amp; client_id=1097620474561-gusvm8cq428h86r7pcum285cuffssncj.apps.googleusercontent.com&amp; client_secret=,my-client-secret&gt;&amp; redirect_uri=hurn:ietf:wg:oauth:2.0:oob&amp; grant_type=authorization_code Any suggestions about what I might be doing wrong?
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/21347007
type: Question
has title: Error 401 requesting access token from Google with Oauth2
has comment: http://stackoverflow.com/comment/32276204
tagged with: google-oauth-java-client
has comment: http://stackoverflow.com/comment/32266526
tagged with: java
tagged with: google-oauth

http://stackoverflow.com/a/21214297
has body: I think you are missing something like this before you start service: Service.getInstance().addGateway(gateway); Here is SMSlib example.
has comment: http://stackoverflow.com/comment/31949315
accepted answer of: http://stackoverflow.com/q/21214228
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21214228
has comment: http://stackoverflow.com/comment/31949325
type: Answer
score: 0

http://stackoverflow.com/q/21306677
has title: Android SharedPreferences/PreferenceFragment not working
tagged with: android
tagged with: android-activity
accepted answer: http://stackoverflow.com/a/21307706
type: AnsweredQuestion
has body: I recently studied the section about handling application preferences with shared preferences and the PreferenceFragment in the Android Developer Documentation and made the following simple example: SettingsActivity.java public class SettingsActivity extends PreferenceActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if(savedInstanceState == null) getFragmentManager().beginTransaction() .replace(android.R.id.content, new SettingsFragment()) .commit() } } SettingsFragment.java public class SettingsFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.settings); } } res/xml/settings.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;PreferenceCategory android:title="@string/pref_general_category"&gt; &lt;EditTextPreference android:key="@id/pref_key_apiBaseUri" android:title="@string/pref_apiBaseUri_title" android:defaultValue="@string/pref_apiBaseUri_default" android:persistent="true" android:inputType="text" android:singleLine="true" /&gt; &lt;/PreferenceCategory&gt; &lt;/PreferenceScreen&gt; Other stuff: id pref_key_apiBaseUri string pref_apiBaseUri_title "Api Base Uri" string pref_api_baseUri_default "http://acme.com/api/ Problem Straightforward stuff, eh? I started the app, went to the preference menu / activity, the preference fragment got inflated and I clicked on "Api Base Uri". An EditText dialog popped up, I changed "http://acme.com/api" to "http://acme.com/api2" and pressed on OK. Now, as far as I understood the documentation, preferences should get saved automatically into the shared preferences. When I reopen the EditText dialog, I see that my changes are stored. HOWEVER.. when I close the activity (or the app) and go back to the settings, again, the default value is back, no changes have been made! W…
downvote count: 0
tagged with: sharedpreferences
tagged with: android-preferences
has answer: http://stackoverflow.com/a/21307706
type: Question
score: 3
tagged with: java
upvote count: 3
answer count: 1
favorite count: 0

http://stackoverflow.com/a/21333225
type: Answer
has body: Try this: if (c.get(Calendar.SECOND) == s){ I have removed ";" symbol Also note that long calcultions in main app thread will freezes it, so you should start background thread for your calculations.
upvote count: 5
has comment: http://stackoverflow.com/comment/32159073
accepted answer of: http://stackoverflow.com/q/21333131
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21333131
downvote count: 0
score: 5

http://stackoverflow.com/q/21349694
answer count: 3
has answer: http://stackoverflow.com/a/21349735
has answer: http://stackoverflow.com/a/21349738
has title: Android get and set layout width
type: UnansweredQuestion
tagged with: android
has body: < . . . . . . /> I want to get the width of the HorizontalScrollView1 and set it to the LinearLayout (layoutScrollContainer) This is my code in java but my app crashes , and I cant understand why . If you know how to do this with xml please tell me. HorizontalScrollView scrollView = (HorizontalScrollView) findViewById (R.id.horizontalScrollView1); LinearLayout lrLayout = (LinearLayout ) findViewById (R.id.layoutScrollContainer); int width = scrollView.getMeasuredWidth(); lrLayout.setLayoutParams(new LinearLayout.LayoutParams(width, LinearLayout.LayoutParams.MATCH_PARENT));
has answer: http://stackoverflow.com/a/26309655
tagged with: http://stackoverflow.com/tag/xml
tagged with: view
score: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/7733813
tagged with: width

http://stackoverflow.com/comment/32150327
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21327471
type: AnswerComment
has text: @MalikEhtasham, I did not test it, but just try as update config.

http://stackoverflow.com/comment/32185058
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21346887
has text: can anyone provide me a new code for google map.. i cant able to sort out this problem??
type: AnswerComment

http://stackoverflow.com/q/21222250
accepted answer: http://stackoverflow.com/a/21222477
upvote count: 1
has comment: http://stackoverflow.com/comment/31963674
has comment: http://stackoverflow.com/comment/31963855
has comment: http://stackoverflow.com/comment/31964057
downvote count: 1
has body: I have a NPE when coding my android application. I already read at least hundreds of topics about it without finding any answer. So I finally ask directly there. Here is the error : 01-19 21:13:09.886: E/AndroidRuntime(6622): FATAL EXCEPTION: main 01-19 21:13:09.886: E/AndroidRuntime(6622): java.lang.NullPointerException 01-19 21:13:09.886: E/AndroidRuntime(6622): at esstin.projet.ExpositionAdaptateur.getView(ExpositionAdaptateur.java:59) 01-19 21:13:09.886: E/AndroidRuntime(6622): at android.widget.AbsListView.obtainView(AbsListView.java:2465) 01-19 21:13:09.886: E/AndroidRuntime(6622): at android.widget.ListView.measureHeightOfChildren(ListView.java:1250) 01-19 21:13:09.886: E/AndroidRuntime(6622): at android.widget.ListView.onMeasure(ListView.java:1162) 01-19 21:13:09.886: E/AndroidRuntime(6622): at android.view.View.measure(View.java:15504) 01-19 21:13:09.886: E/AndroidRuntime(6622): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5059) 01-19 21:13:09.886: E/AndroidRuntime(6622): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1396) 01-19 21:13:09.886: E/AndroidRuntime(6622): at android.widget.LinearLayout.measureVertical(LinearLayout.java:681) 01-19 21:13:09.886: E/AndroidRuntime(6622): at android.widget.LinearLayout.onMeasure(LinearLayout.java:574) 01-19 21:13:09.886: E/AndroidRuntime(6622): at android.view.View.measure(View.java:15504) 01-19 21:13:09.886: E/AndroidRuntime(6622): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5059) 01-19 21:13:09.886: E/AndroidRuntime(6622): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) 01-19 21:13:09.886: E/AndroidRuntime(6622): at android.view.View.measure(View.java:15504) 01-19 21:13:09.886: E/AndroidRuntime(6622): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5059) 01-19 21:13:09.886: E/AndroidRuntime(6622): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1396) 01-19 21:13:09.886: E/AndroidRuntime(6622)…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31964488
has comment: http://stackoverflow.com/comment/31963837
tagged with: java
tagged with: listview
type: Question
has comment: http://stackoverflow.com/comment/31963636
has comment: http://stackoverflow.com/comment/31963641
has comment: http://stackoverflow.com/comment/31964579
has comment: http://stackoverflow.com/comment/31963667
has comment: http://stackoverflow.com/comment/31963888
answer count: 1
has comment: http://stackoverflow.com/comment/31964242
has comment: http://stackoverflow.com/comment/31964674
has answer: http://stackoverflow.com/a/21222477
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/31963809
tagged with: custom-adapter
tagged with: android
has title: ANDROID adapter - NullPointerException at getView method (line : textView.setText())
has comment: http://stackoverflow.com/comment/31964271
favorite count: 0
has comment: http://stackoverflow.com/comment/31963925
has comment: http://stackoverflow.com/comment/31963740
has comment: http://stackoverflow.com/comment/31964046

http://stackoverflow.com/a/21326978
has comment: http://stackoverflow.com/comment/32153189
has body: 1 - It sounds like your mechanism for dynamically generating that number '4234' exists outside of Maven, and you're trying to figure out how to access that number from within Maven, correct? If so, I suggest using the buildnumber-maven-plugin which generates a number which you can then access from within Maven via the ${buildNumber} property. 2 - I suggest switching your callout from dependency:build-classpath to dependency:list -DoutputFile=xyz.txt. The latter gives you a cleaner output of just groupId/artifactId/version which should be easy to edit. Or better yet... Do the above, and simply use &lt;phase&gt; configuration to ensure dependency:list gets called before the assembly plugin runs (typically at the end of package phase), and ensure the resulting output file sits somewhere that the assembly plugin will pick it up. Hope that helps.
type: Answer
answers question: http://stackoverflow.com/q/21234302
score: 0

http://stackoverflow.com/q/21300634
linked to: http://stackoverflow.com/q/17226194
has body: I have a Java program that needs to read an excel file with a specific range that contains data, say from C6 to I6. The total number of rows will vary. After which, I want to save these data into an object, and eventually into a list. Here is an example (data start from row 6. In this case, the last row of data ends at row 10): --------------------------------------------------------------------- | C | D | E | F | G | H | I | --------------------------------------------------------------------- (row 6) | 001 |10102011 | 874837 | Y | Y | TEST001 | No | --------------------------------------------------------------------- (row 7) | 002 |11102011 | 8743834 | Y | Y | | No | --------------------------------------------------------------------- (row 8) | 003 |15102011 | 609348 | N | Y | | No | --------------------------------------------------------------------- (row 9) | 004 |20102011 | 111117 | N | Y | | No | --------------------------------------------------------------------- (row 10) | 005 |30102011 | 837437 | Y | Y | | No | --------------------------------------------------------------------- How do I iterate based on this specific range from excel in Java? I saw this CellReference in Apache POI but not sure how I should be using this. Let's assume that the paths etc has been declared something like (Updated: I have found a way that could possibly save all the lines of data, by using StringBuffer) public void prepareExcel(InputStream excel){ Workbook wb = WorkbookFactory.create(excel); Sheet sheet = wb.getSheetAt(0); StringBuffer sb = new StringBuffer(); for (int rowNum = rowStart; rowNum &lt; rowEnd; rowNum++) { Row r = sheet.getRow(rowNum); for (int cn = 5; cn &lt; 23; cn++) { Cell c = r.getCell(cn); sb.append(c); } } } The next question would be, how do I change this StringBuffer into saving to an object, and afterward to an ArrayList? Or is there any better way to do this? Assume Row H is nullable. The Object is not so crucial here, we can assume: public class S…
type: Question
score: 0
tagged with: excel
has comment: http://stackoverflow.com/comment/32110262
tagged with: apache-poi
tagged with: java
has comment: http://stackoverflow.com/comment/32185312
has comment: http://stackoverflow.com/comment/32101759
has comment: http://stackoverflow.com/comment/32101790
has comment: http://stackoverflow.com/comment/32104377
linked to: http://stackoverflow.com/q/17587116
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32106259
linked to: http://stackoverflow.com/q/16479882
has title: Iterating Excel Spreadsheet values POI
has comment: http://stackoverflow.com/comment/32106655

http://stackoverflow.com/comment/33962088
score: 0
type: AnswerComment
has text: about renderscript? i agree. wish there were better samples, tutorials and documentations.
type: Comment
comment on: http://stackoverflow.com/a/22336271

http://stackoverflow.com/q/21349568
has answer: http://stackoverflow.com/a/21349601
has answer: http://stackoverflow.com/a/21349607
has comment: http://stackoverflow.com/comment/32189094
upvote count: 2
tagged with: java
downvote count: 2
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21350117
has body: I want to extract data from different blogs. I have done it using article extractor but now I have to convert it into json format for storing into MongoDB. My program is returning entire article as string like this: String news=ArticleExtractor.INSTANCE.getText(doc); How can I convert it into json format? URL url; url = new URL("http://blogs.timesofindia.indiatimes.com/mellowdrama/entry/india-needs-a-law-against-community-crime"); InputSource is = HTMLFetcher.fetch(url).toInputSource(); BoilerpipeSAXInput in = new BoilerpipeSAXInput(is); TextDocument doc = in.getTextDocument(); news=ArticleExtractor.INSTANCE.getText(doc); System.out.println(news); JSONObject jsonObj = new JSONObject(news); this last line shows error... the error is Exception in thread "main" java.lang.Error: Unresolved compilation problem: The constructor JSONObject(String) is undefined at Article_ext.main(Article_ext.java:39)
tagged with: http://stackoverflow.com/tag/json
has title: convert a string to json format in java
score: 0
tagged with: mongodb
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/21350117
has comment: http://stackoverflow.com/comment/32189349
possible better answer: http://stackoverflow.com/a/21349607

opengl-es
tags question: http://stackoverflow.com/q/21210872
tags question: http://stackoverflow.com/q/21296798
type: Tag
tags question: http://stackoverflow.com/q/21200130
tags question: http://stackoverflow.com/q/21224152
tag name: opengl-es
tags question: http://stackoverflow.com/q/21318351
tags question: http://stackoverflow.com/q/21199072

http://stackoverflow.com/a/21348653
type: Answer
has body: I would distribute your content as a SQLite file. I've done something similar in a mobile application with the same exact use case (people creating game files and distributing them to the players) and it works pretty well. First of all BASE64 is ASCII encoded after all, so you can use the VARCHAR type to store up to 2GB, which I think in your scenario is definitely enough. You can also use an indexed column to access data in an efficient way. The best pick according the info you gave us IMHO is to create one table for each type, using a varchar primary key to access data using the key value through a simple select returning just that row. SQLite is incredibly efficient in these kind of scenarios. Another point that you can take into account is that, being binary, SQLite gives you a decent size reduction storing data in a binary file instead of a text file. This SO question explains a bit more the topic. Last but not least SQLite is very lightweight and, either natively or via a wrapper, it's avalaible for a huge number of platforms (embedded stuff included).
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/32196774
has comment: http://stackoverflow.com/comment/32196110
accepted answer of: http://stackoverflow.com/q/21346494
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21346494

http://stackoverflow.com/comment/32098341
comment on: http://stackoverflow.com/a/21298255
type: AnswerComment
has text: @Ryan answer updated - includes demo showing deserialization.
score: 0
type: Comment

http://stackoverflow.com/q/21348985
has comment: http://stackoverflow.com/comment/32188283
type: UnansweredQuestion
has title: About Drag and Drop functionality in swing
tagged with: swing
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21350530
answer count: 1
has body: I have one Button name with DATE and another is Text-field in one frame. i want to make a program in a such a way that,when i drag the this button in text-field at that time in text-field,SYSTEM DATE OF A SYSTEM will be print.Any one can solve it? if yes then help me.
score: 0
tagged with: drag-and-drop

http://stackoverflow.com/comment/31938522
has text: Share your POJO files please.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21208400

http://stackoverflow.com/comment/31958912
type: AnswerComment
has text: try doing all of it with one call ... and maybe use javascript bridge to pass debug variables back: http://stackoverflow.com/questions/7636409/android-webview-java-javascript-bridge
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21210591

http://stackoverflow.com/a/21349593
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21349322
answers question: http://stackoverflow.com/q/21349322
has body: Very basic answer. Create an interceptor class that extends HandlerInterceptorAdapter. In the preHandle method check if the user exists in session and return true only if the user exists in session. public class AuthenticationCheckInterceptor extends HandlerInterceptorAdapter { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { //Check if user exists in session. //If no, redirect to login page using response.sendRedirect() and return false //If yes, return true } } Apply this interceptor to all URLs which require you to be logged-in. A simple example is at http://www.mkyong.com/spring-mvc/spring-mvc-handler-interceptors-example/
upvote count: 1
type: AcceptedAnswer
type: Answer

jboss-weld
tags question: http://stackoverflow.com/q/21312507
tags question: http://stackoverflow.com/q/21294900
type: Tag
tag name: jboss-weld
tags question: http://stackoverflow.com/q/21287433

http://stackoverflow.com/q/21248634
type: UnansweredQuestion
has title: How to use charat(index) to count the number of specified characters when comparing strings
has comment: http://stackoverflow.com/comment/32013447
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32011281
has body: Hi I am still new when it comes to programming so I was wondering how to use the charat(index) method to compare characters in two strings each are 4 characters long. I am essentially making a random number guessing game where the user has 5 chances to guess the 4 digit number, and each time I am supposed to return a hint in the form "nAkB". "nA" is supposed to be the number of matching characters in the right index and "kB" is the number matching characters in essentially the wrong index like "2A1B". Here is an example of what the output should look like. You have 5 chances. Input your guess:1234 Hint:2A1B You have 4 chances. Input your guess:2136 Hint:0A4B You have 3 chances. Input your guess:1263 You win! This is what I get Enter your guess you have 5 chances left 1289 1234 hint 213A 196B hint 425A 396B hint 637A 600B hint 849A 808B Enter your guess you have 4 chances left 1289 1289 hint 213A 196B hint 425A 396B hint 637A 600B hint 849A 808B hint 213A 196B hint 425A 396B hint 637A 600B hint 849A 808B Enter your guess you have 3 chances left 1289 also for some reason the condition I set for winning the game is only accepted during the first iteration The problem with the hints is in the getHint() method the problem with my win condition is in the loop in the runGame() method I really really appreciate any help thank you for your time. below is my code runGame() public static String generateRandomNumber() { //Creates a string array of numbers that will be used to generate random numbers String random[]={"0","1","2","3","4","5","6","7","8","9"}; //This takes the array and shuffles it around in order to make a random number Collections.shuffle(Arrays.asList(random)); //This concatenates the fiers fouri ndex's of the array and reuturns them as a single string return random[0]+random[1]+random[2]+random[3]; } public static String getHint(String answer,String guess) { //This is the inititialization of the hint string no kidding?? String hint=""; int i, j; //This nested …
score: 0
has comment: http://stackoverflow.com/comment/32011710
tagged with: character
linked to: http://stackoverflow.com/q/9622419

http://stackoverflow.com/a/21392799
has comment: http://stackoverflow.com/comment/39563384
has comment: http://stackoverflow.com/comment/32391290
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21336296
type: Answer
accepted answer of: http://stackoverflow.com/q/21336296
has body: Sauce Labs On Demand has a great plugin for Jenkins (https://saucelabs.com/jenkins/5). Their approach is pretty simple: you check/uncheck what OSs and browsers you to test and Jenkins sets environment variables for your tests to pick up. Below is a complete example of using Spring's @Configuration: package com.acme.test; import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.WebDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; import org.springframework.core.env.Environment; @Configuration public class SauceLabsWebDriverConfiguration { @Autowired private Environment environment; @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public WebDriver webDriver() throws MalformedURLException { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("version", environment.getProperty("SELENIUM_VERSION", "17.0.1")); capabilities.setCapability("platform", environment.getProperty("SELENIUM_PLATFORM", "XP")); capabilities.setCapability("browserName", environment.getProperty("SELENIUM_BROWSER", "firefox")); String username = environment.getProperty("SAUCE_USER_NAME", "enter_your_username_here"); String accessKey = environment.getProperty("SAUCE_API_KEY", "enter_your_api_here"); return new RemoteWebDriver(new URL("http://" + username + ":" + accessKey + "@ondemand.saucelabs.com:80/wd/hub"), capabilities); } } Sauce Labs has some free plans, but if you don't want to use them, you should be able to switch out the last part that constructs the URL ("http://" + username + ":" + accessKey + "@ondemand.saucelabs.com:80/wd/hub") the actual server URL you want …

http://stackoverflow.com/q/21191688
has comment: http://stackoverflow.com/comment/31910861
tagged with: local-storage
has comment: http://stackoverflow.com/comment/31909599
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31910260
type: Question
has comment: http://stackoverflow.com/comment/31910604
has comment: http://stackoverflow.com/comment/31911064
has comment: http://stackoverflow.com/comment/31910132
tagged with: android-sdcard
has comment: http://stackoverflow.com/comment/31910327
has comment: http://stackoverflow.com/comment/31909369
has title: Android file copying using Runtime.exec() not working
tagged with: android
has body: I am trying to copy a file 'project.jpg' from my /sdcard to /sdcard/temp/ folder, but for some reason , the file isn't getting copied. I am testing using a virtual device and have transferred the file 'project.jpg' via the adb shell. The function used to copy the file is, public void $copyFile() { try { cpSrc = escapePath(this.cpSrc); cpDest = escapePath(this.cpDest); Log.d("$copyFile()","cpSrc = "+cpSrc); Log.d("$copyFile()","cpDest = "+cpDest); String destination = getFilename(cpDest,extractFilename(cpSrc)); Runtime.getRuntime().exec("dd in="+cpSrc+" of="+destination); Log.d("$copyFile()","executed command : 'dd in="+cpSrc+" of="+destination+"'"); displayToast("File Copied Sucessfully."); clearAllModes(); return; } catch(Exception e) { displayToast("$copyFile Error : "+e); this.clearCopyBuffer(); clearAllModes(); } } where escapePath() is used to escape space characters(if any) in the given paths. I got the debug Logs as follows, cpSrc = /sdcard/project.jpg cpDest = /sdcard/temp executed command : 'dd in=/sdcard/project.jpg of=/sdcard/temp/project.jpg Could anyone point the error in the code, BTW suggestions for other ways of coping files/folders ? it would be helpful as i am trying my hand at a file manager.
has comment: http://stackoverflow.com/comment/31909084
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31910040

multithreading
tags question: http://stackoverflow.com/q/21216336
tags question: http://stackoverflow.com/q/21227864
tags question: http://stackoverflow.com/q/21190140
tags question: http://stackoverflow.com/q/21263595
tags question: http://stackoverflow.com/q/21295013
tags question: http://stackoverflow.com/q/21188564
tags question: http://stackoverflow.com/q/21263600
tags question: http://stackoverflow.com/q/21261574
type: Tag
tags question: http://stackoverflow.com/q/21297614
tags question: http://stackoverflow.com/q/21220483
tags question: http://stackoverflow.com/q/21202899
tags question: http://stackoverflow.com/q/21270196
tags question: http://stackoverflow.com/q/21229178
tags question: http://stackoverflow.com/q/21330979
tags question: http://stackoverflow.com/q/21264157
tags question: http://stackoverflow.com/q/21200130
tags question: http://stackoverflow.com/q/21219042
tags question: http://stackoverflow.com/q/21185532
tags question: http://stackoverflow.com/q/21277746
tags question: http://stackoverflow.com/q/21220801
tags question: http://stackoverflow.com/q/21263574
tags question: http://stackoverflow.com/q/21264844
tags question: http://stackoverflow.com/q/21241036
tags question: http://stackoverflow.com/q/21231135
tags question: http://stackoverflow.com/q/21206655
tags question: http://stackoverflow.com/q/21339326
tags question: http://stackoverflow.com/q/21197409
tags question: http://stackoverflow.com/q/21318558
tags question: http://stackoverflow.com/q/21347731
tags question: http://stackoverflow.com/q/21258087
tags question: http://stackoverflow.com/q/21327355
tags question: http://stackoverflow.com/q/21292133
tags question: http://stackoverflow.com/q/21189776
tags question: http://stackoverflow.com/q/21283293
tags question: http://stackoverflow.com/q/21247781
tags question: http://stackoverflow.com/q/21314504
tags question: http://stackoverflow.com/q/21206962
tags question: http://stackoverflow.com/q/21243858
tags question: http://stackoverflow.com/q/21279503
tags question: http://stackoverflow.com/q/21288440
tags question: http://stackoverflow.com/q/21317135
tags question: http://stackoverflow.com/q/21268064
tags question: http://stackoverflow.com/q/21200093
tags question: http://stackoverflow.com/q/21198869
tags question: http://stackoverflow.com/q/21315101
tags question: http://stackoverflow.com/q/21282000
tags question: http://stackoverflow.com/q/21247046
tags question: http://stackoverflow.com/q/21305107
tags question: http://stackoverflow.com/q/21320156
tags question: http://stackoverflow.com/q/21346816
tags question: http://stackoverflow.com/q/21342160
tags question: http://stackoverflow.com/q/21240826
tags question: http://stackoverflow.com/q/21215209
tags question: http://stackoverflow.com/q/21276225
tags question: http://stackoverflow.com/q/21263321
tags question: http://stackoverflow.com/q/21302322
tags question: http://stackoverflow.com/q/21199254
tags question: http://stackoverflow.com/q/21195039
tags question: http://stackoverflow.com/q/21236289
tags question: http://stackoverflow.com/q/21332199
tags question: http://stackoverflow.com/q/21309152
tags question: http://stackoverflow.com/q/21247117
tags question: http://stackoverflow.com/q/21248095
tags question: http://stackoverflow.com/q/21242812
tags question: http://stackoverflow.com/q/21268784
tags question: http://stackoverflow.com/q/21258887
tags question: http://stackoverflow.com/q/21325201
tags question: http://stackoverflow.com/q/21257904
tags question: http://stackoverflow.com/q/21186645
tags question: http://stackoverflow.com/q/21210009
tags question: http://stackoverflow.com/q/21306410
tags question: http://stackoverflow.com/q/21212482
tags question: http://stackoverflow.com/q/21256114
tags question: http://stackoverflow.com/q/21337599
tags question: http://stackoverflow.com/q/21264740
tags question: http://stackoverflow.com/q/21289922
tags question: http://stackoverflow.com/q/21211858
tags question: http://stackoverflow.com/q/21300924
tags question: http://stackoverflow.com/q/21308352

http://stackoverflow.com/q/21346695
tagged with: eclipse
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21346736
has comment: http://stackoverflow.com/comment/32184399
score: -1
answer count: 3
has body: I saw some other Quadratic Formula Problems but none seemed to encounter this essentially there are two issues, one with a block of code that when resolved by inserting a "}" create more problems and the other being the fact that it won't run. I am somewhat new to java and this is my first really complicated set of code, but I am hopefully am just making minor mistakes I just can't see right now. package package10; public class QuadraticFormula { public static void main(String[] args) { }//Brought in the static void as Eclipse continually insisted this was neccesary. There is a main file I am supposed to be referencing //The file name is QuadraticFormulaMain.java and is in the same directory. Is there a way I should be writing this to reference it? public static String QuadraticFormula (int A, int B, int C) { } int A = 1; int B = -7; int C = 10; //Sets integers to easily testable numbers { System.out.println("Terry Peters");//Thats my Name Object findSolutions; System.out.println(findSolutions); } //Runs and Prints out the solution found below private static int discriminant (int A, int B, int C) { //sets the discriminate with appropriate equation return (B * B)-(4*A*C); } private static int numberOfSolutions (int A, int B, int C) { //The actual numerOfSolutions, checks if the discriminant is positive negative or zero if (discriminant (A, B, C) &gt; 0) return 2; if (discriminant (A, B, C) == 0 ) return 1; if (discriminant (A, B, C) &lt; 0) return 0; } //This performs the find Solutions String mentioned in the beginning //For whatever reason All return statements are showing errors, but says Eclipse has a quick fix. //This is a lie as all it says is "No Suggestions Avalible" private static String findSolutions (int A, int B, int C) { if (numberOfSolutions (A, B, C) == 0); System.out.println ("There are no solutions"); return "There are no solutions"; if (numberOfSolutions (A, B, C) == 1) return ("There is one solution and it is" + plusSolution (A, B, C)); if (numberO…
upvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21347037
has answer: http://stackoverflow.com/a/21346731
has title: Errors in Quadratic Formula Code (Issue with Main and 1 line)
tagged with: java

http://stackoverflow.com/q/21236398
has body: My Eclipse installation suddenly stopped showing import suggestions. If I type a class name that isn't in the current package, autocomplete works fine and shows the class, but after picking from the drop-down, the class name is highlighted as an error with the message "MyClass cannot be resolved to a variable". This error shows no Quick Fix suggestions. However, if I manually add the relevant import statement at the top of the file, the code compiles and runs fine. I've checked my build path and everything appears to be in order -- and like I said, the code runs when I hand-jam the import statement -- but losing automatic importing is really slowing me down. Any idea what could have gone wrong? It worked fine last week! ETA: Another note, if it helps: F3 still opens the class declaration, so Eclipse clearly knows what I "mean", even without the import statement. Also also: Things that have not helped: Clean all projects Restarting Eclipse Restart computer Delete .metadata from workspace, re-import project Start new Java project, re-link source folder, re-add dependencies (not using Maven, but that's not my choice)
has comment: http://stackoverflow.com/comment/31990498
upvote count: 5
has answer: http://stackoverflow.com/a/21236514
tagged with: eclipse
downvote count: 0
has comment: http://stackoverflow.com/comment/31990826
favorite count: 0
has comment: http://stackoverflow.com/comment/62651559
linked to: http://stackoverflow.com/q/37538162
type: UnansweredQuestion
score: 5
has answer: http://stackoverflow.com/a/21236452
answer count: 4
has comment: http://stackoverflow.com/comment/31990547
has answer: http://stackoverflow.com/a/21238316
tagged with: java
has comment: http://stackoverflow.com/comment/31990220
has title: Eclipse won't generate import statements, stopped showing Quick Fix suggestions
has answer: http://stackoverflow.com/a/21236420
has comment: http://stackoverflow.com/comment/31991309
has comment: http://stackoverflow.com/comment/31990380
has comment: http://stackoverflow.com/comment/31990328
type: Question

http://stackoverflow.com/comment/31929863
type: Comment
has text: I want to execute the actions, after all three buttons have been clicked, regardless of order, or number of times a button has been clicked and at the end send a log to a txt file showing the commands or buttons that has been executed.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21203384

http://stackoverflow.com/a/79335594
answers question: http://stackoverflow.com/q/21258214
type: Answer
score: 1
upvote count: 1
has body: java.time Shown below is a notice on the Joda-Time Home Page: Note that from Java SE 8 onwards, users are asked to migrate to java.time (JSR-310) - a core part of the JDK which replaces this project. Solution using java.time, the modern date-time API in Java You can do it with the following steps: Your date-time string, 24-Feb-2014 12:34 does not have timezone information. Therefore parse it to a LocalDateTime using an appropriate DateTimeFormatter. Add the source ZoneId to the obtained LocalDateTime to make it a ZonedDateTime. Use ZonedDateTime#withZoneSameInstant to convert the source ZonedDateTime to the target ZonedDateTime. If you wish to format the obtained ZonedDateTime in the source format, use the same DateTimeFormatter. Demo: class Main { private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern( "dd-MMM-uuuu HH:mm", Locale.ENGLISH); public static void main(String[] args) { // A sample source timezone // ZoneId.SystemDefault() returns the system's default timezone. Change it // as required e.g. to ZoneId.of("Europe/London") ZoneId sourceZone = ZoneId.systemDefault(); // A sample target timezone ZoneId targetZone = ZoneId.of("America/New_York"); LocalDateTime ldt = LocalDateTime.parse("24-Feb-2014 12:34", FORMATTER); ZonedDateTime sourceZdt = ldt.atZone(sourceZone); ZonedDateTime targetZdt = sourceZdt.withZoneSameInstant(targetZone); System.out.println("Source: " + sourceZdt); System.out.println("Target: " + targetZdt); System.out.println("Formatted: " + targetZdt.format(FORMATTER)); } } Output when executed on a JVM set with Europe/London time zone: Source: 2014-02-24T12:34Z[Europe/London] Target: 2014-02-24T07:34-05:00[America/New_York] Formatted: 24-Feb-2014 07:34 Try it on Ideone Note: Your date-time string has alphabets in the English language; therefore, make sure to use an English Locale e.g. Locale.ENGLISH with your DateTimeFormatter. Check Always specify a Locale with a date-time formatter for custom formats to learn more about…
downvote count: 0

http://stackoverflow.com/comment/32040193
type: Comment
type: QuestionComment
has text: And how can i solve? How is possible is null?
score: 0
comment on: http://stackoverflow.com/q/21265302

http://stackoverflow.com/a/21312856
has body: If your sources are like that : /src /mypackage /myresourcespackage - Resources.java - image.png You can load image.png using : ImageIO.read(Resources.class.getResource("image.png"));
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21312603

http://stackoverflow.com/comment/31936598
comment on: http://stackoverflow.com/q/21207413
has text: What have you attempted and what is the problem?
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/21310399
has answer: http://stackoverflow.com/a/21310587
tagged with: serialization
has body: I am creating a Hotel Reservation System in java and I'm having a problem with saving and loading information. I have a class called Global which stores all the arrays: import java.io.*; import java.util.*; public class Global implements Serializable { public static ArrayList&lt;Guests&gt; guests = new ArrayList&lt;Guests&gt;(); public static ArrayList&lt;Reservations&gt; reservations = new ArrayList&lt;Reservations&gt;(); public static ArrayList&lt;Rooms&gt; rooms = new ArrayList&lt;Rooms&gt;(); } I also have a class called ToSave: import java.io.*; import java.util.*; public class ToSave implements Serializable { public ArrayList&lt;Guests&gt; getGuests() { return Global.guests; } public void setGuests(ArrayList&lt;Guests&gt; guests) { Global.guests = guests; } public ArrayList&lt;Reservations&gt; getReservations() { return Global.reservations; } public void setReservations(ArrayList&lt;Reservations&gt; reservations) { Global.reservations = reservations; } public ArrayList&lt;Rooms&gt; getRooms() { return Global.rooms; } public void setRooms(ArrayList&lt;Rooms&gt; rooms) { Global.rooms = rooms; } public void save(String filename) { try { FileOutputStream fileOut = new FileOutputStream(filename); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(this); out.close(); fileOut.close(); } catch (Exception e) { e.printStackTrace(); } } public void load(String filename) { try { FileInputStream fileIn = new FileInputStream(filename); ObjectInputStream in = new ObjectInputStream(fileIn); ToSave save = (ToSave)in.readObject(); this.setGuests(save.getGuests()); this.setReservations(save.getReservations()); this.setRooms(save.getRooms()); in.close(); fileIn.close(); } catch (Exception e) { e.printStackTrace(); } } } Then finally I have a class called uiMethods that stores the save and load buttons: if(clicker == save) { ToSave save = new ToSave(); save.setGuests(Global.guests); save.setReservations(Global.reservations); save.setRooms(Global.rooms); save…
type: UnansweredQuestion
tagged with: loading
has answer: http://stackoverflow.com/a/21310822
has comment: http://stackoverflow.com/comment/32118569
score: 0
tagged with: java
tagged with: save
has title: Serializing array lists in java
has answer: http://stackoverflow.com/a/21310509
type: Question
has comment: http://stackoverflow.com/comment/32118598
has comment: http://stackoverflow.com/comment/32118550
tagged with: arraylist
answer count: 3

http://stackoverflow.com/q/21313084
tagged with: java
tagged with: easymock
has body: I'm writing tests for an app that refers to a hardcoded filename "classpath:config.properties". It isn't possible to change this name. Is there any way to test this app with different configs? i.e. different tests supply different configs at runtime? This is an odd requirement, but I'd deeply appreciate any inputs
type: Question
accepted answer: http://stackoverflow.com/a/21313316
tagged with: mocking
has answer: http://stackoverflow.com/a/21313637
downvote count: 0
favorite count: 0
has title: Mock a config file
answer count: 3
possible better answer: http://stackoverflow.com/a/21313571
linked to: http://stackoverflow.com/q/14117117
has answer: http://stackoverflow.com/a/21313571
has answer: http://stackoverflow.com/a/21313316
upvote count: 1
has comment: http://stackoverflow.com/comment/32123493
type: AnsweredQuestion
tagged with: testing
score: 1

http://stackoverflow.com/a/21326170
has comment: http://stackoverflow.com/comment/32172057
has body: whenever you change the orientation of the screen the activity gets restarted after that the onStart() method is called. Initialize your code that you are using at ExamActivity.addItemList(ExamActivity.java:79) in your onStart() method ex: your list or array go through the site http://www.vogella.com/tutorials/AndroidLifeCycle/article.html#configurationchange
answers question: http://stackoverflow.com/q/21325991
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/32070032
comment on: http://stackoverflow.com/q/21281071
has text: Yes, certainly. I have JUnit tests driving all the cases. And you can be sure I've been backwards and forwards over this many times. :-)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32212484
comment on: http://stackoverflow.com/a/21303814
type: Comment
score: 0
type: AnswerComment
has text: I've done something similar many times before. Could you post your code please in your question?

layout-manager
tags question: http://stackoverflow.com/q/21217806
tags question: http://stackoverflow.com/q/21346281
tags question: http://stackoverflow.com/q/21309485
tags question: http://stackoverflow.com/q/21214417
tags question: http://stackoverflow.com/q/21311617
tags question: http://stackoverflow.com/q/21247623
type: Tag
tags question: http://stackoverflow.com/q/21297178
tags question: http://stackoverflow.com/q/21204860
tags question: http://stackoverflow.com/q/21309627
tags question: http://stackoverflow.com/q/21201103
tags question: http://stackoverflow.com/q/21214768
tags question: http://stackoverflow.com/q/21278519
tags question: http://stackoverflow.com/q/21349451
tags question: http://stackoverflow.com/q/21228740
tags question: http://stackoverflow.com/q/21311954
tag name: layout-manager

http://stackoverflow.com/a/21254392
has comment: http://stackoverflow.com/comment/32020792
upvote count: 2
has comment: http://stackoverflow.com/comment/32020555
type: Answer
answers question: http://stackoverflow.com/q/21254161
has comment: http://stackoverflow.com/comment/32020868
has comment: http://stackoverflow.com/comment/32020465
score: 0
downvote count: 2
has body: In my understanding, an empty array is not null. Not correct. Counterexample: int a[]; a is an empty array (as it doesn't contain anything), and it's also null since it wasn't initialized. In this case, isNotEmpty will return false, since it is empty.
has comment: http://stackoverflow.com/comment/32020390
has comment: http://stackoverflow.com/comment/32020580
has comment: http://stackoverflow.com/comment/65876433

http://stackoverflow.com/comment/31928144
type: AnswerComment
has text: It's my pleasure, Accept answer if solved by clicking on tick mark of answer.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21201484

http://stackoverflow.com/comment/31963091
type: AnswerComment
has text: Please remember that the `a` and `b` from each of the three invocations is a different variable. If it is not clear to you, then I will rename the variables.
type: Comment
comment on: http://stackoverflow.com/a/21221938
score: 0

http://stackoverflow.com/comment/31936911
has text: next possibility is your conversion to Double (see edit)
type: Comment
comment on: http://stackoverflow.com/a/21207442
score: 0
type: AnswerComment

http://stackoverflow.com/q/21195875
tagged with: android
has answer: http://stackoverflow.com/a/21196103
favorite count: 0
tagged with: android-edittext
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21196103
type: Question
upvote count: 2
has body: I'm getting a nullPointerException on "textTo.getText().toString();" below. I don't understand why. I've tried placing the EditText's findViewById's inside onClick too, but no difference. Maila.Java: public class Maila extends Fragment implements OnClickListener{ public static Maila newInstance() { Maila f = new Maila(); System.out.println("Initialiserad"); return f; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.contact_form, container, false); return v; } Button buttonSend; EditText textTo; EditText textSubject; EditText textMessage; EditText textName; EditText textTel; EditText textFrom; @Override public void onViewCreated (View v, Bundle SavedInstanceState){ buttonSend = (Button) getView().findViewById(R.id.mailKnapp); textTo = (EditText) getView().findViewById(R.string.mailAdress); textSubject = (EditText) getView().findViewById(R.id.editTextMeddelandeTitel); textName = (EditText) getView().findViewById(R.id.editTextNamn); textTel = (EditText) getView().findViewById(R.id.editTextTel); textMessage = (EditText) getView().findViewById(R.id.editTextMeddelande); textFrom = (EditText) getView().findViewById(R.id.editTextEpost); Button mailKnapp = (Button)v.findViewById(R.id.mailKnapp); mailKnapp.setOnClickListener(this); } @Override public void onClick(View v) { String to = textTo.getText().toString(); System.out.println("textTo: " + to); String subject = textSubject.getText().toString(); System.out.println("textSubject: " + subject); String message = textMessage.getText().toString(); System.out.println("textMessage: " + message); String namn = textName.getText().toString(); System.out.println("textName: " + namn); String telefon = textTel.getText().toString(); System.out.println("textTel: " + telefon); Intent email = new Intent(Intent.ACTION_SEND); email.putExtra(Intent.EXTRA_EMAIL, new String[]{ to}); //email.putExtra(Intent.EXTRA_CC, new String[]{ to}); //email.putE…
answer count: 2
downvote count: 2
has title: NullPointerException on EditText .getText().toString()
has answer: http://stackoverflow.com/a/21195942
accepted answer: http://stackoverflow.com/a/21195942
score: 0
tagged with: nullpointerexception

http://stackoverflow.com/a/21271652
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21271509
has body: there is lib that handle changing the dialog title and more , take look there https://github.com/danoz73/QustomDialog
score: 1

http://stackoverflow.com/a/25219058
type: Answer
score: 2
upvote count: 2
has body: May be your commons-pool-x.x.x.jar is not present in your lib folder in deployed folder this can be solved by copying this jar file in apache-tomcat-7.0.54\lib folder
downvote count: 0
answers question: http://stackoverflow.com/q/21191544

http://stackoverflow.com/q/21273385
has answer: http://stackoverflow.com/a/21281517
has comment: http://stackoverflow.com/comment/132629483
has comment: http://stackoverflow.com/comment/32054310
tagged with: lambda
tagged with: java-8
accepted answer: http://stackoverflow.com/a/21281517
has comment: http://stackoverflow.com/comment/132629912
has comment: http://stackoverflow.com/comment/32054363
type: AnsweredQuestion
tagged with: java
has body: I can't find the name of the :: operator added in Java 8 in either of the following resources: Proposed Final Draft Specification: The Java Language Specification (JLS) JSR-000335 Lambda Expressions for the Java Programming Language Proposed Final Draft
score: 9
type: Question
has comment: http://stackoverflow.com/comment/32098327
upvote count: 9
has title: What is the name of the :: operator in Java 8
answer count: 3
possible better answer: http://stackoverflow.com/a/21273460
has answer: http://stackoverflow.com/a/21273460
downvote count: 0
has answer: http://stackoverflow.com/a/21273860
tagged with: operators
favorite count: 0

http://stackoverflow.com/a/21206579
type: AcceptedAnswer
downvote count: 0
has body: You are right -- you shouldn't nest inner classes or inheritance for this. The problem is readily solved with composition: Give the Actor class a Status field with getter and setter methods. public abstract class Actor { private Status status; public Actor() { status = new Status(); // default empty status } public Actor(Status status) { this.status = status; } public void setStatus(Status status) { this.status = status; } public Status getStatus() { return status; } } Edit Clarification: I recommend a solution that uses inheritance, since many classes will inherit Actor, but one that does not try to mis-use inheritance by having either Actor extend Status or Status extend Actor.
answers question: http://stackoverflow.com/q/21206566
has comment: http://stackoverflow.com/comment/31935567
type: Answer
accepted answer of: http://stackoverflow.com/q/21206566
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/31935581

http://stackoverflow.com/comment/32170596
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21338735
has text: NutterzUK: for the other definition, i found many examples that demonstrate how to find the saddle point. however, i want to find the saddle point using the def. i gave.
score: 0

http://stackoverflow.com/comment/31906530
type: Comment
comment on: http://stackoverflow.com/q/21190174
score: 0
type: QuestionComment
has text: I tried it by intuition, i also tried to use java.net.athentication but i've read on oracle tutos that it serve for setting up authentication login from the server's side.

http://stackoverflow.com/a/21211490
accepted answer of: http://stackoverflow.com/q/21211310
answers question: http://stackoverflow.com/q/21211310
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4
has body: Instantiation Well, you can argue about this. Instantiating array1 takes 3 bytecode instructions (bipush, newarray, astore), instantiating array2X takes 3 bytecode instructions per array (bipush / iconst, newarray, astore). Speaking theoretically, instantiating array1 could be faster. Access This is what the VM does to get array1[2]: aload_1 ; array1 iconst_2 ; index iaload ; value Guess what it does to get array2B[0]: aload_3 ; array2B on stack iconst_0 ; index iaload ; value No points for anybody. Memory The size of the arrays is equal (array1 is as large as array2A + array2B), at least the size of the contents. Yeah, there are two pointers instead of one, some GC overhead and so on. Don't think about this too much, you won't be able to measure the difference. Caching Access to two different objects can obviously be slower. Not much to say about this. One object is definitely preferable. Variable access &amp; stack Using a single array might improve the overall performance because it can be kept on the stack sometimes. However, the JDK compiler seems to avoid stack operations and falls back to variables. Conclusion There won't be a noticeable difference (although array1 will usually be faster). All of the above points depend on the VM implementation. Write good code, don't over-optimize.
downvote count: 0

http://stackoverflow.com/comment/32043487
score: 0
comment on: http://stackoverflow.com/q/21263216
type: Comment
has text: Do you know which version of Objectify you are using? The `safeGet()` method has been deprecated in favour of `safe()`, which may help others more knowledgeable than me answer the question.
type: QuestionComment

http://stackoverflow.com/q/21313407
score: 0
answer count: 1
tagged with: jenkins
type: UnansweredQuestion
has title: Modifying Manifest file in EAR inside Jenkins job
tagged with: maven
tagged with: java
has answer: http://stackoverflow.com/a/21326737
type: Question
has body: Is it possible to modify the Manifest.mf file inside .EAR/meta-inf/ folder within Jenkins not using Maven but via Ant ??? I have a CI job and Deploy job in Jenkins. The CI job polls SVN to pull the source code and build the .EAR. The generated .EAR file has manifest.mf updated with Jenkins build information (jenkins build info such as buildId, buildNumber, SVN revision number, Jenkins workpsace etc,). The Deploy job uses Copy artifact plugin which copies the .EAR file alone from a specific CI job build. In my deploy job, an ant script target copies the .ear file from Deploy job workspace to remote staging server where the ear is deployed to WAS. What am trying to do - Modify the EAR Manifest.mf in deploy job workspace to update additional information about the environment the file is deployed and the timestamp when the deployment is done. This is for auditing purposes. How can i achieve this from within the deploy job configuration in Jenkins. Please advise !!!
tagged with: ant
tagged with: svn

http://stackoverflow.com/comment/31957535
has text: Note that nowhere is the assumption that the input polygons should be convex. The approach also works when merging concave polygons with shared edges. It however falls apart when polygons are allowed to overlap.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21218781
type: Comment

http://stackoverflow.com/a/21336540
score: 4
answers question: http://stackoverflow.com/q/21336468
upvote count: 4
downvote count: 0
type: Answer
has body: Basically you can only send a trigger to the device so that it then answers by sending the location to the server. This is based on the Google Cloud Messaging service. You will find everything you need there in detail.

http://stackoverflow.com/q/21349531
has comment: http://stackoverflow.com/comment/32189037
has answer: http://stackoverflow.com/a/21349576
answer count: 6
tagged with: runtime-error
score: 0
linked to: http://stackoverflow.com/q/12231453
has body: int[][] input = new int[3][]; int count = 1; for(int i = 0; i &lt;= 2 ; i++ ) { for(int j = 0; j &lt;= 2; j++) { input[i][j] = count++; } } Fifth line throws an error.
has answer: http://stackoverflow.com/a/21349602
accepted answer: http://stackoverflow.com/a/21349602
has answer: http://stackoverflow.com/a/21349557
has answer: http://stackoverflow.com/a/21349578
has comment: http://stackoverflow.com/comment/32189026
has comment: http://stackoverflow.com/comment/32191799
has answer: http://stackoverflow.com/a/21349668
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21349578
tagged with: java
has title: Why the following piece of java code throws run time error?
type: Question
has answer: http://stackoverflow.com/a/21349560

http://stackoverflow.com/q/21185312
score: 4
possible better answer: http://stackoverflow.com/a/21185446
answer count: 3
favorite count: 0
has title: List<String> minus List<String>
has answer: http://stackoverflow.com/a/21185359
type: AnsweredQuestion
tagged with: list
tagged with: java
has body: I have following code. In the first i tried to set values in the list called 'unavailable'. Next, in the for each I have to produce a cycle on the list domainStr minus unavailable. How can i do it? public Result execute(List&lt;String&gt; domainsStr) { Result result = new Result(); try { List&lt;String&gt; domains = domainService.findByNames(domainsStr); result.setUnavailable(domains); } catch (Exception e) { logger.error(e.getMessage(), e); } for (String domain : domainsStr) { ...... } return result; } public static class Result { private List&lt;String&gt; unavailable = new ArrayList&lt;&gt;(); public List&lt;String&gt; getUnavailable() { return unavailable; } public void setUnavailable(List&lt;String&gt; unavailable) { this.unavailable = unavailable; } }
accepted answer: http://stackoverflow.com/a/21185359
has answer: http://stackoverflow.com/a/21185379
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/21185446
downvote count: 0

http://stackoverflow.com/q/21209031
has comment: http://stackoverflow.com/comment/31939617
downvote count: 1
has comment: http://stackoverflow.com/comment/31939635
type: Question
has answer: http://stackoverflow.com/a/21209065
has body: I am new to programming and after a while I finally fixed all my errors but now the app crashes on startup! I have not written all of this code by myself but I have edited it. Also when I still received errors the app could start (but not work obviously). Manifest <?xml version="1.0" encoding="utf-8"?> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="22" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> Activity_Main <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/RelativeLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <requestFocus /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/editText2" android:layout_centerHorizontal="true" android:text="X" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="@android:color/holo_orange_dark" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/editText2" android:layout_centerHorizontal="true" android:text="_________________________" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="@android:color/holo_orange_dark" /> <TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_below="@+id/Text3" android:layout_marginTop="22dp" android:text="=" android:textAppear…
answer count: 2
accepted answer: http://stackoverflow.com/a/21209065
upvote count: 0
has title: Android app crashes upon startup
favorite count: 0
possible better answer: http://stackoverflow.com/a/21209062
tagged with: android
has answer: http://stackoverflow.com/a/21209062
score: -1
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/32030502
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21260241
has text: I particularly like empty arrays/collections for this sort of thing because often you have to make no other adjustment, if the array is looped over to get the results the loop simply quits

http://stackoverflow.com/comment/31947622
has text: @tms777: You're aware `Integer.toBinaryString` exists, right?
comment on: http://stackoverflow.com/q/21213271
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32006390
score: 0
type: Comment
type: QuestionComment
has text: To keep track of the amount of words per line, you could split each line by whitespaces (and punctuation marks) to get an array containing all words. Then you simply get the size of this array, to know the acutal word amount.
comment on: http://stackoverflow.com/q/21246006

http://stackoverflow.com/comment/31963641
has text: Does your `listExpo` contains `null` elements?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21222250

http://stackoverflow.com/comment/32171285
comment on: http://stackoverflow.com/q/21339543
has text: are the keys the same. `spawnTimers.KEY_PREF_SOUND` and `spawnTimers.KEY_PREF_SPAWNSOUND` ??
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21226924
accepted answer: http://stackoverflow.com/a/21227556
tagged with: xml-parsing
has body: I have the following simple piece of code: NodeList nodeList = document.getDocumentElement().getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node vtvRespNode = nodeList.item(i); NodeList cardNodes = vtvRespNode.getChildNodes(); for (int j = 0; j < cardNodes.getLength(); j++) { Node cardNode = cardNodes.item(j); Card card = vtvResponse.new Card(); if (cardNode instanceof Element) { String content = cardNode.getLastChild().getTextContent().trim(); if(cardNode.getNodeName().equals(CARD_TYPE)) { Log.i(TAG,"cardType set for this card: "+content); } else if(cardNode.getNodeName().equals(TTL)) { Log.i(TAG,"TTL set for this card: "+content); } else if(cardNode.getNodeName().equals(LOCAL_TIME_STAMP)) { Log.i(TAG,"localtimeStamp set for this card: "+content); } else if(cardNode.getNodeName().equals(CARD_BLOB)) { CharacterData child = (CharacterData) cardNode.getFirstChild(); if(child instanceof CharacterData){ Log.i(TAG,"cardNode is instanceof CharacterData"); content = child.getData(); } Log.i(TAG,"blob set for this card: "+content); } } } } Now, I have this sample xml: 1233546 4 76542 {"timezone": 330.0, "date": "03/10/13", "windspeed": "15", "weather": "Partly Cloudy", "temperature": "28", "time": "04:02", "city_name": "Bangalore", "country": "India", "day": "thursday", "meridian": "pm"} Here, I'm not able to get the CDATA data from the xml. The last Log of the else if blob always returns a blank string and I'm not able to figure out what I'm doing wrong. Plz help !!
answer count: 1
has comment: http://stackoverflow.com/comment/31972074
has title: Unable to get data from CDATA in Java
has comment: http://stackoverflow.com/comment/31971981
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21227556
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31971950

hibernate
tags question: http://stackoverflow.com/q/21346489
tags question: http://stackoverflow.com/q/21275596
tags question: http://stackoverflow.com/q/21233853
tags question: http://stackoverflow.com/q/21284569
tags question: http://stackoverflow.com/q/21304827
tags question: http://stackoverflow.com/q/21256348
tags question: http://stackoverflow.com/q/21336967
tags question: http://stackoverflow.com/q/21308536
tags question: http://stackoverflow.com/q/21261566
tags question: http://stackoverflow.com/q/21277587
tags question: http://stackoverflow.com/q/21242532
tags question: http://stackoverflow.com/q/21184297
tags question: http://stackoverflow.com/q/21271366
tags question: http://stackoverflow.com/q/21193516
tags question: http://stackoverflow.com/q/21193982
tags question: http://stackoverflow.com/q/21297427
tags question: http://stackoverflow.com/q/21277695
tags question: http://stackoverflow.com/q/21220234
tags question: http://stackoverflow.com/q/21340343
tags question: http://stackoverflow.com/q/21320893
tags question: http://stackoverflow.com/q/21196672
tags question: http://stackoverflow.com/q/21185728
tags question: http://stackoverflow.com/q/21229084
tags question: http://stackoverflow.com/q/21236759
tags question: http://stackoverflow.com/q/21197012
tags question: http://stackoverflow.com/q/21238357
tags question: http://stackoverflow.com/q/21192536
tags question: http://stackoverflow.com/q/21191972
tags question: http://stackoverflow.com/q/21265738
tags question: http://stackoverflow.com/q/21284175
tags question: http://stackoverflow.com/q/21281780
tags question: http://stackoverflow.com/q/21269203
tags question: http://stackoverflow.com/q/21206017
tags question: http://stackoverflow.com/q/21186906
tags question: http://stackoverflow.com/q/21307781
tag name: hibernate
tags question: http://stackoverflow.com/q/21304813
tags question: http://stackoverflow.com/q/21263170
tags question: http://stackoverflow.com/q/21271107
tags question: http://stackoverflow.com/q/21348177
tags question: http://stackoverflow.com/q/21232815
tags question: http://stackoverflow.com/q/21319031
tags question: http://stackoverflow.com/q/21301956
tags question: http://stackoverflow.com/q/21186143
tags question: http://stackoverflow.com/q/21308822
tags question: http://stackoverflow.com/q/21267623
tags question: http://stackoverflow.com/q/21273163
tags question: http://stackoverflow.com/q/21238305
tags question: http://stackoverflow.com/q/21255625
tags question: http://stackoverflow.com/q/21222692
tags question: http://stackoverflow.com/q/21263595
tags question: http://stackoverflow.com/q/21347995
tags question: http://stackoverflow.com/q/21202379
tags question: http://stackoverflow.com/q/21339759
tags question: http://stackoverflow.com/q/21285704
tags question: http://stackoverflow.com/q/21261546
tags question: http://stackoverflow.com/q/21223760
tags question: http://stackoverflow.com/q/21241210
tags question: http://stackoverflow.com/q/21263771
tags question: http://stackoverflow.com/q/21255016
tags question: http://stackoverflow.com/q/21237949
tags question: http://stackoverflow.com/q/21230688
tags question: http://stackoverflow.com/q/21255729
tags question: http://stackoverflow.com/q/21283339
tags question: http://stackoverflow.com/q/21278072
tags question: http://stackoverflow.com/q/21344049
tags question: http://stackoverflow.com/q/21207255
tags question: http://stackoverflow.com/q/21332098
tags question: http://stackoverflow.com/q/21282987
tags question: http://stackoverflow.com/q/21206204
tags question: http://stackoverflow.com/q/21215693
tags question: http://stackoverflow.com/q/21190283
tags question: http://stackoverflow.com/q/21195082
tags question: http://stackoverflow.com/q/21222176
tags question: http://stackoverflow.com/q/21306282
tags question: http://stackoverflow.com/q/21314239
tags question: http://stackoverflow.com/q/21223445
tags question: http://stackoverflow.com/q/21216166
tags question: http://stackoverflow.com/q/21253787
tags question: http://stackoverflow.com/q/21282432

http://stackoverflow.com/comment/31927518
has text: @user3209348 If the file is now in the default package, you won't need the imports anymore, so just delete them as well.
type: Comment
comment on: http://stackoverflow.com/a/21201798
score: 0
type: AnswerComment

http://stackoverflow.com/q/21205161
has body: try { Class.forName("org.apache.derby.jdbc.ClientDriver"); Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/gledi", "root", "root"); String sql = "SELECT MAX(NR) from ROOT.GLEDI"; PreparedStatement pst = con.prepareStatement(sql); ResultSet rs = pst.executeQuery(); if (rs.next()) { String nr1= rs.getString("MAX(NR)"); // here is the whole problem !!!!! how can i fix it text.setText(nr1); } } catch (Exception e) { }
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31932597
has title: How to fix a DB probblem in Java (with DERBY DB)?
tagged with: java
has comment: http://stackoverflow.com/comment/31932990
has answer: http://stackoverflow.com/a/21205183
type: Question
tagged with: database
score: -4
tagged with: derby
downvote count: 4
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/32082718
comment on: http://stackoverflow.com/a/21289961
type: AnswerComment
has text: But setText() would set the same as the text of the button. I want that it should set the Command to my customized text, not the one which is visible to the user (see set and getActionCommand() in java)
score: 0
type: Comment

http://stackoverflow.com/comment/32021610
type: AnswerComment
score: 0
type: Comment
has text: It is very hared to follow your questions; what you changed, what you didn't change, what your code prints out and why. In the nutshell, you can set width and height of the preview surface view, and you should preserve the aspect ratio of the preview frame of the camera. This may eventually leave margins along the longer axis.
comment on: http://stackoverflow.com/a/21232917

http://stackoverflow.com/comment/32076883
score: 5
comment on: http://stackoverflow.com/q/21286845
type: QuestionComment
has text: Read the javadoc for `Class`.
type: Comment

http://stackoverflow.com/a/21225808
answers question: http://stackoverflow.com/q/21225775
type: Answer
has body: Arrays.sort() uses the natural ordering of the objects, so that would imply that you need them to implement Comparable, or you're going to get unreliable sorting behavior. Simply put, if you want to sort each book by its title, then have it implement Comparable: public class Book implements Comparable&lt;Book&gt; { public int compareTo(Book otherBook) { return title.compareTo(otherBook.getTitle()); } } You'd also want to do the same for the subclass EBook as well.
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21225775

http://stackoverflow.com/q/21239025
possible better answer: http://stackoverflow.com/a/21241685
tagged with: jetty
has title: JETTY: Embedded JSP inside its jar
has answer: http://stackoverflow.com/a/21241685
type: Question
tagged with: java
tagged with: eclipse
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21482207
accepted answer: http://stackoverflow.com/a/21482207
has body: I'm using Jetty 8.0. to create a simple web server (html/json/png) inside my java application. I added an handler to use jsp pages positioned inside a package (as mentioned here: http://docs.codehaus.org/display/JETTY/Embedding+Jetty): String WEBAPPDIR = "com/econorma/jsp/resources"; String CONTEXTPATH = "/jsp"; URL warUrl = WebApplication.class.getClassLoader().getResource(WEBAPPDIR); final String warUrlString = warUrl.toExternalForm(); WebAppContext webapp = new WebAppContext(warUrlString, CONTEXTPATH); I tested this code in Eclipse without any problems: html and jsp both work. My problem come when I run my jar deployed. I get NULL POINTER exception in the getClassLoader line. I try to put the slash at the end of WEBAPPDIR as mentioned in one StackOverflow post but, also if I solve the null pointer exception, I can't me it work.
tagged with: jsp
type: AnsweredQuestion

http://stackoverflow.com/comment/31973392
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21227561
has text: Thanks, I didn't realise I had to use the return statement on the method-call as well.
type: AnswerComment

http://stackoverflow.com/q/21272074
tagged with: scheduling
tagged with: scheduled-tasks
tagged with: amazon-web-services
has comment: http://stackoverflow.com/comment/32052379
type: Question
has body: I'm new to web servers. I have a java class that does a set of computations. I want to have this java class run every hour and update my domain on AWS, with the data. My question is how/where do I set this job to run? Is there a standard for this? Or does AWS have something I can use? I know how to read/write my data to AWS. Should a cron job be used? Should the cron job run on AWS?
has answer: http://stackoverflow.com/a/21272269
score: 0
has title: Job that runs java class and updates web server via AWS
answer count: 1
tagged with: sql-job
tagged with: java
has comment: http://stackoverflow.com/comment/32052515
type: UnansweredQuestion

http://stackoverflow.com/comment/32082838
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21290042
has text: This is a great solution as is `java.text.MessageFormat` http://docs.oracle.com/javase/7/docs/api/java/text/MessageFormat.html
score: 0

http://stackoverflow.com/a/21222753
answers question: http://stackoverflow.com/q/21220611
has body: You have to remove your old installation first from launchd. So go to the old installation and do bin/neo4j remove then your new server should start without problems.
score: 2
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/21205791
tags question: http://stackoverflow.com/q/21310696
tag name: csv
tags question: http://stackoverflow.com/q/21188788
tags question: http://stackoverflow.com/q/21299852
tags question: http://stackoverflow.com/q/21284026
tags question: http://stackoverflow.com/q/21308894
tags question: http://stackoverflow.com/q/21281407
tags question: http://stackoverflow.com/q/21274589
tags question: http://stackoverflow.com/q/21329570
tags question: http://stackoverflow.com/q/21215759
tags question: http://stackoverflow.com/q/21267630
tags question: http://stackoverflow.com/q/21223419
tags question: http://stackoverflow.com/q/21326217
tags question: http://stackoverflow.com/q/21270709

http://stackoverflow.com/q/21332765
tagged with: java
has comment: http://stackoverflow.com/comment/33300154
type: Question
downvote count: 0
tagged with: android-youtube-api
has answer: http://stackoverflow.com/a/21333900
favorite count: 0
has comment: http://stackoverflow.com/comment/33300085
tagged with: android
answer count: 4
has body: I'm getting this error Fatal Exception: java.lang.IllegalStateException This YouTubePlayer has been released , but release() wasn't called explicitly.Here is the piece of code where crash occurs : if(youtubePlayer != null){ time = youtubePlayer.getCurrentTimeMillis();//exception may occur } is it possible to check that youtubePlayer was released? Any callback ? Thanks.
has answer: http://stackoverflow.com/a/25385726
has title: Android : youtube player has been released
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33436981
has answer: http://stackoverflow.com/a/36081710
tagged with: youtube-api
score: 19
has comment: http://stackoverflow.com/comment/33339970
upvote count: 19

http://stackoverflow.com/q/21199240
tagged with: java
has answer: http://stackoverflow.com/a/21211076
upvote count: 1
type: Question
has title: Cobertura Issue with Autowired Classes
has comment: http://stackoverflow.com/comment/31992970
has comment: http://stackoverflow.com/comment/31970003
downvote count: 0
has comment: http://stackoverflow.com/comment/31969946
tagged with: java-6
has body: I am having some issues with Cobertura not counting code coverage for AutoWired Classes. I have a class layout like so: class StartClass { @Autowired DeleteHandlerInterface handler; // function to call handler } class SoftDeleteHandlerImpl implements DeleteHandlerInterface { @Resource(name = "name") AnotherClassInterface impl; @Autowired DataLayerInterface db; // function to do work impl.callFunction(); db.delete(); } It turns out Cobertura is able to determine coverage for StartClass and DataLayerInterface. But it is saying 0% coverage for SoftDeleteHandlerImpl and AnotherClassInterface. Has anyone experienced this issue?
has comment: http://stackoverflow.com/comment/31969987
answer count: 1
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31947955
tagged with: cobertura
has comment: http://stackoverflow.com/comment/32120947
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/32019438
type: Comment
comment on: http://stackoverflow.com/q/21230084
score: 0
type: QuestionComment
has text: server side Java..also javascript (like plugins) if any possibilities are there! @ThiefMaster

http://stackoverflow.com/comment/31984194
has text: Thanks for the answer. But as I mentioned, the user has already submitted the codes to me. I cannot modify that code, as JNI would ask for a return value of jnitArray and not simply the int array that the user would have returned. Is there any way around from there ?
type: AnswerComment
comment on: http://stackoverflow.com/a/21233972
score: 0
type: Comment

http://stackoverflow.com/q/21224073
has comment: http://stackoverflow.com/comment/32830106
upvote count: 6
tagged with: nonblocking
has body: I am new to Java NIO and have used it a little. I have a general query. If you are designing a ultra low latency app vs high throughput application, which of the two gets clearly benefited by using Non blocking IO? My understanding is that Non blocking IO should certainly help in high throughput as worker threads are not blocking, hence not waiting for response and are free to fire new requests until previous requests are served. Once we get responses for previously fired requests, worker threads can process them asynchronously, increasing throughput. However, I am unable to see how Non blocking IO directly benefits low latency application. I guess "Asynchronous behavior is a great way to avoid contention." If that is the case, low contention means low latency. Hence NIO may help in low latency. Does it make sense?
tagged with: java
has answer: http://stackoverflow.com/a/22185148
has comment: http://stackoverflow.com/comment/32051463
tagged with: nio
has comment: http://stackoverflow.com/comment/32005761
type: Question
answer count: 2
tagged with: throughput
has title: Java NIO good for low latency or high throughput?
downvote count: 0
has comment: http://stackoverflow.com/comment/32013054
tagged with: low-latency
favorite count: 0
has answer: http://stackoverflow.com/a/21711528
type: UnansweredQuestion
score: 6

bufferedinputstream
tags question: http://stackoverflow.com/q/21330064
type: Tag
tags question: http://stackoverflow.com/q/21279829
tag name: bufferedinputstream

http://stackoverflow.com/a/21223271
has comment: http://stackoverflow.com/comment/31974866
accepted answer of: http://stackoverflow.com/q/21219857
type: Answer
answers question: http://stackoverflow.com/q/21219857
score: 0
has comment: http://stackoverflow.com/comment/31976537
has body: You can use the Observer Design Pattern
type: AcceptedAnswer

http://stackoverflow.com/q/21286005
has title: Force a class to implement one of two interfaces that implements another interface
score: 0
type: UnansweredQuestion
tagged with: annotations
type: Question
tagged with: java
has body: I am not really sure about Java Annotations, but I think they can solve my problem. I have an java interface "Target". This is an empty interface, so I can give that implementation into an "TargetHolder", which is simply a list of Targets. Now I only have 2 Types of Targets. Type "Alpha" and type "Beta". Type "Alpha" has no functionality in common with Type "Beta". Easiest way would be to just extend "Beta" and "Alpha" from "Target". But with this solution it is possible for a programmer to create a class that extends "Target" only, which must not be possible. Can I solve that with annotations? How?
has answer: http://stackoverflow.com/a/21286849
answer count: 2
has answer: http://stackoverflow.com/a/21286998

http://stackoverflow.com/a/28171764
answers question: http://stackoverflow.com/q/21234384
score: 0
type: Answer
has body: If you work on web project you may use ServletOutputStream and doing something like this Workbook wb = new HSSFWorkbook(); ServletOutputStream out = response.getOutputStream(); wb.write(out); out.flush(); out.close(); Or you can use FileInputStream Workbook wb = WorkbookFactory.create(new FileInputStream("MyExcel.xlsx"));
has comment: http://stackoverflow.com/comment/58344119

http://stackoverflow.com/comment/32194819
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21351693
has text: Thanks But clear but not working when i press clear button ...textbox value not clear
type: Comment

http://stackoverflow.com/comment/32094660
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21296593
has text: Sounds like an excellent question for a debugger. Step through it. Or put some log statements in there.
type: Comment

cookies
tags question: http://stackoverflow.com/q/21214221
tags question: http://stackoverflow.com/q/21226475
type: Tag
tags question: http://stackoverflow.com/q/21231885
tags question: http://stackoverflow.com/q/21193428
tags question: http://stackoverflow.com/q/21308583
tags question: http://stackoverflow.com/q/21267909
tag name: cookies
tags question: http://stackoverflow.com/q/21252714
tags question: http://stackoverflow.com/q/21318166

http://stackoverflow.com/comment/31932912
type: QuestionComment
score: 0
has text: Does that REST service publish a service descriptor in WSDL or WADL? (Some do, some don't…)
comment on: http://stackoverflow.com/q/21201946
type: Comment

http://stackoverflow.com/q/21301664
has answer: http://stackoverflow.com/a/21301714
type: AnsweredQuestion
has body: I exported my project to an executable jar and noticed that eclipse also packaged the external jars I used. When trying to run it on a different machine (which did not have JRE installed), it failed giving the reason that JRE is missing. What is the difference then between the JRE referenced in my project and the JRE I installed from Oracle after I received the error message?
tagged with: java
has comment: http://stackoverflow.com/comment/32103662
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/21301714
answer count: 1
has title: Why must JRE be installed on a machine if it's referenced and packaged in my project?

http://stackoverflow.com/comment/80809526
type: Comment
type: QuestionComment
has text: The saddle point with in matrix is not the value at this specific point, but its coordinate. In your case, because 7 and 8 are occurring only once, it still kinda works though... :) But nevertheless, it is incorrect to say that "7" is a saddle point of this matrix.
comment on: http://stackoverflow.com/q/21338735
score: 0

http://stackoverflow.com/a/21268317
has comment: http://stackoverflow.com/comment/32045816
has comment: http://stackoverflow.com/comment/32047348
answers question: http://stackoverflow.com/q/21267457
score: 0
has body: The simplest way to do it is have an Array or list of Sockets, and add to it every time a new client connects/subtract when client leaves. Then when a message is received, loop through that array/list and send message to other clients. (make sure to check the client you are on against the current client in list so you dont send message to the client that sent it to server) While this is fine on a small scale, it will cause problem on a large scale as you have to loop through a large list each time a new message is received. to have chatRooms or something, you can have a multidimensional array (Array[room][socket]) then you can do loop through certain rooms and only send to those clients, or loop through all, etc. To send to specific users only, you can have a User.java class that has a username and a socket in it. then, instead of doing an array of sockets, use an array of users and in your loop, check username and only send to the required users. Flow: UserA connects to server, sends username to be bob server recieves connections, makes new User object, sets username to bob and sets socket to users socket, then adds that User object to User[] UserB connects to server, sends username john same deal, server makes new user object etc etc. john sends a message to server and tells it to only send the message to bob Server loops through User[] and checks username of them, if username matches bob server calls getSocket on that user object, this returns the socket connection for that user. server then gets the outputStream of that socket, and creates a printwriter with it. the it sends the message received from john through the newly create printwriter.
has comment: http://stackoverflow.com/comment/32046986
has comment: http://stackoverflow.com/comment/32047508
has comment: http://stackoverflow.com/comment/32045061
has comment: http://stackoverflow.com/comment/32045368
has comment: http://stackoverflow.com/comment/32044936
has comment: http://stackoverflow.com/comment/32046520
type: Answer
has comment: http://stackoverflow.com/comment/32045261

http://stackoverflow.com/comment/106320622
score: 0
type: Comment
has text: It does snap but there are a few issues. It doesn't work well on Windows 10 when the windows are decorated with a shadow. The shadow is snapped to the edge of the screen and there is always a space between the real border of the window and the edge of the screen. Also when the frame is resized, for exemple by dragging the left border, the snapping causes the right border to move. The snapping should just attract the left border and leave the right border unchanged.
type: AnswerComment
comment on: http://stackoverflow.com/a/21232633

http://stackoverflow.com/q/21293533
score: 0
has comment: http://stackoverflow.com/comment/32090301
has comment: http://stackoverflow.com/comment/32089639
has title: DateTime getDayOfYear() Returning 366 for 12-31-2013 instead of 365
has comment: http://stackoverflow.com/comment/32089692
answer count: 1
has comment: http://stackoverflow.com/comment/32089976
type: UnansweredQuestion
tagged with: datetime
has comment: http://stackoverflow.com/comment/32089312
has comment: http://stackoverflow.com/comment/32092021
tagged with: java
has comment: http://stackoverflow.com/comment/32090199
has answer: http://stackoverflow.com/a/21293984
has comment: http://stackoverflow.com/comment/32089191
has comment: http://stackoverflow.com/comment/32090056
type: Question
has comment: http://stackoverflow.com/comment/32090116
has comment: http://stackoverflow.com/comment/32090570
has body: Does anyone know why this method is behaving this way? 2013 is not a leap year, so I would expect that if I have a DateTime object like: DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"); DateTime dt = formatter.parseDateTime("2013-12-31 23:59:52"); That dt.getDayOfYear() would give me 365 but it's giving me 366. Can anyone see what the problem is? I am also getting 366 if I do dt.toString("DDD"); I would appreciate any input anyone might have.

galaxy
type: Tag
tag name: galaxy
tags question: http://stackoverflow.com/q/21231650

game-loop
tag name: game-loop
tags question: http://stackoverflow.com/q/21348358
type: Tag

http://stackoverflow.com/comment/32025656
type: AnswerComment
type: Comment
has text: Just had a look and for some reason `$GRADLE_HOME\bin` is not tagged onto `$PATH`. Try this `PATH=~/gradle/bin:$PATH` and then immediately run `echo $PATH` you should see `~/gradle/bin` as the first item and then run `gradle --version`. The only thing I can think about is you are not allowed to change `$PATH` which I find hard to believe. Is your `~/gradle` all up and running? If you run `cd ~/gradle/bin;gradle --version` does that work?
score: 0
comment on: http://stackoverflow.com/a/21227171

http://stackoverflow.com/comment/31949549
has text: Ctrl+ or Ctrl- resizes both images and text here in FF. BTW - you lose most users the moment you start telling them what they are and aren't supposed to do.. But hey, it's your game, so go for it if you want.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21214460
type: Comment

http://stackoverflow.com/comment/32186619
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21347807
has text: nobody here to help me
score: 0

http://stackoverflow.com/comment/31988929
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21236428
has text: AND: he is calling execute and cancel on two different instances of worker. Mind the context, "worker" is created in. Each click on a button will create a new Worker.
score: 3

http://stackoverflow.com/q/21257933
has answer: http://stackoverflow.com/a/21258122
has answer: http://stackoverflow.com/a/21258269
has answer: http://stackoverflow.com/a/21258150
has answer: http://stackoverflow.com/a/21258387
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21258041
has title: Determine the Highest and Lowest per row in array
tagged with: java
answer count: 6
accepted answer: http://stackoverflow.com/a/21258387
possible better answer: http://stackoverflow.com/a/21258023
has answer: http://stackoverflow.com/a/21258023
tagged with: arrays
has body: Please help me on this, I already have a code and it runs perfectly but the thing is I need to determine the Highest and Lowest per row. I don't know how to start, please help me and also please explain to me. here is the code: int [][] num = {{1,4,3,0,5},{2,4,7,8,10},{3,9,60,20,4}}; int row, col; for (row=0;row&lt;3;row++){ int sum = 0; for (col=0;col&lt;5;col++){ System.out.print(num[row][col]+"|"); sum =sum+num[row][col]; } System.out.println("sum = "+sum); }
score: 0
tagged with: multidimensional-array

http://stackoverflow.com/comment/32152240
type: Comment
type: QuestionComment
has text: I guess you only want the list of non-common words, no text. You're scanning a String and at the same time modifying another one, this doesn't make much sense. Just scan and collect all words not contained in `sw` into a `StringBuilder` or a `List<String>`.
comment on: http://stackoverflow.com/q/21326023
score: 0

http://stackoverflow.com/comment/32753727
has text: Awarded bounty to this question because: 1 - the OP liked it and 2 - it mentions "anonymous inner classes" which is essentially a workaround to java's limitations (lack of delegates and events and real generics).
type: AnswerComment
comment on: http://stackoverflow.com/a/21659675
type: Comment
score: 0

http://stackoverflow.com/q/21317848
score: 1
tagged with: java
has title: How do I fill an array in my main class with a fillPermutation void method?
has comment: http://stackoverflow.com/comment/32132489
type: Question
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32132529
has body: My RandomPermutation class and fillPermutation method: public class RandomPermutation { public int permutation[]; private int numAttempts[]; public void fillPermutation(int numItems, int seed) { if (permutation.length!=numItems) permutation = new int[numItems]; Random rand = new Random(seed); permutation[0]=rand.nextInt(numItems-1); numAttempts[0]=1; for(int i=1; i&lt;numItems-1; i++) { int count = 0; int m=rand.nextInt(numItems); for(int j=0; j&lt;i-1; j++) while(m==permutation[j]) { m=rand.nextInt(numItems); count++; } permutation[i]=m; numAttempts[i]=count; } } } Requirements for the main class: "Initially, main-function should call fill-function once for numItems = 10, and print the permutation and the numAt- tempts as shown below. You would also want to print the integers m as they are created in the process, but turn the printing of m off before generating the second part of the output; save the outputs in some file. Then, add the call averNumAttempts with numItems = 10 and numIterationss = 100000 in main-function to generate the second part of the output and save it at the end of the first output file. Finally, submit paper copy of your code and the output file." So how do I make this work using a void method? There's a bit more info on the assignment sheet about the other parts of the code if anybody needs clarification. Thanks ahead of time!
has comment: http://stackoverflow.com/comment/32132590
linked to: http://stackoverflow.com/q/21317074
has comment: http://stackoverflow.com/comment/32132467
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32132509

http://stackoverflow.com/q/21309795
tagged with: java
has body: So In one of my xslt files, I see &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:myxsl="urn:schemas-microsoft-com:xslt" xmlns:xsl2="http://www.w3.org/TR/xslt20/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:java="http://xml.apache.org/xalan/java" xmlns:mine="com.my.example.impl.BaseImpl" xmlns:m="com.my.example.util.CustomXsltHashMap" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" exclude-result-prefixes="myxsl java s mine m xs xsl2"&gt; Can someone tell me what each line here means? I will really appreciate a line by line interpretation of these namespaces and their uses? I am using xslt transformation from within the Java services somehow. (not my code). Thanks
upvote count: 1
downvote count: 1
tagged with: xslt
type: Question
has answer: http://stackoverflow.com/a/21310422
score: 0
has answer: http://stackoverflow.com/a/21310349
has title: What is the point of so many namespaces
has answer: http://stackoverflow.com/a/21310347
possible better answer: http://stackoverflow.com/a/21310379
favorite count: 0
has answer: http://stackoverflow.com/a/21310379
answer count: 5
has answer: http://stackoverflow.com/a/21314008
linked to: http://stackoverflow.com/q/20679790
accepted answer: http://stackoverflow.com/a/21310349
tagged with: http://stackoverflow.com/tag/xml
tagged with: xml-namespaces
type: AnsweredQuestion

http://stackoverflow.com/q/21281026
type: UnansweredQuestion
tagged with: soap
tagged with: xsd
tagged with: java
upvote count: 1
type: Question
has body: i have 2 attributes called rowstart and rowend. so when i am writing xsd i need to have a condition like rowstart &lt; rowend. is there any way to do that in XSD. ?
answer count: 1
tagged with: wsdl
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/21282010
favorite count: 0
has title: Comparing attribute values in xsd in WSDL

http://stackoverflow.com/comment/32171133
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21339241
has text: I know that is a convention, but I only change that and it works... (you can test). I don't know why, but it is functionality. Maybe she has her IDE configured to don't allow upper-case on variables, because is more than a simple convention.
score: 0

http://stackoverflow.com/comment/32210376
comment on: http://stackoverflow.com/a/21332207
type: Comment
has text: Could you able to check the java addin checkbox or Is it disabled
score: 0
type: AnswerComment

http://stackoverflow.com/a/21233521
has comment: http://stackoverflow.com/comment/32018964
has comment: http://stackoverflow.com/comment/32010896
score: 0
has comment: http://stackoverflow.com/comment/32024170
type: Answer
has body: A point of note; you're setting the ContentType three times. It only needs setting once? You don't appear to be returning the response, but I presume some other part of your program is handling that. EDITED: the other answer that was here disappeared. Going to need more information to work out what is going wrong. Please bear in mind that System.out.println() calls will not show up in the browser as they're console-specific.
has comment: http://stackoverflow.com/comment/32023929
answers question: http://stackoverflow.com/q/21232875

http://stackoverflow.com/comment/32011403
comment on: http://stackoverflow.com/q/21249198
score: 0
has text: @Christian +1, space or newline.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21299861
has comment: http://stackoverflow.com/comment/32101779
has body: You can declare an array of innerclass objects like this. class util { Outerclass.innerclass[] inner = new Outerclass.innerclass[10]; } And to instantiate them you can do something like this inside the util class. void test() { Outerclass outer = new Outerclass(); inner[0] = outer.new innerclass(); }
score: 13
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32102247
has comment: http://stackoverflow.com/comment/32101517
type: Answer
answers question: http://stackoverflow.com/q/21299833
upvote count: 13
accepted answer of: http://stackoverflow.com/q/21299833

http://stackoverflow.com/comment/31928739
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21202668
has text: Nope...just take the case of android-support-v4.jar. If you need to add the latest version, say android-support-v13, then you would need to do so using the java build path tab.
type: AnswerComment

http://stackoverflow.com/comment/32060983
type: AnswerComment
has text: I replace the while with if. And, I add a System.out.print(x) after the if loop. There were some pattern in the result. Im just wondering why would that be?
type: Comment
comment on: http://stackoverflow.com/a/21277508
score: 0

http://stackoverflow.com/comment/31919879
score: 0
type: AnswerComment
type: Comment
has text: Should be where? It's not, and the error you're receiving is exactly what that would cause.
comment on: http://stackoverflow.com/a/21197647

http://stackoverflow.com/q/21271620
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/32051681
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32051769
has answer: http://stackoverflow.com/a/21271950
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32051033
has comment: http://stackoverflow.com/comment/32051508
score: -1
has comment: http://stackoverflow.com/comment/32051457
tagged with: android-uiautomator
type: Question
downvote count: 2
has body: public class SendText extends UiAutomatorTestCase { private String jsonString = "{\"A\": [[107,729],[108,728],[108,728],[108,727]," + "[108,727],[108,727],[108,727],[108,727],[108,727],[108,727],[108,727],[108,727],[110,724]," + "[114,717],[125,701],[134,685],[145,663],[157,636],[169,607],[179,583],[191,558],[196,547]," + "[199,540],[201,534],[202,529],[203,528],[204,525],[204,524],[204,524],[204,524],[204,524]," + "[204,524],[204,525],[204,530],[205,538],[207,549],[209,566],[216,602],[223,629],[229,653]," + "[235,671],[238,684],[241,697],[242,703],[242,707],[243,710],[243,712],[243,713],[243,713]," + "[243,713],[243,713],[244,713],[244,713],[244,713],[244,713],[242,709],[237,703],[230,695]," + "[224,684],[220,679],[215,671],[212,665],[206,658],[202,655],[200,654],[196,651],[192,648]," + "[189,646],[184,642],[182,641],[180,639],[179,637],[177,635],[176,634],[174,633],[173,631]," + "[172,630],[171,629],[170,628],[170,628],[170,627],[169,627],[169,627],[169,627],[169,627]," + "[169,629],[169,629]]}" ; public void testSendText() throws UiObjectNotFoundException { JSONObject jsonObj; try { jsonObj = new JSONObject(jsonString); jsonObj.getJSONArray("A"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } //String line = null; for(int k = 0; k &lt; jsonString.length(); k++ ){ Vector&lt;Point&gt; apoints = new Vector&lt;Point&gt;(); apoints.add(new Point()); getUiDevice().swipe((Point[])apoints.toArray(), 5); } } }
has title: java.lang.ClassCastException: java.lang.Object[] cannot be cast to android.graphics.Point[]
has comment: http://stackoverflow.com/comment/32051353
upvote count: 1

http://stackoverflow.com/comment/31936552
type: Comment
type: QuestionComment
has text: @JuanManuel : Person's object, just like many-to-one.
score: 0
comment on: http://stackoverflow.com/q/21206017

http://stackoverflow.com/q/21202121
accepted answer: http://stackoverflow.com/a/21202651
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31927852
tagged with: android
tagged with: facebook
type: AnsweredQuestion
tagged with: facebook-sdk-3.0
tagged with: java
has comment: http://stackoverflow.com/comment/31927753
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/31927691
has title: imported FacebookSDK and yet missing class runtime exception
has comment: http://stackoverflow.com/comment/31927648
has answer: http://stackoverflow.com/a/21202651
has body: I have the following android layout xml: <com.facebook.widget.LoginButton android:id="@+id/authButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="30dp" /> However I get runtime error: which can even be seen in the Graphical editor: But I don't get why, as I have imported the FacebookSDK properly (i think) and when I do cmd + right click on the XML I get to the right class implementation `package com.facebook.widget; public class LoginButton extends Button {` What am I missing?

http://stackoverflow.com/comment/31930460
type: AnswerComment
type: Comment
has text: I have done that at the very beginning of using jAudio - to no avail. It is added as a zip (that is how jaudio is delivered) but it is also added through maven as a maven dependncy.
comment on: http://stackoverflow.com/a/21203363
score: 0

http://stackoverflow.com/a/21203557
has comment: http://stackoverflow.com/comment/31930211
score: 0
answers question: http://stackoverflow.com/q/21203428
type: Answer
has comment: http://stackoverflow.com/comment/31930162
has comment: http://stackoverflow.com/comment/31930303
has body: try storing the last 'i' where the max number of votes is. After that, just get the name by getting the element at location i in names[] (names[i]) or the variable where you saved it. int name_index = 0; int max = Votes[0]; for ( int i = 0 ; i &lt; 5 ; i++){ if ( max &lt; Votes[i] ){ max = Votes[i]; name_index = i; } } String target_name = names[name_index]; This is because you are looping both arrays at the same time, votes and names are in the same locations when indexing.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21203428

content-length
type: Tag
tag name: content-length
tags question: http://stackoverflow.com/q/21290361

paypal-adaptive-payments
tags question: http://stackoverflow.com/q/21276421
type: Tag
tag name: paypal-adaptive-payments

http://stackoverflow.com/comment/32076942
comment on: http://stackoverflow.com/q/21271485
type: QuestionComment
type: Comment
score: 0
has text: Let's see your full controller class.

http://stackoverflow.com/a/21329694
answers question: http://stackoverflow.com/q/21329234
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32156141
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32160224
has body: But the problem is, I cannot resolve the problem that javaFX related panel is flashing(repainting so slow) when mouseover a button. Is there any solution, or will I try to integrate Swing into javaFX? Which will be annoying . never seen that, nor flickering (no idea how to run, simulating from your code snipped posted here) for better help sooner post an SSCCE/MCVE, short, runnable, compilable, caused with a.m. and described issue (note to test and see usage of SwingUtilities.invokeLater and Platform.runLater) import java.awt.BorderLayout; import java.awt.Dimension; import javafx.application.Platform; import javafx.embed.swing.JFXPanel; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javax.swing.JApplet; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.UIManager; public class JavaFX_And_Swing extends JApplet { private final int WIDTH = 300; private final int HEIGHT = 250; private static JFXPanel fxContainer; private static JFXPanel fxContainerTwo; private static final long serialVersionUID = 1L; public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (Exception e) { } JFrame frame = new JFrame("JavaFX embeded in Swing"); frame.setLayout(new BorderLayout(5, 5)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JApplet applet = new JavaFX_And_Swing(); applet.init(); frame.setContentPane(applet.getContentPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); applet.start(); } }); } @Override public void init() { fxContainer = new JFXPanel(); fxContainer.setPreferredSize(new Dimension(WIDTH / 5, HEIGHT / 5)); add(fxContainer, BorderLayout.NORTH); fxContainerTwo = new JFXPanel(); fxContainerTwo.setPrefe…
has comment: http://stackoverflow.com/comment/32159968
accepted answer of: http://stackoverflow.com/q/21329234
upvote count: 2

http://stackoverflow.com/comment/31922048
comment on: http://stackoverflow.com/q/21198503
has text: Filter by error and you should get everything
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21296147
answer count: 1
has body: Liferay uses Ant SDK up to Version 6.0.6. Since Version 6.1+ it now supports Maven. I would like to know if I can build any plugin using Maven. By the way, the maven support is only for V6.1+, what I am trying to infer here is a way to do it using Maven for V6.0.6 line.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32120508
has answer: http://stackoverflow.com/a/21418216
tagged with: maven
has comment: http://stackoverflow.com/comment/32109970
type: Question
has title: Can a Liferay V6.0.6 be written using Maven build system?
tagged with: java
score: 0
tagged with: liferay

http://stackoverflow.com/comment/32107572
type: QuestionComment
comment on: http://stackoverflow.com/q/21301868
has text: Packages are not tree structure in Java, even if some IDEs can present them as "folders" (Eclipse does not by default). What you want would be hackish and a bad idea; it is not supported and that is a good thing. Create test suites.
score: 0
type: Comment

http://stackoverflow.com/comment/32162198
has text: nice animation, but the OP algorithm is not an insertion sort.
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/21334774
type: Comment

http://stackoverflow.com/q/21311596
upvote count: 3
tagged with: java
tagged with: ssl
tagged with: jboss
type: Question
has body: I searched any possible solution to trust all certificate using Resteasy client, but I could not find a single working solution. I'm beginning to think that there is no way to do this using Resteasy 2.2.1. Now, this is a sample of what I've done so far for a normal HTTP connection using resteasy client setting a proxy: org.apache.commons.httpclient.HttpClient hc = new HttpClient(); ApacheHttpClientExecutor ace; String proxyhost = getProperty("proxyHost"); Integer proxyport = getProperty("proxyPort", Integer.class); boolean useProxy = (proxyhost != null); if(useProxy){ hc.getHostConfiguration().setProxy(proxyhost, proxyport); ace = new ApacheHttpClientExecutor(hc); } else { ace = new ApacheHttpClientExecutor(); } ClientRequestFactory crf = new ClientRequestFactory(ace,uri); Now, how can I tell to my ClientRequestFactory or my ApacheHttpClientExecutor or my HttpClient to trust all certificate? Beware: I'm using Resteasy 2.2.1 (JBoss 5.1) I can't migrate to JBoss 7 or use a different resteasy version so I can't accept any answer that uses ResteasyClientBuilder I can already see the good guy that answer "You shouldn't trust all certificate, it's evil!". This is an HTTP client used for Integration test, so it's pointless to consider (at this test level) the SSL certificate. I will absolutely not do this in production.
downvote count: 0
linked to: http://stackoverflow.com/q/18894860
has comment: http://stackoverflow.com/comment/32121050
has comment: http://stackoverflow.com/comment/32120929
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/21257455
tagged with: resteasy
has answer: http://stackoverflow.com/a/26532736
type: UnansweredQuestion
score: 3
has title: HTTP Resteasy client SSL trust all certificate

http://stackoverflow.com/q/21213143
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/29837677
has answer: http://stackoverflow.com/a/38096218
type: Question
has comment: http://stackoverflow.com/comment/55922160
has answer: http://stackoverflow.com/a/21321603
has body: I'm new to ANTLR and trying to write grammar in ANTLR4 without any prior brush with the previous version. I'm following the book 'The Definitive ANTLR 4 Reference'. I use Eclipse and installed ANTLR4 IDE as given in here. I wrote the following grammar in Expr.g4: grammar Expr; import Common; options{ language = Java; } prog: stat+; stat: expr NEWLINE | ID '=' expr NEWLINE | NEWLINE; expr: expr ('/'|'*') expr | expr ('+'|'-') expr | INT | ID | '('expr')'; The Common.g4 contains the following: lexer grammar Common; ID: [A-Za-z]+; INT: [0-9]+; NEWLINE: '\r'?'\n'; WS: [\t]+ -&gt; skip; The lexer.java was created but not parser.java and visitor.java and other base file. Please help me fix the problem. Thanks in advance.
has comment: http://stackoverflow.com/comment/31947547
downvote count: 0
has answer: http://stackoverflow.com/a/58437017
has title: ANTLR4 Parser, Visitor not created
favorite count: 0
tagged with: parsing
upvote count: 8
tagged with: antlr4
answer count: 5
has answer: http://stackoverflow.com/a/21285105
has comment: http://stackoverflow.com/comment/31994035
tagged with: eclipse-kepler
score: 8

http://stackoverflow.com/a/21219440
downvote count: 1
upvote count: 20
has comment: http://stackoverflow.com/comment/79387819
type: Answer
score: 19
has comment: http://stackoverflow.com/comment/31958786
has body: (...) by using Constructor Injection, you assert the requirement for the dependency in a container-agnostic manner This mean that you can enforce requirements for all injected fields without using any container specific solution. Setter injection example With setter injection special spring annotation @Required is required. @Required Marks a method (typically a JavaBean setter method) as being 'required': that is, the setter method must be configured to be dependency-injected with a value. Usage import org.springframework.beans.factory.annotation.Required; import javax.inject.Inject; import javax.inject.Named; @Named public class Foo { private Bar bar; @Inject @Required public void setBar(Bar bar) { this.bar = bar; } } Constructor injection example All required fields are defined in constructor, pure Java solution. Usage import javax.inject.Inject; import javax.inject.Named; @Named public class Foo { private Bar bar; @Inject public Foo(Bar bar) { this.bar = bar; } } Unit testing This is especially useful in Unit Testing. Such kind of tests should be very simple and doesn't understand annotation like @Required, they generally not need a Spring for running simple unit test. When constructor is used, setup of this class for testing is much easier, there is no need to analyze how class under test is implemented.
has comment: http://stackoverflow.com/comment/53024578
answers question: http://stackoverflow.com/q/21218868

http://stackoverflow.com/q/21316452
has comment: http://stackoverflow.com/comment/32129947
upvote count: 2
has body: Is there a way to convert classes generated using a certain JDK version from one vendor, to those of another vendor, without decompiling them? The operating system remains the same.
has comment: http://stackoverflow.com/comment/32129879
type: Question
has comment: http://stackoverflow.com/comment/32129882
has answer: http://stackoverflow.com/a/21317866
tagged with: bytecode
tagged with: java
has comment: http://stackoverflow.com/comment/32130099
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32129831
has comment: http://stackoverflow.com/comment/32129871
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32130085
has comment: http://stackoverflow.com/comment/32130051
has comment: http://stackoverflow.com/comment/32129713
has title: Converting byte codes to run using a different JRE
has comment: http://stackoverflow.com/comment/32129742
score: 2
has comment: http://stackoverflow.com/comment/32129606

http://stackoverflow.com/q/21309121
tagged with: java
has answer: http://stackoverflow.com/a/21479732
type: Question
upvote count: 4
answer count: 1
downvote count: 0
score: 4
tagged with: tomcat
favorite count: 0
tagged with: web.xml
accepted answer: http://stackoverflow.com/a/21479732
tagged with: wicket
has body: I have such an issue. I need to show customized error page, when receive 404 HTTP error. I`m using Wicket 1.4 and Tomcat6. I have implemented these things in web.xml, like wicket.filter /* REQUEST ERROR </filter-mapping> 404 /404 and placed in such code in my WebApplication: mount(new HybridUrlCodingStrategy("/404", PageNotFound.class)); PageNotFound class isErrorPage set true, isVersioned false and @Override protected void configureResponse() { super.configureResponse(); getWebRequestCycle().getWebResponse().getHttpServletResponse().setStatus(HttpServletResponse.SC_NOT_FOUND); } Now the problem is, that when I enter some invalid url, like http://localhost:8080/myApp-war/invalidUrl, I can see my PageNotFound. But when I enter something like http://localhost:8080/myApp-war/?wicket:bookmarkablePage=:com.mypackage.invalidUrl, then I just get empty clear page without any data. I have noticed, that at first situation tomcat shows just "HTTP Status 404 - /myApp-war/invalidUrl" and in the other case it shows slightly different message : "HTTP Status 404 - Unable to load Bookmarkable Page" How is it possible to make both cases show the same page? Maybe this tag needs to be modified? I`ll provide you with more information, if you need.
has title: Tomcat error page using bookmarkable pages in Wicket
type: AnsweredQuestion

http://stackoverflow.com/q/21235085
has body: Ok I am doing project on web services where I plan to implement based on JAX-WS.However i have an issue which I think is about composing services. And after searching on Internet i found WS-BPEL will allow me to do that. I am using netbeans 7.4 but i do not have the SOA feature in it. So now my question is.? Is there any other method for doing service composition? is there any link where i can download the SOA plugin for netbeans 7.4? Or any tutorial which can gimme information on any new technologies which i can use for service composition using existing netbeans 7.4? Thanks in advance
tagged with: java
has answer: http://stackoverflow.com/a/21249566
type: Question
type: AnsweredQuestion
tagged with: netbeans
has title: SOA feature in netbeans 7.4
score: 0
tagged with: web-services
tagged with: soa
answer count: 1
accepted answer: http://stackoverflow.com/a/21249566

http://stackoverflow.com/q/21324233
has title: Similar recursive case, different run time?
type: Question
has body: The first one's run time is O(log n) which I know is the run time for most recursive cases. int happy (int n, int m) { if (n &lt; 10) return n; else if (n &lt; 100) return happy (n - 2, m); else return happy (n/2, m); } However, the second recursive case's run time is O(n) int silly(int n, int m) { if (n &lt; 1) return m; else if (n &lt; 10) return silly(n/2, m); else return silly(n - 2, m); } Can anyone explain why? I would really appreciate that!
tagged with: runtime
has answer: http://stackoverflow.com/a/21324278
score: 0
answer count: 1
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21324278

http://stackoverflow.com/a/21338727
score: 0
type: Answer
has body: As pointed out, math.random returns a value between 0 and 1. Multiplying that by 1 gives you the same value. Thus, the *1 is obsolete. What you can do is *100 and cast it as an int, to give you a rounded whole number between 0 and 100. Your spawnRange is player.getX() - player.getWidth(). If you properly named this, you got a whole load of issues. First, if player is at x=0, you'll be trying to spawn stuff offscreen. Second, the enemies will always spawn behind the player and can only spawn in the area that is as big as the player, so probably you can only spawn one enemy at a time with at most a few pixels between it and the player. What you generally want, is to spawn enemies near a player, not actually in his face. If you also would like to spawn within the entire map, you need to apply the following math: Spawnrange is at minimum player.width away from player's x (preferably twice the width for some breathing room), to at most the highest x position. minimumDistance = player.getX()+player.getWidth(); Spawnrange = random.nextInt( screenXSize - minimumDistance ) ) + minimumDistance; This spawns you a result within the screen's x bounds, with at least a player's size away from the player's position. You can of course also incorporate the values that are behind the player by reversing the math. On to the next problem: You want to spawn enemies away and close by. What I'd do, is spawn two enemies at once: one close by, one far away. One from behind, the other from the front. Use the random function to determine if it'll be close or far, and then apply the proper random.nextInt().
answers question: http://stackoverflow.com/q/21338137

http://stackoverflow.com/comment/32097427
type: QuestionComment
comment on: http://stackoverflow.com/q/21297979
has text: See the section on generic methods here: http://www.ntu.edu.sg/home/ehchua/programming/java/JavaGeneric.html
score: 0
type: Comment

http://stackoverflow.com/comment/32139584
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21321633
score: 1
has text: *"This is happening because I cant access a variable in a try/catch statement."* It is actually undoubtedly happening because `new URL(srcfile)` is throwing an exception which your code is eating. Print the stack trace like others are suggesting and then we can help with the actual problem.

http://stackoverflow.com/comment/32036879
type: QuestionComment
comment on: http://stackoverflow.com/q/21262961
type: Comment
has text: and EMUtil gets it from??? Where I am going is that while this is fine it leaves you no ability to alter your session lifecycle or expand the scope of your units of work as your requirements grow and the project evolves. You are coupled to all units of work being defined as stand alone static method, which gets ugly.
score: 0

http://stackoverflow.com/q/21197099
tagged with: java
has comment: http://stackoverflow.com/comment/31918868
has title: Implementing back button functionality in Swing
type: Question
has body: I am facing a issue with implementing back button functionality. I have 2 frames (Main Frame and Second Frame), so when i press a button on Main frame it takes me to second frame. On the second frame i have a back button it takes me back to the main frame. This is working as expected. But the problem is that once i am back on the main frame after pressing the back button all the alignment of the main frame goes away. On Main frame i have below code to goto second frame: frame.dispose(); frame.setVisible(false); WebAppTest object = new WebAppTest(); object.createAndShowGUIWebAppTest(); On the second frame i am using below code to go back to main frame: MainLanding object = new MainLanding(); object.createAndShowGUIMainLanding(); frame1.dispose(); frame1.setVisible(false);
has comment: http://stackoverflow.com/comment/31919778
has answer: http://stackoverflow.com/a/21197840
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/9554636
favorite count: 0
type: UnansweredQuestion
tagged with: swing
linked to: http://stackoverflow.com/q/5654926
downvote count: 0
duplicate of: http://stackoverflow.com/q/5654926
score: 1

http://stackoverflow.com/q/21217090
answer count: 2
tagged with: sql-server
has answer: http://stackoverflow.com/a/21217188
type: UnansweredQuestion
score: 0
has title: No suitable driver found for jdbc:sqlserver://repcode;DatabaseName=reporting
has body: I have Eclipse Kepler and added sqljdbc4.jar to the classpath using properties on the project and then 'Java Build Path" and finally added under Libraries. When I tries running the code (Run on server) i get the error: java.sql.SQLException: No suitable driver found for jdbc:sqlserver://repcode;DatabaseName=reporting at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) The code: package com.example.viewreport; import javax.servlet.annotation.WebServlet; import java.sql.*; @SuppressWarnings("serial") @Theme("viewreport") public class ViewreportUI extends UI { .......... CUT .................. String userName = "report"; String password = "report"; String url = "jdbc:sqlserver://repcode;DatabaseName=reporting"; try { Connection conn = DriverManager.getConnection(url, userName, password); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Some vaadin code is stripped out from the above source. What am I missing? The SQL server is a 2008 R2 The code is run on a local tomcat catalina instance
tagged with: java
has answer: http://stackoverflow.com/a/21217251
type: Question

http://stackoverflow.com/a/21246795
has comment: http://stackoverflow.com/comment/32008293
upvote count: 10
answers question: http://stackoverflow.com/q/21246696
downvote count: 0
has comment: http://stackoverflow.com/comment/32007775
type: Answer
has comment: http://stackoverflow.com/comment/32007963
has comment: http://stackoverflow.com/comment/32008517
has body: If you want the values 1 or 2 with equal probability, then int temp = (Math.random() &lt;= 0.5) ? 1 : 2; is all you need. That gives you a 1 or a 2, each with probability 1/2.
has comment: http://stackoverflow.com/comment/32007598
has comment: http://stackoverflow.com/comment/32007640
score: 10

http://stackoverflow.com/q/21293575
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/21293627
accepted answer: http://stackoverflow.com/a/21293627
favorite count: 0
has comment: http://stackoverflow.com/comment/32089321
score: 2
downvote count: 0
tagged with: 64-bit
has body: Recently I developed interest in bit manipulation and arithmetic. I am planning to write a code to represent a chess board using a 64 bit long variable where each bit represents a cell. I encountered an issue as below: public class Chess { public static void main(String[] args) { long v = (1 &lt;&lt; 63 ) - 1; System.out.println(Long.MAX_VALUE+ " " +v); System.out.println(Long.toBinaryString(v)); System.out.println(Long.bitCount(v)); } } Following is the output of the above code: 9223372036854775807 2147483647 1111111111111111111111111111111 31 which is not correct. I am expecting a 64 bit binary string. I am using a 64 bit machine with 64 bit Windows OS. Please help.
type: AnsweredQuestion
tagged with: java
has title: Cannot generate a 64 bit long value in java
type: Question

http://stackoverflow.com/comment/103784477
type: Comment
has text: But in the video on your reference... I still see the lines..
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/47562954

http://stackoverflow.com/q/21199272
type: AnsweredQuestion
tagged with: libgdx
tagged with: scene2d
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/21199367
has title: Get an actor by name in libgdx
upvote count: 7
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/21202655
answer count: 3
accepted answer: http://stackoverflow.com/a/21199367
tagged with: android
favorite count: 0
possible better answer: http://stackoverflow.com/a/21202254
has answer: http://stackoverflow.com/a/21202254
has body: How do I get an actor by name in libgdx? I currently have the following ChangeListener: ChangeListener colorPickerListener = new ChangeListener() { public void changed(ChangeEvent event, Actor actor) { //Popup Window toolboxStage.addActor(blockWindow); //toolboxStage.getRoot().removeActor(blockWindow); Gdx.app.log("LevelEditorScreen", "Color Picker Selected"); Gdx.app.log("LevelEditorScreen", "HUD Width: " + HUD_WIDTH); Gdx.input.setInputProcessor(toolboxStage); } }; The actor that is above is the actor that has been touched. Once this particular actor has been touched I need to change the color of another actor. How exactly do I go about getting that actor by its name?

http://stackoverflow.com/comment/32167582
type: QuestionComment
score: 2
has text: Looks like the instances of `MyClass` in your `List<MyClass> xxx` have the same hash code and are the same by the definition of its `equals` method.
comment on: http://stackoverflow.com/q/21337649
type: Comment

http://stackoverflow.com/comment/32142940
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21323389
has text: That seemed to have matched the output I was looking for. Although, do you know what I could have done to not store anything but integers (nulls)into my array?

http://stackoverflow.com/comment/32175952
type: Comment
comment on: http://stackoverflow.com/a/21340968
type: AnswerComment
score: 0
has text: Ah, that's where it gets complicated. So, what you could do is also pass in an argument for some identifier, and pass that identifier back in the callback.

http://stackoverflow.com/comment/32317565
type: Comment
comment on: http://stackoverflow.com/q/21302219
type: QuestionComment
has text: what jboss version are you using?
score: 0

http://stackoverflow.com/a/21328810
answers question: http://stackoverflow.com/q/21326046
score: 0
has body: You are path binding the drop down value to the cmsPhysicalExamCategory.id So, the selected value will be retained in the form when you recall the form again for some other operation like 'edit. You can change the value in the drop down and the new value will be path binded to the model. Here, its not getting binded. It may be because of the error in path bind/form submit. Please post the form submit code/controller code for more help.
type: Answer

http://stackoverflow.com/comment/32147485
comment on: http://stackoverflow.com/a/21309056
has text: You are right, and there are many more topics to consider (also here) when heading into the Java Memory Model internals. I should have said, that my explanation is a _possible_ reason for the observed behavior. At least, this is what I experienced!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31964759
type: Comment
comment on: http://stackoverflow.com/a/21222038
type: AnswerComment
has text: Does it have anything to do with memory? or it is just nonsense? :S :S well i have to execute it to calculate running time for different large input data
score: 0

http://stackoverflow.com/a/21227768
has comment: http://stackoverflow.com/comment/31973784
answers question: http://stackoverflow.com/q/21227725
score: 0
has comment: http://stackoverflow.com/comment/31973454
type: Answer
has body: If you want your application to work on any platform then you should not use libraries that are only on machines with Java 7. Write your own code, something that you are sure is on any version of Java.
has comment: http://stackoverflow.com/comment/31973393

http://stackoverflow.com/comment/94388050
type: Comment
comment on: http://stackoverflow.com/a/21278436
score: 1
type: AnswerComment
has text: Unfortunately this link is not available anymore :(

http://stackoverflow.com/comment/32006028
type: QuestionComment
comment on: http://stackoverflow.com/q/21245253
score: 0
has text: This code cannot **possibly** have worked for you. (If it did, all you would have to do was change `<` to `>`.)
type: Comment

http://stackoverflow.com/comment/31969577
comment on: http://stackoverflow.com/q/21225220
type: Comment
type: QuestionComment
has text: If you are still getting the exception, verify you aren't closing the stream somewhere else and also make sure you've truly recompiled the code.
score: 0

http://stackoverflow.com/a/23061243
answers question: http://stackoverflow.com/q/21331310
upvote count: 1
has body: Perhaps don't use the ?string.currency -format at all and do the formatting yourself? For example... ${user.locale.currencySign} ${price.forLocale(user.locale)} ..
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21331310
type: Answer

http://stackoverflow.com/comment/32062715
has text: @TheLostMind Ok, so then don't? If the `OnQueryResultSentListener` is used in more places, it should maybe be an interface on its own.
comment on: http://stackoverflow.com/q/21278028
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21223440
type: Question
has answer: http://stackoverflow.com/a/21223652
answer count: 1
has title: How to include DB constant names (table, column...) into an interface shared by many apps
score: 0
has body: I have a philosophical problem in android, to solve it I have been searching and reading what I have found before asking but none of them has solved my problem, so I'll try to explain it. I have one android app where I have a database, trying to apply OOP I have created an interface, an abstract class and a class, so that I can use various types of DBs just by changing the reference of the instanced class. I would also like to maintain this code as clean as possible so that it can be used in any new program that I develop, if possible I always prefer to write code that can be used in any app just by including the files. Saying so my problem is that I don't know where to put the constant strings of the DB (table names, column names...), a DB that is specific for this app. Since the DB is specific for this app I discard putting them into the interface, don't want to inherit the strings of all the DBs that use this interface into each app. I have also seen that there are other possibilities: -Interface just to hold the constants, but it's said to be a bad practice -Class just to hold all the global variables, also a bad practice according to what I have read. From my point of view, the best place for the declaration of these constants is the interface of the DB, since it's accessible for all the classes that need to use the DB and is more logical. I have come to 2 solutions but I'm open to more solutions: 1.-Creating a copy of the DB interface file for each app, so that I have: -Clean and common DB interface. -A modified copy of the original DB Interface including the DB names of one app, this file is exclusive for the app and it must be copied into the directory of the app. The abstract class and the class would remain the same and common for all the projects. 2.-Extending an interface into the DB interface so that it has access to the Names of the DB, each app should have an exclusive interface with the names of the DB. I would like to know which one would be the bes…
tagged with: android
linked to: http://stackoverflow.com/q/4646577
type: UnansweredQuestion
tagged with: java
tagged with: database

http://stackoverflow.com/comment/32166403
type: Comment
has text: After re-reading the question and your answer, it might be me who is confused. The OP creates a `PreparedStatement` (in an invalid way), but uses it as a normal `Statement` object by using the execute methods that accept a query string (which isn't allowed, see my answer). I initially read the question to be about `Statement`, and in that case your answer doesn't answer it.
type: AnswerComment
comment on: http://stackoverflow.com/a/21327383
score: 0

http://stackoverflow.com/comment/32171090
type: Comment
type: QuestionComment
has text: You have to accept the unchecked cast, basically. Either that, or take a `Class<T>` as a parameter to the constructor, so you can perform the cast safely.
comment on: http://stackoverflow.com/q/21339381
score: 0

http://stackoverflow.com/q/21276205
tagged with: rxtx
score: 0
has comment: http://stackoverflow.com/comment/32059142
has body: I have written a code for serial communication using RXTX comm.When i write 13000 bytes on port then nothing is written but when i write 115200 or less bytes it works like a charm.One more thing this only happens on some systems. Update: Below is my code that write bytes on port: public String portWriter(byte[] messageString) throws NoSuchPortException { if (Processing.serialPort == null) { System.out.println("serial port is null"); Processing.portId = CommPortIdentifier.getPortIdentifier(Processing.portText); try { Processing.serialPort = (SerialPort) Processing.portId.open("SimpleWriteApp", 2000); } catch (PortInUseException e) { return "Port in use by another application."; } try { Processing.serialPort.setSerialPortParams(Processing.speed, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } catch (UnsupportedCommOperationException e) { return "Unsupported comm operation."; } } try { outputStream = Processing.serialPort.getOutputStream(); outputStream.flush(); } catch (IOException e) { return "Unable to write on port."; } try { //System.out.println("write " + new BigInteger(1, messageString).toString(16)); outputStream.write(messageString); } catch (IOException e) { return "Unable to write on port."; } return null; }
has title: Maximum no. bytes that can be written on com port
has comment: http://stackoverflow.com/comment/32058843
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/32061086
tagged with: java
type: Question

http://stackoverflow.com/q/21232028
type: UnansweredQuestion
tagged with: android
has body: i am facing problem in to import google_play_service_lib, which is making conflict with twitter and linkedIn lib mPlusClient = new PlusClient.Builder(getActivity(), this, this) .setVisibleActivities("http://schemas.google.com/AddActivity", "http://schemas.google.com/BuyActivity").build();`
has comment: http://stackoverflow.com/comment/31980923
score: 2
answer count: 0
has title: can i make my android application to login through facebook, linked in, twitter and google plus?
has comment: http://stackoverflow.com/comment/31981207
type: Question
tagged with: java
upvote count: 2
has comment: http://stackoverflow.com/comment/31980842
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31981256

http://stackoverflow.com/a/21296199
score: 3
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21296144
has body: Here's another example that returns false public static void main(String[] args) { checkType(""); } static &lt;T&gt; void checkType(T sometype) { System.out.println(sometype instanceof A); } static class A {} It's really only useful when trying to compare (and then cast) to a more specific type. In your example, c instanceof A doesn't make sense since the type C is not in the inheritance hierarchy of A.
upvote count: 3

http://stackoverflow.com/comment/32104534
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21297150
has text: With connection parameters you mean the user name and password?

http://stackoverflow.com/comment/32021394
type: QuestionComment
comment on: http://stackoverflow.com/q/21255246
score: 0
type: Comment
has text: @Njol yes it runs by double click but on other computers it does not run.

http://stackoverflow.com/a/21243045
has comment: http://stackoverflow.com/comment/32001193
answers question: http://stackoverflow.com/q/21242939
has comment: http://stackoverflow.com/comment/32001247
has body: Adding "android:windowNoTitle" means no action bar is created. Therefore getSupportActionBar() will return null.
upvote count: 2
has comment: http://stackoverflow.com/comment/32001831
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32001058

http://stackoverflow.com/q/21281131
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21281244
tagged with: java
tagged with: eclipse
tagged with: javaw
has comment: http://stackoverflow.com/comment/32067107
has comment: http://stackoverflow.com/comment/32067081
type: Question
downvote count: 0
has body: Sorry for the ambiguous title, but I've literally no idea how to even name this behavior. When I try to compile any project in Eclipse, I get this in the console: Usage: javaw [-options] class [args...] (to execute a class) or javaw [-options] -jar jarfile [args...] (to execute a jar file) where options include: -d32 use a 32-bit data model if available -d64 use a 64-bit data model if available -server to select the "server" VM -hotspot is a synonym for the "server" VM [deprecated] The default VM is server. -cp &lt;class search path of directories and zip/jar files&gt; -classpath &lt;class search path of directories and zip/jar files&gt; A ; separated list of directories, JAR archives, and ZIP archives to search for class files. -D&lt;name&gt;=&lt;value&gt; set a system property -verbose[:class|gc|jni] enable verbose output -version print product version and exit -version:&lt;value&gt; require the specified version to run -showversion print product version and continue -jre-restrict-search | -no-jre-restrict-search include/exclude user private JREs in the version search -? -help print this help message -X print help on non-standard options -ea[:&lt;packagename&gt;...|:&lt;classname&gt;] -enableassertions[:&lt;packagename&gt;...|:&lt;classname&gt;] enable assertions with specified granularity -da[:&lt;packagename&gt;...|:&lt;classname&gt;] -disableassertions[:&lt;packagename&gt;...|:&lt;classname&gt;] disable assertions with specified granularity -esa | -enablesystemassertions enable system assertions -dsa | -disablesystemassertions disable system assertions -agentlib:&lt;libname&gt;[=&lt;options&gt;] load native agent library &lt;libname&gt;, e.g. -agentlib:hprof see also, -agentlib:jdwp=help and -agentlib:hprof=help -agentpath:&lt;pathname&gt;[=&lt;options&gt;] load native agent library by full pathname -javaagent:&lt;jarpath&gt;[=&lt;options&gt;] load Java programming language agent, see java.lang.instrument -splash:&lt;imagepath&gt; show splash screen with specif…
has title: Invalid command do javaw in Eclipse?
answer count: 1
has comment: http://stackoverflow.com/comment/32067180
favorite count: 0
linked to: http://stackoverflow.com/q/9862037
upvote count: 2
tagged with: android
linked to: http://stackoverflow.com/q/14993683
has answer: http://stackoverflow.com/a/21281244

http://stackoverflow.com/a/21233368
type: AcceptedAnswer
has body: You can use the asWritable method on a Closure to get a Writable returned, ie: Writable process() { def output = asciidoctor.render(this.payload, asciidoctorJOptions); { w -&gt; w.println output }.asWritable() }
type: Answer
has comment: http://stackoverflow.com/comment/32027387
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21205446
accepted answer of: http://stackoverflow.com/q/21205446
upvote count: 1

http://stackoverflow.com/q/21299110
favorite count: 0
type: UnansweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/32099283
has answer: http://stackoverflow.com/a/21299221
type: Question
tagged with: java
score: -1
has title: What's the easiest way to check if inputed number is a positive integer and re-prompt if not?
answer count: 2
tagged with: validation
downvote count: 1
has body: The program takes user input which is supposed to be an integer greater than 0. If the user doesn't do this he is notified of the mistake and is reprompted. Once the correct input is entered, the value is returned. What's the best way to do this? The following code is my try but doesn't work. It seems unnecessarily complex for such an easy task. System.out.println("Please enter an integer greater than 0:"); Scanner scan = new Scanner(System.in); int red = -1; do { try { red = scan.nextInt(); }catch(InputMismatchException e) { System.out.println("Number must be an integer"); scan.nextLine(); if(red &lt; 1) System.out.println("Number must be more than zero"); else break; } }while(true); return red; Sometimes I don't know what to put in my question because I already know the code doesn't work - so if there's something else I should tell please let me know.
has answer: http://stackoverflow.com/a/21299646

http://stackoverflow.com/comment/32081860
type: AnswerComment
has text: I can't put it in my main class because of it being private in the other, and if I put it in the other it says it is already defined.
type: Comment
comment on: http://stackoverflow.com/a/21289439
score: 0

http://stackoverflow.com/comment/32133510
type: QuestionComment
has text: @OliCharlesworth I didnt ask about the mathematical shape of the erath. I asked if the given statement is true. how precise is this solution.
type: Comment
comment on: http://stackoverflow.com/q/21318407
score: 0

http://stackoverflow.com/comment/32081664
comment on: http://stackoverflow.com/a/21288753
has text: @Gaurav No, it is *not the same* as Byte.parseByte. For example, it accepts the value above, which parsebyte does not.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21306457
tagged with: libgdx
has answer: http://stackoverflow.com/a/27205624
answer count: 2
has comment: http://stackoverflow.com/comment/41769179
favorite count: 0
has answer: http://stackoverflow.com/a/38401475
type: UnansweredQuestion
has body: I found out there is a new component in LibGDX in nightly builds - TextArea which is part of the scene2d.ui package. It's nice to have a component like this, very easy to use, but what I'm missing is some support for a multi-colored text. I want to highlight some keywords in a text with a different color but I don't know how to do it with current api. There is one method in BitmapFontCache class: public void setColors (Color tint, int start, int end) Javadoc for this method says following: Sets the color of the specified characters. This may only be called after setText(CharSequence, float, float) and is reset every time setText is called. But I don't know how to use it through TextArea object or if it's even possible to do it that way. Someone who tried to figure it out? Every hint will be appreciated.
score: 8
downvote count: 0
has title: Multi-colored text in libgdx
tagged with: java
upvote count: 8
type: Question

http://stackoverflow.com/comment/31991035
score: 0
comment on: http://stackoverflow.com/q/21194274
type: Comment
type: QuestionComment
has text: Guys, just an update... I was in the wrong direction, I believe I will have to use lucene, in the QueryParse here, to get the Case Insensitive fields. Am new to this, so any help will be highly appreciated. Thanks for all the prior help, @nachokk

http://stackoverflow.com/comment/32103350
comment on: http://stackoverflow.com/a/21300965
score: 0
type: AnswerComment
type: Comment
has text: Any error you got in firebug ? If it is hitting the url correctly, are you able to get your provided parameters in php file ?

http://stackoverflow.com/q/21318448
score: 1
has answer: http://stackoverflow.com/a/21318497
favorite count: 0
type: Question
upvote count: 2
answer count: 1
downvote count: 1
tagged with: java
type: UnansweredQuestion
has title: "d = ut + 1/2 at^2"? How to solve this in java?
has body: public class DistanceTravelled { static double testcase11 = 12.5; static double testcase12 = 4.4; static double testcase13 = 10; public static void main(String args[]){ DistanceTravelled testInstance= new DistanceTravelled(); double result = testInstance.distance(testcase11,testcase12,testcase13); System.out.println(result); } //write your code here public double distance(double u, double a, double t){ double d = d = u*t + 1/2*a*t^2 ; return d; } }

http://stackoverflow.com/q/21219884
has answer: http://stackoverflow.com/a/39146260
has body: I wanted to replace all commas with commas and a newline using IntelliJ IDEA's replace function. What do I put in the search box? In vim I'd use &amp;\r.
type: Question
has answer: http://stackoverflow.com/a/52581541
tagged with: intellij-idea
score: 177
answer count: 11
has answer: http://stackoverflow.com/a/21221346
has answer: http://stackoverflow.com/a/21219912
upvote count: 177
has answer: http://stackoverflow.com/a/44584528
has answer: http://stackoverflow.com/a/37371568
favorite count: 0
accepted answer: http://stackoverflow.com/a/21219921
has answer: http://stackoverflow.com/a/52663096
has answer: http://stackoverflow.com/a/49325107
has answer: http://stackoverflow.com/a/21219925
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21219921
downvote count: 0
has title: In IntelliJ IDEA how do I replace text with a new line?
has answer: http://stackoverflow.com/a/78767164
possible better answer: http://stackoverflow.com/a/21221346
tagged with: java

http://stackoverflow.com/comment/32000654
score: 0
type: AnswerComment
has text: @Taylor Can you go into more detail about what you mean? All I see is that `RestTemplate` uses `SimpleClientHttpRequestFactory` to generate its connections and requests.
type: Comment
comment on: http://stackoverflow.com/a/21242941

http://stackoverflow.com/q/21326488
linked to: http://stackoverflow.com/q/17085692
accepted answer: http://stackoverflow.com/a/21326730
has title: Java, publish with local folders
linked to: http://stackoverflow.com/q/16486858
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32147867
possible better answer: http://stackoverflow.com/a/21328139
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32147802
type: Question
answer count: 2
has body: I have an Java desktop program which uses a "file" folder to keep logs and "image" folder to get images of its gui. I want to publish this program with ".class" files visible ( so that i can update them ). 1-) In eclipse, when i use export--> Jar or export-->Executable Jar options. Its wraps everything in one jar and my program doesn't work ( probably because it cannot find image files ). I think i remember a way to publish the code as it is using eclipse but cannot find it :/. How can i publish my code keeping the folders i want with the program? 2-)Is it a bad idea to keep visable ".class" files for updates? ( i don't, also want people sneak in the code because it will have database url's and such ). What are my alternatives? How do you make your updates? Thanks for the answers and pardon me if i asked something has already be asked and answered gazilion times :/(.
downvote count: 0
tagged with: jar
favorite count: 0
has answer: http://stackoverflow.com/a/21328139
has answer: http://stackoverflow.com/a/21326730

http://stackoverflow.com/q/21346702
has comment: http://stackoverflow.com/comment/32184640
tagged with: java
has comment: http://stackoverflow.com/comment/32184570
tagged with: inputstream
has comment: http://stackoverflow.com/comment/32259935
has comment: http://stackoverflow.com/comment/32185305
answer count: 2
has comment: http://stackoverflow.com/comment/32184609
has body: How do I redirect the input stream for a program so that it will run from the console as main > myProgram with no filename specified within the code? This is what I have so far. public static void main (String[ ] args) throws IOException { BufferedReader in = new BufferedReader (new InputStreamReader (System.in)); while(in.next != null){ in.read(); } } I know it's going to be something to do with System.setIn but I have no clue as to how to write it so that it will detect a filename after Main > is typed.
has title: Java- redirecting input stream
has comment: http://stackoverflow.com/comment/32187340
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21346743
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/44593418
has comment: http://stackoverflow.com/comment/32184426
upvote count: 1
has comment: http://stackoverflow.com/comment/32184378
type: Question

http://stackoverflow.com/a/21235873
accepted answer of: http://stackoverflow.com/q/21193428
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21193428
type: Answer
has body: It turns out that the problem was on the method destroyCookie on this line cookie.setDomain(""); as I put as comment, I've tried setting my cookie domain, but since I was doing lots of changes the use of setDomain(".myCompany.com") didn't work. Now after I modified my client.logout to clean the session info of the user on the jboss side and did the modification setting the domain on the destroyCookie method it is working fine. So the final modification was this: private void destroyCookie(Cookie cookie, HttpServletResponse response) { if (cookie != null) { response.setContentType("text/html"); cookie.setPath("/"); cookie.setValue("notValidSession"); cookie.setComment("EXPIRING COOKIE at " + System.currentTimeMillis()); cookie.setVersion(0); //I've configured the domain on the custom-params-service.xml on JBoss cookie.setDomain( AppUtils.getJndiConfig("SSOCookieDomain") ); cookie.setMaxAge(0); response.addCookie(cookie); } } And the method to clean the session info on JBoss side (on my client jar): private void cleanUserSession(HttpServletRequest _request) { HttpSession session = (HttpSession) _request.getSession(false); if ( session != null ){ session.setAttribute(ClientUtil.AUTH_TOKEN, "" ); session.setAttribute(ClientUtil.USUER_INFO, null); } }
score: 0

http://stackoverflow.com/q/21282785
tagged with: list
has answer: http://stackoverflow.com/a/21282832
tagged with: java
has comment: http://stackoverflow.com/comment/32069672
accepted answer: http://stackoverflow.com/a/21282832
possible better answer: http://stackoverflow.com/a/21284034
type: Question
has answer: http://stackoverflow.com/a/21284034
answer count: 2
has title: Convert List<Object> to List<String> without for?
score: 0
has body: How can I convert a List of Objects to corresponding List of Strings without scanning all elements by for loop?
has comment: http://stackoverflow.com/comment/32069819
has comment: http://stackoverflow.com/comment/32069797
has comment: http://stackoverflow.com/comment/32069773
type: AnsweredQuestion

http://stackoverflow.com/a/21345272
answers question: http://stackoverflow.com/q/21345246
type: Answer
score: 1
upvote count: 1
downvote count: 0
has body: You're not checking the first element of the array public static double computePositiveSum(double[] num) { double sum = 0.0; for(double d : num) { if(d &gt; 0) { sum += d; } } return sum; }

http://stackoverflow.com/comment/32059231
comment on: http://stackoverflow.com/a/21276130
type: Comment
has text: Beauty ! works perfectly.. but y is it like executeUpdate works but executeQuery doesnt work ?? in both casesdata is getting inserted properly.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32075762
comment on: http://stackoverflow.com/a/21285785
score: 0
type: AnswerComment
type: Comment
has text: I have complex ant tasks for building

http://stackoverflow.com/comment/32077327
has text: age is an integer, so insert there an int such as 5 or so
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21287024
type: Comment

http://stackoverflow.com/q/21295779
has comment: http://stackoverflow.com/comment/32093520
has comment: http://stackoverflow.com/comment/32094686
has comment: http://stackoverflow.com/comment/32094371
tagged with: java
has answer: http://stackoverflow.com/a/21324380
type: Question
has comment: http://stackoverflow.com/comment/32093858
answer count: 2
has comment: http://stackoverflow.com/comment/32094028
has answer: http://stackoverflow.com/a/21296702
has comment: http://stackoverflow.com/comment/32094738
has body: How do I keep track of the DNA strand with the smallest and largest number of each of the nucleobases and print those strands to the output? Lets say I write this into the console(when I type "end" the output will display): A CC AATA GGG TTT end The console should produce output that's like this: A count: 4 C count: 2 G count: 3 T count: 4 Low A count: CC High A count: AATA Low C count: A High C count: CC Low G count: A High G count: GGG Low T count: A High T count: TTT Here is my code: package com.trouen; import java.util.Scanner; public class DNA { public static void main(String[] args) { Scanner s = new Scanner(System.in); process(s); } public static void process(Scanner s) { int aCount = 0; int cCount = 0; int gCount = 0; int tCount = 0; String lowACount = null; String lowCCount = null; String lowGCount = null; String lowTCount = null; String highACount = null; String highCCount = null; String highGCount = null; String highTCount = null; String printout = null; while (s.hasNext()) { String input = s.next(); for (int i = 0; i &lt; input.length(); i++) if (input.charAt(i) == 'A') { aCount++; } else if (input.charAt(i) == 'C') { cCount++; // lowCCount = input; } else if (input.charAt(i) == 'G') { gCount++; // lowGCount = input; } else if (input.charAt(i) == 'T') { tCount++; // lowTCount = input; } if (input.equalsIgnoreCase("end")) { break; } } s.close(); System.out.println("A count: " + aCount); System.out.println("C count: " + cCount); System.out.println("G count: " + gCount); System.out.println("T count: " + tCount); System.out.println("Low A count: " + lowACount); System.out.println("High A count: " + highACount); System.out.println("Low C count: " + lowCCount); System.out.println("High C count: "); System.out.println("Low G count: " + lowGCount); System.out.println("High G count: "); System.out.println("Low T count: " + lowTCount); System.out.println("High T count: "); } } I seem to have gotten the counting the amount of letters down, but I can't seem to figur…
has comment: http://stackoverflow.com/comment/32093467
has comment: http://stackoverflow.com/comment/32093375
has comment: http://stackoverflow.com/comment/32093419
score: 0
has title: Count and display frequently occuring strings (Java)
type: UnansweredQuestion

http://stackoverflow.com/a/21349738
answers question: http://stackoverflow.com/q/21349694
has body: it crashes because the LayoutParams refers always to the Parent. In your case you are getting a ClassCastException because you are using the LinearLayout.LayoutParams
score: 0
type: Answer

http://stackoverflow.com/comment/32148834
type: AnswerComment
comment on: http://stackoverflow.com/a/21308379
has text: Ok, You need to have your test classes at the same location as your testng jar and xml. testNG jar doesn't understand the path for your test class from xml. If yor are creating a jar than you need to have testNG jar path added to mainfest file.
score: 0
type: Comment

infrared
tags question: http://stackoverflow.com/q/21322422
type: Tag
tag name: infrared

http://stackoverflow.com/comment/32008448
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21246524
type: Comment
has text: EchoServer EchoServer = new EchoServer(); EchoServer.echo(); // and echo() is not static!!

http://stackoverflow.com/comment/32166927
has text: @Dukeling On closer inspection you are right, I overlooked that the swaps are not happening in the inner loop.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21334949

http://stackoverflow.com/q/21288493
answer count: 2
accepted answer: http://stackoverflow.com/a/21290865
has answer: http://stackoverflow.com/a/21293009
has body: Im trying to make it so when a button is clicked, I can change one of its properties. class Tile extends Button{ public int position[]; public Tile(){ super(); position = 0; } } Where initialized: { Tile tiles [][] = new Tile[10][10]; for(int i=0; i&lt;10; i ++){ for(int j =0; j&lt;10; j++){ tiles[i][j].position = i*10+j; tiles[i][j].addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler&lt;MouseEvent&gt;(){ @Override public void handle(MouseEvent e) { System.out.println(((Tile)(e.getSource())).position[1]); //this results in a null pointer } }); } } } I'd like the program to print out the position value in the tile when it is clicked. Is there any way to access the object which the event is referring to? I really just need to know which tile in the array was clicked. edit: When I try to use e.getSource(), i get a NullPointerException
tagged with: button
possible better answer: http://stackoverflow.com/a/21293009
score: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21290865
tagged with: java
tagged with: javafx
has title: Javafx2 modify button when clicked
tagged with: event-listener
type: Question

http://stackoverflow.com/q/21341027
accepted answer: http://stackoverflow.com/a/21341202
has answer: http://stackoverflow.com/a/51578089
has answer: http://stackoverflow.com/a/25659067
has answer: http://stackoverflow.com/a/27948007
has body: Given a byte array, how can I find within it, the position of a (smaller) byte array? This documentation looked promising, using ArrayUtils, but if I'm correct it would only let me find an individual byte within the array to be searched. (I can't see it mattering, but just in case: sometimes the search byte array will be regular ASCII characters, other times it will be control characters or extended ASCII characters. So using String operations would not always be appropriate) The large array could be between 10 and about 10000 bytes, and the smaller array around 10. In some cases I will have several smaller arrays that I want found within the larger array in a single search. And I will at times want to find the last index of an instance rather than the first.
answer count: 10
has answer: http://stackoverflow.com/a/21341389
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21341168
tagged with: java
has comment: http://stackoverflow.com/comment/32174223
has comment: http://stackoverflow.com/comment/32174106
possible better answer: http://stackoverflow.com/a/21341168
type: Question
has answer: http://stackoverflow.com/a/38790765
has answer: http://stackoverflow.com/a/31473708
has answer: http://stackoverflow.com/a/67275192
has answer: http://stackoverflow.com/a/21341202
has answer: http://stackoverflow.com/a/48853508
tagged with: search
has title: Find indexOf a byte array within another byte array
score: 45
tagged with: arrays
downvote count: 0
upvote count: 45
favorite count: 0

http://stackoverflow.com/comment/32172008
comment on: http://stackoverflow.com/q/21339686
score: 0
type: QuestionComment
has text: Preferences -> Java -> Editor -> Content Assist -> Favorites helps you to correct this error. But this still requires manual correction. If you have that much of static imports, I would consider this to be a code smell.
type: Comment

http://stackoverflow.com/q/21208428
tagged with: http://stackoverflow.com/tag/xml
has body: When I click my button in emulator, my application crashes. Below is my layout.xml: &lt;Button android:id="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_below="@+id/textView1" android:layout_marginTop="40dp" android:onClick="loginUser" android:text="@string/login_text" /&gt; Here is my method loginUser() in my MainActivity.java: public void loginUser() { Log.d("User Authentication Service", "Trying to login..."); doLogin(new Intent(getBaseContext(), LoginUserService.class)); } I've defined which method should be called in my layout.xml using the below line: android:onClick="loginUser" But when I press the button in emulator, application crashes. I've tried changing the above value in layout.xml as show below: android:onClick="loginUser()" But nothing works. What's is wrong?
has comment: http://stackoverflow.com/comment/31938493
has comment: http://stackoverflow.com/comment/31938903
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
upvote count: 1
downvote count: 0
answer count: 1
has title: Button click not working. - Android
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/21208435
accepted answer: http://stackoverflow.com/a/21208435

http://stackoverflow.com/a/21197461
downvote count: 0
answers question: http://stackoverflow.com/q/21197438
has body: b^2 doesn't do what you think it does in Java. Write b*b instead. The ^ operator is actually the bitwise-XOR operator; there is no exponent operator. (There is, however, a Math.pow() function.)
score: 5
upvote count: 5
type: Answer

http://stackoverflow.com/q/21229178
type: Question
has answer: http://stackoverflow.com/a/21229200
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/9473562
has answer: http://stackoverflow.com/a/21229429
has comment: http://stackoverflow.com/comment/31975781
has title: How to Stop Multiple Instances of a Thread Class one by one?
has body: I have a Thread worker class Java, which is initiated several times (Lets say 10 instances). Now I want to stop these running threads one by one in the order they a created (First in first). All these thread objects are stored in an ArrayList. Could anyone help. Thanks in advance Lee
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/21229713
has comment: http://stackoverflow.com/comment/31975763
tagged with: java

http://stackoverflow.com/comment/31932547
has text: When you write new `Scanner(System.in)` you are passing `Scanner` an `InputStream` which is located in the `System` class. However in your example that's not what you wanted to use it for, so you needed to pass it the right object, which, in this case, was the `File` object you just obtained from `JFileChooser`. I hope that makes sense, feel free to ask for clarification if anything doesn't make sense.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21198703
type: Comment

http://stackoverflow.com/q/21267930
possible better answer: http://stackoverflow.com/a/21268308
has answer: http://stackoverflow.com/a/21268308
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21268251
has comment: http://stackoverflow.com/comment/32044361
accepted answer: http://stackoverflow.com/a/21268251
type: Question
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/32044419
has title: How to simply display a value on a jsp page?
has comment: http://stackoverflow.com/comment/32044651
tagged with: java
has comment: http://stackoverflow.com/comment/32044543
answer count: 2
tagged with: jsp
has comment: http://stackoverflow.com/comment/32044515
has body: I realize variations of this question are all over, but are not meeting my specific needs and noobness. No matter what I try in the .jsp file, I am always displaying blank strings. I'm not sure if I'm not even passing the value, or if I'm trying to display it incorrectly. The controller method that calls the page: @RequestMapping(value = "/showOffice/{officeId}", method=RequestMethod.GET) public ModelAndView showOfficePage(@PathVariable("officeId") Long officeId, HttpServletRequest request) { System.out.println("The office being found is: " + officeId.toString()); Office office = officeServiceImpl.find(officeId); String officeName = office.getOfficeName(); System.out.println("The office name that should be displayed is: " + officeName); ModelAndView result = new ModelAndView("showOffice", "office", office); request.setAttribute("officeName", officeName); return result; } The jsp file (which calls includes the include.jsp which has <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>: <t:genericpage> <t:header></t:header> Office Name:<c:out value="${request.officeName}" /> </t:genericpage> Here's the link that I press to show the button: Find An Office Logging shows that the appropriate value is assigned to officeName in the controller method. Can anybody advise me here? Thanks.
score: 0

http://stackoverflow.com/q/21335677
answer count: 1
has comment: http://stackoverflow.com/comment/32163671
favorite count: 0
has answer: http://stackoverflow.com/a/21336096
tagged with: classloader
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/17978514
downvote count: 1
tagged with: jakarta-ee
has body: I try to run a JBoss7x with a quite special XA configuration to enable FCF. I configured my datasource and stuff and want to start the application now. Unfortunately I get the following Exception: Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of <bootloader>) previously initiated loading for a different type with name "javax/transaction/xa/XAResource" at java.lang.Class.getDeclaredMethods0(Native Method) [rt.jar:1.7.0_25] at java.lang.Class.privateGetDeclaredMethods(Class.java:2521) [rt.jar:1.7.0_25] at java.lang.Class.privateGetPublicMethods(Class.java:2641) [rt.jar:1.7.0_25] JBoss has two different locations to load this special class or interface. the JEE6 jar and the jdk7 himself. Firstly WHY? And secondly, how to solve this Problem? Here's the configuration of the datasource, but the problem is not related to the datasource. The main issue that this class present in two official oracle <xa-datasource-property name="URL"> jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=ON) (ADDRESS=(PROTOCOL=TCP)(HOST=node1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP) (HOST=node2)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=REDSHEEP_RAC.WORLD))) </xa-datasource-property> <xa-datasource-property name="ONSConfiguration"> nodes=node1:6200,node2:6200 </xa-datasource-property> <xa-datasource-property name="MinPoolSize"> 200 </xa-datasource-property> <xa-datasource-property name="MaxPoolSize"> 200 </xa-datasource-property> <xa-datasource-property name="InactiveConnectionTimeout"> 5 </xa-datasource-property> <xa-datasource-property name="TimeToLiveConnectionTimeout"> 5 </xa-datasource-property> <xa-datasource-property name="AbandonedConnectionTimeout"> 5 </xa-datasource-property> <xa-datasource-property name="ConnectionWaitTimeout"> 5 </xa-datasource-property> <xa-datasource-property name="PropertyCycle"> 900 </xa-datasource-property> <xa-datasource-property name="ValidateConnectionOnBorrow"> true </xa-datasource-property> <xa-datasource-property name="…
has comment: http://stackoverflow.com/comment/32163622
has title: Class javax.tranxaction.xa.XAResource present in two jars
tagged with: java
score: -1
tagged with: jboss
type: Question
upvote count: 0

http://stackoverflow.com/q/21345615
has body: I am trying to start a Service that implements SensorEventListener. I am getting an error in my logcat claiming: android.content.ActivityNotFoundException:Unable to find explicit activity class {com.devicemoved/com.devicemoved.ShakeWakeupService}; have you declared this activity in your AndroidManifest.xml? My Service is declared in my manifest as shown: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.devicemoved" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" /&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.devicemoved.launcherGo" 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;service android:name="com.devicemoved.ShakeWakeupService" /&gt; &lt;/application&gt; The Activity public class ShakeWakeupService extends Service implements SensorEventListener { private Context mContext; SensorManager mSensorEventManager; Sensor mSensor; // BroadcastReceiver for handling ACTION_SCREEN_OFF. public BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // Check action just to be on the safe side. if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { Log.v("shake mediator screen off", "trying re-registration"); // Unregisters the listener and registers it again. mSensorEventManager.unregisterListener(ShakeWakeupService.this); mSensorEventManager.registerListener(ShakeWakeupService.this, mSensor, SensorManager.SENSOR_DELAY_NORMAL); } } }; @Override public void onCreate() { super.onCreate(); Log.v("shake service startup", "registering fo…
tagged with: sensors
answer count: 1
downvote count: 0
score: 1
favorite count: 0
tagged with: service
accepted answer: http://stackoverflow.com/a/21345639
tagged with: android
upvote count: 1
type: AnsweredQuestion
tagged with: java
has title: Activity not found while using a service
type: Question
tagged with: broadcastreceiver
has answer: http://stackoverflow.com/a/21345639

http://stackoverflow.com/comment/32070862
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21283246
has text: @IndraYadav: he clearly gave an example with numbers from 1 to 6 but I'll edit my answer to reflect both cases.
score: 0

http://stackoverflow.com/a/21279138
downvote count: 0
has body: You can try this. Location location = new Location("providername"); location.setLatitude(latitude); location.setLongitude(longitude); Then you can use the location object;
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21278916
type: Answer

http://stackoverflow.com/a/21206554
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21206303
has body: You need to assign the Logger been returned by Logger.getLogger() to a Logger object, like this: Logger log = Logger.getLogger("myApp"); and then use log to work. Otherwise Logger.getLogger() will always return a new instance.
score: 1
answers question: http://stackoverflow.com/q/21206303
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31936247

http://stackoverflow.com/comment/32071609
type: Comment
comment on: http://stackoverflow.com/a/21283776
has text: I want to use an array because its our main lesson now. I did a loop thing inside the first for loop but it just dont work.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31912611
comment on: http://stackoverflow.com/q/21193657
has text: Worth reading: http://stackoverflow.com/questions/504103/how-do-i-write-a-correct-micro-benchmark-in-java
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32025436
has text: But How can I achieve ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21257695
type: AnswerComment

http://stackoverflow.com/a/21222763
score: 1
has body: You need to keep track of the maximum number of users while your iterating. Initialize a variable called maxWebsite to null before your loop Initialize an integer called max to Integer.MIN_VALUE before your loop While your iterating, test if w.getMaxUsers() is superior than the max value. If it is, update accordingly the maxWebsite and max variables Note : remove the else statement in your loop, you have to iterate all the elements of your array. If you're using Collections, that could be simple using Collections.max with a custom comparator : List&lt;Website&gt; l = ....... l.removeAll(Collections.singleton(null)); //remove null elements from the list Website maxWebsite = Collections.max(l, new Comparator&lt;Website&gt;(){ @Override public int compare(Website arg0, Website arg1) { return Integer.compare(arg0.getMaxUsers(), arg1.getMaxUsers()); } });
answers question: http://stackoverflow.com/q/21222557
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/61958056
type: AnswerComment
score: 0
type: Comment
has text: @David I had a question around how to make a custom ring chart and I think you would be in position to answer if this is even possible https://stackoverflow.com/questions/37213030/make-a-custom-ring-chart-in-jfreecharts
comment on: http://stackoverflow.com/a/21229111

http://stackoverflow.com/a/21300096
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21300023
has body: ! negates a boolean expression: !true: is false !false: is true while something == false will evaluate to: true: if something is false false: if something is true In this case both expressions will evaluate to the same value: public static void main(String[] args) { System.out.println(!false); System.out.println(false == false); System.out.println(!true); System.out.println(true == false); } Output: true true false false

http://stackoverflow.com/a/21327506
has comment: http://stackoverflow.com/comment/32151498
type: Answer
score: 2
upvote count: 3
answers question: http://stackoverflow.com/q/21327012
downvote count: 1
has body: Firstly I am confused about your code s = con.prepareStatement(); Is it work well?I can't find such function in JAVA API,at least one parameter is needed.Maybe you want to invoke this function s = con.createStatement(); I just ran my code to access DB2 for twice with one single Statement instance without close it between two operation.It's work well.I think you can try it yourself too. String sql = ""; String sql2 = ""; String driver = "com.ibm.db2.jcc.DB2Driver"; String url = "jdbc:db2://ip:port/DBNAME"; String user = "user"; String password = "password"; Class.forName(driver).newInstance(); Connection conn = DriverManager.getConnection(url, user, password); Statement statement = conn.createStatement(); ResultSet resultSet = statement.executeQuery(sql); int count = 0; while (resultSet.next()) { count++; } System.out.println("Result row count of query number one is: " + count); count = 0; resultSet = statement.executeQuery(sql2); while (resultSet.next()) { count++; } System.out.println("Result row count of query number two is: " + count);

http://stackoverflow.com/comment/32150197
has text: I think you have not included the catch block
comment on: http://stackoverflow.com/q/21328007
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/q/21245072
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/6358428
tagged with: footer
score: 0
tagged with: android
has body: For almost a week am I wondering (unsuccesfully) how to how to detect that all ListView objects (rows) are loaded. My ListView is Load-More type (i've set the limit to 5 rows, so after every 5 rows does it load more 5). I am using Parse.com framework. When the whole list is loaded I want to remove footer View. For more see my code below. Do you have any idea or advice, how to accomplish it? Thanks in advance. public class Fragment1 extends Fragment { private ListView mListView; private AnimalAdapter mAdapter; ProgressBar mProgressBar; EditText mEditText; RelativeLayout mRelativeLayout; ProgressBar oProgressBar; LinearLayout mLinearLayout; Context context; LayoutInflater inflater; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.animalsfrag, container, false); mListView = (ListView)rootView.findViewById(R.id.animal_list); View header = getActivity().getLayoutInflater().inflate(R.layout.header, null); header.setPadding(2, 8, 4, 2); mListView.setVisibility(View.INVISIBLE); mListView.requestFocus(); mListView.addHeaderView(header); View footer = getActivity().getLayoutInflater().inflate(R.layout.footer, null); mListView.addFooterView(footer); footer.setVisibility(View.VISIBLE); mProgressBar = (ProgressBar) rootView.findViewById (R.id.loading_animals); mProgressBar.setVisibility(View.VISIBLE); RemoteDataTask task = new RemoteDataTask(); task.execute(); return rootView; } public void updateData() { //Main area no.1 mListView = (ListView)getView().findViewById(R.id.animal_list); int limit = mListView.getCount() + 5; ParseQuery&lt;Animal&gt; query = ParseQuery.getQuery(Animal.class); query.setCachePolicy(CachePolicy.CACHE_THEN_NETWORK); query.orderByAscending("animal"); query.setLimit(limit); Toast.makeText(getActivity(), "now", Toast.LENGTH_SHORT).show(); query.findInBackground(new FindCallback&lt;Animal&gt;() { @Override public void done(List&lt;Animal&gt; animals,…
possible better answer: http://stackoverflow.com/a/21245250
has answer: http://stackoverflow.com/a/21245250
tagged with: parse-platform
has title: Android: How to detect that all ListView objects are loaded
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21249116
tagged with: java
accepted answer: http://stackoverflow.com/a/21249116
tagged with: listview

http://stackoverflow.com/comment/31909028
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21191823
has text: Are you sure that one works?. Cuz I am pretty sure I did like that and it only wrote out something like this: example.com@49030, example.com@930490

http://stackoverflow.com/q/21294032
has title: XMl Validation Error for xs:attribute ref
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21294220
score: 0
answer count: 2
has body: My apologies if I am asking a repeated question. I did try to search online for a similar issue with no luck. Any help would be greatly appreciated. I I am trying to validate an xml with an xsd. The xsd has multiple import statements to reference other xsd's. I am getting this error for any attributes which has ref partial xml tag org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'bme:version' to a(n) 'attribute declaration' component. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown Source) at org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(Unknown Source) at org.apache.xerces.impl.xs.traversers.XSDAttributeTraverser.traverseLocal(Unknown Source) at org.apache.xerces.impl.xs.traversers.XSDAbstractTraverser.traverseAttrsAndAttrGrps(Unknown Source) at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.processComplexContent(Unknown Source) at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexTypeDecl(Unknown Source) at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseGlobal(Unknown Source) at org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(Unknown Source) at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(Unknown Source) at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseGlobal(Unknown Source) at org.apache.xerces.impl.xs.traversers.XSDHandler.traverseSchemas(Unknown Source) at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source) at org.ap…
has answer: http://stackoverflow.com/a/21295684
type: UnansweredQuestion
tagged with: xsd

http://stackoverflow.com/q/21259620
has comment: http://stackoverflow.com/comment/32201714
downvote count: 0
score: 1
has title: EWS Java API 1.2 - best way to parse letter body
tagged with: java
type: Question
tagged with: ewsjavaapi
tagged with: exchangewebservices
has answer: http://stackoverflow.com/a/21263120
upvote count: 1
accepted answer: http://stackoverflow.com/a/21263120
answer count: 1
has body: I'm using EWS Java API 1.2 to get e-mails from server. And I have a problem: I use properties like this: PropertySet itemPropertySet = new PropertySet(BasePropertySet.FirstClassProperties); itemPropertySet.setRequestedBodyType(BodyType.Text); ... String body = message.getBody().toString(); In this example I get body as plain text. But I need to save formatting of body (e.g. empty lines). When I use BodyType.HTML I get all html tags, css styles etc. What is the best way to get body of message with saving formatting and excluding html tags, css styles, etc. Thank you for your replies! Update with my solution: I've stopped on this variant. My problem was in empty lines, so now I handle BR and P tags by next functions: public void handleStartTag(Tag t, MutableAttributeSet a, int pos) //To handle Tag.BODY public void handleSimpleTag(Tag t, MutableAttributeSet a, int pos) //To handle Tag.BR and adding '\n' public void handleEndTag(Tag t, int pos) //To handle Tag.P (and adding '\n') and Tag.BODY public void handleText(char[] data, int pos)
favorite count: 0
linked to: http://stackoverflow.com/q/18125685
type: AnsweredQuestion

http://stackoverflow.com/comment/31944912
has text: @EJP Ok, I guess I was just to quick to draw a conclusion, not considering all (independent from Serializable) possibilities. Now that I see the answers. I am removing the first comment.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21203846

http://stackoverflow.com/comment/32027270
has text: Many years ago, at the time of the epic BGGA/CICE/FCM fight, I read [somewhere](https://weblogs.java.net/blog/carcassi/archive/2010/04/09/two-problems-generics-java-0) that "Java should focus on fixing its Generics instead of bringing in yet another layer of complexity". Turns out they did the former as a service to the latter :)
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21258213

http://stackoverflow.com/q/21189009
type: AnsweredQuestion
tagged with: java
downvote count: 5
tagged with: date
has comment: http://stackoverflow.com/comment/31903621
has title: Convert string to a formated date in java
has comment: http://stackoverflow.com/comment/31903760
answer count: 1
has body: Hi, I have a string like: String selectedDate = "Fri Jan 17 00:00:00 CAT 2014"; I need to format it to: DD.MM.YYYY = 17.01.2014 00:00:00 Can anyone help please see code below: String date = getDate(selectedDate); private String getDate(String inpuDate) { Date date = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss ").parse(inputDate); return new SimpleDateFormat("dd.mm.yyyy hh:mm:ss").format(date); }
favorite count: 0
has answer: http://stackoverflow.com/a/21189253
duplicate of: http://stackoverflow.com/q/4772425
accepted answer: http://stackoverflow.com/a/21189253
has comment: http://stackoverflow.com/comment/31903842
tagged with: parsing
has comment: http://stackoverflow.com/comment/31903687
upvote count: 2
score: -3
has comment: http://stackoverflow.com/comment/31903713
has comment: http://stackoverflow.com/comment/31903905
linked to: http://stackoverflow.com/q/4772425
has comment: http://stackoverflow.com/comment/31904023
type: Question

http://stackoverflow.com/comment/32179696
type: QuestionComment
comment on: http://stackoverflow.com/q/21343936
has text: What is for `BigInteger.valueOf(a)`? This should be `a`.
score: 0
type: Comment

http://stackoverflow.com/q/21297178
has title: Can I get a JTextField above an JEditorPane but below a JTabbedPane?
upvote count: 1
downvote count: 1
type: Question
has body: I'm working on a simple web browser that has tabs. I'm having alot of trouble adding a textfield below the tabbedpane, exactly like it is in chrome. Heres what I have so far: public class Browser { private JFrame frame; private JPanel panelTop; private JEditorPane editor; private JScrollPane scroll; private JTextField field; private JButton button; private JButton home; private URL url; private JMenu file = new JMenu("File"); private JMenuItem exit = new JMenuItem("Exit"); private JMenuBar menuBar = new JMenuBar(); private ImageIcon nt = new ImageIcon("./Icons/newTab.jpg"); private ImageIcon cl = new ImageIcon("./Icons/close.png"); private JButton newTab = new JButton(cl); private JTabbedPane tabbedPane = new JTabbedPane(); private int tabCounter = 0; private Dimension dim = new Dimension(nt.getIconWidth()+2, nt.getIconHeight()+2); public Browser() { initComponents(); frame = new JFrame(); frame.setTitle("TeslaNet Browser"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(800,600); frame.setJMenuBar(menuBar); menuBar.add(file); file.add(exit); exit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); panelTop = new JPanel(); frame.add(BorderLayout.NORTH, panelTop); panelTop.add(field); panelTop.add(button); panelTop.add(home); panelTop.add(newTab); newTab.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { initComponents(); } }); newTab.setToolTipText("New Tab"); newTab.setPreferredSize(dim); JPanel topPanel = new JPanel(); topPanel.setLayout(new BorderLayout()); frame.add(topPanel); topPanel.add(tabbedPane, BorderLayout.CENTER); panelTop.add(scroll, BorderLayout.CENTER); frame.setVisible(true); } private void initComponents() { try { url = new URL("http://www.reddit.com"); } catch(MalformedURLException mal) { JOptionPane.showMessageDialog(null,mal); } try { editor = new JEditorPane(url); editor.setEditable(false); } catch(IOException ioe) { JOptionPane.showMe…
score: 0
has comment: http://stackoverflow.com/comment/32162273
answer count: 1
tagged with: layout-manager
has answer: http://stackoverflow.com/a/21302970
accepted answer: http://stackoverflow.com/a/21302970
favorite count: 0
tagged with: jtabbedpane
has comment: http://stackoverflow.com/comment/32104521
has comment: http://stackoverflow.com/comment/32104657
tagged with: swing
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/21325924
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32239775
has comment: http://stackoverflow.com/comment/32147565
has comment: http://stackoverflow.com/comment/32151151
has title: Unable to generate xml files through junit
has comment: http://stackoverflow.com/comment/32147604
linked to: http://stackoverflow.com/q/14247610
tagged with: junit
downvote count: 0
favorite count: 0
has body: I have a class that executes testcases. But I am facing a little problem here. After the testcases gets executed, corresponding xmls are not getting generated. I want to generate a junitreport so I require the xml files generated by junit. public class TestRunner1 { public static void main(String[] args) { Class[] classes = { TestCase1.class ,PrimeNumberCheckerTest.class , TestCase2.class}; Result result = JUnitCore.runClasses(classes); for (Failure failure : result.getFailures()) { System.out.println(failure.toString()); } System.out.println(result.wasSuccessful()); // System.out.println(result); } } can someone help?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32147240
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/a/21191623
type: Answer
upvote count: 6
has body: It seems the 'commons-pool' jar is not being deployed. If you are using eclipse, you can check which jars are deployed by going to the project's properties, and clicking Deployment Assembly.
has comment: http://stackoverflow.com/comment/31908866
score: 6
answers question: http://stackoverflow.com/q/21191544
has comment: http://stackoverflow.com/comment/31908728
downvote count: 0

http://stackoverflow.com/comment/32020356
has text: See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/a/9554657/418556) Commonly the fix to this type of problem is to use a modal component such as a `JDialog` or a `JOptionPane`..
comment on: http://stackoverflow.com/q/21254693
type: Comment
type: QuestionComment
score: 4

http://stackoverflow.com/a/21283978
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32074393
has body: As you are using projection in HQL your result will be List. So, for each resultant row you have an Object[] array with following data types as per your projections. {String, Your model object, int/long, String}. So, when you do allParent.get(i).getAllChild() and i=0 you are doing getAllChild() on Object[] array and will result ClassCastException. Please go through using projections in HQL.
has comment: http://stackoverflow.com/comment/32100737
has comment: http://stackoverflow.com/comment/32074750
answers question: http://stackoverflow.com/q/21263170

http://stackoverflow.com/comment/31961435
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21220234
has text: @MChan: When I go to your SO profile, I see that you're from Hong Kong. You thus have a ManyToOne association with Hong Kong. But, by seeing your profile, I can't know all the SO users from Hong Kong. It's the same here: you load a user and you know its role. But that doesn't mean that you know all the users having this role.

http://stackoverflow.com/a/21306665
has body: The most important thing to remember is that Maven and OSGi have completely different roles: Maven is a build tool. It is responsible for compiling your code (using the javac compiler) and assembling the result into bundles (jar files) on the disk... and that's it. Maven doesn't run your code. OSGi is a runtime modularity framework. It takes bundle files that have been built by Maven or any other build system, and creates a framework for them to run in. OSGi doesn't tell you how to build the bundles, but it does place some constraints on their contents that have to be satisfied by whatever build tool you use. Now to answer your specific questions: A "plug-in" is Eclipse terminology for a bundle. This arose because Eclipse used a different module system than OSGi prior to version 3. Now they are the same thing. A package is NOT the same thing, it is a Java package as in the package declaration that you put at the top of your Java source files. Typically a bundle will contain one or more packages. A dependency in the Maven pom.xml means that the specified jar file will be made visible to the javac compiler when it compiles your code. Remember that Maven is a build tool so this only specifies a build-time dependency. This is required because if you use a symbol in your Java source such as org.slf4j.Logger then the javac compiler has to find that symbol on the classpath. Otherwise the compilation of your code will fail. OSGi bundles are the output of your build process, and the physical modules loaded by the runtime OSGi framework. Essentially a bundle is just a jar file with some OSGi-specific entries in its META-INF/MANIFEST.MF. Because it is a file you can save it, move it around, deploy it into an application etc. OSGi loads this file and creates a runtime module that encapsulates the contents of the bundle. A whole application is typically made out of many bundles. To run an OSGi application you have to tell OSGi which bundles to include. From the combination of bu…
score: 2
accepted answer of: http://stackoverflow.com/q/21290739
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21290739
upvote count: 2
type: Answer

http://stackoverflow.com/a/21184858
answers question: http://stackoverflow.com/q/21184695
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: Longer version is more readable and the the code is self documenting. So a good method name = method responsibility. Adj can be understand as adjust or adjacent, etc.

http://stackoverflow.com/comment/32080621
has text: @Gaurav No. It's the other way around: Because the number of bits in a byte is only 8, it allows only 256 different numbers. **usually** it is assumed this are the numbers -128 to 127, inclusive. But since you don't want numbers (as you said), it doesnt matter.
type: AnswerComment
comment on: http://stackoverflow.com/a/21288753
score: 0
type: Comment

http://stackoverflow.com/comment/32159171
type: Comment
type: QuestionComment
has text: You get a down-vote from me. No evidence of prior research at all.
score: 0
comment on: http://stackoverflow.com/q/21333260

http://stackoverflow.com/comment/32174925
comment on: http://stackoverflow.com/q/21341299
has text: I don't want anybody to do my homework, which is why I was trying not to post any code or have anybody post code to solve the problem. I just cant wrap my head around the question, and I don't know why because it looks like a simple problem. I will put up the code shortly, not on my school computer.
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32023644
type: QuestionComment
type: Comment
score: 3
has text: Is there any reason why you'd want to do this? If you tell us why people may be able to suggest a better solution.
comment on: http://stackoverflow.com/q/21256616

http://stackoverflow.com/comment/32076493
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21285770
has text: It looks like you've almost "improved" the bubble sort to a [cocktail sort](http://en.wikipedia.org/wiki/Cocktail_sort).
type: Comment

portability
tags question: http://stackoverflow.com/q/21308825
tag name: portability
type: Tag

http://stackoverflow.com/comment/31945870
has text: `newBuilder` can return a `BuilderA<?>`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21212139
type: Comment

http://stackoverflow.com/comment/31954292
type: AnswerComment
comment on: http://stackoverflow.com/a/21216372
type: Comment
has text: There is something i still don't understand. I updated the question, could you please show me the way how to do things right?
score: 0

http://stackoverflow.com/q/21302747
has body: In my current project I have this group of big and complicated annotations I have to put on a lots of fields around my class. They are Jackson json annotations. @JsonSerialize(using = IViewableToReferenceSerializer.class, contentUsing = IViewableToReferenceSerializer.class) private ComplexeObject myObject; and I would like to substitute it to something like: @JsonAsReference private ComplexeObject myObject; I already tested the system without the custom annotation and it works fine. I though I could define my annotation as (for example): @Target({ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @JsonSerialize(using = IViewableToReferenceSerializer.class, contentUsing = IViewableToReferenceSerializer.class) public @interface JsonAsReference { } So my question is: Is it even possible? Or am I just doing something wrong? UPDATE: I found an answer for the particuliar Jackson case in this thread Create a custom Jackson annotation but I am open to any general case solution.
answer count: 1
has title: Substitute complicated combo of annotations with one custom annotation
type: UnansweredQuestion
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/12921812
tagged with: annotations
type: Question
has comment: http://stackoverflow.com/comment/32105476
has answer: http://stackoverflow.com/a/21303084

http://stackoverflow.com/comment/32017656
score: 1
type: QuestionComment
type: Comment
has text: I'm surprised you don't get error with `ActionName.get(c)` `:/`
comment on: http://stackoverflow.com/q/21252960

http://stackoverflow.com/a/21332673
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21276134
has body: If you are using the old MapReduce API, continue using new Job() to create the instance. If you have migrated to the new API, use Job job = Job.getInstance(conf, "word count");

http://stackoverflow.com/q/21288559
possible better answer: http://stackoverflow.com/a/21289680
has comment: http://stackoverflow.com/comment/32081897
has comment: http://stackoverflow.com/comment/32082080
type: AnsweredQuestion
tagged with: biginteger
tagged with: java
has answer: http://stackoverflow.com/a/21289759
linked to: http://stackoverflow.com/q/21286794
has title: LargeInteger's equivalent of BigInteger's and?
type: Question
has body: LargeInteger doesn't appear to have an equivalent function to BigInteger's and. Since and(BigInteger val) "Returns a BigInteger whose value is (this &amp; val). (This method returns a negative BigInteger if and only if this and val are both negative.)", I tried to follow this great answer on reproducing testBit with static LargeInteger and(LargeInteger i, LargeInteger j) { return i &amp; j; } but the compiler reports error: bad operand types for binary operator '&amp;' return i &amp; j; ^ How can BigInteger's and be reproduced to be used on LargeInteger?
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21289759
has answer: http://stackoverflow.com/a/21289680
tagged with: binary
tagged with: jscience

http://stackoverflow.com/q/21338102
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
upvote count: 8
has answer: http://stackoverflow.com/a/21349220
tagged with: maven
tagged with: spring
has comment: http://stackoverflow.com/comment/32220858
score: 8
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/68050790
accepted answer: http://stackoverflow.com/a/21349220
has title: Make Tomcat Ignore Servlet in WEB-INF/LIB
has body: I'm created a web-application and I need it to be able to interact with a graph database (I'm using Titan). When adding Titan's dependency, I get the following errors when I try to deploy this WAR in Tomcat: SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:188) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) ... 6 more Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/catalina/loader/WebappClassLoader) previously initiated loading for a different type with name "javax/servlet/ServletContext" at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoad…
tagged with: servlets

http://stackoverflow.com/comment/31919989
type: Comment
has text: @RomanVottner And technically that's perfectly legal (You just wouldn't do it in a real project); only one class is defined `public`; that has nothing to do with the error he's receiving which I've ... explained in my answer.
score: 1
comment on: http://stackoverflow.com/a/21197647
type: AnswerComment

http://stackoverflow.com/comment/34578087
has text: When you say "Move the SimpleMessagingTemplate to the root context"..I really dont understand how to move...i am sorry ...very new to spring ...
type: AnswerComment
comment on: http://stackoverflow.com/a/21320544
type: Comment
score: 1

http://stackoverflow.com/comment/32133847
has text: No its not! Look carefully ! they start their own thraead (line 38 - 56). your are executing your worker in the displaythread.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21318517

http://stackoverflow.com/comment/31918743
score: 0
comment on: http://stackoverflow.com/q/21197021
type: Comment
type: QuestionComment
has text: Pasting the error message you got in google would have returned tons of links explaining what the error means. Google is your friend. Use it.

http://stackoverflow.com/q/21269426
has answer: http://stackoverflow.com/a/21269799
has body: Help. I build a new class (ParseException) that extends the RuntimeException. In another class I check for invalid String (only letters and numbers), if it's invalid it throw a ParseException with message of the invalid token. Now I wanna test if the throw massage is according to the invalid token. So I wonder how can I get to the message that was thrown from the Exception. So I am trying catch (ParseException ex) { test(ParseException.equal( "For input string: "#""),"should be ParseException "); } and catch (ParseException ex) { test(massage.equal( "For input string: "#""),"should be ParseException "); } and other wrong things. Still it's wrong and I don't know how to get to the message field that catch.
score: -1
has comment: http://stackoverflow.com/comment/32047064
accepted answer: http://stackoverflow.com/a/21269799
answer count: 1
has comment: http://stackoverflow.com/comment/32047150
favorite count: 0
tagged with: exception
has comment: http://stackoverflow.com/comment/32047438
type: AnsweredQuestion
tagged with: java
has title: Compare catch message from exception
downvote count: 1
has comment: http://stackoverflow.com/comment/32047251
type: Question
upvote count: 0

http://stackoverflow.com/comment/63082167
type: Comment
comment on: http://stackoverflow.com/a/26693894
type: AnswerComment
score: 0
has text: Because the OP is clearly running Windows, it's really not at all helpful to the OP.

http://stackoverflow.com/comment/31989850
type: QuestionComment
score: 0
has text: Try: `set t.done = (t.done==false)`
type: Comment
comment on: http://stackoverflow.com/q/21236759

http://stackoverflow.com/comment/32120772
type: Comment
has text: It seems to me that at least one of those is probably advised by your Aspect (therefore managed by Spring), but the one handling the requests is managed by Struts. I don't know Struts integration with Spring at all, so I recommend you investigate how those two work together.
type: QuestionComment
comment on: http://stackoverflow.com/q/21271485
score: 0

http://stackoverflow.com/comment/32109771
type: Comment
type: QuestionComment
has text: do you mean that java code runs smoothly but masterdb.createCorporateDBProc() has no effect? How do you know that it is not executed? Can you update this prcedure with some log? Is there commit?
comment on: http://stackoverflow.com/q/21304504
score: 0

http://stackoverflow.com/a/21212886
answers question: http://stackoverflow.com/q/21211495
has body: You need to separate ActionListeners. You add an ActionListener to the button. This ActionListener simply starts the Timer. You create the Timer with a second ActionListener. This ActionListener decrements the time.
score: 0
type: Answer

geolocation
tags question: http://stackoverflow.com/q/21239651
tags question: http://stackoverflow.com/q/21310679
type: Tag
tag name: geolocation

opencv
type: Tag
tags question: http://stackoverflow.com/q/21292991
tags question: http://stackoverflow.com/q/21265986
tags question: http://stackoverflow.com/q/21324558
tags question: http://stackoverflow.com/q/21206481
tags question: http://stackoverflow.com/q/21231267
tags question: http://stackoverflow.com/q/21315537
tag name: opencv
tags question: http://stackoverflow.com/q/21241620
tags question: http://stackoverflow.com/q/21303001
tags question: http://stackoverflow.com/q/21287443
tags question: http://stackoverflow.com/q/21309915
tags question: http://stackoverflow.com/q/21207755

http://stackoverflow.com/comment/31946013
type: QuestionComment
has text: @jonderry I undid the removal of my post as I updated the code and my post to showcase a generic version of builder inheritance which returns the correct type (instead of the base-type)
comment on: http://stackoverflow.com/q/21210870
score: 0
type: Comment

http://stackoverflow.com/a/21354021
answers question: http://stackoverflow.com/q/21308723
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21308723
has body: There is no client context available in JMX today, maybe it will be added for JDK 9. http://weblogs.java.net/blog/emcmanus/archive/2008/12/client_context_1.html
upvote count: 1
has comment: http://stackoverflow.com/comment/32256889

http://stackoverflow.com/comment/33599088
has text: download Hercules to better undestand of SMS structure . http://new.hwg.cz/files/download/sw/version/hercules_3-2-6.exe
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21306784
type: Comment

http://stackoverflow.com/q/21248095
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/21248628
accepted answer: http://stackoverflow.com/a/21248628
score: 0
answer count: 1
tagged with: asynchronous
tagged with: callback
has body: I am using MySQL to store data for a game I am making and need to access the database from outside the main thread so to not interupt it from a long query and return the data to the main thread to be processed on it's next loop. I am aware that there are multiple ways of doing this, queues, maps, callbacks etc. What would be the "accepted" way of doing this if I was asked to do this professionally? I know this is a broad, slightly opinion based question but this is the only place I know of that I might get an answer from, if anyone knows a site that is more suited to questions like this please let me know. Thanks.
has title: Return result from asynchronous SQL query (Java)
has comment: http://stackoverflow.com/comment/32011070
has comment: http://stackoverflow.com/comment/32010392

http://stackoverflow.com/comment/31995163
has text: I figured this was the case...I'm curious if we can sign only the pertinent JARs and redistribute them, or if the entire package should be re-signed. Doing a reinstall of the application is a showstopper for most, although not being able to access it is one as well :)
type: AnswerComment
comment on: http://stackoverflow.com/a/21239846
score: 0
type: Comment

http://stackoverflow.com/comment/70246364
score: 0
type: Comment
comment on: http://stackoverflow.com/a/41520279
type: AnswerComment
has text: Above code for updating data into table using hibernate it was worked properly

http://stackoverflow.com/comment/75004984
type: Comment
comment on: http://stackoverflow.com/a/32206148
type: AnswerComment
has text: Could you please articulate a little more about how this command works for those of us who aren't experts in sed? I understand the the "b" commands mean essentially "goto" the the specified label. What do the "p" and "n" commands do?
score: 0

http://stackoverflow.com/q/21269820
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32048726
has comment: http://stackoverflow.com/comment/32048997
type: Question
has answer: http://stackoverflow.com/a/21270159
answer count: 2
has comment: http://stackoverflow.com/comment/32048855
has title: Using ProcessBuilder to run multiple programs
has comment: http://stackoverflow.com/comment/32049220
has comment: http://stackoverflow.com/comment/32048150
upvote count: 2
linked to: http://stackoverflow.com/q/15482492
favorite count: 0
tagged with: processbuilder
type: UnansweredQuestion
has body: I'm trying to create an autograder for my Java programming class I'm teaching this semester. The basic idea of the autograder is that it will place a copy of my tester's .class file in same location as the students' turnins (each in their own folder). It will report the results in a text file and give the data back to me. The issue that I'm stuck on is that I cannot get the ProcessBuilder to execute my tester class, and I've tried various different ways of typing the command out, but I'm not sure what the correct command is. Here is the code: public...main(String[] args){ ///Code not relevant ommitted Runtime runtime = Runtime.getRuntime(); for (String person : uniqueIds) { File currentLoc = new File(HW_ID + "/" + person); ProcessBuilder g = new ProcessBuilder("bash", "-c", "java", " -cp ", currentLoc.getAbsolutePath(), " Grader"); Process process = g.start(); process.waitFor(); } } "uniqueIds" is a String Array that contains each student's uniqueId, which is the name of the folder that their homework is turned in to. "HW_ID" is a constant that is the name of the folder that the turnin set for all of the students is housed in. So the file structure is: HW_ID/uniqueID/ "Grader" is the name of my program that will grade the turnins. How can I use ProcessBuilder to start my Grader program that is in the specified file location? EDIT: I'm using a Mac on this, but if the code for Windows is different, please list both. Thanks!
has answer: http://stackoverflow.com/a/21270879

http://stackoverflow.com/comment/31896353
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21184950
has text: Show us some context around Sql.java:118.
type: QuestionComment

http://stackoverflow.com/comment/138388895
score: 0
comment on: http://stackoverflow.com/a/21204085
type: Comment
has text: @Gab是好人 please note that, for example, Postres does not support READ_UNCOMMITTED and uses READ_COMMITTED instead. It may save a lot of time for you. `The SQL standard defines one additional level, READ UNCOMMITTED. In PostgreSQL READ UNCOMMITTED is treated as READ COMMITTED.`
type: AnswerComment

http://stackoverflow.com/comment/110336116
type: Comment
has text: Since all MS-Office files are XML then the use of an XML pipeline framework using Saxon enables building Excel,Word etc files using XSLT alone
type: AnswerComment
comment on: http://stackoverflow.com/a/23603661
score: 0

http://stackoverflow.com/a/21374680
score: 0
has body: That would depend the frequency of the connection being made. Having a less congested network will allow fluent performance in both the cases though using SSL/TLS would add some overhead considering low number of clients in the intra-net space. But in case you are making transactions in frequent manner, than in such case, I would prefer persistent connection reducing new connection overhead. On the other side, if we are taking about huge number of transactions from large number of connections for a server with low capabilities, then making a persistent connection may congest the network and will certainly take a test of the server. So we'll have to make choices taking various factors into consideration.
answers question: http://stackoverflow.com/q/21330421
type: Answer

http://stackoverflow.com/comment/31905564
score: 0
comment on: http://stackoverflow.com/q/21189820
type: QuestionComment
type: Comment
has text: I saw that. The question asks how does that work?Technically?

http://stackoverflow.com/a/21277348
has body: Cart crt=null; while(rst.next()) { System.out.println("CPoint"); try { long p = rst.getLong("itemID"); crt.itmID = p; // This is the line thats creating the error System.out.println(p + " is long! I guess..."); } crt is null when you try to access crt.itemID. You have to assign it an instance first. I think you may simply change the first line from the snippet to Cart crt = new Cart();
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32060860
has comment: http://stackoverflow.com/comment/32060960
type: Answer
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/21277179
answers question: http://stackoverflow.com/q/21277179

http://stackoverflow.com/comment/32056018
score: 0
has text: @ElliottFrisch Thanks for the link, I wasn't familiar with Jasmin. It seems I'm suggesting something similar to their solution with wrapper classes.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21274346

http://stackoverflow.com/q/21278860
accepted answer: http://stackoverflow.com/a/21278921
favorite count: 0
has answer: http://stackoverflow.com/a/21278921
tagged with: android
possible better answer: http://stackoverflow.com/a/21278987
upvote count: 6
answer count: 4
has answer: http://stackoverflow.com/a/78423590
type: AnsweredQuestion
tagged with: android-intent
downvote count: 1
has title: Android pass Long value Intent
has body: I know String value= value; Intent i = new Intent(this, NextActivity.class); i.putExtra("value",value + ""); startActivity(i) and in NextActivity values = getIntent().getStringExtra("value"); is used to pass the value and get value.. can any one pleaese help me how to pass the long value... I know we can get the long value through getIntent().getLongExtra(""); can anyone help me how to pass the value ' putExtra ' to my knowledge is used to pass string value..
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21278987
has answer: http://stackoverflow.com/a/21279180
has comment: http://stackoverflow.com/comment/32063342
linked to: http://stackoverflow.com/q/13671926
score: 5

http://stackoverflow.com/comment/32159823
has text: Add this to your main function last line `System.out.printf("Total Cost of Groceries :::: >>>> %.2f",list.getTotalCost());`
comment on: http://stackoverflow.com/a/21332434
type: AnswerComment
score: 0
type: Comment

mouseevent
tags question: http://stackoverflow.com/q/21214470
tags question: http://stackoverflow.com/q/21272230
tags question: http://stackoverflow.com/q/21247137
tags question: http://stackoverflow.com/q/21247833
type: Tag
tags question: http://stackoverflow.com/q/21292322
tag name: mouseevent

http://stackoverflow.com/comment/37125774
has text: No i never fixed it. It's good to know, that it's the markdown plugin. I just didn't invest time into this, because it's not a real problem. Thanks!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21228772

http://stackoverflow.com/comment/32291713
has text: thanks @Hoosier for pointing that out. Haven't explored JWI, will. kindly accept the answer if it helped.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21383233

http://stackoverflow.com/comment/32058324
score: 0
type: AnswerComment
has text: Good idea in general, but: I have the webservice classes autogenerated according to provided wsdl from the webservice. Usig your approach, I'd have to further create one wrapper class for generated class I want to use...
type: Comment
comment on: http://stackoverflow.com/a/21270668

http://stackoverflow.com/q/21265942
has title: Java array minimum element within for-loop
has body: OK, I have been at it for a long time now. I have looked after similar problems here in stack-overflow and I still can't make it work. I need to find the maximum values within an array and minimum values. Trying to find the minimum is the problem. I have literately tried everything from writing separate methods and so on and still the output in 0. Here is what I have tried: import java.util.Scanner; class ArrayMin { public static void main(String args[]) { @SuppressWarnings("resource") Scanner scanner = new Scanner(System.in); int a[] = new int[10]; int max = a[0]; int min = a[0]; System.out.println("Enter elements of array :"); for (int i = 0; i &lt; 10; i++) { a[i] = scanner.nextInt(); if (i == 9) break; } for (int i = 1; i &lt; a.length; i++) { if (a[i] &gt; max) max = a[i]; else if (a[i] &lt; min) min = a[i]; } System.out.println("Result is max is :" + (max)); //if I input 1-10, output is 10 System.out.println("Result is min is :" + (min)); //whatever number I input the output is always 0 } }
possible better answer: http://stackoverflow.com/a/21266034
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32041151
type: Question
has comment: http://stackoverflow.com/comment/32040421
has answer: http://stackoverflow.com/a/21266034
accepted answer: http://stackoverflow.com/a/21265984
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32041458
tagged with: arrays
has answer: http://stackoverflow.com/a/21265984
has comment: http://stackoverflow.com/comment/32040446

http://stackoverflow.com/q/21245950
has title: Reading a file and performing functions based on the contents of the line
possible better answer: http://stackoverflow.com/a/21245996
has answer: http://stackoverflow.com/a/21245996
accepted answer: http://stackoverflow.com/a/21246019
tagged with: line
type: AnsweredQuestion
tagged with: numbers
tagged with: java
has answer: http://stackoverflow.com/a/21246095
tagged with: file
has body: I'm wondering if it's possible to read a file by the line number, each with different values and make a condition where if that line contains a certain string or number specified. If it did it would, for example, take the content specified in that line into a variable? So in a file line one has Age: 50, line 2 has Age: 23, line 3 has Age: 34. What I'm hoping for is that I look specifically at line 3 and take the number 34 and place it in a variable for use in my program. If it is possible, how would you go about doing this?
type: Question
tagged with: if-statement
has answer: http://stackoverflow.com/a/21246019
score: 0
answer count: 3

http://stackoverflow.com/comment/32005096
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21245449
has text: Please define "delete"? Please provide some context, *any* context.

http://stackoverflow.com/q/21277056
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32060233
tagged with: java
has body: Background I am updating a DB From a Service at a certain time daily, while this DB is under update and the user tries to open the app I want to hold on and dont display what is going on, though my service is a typical Cron job implemented in the background. What can be done to achieve this? Also I want to acquire a lock on the DB so that the records dont get messed up. Would appreciate any tuts or any related algos in this regard.
type: Question
score: 0
has title: Acquire an EXCLUSIVE lock on DB
answer count: 1
has comment: http://stackoverflow.com/comment/32060353
has answer: http://stackoverflow.com/a/21277442
linked to: http://stackoverflow.com/q/21178755
tagged with: android
accepted answer: http://stackoverflow.com/a/21277442

http://stackoverflow.com/a/21246509
answers question: http://stackoverflow.com/q/21246489
has body: It should be like that public static void main(String[] args) { EchoServer0 e = new EchoServer0(); // TODO Auto-generated method stub e.listen(); } Your variable of type Object truly doesn't have such a method, but the type EchoServer0 you define above certainly has.
score: 0
type: Answer

http://stackoverflow.com/comment/32075097
comment on: http://stackoverflow.com/q/21282057
type: QuestionComment
has text: try executing `mvn dependency:tree` on your project. It looks like the wrong sqljdbc.jar is landing on the classpath. Maybe it is included as a transient dependency from somewhere else? If it is then you can define an `exclude`.
score: 0
type: Comment

http://stackoverflow.com/comment/32066218
type: AnswerComment
comment on: http://stackoverflow.com/a/21280409
score: 0
type: Comment
has text: That reason for failure can be passed back to the client in the form of the message. The status code (of say BAD REQUEST) would indicate failure.

http://stackoverflow.com/a/21282478
downvote count: 0
has body: Every Executor there uses a ThreadFactory to create the threads it needs. If you don't provide one explicitly it will take a default one which returns a rather plain thread but with a name. The method without factory will just delegate to the one with. public static ScheduledExecutorService newSingleThreadScheduledExecutor() { return new DelegatedScheduledExecutorService (new ScheduledThreadPoolExecutor(1)); } Executors start out with no thread at all and they will create one when they need one. The amount of threads they may use concurrently depend on their configuration. If a thread dies for some reason they can create a new one to replace it. SingleThreadExecutor is guaranteed to never use more than 1. It is guaranteed that your code is executed sequentially but it is not guaranteed that it will always be the same thread.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21282000
score: 2

http://stackoverflow.com/comment/31947889
comment on: http://stackoverflow.com/q/21211974
type: Comment
type: QuestionComment
score: 1
has text: Or just use fileList(). See: https://developer.android.com/reference/android/content/Context.html#fileList()

http://stackoverflow.com/comment/32018574
comment on: http://stackoverflow.com/q/21253505
has text: How do you want to communicate with each other? You could do it through ajax calls from the client-side directly, or do remote calls from the server-side
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31898776
score: 0
has text: you just need to set Uniq id to your imageview.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21186512

http://stackoverflow.com/comment/31971436
score: 0
type: Comment
type: QuestionComment
has text: What happens if you delete the files and then try to create only the 8GB and 16GB files?
comment on: http://stackoverflow.com/q/21226441

http://stackoverflow.com/comment/32047438
type: QuestionComment
has text: I don't know if I wold be comfortable getting a massage from an Exception... I hear they can be pretty rough.
score: 1
comment on: http://stackoverflow.com/q/21269426
type: Comment

http://stackoverflow.com/a/21278254
answers question: http://stackoverflow.com/q/21278185
score: 0
type: Answer
has body: I think what has happened is that when you installed the Environment Path that was set was pointing at the JRE bin and not the JDK bin. The JRE does not contain the javac executable. Inserting the JDK bin into the Environment Path will resolve the issue as windows will now scan that folder/location to search for the executable called javac.exe

http://stackoverflow.com/q/21298863
possible better answer: http://stackoverflow.com/a/21298888
upvote count: 3
accepted answer: http://stackoverflow.com/a/21298923
answer count: 3
has answer: http://stackoverflow.com/a/21301438
tagged with: log4j
has answer: http://stackoverflow.com/a/21298888
favorite count: 0
has answer: http://stackoverflow.com/a/21298923
downvote count: 0
has body: So I'm having an issue where log4j seems to want to log absolutely everything that can "debug" when I switch the root logger to DEBUG. This is my file: log4j.rootLogger=DEBUG, READER log4j.appender.READER=org.apache.log4j.ConsoleAppender log4j.appender.READER.layout=org.apache.log4j.PatternLayout log4j.appender.READER.layout.ConversionPattern=[%-5p] %t-&gt;%c{1} - %m%n com.myclass.readers=DEBUG, READER Now what I'd like is only my debug statements defined under the reader class to be printed. The issue I'm having is, it looks like the Apache HTTP package I'm using within my reader class starts dumping its debug content too. How can I restrict this to only the stuff from my class? I've looked around online, and I'm not sure whether I'm just missing something completely, but I can't seem to figure this out. Thanks!
tagged with: logging
has title: Why is log4j logging absolutely everything when in DEBUG?
type: AnsweredQuestion
score: 3
tagged with: java
type: Question

http://stackoverflow.com/a/21191764
upvote count: 2
has comment: http://stackoverflow.com/comment/31910695
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21191562
has body: Generally Speaking , An IOException will be thrown on close if the final flush fails. and this can take place for many reasons . Lets say , you have OutputStream that for some reason hasn't written to the file yet. Invoking close() will flush out the data, but if the file is locked - then an IOException would be raised.

http://stackoverflow.com/a/21312392
answers question: http://stackoverflow.com/q/21292836
score: 1
upvote count: 1
type: AcceptedAnswer
has body: No reason to launch a different intent. In your onclick method just thread out the call to the methods that actually do the work. onClick(View view) { new Thread(new Runnable() { public void run() { Call your methods } }).start(); }
type: Answer
accepted answer of: http://stackoverflow.com/q/21292836
downvote count: 0

http://stackoverflow.com/comment/31949434
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21204996
has text: I read above links. but I don't know how to over come this issue. `C:\Program Files\glassfish-3.1.2.2\glassfish\domains\domain1\logs` the logs folder is empty.
score: 0

http://stackoverflow.com/a/21254323
has comment: http://stackoverflow.com/comment/32019956
has comment: http://stackoverflow.com/comment/32019686
has body: Use a StringBuilder, which is like a mutable string: String s = "..###.##...#"; StringBuilder sb = new StringBuilder(s); sb.setCharAt(4, '$'); There are lots of other methods you can use to change the contents. When you're done: s = sb.toString();
has comment: http://stackoverflow.com/comment/32019790
answers question: http://stackoverflow.com/q/21254187
score: 1
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/32020138
downvote count: 1

http://stackoverflow.com/q/21347012
has comment: http://stackoverflow.com/comment/32185076
tagged with: equals
downvote count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21347097
has comment: http://stackoverflow.com/comment/32185020
has comment: http://stackoverflow.com/comment/32184985
tagged with: java
has comment: http://stackoverflow.com/comment/32185008
type: Question
score: -2
has comment: http://stackoverflow.com/comment/32185207
duplicate of: http://stackoverflow.com/q/513832
has body: I know that == compares whether two objects are the same and .equals() compares whether the contents inside the objects is the same. How come you can use == on int's and it would compare the contents. int x=5; int y=5; if(x==y) System.out.print("They are equal"); This code would print the statement.
has comment: http://stackoverflow.com/comment/32185055
has title: Difference between == and .equals() between strings and ints in Java
upvote count: 3
has answer: http://stackoverflow.com/a/21347072
linked to: http://stackoverflow.com/q/513832
answer count: 3
has comment: http://stackoverflow.com/comment/32185295
tagged with: string
has answer: http://stackoverflow.com/a/21347089
linked to: http://stackoverflow.com/q/767372
has comment: http://stackoverflow.com/comment/32184955
favorite count: 0

http://stackoverflow.com/comment/32008803
has text: @DanGetz absolutely. Unfortunately programming teachers/classes tend to be horrible and create assignments like this.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21247405
type: QuestionComment

http://stackoverflow.com/a/21293645
has body: The simplest way (probably not the cleanest one) in plain Java is to do the following: QuartzScheduler quartzScheduler = ... Set&lt;Trigger&gt; triggers = new HashSet&lt;&gt;(); triggers.add(new SimpleTriggerImpl()); triggers.add(new CronTriggerImpl()); Map&lt;JobDetail, Set&lt;? extends Trigger&gt;&gt; triggersAndJobs = new HashMap&lt;&gt;(); triggersAndJobs.put(new JobDetailImpl(), triggers); quartzScheduler.scheduleJobs(triggersAndJobs, false); Or if you are not using Java 7: QuartzScheduler quartzScheduler = ... Set&lt;Trigger&gt; triggers = new HashSet&lt;Trigger&gt;(); triggers.add(new SimpleTriggerImpl()); triggers.add(new CronTriggerImpl()); Map&lt;JobDetail, Set&lt;? extends Trigger&gt;&gt; triggersAndJobs = new HashMap&lt;JobDetail, Set&lt;? extends Trigger&gt;&gt;(); triggersAndJobs.put(new JobDetailImpl(), triggers); quartzScheduler.scheduleJobs(triggersAndJobs, false); A shorter version with Guava: QuartzScheduler quartzScheduler = ... Set&lt;? extends Trigger&gt; set = Sets.newHashSet(new SimpleTriggerImpl(), new CronTriggerImpl()); Map&lt;JobDetail, Set&lt;? extends Trigger&gt;&gt; triggersAndJobs = Maps.newHashMap(); triggersAndJobs.put(new JobDetailImpl(), set); quartzScheduler.scheduleJobs(triggersAndJobs, false); Update. Using TriggerBuilder in fact doesn't change much. TriggerBuilder.build() returns a trigger instance which can be referenced just as Trigger. QuartzScheduler quartzScheduler = ... Set&lt;Trigger&gt; triggers = new HashSet&lt;Trigger&gt;(); Trigger trigger1 = newTrigger() .withIdentity(triggerKey("myTrigger", "myTriggerGroup")) .withSchedule(simpleSchedule() .withIntervalInHours(1) .repeatForever()) .startAt(futureDate(10, DateBuilder.IntervalUnit.MINUTE)) .build(); triggers.add(trigger1); Trigger trigger2 = newTrigger() ... triggers.add(trigger2); Map&lt;JobDetail, Set&lt;? extends Trigger&gt;&gt; triggersAndJobs = new HashMap&lt;JobDetail, Set&lt;? extends Trigger&gt;&gt;(); triggersAndJobs.put(new JobDetailImpl(), triggers); quar…
answers question: http://stackoverflow.com/q/21292936
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32091353
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21292936
has comment: http://stackoverflow.com/comment/32090941

http://stackoverflow.com/comment/31963166
comment on: http://stackoverflow.com/q/21192290
has text: I can't reproduce this problem :/
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32237824
comment on: http://stackoverflow.com/a/21332058
has text: There was some problem in server so for everything it was responding 404.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31941297
type: QuestionComment
has text: @MichaelT the filtering keywords are determined at compile time
comment on: http://stackoverflow.com/q/21207292
score: 0
type: Comment

http://stackoverflow.com/comment/31972431
type: AnswerComment
has text: I thought this would work, but there is int & integer with char and Character also
type: Comment
comment on: http://stackoverflow.com/a/21227260
score: 0

http://stackoverflow.com/comment/32059624
type: QuestionComment
has text: i am uploading a csv file,i only need the file name to update the table contain.it works with default eclipse browser but not in chrome or firefox
comment on: http://stackoverflow.com/q/21276631
score: 0
type: Comment

http://stackoverflow.com/comment/32152420
has text: I use Swing for the front-end.. Could it be that the EDT is throwing this error but the main application thread is still running?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21329099
score: 0

http://stackoverflow.com/q/21211599
has comment: http://stackoverflow.com/comment/31944591
has comment: http://stackoverflow.com/comment/31944616
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31944583
has comment: http://stackoverflow.com/comment/31944776
has title: Image processing output gives black image
answer count: 0
tagged with: java
tagged with: image-processing
type: Question
has comment: http://stackoverflow.com/comment/31944657
has comment: http://stackoverflow.com/comment/31944659
has body: So, just posted earlier about trying to finish my comp sci project. I basically finished everything I needed to do but, I was trying to get this image to rotate 90 degrees, but when i open the outputted image, its all black. I'm not sure what is wrong with it. import java.awt.image.*; import java.io.*; import javax.imageio.*; import java.awt.*; public class Project6b { public static void main (String args[]) throws Exception { rotate90ToLeft("Jack.jpg","Jack2.jpg"); } public static void rotate90ToLeft(String originalImage, String convertedImage) throws Exception { BufferedImage bufferImg = ImageIO.read(new File(originalImage)); BufferedImage bufferImgOut = new BufferedImage(bufferImg.getWidth(),bufferImg.getHeight(), bufferImg.getType()); for( int x = 0; x &lt; bufferImg.getWidth(); x++ ) { for( int y = 0; y &lt; bufferImg.getHeight(); y++ ) { int px = bufferImg.getRGB(x, y); int destY = bufferImg.getWidth() - x - 1; bufferImgOut.setRGB(y,destY, px); } } File outputfile = new File(convertedImage); ImageIO.write(bufferImgOut, "png", outputfile); } } Okay, I figured out that the image has to be smaller than 400x400. Is there any way I can make it work for any size image?
score: 0

http://stackoverflow.com/a/21247511
upvote count: 2
has body: Your logic is incorrect. The size of the array is assigned to zero. How will you store something in that container if there is no space? You loop counter is off. The easiest way to iterate over an array is to start at the beginning and move to the end Array indexes start at zero Array indexes go up to (length - 1) You need to use high and low in your test. psuedo code initialize result to the same size as the input foreach(item in array) { if(item is in range) { add item to result } } Closer to code results = new Int[a.length()]; int resultsPosition = 0; for(int i = 0; i &lt; a.length(); i++) { if(a[i] =&gt; low &amp;&amp; a[i] &lt;= high) { results[reultsPosition] = a[i]; resultsPosition++; } }
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21247405

http://stackoverflow.com/comment/32158447
type: AnswerComment
score: 0
has text: There is no print statement in your `main` function. If you add that, you should probably get the right result by now.
type: Comment
comment on: http://stackoverflow.com/a/21332434

http://stackoverflow.com/q/21187852
tagged with: java
tagged with: ssl
answer count: 1
linked to: http://stackoverflow.com/q/373295
has body: When i visit a java application running website I get error "application blocked by security settings" This is due to certificate problem. I know the publisher so i can trust him. Then after a quick google search I changed security setting of java to medium and also added the website to Execption website list. Still I am getting a different window asking me to accept risk and continue running application(Shown in image below). This window comes every time i run it. So how it can be avoided?
favorite count: 0
accepted answer: http://stackoverflow.com/a/21195134
tagged with: security
has comment: http://stackoverflow.com/comment/31914614
has comment: http://stackoverflow.com/comment/31930681
type: AnsweredQuestion
score: 0
tagged with: javafx
upvote count: 1
downvote count: 1
type: Question
has title: Avoid security warning of Java due to certificate error
has comment: http://stackoverflow.com/comment/31915027
has comment: http://stackoverflow.com/comment/31913693
has answer: http://stackoverflow.com/a/21195134
has comment: http://stackoverflow.com/comment/31903322

http://stackoverflow.com/q/21330069
has answer: http://stackoverflow.com/a/21330761
tagged with: jms
tagged with: serialization
type: UnansweredQuestion
has body: We use some jms servers in project. When passing objects, we have two options: Mark the message class as implements Serializable, then pass it directly. (the message class is just a simple java bean) Use Gson to serialize them to json, then deserialize in consumer side And think more: We just passing them in internal queues now, which means they are all run in a single JVM We may turn to use external queues in the future The message may have nested fields in the future I prefer the first option since it's easy, and have better performance than the second one. But my colleages prefer the second one, they said they hear there are some issues(but they don't know exactly) with the java built-in serialization, they may have problems some day. Which option shall I choose? Is there any problem with the built-in serializtion provided by Java?
tagged with: java
tagged with: gson
type: Question
has title: Is it safe to use java built-in `serialization` to passing objects to JMS queue?
score: 0
answer count: 1

http://stackoverflow.com/comment/31974469
type: QuestionComment
comment on: http://stackoverflow.com/q/21228384
has text: I made a for look that runs through the assorted array and when it switches to something different I increment a counter and in the end thats the length of the unique and instances array. But I am stuck on how to move the elements of the sorted array into these two.
score: 0
type: Comment

http://stackoverflow.com/a/22761786
has comment: http://stackoverflow.com/comment/99935717
type: Answer
answers question: http://stackoverflow.com/q/21273553
score: 2
downvote count: 0
upvote count: 2
has body: The problem is in @drawable/dummy_background_image instead, use @drawable/dummy_background_image and it will work

http://stackoverflow.com/a/21342240
has comment: http://stackoverflow.com/comment/32194498
has comment: http://stackoverflow.com/comment/34248590
has comment: http://stackoverflow.com/comment/32187949
has comment: http://stackoverflow.com/comment/32187617
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32179795
type: Answer
accepted answer of: http://stackoverflow.com/q/21340310
has comment: http://stackoverflow.com/comment/32178761
has body: It all depends on your app. Having a centralized hierarchy of services would certainly make it simpler to implement single security checks for create/retrieve/update/delete methods. But you have an existing app with different services that don't necessarily have a common parent implementation, then you'd have to add ALC security annotation on each service method. Another option is to put ACL security on your DAO layer, it works fine, but for some reason just doesn't feel right. IMHO DAO's shouldn't deal with things like security. I've spent a LOT of time dealing with Spring Security ACL, got a pretty good handle on it by now, ping me if you need any concrete examples.
answers question: http://stackoverflow.com/q/21340310
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34226782

http://stackoverflow.com/comment/31906120
type: Comment
type: QuestionComment
has text: I doesn't display an error, it displays google authentication account page.
comment on: http://stackoverflow.com/q/21190174
score: 0

http://stackoverflow.com/comment/31984000
score: 0
type: Comment
type: QuestionComment
has text: @BobJarvis : This is calling a C++ method from Java and not the other way round. I have also written one of the ways I found on the internet and why I am not using it
comment on: http://stackoverflow.com/q/21233831

http://stackoverflow.com/q/21241963
has answer: http://stackoverflow.com/a/21242646
has comment: http://stackoverflow.com/comment/31999710
type: AnsweredQuestion
has title: Can't open FragmentActivity from Fragment/FragmentActivity in Navigation Drawer
has comment: http://stackoverflow.com/comment/31999797
tagged with: android-intent
type: Question
accepted answer: http://stackoverflow.com/a/21242646
tagged with: android-fragments
tagged with: java
score: 0
tagged with: google-maps
answer count: 1
has body: I've got a problem I can't solve with my app's navigation drawer. One of the links in the navigation drawer is to open a FragmentActivity (which contains a ViewPager). The other links are Fragments. Right now I have it set up as an Intent to start that activity but I get an error about one of my Fragments, MapsPage. Something to do with nesting Fragments. I'll post the logcat below. This is now my NavigationDrawer onClick is set up: @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) { Fragment newFragment = new MapsPage(); FragmentManager fm = getSupportFragmentManager(); switch(i) { case 0: newFragment = new FragOne(); fm.popBackStack(); break; case 1: newFragment = new FragTwo(); fm.popBackStack(); break; case 2: newFragment = new FragThree(); fm.popBackStack(); break; case 3: Intent in = new Intent(getApplicationContext(), FragmentPagerActivity.class); startActivity(in); fm.popBackStack(); break; } fm.beginTransaction().add(R.id.main, newFragment).addToBackStack("fragback").commit(); drawerLayout.closeDrawer(rl); } My issue is with "case 3:". The MapsPage which is central to my app has a map fragment in the XML which is causing there to an exception when calling this. Here is the exception: 01-20 18:42:09.302: E/AndroidRuntime(15950): FATAL EXCEPTION: main 01-20 18:42:09.302: E/AndroidRuntime(15950): Process: com.android.package.name, PID: 15950 01-20 18:42:09.302: E/AndroidRuntime(15950): android.view.InflateException: Binary XML file line #7: Error inflating class fragment 01-20 18:42:09.302: E/AndroidRuntime(15950): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713) 01-20 18:42:09.302: E/AndroidRuntime(15950): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 01-20 18:42:09.302: E/AndroidRuntime(15950): at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 01-20 18:42:09.302: E/AndroidRuntime(15950): at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 01-20 1…
tagged with: android

http://stackoverflow.com/comment/32061318
score: 1
has text: Time for pencil and paper tracing!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21277156

header
type: Tag
tags question: http://stackoverflow.com/q/21205791
tag name: header

http://stackoverflow.com/a/21554647
upvote count: 10
type: Answer
has body: I just solved this problem by uninstalling older versions of Java from the Control Panel. Control Panel &gt; Uninstall a Program
downvote count: 0
score: 10
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21235091
accepted answer of: http://stackoverflow.com/q/21235091

http://stackoverflow.com/comment/31935388
type: Comment
score: 0
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/45546/discussion-between-parth-doshi-and-naresh-r)
comment on: http://stackoverflow.com/a/21206302
type: AnswerComment

http://stackoverflow.com/q/21210978
score: 1
tagged with: java
has body: I wonder when Garbage Collector releases the memory associated to a deleted node from a LinkedList! I mean the GC releases the memory simply because there is no reference to that object? ( with reference to the code below please) public class Node { int data; Node next; public Node(int data){ this.data = data; } public Node(Node node){ data = node.data; next = node.next; } } public void delete (Node prevNode, Node currentNode){ if (currentNode == tail){ tail = prevNode; } if (currentNode == head){ head = currentNode.next; } else { prevNode.next = currentNode.next; } len--; }
tagged with: garbage-collection
upvote count: 1
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has title: What happens to the deleted node in a java linkedlist?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21211029
tagged with: linked-list

http://stackoverflow.com/q/21328795
has comment: http://stackoverflow.com/comment/32152511
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32152463
has title: Loss of precision using arrays and long data types
has comment: http://stackoverflow.com/comment/32152730
tagged with: java
upvote count: 1
has body: This is a program designed to estimate the value of pi using Buffons needle simulation. The problem I am having here is that if the user inputs a really big number, the program crashes. I'm assuming it's because I am not using a long data type instead of the int. When I tried to change the number of trials in the trials method to a long data type, it kept giving me an error saying that there was a lack of precision for the length of the array. I can't figure out how to fix this problem.. Help? import java.util.Scanner; public class Darts { public static long trials() //User Inputs number of trials { long input; Scanner in = new Scanner(System.in); System.out.print("How many darts/trials? "); input = in.nextLong(); return input; } public static double [] randomX(long trial) // Randomly generates numbers for the x coordinate on the amounts of trials { double [] randNumArrayX = new double[trial]; for(int i = 0; i &lt; trial; i++) { randNumArrayX[i] = Math.random(); } return randNumArrayX; } public static double [] randomY(long trial) // Randomly generates numbers forthe y coordinate on the amounts of trials { double [] randNumArrayY = new double[trial]; for(int i = 0; i &lt; trial; i++) { randNumArrayY[i] = Math.random(); } return randNumArrayY; } public static int [] dartBoard(double [] randx, double [] randy) // determines whether the dark hit the board or not { int [] hitMiss = new int[randx.length]; int [] trials = new int[randx.length]; for(int i = 0; i &lt; randx.length; i++) { if( Math.pow(randx[i] , 2) + Math.pow(randy[i] , 2) &lt;= 1) { hitMiss[i] = 1; } else { hitMiss[i] = 0; } } return hitMiss; } public static double [] calcPi(int [] h) // Calculates pi using randomly generated numbers { int hitCounter = 0; double [] pi = new double[h.length]; for(int i = 0; i &lt; h.length; i++) { if(h[i] == 1) { hitCounter++; } pi[i] = 4*(hitCounter/(i + 1)); } return pi; } public static void print(double [] pi) // prints results { for(int i = 0; i &lt; 10; i++) { System.o…
type: Question
has comment: http://stackoverflow.com/comment/32151837
tagged with: long-integer
downvote count: 0
has comment: http://stackoverflow.com/comment/32151621
tagged with: type-conversion
answer count: 1
has comment: http://stackoverflow.com/comment/32152667
score: 1
has answer: http://stackoverflow.com/a/21330022
has comment: http://stackoverflow.com/comment/32152564
favorite count: 0
tagged with: java.util.scanner

http://stackoverflow.com/a/21293457
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21293403
answers question: http://stackoverflow.com/q/21293403
type: Answer
has comment: http://stackoverflow.com/comment/32089150
has body: A simple search on the net shows that net.java.util.TagValue class belongs to fixparser library. Make sure that this library is in your classpath when working on your project.
score: 0

http://stackoverflow.com/q/21343039
upvote count: 1
tagged with: calendar
has body: I am trying to change the timezone of a calendar object while maintaining the actual date/time so I can call getTimeInMilliseconds() on the updated calendar object. I looked at this other question. Here, the accepted answer is to individually set each field of a new Calendar object. However, I was able to make it work by simply changing the timezone of a copy of the original Calendar object. Strange thing is, this only works if I make some modification to the original Calendar before resetting the timeZone. The following example illustrates the inconsistency. public void TestCalendar() { Calendar nextYear = Calendar.getInstance(); nextYear.add(Calendar.YEAR, 1); log.info("Next Year: {}", getUTCMilliseconds(nextYear)); Calendar now = Calendar.getInstance(); log.info("Now: {}", getUTCMilliseconds(now)); } protected String getUTCMilliseconds(Calendar cal) { // Create a new calendar so we don't modify input Calendar expectedDbTime = (Calendar) cal.clone(); // Change the TimeZone the contained date is interpreted in expectedDbTime.setTimeZone(TimeZone.getTimeZone("UTC")); // Return millisecond value of this date in the UTC timezone return String.valueOf(expectedDbTime.getTimeInMillis()); } I ran this program on Jan 24th, 2015 @ 2:33 PM, and got the following output: Next Year: 1422110038529 //(Corresponding UTC Date: Sat Jan 24 2015 2:33:58 PM) Now: 1390599238531 //(Corresponding UTC Date: Fri Jan 24 2014 9:33:58 PM) As you can see, the nextYear prints as expected, however the next line is not as expected (It should correspond to 1/24/2014 2:33:58PM UTC, instead, it corresponds to current date/time which is 1/24/2014 2:33:58 MTN). Can someone tell me what's going on here? EDIT: Just updated some formatting.
type: Question
linked to: http://stackoverflow.com/q/2873119
has title: JAVA: Weird behaviour when changing TimeZone of Calendar object without changing the Date/Time
has comment: http://stackoverflow.com/comment/32229936
accepted answer: http://stackoverflow.com/a/21343754
has comment: http://stackoverflow.com/comment/32181188
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32179313
tagged with: timezone
tagged with: datetime
tagged with: datetime-conversion
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21343754

http://stackoverflow.com/comment/31910342
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21190955
has text: I believe you have to define a `property-placeholder` per configuration file. Try it and let us know.

http://stackoverflow.com/comment/32068587
has text: is that causing problem?
comment on: http://stackoverflow.com/q/21260566
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31921640
type: AnswerComment
comment on: http://stackoverflow.com/a/21198669
has text: Well, I am developing a security product, and not doing application development. So I need help in concern to adding permission to android manifest through java.I am not permitted to change the source code of the application.
type: Comment
score: 0

http://stackoverflow.com/comment/31957169
comment on: http://stackoverflow.com/q/21217724
score: 0
type: Comment
type: QuestionComment
has text: Post the server log file.

http://stackoverflow.com/comment/31923021
comment on: http://stackoverflow.com/q/21199419
has text: There is such a thing as trying to be too succinct, and perhaps this is one of those occurrences.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/21326156
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21325949
type: Answer
has comment: http://stackoverflow.com/comment/32149421
has comment: http://stackoverflow.com/comment/32149835
accepted answer of: http://stackoverflow.com/q/21325949
has comment: http://stackoverflow.com/comment/32149606
has comment: http://stackoverflow.com/comment/32149459
score: 1
has body: You are using the * to separate "main items" but it can also be inside the main item. Your requirements look odd, but lets assume for the sake of argument that you are getting your input data like this and you want to split it like you suggested. That means that every * that is preceded by a number is a separator, but a * that is not preceded by a number is not. You can achieve that using regular expressions: (with a positive look-behind expression (?&lt;=expr) String str = "USA*2*Japan*8^2*India*5^4^2*Germany*5"; List&lt;String&gt; lst = Arrays.asList(Pattern.compile("(?&lt;=\\d)\\*").split(str)); System.out.println(lst); Prints: [USA*2, Japan*8^2, India*5^4^2, Germany*5] After further clarification in the comment below, it seems that the problem is more generic than the initial example; the question becomes: How do I split a string on a separator, but only after 2 occurrences of the separator. Although it's possible to do with a regex, it may be easier to do and understand in a for loop like this: public static List&lt;String&gt; split(String str, char splitChar, int afterOccurrences) { List&lt;String&gt; lst = new ArrayList&lt;&gt;(); int occurrencesSeen = 0; int start = 0; for (int i = 0; i &lt; str.length(); i++) { char ch = str.charAt(i); if (ch == splitChar) { occurrencesSeen++; if (occurrencesSeen &gt;= afterOccurrences) { lst.add(str.substring(start, i)); start = i + 1; occurrencesSeen = 0; } } } if (start &lt; str.length() - 1) lst.add(str.substring(start)); return lst; } public static void main(String[] args) { String str = "USA*2*Japan*8^2*India*5^4^2*Germany*5"; System.out.println(split(str, '*', 2)); } This method also allows you to split after 3 or any other number of occurrences.
has comment: http://stackoverflow.com/comment/32149202
has comment: http://stackoverflow.com/comment/32149243

http://stackoverflow.com/a/21228026
accepted answer of: http://stackoverflow.com/q/21227908
type: Answer
answers question: http://stackoverflow.com/q/21227908
downvote count: 0
score: 3
has body: In OnClick method, change your code to ImageView iv = (ImageView)v; ProductURL = (String) iv.getTag();
type: AcceptedAnswer
upvote count: 3

http://stackoverflow.com/a/21198117
downvote count: 0
type: Answer
has body: It's very easy to call methods on Java objects in CFML. One just creates the Java object instance and then... calls methods on it. EG: &lt;cfscript&gt; string = createObject("java", "java.lang.String").init("my string"); // init() calls the appropriate constructor indexOf = string.indexOf("ring"); charAt = string.charAt(4); toCharArray = string.toCharArray(); toUpperCase = string.toUpperCase(); writeDump([string,indexOf,charAt,toCharArray,toUpperCase]); &lt;/cfscript&gt; There's often some monkeying around to do with type-casting: CFML's loose/dynamic typing needs marshalling before sending to Java sometimes. Look up javaCast() for that. But that's basically it.
upvote count: 2
answers question: http://stackoverflow.com/q/21194656
score: 2

http://stackoverflow.com/q/21337549
tagged with: servlets
upvote count: 1
has body: I am requesting information from JSP and putting them to database via Java Servlet. I have this kind of (simplified) Java Servlet. protected void doPost(//parameters etc.){ String brand = request.getParameter("brand"); String model = request.getParameter("model"); CarBean newCar = new CarBean(brand, model); try { Connection con = ConnectionFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO Cars (brand, model)" + "VALUES (?, ?)"; ps.setString(1, newCar.getBrand()); ps.setString(2, newCar.getModel()); ps.executeUpdate(); ps.close(); } catch ... { } Everything is working correctly, but now I want to separate this database connection to it's own class. I want to do a class where is just three methods (add, delete, edit) for database. Can I use a newCar object as a parameter somehow in a class which is in different package? I've done this, but this isn't working. public class DAO{ public void addCar(CarBean newCar) throws ServletException { try { Connection con = ConnectionFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO Cars (brand, model)" + "VALUES (?, ?)"; ps.setString(1, newCar.getBrand()); ps.setString(2, newCar.getModel()); ps.executeUpdate(); ps.close(); } catch (SQLException e) { throw new ServletException(e); } ... public void deleteCar ... public void editCar ... and then I just call addCar from Servlet like this: protected void doPost(//parameters etc.){ String brand = request.getParameter("brand"); String model = request.getParameter("model"); CarBean newCar = new CarBean(brand, model); addCar(newCar); It's saying cannot find symbol, symbol: method addCar(CarBean), location: class MainServlet and offers to make method addCar to this servlet, but that can't be right. That addCar method have to be in DAO class (which is in Database folder). I don't know if this is quite confusing? How to move that try-catch which is doing data transferring to another class?
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32167870
accepted answer: http://stackoverflow.com/a/21338837
has comment: http://stackoverflow.com/comment/32167985
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21338837
type: Question
has comment: http://stackoverflow.com/comment/32167370
has comment: http://stackoverflow.com/comment/32167428
has comment: http://stackoverflow.com/comment/32167449
tagged with: jsp
has title: Splitting one servlet class to servlet and DAO class

http://stackoverflow.com/comment/31989878
type: AnswerComment
type: Comment
has text: Thank You +1. So how should i correct my method so that it works ?
comment on: http://stackoverflow.com/a/21236896
score: 0

http://stackoverflow.com/comment/31953640
comment on: http://stackoverflow.com/q/21190553
has text: If you are using libgdx, could you use the box2d API to do all of this for you?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21203508
linked to: http://stackoverflow.com/q/1200621
downvote count: 2
accepted answer: http://stackoverflow.com/a/21203610
tagged with: collections
has answer: http://stackoverflow.com/a/21203566
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31929911
type: Question
upvote count: 0
score: -2
has body: Is this formula is legal in java to declare ArrayList List&lt;Integer&gt; list1 = new ArrayList&lt;Integer&gt;() {1,2,3,4,5};
has title: ArrayList declaration in java
has answer: http://stackoverflow.com/a/21203610
tagged with: arraylist
linked to: http://stackoverflow.com/q/12321177
has comment: http://stackoverflow.com/comment/31930006
has answer: http://stackoverflow.com/a/21203583
possible better answer: http://stackoverflow.com/a/21203552
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/21203552

http://stackoverflow.com/comment/88441817
comment on: http://stackoverflow.com/a/21242111
type: AnswerComment
has text: @Gustavo what date is new `Date(0)`? that depends on the time zone. In Hawaii its `1969-12-31` but in Australia its `1970-01-01`. That is why you need to define a time zone to make a meaningful conversion. So `ZoneId.systemDefault()` may not be correct for you as that is the time zone the system (JVM) has.
type: Comment
score: 2

http://stackoverflow.com/comment/32080327
has text: you could always write code to handle that situation
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21287880
score: 0

http://stackoverflow.com/comment/32045760
score: 0
type: QuestionComment
has text: Here you go: http://docs.oracle.com/javase/tutorial/essential/regex/
type: Comment
comment on: http://stackoverflow.com/q/21268737

http://stackoverflow.com/q/21257464
has answer: http://stackoverflow.com/a/21257504
linked to: http://stackoverflow.com/q/2349633
tagged with: servlets
type: Question
has title: for sendredirect which method gets called doGet or doPost()
duplicate of: http://stackoverflow.com/q/2349633
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/21257930
answer count: 3
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21258831
upvote count: 1
has body: I am new to servlets. My Q is if I use for response.sendredirect() which method gets called doGet or doPost()? I know that in jsp to servlet get or post method will get called according to method type. But if it is servlet to servlet request using response.sendRedirect() which method will get called? how servlet engine decides which method to call? Thanks in avdance.
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/32025076
score: 1
tagged with: java

type-conversion
tags question: http://stackoverflow.com/q/21261286
tags question: http://stackoverflow.com/q/21330895
tags question: http://stackoverflow.com/q/21327770
tag name: type-conversion
tags question: http://stackoverflow.com/q/21296570
tags question: http://stackoverflow.com/q/21309707
tags question: http://stackoverflow.com/q/21317631
type: Tag
tags question: http://stackoverflow.com/q/21328795
tags question: http://stackoverflow.com/q/21246662

http://stackoverflow.com/a/21262278
downvote count: 1
has comment: http://stackoverflow.com/comment/32034612
has comment: http://stackoverflow.com/comment/32034743
has body: You're shadowing your instance variables in your constructor : public Ride(String n, int tr, double hr , int nr){ name = n; ticketsRequired = tr; heightRequirement = hr; numberOfRiders = nr; } Using this with a field in the constructor is not required here, but it is a good pratice as they are often shadowed by the constructor's parameters (see using the this keyword). Here's a version using the this keyword: public Ride(String n, int tr, double hr , int nr){ this.name = n; this.ticketsRequired = tr; this.heightRequirement = hr; this.numberOfRiders = nr; }
has comment: http://stackoverflow.com/comment/32033912
has comment: http://stackoverflow.com/comment/32034023
answers question: http://stackoverflow.com/q/21262250
has comment: http://stackoverflow.com/comment/32033911
has comment: http://stackoverflow.com/comment/32035118
has comment: http://stackoverflow.com/comment/32034840
type: Answer
has comment: http://stackoverflow.com/comment/32033889
has comment: http://stackoverflow.com/comment/32034662
has comment: http://stackoverflow.com/comment/32034075
upvote count: 14
has comment: http://stackoverflow.com/comment/32096478
score: 13

http://stackoverflow.com/a/21264867
type: Answer
answers question: http://stackoverflow.com/q/21263170
has body: Without seeing the model classes, my best guess would be that you want to replace 'AND child_id = :childId' with 'AND child.id = :childId', or whatever the id column is labelled in your Child class.
score: 0

http://stackoverflow.com/comment/32038442
comment on: http://stackoverflow.com/q/21264767
type: Comment
type: QuestionComment
has text: Yes it's connecting, but it's not logging in because the credentials are wrong.
score: 1

http://stackoverflow.com/comment/32186393
score: 0
type: Comment
type: QuestionComment
has text: I can't see anything that provides an `IVMInstall` for the running JRE. Launches that run in the Eclipse JVM use a different system.
comment on: http://stackoverflow.com/q/21339889

http://stackoverflow.com/q/21208997
possible better answer: http://stackoverflow.com/a/21209332
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21209332
has comment: http://stackoverflow.com/comment/32008365
tagged with: java
has comment: http://stackoverflow.com/comment/31997559
has comment: http://stackoverflow.com/comment/31940991
has body: I have been struggling with this wordsearch project for a couple of days now, just trying to get the horizontal search working. It's meant to work in all 8 possible directions (horizontal, vertical, diagonal). Here is my current code. For now I'm only worrying about the horizontal, as I suspect if I get the comparison down right then the rest will be simpler. I am meant to write code which finds the words contained in the boards array, and output those characters to another array which is the same size as the board array (Hence, the output array is the solution to the board array). So far, all my code does is iterate through the entire board, then check if it matches with the first character of the wordlist, if it does then this character is assigned on the output array, which is finally printed in the end out to the console for the user to see. My question is, how can I forward my search to iterate the wordlist as well? Is my approach wrong? For example, if the board char matches with the char in the wordlist, then continue in that specified direction (in my case I'm worrying about the horizontal direction) and find the word. Also, method 'filter' is meant to handle exceptionOutofBounds in case the search goes off the board. Any ideas or approaches are welcome.
type: Question
has answer: http://stackoverflow.com/a/21209708
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/31940083
accepted answer: http://stackoverflow.com/a/21209708
tagged with: char
answer count: 3
has title: Java wordsearch Char arrays
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/34165874

http://stackoverflow.com/q/21344065
upvote count: 3
tagged with: file-io
tagged with: http://stackoverflow.com/tag/zip
downvote count: 0
has body: I have the following code that writes a text file in a ZIP file: FileOutputStream fOut = new FileOutputStream(fullFilename, false); BufferedOutputStream bOut = new BufferedOutputStream(fOut); ZipOutputStream zOut = new ZipOutputStream(bOut); zOut.putNextEntry(new ZipEntry("aFile1.txt")); //Do some processing and write to zOut... zOut.write(...); (...) zOut.closeEntry(); zOut.close(); //Etc (close all resources) I would need to change the filename of the zipEntry after it has been written (as its name will depend on its content written). Also, it is not an option to write in a buffer and write to file only when final filename is known (because file size is potentially very large: not enough memory).
has title: How do I change a ZipEntry name
possible better answer: http://stackoverflow.com/a/21344308
has answer: http://stackoverflow.com/a/21344757
accepted answer: http://stackoverflow.com/a/21344757
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21344308
favorite count: 0

http://stackoverflow.com/a/21206449
has body: Taken from user templatetypedef: There are two main reasons you might want to mark an argument final. First, if you're planning on using the argument in an anonymous inner class, then you must mark it final so that it can be referenced in that class. This is actually a pretty common use case for marking arguments final. The other common reason to mark arguments final is to prevent yourself from accidentally overwriting them. If you really don't want to change the arguments, then perhaps you should mark them final so that if you actually do, you'll get the error at compile-time rather than finding out at runtime that your code has a bug.
type: Answer
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21206394
answers question: http://stackoverflow.com/q/21206394

http://stackoverflow.com/q/21318835
has answer: http://stackoverflow.com/a/21323002
accepted answer: http://stackoverflow.com/a/21323002
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
type: Question
tagged with: video-capture
has title: How not to seek to keyframes
tagged with: video-player
upvote count: 3
has body: I've tried to find a solution to seek frame by frame (not only to keyframes) in my android app. approach: A simple VideoView of the android sdk: Here I've got a onSeekCompleteListener of the base class MediaPlayer from the onPreparedListener of VideoView and pause the playback right after started it and moved to a preferred position. Problem: Only seeks to keyframes! approach: MediaMetaRetriever: I have got something like this: MediaMetadataRetriever retriever; long Position; ImageView video; TextView lbPosition; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); video = (ImageView)findViewById(R.id.imVideo); lbPosition = (TextView)findViewById(R.id.lbPosition); bnTake = (Button)findViewById(R.id.bntake); retriever.setDataSource(this, Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.vid)); video.setOnClickListener(new ImageView.OnClickListener() { @Override public void onClick(View arg0) { Position += 100000; Bitmap frame = retriever.getFrameAtTime(Position, MediaMetadataRetriever.OPTION_CLOSEST); video.setImageBitmap(frame); lbPosition.setText(String.valueOf(Position)); } }); bnTake.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View arg0) { Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); startActivityForResult(takeVideoIntent, 123123); } }); } When I use OPTION_CLOSESTS in retriever.getFrameAtTime it gives me a getFrameAtTime: videoFrame is a NULL pointer error. When I don't use this option, it goes through keyframes. Maybe possible solutions: approach: Record video with more keyframes. If I would record the video with an higher keyframe rate in my android app, could that be a solution? Is this possible? approach (I haven't tried!): I've heard something of video player 3rd party libraries for android that use FFMPEG. Is there any library that can seek while in pause state and update the position for the vide…
answer count: 1
favorite count: 0
tagged with: android

http://stackoverflow.com/comment/32064579
comment on: http://stackoverflow.com/q/21279561
has text: What exactly you mean by "can't see myModel object"?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/32153848
has text: Could you post your log with the error?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21330100

http://stackoverflow.com/q/21330954
has answer: http://stackoverflow.com/a/21331477
downvote count: 0
has comment: http://stackoverflow.com/comment/32155615
favorite count: 0
has title: Update data only by difference between files (delta for java)
has comment: http://stackoverflow.com/comment/32155506
score: 6
has answer: http://stackoverflow.com/a/21331992
upvote count: 6
answer count: 4
type: AnsweredQuestion
tagged with: delta
possible better answer: http://stackoverflow.com/a/21331477
tagged with: java
has comment: http://stackoverflow.com/comment/32155750
type: Question
has answer: http://stackoverflow.com/a/21331351
linked to: http://stackoverflow.com/q/11442162
linked to: http://stackoverflow.com/q/1931466
has body: UPDATE: I solved the problem with a great external library - https://code.google.com/p/xdeltaencoder/. The way I did it is posted below as the accepted answer Imagine I have two separate pcs who both have an identical byte[] A. One of the pcs creates byte[] B, which is almost identical to byte[] A but is a 'newer' version. For the second pc to update his copy of byte[] A into the latest version (byte[] B), I need to transmit the whole byte[] B to the second pc. If byte[] B is many GB's in size, this will take too long. Is it possible to create a byte[] C that is the 'difference between' byte[] A and byte[] B? The requirements for byte[] C is that knowing byte[] A, it is possible to create byte[] B. That way, I will only need to transmit byte[] C to the second PC, which in theory would be only a fraction of the size of byte[] B. I am looking for a solution to this problem in Java. Thankyou very much for any help you can provide :) EDIT: The nature of the updates to the data in most circumstances is extra bytes being inserted into parts of the array. Ofcourse it is possible that some bytes will be changed or some bytes deleted. the byte[] itself represents a tree of the names of all the files/folders on a target pc. the byte[] is originally created by creating a tree of custom objects, marshalling them with JSON, and then compressing that data with a zip algorithm. I am struggling to create an algorithm that can intelligently create object c. EDIT 2: Thankyou so much for all the help everyone here has given, and I am sorry for not being active for such a long time. I'm most probably going to try to get an external library to do the delta-encoding for me. A great part about this thread is that I now know what I want to achieve is called! I believe that when I find an appropriate solution I will post it and accept it so others can see as to how I solved my problem. Once again, thankyou very much for all your help.
has answer: http://stackoverflow.com/a/21654504
accepted answer: http://stackoverflow.com/a/21654504
linked to: http://stackoverflow.com/q/20979312
has comment: http://stackoverflow.com/comment/66663079

http://stackoverflow.com/comment/33494455
has text: Any hints what that stupid mistake was?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21193140

http://stackoverflow.com/comment/32141153
type: Comment
has text: The code to grab the bean looks correct to me, you may want to use the class however. The exception is clearly saying the configuration file cannot be found.
score: 0
comment on: http://stackoverflow.com/q/21322594
type: QuestionComment

http://stackoverflow.com/a/38471463
answers question: http://stackoverflow.com/q/21191551
score: 0
type: Answer
has body: I know i'm a few years late for this, but hope it helps anyone reading you can use a flag for your while-loop condition flag = true; while(flag){ //some code here if(condition) flag = false; } the if condition is the condition to exit the loop, i.e. when you break out of it.

http://stackoverflow.com/comment/31899727
type: QuestionComment
has text: As pointed out by @MarkoTopolnik in a comment from [this question](http://stackoverflow.com/q/20799763/2587435) - _"And you wouldn't by any chance rely on Eclipse/NetBeans Console window to count the lines? If yes, then there's your problem: the window has a maximum scrollback limit set to 1500 lines. "_
comment on: http://stackoverflow.com/q/21186815
score: 0
type: Comment

http://stackoverflow.com/comment/31989106
comment on: http://stackoverflow.com/q/21236598
score: 2
has text: What about.. `report`?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21344463
has comment: http://stackoverflow.com/comment/32180521
type: Question
has answer: http://stackoverflow.com/a/21344782
linked to: http://stackoverflow.com/q/21343381
has comment: http://stackoverflow.com/comment/32180486
has comment: http://stackoverflow.com/comment/32180460
has comment: http://stackoverflow.com/comment/32180496
tagged with: button
has answer: http://stackoverflow.com/a/21344601
favorite count: 0
has title: How do I fix my code to count the number of clicks on each button?
has comment: http://stackoverflow.com/comment/32180483
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21344525
answer count: 4
has answer: http://stackoverflow.com/a/21344577
upvote count: 2
score: 0
tagged with: java
downvote count: 2
has body: I have written a program with two buttons for a Java class that I am taking. I now need to count and display the number of clicks each button gets. I have some code for counting clicks but am fairly certain that it is wrong. The error I have is "identifier expected", how can I fix this? Here is my updated code: import java.awt.*; import java.awt.event.*; public class FinalProj1 extends Frame implements ActionListener,WindowListener { FinalProj1() { setTitle("Click Counter"); setSize(400,400); show(); } public static void main(String args[]) { Frame objFrame; Button objButton1; Button objButton2; TextField count = new TextField(20); TextField count2 = new TextField(20); Label objLabel; Label objLabel2; objFrame= new FinalProj1(); objButton1= new Button("Agree"); objButton2= new Button("Dissagree"); objLabel= new Label(); objLabel2= new Label(); objLabel2.setText("Mexican Food Is Better Than Chineese Food"); objButton1.setBounds(110,175,75,75); objButton2.setBounds(190,175,75,75); objLabel2.setBounds(80,95, 250,25); objFrame.add(objButton2); objFrame.add(objButton1); objFrame.add(objLabel2); objFrame.add(objLabel); } private int numClicks = 0; private int numClicks2 = 0; objButton1.addActionListener(this) objButton2.addActionListener(this) public void actionPerformed(ActionEvent e) { numClicks++; numClicks2++; count.setText("There are " + numClicks + " who agree"); count2.setText("There are " + numClicks2 + " who dissagree"); } }

http://stackoverflow.com/q/21228447
has answer: http://stackoverflow.com/a/50058300
has answer: http://stackoverflow.com/a/77517231
favorite count: 0
has comment: http://stackoverflow.com/comment/31974607
type: Question
has answer: http://stackoverflow.com/a/21228953
possible better answer: http://stackoverflow.com/a/50058300
has answer: http://stackoverflow.com/a/48451244
answer count: 6
tagged with: spring-mvc
score: 4
accepted answer: http://stackoverflow.com/a/21228953
tagged with: java
upvote count: 4
has body: I am working on Spring Framework and I wanted to write an interceptor and I wrote it eventually and it is working fine. but at a point, I dont want my interceptor to intercept the request that is when user wants to logout and the session is being invalidated. But it is not happening as per my expectation. I am adding interceptors by extending the WebMvcConfigurerAdapter and by utilizing the addInterceptors method and here is the code. public void addInterceptors(InterceptorRegistry registry) { super.addInterceptors(registry); registry.addInterceptor( loggerInterceptor ); registry.addInterceptor( authenticationInterceptor ).excludePathPatterns("/invalidate"); } Have I done anything wrong here.? excludePathPatterns - > My URL ends with /invalidate. So please guide me, how to device a proper pattern.
has title: Spring, Interceptor's excludePathPatterns function is not working properly
has answer: http://stackoverflow.com/a/66780662
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/39634160

http://stackoverflow.com/comment/32389262
type: AnswerComment
type: Comment
has text: @Java I'm glad that it helped! Concerning `response.getAck()` returning `FAILURE` please refer to edited part of my answer.
comment on: http://stackoverflow.com/a/21405009
score: 0

http://stackoverflow.com/comment/32123911
has text: @AndrewThompson I graciously accept the down-vote. Though at my defense, I was just simply trying to answer the direct question of the OP.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21312138
type: Comment

http://stackoverflow.com/a/21273394
score: 0
answers question: http://stackoverflow.com/q/21273314
has body: Is the order of the parameters correct for the INSERT wo? It looks like you're putting the systemID into the woID field rather than systemID_fk which has the constraint. Should it be: transaction.executeSql('INSERT INTO wo (woID, woType, systemID_fk) ' + 'VALUES (?, ?, (SELECT systemID FROM system WHERE systemID = ' + obj.systemID + '))', [obj.woID, obj.woType], nullHandler, errorHandler);
type: Answer
has comment: http://stackoverflow.com/comment/32054641

http://stackoverflow.com/q/21287433
tagged with: cdi
accepted answer: http://stackoverflow.com/a/21288080
has body: I am trying to use @Qualifier to create an annotation on an Alternative class that will be used instead of the default class marked with @Default. However , when I do this weld reports the error. I am trying to inject demo.cdi.ProductB (the default is demo.cdi.ProductA) This is the error I get: Exception in thread "main" org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type Product with qualifiers @Video at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedMethod] @Inject public demo.cdi.OrderManagementImpl2.OrderManagementImpl2(@Video Product) at demo.cdi.OrderManagementImpl2.OrderManagementImpl2(OrderManagementImpl2.java:0) WELD-001475: The following beans match by type, but none have matching qualifiers: - Managed Bean [class demo.cdi.productA] with qualifiers [@Default @Any] if I modify beans.xml by adding other alternatives I get the error below: demo.cdi.ProductB demo.cdi.ProductC demo.cdi.productD (the error): org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type Product with qualifiers @Default How do I create Qualifier notations for the non-default class? the rest of the code is below for reference: (ProductA): package demo.cdi; import java.util.LinkedList; import javax.enterprise.inject.Default; @Default public class ProductA implements Product { @Override public LinkedList<Feature> getFeatures() { LinkedList<Feature> rtn = new LinkedList<Feature>(); rtn.add(new Feature("FKA", "FVA")); return rtn; } } (VideoProduct): package demo.cdi; import java.util.LinkedList; import javax.enterprise.inject.Alternative; import javax.enterprise.inject.Produces; @Alternative @Video public class VideoProduct implements Product { private VideoProduct() {} @Produces public Product factoryCreate() { return new VideoProduct(); } @Override public LinkedList<Feature> getFeatures() { LinkedList<Feature> rtn = new LinkedList<Feature>(); rtn.add( new Feature("FKB","FVB") ); return …
tagged with: java
tagged with: annotations
has title: How to use qualifier on non default class with java cdi
type: Question
tagged with: jakarta-ee
type: AnsweredQuestion
tagged with: jboss-weld
score: 4
upvote count: 4
has answer: http://stackoverflow.com/a/21288080
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/21301610
has comment: http://stackoverflow.com/comment/32103373
upvote count: 2
has comment: http://stackoverflow.com/comment/32105513
answers question: http://stackoverflow.com/q/21301143
type: Answer
has body: You can try to use AdjustmentListener for gettign scroll event once, try next: import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.io.UnsupportedEncodingException; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextArea; public class Example { public static void main(String[] args) throws UnsupportedEncodingException { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JScrollPane pane = new JScrollPane(new JTextArea()); pane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() { @Override public void adjustmentValueChanged(AdjustmentEvent e) { if(e.getValueIsAdjusting()){ return; } System.out.println("vertical scrolled"); System.out.println("bar value = " + e.getValue()); } }); frame.setContentPane(pane); frame.setSize(300, 200); frame.setVisible(true); } } Here is another example.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32104164

http://stackoverflow.com/a/21260934
has body: You have two possibilities to achieve this: You can use a PropertyEditor @InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(Calendar.class, new PropertyEditorSupport() { @Override public void setAsText(String text) throws IllegalArgumentException { setValue(parseDate()); } private Calendar parseDate() { try { Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); cal.setTime(sdf.parse("Mon Mar 14 16:02:37 GMT 2011")); return cal; } catch (ParseException e) { return null; } } }); } For Documentation see this and this. Or you can use spring conversion service. For this see: "Spring 3 Type Conversion".
type: Answer
has comment: http://stackoverflow.com/comment/40317823
upvote count: 4
has comment: http://stackoverflow.com/comment/32032428
score: 4
has comment: http://stackoverflow.com/comment/40286224
downvote count: 0
has comment: http://stackoverflow.com/comment/40295804
answers question: http://stackoverflow.com/q/21260209

http://stackoverflow.com/comment/32098036
has text: can you check what number is `list.size()` returning?
comment on: http://stackoverflow.com/q/21298324
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31965805
has text: I tried both as an argument and hard coding it. The file is in the same folder as the program.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21223419
score: 0

http://stackoverflow.com/q/21228873
tagged with: bigdata
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/71054599
type: Question
tagged with: hadoop
has body: I have installed Hadoop &amp; connected with Hadoop locally successful. I can connect the Sqoop via REST api and via cli interface. But once I want to start creating a job for important data from MySQL. It shows Connection configuration Warning message: Can't connect to the database with given credentials: No suitable driver found for jdbc:mysql://127.0.0.1:3306/for Error message: Can't load specified driver after google its solution, I has already put the mysql-connector.jar to sqoop web lib folder create a lib folder under the sqoop folder and put the mysql-connector.jar in it I also have restarted or even reboot my VM. It still says cannot load specified driver. Is there any config files I have missed to set? Thank you! My ENV: VirtualBox + Vagrant + Ubuntu 12.04 JDK (Sun Distrubution 1.7_update 51) Hadoop 2.2.0 (complied version) Sqoop 1.99.3 (complied version) Thank again!
has answer: http://stackoverflow.com/a/23150743
score: 0
answer count: 1
tagged with: sqoop
has title: How to add mysql connector to Sqoop 1.99.3
type: UnansweredQuestion

http://stackoverflow.com/a/21212090
score: 2
accepted answer of: http://stackoverflow.com/q/21212043
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: No, java's implementation of modulus will return a value in the range (-n, n) for the value x % n. I.e. If you have a negative number as the left operand, then the result will be negative. to get around this, try something like the following: ((x % n) + n) % n; Which will return a value in the range [0,n) EDIT (to reflect UPDATE in question) In the case of positive numbers in the left operand, then simply x % n will produce numbers in the range [0,n) where x &gt;= 0.
has comment: http://stackoverflow.com/comment/31945424
upvote count: 2
answers question: http://stackoverflow.com/q/21212043
has comment: http://stackoverflow.com/comment/31945478

http://stackoverflow.com/q/21330079
score: 2
has title: I/O Exception and Unable to find element In IE using Selenium Webdriver
has comment: http://stackoverflow.com/comment/32157107
downvote count: 0
possible better answer: http://stackoverflow.com/a/21330393
favorite count: 0
has answer: http://stackoverflow.com/a/21330393
has answer: http://stackoverflow.com/a/21330591
answer count: 4
has answer: http://stackoverflow.com/a/21373224
type: AnsweredQuestion
upvote count: 2
tagged with: selenium
has body: The below code works fine with Firefox and chrome but shows errors when executed in IE. System.setProperty("webdriver.ie.driver", "G:\\Selenium\\IEDriver\\IEDriverServer.exe"); WebDriver driver=new InternetExplorerDriver(); driver.get("https://www.google.co.in/?gws_rd=cr&amp;ei=ZDziUrLDEuLpiAeD44H4BA"); driver.findElement(By.name("q")).sendKeys("Selenium"); The error displayed is I/O exception (java.net.SocketException) caught when processing request: Software caused connection abort: recv failed Jan 24, 2014 3:44:04 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute INFO: Retrying request Exception in thread "main" org.openqa.selenium.NoSuchElementException:
type: Question
tagged with: internet-explorer
tagged with: java
accepted answer: http://stackoverflow.com/a/21373224
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32156784
has answer: http://stackoverflow.com/a/41370724

http://stackoverflow.com/comment/32085933
has text: So the question title is wrong?
type: Comment
comment on: http://stackoverflow.com/q/21291586
score: 0
type: QuestionComment

http://stackoverflow.com/a/21229435
type: Answer
score: 1
upvote count: 1
has body: the only reason you want to add an ID to the layouts is so that you can get a hold of that view in the code.. here you allready have access to the EditText its easier then to just add all the EditTexts to List then use them from there or even to a EditText[]
answers question: http://stackoverflow.com/q/21229389
downvote count: 0

http://stackoverflow.com/comment/32139207
comment on: http://stackoverflow.com/q/21271802
type: Comment
type: QuestionComment
has text: @EvertonAgner Sorry, I'm extremely new to Java and programming and don't know what would be helpful in solving the problem and what wouldn't be, just wanted to give people as much information as they need.
score: 0

http://stackoverflow.com/a/21305511
has comment: http://stackoverflow.com/comment/32110410
has comment: http://stackoverflow.com/comment/32110565
has comment: http://stackoverflow.com/comment/32110351
type: Answer
has comment: http://stackoverflow.com/comment/32110228
has comment: http://stackoverflow.com/comment/32110599
downvote count: 0
has comment: http://stackoverflow.com/comment/32110721
score: 6
has comment: http://stackoverflow.com/comment/32110663
has comment: http://stackoverflow.com/comment/32110183
accepted answer of: http://stackoverflow.com/q/21305431
has body: 1) Why am I getting Exception in thread "main" Because there's presumably no value for the given integer, so the get call returns null. You're then unboxing that, which throws an exception. Your code is effectively: public static Double getAUC(int i){ Double temp = SaveMethod.AUC.get(i); // This can return null double AUC = temp.doubleValue(); // This was auto-unboxing Double boxed = Double.valueOf(AUC); // This was boxing return boxed; } If you want to just return null instead if the key is missing, just avoid ever converting to Double. Your method can be as simple as: public static Double getAUC(int i) { return SaveMethod.AUC.get(i); } It's not clear whether you want to just return null though, or throw some other kind of exception. 2) is this saving option thread safe? Well HashMap isn't thread-safe to start with, so no... consider using ConcurrentHashMap instead.
answers question: http://stackoverflow.com/q/21305431
type: AcceptedAnswer
upvote count: 6

http://stackoverflow.com/q/21333460
has comment: http://stackoverflow.com/comment/32159612
answer count: 2
accepted answer: http://stackoverflow.com/a/21333608
downvote count: 0
favorite count: 0
tagged with: interface
type: AnsweredQuestion
tagged with: constants
score: 2
upvote count: 2
tagged with: java
has title: How to mandate a constant in Java
has answer: http://stackoverflow.com/a/21333608
has body: I'm using JAX-RS to create REST Web Services. I need to make the value of the @Path annotation on my Resource Classes publicly accessible. Using reflection to obtain this value seems a little heavy. I thought I would hold the value in a public static final String, so that it is both accessible to the @Path annotation and to other Classes. What is the best way to mandate that a Class provide this constant? I was under the impression that using constants in an Interface was an anti-pattern (Effective Java 2nd Edition). EDIT: As pointed out Effective Java says "If the constants are strongly tied to an existing class or interface, you should add them to the class or interface". In my situation, the @Path will be the same for all implementers of the Interface, and the Interface will provide methods, so I think I am safe to add the constant to the Interface.
type: Question
possible better answer: http://stackoverflow.com/a/21333761
has comment: http://stackoverflow.com/comment/32159630
has answer: http://stackoverflow.com/a/21333761

http://stackoverflow.com/comment/32317966
has text: Start and end will be sequenced as they are in the document. I'm not sure there is any promise regarding exactly when errors are reported. It's fairly common to give up parsing the document after the first error has been found, since it isn't at all clear how to recover from the error and the correction could affect whether anything later in the stream is or is not well formed or valid.
type: Comment
comment on: http://stackoverflow.com/a/21274222
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31971495
type: Comment
comment on: http://stackoverflow.com/a/21226197
has text: I agree. But, each multidimensional array can be converted to 1D array and transformed with this function.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21197012
type: UnansweredQuestion
has body: I have an application that use Spring and Hibernate. Originally, I thought that this application would deployed on Tomcat, but, by requirements of customer, now I need deploy on Oracle AS 10g. First, appear me the famous error: XML-24509: (Error) Definición duplicada para: 'xxx', and I solved with this, I put this on VM of the Server: -Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl but now I have the following error: /Users/hlopez/SPRING/sts-3.1.0.RELEASE/plugins/org.eclipse.jst.server.generic.oc4j_1.5.206.v20090812/buildfiles/oracle.10.1.3.xml:74: Deploy error: Operation failed with error: Error creating bean with name 'analyzerConfigDAOImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [META-INF/spring/mvc/servlet-context.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z I read about this, and a lot of people typed that, this error is caused for some .jars of hibernate, I removed the hibernate-jpa-2.0-api-1.0.1.Final, but this caused more errors, I have these .jars on my server: adf-connections.jar adfmtl.jar adfui.jar ​dc-adapters.jar adfbinding.jar ​adfcm.jar ​adfm.jar adfmweb.jar adfshare.jar ​bc4jct.jar ​bc4jctejb.jar ​bc4jdomorcl.jar ​bc4jimdomains.jar ​bc4jmt.jar ​bc4jmtejb.jar ​collections.jar ​commons-cli-1.0.jar jdev-cm.jar ​ojmisc.jar ​regexp.jar ​share.jar ​xmlef.jar ​xsqlserializers.jar concurrent.jar mdsrt.jar ordhttp.jar ordim.jar Help please, Thanks.
tagged with: spring
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/31918918
type: Question
has title: Error OracleAS and Hibernate
score: 0
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/31919244
answer count: 0

http://stackoverflow.com/comment/97141450
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/50387548
has text: This is not an overflow actually :)
score: 0

http://stackoverflow.com/comment/31973614
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21202475
has text: How do i do that? and shared .yml file code,configuration class code and of service class in post
type: AnswerComment

http://stackoverflow.com/q/21330638
accepted answer: http://stackoverflow.com/a/21378499
downvote count: 0
answer count: 1
tagged with: javascript
tagged with: jackson
favorite count: 0
tagged with: sencha-touch-2
has title: Deserialization with Jackson: "org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of [projectname]."
type: AnsweredQuestion
has body: I'm working on a RESTful app based on this tutorial (wich is just a simple webapp about notes without any webservice by default). Unfortunately, when i try to add a note, there is no errors on the first time and the note is really saved in my arrayList of a singleton server-side. No errors... But when I retry to add an other note, it fails with this error in my jetty server console: janv. 24, 2014 7:54:29 AM com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException Grave: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of [...].noteapp.rest.model.Note out of START_ARRAY token at [Source: org.eclipse.jetty.server.HttpInput@71453e59; line: 1, column: 1] at org.codehaus.jackson.map.JsonMappingException.from(JsonMappingException.java:163) at org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:219) A weird thing is that if I reload the page, it works again one time. Here is the Sencha model of my notes (model.Note.js): Ext.define("NotesApp.model.Note", { extend: "Ext.data.Model", config: { idProperty: 'id', fields: [ { name: 'id', type: 'string' }, { name: 'dateCreated', type: 'date', dateFormat: 'U' }, { name: 'title', type: 'string' }, { name: 'narrative', type: 'string' } ], validations: [ { type: 'presence', field: 'id' }, { type: 'presence', field: 'dateCreated' }, { type: 'presence', field: 'title', message: 'Veuillez entrer un titre pour cette note' } ] } }); Here is the storage (store.Notes.js): Ext.define("NotesApp.store.Notes", { extend: "Ext.data.Store", config: { autoLoad: true, model: "NotesApp.model.Note", proxy: { type: 'ajax', url: '/restnotes/notearray', reader: { type: 'json', rootProperty: 'note' }, writer: { type: 'json', writeAllFields: true }, actionMethods: { read: "GET", create: "POST", update: "POST", destroy: "DELETE" }, a…
upvote count: 3
has answer: http://stackoverflow.com/a/21378499
type: Question
score: 3
tagged with: java
tagged with: jersey

http://stackoverflow.com/comment/31946169
comment on: http://stackoverflow.com/a/21212406
type: Comment
type: AnswerComment
has text: @EGHDK Pedro Loureiro give you the answer
score: 0

http://stackoverflow.com/q/21288755
tagged with: arrays
has answer: http://stackoverflow.com/a/21288920
tagged with: copy
has body: I would like to paste a given little array into another bigger array at a specified position (or interval) in Java: int[] bigger_array = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int[] smaller_array = { 1, 2, 3 }; Does exist a simple Java method (with matlab it's simple) that helps me pasting "smaller_array" for example at position 2 (of the bigger) so that "bigger_array" variable becomes: { 0, 0, 1, 2, 3, 0, 0, 0, 0 }; Please don't paste methods with a simple "for". I want to know if an optimized method exists.
score: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/21288920
has comment: http://stackoverflow.com/comment/32080639
has comment: http://stackoverflow.com/comment/32081336
has answer: http://stackoverflow.com/a/21289086
has comment: http://stackoverflow.com/comment/32080477
has answer: http://stackoverflow.com/a/21288907
favorite count: 0
has comment: http://stackoverflow.com/comment/32080860
answer count: 4
tagged with: matlab
has answer: http://stackoverflow.com/a/21288891
type: AnsweredQuestion
upvote count: 3
has title: Java - paste a given little array into another bigger array at a specified position (or interval)
tagged with: java
accepted answer: http://stackoverflow.com/a/21289086
type: Question

http://stackoverflow.com/comment/32083674
score: 1
type: AnswerComment
has text: I guess they haven't touched the introduction for a while. If you search for "1.2" throughout the document, it's mentioned a few times. Of course, what really matters is also the link to the "Oracle Provider Documentation" in Appendix A at the end of the guide (it doesn't necessarily stand out...)
comment on: http://stackoverflow.com/a/21289506
type: Comment

http://stackoverflow.com/a/21368442
upvote count: 2
has body: Rajesh, As eis pointed out earlier, JBoss EAP 6.x is based on JBoss AS 7.x code base, which is significantly different than the earlier versions (JBoss AS 4.x, 5.x, 6.x, JBoss EAP 5.x) Ports are not defined in server.xml anymore like in previous versions, but rather in JBOSS_HOME/standalone/configuration/standalone.xml. Try debugging your code with Eclipse (or your favourite IDE), place few breakpoints and step through your code, line by line. See why you are getting NULL, my guess is that your document passed is NULL, and therefore your modifyAttributeValue() method returns NULL as well. Now, if you would like to change the port programmatically, there are few different ways to do it. The easiest is to use JBoss CLI (native interface): JBOSS_HOME/bin/jboss-cli.sh --connect /socket-binding-group=standard-sockets/socket-binding=http:write-attribute(name=port,value=8081) Hope that helps.
score: 2
answers question: http://stackoverflow.com/q/21329509
downvote count: 0
type: Answer

http://stackoverflow.com/a/21345761
has body: Add them like this: &lt;property name="url" value="jdbc:mysql://localhost/_dbName" /&gt; &lt;property name="username" value="your username" /&gt; &lt;property name="password" value="your password" /&gt;
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21316022
answers question: http://stackoverflow.com/q/21316022

http://stackoverflow.com/q/21241230
accepted answer: http://stackoverflow.com/a/21241354
favorite count: 0
tagged with: apache-httpclient-4.x
tagged with: android
upvote count: 4
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/21241466
has body: I want to use a remote API from my Android device, but for some reason, the UrlEncodedFormEntity class doesn't transform the _ with %5f like the remote API seems to expect. As a consequence, using this code: List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(1); nameValuePairs.add( new BasicNameValuePair("json", "{\"params\":{\"player_name\":\"Toto\", \"password\":\"clearPass\"}, \"class_name\":\"ApiMasterAuthentication\", \"method_name\":\"login\"}") ); httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.UTF_8)); ResponseHandler responseHandler = new BasicResponseHandler(); httpClient.execute(httpPost, responseHandler); send a post request to the server, with this content: json=%7B%22params%22%3A%7B%22player_name%22%3A%22Toto%22%2C%22password%22%3A%22clearPass%22%7D%2C%22class_name%22%3A%22ApiMasterAuthentication%22%2C%22method_name%22%3A%22login%22%7D I would like it to be like this (replacing the preivous underscore by %5F): json=%7B%22params%22%3A%7B%22player%5Fname%22%3A%22Toto%22%2C%22password%22%3A%22clearPass%22%7D%2C%22class%5Fname%22%3A%22ApiMasterAuthentication%22%2C%22method%5Fname%22%3A%22login%22%7D I don't have control over the API, and the official client of the API behave like this. It seems to be the expected behaviour for an URL normalization Am I missing something? I first thought it was an UTF-8 encoding issue, but adding HTTP.UTF-8 in the constructor of UrlEncodedFormEntity doesn't solve the problem. Thanks for your help. EDIT: Finally, the problem didn't come from this unescape underscore. Even if the other client I tried to reproduce the behaviour escaped it, I only had to set the proper header: httpPost.addHeader("Content-Type","application/x-www-form-urlencoded"); And the request worked just fine. Thanks everyone, and especially singh.jagmohan for his help (even if the problem was finally elsewhere)!
tagged with: http
type: Question
tagged with: java
score: 4
answer count: 2
has title: UrlEncodedFormEntity doesn't encode underscore
has answer: http://stackoverflow.com/a/21241466
tagged with: url
has answer: http://stackoverflow.com/a/21241354

http://stackoverflow.com/comment/32164866
type: Comment
has text: hmm now file name prints normal but SAX throws Exception that it couldn't find such file..may be something with charset i working on Windows and already try windows-1251 and windows-1252
comment on: http://stackoverflow.com/a/21335915
type: AnswerComment
score: 0

http://stackoverflow.com/q/21245712
has body: I have a REST web servce configure as the following: @Path("/users") public class UserManager { @Context UriInfo uriInfo; @POST @Consumes("application/json") public void createUser(User user) { URI uri = uriInfo.getAbsolutePathBuilder().path(user.getUserName()) .build(); Response res = Response.created(uri).build(); try { MongoDbDataAccess.getInstance().addUser(user); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } And My Tomcat server configure as the following: Jersey REST Service com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.packages anyq.server.anyq.manager 1 Jersey REST Service /rest/* The POJO I create look like the following: @XmlRootElement public class User { private long userId; private String userName; private String userPassword; public User() { super(); } public User(long userId, String userName, String userPassword) { super(); this.userId = userId; this.userName = userName; this.userPassword = userPassword; } public long getUserId() { return userId; } public void setUserId(long userId) { this.userId = userId; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getUserPassword() { return userPassword; } public void setUserPassword(String userPassword) { this.userPassword = userPassword; } } I create the a test client in order to test the createUser method: public class tester { public static void main(String[] args) throws UnknownHostException { String USER_URI = "http://localhost:8080/AnyAppserver/rest/users"; User user = new User((long) 451, "mosssi", "464asd64"); Client client = Client.create(); WebResource r = client.resource(USER_URI); ClientResponse response = r.accept(MediaType.APPLICATION_JSON).post( ClientResponse.class, user); } But I get the following error: POST http://localhost:8080/AnyAppserver/rest/users returned a response status of 415 Unsupported Media Type The wierd issue is whe…
has title: Unable to send JSON object to Rest web service
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/21245771
tagged with: jersey
downvote count: 0
tagged with: pojo
tagged with: rest
answer count: 1
accepted answer: http://stackoverflow.com/a/21245771
favorite count: 0

http://stackoverflow.com/comment/31975960
type: Comment
score: 0
type: AnswerComment
has text: Thanks for the response.. I was concerned that was the case. I'm hoping someone knows for sure..
comment on: http://stackoverflow.com/a/21229292

http://stackoverflow.com/a/28131005
upvote count: 1
score: 1
has body: You could just setup a local broker and bridge that with the remote broker. That way you can queue up all your messages locally and when the remote broker comes back online all can be delivered.
downvote count: 0
answers question: http://stackoverflow.com/q/21269331
type: Answer

http://stackoverflow.com/comment/32068628
type: Comment
has text: it seems that `mainObject.getEdgeCount()` is always > 0 but not
type: QuestionComment
comment on: http://stackoverflow.com/q/21282024
score: 0

http://stackoverflow.com/q/21218464
has comment: http://stackoverflow.com/comment/31956545
type: Question
has body: I have a loop that start the program over if the user input is yes and end the program if the user input is no my codes end the program when the user input is no but if its any thing else it will start over i want to make it only start over if the user input is yes System.out.println("Would you like to purchase more ticket ? "); Scanner answer = new Scanner(System.in); String an = answer.nextLine(); if (an.equals("yes")) { lottery =true; } else if(an.equals("no")) { System.out.println("Thank you, Have a Great Day"); lottery=false; }
has comment: http://stackoverflow.com/comment/31957688
has title: My program is no taking the user input to start the program over in a loop
tagged with: boolean
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31956567
has comment: http://stackoverflow.com/comment/31956573
tagged with: while-loop
has answer: http://stackoverflow.com/a/21218636
has comment: http://stackoverflow.com/comment/31956753
type: UnansweredQuestion
tagged with: java
tagged with: loops

http://stackoverflow.com/q/21248645
upvote count: 2
type: UnansweredQuestion
tagged with: garbage-collection
has answer: http://stackoverflow.com/a/21270649
type: Question
tagged with: java
tagged with: concurrent-mark-sweep
linked to: http://stackoverflow.com/q/2833983
downvote count: 0
answer count: 1
has body: Usually for CMS I will see the following stdout [Unloading class sun.reflect.GeneratedMethodAccessorXXX] [Unloading class sun.reflect.GeneratedConstructorAccessorXXXX] [Unloading class sun.reflect.GeneratedSerializationConstructorAccessorXXX] [Unloading class sun.reflect.GeneratedSerializationConstructorAccessorXXX] [Unloading class sun.reflect.GeneratedSerializationConstructorAccessorXXX] but I notice the following in them too [Unloading class Customer_datasetXXXXX] – 280+ occurrence in log [Unloading class Item_XXXXXX] – 220+ occurrence in log [Unloading class Receipt_XXXXX] – 30+ occurrence in log [Unloading class Foo_XXXXX] – 190 occurrence in log *XXXXX are just random numbers. May I know what will most likely cause the above and is it normal? I don't understand why are there that many occurrence for class objects? A class is a template and an object is an instance of a class. So why do I have so many occurrence of Foo class being unloaded?
linked to: http://stackoverflow.com/q/148681
tagged with: jvm
favorite count: 0
has title: Object classes in concurrent-mark-sweep (CMS) unloading classes
score: 2
has comment: http://stackoverflow.com/comment/32031385
tagged with: reflection

http://stackoverflow.com/comment/31961907
score: 0
has text: yeah but too much to do and not time at all :(
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21221105

http://stackoverflow.com/comment/31923832
type: QuestionComment
has text: have you tried whether `Double.parseDouble(String)` happens to support that format?
comment on: http://stackoverflow.com/q/21199852
score: 0
type: Comment

http://stackoverflow.com/comment/81862621
has text: @Dazed: your answer is really great. In my case the requirement is the XPath may vary every time and it can have //StockReport/Artical (or) //StockReport/Artical/text(). So I want to check if the VTDNav is evaluating to Text? or Element?. Is there a way if I can check if the XPath is pointing to an XML Node/Element/Tag/"Text of the TaG" ? ... Please help me with this
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21279523
score: 0

http://stackoverflow.com/q/21262808
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21262948
has comment: http://stackoverflow.com/comment/32034870
has body: Given the following two classes Foo and FooBar: public abstract class Foo { private String type; private int id; public String getType() {...} public int getId() {...} } public class FooBar extends Foo { private String extraField; public String getExtraField() {...} } How do I implement a class with a field that could be either Foo or FooBar? For example, in the class Example below, I want the getFoo() method to return either an instance of Foo or an instance of FooBar such that all accessors are available: public class Example { private Foo fooField; // Not correct! public Foo getFooField() {...} } I am thinking that I need to implement a generic class as a wrapper, but I'm not sure how to tie it into the Example class. public interface FooWrapper&lt;T extends Foo&gt; { // Would I define some getter here? // Is this the right track? } Update: For clarification, Example does not extend Foo. Example is a completely different type that contains a field of type Foo/FooBar.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21262948
has title: Field of generic type with getter that returns the right type?
tagged with: java
has comment: http://stackoverflow.com/comment/32035387
type: Question

http://stackoverflow.com/q/21265519
tagged with: machine-learning
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/21269547
has comment: http://stackoverflow.com/comment/32062467
has body: I am looking into finding algorithm within the area of clustering or machine learning which will facilitate or creating a typical data reading for a group of readings. The issue is that it must facilitate time series data; thus some traditional (k-means) techniques are not as useful. Can anyone recommend places to look or particular algorithms that would provide a typical reading and relatively simple to implement (in Java), manipulate and understand?
has answer: http://stackoverflow.com/a/21269547
tagged with: cluster-analysis
has answer: http://stackoverflow.com/a/21265846
has title: Clustering: Finding a Average Reading
answer count: 2
upvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21265846
score: -1
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/32114351
comment on: http://stackoverflow.com/a/21307706
type: AnswerComment
has text: I have defined my id in /res/values/ids.xml as the following: `<item type="id" name="pref_key_apiBaseUri" />`. Shouldn't that work?
type: Comment
score: 0

http://stackoverflow.com/q/21238792
tagged with: pong
has body: im making a pong game in java, i've run into a problem. The bug is that when the pong ball intersects with either the AI or player paddles, the ball will sometimes collide multiple times. It basically looks like like the ball is gliding on the paddle. Sometimes, the ball will even get stuck behind the paddle infinitely. Had anyone ever encountered this error or something similar? I am confused with this multiple collision stuff :( my ball class is below: package ponggame; import java.awt.*; public class Ball{ int x; int y; int sentinel; int width = 15; int height = 15; int defaultXSpeed = 1; int defaultYSpeed = 1; public Ball(int xCo, int yCo){ x = xCo; y = yCo; } public void tick(PongGame someGame) { x += defaultXSpeed; y+= defaultYSpeed; if(PongGame.ball.getBounds().intersects(PongGame.paddle.getBounds()) == true){ defaultXSpeed *= -1; } if(PongGame.ball.getBounds().intersects(PongGame.ai.getBounds()) == true){ defaultXSpeed *= -1; } if(PongGame.ball.y &gt; 300){ defaultYSpeed *= -1; } if(PongGame.ball.y &lt; 0){ defaultYSpeed *= -1; } if(PongGame.ball.x &gt; 400){ defaultXSpeed *= -1; PongGame.playerScore++; System.out.println("Player score: " + PongGame.playerScore); } if(PongGame.ball.x &lt; 0){ defaultXSpeed *= -1; PongGame.aiScore++; System.out.println("AI score: " + PongGame.aiScore); } } public void render(Graphics g ){ g.setColor(Color.WHITE); g.fillOval(x, y, width, height); } public Rectangle getBounds(){ return new Rectangle(PongGame.ball.x, PongGame.ball.y, PongGame.ball.width, PongGame.ball.height); } }
type: Question
tagged with: game-physics
tagged with: java
tagged with: collision-detection
score: 0
has answer: http://stackoverflow.com/a/21238950
answer count: 1
type: UnansweredQuestion
has title: Java Pong ball glides on paddle
tagged with: collision

http://stackoverflow.com/q/21236871
has answer: http://stackoverflow.com/a/21237115
tagged with: apache
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion
tagged with: php
score: 1
tagged with: java
upvote count: 1
has body: on redhat6 I installed httpd2.2 &amp; tomcat6. the httpd's user is "apache". the tomcat6's user is "tomcat". now I want use "apache" run both httpd &amp; tomcat. how to config tomcat ? Why I ask this: 1. now I have a legacy system, php on front and java on background. 2. the system have a config import function. 3. when I upload config file on php UI, the php will great a tmp file in /tmp/* 4. but the java can not read the tmp file, because the tomcat user is "tomcat" and the httpd user is "apache". so I want to run tomcat as "apache"
type: Question
has title: how to use httpd user to run tomcat6 on redhat6?

http://stackoverflow.com/comment/31919644
score: 0
type: QuestionComment
type: Comment
has text: Not allowed to, this is a project, also I'd have no clue how, kind of an amateur still...
comment on: http://stackoverflow.com/q/21197569

http://stackoverflow.com/q/21304396
upvote count: 1
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21304840
tagged with: jasper-reports
downvote count: 0
answer count: 1
favorite count: 0
has body: I use JasperViewer to display my report but the look and feel is not i want. Is there a way to change the look and feel of the JasperViewer? For example if you click on save button i want to have look and feel of windows or the same things for print dialog when clicking on the print button. JasperViewer viewer = new JasperViewer(mainPrint,false); //viewer.changeLookAndFeel(); viewer.setVisible(true);
has title: how to change look and feel of JasperViewer?
tagged with: jframe
type: UnansweredQuestion

http://stackoverflow.com/q/21224981
has title: Use of command line argument shows array index out of bounds exception
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/31968542
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31968541
favorite count: 0
has answer: http://stackoverflow.com/a/21225025
type: Question
score: -2
answer count: 1
has body: When I try to execute the below code, it shows array index out of bounds exception. public class aaags { public static void main(String[] args) { System.out.println("The length of args is:"+ args.length); System.out.println("The value of args[0] is:"+ args[0]); System.out.println("The value of args[1] is:"+ args[1]); } }
tagged with: java
downvote count: 2
tagged with: indexoutofboundsexception

http://stackoverflow.com/comment/58729466
comment on: http://stackoverflow.com/a/21187003
type: AnswerComment
score: 0
type: Comment
has text: Yeah i can see that. So i am using this class in Android then which Priority i should be using?

http://stackoverflow.com/a/21340774
has body: The reason that the IP 127.0.0.1 works is beacause thats the IP of something called localhost. Since you are hosting both the server and the client on the machine that works just fine. When you want to have lets say the server program on one computer and client on another inside your local network (only accessed from inside of your network) you have to point the IP adress of the client to your server's IP adress. But things are a bit diffrent when you want to access it from OUTSIDE of your network. Its similar to before, just that you have to port forward your server's IP from your router with the port (6789 in your case). What this does is that when your routers public IP receives data with the port 6789, it knows where to send it. If it doesen't know, it just discards it. When you have port forwarded your router to accept data from port 6789. You need to find out your public IP adress. (which is farily easy to do, just head to: http://www.whatsmyip.org/) Then from outside your local network, start up your client on a computer. Then replace the IP that the client shall connect with to whatever your public IP is. NOTE: Your router's public IP adress changes from time to time, so that if you try to connect one day your routers public IP may have changed. A way to avoid this is to use DDNS (dynamic domain name system) but that is another topic. Hope this helps! -Kad
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21333949
downvote count: 0

http://stackoverflow.com/a/21335246
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21335006
has comment: http://stackoverflow.com/comment/32164767
has body: how can i know the path of the picture that will be store in this button This can be easily done by calling File.getPath() method: File file = fc.getSelectedFile(); System.out.println(file.getPath()); Additionaly you can store this path in the button through JComponent.putClientProperty(Object key, Object value): File file = fc.getSelectedFile(); btnNewButton.putClientProperty("imagepath", file.getPath()); what type of picture will you recommend me to upload in this button ? It can be JPG, PNG, BMP, WBMP and GIF, as per javax.imageio package description. Be aware Java doesn't support ICO format natively: Adding image to JButton
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21335006
has comment: http://stackoverflow.com/comment/32163341
score: 2
has comment: http://stackoverflow.com/comment/32164552

http://stackoverflow.com/q/21273125
downvote count: 1
type: Question
tagged with: nosuchelementexception
score: -1
tagged with: arraylist
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/21275143
favorite count: 0
type: UnansweredQuestion
has title: java.util.NoSuchElementException when working with .equals, arraylist and reading file with scanner
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/32053903
tagged with: java
has body: I'm attempting to populate an arraylist of strings with a text file that contains spaces, such that each string in the arraylist would contain a space between the first and second numbers in it, and no leading or trailing spaces. I am unfortunately running into the following error sequence when running it: Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at scannerTest.main(scannerTest.java:26) The following is my code: import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Scanner; public class scannerTest { private static ArrayList&lt;String&gt; myStore = new ArrayList&lt;String&gt;(); public static void main(String[] args) { int id = 0; int inv = 0; boolean idStarted = false; boolean idFinished = false; try { Scanner file = new Scanner(new File("file50.txt")); System.out.println("File: " + "file50.txt"); while (file.hasNextLine()) { for (int b = 0; b &lt; (file.nextLine()).length(); b++) { if (!file.next().equals(" ")) { id = id + Integer.parseInt(file.next()); idStarted = true; } if (idStarted = true &amp;&amp; file.next().equals(" ")) { idFinished = true; } if (idFinished = true &amp;&amp; !file.next().equals(" ")) inv = inv + Integer.parseInt(file.next()); } String result = Integer.toString(id) + " " + Integer.toString(inv); myStore.add(result); } } catch (FileNotFoundException e) { System.out.println("ERROR: File '" + "file50.txt" + "' not found!"); } System.out.println(myStore); } } The file looks like this: 3679 87 196 60 17914 12 18618 64 2370 65 584 85 18524 34 12024 5 6992 76 18410 56 9267 68 18995 56 6265 58 6835 94 14151 82 11485 39 15559 33 18465 27 19967 45 13520 38 5529 11 3433 5 17911 96 18181 60 11549 88 14896 81 184 14 4329 64 18871 69 15141 87 11584 32 14088 92 18061 3 206 31 13066 8 19623 88 12705 14 9351 8 17753 70 15917 51 768 85 15814 60 15320 82 8303 90 7282 73 14092 48 10629 19 12917 63 15006 5…
tagged with: file
has comment: http://stackoverflow.com/comment/32053928
has answer: http://stackoverflow.com/a/21273190

http://stackoverflow.com/q/21248249
tagged with: touch-event
tagged with: object
has title: XY-Pad get X and Y NPE error
score: 0
has body: I have recently been working on a program for an android application which is a simple XY-Pad which will display the X and Y coordinates of a users input in set View. The way it works is I have an XML layout for the application which has two TextViews (one to display X values, and one to display Y values), and it also has a View which is where the XY-Pad is located. The problem I keep running into though is when I attempt to send the X and Y coordinates over to the XML's linked class file to set the text of the TextViews, I get an error (a NullPointerException error). Does anyone know what could possibly be wrong with by code? Here is the XML data: &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=".Start" &gt; &lt;TextView android:id="@+id/theX" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="X:" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;TextView android:id="@+id/theY" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/button1" android:layout_marginBottom="30dp" android:layout_toLeftOf="@+id/linearLayout1" android:text="Y: " android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;view class="com.example.robotcontroller.drawing" android:id="@+id/XYpad" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toRightOf="@+id/button1" /&gt; Here is the 'drawing' class, which is that goes inside of the View in the XML data: public class drawing extends View{ private Paint paint = new Paint(); private Path path = new Path(); private float eventX = 0; private float eventY = 0; public drawing(Context context, AttributeSet attrs) { super(context, attrs); paint.setAntiAlias(true); paint.setStrokeWidth(20f); paint.setColo…
answer count: 1
has comment: http://stackoverflow.com/comment/32097800
accepted answer: http://stackoverflow.com/a/21322705
has comment: http://stackoverflow.com/comment/32087175
tagged with: android
type: AnsweredQuestion
tagged with: view
has answer: http://stackoverflow.com/a/21322705
tagged with: java
type: Question

http://stackoverflow.com/comment/93739278
type: Comment
comment on: http://stackoverflow.com/a/21264969
has text: @user1836155: I've spent the last 10 years doing only jOOQ. I'm *very* curious about what your company does so much better. Are you thinking of a very specific use-case? Then perhaps. But for general purpose SQL query building? I sincerely doubt it :)
score: 4
type: AnswerComment

http://stackoverflow.com/q/21186146
accepted answer: http://stackoverflow.com/a/21188204
has body: I am trying to resize an IplImage image in javacv. I found the cvResize function that does such a thing. MY workflow is: to open the image to transform it to gray_scale to resize it to desirable size and finally to reshape it. I have already read it transform it to gray_scale and resize it. What is my problem the final step, reshaping. I have the cvReshape which does what I want. I ve got an IplImage, I have to transform it to cvMat. The next step is reshaping, which takes 4 arguments, a cvArr a cvMat and the desirable dimensions. // read an image final IplImage image = cvLoadImage("ef.jpg"); //create image window named "My Image" final CanvasFrame canvas = new CanvasFrame("My Image"); // request closing of the application when the image window is closed canvas.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE); // show image on window canvas.showImage(image); IplImage GrayImage = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 1); cvCvtColor(image, GrayImage, CV_BGR2GRAY); IplImage img = IplImage.create(60, 60, IPL_DEPTH_8U, 1); //resize the image cvResize(GrayImage, img, CV_INTER_LINEAR); cvSaveImage("4-rjb" + ".jpg", img); //cvReleaseImage(result1); System.out.println("The size of the image: "+img); CvMat mtx = CvMat.createHeader(img.height(), img.width()); cvGetMat(img, mtx, null, 0); System.out.println(mtx); cvReshape(img, mtx, 3600, 1); I am receiving the error: OpenCV Error: Bad number of channels () in unknown function, file .\src\array.cpp, line 2721 I ve just want to reshape a 2d image, why that bad number of channels error happened??
tagged with: javacv
type: AnsweredQuestion
has title: Reshaping an IplImage in javacv
type: Question
has answer: http://stackoverflow.com/a/21188204
score: 0
tagged with: reshape
answer count: 1
tagged with: java

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/21232413
tags question: http://stackoverflow.com/q/21305382
type: Tag
tags question: http://stackoverflow.com/q/21228066
tags question: http://stackoverflow.com/q/21297261
tags question: http://stackoverflow.com/q/21248390

http://stackoverflow.com/comment/32035797
has text: Thanks! that works! I am going to edit my post, adding some comments for future reference.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21263077

http://stackoverflow.com/q/21299833
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/21299861
favorite count: 0
has answer: http://stackoverflow.com/a/21299899
linked to: http://stackoverflow.com/q/70324
type: Question
possible better answer: http://stackoverflow.com/a/21299899
tagged with: inner-classes
tagged with: syntax
answer count: 2
upvote count: 1
tagged with: nested-class
has answer: http://stackoverflow.com/a/21299861
tagged with: java
tagged with: class
has comment: http://stackoverflow.com/comment/32100455
type: AnsweredQuestion
has body: Consider the following nested classes. class Outerclass { class innerclass { } } class util { //how to declare an array of innerclass objects here? }
has title: Create array of inner class object in a different class

http://stackoverflow.com/a/21343494
type: Answer
accepted answer of: http://stackoverflow.com/q/21343217
answers question: http://stackoverflow.com/q/21343217
upvote count: 1
has body: Use hasNextToken() before each call to nextToken() to check if there actually is a next token. At this step you have 0, 1, 2, 3,... Strings. At this step, everything's fine if you have 3 Strings (first name, middle name, last name) and the program continues with the first token as the first name, the second token as the middle name and the third token as the last name, of course. If on the other hand there are only two Strings at this step, you assign the middle name a random letter as you said, and you assign the first token to the first name and the second token to the last name. From there, your program continues with String firstInitial = ...
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32179382

http://stackoverflow.com/q/21316299
tagged with: matrix
has comment: http://stackoverflow.com/comment/32261643
answer count: 1
accepted answer: http://stackoverflow.com/a/21390263
tagged with: colt
has title: Matrix rank doesn't work as per API specs in parallel colt
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32261657
has answer: http://stackoverflow.com/a/21390263
tagged with: sparse-matrix
has body: I am using parallel colt wherein I need to find the rank of a matrix. The API documentation says the following about the following about DoubleAlgebra#rank: rank(DoubleMatrix2D A) Returns the effective numerical rank of matrix A, obtained from Singular Value Decomposition. But when I use it in my code, I get an IllegalArgumentException at runtime: Exception in thread "main" java.lang.IllegalArgumentException: Matrix must be dense at cern.colt.matrix.tdouble.algo.DoubleProperty.checkDense(Unknown Source) at cern.colt.matrix.tdouble.algo.decomposition.DenseDoubleSingularValueDecomposition.<init>(Unknown Source) at cern.colt.matrix.tdouble.algo.DenseDoubleAlgebra.svd(Unknown Source) at cern.colt.matrix.tdouble.algo.DenseDoubleAlgebra.rank(Unknown Source) The API doesn't mention that a matrix needs to be dense. In my IDE (I use Intellij IDEA), when I ctrl+click the method name in my code, it goes to the source, which shows public int rank(cern.colt.matrix.tdouble.DoubleMatrix2D doubleMatrix2D) { /* compiled code */ } Bottomline, everywhere I see the requirement for a DoubleMatrix2D object, not a DenseDoubleMatrix2D object. Any idea why the runtime exception happens?
score: 0

http://stackoverflow.com/q/21204500
tagged with: nested-class
has comment: http://stackoverflow.com/comment/31931651
has comment: http://stackoverflow.com/comment/31931668
has comment: http://stackoverflow.com/comment/31932149
tagged with: java
has answer: http://stackoverflow.com/a/21204568
type: Question
has title: Returning reference to nested class
answer count: 1
has body: When you have a nested class such as this public class OuterClass { public class InnerClass { } } and you want to have a method that returns reference to the inner class, whitch of the following is better to do? public class OuterClass { public InnerClass someMethod() { } public class InnerClass { } } or public class OuterClass { public OuterClass.InnerClass someMethod() { } public class InnerClass { } } Edit: my reason for asking is because when ever I create a method in eclipse that returns say a map entry the return type generated by eclipse is always shown as Map.Entry&lt;SomeObject, SomeObject&gt; and I wonder if there is a reason behind it
score: 0
tagged with: return-type
has comment: http://stackoverflow.com/comment/31931496
tagged with: inner-classes
type: UnansweredQuestion

http://stackoverflow.com/comment/31932423
comment on: http://stackoverflow.com/a/21205038
type: AnswerComment
type: Comment
score: 1
has text: I tried this, but it gives a load of errors in regards to the functions within my SQLiteDatebase, eg: 'Cannot make a static reference to the non-static method openOrCreateDatabase(String, int, SQLiteDatabase.CursorFactory) from the type ContextWrapper'. Any ideas?

http://stackoverflow.com/q/21247425
has body: I have a RESTful resource which should take as a parameter a comma separated list of values. http://host:port/path/to/resource?enums=abc,def,ghi How do I make RestEasy and Jackson handle this? @GET public ResourceModel getResource( @QueryParam("enums") MyEnum[] values ) { return new ResourceModel( values ); } I know I can make it a simple String with an internal parser. But I would much prefer to be able to specify the type so that Jackson does the conversion for me (returning appropriately numbered error codes if the input is bad, etc). I've tried making values an array (as shown above), a List&lt;MyEnum&gt; and a custom MyList class extending List&lt;MyEnum&gt; with public static MyList fromString( String commaSeparatedValues ) method. Nothing seems to work. There must be some way to introduce a custom converter for it? Thanks. -Shadow
has title: How to specify RESTful resource query parameter of an array of enum objects
tagged with: java
upvote count: 2
answer count: 1
tagged with: jboss7.x
tagged with: jackson
favorite count: 0
tagged with: resteasy
tagged with: rest
type: UnansweredQuestion
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21269648
has comment: http://stackoverflow.com/comment/32009556
type: Question

http://stackoverflow.com/comment/32060728
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21277179
has text: run: CPoint 1234567890 is long! I guess... CP 1 1234567890 Exception in thread "main" java.lang.NullPointerException at com.Model.getCartDatabase(Model.java:336) CP 2 at com.TEST.main(TEST.java:34) Java Result: 1
type: Comment

http://stackoverflow.com/comment/32127470
comment on: http://stackoverflow.com/q/21312005
score: 0
type: Comment
type: QuestionComment
has text: Initially i would go for #1, as it easier to manage other than managing installation packages for long. but on the other hand, it is not generic, and id like to keep my code generic as possible. And third, i'm on a very short schedule, if there is a 3rd party installers that can warp this up and create different os installer with start up, thats better, under the circumstance of course.

http://stackoverflow.com/comment/32063933
score: 0
comment on: http://stackoverflow.com/a/21196693
type: Comment
type: AnswerComment
has text: Thanks a lot, Max, that really helped. The changes are even more significant than I expected. So, here's the actual piece of code I'm using now: http://paste.ubuntu.com/6796366/. My observations are: 1) breadth-first search runs twice as long as depth-search; 2) instead of returning nonexistent relationships, it's better to return an empty list, which is singleton over JVM, hence doesn't lead to creation of new objects, which can be painful on long paths; 3) this example of expanders usage is just awesome - they should have it in docs already! Thank you very much for your help.

http://stackoverflow.com/q/21243361
downvote count: 1
has title: Final String Tokenizer Error in Java
type: Question
has comment: http://stackoverflow.com/comment/32001718
has answer: http://stackoverflow.com/a/21243614
has comment: http://stackoverflow.com/comment/32001441
has comment: http://stackoverflow.com/comment/32001562
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/32001415
favorite count: 0
possible better answer: http://stackoverflow.com/a/21243556
type: AnsweredQuestion
has body: I've written some code that takes in a string of format "1 day hh:mm:ss". Using a string tokenizer, I'm attempting to split the string into various sections of interest, namely convert the 1 day to 86400 seconds, the hours to minutes and so forth. I'm having an error reaching the seconds, and returning that with my code. I can't figure out where the issue lays. I thought about this over the weekend, and as a last resort I've decided to ask the broader community for corrective assistance and any suggestions to improve this code better. The Goal: Read in a string of format "X days hh:mm:ss" and convert this to seconds. Code is attached below. This error I get read as follows: "java.util.NoSuchElementException at java.util.StringTokenizer.nextToken(StringTokenizer.java:332) at ReadIn.parseTime(ReadIn.java:110) at ReadIn.main(ReadIn.java:60)" I've gathered it has something to do with be unable to parse the final int ("ss") values of the format.I'm not sure why this is so, and would like some clarity was to what I'm doing wrong. I know some portions of this code are redundant, so I'm completely open and welcome all constructive criticism. Thanks in advance! public static int parseTime(String s) { int days = 0; int hours = 0; int minutes = 0; int seconds = 0; try{ StringTokenizer st = new StringTokenizer(s,": "); if(s.contains("day")){ days = Integer.parseInt(st.nextToken()); String throwAway = st.nextToken();// day throwAway = throwAway.substring(0, throwAway.lastIndexOf(throwAway)); hours = Integer.parseInt(st.nextToken()); throwAway = st.nextToken();//hours throwAway = throwAway.substring(0, throwAway.lastIndexOf(throwAway)); minutes = Integer.parseInt(st.nextToken()); throwAway = throwAway.substring(0, throwAway.lastIndexOf(throwAway)); seconds = Integer.parseInt(st.nextToken()); throwAway = st.nextToken(); } }catch(NoSuchElementException e) { // TODO Auto-generated catch block e.printStackTrace(); }catch(NumberFormatException e){ e.printStackTrace(); } return (days*8…
has answer: http://stackoverflow.com/a/21243556
has comment: http://stackoverflow.com/comment/32001380
has comment: http://stackoverflow.com/comment/32001463
tagged with: java
has comment: http://stackoverflow.com/comment/32001573
upvote count: 1
has answer: http://stackoverflow.com/a/21243606
accepted answer: http://stackoverflow.com/a/21243606

http://stackoverflow.com/comment/31948859
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21213922
has text: can you please show me thi link where can i download jboss.client jar file

http://stackoverflow.com/q/21294416
linked to: http://stackoverflow.com/q/8898765
score: 0
answer count: 2
has body: My intention is to develop an eclipse plugin (I will explain why I am sticking on to eclipse plugin.), that will execute a python script at a specific location (say C:\MyProject\testscript.py). I am interested in getting responses, from those who have already tried out anything similar, on whether this approach will work. Why Eclipse Plugin? I am trying to listen to a notification from a Server. Although the server exposes Plain java APIs, the listening mechanism is not provided as plain java api. But using the eclipse plugins provided by the server, I can see the notifications in the eclipse UI.
tagged with: eclipse-plugin
has title: Can an eclipse plugin invoke an external python script?
linked to: http://stackoverflow.com/q/16447410
linked to: http://stackoverflow.com/q/15515298
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21344144
accepted answer: http://stackoverflow.com/a/21344144
type: Question
possible better answer: http://stackoverflow.com/a/21294659
has answer: http://stackoverflow.com/a/21294659
tagged with: eclipse

http://stackoverflow.com/a/22394976
answers question: http://stackoverflow.com/q/21348284
type: Answer
has body: Then we get to point 4, 5, 6, &amp; 7. Point 4 is vertical because its depth is even, point 5 should be as well. It's x point is smaller than point 1, so it goes to the left, its x point is bigger than point 2, so it goes to the right, becoming point 3s' right child, which should make its depth even, thus vertical. Same problem for the right subtree. This is incorrect. Once you go down one branch of the tree you stay there. So point 1 is at the root, and has children 2 and 3. 2 has child 4, 4 has child 5. Thus 5 should be horizontal as it is a child of 4, which is a child of 2, which is a child of 1. Wikipedia has a good explanation of kd-trees here: http://en.wikipedia.org/wiki/K-d_tree In summary, since point 5 is to the left of 1, it goes into that branch. Since it is below 2, it takes that branch. Since it is to the right of 4, it takes that branch.
score: 0

http://stackoverflow.com/comment/32132109
type: AnswerComment
has text: Precisely... the error message is saying that the current JVM you are actually running is Java 6, whereas the bundle requires at least Java 7.
comment on: http://stackoverflow.com/a/21306683
score: 0
type: Comment

http://stackoverflow.com/comment/31935644
type: Comment
has text: why suffer using above statement try using PreparedStatement lot more easier to understand and better way of coding.
comment on: http://stackoverflow.com/q/21206865
score: 0
type: QuestionComment

http://stackoverflow.com/a/21284223
has comment: http://stackoverflow.com/comment/32073427
accepted answer of: http://stackoverflow.com/q/21282946
type: Answer
has body: You can achieve it as below : public static void main(String[] args) { String dataStr = "rcpt 7554 Jan-21 01-03:43:27 ? /usr/bin/Program\n" + "ncuser2 7202 Jan-21 01-04:22:08 ? /usr/bin/Program\n" + "lyn 6277 Dec-17 36-02:14:51 ? /usr/bin/Program 10.15.1.104:0.0\n" + "lyn 6268 Dec-17 36-02:15:17 ? /usr/bin/Program 10.15.1.104:0.0\n"; String rows[] = dataStr.split("\n"); Vector&lt;Vector&lt;String&gt;&gt; dataVector = new Vector&lt;Vector&lt;String&gt;&gt;(); for (String row : rows) { row = row.trim(); //UPDATE Vector&lt;String&gt; data = new Vector&lt;String&gt;(); data.addAll(Arrays.asList(row.split("\\s+"))); dataVector.add(data); } Vector&lt;String&gt; header = new Vector&lt;String&gt;(2); header.add("User"); header.add("PID"); header.add("Launch"); header.add("Runtime"); header.add("TTYP"); header.add("Program"); TableModel model = new DefaultTableModel(dataVector, header); JTable table = new JTable(model); JFrame frame = new JFrame("DemoFrame"); frame.add(new JScrollPane(table)); frame.setSize(300, 200); frame.setVisible(true); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); } OUTPUT
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/32074622
has comment: http://stackoverflow.com/comment/32073638
answers question: http://stackoverflow.com/q/21282946
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32072927
has comment: http://stackoverflow.com/comment/32072606
has comment: http://stackoverflow.com/comment/32075072

http://stackoverflow.com/a/21276083
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: When you decide to quit the app you can do it by doing 2 things set a specific resultCode to the activity that means QUIT_APP and finish the activity override function onActivityResult in all your activities (or inherit froma singel one) and for resultCode QUIT_APP repeat step a. Basically it will cascade all your activities edit: also in your code call startActivityForResult instead of startActivity. See this for more info https://stackoverflow.com/a/1124988/1393632
answers question: http://stackoverflow.com/q/21275956

http://stackoverflow.com/a/21207762
answers question: http://stackoverflow.com/q/21205947
has comment: http://stackoverflow.com/comment/31941678
score: 0
type: Answer
has body: Try This :- JTextField textField = new JTextField(); textField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { //do stuff here when enter pressed String text = textField.getText(); if(text!=null &amp;&amp; !text.equals("")){ char c = evt.getKeyChar(); int val=Integer.parseInt(c); if(val&gt;=48 &amp;&amp; val&lt;=57){ if(Integer.parseInt(text)&lt;=10){ //Its valid and allowed }else{ //Its invalid, show error message here } }else{ //Show message only numbers are allowed return false; } } } }); Hope it will help you.

http://stackoverflow.com/comment/32099192
type: QuestionComment
comment on: http://stackoverflow.com/q/21299030
score: 0
has text: What `event` list contains ?
type: Comment

http://stackoverflow.com/a/21283179
has body: Remove [] from onclick like, document.getElementById('playmode').onclick = function () { if (me.paused) me.play(); else me.pause(); }; Don't reassign me variable success: function (me) {// me is your player here var flag = true; //var me = document.getElementById('player1'); //remove this line me.play(); me.addEventListener('timeupdate', function () { if (flag) { if (this.currentTime &gt; 4.10234 &amp;&amp; this.currentTime &lt; 4.451111) { this.pause(); flag = false } } document.getElementById('time').innerHTML = me.currentTime; }, false); document.getElementById('playmode').onclick = function () { if (me.paused) me.play(); else me.pause(); };
has comment: http://stackoverflow.com/comment/32070465
answers question: http://stackoverflow.com/q/21283053
score: 0
type: Answer

http://stackoverflow.com/comment/32166100
comment on: http://stackoverflow.com/q/21336858
has text: you can not have merge tag as root, for fragment
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/comment/31934621
score: 0
has text: Also, `String` is final, so the method can't be overridden
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21206263

http://stackoverflow.com/q/21201873
has title: Java ProcessBuilder Pipe
upvote count: 1
has body: I have a shell command my_command that accepts a pipe as input , eg echo "test" | my_command param1 param2 I tried this: cmd.add("echo"); cmd.add( "test"); cmd.add("| my_command"); cmd.add(param1); cmd.add(param2); but i did I not get desired result. cmd is a list declared using ArrayList. thanks
type: Question
linked to: http://stackoverflow.com/q/3776195
has answer: http://stackoverflow.com/a/21202004
downvote count: 0
duplicate of: http://stackoverflow.com/q/3776195
answer count: 1
favorite count: 0
tagged with: processbuilder
type: UnansweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/31968322
type: Comment
has text: It seems like he did my homework but the only thing i added to my code is the append(" "). Thank you all for your help.
type: AnswerComment
comment on: http://stackoverflow.com/a/21224400
score: 0

http://stackoverflow.com/q/21228932
upvote count: 1
tagged with: swing
has title: How to set JDialog position according to the parent JFrame?
type: Question
has answer: http://stackoverflow.com/a/21240677
has answer: http://stackoverflow.com/a/21229779
answer count: 3
downvote count: 0
has body: I am having one parent frame in my system and one dialog that I need to show on Click. But I need to show that dialog in the middle of the parent frame. All time. And that parent frame position may not be the same all the time. So how to set it all time in to the middle? I am Working on Swing JFrame. com.verve.visdashboard.NewOkCancelDialog cancelDialog = new com.verve.visdashboard.NewOkCancelDialog(new FrameOwnserPnael(), true); cancelDialog.setLocationRelativeTo(new FrameOwnserPnael()); cancelDialog.setLocationByPlatform(true);
favorite count: 0
tagged with: jdialog
tagged with: jframe
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10030947
has answer: http://stackoverflow.com/a/21229023
duplicate of: http://stackoverflow.com/q/10030947
score: 1
tagged with: java

http://stackoverflow.com/comment/31918687
score: 2
comment on: http://stackoverflow.com/q/21197078
type: Comment
has text: toString() is supposed to return a string containing a "description" of the object. It's not supposed to print anything. Read the javadoc of Object.toString().
type: QuestionComment

http://stackoverflow.com/q/21346327
has comment: http://stackoverflow.com/comment/32183779
has body: So I looked at other answers and I did not find a solution to my question. I'm new to Java so don't expect complex methods, I'll show what's in the text file and a few methods, thanks :) By the way, it's a runtime error. Text File: 1.1206060982385907E-23 1.8211358653686147E-24 1.6396713341496784E-24 5.76142040175542E-24 1.305001288660403E-26 1.8362146624686452E-26 1.0207894499723824E-25 1.0867598055339296E-25 4.670786575865269E-23 Main Method: public static void main(String[] args)throws IOException { // Extension idea... instead of hard codeing the weight, you may propt the user for input. // Initialize Variables double[] gravity = new double[9]; File fileRead = new File("/Users/jerome/Desktop/Gravity.txt"); Scanner inFile = new Scanner (fileRead); for (int i = 0; i&lt;9; i ++) { gravity[i] = inFile.nextDouble(); // Fails here } inFile.close(); double earthWeight = 100.0; // initalize Earth weight to 100 lbs. String[] names = {"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto"}; // Processing double[] weights = calcWeight(earthWeight, gravity); // static method you write // Output printResults(names, gravity, weights); } //end main }//end class Printing to Screen: public static void printResults(String[] name,double gravity[],double weights[]) { System.out.printf("%25s %n","My Weight on the Planets"); System.out.printf("%10s %13s %13s %n"," Planet","Gravity","Weight (lbs)"); System.out.printf("%s %n","================================================"); for (int i = 0; i&lt;9; i ++) { System.out.printf("%10s %13s %13s %16s %n",name[i],gravity[i],weights[i]); } } Gravity calculation: public static double[] calcWeight(double earthWeight,double[] gravity) { double[] calcWeight = new double[9]; for (int i=0; i&lt;9; i++) { calcWeight[i] = earthWeight * gravity[i]; } return calcWeight; }
has comment: http://stackoverflow.com/comment/32184370
type: UnansweredQuestion
tagged with: text
answer count: 0
tagged with: file
type: Question
has comment: http://stackoverflow.com/comment/32184000
tagged with: java
has comment: http://stackoverflow.com/comment/32183708
has title: Input.Java.Mismatch error: Null for text file
score: 0

http://stackoverflow.com/q/21261077
tagged with: oop
possible better answer: http://stackoverflow.com/a/21261152
answer count: 3
has answer: http://stackoverflow.com/a/21261136
accepted answer: http://stackoverflow.com/a/21261136
downvote count: 0
has title: Conflict between separating logic and polymorphism
favorite count: 0
has body: I'm trying to create a messaging system in Java. I have an interface Message which will have multiple implementations (e.g. TextMessage and AudioMessage). This interface will be available on both the server and the client. My problem is that the client should render different visual output based on the type of message it receives from the server. Therefore I either have to know the type of the message I'm dealing with which I could do using instanceof() or I can put an abstract method in the Message interface and make use of polymorphism so the Message takes care of creating the visual output. However doing any of that feels dirty as I'd have to either create a new if instanceof block every time or let the Message take care of creating the visual part, which feels just as wrong, as it is supposed to be some kind of model. Does anyone have a solution or an appropriate design pattern I could use here? Thanks!
upvote count: 6
has answer: http://stackoverflow.com/a/21261152
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21261323
score: 6
tagged with: design-patterns
type: Question

http://stackoverflow.com/comment/32144077
comment on: http://stackoverflow.com/q/21324417
score: 0
type: QuestionComment
type: Comment
has text: Something wrong with `Collections.sort`?

http://stackoverflow.com/comment/60708052
comment on: http://stackoverflow.com/a/21344397
type: Comment
has text: You can also avoid HeadlessException with -Djava.awt.headless=false :) Thanks!
score: 9
type: AnswerComment

http://stackoverflow.com/comment/31935233
type: AnswerComment
comment on: http://stackoverflow.com/a/21206302
score: 0
has text: what values you get in "widthMeasureSpec" and "heightMeasureSpec"? what does it make to look like? Means does it fill the screen when you call super.onMeasure(widthMeasureSpec, heightMeasureSpec);?
type: Comment

http://stackoverflow.com/comment/73146752
score: 1
type: AnswerComment
type: Comment
has text: I'm experiencing the same exact thing as the above comment. I can't get the instance created when calling the web service to have the autowired fields. Am I doing something wrong with how I'm creating the web service? Or did I not follow the solution correctly? Spring is definitely creating the WS class as a bean, but it's not the same instance used when calling the service.
comment on: http://stackoverflow.com/a/21193890

http://stackoverflow.com/comment/32140983
type: Comment
has text: I meant to say thank you, but I forgot, so thank you! The project I am undertaking is the largest I have had to do to date and I have been getting confused at the smallest things. Thank you for helping me sort things out in my mind, I really appreciate everything you've given me to think about!
comment on: http://stackoverflow.com/a/21272940
score: 0
type: AnswerComment

http://stackoverflow.com/a/21242111
type: Answer
has comment: http://stackoverflow.com/comment/54895845
downvote count: 3
answers question: http://stackoverflow.com/q/21242110
has comment: http://stackoverflow.com/comment/31999154
has comment: http://stackoverflow.com/comment/52095235
has comment: http://stackoverflow.com/comment/119158513
has body: Short answer Date input = new Date(); LocalDate date = input.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); Java 9 answer In Java SE 9, a new method has been added that slightly simplifies this task: Date input = new Date(); LocalDate date = LocalDate.ofInstant(input.toInstant(), ZoneId.systemDefault()); This new alternative is more direct, creating less garbage, and thus should perform better. Explanation Despite its name, java.util.Date represents an instant on the time-line, not a "date". The actual data stored within the object is a long count of milliseconds since 1970-01-01T00:00Z (midnight at the start of 1970 GMT/UTC). The equivalent class to java.util.Date in JSR-310 is Instant, thus there is a convenient method toInstant() to provide the conversion: Date input = new Date(); Instant instant = input.toInstant(); A java.util.Date instance has no concept of time-zone. This might seem strange if you call toString() on a java.util.Date, because the toString is relative to a time-zone. However that method actually uses Java's default time-zone on the fly to provide the string. The time-zone is not part of the actual state of java.util.Date. An Instant also does not contain any information about the time-zone. Thus, to convert from an Instant to a local date it is necessary to specify a time-zone. This might be the default zone - ZoneId.systemDefault() - or it might be a time-zone that your application controls, such as a time-zone from user preferences. Use the atZone() method to apply the time-zone: Date input = new Date(); Instant instant = input.toInstant(); ZonedDateTime zdt = instant.atZone(ZoneId.systemDefault()); A ZonedDateTime contains state consisting of the local date and time, time-zone and the offset from GMT/UTC. As such the date - LocalDate - can be easily extracted using toLocalDate(): Date input = new Date(); Instant instant = input.toInstant(); ZonedDateTime zdt = instant.atZone(ZoneId.systemDefault()); LocalDate date = zdt.toLocalDat…
has comment: http://stackoverflow.com/comment/71996175
has comment: http://stackoverflow.com/comment/48883667
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/88441817
has comment: http://stackoverflow.com/comment/31999342
accepted answer of: http://stackoverflow.com/q/21242110
has comment: http://stackoverflow.com/comment/31999364
has comment: http://stackoverflow.com/comment/31999653
score: 997
has comment: http://stackoverflow.com/comment/31999560
has comment: http://stackoverflow.com/comment/72029770
has comment: http://stackoverflow.com/comment/32017817
has comment: http://stackoverflow.com/comment/131715015
has comment: http://stackoverflow.com/comment/31999534
upvote count: 1000
has comment: http://stackoverflow.com/comment/105874559
has comment: http://stackoverflow.com/comment/32000304
has comment: http://stackoverflow.com/comment/32629548

http://stackoverflow.com/a/21286979
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has body: I was confused by possible solutions implementing a custom JaasSecurityManagerService mbean, or at least define it's DefaultCacheTimeout: link and link The answer proved much simpler, and I got it from here (scroll to the answer by Darren Jones for Wildfly, complemented by Artur Mioduszewski for EAP6.1). I use EAP 6.2, so used the following configuration in my standalone.xml &lt;subsystem xmlns="urn:jboss:domain:infinispan:1.4"&gt; &lt;cache-container name="security" default-cache="auth-cache"&gt; &lt;local-cache name="auth-cache" batching="true"&gt; &lt;expiration lifespan="*INSERT_CACHE_TIMEOUT_IN_MILLIS"/&gt; &lt;/local-cache&gt; &lt;/cache-container&gt; ... &lt;security-domain name="myJaasDomain" cache-type="infinispan"&gt; Setting the timeout to 0 shows undefined behaviour, so I used 1 ms.
has comment: http://stackoverflow.com/comment/46715064
type: Answer
accepted answer of: http://stackoverflow.com/q/21280812
answers question: http://stackoverflow.com/q/21280812

http://stackoverflow.com/a/21327483
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21326539
type: Answer
has comment: http://stackoverflow.com/comment/32151402
answers question: http://stackoverflow.com/q/21326539
has comment: http://stackoverflow.com/comment/32149573
downvote count: 0
has body: First of all it's good that you try to implement some data structure of your own. But if you need to implement such thing, you need to do an in-depth analysis of how that data structure (Singly LinkedList in your case) stores and retrieves data &amp; whether order of insertion is maintained or it maintains sorted order and so. Suggesting you some points to follow always before doing an implementation. Understand the concept first. Write down the algorithm about how it works. Design it (probably writing down the design on a paper is best practice &amp; will give you a clear view on what you implement) Implement &amp; test it. In your case here, you design a Node class for your linkedlist which would take care of all node related tasks like storing next/previous node address (SinglyLinkedList would store only next node address). Keep this Node as Inner class (is best practice) of your LinkedList class. private class Node&lt;T&gt;{ private Node&lt;T&gt; next; private T data; public Node(T data, Node&lt;T&gt; next){ this.data = data; this.next = next; } } I have used Generics here. You can do it without using Generics too. Implement linkedlist operations (like add/remove etc) in your linkedlist class traversing through these Node objects. Whatever algorithm you have written down helps you in such places to implement in a efficient manner. I have my sample code here. Whatever code you posted here is not a good implementation. Try following the steps I specified &amp; you will have your better code. public class LinkedList&lt;T&gt; { private Node&lt;T&gt; head; private Node&lt;T&gt; nextNode; private int size = 0; public void addFirst(T element){ head = new Node&lt;T&gt;(element, head); } public void add(T element){ if(head == null) addFirst(element); else{ Node&lt;T&gt; node = head; while(node.next != null){ node = node.next; } node.next = new Node&lt;T&gt;(element, null); } size++; } public int size(){ return size; } // Inner class somewhere here } This is simple repres…
has comment: http://stackoverflow.com/comment/32149609
score: 1

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/21336216
tags question: http://stackoverflow.com/q/21316443
tags question: http://stackoverflow.com/q/21341652
tags question: http://stackoverflow.com/q/21311345
type: Tag

http://stackoverflow.com/a/21207167
answers question: http://stackoverflow.com/q/21207049
score: 5
has comment: http://stackoverflow.com/comment/31936409
has comment: http://stackoverflow.com/comment/31944071
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31936202
has comment: http://stackoverflow.com/comment/31936267
has comment: http://stackoverflow.com/comment/31936129
has comment: http://stackoverflow.com/comment/31936297
type: Answer
has body: The point of prepared statements is, among others, to not concatenate your queries yourself. You want to do the following: //first you "prepare" your statement (where the '?' acts as a kind of placeholder) PreparedStatement st = con.prepareStatement("insert into user (user,age,school,password) values (?,?,?,?);"); //now you bind the data to your parameters st.setString(1, user); ... //and then you can execute it st.executeUpdate() For more details see the official tutorial. There are a couple of things happening behind the scenes that make the query safe, like escaping special characters that would otherwise allow altering the statement (google SQL injections if you want to know more)
has comment: http://stackoverflow.com/comment/31936229
upvote count: 5
has comment: http://stackoverflow.com/comment/31939159
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21207049
has comment: http://stackoverflow.com/comment/31936352

http://stackoverflow.com/a/21196749
type: Answer
has body: I really recommend formatting the code. else if(odd.equals("AT517")); Has a ; So does else if(odd.equals("AT617"));
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31918258
answers question: http://stackoverflow.com/q/21196653
upvote count: 1
has comment: http://stackoverflow.com/comment/31918330
has comment: http://stackoverflow.com/comment/31918188

http://stackoverflow.com/a/78591870
downvote count: 0
score: 1
has body: I was using a theme with NO_ACTION_BAR, the code was generated by Android Studio and I probably picked a template without an action bar. So check your AndroidManifest.xml if the theme has a parent set to NO_ACTION_BAR and change it.
answers question: http://stackoverflow.com/q/21214627
upvote count: 1
type: Answer

http://stackoverflow.com/comment/32017639
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21252960
has text: this might help http://stackoverflow.com/questions/1409116/how-to-stop-the-task-scheduled-in-java-util-timer-class

http://stackoverflow.com/comment/32030445
has text: Yes but in my case we dont know the name is SiteData unless the user clicks on it in the gui therefore all is stored in a variable and that I have getters and setters for. Ive done something like this but havent tested it yet : String expression = "/" + obj.getObjectType() + "/prop/*";
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21260247

http://stackoverflow.com/q/21207067
has answer: http://stackoverflow.com/a/21207181
answer count: 3
has comment: http://stackoverflow.com/comment/31935973
duplicate of: http://stackoverflow.com/q/112503
linked to: http://stackoverflow.com/q/642897
has body: I am trying to remove a meteor in my game for when it his a bullet but there seems to be an error, and I do not now another method to remove the object. for (int i = 0; i &lt; numA; i++) { if (meteor[i].isVisible()) meteor[i].move(); else meteor[i].remove(i); }
tagged with: java
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/642897
has answer: http://stackoverflow.com/a/21207154
has title: How do i remove an array object if the array is not made by an ArrayList?
score: 2
tagged with: arrays
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/21207111
has comment: http://stackoverflow.com/comment/31936155
linked to: http://stackoverflow.com/q/112503
upvote count: 2

http://stackoverflow.com/q/21325949
tagged with: java
accepted answer: http://stackoverflow.com/a/21326156
linked to: http://stackoverflow.com/q/275944
type: Question
tagged with: arrays
has title: how to create array from string in java with respective data items
score: -4
downvote count: 4
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21326156
type: AnsweredQuestion
has body: How to create an array from a string with two respective data items. String str="USA*2*Japan*8^2*India*5^4^2*Germany*5*"; Here, I want to create an array of two items in . Like this: Arraylist&lt;string&gt; arr= [USA*2,Japan*8^2, India*5^4^2,Germany*5]; Here * is indicating main items and ^ is indicating sub items.

http://stackoverflow.com/a/21243468
type: Answer
accepted answer of: http://stackoverflow.com/q/21232142
answers question: http://stackoverflow.com/q/21232142
has body: Can i set an variable in available tag like this? Yes, you can. Macro names are changed with each iteration. The &lt;var/&gt; task is simply a way to unset and reset a property in Ant. It's part of the Ant-Contrib project. You don't need to unset and reset the property: &lt;var name="schema.params.file" unset="true"/&gt; &lt;property name="schema.params.file" value="false"/&gt; You could do this in a single statement: &lt;var name="schema.params.file" value="false"/&gt; Their use is highly discouraged since it breaks Ant's immutable property idea. However, I've find that I too use &lt;var/&gt; a lot when going through &lt;for/&gt; loops and sometimes &lt;macrodef&gt;. Newer versions of Ant allow you to localize properties, so I suspect the &lt;var/&gt; task will soon no longer be needed. Another thing which may make things a bit easier is that you can use &lt;if/&gt; tests with &lt;available/&gt; &lt;if&gt; &lt;then&gt; &lt;and&gt; &lt;available file="${infinys.root}/schema_params/@{componentname}-schema_params.sql" type="file"/&gt; &lt;available file="${stage.dir}/@{componentname}/@{installableid}/schema/install/scripts" type="dir"/&gt; &lt;/and&gt; &lt;sequencial&gt; .... &lt;/sequential/&gt; &lt;/then&gt; &lt;/if&gt; Doing this may make your code a bit cleaner and easier to understand. It will also eliminate the need to unset properties in the first place.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/31996826
comment on: http://stackoverflow.com/q/21238601
score: 0
type: QuestionComment
has text: Since in the simple test case I can get it to work by just changing the order of the Source[] entries, I'm not sure an LSResourceResolver should be needed here?
type: Comment

http://stackoverflow.com/comment/32176980
type: Comment
type: AnswerComment
has text: The custom view can save it's own state, so if the screen rotates (Rotation currently locked but may be enabled later) the data is maintained. If the dialog is open and something happens, I don't mind if the dialog does not come back up.
comment on: http://stackoverflow.com/a/21340968
score: 0

http://stackoverflow.com/comment/32120928
has text: I have a JFrame, GUI Swing thing, this is just the coding in it.
comment on: http://stackoverflow.com/q/21310722
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/21195892
downvote count: 0
score: 1
has body: If you call a method with . you're executing that method always. How else can it work? You should change your design.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21195657

http://stackoverflow.com/a/21276655
answers question: http://stackoverflow.com/q/21276225
score: 1
has body: Consider that you are designing a movie ticket seller application. And lets drop all the technology capabilities that are provided these days, for the sake of visualizing the problem. There is only one ticket left for the show with 5 different counters selling tickets. Consider there are 2 people trying to buy the last ticket of the show at the counters. Consider your application workflow to be such You take in details of the buyer, his name, and his credit card number. (this is the read operation) Then you find out how many tickets are left for the show (this is again a read operation) Then you book the ticket with the credit card (this is the write operation) If this logic isnt synchronised, what would happen? The details of Customer 1 and Customer 2 would be read up until step 2. Both will try to book the ticket and both their tickets would be booked. If it is modified to be You take in details of the buyer, his name, and his credit card number. (this is the read operation) Synchronize( Then you find out how many tickets are left for the show (this is again a read operation) Then you book the ticket with the credit card (this is the write operation) ) There is no chance of overbooking the show due to a thread race condition. Now, consider this example where you absolutely know that there will be only and only 1 person booking tickets. There is no need for synchronization. The ticket seller here would be your single thread in case of your application I have tried to put this in a very very simplistic manner. There are frameworks, and constraints which you put on the DB to avoid such a simple scenario. But the intent of the answer is to prove the theory of why thread synchronization, and not the capabilities of the way to avoid it.
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/21194170
type: AcceptedAnswer
has body: I don't have very detailed experience with HttpClient because in my past experiences I mostly used Jsoup Java library. But I also tried using HttpClient, here is a code snippet to get the content of a response. There may be some differences related with Android API but I hope it helps. (For instance, CloseableHttpResponse and HttpResponse ) public static String readHttpResponse(CloseableHttpResponse response) throws IOException { final StringBuilder builder = new StringBuilder(); try { HttpEntity entity = response.getEntity(); if (null != entity) { InputStream inputStream = entity.getContent(); try { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); String line = null; while ((line = bufferedReader.readLine()) != null) { builder.append(line); } } finally { inputStream.close(); } } } finally { response.close(); } return builder.toString(); } // end of readHttpResponse(CloseableHttpResponse response) And this is a different implementation which uses EntityUtils public static String readHttpResponse(CloseableHttpResponse response) throws IOException { try { HttpEntity entity = response.getEntity(); if (null != entity) { return EntityUtils.toString(entity); } } finally { response.close(); } return ""; } // end of readHttpResponse(CloseableHttpResponse response) If you are interested using a library, you would get the same result using the code in the below. Connection.Response res = Jsoup.connect("URL") .data("FIELD1", "abc", "FIELD2", "abc") .method(Connection.Method.POST) .execute(); String result = res.body();
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21191584
answers question: http://stackoverflow.com/q/21191584

http://stackoverflow.com/comment/31942837
comment on: http://stackoverflow.com/a/21194359
score: 0
type: AnswerComment
has text: I'd use a variable and do a +1 or you might use calendar.roll() like so http://www.tutorialspoint.com/java/util/calendar_roll.htm
type: Comment

http://stackoverflow.com/comment/31912872
type: QuestionComment
comment on: http://stackoverflow.com/q/21193657
has text: @RyanCarlson beacause this 54ms or more is related to scheduling.
score: 0
type: Comment

http://stackoverflow.com/q/21272877
has title: Understanding JVM Memory Allocation and Java Out of Memory: Heap Space
has answer: http://stackoverflow.com/a/21276727
has answer: http://stackoverflow.com/a/21272959
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/32054278
tagged with: out-of-memory
upvote count: 32
answer count: 4
has answer: http://stackoverflow.com/a/21273084
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21276727
tagged with: memory-management
possible better answer: http://stackoverflow.com/a/21273084
downvote count: 1
type: Question
score: 31
has answer: http://stackoverflow.com/a/21278436
tagged with: java
has body: I'm looking into really understanding how memory allocation works in the JVM. I'm writing an application in which I'm getting Out of Memory: Heap Space exceptions. I understand that I can pass in VM arguments such as Xms and Xmx to up the heap space that the JVM allocates for the running process. This is one possible solution to the problem, or I can inspect my code for memory leaks and fix the issue there. My questions are: 1) How does the JVM actually allocate memory for itself? How does this relate to how the OS communicates available memory to the JVM? Or more generally, how does memory allocation for any process actually work? 2) How does virtual memory come into play? Let's say you have a system with 32GB of physical memory and you allocate all 32GB to your Java process. Let's say that your process actually consumes all 32GB of memory, how can we enforce the process to use virtual memory instead of running into OOM exceptions? Thanks.
linked to: http://stackoverflow.com/q/54318518
tagged with: memory

http://stackoverflow.com/comment/32028894
has text: I added <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.INTERNET"/>
type: Comment
comment on: http://stackoverflow.com/a/21258992
score: 0
type: AnswerComment

http://stackoverflow.com/a/21189253
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/31905569
has comment: http://stackoverflow.com/comment/31905709
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21189009
answers question: http://stackoverflow.com/q/21189009
has comment: http://stackoverflow.com/comment/31905489
has body: Try the following: String date = getDate(selectedDate); private String getDate(String inpuDate) { Date date = new SimpleDateFormat("EEE MMM d hh:mm:ss z yyyy").parse(inputDate); return new SimpleDateFormat("dd.MM.yyyy hh:mm:ss").format(date); }
upvote count: 3
type: Answer

http://stackoverflow.com/comment/31918980
has text: Thanks @T.J.Crowder, this is a great solution. Although currently the StringBuilder adds a new line on the last printed String and this is not wanted. How do I go about ensuring the last String does not end with a new line, "\n"?
comment on: http://stackoverflow.com/a/21197111
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21264385
type: Answer
has comment: http://stackoverflow.com/comment/32043202
has body: Spying is not needed, mocking is enough. As @David said, also mocking is not needed and not recommended for value object. Using @Test(expected = Exception.class) has many drawbacks, test can pass when exception is thrown from not expected places. Test is not working but is visible as green. I prefer BDD style testing with catch-exception. Reasons for using catch-exceptions (...) in comparison to the use of try/catch blocks. The test is more concise and easier to read. The test cannot be corrupted by a missing assertion. Assume you forgot to type fail() behind the method call that is expected to throw an exception. (...) in comparison to test runner-specific mechanisms that catch and verify exceptions. A single test can verify more than one thrown exception. The test can verify the properties of the thrown exception after the exception is caught. The test can specify by which method call the exception must be thrown. The test does not depend on a specific test runner (JUnit4, TestNG). import static com.googlecode.catchexception.CatchException.caughtException; import static com.googlecode.catchexception.apis.CatchExceptionAssertJ.*; public class FooBarTest { FooBar sut = new FooBar(); // System Under Test @Test public void shouldThrowExceptionWhenListHasTooManyElements() { when(sut).getMethod(listWithSize(150)); then(caughtException()).isInstanceOf(Exception.class); } private List&lt;String&gt; listWithSize(int size) { return new ArrayList&lt;String&gt;(Arrays.asList(new String[size])); } } Full working code for this test: https://gist.github.com/mariuszs/8543918 Not recommended solution with expected and mocking. @RunWith(MockitoJUnitRunner.class) public class FooBarTest { @Mock List&lt;String&gt; codes; FooBar fooBarInstance = new FooBar(); @Test(expected = Exception.class) public void shouldThrowExceptionWhenListHasTooManyElements() throws Exception { when(codes.size()).thenReturn(150); fooBarInstance.getMethod(codes); } }
has comment: http://stackoverflow.com/comment/32044934
upvote count: 4
has comment: http://stackoverflow.com/comment/32039045
downvote count: 0
has comment: http://stackoverflow.com/comment/32045010
has comment: http://stackoverflow.com/comment/32042446
has comment: http://stackoverflow.com/comment/32042199
has comment: http://stackoverflow.com/comment/32043349
has comment: http://stackoverflow.com/comment/32045011
has comment: http://stackoverflow.com/comment/32040675
has comment: http://stackoverflow.com/comment/32042368
score: 4
has comment: http://stackoverflow.com/comment/32038577
accepted answer of: http://stackoverflow.com/q/21262768
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21262768
has comment: http://stackoverflow.com/comment/32043116
has comment: http://stackoverflow.com/comment/32043371
has comment: http://stackoverflow.com/comment/32043005
has comment: http://stackoverflow.com/comment/32042951

http://stackoverflow.com/q/21225151
type: Question
has comment: http://stackoverflow.com/comment/31969717
linked to: http://stackoverflow.com/q/9436219
has comment: http://stackoverflow.com/comment/31969275
accepted answer: http://stackoverflow.com/a/21243000
tagged with: jcreator
has title: Why can't I use JavaFX in JCreator?
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21243000
has body: I'm currently using JCreator 5.0 and JDK 1.7.0_51. I haven't had any issues when coding, and this time I decided to adventure myself in the realms of JavaFX, but it seems I can't reach any of its content. Here's the error I get when I press the "Build File" button: H:\Tareas\Projects\Test\Test1.java:1: error: package javafx.stage does not exist import javafx.stage.*; ^ 1 error So, my questions are: Is there something I'm doing wrong? Am I missing something? I actually haven't coded anything yet, it just seems the import is not working. This is the code so far, by the way, irrelevant I guess: import javafx.stage.*; public class Test1 { public Test1() { } } Thanks in advance!! By the way, javafx.stage.* is not the only thing that gets me errors, in general, anything coming from javafx.* does the same :C, even "javafx.*" itself, I'm just using that as an example. Cheers! edit: I solved it now! and I did it thanks to @MadProgrammer, after reading the thread he provided me! Thanks very much =) it was so simple! So what I found after reading the thread is that I needed to tell JCreator that such package existed, so I went through these steps in JCreator: went to "Configure" menu then 'Options" then selected "JDK Profiles" in the left menu then selected my "JDK version 1.7.0_51" profile then clicked the "Edit..." button then in the "Classes" tab clicked the "Add" button then selected "Add Archive" then went to my "C:\Program Files\Java\jdk1.7.0_51\jre\lib" folder to select "jfxrt.jar" and finally opened it, click in "Ok", "Ok", et c. and volia! no more errors! Too long, didn't read: added "jfxrt.jar" to my JDK Profile in JCreator Options =) Thanks very much! I will be posting this as an answer soon, I just have to wait a couple hours due to having not enough reputation points, cheers everyone!
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: javafx
upvote count: 1
tagged with: import

http://stackoverflow.com/a/21341433
upvote count: 3
has body: You can use sys.byteorder: &gt;&gt;&gt; import sys &gt;&gt;&gt; print sys.byteorder 'little' Or you can get endianness by yourself with a little help of the built-in struct module: import struct def is_little(): packed = struct.pack("i", 1) return packed[0] == "\x01"; print is_little() That was all Python of course.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21341325
score: 3

http://stackoverflow.com/comment/31969508
comment on: http://stackoverflow.com/a/21223701
has text: @SuzanCioc - If you have time to spend on this kind of thing, take a look at "orthogonal persistence". It is a good example a brilliant unifying idea that that was tried, and tried, and tried ... and ultimately given up on. Because it was impractical.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21324649
score: 6
answers question: http://stackoverflow.com/q/21324468
accepted answer of: http://stackoverflow.com/q/21324468
has comment: http://stackoverflow.com/comment/32144491
type: AcceptedAnswer
downvote count: 0
has body: (Edit: a clearer and more correct answer) I believe it is because JODA and Java Date Format is treating "12" in 12-hour presentation differently. One of them treat it as midnight, while the other treat it as noon. Change your input to 2011-06-11T01:00:00Z will prove my hypothesis. It is because, you are creating JODA time using the constructor of DateTime, which in turns parse your String using ISO format, for which use 24-hour format : Default format used by JODA, while the DateFormat you used to construct your Java Date is using hh for hour field, which means 12-hour format. Therefore they interpret "12" differently: 12-hour format treat it as mid-night, while 24-hour treat it as noon. Easiest change is to change the format to yyyy-MM-dd'T'HH:mm:ss'Z' which use 24-hour presentation, then both of them works fine.
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/32144724

http://stackoverflow.com/q/21230486
has comment: http://stackoverflow.com/comment/31982466
has comment: http://stackoverflow.com/comment/35512907
answer count: 0
tagged with: java
type: Question
has title: how to retrieve blob Object from sqlite in Blackberry java
score: 0
tagged with: sqlite
has body: I am, retrieving blob objects which is in db, While retrieving in the second time, I am getting error as java.lang.ArrayIndexOutOfBoundsException: Row index 1 out of valid range Code which i am using as below d = DatabaseFactory.open(myURI); st = d.createStatement(queryStatement); st.prepare(); net.rim.device.api.database.Cursor c = st.getCursor(); Vector list = new Vector(); Row r; int i = 0; System.out.println("C Value is &gt;&gt;&gt;&gt;&gt;"+c.getPosition()); while (c.next()) { System.out.println("Row Count &gt;&gt;&gt;&gt;&gt; "+i); Row row = c.getRow(); is= row.getBlobStream(i);//this is place I am getting error byteArray.reset(); is.reset(); } Is this wrong way of invocation?
type: UnansweredQuestion
tagged with: blackberry-jde

server-sent-events
tags question: http://stackoverflow.com/q/21343683
tag name: server-sent-events
type: Tag

http://stackoverflow.com/comment/32166691
comment on: http://stackoverflow.com/q/21320893
has text: Glad you found it! I ran same query on Oracle with Locate() instead of charindex which worked fine.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21318396
downvote count: 0
favorite count: 0
has body: I have a program that searches an array of 10 elements for a target from the beginning of the array to the end of the array and then from the end of the array to the beginning of the array. Each time the program is run the array of Strings is shuffled. I'm clocking the time it takes to find the target for both searches. What I'm finding is that the search from the end of the array to the beginning is always fastest, even if the target is located at the 0 position in the array. Can someone explain why this is happening? Here is my program: public class LinearStringSearch { // Array filled with random Strings String[] randomStrings = {"apple", "yellow", "fire", "wood", "zinc", "ram", "mouse", "fish", "cheese", "dirt"}; // Save target arguments for global access(console printing purposes) String target; String target2; long startTime; long startTime2; long estimatedTime; long estimatedTime2; /** * * @param target - the item you want to retrieve from array * @param sa - the name of the array * @return i - the target, otherwise return error code: -1 */ int linearStringSearch(String target, String[] sa) { this.target = target; // set class variable for print access shuffleArray(sa); startTime = System.nanoTime(); // Start speed test for(int i = 0; i &lt; sa.length; ++i) { //System.out.println("Searching array position: " + i); // Comment out for more accuracy if (sa[i].equals(target)) { estimatedTime = System.nanoTime() - startTime; // End speed test System.out.println("The target " + "'" + target + // Print target/index to console "'" + " found at array index: "+ i); System.out.println("Estimated search time in " + // Print estimated time "nanoseconds: " + estimatedTime); return i; // return the index of target } } return -1; // -1 means that target was not found } /** * * @param target - the item you want to retrieve from array * @param sa - the name of the array * @return i - the target, otherwise return error code: -1 */ int backwardLinearStringSearch(String target, S…
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/504103
score: 2
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/32133764
has comment: http://stackoverflow.com/comment/32133447
has comment: http://stackoverflow.com/comment/32135706
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/32133446
tagged with: java
has comment: http://stackoverflow.com/comment/32133622
has comment: http://stackoverflow.com/comment/32133788
has title: Need help understanding the results of my running time tests for simple array search
has comment: http://stackoverflow.com/comment/32133753

http://stackoverflow.com/comment/32049801
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21270274
has text: Aside from using reference equality to test a string (use `.equals()`), the two terms are mutually exclusive.
type: Comment

http://stackoverflow.com/a/21246725
has body: Try adding this line to onCreate method of your Overlay class dPanel.setActivity(this); And implementing setActivity() in the drawingPanel class like this: public void setActivity(Activity overlayActivity) { mActivity = overlayActivity; } This way, you can use mActivity to reference your Activity and call public methods to "hide/show the action bar", like: mActivity.getActionBar().hide(); and, mActivity.getActionBar().show();
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21246481
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/32009845
score: 1
accepted answer of: http://stackoverflow.com/q/21246481
has comment: http://stackoverflow.com/comment/32008032

http://stackoverflow.com/comment/32057118
has text: @JqueryLearner I am confusing that the idea i said above okay or should i try by using 4 variables and then compares? thanks for your help
comment on: http://stackoverflow.com/q/21274862
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32255518
type: Comment
has text: The 'Job still running' message comes from the Job Manager and that only looks at Job threads. Other non-daemon threads might stop the shutdown from finishing until they exit but they won't generate this message.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21287126

http://stackoverflow.com/a/21263581
upvote count: 1
score: 1
has body: Your constructor calls two methods: super(str) and start(). The first method is the constructor of the superclass, so Thread(String) which creates a new Thread object with the given string as name. The second method, start(), actually creates and starts a new thread. In this new thread, the run() method is called (similar to main() of the entire program, but for a thread). This method then calls s.show(Thread.currentThread().getName(),10);. Since you set the thread name to the given string str, Thread.currentThread().getName() returns that same string.
downvote count: 0
answers question: http://stackoverflow.com/q/21263321
type: Answer

http://stackoverflow.com/comment/32176631
type: Comment
has text: Also, note that your `NetChange` method will throw exception if the array contains 0 or 1 elements. So make sure you don't run it on such arrays.
type: AnswerComment
comment on: http://stackoverflow.com/a/21341997
score: 0

http://stackoverflow.com/comment/32107554
type: Comment
comment on: http://stackoverflow.com/q/21303448
score: 0
type: QuestionComment
has text: Do you know any of this tool ? If possible, it would be nice if they have a java API, as I could integrate them nicely into gradle.

http://stackoverflow.com/a/21445999
answers question: http://stackoverflow.com/q/21278160
has body: You should have it after your datatable init code - otherwise it might get called before the table is initialized, resulting in an error. Normally you'll initialize the datatable from a $(document).ready function, to ensure everything needed has been loaded. Set up the window resize handler after that.
score: 0
type: Answer

http://stackoverflow.com/a/21201350
score: 1
accepted answer of: http://stackoverflow.com/q/21201113
answers question: http://stackoverflow.com/q/21201113
upvote count: 1
type: AcceptedAnswer
has body: buttonRem = findViewById(R.id.buttonRem); buttonRem.setOnClickListener(this); Above is getting called before inflation of the layout. Remove this from onCreate Move this to: public void onClick(View v) { switch(v.getId()){ case (R.id.button1): RelativeLayout rootLayout = (RelativeLayout)findViewById(R.id.main_layout); //use layout inflater to create 'spinnerNew' on the fly final LayoutInflater spnInflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); spinnerNew = (Spinner)spnInflater.inflate(R.layout.extra_spinner, null); rootLayout.addView(spinnerNew); //move the dynamic spinner to different position RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)spinnerNew.getLayoutParams(); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); params.addRule(RelativeLayout.BELOW, R.id.spinner1); spinnerNew.setLayoutParams(params); //causes layout update //use layout inflater to create 'remove button' on the fly final LayoutInflater btnInflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); buttonRem = (Button)btnInflater.inflate(R.layout.btn_remove, null); rootLayout.addView(buttonRem); //move the dynamic button to different position RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams)buttonRem.getLayoutParams(); params1.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); params1.addRule(RelativeLayout.ALIGN_BOTTOM, R.id.spinnerNew); buttonRem.setLayoutParams(params1); buttonRem.setOnClickListener(this);//&lt;-------------set onclick here break; case(R.id.buttonRem): //spinnerNew.setVisibility(View.GONE); //does nothing //buttonRem.setVisibility(View.GONE);//does nothing ViewGroup layout = (ViewGroup) spinnerNew.getParent(); if(null!=layout) layout.removeView(spinnerNew);//does nothing break; } }
type: Answer
downvote count: 0

http://stackoverflow.com/a/21246862
upvote count: 6
score: 6
has comment: http://stackoverflow.com/comment/32007748
answers question: http://stackoverflow.com/q/21246813
downvote count: 0
has body: Using a List&lt;Byte&gt; will box every byte into a separate object instance. In bulk, that is one of the worst possible things you can do for performance. By contrast, an array or string can occupy a solid block of memory. Instead, you should use ByteArrayOutputStream, or use byte[] directly and resize as needed (you can make a wrapper class for that)
type: Answer

http://stackoverflow.com/comment/31924963
type: Comment
comment on: http://stackoverflow.com/a/21200531
has text: This is a good idea in some cases. I would choose, however, to go with a non-reflection version.
type: AnswerComment
score: 0

http://stackoverflow.com/q/21224062
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/21224180
accepted answer: http://stackoverflow.com/a/21224180
favorite count: 0
linked to: http://stackoverflow.com/q/16497799
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: classpath
type: Question
has title: mongo-java-driver-2.9.3.jar doesnt include MongoClient
tagged with: mongodb
has comment: http://stackoverflow.com/comment/31966976
has body: I have a small java project and I would like to use mongo-java-driver in order to connect to my mongoDB . I download the latest mongo-java-driver from MongoDB site (mongo-java-driver-2.9.3.jar) (from here:http://central.maven.org/maven2/org/mongodb/mongo-java-driver/2.9.3/ but it seems that MongoClient isnt in the JAR file. Any idea?

http://stackoverflow.com/a/21313587
has body: Maybe java generics can help you with this. You can do something like: class YourClass&lt;E&gt; { void getAnAttributeOfAClass(E attr_as_arg){ // some code } } someVariable = new YourClass&lt;Person&gt;(); someVariable.getAnAtributeOfAClass(someObject); //this will not compile if someObject is not an instance of Person But I still don't know what you want to do exactly inside the method.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21311210

http://stackoverflow.com/q/21325231
has answer: http://stackoverflow.com/a/21326614
has comment: http://stackoverflow.com/comment/32145451
has title: Why not Constructor in Anonymous class in Java? It's contradicting OOP's rule
favorite count: 0
answer count: 6
tagged with: constructor
has comment: http://stackoverflow.com/comment/32145599
has comment: http://stackoverflow.com/comment/32145434
downvote count: 1
has answer: http://stackoverflow.com/a/21325307
has answer: http://stackoverflow.com/a/21325360
tagged with: oop
has body: The OOP's rule is "No class can exist without constructor". Its' ok. But in Java Anonymous class can never have its constructor, because it does not have any name. So it is contradicting OOP's rule. I'm really confused. Is it breaking OOP's rule?
tagged with: java
has answer: http://stackoverflow.com/a/21325299
upvote count: 4
has answer: http://stackoverflow.com/a/21325359
type: UnansweredQuestion
tagged with: anonymous-class
has answer: http://stackoverflow.com/a/21325340
type: Question
has comment: http://stackoverflow.com/comment/32145424
score: 3

http://stackoverflow.com/q/21240305
has comment: http://stackoverflow.com/comment/31996392
has title: Get nearby BSSID and signal strength in Java
answer count: 1
tagged with: wifi
score: 0
has answer: http://stackoverflow.com/a/23744338
has comment: http://stackoverflow.com/comment/31996047
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31996185
has comment: http://stackoverflow.com/comment/31996325
type: Question
tagged with: bssid
tagged with: java
has body: I need to get nearby BSSID's with their signal strength using Java. Something like the output of netsh wlan show networks mode=BSSID. Is it possible?

http://stackoverflow.com/comment/31946567
type: AnswerComment
has text: Actually there is a bug in this. Consider the following: "Foo f = newBuilder().a(4).a(5).c(34).build()".
type: Comment
comment on: http://stackoverflow.com/a/21212139
score: 0

http://stackoverflow.com/a/21202197
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21202171
has comment: http://stackoverflow.com/comment/31927642
has comment: http://stackoverflow.com/comment/31927850
has body: You better do not rely on extensions. Find the mime type of the file. See this SO question: Getting A File&#39;s Mime Type In Java You must read the mime type with Files.probeContentType(path). More relevant information on mime types
has comment: http://stackoverflow.com/comment/31927695
downvote count: 0
has comment: http://stackoverflow.com/comment/73586455
score: 1

http://stackoverflow.com/a/21294907
score: -1
downvote count: 1
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/21294570
has body: For Enabling JMX in Hibernate, EhCache, Quartz, DBCP and Spring Kindly refer the http://nurkiewicz.blogspot.com/2011/12/enabling-jmx-in-hibernate-ehcache-qurtz.html

http://stackoverflow.com/a/21279145
downvote count: 0
has comment: http://stackoverflow.com/comment/32065945
has comment: http://stackoverflow.com/comment/32107602
has comment: http://stackoverflow.com/comment/32063756
has comment: http://stackoverflow.com/comment/32063679
answers question: http://stackoverflow.com/q/21279086
upvote count: 2
has comment: http://stackoverflow.com/comment/32063641
has body: There's no need for you to use AWT in this day and age, unless you can come up with a good reason. You're obviously reading outdated (or just plain horrible) examples on the web, if there's something like frame.show() involved.
type: Answer
score: 2

http://stackoverflow.com/q/21235472
has answer: http://stackoverflow.com/a/36985695
answer count: 5
tagged with: spring
upvote count: 4
has comment: http://stackoverflow.com/comment/31991575
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25982801
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has title: HTTP Status 406. Spring MVC 4.0, jQuery, JSON
has body: I want to send JSON from my controller. I have the following configuration. spring-servlet.xml : <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <mvc:annotation-driven/> <mvc:resources mapping="/resources/**" location="/resources/"/> <context:component-scan base-package="com.castle.controllers"/> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/views/"/> <property name="suffix" value=".jsp"/> </beans> .js : function testAjax() { var data = {userName: "MyUsername", password:"Password"}; $.ajax({ url: 'ajax/test.htm', dataType : 'json', type : 'POST', contentType: "application/json", data: JSON.stringify(data), success: function(response){ alert('Load was performed.'); } }); } UserTest.java: public class UserTest { private String userName; private String password; public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } TestAjaxController.java : @Controller @RequestMapping("/ajax") public class TestAjaxController { @RequestMapping(method = RequestMethod.POST, value = "/test.htm") public @ResponseBody UserTest testAjaxRequest(@RequestBody UserTest user) { return user; } } pom.xml : org.codehaus.jackson jackson-mapper-asl 1.9.13 org.codehaus.jackson jackson-core-asl 1.9.13 …
tagged with: jquery
score: 4
has answer: http://stackoverflow.com/a/21238072
has answer: http://stackoverflow.com/a/29857082
has answer: http://stackoverflow.com/a/21236862
accepted answer: http://stackoverflow.com/a/21236862
possible better answer: http://stackoverflow.com/a/29857082
favorite count: 0

http://stackoverflow.com/comment/31958094
has text: `Helper class` is normal java class or extending Activity? if normal class then you also need to add one more Activity context parameter to `setPositionToView`. then use activity context to initialize stateTv TextView instance
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21219314
type: QuestionComment

http://stackoverflow.com/a/21277551
upvote count: 1
has body: The normal java way, from mwithin the controller itself probably won;t work as spring creates a proxy of the original class : String className = this.getClass().getSimpleName(); I think you need to implement a request mapping handler
answers question: http://stackoverflow.com/q/21277512
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32061592
has comment: http://stackoverflow.com/comment/32061450
score: 1

http://stackoverflow.com/comment/32106249
type: AnswerComment
comment on: http://stackoverflow.com/a/21282346
type: Comment
has text: basically i m not reading image from file, but converted thur a bytearray. Anyway I manage to get the size of the image working thanks.
score: 0

http://stackoverflow.com/comment/31940373
type: AnswerComment
has text: Haha probably, as I wrote above "The button doesnt calculate the inputs, do you know whats the matter there?"
type: Comment
comment on: http://stackoverflow.com/a/21209062
score: 0

http://stackoverflow.com/q/21218984
type: Question
tagged with: jasper-reports
has body: There is some trouble with the property "On Error type" for the images on subreports? This works fine when the image it's placed on the principal report, i send it a String null or "" and puts blank or icon. But doesn't works when I place the image on subreports, throws JRException: Image read failed ArrayList dataHeaderNoSubreport = new ArrayList(); dataHeaderNoSubreport.add(new ppalReport("")); //has an attribute called imageUrl, this works if i don´t send parameters in fill report ArrayList dataHeader = new ArrayList(); dataHeader.add(new Header("")); //subreport, param image url Map parameters = new HashpMap(); parameters.put("subreportHeader", new JRBeanCollectionDataSource(dataHeader)); ... JRBeanCollectionDataSource dataReport = new JRBeanCollectionDataSource(dataHeaderNoSubreport); JasperReport report = (JasperReport) JRLoader.loadObject("principal.jasper"); //contains a field called imageUrl and the subreport JasperPrint jasperPrint = JasperFillManager.fillReport(report, parameters, dataReport);
has comment: http://stackoverflow.com/comment/31958273
score: 0
has comment: http://stackoverflow.com/comment/31957536
has title: property On Error type for images on subreport doesn't works?
has comment: http://stackoverflow.com/comment/31958544
tagged with: subreport
type: UnansweredQuestion
answer count: 0
tagged with: java
tagged with: image

messageformat
tags question: http://stackoverflow.com/q/21303628
type: Tag
tag name: messageformat

http://stackoverflow.com/q/21299231
tagged with: python
has answer: http://stackoverflow.com/a/21299271
answer count: 1
downvote count: 1
tagged with: java
tagged with: whitespace
accepted answer: http://stackoverflow.com/a/21299271
has comment: http://stackoverflow.com/comment/32099639
type: Question
type: AnsweredQuestion
has body: I'm writing server-client project. The server side is being developed in Java, and the client side in Python. Recently when I try to send a string over the socket, the server gets it with white spaces in it. Let's say I send: 1:user:password in the server side I use a string split to convert this one string into 3, the first string (in this case "1") will tell the server what to do with the rest (the username and the password). Now the problem is that when I print what I get from the socket in the server side I get something like this: 1 : u s e r : p a s s w o r d with white spaces between every character. I tried to use the String function replaceAll("\\s","") and replaceAll("\\s+","") but they didn't seem to work. The I used replaceAll("\\S","k") with a capital S, and realized that it actually showed me: kkkkkkkkkkkkkkkkkkkkkkkkkkkkk So I got to the conclusion that those "white spaces" aren't really white spaces, because the \\S replaces "anything that isn't a space character (including both letters and numbers, as well as punctuation etc)". My question is: What are those blanks, and how can I get rid of them? Thanks in advance. Sorry for the long post.
score: 1
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/32099474
has title: How can I get rid of "white spaces"
upvote count: 2
has comment: http://stackoverflow.com/comment/32099540
tagged with: sockets

http://stackoverflow.com/a/21300917
answers question: http://stackoverflow.com/q/21300132
has body: try like this int index = -1; boolean found = false; for(int i = 0; i &lt; array.length; i++) { if(array[i].equalsIgnoreCase(userInput)) { index = i; found = true; break; } }
score: 0
type: Answer

junit
type: Tag
tags question: http://stackoverflow.com/q/21316985
tags question: http://stackoverflow.com/q/21288645
tags question: http://stackoverflow.com/q/21286593
tags question: http://stackoverflow.com/q/21226985
tags question: http://stackoverflow.com/q/21262768
tags question: http://stackoverflow.com/q/21219942
tags question: http://stackoverflow.com/q/21260961
tags question: http://stackoverflow.com/q/21328734
tags question: http://stackoverflow.com/q/21198551
tags question: http://stackoverflow.com/q/21203430
tag name: junit
tags question: http://stackoverflow.com/q/21301868
tags question: http://stackoverflow.com/q/21314239
tags question: http://stackoverflow.com/q/21195450
tags question: http://stackoverflow.com/q/21284859
tags question: http://stackoverflow.com/q/21188271
tags question: http://stackoverflow.com/q/21258220
tags question: http://stackoverflow.com/q/21260364
tags question: http://stackoverflow.com/q/21335205
tags question: http://stackoverflow.com/q/21189870
tags question: http://stackoverflow.com/q/21244953
tags question: http://stackoverflow.com/q/21281071
tags question: http://stackoverflow.com/q/21325924
tags question: http://stackoverflow.com/q/21202576
tags question: http://stackoverflow.com/q/21190019
tags question: http://stackoverflow.com/q/21323943
tags question: http://stackoverflow.com/q/21329288
tags question: http://stackoverflow.com/q/21342981
tags question: http://stackoverflow.com/q/21230256
tags question: http://stackoverflow.com/q/21228625
tags question: http://stackoverflow.com/q/21295505
tags question: http://stackoverflow.com/q/21281288
tags question: http://stackoverflow.com/q/21334078
tags question: http://stackoverflow.com/q/21228131
tags question: http://stackoverflow.com/q/21205853
tags question: http://stackoverflow.com/q/21319550

http://stackoverflow.com/a/21243521
has body: You should use the semicolon paths separator (;), as discribed in Setting the classpath document. But you are using colon instead (:). Try to use the following command (copy and paste it): javac -cp /User/JAVA/jar1.jar;/User/JAVA/jar2.jar Helper.java Main.java from your /User/JAVA/MyProject directory. EDIT: All above is for Windows. The problem is in paths themselves.
has comment: http://stackoverflow.com/comment/32002592
upvote count: 1
has comment: http://stackoverflow.com/comment/32001654
has comment: http://stackoverflow.com/comment/32002025
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/32002432
score: 1
has comment: http://stackoverflow.com/comment/32001719
answers question: http://stackoverflow.com/q/21243017
has comment: http://stackoverflow.com/comment/32001819
has comment: http://stackoverflow.com/comment/32004063
has comment: http://stackoverflow.com/comment/32005729
has comment: http://stackoverflow.com/comment/32002213

http://stackoverflow.com/comment/32080286
type: Comment
has text: The system is as old as the library version and I'm not allowed to replace the version of the jar.
type: QuestionComment
comment on: http://stackoverflow.com/q/21288235
score: 0

http://stackoverflow.com/q/21297241
type: Question
has answer: http://stackoverflow.com/a/21297279
has answer: http://stackoverflow.com/a/21297278
score: 0
tagged with: char
answer count: 3
possible better answer: http://stackoverflow.com/a/21297278
accepted answer: http://stackoverflow.com/a/21297279
has comment: http://stackoverflow.com/comment/32095948
has body: I'm trying to write a program for my programming class, and the program is supposed to run like an online shopping store, and so at one point the program is supposed to ask the user if they have a promotional code, and if they put in 'y' for yes, it asks for a six-character promotional code. Criteria for the promotional code is: The third character needs to be a 7 The fifth and sixth characters need to be 'bG.' For some reason, my program doesn't seem to be running properly. It compiles fine, but when it reaches the if statement that checks the promotional code, it always prints out the line that tells you your promotional code is wrong. I even changed it so that the criteria was just that one of the characters in the code needed to be 7, and then entered '777777' as the promotional code, but it still printed out as if the promotional code were wrong. I can't figure out why it isn't running properly. Here's the original code: Scanner pro=new Scanner(System.in); out.println("\nDo you have a promotional code? Enter Y for yes, N for no: "); String pc=pro.nextLine(); char promo=pc.charAt(0); int o=7; switch(promo) { case 'y': case 'Y': Scanner mo=new Scanner(System.in); System.out.println("Please input the six character promotional code here: "); String prm=mo.nextLine(); char code=prm.charAt(2); if(code==7&amp;&amp;prm.substring(4).equals("bG")) { ordp=ordp*.9; System.out.println("\nYou have recieved ten percent off your order! Your order subtotal is now "+ordp+"."); } else { System.out.println("\nYour promotional code is not valid."); } case 'n': case 'N': break; } I apologize for the code block not being formatted correctly. I can't seem to figure out how to format it correctly...sorry! I really did try, and can't get it right, apparently, so I did the best I could. In any case, that's the relevant code. Help is much appreciated.
has title: Program does not run properly
has answer: http://stackoverflow.com/a/21297378
type: AnsweredQuestion
tagged with: if-statement
tagged with: java
has comment: http://stackoverflow.com/comment/32095942
tagged with: switch-statement
has comment: http://stackoverflow.com/comment/32096347

http://stackoverflow.com/q/21254501
score: 0
has body: I have XML parsed data that I am trying to add into a DefaultTableModel. The DefaultTableModel takes in Vectors or Object[] as argument according to the documentation. But when I use a Vector I get this exception : java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Vector This is the class I am using to parse and add into the vector . public class PropXMLParsing { static PropXMLParsing instance = null; private Vector&lt;String&gt; header = new Vector&lt;String&gt;(); private Vector&lt;String&gt; data = new Vector&lt;String&gt;(); public static PropXMLParsing getInstance() { if (instance == null) { instance = new PropXMLParsing(); try { instance.ParserForObjectTypes(); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParserConfigurationException e) { e.printStackTrace(); } } return instance; } public void ParserForObjectTypes() throws SAXException, IOException, ParserConfigurationException { try { FileInputStream file = new FileInputStream(new File( "xmlFiles/CoreDatamodel.xml")); DocumentBuilderFactory builderFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document xmlDocument = builder.parse(file); XPath xPath = XPathFactory.newInstance().newXPath(); String expression = "//prop/*"; NodeList nodeList = (NodeList) xPath.compile(expression).evaluate( xmlDocument, XPathConstants.NODESET); for (int i = 0; i &lt; nodeList.getLength(); i++) { System.out.println(nodeList.item(i).getFirstChild() .getNodeValue()); data.addElement(nodeList.item(i).getFirstChild().getNodeValue()); header.addElement(nodeList.item(i).getFirstChild() .getNodeValue()); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (XPathExpressionException e) { e.printStackTrace(); } } public Vect…
has answer: http://stackoverflow.com/a/21254708
has title: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Vector
tagged with: xpath
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21254617
has comment: http://stackoverflow.com/comment/32020275
type: Question
answer count: 2
tagged with: xml-parsing
tagged with: vector
tagged with: user-interface

http://stackoverflow.com/q/21317603
has comment: http://stackoverflow.com/comment/32132054
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32131925
has title: BlueJ Postgresql driver not found
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32133368
has comment: http://stackoverflow.com/comment/32131833
type: Question
has body: I have created a java application which I would like to connect to a database, below is a snippet of my code Class.forName("org.postgresql.Driver"); String host = "jdbc:postgresql://localhost"; String user = "user"; String password = "password"; con = DriverManager.getConnection(host, user, password); I get the error below when trying to run the application java.lang.ClassNotFoundException: org.postgresql.Driver I am new to the SQL element of Java, I know java programming very well but not the SQL side. I am using BlueJ to create my program and it seems it cannot find the driver for Postgresql, what am I doing wrong? I am new this and only today just trying to create a test program to get a better understanding of how it works and need help with how to get the driver working. Added the driver files from the Postgres website to BlueJ via the method in the comments, restarted BlueJ, the drivers say they are loaded but still get an error saying: No suitable driver found for jdbc:postgresql://localhost
has comment: http://stackoverflow.com/comment/32133631
has comment: http://stackoverflow.com/comment/32132106
tagged with: bluej
has comment: http://stackoverflow.com/comment/32131872
score: 0

http://stackoverflow.com/comment/31979564
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21231279
has text: `null` references have nowhere to point to. `0` length arrays have a place to point to and can be derefrenced without running into `NullPointerException`. See @EvgeniyDorofeev's explanation on "why" of it
type: Comment

http://stackoverflow.com/comment/32074143
type: Comment
has text: Thank you! Thought I tried something like that, but I probably changed other things as well.
comment on: http://stackoverflow.com/a/21285224
type: AnswerComment
score: 0

http://stackoverflow.com/a/21239798
answers question: http://stackoverflow.com/q/21234341
has body: Instead of trying the .toLowerCase() there I used it in the FileReader when it reads the .txt file and it worked i.name = name.toLowerCase(); So in the end my code there was this: static void readFile(ArrayList&lt;Items&gt; list) throws IOException { BufferedReader in = new BufferedReader( new FileReader("input.txt") ); String text; while( (text = in.readLine()) != null ) { if(text.length()==0) break; Scanner line = new Scanner(text); linha.useDelimiter("\\s*:\\s*"); String name = line.next(); int qtt = line.nextInt(); Items i = new Items(); i.name = name.toLowerCase(); i.qtt = qtt; list.add(i); } in.close(); }
accepted answer of: http://stackoverflow.com/q/21234341
upvote count: 1
has comment: http://stackoverflow.com/comment/31996301
has comment: http://stackoverflow.com/comment/31995123
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/a/21244083
answers question: http://stackoverflow.com/q/21241074
score: 4
has body: The answer to your question is: No, there is no way you can interact with Flash from/using Selenium WebDriver. Full stop. I know there are heaps of developers out there need to automated Flash. But this has never been a part of the Selenium project and it will never be added into. You might want to have a wander around Selenium Users group. For projects like flash-selenium and flex-ui-selenium, they are not part of the Selenium project but created by third party, which means they can easily be discontinued due to various reasons. If you have decided to use them, you might end up developing the project itself instead of using it. Furthermore, I'm not aware of such projects compatible with Selenium WebDriver anyway. One other possible solution might be using Sikuli, which is not a Flash automation tool though. It should support automating Flash with its unique image comparison technology. But once again, this has nothing to do with Selenium in any way.
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/21208731
has body: Im trying to make a program to fill out an online login using local string variables. Here is what i have so far: web = (WebView) findViewById(R.id.webview); WebSettings webSettings = web.getSettings(); webSettings.setJavaScriptEnabled(true); web.getSettings().setUserAgentString("Mozilla/5.0 " + "(Windows NT 6.2; " + "WOW64) AppleWebKit/537.31 " + "(KHTML, like Gecko) Chrome/20 " + "Safari/537.31"); web.getSettings().setDefaultZoom(WebSettings.ZoomDensity.CLOSE); web.loadUrl("http://ta.yrdsb.ca/yrdsb/"); web.setWebViewClient(new WebViewClient() { public void onPageFinished(WebView view, String url) { String username="test"; String password="test"; view.loadUrl("javascript:document.getElementById('username').value = '"+username+"';document.getElementById('password').value='"+password+"';"); } }); My problem is that the fields are not being filled in. I think the issue is with the id's, because from what i can see, it seems that the text fields on this particular site do not have an id associated with them. This is what the username field is (there is no id): &lt;input type="text" name="username" size="10" border="0"&gt; So my question is how would i go about doing this without having the ids of the username and password fields, or am i just missing something? Thanks in advance.
accepted answer: http://stackoverflow.com/a/21208757
type: AnsweredQuestion
tagged with: android
type: Question
answer count: 1
has title: Fill text fields in WebView online form without id's
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21208757
tagged with: javascript

http://stackoverflow.com/a/21209332
upvote count: 2
type: Answer
score: 2
has body: Consider the following program: import java.util.ArrayList; public class WordSearch { static char[][] board; static int board_x, board_y; static ArrayList&lt;String&gt; search_words; public static void main(String args[]) { board = new char[][]{ { 's', 't', 'a', 'c', 'k' }, { 'x', 'f', 'l', 'o', 'w' }, { 'x', 'x', 'x', 'v', 'x' }, { 'x', 'x', 'x', 'e', 'x' }, { 'x', 'x', 'x', 'r', 'x' }, }; // You could also get these from board.size, etc board_x = 5; board_y = 5; search_words = new ArrayList&lt;String&gt;(); search_words.add("stack"); search_words.add("over"); search_words.add("flow"); search_words.add("not"); for(String word : search_words){ find(word); } } public static void find(String word) { // Search for the word laid out horizontally for(int r=0; r&lt;board_y; r++){ for(int c=0; c&lt;=(board_x - word.length()); c++){ // The pair (r,c) will always be where we start checking from boolean match = true; for(int i=0; i&lt;word.length(); i++){ if(board[r][c + i] != word.charAt(i)){ match = false; System.out.format(" '%s' not found starting at (%d,%d) -- first failure at %d\n", word, r, c, i); break; } } if(match){ System.out.format("Found match (horizontal) for '%s' starting at (%d,%d)\n", word, r, c); } } } } } The board is a 2-dimensional char array and the list of words you're searching for is an ArrayList called search_words. After some simple sample initialization of the board and the search_words list, it iterates through the words in the list, searching for each if it lies horizontally. This idea could be extended to search vertically or diagonally as well with some tweaks. The logic here is what you should take away from the sample program, not necessarily the structure. If I were doing this for anything serious, I'd probably have a Board class, probably with a .find(word) method. Finally, the verbose output is: Found match (horizontal) for 'stack' starting at (0,0) 'stack' not found starting at (1,0) -- first failure at 0 'stack' not found starting at (2,…
downvote count: 0
answers question: http://stackoverflow.com/q/21208997

http://stackoverflow.com/q/21340941
has comment: http://stackoverflow.com/comment/32174231
has comment: http://stackoverflow.com/comment/32174904
tagged with: jbutton
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21342014
has comment: http://stackoverflow.com/comment/32174665
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32174074
has answer: http://stackoverflow.com/a/21342028
has comment: http://stackoverflow.com/comment/32174930
tagged with: jtable
score: 0
accepted answer: http://stackoverflow.com/a/21342014
has title: JButton + radiobox + checkbox
possible better answer: http://stackoverflow.com/a/21342028
has comment: http://stackoverflow.com/comment/32175076
has comment: http://stackoverflow.com/comment/32173911
has comment: http://stackoverflow.com/comment/32174313
has body: I'd like this program I have to have some kind of "sum" button which will add in the column "Description" summarised information about the movie. Lets say I have "die hard" as a title, age 7 from radiobutton, and horror selected from the checkbox. Pressin the button would put "Die hard, 7, horror" under the column. I have no idea how to aproach this case. package naplety.Swing; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.DefaultListModel; import javax.swing.JButton; import javax.swing.JCheckBoxMenuItem; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.ListModel; import javax.swing.SwingUtilities; import javax.swing.table.DefaultTableModel; import javax.swing.JCheckBox; public class SamodzielnaListaOsob extends JFrame implements ActionListener { JButton dodaj, erease; JTextField film; DefaultListModel&lt;String&gt; listFilm; DefaultTableModel tableFilm; public SamodzielnaListaOsob(String title) { super(title); setDefaultCloseOperation(EXIT_ON_CLOSE); final JTextField film = new JTextField("Wpisz tytul filmu", 10); film.setBorder(BorderFactory.createTitledBorder("Film")); JPanel p1 = new JPanel(); p1.add(film); JButton dodaj = new JButton("Add to list"); dodaj.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String nowyFilm = film.getText(); if (nowyFilm != "") { listFilm.addElement(nowyFilm); film.setText(""); } } }); JButton erease = new JButton("Clear"); erease.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { film.setText(""); } }); JButton dodajDoTabeli = new JButton("Add to tabl…
tagged with: swing
has comment: http://stackoverflow.com/comment/32174410

http://stackoverflow.com/q/21281591
accepted answer: http://stackoverflow.com/a/21281849
tagged with: java
tagged with: multiple-insert
tagged with: queue
type: Question
has answer: http://stackoverflow.com/a/21281849
tagged with: fifo
has comment: http://stackoverflow.com/comment/32067662
score: 0
answer count: 1
tagged with: synchronized
has title: syncronized(this) is not working?
has body: Need to create a multiple user application in java with multiple insert at a time so i tried to maintain a queue using synchronized (this) in my program but it is not up to the mark. which will be the better option than synchronized. any help in this will be appreciated.
has comment: http://stackoverflow.com/comment/32067936
type: AnsweredQuestion

http://stackoverflow.com/q/21304431
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32108520
possible better answer: http://stackoverflow.com/a/21304596
has title: Is it possible to call the constructor of a class in another class?
tagged with: constructor
has answer: http://stackoverflow.com/a/21304491
has body: If i have two classes in differents files,not in the same file, and in particular, not connected by inheritance. public class Hello{ Hello(){ System.out.println("HELLO"); } } public class GoodBye{ GoodBye(){ Hello.Hello(); } public static void main(String arg[]) { new GoodBye(); } }
has comment: http://stackoverflow.com/comment/32108356
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21304491
has answer: http://stackoverflow.com/a/21304596

http://stackoverflow.com/q/21266547
has answer: http://stackoverflow.com/a/21266597
type: Question
upvote count: 5
has answer: http://stackoverflow.com/a/21266679
has title: for loop to print the integer array in reverse
has comment: http://stackoverflow.com/comment/32041620
tagged with: arrays
has answer: http://stackoverflow.com/a/21266646
has comment: http://stackoverflow.com/comment/32041562
has body: I am writing a program for creating a for loop to print the integer array in reverse order. public class RevIntArray { public static void main(String[] args) { int var[]=new int[3]; int i; for(i = -3; i &gt; -3; i++) { System.out.println(i); } } } I am not receiving any results. Can someone provide a simple solution to this?
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21266680
answer count: 4
has comment: http://stackoverflow.com/comment/32041608
linked to: http://stackoverflow.com/q/24206036
score: 2
tagged with: java
downvote count: 3
duplicate of: http://stackoverflow.com/q/24206036

http://stackoverflow.com/a/21325039
has body: While creating a table the column should be mentioned as date(have to make sure column name is NOT DATE) ex : create table abc(dataentrydate Date not null); and for retrieving the records based on date this below query can be used SELECT * FROM abc WHERE dateentrydate BETWEEN '17-01-2014' AND '22-01-2014' ORDER BY dateentrydate; Thanks a lot for the response and help provided.
score: 0
answers question: http://stackoverflow.com/q/21310660
type: Answer

http://stackoverflow.com/comment/32146237
score: 0
comment on: http://stackoverflow.com/q/21189820
has text: This question is NOT about how "qualified this" is used Or what's the purpose of its existence, but about how is "classname.this" being internally resolved to the enclosing object reference?i.e , usually classname.this should mean something which is being retrieved out of the class definition and hence , it shouldn't conceptually work for objects ; unless made to work that way
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21238950
answers question: http://stackoverflow.com/q/21238792
type: Answer
has body: The problem is you're not changing the ball's position when it intersects the paddle, you're just reversing the x velocity. So, if the ball intersects with a paddle deeply, x velocity is infinitely flipped between positive and negative. Try tracking the ball's previous position on each tick. Upon collision, set the ball's position to its last position, and reverse x velocity. This is a quick fix for your problems. A more realistic physics system would calculate the new position after collision more precisely, but this is good enough for low velocities, especially as you're not scaling by time.
score: 5
upvote count: 5
downvote count: 0

http://stackoverflow.com/comment/31955704
has text: Please re-read the link. Your minimal example should in fact be **minimal** and not have any irrelevant code unrelated to your problem such as logging, or NetBeans generated code. Just create a small GUI by hand coding, one that reproduces your problem and post it.
comment on: http://stackoverflow.com/q/21217368
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32155534
comment on: http://stackoverflow.com/q/21330900
score: 0
type: Comment
type: QuestionComment
has text: i have used ContentNegotiationManagerFactoryBean, i have edited my question too

http://stackoverflow.com/a/21331477
has comment: http://stackoverflow.com/comment/32163969
type: Answer
has comment: http://stackoverflow.com/comment/32219551
has comment: http://stackoverflow.com/comment/32160789
has comment: http://stackoverflow.com/comment/32205198
downvote count: 0
has body: Using a collection of "change events" rather than sending the whole array A solution to this would be to send a serialized object describing the change rather than the actual array all over again. public class ChangePair implements Serializable{ //glorified struct public final int index; public final byte newValue; public ChangePair(int index, byte newValue) { this.index = index; this.newValue = newValue; } public static void main(String[] args){ Collection&lt;ChangePair&gt; changes=new HashSet&lt;ChangePair&gt;(); changes.add(new ChangePair(12,(byte)2)); changes.add(new ChangePair(1206,(byte)3)); } } Generating the "change events" The most efficient method for achieving this would be to track changes as you go, but assuming thats not possible you can just brute force your way through, finding which values are different public static Collection&lt;ChangePair&gt; generateChangeCollection(byte[] oldValues, byte[] newValues){ //validation if (oldValues.length!=newValues.length){ throw new RuntimeException("new and old arrays are differing lengths"); } Collection&lt;ChangePair&gt; changes=new HashSet&lt;ChangePair&gt;(); for(int i=0;i&lt;oldValues.length;i++){ if (oldValues[i]!=newValues[i]){ //generate a change event changes.add(new ChangePair(i,newValues[i])); } } return changes; } Sending and recieving those change events As per this answer regarding sending serialized objects over the internet you could then send your object using the following code Collection&lt;ChangePair&gt; changes=generateChangeCollection(oldValues,newValues); Socket s = new Socket("yourhostname", 1234); ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream()); out.writeObject(objectToSend); out.flush(); On the other end you would recieve the object ServerSocket server = new ServerSocket(1234); Socket s = server.accept(); ObjectInputStream in = new ObjectInputStream(s.getInputStream()); Collection&lt;ChangePair&gt; objectReceived = (Collection&lt;ChangePair&gt;) in.readObject(); //u…
has comment: http://stackoverflow.com/comment/32205176
score: 3
answers question: http://stackoverflow.com/q/21330954
upvote count: 3

http://stackoverflow.com/a/21283854
upvote count: 13
has comment: http://stackoverflow.com/comment/32071809
answers question: http://stackoverflow.com/q/21283633
score: 13
has body: This will work as expected and it will even work on almost all Unicode characters and numbers: public static final int lastAlphaNumeric(String s) { for (int i = s.length() - 1; i &gt;= 0; i--) { char c = s.charAt(i); if (Character.isLetter(c) || Character.isDigit(c)) return i; } return -1; // no alphanumeric character at all } It is also much faster than the other answers ;)
downvote count: 0
type: Answer

http://stackoverflow.com/q/21262768
tagged with: junit
has comment: http://stackoverflow.com/comment/32038659
favorite count: 0
linked to: http://stackoverflow.com/q/10806345
possible better answer: http://stackoverflow.com/a/21266384
has comment: http://stackoverflow.com/comment/32034859
type: AnsweredQuestion
downvote count: 0
score: 1
has title: Spy a method parameter while testing with Mockito?
has comment: http://stackoverflow.com/comment/32034937
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/21264385
accepted answer: http://stackoverflow.com/a/21264385
tagged with: java
has answer: http://stackoverflow.com/a/21266384
has body: Suppose that I have a class like; public class FooBar { public int getMethod(List&lt;String&gt; code){ if(code.size() &gt; 100) throw new Exception; return 0; } } and I have a test class like this; @RunWith(PowerMockRunner.class) @PrepareForTest(FooBar.class) public class FooBarTest{ FooBar fooBarInstance; @Before public void setUp() { //MockitoAnnotations.initMocks(this); fooBarInstance = new FooBar(); } @Test(expected = Exception.class) public void testGetCorrelationListCodesParameter() { List&lt;String&gt; codes = Mockito.spy(new ArrayList&lt;String&gt;()); Mockito.doReturn(150).when(codes).size(); fooBarInstance.getMethod(codes); } } How can I make this test method to throw an exception ? I've dealing for hours to do this. Well thanks anyway.
has comment: http://stackoverflow.com/comment/32037220
answer count: 2
upvote count: 1
tagged with: mockito

http://stackoverflow.com/q/21269356
downvote count: 1
accepted answer: http://stackoverflow.com/a/21269452
has comment: http://stackoverflow.com/comment/32051642
has comment: http://stackoverflow.com/comment/32051598
has body: In order to compute the hamming distance of two strings, they must both have the same length. What can be returned if this kind of algorithmn is implemented in java, if the strings are different lengths?
has comment: http://stackoverflow.com/comment/32051078
has answer: http://stackoverflow.com/a/21269452
has comment: http://stackoverflow.com/comment/32051186
has comment: http://stackoverflow.com/comment/32046977
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32051388
tagged with: algorithm
has comment: http://stackoverflow.com/comment/32051334
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32051118
possible better answer: http://stackoverflow.com/a/21269447
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/21269447
answer count: 2
has comment: http://stackoverflow.com/comment/32046992
tagged with: string
has title: Hamming Distance as integer return of two Strings Java
favorite count: 0
has comment: http://stackoverflow.com/comment/32049173
has comment: http://stackoverflow.com/comment/32051576

http://stackoverflow.com/comment/32084356
has text: no i dont have a book. and will this if statement be done in the drawing panel class?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21290121
score: 0

http://stackoverflow.com/comment/32041539
type: QuestionComment
comment on: http://stackoverflow.com/q/21266527
score: 4
has text: We are not a code debugging service. You should at least tell us what you've tried yourself, so we don't waste OUR time duplicating things YOU should have tried already
type: Comment

http://stackoverflow.com/q/21302784
score: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21302878
tagged with: java
linked to: http://stackoverflow.com/q/1660694
has body: I've already gone through: Regex to match four repeated letters in a string using a Java pattern and Regular expression to match any character being repeated more than 10 times But they aren't useful in my case. They are fine if I just want to check if a string is containing repeated characters (like 1111, abccccd, 12aaaa3b, etc.). What I want is to check if string is comprising entirely of repeated characters only i.e. aabb111, 1111222, 11222aaa, etc. Can anyone help me out with this?
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/21302878
has comment: http://stackoverflow.com/comment/32105790
has comment: http://stackoverflow.com/comment/32105447
has title: What is a regular expression to find if string contains only repeating characters?
downvote count: 0
answer count: 1
tagged with: string
linked to: http://stackoverflow.com/q/2622776
favorite count: 0
has comment: http://stackoverflow.com/comment/32105568
tagged with: regex

web
tags question: http://stackoverflow.com/q/21252105
tags question: http://stackoverflow.com/q/21201946
tags question: http://stackoverflow.com/q/21337477
tags question: http://stackoverflow.com/q/21300388
type: Tag
tags question: http://stackoverflow.com/q/21280257
tags question: http://stackoverflow.com/q/21224571
tags question: http://stackoverflow.com/q/21263528
tags question: http://stackoverflow.com/q/21316869
tag name: web
tags question: http://stackoverflow.com/q/21345607
tags question: http://stackoverflow.com/q/21195555
tags question: http://stackoverflow.com/q/21329846

http://stackoverflow.com/comment/32038293
type: Comment
type: QuestionComment
score: 1
has text: Please, always share you code. That tells us what you've tried so far. Besides, this place is full of Geeks (including me) and code helps us understand you problem better.
comment on: http://stackoverflow.com/q/21259989

http://stackoverflow.com/comment/32073124
has text: Hi Tom,I said so in a sense that we cant overload methods based on the type of checked exceptions which are thrown from a method and therefore it must not be a part of method signature ..
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21284253
type: QuestionComment

http://stackoverflow.com/q/21193167
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/21193548
has answer: http://stackoverflow.com/a/21193548
score: -1
answer count: 2
has title: Close ServerSocket in java
has answer: http://stackoverflow.com/a/21193625
upvote count: 0
duplicate of: http://stackoverflow.com/q/9762859
has comment: http://stackoverflow.com/comment/31911914
has comment: http://stackoverflow.com/comment/31911743
favorite count: 0
accepted answer: http://stackoverflow.com/a/21193625
tagged with: sockets
has comment: http://stackoverflow.com/comment/31911836
has body: I have the following program: package testServer; import java.io.IOException; import java.net.*; public class MainClass { public static void main(String[] args) throws IOException { ServerSocket socket = new ServerSocket (8073); socket.close(); } } As you can see i close my socket at the end of the program. However when i relunch my program i get Exception: Exception in thread "main" java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.socketBind(PlainSocketImpl.java:521) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:414) at java.net.ServerSocket.bind(ServerSocket.java:326) at java.net.ServerSocket.&lt;init&gt;(ServerSocket.java:192) at java.net.ServerSocket.&lt;init&gt;(ServerSocket.java:104) at testServer.MainClass.main(MainClass.java:10) why it is happening ? i thought that after calling the close() the port can be reused. I checked by netstatthat this socket is not used anywhere else.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31911579
linked to: http://stackoverflow.com/q/9762859
tagged with: java
has comment: http://stackoverflow.com/comment/31911889

http://stackoverflow.com/comment/32180962
type: AnswerComment
type: Comment
has text: It isn't simple because the entry name forms part of the local file header, which has to be written to the output stream before the compressed data. I suppose if you had a seekable stream as the underlying destination you could conceivably go back and modify the header to change the name to another one but only if the new name is representable in exactly the same number of bytes as the old one...
comment on: http://stackoverflow.com/a/21344757
score: 0

http://stackoverflow.com/q/21219695
downvote count: 0
possible better answer: http://stackoverflow.com/a/21219724
has title: Ternary Operators Java
tagged with: java
has answer: http://stackoverflow.com/a/21219724
score: 17
duplicate of: http://stackoverflow.com/q/25163713
tagged with: conditional-operator
type: Question
has body: Is there a way to implement this in a ternary operation. I'm very new to that ternary stuff, maybe you could guide me. if(selection.toLowerCase().equals("produkt")) cmdCse.setVisible(true); else cmdCse.setVisible(false); This one doesn't seem to work. selection.toLowerCase().equals("produkt")?cmdCse.setVisible(true):cmdCse.setVisible(false);
linked to: http://stackoverflow.com/q/25163713
linked to: http://stackoverflow.com/q/17470595
has answer: http://stackoverflow.com/a/21219746
has answer: http://stackoverflow.com/a/45951011
linked to: http://stackoverflow.com/q/30036183
answer count: 7
upvote count: 17
has answer: http://stackoverflow.com/a/21968201
favorite count: 0
has comment: http://stackoverflow.com/comment/31958848
has answer: http://stackoverflow.com/a/69298532
has answer: http://stackoverflow.com/a/21219722
accepted answer: http://stackoverflow.com/a/21219722
has comment: http://stackoverflow.com/comment/31958908
has answer: http://stackoverflow.com/a/21219747
type: AnsweredQuestion

http://stackoverflow.com/q/21198832
answer count: 2
tagged with: xml-parsing
score: 0
has answer: http://stackoverflow.com/a/69728566
tagged with: http://stackoverflow.com/tag/xml
has title: method getElementsByTagName is undefined for type element
type: UnansweredQuestion
type: Question
tagged with: java
has body: I'm trying to write a Java code for parsing an XML file. I want to retrieve value of all "name" elements inside "function" tag. But when I'm using NodeList nlList = element.getElementsByTagName("name"); there is error "method getElementsByTagName is undefined for type element". this is my XML file sample: Each function tag include multiple "name" elements which I want to use the getTextContent to access the value of these nodes. private boolean canClose <parameter_list>( IEditorReference editorReference )</parameter_list> { <decl_stmt> IEditorPart editor = editorReference . getEditor <argument_list>( false )</argument_list> ;</decl_stmt> if ( editor instanceof IContextAwareEditor ) { return (( IContextAwareEditor ) editor ). canClose <argument_list>()</argument_list> ; } return true ; } This is my code, first I tried to retrieve all of "function" elements and after that I wrote a for loop to find all of "name" elements inside "function" tags. But there is s error ""method getElementsByTagName is undefined for type element" when I used getElementsByTagName method for second time. String name = file.getName(); File fXmlFile = new File(dirPath + name); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(fXmlFile); doc.getDocumentElement().normalize(); NodeList nList = doc.getElementsByTagName("function"); for (int temp = 0; temp < nList.getLength(); temp++) { NodeList nList1 = nList.item(temp).getChildNodes(); Node n = nList1.item(temp); if (n.getNodeType() == Node.ELEMENT_NODE) { Element eElement = (Element) n; NodeList nlList = eElement.getElementsByTagName("name"); } }
has comment: http://stackoverflow.com/comment/31922087
has answer: http://stackoverflow.com/a/21199040

http://stackoverflow.com/comment/79531323
comment on: http://stackoverflow.com/a/34896224
score: 0
type: Comment
has text: Is there a way to only allow an algorithm from a specific source? I should only be allowing this exception for one or two servers that I trust.
type: AnswerComment

http://stackoverflow.com/comment/31946028
type: AnswerComment
has text: Be sure to 'accept' answers that answer your question, as well as upvoting them -- it's part of how StackOverflow works.
comment on: http://stackoverflow.com/a/21211763
type: Comment
score: 1

http://stackoverflow.com/comment/56341628
type: QuestionComment
comment on: http://stackoverflow.com/q/21337698
has text: Maven does not add such thing in build.
score: 0
type: Comment

http://stackoverflow.com/comment/56496428
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24951323
has text: In step 2, "Declare Environment Variable", can you explain in more detail? What environment variable are we declaring?
score: 0

http://stackoverflow.com/comment/32060212
score: 0
comment on: http://stackoverflow.com/a/21275681
type: AnswerComment
type: Comment
has text: unless im forgetting code somewhere, but i dont think i can be bothered sifting through hundreds of lines of code looking for something that may be missing. also the whole project runs perfectly fine, even along side my own

http://stackoverflow.com/a/21293525
score: 0
type: AcceptedAnswer
type: Answer
has body: You can use marginLeft, marginRight, marginTop, and marginBottom for small adjustments. If you want to do larger adjustments you can use blank elements in combination with weights, or use a RelativeLayout in combination with alignParentBottom, alignParentTop, alignParentRight, and/or alignParentLeft
answers question: http://stackoverflow.com/q/21292735
accepted answer of: http://stackoverflow.com/q/21292735

http://stackoverflow.com/comment/32151498
has text: I recon for the ease of reading he used this non working kind of pseudo code. `close(rs)` should also be `rs.close()` and you would need a `null` check in finally and another `try`/`catch` etc.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/21327506
type: AnswerComment

http://stackoverflow.com/comment/32121410
score: 0
has text: Fixed the generated SQL and added more info on the database
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21311507

http://stackoverflow.com/q/21249241
type: UnansweredQuestion
tagged with: java
tagged with: multithreading
tagged with: file
upvote count: 1
has comment: http://stackoverflow.com/comment/32036101
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/9413656
has title: Search completes in specific time
has answer: http://stackoverflow.com/a/21249363
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21250848
has body: I have a code to to search files in specific location. I want to add time bound to stop search . If I say search in 5000 ms, then search has to stop after 5000ms and display the results. Can anyone one suggest the best approach? public class FileSearch { final private int FOLDER=1,FILE=2,BOTH=3; private Pattern pat; private int filter; private List&lt;String&gt; searchList = new ArrayList&lt;String&gt;(); public void setFilter(int filter) { this.filter = filter; } public void setPat(Pattern pat) { this.pat = pat; } private void findFileNames(File file){ File[] list = file.listFiles(); if (list != null) for (File fil : list) { if (fil.isDirectory()) { findFileNames(fil); } else { matchName(fil.getName()); } } } private void findFolderNames(File file){ File[] list = file.listFiles(); if (list != null) for (File fil : list) { if (fil.isDirectory()) { matchName(fil.getName()); findFolderNames( fil); } } } public void findFile(File file) { switch(this.filter){ case FOLDER: findFolderNames(file); break; case FILE: findFileNames(file); break; case BOTH: File[] list = file.listFiles(); if (list != null) for (File fil : list) { if (fil.isDirectory()) { findFolderNames(fil); } else { matchName(fil.getName()); } } findFileNames(file); findFolderNames(file); break; default: break; } } public void startFileSearch() { FileSearch ff = new FileSearch(); Scanner scan = new Scanner(System.in); System.out.println("Enter the file name to be searched (Can use regular expressions).. "); String name = scan.next(); System.out.println("Enter the directory where to search "); String directory = scan.next(); System.out.println("Enter filter (1.FOLDER/2..FILE/3.BOTH) to search "); int filter = scan.nextInt(); ff.setPat(Pattern.compile(name)); ff.setFilter(filter); ff.findFile(new File(directory)); } private void matchName(String fileName){ if (this.pat.matcher(fileName).find()) { System.out.println(fileName); this.searchList.add(fileName); } } }
has comment: http://stackoverflow.com/comment/32012169
favorite count: 0

http://stackoverflow.com/comment/32020443
type: QuestionComment
comment on: http://stackoverflow.com/q/21254465
has text: How do I know if it is?
type: Comment
score: 0

http://stackoverflow.com/comment/31978919
type: Comment
has text: I tested the same scenario on my machine it worked. Please check you must be missing something either html file is not at correct place or name might be not correct.
score: 0
comment on: http://stackoverflow.com/q/21229839
type: QuestionComment

http://stackoverflow.com/a/21234039
answers question: http://stackoverflow.com/q/21232549
type: Answer
has body: favicon You should first use your favorite search engine to find out how "favicon" items are published so that browsers know where to load. You will find more info, but probably the most common way is to place following link in html/head: &lt;link rel="shortcut icon" href="/i_dont_name_it_fav_icon.ico" /&gt; Parsing HTML I'm afraid your idea won't be successful in many cases. Since HTML is not XML, better use jsoup to extract the information you need. Crawling / Loading Pages Before using HttpURLConnection I recommend using a library for loading web resources, because HttpURLConnection is not easy to use. If it's hard to find a good library, check out Apache Http Client. I've implemented a small wrapper over HttpURLConnection: DavidWebb. It's leightweight and easy to use.
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/31950039
score: 0
type: Comment
type: QuestionComment
has text: OK.. I'm still not clear what your actual question is. Because if it is *" Can anybody guide me a bit?"* the question is prime to be closed as ..any of a number of reasons.
comment on: http://stackoverflow.com/q/21214640

http://stackoverflow.com/q/21288971
has comment: http://stackoverflow.com/comment/32083999
score: 0
has comment: http://stackoverflow.com/comment/32082155
tagged with: utf-8
has body: Say we have a main string contains some text which is in UTF-8 and another string which is a word and this will be in UTF-8 format as well.So please help me to do this in Java.Thank you. import java.awt.Component; import java.io.File; import javax.swing.JFileChooser; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; public class Example { private static Component frame; public static void main(String args[]) throws FileNotFoundException, IOException{ JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(frame); //Where frame is the parent component File file = null; if (returnVal == JFileChooser.APPROVE_OPTION) { file = fc.getSelectedFile(); //Now you have your file to do whatever you want to do String str = file.getName(); str = "c:\\" + str; BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(str),"UTF8")); String line; String wordfname = "c:\\word.txt"; BufferedReader innew = new BufferedReader(new InputStreamReader(new FileInputStream(wordfname),"UTF8")); String word; word = innew.readLine(); System.out.println(word); File fileDir = new File("c:\\test.txt"); Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileDir), "UTF8")); while((line = in.readLine()) != null) { System.out.println(line); out.append(line).append("\r\n"); boolean r = line.contains(word); System.out.println(r); } out.flush(); out.close(); System.out.println(str); } else { //User did not choose a valid file } } } Link to the two files are: https://www.dropbox.com/s/4ej0hii6gnlwtga/kannada.txt and https://www.dropbox.com/s/emncfr7bsi8mvwn/word.txt
has comment: http://stackoverflow.com/comment/32083666
has title: (JAVA)Finding a substring in a string which is in UTF-8 encoded format
has comment: http://stackoverflow.com/comment/32081164
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32081491
has answer: http://stackoverflow.com/a/21299644
has comment: http://stackoverflow.com/comment/32099087
has comment: http://stackoverflow.com/comment/32081655
has comment: http://stackoverflow.com/comment/32082641
tagged with: java
has answer: http://stackoverflow.com/a/21290522
tagged with: substring
has comment: http://stackoverflow.com/comment/32081594
type: Question
has comment: http://stackoverflow.com/comment/32080906
answer count: 3
has comment: http://stackoverflow.com/comment/32085435
has answer: http://stackoverflow.com/a/21289119

http://stackoverflow.com/a/21246207
upvote count: 13
has comment: http://stackoverflow.com/comment/32024195
has comment: http://stackoverflow.com/comment/32023815
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21246137
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21246137
has comment: http://stackoverflow.com/comment/32006577
type: Answer
score: 13
has body: Try this code colorpicker.setStyle("-fx-color-label-visible: false ;");

design-patterns
tags question: http://stackoverflow.com/q/21255686
tags question: http://stackoverflow.com/q/21312679
tags question: http://stackoverflow.com/q/21197607
tag name: design-patterns
tags question: http://stackoverflow.com/q/21232112
tags question: http://stackoverflow.com/q/21252105
tags question: http://stackoverflow.com/q/21227596
tags question: http://stackoverflow.com/q/21241020
tags question: http://stackoverflow.com/q/21316076
tags question: http://stackoverflow.com/q/21234671
tags question: http://stackoverflow.com/q/21333363
type: Tag
tags question: http://stackoverflow.com/q/21349350
tags question: http://stackoverflow.com/q/21240801
tags question: http://stackoverflow.com/q/21224152
tags question: http://stackoverflow.com/q/21323889
tags question: http://stackoverflow.com/q/21217472
tags question: http://stackoverflow.com/q/21189361
tags question: http://stackoverflow.com/q/21208729
tags question: http://stackoverflow.com/q/21340316
tags question: http://stackoverflow.com/q/21261077
tags question: http://stackoverflow.com/q/21219702
tags question: http://stackoverflow.com/q/21210870
tags question: http://stackoverflow.com/q/21320921
tags question: http://stackoverflow.com/q/21325777
tags question: http://stackoverflow.com/q/21262961

http://stackoverflow.com/comment/32111091
comment on: http://stackoverflow.com/q/21303448
score: 0
type: Comment
type: QuestionComment
has text: Is code generated by gradle or you have it as part of your project in sources? Do you need to save result of your renaming or you should rename it every build (I mean do you have many flavours of your code)?

http://stackoverflow.com/comment/32049052
has text: please, provide your fxml
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21266694

http://stackoverflow.com/comment/31998168
comment on: http://stackoverflow.com/q/21239839
has text: if you are trying to do something like this: for int i, 1 to 100: JLabel jLabel+i = new instanciation of JLabel class you should look into java reflection
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32096824
type: Comment
type: QuestionComment
has text: This is not a complete function, so the question is impossible to answer. What is the algorithm supposed to do?
comment on: http://stackoverflow.com/q/21297715
score: 0

http://stackoverflow.com/a/21248612
has comment: http://stackoverflow.com/comment/32010901
has comment: http://stackoverflow.com/comment/32010489
upvote count: 1
has comment: http://stackoverflow.com/comment/32010706
has comment: http://stackoverflow.com/comment/32014363
has comment: http://stackoverflow.com/comment/32011163
has comment: http://stackoverflow.com/comment/32010550
has comment: http://stackoverflow.com/comment/32010575
has comment: http://stackoverflow.com/comment/32011053
has comment: http://stackoverflow.com/comment/32010859
has comment: http://stackoverflow.com/comment/32022563
type: Answer
answers question: http://stackoverflow.com/q/21248590
has body: You declare an arraylist of type String but then try to fill it with other non-string entities. You may instead want to create an arraylist of objects: ArrayList&lt;Object&gt; categories = new ArrayList&lt;Object&gt;(); And then you can interact with the classes by referencing them from the arraylist. My response is incorrect, this wouldn't function correctly. If all you need is categories and values, you can just use: ArrayList&lt;ArrayList&lt;String&gt;&gt; categories = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(); Then you can create some more ArrayLists for each category, populate the categories, then add them to the top level ArrayList: ArrayList&lt;String&gt; medical = new ArrayList&lt;String&gt;(); medical.add("one"); medical.add("two"); medical.add("etc"); categories.add(medical);
downvote count: 0
score: 1

http://stackoverflow.com/comment/32188185
comment on: http://stackoverflow.com/q/21348971
type: Comment
score: 1
has text: post the json and how you get make your http request
type: QuestionComment

http://stackoverflow.com/comment/32071975
has text: @TacticalCoder I dont really care if the sequence of numbers 1-6 is in order or not. I just need it to be free from repeated numbers. Btw, I just understand some of the code. Im sorry I only know basics.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21283246
type: Comment

http://stackoverflow.com/comment/31951796
type: QuestionComment
has text: Works like a charm in Java for me too. JDK 1.7. Same version that I'm using for the project in Android, minSDK API level 14.
comment on: http://stackoverflow.com/q/21214972
score: 0
type: Comment

http://stackoverflow.com/q/21215785
type: Question
score: 3
has comment: http://stackoverflow.com/comment/31951934
has answer: http://stackoverflow.com/a/21218110
tagged with: java
has comment: http://stackoverflow.com/comment/31951877
has comment: http://stackoverflow.com/comment/31952179
answer count: 2
downvote count: 0
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/31951759
has answer: http://stackoverflow.com/a/21227573
has title: asterisk letter wrong alignment java
has body: When I view list item with a text aligned to right in Arabic language, wrong formatting occurs. In all Arabic statements, it works fine. [arWord].25.3 but only when the text is * it looks like this. Result : .22.1.* CODE: arabicFormat = String.format(new Locale(Language.Arabic.getCode(), Language.Arabic.getCountry()), "%d.%d.%s",position, (h.getSeq() + 1), navText); Expected: *.22.1 [asterisk at the left] Result : .22.1.* EDIT: The problem appeared also with other characters like ، '.
has comment: http://stackoverflow.com/comment/31951998
upvote count: 3
type: UnansweredQuestion
tagged with: string-formatting
has comment: http://stackoverflow.com/comment/31951776

http://stackoverflow.com/q/21310194
has comment: http://stackoverflow.com/comment/32119417
tagged with: simpledateformat
linked to: http://stackoverflow.com/q/8428313
answer count: 2
has comment: http://stackoverflow.com/comment/32140365
tagged with: sql
has answer: http://stackoverflow.com/a/22664782
has title: Using ~ in SimpleDateFormat#parse()
has answer: http://stackoverflow.com/a/21311077
favorite count: 0
has comment: http://stackoverflow.com/comment/32151860
has comment: http://stackoverflow.com/comment/32119483
possible better answer: http://stackoverflow.com/a/22664782
has comment: http://stackoverflow.com/comment/32119818
has comment: http://stackoverflow.com/comment/32118024
tagged with: date-parsing
has comment: http://stackoverflow.com/comment/32118469
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/32119746
score: 1
has body: The below code is executing without any problems. But logically it seems to be incorrect. Why is it so? import java.sql.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; DateFormat df =new SimpleDateFormat("MM/dd/yyyy"); new Date(df.parse("09/01/3~34").getTime()); // Produces '09/01/3' new Date(df.parse("09/01/100000").getTime()); // Produces ' 000-09-01'
tagged with: java
accepted answer: http://stackoverflow.com/a/21311077
has comment: http://stackoverflow.com/comment/32151902
downvote count: 1
has comment: http://stackoverflow.com/comment/32118370
type: Question
has comment: http://stackoverflow.com/comment/32122062

http://stackoverflow.com/comment/31957161
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21215338
has text: @chrylis If I do remember well,, those libraries (located in rt.jar indeed) are provided with jre because they are required for the runtime. JDK provides tools for compilation, monitoring, javadoc.... in addition of what the jre provides
score: 0

http://stackoverflow.com/q/21275798
accepted answer: http://stackoverflow.com/a/23162741
type: AnsweredQuestion
tagged with: java
tagged with: nfc-p2p
type: Question
has answer: http://stackoverflow.com/a/23162741
tagged with: open-nfc
score: 0
tagged with: smartcard
has body: Hi i got ACR122 USB NFC dongle which read and write the NFC Tag, how can i use USB NFC RW to write the data into NFC tag in NDEF format and MIME code (from PC) which could launch an app when contact a smart phone.I have tried writing tag with Smart Phone in Ndef format but i have doubt in using a external NFC RW to do the same, plz clarify
answer count: 1
tagged with: nfc
has title: JAVA - Writing NFC tag through USB NFC R/W in NDEF format with MIME

http://stackoverflow.com/q/21189820
has comment: http://stackoverflow.com/comment/31905995
has answer: http://stackoverflow.com/a/21189973
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31905237
has comment: http://stackoverflow.com/comment/31905508
has comment: http://stackoverflow.com/comment/31905233
has comment: http://stackoverflow.com/comment/32146200
type: Question
has comment: http://stackoverflow.com/comment/32146237
has comment: http://stackoverflow.com/comment/31905144
tagged with: this
answer count: 1
has comment: http://stackoverflow.com/comment/31905564
has title: Using "this" via class definition?
tagged with: static
has comment: http://stackoverflow.com/comment/31905211
has comment: http://stackoverflow.com/comment/31905250
linked to: http://stackoverflow.com/q/2731719
has comment: http://stackoverflow.com/comment/32151476
favorite count: 0
has comment: http://stackoverflow.com/comment/31905589
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31905371
has body: How does this android Code work - "this" is being referenced in a static way(by the class name) in makeText method. ( 1st Parameter) public class QuizActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { private Button mTrueButton; mTrueButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(QuizActivity.this,R.string.incorrect_toast,Toast.LENGTH_SHORT).show(); } }); } } The question is about how does "qualified this" work and not why does it exist or its purpose, but about how is "classname.this" being internally resolved to the enclosing object reference?Classname.this is usually used and works for static members , it shouldn't conceptually work for member variables like "this"; unless made to work that way
has comment: http://stackoverflow.com/comment/43763084
downvote count: 1

http://stackoverflow.com/comment/32145172
comment on: http://stackoverflow.com/a/21324879
type: AnswerComment
score: 0
type: Comment
has text: +1 Thanks for saying each method call will have it's own call stack

http://stackoverflow.com/comment/32031617
has text: Is there any kind of effect for android intent?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21261101
score: 0

http://stackoverflow.com/comment/47218331
type: Comment
has text: It Worked for me, close IDE, kill adb.exe, unplug the phone and start IDE
type: AnswerComment
comment on: http://stackoverflow.com/a/29519323
score: 0

http://stackoverflow.com/comment/32149474
has text: If it did not solve your issue, why did you change the title of the post to `Struts 2 Action redirect now working`. You should have updated your previous question with the code instead of creating a new one.
comment on: http://stackoverflow.com/q/21326832
type: Comment
type: QuestionComment
score: 1

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/21313035
type: Tag
tags question: http://stackoverflow.com/q/21186512

http://stackoverflow.com/q/21207715
has answer: http://stackoverflow.com/a/21207790
accepted answer: http://stackoverflow.com/a/21207790
downvote count: 0
possible better answer: http://stackoverflow.com/a/21207798
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
has title: Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3139 in java.library.path
tagged with: linux
upvote count: 1
has body: I am making simple java Desktop application using eclipse in Linux. I have added all required libraries in to my class path. but I still getting this error when I run this. Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3139 in java.library.path I was trying to find an answer through Internet but still I can not. Can anybody help me. I am using SWT designer to implement.
has answer: http://stackoverflow.com/a/21207798
linked to: http://stackoverflow.com/q/21069412
favorite count: 0

http://stackoverflow.com/comment/32103355
score: 0
type: QuestionComment
has text: Down voter please explain the reason so that i could ask better
type: Comment
comment on: http://stackoverflow.com/q/21301366

http://stackoverflow.com/a/21295684
has body: My guess would be that the error message means what it says: your schema contains an xs:attribute ref="X" where there is not attribute declaration named X. This could be because of a failure to import the schema or because the namespaces are wrong. But we can't debug your schema without seeing it.
type: Answer
answers question: http://stackoverflow.com/q/21294032
score: 0

http://stackoverflow.com/q/21345965
tagged with: http://stackoverflow.com/tag/json
has body: Working Java, using Gson. The input starts: {"success":1,"return":{ Unfortunately, as you know, you can not create a field/variable named 'return' in Java. So, how does one get around this, as the bulk of the data is behind the 'return' field? This question Serialize JSON object named "return" is related, but the language is C#.
has title: De-serializing JSON object with property named 'return'
has answer: http://stackoverflow.com/a/21345989
score: 0
has answer: http://stackoverflow.com/a/21346001
answer count: 3
possible better answer: http://stackoverflow.com/a/21345989
has answer: http://stackoverflow.com/a/21346000
accepted answer: http://stackoverflow.com/a/21346001
linked to: http://stackoverflow.com/q/14527804
type: AnsweredQuestion
tagged with: java
tagged with: gson
type: Question

http://stackoverflow.com/a/21301093
has comment: http://stackoverflow.com/comment/32102747
has body: You never call Square#draw. Having said that, I would be wary about calling fillBoard every time the paint method is called, in fact I'd discourage you from overriding paint in the first place. What I might do is check to see if sq is null in fillBoard and only generate the array then. Back in the paint method, I would simply use a compound loop and draw each square. Instead of overriding paint of JApplet, you should start with something like JPanel and override it's paintComponent method, make sure you call super.paintComponent! There are a number of reasons you should do this, but the main one here is JApplet is not double buffered, meaning you will get "flashes" as the drawing is updated. JPanel is double buffered by default, saving you a lot of work and time having to implement your own solution... Once you've done this, take custom panel and add it to the applet. I would move all the painting logic to it. Take a look at Performing Custom Painting for more details
has comment: http://stackoverflow.com/comment/32102948
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32102640
type: Answer
has comment: http://stackoverflow.com/comment/32103030
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21300960
answers question: http://stackoverflow.com/q/21300960

http://stackoverflow.com/comment/32136581
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21320108
score: 1
has text: Your code is full of syntax errors. Read the error the compiler is giving you, think about it.

http://stackoverflow.com/a/21217481
has body: My messy solution. I don't know if there are sideeffects. So far no: Rename the old project to XXXXX_OLD Create new Project XXXXX with initial JAVA7 Environment Close Eclipse Copy Content of Folder XXXXX_OLD to XXXXX Start Eclipse. No Compilation Error anymore for my Constructor ZipFile(1,2) I would really like to know the right way. I only gave this solution for probably help other peoples with the same issue. Use this Method on your own RISK! Its messy.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21215338

http://stackoverflow.com/q/21199595
tagged with: jpanel
score: 0
accepted answer: http://stackoverflow.com/a/21199645
has title: Java GUI not showing
possible better answer: http://stackoverflow.com/a/21199649
has answer: http://stackoverflow.com/a/21199649
has body: import java.util.Scanner; import javax.swing.*; @SuppressWarnings("serial") public class Synthetic_Division extends JFrame{ public void init(){ JTextField JTF = new JTextField(); JLabel label = new JLabel(); JPanel panel = new JPanel(); panel.add(label); panel.add(JTF); this.add(panel); } public Synthetic_Division(){ super("Synthetic Division"); this.init(); this.setSize(600, 400); this.setVisible(true); } public static void main(String[] args) { int sol01 = 0, sol12 = 0, sol23 = 0, sol34 = 0, sol45 = 0, cross12 = 0, cross23 = 0, cross34 = 0, cross45 = 0, cross56 = 0, Remainder = 0, Divisor = 0, Number1 = 0, Number2 = 0, Number3 = 0, Number4 = 0, Number5 = 0, Number6 = 0, NumberOfNumbers = 0; System.out.println("Please input the following values accordingly."); System.out.println("1. Numbers in equation (: 4-6 :)"); System.out.println("2. Divisor (: After the sign has been flipped :)"); System.out.println("3. First Number"); System.out.println("4. Second Number"); System.out.println("5. Third Number"); System.out.println("6. Fourth Number"); System.out.println("7. Fifth Number (: If Needed :)"); System.out.println("8. Sixth Number (: If Needed :)"); Scanner in = new Scanner(System.in); NumberOfNumbers = in.nextInt(); Divisor = in.nextInt(); Number1 = in.nextInt(); Number2 = in.nextInt(); Number3 = in.nextInt(); Number4 = in.nextInt(); if (NumberOfNumbers == 5 || NumberOfNumbers == 6) { Number5 = in.nextInt(); } if (NumberOfNumbers == 6) { Number6 = in.nextInt(); } if (NumberOfNumbers == 4) { sol01 = Number1; cross12 = sol01 * Divisor; sol12 = Number2 + cross12; cross23 = sol12 * Divisor; sol23 = Number3 + cross23; cross34 = sol23 * Divisor; Remainder = Number4 + cross34; if (Remainder == 0) { System.out.println(sol01 + " + " + sol12 + " + " + sol23 + " with no remainder! "); } else { System.out.println(sol01 + " + " + sol12 + " + " + sol23 + " with a remainder of: " + Remainder); } } else if (NumberOfNumbers == 5) { sol01 = Number1; cross12 = sol01 * Divisor; sol12 …
has answer: http://stackoverflow.com/a/21199698
has answer: http://stackoverflow.com/a/24875859
answer count: 4
type: AnsweredQuestion
tagged with: jframe
has answer: http://stackoverflow.com/a/21199645
tagged with: swing
tagged with: jtextfield
type: Question
tagged with: java

http://stackoverflow.com/comment/31925596
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21200888
has text: Well, first things first, extend either `Applet` or `JApplet` class.

http://stackoverflow.com/q/21320839
score: 0
answer count: 1
tagged with: url
has answer: http://stackoverflow.com/a/21321065
tagged with: pattern-matching
has body: i have method which can return me to array of links in string, but this work only if link have 'http' or 'www' prefix ( http:// site.com or www.site.com) . and also need to detect links without prefix just site.com Please help me ArrayList retrieveLinks(String text) { ArrayList links = new ArrayList(); String regex = "\\(?\\b(http://|https://|www[.])[-A-Za-z0-9+&amp;@#/%?=~_()|!:,.;]*[-A-Za-z0-9+&amp;@#/%=~_()|]"; Pattern p = Pattern.compile(regex); Matcher m = p.matcher(text); while(m.find()) { String urlStr = m.group(); char[] stringArray1 = urlStr.toCharArray(); if (urlStr.startsWith("(") &amp;&amp; urlStr.endsWith(")")) { char[] stringArray = urlStr.toCharArray(); char[] newArray = new char[stringArray.length-2]; System.arraycopy(stringArray, 1, newArray, 0, stringArray.length-2); urlStr = new String(newArray); // System.out.println("Finally Url ="+newArray.toString()); } //System.out.println("...Url..."+urlStr); links.add(urlStr); } return links; }
tagged with: regex
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1600291
accepted answer: http://stackoverflow.com/a/21321065
tagged with: java
duplicate of: http://stackoverflow.com/q/1600291
type: Question
has title: modify regexp to detect all url links

http://stackoverflow.com/comment/32000057
comment on: http://stackoverflow.com/a/21242332
type: Comment
has text: We cannot ask user to do settings on his machine. There are thousands of users. We need to fix this in our code.
score: 0
type: AnswerComment

http://stackoverflow.com/a/21229028
has body: The error is that you are referencing same variable sum in your array, so all elements of array pointed to the same result. Quick fix: add newList.add(new Double(sum)); instead of newList.add(sum); and you'll create new Double for each result.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21228820
upvote count: 1
score: 1

http://stackoverflow.com/q/21338829
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21339241
has answer: http://stackoverflow.com/a/21339384
has comment: http://stackoverflow.com/comment/32169972
has title: StringReplacement with User's Input - Java
type: Question
has comment: http://stackoverflow.com/comment/32170112
has comment: http://stackoverflow.com/comment/32169915
tagged with: java
has answer: http://stackoverflow.com/a/21339201
has answer: http://stackoverflow.com/a/21338965
has comment: http://stackoverflow.com/comment/32169917
score: 0
has answer: http://stackoverflow.com/a/21338934
has body: I am not sure if I am going about this correctly. I am writing a program that exercises that StringReplacement. What were the user input's I want to be able to take one of there words and change it to something else as the output. Here is my code: import java.util.Scanner; public class StringReplace { private static Scanner input; public static void main(String[] args) { String Line; input = new Scanner( System.in ); System.out.print("Please Enter a String: "); Line=input.next(); Line = Line.replace("Wake", "Wake Business"); } } So for example after running the program the user is prompted to Please Enter a String: I would enter "Wake up America" and when I hit enter nothing happens. I know I am going about this the wrong way and not sure how to correct it. Yes, I am a beginner. Would someone help me with this problem? I would appreciate it. Thank you in advance.
answer count: 5

http://stackoverflow.com/q/21190705
has comment: http://stackoverflow.com/comment/31908074
type: Question
has title: Passing objects interoperably - JavaBean to C#
tagged with: c#
has body: Is there any library out there that will allow developers to pass objects from one language to another and then manipulate/change the objects and pass them back? This would be a great and simple alternative to Messaging and XML systems out there. I read about Colors which seemed to be what I was searching for but from what I understand it hasn't been released yet. In my Java application (or any language, but java for this example) I'd like to use something like: import beans.Person; ... PythonObj pythonObj = new PythonObj("http://192.168.1.54/personGET/myusername/mypassword"); Person person = pythonObj.getPerson(); Which would consume an object published by Python via GET. So I'm guessing there would need to be a library for each language. No need for any external boilerplate strings/files (xml, json, csv, proto, etc etc) for configurations, etc. Just the library import...
has comment: http://stackoverflow.com/comment/31906876
has answer: http://stackoverflow.com/a/21191182
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31907082
favorite count: 0
tagged with: colors
has comment: http://stackoverflow.com/comment/31906930
tagged with: python
has comment: http://stackoverflow.com/comment/31906912
accepted answer: http://stackoverflow.com/a/21191182
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31906970
tagged with: language-interoperability
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31907002
upvote count: 1

http://stackoverflow.com/comment/31964613
comment on: http://stackoverflow.com/q/21222777
score: 0
type: Comment
type: QuestionComment
has text: I want to execute two different searches of the information that I have stored in the registries with two different if statements for greatest value and smallest value of attribute ageGV.

http://stackoverflow.com/a/21246061
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has body: The problem is that you create a new TableView, and new TableColumns. These are not the TableView and TableColumns that are defined in the FXML file and displayed in your UI. I think you need private void initializeTableView() { personTableView.setItems(myList); personTableView.setEditable(true); // fNameCol = new TableColumn&lt;&gt;("First Name"); fNameCol.setCellFactory(new PropertyValueFactory("firstName")); // lNameCol = new TableColumn&lt;&gt;("Last Name"); lNameCol.setCellValueFactory(new PropertyValueFactory("lastName")); }
answers question: http://stackoverflow.com/q/21244622
accepted answer of: http://stackoverflow.com/q/21244622

http://stackoverflow.com/q/21341325
has comment: http://stackoverflow.com/comment/32174595
downvote count: 1
upvote count: 4
has title: how to get endianess in Java or python?
answer count: 4
has comment: http://stackoverflow.com/comment/32174617
has answer: http://stackoverflow.com/a/21488813
has answer: http://stackoverflow.com/a/21341433
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21341502
tagged with: python
has answer: http://stackoverflow.com/a/21341417
linked to: http://stackoverflow.com/q/2188660
score: 3
tagged with: java
tagged with: http://stackoverflow.com/tag/c
type: Question
has body: In C I could the Endianess of the machine by the following method. how would I get using a python or Java program?. In Java, char is 2-bytes unlike C where it is 1-byte. I think it might not be possible with python since it is a dynamic language, but I could be wrong bool isLittleEndian() { // 16 bit value, represented as 0x0100 on Intel, and 0x0001 else short pattern = 0x0001; // access first byte, will be 1 on Intel, and 0 else return *(char*) &amp;pattern == 0x01; }
has comment: http://stackoverflow.com/comment/32174703
tagged with: endianness
favorite count: 0
has comment: http://stackoverflow.com/comment/32174581

http://stackoverflow.com/a/21219724
upvote count: 9
has body: Perhaps cmdCse.setVisible(selection.toLowerCase().equals("produkt"));
score: 9
downvote count: 0
answers question: http://stackoverflow.com/q/21219695
type: Answer

http://stackoverflow.com/a/21213058
score: 8
upvote count: 8
has comment: http://stackoverflow.com/comment/31947776
type: Answer
has body: The JVM unfortunately does not support unsigned data types (besides char, thanks Erwin), but there is hope! Scala has a sufficiently advanced type system that allows you to create your own types that act like unsigned types! There is even a library that already does it! The library overloads the operators and provides conversions.
has comment: http://stackoverflow.com/comment/31949463
has comment: http://stackoverflow.com/comment/31949503
answers question: http://stackoverflow.com/q/21212993
downvote count: 0

http://stackoverflow.com/comment/31989098
has text: you are creating an instance of worker in each `button click` see `Worker worker = new Worker();` they are not related the one you cancel that the one you want to cancel.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21236289

http://stackoverflow.com/comment/104048472
comment on: http://stackoverflow.com/a/52963942
score: 0
type: Comment
type: AnswerComment
has text: This will silently use wrong values if they themselves contain equal signs. E.g. `--options=foo=bar,baz=moo` becomes `{options=foo}`. Another poor use of `split`.

http://stackoverflow.com/a/21207268
answers question: http://stackoverflow.com/q/21207204
has body: The method print() is defined in the abstract class Program, just importing this doesn't do anything. You have to extend the abstract class to make the print() method available to you. public class Cell extends Program { }
has comment: http://stackoverflow.com/comment/31939576
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21207204

http://stackoverflow.com/a/36123886
answers question: http://stackoverflow.com/q/21277123
score: 1
upvote count: 1
type: Answer
has body: void RequestVolley() { // Instantiate the RequestQuee RequestQueue queue = Volley.newRequestQueue(getApplication()); //create new volley request JsonObjectRequest requestNew = new JsonObjectRequest(Request.Method.GET, Url, null, createMyReqSuccessListener(), createMyReqErrorListener()); //Response.Listener and Error.Listener defined afterwards //first param is TIMEOUT ...integer //second param is number of retries ...integer //third is backoff multiplier ...integer requestNew.setRetryPolicy(new DefaultRetryPolicy(6000, 1, 1)); queue.add(requestNew); } private Response.Listener &lt; JSONObject &gt; createMyReqSuccessListener() { return new Response.Listener &lt; JSONObject &gt; () { @Override public void onResponse(JSONObject response) { //do something } }; } private Response.ErrorListener createMyReqErrorListener() { return new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { //do something } }; }
downvote count: 0

http://stackoverflow.com/q/21229804
has answer: http://stackoverflow.com/a/21274128
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/36857621
downvote count: 0
has answer: http://stackoverflow.com/a/36857621
has title: server does not have an epr for the wsdl epr - Axis2
accepted answer: http://stackoverflow.com/a/21274128
tagged with: wsdl
tagged with: soap
favorite count: 0
score: 6
has body: I have been trying to find out the exact reason for the error and this looks like a common error to many of them using Axis but i could not able to fix them with any thing which i was able to find on net. I am able to see my service at http://localhost:8080/axis2/services/listServices. when i hit the service epr on browser http://localhost:8080/axis2/services/AuthService, it is working fine also. I tested the service using SoapUI and its working. But i am wondering why can't i see the wsdl when i click on the following link from the listServices page: http://localhost:8080/axis2/services/AuthService?wsdl&gt;. I get this error org.apache.axis2.AxisFault: Server does not have an epr for the wsdl ==> https://localhost:8080/services/TestService?wsdl&gt; at org.apache.axis2.description.AxisService.getLocationURI(AxisService.java:1615) at org.apache.axis2.description.AxisService.setPortAddress(AxisService.java:1498) at org.apache.axis2.description.AxisService.printDefinitionObject(AxisService.java:1078) at org.apache.axis2.description.AxisService.printUserWSDL(AxisService.java:1112) at org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1386) at org.apache.axis2.transport.http.ListingAgent.handleWSDLRequest(ListingAgent.java:327) at org.apache.axis2.transport.http.ListingAgent.processListService(ListingAgent.java:183) at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at com.highradius.payrad.HeaderFilter.doFilter(HeaderFilter.java:182) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain…
tagged with: web-services
upvote count: 6
type: AnsweredQuestion
tagged with: java
tagged with: apache-axis

http://stackoverflow.com/q/21271369
has comment: http://stackoverflow.com/comment/32050620
score: 1
has answer: http://stackoverflow.com/a/21271556
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/21271556
has body: Is there a method to convert type Dimension to String so that it could be displayed in a JTextField? Or could you suggest any other possible way to display dimension, please?
has comment: http://stackoverflow.com/comment/32050710
has answer: http://stackoverflow.com/a/21271523
answer count: 3
has comment: http://stackoverflow.com/comment/32050594
has comment: http://stackoverflow.com/comment/32050892
has comment: http://stackoverflow.com/comment/32050871
favorite count: 0
has comment: http://stackoverflow.com/comment/32050657
upvote count: 2
has title: how to convert Dimension values to string or int
tagged with: swing
accepted answer: http://stackoverflow.com/a/21271523
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32050675
has answer: http://stackoverflow.com/a/21271427

http://stackoverflow.com/a/21341105
answers question: http://stackoverflow.com/q/21339996
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21339996
type: Answer
downvote count: 0
score: 3
has body: You are incorrectly defining MVC handling in your root context (&lt;context:component-scan&gt; on controllers and &lt;mvc:annotation-driven&gt; inside application-context.xml). Move that to the servlet context (SpringTest3-sevlet.xml) and initialize locale interceptor via : &lt;mvc:interceptors&gt; &lt;bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"&gt; &lt;property name="paramName" value="lang" /&gt; &lt;/bean&gt; &lt;/mvc:interceptors&gt; Also drop your unnecessary handler mapping definition (ControllerClassNameHandlerMapping). If you are not sure what are the differences between root and servlet contexts, check other answers on this topic (e.g. Difference between applicationContext.xml and spring-servlet.xml in Spring Framework ).
type: AcceptedAnswer

http://stackoverflow.com/comment/42715884
score: 5
has text: It is ok in Compilation time. But it fails for me in Runtime(NoClassDefFoundError). How to avoid it?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21255748

http://stackoverflow.com/q/21296235
tagged with: declaration
accepted answer: http://stackoverflow.com/a/21296264
has title: How to declare Adapter in fragment?
type: AnsweredQuestion
has body: import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ListView; import com.actionbarsherlock.app.SherlockFragment; public class FragmentTab2 extends SherlockFragment { private String[]names = {"Video", "Audio"}; private String[]urls = {"http://c172200.r0.cf3.rackcdn.com/104824.mp4", "http://c172200.r0.cf3.rackcdn.com/106973.mp4"}; @Override public View onCreateView(LayoutInflater inflater1, ViewGroup container, Bundle savedInstanceState) { // Get the view from fragmenttab2.xml View view = inflater1.inflate(R.layout.fragmenttab2, container, false); return view; ListView lv = (ListView)findViewById(R.id.List); VideoAdapter adapter = new VideoAdapter(this, names, urls); lv.setAdapter(adapter); } } I'm to make a listview in a fragmenttab. I have the created the interface using a tutorial. http://www.youtube.com/watch?v=54wC1lgmbKQ In the video you can see application. I'm not sure where to declare and to declare the adapter. Right now i'm declaring in in the fragmenttab1 activity it self, but this causes errors to appear, saying that "The Constructor in undefined" and that "The method findViewById(int) in undefined within the type FragmentTab2". Can anyone help me? This would really boost my school project. Thanks in advance! The code of the adapter: import android.content.Context; import android.content.Intent; import android.net.Uri; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.TextView; public class VideoAdapter extends ArrayAdapter&lt;String&gt; { private final Context context; private final String[] names; private final String[] urls; public VideoAdapter(Context context, String[] names, String[] urls) { super(context, R.layout.videorow, names); this.context = context; this.names = names; this.urls = urls;…
tagged with: android-fragments
tagged with: java
type: Question
upvote count: 4
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/21296264
score: 4
favorite count: 0
tagged with: listadapter
tagged with: android

http://stackoverflow.com/comment/31980534
type: Comment
comment on: http://stackoverflow.com/a/21230733
type: AnswerComment
has text: [AWT-EventQueue-0] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final 134 [AWT-EventQueue-0] INFO org.hibernate.cfg.Environment - Hibernate 3.6.10.Final
score: 0

http://stackoverflow.com/comment/32056056
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21274414
has text: Why do you need them each to be JFrames? Why can't you make them panels or some other component?
type: Comment

http://stackoverflow.com/comment/31980426
comment on: http://stackoverflow.com/a/21206146
score: 0
type: AnswerComment
type: Comment
has text: I can't tell you why you get the NPE without your code, but quoting myself: "you have to catch the Exception as part of the readNumber part". In other words: *don't* throw an exception inside the loop; check your `codelength` variable instead

http://stackoverflow.com/q/21227324
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8221205
tagged with: gwt
tagged with: java
type: Question
tagged with: jquery-ui
has comment: http://stackoverflow.com/comment/31972868
has comment: http://stackoverflow.com/comment/31981035
score: 0
has title: Is it possible to get a GWT web page as html page?
tagged with: http://stackoverflow.com/tag/html
has body: I have a GWT web page designed in my web application, now we are removing the gwt and adding jquery. Is there any simple process to convert GWT page into HTML page just UI designing? If so please let me know.
has comment: http://stackoverflow.com/comment/31972827

http://stackoverflow.com/comment/32082792
type: QuestionComment
comment on: http://stackoverflow.com/q/21289982
has text: You cannot have variable variable names in Java.
score: 1
type: Comment

http://stackoverflow.com/comment/32157001
type: AnswerComment
comment on: http://stackoverflow.com/a/21324532
type: Comment
has text: I confuse, because I used the variable `i` before, and you use it now. Anyway thank you.
score: 0

http://stackoverflow.com/comment/32049113
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21270610
has text: This doesn't make sense to me: `(1 - 100) * base.getRed())`. Multiply by -99? Really? You shouldn't be hard-coding those numbers but should be using variables that transition. You should be testing your code with println's to help debug it.
type: Comment

http://stackoverflow.com/q/21286281
favorite count: 0
has comment: http://stackoverflow.com/comment/32933911
tagged with: android
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: google-gdk
type: Question
has body: i write an android app that has java and native c code. I know this can predict if my apk currently runs on Glass with this line of code: how can I do similar detection in native c code? if (android.os.Build.MODEL.contains("Glass")) {
has answer: http://stackoverflow.com/a/21288828
accepted answer: http://stackoverflow.com/a/21288828
has title: detecte if my apk runs on glass or mobile device
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/67588529
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23132265
has text: @jps Will KieScanner work with above mentioned approach ?

http://stackoverflow.com/q/21198573
tagged with: methods
answer count: 1
tagged with: java
has title: Getting an error: Exception in thread "main" java.lang.NullPointerException
has answer: http://stackoverflow.com/a/21198929
has body: What's wrong with my code? Basically, there is a menu and the user selects a number. After they choose "1", they can move on to the second method readData and select another number. If they choose "2", it works; however, if they choose "3" (the bestSeller method), I get the exception error.
type: AnsweredQuestion
favorite count: 0
tagged with: nullpointerexception
type: Question
accepted answer: http://stackoverflow.com/a/21198929
score: -1
upvote count: 2
downvote count: 3

http://stackoverflow.com/q/21325991
has body: I am able to compile, build, and install the project successfully And the project is running well in portrait, But In landscape mode, When I click in button, the app says: Unfortunately has stopped. Could you please help me figure this out? This is The app Logcat In Landscape mode: 01-24 09:58:19.936: W/dalvikvm(6847): threadid=1: thread exiting with uncaught exception (group=0x409c01f8) 01-24 09:58:19.986: E/AndroidRuntime(6847): FATAL EXCEPTION: main 01-24 09:58:19.986: E/AndroidRuntime(6847): java.lang.NullPointerException 01-24 09:58:19.986: E/AndroidRuntime(6847): at com.Divani.Marzieh.ExamActivity.addItemList(ExamActivity.java:79) 01-24 09:58:19.986: E/AndroidRuntime(6847): at com.Divani.Marzieh.ExamActivity$1.onClick(ExamActivity.java:71) 01-24 09:58:19.986: E/AndroidRuntime(6847): at android.view.View.performClick(View.java:3511) 01-24 09:58:19.986: E/AndroidRuntime(6847): at android.view.View$PerformClick.run(View.java:14105) 01-24 09:58:19.986: E/AndroidRuntime(6847): at android.os.Handler.handleCallback(Handler.java:605) 01-24 09:58:19.986: E/AndroidRuntime(6847): at android.os.Handler.dispatchMessage(Handler.java:92) 01-24 09:58:19.986: E/AndroidRuntime(6847): at android.os.Looper.loop(Looper.java:137) 01-24 09:58:19.986: E/AndroidRuntime(6847): at android.app.ActivityThread.main(ActivityThread.java:4424) 01-24 09:58:19.986: E/AndroidRuntime(6847): at java.lang.reflect.Method.invokeNative(Native Method) 01-24 09:58:19.986: E/AndroidRuntime(6847): at java.lang.reflect.Method.invoke(Method.java:511) 01-24 09:58:19.986: E/AndroidRuntime(6847): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 01-24 09:58:19.986: E/AndroidRuntime(6847): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 01-24 09:58:19.986: E/AndroidRuntime(6847): at dalvik.system.NativeStart.main(Native Method) This is The examActivity Code: public class ExamActivity extends Activity { private EditText etInput1; private EditText etInput2; private…
score: 1
possible better answer: http://stackoverflow.com/a/21326170
accepted answer: http://stackoverflow.com/a/21326914
upvote count: 1
has answer: http://stackoverflow.com/a/21326170
type: AnsweredQuestion
tagged with: android-layout
has comment: http://stackoverflow.com/comment/32147027
tagged with: java
has title: Unfortunately, (App Name) has stopped Android, Eclipse
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32147070
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32147092
has comment: http://stackoverflow.com/comment/32146865
downvote count: 0
has answer: http://stackoverflow.com/a/21326914
favorite count: 0
has comment: http://stackoverflow.com/comment/32147054
has comment: http://stackoverflow.com/comment/32147762
tagged with: android

http://stackoverflow.com/q/21289293
has answer: http://stackoverflow.com/a/21290619
type: Question
downvote count: 0
linked to: http://stackoverflow.com/q/76524453
tagged with: ssl
tagged with: security
accepted answer: http://stackoverflow.com/a/21289506
answer count: 7
favorite count: 0
has title: Java 7 support of AES-GCM in SSL/TLS?
has answer: http://stackoverflow.com/a/79497608
has answer: http://stackoverflow.com/a/72709554
has body: According to Java 7 documentation as well as third party vendors, it appears Java 7 should support AES-GCM suites: ibm java 7 java 7 ssl doc I was hitting some errors in negotiation between client and server unable to negotiate a cipher due to restricting it to only the AES-GCM ciphers. After investigation I found that it appears that the cipher suites are not supported on client nor server (tomcat instance). Ran some sample code on client to get the output: // Create an SSLContext that uses our TrustManager SSLContext context = SSLContext.getInstance("TLS"); context.init(null, trustAllCerts, new SecureRandom()); SSLParameters params = context.getSupportedSSLParameters(); String[] suites = params.getCipherSuites(); System.out.println("Java version : " + System.getProperty("java.runtime.version")); System.out.println("Connecting with " + suites.length + " cipher suites supported:"); for (int i = 0; i &lt; suites.length; i++) { System.out.println(); System.out.print(" ********* "); System.out.print(suites[i]); System.out.print(" ********* "); } Java version: 1.7.0_51-b13 Connecting with 63 cipher suites supported: ********* TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 ********* ********* TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 ********* ********* TLS_RSA_WITH_AES_128_CBC_SHA256 ********* ********* TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 ********* ********* TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 ********* ********* TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 ********* ********* TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 ********* ********* TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA ********* ********* TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA ********* ********* TLS_RSA_WITH_AES_128_CBC_SHA ********* ********* TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA ********* ********* TLS_ECDH_RSA_WITH_AES_128_CBC_SHA ********* ********* TLS_DHE_RSA_WITH_AES_128_CBC_SHA ********* ********* TLS_DHE_DSS_WITH_AES_128_CBC_SHA ********* ********* TLS_ECDHE_ECDSA_WITH_RC4_128_SHA ********* ********* TLS_ECDHE_RSA_WITH_RC4_128_SHA *…
upvote count: 16
has answer: http://stackoverflow.com/a/49154932
tagged with: aes
has answer: http://stackoverflow.com/a/21290409
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21289506
has answer: http://stackoverflow.com/a/29094819
score: 16
possible better answer: http://stackoverflow.com/a/21290409

http://stackoverflow.com/comment/31939103
type: Comment
has text: Your second pattern does(n't)? make nothing more than your first pattern does! However the first pattern is good and can be easily rewritten for any ref number.
score: 0
comment on: http://stackoverflow.com/a/21208474
type: AnswerComment

http://stackoverflow.com/a/21187047
answers question: http://stackoverflow.com/q/21186906
score: 1
has comment: http://stackoverflow.com/comment/31899772
has comment: http://stackoverflow.com/comment/31901339
downvote count: 0
has comment: http://stackoverflow.com/comment/31901674
has comment: http://stackoverflow.com/comment/31900621
has comment: http://stackoverflow.com/comment/31901063
has comment: http://stackoverflow.com/comment/31899766
type: Answer
has body: Just change that query to Query query = session.createQuery("from SBoxInfo");
upvote count: 1

http://stackoverflow.com/q/21200888
has comment: http://stackoverflow.com/comment/31925539
has comment: http://stackoverflow.com/comment/31925549
score: 0
tagged with: swing
has answer: http://stackoverflow.com/a/21200986
has comment: http://stackoverflow.com/comment/31925586
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31925596
has comment: http://stackoverflow.com/comment/31925541
answer count: 1
has title: Program can not be run as Java Applet
accepted answer: http://stackoverflow.com/a/21200986
tagged with: applet
has comment: http://stackoverflow.com/comment/31925553
has comment: http://stackoverflow.com/comment/31925574
tagged with: awt
has comment: http://stackoverflow.com/comment/31925488
has body: I wrote a simple program that couldn't be run as a Java Applet. When I tried to run the program, a frame did pop up and and asked which program to be run. I clicked the program I wrote, which is shown below. Surprisingly, Eclipse would run other programs in the same default package. Can anyone tell me what went wrong? Here is one program from The Art and Science of Java Chapter 6 Exercise 3: ApproxPIValue import acm.util.*; public class ApproxPIValue { public void run() { int total = 0; //This variable counts the amount of time x^2 + y^2 &lt; 1.// for (int a = 0; a &lt; 10000; a++) { double x = rgen.nextDouble(-1.0, 1.0); double y = rgen.nextDouble(-1.0, 1.0); if (Math.sqrt(x) + Math.sqrt(y) &lt; 1) { //x^2 + y^2 &lt; 1 means that this pair number will fall into the circle with radius of 1 centered in the middle of the coordinates. total++; } double approxPIValue = total / 10000 * 4; //total / 100000 is the approximate ratio of the area of the circle over the area of the square. The approximate ratio would be close to PI/4 if x and y are randomly chosen. So total / 10000 * 4 will give the approximate PI.// System.out.print(approxPIValue); } } /* set RandomGenerator as an instance variable. */ private RandomGenerator rgen = new RandomGenerator(); } I also want to pose another program that doesn't work either. CoinFace import acm.util.*; /** * This class decides the face of a coin. * 1 and 2 represent correspondingly Heads and Tails. * Clients can get the "face" of the coin by calling getState() method. */ public class CoinFace { public CoinFace() { state = rgen.nextInt(1, 2); } /* private instance variable. */ private int state; public int getState() { return state; } /* declare RandomGenerator as an instance variable. */ private RandomGenerator rgen = new RandomGenerator(); } ConsecutiveHeads public class ConsecutiveHeads extends CoinFace{ public void run () { while (true) { int totalFlip = 0; int consecutiveHeads = 0; //the time of getting consecutive Heads when fl…
has comment: http://stackoverflow.com/comment/31925663

http://stackoverflow.com/a/21272302
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21272276
has comment: http://stackoverflow.com/comment/32052753
answers question: http://stackoverflow.com/q/21272276
has body: I think a simple search on any search engine could have helped you. Eg: String date = c.get(Calendar.YEAR) + "-"+ c.get(Calendar.MONTH)+ "-"+ c.get(Calendar.DAY_OF_MONTH) ; String time = c.get(Calendar.HOUR_OF_DAY) + ":" + c.get(Calendar.MINUTE)+ ":" + c.get(Calendar.SECOND);
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32145019
score: 0
has text: and yes, i have added a <static-files> and it is doing absolutely nothing. There has to be something going on behind the scenes in this example.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21324864

http://stackoverflow.com/q/21335758
has title: Java SAX read filename with metacharacters
has comment: http://stackoverflow.com/comment/32164741
upvote count: 3
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/21454515
tagged with: dom4j
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21335915
downvote count: 0
tagged with: sax
type: Question
has answer: http://stackoverflow.com/a/21335915
has body: How do you read files with metacharacters in the file name? For example: private void readDoc (String path) { try { SAXReader reader = new SAXReader(); this.doc = reader.read("_40208#1159SOV.xml"); } catch(Exception e) { this.print(e.getMessage()); } } I tried using: reader.read(Pattern.quote("_40208#1159SOV.xml"); but it doesn't work. Would like a solution that does not require renaming the files. Thank you.
score: 3
possible better answer: http://stackoverflow.com/a/21454515
tagged with: java
has comment: http://stackoverflow.com/comment/32163967

http://stackoverflow.com/comment/31900947
type: Comment
has text: Have you tried `cssEngine.setClassname(composite, "class1 class2");`
comment on: http://stackoverflow.com/q/21185923
score: 0
type: QuestionComment

runtime-error
tags question: http://stackoverflow.com/q/21343839
tags question: http://stackoverflow.com/q/21349111
tags question: http://stackoverflow.com/q/21219388
tag name: runtime-error
tags question: http://stackoverflow.com/q/21209866
tags question: http://stackoverflow.com/q/21320547
type: Tag
tags question: http://stackoverflow.com/q/21208400
tags question: http://stackoverflow.com/q/21349531
tags question: http://stackoverflow.com/q/21221942

apache
tag name: apache
tags question: http://stackoverflow.com/q/21304212
tags question: http://stackoverflow.com/q/21286040
tags question: http://stackoverflow.com/q/21294253
tags question: http://stackoverflow.com/q/21321897
tags question: http://stackoverflow.com/q/21301475
tags question: http://stackoverflow.com/q/21212629
tags question: http://stackoverflow.com/q/21311738
tags question: http://stackoverflow.com/q/21189649
tags question: http://stackoverflow.com/q/21236871
tags question: http://stackoverflow.com/q/21312003
tags question: http://stackoverflow.com/q/21331000
tags question: http://stackoverflow.com/q/21230745
tags question: http://stackoverflow.com/q/21230634
tags question: http://stackoverflow.com/q/21289217
tags question: http://stackoverflow.com/q/21254051
tags question: http://stackoverflow.com/q/21232250
type: Tag
tags question: http://stackoverflow.com/q/21229469
tags question: http://stackoverflow.com/q/21339637
tags question: http://stackoverflow.com/q/21263030
tags question: http://stackoverflow.com/q/21226037
tags question: http://stackoverflow.com/q/21253025
tags question: http://stackoverflow.com/q/21234384
tags question: http://stackoverflow.com/q/21254719
tags question: http://stackoverflow.com/q/21237391
tags question: http://stackoverflow.com/q/21276631
tags question: http://stackoverflow.com/q/21296519
tags question: http://stackoverflow.com/q/21330263
tags question: http://stackoverflow.com/q/21184604

http://stackoverflow.com/comment/32189442
has text: so what i should do? move the queries to servlet>?
comment on: http://stackoverflow.com/a/21349792
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32135017
type: QuestionComment
has text: why would using a different making like (defn mark-true [n] (conj '(true) n)) make a difference?
score: 0
comment on: http://stackoverflow.com/q/21318858
type: Comment

http://stackoverflow.com/comment/32077492
has text: I don't get it. Why exactly do you need Locks?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21286831
score: 1

http://stackoverflow.com/q/21241729
has comment: http://stackoverflow.com/comment/31998530
answer count: 1
tagged with: connection
has title: Jsp, connection pool and mysql
type: UnansweredQuestion
tagged with: java
has body: I've going around this for a while, yet seem to be lacking the knowledge. Can someone paste a quick guide on how to implement such thing. I'm a bit puzzled about what context is and what's his role is the whole situation. At the end point, I already have a connection class, even a connection pool class with boneCp, yet I've no idea on how to run it on server start and not when a Jsp call comes in. Thx for the help.
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/31999172
has answer: http://stackoverflow.com/a/21241914
tagged with: jsp
score: 0
tagged with: pool

http://stackoverflow.com/a/21222477
answers question: http://stackoverflow.com/q/21222250
score: 0
has body: int count = 0; //... while(count &lt;= expoBdd.getNumberOfRows()){ Exposition expoFromDb = expoBdd.getExpositionWithId(count); listeExposition.add(expoFromDb); count++; } This loop runs getNumberOfRows() + 1 times. Now, depending on getExpositionWithId() implementation, it may result in a null to end up in the list, causing a NPE when toString() is called on it here: nomExpo.setText(listeExpo.get(position).toString()); Quick fix: change the &lt;= to &lt;.
has comment: http://stackoverflow.com/comment/31964438
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21222250

http://stackoverflow.com/comment/32281088
type: Comment
has text: create datebase with *.ddl simply batch execute statements in ddl file to create tables, keys, ecc. sync database use liquibase syncChangeLog on the fresh schema.
score: 0
comment on: http://stackoverflow.com/a/21392795
type: AnswerComment

http://stackoverflow.com/q/21228113
has comment: http://stackoverflow.com/comment/31977728
answer count: 0
has comment: http://stackoverflow.com/comment/31976761
has comment: http://stackoverflow.com/comment/31977555
upvote count: 1
tagged with: swing
type: Question
has body: I am trying to fetch an image from the oracle 10g database in a jframe, but i am not able to do it. Its not showing anything in the frame, and there is no compilation error in the program, because, my program is runnig, and its showing an empty jframe. I am providing the detail code along with the database structure. Please help me finding the solution. Create Table Structure in the database: create table abc ( img blob ); This is the insert image code: import java.io.File; import java.io.FileInputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; public class test1 { public static void main(String args[]) throws Exception { Connection conn; try { Class.forName("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcl","scott","tiger"); if(conn != null) System.out.println("\n Connection created."); File imgfile = new File("D:\\ss.jpg"); FileInputStream fin = new FileInputStream(imgfile); PreparedStatement pre = conn.prepareStatement("insert into abc values(?)"); pre.setBinaryStream(1,fin,(byte)imgfile.length()); pre.executeUpdate(); conn.commit(); System.out.println("Inserting Successfully!"); pre.close(); } catch(Exception e1) { System.out.println(e1);} } } The code for retrieve image is: import java.awt.Graphics; import java.awt.Image; import java.sql.Blob; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JLabel; public class RetrieveImage { public static void main(String[] args) { try{ Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcl", "scott","tiger"); PreparedStatement ps=con.prepareStatement("select * from abc"); ResultSet rs=ps.executeQuery(); rs.next(); Blob b=rs.getBlob(1); JLabel label = new JLabel(); JFrame f = new JFrame(…
tagged with: java
linked to: http://stackoverflow.com/q/17630527
has comment: http://stackoverflow.com/comment/31979472
downvote count: 0
score: 1
has title: Fetching an image from oracle database, but its not showing in JFrame
favorite count: 0
has comment: http://stackoverflow.com/comment/31977991
has comment: http://stackoverflow.com/comment/31974154
has comment: http://stackoverflow.com/comment/31977180
type: UnansweredQuestion
tagged with: oracle-database

http://stackoverflow.com/comment/32044848
has text: Define "just stops". Do you get an error message? If so, what's the message? (If not, it's probably either a bug in your code, or it hasn't actually stopped but is swapping badly enough to drag performance to a crawl.) What have you done so far to try to diagnose the problem?
score: 1
comment on: http://stackoverflow.com/q/21268239
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21286659
type: Question
has answer: http://stackoverflow.com/a/21302343
score: 0
answer count: 1
tagged with: paintcomponent
has title: Ellispe won't appear on jframe
tagged with: jframe
tagged with: swing
accepted answer: http://stackoverflow.com/a/21302343
type: AnsweredQuestion
has body: I have been working with arrow keys movement and when i finally found a easy tutorial, the graphics won't draw the circle, please any help at all would be greatly appreciated! import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.geom.Ellipse2D; import javax.swing.JPanel; import javax.swing.Timer; public class Plant extends JPanel implements ActionListener, KeyListener{ double x = 0, y = 0, velx = 0, vely = 0; Timer t = new Timer(5, this);//calls action listener every 5 seconds public Plant(){ t.start(); addKeyListener(this); setFocusable(true); setFocusTraversalKeysEnabled(false);//sets odd keys to act normal } public void drawGraphics(Graphics g){ super.paintComponent(g); Graphics2D g2= (Graphics2D) g; g2.fill(new Ellipse2D.Double(x, y, 70, 70)); } public void actionPerformed(ActionEvent e){ repaint();//adds to x and y coordinates, then redraws them to the new coordinates x += velx; y += vely; } public void up(){ vely = -1.5;//casll when up key is pressed velx = 0; } public void down(){ vely = 1.5; velx = 0; } public void left(){ velx = -1.5; vely = 0; } public void right(){ velx = 1.5; vely = 0; } public void keyPressed(KeyEvent e){ int code = e.getKeyCode(); if(code == KeyEvent.VK_UP){ up(); } if(code == KeyEvent.VK_DOWN){ down(); } if(code == KeyEvent.VK_LEFT){ left(); } if(code == KeyEvent.VK_RIGHT){ right(); } } public void keyReleased(KeyEvent e){} public void keyTyped(KeyEvent e){} } and here is the code for my second class, that draws the frame. import javax.swing.JFrame; public class BasicCharacterMovement{ public static void main(String args[]){ JFrame j = new JFrame(); Plant s = new Plant(); j.add(s); j.setVisible(true); j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); j.setSize(800, 600); } }
tagged with: java

http://stackoverflow.com/comment/32049333
has text: So how is the background changed in the example? (it’s the icon)
type: Comment
comment on: http://stackoverflow.com/q/21270656
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32849139
type: QuestionComment
comment on: http://stackoverflow.com/q/21325355
has text: did you implement this ?
score: 0
type: Comment

http://stackoverflow.com/comment/32148957
has text: Uh, the link in the question...?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21327068
type: Comment

http://stackoverflow.com/comment/31912235
type: Comment
comment on: http://stackoverflow.com/a/21193139
type: AnswerComment
has text: @JohnVint can you recommend a reference for reading about what 2-CAS would imply? '2-CAS' is a hard thing to google for..
score: 0

dib
type: Tag
tag name: dib
tags question: http://stackoverflow.com/q/21185392

http://stackoverflow.com/comment/31912696
comment on: http://stackoverflow.com/a/21193714
score: 0
type: AnswerComment
has text: @MariuszS Loop duration 1123 ms.
type: Comment

http://stackoverflow.com/comment/111527225
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26597701
has text: @ChristianCiach You are correct. I spelled out what you are saying in [this answer](https://stackoverflow.com/a/63068341/5772882).
score: 0

http://stackoverflow.com/q/21250394
favorite count: 0
type: UnansweredQuestion
tagged with: maven
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Jetty build success, but in the browser i am getting "Error 503 Service Unavailable"
has comment: http://stackoverflow.com/comment/32013568
has body: To run my application locally i am building it using 'mvn jetty:run' command. It builds my app properly without any issue. But still in my browser i am getting an error saying : HTTP ERROR: 503 Problem accessing /s/projectdash/. Reason: Service Unavailable Powered by Jetty:// I am not able to understand this issue. any one help me to sort this please?
downvote count: 0

http://stackoverflow.com/q/21198327
has answer: http://stackoverflow.com/a/21198379
type: AnsweredQuestion
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/31921025
downvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21198409
score: -1
accepted answer: http://stackoverflow.com/a/21198379
has comment: http://stackoverflow.com/comment/31921023
answer count: 3
possible better answer: http://stackoverflow.com/a/21198409
upvote count: 0
favorite count: 0
has body: I am trying to read from a file and input each line into a ArrayList. I have my file in the same folder as the main java file. There are no spelling errors in the file names. Can someone help me figure out what is wrong? Scanner in = new Scanner(new FileReader("lab02in.txt")); while(in.hasNextLine()) { String line = in.nextLine(); countries.add(line); } in.close(); System.out.println("Printing New list after adding from file"); displayCountries(countries); I get this error: Exception in thread "main" java.io.FileNotFoundException: lab02in.txt (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:146) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:101) at java.io.FileReader.&lt;init&gt;(FileReader.java:58) at lab2.Lab2.main(Lab2.java:50) Java Result: 1
tagged with: arraylist
has answer: http://stackoverflow.com/a/21198462
has title: Reading from file error in Java?
tagged with: filereader

http://stackoverflow.com/q/21289998
has answer: http://stackoverflow.com/a/21297490
score: 2
downvote count: 0
tagged with: java
tagged with: advanced-queuing
type: Question
upvote count: 2
answer count: 2
tagged with: oracle-database
has title: DEQUEUE Oracle Advanced Queue from Weblogic Server
has answer: http://stackoverflow.com/a/21340601
tagged with: jms
favorite count: 0
type: UnansweredQuestion
has body: I need to dequeue a Message from Oracle Advanced Queue (ADQ) through an MDB. The MDB is deployed on Weblogic 11. I can define a Foreign Server for ADQ (official oracle doc). The qustion is: what happens if the payload is not a jms type e.g. queue_payload_type=&gt;'sys.aq$_jms_text_message' but is a custom type? How Weblogic remap it?

http
tags question: http://stackoverflow.com/q/21330421
tags question: http://stackoverflow.com/q/21288139
tags question: http://stackoverflow.com/q/21326724
tags question: http://stackoverflow.com/q/21301475
tags question: http://stackoverflow.com/q/21313643
tags question: http://stackoverflow.com/q/21230874
tags question: http://stackoverflow.com/q/21330767
tags question: http://stackoverflow.com/q/21273686
tags question: http://stackoverflow.com/q/21189817
tags question: http://stackoverflow.com/q/21293337
tags question: http://stackoverflow.com/q/21241230
tag name: http
tags question: http://stackoverflow.com/q/21226037
tags question: http://stackoverflow.com/q/21286746
tags question: http://stackoverflow.com/q/21306004
tags question: http://stackoverflow.com/q/21295940
tags question: http://stackoverflow.com/q/21316869
type: Tag
tags question: http://stackoverflow.com/q/21281499
tags question: http://stackoverflow.com/q/21330050
tags question: http://stackoverflow.com/q/21311671
tags question: http://stackoverflow.com/q/21237866

http://stackoverflow.com/q/21202582
has answer: http://stackoverflow.com/a/21202668
has answer: http://stackoverflow.com/a/21202976
has body: I'm a bit confused between 2 screen in eclipse: I'm not sure how to import FB sd into my Android project properly. What does "android" mean vs "Java build path" ? As current configuration I get this error:
has answer: http://stackoverflow.com/a/21202641
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21202607
type: Question
has title: How to import Facebook SDK into my android eclipse project
has answer: http://stackoverflow.com/a/21202737
accepted answer: http://stackoverflow.com/a/21202668
tagged with: java
possible better answer: http://stackoverflow.com/a/21202607
tagged with: eclipse
score: 0
answer count: 5
tagged with: android
tagged with: facebook

http://stackoverflow.com/comment/31937980
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21207570
type: AnswerComment
has text: just don't delete Java like that again

http://stackoverflow.com/a/21304051
has comment: http://stackoverflow.com/comment/32380613
has comment: http://stackoverflow.com/comment/32148905
upvote count: 1
has comment: http://stackoverflow.com/comment/32132641
has comment: http://stackoverflow.com/comment/32132614
type: Answer
has comment: http://stackoverflow.com/comment/32357616
has body: There are several ways of doing it, but you should not be using String manipulation (i.e. indexOf), the performance could be horrible. The results in the cursor are nested Maps, representing the document in the database - a Map is a good Java-representation of key-value pairs. So you can navigate to the place you need in the document, instead of having to parse it as a String. I've tested the following and it works on your test data, but you might need to tweak it if your data is not all exactly like the example: while (cursor.hasNext()) { DBObject campaignDBO = cursor.next(); List callsByTimezone = (List) ((DBObject) ((List) campaignDBO.get("activeCampaigns")).get(0)).get("callsByTimeZone"); DBObject valuesThatIWant; for (Object o : callsByTimezone) { DBObject call = (DBObject) o; if (call.get("label").equals("PT")) { valuesThatIWant = call; } } } Depending upon your data, you might want to add protection against null values as well. The thing you were looking for ({"label":"PT", "loaded":1 }) is in the variable valueThatIWant. Note that this, too, is a DBObject, i.e. a Map, so if you want to see what's inside it you need to use get: valuesThatIWant.get("label"); // will return "PT" valuesThatIWant.get("loaded"); // will return 1 Because DBObject is effectively a Map of String to Object (i.e. Map&lt;String, Object&gt;) you need to cast the values that come out of it (hence the ugliness in the first bit of code in my answer) - with numbers, it will depend on how the data was loaded into the database, it might come out as an int or as a double: String theValueOfLabel = (String) valuesThatIWant.get("label"); // will return "PT" double theValueOfLoaded = (Double) valuesThatIWant.get("loaded"); // will return 1.0 I'd also like to point out the following from my answer: ((List) campaignDBO.get("activeCampaigns")).get(0) This assumes that "activeCampaigns" is a) a list and in this case b) only has one entry (I'm doing get(0)). You will also have noticed that the fields va…
downvote count: 0
has comment: http://stackoverflow.com/comment/32357729
score: 1
answers question: http://stackoverflow.com/q/21297321

http://stackoverflow.com/q/21298371
has body: Ok so I have a JButton to restart my game. private static class Clicked implements ActionListener { @Override public void actionPerformed(ActionEvent event) { hero.setHealth(100); cl.show(cards, sGame); } } After I press the button the keyboard listener doens't work. I looked it up and it seems like the window is losing focus. I already have setfocusable and adding the keylistener in my game panel: addKeyListener(new Keys()); setFocusable(true); setDoubleBuffered(true); Do I do something after the button event or what?
has answer: http://stackoverflow.com/a/21298438
tagged with: swing
tagged with: jbutton
has title: Setting Focusable After Button Event
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/21298438
answer count: 1
tagged with: focus
tagged with: keyboard-events

http://stackoverflow.com/comment/31954193
score: 0
type: AnswerComment
has text: I'll have to read through that once I figure out what's going on with my project.. this error doesn't even make sense anymore. thanks for the help and reference.
type: Comment
comment on: http://stackoverflow.com/a/21216945

http://stackoverflow.com/q/21247965
has body: I have Multiset&lt;String&gt; keys I want to have a Multiset with the 200 most frequent keys. I've figured out how to get an ImmutableMultiset that is ordered by frequency but I'm having trouble getting just a subset of it. I got the sorting aspect from this other stackOverFlow question ImmutableMultiset&lt;String&gt; orderedMultiset = Multisets.copyHighestCountFirst(keys); For the subset aspect I tried using a MinMaxPriorityQueue so that I can use the maximumSize(200). MinMaxPriorityQueue&lt;String&gt; orderedSubset = MinMaxPriorityQueue.maximumSize(200).create(orderedMultiset); But it seems to return just a random selection of 200 of the keys. And checking the top value from orderedMultiset doesn't even appear in the returned MinMaxPriorityQueue. I also am afraid that even if it did get them in order I might end up with only a couple different keys where the sum of the counts total 200. And preferably I'd like to have 200 different keys with the count for each. I asked someone and they mentioned something about a POJO and a Comparable but I didn't follow what they suggested. Since a POJO can't really implement a Comparable by definition. I'm not really sure. I also was playing around with using the guava Ordering but I don't think that will work since the function would be taking Strings and is unaware of the counts from the multiset. MinMaxPriorityQueue&lt;String&gt; strings = MinMaxPriorityQueue.orderedBy(topKCount).maximumSize(200).create(multisets); private final Ordering&lt;String&gt; topKCount = Ordering.natural() .onResultOf(new Function&lt;String, String&gt;() { @Override public String apply(String keys) { //todo } }); Does anyone know what I'm doing wrong here or at least point in the right direction. Thanks
has answer: http://stackoverflow.com/a/21248257
accepted answer: http://stackoverflow.com/a/21248257
possible better answer: http://stackoverflow.com/a/21248082
linked to: http://stackoverflow.com/q/4345633
answer count: 3
downvote count: 0
has title: Get an ordered subset from a Multiset of the most frequent X entries
favorite count: 0
tagged with: priority-queue
has answer: http://stackoverflow.com/a/21253774
has answer: http://stackoverflow.com/a/21248082
tagged with: multiset
score: 2
type: AnsweredQuestion
tagged with: guava
upvote count: 2
tagged with: java
type: Question

http://stackoverflow.com/a/21286861
score: 0
type: Answer
has body: yes, 10M relationships and 1M nodes should be no problem to even hold in memory. For fastest retrieval, I would build a server extension in Java and use the embedded API or even Cypher, and expose a custom REST endpoint that your PHP environment talks to, see http://docs.neo4j.org/chunked/milestone/server-plugins.html
has comment: http://stackoverflow.com/comment/32077463
has comment: http://stackoverflow.com/comment/32107588
has comment: http://stackoverflow.com/comment/32077792
answers question: http://stackoverflow.com/q/21286485

http://stackoverflow.com/a/21253046
has comment: http://stackoverflow.com/comment/32021291
score: 4
has comment: http://stackoverflow.com/comment/32023100
has body: My requirement is that, a java function has to run at every fixed intervals soon after the server starts To begin with, you can start using java.util.Timer. Here is a good link on usage of Timer class. Using quartz scheduler is always a better option, but Timer can be a quick way to start off with. You can find some help to start using Quartz Scheduler in Java Alternatively, you can also opt for ScheduledExecutorService in java. I would prefer this option over java.util.Timer
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32019302
accepted answer of: http://stackoverflow.com/q/21252926
type: Answer
has comment: http://stackoverflow.com/comment/32019773
upvote count: 4
answers question: http://stackoverflow.com/q/21252926
downvote count: 0

http://stackoverflow.com/a/21340747
has body: login.java package test.example; import javax.swing.*; import java.awt.event.*; import java.sql.*; public class login { .... } in login.jsp &lt;%@page import="javax.swing.JOptionPane"%&gt; &lt;%@page import="java.sql.Connection"%&gt; &lt;%@page import="java.sql.Statement"%&gt; &lt;%@page import="java.sql.ResultSet"%&gt; &lt;%@page import="java.sql.DriverManager"%&gt; &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt; &lt;%@page import="test.example.*" %&gt; After making these changes clean your project, rebuild. it should work.
type: Answer
has comment: http://stackoverflow.com/comment/32173773
has comment: http://stackoverflow.com/comment/32174320
has comment: http://stackoverflow.com/comment/32173760
score: 0
has comment: http://stackoverflow.com/comment/32174384
answers question: http://stackoverflow.com/q/21339509

http://stackoverflow.com/q/21277129
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21277383
has body: I have a Spring MVC application where I use data binding to populate a custom form object someForm with the posted values. The interesting part of the controller looks like the following: @RequestMapping(value = "/some/path", method = RequestMethod.POST) public String createNewUser(@ModelAttribute("someForm") SomeForm someForm, BindingResult result){ SomeFormValidator validator = new SomeFormValidator(); validator.validate(someForm, result); if(result.hasErrors()){ ... return "/some/path"; } } SomeFormValidator class is implementing Springs org.springframework.validation.Validator interface. While this is great for validating the users input and creating error messages related to the input, this seems to be not well suited to handle more critical errors, which cannot be presented to the user but are still related to a controller input, like a missing hidden field which is expected to be present at post time. Such errors should result in application errors. What is the Spring MVC way to handle such errors?
tagged with: validation
answer count: 1
accepted answer: http://stackoverflow.com/a/21277383
tagged with: spring-validator
has title: How to handle validation and critical errors in Spring MVC

http://stackoverflow.com/comment/31932711
type: Comment
comment on: http://stackoverflow.com/a/21191167
type: AnswerComment
has text: yes, the extension doesn't matter at all, you can pick any file name and extension you want.
score: 0

http://stackoverflow.com/q/21256478
has body: I need to confirm what I suspect as I cannot find any documentation on it, so this would appear a silly question, and since I am a learner at eclipse PDE. Initially, I had a parent project pom of an eclipse plugin project with 1.1.0-SNAPSHOT with two child projects, with both their poms referring to the parent pom as version 1.1.0-SNAPSHOT. I was able to build the projects successfully and had a site which I use to install the plugin into eclipse. Then, I wanted my personal temp version called 1.1.1-mine. So I modified the three poms to 1.1.1-mine I also updated the META-INF/MANIFEST.MF and feature.xml from 0.13.0.qualifier to 0.13.1.qualifier However, the build encountered the following error. [ERROR] Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:0.15.0:validate-version (default-validate-version) on project org.sonatype.m2e.subclipse: OSGi version 1.1.1.qualifier in META-INF/MANIFEST.MF does not match Maven version 1.1.1-mine in pom.xml Does qualifier have to be a maven version keyword? Because, the build proceeded without error after I changed mine to SNAPSHOT in the poms. If not, what did I do wrong? What can I do to allow me to have version 1.1.1-mine?
tagged with: eclipse-pde
type: Question
tagged with: tycho
upvote count: 7
answer count: 1
tagged with: pom.xml
has comment: http://stackoverflow.com/comment/42504549
favorite count: 0
tagged with: maven
has title: What is an OSGI version qualifier
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21263594
accepted answer: http://stackoverflow.com/a/21263594
score: 7
tagged with: java

key-bindings
tags question: http://stackoverflow.com/q/21200845
tag name: key-bindings
tags question: http://stackoverflow.com/q/21209309
type: Tag

http://stackoverflow.com/q/21263566
score: 1
tagged with: web-services
has answer: http://stackoverflow.com/a/21263909
accepted answer: http://stackoverflow.com/a/21263909
type: Question
tagged with: java
upvote count: 1
answer count: 1
favorite count: 0
tagged with: apache-commons-beanutils
has body: I’m trying to register a custom converter for XMLGregorianCalendars to do the conversión from POJO received by WS (with XMLGregorianCalendar fields) to my model (Date objects). I tried to register to process properties with XMLGregorianCalendar.class, but the it seems to be an anonymous class and in executing time is detected as XMLGregorianCalendarImpl.class, which doesn’t cause the triggering of my custom converter. How can I do this conversion? I can register to XMLGregorianCalendarImpl.class because it is not a “visible” class… Here it's my code: […] ConvertUtils.register(new XMLGregorianCalendarConverter(), XMLGregorianCalendar.class); BeanUtils.copyProperties(result, original); […] //”result” is a object from my model with Date properties and “original” a pojo with properties with the same name but with XMLGregorianCalendar. XMLGregorianCalendarConverter.class: import javax.xml.datatype.XMLGregorianCalendar; import org.apache.commons.beanutils.converters.DateConverter; public class XMLGregorianCalendarConverter implements org.apache.commons.beanutils.Converter{ private DateConverter dateConverter = new org.apache.commons.beanutils.converters.DateConverter(); @SuppressWarnings("unchecked") @Override public &lt;T&gt; T convert(Class&lt;T&gt; type, Object value) { if(value == null || value.toString().length() &lt; 1) return null; if(type.toString().contains("XMLGregorianCalendar")){ XMLGregorianCalendar xmldate = (XMLGregorianCalendar) value; return (T) xmldate.toGregorianCalendar().getTime(); }else{ return dateConverter.convert(type, value); } } } Thanks!
tagged with: converters
type: AnsweredQuestion
has title: Custom convert XMLGregorianCalendar to Date with BeanUtils
downvote count: 0

http://stackoverflow.com/comment/31969995
type: AnswerComment
has text: For completeness, there are also DatagramChannel and AsyncDatagramChannel.
type: Comment
comment on: http://stackoverflow.com/a/21225788
score: 0

http://stackoverflow.com/a/21229391
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32000914
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/21229336
score: 2
answers question: http://stackoverflow.com/q/21229336
has body: You're building the md5 hash for vecA in both cases: algorithm.update(vecA.toString().getBytes()); should probably be algorithm.update(v.toString().getBytes()); Whats the reason and is their any advantage in using java.security.MessageDigest or simply hashCode() in that case? One advantage of not using hashCode would be that if that method is not overridden, two instances of the same class and with the same attribute values would still return different hashes, due to the default implementation of hashCode. How about the performance of hash functions vs. comparisons of all attributes? If you just compare the attributes once, there might not be any noticable performance difference (that, however, depends on how you compare the attributes) but in case of repeatedly comparing a number of attributes vs. calculating a hash once and repeatedly comparing the hashes, the latter might be faster. Edit: Here's an example to clarify the answer to the first quote. Consider the following simple piece of code: static class A { int x; public A( int i) { x = i; } } static class B { int x; public B( int i) { x = i; } public int hashCode() { final int prime = 31; return prime * x; } public boolean equals( Object obj ) { //by contract you should always override equals and hashCode together //also note that some checks are omitted for simplicity's sake (obj might be null etc.) return getClass().equals( obj.getClass()) &amp;&amp; x == ((B)obj).x; } } As you can see, A doesn't override hashCode while B does. Thus you'll get the following result: System.out.println(new A( 500 ).hashCode() == new A(500).hashCode()); //false System.out.println(new B( 500 ).hashCode() == new B(500).hashCode()); //true Note that x is the same in both cases but for A#hashCode() the object identity is used, not the value of x as does B#hashCode()
has comment: http://stackoverflow.com/comment/31977659
has comment: http://stackoverflow.com/comment/31984560

http://stackoverflow.com/q/21239911
has comment: http://stackoverflow.com/comment/31995116
has body: I've been trying to get the hang of exceptions but I've run into some problems. I'm going to explain what I know and add bold text to the parts I'm not sure of: I understand that there are Checked exceptions and Unchecked exceptions (The latter are all subclasses of RuntimeException?). In methods where Checked exceptions can be thrown, the method signature NEEDS to state this (At least if I've understood what I've read about exceptions correctly?). E.g.: public void m() throws IOException{ ... } This doesn't need to be done for Unchecked exceptions (It doesn't NEED to, but CAN it?) I also know that you can "try" a piece of your code and any exceptions that might be thrown there will be caught in the "catch" part (Try-Catch). Does this have to be done for both checked and unchecked exceptions? When do I have to do this? To clarify the second part of the last question, a class like public class A { private int[] items; public int first() { return items[0]; } } Will return a NullPointerException. Yet there's no Try-Catch part, so when do I need to use Try-Catch and when don't I? Thanks a lot in advance! P.s. I've already read some answers regarding this topic on StackOverflow but none are really specific to the problems I'm experiencing.
tagged with: exception
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21240157
type: Question
has comment: http://stackoverflow.com/comment/31995087
accepted answer: http://stackoverflow.com/a/21240087
has title: Checked and unchecked exceptions; what makes them different?
has answer: http://stackoverflow.com/a/21240087
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21240157
has comment: http://stackoverflow.com/comment/31995133

http://stackoverflow.com/a/21289680
has body: Judging from the documentation, there are methods for converting LargeIntegers into byte arrays, and also to create a LargeInteger from byte arrays. Hence, you can do the following: convert operands to byte arrays combine the individual bytes with the operator you want (&amp;, |, ^) convert resulting byte array back to LargeInteger Now, correct me if I am wrong, but the original python code seems to only do n &amp; 1. Since you have even() and odd() methods, why not use them? The following identity holds: large &amp; 1 = large.odd() ? 1 : 0
score: 0
has comment: http://stackoverflow.com/comment/32082290
has comment: http://stackoverflow.com/comment/32082376
answers question: http://stackoverflow.com/q/21288559
has comment: http://stackoverflow.com/comment/32082326
has comment: http://stackoverflow.com/comment/32082449
type: Answer

http://stackoverflow.com/q/21324036
favorite count: 0
linked to: http://stackoverflow.com/q/3610261
has answer: http://stackoverflow.com/a/21324052
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/32143701
tagged with: loops
accepted answer: http://stackoverflow.com/a/21324207
type: Question
has body: Having this code: Map&lt;String,Rect&gt; map1 = new HashMap&lt;String,Rect&gt;(); Map&lt;String,Rect&gt; map2 = new HashMap&lt;String,Rect&gt;(); ... for( Rect r: map1.values() ) { r.offset(10,10); } for( Rect r: map2.values() ) { r.offset(10,10); } If the code inside both loops is the same, is there a simple way to combine the two loops into one loop? (Assume all map keys are different). I do have some ideas that would help too (like merging the two maps into one single map or having a method doing the loop with the map as argument), but I wonder if there is something in Java syntax that just allows to chain two similar list and loop through them.
possible better answer: http://stackoverflow.com/a/21324052
has answer: http://stackoverflow.com/a/21324207
has title: Is there a way to chain Lists (or Maps) in a for loop?
answer count: 2
tagged with: for-loop
downvote count: 0
has comment: http://stackoverflow.com/comment/32143638

http://stackoverflow.com/comment/31921430
has text: @EvgenyTanhilevich sorry, I changed the code. itemAction is a local variable
type: Comment
comment on: http://stackoverflow.com/q/21198503
score: 0
type: QuestionComment

http://stackoverflow.com/q/21337986
score: 0
has body: I am trying to produce a distribution of some "score" function. This function is scoring in the [1..100] range so I have data points in the following form: score 1: n1 counts score 2: n2 counts ... score 100: n100 counts I tried to use a Bar Chart (using ChartFactory.createBarChart(...)) but the result is too crowded on the x-axis where I have 100 categories (for scores 1 to 100): Note that the results shown above have a huge concentration (spike) around score 78 but that's not the problem. Even if they were nicely distributed I would still get an overloaded x axis. Is there an easy remedy or should I be looking into some other kind of chart?
has comment: http://stackoverflow.com/comment/32168212
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32168534
tagged with: java
tagged with: jfreechart
has answer: http://stackoverflow.com/a/21338412
type: Question
has title: JFreeChart bar chart too crowded on the X-axis
answer count: 1

http://stackoverflow.com/a/21255787
upvote count: 2
has body: duplicate You should implement readObject and writeObject on your class so you can serialise its objects in a custom way. First, make your non-serialisable field transient. In writeObject, first call defaultWriteObject on the stream to store all the non-transient fields, then call other methods to serialise the individual properties of your non-serialisable object. In readObject, first call defaultReadObject on the stream to read back all the non-transient fields, then call other methods (corresponding to the ones you added to writeObject) to deserialise your non-serialisable object. I hope this makes sense. :-)
downvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21255699
type: Answer

http://stackoverflow.com/comment/32026160
type: QuestionComment
score: 1
has text: what does it mean "max" - give examples from the example data...
comment on: http://stackoverflow.com/q/21258107
type: Comment

http://stackoverflow.com/a/21249103
has comment: http://stackoverflow.com/comment/32054781
has body: The problem is likely with the session objects that are already existing in your live App Engine application. It seems that there are several objects created over there of type ConversationContainer and the JARs that you have subsequently linked up contain some differences in terms of Serialization UID, which is causing an issue. The choices before you would be to try these methods and see which one works: If possible, ensure that previous Serialization UID used for your classes is the same. I believe leaving them empty might also work. Look at the Sessions Datastore in your App Engine instance, see if it is possible to clear that along with possible MemCache entries that are holding objects of that type.
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21248341
type: Answer
accepted answer of: http://stackoverflow.com/q/21248341

http://stackoverflow.com/comment/31991650
type: Comment
type: QuestionComment
has text: How will that help? I still want to read the messages in between, or am I missing something?
comment on: http://stackoverflow.com/q/21237148
score: 0

http://stackoverflow.com/comment/31995890
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21240271
has text: What the heck with those includes, don't you use an IDE?

http://stackoverflow.com/q/21294570
downvote count: 0
has answer: http://stackoverflow.com/a/21294907
tagged with: jdbc
has comment: http://stackoverflow.com/comment/130209323
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: oracle-database
tagged with: jmx
tagged with: spring
has body: I am using an Oracle connection pool by using the following Spring configuration for my datasource: <util:properties> 5 5 30 20 </util:properties> I would like to expose the statistics of this pool via JMX so that I can monitor the pool to see how many connections are in the pool, how many are busy, etc. I am connecting to an Oracle 10g server with the oracle 11.2.0.3.0 jdbc driver. How do I do this?
score: 2
has title: How do I expose Oracle connection pool statistics over JMX?
has answer: http://stackoverflow.com/a/21295298
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/129557337

http://stackoverflow.com/q/21252705
answer count: 1
accepted answer: http://stackoverflow.com/a/21332101
tagged with: java
tagged with: playframework
type: AnsweredQuestion
tagged with: jpa
has comment: http://stackoverflow.com/comment/32035167
type: Question
tagged with: sql
has answer: http://stackoverflow.com/a/21332101
has comment: http://stackoverflow.com/comment/32060223
has comment: http://stackoverflow.com/comment/32026977
has title: JPA Select - Some specific keys are slow?
score: 0
has body: Using Play Framwork 1.x - I've made this model definition: @Entity public class ShareHistoryResult extends GenericModel { @Id @Index(name = "isinOnly") public String ISIN; @Id @Index(name = "calDate") public Date calDate; public Double opening; public Double closing; public Double highest; public Double lowest; public Integer count; public Double turnover; To get the most recent result before a certain date, I'm selecting: ShareHistoryResult shareDay = ShareHistoryResult.find("calDate &lt;= ? AND ISIN = ? AND closing &gt; 0 ORDER BY calDate DESC", date, isin).first(); Works fine. For most isin keys the request takes less than 50ms. But for a few keys (the same every time) it takes as long as 300-400 ms. The SQL generated by JPA: select sharehisto0_.calDate as calDate9_, sharehisto0_.ISIN as ISIN9_, sharehisto0_.closing as closing9_, sharehisto0_.count as count9_, sharehisto0_.highest as highest9_, sharehisto0_.lowest as lowest9_, sharehisto0_.opening as opening9_, sharehisto0_.turnover as turnover9_ from ShareHistoryResult sharehisto0_ where sharehisto0_.calDate&lt;=? and sharehisto0_.ISIN=? and sharehisto0_.closing&gt;0 order by sharehisto0_.calDate DESC limit ? If I run this SQL directly in MySqlWorkbench with one of the slow keys. It evaulates in a lightning speed of 0.02 - 0.2 sec. This is the create statement of the table (copied from MySqlWorkbench): CREATE TABLE `ShareHistoryResult` ( `calDate` datetime NOT NULL, `ISIN` varchar(255) NOT NULL, `closing` double DEFAULT NULL, `count` int(11) DEFAULT NULL, `highest` double DEFAULT NULL, `lowest` double DEFAULT NULL, `opening` double DEFAULT NULL, `turnover` double DEFAULT NULL, PRIMARY KEY (`calDate`,`ISIN`), KEY `calDate` (`calDate`), KEY `isinOnly` (`ISIN`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET Any idees why some keys are remarkably slower than others?

http://stackoverflow.com/q/21288929
has title: How to retrieve all the values from a custom arraydapter
tagged with: java
type: Question
has body: i have implemented a custom array adapter for my project,so far i am able to add and delete items from it and it displays them in the ListView too dynamically..however i have a button in the MainActivity(that holds the ListView), that when clicked i want to display all the row items. so far what i am getting instead of the data in the adapter after appending all values to a StringBuilder is: com.baseadapter.C@4052b9b8com.baseadapter.C@4052f490com.baseadapter.C@40531378com.baseadapter.C@4053415 the arrayadapter and arraylist are set as below: ArrayList&lt;C&gt; arrayvalues= new ArrayList&lt;C&gt;(); MyAdapter adapter; adapter= new MyAdapter(MainActivity.this, R.layout.list_item, arrayvalues); the code for my collection class is this: public class C { String the_text; public String getText() { return the_text; } public void setText(String the_text) { this.the_text = the_text; } public C(String the_text) { super(); this.the_text = the_text; } } the code i use to iterate over the adapter is this: btn_done.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub StringBuilder b = new StringBuilder(); for(int i=0 ; i&lt;adapter.getCount() ; i++){ b.append(adapter.getItem(i)); } Toast.makeText(getApplicationContext(), b.toString(), Toast.LENGTH_SHORT).show(); } }); and the custom adapter code(just in case,though i don,t think the problem lies here): public class MyAdapter extends ArrayAdapter&lt;C&gt; { Context context; int layoutResourceId; ArrayList&lt;C&gt; data = new ArrayList&lt;C&gt;(); public MyAdapter(Context context, int layoutResourceId, ArrayList&lt;C&gt; data) { super(context, layoutResourceId, data); this.layoutResourceId = layoutResourceId; this.context = context; this.data = data; } @Override public View getView(final int position, View convertView, ViewGroup parent) { View row = convertView; myholder holder = null; if (row == null) { LayoutInflater inflater = ((Activity) context).getLayoutInfla…
tagged with: android-arrayadapter
tagged with: arrays
accepted answer: http://stackoverflow.com/a/21289053
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21289090
has answer: http://stackoverflow.com/a/21289090
tagged with: android
has answer: http://stackoverflow.com/a/21289053
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32080726

ubuntu
tags question: http://stackoverflow.com/q/21311439
tags question: http://stackoverflow.com/q/21261616
tags question: http://stackoverflow.com/q/21315160
tags question: http://stackoverflow.com/q/21212629
tags question: http://stackoverflow.com/q/21185607
tag name: ubuntu
tags question: http://stackoverflow.com/q/21329405
tags question: http://stackoverflow.com/q/21200877
tags question: http://stackoverflow.com/q/21260064
type: Tag

http://stackoverflow.com/a/21213010
type: Answer
has body: Add another BlockingQueue, make newPrice() replace (clear/add) the value in this queue before put(). Make getNewPrice() poll this queue.
answers question: http://stackoverflow.com/q/21211858
score: 0

http://stackoverflow.com/comment/32014559
has text: also related answer from [this](http://stackoverflow.com/a/20877115/2817802)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21250973

http://stackoverflow.com/comment/66849640
comment on: http://stackoverflow.com/a/21241417
type: AnswerComment
has text: How would I go about registering the Binding (in this case Int4RangeConverter) in Java? The manual only shows how to do using xml.
type: Comment
score: 0

http://stackoverflow.com/q/21285080
has comment: http://stackoverflow.com/comment/32074116
has comment: http://stackoverflow.com/comment/32074042
has comment: http://stackoverflow.com/comment/32074022
has comment: http://stackoverflow.com/comment/32074367
has comment: http://stackoverflow.com/comment/32074085
has comment: http://stackoverflow.com/comment/32074387
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32074180
answer count: 1
has comment: http://stackoverflow.com/comment/32073847
has body: I want to write the file as byte only and not the character. String binaryString = "10110101" I am using byte mybyte = Byte.parseByte(binaryString,2); I want to write this converted byte into the file as a byte and not the character. I am using : FileOutputStream fos1 = new FileOutputStream(new File("output")); fos.write(mybyte); But after write, when I see the files the byte is actually written as the characters. Is I am doing something wrong in conversion ? How to make it write as byte and not char ? Edit: Like for the String 101101010111001011111000 (taking 8 bits at a time and then writing to the file) : it is converted to "Z9|".
has title: Converting Binary String into byte and not char while writing to file
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32075866
tagged with: java-io
has comment: http://stackoverflow.com/comment/32074072
has comment: http://stackoverflow.com/comment/32073763
has comment: http://stackoverflow.com/comment/32074519
has answer: http://stackoverflow.com/a/21285314
has comment: http://stackoverflow.com/comment/32074082
type: Question

http://stackoverflow.com/a/21222724
score: -1
has body: Your code declares these two member variables in class CheckItem with the private scope. This means no other classes can access them directly on a CheckItem instance: private double myPrice, mySalesTax; If you want class TC1 to be able to read or modify them, declare them in CheckItem.java as public. Alternatively, and generally a better practice, you could add public methods to CheckItem.java to allow other classes to access their values: public double getMyPrice() { return this.myPrice; } public void setMyPrice(double price) { this.myPrice = price; } public double getMySalesTax() { return this.mySalesTax; } public void setMySalesTax(double st) { this.mySalesTax = st; } public int getMyQuantity() { return this.myQuantity; } public void setMyQuantity(int newQty) { this.myQuantity = newQty; } Then, in TC1.java you'd use these methods instead of direct access: items[i].setMyQuantity(quantities[i]); and a[i]=items[i].getMyPrice()*((items[i].getMySalesTax()\100)+1);
upvote count: 0
answers question: http://stackoverflow.com/q/21222617
type: Answer
downvote count: 1

http://stackoverflow.com/comment/32115534
type: QuestionComment
has text: :DDD sorry Dut I can't when I try to change it I get distracted :D
comment on: http://stackoverflow.com/q/21289844
score: 0
type: Comment

http://stackoverflow.com/comment/32146541
comment on: http://stackoverflow.com/a/21325747
type: Comment
score: 1
has text: yeah in that case you can go for `abstract class`. Updated the answer with same.
type: AnswerComment

http://stackoverflow.com/q/21242735
tagged with: filenames
has title: Variable filename in Java
tagged with: java
type: Question
answer count: 1
score: 0
has body: Is there any way you can change the name of a file each time doing a loop? Lets say I've got the following sample code: while(somecondition) { try (PrintWriter w = new PrintWriter("output.txt", "UTF-8");){ w.println("Bye World"); } } Now i want to change the name of output.txt each time the loop starts again to output++.txt. I would now receive: output1.txt output2.txt output3.txt outputn.txt
has answer: http://stackoverflow.com/a/21242747
accepted answer: http://stackoverflow.com/a/21242747
tagged with: printwriter
tagged with: loops
type: AnsweredQuestion

http://stackoverflow.com/comment/31934134
score: 1
has text: Also check out my answer to a similar question [here](http://stackoverflow.com/questions/6172267/how-to-restrict-the-jtextfield-to-a-x-number-of-characters).
comment on: http://stackoverflow.com/q/21205947
type: Comment
type: QuestionComment

http://stackoverflow.com/a/41923781
answers question: http://stackoverflow.com/q/21243729
score: 2
downvote count: 0
upvote count: 2
has body: I used a hashmap and it satisfies o(nlogn) and o(n) time and space complexities import java.util.*; class Solution { public int[] solution(int[] A) { int N = A.length; HashMap&lt;Integer, Integer&gt; count = new HashMap&lt;&gt;(); for (int i : A) { Integer key = count.get(i); if (key != null) { count.put(i, key + 1); } else { count.put(i, 1); } } HashMap&lt;Integer, Integer&gt; divs = new HashMap&lt;&gt;(); for (Integer n : count.keySet()) { int sum = 0; int j = 1; while (j * j &lt;= n) { if (n % j == 0) { if (count.containsKey(j)) { sum += count.get(j); } //find n = j*k cases to add both to the dividors int k = n / j; if (k != j) { if (count.containsKey(k)) { sum += count.get(k); } } } j++; } divs.put(n, N - sum); } for (int i = 0; i &lt; A.length; i++) { A[i] = divs.get(A[i]); } return A; } }
type: Answer

http://stackoverflow.com/q/21207292
has comment: http://stackoverflow.com/comment/31936665
score: 2
has answer: http://stackoverflow.com/a/21207415
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21207389
has answer: http://stackoverflow.com/a/21207397
tagged with: string-matching
has title: Fastest way to create a keyword filter?
tagged with: algorithm
linked to: http://stackoverflow.com/q/4378455
tagged with: java
has answer: http://stackoverflow.com/a/21208890
has comment: http://stackoverflow.com/comment/31936536
has comment: http://stackoverflow.com/comment/31936606
has comment: http://stackoverflow.com/comment/31936736
type: Question
has comment: http://stackoverflow.com/comment/31941297
has answer: http://stackoverflow.com/a/21210837
has body: I'm trying to filter tweets based on keyword filter. The filter could have 10 words or more. So a tweet passes if it contains the keywords. The only thing I can think of is to split the tweet's text into tokens. Then I would loop over the filter words and compare every token to every words in the filter. However this way seems very slow. Suppose the keyword filter has N keywords and the number of tokens is M, then its needs O(N*M). Is there a better approach?
downvote count: 0
answer count: 6
has answer: http://stackoverflow.com/a/21208201
favorite count: 0
has comment: http://stackoverflow.com/comment/31936562

http://stackoverflow.com/comment/110431858
score: 0
type: AnswerComment
has text: @noone "`stage.getActors()` should also contain all actors." I don't know man, if you put a `Group` in that `Stage`, and put 10 `Actor`s inside the group `stage.getActors()` will only return the `Group` actor, it won't return the 10 actors inside that `Group`. I think this is what he meant when he said "Grouping System".
comment on: http://stackoverflow.com/a/21202655
type: Comment

http://stackoverflow.com/comment/32056457
comment on: http://stackoverflow.com/q/21274609
has text: Can't be done. Even if it's signed, you may still have dialogs appearing. You could consider using Java Web Start, but I'm not sure if this will solve the problem entirely
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/21254250
has answer: http://stackoverflow.com/a/21254296
possible better answer: http://stackoverflow.com/a/21254333
tagged with: android
has comment: http://stackoverflow.com/comment/32019753
has body: For practice I make the example "Building your first app" on https://developer.android.com/training/basics/firstapp/index.html Now I have problem with Intents. Eclipse say "Unreachable Code" I have already imported the class Intent (import android.content.Intent;) Intent intent = getIntent(); Here is the code: package com.example.test; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.MenuItem; import android.support.v4.app.NavUtils; import android.annotation.TargetApi; import android.os.Build; import android.content.Intent; import android.widget.TextView; public class DisplayMessageActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_message); // Show the Up button in the action bar. setupActionBar(); } /** * Set up the {@link android.app.ActionBar}, if the API is available. */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) private void setupActionBar() { if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) { getActionBar().setDisplayHomeAsUpEnabled(true); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.display_message, menu); return true; // Get the message from the intent **Intent intent = getIntent();** String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); //Create the text view TextView textView = new TextView(this); textView.setTextSize(40); textView.setText(message); //Set the Text view as the activity layout setContentView(textView); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see …
has answer: http://stackoverflow.com/a/21254342
tagged with: android-intent
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21254296
score: 0
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/21254333
has comment: http://stackoverflow.com/comment/32019643
has title: Android Development in Eclipse Unrechable Code Intent
answer count: 3

http://stackoverflow.com/q/21326506
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21326924
has body: I'm working on a code that determines if 2 BST are equal in terms of values or not. This is what I came up with, but it only return true and i don't really know what the problem is. public boolean same(BSTree t2) { return sameTree(root, t2); } private boolean sameTree(TreeNode n, BSTree other) {//L-M-R boolean found = false; if (n != null) { sameTree(n.getLeftNode(), other); if (other.search(n.getData())) { found = true; } sameTree(n.getRightNode(), other); } return found; } In the main method, I created 2 BST and inserted values in them. Then I called I used to following to call the method: System.out.println("Are the trees the same: " + tree1.same(tree2));
tagged with: binary-search-tree
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21326648
has title: Checking if 2 BST are equals in terms of values
tagged with: recursion
has answer: http://stackoverflow.com/a/21326655
tagged with: java
type: Question

http://stackoverflow.com/q/21218958
tagged with: java
has answer: http://stackoverflow.com/a/33454655
type: Question
downvote count: 0
tagged with: hard-drive
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31968252
tagged with: serial-number
has title: Get the real serial number of Hard-Disk in computer using java
has comment: http://stackoverflow.com/comment/31957687
upvote count: 3
type: UnansweredQuestion
has body: I've been trying this code, but I wonder the output is not the serial number (SN). The result only contains the number without alphabet. I wonder, it must be the combination between number and alphabet. Here is the code : import java.io.File; import java.io.FileWriter; import java.io.BufferedReader; import java.io.InputStreamReader; public class DiskUtils { private DiskUtils() { } public static String getSerialNumber(String drive) { String result = ""; try { File file = File.createTempFile("realhowto",".vbs"); file.deleteOnExit(); FileWriter fw = new java.io.FileWriter(file); String vbs = "Set objFSO = CreateObject(\"Scripting.FileSystemObject\")\n" +"Set colDrives = objFSO.Drives\n" +"Set objDrive = colDrives.item(\"" + drive + "\")\n" +"Wscript.Echo objDrive.SerialNumber"; // see note fw.write(vbs); fw.close(); Process p = Runtime.getRuntime().exec("cscript //NoLogo " + file.getPath()); BufferedReader input = new BufferedReader (new InputStreamReader(p.getInputStream())); String line; while ((line = input.readLine()) != null) { result += line; } input.close(); } catch(Exception e){ e.printStackTrace(); } return result.trim(); } public static void main(String[] args){ String sn = DiskUtils.getSerialNumber("C"); javax.swing.JOptionPane.showConfirmDialog((java.awt.Component) null, sn, "Serial Number of C:", javax.swing.JOptionPane.DEFAULT_OPTION); } } Then, i also have tried to proof the real SN that may be true (contains number and alphabet). Here is the tutorial that I got to check the real SN of hard-disk : Open up a command prompt window (Start Menu > All Programs > Accessories > Command Prompt). Type in: vol. The Volume Serial Number is the Disk Serial Number. The result between the code and the tutorial has really a big different. Do you guys know, which one is true ? And how to proof that ?
has answer: http://stackoverflow.com/a/26693894
score: 3
has answer: http://stackoverflow.com/a/21220067

http://stackoverflow.com/a/21220834
downvote count: 0
upvote count: 2
has body: As already written you have to put your next element in a local variable. This is not enough however: please never use == to compare strings. Use String's method equalsinstead or even equalsIgnoreCase. You should use something like : String val = j.next(); if(val.equals("A")){ // you could use val.equalsIgnoreCase("A") to be case insensitive ... } else if (val.equals("B")){ ... As suggested in aljipa's answer, you you to use a switch. If you want your test to be case insensitive can can also write something like: String val = j.next(); switch (val.toUpperCase()) { case "A": a++; break; case "B": ...
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21220718
has comment: http://stackoverflow.com/comment/31961363
type: Answer
accepted answer of: http://stackoverflow.com/q/21220718
score: 2
has comment: http://stackoverflow.com/comment/31961096

http://stackoverflow.com/q/21292284
tagged with: elasticsearch
has comment: http://stackoverflow.com/comment/33094553
upvote count: 4
has title: Is the @timestamp field needed when using Logstash to store in Elasticsearch?
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/21293622
has answer: http://stackoverflow.com/a/21293622
type: Question
tagged with: kibana
has body: I have the following setup: I have a Java tool which sends JSON messages to RabbitMQ. They look like this: { "a": 0, "b": 1, "c": 2 } Now I use Logstash to read the RabbitMQ queue and store them into Elasticsearch, so I can analyze the data with Kibana. The JSON stored in Elasticsearch looks like this: { "a": 0, "b": 1, "c": 2, "@version": "1", "@timestamp": "2014-01-22T19:05:19.136Z" } I don't think the @timestamp field will be of any use for what I'm doing. When I use cURL to store the same JSON in Elasticsearch, only the @version field is there, the @timestamp field is not present. Is there any way to configure Logstash to not save @timestamp?
score: 4
answer count: 2
tagged with: logstash
favorite count: 0
has answer: http://stackoverflow.com/a/21297857
accepted answer: http://stackoverflow.com/a/21297857

http://stackoverflow.com/q/21199058
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21199079
tagged with: backwards-compatibility
tagged with: java
has comment: http://stackoverflow.com/comment/31922912
has comment: http://stackoverflow.com/comment/31922450
type: Question
upvote count: 4
answer count: 2
tagged with: bytecode
downvote count: 0
tagged with: compilation
score: 4
has title: JRE version must be equal to or above JDK version?
has comment: http://stackoverflow.com/comment/31923994
has answer: http://stackoverflow.com/a/21199079
has body: I've read that the bytecodes that the JDK generate are generic. What I say is that they only do things like memory mapping, calling, etc... So if that's true, it would mean that I can, for example, if write a program with characteristics of JDK 1.7, I don't need to worry about if it can run in a user with JRE 1.6? (It's an example, it could happen with more exagerated cases). So, my question is: Can I write a program with new things from 1.7 and run it in 1.6?
has comment: http://stackoverflow.com/comment/31922366
possible better answer: http://stackoverflow.com/a/21199369
tagged with: jvm
has answer: http://stackoverflow.com/a/21199369
favorite count: 0
has comment: http://stackoverflow.com/comment/31922973
has comment: http://stackoverflow.com/comment/31926575
has comment: http://stackoverflow.com/comment/31922437
has comment: http://stackoverflow.com/comment/31923656

http://stackoverflow.com/a/21301069
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32102977
answers question: http://stackoverflow.com/q/21301040
score: 3
upvote count: 3
has body: What you are trying to do is the merge part of a merge-sort algorithm. The links below will give you an in-depth explanation on how to do it. Wikipedia Princeton Edu Colorado Edu

http://stackoverflow.com/comment/32036903
has text: when i use this method, if i change something in tempProgListMin it changed in progList.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21263712
type: Comment

http://stackoverflow.com/q/21242546
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31999955
score: -3
has comment: http://stackoverflow.com/comment/31999936
has answer: http://stackoverflow.com/a/21242696
has comment: http://stackoverflow.com/comment/32000031
tagged with: throwable
has comment: http://stackoverflow.com/comment/31999827
tagged with: java
has comment: http://stackoverflow.com/comment/31999880
type: Question
has body: I know that each java class should extend the Throwable class so that exceptions can be handled. Is this done by: public class Test extends Throwable or public class Test throws Throwable?
has answer: http://stackoverflow.com/a/21243096
has comment: http://stackoverflow.com/comment/31999832
has answer: http://stackoverflow.com/a/21242725
has title: Using the Throwable class
linked to: http://stackoverflow.com/q/6591910
has comment: http://stackoverflow.com/comment/31999998
has comment: http://stackoverflow.com/comment/32000012
answer count: 3
downvote count: 3
tagged with: exception
has comment: http://stackoverflow.com/comment/31999966
linked to: http://stackoverflow.com/q/17333925
favorite count: 0
upvote count: 0

http://stackoverflow.com/comment/32152123
comment on: http://stackoverflow.com/a/21328040
type: Comment
has text: I found it a good solution, but this doesn't seems to work. Below is my code. `NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).wereSentTo("activemq:topic:topicName").create();` `template.sendBodyAndHeaders(theEndpoint, data, headers);` `boolean match = notify.matches(5,TimeUnit.SECONDS);` `if(match) assertMockEndpointsSatisfied();` but match is always false.
score: 0
type: AnswerComment

http://stackoverflow.com/a/21303149
type: Answer
has comment: http://stackoverflow.com/comment/32108137
has comment: http://stackoverflow.com/comment/32111522
has comment: http://stackoverflow.com/comment/32111119
answers question: http://stackoverflow.com/q/21300459
score: 0
has body: You can pass the parameter into java script handler method to solve ur second option. OK And retrieve from the method. @JavascriptInterface public void onClick(String id) { Log.i("JsHandler onClick", id); } u can find the complete tutorial here

http://stackoverflow.com/q/21293897
type: Question
has body: When setting up spring security method authentication with a custom access decision manager, I get a circular bean dependency error that aborts server startup. The custom access decision manager reads security reference data from a database, using services that are also used elsewhere in the application and are themselves secured: I am using spring security 3.0.5, this is the main error message (see full stacktrace bellow): Error creating bean with name 'securityReferenceDataService': Bean with name 'securityReferenceDataService' has been injected into other beans [myAccessDecisionManager] in its raw version as part of a circular reference, but has eventually been wrapped. This is the spring configuration for the global-security-method element and the security reference data service: &lt;bean id="myAccessDecisionManager" class="sample.mvc.root.context.services.MyAccessDecisionManager"&gt; &lt;property name="securityReferenceDataService" ref="securityReferenceDataService"/&gt; &lt;/bean&gt; &lt;security:global-method-security secured-annotations="enabled" jsr250-annotations="enabled" access-decision-manager-ref="myAccessDecisionManager" /&gt; This is the simplified code for the security reference data service: public class SecurityReferenceDataDao { @Secured(value = "ADMIN") public List&lt;SecurityReferenceData&gt; loadSecurityReferenceData() { ... } } Full stack trace: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'securityReferenceDataService': Bean with name 'securityReferenceDataService' has been injected into other beans [myAccessDecisionManager] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example. at org.springframework.beans.factory.support.AbstractAutowireCap…
tagged with: spring-security
tagged with: security
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring
has answer: http://stackoverflow.com/a/21293898
accepted answer: http://stackoverflow.com/a/21293898
type: AnsweredQuestion
score: 1
tagged with: java
has title: Spring security circular bean dependency error
upvote count: 1

http://stackoverflow.com/a/21193081
score: 0
has body: Something like: public static abstract class Lazy&lt;T&gt; { private T t = null; public synchronized T get() { if (t == null) { t = create(); } return t; } protected abstract T create(); } public static final Lazy&lt;List&lt;String&gt;&gt; lazyList = new Lazy&lt;List&lt;String&gt;&gt;(){ @Override protected List&lt;String&gt; create() { return new ArrayList&lt;String&gt;(); } };
answers question: http://stackoverflow.com/q/21192950
type: Answer

http://stackoverflow.com/q/21233123
possible better answer: http://stackoverflow.com/a/21233276
has answer: http://stackoverflow.com/a/21233276
has title: Error in removing object from ArrayList in Java [Eclipse]
has comment: http://stackoverflow.com/comment/31982738
has comment: http://stackoverflow.com/comment/31982824
has comment: http://stackoverflow.com/comment/31982902
tagged with: arraylist
has comment: http://stackoverflow.com/comment/31982859
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31983469
has body: I have this method that removes a specific Object P from the ArrayList here is my code: public void removeProduct(Product p) throws StockException{ int flag=0; for(Product i:StockProducts) if(p.getCode()==i.getCode()){ this.StockProducts.remove(p); flag=1; } if(flag==0){ StockException e = new StockException("could not remove the Product , PRODUCT IS NOT IN THE STOCK: ", p); throw e; } } Error : Exception in thread "main" java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(Unknown Source) at java.util.ArrayList$Itr.next(Unknown Source) at Stock.removeProduct(Stock.java:29) at Test.main(Test.java:18) If you need further information about my code tell me ADDING METHOD public void addProduct(Product p) throws StockException{ for(Product i:StockProducts) if(p.getCode()==i.getCode()){ StockException e = new StockException("could not add the Product , CODE ALREADY EXIST IN STOCK: ", p); throw e; } this.StockProducts.add(p); }
has answer: http://stackoverflow.com/a/21233220
has comment: http://stackoverflow.com/comment/31982710
type: Question
answer count: 2
tagged with: concurrentmodification
has comment: http://stackoverflow.com/comment/31982614
tagged with: collections
has comment: http://stackoverflow.com/comment/31983348
has comment: http://stackoverflow.com/comment/31982675
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31982647
accepted answer: http://stackoverflow.com/a/21233220

http://stackoverflow.com/a/21268567
type: Answer
has body: You could store the word in one array and use another array as the masked word. Then fetch user input and loop through the arrays to replace letters when found. Like so: char word[] = "qwert".toCharArray(); char mask[] = "_____".toCharArray(); char input = getUserInput(); //made up method, of course... for(int i = 0; i &lt; word.length; i++) { if(word[i] == input) { mask[i] = input; } } //repeat until solved, use a counter or something...
score: 0
answers question: http://stackoverflow.com/q/21268433

http://stackoverflow.com/q/21253808
type: AnsweredQuestion
has body: I want to automatically cut a string from a textarea up to 255 characters. . So that my Action gets only 255 characters. But the problem is Javascript considers line break as one character while Java treats it as two ("\r\n"). So even if I limit text area string length to 255 characters by following code $('textarea[name*="matterData.customFields"]').each(function () { if($(this).val().length&gt;=255){ a=$(this).val().substring(0, 254); $(this).val(a); } in my action string length is always greater than 255 characters as new line is changed to "\r\n" How can I remove this extra \r from jQuery itself?
answer count: 1
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21253922
accepted answer: http://stackoverflow.com/a/21253922
tagged with: javascript
tagged with: jquery
has title: Java Action receiving “\r\n” for each new line in textarea field But Javascript gets only '\n'
type: Question

http://stackoverflow.com/a/21246990
has comment: http://stackoverflow.com/comment/32008022
accepted answer of: http://stackoverflow.com/q/21246968
type: Answer
has comment: http://stackoverflow.com/comment/32008088
answers question: http://stackoverflow.com/q/21246968
score: 5
has body: You're looping over every cell in the snake, including the head. The head is in the same spot as the head, so the snake eats its own face and dies. Don't include the head in the loop.
type: AcceptedAnswer
upvote count: 5
downvote count: 0

http://stackoverflow.com/comment/31910974
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21192863
has text: The NPE will be thrown by `things.length` before `things[i]`.

http://stackoverflow.com/q/21223660
tagged with: android
possible better answer: http://stackoverflow.com/a/21223931
has comment: http://stackoverflow.com/comment/31966296
has answer: http://stackoverflow.com/a/21223931
type: AnsweredQuestion
has body: Hi I am writing a simple app that interacts with androids camera API directly, I'm using this tutorial http://www.tutorialspoint.com/android/android_camera.htm Could anyone show me where I am going wrong? The log output: 01-09 23:42:56.901: D/ATRecorder(886): com.htc.autotest.dlib.RecordEngine in loader dalvik.system.DexClassLoader@40528bb8 01-09 23:42:57.161: D/AndroidRuntime(886): Shutting down VM 01-09 23:42:57.161: W/dalvikvm(886): threadid=1: thread exiting with uncaught exception (group=0x400205a0) 01-09 23:42:57.171: E/AndroidRuntime(886): FATAL EXCEPTION: main 01-09 23:42:57.171: E/AndroidRuntime(886): java.lang.RuntimeException: startPreview failed 01-09 23:42:57.171: E/AndroidRuntime(886): at android.hardware.Camera.startPreview(Native Method) 01-09 23:42:57.171: E/AndroidRuntime(886): at com.example.camera1.ShowCamera.surfaceCreated(ShowCamera.java:30) 01-09 23:42:57.171: E/AndroidRuntime(886): at android.view.SurfaceView.updateWindow(SurfaceView.java:551) 01-09 23:42:57.171: E/AndroidRuntime(886): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:348) 01-09 23:42:57.171: E/AndroidRuntime(886): at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 01-09 23:42:57.171: E/AndroidRuntime(886): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 01-09 23:42:57.171: E/AndroidRuntime(886): at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 01-09 23:42:57.171: E/AndroidRuntime(886): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 01-09 23:42:57.171: E/AndroidRuntime(886): at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 01-09 23:42:57.171: E/AndroidRuntime(886): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 01-09 23:42:57.171: E/AndroidRuntime(886): at android.view.ViewGroup.drawChild(ViewGroup.java:1730) 01-09 23:42:57.171: E/AndroidRuntime(886): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 01-09 23:42:57.171: E/AndroidRuntime(886): at android.view.View.draw(View.java:6973) 01-09 23:42:57.…
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/7942378
tagged with: android-camera
has comment: http://stackoverflow.com/comment/31966474
linked to: http://stackoverflow.com/q/13660009
has comment: http://stackoverflow.com/comment/31966160
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21231573
has title: Android: Uncaught exception causing fatal exception in main
has comment: http://stackoverflow.com/comment/31966386
has comment: http://stackoverflow.com/comment/31966269
accepted answer: http://stackoverflow.com/a/21231573
tagged with: exception

http://stackoverflow.com/q/21295940
tagged with: java
tagged with: http-response-codes
tagged with: http
type: Question
answer count: 2
has title: What is the correct HTTP error code to return, 404 vs 412?
accepted answer: http://stackoverflow.com/a/21302419
has answer: http://stackoverflow.com/a/21296454
score: 0
tagged with: rest
has body: I am working on designing the REST APIs. One of the POST request to create a room in a home takes an input of ID of the home and room name like : POST /webCall/development/construction <?xml version="1.0"?> <home id='110001'/> large bedroom So my question here is,suppose the home ID = 110001, doesn't exist in the system, In that case should 404(Resource not found) be the response code or 412(Precondition failed) be the response code. Possible arguements. Why 404 : The resource home with ID : 110001 is not found. Why 412 : The precondition to create a room is that a home should exist,which fails here. Please provide your suggestions with reasoning, that would help me to take right decision.
possible better answer: http://stackoverflow.com/a/21296454
tagged with: web-services
has answer: http://stackoverflow.com/a/21302419
type: AnsweredQuestion

http://stackoverflow.com/a/21293977
has body: I think you should define both the success and the failure url as properties in your configuration and then let the filter decide which way to go. You can change the properties of the bean if you make it accessible (by making it public or with a setter) but that is probably not want you want since it changes the property for the single bean instance in the application context which is used by several threads concurrently. Best regards Hacim
answers question: http://stackoverflow.com/q/21293637
score: 0
type: Answer

http://stackoverflow.com/comment/31930623
comment on: http://stackoverflow.com/a/21203883
type: AnswerComment
has text: To display file lists from .../Test dir. @SanthoshKumar544
score: 0
type: Comment

jbutton
tags question: http://stackoverflow.com/q/21326771
tags question: http://stackoverflow.com/q/21213854
tags question: http://stackoverflow.com/q/21187552
tags question: http://stackoverflow.com/q/21273008
tags question: http://stackoverflow.com/q/21223001
tags question: http://stackoverflow.com/q/21221749
tags question: http://stackoverflow.com/q/21266532
tags question: http://stackoverflow.com/q/21346013
tags question: http://stackoverflow.com/q/21228740
tags question: http://stackoverflow.com/q/21261379
type: Tag
tags question: http://stackoverflow.com/q/21246036
tags question: http://stackoverflow.com/q/21228733
tags question: http://stackoverflow.com/q/21201578
tags question: http://stackoverflow.com/q/21339367
tags question: http://stackoverflow.com/q/21346281
tags question: http://stackoverflow.com/q/21298371
tags question: http://stackoverflow.com/q/21254845
tags question: http://stackoverflow.com/q/21203346
tags question: http://stackoverflow.com/q/21246405
tags question: http://stackoverflow.com/q/21269532
tags question: http://stackoverflow.com/q/21214640
tags question: http://stackoverflow.com/q/21205429
tags question: http://stackoverflow.com/q/21287577
tag name: jbutton
tags question: http://stackoverflow.com/q/21240059
tags question: http://stackoverflow.com/q/21293646
tags question: http://stackoverflow.com/q/21340941

http://stackoverflow.com/a/21215216
score: 1
has body: If you already have the array , so what you need is call your methods and pass this value to it lets say you have this array : double[] num = {1.2,2.3}; and your count is the length of num array , so the count is: int count = num.length; then call your method and pass the parameters to it like this: findMin(num , count ); computePositiveSum(num , count ); countNegative(num , count ); Note : you need to read in Object-Oriented Programming Concepts
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21215151

http://stackoverflow.com/comment/31912715
comment on: http://stackoverflow.com/q/21193590
score: 1
has text: I was stuck on this problem for an hour, but after I drank a cup of milk, I triedagain, it did not work, then put the second class in an other package which I include in the main class, it did not work, then move back in the same folder and it worked again. I already did that before but now it is working for no reason. Should I delete my post ? PS: everytime, I ran it by right-click on the project > run as > java application
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21207760
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/21207635
has body: Try to set the JAVA_TOOL_OPTIONS environment variable to -Dfile.encoding=UTF8
has comment: http://stackoverflow.com/comment/31937357
upvote count: 3
answers question: http://stackoverflow.com/q/21207635

http://stackoverflow.com/a/21339592
type: Answer
score: 2
upvote count: 2
has body: No - all ADT does is use the existing JDK environment :)
answers question: http://stackoverflow.com/q/21339570
downvote count: 0

http://stackoverflow.com/q/21322375
has answer: http://stackoverflow.com/a/21323635
score: 5
has comment: http://stackoverflow.com/comment/32142231
has comment: http://stackoverflow.com/comment/32143149
answer count: 3
favorite count: 0
has body: If a program sends data to my standard input stream in Java through a pipe, how can I make my Java program atuomatically detect if new data is coming through the pipe into the input stream so that I can read it? I know that I could use an infinite while loop that constantly keeps reading and checking the standard input stream. But this is inefficent and it takes a lot of resources. I am not even allowed to do this for my assignment. It has to be synchronized somehow. Can I put a listener on the pipe or standard input that says: "Hey! Read the standard input now! New data is coming!" or can I make the pipe send interrupts or how do I do this?
has answer: http://stackoverflow.com/a/21323757
has comment: http://stackoverflow.com/comment/72076615
type: UnansweredQuestion
has title: Read from Java standard input without polling or constantly reading and without wasting resources
has answer: http://stackoverflow.com/a/21322419
upvote count: 6
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/a/21341556
answers question: http://stackoverflow.com/q/21339029
has body: Of course you could manually "shallow clone" the node -- create a new element node using the name/namespace from the existing one -- then move the attributes over and replace the old node with the new one.
score: 0
type: Answer

http://stackoverflow.com/comment/32232068
comment on: http://stackoverflow.com/a/21371485
type: AnswerComment
score: 0
type: Comment
has text: If you're reading from input, you'll need to wrap in a try/catch block, because there's a possibility of an error with the IO. (welcome to checked exceptions of java). I've edited my answer to include this. read doesn't prompt 4 times, it will just read 4 characters, from a single input.

http://stackoverflow.com/comment/32125022
has text: So this would block the synchronous thread and hold it until the asynchronous thread is complete correct?
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21313963
type: Comment

http://stackoverflow.com/comment/32170347
type: Comment
type: QuestionComment
has text: If you had a GUI, you can add a `KeyListener` to your `JFrame`.
score: 0
comment on: http://stackoverflow.com/q/21339069

http://stackoverflow.com/comment/31917711
type: QuestionComment
has text: where are you declaring your `image1square` objects?
type: Comment
comment on: http://stackoverflow.com/q/21196499
score: 0

http://stackoverflow.com/a/21263594
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: In a nutshell, OSGi .qualifier means the same thing as -SNAPSHOT. Since OSGi doesn't allow for more than 3 numbers in a version (+ qualifier), creating a -mine version is a bit tricky. According to the FAQ, you can tell Tycho a string that it should be use to replace qualifier with: mvn -DforceContextQualifier=mine Note that this disables all the goodness you get from SNAPSHOT versions (namely that you can deploy the bundle several times).
upvote count: 3
has comment: http://stackoverflow.com/comment/32159188
accepted answer of: http://stackoverflow.com/q/21256478
score: 3
answers question: http://stackoverflow.com/q/21256478

http://stackoverflow.com/comment/32003351
score: 0
comment on: http://stackoverflow.com/a/21228929
type: Comment
has text: Thanks Andrew Thompson. That helped a lot :D
type: AnswerComment

http://stackoverflow.com/q/21277505
has body: After using Tomcat for quite a while we have decided to move to Glassfish. In Tomcat we used to put all the Jar's we wanted to share between projects under the tomcat7/lib dir, in Glassfish I've put the Jar's in glassfish/domains/domain1/lib and yet I cannot import classes I have in the Jar's there. The project build path has ofcourse the Glassfish System Libraries there. Do I have to reference every Jar in a default-web.xml in the config dir or am I missing something else here?
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21286460
linked to: http://stackoverflow.com/q/6889545
tagged with: glassfish
type: AnsweredQuestion
tagged with: shared-libraries
accepted answer: http://stackoverflow.com/a/21286460
type: Question
linked to: http://stackoverflow.com/q/13056010
answer count: 1
has title: Glassfish 4.0 domain library Jars are not recognized

http://stackoverflow.com/q/21237572
tagged with: json-deserialization
type: AnsweredQuestion
tagged with: list
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Group list of objects in a list attribute during deserialization using Jackson
upvote count: 1
linked to: http://stackoverflow.com/q/8263008
accepted answer: http://stackoverflow.com/a/21238603
type: Question
has body: I have a JSON Structure looking like this: [ { "id": 0, "name": "Foo" }, { "id": 1, "name": "Bar" } ] and a corresponding Java Object for Data binding: public class Thing { public int id; public String name; } I know how I could deserialize the JSON list into a list of Thing. Now here comes the tricky part: What I want to do is deserializing the JSON into a class looking like the following snippet by only doing changes to this class: public class Things { private List&lt;Thing&gt; things; public void setThings(List&lt;Thing&gt; things) { this.things = things; } public List&lt;Thing&gt; getThings() { return this.things; } } This is because the JSON deserialization is build in deep in our application by using an ObjectMapper like this: private static &lt;T&gt; T parseJson(Object source, Class&lt;T&gt; t) { TypeReference&lt;T&gt; ref = new TypeReference&lt;T&gt;() { }; TypeFactory tf = TypeFactory.defaultInstance(); //[...] obj = mapper.readValue((String) source, tf.constructType(ref)); //[...] return obj; } Are there any annotations with which I can achieve what I want or do I have to make changes to the mapper-code? Much thanks in advance, McFarlane
tagged with: jackson
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21238603

http://stackoverflow.com/comment/32000107
type: Comment
type: QuestionComment
has text: @HovercraftFullOfEels--You're right about this being a duplicate. The suggestions at the link are dicey and hard to follow, so I'll have to study them more carefully. Seems a lot to go through for such a common need. I may settle for VGR's 2-line side note, as it makes my 3-spinner method look childish and is simple to implement as is.
comment on: http://stackoverflow.com/q/21225401
score: 0

http://stackoverflow.com/a/21198766
type: Answer
has body: Overall it's ok since it's a very commonly used object in your application. However there are 2 problems you can face as far as I can see: Concurrent access and mutable state of Scanner can be a problem. You might want to synchronize that. Unit testing might be a problem since you can't override static members. It might still be ok if in classes that use it it can be overridden. So it depends on the size of your app and how it's used in terms of multithreading. I would do it at home but not at work.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21198652
downvote count: 0

http://stackoverflow.com/q/21282024
has body: My function is: private void addEdges(mxICell mainObject, List&lt;Object&gt; edgesList) { if (mainObject.getEdgeCount() &gt; 0) { // for (int i = 0; i &lt; mainObject.getEdgeCount(); i++) { edgesList.add(mainObject.getEdgeAt(0)); addEdges(((Line) mainObject.getEdgeAt(0)).getSource(), edgesList); } // } else return; } BEGING UPDATE The function calling is here: for (Object obj : map.values()) { if (obj instanceof Port &amp;&amp; ((Port) obj).getParent().getStyle().equals("POWER")) { String Feeder = ((Port) obj).getParent().getValue() .toString(); List&lt;Object&gt; edgesList = new ArrayList&lt;Object&gt;(); Port p = (Port) obj; mxICell mainObject = p; addEdges(mainObject, edgesList); //staff }} END UPDATE it gives me a Exception occurred during event dispatching: java.lang.StackOverflowError
answer count: 2
has comment: http://stackoverflow.com/comment/32068455
has comment: http://stackoverflow.com/comment/32068512
score: 0
has comment: http://stackoverflow.com/comment/35104143
has answer: http://stackoverflow.com/a/21282065
has answer: http://stackoverflow.com/a/21282178
has comment: http://stackoverflow.com/comment/32068448
type: UnansweredQuestion
tagged with: recursion
tagged with: java
has title: Java Recursive function fails
has comment: http://stackoverflow.com/comment/32068628
tagged with: jgraph
type: Question

linux
tags question: http://stackoverflow.com/q/21315230
tags question: http://stackoverflow.com/q/21337078
tags question: http://stackoverflow.com/q/21279864
tags question: http://stackoverflow.com/q/21253290
tags question: http://stackoverflow.com/q/21207715
tags question: http://stackoverflow.com/q/21285849
tags question: http://stackoverflow.com/q/21284815
tags question: http://stackoverflow.com/q/21281000
tags question: http://stackoverflow.com/q/21270125
tags question: http://stackoverflow.com/q/21282327
tags question: http://stackoverflow.com/q/21305606
tags question: http://stackoverflow.com/q/21194466
type: Tag
tags question: http://stackoverflow.com/q/21332109
tags question: http://stackoverflow.com/q/21203708
tags question: http://stackoverflow.com/q/21261616
tags question: http://stackoverflow.com/q/21184915
tags question: http://stackoverflow.com/q/21311439
tags question: http://stackoverflow.com/q/21212060
tag name: linux
tags question: http://stackoverflow.com/q/21265111
tags question: http://stackoverflow.com/q/21252303
tags question: http://stackoverflow.com/q/21215595
tags question: http://stackoverflow.com/q/21185156
tags question: http://stackoverflow.com/q/21212629
tags question: http://stackoverflow.com/q/21299873
tags question: http://stackoverflow.com/q/21314199

http://stackoverflow.com/comment/32141582
type: Comment
has text: I add in the code you provide in my project and get error as well. I also go to the link you provide, what its mean "Manually uninstall the App from device and restart the device"? I also recreate my key again, but still can't fixed the error. Please help, thanks.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21307321

http://stackoverflow.com/a/21327593
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21327497
has comment: http://stackoverflow.com/comment/32237623
has comment: http://stackoverflow.com/comment/32289687
answers question: http://stackoverflow.com/q/21327497
score: 3
has comment: http://stackoverflow.com/comment/32238601
type: AcceptedAnswer
downvote count: 0
has body: Required jar is missing SO you have to download the required jar and then set your classpath download link
has comment: http://stackoverflow.com/comment/32237156
type: Answer

http://stackoverflow.com/a/21243392
type: AcceptedAnswer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21243247
type: Answer
answers question: http://stackoverflow.com/q/21243247
downvote count: 0
has body: The system date that you get will also include hours, minutes, seconds and milliseconds. You are only printing out the year, month and day. So they will look the same when you print these but when you compare them with .equals it will return false due to the time portion of the dates being different. You could format the dates and compare the strings from the format to see if they are the same if(dateFormat.format(tempdate).equals(dateFormat.format(currdate))){...}
score: 3

http://stackoverflow.com/q/21312075
type: UnansweredQuestion
tagged with: java
tagged with: eclipse
has body: If I'm referencing an external library from an project in Eclipse for instance 'org.eclipse.swt.*', how can I tell what jar-file I need to reference ? EDIT: I know I can look at the contents of a jar file but that's not very convenient to do. Isn't there any documentation for org.eclipse.swt what jar file a given package is in ?
type: Question
has answer: http://stackoverflow.com/a/21312399
has comment: http://stackoverflow.com/comment/32121842
has comment: http://stackoverflow.com/comment/32121698
score: 0
answer count: 2
has title: How can I tell a given package belongs to which jar?
has answer: http://stackoverflow.com/a/21312234
tagged with: jar
tagged with: packaging
has comment: http://stackoverflow.com/comment/32121629

http://stackoverflow.com/comment/31941595
has text: Not without some JNI/JNA. You could start by looking at the [Game Centre for Developers](https://developer.apple.com/game-center/)
score: 0
comment on: http://stackoverflow.com/q/21210007
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32028268
comment on: http://stackoverflow.com/q/21248160
type: Comment
type: QuestionComment
score: 0
has text: But as a note about the close vote: I do understand that the eventual solution that _you_ need is to find a factory for PircBots, or to implement one, or something that will provide you an instance, and that's going to be the main challenge. However, what actually appears in the question is "non-static method … cannot be referenced from a static context." Future users who need information about abstract classes won't find this question by searching, but users who need information about static vs. non static contexts will, and their question has already been answered.

http://stackoverflow.com/comment/32118875
type: Comment
comment on: http://stackoverflow.com/a/21306010
score: 0
type: AnswerComment
has text: If you can use spring, it's the best solution and easy to use. Could you post part of your pom.xml? Since you are not using spring, I think you should take a look at this: http://ridgetopsolutions.com/blog/2013/02/12/getting-started-with-aspectj-and-maven/ You may be missing something in your pom.

http://stackoverflow.com/comment/32244172
comment on: http://stackoverflow.com/a/21309484
score: 0
type: Comment
has text: @Koneri If my answer solved your problem, don't forget to select it as the answer for the question (check mark next to my answer). As for your question, I'm not sure I understand. The `Socket client = server.accept();` binds the server to the client (creating a connection). That method blocks (doesn't execute past the line) until a client connects successfully.
type: AnswerComment

http://stackoverflow.com/comment/32116923
type: Comment
type: QuestionComment
has text: yes that is working for me, what i will do is i will show you the code which will produce the graph on jsfiddle.net.
comment on: http://stackoverflow.com/q/21306806
score: 0

http://stackoverflow.com/comment/32073231
has text: Do a clean + build on all sources.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21283880

aspectj
tags question: http://stackoverflow.com/q/21305465
tags question: http://stackoverflow.com/q/21208594
tag name: aspectj
tags question: http://stackoverflow.com/q/21316904
type: Tag
tags question: http://stackoverflow.com/q/21257066
tags question: http://stackoverflow.com/q/21271485
tags question: http://stackoverflow.com/q/21187411

http://stackoverflow.com/comment/102926963
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21261220
type: Comment
has text: Can you add an example or a link?

http://stackoverflow.com/q/21230555
has body: First time I run onClickMap function(click button) it works and the mapFragment appears, then I click spotList button and it works too and the SpotListFragment appears, then I run onClickMap again and the app crashes! Screen Image: MainActivity.class package com.pap.myspots; import com.pap.myspots.adapter.TabsPagerAdapter; import com.pap.myspots.fragments.MapFragment; import com.pap.myspots.fragments.NotificationsFragment; import com.pap.myspots.fragments.SpotListFragment; import android.app.ActionBar; import android.app.ActionBar.Tab; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; import android.view.View; import android.widget.ImageView; import android.widget.TextView; public class MainActivity extends FragmentActivity implements ActionBar.TabListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; String local; // Tab titles @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Initilization viewPager = (ViewPager) findViewById(R.id.pager); actionBar = getActionBar(); mAdapter = new TabsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mAdapter); actionBar.setHomeButtonEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Adding Tabs ImageView mapTab = new ImageView(this); mapTab.setBackgroundColor(Color.parseColor("#ffbb33")); //mapTab.setImageResource(R.drawable.notificationsicon); actionBar.addTab(actionBar.newTab().setIcon(R.drawable.nicon) .setTabListener(this)); actionBar.addTab(actionBar.newTab().setIcon(…
has comment: http://stackoverflow.com/comment/31978143
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21230877
type: AnsweredQuestion
tagged with: android
accepted answer: http://stackoverflow.com/a/21230877
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
upvote count: 2
has title: Android:Having problems with fragmentManager(Error XML inflateExeption)
answer count: 1
tagged with: fragmentmanager
tagged with: android-fragments
tagged with: java

http://stackoverflow.com/q/21335998
has answer: http://stackoverflow.com/a/21342243
has comment: http://stackoverflow.com/comment/32165336
has comment: http://stackoverflow.com/comment/32173534
has comment: http://stackoverflow.com/comment/32172985
tagged with: processing
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32166178
tagged with: osc
type: Question
has body: I am trying to send two variables from one sketch to another, using the oscP5 library for processing. The message I am sending is created like this: OscMessage myMessage = new OscMessage("/test"); myMessage.add(title); myMessage.add("Zeit"); oscP5.send(myMessage, remoteLocation); In the second sketch, I receive the data like that: void oscEvent(OscMessage theOscMessage) { if(theOscMessage.checkAddrPattern("/test")) { String title = theOscMessage.get(0).stringValue(); String layoutType = theOscMessage.get(1).stringValue(); addToQueue(title, layoutType); } } And here my simplified addToQueue function: void addToQueue(String title, String layoutType) { if(!existsInQueues(title)) { upcomingHeadlines.add(new Headline(title, printAxis, scrollSpeed, layoutType)); } } Every time I start the sketches, I get the error: ERROR @ OscP5 ERROR. an error occured while forwarding an OscMessage to a method in your program. please check your code for any possible errors that might occur in the method where incoming OscMessages are parsed e.g. check for casting errors, possible nullpointers, array overflows ... . method in charge : oscEvent java.lang.reflect.InvocationTargetException I have been able to track the problem down to the layoutType-Variable. If I change String layoutType = theOscMessage.get(1).stringValue(); to String layoutType = "Zeit"; no error occurs. That is quite confusing, because both versions should have the same result. The error message does not help me in any way. Edit I have compared the two possible variables like that: String layoutType = theOscMessage.get(1).stringValue(); String layoutTypeB = "Zeit"; if(layoutType.equals(layoutTypeB)) println("Same String!"); Since gets printed to the console, both have to be the same … I really do not know where to search for an error anymore. Edit 2 I have wrapped my second sketch in try {...} catch(Exception ex) {ex.printStackTrace();} like that: void oscEvent(OscMessage theOscMessage) { try { if(theOscMessage.checkAddrP…
answer count: 1
score: 0
linked to: http://stackoverflow.com/q/513832
accepted answer: http://stackoverflow.com/a/21342243
has comment: http://stackoverflow.com/comment/32174842
has comment: http://stackoverflow.com/comment/32165199
has title: InvocationTargetException while trying to add variables to a new object

http://stackoverflow.com/comment/31908375
has text: @VikasNehaOjha But the `@` is missing, isn't it? I think it should be `li[@list]`.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21189736
type: Comment

http://stackoverflow.com/comment/32067751
has text: One obvious thing to try is calling `ps.setNull(1, 3);` and seeing whether that then shows a value of 3...
score: 0
comment on: http://stackoverflow.com/q/21281592
type: Comment
type: QuestionComment

sqlite
tags question: http://stackoverflow.com/q/21219039
tags question: http://stackoverflow.com/q/21254031
tags question: http://stackoverflow.com/q/21296029
tags question: http://stackoverflow.com/q/21283883
tags question: http://stackoverflow.com/q/21319210
tags question: http://stackoverflow.com/q/21267851
tags question: http://stackoverflow.com/q/21242551
type: Tag
tags question: http://stackoverflow.com/q/21309808
tags question: http://stackoverflow.com/q/21325983
tags question: http://stackoverflow.com/q/21273314
tags question: http://stackoverflow.com/q/21203457
tags question: http://stackoverflow.com/q/21230486
tags question: http://stackoverflow.com/q/21244760
tags question: http://stackoverflow.com/q/21313280
tags question: http://stackoverflow.com/q/21319362
tags question: http://stackoverflow.com/q/21193819
tags question: http://stackoverflow.com/q/21290985
tags question: http://stackoverflow.com/q/21333054
tags question: http://stackoverflow.com/q/21230535
tags question: http://stackoverflow.com/q/21320448
tags question: http://stackoverflow.com/q/21308092
tags question: http://stackoverflow.com/q/21319769
tags question: http://stackoverflow.com/q/21189685
tag name: sqlite
tags question: http://stackoverflow.com/q/21327175
tags question: http://stackoverflow.com/q/21310506

http://stackoverflow.com/q/21189170
has body: I'm writing a WSDL file and I can't get rid of this warning from the Eclipse validator: WS-I: (BP2208) wsdl:operation was not a request/response or one-way operation. This is the WSDL source I wrote: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://pad.polito.it/ACSAuth" xmlns:tns="http://pad.polito.it/ACSAuth"> <xs:element name="AccessDB" type="tns:AccessDBType"> <xs:element name="passThrough" type="tns:passThroughType"/> </xs:schema> <part name="db" element="tns:AccessDB"/> <part name="info" element="tns:passThrough"/> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> <soap:operation soapAction="" /> <soap:body use="literal"/> <soap:operation soapAction="" /> <soap:body use="literal"/> <soap:address location="http://localhost:8181/ACSAuth"/> Here you can find the complete WSDL file: https://dl.dropboxusercontent.com/u/33459047/StackOverflow/Master.wsdl I believe that the source of the problem is the operation "updateManager", but I don't know how to fix it. Can someone help me please? Thank you in advance.
linked to: http://stackoverflow.com/q/21196171
tagged with: wsdl
downvote count: 0
linked to: http://stackoverflow.com/q/15950938
answer count: 1
has title: Strange WSDL warning during validation in Eclispe: "wsdl:operation was not a request/response or one-way operation"
favorite count: 0
tagged with: soap
tagged with: web-services
accepted answer: http://stackoverflow.com/a/21191278
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21191278
type: Question

http://stackoverflow.com/a/21269623
type: Answer
has body: Java handles the situation like any other language. A divide by zero error generates a processor exception which triggers an interrupt. The interrupt is "read" by the operating system and forwarded to the program if a handler is registered. Since Java registers a handler, it receives the error and then translates it into an ArithmeticException that travels up the stack.
downvote count: 0
score: 8
answers question: http://stackoverflow.com/q/21269461
upvote count: 8

http://stackoverflow.com/comment/31931533
comment on: http://stackoverflow.com/a/21204157
type: Comment
has text: obviously it will say you are returning integer and the return type is string.
score: 0
type: AnswerComment

task
type: Tag
tag name: task
tags question: http://stackoverflow.com/q/21216892

http://stackoverflow.com/q/21310539
has answer: http://stackoverflow.com/a/21316473
has comment: http://stackoverflow.com/comment/32119151
accepted answer: http://stackoverflow.com/a/21316473
has body: I am supposed to extract representative terms from an organisation's website using wikipedia's article-link data dump. To achieve this I've - Crawled &amp; downloaded organisation's webpages. (~110,000) Created a dictionary of wikipedia ID and terms/title. (~40million records) Now, I'm supposed to process each of the webpages using the dictionary to recognise terms and track their term IDs &amp; frequencies. For the dictionary to fit in memory, I've splitted the dictionary into smaller files. Based on my experiment with a small data-set, the processing time for the above will be around 75 days. And this is just for 1 organisation. I have to do the same for more than 40 of them. Implementation - HashMap for storing dictionary in memory. looping through each map entry to search the term in a webpage, using Boyer-Moore search implementation. Repeating the above for each webpage, and storing results in a HashMap. I've tried optimizing the code and tuning the JVM for better performance. Can someone please advise on a more efficient way to implement the above, reducing the processing time to a few days. Is Hadoop an option to consider?
score: 0
possible better answer: http://stackoverflow.com/a/21314952
has answer: http://stackoverflow.com/a/21314952
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32118660
tagged with: java
tagged with: ontology
has title: How to improve the performance when working with wikipedia data and huge no. of webpages?
type: Question
tagged with: hadoop
answer count: 2
tagged with: wikimedia-dumps
tagged with: text-mining

http://stackoverflow.com/comment/31950883
score: 0
comment on: http://stackoverflow.com/q/21213864
type: Comment
type: QuestionComment
has text: AFAIK Basic Authentication is not the way to do this. Maybe http://stackoverflow.com/questions/11068892/oauth-2-0-authorization-header helps or read some Google documentation.

http://stackoverflow.com/comment/31929258
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21203054
has text: I think `cospring-demo` is not a valid package name (contains hyphen) try using `cospring` in your class `App`.

http://stackoverflow.com/a/21196837
has comment: http://stackoverflow.com/comment/31922057
has comment: http://stackoverflow.com/comment/31932002
type: Answer
has comment: http://stackoverflow.com/comment/31931193
has comment: http://stackoverflow.com/comment/31931563
has body: Ohhh! I think I understand your question now: you have initial values in the hashmap, and you want to modify the values by the values in the text file, (e.g. if the text file says you have 2 of something you want to increase the count of that something by 2?) if that's what you want, you are very close: replace this: //prod.put(Linha[0], Integer.parseInt(Linha[1])); with this: prod.put(Linha[0], prod.get(Linha[0])+Integer.parseInt(Linha[1])); (That's the quick and dirty way - it will fail if you don't initialize the value in the hash map to 0.) You can avoid that by testing for this condition: if (prod.containsKey(Linha[0])) { // update value prod.put(Linha[0], prod.get(Linha[0])+Integer.parseInt(Linha[1])); } else { // first entry prod.put(Linha[0], Integer.parseInt(Linha[1])); } One advantage of this is you can add new products at any time without modifying the code that initializes your map.
answers question: http://stackoverflow.com/q/21195891
has comment: http://stackoverflow.com/comment/31921679
score: 0

http://stackoverflow.com/comment/32148108
score: 0
comment on: http://stackoverflow.com/q/21326214
type: Comment
type: QuestionComment
has text: @JBNizet It does not produce anything so the servlet is not even called. Thanks for pointing out that! There is an error. It said 404 (Not Found).

http://stackoverflow.com/a/21325119
upvote count: 2
score: 1
downvote count: 1
has body: When you prefix a literal number in Java with 0, it is treated as an octal value (base 8). Octal 45 equals 37 in base 10.
answers question: http://stackoverflow.com/q/21325094
type: Answer

http://stackoverflow.com/a/21245469
score: 3
has comment: http://stackoverflow.com/comment/32005983
has comment: http://stackoverflow.com/comment/32005342
downvote count: 0
type: AcceptedAnswer
has body: Something like double highestprice = 0; for (int i = 0; i &lt; data.length; i++) { if(data[i].getPrice() &gt; highestprice) { highestprice = data[i].getPrice(); } }
upvote count: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/21245253
answers question: http://stackoverflow.com/q/21245253

http://stackoverflow.com/a/21203883
has comment: http://stackoverflow.com/comment/31930708
has comment: http://stackoverflow.com/comment/31930795
has comment: http://stackoverflow.com/comment/31930623
answers question: http://stackoverflow.com/q/21203708
has comment: http://stackoverflow.com/comment/31930735
has comment: http://stackoverflow.com/comment/31930768
has comment: http://stackoverflow.com/comment/31930588
has comment: http://stackoverflow.com/comment/31930535
score: 0
type: Answer
has body: Better to try this: File folder = new File("your/path"); File[] listOfFiles = folder.listFiles(); for (int i = 0; i &lt; listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { System.out.println("File " + listOfFiles[i].getName()); } else if (listOfFiles[i].isDirectory()) { System.out.println("Directory " + listOfFiles[i].getName()); } } Hope this helps you

http://stackoverflow.com/comment/32005892
type: AnswerComment
type: Comment
has text: Ah shoot, I forgot to make this more explicit in my description, since I thought it might come up. I had to edit the code snippet to be less revealing, and I made a mistake in demonstrating a mismatch that isn't actually there. Through testing millions of randomly generated ID's, I'm pretty sure that there is no risk of collisions on _id vs userId, and furthermore there cannot exist a user with one without the other in Mongo, there's no API that can do that. But, I'll see if I can get this into testing anyway, to be 100% sure. Thanks!
comment on: http://stackoverflow.com/a/21244902
score: 0

http://stackoverflow.com/a/22728331
score: 0
has body: I am facing the same issue as yours. The error message is saying that EclipseLink is unable to differentiate whether you are querying LassoWarehandlingEntry or LassoWarehandlingEntryHist. (a class indicator field or class extraction method must be set.) Hence, if you query LassoWarehandlingEntry, EclipseLink will query both LassoWarehandlingEntry and LassoWarehandlingEntryHist. So I guess that you are trying to use descriptor.getInheritancePolicy().setShouldReadSubclasses(false); Unfortunately, since we are using InheritanceType.TABLE_PER_CLASS, it seems that we cannot use discriminator annotations (@DiscriminatorColumn and @DiscriminatorValue). These 2 annotations are only for InheritanceType.SINGLE_TABLE and InheritanceType.JOINED. ClassExtractor does not work either. More info at https://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Entities/Inheritance Anyway, I solved this issue by creating an abstract class which will be inherited by both concrete classes. In your case: @MappedSuperclass public abstract class AbstractLassoWarehandlingEntry extends AbstractAuditedOzlEntity implements Serializable { // define the specific stuff of this table ... } @Entity @Table(name = "lasso_warehandling_entry") public class LassoWarehandlingEntry extends AbstractLassoWarehandlingEntry implements Serializable { // Empty class as the content is already defined in AbstractLassoWarehandlingEntry } @Entity @Table(name = "lasso_warehandling_entry_hist") @AttributeOverride(name="id", column=@Column(name="hist_id")) public class LassoWarehandlingEntryHist extends AbstractLassoWarehandlingEntry { ... // add the columns which only exist in the history tables like end_date } By using this approach, you can remove the following line from your HistoryCustomizer class. descriptor.getInheritancePolicy().setShouldReadSubclasses(false); Now, if you query LassoWarehandlingEntry, EclipseLink will just execute 1 query to LassoWarehandlingEntry table. Hope that this helps!
type: Answer
answers question: http://stackoverflow.com/q/21293866

dicom
tag name: dicom
tags question: http://stackoverflow.com/q/21255783
type: Tag

http://stackoverflow.com/a/21271308
score: 6
type: Answer
upvote count: 6
has body: The issue is here: Sent: '{"schedule":"R/2014-02-02T00:00:00Z/PT24H", "name":"Scala-Post-Test", "command":"which scalac", "epsilon":"PT15M", "owner":"myemail@thecompany.com", "async":false}' to http://localhost:4040/scheduler/iso8601 received 500 You'll note your JSON is surrounded by single quotes. This makes it invalid. Also worth noting is that while this code works, you are using a DataOutputStream.writeBytes() to output your data. This would be problematic if your string including anything but single-byte characters; it strips the high 8 bits off each char (Java uses 2-byte chars to hold UTF-16 codepoints). It's better to use something more suited for String output. The same technique you use for input, for example: BufferedWriter out = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream)); out.write(jsonString); out.close();
accepted answer of: http://stackoverflow.com/q/21268600
answers question: http://stackoverflow.com/q/21268600
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/136524263
score: 0
type: Comment
comment on: http://stackoverflow.com/a/70235368
type: AnswerComment
has text: the cast *back* to (char) is needed exactly because of that implicit promotion to `int`

http://stackoverflow.com/q/21247835
has title: ways to upload PDF in your site
has answer: http://stackoverflow.com/a/21248508
tagged with: jsp
has comment: http://stackoverflow.com/comment/32009554
score: 0
answer count: 3
tagged with: http://stackoverflow.com/tag/pdf
has answer: http://stackoverflow.com/a/21480969
accepted answer: http://stackoverflow.com/a/21248508
has comment: http://stackoverflow.com/comment/32009423
has body: I'm using JSP/Java and Spring MVC as framework. I'm going to support uploading PDF files to my site. The site will be uploaded to a free web hosting site. I want to know which is the best way to support the uploading the PDF files: Save it into database? Save it to the web server ( if this is possible ) Save it to your recommendation ( please share what you have in mind ) And also give me a link or tutorial of how may I do this ( if you suggest other than option 1 and 2 ) Thank you in advance.
possible better answer: http://stackoverflow.com/a/21248418
has comment: http://stackoverflow.com/comment/32009474
has answer: http://stackoverflow.com/a/21248418
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32009493
type: Question

http://stackoverflow.com/comment/32069797
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21282785
has text: thanks. the list contains String objects.

http://stackoverflow.com/q/21255106
has comment: http://stackoverflow.com/comment/32021038
answer count: 1
has comment: http://stackoverflow.com/comment/32021926
favorite count: 0
has comment: http://stackoverflow.com/comment/32021435
has answer: http://stackoverflow.com/a/21255612
has body: I have made a program in Java that allows the server admin to monitor the client processes. It's all OK when I'm sending data to the server. But, when I try to send data back, it just doesn't receive it. import java.io.*; import java.net.*; class TCPServer { public static void main(String argv[]) throws Exception { String clientSentence; String capitalizedSentence; ServerSocket welcomeSocket = new ServerSocket(6789); while (true) { Socket connectionSocket = welcomeSocket.accept(); BufferedReader inFromClient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream())); DataOutputStream outToClient = new DataOutputStream(connectionSocket.getOutputStream()); clientSentence = inFromClient.readLine(); System.out.println("Received: " + clientSentence); capitalizedSentence = clientSentence.toUpperCase(); outToClient.writeBytes(capitalizedSentence); } } } I found out the error, i was not sending an "\n" after the message, causing a pile-up and that never got sent. import java.io.*; import java.net.*; class TCPServer { public static void main(String argv[]) throws Exception { String clientSentence; String capitalizedSentence; ServerSocket welcomeSocket = new ServerSocket(6789); while (true) { Socket connectionSocket = welcomeSocket.accept(); BufferedReader inFromClient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream())); DataOutputStream outToClient = new DataOutputStream(connectionSocket.getOutputStream()); clientSentence = inFromClient.readLine(); System.out.println("Received: " + clientSentence); capitalizedSentence = clientSentence.toUpperCase() + "\n"; // &lt;----- outToClient.writeBytes(capitalizedSentence); } } }
has comment: http://stackoverflow.com/comment/32021054
tagged with: tcp
has comment: http://stackoverflow.com/comment/32022058
downvote count: 2
has title: TCP Client sending but not receiving and Server receiving but not sending
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32889606
has comment: http://stackoverflow.com/comment/32021521
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/32021028
type: Question
accepted answer: http://stackoverflow.com/a/21255612

http://stackoverflow.com/comment/51559501
score: 0
has text: don't check class type against string name in 'supports' method. use next expression instead: return clazz.equals(Employee.class);
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21349030

http://stackoverflow.com/q/21267851
has title: NullPointException when trying to print database rows
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21268017
downvote count: 3
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/21267955
score: -2
has answer: http://stackoverflow.com/a/21267955
tagged with: java
tagged with: database
has body: When accessing app page 'CurrentItems', shuts down with the following errors: 01-21 19:51:54.474: E/AndroidRuntime(10418): FATAL EXCEPTION: main 01-21 19:51:54.474: E/AndroidRuntime(10418): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fooditemmonitor/com.example.fooditemmonitor.CurrentItems}: java.lang.NullPointerException 01-21 19:51:54.474: E/AndroidRuntime(10418): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2295) 01-21 19:51:54.474: E/AndroidRuntime(10418): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349) 01-21 19:51:54.474: E/AndroidRuntime(10418): at android.app.ActivityThread.access$700(ActivityThread.java:159) 01-21 19:51:54.474: E/AndroidRuntime(10418): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316) 01-21 19:51:54.474: E/AndroidRuntime(10418): at android.os.Handler.dispatchMessage(Handler.java:99) 01-21 19:51:54.474: E/AndroidRuntime(10418): at android.os.Looper.loop(Looper.java:176) 01-21 19:51:54.474: E/AndroidRuntime(10418): at android.app.ActivityThread.main(ActivityThread.java:5419) 01-21 19:51:54.474: E/AndroidRuntime(10418): at java.lang.reflect.Method.invokeNative(Native Method) 01-21 19:51:54.474: E/AndroidRuntime(10418): at java.lang.reflect.Method.invoke(Method.java:525) 01-21 19:51:54.474: E/AndroidRuntime(10418): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046) 01-21 19:51:54.474: E/AndroidRuntime(10418): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862) 01-21 19:51:54.474: E/AndroidRuntime(10418): at dalvik.system.NativeStart.main(Native Method) 01-21 19:51:54.474: E/AndroidRuntime(10418): Caused by: java.lang.NullPointerException 01-21 19:51:54.474: E/AndroidRuntime(10418): at com.example.fooditemmonitor.CurrentItems.updateTable(CurrentItems.java:65) 01-21 19:51:54.474: E/AndroidRuntime(10418): at com.example.fooditemmonitor.CurrentItems.onCreate(CurrentItems.java:34) 01-21 19:51:54…
has comment: http://stackoverflow.com/comment/32044346
answer count: 2
has answer: http://stackoverflow.com/a/21268017
tagged with: sqlite
favorite count: 0
tagged with: nullpointerexception

http://stackoverflow.com/comment/31954950
comment on: http://stackoverflow.com/a/21217426
score: 0
type: Comment
has text: When I pass the ArrayAdapter into EndlessAdapter, how do I go about apending my new ArrayList to the adapter?
type: AnswerComment

http://stackoverflow.com/q/21224978
has comment: http://stackoverflow.com/comment/31971014
score: -1
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/31971354
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/31968581
accepted answer: http://stackoverflow.com/a/21226967
tagged with: jakarta-mail
has comment: http://stackoverflow.com/comment/31971647
answer count: 1
downvote count: 1
has title: MailConnectException while sending JavaMail
has answer: http://stackoverflow.com/a/21226967
upvote count: 0
has comment: http://stackoverflow.com/comment/31971155
tagged with: maven
linked to: http://stackoverflow.com/q/8771167
has body: I am trying to send an JavaMail from servlet. The code for servlet looks like this: package com.lsp.web; import com.lsp.service.Mailer; import org.springframework.beans.factory.annotation.Autowired; import javax.mail.MessagingException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @WebServlet(name = "contact", urlPatterns = {"/contact"}) public class ContactServlet extends SpringInjectedServlet { @Autowired private Mailer mailer; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.getRequestDispatcher("contact.jsp").forward(req, resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String customerEmail = req.getParameter("email"); String subject = req.getParameter("subject"); String body = req.getParameter("message"); String error = null; String succMess = null; try { javax.mail.internet.InternetAddress ia = new javax.mail.internet.InternetAddress(customerEmail); ia.validate(); mailer.send(customerEmail, subject, body); //Maler class send method req.setAttribute("succMessage", succMess); req.getRequestDispatcher("sent.jsp").forward(req, resp); } catch (javax.mail.internet.AddressException ae) { error = "您指出的邮箱地址不存在"; req.setAttribute("errorMessage", error); req.getRequestDispatcher("contact.jsp").forward(req, resp); } catch (MessagingException mex) { error = "发送失败"; req.setAttribute("errorMessage", error); req.getRequestDispatcher("contact.jsp").forward(req, resp); } } } Then my Mailer class is: package com.lsp.service; import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; imp…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31971219
tagged with: java

xtext
tags question: http://stackoverflow.com/q/21280838
tags question: http://stackoverflow.com/q/21330803
type: Tag
tag name: xtext
tags question: http://stackoverflow.com/q/21238358

http://stackoverflow.com/comment/32160506
type: AnswerComment
has text: I really can't figure out how to do this :/
type: Comment
comment on: http://stackoverflow.com/a/21333455
score: 0

http://stackoverflow.com/q/21211331
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21211403
has title: Vairables used but eclipse says they're not?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31944084
has comment: http://stackoverflow.com/comment/31944047
has body: I'm doing some input handling in Java and I'm running into some trouble. I've got two variables (xMove and zMove) and I've used them in the code a number of times yet eclipse refuses to acknowledge their use. I have a feeling that is what's causing me problems so please take a look so I can see what I'm doing wrong public void tick(boolean forward, boolean back, boolean left, boolean right, boolean turnLeft, boolean turnRight) { double xMove = 0.0; double zMove = 0.0; if (forward) { zMove++; } if (back) { zMove--; } if (left) { xMove++; } if (right) { xMove--; } if (turnLeft) { zMove++; } if (turnRight) { zMove++; } }
has comment: http://stackoverflow.com/comment/31944031
has comment: http://stackoverflow.com/comment/31944030
has answer: http://stackoverflow.com/a/21211379
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31944057
has answer: http://stackoverflow.com/a/21211871
tagged with: variables
has comment: http://stackoverflow.com/comment/31944102

http://stackoverflow.com/comment/100693782
type: Comment
comment on: http://stackoverflow.com/a/21234897
score: 1
has text: The relative precedence of pre- and post-incrementing in Java does not matter. However, for efficiency of presentation, all prefix operators including pre-incrementation have the same precedence. One of them is unary minus. Now consider the expression **- x++**. It is parsed as **- (x++)**, which makes sense. With the opposite precedence it would be parsed as **(-x)++**, which is undefined because **-x** is not an lvalue (i.e. cannot be assigned to).
type: AnswerComment

http://stackoverflow.com/q/21245815
downvote count: 4
has comment: http://stackoverflow.com/comment/32007102
has comment: http://stackoverflow.com/comment/32005964
tagged with: java
has comment: http://stackoverflow.com/comment/32005889
has body: Lets say I do Map&lt;String, Integer&gt; map = new HashMap&lt;String, Integer&gt;(); map.containsValue(value) returns true whether or not the value is found in the hashmap. But I found that there is no way to remove a value. Like map.removeValue(value). You can only remove the key, as in, map.removeKey(key). Now, my question is, does removing the key also remove the value? So when I search map.containsValue(value), will it return false if I deleted the key associated with the value with map.removeKey?
has comment: http://stackoverflow.com/comment/32007082
has comment: http://stackoverflow.com/comment/32005914
type: Question
has comment: http://stackoverflow.com/comment/32005881
tagged with: hashmap
score: -2
has comment: http://stackoverflow.com/comment/32007075
has comment: http://stackoverflow.com/comment/32005885
has comment: http://stackoverflow.com/comment/32005955
upvote count: 2
has title: Removing values from a Java hashmap
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21245848
has comment: http://stackoverflow.com/comment/32005934
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32005976
has comment: http://stackoverflow.com/comment/32005913
tagged with: dictionary

http://stackoverflow.com/q/21197217
has body: I'm attempting to parse the following XML data: getPosts 1 4 <Title>Stream http://www.youtube.com/embed/bNXqZR0A2Mw <Title>Movies http://www.youtube.com/embed/bNXqZR0A2Mw?rel=0 <Title>Music none <Title>Hello world! However every time I do so I'm getting a NPE: FATAL EXCEPTION: main 01-17 17:30:07.843: E/AndroidRuntime(17573): java.lang.NullPointerException 01-17 17:30:07.843: E/AndroidRuntime(17573): at com.androidbegin.xmlparsetutorial.MainActivity.getNode(MainActivity.java:110) I've attempted to connect to the web service then parse the data using the following: public class MainActivity extends Activity { // Declare variables TextView textview; NodeList nodelist; ProgressDialog pDialog; // Insert image URL String URL = "http://exampleurl.com/xmlrpc.php?cmd=getPosts"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the view from activity_main.xml setContentView(R.layout.activity_main); // Locate a TextView in your activity_main.xml layout textview = (TextView) findViewById(R.id.text); // Execute DownloadXML AsyncTask new DownloadXML().execute(URL); } // DownloadXML AsyncTask private class DownloadXML extends AsyncTask<String, Void, Void> { @Override protected void onPreExecute() { super.onPreExecute(); // Create a progressbar pDialog = new ProgressDialog(MainActivity.this); // Set progressbar title pDialog.setTitle("Android Simple XML Parsing using DOM Tutorial"); // Set progressbar message pDialog.setMessage("Loading..."); pDialog.setIndeterminate(false); // Show progressbar pDialog.show(); } @Override protected Void doInBackground(String... Url) { try { URL url = new URL(Url[0]); DocumentBuilderFactory dbf = DocumentBuilderFactory .newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); // Download the XML file Document doc = db.parse(new InputSource(url.openStream())); doc.getDocumentElement().normalize(); // Locate the Tag Name nodelist = doc.getElementsByTagName("cmd"); } catch (Exception e) { Log.e…
tagged with: android
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/21197307
type: UnansweredQuestion
tagged with: java
tagged with: nodes
type: Question
has title: Parsing XML Data Results in FATAL EXCEPTION: main
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21197358

http://stackoverflow.com/a/21193976
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/31912962
upvote count: 1
has body: The very simple answer to that would be: public static List&lt;String[]&gt; read(String document) throws IOException{ List&lt;String[]&gt; data = null; try{ CSVReader reader = new CSVReader(new FileReader(document)); data = reader.readAll(); reader.close(); } catch(IOException e){ e.printStackTrace(); } return data; } This is because data was declared inside the try catch block or as it is also called scope (I'll stick to block). Everything declared inside a block can only be accesed inside this block or in blocks that are inside aswell. Another solution would be the following. It avoids declaring (and initialzing) the data variable if not neccessary: public static List&lt;String[]&gt; read(String document) throws IOException{ try{ CSVReader reader = new CSVReader(new FileReader(document)); List&lt;String[]&gt; data = reader.readAll(); reader.close(); // Return early. Note this only happens when everything went right. // (Which is what we hope for) return data; } catch(IOException e){ e.printStackTrace(); } // This will only happen when it caught a exception! return null; } However I would stick to the first solution!
answers question: http://stackoverflow.com/q/21193785

http://stackoverflow.com/comment/32048855
score: 0
type: Comment
type: QuestionComment
has text: @A4L no errors reported. The code runs, but the text files that should be created from the execution of Grader are not present, which indicates that the call to Grader did not go through correctly.
comment on: http://stackoverflow.com/q/21269820

http://stackoverflow.com/comment/31956925
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21218640
type: Comment
has text: the problem is that this assignment is not allowed to use any libraries, including java.util.*

http://stackoverflow.com/comment/32101286
has text: I just posted the same comment to all of them ;)
type: Comment
comment on: http://stackoverflow.com/a/21300267
score: 0
type: AnswerComment

http://stackoverflow.com/q/21204245
score: 0
tagged with: jpa
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21218449
tagged with: hibernate-mapping
type: AnsweredQuestion
upvote count: 1
downvote count: 1
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/21218449
has body: I have this class: @Entity @Table(name = "TOPUP_MESSAGE") public class ReportFee { //... ID &amp; Other Properties @ManyToOne @JoinColumn(name="CONTRACT_ID") private ContractDetail contractDetail; //GETTERS AND SETTERS } and ContractDetail class is like this: @Entity @Table(name = "CONTRACT_DETAIL") public class ContractDetail { //... ID &amp; Other Properties @ManyToOne @JoinColumn(name = "CONTRACT_ID") private Contract contract; //GETTERS AND SETTERS } My Contract class is like this: @Entity @Table(name = "CONTRACT") public class Contract implements { //... ID &amp; Other Properties @ManyToOne @JoinColumn(name = "OPERATOR_ID") private Operator operator; //GETTERS AND SETTERS } I defined my alias like this but It's wrong : Session session = (Session)this.em.getDelegate(); Criteria crit = session.createCriteria(getEntityClass()); crit = crit.createAlias("contractDetail", "cd", JoinType.LEFT_OUTER_JOIN); crit = crit.createAlias("contract", "c", JoinType.LEFT_OUTER_JOIN); crit = crit.createAlias("operator", "op", JoinType.LEFT_OUTER_JOIN); Criterion c= Restrictions.eq("cd.cd.op", operator); crit.add(c); List result = crit.list(); but unfortunately I get this error: org.hibernate.QueryException: could not resolve property: contract of: x.be.ReportFee at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:83) at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:77) at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1809) at org.hibernate.loader.criteria.EntityCriteriaInfoProvider.getType(EntityCriteriaInfoProvider.java:57) at org.hibernate.loader.criteria.CriteriaQueryTranslator.getPathInfo(CriteriaQueryTranslator.java:251) at org.hibernate.loader.criteria.CriteriaQueryTranslator.createCriteriaEntityNameMap(CriteriaQueryTranslator.java:230) at org.hibernate.loader.criteria.CriteriaQueryTranslator.(CriteriaQueryTranslator.java:112) at org.…
tagged with: java
tagged with: hibernate
has title: Hibernate Nested Properties Alias

http://stackoverflow.com/comment/32087029
type: Comment
has text: Display.getDefault().asyncExec() runs that Runnable on the UI thread. I see no call to annotate.annotation().
comment on: http://stackoverflow.com/a/21291318
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32060754
type: AnswerComment
score: 0
type: Comment
has text: Now f is not final :D see above.
comment on: http://stackoverflow.com/a/21277298

http://stackoverflow.com/comment/31905386
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21189535
has text: I have posted the actual code.. Can anybody please help now

http://stackoverflow.com/comment/32146195
type: QuestionComment
comment on: http://stackoverflow.com/q/21325472
has text: and you can preserve values, to later make sure on *submit*, if the values have actually been changed or not.
score: 0
type: Comment

http://stackoverflow.com/q/21300924
has answer: http://stackoverflow.com/a/35067338
linked to: http://stackoverflow.com/q/1960832
tagged with: executor
has answer: http://stackoverflow.com/a/21301090
downvote count: 0
linked to: http://stackoverflow.com/q/26938210
score: 28
favorite count: 0
linked to: http://stackoverflow.com/q/21156599
upvote count: 28
linked to: http://stackoverflow.com/q/2077771
has answer: http://stackoverflow.com/a/35069785
has body: My question is : does it make sense to use Executors.newFixedThreadPool(1)??. In two threads (main + oneAnotherThread) scenarios is it efficient to use executor service?. Is creating a new thread directly by calling new Runnable(){ } better than using ExecutorService?. What are the upsides and downsides of using ExecutorService for such scenarios? PS: Main thread and oneAnotherThread dont access any common resource(s). I have gone through : What are the advantages of using an ExecutorService?. and Only one thread at a time!
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21301090
linked to: http://stackoverflow.com/q/3984076
tagged with: java
tagged with: multithreading
type: Question
has title: Difference between Executors.newFixedThreadPool(1) and Executors.newSingleThreadExecutor()
has answer: http://stackoverflow.com/a/36398851
possible better answer: http://stackoverflow.com/a/35067338

http://stackoverflow.com/comment/32071151
comment on: http://stackoverflow.com/q/21283633
score: 4
type: Comment
type: QuestionComment
has text: Traverse the string backwards and stop when you find the first (i.e. last) number or letter.

http://stackoverflow.com/a/21305332
type: Answer
has body: Try returning the array arr in domode method public void run() { int[] arr = new int [3]; for(int i=0; i&lt;arr.length;i++){ arr[i]=i; } arr = domore(arr); for(int i=0; i&lt;arr.length;i++){ println(arr[i]); } } private int[] domore(int[] arr) { // TODO Auto-generated method stub int [] att = new int [3]; for(int i=0; i&lt;att.length;i++){ att[i]=77; } return(att); }
has comment: http://stackoverflow.com/comment/32109942
upvote count: 1
answers question: http://stackoverflow.com/q/21305215
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32110043

http://stackoverflow.com/comment/32144813
type: AnswerComment
score: 0
has text: hello kentaro. What is callback url used for? and what it is look like? Could you please give me example .
type: Comment
comment on: http://stackoverflow.com/a/21319051

http://stackoverflow.com/comment/32249720
comment on: http://stackoverflow.com/a/21366128
score: 0
type: Comment
has text: is there a way to keep it? as it gives many abilites to play aronund with the code?
type: AnswerComment

http://stackoverflow.com/comment/32007098
comment on: http://stackoverflow.com/q/21246472
score: 0
has text: Thanks. But again, I don't want the user to be doing anything other than just giving the input and pressing enter.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21248005
has comment: http://stackoverflow.com/comment/32095085
has body: If I was thinking about doing something like I would probably set up two queues, an outgoing and incoming queue. These would be used to "stage" messages. The idea being that outgoing messages would be placed into the outgoing queue and when Thread was able to, it would pop off the next message and send it. When the queue was empty, it would simply "wait" until a new message become available. The concept would work in reverse for the incoming queue. The Thread would read a message and push it onto the incoming queue. Some other process (possibly a SwingWorker) would be monitoring the queue and pop the next message of it and re-sync it with the GUI. You might find Concurrency in Swing of some use. How the underlying protocol actually worked would dictate a lot more of the details though
has comment: http://stackoverflow.com/comment/32095269
has comment: http://stackoverflow.com/comment/32095775
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32095119
has comment: http://stackoverflow.com/comment/32095212
has comment: http://stackoverflow.com/comment/32095337
has comment: http://stackoverflow.com/comment/32095282
has comment: http://stackoverflow.com/comment/32095300
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/32098211
accepted answer of: http://stackoverflow.com/q/21247781
upvote count: 3
answers question: http://stackoverflow.com/q/21247781

http://stackoverflow.com/a/21215121
has comment: http://stackoverflow.com/comment/31956750
answers question: http://stackoverflow.com/q/21214201
type: Answer
has comment: http://stackoverflow.com/comment/70096062
score: 0
has body: Consider using an ImmutableMap from Guava. Creation of Map using it is like a charm: Map&lt;String,String&gt; map = ImmutableMap.of("key1", "value1", "key2", "value2"); There's another option for cases when you need to modify the entries of your map. You can use EnumMap from JDK. It's a little bit faster than HashMap.

http://stackoverflow.com/comment/31959131
score: 0
comment on: http://stackoverflow.com/q/21219406
type: Comment
type: QuestionComment
has text: @csmckelvey updated with additional codes!

http://stackoverflow.com/a/49252392
upvote count: 2
answers question: http://stackoverflow.com/q/21274732
has body: I have solved it using "force update", pressing Alt+F5 as it is mentioned in the following link.
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/35447464
has comment: http://stackoverflow.com/comment/58613866
has body: WorkbookSettings workbookSettings = new WorkbookSettings(); workbookSettings.setGCDisabled(true); readwb = Workbook.getWorkbook(file.getInputStream(), workbookSettings);
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21301785

http://stackoverflow.com/q/21287780
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/21288651
accepted answer: http://stackoverflow.com/a/21288651
answer count: 1
tagged with: deserialization
tagged with: jackson
favorite count: 0
has title: How can I deserialize a JSON array of "name" "value" pairs to a Pojo using Jackson
downvote count: 0
has body: I want to deserialize the following JSON object: { "id":"001", "module_name":"Users", "name_value_list": { "user_name": {"name":"user_name", "value":"admin"}, "full_name": {"name":"full_name", "value":"Lluís Pi"}, "city": {"name":"full_name", "value":"Barcelona"}, "postal_code": {"name":"postal_code", "value":"08017"}, ... } } into some Java object like this: @JsonIgnoreProperties(ignoreUnknown = true) @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE) public class UserEntry { private String id; private String moduleName; private Person nameValueList; public String getId() { return id; } public String getModuleName() { return moduleName; } public Person getPerson() { return nameValueList; } } where Person is the following class: @JsonIgnoreProperties(ignoreUnknown = true) @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE) class Person { private String userName; private String fullName; private String city; private String postalCode; } using Jackson but I get a deserialization error. If I change the type of field nameValueList to a Map all the deserialization process goes with no problem and I get a map where the key is the "name" value and the value is the "value" value. So my question is: is there any simple, or no so simple, way to deserialize this kind of JSON object to a Java Pojo with properties prop_1, prop_2, prop_3and prop_4? { "name_value_list": { "prop_1": {"name":"prop_1", "value":"value_1"}, "prop_2": {"name":"prop_2", "value":"value_2"}, "prop_3": {"name":"prop_3", "value":"value_3"}, "prop_4": {"name":"prop_4", "value":"value_4"}, ... } }
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/21190260
has title: JFormattedTextField instead of JTextField
has answer: http://stackoverflow.com/a/21190314
answer count: 3
score: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/21190314
favorite count: 0
has answer: http://stackoverflow.com/a/21200834
type: AnsweredQuestion
has body: In Java, what is the difference between JTextField and JFormattedTextField ? I mean when should I use JFormattedTextField instead of JTextField?
has comment: http://stackoverflow.com/comment/31906028
upvote count: 3
tagged with: java
tagged with: swing
tagged with: jtextfield
has answer: http://stackoverflow.com/a/21190615
type: Question
accepted answer: http://stackoverflow.com/a/21200834

http://stackoverflow.com/comment/32239307
type: AnswerComment
has text: @holger Exactly, that matches my observation: first and foremost the average Java dev would never want to use, or see used, the sneaky throw. Those which do end up using it are of the "rebellious" attitude towards checked exceptions.
type: Comment
comment on: http://stackoverflow.com/a/21329863
score: 1

http://stackoverflow.com/q/21219518
downvote count: 1
type: Question
type: AnsweredQuestion
has body: As you can see on the image below, I have 6 horizontal layouts, with 6 image buttons in each, in total 36 image buttons. Every button is 120x123 pixels in xdhpi, 80x92 in hdmi, 53x61 in mdpi folders. On the bottom you can see my whole XML code for this activity. The problem is, I need those bricks to strech all the way hirizontaly. As you can see the layout containing those brick goes all the way, but the images don't. I tried to make the images bigger, 128px in widht but that didn't help at all. <?xml version="1.0" encoding="utf-8"?> <ImageView android:id="@+id/ivSlika" android:layout_width="fill_parent" android:layout_height="match_parent" /> <ImageButton android:id="@+id/ib1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/bricks_01" android:padding="0dp" />/ <ImageButton android:id="@+id/ib2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/bricks_02" android:padding="0dp" /> <ImageButton android:id="@+id/ib3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/bricks_03" android:padding="0dp" /> <ImageButton android:id="@+id/ib4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/bricks_04" android:padding="0dp" /> <ImageButton android:id="@+id/ib5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/bricks_05" android:padding="0dp" /> <ImageButton android:id="@+id/ib6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/bricks_06" android:padding="0dp" /> <ImageButton android:id="@+id/ib7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/bricks_07" android:padding="0dp" /> <ImageButton android:id="@+id/ib8" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/bricks_08" android:padding="0dp" /> <ImageButt…
has answer: http://stackoverflow.com/a/21219676
score: -1
possible better answer: http://stackoverflow.com/a/21219605
has answer: http://stackoverflow.com/a/21219605
answer count: 3
upvote count: 0
favorite count: 0
has title: How to strech images to fill page horizontaly?
accepted answer: http://stackoverflow.com/a/21219676
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
has answer: http://stackoverflow.com/a/21219885

atomic
type: Tag
tag name: atomic
tags question: http://stackoverflow.com/q/21283293

http://stackoverflow.com/q/21278811
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20837856
score: 1
tagged with: jackson
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/21279016
has title: Deseralizing JSON Objects Using Jackson
upvote count: 2
has body: I'm currently developing a Java web application that consumes the JSON data exposed by Magento REST API. An example of data returned by the api is: {"1":{"entity_id":"1","name":"Wedding dress","description":"White wedding dress"},"2":{"entity_id":"2","name":"Sunglasses", "description":"Black sunglasses"}} and I have a Java class in my application as below: public class Item { @JsonProperty("entity_id") private String entityId; private String name; private String description; //... } I would like to deseralize the data and convert that into an ArrayList&lt;Item&gt; but I keep on getting the error below: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token at [Source: java.io.StringReader@1ec0f9f6; line: 1, column: 1] at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:164) at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:575) at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:569) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.handleNonArray(CollectionDeserializer.java:259) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:217) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:207) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:23) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2888) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2048) at pricebeaver.service.MagentoItemServiceImpl.getItemsForPriceCheck(MagentoItemServiceImpl.java:111) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMe…
downvote count: 1
answer count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/21279016

numbers
tags question: http://stackoverflow.com/q/21245950
tags question: http://stackoverflow.com/q/21215396
tags question: http://stackoverflow.com/q/21198873
tags question: http://stackoverflow.com/q/21297597
tags question: http://stackoverflow.com/q/21335359
tags question: http://stackoverflow.com/q/21307702
tags question: http://stackoverflow.com/q/21198995
type: Tag
tag name: numbers

http://stackoverflow.com/comment/31911064
has text: @cyberPheonix Happy to see you got it.
comment on: http://stackoverflow.com/q/21191688
score: 0
type: QuestionComment
type: Comment

jaxb
tags question: http://stackoverflow.com/q/21317146
tags question: http://stackoverflow.com/q/21283327
tags question: http://stackoverflow.com/q/21240994
tags question: http://stackoverflow.com/q/21294961
tags question: http://stackoverflow.com/q/21265610
tags question: http://stackoverflow.com/q/21347816
tags question: http://stackoverflow.com/q/21237127
tags question: http://stackoverflow.com/q/21230367
tags question: http://stackoverflow.com/q/21339025
tags question: http://stackoverflow.com/q/21220760
tags question: http://stackoverflow.com/q/21260522
tags question: http://stackoverflow.com/q/21253529
tags question: http://stackoverflow.com/q/21314322
tags question: http://stackoverflow.com/q/21217232
tags question: http://stackoverflow.com/q/21255925
tags question: http://stackoverflow.com/q/21348006
tags question: http://stackoverflow.com/q/21312323
tags question: http://stackoverflow.com/q/21258118
tags question: http://stackoverflow.com/q/21261566
tags question: http://stackoverflow.com/q/21300940
tags question: http://stackoverflow.com/q/21321665
type: Tag
tag name: jaxb
tags question: http://stackoverflow.com/q/21224515
tags question: http://stackoverflow.com/q/21188599
tags question: http://stackoverflow.com/q/21327516
tags question: http://stackoverflow.com/q/21336771
tags question: http://stackoverflow.com/q/21221991
tags question: http://stackoverflow.com/q/21252096
tags question: http://stackoverflow.com/q/21279734
tags question: http://stackoverflow.com/q/21335894
tags question: http://stackoverflow.com/q/21332444

http://stackoverflow.com/a/21404018
score: 0
type: Answer
has body: Try sending this kind of command to your obd device – 0131\r (i.e. MM PP\r format and don't forget to append \r at the end of your command). OBD device identifies the end of command request by \r. So I am getting proper response while sending this command pattern and receiving 2 bytes response as expected.
answers question: http://stackoverflow.com/q/21268058

geotools
type: Tag
tags question: http://stackoverflow.com/q/21184666
tag name: geotools

http://stackoverflow.com/a/21224710
has body: In terms of procedural language, It is always good to write a function that would deliver one specific task so that further you can reuse this. So always keep your function code is as small as possible and call one function from another.
answers question: http://stackoverflow.com/q/21224610
type: Answer
downvote count: 1
score: 0
upvote count: 1

http://stackoverflow.com/comment/32002700
comment on: http://stackoverflow.com/a/21241529
type: AnswerComment
has text: Can I assume that you meant 'for (Node n : GlobalGraphOperations.at(db).getAllNodes()) ?
score: 0
type: Comment

http://stackoverflow.com/comment/31982363
comment on: http://stackoverflow.com/a/21229444
type: AnswerComment
score: 0
type: Comment
has text: linearLayout.findViewById(5);

http://stackoverflow.com/a/21341512
has body: Just count how many elements match your filter first, then create the array, then populate it. It means you'll need to go through the array twice, but there are no really nice alternatives unless you want to end up creating multiple arrays. So something like: public int[] above100Degrees() { // First work out how many items match your filter int count = 0; // Are you allowed to use the enhanced for loop? It's not necessary, but it // makes things simpler. for (int temp : temps) { if (temp &gt; 100) { count++; } } // Create an array of the right size... int[] ret = new int[count]; // ... and populate it. int index = 0; for (int temp : temps) { if (temp &gt; 100) { ret[index++] = temp; } } return ret; }
downvote count: 0
has comment: http://stackoverflow.com/comment/32175600
answers question: http://stackoverflow.com/q/21341466
has comment: http://stackoverflow.com/comment/32175579
type: Answer
has comment: http://stackoverflow.com/comment/32175014
score: 5
upvote count: 5

http://stackoverflow.com/q/21288900
possible better answer: http://stackoverflow.com/a/26928836
has answer: http://stackoverflow.com/a/21289016
has body: I working on a project in Java and I want to put text in a HashMap using GSON,here is my JSON: { "someText": { "text1": "lorem ipsum", "text2": "ipsum lorem" } } and here a piece of my code: private static class myTexts { private final Map&lt;String, String&gt; someText = new HashMap&lt;String, String&gt;(); } myTexts t = this.gson.fromJson(myJsonFile, myTexts.class); I have this error: com.google.gson.JsonSyntaxException: duplicate key: null, I've tried to find what's wrong for a while, but I can't seem to find the problem :/
tagged with: hashmap
has answer: http://stackoverflow.com/a/26928836
has title: JSON to hashmap with GSON
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32080913
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/21289016
favorite count: 0
type: Question
tagged with: dictionary
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 2
tagged with: gson
upvote count: 1

http://stackoverflow.com/a/21236773
has body: If you want the sum of the quantity for a specific price, then you syntactically correct SQL. Your expression: SELECT price, sum(quantity) as quantity FROM table; Is not correct because there is no group by clause. Try this: SELECT price, sum(quantity) as quantity FROM table GROUP BY price; If you only want the results for one price: SELECT sum(quantity) as quantity FROM table WHERE price = xxx;
answers question: http://stackoverflow.com/q/21236713
has comment: http://stackoverflow.com/comment/31991947
has comment: http://stackoverflow.com/comment/31990999
has comment: http://stackoverflow.com/comment/31990292
type: Answer
has comment: http://stackoverflow.com/comment/31992371
has comment: http://stackoverflow.com/comment/31990868
score: 0

http://stackoverflow.com/comment/32032557
type: QuestionComment
has text: Have you tried not closing "toServer" until all is done? And also cumulating the input from Server, instead of replacing the String for each line. You'll only get the last line always. You might want to try a StringBuilder.
comment on: http://stackoverflow.com/q/21260566
score: 0
type: Comment

http://stackoverflow.com/a/45628795
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21282432
has body: This can also happen if the dialect cannot connect for any other reason, such as password expired. Check for any earlier exceptions that may reveal the cause.

rmi
tags question: http://stackoverflow.com/q/21275485
tags question: http://stackoverflow.com/q/21318422
tag name: rmi
type: Tag
tags question: http://stackoverflow.com/q/21279211

http://stackoverflow.com/a/21212483
score: 0
answers question: http://stackoverflow.com/q/21212279
has body: Don't ofuscate! Do this: Room.java public class Room { private boolean isOccupied; public Room() { this.isOccupied = false; } public boolean obtainTheRoom() { if(!isOccupied) this.isOccupied = true; return !isOccupied; } } Main.java import java.util.Scanner; public final class Main { private static final int ROOM_AMOUNT = 50; private static int actualRoom; private static Scanner cmdin = new Scanner(System.in); public static void main(String[] args) { Room[] rooms = new Room[ROOM_AMOUNT]; // Select some random, but static rooms to be occupied for(int i = 1; i &lt;= ROOM_AMOUNT; i++) { if(i % 3 - 1 == 0 || i * 2 % i + 10 - 2 == 2) { rooms[i - 1].obtainTheRoom(); } } for(;;) { System.out.print("Enter a room number:\t"); try { actualRoom = Integer.parseInt(cmdin.next()); } catch(NumberFormatException nfe) { loopRoomNumber(); } if(rooms[actualRoom - 1].obtainTheRoom()) { System.out.println("Got the room " + actualRoom + "! Now it's occupied -_-"); } else { System.out.println("Room Occupied!"); } } } private static void loopRoomNumber() { System.out.print("That's not a valid room number!\n\n"); try { actualRoom = Integer.parseInteger(cmdin.next()); } catch(NumberFormatException nfe) { loopRoomNumber(); } } } That should work. Good luck!
type: Answer

http://stackoverflow.com/comment/31915292
has text: Just a wild guess: method `fi.nextInt` throws an exception...
comment on: http://stackoverflow.com/q/21195208
score: 0
type: QuestionComment
type: Comment

serialization
tags question: http://stackoverflow.com/q/21283116
tags question: http://stackoverflow.com/q/21238245
tags question: http://stackoverflow.com/q/21330069
tags question: http://stackoverflow.com/q/21346494
tags question: http://stackoverflow.com/q/21189518
tags question: http://stackoverflow.com/q/21226758
tags question: http://stackoverflow.com/q/21323336
tags question: http://stackoverflow.com/q/21270672
tag name: serialization
tags question: http://stackoverflow.com/q/21285230
tags question: http://stackoverflow.com/q/21310399
tags question: http://stackoverflow.com/q/21292867
tags question: http://stackoverflow.com/q/21209106
tags question: http://stackoverflow.com/q/21255699
tags question: http://stackoverflow.com/q/21346739
tags question: http://stackoverflow.com/q/21213985
type: Tag
tags question: http://stackoverflow.com/q/21345116
tags question: http://stackoverflow.com/q/21229689
tags question: http://stackoverflow.com/q/21246733
tags question: http://stackoverflow.com/q/21327187
tags question: http://stackoverflow.com/q/21304261
tags question: http://stackoverflow.com/q/21347670
tags question: http://stackoverflow.com/q/21201903
tags question: http://stackoverflow.com/q/21284253
tags question: http://stackoverflow.com/q/21209240
tags question: http://stackoverflow.com/q/21259975
tags question: http://stackoverflow.com/q/21294190
tags question: http://stackoverflow.com/q/21228236
tags question: http://stackoverflow.com/q/21194211

http://stackoverflow.com/comment/32022164
comment on: http://stackoverflow.com/a/21255293
has text: You can write that and if your hbm2ddl property is correctly set hibernate will create the view but you cannot call the view query as a SQL named query because its a DDL query and not a query which returns a list.
score: 0
type: AnswerComment
type: Comment

remote-debugging
tag name: remote-debugging
tags question: http://stackoverflow.com/q/21262292
type: Tag

http://stackoverflow.com/comment/32076713
score: 0
type: Comment
type: QuestionComment
has text: What do you mean by middle and how is `sample.txt` related with this string manipulation?
comment on: http://stackoverflow.com/q/21286723

http://stackoverflow.com/q/21260424
accepted answer: http://stackoverflow.com/a/21260539
type: Question
tagged with: firefox-addon
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32038706
favorite count: 0
has answer: http://stackoverflow.com/a/21260539
tagged with: icedtea
has body: I am new to Stack Exchange and this is my first question so please forgive me if I do not ask this question conforming to the normal standards of this website. If you have any tips that will help me become a more efficient member please feel free to let me know. First off, I am having a problem with my Java plugin in Firefox. Under tools, add-ons, I have listed for my Java plugin, "Java(TM) Plug-in 10.51.2 10.51.2". I recently installed some updates and apparently the new version of Java automatically blocks un-signed applets from being able to run even if you attempt to allow it manually by clicking on the "Allow Now" option that is displayed in the URL bar. This is unacceptable as I am currently trying to test software and I need to be able to run the applet. So to get back to the question, how can I remove that specific Java plugin (Java(TM) Plug-in 10.51.2 10.51.2) and install the icedtea-7-plugin for Firefox to use in its place. I have installed the icedtea-7-plugin via terminal through the "sudo apt-get install icedtea-7-plugin" command with success but how can I get Firefox to use this plugin and disregard the plugin that is currently listed under the add-ons option in my browser. Any help will be greatly appreciated as this is a frustrating matter. Thank you very much! -Dave EDIT: It is important to note the reason that the OP was asking about allowing unsigned applets was that he is developing on one. This question is therefore on topic as it is about a tool used for software development.
tagged with: plugins
type: AnsweredQuestion
has title: How to debug an unsigned Java Plugin in Firefox using icedtea-7-plugin
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/32060026
type: QuestionComment
has text: whats wrong? are you not able to access?
comment on: http://stackoverflow.com/q/21276904
score: 0
type: Comment

http://stackoverflow.com/a/21290635
upvote count: 2
answers question: http://stackoverflow.com/q/21290478
has body: you are trying to print the results of a method Result() but that method doesn't return anything so println() has nothing to print. Try returning something from Result() and your println should work.
downvote count: 0
has comment: http://stackoverflow.com/comment/32084011
type: Answer
score: 2

http://stackoverflow.com/a/21285285
has body: The problem is because you are using an Excel95 file, and unfortunately it seems that is not supported (only files after Excel97 are). Take a look here http://jexcelapi.sourceforge.net/resources/javadocs/2_6_10/docs/jxl/Workbook.html#getWorkbook(java.io.InputStream) and here http://www.java-forum.org/allgemeine-java-themen/140138-java-tabelle-auslesen-xls-excel-fehler.html
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21284880
type: Answer
answers question: http://stackoverflow.com/q/21284880
has comment: http://stackoverflow.com/comment/45092247
score: 2
upvote count: 2

http://stackoverflow.com/comment/32155998
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21331058
has text: I did as what u said but it outputs infinite again
score: 0

http://stackoverflow.com/q/21192888
has answer: http://stackoverflow.com/a/41909223
has title: How print bit Image TM-T88V
has answer: http://stackoverflow.com/a/22598014
tagged with: epson
type: UnansweredQuestion
answer count: 4
score: 2
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/47562954
downvote count: 1
type: Question
has body: I can't print my bit image without white line each 24 lines. I need to print an image, but this image have white lines each 24 lines to bits. The epson printer print the image to the next format. &gt;line 23 01010101000010001010 &gt;line 24 00001000100000000110 &gt;line 25 --------- white line ------------ How can delete this damn white line? Image size width:400px height:73px while (offset &lt; height) { //format ESC* Epson printer String modIMG = new String(new byte[]{0x1B, 0x2A, 33, 0, 2}); img.append(modIMG); for (int x = 0; x &lt; width; ++x) { for (int k = 0; k &lt; 3; ++k) { byte slice= 0; for (int b = 0; b &lt; 8; ++b) { int y = (((offset / 8) + k) * 8) + b; int i = (y * width) + x; boolean v = false; if (i &lt; bitSet.length()) { v = bitSet.get(i);} slice |= (byte) ((v ? 1 : 0) &lt;&lt; (7 - b)); } img.slice(new String(new byte[] {slice})); } } offset += 24; img.append(new String(new String(new byte[]{0x1B,0x33,30})); }
has comment: http://stackoverflow.com/comment/32135307
has answer: http://stackoverflow.com/a/25347790
has comment: http://stackoverflow.com/comment/32948909
favorite count: 0

http://stackoverflow.com/a/21300368
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21300196
downvote count: 0
has body: Here is Different Behavour of OnTouch Listener setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { Log.d(TAG, "mode=DRAG"); switch (event.getAction() &amp; MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: Log.i("Tag", "1"); break; case MotionEvent.ACTION_POINTER_DOWN: Log.i("Tag", "2"); break;// return case MotionEvent.ACTION_UP: Log.i("Tag", "3"); case MotionEvent.ACTION_POINTER_UP: Log.i("Tag", "4"); break; case MotionEvent.ACTION_MOVE: Log.i("Tag", "5"); break; } return true; } });

http://stackoverflow.com/q/21215693
tagged with: bulkupdate
accepted answer: http://stackoverflow.com/a/21217829
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31955257
has title: How to Use Date Object in Hibernate bulk update query
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21217829
tagged with: java
tagged with: hibernate
has body: Hi here i am trying to write hibernate bulk update query as following Date purchsedDate = TimeUtils.getSystemTimeInGMT(); String updatetest = "update Appointment app set app.appointmentStatus = ? WHERE app.purchased.boughtTime = ? "; getHibernateTemplate().bulkUpdate(updatetest, new Object[] {AppointmentStatus.CANCELLED, purchsedDate}); When i run this query I am getting following error com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'set appointment_status='CANCELLED' where bought_time='2014-01-19 10:32:51'' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2427) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2345) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2330) at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.hibernate.engine.jd…
tagged with: hql
type: Question

http://stackoverflow.com/comment/32098627
comment on: http://stackoverflow.com/q/21295808
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Format XML code in Eclipse](http://stackoverflow.com/questions/4527474/format-xml-code-in-eclipse)

http://stackoverflow.com/q/21315502
type: Question
tagged with: odt
has comment: http://stackoverflow.com/comment/86204667
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
favorite count: 0
upvote count: 2
has body: Im using OO UNO to create a ODT file... no matter if in the creation i try to salve in pdf or try to convert latter, i got the same errors: Connected to a running office ... com.sun.star.task.ErrorCodeIOException: at com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:173) at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:139) at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:334) at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:303) at com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:87) at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:636) at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:146) at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:128) at com.sun.proxy.$Proxy8.storeToURL(Unknown Source) at cards_certidao.cardmenuitem43.imprimirNegativa(cardmenuitem43.java:465) at cards_certidao.cardmenuitem43$2.actionPerformed(cardmenuitem43.java:169) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) the code for conversion: String loadUrl="file:///" + file.getPath(); String storeUrl="file:///" + "F:\\GeradorCertidoesNegativas\\feitas\\" + "["+ nomeDataArquivo + "]" + cboxTipos.getSelectedItem().toString() +"_" + protocolo +"_" + nomedopc + "_" + nomeDataArquivo2 + ".pdf"; try { XComponentContext xContext = BootstrapSocketConnector.bootstrap(oooExeFolder); XMultiComponentFactory xMultiComponentFactory = xContext.getServiceManager(); XComponentLoader xcomponentloader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class,xMultiComponentFactory.createInstanceWithContext("com.sun.star.frame.Desktop", xContext)); Object objectDocumentToStore = xcomponentloader.loadComponentFromURL(loadUrl, "_blank", 0, new PropertyValu…
type: UnansweredQuestion
score: 2
answer count: 0
tagged with: java
has title: ODF to PDF using OO

http://stackoverflow.com/a/21189058
answers question: http://stackoverflow.com/q/21188807
has comment: http://stackoverflow.com/comment/31907031
has body: The way that I did it about six years ago, I serialized the object (so that it was a string) converted the string to a byte array, encrypted the bytes, and sent the data as bytes. The other end then reversed the process. I got this to work for encrypted communications between a Java server and an AS3 client. It won't work for languages that don't support byte arrays though. Do you need more details?
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31903927

http://stackoverflow.com/q/21218296
type: Question
accepted answer: http://stackoverflow.com/a/21233190
has title: Maven Bundle Plugin: Export has private references
tagged with: maven-bundle-plugin
downvote count: 0
answer count: 1
favorite count: 0
tagged with: bnd
tagged with: osgi
has body: After updating the maven-bundle-plugin from version 2.3.5 to version 2.4.0 running mvn clean install outputs some warning messages, which I don't fully understand. E.g. Export ch.entwine.weblounge.contentrepository.impl.index, has 1, private references [org.elasticsearch.action.bulk] I guess this has something to do with an embedded lib (elasticsearch). Here are parts of the POM: <dependencies> ... org.elasticsearch elasticsearch 0.19.9 ... </dependencies ... ... ch.entwine.weblounge.contentrepository.impl.index ... .... elasticsearch;inline=true ... What does the error message exactly mean? What is the recommended way to solve such problems?
upvote count: 16
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21233190
score: 16

http://stackoverflow.com/comment/32019264
type: QuestionComment
comment on: http://stackoverflow.com/q/21253040
has text: What do you mean by 'an exact salt like the one generated in java'? Salt is only a list of random bit.
score: 0
type: Comment

http://stackoverflow.com/comment/37685774
score: 0
type: Comment
has text: @SergeBallesta It's always better to check button click in cases where the form action is on the same page..also from where does `JOptionPane` comes from in this..
type: AnswerComment
comment on: http://stackoverflow.com/a/24365694

http://stackoverflow.com/a/21303202
downvote count: 0
has comment: http://stackoverflow.com/comment/32106304
has body: You can not convert List&lt;Double&gt; to List&lt;Integer&gt; directly. Loop on each Double object and call intValue() function to get the integer part of it. For e.g. 13.3 will give 13. I hope thats what you want. for(Double d : labels.data){ lab.add(d.intValue()); }
score: 9
has comment: http://stackoverflow.com/comment/32106194
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32106301
accepted answer of: http://stackoverflow.com/q/21303106
answers question: http://stackoverflow.com/q/21303106
type: Answer
upvote count: 9

http://stackoverflow.com/comment/32090068
comment on: http://stackoverflow.com/a/21292239
score: 0
type: Comment
has text: Sorry, don't mean to be stream of consciousness, but if I remove the second, transparent "panel" and then add buttons directly to the BackgroundPanel, it all seems to work. Are there any disadvantages to this approach?
type: AnswerComment

http://stackoverflow.com/q/21284313
downvote count: 0
has comment: http://stackoverflow.com/comment/32072773
favorite count: 0
has body: As in documentation it is said: " /** * Factory method to create a 15-min, 9:00 AM thought 4:00 PM, Monday * through Friday SegmentedTimeline. * * This timeline uses a segmentSize of FIFTEEN_MIN_SEGMENT_SIZE. The * segment group is defined as 28 included segments (9:00 AM through * 4:00 PM) and 68 excluded segments (4:00 PM through 9:00 AM the next day). * * In order to exclude Saturdays and Sundays it uses a baseTimeline that * only includes Monday through Friday days. * * The startTime of the resulting timeline will be 9:00 AM * after the startTime of the baseTimeline. This will correspond to 9:00 AM * of the first Monday after 1/1/1900. * * @return A fully initialized SegmentedTimeline. */ public static SegmentedTimeline newFifteenMinuteTimeline() " in code of this method is: "timeline.setBaseTimeline(newMondayThroughFridayTimeline());" and if you just search where the SegmentedTimeline baseTimeline is used, you will see, that is uesed in 3 other methods: public void addBaseTimelineException(long domainValue) - which adds some exception to baseTimeline, public void addBaseTimelineExclusions(long fromBaseDomainValue, long toBaseDomainValue) - same here, and public SegmentedTimeline getBaseTimeline(). Note that this getter is not used anywhere else. So my question is, where is implementation, that allows to add weekends as an exceptions to segmentedTimeline, which is above baseTimeline? Summary: Adding baseTimeline to any timeline does nothing. How to modify that class (SegmentedTimeLine) to make a timeline, which is sth like intraday - but monday to friday, and every day from 9.00am to 7.00pm?
type: Question
has answer: http://stackoverflow.com/a/21716445
score: 4
tagged with: jfreechart
answer count: 1
tagged with: timeline
has title: How to combine 2 SegmentedTimelines in 1?
has comment: http://stackoverflow.com/comment/32120873
tagged with: java
type: UnansweredQuestion
upvote count: 4

http://stackoverflow.com/a/58037702
upvote count: 41
downvote count: 0
has body: Please use @Modifying annotation over the @Query annotation. @Modifying @Query(value = "UPDATE Users set coins_balance = coins_balance + :coinsToAddOrRemove where user_id = :user_id", nativeQuery = true) int updateCoinsBalance(@Param("user_id") Long userId, @Param("coinsToAddOrRemove") Integer coinsToAddOrRemove); The same is true for any DML query (i.e. DELETE, UPDATE or INSERT)
answers question: http://stackoverflow.com/q/21276059
type: Answer
score: 41

http://stackoverflow.com/a/21213060
type: Answer
has body: Class2 is not an inner class it is a nested static class, for those you dont need an instance of outer class simply do it this way import xxx.Class1.Class2; ... Class2 obj2 = new Class2(); see http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html
answers question: http://stackoverflow.com/q/21213004
score: 0

http://stackoverflow.com/a/21267467
has comment: http://stackoverflow.com/comment/32043411
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21267448
downvote count: 1
has body: Using a hash is not feasible if you want to reverse it. Base 64 doesn't match your requirements, but you can try something similar: Encode each character using only [a-z0-9_-], or more exactly, if the character doesn't match [a-z0-9_], replace it by its unicode value preceeded by -.
score: -1

http://stackoverflow.com/comment/32116285
score: 0
type: Comment
has text: whats the SOAP_ACTION_TIME_LIMIT?
comment on: http://stackoverflow.com/a/21305880
type: AnswerComment

http://stackoverflow.com/a/21332112
answers question: http://stackoverflow.com/q/21331998
score: 4
has body: By default your while loop will be executing on the Event Dispatch Thread (EDT), which handles all GUI operations. You should never execute long running tasks on the EDT for this reason - the GUI will lock up, since you're not giving it any free time to handle user input! However, you must execute any code that touches the GUI on the EDT. There's a special method, SwingUtilities.invokeLater(), that will do this (take a Runnable and invoke it on the EDT.) So in your example you would create a new thread and execute it, this thread would contain your while loop, and the myDisp.update() call would be wrapped in the above method to ensure it was still on the EDT. The alternative (neater) solution is to use a SwingWorker, which provides a nicer interface for accomplishing the same thing.
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/31957329
comment on: http://stackoverflow.com/q/21218557
has text: i forget to say that i'm using Slick Image librarie so it looks hard to convert from Image to BufferedImage
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/78360342
type: AnswerComment
comment on: http://stackoverflow.com/a/21838472
score: 0
type: Comment
has text: Initially My application was working fine. But after restart eclipse why I need to follow this steps, I didn't get. I didn't changed the maven/pom.xml or any setting. Can you guide?

http://stackoverflow.com/comment/32069479
score: 0
has text: @MartinFrey, No, I just want to de-couple the html request param names from the java bean accessor names. daviooh's answer below is a possible solution for me. I'm investigating the other possible solution of overriding Spring's WebBindingInitializer and using annotations at the moment because this might have the advantage of detecting the object type and then selecting the correct mapping automatically. I'll post my results.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21259406

http://stackoverflow.com/comment/32060087
type: Comment
has text: Because commons-io is not on the classpath.. I mean eclipse classpath is not your java classpath when you run the jar
score: 1
comment on: http://stackoverflow.com/q/21277004
type: QuestionComment

http://stackoverflow.com/comment/31943476
has text: @user3210676 Does `(view.getId() == R.id.resultbutton)` evaluated to true?
type: AnswerComment
comment on: http://stackoverflow.com/a/21210939
score: 0
type: Comment

http://stackoverflow.com/comment/32147530
type: Comment
comment on: http://stackoverflow.com/a/21325788
has text: Makes perfect sense.. Thanks :)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31953208
score: 0
type: Comment
type: QuestionComment
has text: remove this.setUI(new JButton().getUI()); and to override getPreferredSize, use those coordinates (getHeight/Wieght)in paintComponent
comment on: http://stackoverflow.com/q/21214640

http://stackoverflow.com/comment/31961171
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21220453
has text: Hey...excuse me one more time .. i have to order a large nr of data let's say 7500...but first i tried how it works with a small nr for example 10 ...and it get's me : 0 1 2 3 4 5 6 7 9 8 the only thing i changed is i=m+1 at the beginning at i-s initialization
type: AnswerComment

http://stackoverflow.com/comment/31911973
has text: I'll update the question again to show you the full class and an example usage. I would like to have even batch sizes until the final flush (for any left overs).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21193139

http://stackoverflow.com/a/21219117
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21219008
answers question: http://stackoverflow.com/q/21219008
has body: Hard to tell, but it looks like android is trying to load following activity java.lang.ClassNotFoundException: Didn't find class "com.as400samplecode.AndroidListViewCursorAdaptorActivity" maybe you have AndroidListViewCursorAdaptorActivity in your manifest file but you dont have it in you classes?
score: 0

http://stackoverflow.com/comment/32038570
score: 0
has text: babubhai yes hiren No bob Yes samir Yes Canon No
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21243138

http://stackoverflow.com/a/21299070
has body: replace events.get(i).getName(); by events.get(i).getClass().getName();
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21299030
accepted answer of: http://stackoverflow.com/q/21299030

http://stackoverflow.com/comment/31919640
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21197165
has text: Actually he can, no need to be so negative on the poor guy.

http://stackoverflow.com/comment/31954393
comment on: http://stackoverflow.com/q/21217290
score: 0
type: Comment
has text: maybe instantiate new objects of the classes ...
type: QuestionComment

http://stackoverflow.com/comment/32051642
type: Comment
type: QuestionComment
has text: @NiklasB. I edited my question. Your objections were justified.
comment on: http://stackoverflow.com/q/21269356
score: 0

http://stackoverflow.com/comment/32059778
score: 0
comment on: http://stackoverflow.com/a/21248628
type: AnswerComment
has text: Would you be able to give an example?
type: Comment

http://stackoverflow.com/comment/32006660
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21246060
has text: Please give more edge case examples of input and desired output. I sure there is a one line solution, but I'm not sure what you want

http://stackoverflow.com/comment/32152463
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21328795
type: Comment
has text: you can't pass long value as array length

http://stackoverflow.com/q/21184478
type: Question
answer count: 1
score: 0
has title: Using XSSFWorkBook to read excel alters the cell numbers accuracy
has comment: http://stackoverflow.com/comment/31895316
tagged with: apache-poi
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31896884
has comment: http://stackoverflow.com/comment/31895160
has answer: http://stackoverflow.com/a/21184755
tagged with: excel
tagged with: java
has body: I am using the package org.apache.poi.openxml4j.opc; package to read in an excel file and it is changing the accuracy of the numbers being read from excel. I have an instance in which if I have 1.11 or 2.22 or 4.44 in a cell then the XSSFWorkbook returns a 1.110000000001, 2.220000000002 and so on. Has anyone got an idea what is going on?
linked to: http://stackoverflow.com/q/1072561

http://stackoverflow.com/a/21268597
answers question: http://stackoverflow.com/q/21267091
score: 0
type: Answer
has body: for (int col = 0; col &lt; assignments.length; col++) { for(int row = 0; row &lt; assignments[col].length; row++) assignAvgArray[row] += assignments[row][col]; assignAvgArray[col] = (assignAvgArray[col]/5); } } assignments.length is 5 so col can become 4. assignAvgArray.length is 4. When you are giving the aassignAvgArray col=4 it will throw an arrayoutofboundException. fix it ,and if you still have an error comment under my answer.

http://stackoverflow.com/comment/32088993
has text: Your settings worked in `MYMAVEN/conf/settings.xml` file, while I don't see if it is possible to put plugin code @axtavt suggested there
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21244677
score: 0

http://stackoverflow.com/a/21424129
has body: I found this code from run.bat in JBoss 4.0.5 GA bin folder rem Include the JDK javac compiler for JSP pages. The default is for a Sun JDK rem compatible distribution to which JAVA_HOME points set JAVAC_JAR=%JAVA_HOME%\lib\tools.jar According to this, if you point the JAVA_HOME to JDK 1.6 properly. it should compile the jsps with that version
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32326007
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/21302219

http://stackoverflow.com/comment/31969127
has text: Did you mean to edit this code? Because you're still closing System.in here.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21225302
score: 0

http://stackoverflow.com/comment/31948778
type: Comment
comment on: http://stackoverflow.com/q/21213055
score: 0
has text: That ... doesn't answer what I asked. The problem is most likely with *your* class file and where you're running `javac` from, not their jar.
type: QuestionComment

http://stackoverflow.com/comment/32082631
type: Comment
has text: http://en.wikipedia.org/wiki/Interrupt_latency Latency generated by switching from Java program to OS (on sleep()) and back. Switching context needs some time.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21198208

http://stackoverflow.com/q/21317101
tagged with: android-support-library
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/21317306
accepted answer: http://stackoverflow.com/a/21317306
score: 2
type: AnsweredQuestion
has body: So, I tried to add v7 appcompat support library with resource to MyFirstApp project, by following the tutorial @ http://developer.android.com/tools/support-library/setup.html Both android-support-v4.jar and android-support-v7-appcompat.jar files were exported. Eclipse includes the android-support-v4.jar by default and when I tried the code: // MainActivity.java import android.support.v7.app.ActionBarActivity;// error public class MainActivity extends ActionBarActivity {...} // error // DisplayMessageActivity.java import android.support.v4.app.NavUtils; // error on this line public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.display_message, menu);// error at R return true; } public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this);// error at NavUtils return true; } return super.onOptionsItemSelected(item); } I got a number of errors: The import android.support cannot be resolved MainActivity.java /MyFirstApp/src/com/example/myfirstapp line 4 Java Problem The method onCreate(Bundle) of type MainActivity must override or implement a supertype method MainActivity.java /MyFirstApp/src/com/example/myfirstapp line 16 Java Problem ActionBarActivity cannot be resolved to a type MainActivity.java /MyFirstApp/src/com/example/myfirstapp line 12 Java Problem R cannot be resolved to a variable MainActivity.java /MyFirstApp/src/com/example/myfirstapp line 18 Java Problem ActionBarActivity cannot be resolved to a type MainActivity.java /MyFirstApp/src/com/example/…
tagged with: java
tagged with: eclipse
downvote count: 1
type: Question
has title: Android problems when import library project using Eclipse
upvote count: 3
answer count: 1

http://stackoverflow.com/comment/32120947
has text: On reflection this doesn't look like a weaving problem. Sorry. This problem usually gives partially uncovered lines, but you have 0%. Have you tried Up/downgrading cobertura? This has worked for me in the past. (I'm my case downgraded)
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21199240

http://stackoverflow.com/a/39911426
type: Answer
answers question: http://stackoverflow.com/q/21326931
has body: The object values must be different while doing relation ship give the different value in user3.getVehi().add(veh1)
score: 0

http://stackoverflow.com/comment/31896164
has text: yes that was the issue, also in the Scala doc the package is not mentioned in the source code even though its mentioned in the doc
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21184848

http://stackoverflow.com/comment/32073128
type: Comment
comment on: http://stackoverflow.com/a/21248628
score: 0
type: AnswerComment
has text: I can if you want, despite there being many tutorials online... which do you want an example for? Android or Swing?

http://stackoverflow.com/comment/31985680
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21230601
score: 0
has text: even i tried using this link " http://www.dayon.nl/content/xhtml-pdf-java-0 " like but show me error " Exception in thread "main" org.xhtmlrenderer.util.XRRuntimeException: Can't load the XML resource (using TRaX transformer). java.io.IOException: Stream closed " where its show that how we can clean the html. but does not work

http://stackoverflow.com/a/21316706
type: AcceptedAnswer
type: Answer
has body: From http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/HashMap.java: static int indexFor(int h, int length) { return h &amp; (length-1); }
answers question: http://stackoverflow.com/q/21316638
score: 5
upvote count: 5
accepted answer of: http://stackoverflow.com/q/21316638
downvote count: 0

http://stackoverflow.com/comment/32183235
score: 0
has text: Write it like `this.registerBlock((Object[][]) blocks);`
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21346048

http://stackoverflow.com/a/49444325
answers question: http://stackoverflow.com/q/21233135
score: 0
has body: in dq_dataloader-amq.properties you should define param connectionFactoryName = queueConnectionFactory as connectionFactoryNames = queueConnectionFactory then update as &lt;bean id="amqConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"&gt; &lt;property name="jndiTemplate" ref="jndiTemplate" /&gt; &lt;property name="jndiName" value="queueConnectionFactory" /&gt; &lt;/bean&gt; code in ActiveMQInitialContextFactory protected String[] getConnectionFactoryNames(Map environment) { String factoryNames = (String) environment.get("connectionFactoryNames"); if (factoryNames != null) { List&lt;String&gt; list = new ArrayList&lt;String&gt;(); for (StringTokenizer enumeration = new StringTokenizer(factoryNames, ","); enumeration.hasMoreTokens();) { list.add(enumeration.nextToken().trim()); } int size = list.size(); if (size &gt; 0) { String[] answer = new String[size]; list.toArray(answer); return answer; } } return DEFAULT_CONNECTION_FACTORY_NAMES; }
type: Answer

http://stackoverflow.com/a/21278918
answers question: http://stackoverflow.com/q/21276042
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/32151536
upvote count: 1
has comment: http://stackoverflow.com/comment/32120996
has comment: http://stackoverflow.com/comment/32124224
accepted answer of: http://stackoverflow.com/q/21276042
has body: Surround the image loading with a try/catch.. BTW - how exactly does the code load images? ImageIO.read(..) throws informative exceptions, whereas a lot of image loading methods just fail silently.

http://stackoverflow.com/comment/31960875
score: 2
has text: Cache the result of `j.next()` in some variable, then check for its value instead.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21220718

http://stackoverflow.com/comment/32148908
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21327091
has text: @Lorenzo Ohh God really. The people who downvote are not doing it because they have to show superiority over someone. All are helpful enough to take time out from their schedule and help others. And if the question deserves a downvote it will get it. If there are upvotes so will always be the downvotes.

http://stackoverflow.com/a/21284567
has comment: http://stackoverflow.com/comment/32093253
downvote count: 0
has body: search api returns limited number of tweet per request X page. you can use sinceId and maxId to get more tweets. query.setMaxId(maxId); query.setSinceId(sinceId); sinceId must be the tweetId of last tweet that you got in latest request. useful link : https://dev.twitter.com/docs/working-with-timelines
answers question: http://stackoverflow.com/q/21279565
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32076050

http://stackoverflow.com/a/21197218
has comment: http://stackoverflow.com/comment/31920741
upvote count: 1
answers question: http://stackoverflow.com/q/21196672
type: Answer
has body: Here is an example interface: public interface GenericDao&lt;T, PK extends Serializable&gt; { T create(T t); T read(PK id); T update(T t); void delete(T t); } And an implementation: public class GenericDaoJpaImpl&lt;T, PK extends Serializable&gt; implements GenericDao&lt;T, PK&gt; { protected Class&lt;T&gt; entityClass; @PersistenceContext protected EntityManager entityManager; public GenericDaoJpaImpl() { ParameterizedType genericSuperclass = (ParameterizedType) getClass() .getGenericSuperclass(); this.entityClass = (Class&lt;T&gt;) genericSuperclass .getActualTypeArguments()[0]; } @Override public T create(T t) { this.entityManager.persist(t); return t; } @Override public T read(PK id) { return this.entityManager.find(entityClass, id); } @Override public T update(T t) { return this.entityManager.merge(t); } @Override public void delete(T t) { t = this.entityManager.merge(t); this.entityManager.remove(t); } } Log the Exceptions and re-throw them as RuntimeException for the caller. Logging the exceptions:- Print/Log stack trace in catch block, so that if caller of the method forget it to log you have already done it in your GenergicDAO Re-Throwing the exception :- So that caller can catch that exception and rollback etc whatever he want to do
downvote count: 0
score: 1

http://stackoverflow.com/q/21336920
type: Question
has answer: http://stackoverflow.com/a/21631920
tagged with: jetty-9
has title: Running Jetty 9 on Java 6
has comment: http://stackoverflow.com/comment/32168359
tagged with: java-6
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 6
tagged with: jetty
upvote count: 6
has body: I work for a corporation that won't upgrade from JRE 6 to JRE 7 on our servers. I have successfully developed some code that works on JRE 7 using Jetty 9. However, I can't run this code on the corporation server. I was wondering if anyone out here knew of a way to run Jetty 9 on JRE 6. I specifically need the HTTPConfiguration class from Jetty 9. The only potential thing I can think of would be to download Jetty, set it to a 1.6 compliance and work from that. I'm really hoping (with a shot in the dark) that someone has a better idea.
tagged with: java

http://stackoverflow.com/a/21325140
accepted answer of: http://stackoverflow.com/q/21307642
has comment: http://stackoverflow.com/comment/32226865
answers question: http://stackoverflow.com/q/21307642
type: AcceptedAnswer
has body: There is an easy way to easily identify the individual test cases in a Parameterized test, you may provide a name using the @Parameters annotation. This name is allowed to contain placeholders that are replaced at runtime: {index}: the current parameter index {0}, {1}, …: the first, second, and so on, parameter value See example here: https://github.com/junit-team/junit/wiki/Parameterized-tests
type: Answer
has comment: http://stackoverflow.com/comment/32207404
score: 3
has comment: http://stackoverflow.com/comment/32154125
downvote count: 1
upvote count: 4

http://stackoverflow.com/comment/32078138
comment on: http://stackoverflow.com/a/21198208
type: AnswerComment
score: 0
has text: No, I want low latency results.
type: Comment

http://stackoverflow.com/q/21263380
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/21276385
has title: Filter add ArrayList to HashMap
tagged with: android
type: UnansweredQuestion
has body: I have an ArrayList, its hierarchy has 3 levels. Category, Forum, ChildForum. But Forum and ChildForum, they have the same attributes (most important attributes are nodeId, and parentNodeId).And a coupe Forums don't have any ChildForum inside it. Category------ | Forum--------- | | | ChildForum-------- | | |______________________Thread So I want to find a way to binding them into listviews, and onClickItem, check out which Forum has child or not, so i can navigate the view to the right fragment This is what i have done now: nodeList = new ArrayList&lt;Node&gt;(); //nodeList contains Category, Forum, and ChildForum forumNodeList = new ArrayList&lt;Node&gt;(); childList = new ArrayList&lt;Node&gt;(); // temp array forumChildNodeList = new HashMap&lt;String, ArrayList&lt;Node&gt;&gt;(); Fill data for (int i = 0; i &lt; nodeList.size(); i++) { if (nodeList.get(i).getParent_node_id().equals(nodeId)) { //nodeId = categoryId forumNodeList.add(nodeList.get(i)); } for (int j = 0; j &lt; forumNodeList.size(); j++) { if (forumNodeList.get(j).getNodeId() .equals(nodeList.get(i).getParent_node_id())) { childList.add(nodeList.get(i)); // Log.d("childList", "" + childList.size()); forumChildNodeList.put( forumNodeList.get(j).getNodeId(), childList); } forumChildNodeList.put(forumNodeList.get(j).getNodeId(), childList); } } setOnClickItem: getListView().setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position, long arg3) { if (forumChildNodeList.get( forumNodeList.get(position).getNodeId()).size() &gt; 0) { //Fragment Transaction to ChildForumFragment } else { //Fragment Transaction to ThreadFragment } } }); When i show log in onClick. it looks like all HashMap with forum id have the same ChildForum. In fact some of them don't have any childForum. I know for sure, For-loops and the if-conditions have something wrong. or maybe I am missing something? Please help! Thanks in advance!
upvote count: 1
type: Question
tagged with: hashmap
score: 1
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32036523

http://stackoverflow.com/comment/31985034
type: Comment
comment on: http://stackoverflow.com/a/21234151
score: 0
type: AnswerComment
has text: Then the compiler cannot find the method isValidSSn

http://stackoverflow.com/q/21298457
has comment: http://stackoverflow.com/comment/32098233
type: AnsweredQuestion
tagged with: java
score: 17
has title: Which method will be better when multiply 100 with BigDecimal?
type: Question
has comment: http://stackoverflow.com/comment/32098952
tagged with: bigdecimal
downvote count: 3
has comment: http://stackoverflow.com/comment/32098260
has body: Here I have a question when using Java BigDecimal. Which way will be better when I want to multiply 100 for a object of BigDecimal. multiply 10 twice; movePointRight(2); scaleByPowerOfTen(2); any other way? please show me if there is. BTW, it will be used for commercial calculation, so I'm considering the precision rather than the speed.
answer count: 1
has answer: http://stackoverflow.com/a/21298647
accepted answer: http://stackoverflow.com/a/21298647
favorite count: 0
upvote count: 20

http://stackoverflow.com/comment/32140530
type: QuestionComment
type: Comment
has text: @n1k1ch I just edited the post to include that info. Anything else to take a look at? A 3rd day stuck on this is going to suck! :)
score: 0
comment on: http://stackoverflow.com/q/21306956

http://stackoverflow.com/a/21234199
has comment: http://stackoverflow.com/comment/31984633
score: 0
has body: Replace System.currentTimeMillis() with Clock.getRealtimeClock().currentTimeMillis(). The first time delay is not avoidable as it takes some time to load the functions into the stack itself. I believe there is no concept for method caching. Someone correct me if I am wrong.
has comment: http://stackoverflow.com/comment/31984894
type: Answer
answers question: http://stackoverflow.com/q/21234053
has comment: http://stackoverflow.com/comment/31985458

http://stackoverflow.com/comment/32111469
comment on: http://stackoverflow.com/a/21238763
type: AnswerComment
score: 0
has text: Have you run the exported war in Tomcat ? Did you have the same problem as in Eclipse ?
type: Comment

http://stackoverflow.com/a/21185537
answers question: http://stackoverflow.com/q/21185251
has comment: http://stackoverflow.com/comment/31897229
type: Answer
has comment: http://stackoverflow.com/comment/31897245
has body: You need to associate the original path with the label somehow, most likely by creating your own sub-class of label that stores the path inside it. You can then query the path from the label when you get the drop event. You can also look at using ImageIO to load into a BufferedImage which then gives you much more power and control over the image.
has comment: http://stackoverflow.com/comment/31897173
score: 0

http://stackoverflow.com/comment/32005186
comment on: http://stackoverflow.com/a/21245372
score: 0
type: AnswerComment
has text: Perfect! Now look at MadProgrammer's answers on swing questions if you want some tutorials on swing.
type: Comment

http://stackoverflow.com/a/21218449
has body: I solved this problem when I defined the nested hierarchy like this: Session session = (Session)this.em.getDelegate(); Criteria crit = session.createCriteria(getEntityClass()); crit = crit.createAlias("contractDetail", "cd", JoinType.LEFT_OUTER_JOIN); crit = crit.createAlias("cd.contract", "c", JoinType.LEFT_OUTER_JOIN); Criterion criterion= Restrictions.eq("c.operator", operator); crit.add(c); List result = crit.list();
score: 4
type: Answer
accepted answer of: http://stackoverflow.com/q/21204245
upvote count: 4
answers question: http://stackoverflow.com/q/21204245
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27948007
upvote count: 34
has comment: http://stackoverflow.com/comment/104647567
downvote count: 0
has body: Google's Guava provides a Bytes.indexOf(byte[] array, byte[] target).
has comment: http://stackoverflow.com/comment/131060040
type: Answer
has comment: http://stackoverflow.com/comment/70671628
score: 34
has comment: http://stackoverflow.com/comment/88417667
has comment: http://stackoverflow.com/comment/95954204
answers question: http://stackoverflow.com/q/21341027
has comment: http://stackoverflow.com/comment/70625251
has comment: http://stackoverflow.com/comment/91992617

http://stackoverflow.com/q/21346013
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21346151
type: Question
has title: Get a Fixed sized GridLayout
has comment: http://stackoverflow.com/comment/32183241
score: 0
answer count: 1
has body: I need to make a fixed sized for a GridLayout with 100 buttons located in the center portion of a BorderLayout. On the east portion of the border layout is another Gridlayout that keeps shrinking the center component whenever the text is longer then the size of the current JTextAreas located in the east. The JFrame is not resizable also. Is there a way to get a fixed size for the center component while allowing the JTextArea to still expand?
tagged with: jframe
tagged with: size
accepted answer: http://stackoverflow.com/a/21346151
tagged with: swing
tagged with: jbutton

http://stackoverflow.com/comment/32011743
score: 1
has text: where is your runtime code - show us what you have tried.
comment on: http://stackoverflow.com/q/21249411
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32169993
comment on: http://stackoverflow.com/q/21338735
type: Comment
type: QuestionComment
score: 0
has text: i need help in looping through the matrix and display those two numbers. i wrote a for loop that will go through each row and column and find the highest. but, i got stuck after that.

http://stackoverflow.com/comment/138244369
type: Comment
has text: Thanks Michał. I was struggling with the same concept since all the examples use systemDefault. I tested this out and you are correct, I should use ZoneOffset.UTC since I don't want the date value offset/modified. This answer helped clarify it for me: https://stackoverflow.com/a/40143687/2371207
comment on: http://stackoverflow.com/a/48958784
type: AnswerComment
score: 0

http://stackoverflow.com/q/21195844
has answer: http://stackoverflow.com/a/21198970
type: Question
has answer: http://stackoverflow.com/a/21195894
has body: My Async class will not display the contents of the JSON Feed and I am getting the error: 01-17 15:44:35.438: W/System.err(1732): org.json.JSONException: Value null of type org.json.JSONObject$1 cannot be converted to JSONArray. I am assuming my readJSONFeed method may be returning a null string but I cant figure out why. The code is below if anyone can see the problem I would be grateful. public class JSONActivity extends Activity { public String readJSONFeed(String URL) { StringBuilder stringBuilder = new StringBuilder(); HttpClient client = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(URL); try{ HttpResponse response = client.execute(httpGet); StatusLine statusLine = response.getStatusLine(); int statusCode = statusLine.getStatusCode(); if(statusCode == 200){ HttpEntity entity = response.getEntity(); InputStream content = entity.getContent(); BufferedReader reader = new BufferedReader( new InputStreamReader(content)); String line; while ((line = reader.readLine()) != null); { stringBuilder.append(line); } }else{ Log.e("JSON", "Failed to download file"); } }catch(ClientProtocolException e) { e.printStackTrace(); }catch(IOException e) { e.printStackTrace(); } return stringBuilder.toString(); } private class ReadJSONFeedTask extends AsyncTask&lt;String, Void, String&gt; { protected String doInBackground(String... urls){ return readJSONFeed(urls[0]); } protected void onPostExecute(String result){ try{ JSONArray jsonArray = new JSONArray(result); Log.i("JSON", "Number of surverys in feed: " + jsonArray.length()); //---print out the content of the JSON feed--- for(int i = 0; i &lt; jsonArray.length(); i++){ JSONObject jsonObject = jsonArray.getJSONObject(i); Toast.makeText(getBaseContext(), jsonObject.getString("appeId") + " - " + jsonObject.getString("inputTime"), Toast.LENGTH_SHORT).show(); } }catch(Exception e){ e.printStackTrace(); } } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.lay…
answer count: 2
has comment: http://stackoverflow.com/comment/31932453
downvote count: 0
score: 1
favorite count: 0
has title: Async Class not working to print out contents of JSON feed
has comment: http://stackoverflow.com/comment/31916425
type: UnansweredQuestion
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1

http://stackoverflow.com/a/21337754
has body: HashSet relies on the hashCode() method in Object. If you need a hash code, you need to override this method. When overriding hashCode(), one must also override equals(). See What issues should be considered when overriding equals and hashCode in Java?
score: 0
answers question: http://stackoverflow.com/q/21337649
type: Answer

http://stackoverflow.com/q/21244512
score: 17
has comment: http://stackoverflow.com/comment/32007004
answer count: 2
has title: How to scale NodeJS linearly on multiple cores?
downvote count: 0
favorite count: 0
has body: I am doing a quick performance test for NodeJS vs. Java. The simple use case chosen is querying a single table in MySQL database. The initial results were as follows: Platform | DB Connections | CPU Usage | Memory Usage | Requests/second ==============================|================|===========|===============|================ Node 0.10/MySQL | 20 | 34% | 57M | 1295 JBoss EAP 6.2/JPA | 20 | 100% | 525M | 4622 Spring 3.2.6/JDBC/Tomcat 7.0 | 20 | 100% | 860M | 4275 Note that Node's CPU and memory usage are way lower than Java but the throughput is also about a third! Then I realized that Java was utilizing all four cores on my CPU, whereas Node was running on only one core. So I changed the Node code to incorporate the cluster module and now it was utilizing all four cores. Here are the new results: Platform | DB Connections | CPU Usage | Memory Usage | Requests/second ==============================|================|===========|===============|================ Node 0.10/MySQL (quad core) | 20 (5 x 4) | 100% | 228M (57 x 4) | 2213 Note that the CPU and memory usage have now gone up proportionately but the throughput has only gone up by 70%. I was expecting a four fold increase, exceeding the Java throughput. How can I account for the descrepancy? What can I do to increase the throughput linearly? Here's the code for utilizing multiple cores: if (Cluster.isMaster) { var numCPUs = require("os").cpus().length; for (var i = 0; i &lt; numCPUs; i++) { Cluster.fork(); } Cluster.on("exit", function(worker, code, signal) { Cluster.fork(); }); } else { // Create an express app var app = Express(); app.use(Express.json()); app.use(enableCORS); app.use(Express.urlencoded()); // Add routes // GET /orders app.get('/orders', OrderResource.findAll); // Create an http server and give it the // express app to handle http requests var server = Http.createServer(app); server.listen(8080, function() { console.log('Listening on port 8080'); }); } I am using the node-mysql driver for query…
has comment: http://stackoverflow.com/comment/32004859
has comment: http://stackoverflow.com/comment/32004470
has comment: http://stackoverflow.com/comment/36882993
has comment: http://stackoverflow.com/comment/32006556
tagged with: node.js
type: UnansweredQuestion
tagged with: node-mysql
tagged with: spring
has comment: http://stackoverflow.com/comment/61574372
upvote count: 17
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/21246953
tagged with: java
has answer: http://stackoverflow.com/a/24817870

http://stackoverflow.com/a/21209298
type: Answer
has comment: http://stackoverflow.com/comment/31941200
has comment: http://stackoverflow.com/comment/31941072
has body: Your problem is not really the state pattern. Your problem lies after the state pattern has done it's job which is to route a method call to a certain implementation that represents a state. The instanceof problem with subclasses is an independent problem. The solution here is to avoid instanceof like in other code too, preferably with with interaction between the state and it's next state via methods. switch over enum types looks nicer already but is not much better since you still depend on the concrete type of the other object. Could be considered okay since all of them are defined in the same class so the dependency is just on yourself. What you should end up with in the best case looks something like @Override public void doStateDependentLogic(IState newState) { if (newState.isBeautiful()) { System.out.println(newState.getYourPartOfTheInterAction(this)); } else { somethingElse(); } } i.e. method calls on abstractions without being concerned about the implementation details.
upvote count: 1
has comment: http://stackoverflow.com/comment/31942796
has comment: http://stackoverflow.com/comment/31941008
answers question: http://stackoverflow.com/q/21208729
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31941221

http://stackoverflow.com/comment/32177079
type: Comment
comment on: http://stackoverflow.com/a/21342214
has text: This doesn't do what I need. I want to make it impossible to add the wrong Concept into a List. For example, no Link in Relations and no Relation into Links.
type: AnswerComment
score: 0

android-broadcast
tag name: android-broadcast
tags question: http://stackoverflow.com/q/21250548
type: Tag

http://stackoverflow.com/comment/31923506
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21199644
has text: My maim methods are always especially violent.
score: 1

http://stackoverflow.com/comment/32061581
score: 2
comment on: http://stackoverflow.com/a/21277260
has text: @Sudhanshu Why? So you can add unnecessary string processing to your code for fun?
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21208479
has answer: http://stackoverflow.com/a/21208490
has body: I have a class that contains static fields like large lists that stores keywords. Then I have static methods that work on those static fields. I was wondering if the static fields get emptied and loaded every time I call the static methods.
has title: Are the static fields called/loaded every time they are used?
answer count: 3
has comment: http://stackoverflow.com/comment/31938614
has answer: http://stackoverflow.com/a/21208517
has comment: http://stackoverflow.com/comment/31938591
tagged with: static
has comment: http://stackoverflow.com/comment/31938973
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31938624
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/21208517
has answer: http://stackoverflow.com/a/21208585
type: Question
possible better answer: http://stackoverflow.com/a/21208490
has comment: http://stackoverflow.com/comment/31938629

http://stackoverflow.com/q/21252096
linked to: http://stackoverflow.com/q/953723
has body: I noticed ObjectFactory class generated by jaxb compiler xjc. I read something about the purpose of it. I am wondering what is a proper way to create jaxb objects as for my purposes I don't need this class at all. Should I always use the ObjectFactory even for trivial cases or can I construct the objects via normal constructor (what definitely works ok)? Edit: added example: I need to create instance of IpAddress This is factory method: public IpAddress createIpAddress() { return new IpAddress(); } Is it better IpAddress ia = new IpAddress() or IpAddress ia = objectFactory.createIpdAddress()
tagged with: java
has answer: http://stackoverflow.com/a/21255672
tagged with: jaxb
type: Question
upvote count: 4
has title: Proper way of creating JAXB objects
answer count: 2
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/21252250
favorite count: 0
has comment: http://stackoverflow.com/comment/32016266
type: UnansweredQuestion

http://stackoverflow.com/comment/32084289
type: QuestionComment
type: Comment
has text: Kevin set that as an answer and I'll set that as accepted, thanks!
comment on: http://stackoverflow.com/q/21290788
score: 0

http://stackoverflow.com/q/21271627
type: Question
has body: Wondering if someone can help, i am having some trouble with NotificationCompat.BigPictureStyle - i dont know if i am missing something, but my notification works except for the picture.. i have included a lot of the source most of it happens at the end.. public class OneShotAlarm extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { int z = 4; //increase this number here to the total number of affirmations Random rand = new Random(); int y = rand.nextInt(z); String[] s = null; s = new String[z]; //dim s[0] = "i am the best and you are the most amaxzing thing on "; s[1] = "I love and approve of myself."; s[2] = "you are the re2t"; s[3] = "you are the res3t"; String zztitle = ""; String zzrestofline = ""; String string = s[y]; StringBuffer buffer = new StringBuffer(); if (string.length() &gt; 25){ for(int i = 0; i &lt; string.length(); i++) { // Set title to first 25 chars and rest of line to rest // if((i &gt; 0) &amp;&amp; (i % 100) == 0) { if(i == 25) { zztitle = buffer.toString(); buffer = new StringBuffer(); } // Just adds the next character to the StringBuffer. buffer.append(string.charAt(i)); } zzrestofline = buffer.toString(); } else { zztitle = s[y]; } setNotification(context,zzrestofline,zztitle); WakeLocker.acquire(context); Toast.makeText(context,s[y], Toast.LENGTH_LONG).show(); WakeLocker.release(); } private void setNotification(Context context, String zzmsg, String zztitle) { // http://codeversed.com/expandable-notifications-android/#Custom_View Bitmap remote_picture = null; remote_picture = BitmapFactory.decodeResource(context.getResources(), R.drawable.retreatgoddess); // Create the style object with BigPictureStyle subclass. NotificationCompat.BigPictureStyle notiStyle = new NotificationCompat.BigPictureStyle(); notiStyle.setBigContentTitle("Big Picture Expanded"); notiStyle.setSummaryText("Nice big picture."); // Add the big picture to the style. notiStyle.bigPicture(remote_picture); // Creates an explicit int…
downvote count: 0
answer count: 1
favorite count: 0
tagged with: notifications
has comment: http://stackoverflow.com/comment/38977220
tagged with: android
upvote count: 2
type: UnansweredQuestion
has title: NotificationCompat.BigPictureStyle can get picture to display
has answer: http://stackoverflow.com/a/29668726
score: 2
tagged with: java

http://stackoverflow.com/q/21205389
favorite count: 0
tagged with: jtable
linked to: http://stackoverflow.com/q/2192764
tagged with: sql
linked to: http://stackoverflow.com/q/9593468
accepted answer: http://stackoverflow.com/a/21205454
upvote count: 2
linked to: http://stackoverflow.com/q/2201886
has title: How to retrieve value from JTextField in JTable?
tagged with: swing
tagged with: jtextfield
downvote count: 1
possible better answer: http://stackoverflow.com/a/54941152
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/54941152
score: 1
tagged with: java
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/10620448
has body: Let me break my question in 2 parts. How to retrieve value from JTextfiled in JTable? After all the data how to store in database in one go? Name and Age should be retrive from JTextfield on jbutton1 action and by clicking jbutton2 all the data of Jtable should be stored in SQL DB. Below is my code: package tablefilterdemo; public class Tableinputhroughtextbox extends javax.swing.JFrame { public Tableinputhroughtextbox() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jButton1 = new javax.swing.JButton(); jtfname = new javax.swing.JTextField(); jtfage = new javax.swing.JTextField(); jButton2 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null}, {null, null}, {null, null}, {null, null} }, new String [] { "Name", "Age" } )); jScrollPane1.setViewportView(jTable1); jButton1.setText("Submit for Table"); jButton2.setText("Submit for SQL"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(29, 29, 29) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(53, 53, 53) .addComponent(jtfname, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(46, 46, 46) .addComponent(jtfage, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_S…
has answer: http://stackoverflow.com/a/21205454

http://stackoverflow.com/q/21186550
has answer: http://stackoverflow.com/a/21347856
tagged with: macos
tagged with: webcam
score: 1
has comment: http://stackoverflow.com/comment/31931256
has title: java capturing webcam images macbook
has comment: http://stackoverflow.com/comment/31906363
has comment: http://stackoverflow.com/comment/31901252
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21347856
linked to: http://stackoverflow.com/q/17061374
tagged with: java
has answer: http://stackoverflow.com/a/29233266
has comment: http://stackoverflow.com/comment/31940879
type: Question
answer count: 3
tagged with: javacv
has body: I'm currently beginning on a project where I want to capture and manipulate a datastream from my webcam in order to start I wanted to take some pictures from my webcam and show those to the user. However this gave an error. public class quicktest implements Runnable { public static void main(String[] args){ Thread t=new Thread(new quicktest()); t.start(); } IplImage image; CanvasFrame canvas = new CanvasFrame("Web Cam"); public quicktest() { canvas.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE); } @Override public void run() { FrameGrabber grabber = new VideoInputFrameGrabber(0); int i=0; try { grabber.start(); IplImage img; while (true) { img = grabber.grab(); if (img != null) { cvFlip(img, img, 1);// l-r = 90_degrees_steps_anti_clockwise // show image on window canvas.showImage(img); } Thread.sleep(1000); } } catch (Exception e) { } } this gives the following exception: Exception in thread "Thread-3" java.lang.UnsatisfiedLinkError: no jnivideoInputLib in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1764) at java.lang.Runtime.loadLibrary0(Runtime.java:823) at java.lang.System.loadLibrary(System.java:1044) at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:711) at com.googlecode.javacpp.Loader.load(Loader.java:586) at com.googlecode.javacpp.Loader.load(Loader.java:540) at com.googlecode.javacv.cpp.videoInputLib.&lt;clinit&gt;(videoInputLib.java:81) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:249) at com.googlecode.javacpp.Loader.load(Loader.java:561) at com.googlecode.javacpp.Loader.load(Loader.java:540) at com.googlecode.javacv.cpp.videoInputLib$videoInput.&lt;clinit&gt;(videoInputLib.java:193) at com.googlecode.javacv.VideoInputFrameGrabber.start(VideoInputFrameGrabber.java:101) at com.googlecode.javacv.VideoInputFrameGrabber.start(VideoInputFrameGrabber.java:98) at quicktest.run(quicktest.java:27) at java.lang.Thread.run(Thread.java:695) I already searched and tried what was suggest…
downvote count: 0
possible better answer: http://stackoverflow.com/a/21257624
favorite count: 0
has answer: http://stackoverflow.com/a/21257624
tagged with: exception

http://stackoverflow.com/comment/32029716
has text: Exceptions should not be used to control flow. Only throw one if it is actually an Exception.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21260037
score: 4

http://stackoverflow.com/a/23909448
answers question: http://stackoverflow.com/q/21231560
upvote count: 1
type: Answer
downvote count: 0
has body: final Process exec = new ProcessBuilder("bash", "-c", query).start(); As the error indicates, there is no executable program bash, typically bash in installed on Unix systems at location /bin/bash, so you must provide the path to your program. Even relative paths work. This command below will work on Unix like OS with bash installed. final Process exec = new ProcessBuilder("/bin/bash", "-c", query).start();
score: 1

http://stackoverflow.com/q/21197165
has comment: http://stackoverflow.com/comment/31918971
has comment: http://stackoverflow.com/comment/31918878
has comment: http://stackoverflow.com/comment/31919066
type: UnansweredQuestion
score: -4
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21197579
tagged with: java
has title: My program requires java JDK to run?
has comment: http://stackoverflow.com/comment/31918869
downvote count: 5
has comment: http://stackoverflow.com/comment/31919640
answer count: 1
favorite count: 0
has body: this is a kind of weird non programming (but java related) question. I created a java program (game) using just normal java, and no libraries. In ordor to double click/open it, you need to have java SDK/JDK (I don't know which) installed. I tested this multiple times, and in order for my PC and Mac to launch it, you need to install it. is there anyway to get around this? I know Minecraft doesn't force you to download the JDK. Here's the link to source code of my game if your interested (no, it is not a virus): http://www.filedropper.com/daplatform Thanks, Jake Here's the link to the download of the JDK (Its next to the giant Netbeans download): http://www.oracle.com/technetwork/java/javase/downloads/index.html

http://stackoverflow.com/a/21279280
answers question: http://stackoverflow.com/q/21279042
type: Answer
has body: You can check this in two ways... 1] checks if String is empty... if ( "".equals(picture.trim()) ) { picture = "NULL"; } 2] checks if String length is 0... if ( picture.trim().length() == 0 ) { picture = "NULL"; }
has comment: http://stackoverflow.com/comment/32066603
score: 0

http://stackoverflow.com/comment/31902809
comment on: http://stackoverflow.com/a/21186321
type: Comment
has text: Thanks for `final` example :)
score: 1
type: AnswerComment

http://stackoverflow.com/comment/32158422
type: QuestionComment
has text: How do you want to format date object?? Why?
score: 0
comment on: http://stackoverflow.com/q/21332592
type: Comment

http://stackoverflow.com/a/21213562
upvote count: 3
answers question: http://stackoverflow.com/q/21213552
downvote count: 0
has body: you want return statement return total/numbers.length; out of loop
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21213552
type: Answer
score: 3

http://stackoverflow.com/q/21324864
tagged with: java
score: 0
answer count: 1
tagged with: google-app-engine
has body: I don't know what the heck is going on but I cloned google's GAE Tic Tac Toe example directly into eclipse using this address: https://github.com/GoogleCloudPlatform/appengine-endpoints-tictactoe-java And i cannot serve an jpg from the images folder for the life of me. A gif serves fine. But not jpgs. Any jpg brings up a 404 error. Please, someone... tell me I am not crazy.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32145019
type: Question
has answer: http://stackoverflow.com/a/21332274
accepted answer: http://stackoverflow.com/a/21332274
has title: Java App Engine Tic Tac Toe example Serve image

http://stackoverflow.com/a/21246482
score: 0
type: Answer
has body: You will need to look at every element in the array since it is unsorted. I think when the interviewer said it would take long, you should have said, "yes, it could take long, but that's the only way".
answers question: http://stackoverflow.com/q/21246451

http://stackoverflow.com/q/21204589
tagged with: instance-variables
has answer: http://stackoverflow.com/a/21204694
favorite count: 0
possible better answer: http://stackoverflow.com/a/21204730
upvote count: 25
linked to: http://stackoverflow.com/q/413898
has answer: http://stackoverflow.com/a/21204730
tagged with: static-variables
has answer: http://stackoverflow.com/a/71917755
has body: What is the difference between a static and instance variable. The following sentence is what I cant get: In certain cases, only one copy of a particular variable should be shared by all objects of a class- here a static variable is used. A static variable represents class wide info.All objects of a class share the same data. I thought that instance vars were used class wide whereas static variables only had scope within their own methods?
type: AnsweredQuestion
tagged with: java
score: 24
has answer: http://stackoverflow.com/a/21204644
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/52926126
has answer: http://stackoverflow.com/a/48156635
accepted answer: http://stackoverflow.com/a/21204644
answer count: 6
has comment: http://stackoverflow.com/comment/31931874
tagged with: class
has title: Static vs Instance Variables: Difference?
has comment: http://stackoverflow.com/comment/31931653

http://stackoverflow.com/a/21846889
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21302446
has body: No, you can't use QC 10 url to connect using ALM Rest APIs. ALM Rest APIs are supported for HP ALM 11.0 onwards. Go to Help >> Documentation Library for more information about the ALM REST API in your ALM.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32109288
comment on: http://stackoverflow.com/q/21304106
score: 0
type: Comment
type: QuestionComment
has text: what is line 73 in Fragment1.java?

http://stackoverflow.com/a/21259026
has body: Figured it out, you need to use @DestinationVariable instead of @PathVariable
answers question: http://stackoverflow.com/q/21192091
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21192091
upvote count: 10
downvote count: 1
score: 9

communication
tag name: communication
type: Tag
tags question: http://stackoverflow.com/q/21252540

http://stackoverflow.com/comment/139940654
comment on: http://stackoverflow.com/a/45541092
type: AnswerComment
score: 0
has text: What is the reason you implemented `readStore()` instead of using `loadKeyMaterial(KEYSTOREPATH, KEYSTOREPASS.toCharArray(), KEYPASS.toCharArray())` ?
type: Comment

http://stackoverflow.com/a/21282001
has comment: http://stackoverflow.com/comment/32068848
answers question: http://stackoverflow.com/q/21281867
has body: Try: try (BufferedReader reader = createBufferedReader(condition)) { do things ... } private BufferedReader createBufferedReader(boolean condition){ if (condition) { return method1(); } else { return method2(); } }
has comment: http://stackoverflow.com/comment/32068928
has comment: http://stackoverflow.com/comment/32068674
type: Answer
has comment: http://stackoverflow.com/comment/32068613
has comment: http://stackoverflow.com/comment/32069184
has comment: http://stackoverflow.com/comment/32069243
upvote count: 1
has comment: http://stackoverflow.com/comment/32069195
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32069033

http://stackoverflow.com/comment/32123158
has text: link will help..http://stackoverflow.com/questions/21019131/read-json-file-and-display-its-contents/21019227#21019227
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21312899

http://stackoverflow.com/comment/61932237
type: Comment
has text: `matches in Java means matches the whole string,` thank you!
comment on: http://stackoverflow.com/a/21274068
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32029610
score: 1
has text: Literals are interned anyway; seems redundant. Maybe there's an edge case? I'm skeptical it would ever matter in a relevant way, though. I suspect Cult of the Cargo.
type: Comment
comment on: http://stackoverflow.com/q/21260072
type: QuestionComment

http://stackoverflow.com/q/21242137
answer count: 3
tagged with: android
accepted answer: http://stackoverflow.com/a/21242519
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21242931
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/21242931
type: Question
has title: Android click on the button to go to another page?
has answer: http://stackoverflow.com/a/21242519
has answer: http://stackoverflow.com/a/21242574
tagged with: button
downvote count: 0
favorite count: 0
has body: I need to link the button with the page (not the main page) like when I click on the button to go to the page for example (location page)? private void setupLocationPageButton() { Button LocationPageButton = (Button) findViewById(R.id.btnLocationPage); LocationPageButton.setOnClickListener(new View.OnClickListener()

http://stackoverflow.com/q/21242244
has body: Here I am creating a simple Droid LoginApp, which simply tells login successfull or not. But the if statement is not giving me the desired result. Following is the code : MainActivity.java package com.example.login1; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { public EditText t1,t2; public Button b1; String user,pass; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); t1=(EditText)findViewById(R.id.editText1); t2=(EditText) findViewById(R.id.editText2); b1= (Button) findViewById(R.id.button1); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public void onClick(View arg0) { user = t1.getText().toString(); pass = t2.getText().toString(); if (((user.equals("user")) &amp;&amp; (pass.equals("user")))) { Toast.makeText(this, "Login Sucessful", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(this, "Sorry", Toast.LENGTH_SHORT).show(); t1.setText(""); t2.setText(""); } } } activity_main.xml &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="fill_vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignPar…
has comment: http://stackoverflow.com/comment/31999290
has title: If Else statement in Android not working
linked to: http://stackoverflow.com/q/513832
tagged with: android
has answer: http://stackoverflow.com/a/21242510
has comment: http://stackoverflow.com/comment/31999985
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32000224
has comment: http://stackoverflow.com/comment/31999485
type: Question
has comment: http://stackoverflow.com/comment/31999920
accepted answer: http://stackoverflow.com/a/21242510
tagged with: java
has comment: http://stackoverflow.com/comment/31999316
has comment: http://stackoverflow.com/comment/31999490
has comment: http://stackoverflow.com/comment/31999294
has comment: http://stackoverflow.com/comment/32002837
possible better answer: http://stackoverflow.com/a/21242499
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21242499

http://stackoverflow.com/comment/32021814
type: Comment
type: QuestionComment
has text: Then the resource `res/GeoIP.dat` must be found at `src/res/GeoIP.dat`.
comment on: http://stackoverflow.com/q/21254465
score: 0

http://stackoverflow.com/comment/31998612
type: Comment
type: QuestionComment
has text: Please indent your code properly before posting it, this is a mess to try to look through.
score: 0
comment on: http://stackoverflow.com/q/21241860

http://stackoverflow.com/a/21197268
answers question: http://stackoverflow.com/q/21197053
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: Try this &lt;s:if test='%{com.opensymphony.xwork2.ActionContext.name=="YourActionName"}'&gt; //do some stuff &lt;/s:if&gt;

http://stackoverflow.com/comment/31990739
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21237220
score: 0
has text: @DwB I only found a concept how to deploy JAR packages in the link you posted.

http://stackoverflow.com/comment/31982227
comment on: http://stackoverflow.com/q/21232923
has text: It looks fine. Try running the SQL statement on its own in a query browser. Does that work?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21205871
has answer: http://stackoverflow.com/a/21205977
has comment: http://stackoverflow.com/comment/31933994
has title: Java BufferedImage get single pixel brightness
has answer: http://stackoverflow.com/a/21210977
score: 4
tagged with: image
upvote count: 4
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/14513542
tagged with: monochrome
favorite count: 0
accepted answer: http://stackoverflow.com/a/21210977
has body: I want to convert coloured image to a monochrome, i thought to loop all pixel, but I don't know how to test if they are bright or dark. for(int y=0;y&lt;image.getHeight();y++){ for(int x=0;x&lt;image.getWidth();x++){ int color=image.getRGB(x, y); // ???how to test if its is bright or dark? } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31933970
tagged with: java
has comment: http://stackoverflow.com/comment/31933911
possible better answer: http://stackoverflow.com/a/21205977
type: Question

http://stackoverflow.com/comment/32044934
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21264385
has text: You don't need to split out your tests, and it doesn't always make logical sense to do so. If you're using a runner that doesn't automatically create the Mockito mocks, you can just call the static [initMocks](http://docs.mockito.googlecode.com/hg/org/mockito/MockitoAnnotations.html#initMocks(java.lang.Object)) method instead of using the runner, to process the Mockito annotations. You may also want to add code for the usage validation, but this is not strictly necessary.

http://stackoverflow.com/q/21228203
score: 1
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/21228266
has answer: http://stackoverflow.com/a/21228273
type: Question
has answer: http://stackoverflow.com/a/21228269
accepted answer: http://stackoverflow.com/a/21228269
downvote count: 0
has title: I came across this code snippet in the hello android book and do not understand it
has comment: http://stackoverflow.com/comment/31974092
has answer: http://stackoverflow.com/a/21228266
has body: Hello I am a beginner at Java please help me explain this code snippet this.game = (Game) context; The member variable game is an object reference of class Game while context is passed on to the constructor
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/21228287
has comment: http://stackoverflow.com/comment/31974083
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/32130541
comment on: http://stackoverflow.com/q/21316964
type: QuestionComment
has text: What's not working? And what have you declared the `fileName1` variable for?
score: 0
type: Comment

http://stackoverflow.com/comment/31959936
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21220234
has text: @BoristheSpider Please take a moment to check the User class, I already Eagerly load the collection

http://stackoverflow.com/q/21203430
upvote count: 6
has comment: http://stackoverflow.com/comment/31931686
has body: I have final class and with constructor for that... I have problem to mock this class. I came to know that i cannot use EasyMock for final class. But in my project i should use easymock only. Is there a way to mock this class? Can you please anyone help me in this? //A a = createMock(A.class);//IllegalException occuring while running this test case For example : final class A { private int a; A(int a){ this.a = a; } }
type: UnansweredQuestion
score: 6
has title: How to mock final class in java by using EasyMock?- Junit test
tagged with: java
tagged with: easymock
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21339497
has answer: http://stackoverflow.com/a/21208179
downvote count: 0
has comment: http://stackoverflow.com/comment/31929884
has comment: http://stackoverflow.com/comment/31929781
favorite count: 0
tagged with: junit

http://stackoverflow.com/comment/93390220
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21233582
has text: BTW, Java int is always 32 bits (regardless of the architecture that your given JVM is running on [https://stackoverflow.com/questions/18017752/will-an-int-be-32bit-and-a-long-64bit-regardless-of-whether-the-system-is-32-or]): "By default, the int data type is a 32-bit signed two's complement integer, which has a minimum value of -231 and a maximum value of 231-1" (https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html). So the 32-bit specification here seems to be a bit irrelevant/moot.
score: 0

http://stackoverflow.com/q/21310838
has answer: http://stackoverflow.com/a/21315743
accepted answer: http://stackoverflow.com/a/21315743
type: AnsweredQuestion
has title: Java: WatchService : File.Lastmodified returns 0
downvote count: 0
type: Question
score: 1
has body: I am trying to write a basic directory monitor that prints whether a file is created, changed, or deleted. But I am having trouble displaying the 'lastModified' time of each file. Please see full code below: public static void main(String[] args) throws IOException, InterruptedException { // TODO Auto-generated method stub WatchService watcher = FileSystems.getDefault().newWatchService(); Path dir = Paths.get("C:\\Users\\User1\\Desktop\\test"); WatchKey key = dir.register(watcher, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY ); for (;;) { WatchKey key2 = watcher.take(); for ( WatchEvent&lt;?&gt; event : key.pollEvents() ) { WatchEvent.Kind&lt;?&gt; kind = event.kind(); WatchEvent&lt;Path&gt; ev = (WatchEvent&lt;Path&gt;) event; Path filename = ev.context(); File fullFilename = filename.toFile(); System.out.println("Event: |"+kind+"| Filename: "+fullFilename.getName()+"|Time: "+fullFilename.lastModified()); if (fullFilename.exists()) { System.out.println(fullFilename.getName()+" - Exists"); } else { System.out.println("fullFileName does not exist"); } } boolean valid = key.reset(); if (!valid) { break; } } } The lastModified method returns 0. I have tried testing whether fileFullname object actually exists, and for some reason it doesn't. Yet, when you use fileFullname.getName() it returns the filename just fine. What am I doing wrong? I appreciate your help, and thank you in advance!
tagged with: java
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/q/21290474
has body: While running a set of code in Eclipse, the results are not displayed in the Eclipse console window... Instead "Bhs Console" window opens up and displays the following: bsh % BeanShell 1.3.0 - by Pat Niemeyer (pat@pat.net) Please help me out to sort it... I want the results in the Eclipse console window...
score: 0
has comment: http://stackoverflow.com/comment/32092190
answer count: 1
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32084101
has comment: http://stackoverflow.com/comment/32084303
tagged with: eclipse
has title: Results displayed in Bsh window instead of Eclipse console window while running a program in Eclipse
type: Question
has answer: http://stackoverflow.com/a/26328427
has comment: http://stackoverflow.com/comment/32169502

http://stackoverflow.com/comment/139768118
type: AnswerComment
score: 0
type: Comment
has text: @robmayoff if I knew the answer I would post it. It seems, however, that you do :)
comment on: http://stackoverflow.com/a/21346447

http://stackoverflow.com/comment/31901232
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21186435
has text: I don't really see what are you trying to achieve with this custom annotation, it does not have any validators. What is the aspect you mentioned. Please provide more details.
type: Comment

jsr172
type: Tag
tag name: jsr172
tags question: http://stackoverflow.com/q/21187398

http://stackoverflow.com/a/21247141
upvote count: 2
has comment: http://stackoverflow.com/comment/32008963
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32026529
answers question: http://stackoverflow.com/q/21247091
has body: Valid protocols for the URL class are http, https, ftp, file, and jar so try URL url = new URL("file://Users/videogames/Documents/workspace/TryApplets/res/adv.wav"); If in doubt read the API http://docs.oracle.com/javase/7/docs/api/java/net/URL.html#URL(java.lang.String)
downvote count: 0
has comment: http://stackoverflow.com/comment/32009019

http://stackoverflow.com/a/21338560
has comment: http://stackoverflow.com/comment/32189984
score: 1
has comment: http://stackoverflow.com/comment/32188269
downvote count: 0
answers question: http://stackoverflow.com/q/21336837
has body: Here is more code Renderer.java package game; import static org.lwjgl.opengl.GL11.GL_BLEND; import static org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT; import static org.lwjgl.opengl.GL11.GL_DEPTH_BUFFER_BIT; import static org.lwjgl.opengl.GL11.GL_DEPTH_TEST; import static org.lwjgl.opengl.GL11.GL_MODELVIEW; import static org.lwjgl.opengl.GL11.GL_PROJECTION; import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D; import static org.lwjgl.opengl.GL11.glClear; import static org.lwjgl.opengl.GL11.glEnable; import static org.lwjgl.opengl.GL11.glLoadIdentity; import static org.lwjgl.opengl.GL11.glMatrixMode; import static org.lwjgl.util.glu.GLU.gluPerspective; import static org.lwjgl.opengl.GL11.GL_CONSTANT_COLOR; import static org.lwjgl.opengl.GL11.GL_ONE; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.GL11; public class Renderer { private static boolean in3d = false; public static void initText2D() { in3d = false; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); //GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL11.glClearDepth(1); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glViewport(0,0, 800, 600); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 800, 600, 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); } public static void init2D() { in3d = false; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); GL11.glEnable(GL_BLEND); GL11.glMatrixMode(GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 1, -1); GL11.glMatrixMode(GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glDisable(GL_TEXTURE_2D); // Test //GL11.glBlendFunc(GL_CONSTANT_COLOR, GL_ONE); } public static void init3D(float fov, float aspect, float near, float far) { in3d = t…
type: Answer
upvote count: 1

http://stackoverflow.com/q/21208355
has answer: http://stackoverflow.com/a/21208548
possible better answer: http://stackoverflow.com/a/21208474
has body: I want to search a string for an identifier. The identifier can 4 have variations REF964758362562 REF964-758362-562 964758362562 964-758362-562 The identifier can be located anywhere in a string or on it own. Example: Lorem ipsum REF964-758362-562 Lorem ipsum ABCD964-758362-562 lorem ipsum Lorem ipsum REF964-758362-562 lorem ipsum REF964-758362-562 Lorem ipsum 1234-123456-22 Lorem ipsum 964-758362-562 lorem ipsum REF964758362562 REF964-758362-562 964758362562 964-758362-562 When a hyphen/dash character is used in the identifier, the hyphen will always appear after the third and 9th digits as shown in the examples. Here is what i have come up with but i suspect that the regular expression is getting too long and it can probably be shortened. This also does work well when the identifier is not at the beginning of the string. Any tips/ideas? ^[A-Z]*REF[A-Z]*([12]\d{3})(\d{6})(\d{2})$|^([12]\d{3})(\d{6})(\d{2})[A-Z]*REF[A-Z]*|^([12]\d{3})(\d{6})(\d{2})$ I have put them in groups because once i have extracted the identifiers, i want to add the hyphen if the identifier does not have a hyphen. For example, if the identifier extracted is 964758362562, i want to save it as 964-758362-562. Here are some tests i have run and as you can see not a lot of them match testRegex = "^[A-Z]*REF[A-Z]*([12]\\d{3})(\\d{6})(\\d{2})$|^([12]\\d{3})(\\d{6})(\\d{2})[A-Z]*REF[A-Z]*|^([12]\\d{3})(\\d{6})(\\d{2})$"; PATTERN = Pattern.compile(testRegex, Pattern.CASE_INSENSITIVE); m = PATTERN.matcher("Lorem ipsum REF964-758362-562"); if(m.matches()) { System.out.println("Match = " + m.group()); }else{ System.out.println("No match"); } m = PATTERN.matcher("REF964-758362-562 Lorem ipsum 1234-123456-22"); if(m.matches()) { System.out.println("Match = " + m.group()); }else{ System.out.println("No match"); } m = PATTERN.matcher("Lorem ipsum 964-758362-562 lorem ipsum"); if(m.matches()) { System.out.println("Match = " + m.group()); }else{ System.out.println("No match"); } m = PATTERN.matcher("Lorem ipsu…
has answer: http://stackoverflow.com/a/21208474
tagged with: search
score: 0
has title: Regular Expressions - Using Regex to search for a specific string within another string
has answer: http://stackoverflow.com/a/21208422
tagged with: string
tagged with: pattern-matching
tagged with: regex
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21208422
has answer: http://stackoverflow.com/a/21208565
tagged with: java
type: Question

http://stackoverflow.com/comment/32051773
comment on: http://stackoverflow.com/a/21271973
score: 0
type: Comment
has text: Could be a `String` with "flower" as the content, an enum or an object. Hence why I didn't fill it out. This does however seem to be a school assignment so it doesnt hurt to like some blanks.
type: AnswerComment

http://stackoverflow.com/q/21189855
tagged with: java
has comment: http://stackoverflow.com/comment/31905556
type: Question
has answer: http://stackoverflow.com/a/21204210
tagged with: arrays
has comment: http://stackoverflow.com/comment/31906181
has comment: http://stackoverflow.com/comment/31908855
tagged with: arraylist
score: 0
upvote count: 1
answer count: 1
downvote count: 1
has title: Android: compare string input (edittext) with arraylist
has body: I want to compare my input string with an array list of another class, so I used the searchfield to compare them. As below it works fine. Input Class public class Suche extends Activity{ private Button zumergebnis; final Intent zum_ergebnis = new Intent("android.intent.action.activity_ergebnis"); static String mystring; static void setstring(String textView){ mystring = textView; } @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_suche); zumergebnis = (Button) findViewById(R.id.zumergebnis); zumergebnis.setOnClickListener(new View.OnClickListener(){ public void onClick(View v){ EditText searchinput = (EditText) findViewById(R.id.editText1); String from = searchinput.getText().toString(); setstring(from); startActivity(zum_ergebnis); } });} } Comparing Class public class Ergebnis extends Suche { private TextView textView; static String getstring(){ return mystring; } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ergebnis); textView = (TextView) findViewById(R.id.textView2); textView.setText(mystring); class2 Object = new class2(); final ArrayList&lt;String&gt; word = Object.method2(); ListAdapter listenAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, word); ListView mystringsView = (ListView) findViewById(R.id.listView1); mystringsView.setAdapter(listenAdapter); textView = (TextView) findViewById(R.id.textView2); String searchField = (mystring); for (String s : word) { if (searchField.toString().contains(s)) { textView.setText("Your word"+mystring+"exists in the list"); } else { textView.setText("Word"+mystring+"doesnt exist"); continue; } break; } } } list class public ArrayList method2(){ ArrayList&lt;String&gt; word = new ArrayList&lt;String&gt;(); word.add("uno"); word.add("dos"); word.add("tres"); return word; } } but when adding a second: list class …
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/31905495

http://stackoverflow.com/comment/107375464
comment on: http://stackoverflow.com/q/21325777
score: 0
type: QuestionComment
type: Comment
has text: Genetics doesn't work this way. The inheritance of genetic traits from your mother or father is essentially random. And in some cases, the trait will come from both parents. The only traits that always (i.e. for all children) come from exclusively from the father or mother are those that involve the Y chromosome; i.e. they only affect male children. In UML terms, this "design" is more an Object Diagram than a Class Diagram. So while the problem may be useful as an exercise, it is not related to reality.

http://stackoverflow.com/q/21308523
type: Question
accepted answer: http://stackoverflow.com/a/21308891
score: 0
linked to: http://stackoverflow.com/q/14752782
answer count: 1
tagged with: jsp
has body: I collect Date from my Spring MVC/ Hibernate app using the following code: String startMembershipDate = request.getParameter("startmembershipdate"); and I am using the following field definition for this field in my entity @Column(name="MEMBERSHIP_DATE", nullable=false, unique=false) private Date membershipDate; So I was wondering if someone can please provide me with an example on how to convert the received date in the JSP to GMT format using Joda-time? Also shall I change the field definition from Date to DateTime? Timestamp?
linked to: http://stackoverflow.com/q/10834665
tagged with: spring
linked to: http://stackoverflow.com/q/5042587
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21308891
has title: Saving date in GMT format using Joda-time - Java
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/32377042
type: AnswerComment
has text: The explanation seems pretty possible, I just have one objection. The Foo HAS been inserted in db (and probably committed) since we have an ID in place. However the entity cache is not updated yet, causing the other thread to perform a select by id query. The query does not return anything, because the db isolation level is REPEATABLE_READ. And because of this, it will get no result even if the other thread has actually committed the insert.
comment on: http://stackoverflow.com/a/21436491
type: Comment
score: 4

http://stackoverflow.com/a/21188266
has body: compareTo doesn't always make sense, sometimes the objects cannot be logically ordered. Also note that equals always exists, since it's defined in Object class. It's a good practice to always haven equals method when you have compareTo, and they should be consistent. Also you might want to have a look at this question.
downvote count: 0
answers question: http://stackoverflow.com/q/21188109
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/32018909
has text: UMM you can delete the data from your `list` using `remove()` function of `ArrayList` and then use `notifyDataSetChanged();`.
comment on: http://stackoverflow.com/q/21253716
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21290441
linked to: http://stackoverflow.com/q/513832
accepted answer: http://stackoverflow.com/a/21290492
has answer: http://stackoverflow.com/a/21290610
has answer: http://stackoverflow.com/a/21290469
has answer: http://stackoverflow.com/a/21290492
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21290519
has body: The or statement in the first line of my if statement is not working as i would expect it to, any suggestions? if(answer == "deposit" || "Deposit"){ System.out.println("How much would you like to deposit?"); final int deposit = console.readInt(); account.deposit(deposit); System.out.println( "This leaves you with $" + formatter.format(account.getBalance()) + " in your account"); }else if(answer == "Check Balance"){ System.out.println( "You have $" + formatter.format(account.getBalance()) + " in your account"); }else if(answer == "Withdraw"){ System.out.println("How much would you like to take out?"); final int with = console.readInt(); account.withdraw(with); System.out.println( "This leaves you with $" + formatter.format(account.getBalance()) + " in your account"); }else{ System.out.println("You didn't enter a correct term, please try again."); }
tagged with: if-statement
has answer: http://stackoverflow.com/a/21290519
tagged with: java
duplicate of: http://stackoverflow.com/q/513832
answer count: 6
has comment: http://stackoverflow.com/comment/32083602
type: Question
has answer: http://stackoverflow.com/a/21290472
score: 0
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21290496
has title: Java if or statement not working as expected

http://stackoverflow.com/a/21292256
has comment: http://stackoverflow.com/comment/32115011
upvote count: 2
has comment: http://stackoverflow.com/comment/32115324
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32114878
downvote count: 0
answers question: http://stackoverflow.com/q/21292133
has body: Simply because main thread constructs it not the t thread constructs itself. So, you may rewrite to this one (setting thread's name before starting it): public class RecursiveRunnableTest { public static void main(String... args){ RecursiveRunnable rr = new RecursiveRunnable("First thread"); Thread t = new Thread(rr); t.setName(rr.getName()); t.start(); } } class RecursiveRunnable implements Runnable{ private String name; public RecursiveRunnable(String name) { this.name = name; } public String getName(){return this.name;} @Override public synchronized void run() { System.out.println(Thread.currentThread().getName()); // displaying Thread-0 System.out.println(this.name); // displaying "First thread" try{ Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); }finally{ } } }

http://stackoverflow.com/a/21242490
has comment: http://stackoverflow.com/comment/32002722
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32001139
has comment: http://stackoverflow.com/comment/32004806
has comment: http://stackoverflow.com/comment/32000635
has body: Of course, you're running the application without any parameters given. Parameters the program expects: Server: Usage: java KnockKnockServer &lt;port number&gt; Client: Usage: java EchoClient &lt;host name&gt; &lt;port number&gt; Example for parameters possible: Server: Running from CommandLine: java KnockKnockServer 55555 Running from IDE: 55555 Client: Running from CommandLine: java EchoClient localhost 55555 Running from IDE: localhost 55555 Edit, also solution for beginner. Change: Change String hostName = args[0]; int portNumber = Integer.parseInt(args[1]); To: String hostName = "localhost"; int portNumber = 55555; At client class you will just need to change portNumber because it's the only showing (in purpose).
has comment: http://stackoverflow.com/comment/32003160
has comment: http://stackoverflow.com/comment/32001805
has comment: http://stackoverflow.com/comment/32000652
answers question: http://stackoverflow.com/q/21242289
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21242289

http://stackoverflow.com/comment/31961031
comment on: http://stackoverflow.com/q/21220808
type: Comment
type: QuestionComment
has text: Use `String.equals` to compare Strings
score: 0

http://stackoverflow.com/q/21346816
has answer: http://stackoverflow.com/a/21346832
score: 0
answer count: 2
has body: public class test { public static void main(String[] args) { frame tmp; tmp=new frame(); ExecutorService executor; executor=Executors.newCachedThreadPool(); executor.execute(tmp); executor.shutdown(); } } public class frame extends JFrame implements Runnable{ int lis; public frame() { setVisible(true); lis=1; addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent event) { lis=0; } } ); } @Override public void run() { while(lis==1) { } JOptionPane.showMessageDialog(null,"close"); } } the sequence of steps which i thought will happen after running class test 1) jframe gets displayed and runs in a seperate thread 2) after closing the jframe,the thread completes its execution and executor shut's down 3)class test terminate's since all the statements are executed. but when i run the class test after closing the jframe class test is not terminating any explanation or reference would be helpful. thank you EDIT:suppose i created two frames.i want the program to exit only after all the frames are closed not just one jframe.
has comment: http://stackoverflow.com/comment/32185065
has answer: http://stackoverflow.com/a/21346833
possible better answer: http://stackoverflow.com/a/21346832
accepted answer: http://stackoverflow.com/a/21346833
linked to: http://stackoverflow.com/q/13360430
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
type: Question
has title: java multithreading,program not exiting

http://stackoverflow.com/comment/31917965
comment on: http://stackoverflow.com/a/21196668
score: 0
type: AnswerComment
type: Comment
has text: I got the impression that he wanted to print letter by letter, your code can easily be adapted to this though.

http://stackoverflow.com/a/21301013
type: Answer
has body: Add @ModelAttribute annotation to your model object parameter in the controller method that you're calling, so that Spring knows that's the object that you want to bind the form data to. /* * Update a survey request */ @RequestMapping(value = "/{id}", params = "form", method = RequestMethod.POST) public String update(@ModelAttribute("surveyRequest") SurveyRequest surveyRequest, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest, RedirectAttributes redirectAttributes, Locale locale) { [...] }
has comment: http://stackoverflow.com/comment/32104166
score: 0
accepted answer of: http://stackoverflow.com/q/21300706
answers question: http://stackoverflow.com/q/21300706
type: AcceptedAnswer

http://stackoverflow.com/q/21189470
type: Question
has body: I need to user few memcached servers in my application. Till now i was using only one configuration: And when i want to use two servers, a just wanted do add: But then i get error: is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [net.spy.memcached.MemcachedClient] is defined: expected single matching bean but found Can you help me, how to implement many configurations ?
answer count: 1
score: 0
has title: Spring many mamcached implementation
has answer: http://stackoverflow.com/a/21189520
type: UnansweredQuestion
tagged with: spring
tagged with: memcached
tagged with: java

http://stackoverflow.com/comment/32074488
type: Comment
has text: i want to store an object of a class so that when i run the program again .the object of that class will be unchanged.
comment on: http://stackoverflow.com/q/21285370
score: 0
type: QuestionComment

http://stackoverflow.com/comment/112590708
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21210730
has text: @Amitk Hey, it's been a while since i posted this question. unfortunately no it's been too long :) what ever i solution i found it's probably outdated

http://stackoverflow.com/comment/32039429
comment on: http://stackoverflow.com/q/21221942
type: Comment
type: QuestionComment
score: 0
has text: No Java code should be able to crash the JVM. You need to report this is a bug to Oracle, so they can fix the underlying Java Virtual Machine bug

http://stackoverflow.com/a/21252250
score: 0
has body: ObjectFactory is used by JAXB to identify classes to be bound, eg JAXBContext ctx = JAXBContext.newInstance("test"); &lt;-- test is package Marshaller m = ctx.createMarshaller(); m.marshal(new X(), System.out); &lt;-- X is test package throws javax.xml.bind.JAXBException: "test" doesnt contain ObjectFactory.class or jaxb.index but JAXBContext ctx = JAXBContext.newInstance(X.class); ... works OK because we loaded X to JAXBCOntext explicitly
has comment: http://stackoverflow.com/comment/32028417
type: Answer
answers question: http://stackoverflow.com/q/21252096

http://stackoverflow.com/comment/31993844
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21239146
has text: The `char` data type is actually represented by an integer. Find the integer range of the characters you want, generate a random int in that range, convert it to a char. From there turning an int and a char into strings and combining them should be easy.
type: Comment

http://stackoverflow.com/comment/32040722
has text: Can be related with hibernate.connection.release_mode? What is its default behaviour of relese?
comment on: http://stackoverflow.com/q/21265738
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/63685078
upvote count: 2
answers question: http://stackoverflow.com/q/21308946
has body: I was facing the same issue in my project. Here are the steps that I followed: I first copied the contents of the file to notepad++(copy to any editor which supports utf-8). Eclipse uses the cp1252 encoding for files by default on Windows. After copying file contents, you need to change the encoding to utf-8. You can do this by going to Window-&gt;Preferences-&gt;Workspace. There you will find text file encoding, change it to utf-8 and apply and close. You will notice that characters like (Å å Ä ä Ö ö) have changed to some strange characters. Copy the contents that you had saved in the notepad++(or your editor) to the file in eclipse and save the file. That's it! Run your project, it should not give any warnings or errors for those characters now.
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/21234602
tagged with: ratingbar
type: AnsweredQuestion
tagged with: android-styles
has comment: http://stackoverflow.com/comment/35479530
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/5800657
tagged with: android-layout
has title: Ratingbar style in ListView, strange behavior
has answer: http://stackoverflow.com/a/23196395
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has body: I use custom RatingBar style in ListView row element, but it cause some strange problem. I have got custom style like this: And I use this in my RatingBar in xml (in layout of listView row): style="@style/CourseRatingBar" But then the ListView onItemClickListener just doesn't work. When I click on element, there is no action. When I use this as my RatingBar style: style="?android:attr/ratingBarStyleSmall" everything (onItemClickListener ;-)) works fine. The ListView use BaseAdapter with Holder pattern, with RatingBar, TextView and ImageView.
accepted answer: http://stackoverflow.com/a/23196395
tagged with: android
has comment: http://stackoverflow.com/comment/35448133

http://stackoverflow.com/a/21199947
downvote count: 0
score: 6
has body: Maybe this will help clear things up. String s1 = "This is"; s1 = s1 + " my book"; // Note the space String s2 = "This is my book"; String s3 = "This is my book"; System.out.println(s1==s2); // False System.out.println(s2==s3); // True "Strings are only put in the pool when they are interned explicitly or by the class's use of a literal." Hence, you cannot concatenate strings with the + operator and expect it to be put into the string constant pool.
has comment: http://stackoverflow.com/comment/31923883
upvote count: 6
answers question: http://stackoverflow.com/q/21199878
has comment: http://stackoverflow.com/comment/31923960
type: Answer
has comment: http://stackoverflow.com/comment/31923977

http://stackoverflow.com/q/21276225
has answer: http://stackoverflow.com/a/21276245
downvote count: 0
has comment: http://stackoverflow.com/comment/32059009
favorite count: 0
has answer: http://stackoverflow.com/a/21276309
has answer: http://stackoverflow.com/a/21276655
accepted answer: http://stackoverflow.com/a/21276245
upvote count: 2
answer count: 5
tagged with: multithreading
has answer: http://stackoverflow.com/a/21276878
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21276254
tagged with: java
has answer: http://stackoverflow.com/a/21276254
has title: Java synchronized methods for a single thread
has body: I'm having trouble understanding the synchronized keyword. As far as I know, it is used to make sure that only one thread can access the synchronized method/block at the same time. Then, is there sometimes a reason to make some methods synchronized if only one thread calls them?
type: Question
has comment: http://stackoverflow.com/comment/32058855

http://stackoverflow.com/a/21236644
answers question: http://stackoverflow.com/q/21236532
score: 0
has comment: http://stackoverflow.com/comment/31989707
has comment: http://stackoverflow.com/comment/31989555
type: Answer
has body: Remove ListView lv = getListView(); and change lv.setOnItemClickListener to mainListView.setOnItemClickListener and if your class is called Main use Main.this Instead of getApplicationContext()
has comment: http://stackoverflow.com/comment/31989401
has comment: http://stackoverflow.com/comment/31989367
has comment: http://stackoverflow.com/comment/31990055
has comment: http://stackoverflow.com/comment/31990267
accepted answer of: http://stackoverflow.com/q/21236532
type: AcceptedAnswer

http://stackoverflow.com/comment/32184963
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21330465
has text: Look like your code compilation in netbeans used different axiom jars different from your deployment environment. So please do check your class path for deployment env and netbeans are same.

http://stackoverflow.com/comment/32153632
comment on: http://stackoverflow.com/a/21329829
score: 0
type: AnswerComment
type: Comment
has text: WTF is this website ! ;) Where does it go in a browser ?

http://stackoverflow.com/comment/31990534
type: AnswerComment
type: Comment
has text: @Samhain and it should be an answer
comment on: http://stackoverflow.com/a/21233972
score: 0

http://stackoverflow.com/comment/32007621
has text: Yes. That 2nd one is how I'd approach it. :)
type: Comment
comment on: http://stackoverflow.com/a/21246179
score: 0
type: AnswerComment

http://stackoverflow.com/q/21206229
upvote count: 1
has answer: http://stackoverflow.com/a/21206317
has comment: http://stackoverflow.com/comment/31946612
has body: Let's say I have this function in java public static Character firstNonrepeatedChar(String in) { int[] repeated = new int[256]; for(int i=0; i&lt;256; i++){ repeated[i] = 0; } // First time calling in.length() for(int j=0; j&lt;in.length(); j++){ repeated[in.charAt(j)]++; } // Second time calling in.length() // I could have used "int length = in.length() and use this variable in this second loop" for(int j=0; j&lt;in.length(); j++){ if(repeated[in.charAt(j)] == 1) return in.charAt(j); } return null; } As you can see I have used in.length() twice. Another approach could be saving the in.length() once in a variable and use the variable. can someone tell me how big of difference this makes? I know if I wanted to use that value like 100 times I should keep the value in a variable but in this case we are deciding between just one more function call or using an integer variable.
favorite count: 0
possible better answer: http://stackoverflow.com/a/21206263
has comment: http://stackoverflow.com/comment/31935115
accepted answer: http://stackoverflow.com/a/21206305
has title: when is better to save the result of a function instead of calling it again?
tagged with: memory-management
has comment: http://stackoverflow.com/comment/31934546
downvote count: 0
has answer: http://stackoverflow.com/a/21206305
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21206263
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31934589
tagged with: optimization
answer count: 3

http://stackoverflow.com/a/21270311
type: Answer
answers question: http://stackoverflow.com/q/21269796
score: 0
has body: Creating a new file only won't work. If you can use Java 1.7, you are in safe hands: check out the Files class. However it uses new java.nio.Path instead of java.io.File, so you have to create a Path-object: FileSystem fs = FileSystems.getDefault(); Path p = fs.getPath( "C:/Windows/" );

http://stackoverflow.com/q/21233135
has answer: http://stackoverflow.com/a/21233336
type: UnansweredQuestion
has body: I am a starter in JNDI and JMS technology. I have my JNDI file as: java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory # use the following property to configure the default connector java.naming.provider.url = nio://localhost:61616 # use the following property to specify the JNDI name the connection factory # should appear as. #jms.connectionFactoryNames = ConnectionFactory, queueConnectionFactory, topicConnectionFactry connectionFactoryName = queueConnectionFactory #connectionfactory.amqConnectionFactory = nio://localhost:61616 # register some queues in JNDI using the form # queue.[jndiName] = [physicalName] queue.requestQueue = dq-dataloader.requestqueue # register some topics in JNDI using the form # topic.[jndiName] = [physicalName] #topic.MyTopic = example.MyTopic My spring configuration file is: <?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-3.0.xsd"> <!-- <context:component-scan base-package="com.qpid.sample" /> --> <property name="location" value="classpath:dq_dataloader-amq.properties" /> <property name="environment" ref="jndiProperties" /> <property name="jndiTemplate" ref="jndiTemplate" /> <property name="jndiName" value="connectionFactoryName" /> <property name="targetConnectionFactory" ref="amqConnectionFactory" /> <property name="sessionCacheSize" value="10" /> <property name="jndiTemplate" ref="jndiTemplate" /> <property name="jndiName" value="requestQueue" /> </beans> Invoker class: import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.context.ApplicationContext; import…
has title: Active MQ, JNDI, Spring error
upvote count: 1
tagged with: spring
tagged with: activemq-classic
tagged with: jndi
score: 1
tagged with: java
type: Question
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/29922525
has answer: http://stackoverflow.com/a/49444325
answer count: 3
tagged with: jms

http://stackoverflow.com/comment/31952612
has text: Thanks, but file creation time is not preserves with this method.
type: AnswerComment
comment on: http://stackoverflow.com/a/21215923
score: 0
type: Comment

http://stackoverflow.com/a/21269597
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21269461
has body: OS sends signal to the process. Default handler would stop the process, but you can define own handler for it. I bet java VM does.
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/32153338
score: 0
comment on: http://stackoverflow.com/q/21309392
type: Comment
type: QuestionComment
has text: @Gorb unquestionably true. However the OP clearly speaks english, as do the people who can answer the OPs question

http://stackoverflow.com/a/22437555
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21337815
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21337815
has body: You can continue to use Eclipse and install angularjs-eclipse, see https://github.com/angelozerr/angularjs-eclipse . There is also JSDT jQuery but I cannot tell its status. So ideally you can set-up the same project in both IDEs and selected features that works the best.
has comment: http://stackoverflow.com/comment/34144808
upvote count: 2

http://stackoverflow.com/q/21228452
has answer: http://stackoverflow.com/a/27560522
has comment: http://stackoverflow.com/comment/31979670
type: Question
tagged with: java-7
downvote count: 0
has comment: http://stackoverflow.com/comment/38419679
has answer: http://stackoverflow.com/a/23803476
favorite count: 0
tagged with: security
has comment: http://stackoverflow.com/comment/31974648
answer count: 3
tagged with: windows
upvote count: 6
has body: Java 7 update 51 has java security level which is set to HIGH by default. I want to change it to medium by using registry or by adding any files. I observed that manually changing security level to medium from high creates registry [HKEY_CURRENT_USER\Software\JavaSoft\DeploymentProperties] "deployment.security.level"="MEDIUM" But if i manually create the above registry then java security setting does not change and created registry gets deleted. So I think there must be other files which does it. So how can I change java security setting? I have seen some articles and forum links but didn't get what I wanted. Also this is not to set security level for my customers and it is for my office where number of employees need to change this setting(all are windows OS pc's) and it will be easy if there is automation like code or a registry entries.
has title: Change Java Security level
has comment: http://stackoverflow.com/comment/31977195
type: UnansweredQuestion
score: 6
has comment: http://stackoverflow.com/comment/31974512
has answer: http://stackoverflow.com/a/44266221
tagged with: java

http://stackoverflow.com/comment/32030524
score: 0
type: AnswerComment
type: Comment
has text: Spring Integration is application layer messaging, AMQP/JMS is infrastructure messaging. That's not bloat, it's abstraction. It allows you to change how you integrate components without worrying about technology changes, and lets you follow EIP. How that gives you less flexibility than hard-coding to JMS is beyond me. As for Spring Batch, you can either implement ItemListeners or drop chunk sizes if you need that granularity. So I disagree. :)
comment on: http://stackoverflow.com/a/21237418

http://stackoverflow.com/q/21233863
has title: static member within nested class in Java
tagged with: class
has answer: http://stackoverflow.com/a/21233897
upvote count: 1
answer count: 1
favorite count: 0
has body: I read java language specification here.Here it says An inner class is a nested class that is not explicitly or implicitly declared static. Inner classes include local, anonymous and non-static member classes. Inner classes may not declare static initializers or member interfaces, or a compile-time error occurs. Inner classes may not declare static members, unless they are constant variables, or a compile-time error occurs. But my question is why inner/nested class can not have static members &amp; why a compile-time error occur? * I'm new in Java
tagged with: static
duplicate of: http://stackoverflow.com/q/1953530
type: UnansweredQuestion
tagged with: class-members
downvote count: 0
tagged with: inner-classes
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/21265111
has title: Android: ANT build fails with google-play-services-lib: "resolve to a path with no project.properties file for project"
has body: I'm trying to build my apps using ANT and I'm failing miserably after I included the google-play-services-lib library project. Step 1 I set up a reference to the library project in my project.properties file: android.library.reference.1=/path/to/google-play-services_lib Step 2 I ran these commands inside the google-play-services_lib folder: android update lib-project --path . ant clean ant release BUILD SUCCESS! Step 3 Back to my project folder ant clean ant release ERROR BUILD FAILED /android/tools/ant/build.xml:460: /path/to/google-play-services_lib resolve to a path with no project.properties file for project /my/project-folder There IS a project.properties in both folders, naturally. The one in google-play-services_lib contains this code: target=android-8 android.library=true I'm obviously missing something that's right there in front of me and I'd really appreciate your help. Thanks!
accepted answer: http://stackoverflow.com/a/21513032
tagged with: android
favorite count: 0
possible better answer: http://stackoverflow.com/a/27028895
has answer: http://stackoverflow.com/a/27028895
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21513032
upvote count: 18
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/47637675
tagged with: ant
downvote count: 0
score: 18
tagged with: linux

http://stackoverflow.com/comment/32144373
score: 0
type: AnswerComment
has text: Remember that your possible solution (SELECT name FROM restaurants) kind of queries will only work in SQL environments (or probably ORMs based on top of some NoSql databases as well) and hence might not be a generic solution. If you are working with entities that you are directly pulling out from the database (getting entity-based documents directly out from NoSql database), your solution might not work for you. But, helper methods in entity objects itself will always work regardless of where you are pulling the data from. PS: nulls and null pointer exceptions go hand in hand :).
type: Comment
comment on: http://stackoverflow.com/a/21294584

http://stackoverflow.com/comment/138140045
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21250249
score: 1
has text: Thank you!!! You saved my life. I thought I would need to change all the code :D

http://stackoverflow.com/a/21217748
answers question: http://stackoverflow.com/q/21217675
has body: import java.util.*; public class P1 { public static void main(String[] args) { // Create a scanner Scanner userInputScanner = new Scanner(System.in); String choice = userInputScanner.nextLine(); System.out.println("Your choice is " + choice); if (choice.trim().equalsIgnorecase("A")) System.out.println( " Action Movie Fan"); else if (choice.trim().equalsIgnorecase("B")) System.out.println( " Comedy movie fan "); else if (choice.trim().equalsIgnorecase("D")) System.out.println(" Drama movie fan "); else System.out.println( "Invalid choice" ); } } otherwise compare only first character of string like choice.charAt(0) == 'A'
score: 0
type: Answer

http://stackoverflow.com/q/21316730
score: 5
has comment: http://stackoverflow.com/comment/32133266
has comment: http://stackoverflow.com/comment/32133330
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32130992
type: Question
has comment: http://stackoverflow.com/comment/32131622
upvote count: 5
tagged with: java
tagged with: linear-algebra
has title: Linear Algebra Library for java
downvote count: 0
has comment: http://stackoverflow.com/comment/32135165
favorite count: 0
has body: I have a set of linear equations that have an infinite number of solution (a solution set) but I cant seem to find any Java-libraries that can produce the solution-set (they all complain about the matrix being "Singular", which would produce an infinite set of solutions?). I may be failing to understand something, but I've looked into some libs as JAMA and la4j but don't understand why they're not able to produce a solution-set for me. BR Tomas A EDIT: I've tried solving the set of equations using a "solver" online and it produces the solution-set for me so I know it should be possible.

http://stackoverflow.com/comment/93482017
comment on: http://stackoverflow.com/a/21671739
type: Comment
score: 0
has text: how can this work? does mongo have entity listeners?
type: AnswerComment

http://stackoverflow.com/comment/32623820
type: QuestionComment
has text: I figured it out finally, drool workbench 6.0.1 have some memory leakage issues. hence whenever you shutdown tomcat. It didn't stop the services related to previous workbench. Hence I got this error.
score: 2
comment on: http://stackoverflow.com/q/21185834
type: Comment

http://stackoverflow.com/a/21242799
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32037570
upvote count: 2
has body: We are working on the next version of jclouds (1.7.1) that should include multi-region support for Rackspace Cloud Files and OpenStack Swift. In the meantime you might be able to use this code as a workaround. private void uploadToRackspaceRegion() { Iterable&lt;Module&gt; modules = ImmutableSet.&lt;Module&gt; of(new Log4JLoggingModule()); String provider = "swift-keystone"; //Region selection is limited to swift-keystone provider String identity = "username"; String credential = "password"; String endpoint = "https://identity.api.rackspacecloud.com/v2.0/"; String region = "ORD"; Properties overrides = new Properties(); overrides.setProperty(LocationConstants.PROPERTY_REGION, region); overrides.setProperty(Constants.PROPERTY_API_VERSION, "2"); BlobStoreContext context = ContextBuilder.newBuilder(provider) .endpoint(endpoint) .credentials(identity, credential) .modules(modules) .overrides(overrides) .buildView(BlobStoreContext.class); RestContext&lt;CommonSwiftClient, CommonSwiftAsyncClient&gt; swift = context.unwrap(); CommonSwiftClient client = swift.getApi(); SwiftObject uploadObject = client.newSwiftObject(); uploadObject.getInfo().setName("test.txt"); uploadObject.setPayload("This is my payload."); //input stream. String eTag = client.putObject("jclouds", uploadObject); System.out.println("eTag = " + eTag); SwiftObject downloadObject = client.getObject("jclouds", "test.txt"); System.out.println("downloadObject = " + downloadObject.getPayload()); context.close(); } Use swift as you would Cloud Files. Keep in mind that if you need to use Cloud Files CDN stuff, the above won't work for that. Also, know that this way of doing things will eventually be deprecated.
has comment: http://stackoverflow.com/comment/32001237
accepted answer of: http://stackoverflow.com/q/21222882
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21222882
has comment: http://stackoverflow.com/comment/32009740
has comment: http://stackoverflow.com/comment/32002238

http://stackoverflow.com/comment/32022567
type: Comment
has text: You can put `Test test=new Test()` almost anywhere in the `Test.java` file - there's no such restrictions in Java.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21255964

http://stackoverflow.com/a/21274072
answers question: http://stackoverflow.com/q/21274040
upvote count: 1
has body: The javadoc for Matcher#matches() states Attempts to match the entire region against the pattern. So it is trying to match the entire abc dog def. It's not trying to check if the Pattern appears in that String. Use Matcher#find() for that. Attempts to find the next subsequence of the input sequence that matches the pattern.
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/32181039
type: Comment
has text: It would use one-element arrays instead of custom classes.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21274346

http://stackoverflow.com/q/21302446
has body: Can any one help me on QC ALM REST API's. What are all the things we need to configure to work on this? I have access to QC 10. Can i use same QC 10 url to connect using ALM REST API's
score: 0
tagged with: rest
tagged with: hp-quality-center
has answer: http://stackoverflow.com/a/44821679
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21846889
type: Question
answer count: 2
tagged with: api
has title: QC ALM REST API using java

http://stackoverflow.com/a/21745327
has body: Created a new frame with a JTextArea covering it, everytime I have a System.out.println() I just used a static addToDebugger(String s) method which just concatenates JTextArea.getText() with a "\n" + s and then JTextArea.setText().
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21273381
answers question: http://stackoverflow.com/q/21273381
type: Answer

http://stackoverflow.com/comment/31926752
score: 0
has text: I understand what protected access is.....What seems to be the problem @Brian??
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21201520

http://stackoverflow.com/comment/32000084
comment on: http://stackoverflow.com/q/21242692
score: 0
type: Comment
type: QuestionComment
has text: Let's see your `<form:form>` binding and the getters/setters you have.

http://stackoverflow.com/a/21325863
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32146995
accepted answer of: http://stackoverflow.com/q/21325377
score: 0
answers question: http://stackoverflow.com/q/21325377
has comment: http://stackoverflow.com/comment/32146688
has comment: http://stackoverflow.com/comment/32147286
has comment: http://stackoverflow.com/comment/32146914
type: Answer
has comment: http://stackoverflow.com/comment/32177453
has comment: http://stackoverflow.com/comment/32147028
has comment: http://stackoverflow.com/comment/32147126
has body: The loop in slowMoveVertical pretty much locks you into drawing the sun in front. If your assignment allows you to bypass slowMoveVertical, then you can manually do the loop it does and render your sun and the hill yourself so the layering is right. for(int i = 0; i &lt; 190; i++) { sun.moveHorizontal(1); hill.draw(); } edit... There's a wait() at the end of the draw call, which would really only be used on the last object in the "batch". Making another draw method with an optional wait call allows the caller to control it instead of the circle. example... public void draw() { draw(true); // retain current behavior { public void draw(boolean useWait) { if(isVisible) { Canvas canvas = Canvas.getCanvas(); canvas.draw(this, color, new Ellipse2D.Double(xPosition, yPosition, diameter, diameter)); if (useWait) { canvas.wait(10); } } } Now you can call sun.draw(false) and hill.draw(true) and it shouldn't flicker (or a at least a lot less).

http://stackoverflow.com/a/21255756
upvote count: 7
has comment: http://stackoverflow.com/comment/32022327
answers question: http://stackoverflow.com/q/21255684
has comment: http://stackoverflow.com/comment/32022404
has body: Informally speaking, you can think of this System.out.println(t.getTest().i); as being equivalent to System.out.println(Test.i); because i is static. This is the simplest answer probably. Strictly speaking, they are not equivalent. Actually getTest() is called but its return value is not used for accessing the i field as this test below shows. public class Test { static int i = 10; Test getTest() { System.out.println("Method getTest() called!"); return null; } public static void main(String args[]) { Test t = new Test(); System.out.println(t.getTest()); System.out.println(t.getTest().i); } }
downvote count: 0
has comment: http://stackoverflow.com/comment/32022406
type: Answer
score: 7

private-class
tags question: http://stackoverflow.com/q/21261266
tag name: private-class
type: Tag

http://stackoverflow.com/comment/31973423
comment on: http://stackoverflow.com/q/21204627
score: 0
has text: Tried Byte[] but its increasing the file size which is too large :-(
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21309068
accepted answer of: http://stackoverflow.com/q/21308929
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/21308929
type: AcceptedAnswer
has body: Java EE is a fundamentally different story than SE. Whereas SE contains the Java runtime and many development tools, EE is just a library. In fact, most of the library are just interfaces with no implementations. This is because the JEE application container is the one which will provide its implementations of those interfaces. At development time you just need the interfaces to have something to refer to and NetBeans for Java EE (hopefully) already comes with those interfaces bundled.
has comment: http://stackoverflow.com/comment/32116057
type: Answer
has comment: http://stackoverflow.com/comment/32116037
downvote count: 0

http://stackoverflow.com/a/21347946
answers question: http://stackoverflow.com/q/21347811
has comment: http://stackoverflow.com/comment/32186725
score: 0
has body: You should not be accessing a view created in a different activity like this. Also, why is the need to do this because only 1 activity would be shown at a time (either tv or mainactivity). If you want to set something in another activity you should be using intents.
type: Answer

http://stackoverflow.com/comment/31921535
score: 2
comment on: http://stackoverflow.com/q/21198652
has text: No, it's not necessarily bad practice in my experience.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21346694
has title: Floating point arithmetic and comparing of floating point values
has comment: http://stackoverflow.com/comment/32184615
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32184395
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32184611
score: 2
has body: For these lines of code, I get back 0 as an output that is they are all equal to each other. Now if I understand correctly, a b and c may store slightly different versions of the true value .3 hence when do a Float.compare(...) against these values, I expect to get back as an output a value other than 0. Why do I get them as 0? float a = 0.15f + 0.15f; float b = 0.1f + 0.2f; float c = 0.3f; System.out.println(Float.compare(a, b)); //&lt;--- outputs 0 System.out.println(Float.compare(a, c)); //&lt;--- outputs 0 System.out.println(Float.compare(b, c)); //&lt;--- outputs 0
downvote count: 0
has comment: http://stackoverflow.com/comment/32184430
type: Question
has comment: http://stackoverflow.com/comment/32184574
tagged with: java
has answer: http://stackoverflow.com/a/21346718
upvote count: 2

http://stackoverflow.com/a/21205884
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21205816
answers question: http://stackoverflow.com/q/21205816
has body: It is not a good practice to have "return" in a finally block. The finally block can be executed due to two reasons: (a) An exception was thrown by the try block (and not caught by catch block) - in this case the method will have no return value so a return something statement in the finally block will have no effect. (b) the try block completed normally. If that block ends with a return something then you the code is a bit confusing to the reader, as there are now two return statements that are relevant and it is not clear which should take precedence over the other.
type: Answer
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/31933888
has comment: http://stackoverflow.com/comment/31934148
downvote count: 0

http://stackoverflow.com/comment/32077156
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21286860
has text: like if i get a webpage,like facebook-will it let me enter my details like username or password?
score: 0

http://stackoverflow.com/q/21342269
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21342467
has answer: http://stackoverflow.com/a/21342528
type: Question
tagged with: gwt
has title: Extend Abstract Class with Generic Types?
has body: How can I extent an abstract class like the following which has generic arguments? @Singleton public abstract class Presenter&lt;V extends View, Proxy_ extends Proxy&lt;?&gt;&gt; extends PresenterWidget&lt;V&gt; { ... }
score: 0
answer count: 2
tagged with: gwt-platform
tagged with: extends

http://stackoverflow.com/comment/32291824
comment on: http://stackoverflow.com/a/21349336
has text: I did exactly like that and it works at the beginning and the interface appeared after but when I click the botton application stop working
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32102747
comment on: http://stackoverflow.com/a/21301093
score: 0
type: Comment
has text: Basically, as I said, I would put in a check in `fillBoard` to see if `sq` is `null`, if it is, you would create the border. Back in your `paint` method, you would use a similar compound `for-loop` as you used in `fillBoard`, but instead of creating `Square`s you would simply call `sq[row][col].draw(page);` - also, the first thing you should do in the `paint` method is call `super.paint(page)`
type: AnswerComment

http://stackoverflow.com/comment/31916719
score: 0
type: Comment
type: QuestionComment
has text: Post the full error log. Something appears to be `null`
comment on: http://stackoverflow.com/q/21195899

http://stackoverflow.com/comment/31894967
score: 1
comment on: http://stackoverflow.com/q/21184351
type: Comment
type: QuestionComment
has text: Have you used dbHandler to run a query? The database won't be created until you do. Set a breakpoint in onCreate() and onUpgrade() and debug, or write to the log from within those methods to see what code is being run.

http://stackoverflow.com/comment/32002835
type: Comment
type: QuestionComment
score: 1
has text: If it can display the `JFrame` in the first place, you should be able to destroy the frame in a `finalize` method.
comment on: http://stackoverflow.com/q/21244147

http://stackoverflow.com/comment/31921146
comment on: http://stackoverflow.com/q/21198215
score: 0
type: Comment
type: QuestionComment
has text: Hey there. Can you clarify what are you asking, write it again (in comments) in other words? I read and re-read and still dont think I really get what youre asking.

http://stackoverflow.com/q/21277792
has comment: http://stackoverflow.com/comment/32061461
score: -4
type: Question
answer count: 8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21277950
has answer: http://stackoverflow.com/a/21277932
tagged with: java
has comment: http://stackoverflow.com/comment/32061504
has answer: http://stackoverflow.com/a/21277942
possible better answer: http://stackoverflow.com/a/21277950
has title: Why is the superconstructor being called? and why am I getting an error printing to screen?
has answer: http://stackoverflow.com/a/21277922
has answer: http://stackoverflow.com/a/21277822
has comment: http://stackoverflow.com/comment/32061452
has comment: http://stackoverflow.com/comment/32061700
tagged with: inheritance
favorite count: 0
has body: I am learning java Programming. I am getting the Compilation Error when I try to run the below program. public class Animal { public Animal() { System.out.println(“Making an Animal”); } } public class Hippo extends Animal { public Hippo() { System.out.println(“Making a Hippo”); } } public class TestHippo { public static void main (String[] args) { System.out.println(“Starting...”); Hippo h = new Hippo(); } } As per my understanding, If this progragram runs without an error, it will print Starting... Making a Hippo But in the "Head First Java" book, They mentioned the output of the program is Starting... Making an Animal Making a Hippo How is this output possible? I didnt call the super class constructor, but how come "Making an Animal" printed Here. Can anyone explain the logic behind this? If we call the subclass constructor, is its superclass constrtuctor also executed? And also why I am getting Compilation Error, I am using the Online IDE to test the basic java programs. Error Details Compilation error comments (0) stdin copy Standard input is empty compilation info Main.java:3: error: illegal character: \8220 System.out.println(?Making an Animal?); ^ Main.java:3: error: ';' expected System.out.println(?Making an Animal?); ^ Main.java:3: error: illegal character: \8221 System.out.println(?Making an Animal?); ^ Main.java:8: error: illegal character: \8220 System.out.println(?Making a Hippo?); ^ Main.java:8: error: ';' expected System.out.println(?Making a Hippo?); ^ Main.java:8: error: illegal character: \8221 System.out.println(?Making a Hippo?); ^ Main.java:13: error: illegal character: \8220 System.out.println(?Starting...?); ^ Main.java:13: error: ';' expected System.out.println(?Starting...?); ^ Main.java:13: error: illegal start of expression System.out.println(?Starting...?); ^ Main.java:13: error: illegal character: \8221 System.out.println(?Starting...?); ^ Main.java:13: error: illegal start of expression System.out.println(?Starting...?); ^ 11 errors
has answer: http://stackoverflow.com/a/21277931
has answer: http://stackoverflow.com/a/21277959
accepted answer: http://stackoverflow.com/a/21277959
has answer: http://stackoverflow.com/a/21277945
downvote count: 4
upvote count: 0
tagged with: constructor

http://stackoverflow.com/a/21338632
upvote count: 1
answers question: http://stackoverflow.com/q/21338582
has body: ArrayList&lt;Integer&gt; years = new ArrayList&lt;Integer&gt;(); int j; for (j = 1894; j &lt; 2014; j++) { years.add(j); System.out.println(years.get(j) + ","); // get elements from 1894 to 2014 }
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/q/21222847
tagged with: swing
has body: I am creating a Bomberman game, and I need to be able to have multiplayer. The users should be able to move their characters at the same time, but I do not know how to switch focus for the KeyPressed methods. Here are two of my classes: The Jframe Bomberman Class, and the Character class. public class Bomberman extends JFrame implements ActionListener, MouseListener, KeyListener { private JButton singleplayer, multiplayer, howtoplay, highscores, goBack; public Map[] game; private JLabel scoreLabel, armor; private JComboBox numEnemies; private Highscore highscore = new Highscore(); private int score, armorscore; public Bomberman() { setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(null); Color red = new Color(178, 0, 0); getContentPane().setBackground(red); addKeyListener(this); setStartScreen(); setVisible(true); } private void setHighScores() { Font subtitle = new Font("Myriad Pro", Font.PLAIN, 32); setSize(1000, 750); goBack = new JButton(); goBack.setBounds(300, 620, 240, 70); goBack.setBackground(Color.YELLOW); goBack.setForeground(Color.RED); goBack.setFont(subtitle); goBack.setText("Return"); goBack.addActionListener(this); add(goBack); } private void setSingleplayer(int numEnemies) { setSize(1000, 800); repaint(); score = 0; randomMap(numEnemies, true); JLabel playerScore, armorCount; scoreLabel = new JLabel(); scoreLabel.setBounds(125, 15, 60, 30); scoreLabel.setForeground(Color.YELLOW); scoreLabel.setFont(new Font("Arial Black", Font.PLAIN, 12)); scoreLabel.setText(getScore()); add(scoreLabel); armor = new JLabel(); armor.setBounds(80, 40, 10, 30); armor.setForeground(Color.YELLOW); armor.setFont(new Font("Arial Black", Font.PLAIN, 12)); armor.setText(String.valueOf(getArmorscore())); add(armor); playerScore = new JLabel(); playerScore.setBounds(10, 15, 110, 30); playerScore.setForeground(Color.BLACK); playerScore.setFont(new Font("Arial Black", Font.PLAIN, 15)); playerScore.setText("Player Score:"); add(playerScore); armorCount = new JLabel(); armorCount…
tagged with: java
type: Question
has title: How to have KeyPressed to listen to multiple Objects at the same time?
has comment: http://stackoverflow.com/comment/31964924
score: 0
has comment: http://stackoverflow.com/comment/31965541
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/21242959
answers question: http://stackoverflow.com/q/21242926
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: i %2 == 0 is what is generally used to determine if an index is an even index. In your example this means that the even indexes for row 0 will be set to black. The other rows not equal to zero will also have every other spot being black or white. However they will be white for the even indexes. Perhaps you are having trouble interpreting the ternary or ? operator in the statement below. ( i % 2 == 0 ? Color.black : Color.white ) Basically this is saying, if condition i%2 == 0 (index is even), carry out the first instructions after the question mark (set the color to black), else carry the instructions out after the colon (set the color to white).

http://stackoverflow.com/comment/32089647
has text: I'm not familiar with the Google App Engine but for me it reads like that the BadRequestException thrown is handled on an upper level like expected by returning a 400 Bad Request HTTP Response as intended (https://developers.google.com/appengine/docs/java/endpoints/exceptions). So yes it seems the right way to throw this exceptions.
comment on: http://stackoverflow.com/q/21293628
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/21262439
type: Question
downvote count: 0
tagged with: wsdl
score: 1
has title: Unable to create soap web service client from paypal wsdl in eclipse
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: soap
upvote count: 1
tagged with: web-services
tagged with: paypal
has body: I am trying to create a sop web service client using provided paypal wsdl paypal soap architecture. I am trying to create soap web service client in 2 ways: Create a simple web service client(by option web service client Eclipse) create web service client using axis generator plugin Using first way ,I am getting error as 'Could not retrieve the WSDL url'. Using second way I am getting exception as wsdlexception faultcode other_error FileNotFoundException,unable to get eBLBaseComponents xsd file from wsdl . I have created web service client using first way number of times. Can anybody guide me in this context? Is there issue with wsdl file? Thanks,
tagged with: java

http://stackoverflow.com/comment/31945240
comment on: http://stackoverflow.com/q/21211964
has text: You should never be using a KeyListener on a text component, and in fact should hardly ever use KeyListeners period. Perhaps you want to use a DocumentListener instead on the JTextField's Document.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/a/21298555
has body: Jasper is the JSP compiler used by Tomcat, it takes the JSP pages themselves, parses them, and generates Java code (in the form of a servlet, or at least it used to be) which writes the JSP's output to the servlet response. That Java code would then be compiled and executed against the containers implementation of the Servlet API. Jasper is a standalone library, so in theory you could instantiate its classes inside your own harness, point it at a JSP, generate the servlet code, then compile and execute it. However you'd need to pass in your own mock implementations of the Servlet API interfaces, as it's these that will be called to determine request parameters (HttpServletRequest), and to write the response (HttpServletResponse). You'd need to provide a version of HttpServletResponse that will buffer up the output for you to grab later. From the Tomcat 6 API, this bits your want are in the org.apache.jasper package. Taking a look at at it you'd probably want to create a JspCompilationContext which points to your JSP, call createCompiler(), and take it from there. As far as mocking out the Servlet API goes, you might get what you need from the stub implemetations provided by the Spring Framework for testing purposes
type: Answer
answers question: http://stackoverflow.com/q/21298238
score: 0

http://stackoverflow.com/q/21283696
favorite count: 0
upvote count: 1
tagged with: oid
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22243641
type: Question
has title: How to add new password Attribute with Apache LDAP API
downvote count: 0
tagged with: ldap
accepted answer: http://stackoverflow.com/a/22243641
has body: I am using Apache LDAP API to set new attribute: userPassword in Oracle Internet Directory. I want to set this password with SHA encryption method. I currently have following code: Attribute userPasswordAttribute = new DefaultAttribute("userPassword", "password")); ModifyRequest modifyRequest = new ModifyRequestImpl(); modifyRequest.setName(dn); modifyRequest.add(userPasswordAttribute); ModifyResponse response = connection.modify(modifyRequest); However this adds SSHA encrypted password along with some other attributes which I do not want (authpassword;oid). I have seen that there a class called EncryptionMethod in LDAP API but how to use it in my code?
answer count: 1

wikimedia-dumps
tag name: wikimedia-dumps
tags question: http://stackoverflow.com/q/21310539
type: Tag

http://stackoverflow.com/comment/32063911
type: AnswerComment
has text: T stands for a generic type. Read more: [here](http://docs.oracle.com/javase/tutorial/java/generics/)
type: Comment
comment on: http://stackoverflow.com/a/21279062
score: 0

http://stackoverflow.com/comment/32058431
has text: I am facing same issue. It was working before.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21221779

http://stackoverflow.com/a/21335344
has body: NetworkOnMainThreadException that is thrown when an application attempts to perform a networking operation on its main thread. Also this is only thrown for applications targeting the Honeycomb SDK or higher. Applications targeting earlier SDK versions are allowed to do networking on their main event loop threads, but it's heavily discouraged. So use a separate thread for network operations. For more details visit developer android site.
answers question: http://stackoverflow.com/q/21335254
type: Answer
score: 0

http://stackoverflow.com/comment/31923935
type: AnswerComment
comment on: http://stackoverflow.com/a/21199914
type: Comment
has text: I think this is not related with the *implicit* OP' question.
score: 1

http://stackoverflow.com/q/21334988
possible better answer: http://stackoverflow.com/a/21335044
tagged with: regex
score: 2
has title: Determine string pattern "a+b"
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21335032
upvote count: 2
has answer: http://stackoverflow.com/a/21335122
tagged with: java
has body: I am using String.matches() to determine if a string is in the following pattern: "a+b", where a and b is a number (can contain both , and . if decimal number) I wrote a regex for determining if a number is on the form I want, but I am struggling to write the regex for the whole thing. For just a number, this is my code: kortform.matches("\\d+([\\,.]?\\d+)?") For "a+b" I have the following code, but "1+2" won't even work. kortform.matches("\\d+([\\,.]?\\d+)?\\+\\\\d+([\\,.]?\\d+)?")
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/21335032
downvote count: 0
has answer: http://stackoverflow.com/a/21335044
favorite count: 0

http://stackoverflow.com/comment/31977659
score: 0
comment on: http://stackoverflow.com/a/21229391
type: Comment
has text: Thanks so far, but i don't get the point "two instances of the same class and with the same attribute values would still return different hashes". Aren't vecA and VecB instances of the same Class with the same attribute values? Because their HashCode() are the same, that was one thing i wanted to test with my little program
type: AnswerComment

android-animation
tags question: http://stackoverflow.com/q/21341693
type: Tag
tag name: android-animation
tags question: http://stackoverflow.com/q/21236696

http://stackoverflow.com/a/21279592
accepted answer of: http://stackoverflow.com/q/21279357
upvote count: 3
has body: Today's Java 7 doesn't support labmdas as C# does, so you should transform your () =&gt; ... into something like that (local class): Thread thread = new Thread() { @Override public void run() { runPlannedTestSets.findAndRunTestSet(waitingTestSet, availableHost)); } } thread.start();
score: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21279357
type: Answer

http://stackoverflow.com/comment/31919581
comment on: http://stackoverflow.com/q/21197255
score: 2
has text: @ajb: it will break source compatibility, but not binary compatibility. That's why you can still use old JDBC drivers with a recent Java runtime (unless you call one of the new method, which will then cause a runtime exception).
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21281803
tagged with: spring
has answer: http://stackoverflow.com/a/21285590
tagged with: jsf
score: 1
tagged with: java
type: Question
downvote count: 0
answer count: 1
has body: When I run my project, Spring invoke PostConstruct mehod of JSF Action Bean method at deployment time (during of spring bean creation, I think). As I thought, there is no FacesCOntext at deployment time, I get NullPointerException at PostConstruct method. import javax.inject.Named; import org.omnifaces.cdi.ViewScoped; @Named @ViewScoped public class AddStudentActionBean implements Serializable { private Student student; @PostConstruct public void init() { student = (Student) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("Student"); } @PreDestroy public void destory() { } } How can resolve it?
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has title: JSF 2.0 CDI + Spring 3.1 Integration, FacesContext is null at deployment time

http://stackoverflow.com/q/21268494
has title: tiles-defs.xml dtds version
tagged with: maven
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21286477
answer count: 1
score: 0
tagged with: tiles
has body: I have been getting an error: Line 7 in XML document from ServletContext resource [/WEB-INF/tiles-defs.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Element type "put-attribute" must be declared for some reason I don't think it is reading my tiles-defs like it should. I have http://struts.apache.org/dtds/tiles-config_1_3.dtd and it dosent complain, but I want to use http://tiles.apache.org/dtds/tiles-config_3_0.dtd. If i change the version to what it should be, the compiler complains and says: The content of element type "tiles-definitions" must match "(definition)+". Below is other relevant code that might be the cause of this: tiles-defs.xml <?xml version="1.0"?> <put-attribute name="title" value="" /> <put-attribute name="header" value="/WEB-INF/pages/common/header.jsp" /> <put-attribute name="menu" value="/WEB-INF/pages/common/menu.jsp" /> <put-attribute name="body" value="" /> <put-attribute name="footer" value="/WEB-INF/pages/common/footer.jsp" /> <put-attribute name="title" value="I hate tiles" /> <put-attribute name="body" value="/WEB-INF/pages/splash_page.jsp" /> dispatcher-servlet.xml /WEB-INF/pages/ .jsp org.springframework.web.servlet.view.tiles3.TilesView /WEB-INF/tiles-defs.xml web.xml Spring Web MVC Application dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher *.htm org.springframework.web.context.ContextLoaderListener contextConfigLocation /WEB-INF/dispatcher-servlet.xml, /WEB-INF/spring-security.xml /WEB-INF/tiles-defs.xml springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> pom.xml (Sorry its long >_<) <?xml version="1.0" encoding="UTF-8"?> 4.0.0 groupId PublicWebServer 1.0-SNAPSHOT org.springframework spring-context 4.0.0.RELEASE org.springframework spring-webmvc 4.0.0.RELEASE org.springframework spring-core 4.0.0.RELEASE org.springframework spring-expression 4.0.0.RELEASE org.springfram…
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/21286477

http://stackoverflow.com/comment/32020451
has text: I'm running 1.5.1 too, but in Eclipse, via Counterclockwise, with core.typed loaded. I just tried in the repl, and it works there, just not when I load the code with ctrl-alt-s.
comment on: http://stackoverflow.com/q/21254384
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21333638
answers question: http://stackoverflow.com/q/21333193
score: 0
has body: You can simply use BoxLayout JPanel panel2 = new JPanel(); panel2.setLayout(new BoxLayout(panel2, BoxLayout.Y_AXIS)); panel2.setBackground(Color.WHITE); panel2.add(SendBalInc); But I think that Betlista's answer with GridBag may be preferable, since you have many more options to tweak the layout further in the future.
type: Answer

http://stackoverflow.com/comment/31913726
type: Comment
type: QuestionComment
score: 0
has text: @AlexanderGavrilov With the collection elements I will be searching/Parsing it and performing some similar operations on it.
comment on: http://stackoverflow.com/q/21194274

http://stackoverflow.com/q/21312322
answer count: 1
has answer: http://stackoverflow.com/a/21816249
tagged with: tomcat
upvote count: 10
has title: JMXProxy from JBoss to Tomcat
type: UnansweredQuestion
tagged with: jmx
downvote count: 0
tagged with: java
score: 10
tagged with: jboss
favorite count: 0
type: Question
has body: I have multiple Tomcats and one JBoss. In JBoss i like to proxy about 100 Tomcat's JMX-Beans using "JRMPProxyFactory". I have all the interfaces in jboss but i dont know where i have to add the Tomcat's ip-addresses. This is my tomcat99-service.xml: <?xml version="1.0" encoding="UTF-8"?> jboss:service=invoker,type=jrmp tomcat99:service=JMX Tomcat99Target true myinterface

http://stackoverflow.com/q/21294293
type: UnansweredQuestion
has title: Best way to organize text through patterns?
has answer: http://stackoverflow.com/a/21294544
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21294430
has body: I have scraped a bunch of information, and need to organize it into several fields. The only issue is that there is no specific header before the information to identify it with and create a pattern and matcher. I have included the information for 2 sets of data below. As shown, identifiers are just "left" or "center" showing where they are on the screen. What would be the best way to search and organize each set of data into a CSV, by adding in each field from each data set? The data that would need to be saved would be everything afer "left"> or "center"> to ERIK DAVIDOVIC, ET AL 5620 GOODMAN DRIVE NORTH ROYALTON 44133-0000 CV-13-798497 488-05-029 I 01/02/2013 UNKNOWN HEIRS, ETC OF D.C. RUFUS, ET AL 10603 HAMPDEN AVENUE CLEVELAND 44108-0000 CV-13-798498 109-16-094 A 01/02/2013
type: Question
answer count: 2
upvote count: 1
tagged with: regex
favorite count: 0

http://stackoverflow.com/comment/32171040
score: 0
comment on: http://stackoverflow.com/q/21337707
type: Comment
type: QuestionComment
has text: To address the question, No, there's no way to request the compiler to make the + operator behave differently.

http://stackoverflow.com/comment/32099158
score: 0
type: AnswerComment
type: Comment
has text: its not null after findviewbyid
comment on: http://stackoverflow.com/a/21299067

http://stackoverflow.com/a/21256538
score: 1
type: Answer
answers question: http://stackoverflow.com/q/21256469
upvote count: 1
has body: public String[] OpenFile() // expected return type is String array But you didn't return that from your method. If you don't want to return that change your method return type to void(no return) public void OpenFile() throws IOException { } Or if you want to return as expected use public String[] OpenFile() throws IOException { String[] arr=new String[5]; // implementation return arr; }
downvote count: 0

http://stackoverflow.com/comment/32264415
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21268392
score: 2
has text: In general, all method parameters should be mandatory unless they're explicitly documented as being allowed to be null (we use the `@Nullable` annotation to document this) or if there's an overload of the method that simply does not take the parameter (this is a preferable way of making a parameter optional, in my opinion). We definitely don't advocate the use of `Optional<T>` for method parameters, and `Mandatory<T>` would have the same issues optional does when used as a parameter type, only worse because almost all parameters would need to use it.

http://stackoverflow.com/comment/109991438
type: Comment
has text: I'm curious about this, will it work if my server is outside the kerberos cluster? meaning that the server that launches the API is not kerberised, will it work by just specifying the provided keytab?
comment on: http://stackoverflow.com/a/21642921
score: 0
type: AnswerComment

http://stackoverflow.com/a/21348143
score: 3
type: Answer
has body: Probably because built-in serialization writes class description into the stream, when an instance of the class is first written into the stream. Writing a single User object, you measure the cost of User class description construction and serialization + an instance serialization. Built-in serialization should seem more efficient on writing series of objects of the same class. Reference: http://docs.oracle.com/javase/7/docs/platform/serialization/spec/output.html#5552
answers question: http://stackoverflow.com/q/21347670
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/32172811
type: Comment
comment on: http://stackoverflow.com/q/21340316
type: QuestionComment
has text: @NathanielWaisbrot looks ok to me, user name must not be taken already and fulfill some complexity criteria.
score: 0

http://stackoverflow.com/q/21316128
score: 2
has answer: http://stackoverflow.com/a/21318069
tagged with: java
has comment: http://stackoverflow.com/comment/32129156
type: Question
has body: If I go to the folder using dos prompt and run: python.exe DocumentConverter.py a.odt b.pdf it successfully converts odt to pdf... but if I do this in Java: p = Runtime.getRuntime().exec(new String[]{ "cmd", "C:/OpenOffice 4/program/python.exe", "C:/OpenOffice 4/program/DocumentConverter.py", "C:/OpenOffice 4/program/a.odt C:/OpenOffice 4/program/b.pdf"}); then nothing happens, why?
has answer: http://stackoverflow.com/a/21316491
has comment: http://stackoverflow.com/comment/32129522
has comment: http://stackoverflow.com/comment/32129444
favorite count: 0
has comment: http://stackoverflow.com/comment/32129132
has answer: http://stackoverflow.com/a/21316635
has title: Running command in Java
answer count: 4
linked to: http://stackoverflow.com/q/16452964
has comment: http://stackoverflow.com/comment/32129071
upvote count: 3
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/16452964
has answer: http://stackoverflow.com/a/21316245
downvote count: 1

http://stackoverflow.com/a/21266218
has body: If you create an object in an Activity Class A, then navigate to Activity B, remember that the OS may destroy Activity A at any time. In fact, there is a debug option to automatically kill activities when you navigate to another (for testing). Once Activity A has been destroyed, any objects created will be destroyed and their memory reclaimed. If you want objects to remain after you leave Activity A, you need to save them in the Application class or perhaps a singleton.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21264916
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21264916
upvote count: 2

http://stackoverflow.com/comment/32024012
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21256851
has text: I dont But it work in ALl Browser what will Mistake ?
score: 0

http://stackoverflow.com/q/21337732
has title: Java Properties File appending new values
upvote count: 3
tagged with: java
type: Question
score: 3
has answer: http://stackoverflow.com/a/21337884
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/21338142
has answer: http://stackoverflow.com/a/21338142
tagged with: properties
accepted answer: http://stackoverflow.com/a/21337884
has body: I have an application that implements a JTree and populates the tree with a java properties file as default; The nodes are the keys and the values are the contents of the node. The application was designed to be dynamic so a JButton and JTextField are implemented to take in new values and put the values in the exists keys in the properties file. So for example I have the line below as a default value in a sample.properties file node=cat,dog,mice and using the JTextField and JButton I input "rabbit" to append to the node, to look like: node=cat,dog,mice,rabbit I've implemented JTextField and JButton and have them working but I just can't seem to find a good way to append new values to existing keys in the properties file.
type: AnsweredQuestion

http://stackoverflow.com/comment/32072051
has text: @Aktarel Depends, is your Spring app deployed on jboss or on which server?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21264464

http://stackoverflow.com/a/21315902
downvote count: 0
has body: Neither the CMIS specification nor the OpenCMIS API has a native understanding of workflows or tasks. To Gagravarr's point, if your CMIS-compliant server exposes those objects as instances of something CMIS understands (policies, folders, documents, relationships, or items) then you will be able to do it.
upvote count: 2
answers question: http://stackoverflow.com/q/21194527
type: Answer
score: 2

http://stackoverflow.com/q/21323531
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21324579
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21324579
linked to: http://stackoverflow.com/q/21154148
has body: I have a very simple app which is just an activity with a tab view on it. I have initialised and casted everything to as it should be but am continually getting a null pointer error which always links back to tabHost.setup(); I am using android studio and am new to java. This question has been asked a lot on here but all answers just say to include the setup() and I have already done that. Here is my .java file: package com.example.app; 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; import android.widget.TabHost; 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(); } TabHost tabHost = (TabHost) findViewById(R.id.tabHost); tabHost.setup(); TabHost.TabSpec spec1, spec2, spec3; spec1 = tabHost.newTabSpec("spec1"); spec1.setContent(R.id.tab1); spec1.setIndicator("Tab1"); tabHost.addTab(spec1); spec2 = tabHost.newTabSpec("spec2"); spec2.setContent(R.id.tab2); spec2.setIndicator("Tab2"); tabHost.addTab(spec2); spec3 = tabHost.newTabSpec("spec3"); spec3.setContent(R.id.tab3); spec3.setIndicator("Tab3"); tabHost.addTab(spec3); } @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 par…
has title: tabHost.setup() gives null pointer exception (Android studio)
type: Question
answer count: 2
tagged with: android
possible better answer: http://stackoverflow.com/a/21323625
tagged with: android-studio
tagged with: android-tabhost
has answer: http://stackoverflow.com/a/21323625

http://stackoverflow.com/comment/32485815
comment on: http://stackoverflow.com/q/21306022
type: QuestionComment
has text: I can't answer this question because it's closed, but a solution can be found here: http://stackoverflow.com/questions/20802335/endpoint-publish-for-rest-web-services/21330224#21330224
score: 0
type: Comment

http://stackoverflow.com/a/21271812
has body: This is from the Javadocs of ButtonGroup This class is used to create a multiple-exclusion scope for a set of buttons. Creating a set of buttons with the same ButtonGroup object means that turning "on" one of those buttons turns off all other buttons in the group. A ButtonGroup can be used with any set of objects that inherit from AbstractButton. So it would seem that you do not need to do anything.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21271756
upvote count: 2
type: Answer

http://stackoverflow.com/a/22758739
type: Answer
answers question: http://stackoverflow.com/q/21184549
has comment: http://stackoverflow.com/comment/37202995
score: 0
type: AcceptedAnswer
has body: Please set IEngine::EnableRecognitionVariants to TRUE before the document processing. I work for ABBYY and ready to help you in comments.
has comment: http://stackoverflow.com/comment/37051200
accepted answer of: http://stackoverflow.com/q/21184549

http://stackoverflow.com/comment/32142320
type: AnswerComment
comment on: http://stackoverflow.com/a/21323406
has text: Thanks. I tried to read the link you gave me above. The website has some examples that I don't understand at all. I will try anyways
score: 0
type: Comment

http://stackoverflow.com/comment/32160758
type: Comment
has text: Thanks a lot. But isn't there anything a bit smaller or simpler?
comment on: http://stackoverflow.com/a/21333830
score: 0
type: AnswerComment

http://stackoverflow.com/a/21331389
type: AcceptedAnswer
downvote count: 0
has body: With FTPS you have to use PROT P to make the data channel TLS or PROT C for a non-protected data channel. It might hang because client and server don't agree about the protection of the channel, e.g. the clients wait for non-encrypted data from the server while the server waits for a TLS Client Hello from the client to start encryption. So please check your communication for "PROT" command and the replies to it. Other problems might be if the FTP server is behind a router or firewall. PASV mode is used when the client is behind a firewall, but will give problems if the server is behind a dumb firewall or NAT. Try if plain (e.g. non-TLS) FTP works.
type: Answer
score: 4
accepted answer of: http://stackoverflow.com/q/21327068
answers question: http://stackoverflow.com/q/21327068
has comment: http://stackoverflow.com/comment/32159278
upvote count: 4

http://stackoverflow.com/q/21328646
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21328815
has title: writing and reading a file of strings
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32151488
has comment: http://stackoverflow.com/comment/32151340
has body: Hi friends this is my program to create(write) an array of integer file and reading it..and it is working..now i want to create a file of Strings.Can someone help me please? public class File { public static void main(String args[]) throws IOException{ int[] array={010100101,0010010}; OutputStream os=new FileOutputStream("arun"); for(int i=0;i&lt;array.length;i++){ os.write(array[i]); } InputStream is=new FileInputStream("arun"); for(int i=0;i&lt;array.length;i++){ System.out.println(is.read()); } } }
tagged with: java
downvote count: 3
score: -3
type: Question
has answer: http://stackoverflow.com/a/21328815
upvote count: 0

http://stackoverflow.com/q/21192788
linked to: http://stackoverflow.com/q/218384
tagged with: null
upvote count: 0
tagged with: arrays
possible better answer: http://stackoverflow.com/a/21192863
has comment: http://stackoverflow.com/comment/31910765
has title: Java - how to return a null in this String method?
type: AnsweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/21192836
tagged with: return
type: Question
has answer: http://stackoverflow.com/a/21192856
has body: How to make this string return a null if we put things = null public class Test { static String concatAll(Object[] things) { StringBuffer result = new StringBuffer(); for (int i = 0; i &lt; things.length; i++) { result.append( things[i] ); } String x = result.toString(); return x; } public static void main(String [] args) { Object[] obj = {19, "abc", " ", 3.5}; System.out.println(concatAll(obj)); } } this code will print 19abc 3.5 when i put obj = null in the main method this code is not working, Why?
has answer: http://stackoverflow.com/a/21192868
tagged with: object
has comment: http://stackoverflow.com/comment/31910841
has comment: http://stackoverflow.com/comment/31910760
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/21192847
answer count: 5
accepted answer: http://stackoverflow.com/a/21192836
score: -3
has answer: http://stackoverflow.com/a/21192863

http://stackoverflow.com/comment/32074351
has text: command works but code doesn't, why this happening with me. I want to use it in my project. I think I need to find any other alternative for this.
type: Comment
comment on: http://stackoverflow.com/a/21204996
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32210665
comment on: http://stackoverflow.com/a/21329863
type: AnswerComment
has text: @Holger There is no essential difference between rethrowing and throwing. The only use of `sneakyThrow` is to (re)throw checked exceptions without compiler checking. If that is not the main goal of a Java developer, that Java developer will find no use for `sneakyThrow`. BTW your point about rethrowing Throwable being "possible in Java7" is as unclear as it was before.
type: Comment
score: 0

http://stackoverflow.com/a/21273210
type: Answer
has comment: http://stackoverflow.com/comment/32138025
score: 1
has body: A very good example can be found here: http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.html Try using CV_PI instead of Math.PI? Other reasons could be because of your threshold. Try inserting a value like 50(play around with the numbers). The last 2 values, u can try leaving it to be zero and test it first before inserting values. Default Values for the last 2 is usually zero. There could be many reasons why its not working, so let's slowly find the cause one by one. Also, you did Canny it or something before you applied Hough right? Hope that helps, let me know if my suggestions are useful and helped(: Cheers.
has comment: http://stackoverflow.com/comment/54625494
answers question: http://stackoverflow.com/q/21265986
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/32098216
score: 1
comment on: http://stackoverflow.com/a/21298396
type: AnswerComment
type: Comment
has text: Basically if the file isn't found the constructor will throw this exception. try/catch means control flow will jump out and to the catch block if it does. (BTW the thing I showed with try...finally...close isn't totally necessary but a best practice. Java 7+ also has [try-with-resources](http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html) to replace the idiom.) It's possible the exception will be thrown at run time in which case what @peeskillet has suggested may be of some help. Relative directories are finicky.

http://stackoverflow.com/comment/32207670
comment on: http://stackoverflow.com/a/21344844
type: Comment
has text: Yes. What I noticed is that old and unused imageviews must be removed. They significantly impact performance.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21260842
tagged with: jcombobox
type: AnsweredQuestion
tagged with: keyevent
tagged with: popup
has body: the Title states my problem almost completely. I have some combo box classes which derive from JComboBox, additionally we use the PlasticUI from JGoodies. My Problem is that when I navigate through the available items in the drop down popup those items are automatically being selected. This only happens when I use the navigation keys, hovering with the mouse over the objects is fine. In my case this is pretty bad because it somehow provokes the lazy-loaded data in the object to be loaded and slow the combo box down immensely. How can I turn this behavior off? I tried debugging, but I cannot find a place to set a breakpoint properly, too much magic happening in the background :/ Plzz help :)
tagged with: java
has title: How to turn off auto selection in combobox while navigating in dropdown?
type: Question
has answer: http://stackoverflow.com/a/21261147
score: 0
answer count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/21261147

http://stackoverflow.com/q/21316431
downvote count: 0
tagged with: tomcat
has body: I'm trying to figure out if it's possible to disable the Akka Scheduler thread as I might have found a memory leak(?). I have a Java-Spring application running on Tomcat that registers my Akka ActorSystem with basic configuration - i.e. I haven't provided an application.conf, I'm just going with the standard defaults for everything for the moment. The work done by the actors that get spawned is just simple creation of a Spring RestTemplate object that get some JSON from a service and Jackson is then used to create some objects. On my production servers, which are under fairly large load during retail sales, I've recently noticed my PermGen space slowly creeping up now I've put in the ActorSystem. So to find the source of the problem I ran the application locally, let my Tomcat container initialise the Spring application - which in turn instantiates an actor system. Simple. All good. Until... I started looking at VisualVM memory Sampling. Without even hitting a page - so the app has started up and NOTHING else has taken place, no requests, nada... the sleeping Thread of the scheduler "myActorSystem-scheduler-1" appears to be using memory. Grabbing memory at about 8kb/sec. (possibly per "tick"). I left VisualVM running overnight and came in to find 300MB of PermGen was just GONE. My production servers have a different configuration than development to some degree, but when the server is sitting idle the ONLY THING that's using memory is this scheduler. If the server isn't interacting with anything and the scheduler isn't even used - AT ALL - it really shouldn't be skimming my memory. I haven't configured the Akka actor system to do anything that isn't out of the box. If you debug akka.dispatch.AbstractNodeQueue you'll find that this constructor is called on every 'tick'... private volatile Node&lt;T&gt; _tailDoNotCallMeDirectly; protected AbstractNodeQueue() { final Node&lt;T&gt; n = new Node&lt;T&gt;(); _tailDoNotCallMeDirectly = n; set(n); } Instantiating an object …
has comment: http://stackoverflow.com/comment/46703761
tagged with: memory-leaks
has comment: http://stackoverflow.com/comment/32140816
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: spring
score: 3
upvote count: 3
tagged with: java
has title: How Do I Stop or Disable Scheduler if I've found a possible PermGen memory leak with Tomcat and Akka?
type: Question
has comment: http://stackoverflow.com/comment/32140708
tagged with: akka

http://stackoverflow.com/a/21215923
score: 7
has comment: http://stackoverflow.com/comment/31952612
type: AcceptedAnswer
has body: If you are using Java 7+, you can use: Files.copy(source, target, StandardCopyOption.COPY_ATTRIBUTES); If that does not copy the creation time (it does on my machine), you can also manually set it: Path source = ...; Path target = ...; Files.copy(source, target, StandardCopyOption.COPY_ATTRIBUTES); FileTime creationTime = (FileTime) Files.readAttributes(source, "creationTime").get("creationTime"); Files.setAttribute(target, "creationTime", creationTime);
downvote count: 0
has comment: http://stackoverflow.com/comment/31952683
type: Answer
upvote count: 7
answers question: http://stackoverflow.com/q/21215883
has comment: http://stackoverflow.com/comment/31952245
accepted answer of: http://stackoverflow.com/q/21215883

http://stackoverflow.com/q/21195340
downvote count: 0
has answer: http://stackoverflow.com/a/21195455
tagged with: jvm
favorite count: 0
type: Question
has body: I was reading about instruction set in wiki and I came across this paragraph: Some virtual machines that support bytecode as their ISA such as Smalltalk, the Java virtual machine, and Microsoft's Common Language Runtime, implement this by translatin the bytecode for commonly used code paths into native machine code. In addition, these virtual machines execute less frequently used code paths by interpretation (see: Just-in-time compilation). Transmeta implemented the x86 instruction set atop VLIW processors in this fashion. What does this exactly mean? is the bytecodes are ISA for JVM and JVM in-turn support ISA of processors.
tagged with: instruction-set
possible better answer: http://stackoverflow.com/a/21196194
has answer: http://stackoverflow.com/a/21196194
upvote count: 3
tagged with: java
answer count: 3
accepted answer: http://stackoverflow.com/a/21195455
has title: is bytecode treated as instruction set for JVM?
has answer: http://stackoverflow.com/a/21195457
tagged with: processor
tagged with: bytecode
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/32155782
comment on: http://stackoverflow.com/a/21330393
type: AnswerComment
score: 0
has text: Both options are not working.. same error displayed.. error displayed even before google loads fully.
type: Comment

http://stackoverflow.com/q/21212124
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/31945504
has comment: http://stackoverflow.com/comment/31945750
has title: Practice program that teaches me how to overload methods in Java keeps outputting the wrong answer
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31945516
has comment: http://stackoverflow.com/comment/31946105
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21212314
has comment: http://stackoverflow.com/comment/31945529
has comment: http://stackoverflow.com/comment/31945657
has body: I understand the concept of overloading and I'd like to think I have done it succesfully in this program; it runs fine but the output is not correct. The program is supposed to calculate the area of a circle from two points, one being the radius and the other being a random point on the outside of the circle. The two points are given by the user, and each point consists of two numbers. So point one is x1, x2, while point two is y1, y2. I did a test run by inputting the numbers 1, 2, 3, and 4, which should give me an answer of 3.1458....(pi). However, it gives me 25.132741228718352. Any help on figuring out what is giving me this weird output would be much appreciated. Here is the code import java.util.Scanner; public class AreaCircle { static Scanner input = new Scanner(System.in); public static double getDistance(double x1, double y1, double x2, double y2) { double dx = x2 - x1; double dy = y2 - y1; double distanceSquared = dx * dx + dy * dy; double radius = Math.sqrt(distanceSquared); return radius; } public static double areaCircle (double radius){ double area = (double)Math.PI * (radius * radius); return area; } public static double areaCircle (double x1, double x2, double y1, double y2) { double radius = getDistance(x1, x2, y1, y2); double area = areaCircle (radius); return area; } public static void main(String[] args) { System.out.print("Please input two points, with the first being \n" + "the middle of the circle and the other being \n" + "a point on the outside of the circle. These two points will \n" + "be used to find the area of your circle. \n\n" + "Input the first point here: "); double x1 = input.nextDouble(); System.out.print("Input the second point here: "); double x2 = input.nextDouble(); System.out.print("Input the third point here: "); double y1 = input.nextDouble(); System.out.print("Input the fourth point here: "); double y2 = input.nextDouble(); double result = areaCircle(x1, x2, y1, y2); System.out.println("Your result is: " + result); } }
tagged with: java

http://stackoverflow.com/q/21328349
type: Question
type: AnsweredQuestion
tagged with: android
has title: Dynamically change which variable to call
has body: Okay so I have a table with a lot of columns and rows and I need to populated every single TextView within it from SQLite database. This is how I'm currently doing it (take a deep breath before you lookat it, it's one of the worst codes you'll ever see): populateUrnik("Ponedeljek", 1, razred, pon1, pon1u); populateUrnik("Torek", 1, razred, tor1, tor1u); populateUrnik("Sreda", 1, razred, sre1, sre1u); populateUrnik("Četrtek", 1, razred, cet1, cet1u); populateUrnik("Petek", 1, razred, pet1, pet1u); populateUrnik("Ponedeljek", 2, razred, pon2, pon2u); populateUrnik("Torek", 2, razred, tor2, tor2u); populateUrnik("Sreda", 2, razred, sre2, sre2u); populateUrnik("Četrtek", 2, razred, cet2, cet2u); populateUrnik("Petek", 2, razred, pet2, pet2u); populateUrnik("Ponedeljek", 3, razred, pon3, pon3u); populateUrnik("Torek", 3, razred, tor3, tor3u); populateUrnik("Sreda", 3, razred, sre3, sre3u); populateUrnik("Četrtek", 3, razred, cet3, cet3u); populateUrnik("Petek", 3, razred, pet3, pet3u); populateUrnik("Ponedeljek", 4, razred, pon4, pon4u); populateUrnik("Torek", 4, razred, tor4, tor4u); populateUrnik("Sreda", 4, razred, sre4, sre4u); populateUrnik("Četrtek", 4, razred, cet4, cet4u); populateUrnik("Petek", 4, razred, pet4, pet4u); populateUrnik("Ponedeljek", 5, razred, pon5, pon5u); populateUrnik("Torek", 5, razred, tor5, tor5u); populateUrnik("Sreda", 5, razred, sre5, sre5u); populateUrnik("Četrtek", 5, razred, cet5, cet5u); populateUrnik("Petek", 5, razred, pet5, pet5u); populateUrnik("Ponedeljek", 6, razred, pon6, pon6u); populateUrnik("Torek", 6, razred, tor6, tor6u); populateUrnik("Sreda", 6, razred, sre6, sre6u); populateUrnik("Četrtek", 6, razred, cet6, cet6u); populateUrnik("Petek", 6, razred, pet6, pet6u); populateUrnik("Ponedeljek", 7, razred, pon7, pon7u); populateUrnik("Torek", 7, razred, tor7, tor7u); populateUrnik("Sreda", 7, razred, sre7, sre7u); populateUrnik("Četrtek", 7, razred, cet7, cet7u); populateUrnik("Petek", 7, razred, pet7, pet7u); populateUrnik("P…
answer count: 1
accepted answer: http://stackoverflow.com/a/21328452
tagged with: dynamic
score: 0
tagged with: java
tagged with: variables
has comment: http://stackoverflow.com/comment/32152740
has answer: http://stackoverflow.com/a/21328452

http://stackoverflow.com/a/21343528
score: 4
has body: As said here you are missing the required version number. Maybe you copied your code from somewhere else (not a bad thing, I do it, just saying) and then edited it a bit? You can also specify your version numbers at the top like so, to help with readability and/or maintainability: <slf4j.version>1.7.5</slf4j.version> <logback.version>1.0.9</logback.version> org.slf4j slf4j-api ${slf4j.version} ch.qos.logback logback-classic ${logback.version} ch.qos.logback logback-core ${logback.version} org.mockito mockito-core 1.9.5
answers question: http://stackoverflow.com/q/21343405
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/127237563
score: 0
type: Comment
has text: It does matter. When the server catches `EOFException` it must close the accepted socket. Otherwise you have a resource leak. You need an inner reading loop inside the accepting loop.
comment on: http://stackoverflow.com/a/21297343
type: AnswerComment

http://stackoverflow.com/a/21278341
has comment: http://stackoverflow.com/comment/32068657
has comment: http://stackoverflow.com/comment/32062394
has body: Unfortunately there is nothing like this already provided by LibGDX. But you can easily do it yourself if you do not want shadows. Here is a little video of someone who has done it via LibGDX. Here is the article to this video, with code and descriptions and everything provided. You can do it this way with shaders, but you could also do the same by just rendering a lightmap to an FBO (in the given links you can see how to do that) and then just render it the usual way with blending activated on top of your screen. The standard SpriteBatch can do that and you don't need any custom shaders. If you still want to have real shadows with obstacles, you will probably find this article very useful. But this is a lot slower and needs special shaders. There is also no way to use Box2dLights without Box2D btw.
has comment: http://stackoverflow.com/comment/32248900
has comment: http://stackoverflow.com/comment/32064081
has comment: http://stackoverflow.com/comment/32539067
has comment: http://stackoverflow.com/comment/32246608
upvote count: 8
answers question: http://stackoverflow.com/q/21278229
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32249394
has comment: http://stackoverflow.com/comment/32248764
has comment: http://stackoverflow.com/comment/32064171
accepted answer of: http://stackoverflow.com/q/21278229
has comment: http://stackoverflow.com/comment/32063452
has comment: http://stackoverflow.com/comment/32064708
has comment: http://stackoverflow.com/comment/32071203
has comment: http://stackoverflow.com/comment/32539721
has comment: http://stackoverflow.com/comment/32249574
has comment: http://stackoverflow.com/comment/32539321
type: Answer
has comment: http://stackoverflow.com/comment/32065126
score: 8
downvote count: 0

http://stackoverflow.com/a/21248835
score: 5
accepted answer of: http://stackoverflow.com/q/21248609
upvote count: 5
answers question: http://stackoverflow.com/q/21248609
has body: This bug is pretty tricky. You constructed three MyMath instances. So your code was holding a wrong reference to your JTextFiled instance. That's why you couldn't get the right input. public static void addComponentsToPane(Container pane) { textArea = new JLabel(" "); pane.setLayout(new BoxLayout(pane, BoxLayout.PAGE_AXIS)); pane.add(new MyMath().textField); //MyMath instance 1 pane.add(new MyMath().button); //MyMath instance 2 pane.add(new MyMath().comment); //MyMath instance 3 pane.add(textArea); } Here is the right code: public static void addComponentsToPane(Container pane) { MyMath myMath = new MyMath(); textArea = new JLabel(" "); pane.setLayout(new BoxLayout(pane, BoxLayout.PAGE_AXIS)); pane.add(myMath.textField); pane.add(myMath.button); pane.add(myMath.comment); pane.add(textArea); } :)
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/21273305
linked to: http://stackoverflow.com/q/14741612
has body: Objective: Unlock Android device programmatically and load application on boot up API: 10 & 18 IDE: Eclipse Test device: Emulator I understand this issue has been widely discussed on stackoverflow and elsewhere. But I am unable to get this to work. My first question is Can the Emulator be programmatially unlocked and an application be loaded on boot up? I also read that after API 13 some there were some changes and I am not sure if I am accounting for these changes Assuming the answer is yes please find code excepts below. AndroidManifest.xml <manifest package="com.example.display"> <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.intent.action.BOOT_COMPLETED" /> MainActivity.java package com.example.display; import android.app.Activity; import android.content.Context; import android.content.res.Configuration; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager.LayoutParams; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Unlock // http://developer.android.com/reference/android/app/Activity.html#getWindow() Window window = getWindow(); window.addFlags(LayoutParams.FLAG_DISMISS_KEYGUARD); window.addFlags(LayoutParams.FLAG_SHOW_WHEN_LOCKED); window.addFlags(LayoutParams.FLAG_TURN_SCREEN_ON); } @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; } } myreceiver.java I am expecting this section of the code to get executed on boot u…
score: 2
has comment: http://stackoverflow.com/comment/32054100
downvote count: 0
has title: Unlock Android device programmatically and load application on boot up
accepted answer: http://stackoverflow.com/a/21274258
linked to: http://stackoverflow.com/q/8654831
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21274258
tagged with: java
linked to: http://stackoverflow.com/q/2784441
tagged with: eclipse
type: Question
upvote count: 2
answer count: 1
favorite count: 0
tagged with: android

http://stackoverflow.com/q/21259549
upvote count: 1
has answer: http://stackoverflow.com/a/21259934
accepted answer: http://stackoverflow.com/a/21259934
favorite count: 0
has title: HQL String LEFT
linked to: http://stackoverflow.com/q/8648787
has body: How do I get records that first 4 characters' match my string using HQL? This is my HQL statement: Query query = HibernateUtil.getSessionFactory().getCurrentSession().createQuery("from User where substring(user, 4) like :user"); query.setParameter("user", "John"); Which returns nothing. However, if I reuse the SQL statement in MySQL and change the word "substring" to LEFT then it returns a lot of records. I've also tried replacing "substring" with "left" in my HQL but it gives me this error when I do: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: LEFT
has answer: http://stackoverflow.com/a/21259911
downvote count: 0
has comment: http://stackoverflow.com/comment/32028779
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/79742525
tagged with: mysql
tagged with: hql
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21259911

run-configuration
type: Tag
tags question: http://stackoverflow.com/q/21276629
tag name: run-configuration

http://stackoverflow.com/comment/32179253
comment on: http://stackoverflow.com/q/21343709
has text: Try calling `javac` from the `src` folder. You should read about the [java compiler](http://docs.oracle.com/javase/7/docs/technotes/guides/javac/)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21316245
has comment: http://stackoverflow.com/comment/32129941
answers question: http://stackoverflow.com/q/21316128
score: 1
has comment: http://stackoverflow.com/comment/32129400
upvote count: 1
has comment: http://stackoverflow.com/comment/32129413
has comment: http://stackoverflow.com/comment/32129265
has comment: http://stackoverflow.com/comment/32129451
has body: Instead of passing a String[] as parameter, try passing just a String. Runtime.getRuntime().exec("cmd /c C:/OpenOffice 4/program/python.exe C:/OpenOffice 4/program/DocumentConverter.py C:/OpenOffice 4/program/a.odt C:/OpenOffice 4/program/b.pdf"); I believe the thread How do I execute Windows commands in Java? and this page can help you with what you need if you have any questions or wants to know alternative approaches.
downvote count: 0
has comment: http://stackoverflow.com/comment/32129288
type: Answer

http://stackoverflow.com/q/21215840
has title: Spring Integration receive and send messages over a tcp connection
has answer: http://stackoverflow.com/a/21235543
score: 3
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21235543
has comment: http://stackoverflow.com/comment/31959683
tagged with: tcp
type: AnsweredQuestion
tagged with: spring-integration
upvote count: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31955410
downvote count: 0
has body: I'm trying to implement the following scenario using Spring Integration: I need to connect to a server via TCP IP and process messages received. I need to send messages to the same server from which receive and process responses. This is my config: &lt;channel id="input"&gt; &lt;interceptors&gt; &lt;wire-tap channel="logger"/&gt; &lt;/interceptors&gt; &lt;/channel&gt; &lt;logging-channel-adapter id="logger" level="DEBUG" log-full-message="true"/&gt; &lt;ip:tcp-connection-factory id="factory" type="client" host="localhost" port="9004" single-use="false" using-nio="true" deserializer="javaDeserializer"/&gt; &lt;ip:tcp-inbound-channel-adapter id="inbound" channel="input" connection-factory="factory" client-mode="true" retry-interval="5000"/&gt; I can receive messages sent from the server, but I have no idea how to convert a string. javaDeserializer is not invoked when messages arrive. 2014-01-19 05:47:20 DEBUG TcpNioConnection:380 - localhost:9004:74154fb2-f77c-4036-9142-e756e53a6ac6 Reading... 2014-01-19 05:47:20 DEBUG TcpNioConnection:324 - Read 26 into raw buffer 2014-01-19 05:47:25 DEBUG TcpNioConnection:380 - localhost:9004:74154fb2-f77c-4036-9142-e756e53a6ac6 Reading... 2014-01-19 05:47:25 DEBUG TcpNioConnection:324 - Read 26 into raw buffer 2014-01-19 05:47:30 DEBUG TcpNioConnection:380 - localhost:9004:74154fb2-f77c-4036-9142-e756e53a6ac6 Reading... 2014-01-19 05:47:30 DEBUG TcpNioConnection:324 - Read 26 into raw buffer 2014-01-19 05:47:35 DEBUG TcpNioConnection:380 - localhost:9004:74154fb2-f77c-4036-9142-e756e53a6ac6 Reading... 2014-01-19 05:47:35 DEBUG TcpNioConnection:324 - Read 26 into raw buffer With this example, you can send messages and process the reply from the server, but the connection will close and not kept listening to the messages from the server. Any idea how to solve this? Thanks in advance. Eduardo

http://stackoverflow.com/a/21251070
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32055472
has comment: http://stackoverflow.com/comment/32049193
answers question: http://stackoverflow.com/q/21213649
has body: Firstly I have some issues with your jsp. Why are you not using struts2 tag libraries (s:textfield) for your input. See if you can change that. Also add namespace="/" to your form element. Secondly Change UserModel Constructor from public class UserModel extends BaseModel { private UserVo userVo; public UserModel() { super(); } } to public class UserModel extends BaseModel { private UserVo userVo; public UserModel() { super(); userVo = new UserVo(); } } Thirdly Get your BaseModel to implement java.io.Serializable i.e. public abstract class BaseModel implements java.io.Serializable

http://stackoverflow.com/comment/32073953
type: Comment
type: QuestionComment
has text: @Alessio Thanks.The same problem I have.You have fix for that??
score: 0
comment on: http://stackoverflow.com/q/21284880

http://stackoverflow.com/q/21184441
has title: How to Deploy a jar File on a remote server from within Netbeans?
has answer: http://stackoverflow.com/a/21186275
linked to: http://stackoverflow.com/q/4797050
has answer: http://stackoverflow.com/a/21186571
accepted answer: http://stackoverflow.com/a/21186571
tagged with: deployment
score: 8
tagged with: netbeans
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5891343
has comment: http://stackoverflow.com/comment/31895365
tagged with: java
possible better answer: http://stackoverflow.com/a/21186275
has comment: http://stackoverflow.com/comment/31895481
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31895309
downvote count: 0
has body: I have developed a server [server.jar], and it is now working well (on my localhost). Now I want to "put" this server.jar on my remote server (ie: 122.152.12.33) and run it there, so My client application Replace "Localhost" with this ip and connect the [server.jar]... How may I do that? I found answers but didn't understand them (WAR? , and some configurations). I am using NetBeans IDE. Deployment of Jar file and converting to war using netbeans. Note I also use Mysql Database that I must upload it on the server side. *Update: Another related Question: If I want to try my server.jar on an existing website (Wordpress released site), just by adding my project in a folder, may this harm the online site? And may I use php to run the Jar? (the site that is online is Link. I want to a create a folder http://akhbarna.com/MyPrject/ ... and then put the Jar there and run it by Php. Is it possible? And how this may effect the Online site?
favorite count: 0
has comment: http://stackoverflow.com/comment/31895431
upvote count: 8
linked to: http://stackoverflow.com/q/1617458

http://stackoverflow.com/comment/31981174
type: AnswerComment
score: 0
type: Comment
has text: Here iPlanetDirectoryPro is not cookie name but its a cookie.Please see the docs.
comment on: http://stackoverflow.com/a/21232129

http://stackoverflow.com/a/21196040
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31916804
type: Answer
accepted answer of: http://stackoverflow.com/q/21195961
has comment: http://stackoverflow.com/comment/31916813
has body: It's a hexadecimal color code, the same as used in CSS, for example. See this tutorial, for example. #rrggbb where rr, gg and bb are hexadecimal numbers between 00 and FF. Note: This is not Java syntax, it's valid in Processing but not in Java.
answers question: http://stackoverflow.com/q/21195961
score: 0

http://stackoverflow.com/comment/32174331
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21340343
has text: One thing to check is in your jpa-context.xml do you have this in there `<cache:annotation-driven />`

http://stackoverflow.com/q/21257162
answer count: 2
tagged with: multithreading
has comment: http://stackoverflow.com/comment/32024467
downvote count: 1
has comment: http://stackoverflow.com/comment/32024641
tagged with: performance
has comment: http://stackoverflow.com/comment/32025276
has comment: http://stackoverflow.com/comment/32024581
tagged with: java
has answer: http://stackoverflow.com/a/21257695
type: UnansweredQuestion
upvote count: 0
has title: How to correctly judge the performance in Java using a profiler?
tagged with: profiler
favorite count: 0
has answer: http://stackoverflow.com/a/21257324
has body: I hava a Java project in which I am using threading, but performance of my project is not good and its running very slow on different machines.I want to improve the performance. I used VisualVM profiler to find where it consumes time, but I am not able to find it out. How to resolve this issue?Is it because of threading? And also tell me which profiler should I Use? Please Suggest!!... Thanks.
has comment: http://stackoverflow.com/comment/32024688
type: Question
score: -1

http://stackoverflow.com/comment/81549247
type: Comment
comment on: http://stackoverflow.com/a/21329579
score: 4
has text: @Keerthivasan NO this is not going to work. when method is protected your class should be sub class of that or in same package. but your approach deserve appreciation. you can get this work using reflection. `method = com.mysql.jdbc.ResultSetMetaData.class.getDeclaredMethod("getField", int.class); method.setAccessible(true); com.mysql.jdbc.Field field = (com.mysql.jdbc.Field) method.invoke(resultSetMetaData, x); System.out.println(field.isPrimaryKey());`
type: AnswerComment

http://stackoverflow.com/q/21193785
has title: variable unreachable when using exceptions
has comment: http://stackoverflow.com/comment/31912612
has comment: http://stackoverflow.com/comment/31912614
favorite count: 0
has answer: http://stackoverflow.com/a/21193839
tagged with: exception
answer count: 5
has comment: http://stackoverflow.com/comment/31912865
linked to: http://stackoverflow.com/q/2854144
has comment: http://stackoverflow.com/comment/31912832
has comment: http://stackoverflow.com/comment/31912631
has comment: http://stackoverflow.com/comment/31912654
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21193828
has answer: http://stackoverflow.com/a/21193828
duplicate of: http://stackoverflow.com/q/2854144
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/21193824
has comment: http://stackoverflow.com/comment/31912822
has comment: http://stackoverflow.com/comment/31912707
has comment: http://stackoverflow.com/comment/31912720
type: Question
has comment: http://stackoverflow.com/comment/31912758
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/31912726
has answer: http://stackoverflow.com/a/21193976
has body: I'm rather new to java so apologise if this is a stupid question. I have the following function public static List&lt;String[]&gt; read(String document) throws IOException{ try{ CSVReader reader = new CSVReader(new FileReader(document)); List&lt;String[]&gt; data = reader.readAll(); reader.close(); } catch(IOException e){ e.printStackTrace(); } return data; } however i am getting an error that data cannot be resolved to a variable. However if i but the return in the try statement the error goes away and states that the function should return. As the variable is inside the function i would have thought that regardless of the catch it would of allowed this. Can anyone explain to me where I am going wrong?
has answer: http://stackoverflow.com/a/21193815
accepted answer: http://stackoverflow.com/a/21193824

http://stackoverflow.com/comment/31989569
has text: It's not against convention per se, it's disallowed by Java's syntax.
type: QuestionComment
comment on: http://stackoverflow.com/q/21236598
score: 0
type: Comment

http://stackoverflow.com/comment/32158012
type: Comment
comment on: http://stackoverflow.com/a/21328462
type: AnswerComment
has text: i can: http://www.file-upload.net/download-8547927/weather.zip.html there are 2 projects, weatherserver (downloads the actual weather) and 06SwingWeather (builds into an executable jar file and has the image loading in it, in AboutDialog.java). you have to build weatherserver first, then you can build the swingweather. if you got further questions just ask.
score: 0

http://stackoverflow.com/q/21196661
downvote count: 0
has answer: http://stackoverflow.com/a/21196958
tagged with: javascript
has title: Create java object from javascript within apigee api proxy: Class is not a function, it is object
favorite count: 0
type: UnansweredQuestion
tagged with: apigee
upvote count: 1
score: 1
tagged with: java
has body: from javascript within an Apigee API proxy the following works as expected: var javaString = new java.lang.String("FooBar"); throw "javaString: "+javaString; but this doesn't: var date = new java.util.Date(); throw "date: "+date; and throws following exception when creating an object TypeError: [JavaPackage java.util.Date] is not a function, it is object i've tried lots of stuff from the Mozilla Rhino Scripting_Java page but with no luck please someone explain how am I being stupid
has answer: http://stackoverflow.com/a/21595091
has comment: http://stackoverflow.com/comment/31918387
type: Question
answer count: 2

http://stackoverflow.com/comment/46787671
type: AnswerComment
type: Comment
has text: Why it is not a good practice to try to rollback on Error/RuntimeException ?
score: 1
comment on: http://stackoverflow.com/a/21188426

http://stackoverflow.com/q/21213055
score: -1
upvote count: 0
answer count: 1
tagged with: jar
favorite count: 0
has body: I'm just wondering how to import classes located in a .jar file with out using an IDE. The jar file is in the same directory as the java file. So for example the jar file is called "someclasses.jar" and my file is called program.java I've done research and I just can't seem to get it to work. I'm not sure if I'm doing the class path correctly either. Is this close to how it should be done: import someclasses.*; and when compiling and running: javac -cp '.:someclasses.jar' program.java java -cp '.:someclasses.jar' program Any help would be greatly appreciated.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31948757
has comment: http://stackoverflow.com/comment/31948778
has comment: http://stackoverflow.com/comment/31947360
has answer: http://stackoverflow.com/a/21213102
tagged with: import
downvote count: 1
has title: Importing external classes with out an IDE
type: Question
tagged with: java

http://stackoverflow.com/comment/31939588
type: QuestionComment
has text: 1) All the print's 2) Our teacher asked us so
comment on: http://stackoverflow.com/q/21207204
score: 0
type: Comment

http://stackoverflow.com/comment/32213780
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21347914
type: Comment
has text: i can't understand where use this code? i think there is better way for solving your problem

http://stackoverflow.com/comment/32004781
has text: I changed everything to int, could you please review my edited version and let me know why it still doesn't show the winning conditions?
comment on: http://stackoverflow.com/a/21243930
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21230642
tagged with: java
score: -1
type: Question
upvote count: 0
has title: Getting java.lang.ClassNotFoundException: org.apache.poi.xssf.usermodel.XSSFWorkbook exception while trying to save an excel sheet
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/21230726
has answer: http://stackoverflow.com/a/21230725
type: UnansweredQuestion
downvote count: 1
has body: Here is my full stack trace java.lang.ClassNotFoundException: org.apache.poi.xssf.usermodel.XSSFWorkbook at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204) at com.abi.controller.FileUploadController.onSubmit(FileUploadController.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:746) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:687) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:915) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:822) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain…
has answer: http://stackoverflow.com/a/21230806

http://stackoverflow.com/q/21244953
tagged with: swing
has answer: http://stackoverflow.com/a/21245081
type: Question
has title: Java: Runtime.getRuntime().exec() - how to get reference to launched programs JFrame?
has comment: http://stackoverflow.com/comment/32004361
has comment: http://stackoverflow.com/comment/32004406
score: 0
tagged with: junit
tagged with: user-interface
answer count: 1
has body: When launching a Java program like this (or equivalent): Runtime.getRuntime().exec("java -jar someJar.jar") Is it possible to get a reference to the JFrame of the launched program so it can be automated with libraries like FEST (e.g in tests)? It's easy to do this when the program is launched inside the same VM, as illustrated in this example below, but for several reasons I cannot do that. The program must be separated from the VM/process launching it like above or similar. However, when using the above code to launch the process, the FEST code below does not find the frame. Example using FEST with adapted code from Java Reflection. Running a external jar and referring to its classes?: (FrameFixture is just an automation wrapper for a JFrame): Thread t = new Thread(new Runnable() { public void run() { File file = new File("someJar.jar"); URLClassLoader cl; try { cl = new URLClassLoader( new URL[]{file.toURI().toURL()} ); } catch (MalformedURLException e) {} Class&lt;?&gt; clazz = null; try { clazz = cl.loadClass("Main"); } catch (ClassNotFoundException e) {} Method main = null; try { main = clazz.getMethod("main", String[].class); } catch (NoSuchMethodException e) {} try { main.invoke(null, new Object[]{new String[]{}}); } catch (Exception e) {} } }); t.start(); GenericTypeMatcher&lt;JFrame&gt; matcher = new GenericTypeMatcher&lt;JFrame&gt;(JFrame.class) { protected boolean isMatching(JFrame frame) { return "TestFrame".equals(frame.getTitle()) &amp;&amp; frame.isShowing(); } }; FrameFixture frame = WindowFinder.findFrame(matcher).using(BasicRobot.robotWithCurrentAwtHierarchy()); frame.maximize();
accepted answer: http://stackoverflow.com/a/21245081
type: AnsweredQuestion
tagged with: fest
has comment: http://stackoverflow.com/comment/32004258
tagged with: java
linked to: http://stackoverflow.com/q/14741338

http://stackoverflow.com/comment/32035928
type: Comment
comment on: http://stackoverflow.com/a/21263087
type: AnswerComment
has text: Which some compilers won't let you reference in source code directly.
score: 0

http://stackoverflow.com/comment/32003338
comment on: http://stackoverflow.com/a/21244409
has text: As additional information, I found a question related to a closed System.out: http://stackoverflow.com/questions/8941298/system-out-closed-can-i-reopen-it
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31999241
type: QuestionComment
has text: I don't see `/panel/signup` covered by a specific rule? Which URL gives you the infinite redirect loop?
type: Comment
comment on: http://stackoverflow.com/q/21241897
score: 0

http://stackoverflow.com/q/21230256
tagged with: spring
score: 2
tagged with: junit4
tagged with: java
type: Question
has title: Spring context with jUnit for @Configurable code: NullPointerException for Resource
answer count: 1
tagged with: junit
downvote count: 0
linked to: http://stackoverflow.com/q/4703206
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/21230494
favorite count: 0
has body: I have a production class which looks like @Configurable public class MyProductionClass { @Resource private MyResource resource; private String param; public MyProductionClass(String param) { this.param = param } public void aMethod() { resource.doSomething(); //whatever, the previous line throws NullPointerException when testing } } and a test class like @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:/test-context.xml"}) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) @TestExecutionListeners(listeners = {DependencyInjectionTestExecutionListener.class}) public class MyProductionClassTest { private MyProductionClass underTest; @Test public void aMethodTest() { underTest = new MyProductionClass("aString"); underTest.aMethod(); } } I have some log and I can see Spring context being initialized correctly, with all beans described in test-context.xml happily created, including resource. But, when the test runs underTest.aMethod() a NullPointerException is thrown saying resource is null. I use the same initialization (new MyProductionClass("aString")) in production and there everything works flawlessly. Is there something I am missing when using @Configurable classes with jUnit? Versions are: Spring 3.2.4 jUnit 4.11 EDIT My understanding of @Configurable: this issue may come from a misunderstanding of this feature. I understood it works so that I am not force to statically declare my @Configurable class in any Spring context (either Java or XML based), but so that I can initialized the class with the new operator and magically dependency are injected in the class. However, I do not know if this can work for tests (and I do not find any reason why it should not, a new is a new, whether it comes from a test class or from a production one)
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/21270883
answers question: http://stackoverflow.com/q/21270656
has body: You can still use setIcon but you will need to set the alignment to make the text appear over the image button.setHorizontalTextPosition(SwingConstants.CENTER);
score: 5
type: Answer
upvote count: 5
downvote count: 0

gridbaglayout
tags question: http://stackoverflow.com/q/21201103
tags question: http://stackoverflow.com/q/21333193
tags question: http://stackoverflow.com/q/21326771
tags question: http://stackoverflow.com/q/21278519
tags question: http://stackoverflow.com/q/21193781
tags question: http://stackoverflow.com/q/21246906
type: Tag
tag name: gridbaglayout
tags question: http://stackoverflow.com/q/21232664
tags question: http://stackoverflow.com/q/21310260

http://stackoverflow.com/a/21193804
has body: Well, you could obviously factor out the TimeUnit conversion and save a few cycles. You could also count down rather than up; using a !=0 test is usually faster than comparing to other values. You should also make sure the code is fully JITted (which can take several minutes of running it) before you take ANY measurements. Generally, microbenchmarks are misleading in Java, and microoptimizing without knowing how much that code contributes to your runtime tends to be wasted effort in any case. Don't bother with this sort of exercise. Write the best code you can, give it lots of warm-up time on an assortment real data, then use a profiler to see where it's spending its time (also on real data). That will tell you where performance tuning will actually be productive. Then consider algorithmic improvements, which tend to yield the highest benefit. Profile again with the new code and see what is hot now. Repeat. Remember, infinite improvement of something that accounts for 1% of runtime takes infinite effort but yields only 1% improvement. Put your effort where it makes a difference. And, especially in hotspot Javas where code continues to be optimized during execution but that optimization is not fully deterministic, don't trust a single execution to give you real performance numbers.
has comment: http://stackoverflow.com/comment/31915116
upvote count: 1
answers question: http://stackoverflow.com/q/21193657
downvote count: 0
has comment: http://stackoverflow.com/comment/32078653
score: 1
type: Answer

http://stackoverflow.com/comment/52088985
type: AnswerComment
comment on: http://stackoverflow.com/a/21344120
type: Comment
has text: Please leave a comment on your decision to down-vote this answer.
score: 0

http://stackoverflow.com/comment/32048194
comment on: http://stackoverflow.com/a/21268200
score: 0
type: AnswerComment
type: Comment
has text: If you're still wondering why that is, the reason is that it takes some time before the infinite loop in `main` is JIT-compiled into the optimized version which contains the "loop hoisting" optimization. Only after that optimized version runs for the first time will the code enter the infinite loop which does no further checking of the flag.

http://stackoverflow.com/comment/41485978
comment on: http://stackoverflow.com/a/21240963
type: Comment
has text: I have no idea how to retrieve these cache files added using `Job.addCacheFile(URI)`. It does not work for me using the old way (`context.getCacheFiles()`), because the files are null.
type: AnswerComment
score: 0

http://stackoverflow.com/q/21227330
upvote count: 9
accepted answer: http://stackoverflow.com/a/21240273
tagged with: sftp
answer count: 1
downvote count: 0
tagged with: ssh
tagged with: jsch
favorite count: 0
has title: Difference b/w ChannelSftp's lstat() and stat() method in jSch
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21240273
has body: I am using jSch for SFTP in my Java project. I want to get all files attributes in a directory. But there are two methods to retrieve the file attributes of a file or directory. 1. public SftpATTRS stat(String path) 2. public SftpATTRS lstat(String path) What is the difference b/w these two methods? Please tell me there uses???
tagged with: java
score: 9
type: Question

http://stackoverflow.com/comment/32087146
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21291703
has text: Thank you for your Answer. I am trying implement a parent step for my Job, there i will determine the number of lines and how to stop the job if the parent step completed.
score: 0

http://stackoverflow.com/q/21234674
has body: I'm trying to run a java class which populates my database with dummy data. In eclipse I do it just by right clicking and running as java program. The problem is I'd like make jenkins do it... obvious solution would be running a class using maven as it would put everything needed on the classpath. I have tried http://mojo.codehaus.org/exec-maven-plugin/ like this: populatedb false populatedb org.codehaus.mojo exec-maven-plugin 1.2.1 install java com.example.DatasetReader But it gives me ClassNotFound on com.example.DatasetReader before the project is even built. I use this command: mvn clean install exec:java -Dpopulatedb -Dclasspath -Dexec.mainClass="com.example.DatasetReader" I think it have to do something with execution phase... but there is nothing like post-install... Thanks!
has comment: http://stackoverflow.com/comment/31985705
score: 0
answer count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31988504
has comment: http://stackoverflow.com/comment/31988449
tagged with: plugins
has answer: http://stackoverflow.com/a/21235080
tagged with: maven
has title: Run java class from maven if parameter is specified
type: Question
has answer: http://stackoverflow.com/a/21234759
tagged with: java

http://stackoverflow.com/a/21317994
score: 0
type: Answer
has body: Make sure you initialized tournaments. If it is initialized your venueData might be null. Here is the reason, if(venue.getText().toString().equals("")) Here you are checking if the String is empty or not. You also need to check if it is null or not. If you know for sure it is not null there seems nothing wrong with your code. Try that, if(venue.getText().toString().equals("") || venue.getText() == null)
answers question: http://stackoverflow.com/q/21317090

http://stackoverflow.com/q/21321223
has comment: http://stackoverflow.com/comment/32168864
tagged with: generics
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32166682
type: Question
accepted answer: http://stackoverflow.com/a/23787612
tagged with: java
score: 4
has answer: http://stackoverflow.com/a/23787612
upvote count: 4
tagged with: jersey
has body: In our Jersey 1.9 code, we have an annotation processor that runs at build time and produces documentation of our REST API. It does this by looking for @Paths and then looking at consumed form beans and JResponses. Since JResponse could take a generic like public JResponse&lt;MyRepresentation&gt; findMyEntity(Long id) The API documentation generator would read through methods like that, see the generic return type, and be able to reflectively generate a response definition based on MyRepresentation. In Jersey 2.x, I don't see anything like JResponse. Is there a comparable generic return/response type available for Jersey 2.x resource methods?
downvote count: 0
answer count: 1
tagged with: jersey-2.0
has title: Jersey 2.5: Replacement for JResponse?
favorite count: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/32168153

http://stackoverflow.com/q/21336837
type: Question
has title: Can not draw anything after text rendering initialization code in lwjgl (Java)
has body: Hello I have two seperate initialization codes to switch between rendering 2d shapes and (2d) text in lwjgl. If the initialization code for rendering text is executed, the 2d shapes will not be drawn. I tried everything, and I found the problem line: GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); After I have done something with the glBlendFunc, I can only render tekst, and switching to the initialization code for rendering 2d shapes won't work anymore. Here are my 2 codes: Simple 2d rendering: GL11.glEnable(GL_BLEND); GL11.glMatrixMode(GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 1, -1); GL11.glMatrixMode(GL_MODELVIEW); GL11.glLoadIdentity(); Code for rendering text: GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL11.glClearDepth(1); GL11.glEnable(GL11.GL_BLEND); // Problem line GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glViewport(0,0, 800, 600); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 800, 600, 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); I think the problem is just a wrong OpenGl state, but how can I put the states right?
has answer: http://stackoverflow.com/a/21338560
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21337318
has answer: http://stackoverflow.com/a/21350213
type: UnansweredQuestion
tagged with: opengl
tagged with: rendering
tagged with: java
tagged with: lwjgl

http://stackoverflow.com/q/21321295
has comment: http://stackoverflow.com/comment/32140086
tagged with: java
has comment: http://stackoverflow.com/comment/32140677
has comment: http://stackoverflow.com/comment/32140216
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/32155112
has answer: http://stackoverflow.com/a/21345439
has comment: http://stackoverflow.com/comment/32177605
has comment: http://stackoverflow.com/comment/32140818
has comment: http://stackoverflow.com/comment/32173684
has comment: http://stackoverflow.com/comment/32139744
score: 0
has comment: http://stackoverflow.com/comment/32139037
has comment: http://stackoverflow.com/comment/32139533
answer count: 1
accepted answer: http://stackoverflow.com/a/21345439
has comment: http://stackoverflow.com/comment/32140304
has comment: http://stackoverflow.com/comment/32182734
tagged with: sockets
has body: I am having some major problems with my new project. I have a client app on my PC that is sending a simple String of data to the phone over the WiFi LAN connection. When recieved it should be split to its component parts and then an SMS sent. I'll be honest, this is my first Android project but I'm determined to get this working. When I send the command from my client, the app is failing and being caught in the catch labeled with Log.w("ServerRunnable", "Exception 2"); below. Id really appreciate some advice on this? I don't know why it won't work! public class ListeningService extends Service { private int iNotificationIcon = 1; Handler hHandler; Thread thServerThread = null; private ServerSocket oServerSocket = null; private static final String _S_DELIMITER = "##t2tDELIMITER##"; private static final int _I_SERVER_PORT = 50001; @Override public IBinder onBind(Intent arg0) { Toast.makeText(this, "Service Bound", Toast.LENGTH_LONG).show(); return null; } @Override public int onStartCommand(Intent oIntent, int iFlags, int iStartID) { addNotification(getString(R.string.app_name), "Server listening on xxx.xxx.xxx.xxx:ppppp", iNotificationIcon, true); /* Server Threading */ /*hHandler = new Handler() { @Override public void handleMessage(Message mMsg) { // TODO Auto-generated method stub showMessageBox(mMsg.getData().toString(), "Data Bundle", true); super.handleMessage(mMsg); } };*/ this.thServerThread = new Thread(new ServerRunnable()); //showToast("Thread Created but not started yet", false); this.thServerThread.start(); return START_STICKY; } public class ServerRunnable implements Runnable { public ServerRunnable() { /**/ } public void run() { Socket oSocket; try { oServerSocket = new ServerSocket(_I_SERVER_PORT); Log.w("ServerRunnable", "oServerSocket created"); } catch (Exception e) { e.printStackTrace(); Log.w("ServerRunnable", "Exception 1"); } while (!Thread.currentThread().isInterrupted()) { try { oSocket = oServerSocket.accept(); CommsThread commThread = new C…
tagged with: android
has comment: http://stackoverflow.com/comment/32140031
type: AnsweredQuestion
tagged with: serversocket
has title: Why am I getting NullPointerException with ServerSocket in Android
has comment: http://stackoverflow.com/comment/32178687
type: Question
linked to: http://stackoverflow.com/q/218384

http://stackoverflow.com/comment/32124224
score: 1
type: AnswerComment
type: Comment
has text: *"You could argue that I could pipe all my loading throught a single loading method surrounded by a try/catch, but this approach seems very tedious for me due to my larger number of code lines I would have to change to allow for this change for work."* Better now than later. *"I use getResourceAsStream"* That's good. It won't fail silently.
comment on: http://stackoverflow.com/a/21278918

http://stackoverflow.com/q/21197035
type: AnsweredQuestion
has body: As you can see in the screenshot, new_mean's capacity is 0 eventhough I've created it with an initial capacity of 2 therefore I'm getting index out of bounds exception. Does anyone know what I'm doing wrong? Update: Here's the code private static Vector&lt;Double&gt; get_new_mean( Tuple&lt;Set&lt;Vector&lt;Double&gt;&gt;, Vector&lt;Double&gt;&gt; cluster, Vector&lt;Double&gt; v, boolean is_being_added) { Vector&lt;Double&gt; previous_mean = cluster.y; int n = previous_mean.size(), set_size = cluster.x.size(); Vector&lt;Double&gt; new_mean = new Vector&lt;Double&gt;(n); if (is_being_added) { for (int i = 0; i &lt; n; ++i) { double temp = set_size * previous_mean.get(i); double updated_mean = (temp + v.get(i)) / (set_size + 1); new_mean.set(i, updated_mean); } } else { if (set_size &gt; 1) { for (int i = 0; i &lt; n; ++i) { double temp = set_size * previous_mean.get(i); double updated_mean = (temp - v.get(i)) / (set_size - 1); new_mean.set(i, updated_mean); } } else { new_mean = null; } } return new_mean; }
tagged with: java
has comment: http://stackoverflow.com/comment/31918597
downvote count: 5
has comment: http://stackoverflow.com/comment/31918603
type: Question
has answer: http://stackoverflow.com/a/21197083
has answer: http://stackoverflow.com/a/21197142
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/21197134
accepted answer: http://stackoverflow.com/a/21197083
possible better answer: http://stackoverflow.com/a/21197134
has comment: http://stackoverflow.com/comment/31918595
has title: Why is my Vector size 0?
upvote count: 2
score: -3

http://stackoverflow.com/comment/32106276
type: Comment
has text: See http://docs.spring.io/spring/docs/3.2.7.BUILD-SNAPSHOT/spring-framework-reference/htmlsingle/#orm-hibernate
comment on: http://stackoverflow.com/a/21302367
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32179379
comment on: http://stackoverflow.com/q/21343217
type: Comment
type: QuestionComment
has text: Ok thanks i'll checking that out now.
score: 0

http://stackoverflow.com/comment/32181424
comment on: http://stackoverflow.com/q/21345002
has text: Different _scenario_, same problem.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31973962
type: Comment
has text: You got a really interesting point, but... the `add()` method in `BigInteger` and `BigDecimal` classes doesn't change the object, returns a new one (so a `+` operator, not a `+=`). This probably could be implemented in `AtomicInteger` and `AtomicLong` as well.
comment on: http://stackoverflow.com/a/21199103
type: AnswerComment
score: 0

http://stackoverflow.com/a/21335990
type: Answer
has body: I guess your AddProductGUI extends JDialog . Then take a look to constructor from JDialog you have to set modal true. JDialog api. By the way in java by convention method's name starts with lower-case.
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/21335820
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21335820

http://stackoverflow.com/comment/31903966
has text: I dont think this is the case Ross, can you post some code? In my testing here I changed the setBounds call to the parent frame, still no scroll bar.
score: 1
comment on: http://stackoverflow.com/a/21189125
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32098832
score: 3
comment on: http://stackoverflow.com/a/21298647
type: AnswerComment
has text: Another problem with this benchmark is that it doesn't allow for JVM warmup effects.
type: Comment

http://stackoverflow.com/a/54558101
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21275819
has body: René's example is taking me a long way. Also the explanation how I get ClassLevel Annotations. But then I can only read ClassLevel Annotations Values if I have previously used a method annotation with "*@Around("execution(public * (..)) &amp;&amp; @annotation(com.mycompany.MyAnnotation)")"" How can I get around this? How can I trigger an Aspect if a ClassLevel Annotation is set without going through a Method Execution? I want to write a ClassLevel Annotation like @Documented @Retention(RetentionPolicy.RUNTIME) @Target(value = { ElementType.METHOD, ElementType.TYPE }) @EnableSwagger2 @Import(SwaggerConfiguration.class) public @interface EnableSwaggerApi { String controllerPackage() default "foo.bar.ctrl"; } It's importing the Configuration about "SwaggerConfiguration" where I want to receive the value of "controllerPackage" @Aspect public class SwaggerConfiguration { @Value("${tom.swagger.controller.package:foo.bar.notset}") private String controllerPackage; @Value("${tom.swagger.api.version:1.0.0}") private String apiVersion; @Value("${spring.application.name:MyApplication}") private String applicationName; @Around("execution(public * *(..)) &amp;&amp; @annotation(EnableSwaggerApi)") public void procede(ProceedingJoinPoint call) throws Throwable { MethodSignature signature = (MethodSignature) call.getSignature(); Method method = signature.getMethod(); Class&lt;?&gt; declaringClass = method.getDeclaringClass(); EnableSwaggerApi myAnnotation = declaringClass.getAnnotation(EnableSwaggerApi.class); System.err.println("1 -&gt; " + myAnnotation.controllerPackage()); // -&gt; tko.backend.spring.ctrl myAnnotation = method.getAnnotation(EnableSwaggerApi.class); System.err.println("2 -&gt; " + myAnnotation.controllerPackage()); // -&gt; tko.backend.spring.SOMEOTHERSTUFF // THIS WORKS, BUT JUST IF I USE THE @EnableSwaggerApi ON SOME METHOD! // NOT ON CLASS } @Bean public Docket swaggerApi() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelector…

http://stackoverflow.com/comment/32491693
has text: Did you got any exception?If so, please provide log.
comment on: http://stackoverflow.com/a/21374734
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21280303
score: 0
has body: When in the middle of developing a small app, I noticed that Eclipse searches in some other R.java instead of the R.java file in my project. Ex : I created a TextView (android:id="@+id/title"). When I tried to access it through my class (by using findViewById(R.id.title)), it showed some other R.java class which contained some id's I've never even used and doesn't contain the "title" id I gave my TextView. When I checked my R.java class, it's absolutely fine (there's the "title" id in it). And when I gave findViewById(my.package.R.id.title) instead of findViewById(R.id.title), it works fine. Anybody know why? PS : I tried cleaning the project and restarting Eclipse. Didn't work.
has comment: http://stackoverflow.com/comment/32065747
answer count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32066499
tagged with: java
has comment: http://stackoverflow.com/comment/32065816
tagged with: eclipse
type: Question
tagged with: r.java-file
has comment: http://stackoverflow.com/comment/32065886
has title: Eclipse searches in some other irrelevant R.java class for id's

http://stackoverflow.com/a/21333135
has body: I have only seen filename attribute being specified in Content-Disposition header, but not Content-Type header. Either way, this is a regex that correctly matches filename attribute, according to RFC 1806 (which references RFC 1521 and RFC 822. "filename=(?:([\\x21-\\x7E&&[^\\Q()<>[]@,;:\\\"/?=\\E]]++)|\"((?:(?:(?:\r\n)?[\t ])+|[^\r\"\\\\]|\\\\[\\x00-\\x7f])*)\")" Well, matching is one thing, but you still have to process the file name in the second case, at least to unquote special characters. (You still need to collapse linear-white-space: (?:(?:\r\n)?[\t ])+, as defined in RFC 822, to a single space, and replace non-printable characters).
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21331704
score: 1
has comment: http://stackoverflow.com/comment/32159254
accepted answer of: http://stackoverflow.com/q/21331704
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/21239088
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21238784
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21238784
type: Answer
has body: You don't need to have the context of the current screen, you can just use 'this'. If you have code in a parent class the reference to itself is the same in the parent and child. You can update your code like so: public class BaseActivity extends FragmentActivity { @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); //Removed the AddJournalEntry before this actionbarcolor = PreferenceData.getIntValues(this, "actionbarcolor"); if (actionbarcolor == 1) { ActionBar actionBar = getActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(Color.BLUE)); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowTitleEnabled(true); } else if (actionbarcolor == 2) { ActionBar actionBar = getActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(Color.RED)); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowTitleEnabled(true); } } } You can also style using themes in xml. If you want to get a style going fast I would highly recommend using Android Asset Studio Action Bar Style Generator. This is a great tool to product the required style and resource files for the action bar. Make sure to look through the files it generates to familiarize yourself with how to style the action bar using xml.

http://stackoverflow.com/comment/32170095
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21338821
has text: @crush in his matrix-example there are no saddle-points.
type: AnswerComment

http://stackoverflow.com/a/21323352
has comment: http://stackoverflow.com/comment/32142430
has body: Assuming all you logic for reading integers from file are correct and also hoping this is kind of home work. Though the following implementation is not the right approach, it just solves your purpose. All we are doing here is iterating all the elements in the array until it reaches the null and keep writing them into a buffer. public static void printArrayAndIntegerCount(Integer[] array, String filename) { StringBuilder sb = new StringBuilder(); int count = 0; for(Integer i : array) { if(i != null) { count++; sb.append("index = ").append(i).append(", element = ").append(array[i]).append("\n"); } else { break; } } System.out.println("number of integers in file \""+filename+"\" = "+count); System.out.println(sb); }
score: 0
answers question: http://stackoverflow.com/q/21323037
type: Answer
has comment: http://stackoverflow.com/comment/32143648

http://stackoverflow.com/comment/32033363
has text: Have you tried to copy-paste this code in your `~/.bashrc` file?
type: Comment
comment on: http://stackoverflow.com/q/21261616
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32047381
has text: Have you tried anything?
comment on: http://stackoverflow.com/q/21269630
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/21207442
score: 1
has comment: http://stackoverflow.com/comment/31936978
has comment: http://stackoverflow.com/comment/31937910
upvote count: 1
has comment: http://stackoverflow.com/comment/31936911
has comment: http://stackoverflow.com/comment/31938680
has comment: http://stackoverflow.com/comment/31937186
downvote count: 0
answers question: http://stackoverflow.com/q/21207423
has comment: http://stackoverflow.com/comment/31937457
type: Answer
has body: Java int and long types have size limits. For really huge numbers, look into the BigDecimal class. Another possibility is you are losing precision because of the conversion to double when using the Math.pow() function. Keep this all integer math by squaring numbers the old-fashioned-way: multiply. (i.e. just do 5*i*i-4) ..and yet another problem is with checkSquare doing the floating point math sand then testing for equality with ==. Find a pure-integer way to verify the square. (or, say, do the square root with the sqrt() function, round to an int, and then square it to see if you get back the original number. (Search stack overflow for 'float' and '==' to see why)

http://stackoverflow.com/comment/32160293
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21331992
has text: Neat idea, but imagine this. A = [10,5,7,9,26]. B = [10,2,5,7,9,26]. Inserting just one byte earlier on in the array will screw over all the data that follows. With this data set C = [0,-3,-2,-2,-17,26], which is not useful at all. A more intelligent algorithm would be able to determine that the data has simply moved one space to the right (something along the lines of [insert 2 at index 1]. I am having trouble writing such an algorithm though. Any ideas?

http://stackoverflow.com/q/21229489
has answer: http://stackoverflow.com/a/21229509
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/21229525
type: AnsweredQuestion
has body: Get / Set methods are there to protect my class fields. But since Java is working with reference my private fields are still getting exposed.. e.g. private Date d; Date getDate(){ return d; } void setDate(Date inD){ //Checks for inD d = inD; } //Still the issue is getDate().setHours(xyz); What is the correct approach? Because i dont want to change my Date without using setDate.
has answer: http://stackoverflow.com/a/21229545
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21229525
possible better answer: http://stackoverflow.com/a/21229545
has title: Get/Set in java and reference

http://stackoverflow.com/q/21268064
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21268205
score: 2
has answer: http://stackoverflow.com/a/21268200
upvote count: 2
tagged with: java
tagged with: multithreading
type: Question
has body: I found a piece of code where the thread seems to starve. Below is a simplified example. Is this an example for starvation? What is the reason why the thread does not terminate? Note: Changing the sleep to 1 will sometimes result in termination. The commented out Thread.yield() would solve the problem (for me). public class Foo { public static boolean finished = false; public static void main(String[] args) { Runnable worker = new Runnable() { @Override public void run() { try { Thread.sleep(10); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } finished = true; } }; new Thread(worker).start(); while (!finished) { // Thread.yield(); } } }
accepted answer: http://stackoverflow.com/a/21268200
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32044412
favorite count: 0
has title: Is this starvation?
possible better answer: http://stackoverflow.com/a/21268205

http://stackoverflow.com/q/21240004
answer count: 1
tagged with: android
has title: Having an issue calculating a negative number minus another number
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21240132
accepted answer: http://stackoverflow.com/a/21240132
tagged with: java
has body: So I've written a calculator and it works for all inputs except when you take a negative nuber and minus another one, it doesn't function. // calculation logic public void calculate() { for (int i = 0; i &lt; textField.length(); i++) { if (textField.getText().charAt(i) == '+') { result = Float.parseFloat(textField.getText().toString().substring(0, i)) + Float.parseFloat(textField.getText().toString().substring(i + 1, textField.length())); returnAnswer(decimalFormat.format(result)); } else if (textField.getText().charAt(i) == '-') { if (textField.getText().charAt(0) != '-') { result = Float.parseFloat(textField.getText().toString().substring(0, i)) - Float.parseFloat(textField.getText().toString().substring(i + 1, textField.length())); returnAnswer(decimalFormat.format(result)); } // I know I need to write code here but what? } else if (textField.getText().charAt(i) == '*') { result = Float.parseFloat(textField.getText().toString().substring(0, i)) * Float.parseFloat(textField.getText().toString().substring(i + 1, textField.length())); returnAnswer(decimalFormat.format(result)); } else if (textField.getText().charAt(i) == '÷') { result = Float.parseFloat(textField.getText().toString().substring(0, i)) / Float.parseFloat(textField.getText().toString().substring(i + 1, textField.length())); returnAnswer(decimalFormat.format(result)); } } resultDisplayed = true; } I've commented where I think the problem arises and needs codes to fix as it doesn't take the case of if there is a '-' sign at position [0]. But I'm not sure how to do this as the calculation just crashes the app.
type: Question
score: 0

http://stackoverflow.com/comment/32110165
score: 0
has text: What would you do if you where to build a class which had to purpose to store a lot of calculations AND it should be thread safe?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21305515

http://stackoverflow.com/comment/32000572
has text: Can you show how the dependency is defined?
comment on: http://stackoverflow.com/q/21236493
score: 0
type: Comment
type: QuestionComment

jface
tags question: http://stackoverflow.com/q/21308297
tag name: jface
type: Tag
tags question: http://stackoverflow.com/q/21231838
tags question: http://stackoverflow.com/q/21330747
tags question: http://stackoverflow.com/q/21316846
tags question: http://stackoverflow.com/q/21278512
tags question: http://stackoverflow.com/q/21247177

http://stackoverflow.com/comment/31938974
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21207930
has text: I couldn't understand any useful thing from the Log . I haves saved it you can watch it here https://drive.google.com/file/d/0Bw1rxewzORCqazl5TEtqeUFCcjg/edit?usp=sharing
type: Comment

http://stackoverflow.com/q/21255265
accepted answer: http://stackoverflow.com/a/21255748
tagged with: java
has answer: http://stackoverflow.com/a/36581993
tagged with: eclipse
has body: import ... public class TriggerJob { String jobStatus = &quot;&quot;; SchedulerMetaData metaData = null; public void rightNow(HashMap ParamMap) { AnotherProjectClass anp = new AnotherProjectClass(); anp.display(); } }
linked to: http://stackoverflow.com/q/11792812
has answer: http://stackoverflow.com/a/21255337
type: Question
possible better answer: http://stackoverflow.com/a/36581993
has answer: http://stackoverflow.com/a/38238905
downvote count: 0
has answer: http://stackoverflow.com/a/21255327
favorite count: 0
score: 31
has answer: http://stackoverflow.com/a/21259426
has answer: http://stackoverflow.com/a/21255748
has answer: http://stackoverflow.com/a/77368883
answer count: 10
has title: Can we call another project java class from our project in eclipse
linked to: http://stackoverflow.com/q/2335211
has comment: http://stackoverflow.com/comment/75250495
upvote count: 31
has comment: http://stackoverflow.com/comment/32021329
has answer: http://stackoverflow.com/a/21255351
has comment: http://stackoverflow.com/comment/75253162
has answer: http://stackoverflow.com/a/21255364
has answer: http://stackoverflow.com/a/21255346
has comment: http://stackoverflow.com/comment/32021273
type: AnsweredQuestion

http://stackoverflow.com/comment/32043568
score: 0
type: AnswerComment
type: Comment
has text: thank you. figured it out. i was trying to expand the array and it was wiping it....duh... i figured it out by debugging though. Didnt know how to do that thank you!
comment on: http://stackoverflow.com/a/21266120

http://stackoverflow.com/comment/32161258
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21332109
score: 1
has text: What's this `project-generator.jar`? Pls add a link to the project. It is definitely an issue with the tool you're trying to run, you should contact their support. I suspect they use Maven in the background but in a way that causes problem on your specific environment/platform/etc.

http://stackoverflow.com/comment/32179662
comment on: http://stackoverflow.com/a/21343371
type: AnswerComment
has text: Ok, but now looks like my MyCustomUserDetailsService is not in use, but is using Spring UserDetailsService. In method loadUserByUsername Y insert this line: System.out.println(login); but nothing not printed to shell. And no one exception...
score: 0
type: Comment

http://stackoverflow.com/comment/32081164
score: 0
has text: Actually i'm trying to read text from .txt file which contains UTF-8 encoded data.I want to find whether it contains a required word in that or not.How can i proceed with this
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21288971

http://stackoverflow.com/a/21290522
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21288971
upvote count: 1
has comment: http://stackoverflow.com/comment/32084597
has body: In fact you did everything fine, apart from some UTF-8 details. Java Reader/Writer/String handle Unicode. (Please close the readers too, and flush before close is not needed.) There is one thing: zero-width combining diacritical marks. Small c-circumflex, ĉ, is one character in the Unicode table, code-point U+0109, java "\u0109", but can also be two Unicode code-points: c, plus a zero-width ^, "e\u0302". There exists a text normalization in java which transforms into a specific form. String cCircumflex = "\u0109"; // c^ String cWithCircumflex = "c\u0302"; // c^ String cx = Normalizer.normalize(cCircumflex, Normalizer.Form.NFKC); String cx2 = Normalizer.normalize(cWithCircumflex, Normalizer.Form.NFKC); assert cx.equals(cx2); Which normalisation to chose from is more or less irrelevant, composition (...C) seeming most natural (and gives better font rendering), but decomposition ...D allows natural sorting to be "aäá...cĉ...eé...". You could even search words, with diacritical marks removed (cafe versus café): word = Normalizer.normalize(word, Normalizer.Form.NFKD); // Decompose. word = word.replaceAll("\\p{M}", ""); // Remove diacriticals. word = word.replaceAll("\\p{C}", ""); // Optional: invisible control characters. After running the original code It seems to work with me, without any change (Java 8). Though I had to put kannada.txt on C:\. ಅದರಲ್ಲಿ ್ರಪಂಚದಲ್ಲಿ ಅನೇಕ ಮಾಧ್ಯಮಗಳು ಇದೆ. ಆಕಾಶವಾಣಿ, ದೂರದರ್ಶನ, ವಾರ್ತಾ ಪತ್ರಿಕೆ ಮುಂತಾದವು ಅದರಲ್ಲಿ ದೂರದರ್ಶನಪ ಪ್ರಮುಖವಾದ ಕಾರ್ಯವನ್ನು ಹೊಂದಿದ್ದು ಅದನ್ನು ಚಿಕ್ಕವರಿಂದ ಹಿಡಿದು ದೊಡ್ಡವರವರೆಗೂ ನೋಡುತ್ತಾರೆ. ಇದಕ್ಕೆ ಇಂಗ್ಲೀಷ್‌ನಲ್ಲಿ ಟೆಲಿವಿಷನ್ ಎಂದು ಚಿಕ್ಕದಾಗಿ ಟಿ.ವಿ. ಎಂದು ಕರೆಯುವ ಬದಲು ಟಿ.ಕೆ. ಎಂದು ಕರೆಯಬೇಕಾಗಿತ್ತು. ಏಕೆಂದರೆ ಇದು ಟೆಲಿವಿಷನ್ ಅಷ್ಟೇ ಅಲ್ಲ ಟೈಮ್ ಕಿಲ್ಲರ್ ಕೂಡ. ಇದನ್ನು ಪ್ರಮುಖವಾಗಿ ವಯಸ್ಸಾದವರು ನೋಡುತ್ತಾರೆ. ಆದರೆ ಕೆಲಸಕ್ಕೆ ಬಂದ ಕೆಲಸದವರು ತಾವು ಕೆಲಸ ಮಾಡುವ ಬದಲು ಮನೆಯಲ್ಲಿ ಕುಳಿತು ನೋಡುತ್ತಾರೆ. true false ನನ್ನ ಪ್ರಕಾರ ಹೇಳಬೇಕಾದರೆ ಡಾಕ್ಷರ್‌ಗಳಿಗೆ ದುಡ್ಡು ಕೊಡುವ ಮಹಾಲಕ್ಷ್ಮಿ ಈ ಟಿ.ವಿ. false c:\kannada.txt
type: Answer

http://stackoverflow.com/comment/82280506
comment on: http://stackoverflow.com/a/21331561
score: 1
type: AnswerComment
type: Comment
has text: I have been trying to find how is the iteration of a TreeMap done internally but havnt been able to find it online. Can you please help me understand what traversal algorithm is used to traverse the Red black tree present internally.

http://stackoverflow.com/q/21286831
type: Question
has answer: http://stackoverflow.com/a/21339300
tagged with: concurrency
has answer: http://stackoverflow.com/a/21287085
accepted answer: http://stackoverflow.com/a/21287085
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/32077492
possible better answer: http://stackoverflow.com/a/21339300
has body: I have the following situation: I'm concurrently processing requests that have a given key. I can process any number of requests at the same time, as long as each key in progress is unique. I am a total rookie with concurrency in Java. There must be some pattern/utility/existing question for this, but I can't figure out what to search for. Hoping somebody could point me in the right direction, or comment on what I have so far. This class manages the locks: class LockMap&lt;K&gt; { private Map&lt;K, Object&gt; locks = new HashMap&lt;&gt;(); void acquireLock(K key) throws InterruptedException { Object lockObj; synchronized (locks) { lockObj = locks.get(key); if (lockObj == null) lockObj = new Object(); locks.put(key, lockObj); } synchronized (lockObj) { lockObj.wait(); } } void releaseLock(K key) { Object lockObj; synchronized (locks) { lockObj = locks.get(key); locks.remove(key); } if (lockObj != null) { synchronized (lockObj) { lockObj.notify(); } } } } Then I use the lock manager like this: // lockMap is instance of LockMap shared across all threads void doSomething(K key) { lockMap.acquireLock(key); try { // something } finally { lockMap.releaseLock(key); } } Is this the right way to do it?
favorite count: 0
has comment: http://stackoverflow.com/comment/32078022
type: AnsweredQuestion
score: 3
has title: Managing multiple locks
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/32115291
score: 0
comment on: http://stackoverflow.com/q/21308315
type: QuestionComment
type: Comment
has text: ok - that's weird - there might be something wrong with your attached sources - since the developer api says it's added in 19. Maybe your build sdk is set to 19 in the project->android preferences

http://stackoverflow.com/comment/32133148
comment on: http://stackoverflow.com/q/21318284
score: 0
type: Comment
type: QuestionComment
has text: What do you mean by it isn't completely random?

http://stackoverflow.com/a/21248629
downvote count: 0
has comment: http://stackoverflow.com/comment/32016487
has comment: http://stackoverflow.com/comment/32010944
has body: Problem: ArrayList&lt;String&gt; means you want an array-backed list that can hold String objects. This restricts the add method to only accept strings. The mistake you are making is that you are passing other non-String objects into the add method. Bad Answer 1: The easy way out is to change it to ArrayList&lt;Object&gt;, but this defeats the purpose of generics. The good thing is, you can now pass any object to the add method. The bad thing is, you can now pass any object to the add method. Bad Answer 2: You can create three ArrayList objects instead: ArrayList&lt;Education&gt; eduCategories [...] ArrayList&lt;Games&gt; gameCategories [...] ArrayList&lt;Medical&gt; medCategories [...] But this is also bad, because now you have three lists. Good Answer: You only need one list. For this, you have to create a proper hierarchy: Create an abstract class called Category: abstract class Category Create three classes Education, Games and Medical, all extending Category: class Education extends Category class Games extends Category class Medical extends Category Then you can create your list as: ArrayList&lt;Category&gt; categories = new ArrayList&lt;Category&gt;(); categories.add( new Education() ); categories.add( new Games() ) ; categories.add( new Medical() ) ; In this case, you're restricting the add method to accept only a Category object. Since Education, Games and Medical are all (by extension) Category objects, they will be accepted. But the following will fail: categories.add( "some string" ); //compilation error: String is not a Category So now we are able to take full advantage of generics (compile-time type protection) while allowing different sub-classes to be accepted by the same list.
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32012374
accepted answer of: http://stackoverflow.com/q/21248590
type: Answer
answers question: http://stackoverflow.com/q/21248590
score: 2
has comment: http://stackoverflow.com/comment/32010978

httpsurlconnection
type: Tag
tags question: http://stackoverflow.com/q/21286836
tag name: httpsurlconnection
tags question: http://stackoverflow.com/q/21212674

http://stackoverflow.com/a/21278666
has comment: http://stackoverflow.com/comment/32064890
has comment: http://stackoverflow.com/comment/32070653
has comment: http://stackoverflow.com/comment/32063996
upvote count: 2
has comment: http://stackoverflow.com/comment/32063279
has comment: http://stackoverflow.com/comment/32063125
type: Answer
answers question: http://stackoverflow.com/q/21278521
has comment: http://stackoverflow.com/comment/32063070
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32063199
has body: Use same bundle object. Bundle bund = new Bundle(); bund.putDoubleArray(endLatitudeStr, endLatitude); bund.putDoubleArray(endLongitudeStr, endLongitude); intent.putExtras(bund); startActivity(intent); Intent intent = getIntent(); mXmlRpcUrl = intent.getStringExtra("XmlRpcUrl"); mSessionID = intent.getStringExtra("SessionID"); mGetSavedTripFunc = intent.getStringExtra("GetSavedTripFunc"); Bundle bund = intent.getExtras(); endLatitude = bund.getDoubleArray(endLatitudeStr); endLongitude = bund.getDoubleArray(endLongitudeStr);
has comment: http://stackoverflow.com/comment/32064602

http://stackoverflow.com/q/21303941
has title: How to set a IP address to the tomcat?
type: UnansweredQuestion
tagged with: web-services
tagged with: ip-address
answer count: 4
has comment: http://stackoverflow.com/comment/32107678
has body: I have a Tomcat Server where a .war file is running. I can run the .war file when typing localhost:8080/.. in the browser. But I have to reach this .war file over network. So I have a external IP with a domain name on it. And i should reach this .war file when typing xx.xxx.xxx.xxx:8080/.. in browser. So this IP address should point to its localhost and further to the .war file. How can I achieve this?
tagged with: java
has comment: http://stackoverflow.com/comment/32107634
linked to: http://stackoverflow.com/q/18617
downvote count: 1
has comment: http://stackoverflow.com/comment/32107613
type: Question
has comment: http://stackoverflow.com/comment/32109506
linked to: http://stackoverflow.com/q/4756039
has comment: http://stackoverflow.com/comment/32107815
tagged with: tomcat
has answer: http://stackoverflow.com/a/21304208
upvote count: 8
has comment: http://stackoverflow.com/comment/32107725
has answer: http://stackoverflow.com/a/21304216
has comment: http://stackoverflow.com/comment/32107852
has comment: http://stackoverflow.com/comment/32107891
has answer: http://stackoverflow.com/a/21304175
has comment: http://stackoverflow.com/comment/32107600
has comment: http://stackoverflow.com/comment/32107765
score: 7
has answer: http://stackoverflow.com/a/21304156
favorite count: 0
has comment: http://stackoverflow.com/comment/32108837
has comment: http://stackoverflow.com/comment/32107763

http://stackoverflow.com/a/21281570
upvote count: 19
accepted answer of: http://stackoverflow.com/q/21281354
has comment: http://stackoverflow.com/comment/95653736
answers question: http://stackoverflow.com/q/21281354
has comment: http://stackoverflow.com/comment/62335887
type: AcceptedAnswer
downvote count: 0
score: 19
type: Answer
has body: Add "cmd.exe /c" at the beginning of your command string, that should do the trick. The /c parameter will make the cmd finish and return it to the Java process. Without it, the process will hang.

cocos2d-android
type: Tag
tags question: http://stackoverflow.com/q/21208772
tag name: cocos2d-android

http://stackoverflow.com/comment/32029748
has text: Do I infer from your answer that you see no reason for this, then? You seem to have skated around the question with a bunch of info on interning.
comment on: http://stackoverflow.com/a/21260164
type: AnswerComment
type: Comment
score: 4

http://stackoverflow.com/comment/32071260
score: 0
type: Comment
has text: Use a ConcurrentHashMap<Integer,Shared> then.
comment on: http://stackoverflow.com/a/21283455
type: AnswerComment

http://stackoverflow.com/a/21300052
score: 4
accepted answer of: http://stackoverflow.com/q/21299597
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32103282
answers question: http://stackoverflow.com/q/21299597
has comment: http://stackoverflow.com/comment/32101424
has comment: http://stackoverflow.com/comment/32101455
has comment: http://stackoverflow.com/comment/32101228
has body: Make sure you have added the GridLayout library project in your project as library. Try out as below to import the library project of GridLayout File-&gt;Import-&gt;Existing Android code into workspace Specify android-sdk-[path]/extras/android/support/v7/gridlayout Make sure You import and copy the GridLayout project as an Android library project into your workspace. After import library project add it into your project as library as below: Right click your Project-&gt;Properties-&gt;Java Build Path-&gt;Order and Export where tick mark all option.
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/32101302

http://stackoverflow.com/q/21334607
has comment: http://stackoverflow.com/comment/32168942
tagged with: java
linked to: http://stackoverflow.com/q/19634899
tagged with: java-web-start
has comment: http://stackoverflow.com/comment/40729328
has comment: http://stackoverflow.com/comment/32164108
tagged with: glassfish
score: 0
has comment: http://stackoverflow.com/comment/32162340
has title: WebStart of Java EAR application failing from Glassfish 3.1.2.2
has comment: http://stackoverflow.com/comment/32167662
answer count: 0
type: UnansweredQuestion
has body: I built a small test Java EE Entreprise Application using NetBeans. Everything works fine in NetBeans (version 7.3) when I run/debug it. I'm now trying to deploy the test app using WebStart. To do so, I have setup a GlassFish server of the same version that is in NetBeans (GF 3.1.2.2) and I have the JDK Version 7 U 51 installed on the machine. For right now, I'm trying to run the WebStart app on the same machine that GlassFish is on so I'm guessing it's using JRE 7U51 also. However, when I launch the client application from within GlassFish admin page (app deployed fine), I get a NullPointerException. Here's the full exception trace: java.lang.NullPointerException at java.io.StringReader.&lt;init&gt;(Unknown Source) at org.glassfish.appclient.client.JWSAppClientContainerMain.insertMaskingLoader(JWSAppClientContainerMain.java:186) at org.glassfish.appclient.client.JWSAppClientContainerMain.main(JWSAppClientContainerMain.java:132) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.sun.javaws.Launcher.executeApplication(Unknown Source) at com.sun.javaws.Launcher.executeMainClass(Unknown Source) at com.sun.javaws.Launcher.doLaunchApp(Unknown Source) at com.sun.javaws.Launcher.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Here's the JNPL file I get from GlassFish when I want to WebStart the application: http://pastebin.com/HPddJA3a Please note that the JNPL file is autogenerated by GlassFish... my EAR doesn't contain one. This is my first deployment and I've tried many things.... please help! :) EDIT: More details on how I deploy and access the client app: I uploaded the EAR file to Glassfish using the admin console (port 4848) and that deployment is successful (no error messages). Then, in the admin console, I see all my EE components (EJB, app jar, etc) and I…
has comment: http://stackoverflow.com/comment/32163362
type: Question
tagged with: glassfish-3

http://stackoverflow.com/a/68619247
downvote count: 0
has body: If for some reason anybody still needs this in SB2+ we had to slightly adjust lifecycleEvent method @Override public void lifecycleEvent(LifecycleEvent event) { if (event.getType().equals(Lifecycle.CONFIGURE_START_EVENT)) { URL location = this.getClass().getProtectionDomain().getCodeSource().getLocation(); if (new LocalDevelDetection().isDocker()){ try { //This is necessary to make JSP work in docker --> not sure which of those mounts actually does the trick but I think /YOUR_SB_APP_NAME one works for docker-compose and the other one for "vanilla docker" (non-compose) context.getResources().createWebResourceSet(WebResourceRoot.ResourceSetType.RESOURCE_JAR, "/<<YOUR_SB_APP_NAME>>", new URL("jar:file:/<<PATH_TO_YOUR_SB_APP>>.jar!/"), "/META-INF/resources"); context.getResources().createWebResourceSet(WebResourceRoot.ResourceSetType.RESOURCE_JAR, "/", new URL("jar:file:/<<PATH_TO_YOUR_SB_APP>>.jar!/"), "/META-INF/resources"); } catch (MalformedURLException e) { throw new RuntimeException(e); } } else { if (ResourceUtils.isFileURL(location)) { // when run as exploded directory String rootFile = location.getFile(); if (rootFile.endsWith("/BOOT-INF/classes/")) { rootFile = rootFile.substring(0, rootFile.length() - "/BOOT-INF/classes/".length() + 1); } if (!new File(rootFile, "META-INF" + File.separator + "resources").isDirectory()) { return; } try { location = new File(rootFile).toURI() .toURL(); } catch (MalformedURLException e) { throw new IllegalStateException("Can not add tomcat resources", e); } } String locationStr = location.toString(); if (locationStr.endsWith("/BOOT-INF/classes!/")) { // when run as fat jar locationStr = locationStr.substring(0, locationStr.length() - "/BOOT-INF/classes!/".length() + 1); try { location = new URL(locationStr); } catch (MalformedURLException e) { throw new IllegalStateException("Can not add tomcat resources", e); } } this.context.getResources() .createWebResourceSet(WebResourceRoot.ResourceSetType.RESOURCE_JAR, "/", location, "/MET…
score: 1
answers question: http://stackoverflow.com/q/21243690
upvote count: 1
type: Answer

http://stackoverflow.com/a/21214654
upvote count: 1
has body: The serviceRemoved() method is only called when the removed device unregisters itself before shutting down. JmDNS is not actively checking the presence of the devices but just listening to the broadcast messages. If the removed device has not unregistered itself JmDNS does never know it util the timeout hits in (probably 30minutes in your case). One possibility to check if a device is still there is to actively ask it. There are several ways to do this. I dont know if JmDNS has already something build if for that.
accepted answer of: http://stackoverflow.com/q/21202240
answers question: http://stackoverflow.com/q/21202240
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1

rest
tags question: http://stackoverflow.com/q/21188159
tags question: http://stackoverflow.com/q/21316641
tags question: http://stackoverflow.com/q/21282987
tags question: http://stackoverflow.com/q/21283406
tags question: http://stackoverflow.com/q/21266131
tags question: http://stackoverflow.com/q/21319009
tags question: http://stackoverflow.com/q/21203886
tags question: http://stackoverflow.com/q/21247425
tags question: http://stackoverflow.com/q/21279617
tags question: http://stackoverflow.com/q/21336984
tags question: http://stackoverflow.com/q/21197622
tags question: http://stackoverflow.com/q/21306022
tags question: http://stackoverflow.com/q/21311483
tags question: http://stackoverflow.com/q/21321223
tags question: http://stackoverflow.com/q/21276988
tags question: http://stackoverflow.com/q/21289217
tags question: http://stackoverflow.com/q/21245753
tags question: http://stackoverflow.com/q/21248195
tags question: http://stackoverflow.com/q/21333567
tags question: http://stackoverflow.com/q/21269968
tags question: http://stackoverflow.com/q/21295940
tags question: http://stackoverflow.com/q/21256504
tags question: http://stackoverflow.com/q/21245712
tags question: http://stackoverflow.com/q/21192879
tags question: http://stackoverflow.com/q/21201946
tags question: http://stackoverflow.com/q/21228374
tags question: http://stackoverflow.com/q/21280257
tags question: http://stackoverflow.com/q/21302446
type: Tag
tag name: rest
tags question: http://stackoverflow.com/q/21258431
tags question: http://stackoverflow.com/q/21280324
tags question: http://stackoverflow.com/q/21349030
tags question: http://stackoverflow.com/q/21195937
tags question: http://stackoverflow.com/q/21288922
tags question: http://stackoverflow.com/q/21190472
tags question: http://stackoverflow.com/q/21294675
tags question: http://stackoverflow.com/q/21257581
tags question: http://stackoverflow.com/q/21323005

http://stackoverflow.com/comment/31965119
has text: Original poster, you should show where your cardImages folder is relative to your class files.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21222937
score: 0

http://stackoverflow.com/a/21332346
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21332017
type: Answer
has body: Sound like Your compiler plugin configuration is not complete Your Jdk level should be greater than 1.5 example pom.xml configuration org.apache.maven.plugins maven-compiler-plugin 3.1 1.7 1.7
upvote count: 2

http://stackoverflow.com/a/21304346
score: 0
answers question: http://stackoverflow.com/q/21302618
type: Answer
has body: I think that in this case it should be something like (for show() method): def show(Long secUserId, Long secRoleId) { def secUserSecRoleInstance = SecUserSecRole.get(secUserId, secRoleId) if (!secUserSecRoleInstance) { flash.message = message(code: 'default.not.found.message', args: [message(code: 'secUserSecRole.label', default: 'SecUserSecRole'), id]) redirect(action: "list") return } [secUserSecRoleInstance: secUserSecRoleInstance] }

http://stackoverflow.com/a/21253077
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/21252905
has comment: http://stackoverflow.com/comment/32233317
type: Answer
accepted answer of: http://stackoverflow.com/q/21252905
has body: Here is an example for you: public class Main { public static void main(String args[]) { String example[] = { "item 1", "item 2", "item 3", "item 4", "item 5", "item 6", "item 7", "item 8", "item 9", "item 10" }; for (int i = 0; i &lt; example.length; i += 2) { System.out.println(example[i]); } } } output: item 1 item 3 item 5 item 7 item 9

http://stackoverflow.com/a/21185992
answers question: http://stackoverflow.com/q/21185838
type: Answer
has body: If your spring application loads both context-files it should work out of the box. If not, you have 2 options: Make a parent context-file that includes both context-files. Include one context file from the other one. So in this case, I'm assuming that your webApplicationContext.xml will have an include of the dataApplicationContext.xml.
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/21246473
has answer: http://stackoverflow.com/a/21246498
type: AnsweredQuestion
tagged with: java
has body: I'm trying to connect to my sql database on localhost. With the following code : try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException e) { System.out.println("JdbcOdbcDriver wasn't found"); e.printStackTrace(); } Connection connection = null; try { connection = DriverManager.getConnection("jdbc:mysql://localhost/testBase", "root", ""); Statement statement = connection.createStatement(); ResultSet res = statement.executeQuery(""); } catch(SQLException e){ System.out.println(e); } finally { if(connection != null) { try { connection.close(); } catch (SQLException e) { e.printStackTrace(); } } } I have 2 questions related to this code : I am using the sun.jdbc.odbc.JdbcOdbcDriver driver because it seem that it was the only available on my system, however I've read that it's a windows component... Is there a way to make it platform independent (or is it already) ? The second catch outputs a java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/ Which is quite annoying and I don't seem to be able to find a way to work... Thanks for your help !
accepted answer: http://stackoverflow.com/a/21246498
type: Question
has title: Connection to a sql database questions
score: 0
answer count: 1

http://stackoverflow.com/q/21228344
type: Question
has title: Is it possible to ask series of questions without generate large amount of code?
score: 0
answer count: 2
tagged with: while-loop
type: UnansweredQuestion
has body: I am creating a program in Java, using eclipse. The program asks series of questions from the user and until they have answered it correctly it will ask them again and again and, once it gets the correct answer it will store it in a variable for later use. below is my code; int waitseconds; int favouritenumber; int hoursofsleep; do { String waitsecondsR = JOptionPane.showInputDialog("How many seconds would you like to wait for out of 1 - 7?"); waitseconds = Integer.parseInt(waitsecondsR); } while (waitseconds &lt; 1 || waitseconds &gt; 10); do { String favouritenumberR = JOptionPane.showInputDialog("What is your favourite number out of 1 and 2?"); favouritenumber = Integer.parseInt(favouritenumberR); } while (favouritenumber &lt; 1 || favouritenumber &gt; 2); do { String hoursofsleepR = JOptionPane.showInputDialog("How many hours do you sleep for? between 1-8?"); hoursofsleep = Integer.parseInt(hoursofsleepR); } while (hoursofsleep &lt; 1 || hoursofsleep &gt; 8); These are the first three statements / questions that I have which the user will need to answer and I will probably end up with like 10-12 of these statements in one class, is it possible to make these any shorter? and also I have 2 more questions. Is it possbile to prevent the user from putting in letters answers and if there do, it will provide them with errors? e.g. if there put one instead of 1 or O then the program should ask them to enter again. with the code I have, when you run it a Input Dialog and there user has to enter the answer but if the user clicks cancel or cross icon at the top then java is displaying error messages in the console, how can I stop this from happening? like this; Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: null at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at ExpressTrain.ExpressTrain(ExpressTrain.java:46) at GUIDesign.Express(GUIDesign.java:149) at GUIDesign$1.actionPerformed(GUIDesign.java:80) at jav…
has answer: http://stackoverflow.com/a/21228482
has answer: http://stackoverflow.com/a/21228530
tagged with: java
tagged with: loops
tagged with: eclipse

http://stackoverflow.com/q/21223842
favorite count: 0
has body: I am trying to compare two arrays. I initialise them: public static int [][] craftarray = {{0,0,0},{0,0,0},{0,0,0}}; public static int [][] stone = {{0,0,0},{0,0,0},{0,0,0}}; When i tried to compare them using: Inventory.craftarray.equals(Craft.stone) It did not say they were equal so i printed out the arrays. the craft array came back with 0's while stone returned ' [[I@44ffb2 '. Why is this happening?
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5440039
has answer: http://stackoverflow.com/a/21223849
accepted answer: http://stackoverflow.com/a/21223849
tagged with: java
score: -1
type: Question
downvote count: 2
upvote count: 1
answer count: 1
tagged with: arrays
has title: java strange array comparing
duplicate of: http://stackoverflow.com/q/5440039

ms-word
tags question: http://stackoverflow.com/q/21238312
tag name: ms-word
type: Tag
tags question: http://stackoverflow.com/q/21230367

http://stackoverflow.com/q/21226758
duplicate of: http://stackoverflow.com/q/1023068
has answer: http://stackoverflow.com/a/21226876
has answer: http://stackoverflow.com/a/21227126
has comment: http://stackoverflow.com/comment/31971590
tagged with: deserialization
has comment: http://stackoverflow.com/comment/31971595
has answer: http://stackoverflow.com/a/21226792
tagged with: serialization
type: Question
has title: Why Serializable interface does not contain methods or fields in java?
tagged with: java
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/1023068
has body: So my question is, why serializable interface does not contain methods or fields? When we can use Serializable interface? What happen during deserialization?
linked to: http://stackoverflow.com/q/21015649
type: UnansweredQuestion

http://stackoverflow.com/a/63408616
answers question: http://stackoverflow.com/q/21278307
score: 0
has body: The same architecture has bugged my mind for a while now and it will be a long story if I want to mention all the drawbacks and advantages of it so let me jump into the implementation. The second scenario is valid, but as you mentioned its better to perform the crud actions on same websocket session. This shall remove the need for HTTP handshakes on every request, and reduces the body size of messages, therefore you will have better latency. Meanwhile, you already have a persisting connection to a server, so why not make good use out of it? I searched around for a while and after 6 years from your question, I still couldn't find any websocket protocols that can make this happen, so I decided to work on that by myself cause I needed it for another dummy project. Another advantage of such protocol could be that it doesn't require much changes to your already written controllers. So it should be able to support Spring Framework (for example) annotations and make websocket endpoints out of it. The hard part about implementing such protocol in another framework like spring is that as its not nice to create ServletRequest and ServletResponse and convert them to your own websocket protocol, you loose some advantages. For example, any http filter you have written in your application till that moment, will be meaningless because its not really easy to pass your websocket messages through those filters. About the protocol itself: I decided everything to be passed through json format, alongside a unique id for each request so we can map callbacks on client side to the request id. And of course there is a filter chain to add your filters to it. Another hard to deal thing here is Spring Security as that too works like http filters in some cases. In my own lib I could finally handle annotations like @PreAuthorize but if you are using antMatchers in your HTTP Security Config, it would be a problem. Therefore, creating websocket adapter to call http controllers will have many drawb…
type: Answer

http://stackoverflow.com/comment/32174138
score: 0
has text: http://stackoverflow.com/questions/6077141/android-webview-how-to-code-the-back-button
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21340873

http://stackoverflow.com/comment/32190215
comment on: http://stackoverflow.com/a/21218166
score: 0
type: Comment
has text: I'd checked my file content and its location is correct but still can't get an output in my eclipse console. :(
type: AnswerComment

http://stackoverflow.com/a/21232324
answers question: http://stackoverflow.com/q/21232185
type: Answer
downvote count: 0
has body: You can use java.text.MessageFormat for this: String[] args = {"Princess", "Luna", "Stackoverflow"}; String text = MessageFormat.format("Bla bla, {1}, and {2} and {3}", args);
score: 1
upvote count: 1

http://stackoverflow.com/comment/32004859
has text: Also, are you pooling connections correctly? this is the suggested way `var mysql = require('mysql'); var pool = mysql.createPool(...); pool.getConnection(function(err, connection) { // Use the connection connection.query( 'SELECT something FROM sometable', function(err, rows) { // And done with the connection. connection.release(); // Don't use the connection here, it has been returned to the pool. }); });` https://github.com/felixge/node-mysql
score: 0
comment on: http://stackoverflow.com/q/21244512
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32152761
comment on: http://stackoverflow.com/q/21329099
type: Comment
type: QuestionComment
score: 1
has text: No, log4j wouldn't get any kind of "hook" to log it, unless you were calling log4j yourself.

http://stackoverflow.com/a/21236361
upvote count: 1
answers question: http://stackoverflow.com/q/21235716
accepted answer of: http://stackoverflow.com/q/21235716
type: AcceptedAnswer
downvote count: 0
has body: I have been able to reproduce the error that you are seeing. You can use the following bug to track our progress on this issue: http://bugs.eclipse.org/426126
type: Answer
score: 1

http://stackoverflow.com/q/21228559
has answer: http://stackoverflow.com/a/21229609
has comment: http://stackoverflow.com/comment/31974675
has comment: http://stackoverflow.com/comment/31975979
has title: displaying multiple lists in a single row/table using foreach
linked to: http://stackoverflow.com/q/21190153
upvote count: 1
accepted answer: http://stackoverflow.com/a/21229609
type: Question
tagged with: foreach
type: AnsweredQuestion
tagged with: list
has body: i am new to jstl.. i am trying to display 4 lists in 1 row in a table.. i followed this " how to code foreach involving 3 lists in jstl? " <c:forEach items="${actionList}" var="action" varStatus="counter"> <c:out value= "${action.cut}"/> <c:out value= "${dustList[counter.count].dust}"/> <c:out value= "${myList[counter.count].name}"/> <c:out value= "${megaList[counter.count].megaprice}"/> well the result was i got the first column alrt.. but the rest of the columns aint showing anything.. the servlet gets the values alrt.. request.setAttribute("actionList", actionList); request.setAttribute("dustList", dustList); request.setAttribute("myList", myList); request.setAttribute("megaList", megaList); the passing is also happening correctly.. the calling is also correct.. so where am i going wrong? why is only one list being displayed?? console is displaying no error ..
score: 1
tagged with: java
tagged with: jstl
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31976205
favorite count: 0

http://stackoverflow.com/comment/32186987
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21348187
has text: Ok, your `save` method doesn't even use the view parameter that you defined, you can completely remove it. I will update my answer to match your code.

google-app-engine
tags question: http://stackoverflow.com/q/21293628
tag name: google-app-engine
tags question: http://stackoverflow.com/q/21223160
tags question: http://stackoverflow.com/q/21185922
tags question: http://stackoverflow.com/q/21263216
tags question: http://stackoverflow.com/q/21346933
type: Tag
tags question: http://stackoverflow.com/q/21283080
tags question: http://stackoverflow.com/q/21258033
tags question: http://stackoverflow.com/q/21283339
tags question: http://stackoverflow.com/q/21230361
tags question: http://stackoverflow.com/q/21324065
tags question: http://stackoverflow.com/q/21336421
tags question: http://stackoverflow.com/q/21342370
tags question: http://stackoverflow.com/q/21345177
tags question: http://stackoverflow.com/q/21244892
tags question: http://stackoverflow.com/q/21283507
tags question: http://stackoverflow.com/q/21277665
tags question: http://stackoverflow.com/q/21318934
tags question: http://stackoverflow.com/q/21248341
tags question: http://stackoverflow.com/q/21317978
tags question: http://stackoverflow.com/q/21198836
tags question: http://stackoverflow.com/q/21276421
tags question: http://stackoverflow.com/q/21236314
tags question: http://stackoverflow.com/q/21347810
tags question: http://stackoverflow.com/q/21324864
tags question: http://stackoverflow.com/q/21238716
tags question: http://stackoverflow.com/q/21210529
tags question: http://stackoverflow.com/q/21274485
tags question: http://stackoverflow.com/q/21329071
tags question: http://stackoverflow.com/q/21226929

http://stackoverflow.com/a/21309484
has comment: http://stackoverflow.com/comment/32158279
has comment: http://stackoverflow.com/comment/32186913
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/21309266
type: Answer
has comment: http://stackoverflow.com/comment/32244172
answers question: http://stackoverflow.com/q/21309266
has body: Your server will first create a connection with the client through the accept method. If you wish to have multiple clients you will need to change your code accordingly to accept that. On the client side, you're using \n to delineate the end of a message. This will work fine. Every time you send a new message use \n to indicate the end of the message. On the server side, you should continue reading from I/O until you see the \n. At that point you have received the entire message. Process it and than start listening again. Edit: Since you are waiting for the name of the client, you could simply do the following on the server: BufferedWriter bout = new BufferedWriter(new OutputStreamWriter(client.getOutputStream())); BufferedReader bin = new BufferedReader(new InputStreamWriter(client.getInputStream())); // Wait for incoming name from client. String name = bin.readline(); System.out.println(name); // Send a reply. bout.write("Thank you\n"); bout.flush(); Similarly, on the client (assuming bin and bout are defined the same as above): // Send name to server. bout.write("Name\n"); bout.flush(); // Get a response from the server and print to console. String response = bin.readline(); System.out.println(response);
has comment: http://stackoverflow.com/comment/32160505

http://stackoverflow.com/a/21374990
has comment: http://stackoverflow.com/comment/32257951
has body: Option 2. Latency is one of the biggest factors to look at in making a TCP connection. Because you are in a private network, The cost of creating a new non-SSL connection is insignificant.
has comment: http://stackoverflow.com/comment/32235441
answers question: http://stackoverflow.com/q/21330421
score: 0
type: Answer

http://stackoverflow.com/a/21209904
has comment: http://stackoverflow.com/comment/32611940
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/32611190
has body: You have found a bug (two, actually) in the JDK. Congratulations! (Or, condolences, I suppose). First bug is that it's a "fatal" error, but it will call ErrorListener.error() instead of ErrorListener.fatalError(). If you put a println statement in error() in your example, you'll see it's being called. The second bug is that ignoring the first one above, what you are doing should work. But it doesn't. Throwing your example in the debugger and delving down into the JDK I found that the error listener isn't propagated down into the underlying XMLScanner and XMLErrorReporter. What is happening is that the XMLErrorReporter is instantiating a com.sun.org.apache.xerces.internal.util.DefaultErrorHandler and calling its fatalError() method which is what is spitting that [fatal error] message out to stderr. Specifically, this happens at line 422 of com.sun.org.apache.xerces.internal.impl.XMLErrorReporter After that it rethrows the exception up the stack and the TransformerImpl fires it to your listener. What should be happening is that those underlying classes should either have a proxy to the higher level listener you passed in, or a local no-op listener should be created to silence the output in the lower levels. I suspect it's the latter since otherwise you'd get notified twice. I'll need to look at the abstraction tree more closely and debug the construction chain to find out why that's not happening but in short, unfortunately this is a bug in the JDK and there isn't a way to control/prevent it. (This is testing on Java 1.7.0_25-b15).
upvote count: 7
has comment: http://stackoverflow.com/comment/31945925
has comment: http://stackoverflow.com/comment/31945720
answers question: http://stackoverflow.com/q/21208325
type: Answer

import
type: Tag
tag name: import
tags question: http://stackoverflow.com/q/21215861
tags question: http://stackoverflow.com/q/21225151
tags question: http://stackoverflow.com/q/21319375
tags question: http://stackoverflow.com/q/21315758
tags question: http://stackoverflow.com/q/21213055
tags question: http://stackoverflow.com/q/21262554

http://stackoverflow.com/comment/32000116
has text: one thing, ...so when do you use extends Throwable?
type: AnswerComment
comment on: http://stackoverflow.com/a/21242696
score: 0
type: Comment

http://stackoverflow.com/q/21205193
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21215604
downvote count: 0
tagged with: java
tagged with: apache-storm
type: Question
has answer: http://stackoverflow.com/a/21215604
tagged with: intellij-idea
upvote count: 6
answer count: 2
has title: How to build and Run Storm Topology within Intellij IDEA
favorite count: 0
has body: I followed Storm Starter instructions and imported Twitter Storm in IntelliJ. For sake of testing I edited ExclaimationToplogy a bit and used following Maven command to build and run it: mvn -f m2-pom.xml compile exec:java -Dstorm.topology=storm.starter.ExclamationTopology But I am more interested to build and run within IDE rather than from command line. What actions do I need to perform? Thanks
possible better answer: http://stackoverflow.com/a/42172105
score: 6
tagged with: maven
has answer: http://stackoverflow.com/a/42172105

http://stackoverflow.com/comment/32068069
type: QuestionComment
has text: I agree with Frank: in Oracle you usually don't need temp tables the way you do in SQL Server (you could e.g. use a CTE instead)
comment on: http://stackoverflow.com/q/21281646
score: 1
type: Comment

http://stackoverflow.com/q/21343141
accepted answer: http://stackoverflow.com/a/21343173
answer count: 2
possible better answer: http://stackoverflow.com/a/21343332
downvote count: 0
has answer: http://stackoverflow.com/a/21343173
favorite count: 0
upvote count: 1
tagged with: regex
type: AnsweredQuestion
has body: I have a url, in it I have NotificationId=2418, I need to pull out that number obviously anything can be before and after that. Pulling out NotificationId i can do but how can i pull the number after? I am using Java.
has answer: http://stackoverflow.com/a/21343332
score: 1
tagged with: java
has title: How to get a number after a word out of a url using regex
type: Question
has comment: http://stackoverflow.com/comment/32178124

http://stackoverflow.com/comment/31975122
has text: You can use `List<String>()` and just add as you want, after you can call `stringlist.toArray()`
comment on: http://stackoverflow.com/a/21228843
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/32157644
comment on: http://stackoverflow.com/q/21331174
type: Comment
score: 1
has text: Is passing values which are not Strings permitted? The only documentation I can find is [at xml.apache.org](http://xml.apache.org/xalan-j/usagepatterns.html#params), which states: *Xalan-Java 2 processes string parameters.*
type: QuestionComment

encryption
tags question: http://stackoverflow.com/q/21290382
tags question: http://stackoverflow.com/q/21264678
tag name: encryption
tags question: http://stackoverflow.com/q/21321247
tags question: http://stackoverflow.com/q/21254035
tags question: http://stackoverflow.com/q/21190369
tags question: http://stackoverflow.com/q/21298566
tags question: http://stackoverflow.com/q/21217741
tags question: http://stackoverflow.com/q/21220878
tags question: http://stackoverflow.com/q/21300109
tags question: http://stackoverflow.com/q/21194536
tags question: http://stackoverflow.com/q/21318166
tags question: http://stackoverflow.com/q/21234355
tags question: http://stackoverflow.com/q/21252078
tags question: http://stackoverflow.com/q/21188807
tags question: http://stackoverflow.com/q/21237181
tags question: http://stackoverflow.com/q/21347992
tags question: http://stackoverflow.com/q/21331620
tags question: http://stackoverflow.com/q/21250330
type: Tag

http://stackoverflow.com/a/21300121
has comment: http://stackoverflow.com/comment/32101260
type: Answer
has comment: http://stackoverflow.com/comment/32101578
answers question: http://stackoverflow.com/q/21299873
has comment: http://stackoverflow.com/comment/32360036
has body: You'd generally need a 3rd process that acts a "reverse proxy". All the requests go to that process and it will route the request and response to whichever server is the active one. This 3rd process would also be looking at the machines to measure CPU (using JMX or whatever tools you'd like), and use some logic to change the active server.
score: 0
has comment: http://stackoverflow.com/comment/32102205
has comment: http://stackoverflow.com/comment/32100985

http://stackoverflow.com/comment/79619330
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21219921
has text: And how can you remove an empty line using same regex. :)
score: 0

http://stackoverflow.com/a/21362761
has body: Based on @greg-449's answer, I came up with this. All that was missing was a way to get the font name: public static void main(String[] args) throws FontFormatException, IOException { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); // The font file File fontFile = new File("DIN.ttf"); // Get the font name from AWT String fontName = Font.createFont(Font.TRUETYPE_FONT, fontFile).deriveFont(12).getFontName(); // Load the font in SWT display.loadFont(fontFile.getAbsolutePath()); // Get the font instance with the name we got from AWT final org.eclipse.swt.graphics.Font swtFont = new org.eclipse.swt.graphics.Font(display, fontName, 12, SWT.NORMAL); // Use the font Text text = new Text(shell, SWT.BORDER); text.setFont(swtFont); text.addListener(SWT.Dispose, new Listener() { @Override public void handleEvent(Event arg0) { swtFont.dispose(); } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
has comment: http://stackoverflow.com/comment/32238840
has comment: http://stackoverflow.com/comment/32222959
has comment: http://stackoverflow.com/comment/32222547
score: 1
has comment: http://stackoverflow.com/comment/32288838
has comment: http://stackoverflow.com/comment/32224996
has comment: http://stackoverflow.com/comment/32223009
answers question: http://stackoverflow.com/q/21246662
downvote count: 0
has comment: http://stackoverflow.com/comment/32221622
has comment: http://stackoverflow.com/comment/32281718
has comment: http://stackoverflow.com/comment/32221328
type: Answer
has comment: http://stackoverflow.com/comment/32223722
upvote count: 1

http://stackoverflow.com/comment/32140015
type: Comment
score: 1
has text: +1: I think he's generating this Java, and the root problem is in the DDL, but this is definitely correct.
comment on: http://stackoverflow.com/a/21321851
type: AnswerComment

http://stackoverflow.com/a/21247189
has comment: http://stackoverflow.com/comment/32114181
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21206964
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21206964
has body: If you check out the Getting Started Guide, we recommend that you start with the Java EE version of Eclipse. The SimpleDB tools depend on the Data Tools Platform.
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/31939080
comment on: http://stackoverflow.com/a/21208320
has text: Hey, you never know when you'll need to serialize its lack of data. ;)
type: AnswerComment
score: 0
type: Comment

mocking
tags question: http://stackoverflow.com/q/21315016
tags question: http://stackoverflow.com/q/21313084
tag name: mocking
tags question: http://stackoverflow.com/q/21334078
type: Tag
tags question: http://stackoverflow.com/q/21316985
tags question: http://stackoverflow.com/q/21316182

http://stackoverflow.com/q/21207037
has answer: http://stackoverflow.com/a/21332046
has comment: http://stackoverflow.com/comment/32112423
tagged with: security
answer count: 1
accepted answer: http://stackoverflow.com/a/21332046
favorite count: 0
score: 4
has comment: http://stackoverflow.com/comment/31936021
has comment: http://stackoverflow.com/comment/31936284
has title: Java Web Start security dialogs with Java 7 update 51
type: AnsweredQuestion
tagged with: java
has body: I build a Java Web Start application signed with a valid certificate. When I star the application the security dialog appear correctly as show in this figure http://www.java.com/en/img/download/trusted_signed.jpg My issue is about the "do not show again" checkbox. If the attributes href are present in the jnlp tag of the jnlp file the checkbox appear. If the attribute are not present, the checkbox doesn't appear and the run needs to be confirmed every time. (Example: &lt; jnlp spec="1.0+" codebase="http://docs.oracle.com/javase/tutorialJWS/samples/deployment/webstart_ComponentArch_DynamicTreeDemo" href="dynamictree_webstart.jnlp"> ) This is a problem because my jnlp file is under a password protected directory and if href is specified, the Java Web Start application try to retrieve it as the other resources. ( result in access denied because only the browser session is authenticated and the run fails) The documentation at Deploying a Java Web Start Application said: The codebase and href attributes are optional when deploying Java Web Start applications that will run on at least the Java SE 6 update 18 release or later. You must specify the codebase and href attributes when deploying Java Web Start applications that will run with previous releases of the Java Runtime Environment software. What is the right code? With href or without? Is this a BUG or a feature? How can I show the "don't show again" checkbox without having to specify the href attribute?
has comment: http://stackoverflow.com/comment/32109699
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/31936338
downvote count: 0
tagged with: java-web-start

http://stackoverflow.com/q/21278185
has title: JDK7 problems in windows
has answer: http://stackoverflow.com/a/21278224
has answer: http://stackoverflow.com/a/21278245
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21278275
upvote count: 0
tagged with: java-7
has answer: http://stackoverflow.com/a/21278250
favorite count: 0
has comment: http://stackoverflow.com/comment/32062168
type: Question
has comment: http://stackoverflow.com/comment/32062146
answer count: 6
score: -1
has answer: http://stackoverflow.com/a/21278254
has answer: http://stackoverflow.com/a/21278268
has answer: http://stackoverflow.com/a/21278275
has comment: http://stackoverflow.com/comment/32062206
downvote count: 1
possible better answer: http://stackoverflow.com/a/21278224
tagged with: java
has body: I installed JDK7 in windows. I didn't do anything more, don't confing path and classpath, this is my path enviroments: there can find I didn't include jdk installed directory. but when I run "java -version" command in a commandline, I saw that: but when i run "javac -version", it can't work, "javac" command undefined. If I didn't include my jdk installed directory, java and javac command must all can't work, but when in jdk7, "java" command can work, "javac" command didn't work, for solved the problem, I can include the jdk installed directory in path, but I want to know what cause the problem, is there difference between jdk7 and pre version?

http://stackoverflow.com/comment/32095150
has text: @EJP Sure, but what Thread could intercept the reference changing?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21275245
type: Comment

cryptography
tag name: cryptography
type: Tag
tags question: http://stackoverflow.com/q/21234355
tags question: http://stackoverflow.com/q/21191499

http://stackoverflow.com/comment/32145853
type: AnswerComment
score: 0
type: Comment
has text: WHat does has method do? it will check the key of the JSON String ?
comment on: http://stackoverflow.com/a/21324874

http://stackoverflow.com/comment/32032114
score: 0
has text: Java doesn't have an unsigned 64 bit integer type... what exactly do you need to use it for?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21261286

http://stackoverflow.com/comment/32161757
type: QuestionComment
score: 2
has text: Adding the definition of the `movie` class wouldn't hurt.
comment on: http://stackoverflow.com/q/21334744
type: Comment

http://stackoverflow.com/comment/31908855
type: QuestionComment
has text: @blackbelt: yes they both exist in the manifest.xml
comment on: http://stackoverflow.com/q/21189855
score: 0
type: Comment

http://stackoverflow.com/comment/37990540
score: 0
type: Comment
has text: It should autoresize during editing unless you have set it to false.
type: AnswerComment
comment on: http://stackoverflow.com/a/24520512

http://stackoverflow.com/q/21284616
score: 2
type: AnsweredQuestion
has title: How to draw an information panel in libgdx scene2d ui
upvote count: 2
has answer: http://stackoverflow.com/a/21305540
tagged with: scene2d
tagged with: java
linked to: http://stackoverflow.com/q/17261057
type: Question
possible better answer: http://stackoverflow.com/a/21293925
has answer: http://stackoverflow.com/a/21293925
tagged with: libgdx
accepted answer: http://stackoverflow.com/a/21305540
answer count: 2
has body: In my libgdx game want to draw an information panel where my current health and so on is displayed. I have seen this question which shows something similar, but my panel doesn't need to react on user Input, it should just display informations. Thats why i don't want to add a second stage to my gamescreen. But i need to be sure it is drawn in front of everything else. How can i manage that? I think the z-Index won't work, cause when my character shoots it adds a "Bullet" actor to the stage and this one would be at the last index right? The same thing would be with the "Pause Menu" but for this i really could use a second stage. Or is there also a better solution for the pause menu? EDIT: Is it a good idea to override the stage.draw() method? I could call super.draw() first and then draw my infopanel. So it would be always in front. Or shouldn't i override stage.draw()?
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/21292927
has comment: http://stackoverflow.com/comment/86984337
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/86915511
has body: I may be old school, but I'd really refactor the code under test rather than using classloader hacks. Something like: public enum DatacenterEnum { DEV, DC1, DC2, DC3; static String hostName = InetAddress.getLocalHost().getCanonicalHostName().toLowerCase(); public static String getHostName() { return hostName; } } and in your test code, prior to running the test: DataCenterEnum.hostName = "foo";
score: 0
answers question: http://stackoverflow.com/q/21202576
type: Answer
has comment: http://stackoverflow.com/comment/86919181

http://stackoverflow.com/comment/31941769
type: Comment
comment on: http://stackoverflow.com/q/21210204
has text: Where is the font stored in relationship to the code trying to load it?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32156021
comment on: http://stackoverflow.com/q/21331334
score: 0
has text: There's technical reasons for creating the file in this way based on how the data(SalesByTerritory) is coming from the database.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21263976
score: -1
type: Question
upvote count: 0
answer count: 1
favorite count: 0
tagged with: jms
tagged with: ibm-mq
has title: Websphere MQ series - MQGMO_WAIT
has answer: http://stackoverflow.com/a/21265852
type: UnansweredQuestion
has body: I'm about to refactor a broker application written for websphere MQ. In the existing application, while reading a message from the queue, the following options are being set: MQConstants.MQGMO_WAIT and waitInterval = 1000 (milliseconds). In our application, there is no guarantee that we receive a message every second. We may not receive a message even for hours. I'm not sure why the creators of this application chose to go for waitInterval = 1000 instead of setting the waitInterval to MQWI_UNLIMITED. At the moment, there is a catch block in the code which does not do anything when MQException.MQRC_NO_MSG_AVAILABLE occurs. The creators of this application were really smart people so I do not know why they opted for this approach. I'm new to MQ series, so can anyone please explain the reason behind this?
downvote count: 1
tagged with: java

http://stackoverflow.com/a/21304556
score: 0
answers question: http://stackoverflow.com/q/21304332
type: Answer
has body: Surely managers are also people? The better way to do this is to have a map of Persons and have Manager extend Person. To get a person query the map and return the found Person. To get a manager query the map and check if the returned object is an instanceof Manager and return null if it is not. I would wrap the whole HashMap into a class of your own and that class should implement getPerson(), getManager(), getUser() with appropriate calls/checks. This also decouples the API from the implementation so in future you can always change it and not have to change any other code.
has comment: http://stackoverflow.com/comment/32120045
has comment: http://stackoverflow.com/comment/32120609

http://stackoverflow.com/comment/32060034
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21276973
type: AnswerComment
has text: Can you please elaborate a bit.

http://stackoverflow.com/comment/32094251
type: QuestionComment
comment on: http://stackoverflow.com/q/21296022
score: 0
has text: so, i think i covered most of your questions. But you will still have to deal with moving it faster. I assume timer is running some task, that forces the ui to redraw every 1.5 seconds atm. so changing that to .700 should do the trick
type: Comment

http://stackoverflow.com/comment/32007290
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21246483
type: AnswerComment
has text: I dont think Arrays.asList(array) sorts the array. Anyway sorting is O(n log n), but looping through the array once is O(n). So this is the fastest option.

http://stackoverflow.com/comment/31982391
type: QuestionComment
comment on: http://stackoverflow.com/q/21232112
has text: @Learner - In that case your original design is correct.. I think even Duncan agrees (read his first comment).
score: 0
type: Comment

http://stackoverflow.com/comment/32114181
score: 0
type: Comment
has text: Hello, here I am again. I faced an issue in accessing Amazon RDS using Eclipse. My question is here - http://stackoverflow.com/questions/21307937/unable-to-connect-to-rds-database-java-lang-reflect-invocationtargetexception. Please help
type: AnswerComment
comment on: http://stackoverflow.com/a/21247189

http://stackoverflow.com/comment/31954265
has text: my answer would be loops. show us the code for a better answer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21217290
score: 1

http://stackoverflow.com/a/21202320
type: Answer
has comment: http://stackoverflow.com/comment/31928410
has comment: http://stackoverflow.com/comment/34730958
has comment: http://stackoverflow.com/comment/31928303
answers question: http://stackoverflow.com/q/21202293
has comment: http://stackoverflow.com/comment/31928244
score: 0
has comment: http://stackoverflow.com/comment/31928033
has comment: http://stackoverflow.com/comment/31927884
has comment: http://stackoverflow.com/comment/31928374
has body: The variable a is a reference of type S to an object whose class is A. When you call m() on that object, you'll always get the version of m() in class A being called, because that's the class of the object, no matter what type of variable is referencing it. That's what polymorphism is about. The version of m() that gets called depends on the class of the object, not the type of the referring expression. However, this object actually contains two variables called i - one declared in class A and the other in class S. Which one of these you get depends on the type of the referring expression that you use. Since the variable a is of type S, the expression a.i refers to the one that is declared in class S.

http://stackoverflow.com/comment/32075199
score: 0
type: QuestionComment
has text: Is your example code right? You put 3 of the same thing into your `expectedServices` list. Are you looking to count the number of different classes in your list, to see if that number is 3?
type: Comment
comment on: http://stackoverflow.com/q/21284859

http://stackoverflow.com/comment/32001045
type: QuestionComment
comment on: http://stackoverflow.com/q/21238954
has text: @NeplatnyUdaj Thank you very much for your reply! I will check out the ant manual you shared with me to figure out what may be happening. Regarding the file, I checked its location many times and I'm sure it is there.
score: 0
type: Comment

spongycastle
type: Tag
tags question: http://stackoverflow.com/q/21231149
tag name: spongycastle

scala
tags question: http://stackoverflow.com/q/21286823
tags question: http://stackoverflow.com/q/21187557
tags question: http://stackoverflow.com/q/21194081
tags question: http://stackoverflow.com/q/21292252
tags question: http://stackoverflow.com/q/21190140
tags question: http://stackoverflow.com/q/21250550
tags question: http://stackoverflow.com/q/21338859
tags question: http://stackoverflow.com/q/21268600
tags question: http://stackoverflow.com/q/21184626
tags question: http://stackoverflow.com/q/21266826
tags question: http://stackoverflow.com/q/21189949
tags question: http://stackoverflow.com/q/21318601
tags question: http://stackoverflow.com/q/21281048
tags question: http://stackoverflow.com/q/21267726
tags question: http://stackoverflow.com/q/21204098
tag name: scala
tags question: http://stackoverflow.com/q/21247126
tags question: http://stackoverflow.com/q/21328804
tags question: http://stackoverflow.com/q/21212993
type: Tag
tags question: http://stackoverflow.com/q/21221114
tags question: http://stackoverflow.com/q/21239143

http://stackoverflow.com/q/21336714
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32169601
has comment: http://stackoverflow.com/comment/32166095
answer count: 0
tagged with: android-drawable
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/2833057
upvote count: 1
type: Question
tagged with: android-layout
downvote count: 0
has body: I have a LinearLayout in which a TextView's visibility and background (GradientDrawable) changes according to a function myFunction(): &lt;LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="5dp" android:layout_weight="1" android:animateLayoutChanges="true" android:gravity="center" android:orientation="vertical" &gt; (...Some views...) &lt;TextView android:id="@+id/currentPercentage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginTop="10dp" android:gravity="center" android:paddingLeft="5dp" android:paddingRight="5dp" android:singleLine="true" android:text="XX.X%" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="@color/White" /&gt; &lt;/LinearLayout&gt; The currentPercentage TextView has GONE visibility by default and, according to some events in the fragment that contains it, may have it changed to Visible (or back to GONE) and its background to a different GradientDrawable like so: myFunction(...){ TextView currentPercentage= (TextView) getView().findViewById(R.id.currentPercentage); if(condition ... ) { Color color = // Color based on the condition... GradientDrawable gd = new GradientDrawable( GradientDrawable.Orientation.TL_BR, new int[] {color,color}); DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); int dp = Math.round(10f / (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); gd.setCornerRadius(dp); currentChartPercentage.setBackground(gd); } else if( otherCondition...) { // ... similar stuff ... } else { // Hide the currentPercentage TextView currentPercentage.setVisibility(View.GONE); } } This works fine as the TextView's background and visibility change smoothly whenever myFunction() is called and the other elements in the LinearLayout move (with animation) to make room for the TextView. My issue is that whenever the visibility goes from GONE to VISIBLE, the View fades in nicely …
favorite count: 0
has title: Problems When Changing Visibility and Background of a View

http://stackoverflow.com/comment/139817385
score: 0
type: AnswerComment
type: Comment
has text: @FarrukhNajmi no LineItem should not be embeddable bc you are probably going to have multiple line items. you dont want to have a separate column for each line item. Embeddables are more applicable for things like a composite key or an address class. LineItems would not be embedded, LineItems would indeed be an entity
comment on: http://stackoverflow.com/a/21277087

http://stackoverflow.com/comment/31968849
comment on: http://stackoverflow.com/a/21224536
type: AnswerComment
score: 0
type: Comment
has text: @rickz: I realize you did, but I thought That-Kickass-GirL might find my answer a little bit easier to understand. If it is redundant, feel free to down vote or delete it. :)

http://stackoverflow.com/q/21272665
upvote count: 2
has body: I'm trying to learn how to make an autocomplete textview in an android app would have a dropdown list of contacts with their numbers, based on the letters that the user enters that match a part of a name of a contact. How would I accomplish this? I've spend hours on google without finding a complete solution, which I thought was odd. Any help would be appreciated! Thanks, A beginner android developer MORE DETAILS: I wish to have a textbox similar to the recipient box for the default messaging app, where I would be able to start typing the name of a contact, and suggestions of contact names with their numbers would appear, which I would be able to click and fill my textbox with the number of that contact that I clicked.
answer count: 3
has answer: http://stackoverflow.com/a/21273902
tagged with: textview
has answer: http://stackoverflow.com/a/29451097
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32225208
has title: An autocomplete textview for contact names that get their numbers?
score: 2
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/21274244
linked to: http://stackoverflow.com/q/2628702
type: Question
tagged with: android-contacts
linked to: http://stackoverflow.com/q/12400504
tagged with: autocomplete

http://stackoverflow.com/q/21193225
tagged with: mysql
tagged with: database
tagged with: cpanel
has answer: http://stackoverflow.com/a/21193727
has answer: http://stackoverflow.com/a/21193716
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21193727
possible better answer: http://stackoverflow.com/a/21193716
tagged with: database-connection
type: Question
answer count: 2
has title: How can I connect to my website database? java
has body: Connection baglanti=(Connection)DriverManager.getConnection("jdbc:"+"mysql://localhost:3306/mydatabase?useUnicode=true&amp;amp"+";characterEncoding=latin5","id","password"); Now, how to connect my websites mysql database from java program ? I connect MAMP servers mysql database but I cant connect my website database. localhost -(instead)-> www.mywebsite.com is that true ? And sorry for my english. I figured it out, cPanel -> "Remote Database Access Hosts"
score: 0
tagged with: java

http://stackoverflow.com/comment/31948999
type: Comment
comment on: http://stackoverflow.com/a/21213922
has text: at last worked I was adding jboss-client (5.0 version) an there was not class InitialContextFactory I adde 7.0 version and worked thanks!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32129260
score: 0
has text: @user2115021 thanks for the comment, it's executed on command prompt java test textfile.txt
comment on: http://stackoverflow.com/q/21316169
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21285896
accepted answer of: http://stackoverflow.com/q/21280828
has comment: http://stackoverflow.com/comment/32284885
answers question: http://stackoverflow.com/q/21280828
score: 1
upvote count: 1
has body: ConcurrentUpdateSolrServer allows you to pass a org.apache.http.client.HttpClient client to the constructor, as seen here. So you can enable gzip at HttpClient level (see here for instance, check with the doc of the exact version you use), and then pass along that instance to ConcurrentUpdateSolrServer
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/21197212
answers question: http://stackoverflow.com/q/21197184
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31918945
score: 1
accepted answer of: http://stackoverflow.com/q/21197184
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31919193
downvote count: 0
has body: You're adding the same list at each iteration, and hence the keys are referencing the same list (see figure below). What you're actually doing is this : You create a list containing the values [root, like] and you associate this list with the key root In the second iteration, you clear the list and you add [eat, it] to this list and associate it with another key xsubj. Since you did'nt create a new object, the keys root and xsubj point to the same list object and hence each change on the list will be reflected for all the keys that share it. So that's why at the end you got this output. Instead of calling clear(), create a new list at each iteration. for(int i = 0; i &lt; parts.length; i++){ list = new ArrayList&lt;&gt;(); list.add(...); /** * The code **/ }
has comment: http://stackoverflow.com/comment/31919503

http://stackoverflow.com/comment/31958002
type: Comment
comment on: http://stackoverflow.com/a/21219175
has text: @SeanCoyne Do you have a debugger? I think you're going to need to set a breakpoint.
type: AnswerComment
score: 0

http://stackoverflow.com/a/21317884
has comment: http://stackoverflow.com/comment/32181483
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/32181048
answers question: http://stackoverflow.com/q/21317804
score: 1
has comment: http://stackoverflow.com/comment/32133340
has body: This looks to be the trouble spot. Worker sleeps the thread. Display.getDefault().asyncExec(new Runnable() { public void run() { new Worker(text).work(); } }); It appears to me that you are creating a new Worker which looks like it calls Thread.sleep() which will Block the thread. In this case, it's your GUI thread since it's being executed from inside it! Fix this by removing that offending Thread.sleep(). I try to steer clear of Thread.sleep() in production code. To keep your timing, you can try moving the asyncExec into your Worker (untested) class Worker { Text text; public Worker(Text t) { text = t; }; void work() { for (int i = 0; i &lt; 30; i++) { Display.getDefault().asyncExec(new Runnable() { public void run() { text.append("hello " + i + "\n"); } }); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } }
has comment: http://stackoverflow.com/comment/32133584
has comment: http://stackoverflow.com/comment/32134549
has comment: http://stackoverflow.com/comment/32132983
has comment: http://stackoverflow.com/comment/32133123
type: Answer

http://stackoverflow.com/q/21294241
has comment: http://stackoverflow.com/comment/32090477
answer count: 2
linked to: http://stackoverflow.com/q/2710002
has title: Pointer into Java LinkedList Node
upvote count: 7
tagged with: pointers
favorite count: 0
possible better answer: http://stackoverflow.com/a/21294433
has comment: http://stackoverflow.com/comment/32090970
accepted answer: http://stackoverflow.com/a/21295470
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21294433
tagged with: linked-list
downvote count: 0
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/21295470
type: Question
tagged with: performance
has body: I am pushing n entries into Java LinkedList at O(1). There are few unique items i would like to remove later on at O(1). I though about keeping an array with "pointers" to the unique nodes at the LinkedList so i can later on remove them. is there a way to do it on LinkedList or any other java class? I tried storing iterators to the items. So i can use iter.remove(). But i understood that there can be only one iterator on a list at the time. I know that an easy solution could be implementing link list on my own. But i rather use LinkedList or some other Java class already implemented.
has comment: http://stackoverflow.com/comment/32105780
has comment: http://stackoverflow.com/comment/32090676

http://stackoverflow.com/comment/32053693
score: 0
type: Comment
type: QuestionComment
has text: Either override toString() or use the getters. Done.
comment on: http://stackoverflow.com/q/21273050

http://stackoverflow.com/comment/31992823
has text: Did you say them that you not able to do so?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21238357

http://stackoverflow.com/comment/32039716
comment on: http://stackoverflow.com/a/21263270
score: 0
has text: ok, if decide to write numbers from 1 to 10 into txt as bytes, and then i open txt with notepad, what would i see? Why? Also i didn't quite understand 0, 0, 2, 12 for 2*256+12 = 524. Thank you for your answer
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21336499
score: 10
type: AcceptedAnswer
upvote count: 10
type: Answer
has body: I've found a solution using reflection. Looking for the "logger" field in the slf4j Logger. private &lt;T&gt; T getLogger(final String loggerName, final Class&lt;T&gt; loggerClass) { final org.slf4j.Logger logger = LoggerFactory.getLogger(loggerName); try { final Class&lt;? extends org.slf4j.Logger&gt; loggerIntrospected = logger.getClass(); final Field fields[] = loggerIntrospected.getDeclaredFields(); for (int i = 0; i &lt; fields.length; i++) { final String fieldName = fields[i].getName(); if (fieldName.equals("logger")) { fields[i].setAccessible(true); return loggerClass.cast(fields[i].get(logger)); } } } catch (final Exception e) { logger.error(e.getMessage()); } return null; } Calling with: java.util.logging.Logger myLogger = getLogger(loggerName, java.util.logging.Logger.class) // or org.apache.log4j.Logger myLogger = getLogger(loggerName, org.apache.log4j.Logger.class) But maybe exists a better solution using the slf4j API ?
answers question: http://stackoverflow.com/q/21329953
has comment: http://stackoverflow.com/comment/81980558
accepted answer of: http://stackoverflow.com/q/21329953
downvote count: 0

http://stackoverflow.com/comment/32162559
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21335032
has text: My initial code was wrong either way, so your answer helped :)

http://stackoverflow.com/comment/32142890
has text: Hmm, like how can I make "count" = to a new array and return that array, so I can print it in my 2nd method :o ?
comment on: http://stackoverflow.com/a/21323423
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21229332
type: AcceptedAnswer
has body: For that purposes you can use TableRowSorter, and set Comparator to needed column. In that comparator you can compare values of cells and sorting them: TableRowSorter&lt;TableModel&gt; sorter = new TableRowSorter&lt;TableModel&gt;(model); sorter.setComparator(0, new Comparator&lt;Object&gt;() { @Override public int compare(Object o1, Object o2) { return 0; } }); table.setRowSorter(sorter); table is your JTable , model is model of your table. read more about sorting in JTable.
has comment: http://stackoverflow.com/comment/31978908
has comment: http://stackoverflow.com/comment/32021158
answers question: http://stackoverflow.com/q/21228464
type: Answer
accepted answer of: http://stackoverflow.com/q/21228464
has comment: http://stackoverflow.com/comment/32011365
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32015835
has comment: http://stackoverflow.com/comment/31978754
has comment: http://stackoverflow.com/comment/32017854
has comment: http://stackoverflow.com/comment/32019351
has comment: http://stackoverflow.com/comment/32011218
has comment: http://stackoverflow.com/comment/32011158
upvote count: 1

http://stackoverflow.com/comment/31902861
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21187720
has text: Any inner class can be static. Exceptions are just classes like any other, except that you can throw them.

http://stackoverflow.com/comment/32069652
type: QuestionComment
comment on: http://stackoverflow.com/q/21282318
has text: A.print is called because C# is using variable type (not actual object type) to call non-virtual methods. For virtual methods, actual object type is used to find target method.
score: 0
type: Comment

http://stackoverflow.com/a/21195942
type: AcceptedAnswer
downvote count: 0
has body: Because: textTo = (EditText) getView().findViewById(R.string.mailAdress); You have no EditText by that name, so it returns null. I suspect you meant to use R.id.mailInfo Edit to add: It appears there's multiple issues here, that would be one. Another is that you're not using the View passed into onViewCreated(). All of those calls should be: v.findViewById(...); But that's unlikely to work since I don't see layout named contact_form anywhere.
answers question: http://stackoverflow.com/q/21195875
has comment: http://stackoverflow.com/comment/31917463
has comment: http://stackoverflow.com/comment/31917568
accepted answer of: http://stackoverflow.com/q/21195875
has comment: http://stackoverflow.com/comment/31917409
has comment: http://stackoverflow.com/comment/31917907
has comment: http://stackoverflow.com/comment/31917345
type: Answer
has comment: http://stackoverflow.com/comment/31917586
upvote count: 4
has comment: http://stackoverflow.com/comment/31916826
score: 4

http://stackoverflow.com/q/21287715
has body: I am trying to read a text file using standard input. However, when I try to read the file line by line, it goes into infinite loop(?) state and I have to force quit the process. I am piping data in with &lt; Input1.txt and BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); However, when I try to f.readLine(); it stalls. Edit input file a = {} b = {2*3,7,1*4,5*0,1*2} c = b d = {2*5,1*2,9}
has title: Standard input(piping txt file) and .readline() results in a idling state?
tagged with: input
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/21288071
accepted answer: http://stackoverflow.com/a/21288071
tagged with: standards
tagged with: java
tagged with: eclipse
score: 0
answer count: 1

http://stackoverflow.com/q/21334782
tagged with: pdfbox
type: Question
answer count: 1
score: 0
has body: jsf 2.1 / pdfbox Im tring to generate landscape pdfbox pdf and draw some strings to its contents but I didnt find any full specification about concatenate2CTM method. Does anyone have some full information about the concatenate 2CTM parameters I have only this but does not help me because I dont know what value I must enter. what means a...f operator ???
upvote count: 1
downvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21335785
has title: pdfBox - contentStream.concatenate2CTM full documentation parameters
has comment: http://stackoverflow.com/comment/32163505
has answer: http://stackoverflow.com/a/21335785
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32164849
tagged with: java

http://stackoverflow.com/comment/31976205
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21228559
score: 0
has text: all lists are of size 4. varIndex?? am new to jstl?? could u giv an example??

http://stackoverflow.com/comment/31990815
comment on: http://stackoverflow.com/q/21237193
type: Comment
type: QuestionComment
has text: Sounds like you're running the long running process in the event dispatch thread, and that blocks the GUI from updating. [SwingWorker](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/worker.html) is usually a good way to do the time consuming task in the background.
score: 1

http://stackoverflow.com/comment/32022466
has text: Please give more information. Either other PC has no java installed, java cannot be found, program throws an error (seen from cmdline), or program swallows errors, etc.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21255246

http://stackoverflow.com/a/78505581
type: Answer
answers question: http://stackoverflow.com/q/21245796
score: 0
has body: If the Java version has been recently changed and a daemon is already running from old version, killing Daemon may help. For me Daemon was still pointing old java version, where cacerts were not updated with certificates. To kill all daemon ./gradlew --stop or gradle --stop

http://stackoverflow.com/comment/32119767
comment on: http://stackoverflow.com/a/21302413
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/45924/discussion-between-erum-hannan-and-user2968888)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21198203
tagged with: jsf
linked to: http://stackoverflow.com/q/1414795
score: 1
has title: How to set timeout for a POST request using JSP / JSF
tagged with: java
tagged with: timeout
accepted answer: http://stackoverflow.com/a/21203341
has comment: http://stackoverflow.com/comment/31920953
tagged with: post
type: Question
has body: I would like to know if there is some way to set the timeout for a POST request(I guess it is a POST request) from a JSP using JSF tags. I usually work with ExtJS and do this kinda stuff through AJAX(it's easy to configure the timeout) and don't know almost anything of JSF. Anyway I'm maintaining a legacy system and when the request is done the interface stops listening about 3 minutes after, I would like the interface to wait until there is a response of the server, it doesn't matter if it takes 10 or 15 minutes. Here is the action method which I guess is a standard POST &lt;div style="position:absolute; top:-100"&gt; &lt;h:commandLink action="#{ReporteSeguros.buscarRegistros}" id="buscarRegistros" target="fraGridPagos"&gt; &lt;/h:commandLink&gt; &lt;h:inputHidden id="sucursal" value="#{ReporteSeguros.sucursal}"/&gt; &lt;h:inputHidden id="region" value="#{ReporteSeguros.region}"/&gt; &lt;/div&gt; Any help is appreciated.
has answer: http://stackoverflow.com/a/21203341
tagged with: jsp
linked to: http://stackoverflow.com/q/7145131
upvote count: 1
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31935899
favorite count: 0
has comment: http://stackoverflow.com/comment/31921033
type: AnsweredQuestion

http://stackoverflow.com/comment/32183749
score: 0
type: QuestionComment
type: Comment
has text: Thank you very much to answer my question，‘AuthenticationSunitFilter’' 'is my rewrite the class，I to the original class： javax.servlet.ServletException: org.jasig.cas.client.validation.TicketValidationException: XXXXXXX 'ST-12-xvSwYT1ImDPtZ9QEQAEJ-cas01.example.org'XXXXXX org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:194) org.jasig.cas.client.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:116)
comment on: http://stackoverflow.com/q/21346130

http://stackoverflow.com/comment/31917687
score: 1
has text: See [this](http://arshajii.com/coding-faqs/dynamic-vars.html).
comment on: http://stackoverflow.com/q/21196499
type: QuestionComment
type: Comment

required
tag name: required
tags question: http://stackoverflow.com/q/21218868
type: Tag

http://stackoverflow.com/comment/32088269
comment on: http://stackoverflow.com/q/21293045
has text: Are you in `<project dir>/bin` when you run java?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32133423
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21318224
has text: It has to have a JTextArea because the user can select additional templates from the dropdown menu. Like a database schema

http://stackoverflow.com/comment/32096270
has text: Have you read the Javadocs for the Scanner class?
score: 0
comment on: http://stackoverflow.com/q/21297442
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32104370
has text: Using Access specifier...
comment on: http://stackoverflow.com/q/21302240
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21320156
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/32147385
has answer: http://stackoverflow.com/a/50318472
possible better answer: http://stackoverflow.com/a/50318472
favorite count: 0
accepted answer: http://stackoverflow.com/a/21326227
tagged with: multithreading
type: AnsweredQuestion
tagged with: java
tagged with: forkjoinpool
has comment: http://stackoverflow.com/comment/32154107
type: Question
tagged with: java.util.concurrent
answer count: 2
score: 5
has title: ForkJoinPool resets thread interrupted state
has answer: http://stackoverflow.com/a/21326227
has body: I just noticed the following phenomena when cancelling a Future returned by ForkJoinPool. Given the following example code: ForkJoinPool pool = new ForkJoinPool(); Future&lt;?&gt; fut = pool.submit(new Callable&lt;Void&gt;() { @Override public Void call() throws Exception { while (true) { if (Thread.currentThread().isInterrupted()) { // &lt;-- never true System.out.println("interrupted"); throw new InterruptedException(); } } } }); Thread.sleep(1000); System.out.println("cancel"); fut.cancel(true); The program never prints interrupted. The docs of ForkJoinTask#cancel(boolean) say: mayInterruptIfRunning - this value has no effect in the default implementation because interrupts are not used to control cancellation. If ForkJoinTasks ignore interrupts, how else are you supposed to check for cancellation inside Callables submitted to a ForkJoinPool?

http://stackoverflow.com/comment/51201964
type: AnswerComment
comment on: http://stackoverflow.com/a/27652829
has text: thats just awesome and simple
score: 0
type: Comment

http://stackoverflow.com/q/21345246
has answer: http://stackoverflow.com/a/21345272
has answer: http://stackoverflow.com/a/21345270
answer count: 4
has title: Program only works whe negative numbers entered in array last
possible better answer: http://stackoverflow.com/a/21345272
score: 0
has comment: http://stackoverflow.com/comment/32181892
tagged with: methods
has answer: http://stackoverflow.com/a/21345286
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21345270
tagged with: java
type: Question
tagged with: arrays
has body: For some reason my computePositiveSum final output for "The sum of the positive numbers" is wrong when a negative number is entered before any positive numbers. It seems like what's happening is instead of ignoring the negative numbers it subtracts it's sum from the total. So if my input was (-4,2,3) it would say the sum of positive numbers was 1. I'm not really sure what is wrong with the method. /* Description: Write a program that reads in a sequence of numbers (not necessary integers) from standard input until 0 is read, and stores them in an array. This is done using iteration (choose for, while, or do while loop). You may assume that there will not be more than 100 numbers.*/ import java.util.Scanner; import java.text.DecimalFormat; public class Assignment2 { public static void main (String[] args) { Scanner scan= new Scanner(System.in); int count=0; double[] num= new double[100]; for(int i=0;i&lt;num.length;++i) { num[i]= scan.nextDouble(); if (num[i] == 0) { break; } count++; } double min= findMin(num,count); double pos= computePositiveSum(num, count); int c= countNegative(num,count); DecimalFormat fmt = new DecimalFormat ("0"); DecimalFormat fmt2 = new DecimalFormat ("$0.00"); System.out.println("The minimum number is " +fmt.format(min)); System.out.println("The sum of the positive numbers is "+fmt2.format(pos)); System.out.println("The total number of negative numbers is " +c); }//End Main public static double findMin(double[] num, int count) { double min = num[0]; for(int i=1;i&lt;count;i++){ if(num[i] &lt; min) { min = num[i]; } } return min; }//end findMin public static double computePositiveSum(double[] num, int count) { double pos=num[0]; for(int i=1;i&lt;count;i++){ if(num[i] &gt; 0) { pos=pos+num[i]; } } return pos; } public static int countNegative(double[] num, int count) { double a=num[0]; int c=0; for(int i=0;i&lt;count;i++){ if(num[i] &lt; 0) { c++; } } return c; }//end countNegative }
has comment: http://stackoverflow.com/comment/32181757
has answer: http://stackoverflow.com/a/21345305
has comment: http://stackoverflow.com/comment/32181775

http://stackoverflow.com/a/52590521
type: Answer
has body: if youre using (or you can use) SqlResultSet then this solution fits you: https://github.com/OfekRv/DraggerReports/blob/master/src/main/java/dragger/bl/exporter/ExcelReportExporter.java public class ExcelReportExporter implements ReportExporter { private static final char UNDER_LINE = '_'; private static final char SPACE = ' '; private static final String SUFFIX = ".xlsx"; private static final int TITLE_ROW = 0; private static final int HEADER_ROW = 3; private static final int RESULTS_FIRST_ROW = HEADER_ROW + 1; private static final int FIRST_COLUMN_INDEX = 0; @Inject QueryGenerator generator; @Inject QueryExecutor executor; @Override public File export(Report reportToExport) throws DraggerExportException { String reportName = generateReportName(reportToExport); SqlRowSet results = executor.executeQuery(generator.generate(reportToExport.getQuery())); SqlRowSetMetaData resultsMetaData = results.getMetaData(); try (Workbook workbook = new XSSFWorkbook();) { Sheet sheet = workbook.createSheet(reportName); createTitle(reportToExport, workbook, sheet); createHeaderRowFromMetadata(resultsMetaData, workbook, sheet); int excelRowIndex = createDataTableFromResultset(results, resultsMetaData, workbook, sheet); setTableAutoFilter(resultsMetaData, sheet, excelRowIndex); saveExcelFile(reportName, workbook); autoSizeColumns(resultsMetaData, sheet); } catch (IOException e) { throw new DraggerExportException("Could not create export file", e); } return new File(reportName); } private String generateReportName(Report reportToExport) { return reportToExport.getName().replace(SPACE, UNDER_LINE) + UNDER_LINE + LocalDate.now() + SUFFIX; } private void autoSizeColumns(SqlRowSetMetaData resultsMetaData, Sheet sheet) { for (int i = FIRST_COLUMN_INDEX; i &lt; resultsMetaData.getColumnCount(); i++) { sheet.autoSizeColumn(i); } } private void saveExcelFile(String reportName, Workbook workbook) throws IOException, FileNotFoundException { try (FileOutputStream fileOut = new FileOutputStream(rep…
downvote count: 2
upvote count: 0
score: -2
answers question: http://stackoverflow.com/q/21277967

http://stackoverflow.com/comment/32134682
score: 5
comment on: http://stackoverflow.com/q/21319128
type: Comment
type: QuestionComment
has text: Why are you attempting to sort `toSort` this way? Only the last `Collections.sort` wins. Are you attempting to use multiple `Comparators` to perform a "sort by this, then that, then the other"?

http://stackoverflow.com/comment/32011656
score: 0
type: AnswerComment
type: Comment
has text: Oh, i solved that one already. Forgot to change it before posting it here.Although that isn't the problem.
comment on: http://stackoverflow.com/a/21249322

http://stackoverflow.com/q/21347758
has comment: http://stackoverflow.com/comment/32186265
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21354967
has comment: http://stackoverflow.com/comment/32186534
has answer: http://stackoverflow.com/a/21347797
score: 0
has body: I am able to draw a horizontal line but unable to draw a vertical line. Please help me. import javax.swing.*; import java.awt.*; import java.awt.geom.*; class Success extends JFrame{ public Success(){ JPanel panel=new JPanel(); getContentPane().add(panel); setSize(450,450); JButton button =new JButton("press"); panel.add(button); } public void paint(Graphics g) { super.paint(g); // fixes the immediate problem. Graphics2D g2 = (Graphics2D) g; Line2D lin = new Line2D.Float(20, 40, 850, 40); g2.draw(lin); } public static void main(String []args){ Success s=new Success(); s.setVisible(true); } } Thanks in advance.
answer count: 2
possible better answer: http://stackoverflow.com/a/21347797
favorite count: 0
has title: How to draw vertical line in Swing
accepted answer: http://stackoverflow.com/a/21354967
type: AnsweredQuestion
upvote count: 1
tagged with: swing
downvote count: 1

http://stackoverflow.com/comment/31941185
type: Comment
score: 0
type: AnswerComment
has text: This goes into your build.xml
comment on: http://stackoverflow.com/a/21209144

http://stackoverflow.com/q/21248125
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/30254878
tagged with: selenium-webdriver
downvote count: 0
score: 1
tagged with: java
has title: How to create log file history in selenium webdriver using java
tagged with: selenium
type: Question
has body: Currently working on selenium webdriver. I have created a log file and the log information stored in logfile.log. when i start running my test case the log information is captured but the entire history is visible. i want to clear the log file or it need to be cleared before starting the execution of test cases. Sample log info: 2013-10-01 09:18:06,655 INFO [TEST] Initializing Selenium... 2013-10-01 09:18:06,686 INFO [TEST] Selenium instance started 2013-10-01 09:18:11,905 INFO [TEST] ______________________________________________________________ 2013-10-01 09:18:11,905 INFO [TEST] Initializing Selenium... 2013-10-01 09:18:11,921 INFO [TEST] Selenium instance started 2013-10-01 09:18:11,921 INFO [TEST] Accessing Stored uid,pwd from the stored text file 2013-10-01 09:18:11,921 INFO [TEST] Retrieved uid pwd from the text file 2013-10-01 09:18:12,858 INFO [TEST] Sign in to the OneReports website 2013-10-01 09:18:12,874 INFO [TEST] Enter Username 2013-10-01 09:18:13,077 INFO [TEST] Enter Password 2013-10-01 09:18:14,155 INFO [TEST] Submitting login details 2013-10-01 09:18:33,139 INFO [TEST] Stopping Selenium... 2013-10-01 09:18:33,139 INFO [TEST] ______________________________________________________________
has comment: http://stackoverflow.com/comment/32015205
has answer: http://stackoverflow.com/a/66334903
answer count: 2
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32011122

http://stackoverflow.com/a/21227855
type: Answer
score: 0
has body: As I am thinking you could use zip instead of jar, The problem might with Manifest file check it http://eduunix.ccut.edu.cn/index2/html/java/Que.Special.Edition.Using.Java.2.Standard.Edition.internal.eBook-LiB/ch25lev1sec2.html
answers question: http://stackoverflow.com/q/21227583

http://stackoverflow.com/comment/32071397
comment on: http://stackoverflow.com/a/21283261
score: 0
type: AnswerComment
type: Comment
has text: I meant that the installation may be corrupt. Or did you not install the JRE with your JDK? Reinstallation of the latest version may help. Note that 1.6 is as good as unsupported by now, try and migrate to 7! It should have the same folder structure as the previous one.

http://stackoverflow.com/comment/32131654
type: Comment
comment on: http://stackoverflow.com/q/21314914
score: 0
type: QuestionComment
has text: That's what I think I'll have to do. The problem is I have two object arrays that contain references to specific objects in the array of the other type. So I guess I'll have to re-create the references. Repost as an answer? This is what I'm looking for. Thanks.

http://stackoverflow.com/comment/31972042
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21226952
type: AnswerComment
has text: Normally it would, but `[]` is also nice mechanism to escape some special characters, for example you can escape this way `[*]` `[$]` and many others regex metacharacters.

http://stackoverflow.com/a/21229713
has body: In most cases, if I manage my own threads, I have some kind of flag (e.g. a volatile boolean or AtomicBoolean) that is checked on every run by a thread. E.g. private volatile stop = false; void stop(){ stop = true; } class Worker implements Runnable{ public void run(){ while(!stop){ ... your logic } } } You can interrupted your threads if your threads are potentially blocking for something and you need to let them break free: void stop(){ stop = true; for(Thread thread: threads){ thread.interrupt(); } }
type: Answer
answers question: http://stackoverflow.com/q/21229178
score: 0

http://stackoverflow.com/q/21271485
has comment: http://stackoverflow.com/comment/32054356
has comment: http://stackoverflow.com/comment/32077856
has comment: http://stackoverflow.com/comment/32089270
tagged with: java
has comment: http://stackoverflow.com/comment/32089116
has title: Why my Aspect is not detected for Jersey controller (using custom annotation)?
has comment: http://stackoverflow.com/comment/32087236
tagged with: aop
has comment: http://stackoverflow.com/comment/32077877
has comment: http://stackoverflow.com/comment/32120697
accepted answer: http://stackoverflow.com/a/32507444
tagged with: aspectj
has answer: http://stackoverflow.com/a/37322308
tagged with: jersey
has comment: http://stackoverflow.com/comment/32078108
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32078182
tagged with: spring-aop
has comment: http://stackoverflow.com/comment/32070247
answer count: 3
has comment: http://stackoverflow.com/comment/32087349
has comment: http://stackoverflow.com/comment/32087080
linked to: http://stackoverflow.com/q/25209339
upvote count: 6
has comment: http://stackoverflow.com/comment/32070680
possible better answer: http://stackoverflow.com/a/22117832
has answer: http://stackoverflow.com/a/32507444
has answer: http://stackoverflow.com/a/22117832
score: 6
has comment: http://stackoverflow.com/comment/32077908
has comment: http://stackoverflow.com/comment/32120772
has comment: http://stackoverflow.com/comment/32095108
has comment: http://stackoverflow.com/comment/32076942
has comment: http://stackoverflow.com/comment/32089549
has comment: http://stackoverflow.com/comment/32087205
type: Question
has comment: http://stackoverflow.com/comment/32121043
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32086993
has body: I want to create an Aspect over a Jersey controller to measure how long the services take to be executed. I'm fighting against my pointcut since it isn't detected and my aspect never gets launched. I have tried using lots of pointcuts like: execution(@Monitor * *.*(..)) execution(public * *(..)) change the order of @Aspect and @Component Added a pointcut like this: @Pointcut("execution(@Monitor * *.*(..))") public void monitorRequestTargets(){} @Around("monitorRequestTargets()") Tried using AOP and CGLIB <aop:aspectj-autoproxy proxy-target-class="true"/> Also tried changing the order of configuration in context.xml Eclipse detects that my methods are being adviced by my aspect but it isn't executed at runtime. Could you give me any hint about why aspect is not created or the pointcut doesn't launch? My code is the following. Context.xml <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"> <annotation-driven /> <aop:aspectj-autoproxy /> <context:component-scan base-package="com.mypackage" /> </beans:beans> My MonitorAspect @Component @Aspect public class MonitorAspect { private static final Logger logger = LoggerFactory.getLogger(MonitorAspect.class); @Around("@annotation(com.mypackage.Monitor)") public void logTimeUsage(ProceedingJoinPoint joinPoint) …

filewriter
tag name: filewriter
type: Tag
tags question: http://stackoverflow.com/q/21217414
tags question: http://stackoverflow.com/q/21210697

overriding
tags question: http://stackoverflow.com/q/21338125
tags question: http://stackoverflow.com/q/21226244
tags question: http://stackoverflow.com/q/21254633
tags question: http://stackoverflow.com/q/21247126
tags question: http://stackoverflow.com/q/21282318
type: Tag
tags question: http://stackoverflow.com/q/21295883
tags question: http://stackoverflow.com/q/21333260
tags question: http://stackoverflow.com/q/21223555
tag name: overriding

http://stackoverflow.com/a/21249966
score: 1
answers question: http://stackoverflow.com/q/21249487
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21249487
type: Answer
has body: I went through you code, it seems you are storing images inside you project folder itself. I would suggest you to upload your images somewhere else outside the container.
upvote count: 1

http://stackoverflow.com/q/21208400
score: 0
answer count: 2
tagged with: sql
tagged with: intellij-idea
has title: MySQLIntegrityConstraintViolationException - running DAO project
tagged with: runtime-error
has comment: http://stackoverflow.com/comment/31938522
has answer: http://stackoverflow.com/a/21208518
has body: I created database and two tables for easy DAO program. DB is Mysql, and for creation I used terminal. Here is creation code for two tables: CREATE TABLE students ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(40), course INT, email VARCHAR(40), department_id INT NOT NULL, PRIMARY KEY(id), FOREIGN KEY(department_id) REFERENCES departments(department_id) ); CREATE TABLE departments ( department_id INT NOT NULL AUTO_INCREMENT, name VARCHAR(20), PRIMARY KEY(department_id) ); I used for IDE Intellij. it has smart DB support. You can see, how does it look: But when I run my code I saw next bunch of exceptions: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`University`.`students`, CONSTRAINT `students_ibfk_1` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`)) 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:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1041) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2825) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2156) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1379) at lab.epam.controller.dao.StudentDAO.save(StudentDAO.java:82) at lab.epam.DAOMain.main(DAOMain.java:20) at sun.reflect.NativeMethodAccessorImp…
type: Question
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21208834
tagged with: mysql
accepted answer: http://stackoverflow.com/a/21208518
has answer: http://stackoverflow.com/a/21208834

http://stackoverflow.com/comment/32157590
type: QuestionComment
comment on: http://stackoverflow.com/q/21332183
type: Comment
has text: Replace private GroceryItem[] list = null; by List you are getting error at list.add()
score: 0

http://stackoverflow.com/comment/32169231
comment on: http://stackoverflow.com/q/21338371
has text: Perhaps a better explanation of OOP is requred: http://docs.oracle.com/javase/tutorial/java/concepts/object.html
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43392816
type: Comment
comment on: http://stackoverflow.com/a/21348360
type: AnswerComment
has text: can you please tell me how to add ColumnGroup with button?
score: 0

http://stackoverflow.com/q/21271107
has comment: http://stackoverflow.com/comment/32050291
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/32051089
score: 0
has comment: http://stackoverflow.com/comment/32050136
answer count: 1
has comment: http://stackoverflow.com/comment/32050557
has answer: http://stackoverflow.com/a/21271686
has comment: http://stackoverflow.com/comment/32050421
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32050895
tagged with: swing
has title: Hibernate duplicates object after merge
has comment: http://stackoverflow.com/comment/32051081
has comment: http://stackoverflow.com/comment/32050502
accepted answer: http://stackoverflow.com/a/21271686
type: Question
has body: I have two objects who are in bi-directional relationship. public class Entity1 extends AbstractEntity implements Serializable{ ... //bi-directional many-to-one association to Entity2 @OneToMany(mappedBy="entity1", fetch=FetchType.EAGER) private Set&lt;Entity2&gt; entityTwos = new HashSet&lt;Entity2&gt;(); } public class Entity1 extends AbstractEntity implements Serializable{ ... //bi-directional many-to-one association to Entity1 @ManyToOne @JoinColumn(name="N_ENTITY1") private Entity1 entity1; } So when I modify Entity1 and do this: Entity2 entity2 = new Entity2(); entity2.setValue("I"); entity2.setDate(new Date()); entity1.addEntityTwo(entity2); Entity2HibernateDao dao = new Entity2HibernateDao(); dao.save(entity2); getEnitity1Dao().merge(nalog); everything is ok in database, but after i restart the application, there are two rows in my JTable for Entity1. If I delete: Entity2HibernateDao dao = new Entity2HibernateDao(); dao.save(entity2); Entity1 other attributes of Entity1 are refreshed in database, but of course there are no records for Entity2. I also tried with update() instead of merge(), but it didn't work also. Am I connecting references of Entity1 and Entity2 correctly? Or is it something else? Thanks.

http://stackoverflow.com/comment/32099871
has text: Please post the entire `launchPurchaseFlow`
comment on: http://stackoverflow.com/q/21299496
score: 0
type: Comment
type: QuestionComment

nexus
type: Tag
tags question: http://stackoverflow.com/q/21270925
tag name: nexus

http://stackoverflow.com/q/21275386
tagged with: light-sensor
has comment: http://stackoverflow.com/comment/32057553
has title: How to Set the Range of Brightness minimum and maximum in android
tagged with: android
has comment: http://stackoverflow.com/comment/32066582
answer count: 0
type: UnansweredQuestion
score: 0
linked to: http://stackoverflow.com/q/18312609
tagged with: java
has body: i want to decrease brightness slowly and gradually and user does not fell the brightness change but problem is every time lux value changed and when i decresee value and use thread to sleep it app hanged. is there any other way to handle lux value and also get Accuracy in brightness.... here is the code.... When eEXecuteEquation() method call b_v1(brightness value) updated.... suppose min=20 and max=70 @Override public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_LIGHT) { mLux = (int) event.values[0]; String luxStr = String.valueOf(mLux); pr_lux = mLux; //both are int eEXecuteEquation(); tv.setText("Max: " + maxb + " Min: " + minb + " Lux: " + luxStr + " Brightness Value: " + b_v1 ); if (b_v1 &gt; -1) { if (b_v1 &lt; minb) { try { setBrightnessLevel(minb); } catch (SettingNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if (b_v1 &gt; maxb) { try { setBrightnessLevel(maxb); } catch (SettingNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if (b_v1 &gt;= minb &amp;&amp; b_v1 &lt; maxb) { try { b2 = b_v1; setBrightnessLevel(b_v1); sendvalue=1; while (b_v1 == b2) { try { setBrightnessLevel(b2--); } catch (SettingNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } sendvalue=0; //new LongOperation().execute(""); } catch (SettingNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } int temp_max; private void setBrightnessLevel(int SysBackLightValue11) throws SettingNotFoundException { int brightnessMode = Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE); if (brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) { Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); } Settings.System.putInt(this.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, SysBackLightVa…
type: Question
tagged with: screen-brightness

http://stackoverflow.com/comment/31909075
has text: Check it i have written and tested now only.. and i have posted output also... IT WILL WORK..
comment on: http://stackoverflow.com/a/21191823
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21186438
tagged with: sockets
has title: Cannot get response from PHP socket server
tagged with: php
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21187023
tagged with: java
has body: I make simple socket java client and php cli-based socket echo server. But client doesn't get echo from server. Theres a code... [CLIENT_CLASS (JAVA)] import java.net.*; import java.io.*; import java.util.logging.Level; import java.util.logging.Logger; public class SocketManager { public static void main(String args[]) { int count = 0; Socket socket = null; System.out.println("[TO 8175] Connecting to " + "clashofages.ru" + ":" + 8175 + "..."); while (socket == null) { if (count &gt; 10) { System.out.println("[TO 8175] Can't connect to server..."); return 1; } socket = connect("clashofages.ru", 8175); count++; } System.out.println("[TO 8175] Successfuly connected!"); DataInputStream in = getInput(socket); if (in == null) { return 2; } DataOutputStream out = getOutput(socket); if (out == null) { return 3; } BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in)); String line = null; while (true) { System.out.println("[TO 8175] Type in message for server."); try { line = keyboard.readLine(); } catch (IOException ex) { Logger.getLogger(SocketManager.class.getName()).log(Level.SEVERE, null, ex); } System.out.println("[TO 8175] Sending message to server..."); int writeres = write(out, line); if (writeres != 2) { return 4 + writeres; } System.out.println("[TO 8175] Message sent successfuly!"); if (line.equals("exit")) { System.out.println("[TO 8175] Exiting..."); return 0; } line = read(in); if (line == null) { return 6; } System.out.println("[TO 8175] Server: " + line); } } public static Socket connect(String adress, int port) { Socket socket = null; InetAddress ipAddress = null; try { ipAddress = InetAddress.getByName(adress); } catch (UnknownHostException ex) { System.out.println("[SOCKET_ERROR] Can't convert " + adress + " to InetAdress object"); return socket; } try { socket = new Socket(ipAddress, port); } catch (IOException ex) { System.out.println("[SOCKET_ERROR] Can't connect to " + adress + ":" + port); return null; } return socket; } publi…
type: Question
answer count: 1
downvote count: 0
tagged with: connection
favorite count: 0
accepted answer: http://stackoverflow.com/a/21187023
upvote count: 2

http://stackoverflow.com/a/21208216
has body: Your first code snipped has declaration of method that creates new instance of the class. While the second snippet actually invokes (calls) previously declared method. This approach can be used to create new instance of the class and initialize it in a custom way.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21208163

http://stackoverflow.com/comment/32007963
has text: @peter.petrov I think you could argue that mathematically you have two equivalent ranges, while technically I don't. Yours requires more computation by a hair (addition, floor, and casting vs a single comparison). I don't think any statistical test could tell the difference in the results based on any sample size people are actually likely to draw.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21246795

http://stackoverflow.com/comment/32048201
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21269417
type: Comment
has text: @asaini007 the reason I ask is because it appears there is a fourth cell to the left of `listPanel`. Are you sure the code that calls this method is not adding anything to it? Is there another panel that contains `listPanel` which has another component?

http://stackoverflow.com/comment/32123594
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21313096
has text: @Niels i tried to do url encode/decode, the spaces are still coming up as ? marks.

http://stackoverflow.com/comment/31994679
comment on: http://stackoverflow.com/q/21239143
score: 0
type: Comment
type: QuestionComment
has text: Have you tried accessing URL ftp://ftp.wwpdb.org/pub/pdb/data/structures/divided/pdb/yy/pdb1yyo.ent.gz using something else than your program? (for example browser)

http://stackoverflow.com/comment/32074180
type: QuestionComment
comment on: http://stackoverflow.com/q/21285080
score: 0
has text: Use a hexadecimal editor, or a terminal hexadecimal viewer like `xxd`
type: Comment

http://stackoverflow.com/q/21267546
linked to: http://stackoverflow.com/q/6652687
score: 0
has body: Beginner programmer here. I have to append strings of file names together and have come up with the following methods: class ConsLoItem implements ILoItem { Item first; ILoItem rest; ConsLoItem(Item first, ILoItem rest) { this.first = first; this.rest = rest; } public String images() { if (this.rest.equals(new MtLoItem())) { return this.first.images(); } else return this.first.images() + ", " + this.rest.images(); } } and keep getting the same results, with: ", jesse.jpeg, " when I expect "jesse.jpeg". Any ideas on how to remove the ", " from the beginning and end of the file name?
has answer: http://stackoverflow.com/a/21267691
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/32043585
has comment: http://stackoverflow.com/comment/32043736
linked to: http://stackoverflow.com/q/2088037
type: UnansweredQuestion
has title: How do I separate strings with a comma and a space without having them being put before it?
tagged with: append
tagged with: java
has comment: http://stackoverflow.com/comment/32043598
type: Question

http://stackoverflow.com/q/21234053
tagged with: java
has comment: http://stackoverflow.com/comment/31985010
tagged with: caching
type: Question
has title: Can Java cache a specific function?
has body: I'm currently working on a Stroop Test for an institute of my university. While measuring the time the user needs to hit the keys is no problem, I was curious what kind of delay exist when I call for example System.nanoTimes(). I wrote a small test @Test public void nanoTest() { for(int i = 0; i &lt; 100; i++) { long t1 = System.nanoTime(); long t2 = System.nanoTime(); long t3 = System.nanoTime(); System.out.println("took: "+(t3-t1)); } } which tells me: took: 513 took: 0 took: 513 took: 513 took: 0 took: 0 took: 0 took: 0 took: 0 took: 514 took: 0 ... etc. There is no value other than 0, 513 or 514. If I replace long t2 = System.nanoTime(); with long t2 = System.currentTimeMillis(); it will print something like took: 1540 took: 513 took: 513 took: 0 took: 0 took: 514 took: 514 took: 513 took: 513 took: 513 took: 514 ... etc. I assume that the first time we call System.currentTimeMillis() the function is not cached (I'm not sure how the JVM handles caching ...) therefore the delay is way bigger then the usual 0.5ms. I can just assume that this happens because the function is cached and frequently called. While I am fine with a delay between 0 and 0.5 ms for calling nanoTimes() I'm not fine with having 1.5ms or even more for calling the time function. Can I tell the JVM or even my cpu to cache the specific time function? Can I tell the JVM to probably cache the whole programm? How can I achieve the smallest delay while measuring time? I'm aware that those numbers can differ from pc to pc and even differ if I run more programms in the background, therefore I try to get the smallest delay possible for the time measuring.
possible better answer: http://stackoverflow.com/a/21234568
downvote count: 0
has answer: http://stackoverflow.com/a/21234568
favorite count: 0
accepted answer: http://stackoverflow.com/a/21234394
tagged with: optimization
answer count: 3
has answer: http://stackoverflow.com/a/21234199
score: 1
tagged with: jvm
tagged with: time
upvote count: 1
has comment: http://stackoverflow.com/comment/31984397
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21234394

http://stackoverflow.com/comment/32014219
type: AnswerComment
has text: so for the line 3 `boolean[] charSet = new boolean[256]`, should I create the charSet as `boolean[] charSet = new boolean[65536];` ? thanks!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21249319

http://stackoverflow.com/q/21277904
type: UnansweredQuestion
tagged with: java
has body: I have some POJOs and I have the case in which I receive information about their fields in a non-knowledgeable way. I mean that I receive a Map for each instance, containing some pairs in the pattern [field_name : field_value] and I want to initialize the instance with the information from the map. So what I did is to create an Initializable interface with single method public void initialize (Map initMap) throws Exception Then I created a superclass to my POJOs to implement this interface method. That way i ensure that each of the classes I need can be initialized from a Map. I am not quite sure the pattern I could think of is the correct one, and I feel like there can be a standard Java solution for such trivial problem. So does anyone know if there is a standard way to do the above? Thanks for the answers!. EDIT (Answer): After some discussion in the topics below, it was explained to me that what i intend to do is not a standard case and I shall not expect a standard solution for it. I can agree with that. Also as you said its not so much effort to implement it. What I receive as input to Java can be described as a JSONObject. The information in this JSONObject is to be used to create specific java instances of specific classes that my implementation model consists of. For that reason I am using reflection. The classes that I am instatiating are described with big amount of fields and the information about the instances that i need to create consists of just some of the fields. So my approach is to create the instance, and use Map of that instance field information to initialize the objects with the required information. Conclusion: My problem is not a standard one. I will implement and manage the Initializable abstraction on my own. Big thanks to all that gave their opinion!!!
type: Question
has answer: http://stackoverflow.com/a/21278013
has comment: http://stackoverflow.com/comment/32061698
has comment: http://stackoverflow.com/comment/32061785
score: 0
answer count: 2
has title: Is there a standard way to ensure your custom class is Initializable
tagged with: initialization
has answer: http://stackoverflow.com/a/21277993

http://stackoverflow.com/comment/31929053
type: Comment
comment on: http://stackoverflow.com/a/21194775
has text: +1. As CF runs on java, it is certainly easy enough to interact with java objects. However, I am also wondering *why* you want to incorporate java. ie Do you really need it or is it just unnecessary complexity. Can you give us some background? Are you building a CF layer to interact with an *existing* java application, ...?
score: 1
type: AnswerComment

http://stackoverflow.com/q/21214328
favorite count: 0
tagged with: clib
type: UnansweredQuestion
has body: Is there a way for jnr to construct a struct for me in order to access a returned call using jnr. for example, if I wanted to use int statvfs(const char *path, struct statvfs *buf); where struct statvfs is: struct statvfs { unsigned long f_bsize; /* file system block size */ unsigned long f_frsize; /* fragment size */ fsblkcnt_t f_blocks; /* size of fs in f_frsize units */ fsblkcnt_t f_bfree; /* # free blocks */ fsblkcnt_t f_bavail; /* # free blocks for unprivileged users */ fsfilcnt_t f_files; /* # inodes */ fsfilcnt_t f_ffree; /* # free inodes */ fsfilcnt_t f_favail; /* # free inodes for unprivileged users */ unsigned long f_fsid; /* file system ID */ unsigned long f_flag; /* mount flags */ unsigned long f_namemax; /* maximum filename length */ }; how would I be able to access this?
downvote count: 0
score: 1
tagged with: java
has title: how to use java jnr to infer a clib struct
type: Question
has answer: http://stackoverflow.com/a/37466219
tagged with: jnr
upvote count: 1
answer count: 1

http://stackoverflow.com/q/21276124
answer count: 1
has title: Return an Image in Jersey Response
downvote count: 0
tagged with: tomcat
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21290021
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jersey
tagged with: image
tagged with: response
has body: I need to return an Image (as Stream) in one of my applications. After a short google i found a simple solution, but it only works for Opera and Chrome. Firefox and Safari will show a simple text with the info that the response is a stream. Here's how i do it right now: @GET @Path("/getImage") @Produces({ "images/gif", "images/png", "images/jpg", MediaType.APPLICATION_JSON }) public Response getImage(@QueryParam("width") Integer width, @QueryParam("height") Integer height) { //SOME UNRELEVANT STUFF... String mmcpath = gi.filepath; BufferedImage image = ImageUtil.getImageFromPath(mmcpath); if (image != null) { // resize the image to fit the GUI's image frame image = ImageUtil.resize(image, width, height); InputStream is = ImageUtil.getStreamFromImage(image, FileHelper.getFileSuffix(mmcpath)); if (is != null) { return Response.ok(is).build(); } else { return Response.noContent().build(); } } return Response.noContent().build(); } I hope someone has an idea how i have to change this method to get it working with the other browsers too. Thanks
has answer: http://stackoverflow.com/a/21290021

http://stackoverflow.com/a/21272269
score: 0
has body: You have 2 options for this. Set a cron job and let the operating system execute the script that starts your java program every hour or so. Use something like Quartz Scheduler. In this case your Java program would be running continuously and the scheduler would be within your Java program. There are various advantages and disadvantages to both approaches. In the first case the advantage is that if something wrong happens to the program, you know that in the next hour a new process with a fresh new instance of your program will launch, while in the second case if your Java program hangs for some reason you won't know unless you have some kind of monitoring. However, in case 2 you can maintain some kind of state information you might want to keep between runs. Quartz has also lots of advanced features, like maintaining info about executions in a database. You can also have the Quartz Scheduler run within your webserver itself (so no need for another process). Its just an extra few .jar files to include. So it depends what you actually want to do. You can refer to what features it supports here.
answers question: http://stackoverflow.com/q/21272074
type: Answer

http://stackoverflow.com/q/21285625
has comment: http://stackoverflow.com/comment/32076019
has comment: http://stackoverflow.com/comment/32076889
score: 0
has comment: http://stackoverflow.com/comment/32076366
answer count: 1
has comment: http://stackoverflow.com/comment/32074692
has comment: http://stackoverflow.com/comment/32076251
tagged with: android
has comment: http://stackoverflow.com/comment/32075043
has title: creating a String[] dynamically from a List<String>
has comment: http://stackoverflow.com/comment/32076786
type: UnansweredQuestion
has body: I should create this: listview.setAdapter(new yourAdapter(this, new String[] { "data1","data2" })); But I don't know how to create new String[]{...} dynamically. I have this code and I should use the CitazioniOutput array: String[] citazioni = getResources().getStringArray(R.array.citazioni); List&lt;String&gt; CitazioniOutput = new ArrayList&lt;String&gt;(); for (String value : citazioni) { CitazioniOutput.add(value); } I tried: listview.setAdapter(new yourAdapter(this, CitazioniOutput)); //and ArrayAdapter&lt;String&gt; adapter= new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1,CitazioniOutput); listview.setAdapter(new yourAdapter(this, adapter)); But nothing changed: it says The constructor is undefined How can I convert the List&lt;String&gt; into a String[]?
type: Question
has answer: http://stackoverflow.com/a/21286358
has comment: http://stackoverflow.com/comment/32075635
tagged with: java
has comment: http://stackoverflow.com/comment/32075049

celltable
type: Tag
tag name: celltable
tags question: http://stackoverflow.com/q/21338840

http://stackoverflow.com/q/21250294
score: 0
has body: I'm using latest JDK 7u45 for my development.When I create a simple servlet which used for generating verification code,I found out the image is rather blurred.The image looks just like this: The image is of rather poor quality,and look really poor with my Macbook pro retina display. The Code I'm using for creating the BufferedImage is rather simple: public static BufferedImage getImage() { BufferedImage image = new BufferedImage(IMAGE_WIDTH,IMAGE_HEIGHT,BufferedImage.TYPE_INT_RGB); Graphics graphics = image.getGraphics(); drawRandomNumber((Graphics2D)graphics); return image; } private static void drawRandomNumber(Graphics2D graphics) { graphics.setColor(Color.RED); graphics.setFont(new Font("Arial",Font.BOLD|Font.ITALIC,RANDOM_NUMBER_FONT_SIZE)); char lch = 'a',hch = 'z'; char lcach = 'A',hcach = 'Z'; int x = RANDOM_NUMBER_START_X; for (int i = 0;i &lt; RANDOM_NUMBER_NUM;i++) { char ch = new Random().nextBoolean() ? (char)(new Random().nextInt(hch - lch) + lch) : (char)(new Random().nextInt(hcach - lcach) + lcach); int degree = new Random().nextInt() % 30; graphics.rotate(degree * Math.PI / 180,x,RANDOM_NUMBER_START_Y); graphics.drawString(ch + "",x,RANDOM_NUMBER_START_Y); graphics.rotate(-degree * Math.PI / 180,x,RANDOM_NUMBER_START_Y); x += 60; } } And the code that writes the image to the servlet: ImageIO.write(image, "png", response.getOutputStream()); I just want to know If I want to create a high quality image which support HDPI display,what should I do?Is there any way to produce high quality image with java code?I tried many ways but they seem to help nothing.
answer count: 1
has comment: http://stackoverflow.com/comment/32020854
type: UnansweredQuestion
has title: Creatting a BufferedImage with Retina support
tagged with: java
tagged with: image
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/21250343

http://stackoverflow.com/comment/31952053
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21215914
has text: Can you give me a example, please.

http://stackoverflow.com/comment/31963612
comment on: http://stackoverflow.com/a/21210730
score: 0
type: Comment
has text: wow thats a good idea, sounds perfect actually, thank you very much :)
type: AnswerComment

http://stackoverflow.com/q/21283636
accepted answer: http://stackoverflow.com/a/21283838
linked to: http://stackoverflow.com/q/16471764
has answer: http://stackoverflow.com/a/21283747
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21283838
possible better answer: http://stackoverflow.com/a/21283878
type: Question
has answer: http://stackoverflow.com/a/21283777
score: 1
tagged with: java
has title: Create a Context Menu when Click Long in a Custom ListView
tagged with: listview
has comment: http://stackoverflow.com/comment/32071343
upvote count: 1
has comment: http://stackoverflow.com/comment/32071234
has answer: http://stackoverflow.com/a/21283878
favorite count: 0
has body: I want to show a context menu (OnClickLong)with delete and edit option, in a custom list i created with a custom list adapter. i will post the code SpotListFragment package com.pap.myspots.fragments; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import com.pap.myspots.R; import com.pap.myspots.R.layout; import com.pap.myspots.database.DBAdapter; import com.pap.myspots.listView.SpotList; import com.pap.myspots.listView.SpotListAdapter; import android.annotation.SuppressLint; import android.database.Cursor; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.ListFragment; import android.util.Log; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.LayoutInflater; import android.view.MenuInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemLongClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.Toast; public class SpotListFragment extends Fragment implements OnClickListener{ String nome; String local; Button createToast; List&lt;String&gt; nomes ; List&lt;String&gt; locais ; ListView listView; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_spotlist, container, false); DBAdapter db = new DBAdapter(getActivity()); db.open(); Cursor cursor = db.getAllTitles(); nomes = new ArrayList&lt;String&gt;(); while(cursor.moveToNext()){ String uname = cursor.getString(cursor.getColumnIndex("nome")); nomes.add(uname); } Cursor cursor2 = db.getAllTitles(); locais = new ArrayList&lt;String&gt;(); while(cursor2.moveToNext()){ String ulocal = cursor2.getString(cursor.getColumnIndex("local")); locais.add(ulocal); } SpotListAdapter adapter = new SpotListA…
has answer: http://stackoverflow.com/a/24238903
answer count: 5
tagged with: android-listview
tagged with: android

http://stackoverflow.com/comment/32123528
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21313096
has text: I'm guessing it has something to do with url encoding? For example spaces becoming %20 etc.
score: 0

http://stackoverflow.com/comment/32148904
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21327187
score: 0
has text: What is your operation system?

http://stackoverflow.com/comment/31947601
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21213033
has text: I only added "export JAVA_HOME=/usr/lib/jvm/jdk/" to hadoop-env.sh and rest is the way it was.

http://stackoverflow.com/q/21349737
has title: Too Slow to Load the JSP page
possible better answer: http://stackoverflow.com/a/21349792
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21349792
tagged with: jstl
tagged with: jsp
has answer: http://stackoverflow.com/a/21349898
has body: im newbie in jsp jstl tag. i have a question, recently i build web application that can calculate outlet's total amount by revenue code. i make the query inside the jsp using jstl tag. the problem is my page take too long to load. i got about 60 outlet, 26 revenue code. 1 outlet can have at least 4 revenue code. here is my code in dashboard.jsp <sql:query var="outletView" dataSource="${datasource}"> SELECT outletid FROM user_payment group by outletid </sql:query> Outlet ID Revenue Code Total Transaction Total Amount <c:forEach items="${outletView.rows}" var="rowOutlet"> <sql:query var="outletView" dataSource="${datasource}"> SELECT revcode, count(receiptnumbe) as Transactions, sum(amount) as total FROM user_payment Where outletid='${rowOutlet.outletid}' Group by revcode </sql:query> <c:forEach items="${outletView.rows}" var="displayrevcode"> ${rowOutlet.outletid} ${displayrevcode.revcode} ${displayrevcode.Transactions} ${displayrevcode.total} </c:forEach> </c:forEach> can make it faster? i have to fetch and calculate each outlet's revenue code amount...
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21349898
type: Question

http://stackoverflow.com/q/21201578
type: UnansweredQuestion
tagged with: jbutton
score: 1
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/18398178
has answer: http://stackoverflow.com/a/21201784
has body: Is it a good idea to edit a JButton's interface by using css? If no, please specify alternatives. Thanks in advance.
answer count: 1
tagged with: user-interface
downvote count: 0
has title: How to customize a JButton's interface using css
favorite count: 0
has comment: http://stackoverflow.com/comment/31926656

http://stackoverflow.com/comment/31984133
score: 0
type: QuestionComment
has text: I m not sure, but probably you have to format `DateTime` object individually. Check related links [link](http://stackoverflow.com/questions/10442732/convert-datetime-object-java-to-json-string)
type: Comment
comment on: http://stackoverflow.com/q/21232678

http://stackoverflow.com/comment/32126006
type: AnswerComment
has text: +1 ArrayList can avoid creating an Iterator, but it still iterates over the elements.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21313711

http://stackoverflow.com/q/21266532
tagged with: jbutton
has body: I am trying to use the grid[x][y].setPressedBackgroundColor(getColor()); to set the background but I recieve this error message error: cannot find symbol grid[x][y].setPressedBackgroundColor(getColor()); ^ symbol: method setPressedBackgroundColor(Color) location: class JButton 1 error Process completed. Here is the code for the JButton. The error is thrown in the ButtonGrid constructor: import javax.swing.*; import java.awt.event.*; import java.awt.*; public class ButtonGrid { class MyButton extends JButton { public Color hoverBackgroundColor; public Color pressedBackgroundColor; public MyButton() { this(null); } public MyButton(String text) { super("text"); super.setContentAreaFilled(false); } @Override public void paintComponent(Graphics g) { if (getModel().isPressed()) { g.setColor(pressedBackgroundColor); } else if (getModel().isRollover()) { g.setColor(hoverBackgroundColor); } else { g.setColor(getBackground()); } g.fillRect(0, 0, getWidth(), getHeight()); super.paintComponent(g); } @Override public void setContentAreaFilled(boolean b) { } public Color getHoverBackgroundColor() { return hoverBackgroundColor; } public void setHoverBackgroundColor(Color hoverBackgroundColor) { this.hoverBackgroundColor = hoverBackgroundColor; } public Color getPressedBackgroundColor() { return pressedBackgroundColor; } public void setPressedBackgroundColor(Color pressedBackgroundColor) { this.pressedBackgroundColor = pressedBackgroundColor; } } JFrame frame=new JFrame(); //creates frame JButton[][] grid; //names the grid public ButtonGrid(int width, int length){ int count = 1; //counting variable frame.setLayout(new GridLayout(width,length)); //sets the layout grid=new JButton[width][length]; //sets the size of grid for(int y=0; y&lt;length; y++){ for(int x=0; x&lt;width; x++){ grid[x][y]=new JButton("( "+ count++ +" )"); //creates new button grid[x][y].setForeground(getColor()); //sets text color grid[x][y].setHorizontalTextPosition(SwingConstants.CENTER); //centers text grid[x]…
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/21225760
type: Question
has title: How to set the pressed background color of a JButton?
answer count: 1
has comment: http://stackoverflow.com/comment/32041634
has comment: http://stackoverflow.com/comment/32041581
has comment: http://stackoverflow.com/comment/32041610
tagged with: compiler-errors
has answer: http://stackoverflow.com/a/21266689
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/comment/32000932
type: QuestionComment
comment on: http://stackoverflow.com/q/21243192
score: 1
has text: What don't you understand? Doesn't it work? Where is your `merge()` method?
type: Comment

http://stackoverflow.com/a/21277314
has body: private final int f; You use final for your declaration this will not allow to re-assign another value for f A final variable can only be initialized once, either via an initializer or an assignment statement. Read more about final here so just use private int f;
type: Answer
answers question: http://stackoverflow.com/q/21277250
score: 0

http://stackoverflow.com/comment/31945397
score: 0
has text: Many IDE(s) (like NetBeans, IntelliJ and Eclipse) can do that; I'm not aware of an easy way to do it from the command line. But it is possible or the IDE(s) couldn't do it.
comment on: http://stackoverflow.com/q/21212060
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21190907
has answer: http://stackoverflow.com/a/28870100
tagged with: lotus-domino
accepted answer: http://stackoverflow.com/a/28870100
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32025990
tagged with: xpages
has title: XPage java class causes com.ibm.designer.domino.napi.NotesAPIException
tagged with: domino-designer-eclipse
downvote count: 0
answer count: 1
has body: domino version 9.0.1 designer version 9.0.1 (I changed the text of the stack trace slightly to take the customer out of the picture.) Every once in a while in a developmental environment, I have been getting the following stacktrace in the server log: &gt; 7.01.2014 17:01:13 HTTP JVM: com.ibm.designer.domino.napi.NotesAPIException: File access error: &gt; Error while getting information on item $FileData &gt; 17.01.2014 17:01:13 HTTP JVM: Note item not found. For more detailed information, please consult error-log-0.xml located in &gt; c:/Domino/data/domino/workspace/logs &gt; 17.01.2014 17:01:13 HTTP JVM: Managedbean DatabaseController could not be created Can't instantiate class: &gt; 'de.holistic.cust.epr.EprDatabaseController'.. &gt; java.lang.ClassNotFoundException: class &gt; java.lang.ClassNotFoundException: &gt; de.holistic.cust.epr.EprDatabaseController. For more de &gt; 17.01.2014 17:01:13 HTTP JVM: ailed information, please consult error-log-0.xml located in c:/Domino/data/domino/workspace/logs &gt; 17.01.2014 17:01:13 HTTP JVM: com.ibm.xsp.webapp.FacesServlet$ExtendedServletException: &gt; com.ibm.xsp.exception.EvaluationExceptionEx: Error while executing &gt; JavaScript computed expression the following from the xml log file does not show any of the promised extra information com.ibm.designer.domino.napi.NotesAPIException: File access error: Error while getting information on item $FileData Note item not found This exception is also sometimes coupled with a SecurityException. 1. Resigning the database does not do anything 2. changing the classes and xpages and resaving sometimes fixed the issue once, or it was just the time it took me to try that 3. restarting the HTTP task / server never makes a differance 4. cleaning and building does not do a thing. After google searching for the issue, some people have had this issue while storing their java classes in the java area of the "normal designer" perspective. I have my java code in a custom source folder …
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31975273

http://stackoverflow.com/comment/32130041
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21316443
type: Comment
has text: If it's being defined by a developer then let them expose their functionality through a plugin. Or use Groovy/JavaScript/etc and let the whole thing be done through actual code. Or etc. If all you want is to generate classes, *any* templating mechanism should work, e.g., Velocity, FreeMarker, Mustache, whatever. Your question is too broad, opinion-based, and doesn't contain enough information to help figure out what's wrong with your current solution, why Velocity isn't a good solution, etc.

http://stackoverflow.com/a/21343451
type: Answer
score: 2
upvote count: 2
has body: Just add a mouse listener button.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evtent) { // use evtent.getClickCount() } });
downvote count: 0
answers question: http://stackoverflow.com/q/21343381

http://stackoverflow.com/q/21248995
possible better answer: http://stackoverflow.com/a/21249044
has answer: http://stackoverflow.com/a/21249044
linked to: http://stackoverflow.com/q/17454529
has body: I have text file on my ftp server. I am trying to write into this file but couldn't. This is my code. URL url = new URL("ftp://username:pass@thunder.cise.ufl.edu/public/foler/a.txt;type=i"); URLConnection urlc = url.openConnection(); OutputStream os = urlc.getOutputStream(); // To upload OutputStream buffer = new BufferedOutputStream(os); ObjectOutput output = new ObjectOutputStream(buffer); output.writeChars("hello"); buffer.close(); os.close(); output.close();
accepted answer: http://stackoverflow.com/a/22243166
tagged with: ftp
type: AnsweredQuestion
score: 0
tagged with: file
tagged with: fwrite
type: Question
has answer: http://stackoverflow.com/a/21249729
tagged with: java
has title: Writing into text file on ftp server in Java
has answer: http://stackoverflow.com/a/22243166
answer count: 3

http://stackoverflow.com/q/21273124
has title: R.java not to generate
tagged with: java
tagged with: resources
answer count: 1
score: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has body: My menu files are causing my R.java not to generate. I am not sure what the error could be. Here are the .xml files: display_message.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" android:showAsAction="ifRoom" /&gt; &lt;item android:id="@+id/action_settings" android:orderInCategory="100" android:showAsAction="never" android:title="@string/action_settings"/&gt; main.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" android:showAsAction="ifRoom" /&gt; &lt;item android:id="@+id/action_settings" android:orderInCategory="100" android:showAsAction="never" android:title="@string/action_settings"/&gt;
has comment: http://stackoverflow.com/comment/32053828
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/21273177

http://stackoverflow.com/q/21201068
score: 0
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/31926011
type: Question
has comment: http://stackoverflow.com/comment/31925919
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/31925854
has title: Can't get JTextField value to Database
has body: In here NewJLabel is my Swing file and This is my main class to access everything and I need to get value from text field to database. This code compiles and runs but does not update in database. I am using Netbeans and the connection between MySQL and Java is working. public class Patient extends JFrame implements ActionListener { NewJPanel patient=new NewJPanel(); static Patient p=new Patient(); public static void main(String arg[]){ SwingUtilities.invokeLater(new Runnable(){ @Override public void run(){ JFrame frame=new JFrame(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.getContentPane().add(new NewJPanel()); frame.pack(); frame.setVisible(true); p.addregno(); } }); } public void addregno(){ JButton save=patient.getSave(); save.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { JTextField reg= patient.getRegno(); String s=reg.getText(); System.out.println(s); int n=Integer.parseInt(s); try{ Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/hos", "root", ""); Statement state=(Statement) con.createStatement(); state.executeUpdate("insert into patient (regno) values ('"+n+"')"); }catch(SQLException | ClassNotFoundException ex){ Logger.getLogger(NewJPanel.class.getName()).log(Level.SEVERE, null, ex); } } }); } @Override public void actionPerformed(ActionEvent e) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
answer count: 0

http://stackoverflow.com/q/21280567
upvote count: 2
answer count: 2
has body: Any suggestions on how to effectivley do this? I need it for autmization of .sql-data-delivery and couldn't find a solution till now. For reading out the encoding i use the juniversalchardet-1.0.3 library, which works pretty well. Still i also have to read out the the line-ending format and if needed change it. any help would be apprececiated.
tagged with: java
has title: Convert DOS line endings to Linux line endings and vice versa in java
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: line-endings
possible better answer: http://stackoverflow.com/a/21280894
favorite count: 0
has answer: http://stackoverflow.com/a/21280894
type: Question
has answer: http://stackoverflow.com/a/21330445
tagged with: unix
accepted answer: http://stackoverflow.com/a/21330445

http://stackoverflow.com/q/21325355
tagged with: android-search
tagged with: android
has comment: http://stackoverflow.com/comment/32849139
type: UnansweredQuestion
has title: how to implements getFilter for customAdapter android
has body: i have implemneted search functionality for custom adapter but stil is not working, i have posted my code if anything wrong correct me. java code @Override public Filter getFilter() { /** * A filter object which will filter message key * */ return filter; } Filter filter = new Filter() { @SuppressWarnings("unchecked") @Override protected void publishResults(CharSequence constraint, FilterResults results) { mEventUtil = (List&lt;Event&gt;) results.values; notifyDataSetChanged(); } @Override protected FilterResults performFiltering(CharSequence constraint) { FilterResults results = new FilterResults(); if (mOriginalValues == null) { mOriginalValues = new ArrayList&lt;Event&gt;(mEventUtil); // mOriginalValues } // if (mListItem == null) { // mListItem = new ArrayList&lt;String&gt;(); // for (Event message : mOriginalValues) { // mListItem.add(message.getEvent_Title()); // } // } /** * * If constraint(CharSequence that is received) is null returns * the mOriginalValues(Original) values else does the Filtering * and returns FilteredArrList(Filtered) * **/ if (constraint == null || constraint.length() == 0) { /* * CONTRACT FOR IMPLEMENTING FILTER : set the Original * values to result which will be returned for publishing */ results.count = mOriginalValues.size(); results.values = mOriginalValues; } else { /* Do the filtering */ constraint = constraint.toString().toLowerCase(); List&lt;Event&gt; FilteredArrList = new ArrayList&lt;Event&gt;(mOriginalValues.size()); for (int i = 0; i &lt; mOriginalValues.size(); i++) { Event event = mOriginalValues.get(i); if (event.getEvent_Title().toLowerCase().contains(constraint.toString())) { FilteredArrList.add(event); }else{ } } // set the Filtered result to return results.count = FilteredArrList.size(); results.values = FilteredArrList; } return results; } };
score: 2
tagged with: android-cursoradapter
has answer: http://stackoverflow.com/a/26712288
tagged with: java
type: Question
upvote count: 2
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21325446
favorite count: 0
has comment: http://stackoverflow.com/comment/32145686

http://stackoverflow.com/q/21232250
type: Question
tagged with: apache
downvote count: 0
has title: Apache Lucene - Creating and Storing an Index?
tagged with: lucene
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21237546
accepted answer: http://stackoverflow.com/a/21237546
linked to: http://stackoverflow.com/q/21229469
has comment: http://stackoverflow.com/comment/31981492
upvote count: 1
tagged with: spring-mvc
type: AnsweredQuestion
has body: This post if a follow-on from my previous question: Apache Lucene - Optimizing Searching I want to create an index from title stored in my database, store the index on the server from which I am running my web application, and have that index available to all users who are using the search feature on the web application. I will update the index when a new title is added, edited or deleted. I cannot find a tutorial to do this in Apache Lucene, so can anyone help me code this in Java (using Spring).
score: 1
tagged with: java

http://stackoverflow.com/comment/31915050
has text: Possible duplicate: http://stackoverflow.com/questions/1247772/is-there-an-equivalent-of-java-util-regex-for-glob-type-patterns
comment on: http://stackoverflow.com/q/21195031
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/21224625
type: AcceptedAnswer
score: 4
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/31967949
has body: The problem is that double maxY = Double.MIN_VALUE; is near 0, in fact it is 4.9E-324 which is equivalent to 4.9 * Math.pow(10, -324). That's why the sorting is not working. You could try double maxY = -Double.MAX_VALUE; instead. Double.MIN_VALUE: A constant holding the smallest positive nonzero value of type double, 2^(-1074). Note: You may want to change maxX too. Edit: You may also find interesting this: Double.NEGATIVE_INFINITY.
accepted answer of: http://stackoverflow.com/q/21224526
has comment: http://stackoverflow.com/comment/31967973
answers question: http://stackoverflow.com/q/21224526

http://stackoverflow.com/comment/31936594
score: 0
type: Comment
has text: @user3151146: see comment to original question.
type: AnswerComment
comment on: http://stackoverflow.com/a/21207105

http://stackoverflow.com/comment/31994876
type: Comment
has text: @JordyV The `JsonReader` parses the JSON. You've retrieved a `JsonObject` from it. This `JsonObject` is the root object. It has nested objects and arrays. If it could read anything but there were multiple nested elements named `id`, which would it choose? You have to go element by element.
score: 0
comment on: http://stackoverflow.com/a/21239599
type: AnswerComment

http://stackoverflow.com/q/21340508
tagged with: maven
has comment: http://stackoverflow.com/comment/32173137
type: AnsweredQuestion
score: 7
has answer: http://stackoverflow.com/a/21340621
tagged with: java
upvote count: 7
type: Question
has comment: http://stackoverflow.com/comment/32173431
has comment: http://stackoverflow.com/comment/32173065
has title: How can I organize source-generation in Maven?
possible better answer: http://stackoverflow.com/a/21340674
has answer: http://stackoverflow.com/a/21340674
accepted answer: http://stackoverflow.com/a/21340621
answer count: 3
has comment: http://stackoverflow.com/comment/32173172
downvote count: 0
tagged with: maven-plugin
favorite count: 0
has comment: http://stackoverflow.com/comment/32173400
has body: I have a Maven plugin which generates sources for my java project and places them into 'target/generated-sources' folder. I need these sources at compile-time. I want to have them in my project while modifying it, already generated. And of course, I want to put them into the correct folder under 'src' folder, and not into 'target/generated-sources'. How can I organize this using Maven? In other words, I want to be able: generate sources I need by running some goal of my special source-generating plugin (already done, the sources have the package I specified) move these generated sources to 'src/main/java/...' folder of standart Maven layout. remove them from 'target/generated-sources' folder, because otherwise mvn clean install command raises error which says that I have "duplicate class". Indeed, if I just copy generated sources from target to src - I have to classes with the same name and package, though one of them is located in target folder. Which Maven plugins can hlp with this? I suppose this is a typical task.
linked to: http://stackoverflow.com/q/10734898
has answer: http://stackoverflow.com/a/21340721

http://stackoverflow.com/q/21253778
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21254054
has title: can xpath be used to search links from website?
type: Question
has body: I am searching for functions like to find if the link exist in the webpage. and if the link exist than print something link "link found!". example: ( I want to find XPATH "123") driver.findElement(By.xpath ("123")); if (the xpath found the "123"){ System.out.printIn ("link found") } else { System.out.printIn ("missing link..") }
answer count: 2
score: 0
possible better answer: http://stackoverflow.com/a/21253926
has answer: http://stackoverflow.com/a/21254054
has answer: http://stackoverflow.com/a/21253926
tagged with: xpath
tagged with: selenium

http://stackoverflow.com/a/21206539
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31941192
has body: There are two folders, and two issues. We will fix them one at a time. Then they will be explained. make a main directory just under src move the src/java folder into src/main, the result should be src/main/java Then to fix your resources folder move the src/resources/main into src/main renaming it at the same time to src/main/resources. Now the rationale. This isn't really about Eclipse or Netbeans, it is about Maven. Maven imposes a particular directory naming convention. Maven has put some time and effort into the convention, and it is generally well thought out. More importantly, Maven has been pretty popular, and it's convention is seen as a de-facto standard. Your Netbeans project isn't properly configured. However, you could solve it one of two ways: you could configure every detail, or you could adapt to the standard expected conventions. Since this isn't just Netbean's conventions, but also Maven's conventions, and most IDEs expect these conventions (or at least accommodate them), it is probably a better idea to follow them than to reconfigure you Netbeans to find sources and resources in nonstandard locations.
has comment: http://stackoverflow.com/comment/31935169
accepted answer of: http://stackoverflow.com/q/21206421
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21206421

android-gradle-plugin
tags question: http://stackoverflow.com/q/21330021
tags question: http://stackoverflow.com/q/21213487
tags question: http://stackoverflow.com/q/21319912
tag name: android-gradle-plugin
type: Tag

http://stackoverflow.com/a/21250811
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/32014695
score: 1
answers question: http://stackoverflow.com/q/21250411
upvote count: 1
has body: //something like that getClass().getResource("../../../public_html/resources/images/img.gif") I mean the file path base on your project target folder or bin folder.

http://stackoverflow.com/q/21245111
tagged with: swing
tagged with: git
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32084150
accepted answer: http://stackoverflow.com/a/21245578
has body: I've searched around and cant seem to find a definitive answer. I have a Java Swing project on intranet git server that will have contributors using different IDEs. Is there a best practice for setting this up? I would like the repository to work on both Eclipse and Netbeans naturally. Should we keep the IDE specific files as part of the repository? Should I create separate branches for each of the IDEs? Are there any drawbacks I should watch out for? Thanks! [edit] I got flagged that this answer may be opinionated. Redirecting the question: Assuming we dont use something like Maven, what negative impacts are there in just storing both Netbeans and Eclipse centric files in the source control?
tagged with: java
tagged with: eclipse
has title: Best practice for Git repository supporting both Netbeans and Eclipse users
type: Question
score: 0
linked to: http://stackoverflow.com/q/10301845
answer count: 1
has answer: http://stackoverflow.com/a/21245578
tagged with: netbeans
has comment: http://stackoverflow.com/comment/32004741

http://stackoverflow.com/q/21270145
tagged with: java
type: Question
has body: I want to prove that these two matrices have a mapping: a:{{0 2 3 1},{2 0 3 1},{3 3 0 4},{1 1 4 0}} b:{{0 4 3 3},{4 0 1 1},{3 1 0 2},{3 1 2 0}} As you can see by interchanging rows and columns i can obtain the second matrix from the first but i don't how how to code this in java or c. Please help me out. The matrices are taken as two dimensional arrays a[4][4] and b[4][4] respectively.
accepted answer: http://stackoverflow.com/a/21272021
score: 0
tagged with: matrix
answer count: 1
has title: How do you find whether two 2-dimensional arrays(or matrices) are same?(only you can do interchange row operation or interchange column operation)
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/21272021
type: AnsweredQuestion

http://stackoverflow.com/a/21273084
downvote count: 0
type: Answer
score: 9
upvote count: 9
answers question: http://stackoverflow.com/q/21272877
has body: The JVM (or for that matter any process) that wants to allocate memory will call the C runtime 'malloc' function. This function maintains the heap memory of the C runtime. It, in turn, obtains memory from the operating system kernel - the function used for this is platform dependent; in Linux it could be using the brk or sbrk system calls. Once the memory has been obtained by the JVM, it manages the memory itself, allocating parts of it to the various objects created by the running program. Virtual memory is handled entirely by the operating system kernel. The kernel manages mapping of physical memory pages to the address space of various processes; if there is less physical memory than is needed by all the processes in the system then the OS Kernel will swap some of it out to disk. You can't (and don't need to) force processes to use Virtual Memory. It is transparent to your process. If you are getting 'out of memory' errors, then the causes are likely to be: The JVM limits are being exceeded. These are controlled by various command line arguments and/or properties as you stated in your question The OS may have run out of swap space (or not have any swap space configured to start with). Or some OSs don't even support virtual memory, in which case you have run out of real memory. Most OSs have facilities for the administrator to limit the amount of memory consumed by a process - for example, in Linux the setrlimit system call and/or the ulimit shell command, both of which set limits that the kernel will observe. If a process requests more memory than is allowed by the limits, then the attempt will fail (typically this results in an out of memory message).

http://stackoverflow.com/comment/31967917
score: 3
has text: Each function should only do one thing.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21224610

http://stackoverflow.com/a/21253043
answers question: http://stackoverflow.com/q/21252922
type: Answer
has body: change this to: protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.splash); ImageView iv = (ImageView) findViewById(R.id.iv1); iv.setBackgroundResource(R.animator.animation); AnimationDrawable anim = (AnimationDrawable) iv.getBackground(); anim.start(); new Handler().postDelayed(new Runnable() { @Override public void run() { startActivity(new Intent(Splash.this,Main.class)); } }, 2000); }
score: 0

http://stackoverflow.com/q/21322451
has title: @EntityListeners configured from container
has body: I have a EntityListener that needs to be configurable (typical data source info: driver, user, password), but I´d like to avoid adding one more properties file to the project. Is there any way to retrieve from some standard configuration place such as web.xml? It seems that injection via @Resource will be only available in JPA 2.1 (I am using JPA 2.0). UPDATE - to make this clear In my entity bean, I have an annotation @EntityListeners(MyEntityListener.class). So MyEntityListener may have methods annotated with @PostPersist for example. When my entity bean is gonna be persisted, this method is called. What I want is to retrieve the data for MyEntityListener initialization without using another configuration file.
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32152942
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/32167941
has comment: http://stackoverflow.com/comment/32146704
type: Question
upvote count: 0
tagged with: jpa
has comment: http://stackoverflow.com/comment/32169792
favorite count: 0
accepted answer: http://stackoverflow.com/a/21338839
answer count: 1
tagged with: entitylisteners
has answer: http://stackoverflow.com/a/21338839
tagged with: openjpa

http://stackoverflow.com/comment/32114227
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21276421
has text: thanks... I got all paymnet_status return by Paypal on Paypal IPN.

http://stackoverflow.com/comment/32075498
comment on: http://stackoverflow.com/q/21284774
score: 0
type: Comment
type: QuestionComment
has text: 2.2675

http://stackoverflow.com/comment/31957602
comment on: http://stackoverflow.com/q/21218989
type: QuestionComment
type: Comment
has text: Edit your previous question. Don't [repost](http://stackoverflow.com/questions/21218439/regaring-usage-of-read-and-readline-functions). This question will almost certainly be closed.
score: 2

http://stackoverflow.com/comment/32191897
has text: How did you lookup the server IP address?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21350423

http://stackoverflow.com/a/21265484
has comment: http://stackoverflow.com/comment/32039982
has comment: http://stackoverflow.com/comment/32039664
answers question: http://stackoverflow.com/q/21265302
has comment: http://stackoverflow.com/comment/32039991
has comment: http://stackoverflow.com/comment/32040088
score: 0
has body: It seems that your bitmap array is too small (but not null). Please, check that bitmap array have equal or greater items than titoli array. For example: public ParsingArrayAdapter(Context context,ArrayList&lt;String&gt; titoli, List&lt;Bitmap&gt; bitmap) { super(context,TITOLO); this.c = context; this.titoli = titoli; this.bitmap = bitmap; this.inflater = LayoutInflater.from(c); if (this.titoli.size() &gt; this.bitmap.size()) Log.d("Array compare", "Titoli &gt; Bitmap!"); } and check log output
has comment: http://stackoverflow.com/comment/32039868
type: Answer

http://stackoverflow.com/comment/31933911
comment on: http://stackoverflow.com/q/21205871
has text: It depends on what you mean with "light" and "dark". Maybe setting a threshold could help?
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/21236672
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31990324
answer count: 1
has title: Spring-Batch: Define a parent job with parameters
has answer: http://stackoverflow.com/a/21261220
tagged with: spring-batch
score: 0
has body: I am using spring-batch to copy data from one datasource into another. I have multiple xml files with the defintions of the necessary steps and jobs. They are all pretty similar with a lot of duplicate "code". The only differences are ususally the SQL that selects data from the first datasource and the name of the table where the data is inserted in the second datasource. I would like to create a parent job that consists of the steps and jobs to copy the data and only takes the SQL and the name of the target table as a parameter. I know, i can set a parent job with the 'parent' attribute: &lt;batch:job id="copyDataJob1" parent="AbstractCopyJob"&gt; ... &lt;/batch&gt; But how can I pass and use these parameters in the definition of the parent job?
has comment: http://stackoverflow.com/comment/31989632
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/q/21202079
has title: retrieving the path of an ImageIcon
answer count: 2
has answer: http://stackoverflow.com/a/21202970
downvote count: 0
has body: I have a jlabel that has already an icon, and i want to change the icon when i exit the mouse from the label, i tried this code, it shows no syntax error private void LabelMouseExited(java.awt.event.MouseEvent evt) { if(Label.getIcon().toString().equals("cyberjayacinema/images/Blue%20E1")) { Label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cyberjayacinema/images/red E1.PNG"))); } else { Label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cyberjayacinema/images/white E1.PNG"))); } but only the else case works, although the imageicon is set to the if case, so i guess the error is with retrieving the path of the icon, i assume the way i wrote my getImageIcon was wrong, I wish someone can help me with this. thank you
favorite count: 0
tagged with: jlabel
tagged with: imageicon
has answer: http://stackoverflow.com/a/21202146
possible better answer: http://stackoverflow.com/a/21202146
type: AnsweredQuestion
tagged with: netbeans
accepted answer: http://stackoverflow.com/a/21202970
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/32141643
type: Comment
comment on: http://stackoverflow.com/a/21322670
has text: The compiler *can* catch this example, it's just that generally they don't bother. So there's some interpretation to be done on the question, does it want an example that the compiler *necessarily* cannot catch, or just one that your compiler can't catch because it's not smart enough...
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32160764
comment on: http://stackoverflow.com/a/21334087
type: AnswerComment
has text: @Raghunandan Because i want to reuse it in different activities...so i want this approach..is there any better way or suggestion??
type: Comment
score: 0

http://stackoverflow.com/comment/32020792
type: Comment
has text: @RohitJain So in words, if I write `int a[];`, what you say `a` is? How is it differ from `String b;`? (Both are not initialized)
comment on: http://stackoverflow.com/a/21254392
type: AnswerComment
score: 0

http://stackoverflow.com/a/21264976
answers question: http://stackoverflow.com/q/21263845
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21263845
has body: Unlike a build script, a task or plugin class has no implicit Project context. Hence, it's project.ant, project.file, etc. Also, tasks have to be declared and configured outside the buildscript block (see subproject build.gradle).
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/31900966
comment on: http://stackoverflow.com/q/21187591
score: 0
type: QuestionComment
type: Comment
has text: " I have a Java program that works perfectly with the code below" - Please keep in mind that code that works in Java might NOT work in Android...

http://stackoverflow.com/comment/32143005
score: 0
type: AnswerComment
has text: and i believe its related because we can't override static methods. Great. I knew there are few other things like serialization , lazy loading etc but i was missing this very important reason.
type: Comment
comment on: http://stackoverflow.com/a/21323697

http://stackoverflow.com/comment/34689090
score: 0
comment on: http://stackoverflow.com/q/21258905
type: Comment
type: QuestionComment
has text: Already tried that Kathir, but thankyou :)

http://stackoverflow.com/q/21281843
tagged with: java
has answer: http://stackoverflow.com/a/21296302
type: Question
has body: I'm having problems with overriding bindings of PrivateModule. Here is my example project: http://pastebin.com/3BxUT90H So i have 3 cars, each gets Transmission and Engine from CommonModule. And i bind Driveline to each car separately with annotations, so each gets different class. So standard robot leg problem/solution. But now lets presume i have 10 different cars and i would like to change the Engine in just one module. I could throw out Engine from CommonModule and define Engine in all 10 modules. But better solution would be to override Engine binding in just that one class. How can i achieve this? If i bind(Engine.class).to(PetrolEngine.class); in Module3 i naturally get A binding to Engine was already configured at. Thats why we have Modules.override. But Injector injector = Guice.createInjector( commonModule, module1, module2, Modules.override(commonModule).with(module3) ); gives me the same error. So is there a way to define PrivateModule and override binding that is defined in AbstractModule?
tagged with: guice
score: 0
answer count: 1
type: UnansweredQuestion
has title: Robot leg PrivateModule and binding overriding

http://stackoverflow.com/q/21308361
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32155626
has comment: http://stackoverflow.com/comment/32115056
tagged with: jfreechart
type: Question
has comment: http://stackoverflow.com/comment/32155636
has title: JFreeChart some ChartMouseEvent are skipped
has comment: http://stackoverflow.com/comment/32154762
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32123207
has body: Recently I'm trying to implement a simple ChartMouseListener in JFreeChart and I recognized the problem that not each event causes listener reaction. It's just a simple code: chartPanel.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseMoved(final ChartMouseEvent event) { } @Override public void chartMouseClicked(final ChartMouseEvent event) { final ChartEntity entity = event.getEntity(); System.out.println(event.getTrigger().getWhen()); }); Not each 'click' event causes system out. Is it a bug or I'm doing sth wrong?

http://stackoverflow.com/a/21236514
type: Answer
answers question: http://stackoverflow.com/q/21236398
has body: If none of the other answers works, one brute force suggestion which sometimes resolves weird issues like this would be: Close your Eclipse Delete the .metadata folder inside your Workspace folder Restart Eclipse Note: This way you're going to lose all your workspace configuration. I advise you to backup it first in case it doesn't works.
score: 0

http://stackoverflow.com/comment/32093375
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21295779
has text: This is incredibly similar to https://stackoverflow.com/questions/21269802/how-to-get-the-low-and-high-counts-of-characters-from-a-string
type: Comment

http://stackoverflow.com/comment/32174506
comment on: http://stackoverflow.com/a/21340981
score: 0
type: AnswerComment
has text: the above mentioned code is fine but not recommended becuase i have to use the code for attachment as well can u please see my code and do some changes in it
type: Comment

http://stackoverflow.com/q/21195449
type: Question
has comment: http://stackoverflow.com/comment/31919188
has body: I found this code on-line and try to run it. But it is giving and Null pointer Error. Can anyone help to fix this? thanks Error is saying: java.lang.NullPointerException at LearnJava.compareText.main(compareText.java:79) package test; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.ss.usermodel.Cell; public class Removeduplicate { public static void main(String[] args) { HSSFWorkbook workbook_Output; HSSFWorkbook workbook_Output_Dup; HSSFWorkbook workbook_Output_Final; HSSFWorkbook workbook_Output_Final_2=null; HSSFSheet sheet_Output; HSSFSheet sheet_Output_Dup; HSSFSheet sheet_Output_Final; HSSFRow row_Output; HSSFRow row_Output_Dup; HSSFRow row_Output_Final; HSSFCell cell; HSSFRow row_Output_dup; // Set&lt;Integer&gt; markrowdup = new HashSet&lt;Integer&gt;(); //List&lt;HSSFCell&gt; cellStoreList=new ArrayList&lt;HSSFCell&gt;(); try { FileInputStream fistream_Output= new FileInputStream("C:\\Users\\Satya\\Desktop\\Output.xls"); workbook_Output = new HSSFWorkbook(new POIFSFileSystem(fistream_Output)); File file_dup = new File("C:\\Users\\Satya\\Desktop\\Output_Dup.xls"); FileOutputStream fistream_output_dup = new FileOutputStream(file_dup); workbook_Output.write(fistream_output_dup); fistream_output_dup.close(); FileInputStream fistream_Output_Dup= new FileInputStream("C:\\Users\\Satya\\Desktop\\Output_Dup.xls"); workbook_Output_Dup = new HSSFWorkbook(fistream_Output_Dup); //File file_final_2 = new File("C:\\Users\\Satya\\Desktop\\Output_CRQ.xls"); for (int sheetnum = 0; sheetn…
has comment: http://stackoverflow.com/comment/31919046
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31915856
upvote count: 1
has title: Java- removing Duplicates from excel
tagged with: excel
tagged with: java
answer count: 0
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/21239860
score: 1
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/21240339
downvote count: 0
answer count: 1
tagged with: eclipse-plugin
favorite count: 0
tagged with: eclipse-rcp
has comment: http://stackoverflow.com/comment/31995040
has title: How to create WizardPage correctly (Eclipse platform)
accepted answer: http://stackoverflow.com/a/21240339
has body: In the library code after creating page, the assertion check for control property occurs: public void createPageControls(Composite pageContainer) { // the default behavior is to create all the pages controls for (int i = 0; i &lt; pages.size(); i++) { IWizardPage page = (IWizardPage) pages.get(i); page.createControl(pageContainer); // page is responsible for ensuring the created control is // accessable // via getControl. Assert.isNotNull(page.getControl()); } } (last line) So, while implementing WizardPage#createControl one should fill control with something. In Vogella's sample he created intermediate Composite container and uses it: http://www.vogella.com/tutorials/EclipseWizards/article.html#wizards_example But may I just use createContol's parent argument? UPDATE What if redefine WizardPage class and use it all times? public abstract class WizardPageEx extends WizardPage { public WizardPageEx(String pageName, String title, ImageDescriptor titleImage) { super(pageName, title, titleImage); } public WizardPageEx(String pageName) { super(pageName); } @Override final public void createControl(Composite parent) { Composite control = new Composite(parent, SWT.NONE); createControlEx(control); setControl(control); } abstract public void createControlEx(Composite control); } what are disadvantages of such a decision?
upvote count: 1
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/31935611
type: QuestionComment
comment on: http://stackoverflow.com/q/21204299
type: Comment
score: 0
has text: http://stackoverflow.com/questions/8750563/maven-doesnt-use-java-7

http://stackoverflow.com/q/21283293
type: Question
has answer: http://stackoverflow.com/a/21283455
has comment: http://stackoverflow.com/comment/32070665
has answer: http://stackoverflow.com/a/21288566
downvote count: 0
has comment: http://stackoverflow.com/comment/32071334
possible better answer: http://stackoverflow.com/a/21287071
upvote count: 6
answer count: 4
favorite count: 0
tagged with: atomic
tagged with: atomicreference
has comment: http://stackoverflow.com/comment/32070592
tagged with: multithreading
has comment: http://stackoverflow.com/comment/32071041
score: 6
has answer: http://stackoverflow.com/a/21288027
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21283455
has answer: http://stackoverflow.com/a/21287071
has body: I have to synchronize access between threads to a shared object, whose state consists of several fields. Say: class Shared{ String a; Integer b; //constructor, getters and setters .... } I have possibly many threads reading this objects, doing //readers shared.getA(); shared.getB(); and only one thread that will write at a certain point: //writer shared.setA("state"); shared.setB(1); now my question is how to ensure that reading threads won't find the shared object in an inconsistent state. I read many answers saying that for consistency between threads volatile is the solution,but I'm not sure how it works on multiple fields. E.g., is that enough? volatile String a; volatile Integer b; Another solution would be to make the shared object immutable and use AtomicReference, E.g., AtomicReference&lt;Shared&gt; shared = .... and then the writer will just swap the reference: Shared prev = shared.get(); Shared newValue = new Shared("state",1); while (!shared.compareAndSet(prev, newValue)) Is that approach correct? thanks! Update In my setting the Shared objects are retrieved from a ConcurrentHashMap&lt;Id,Shared&gt;, so the comments agree that the way to go is either using the immutable approach or via synchronizing the updates on shared all together. However, for completeness would be nice to know whether the solution above with the ConcurrentHashMap&lt;Id,AtomicReference&lt;Shared&gt;&gt; is viable or wrong or just superfluous. Anyone can explain? thanks!
tagged with: java
has title: multiple fields: volatile or AtomicReference?
tagged with: concurrency

http://stackoverflow.com/a/21263731
has comment: http://stackoverflow.com/comment/32037649
has comment: http://stackoverflow.com/comment/32037902
type: Answer
has comment: http://stackoverflow.com/comment/32047698
answers question: http://stackoverflow.com/q/21263558
has comment: http://stackoverflow.com/comment/32037167
has comment: http://stackoverflow.com/comment/32122859
has comment: http://stackoverflow.com/comment/32044330
has comment: http://stackoverflow.com/comment/32036854
score: 0
has body: You need to set the Type of the custom class you're using. This is for serialising (just an example): Gson gson = new GsonBuilder().create() Type aType = new TypeToken&lt;/ClassName/&gt;() {}.getType(); String json = gson.toJson(this, aType); gson will then convert the variable types correctly. If you're using a custom class as a variable, you'll need to write a custom type adapter and register the type adapter with the GsonBuilder() instance. To deserialise, you'll need the same process. EDIT: Class&lt;?&gt; klass = null; try { klass = Class.forName(className); } catch (ClassNotFoundException e) { e.printStackTrace(); throw new JsonParseException(e.getMessage()); }

http://stackoverflow.com/comment/32061360
type: AnswerComment
has text: java.lang.Number is a public, non-final class. So, yes. You can check apache commons-lang and commons-math for some examples.
type: Comment
comment on: http://stackoverflow.com/a/21200072
score: 1

http://stackoverflow.com/a/21245771
answers question: http://stackoverflow.com/q/21245712
has comment: http://stackoverflow.com/comment/32006455
type: Answer
accepted answer of: http://stackoverflow.com/q/21245712
has body: You are doing: User user = new User((long) 451, "mosssi", "464asd64"); ClientResponse response = r.accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, user); It's wrong. You should send to your service a real JSON String. Get JSON parser, for example: gson, and do this: User user = new User(451, "mosssi", "464asd64"); String request = gson.toJson(user); ClientResponse response = r.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, request ); Don't use old Jersey-bundle library. Download 2.0 version: https://jersey.java.net/download.html add all libs (lib and ext libraries) to your classpath. Next, you need the jackson packages in your classpath: jackson-annotations-2.2.2.jar jackson-core-2.2.2.jar jackson-databind-2.2.2.jar jackson-jaxrs-base-2.2.1.jar jackson-jaxrs-json-provider-2.2.1.jar jackson-module-jaxb-annotations-2.2.2.jar Your service class should be similiar to this: package anyq.server.anyq.manager; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import anyq.server.common.bean.User; @Path("/users") public class AnyQUserManager { @Context UriInfo uriInfo; @POST @Consumes(MediaType.APPLICATION_JSON) public Response createUser(User user) { System.out.println("HELLO WORLD"); return Response.status(666).entity("Hello world").build(); } } And, finaly, your web.xml should look like: <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> Jersey REST Service org.glassfish.jersey.servlet.ServletContainer jersey.config.server.provider.packages anyq.server.anyq.manager, com.fasterxml.jackson.jaxrs.json 1 Jersey REST Service /rest/* In your client class, do this: String USER_URI = "http://localhost:8080/AnyQserver/rest/users"…
has comment: http://stackoverflow.com/comment/46245199
upvote count: 3
has comment: http://stackoverflow.com/comment/32010668
has comment: http://stackoverflow.com/comment/32006471
has comment: http://stackoverflow.com/comment/32006220
has comment: http://stackoverflow.com/comment/46208943
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32006050
has comment: http://stackoverflow.com/comment/32006378

http://stackoverflow.com/q/21320893
has comment: http://stackoverflow.com/comment/32163176
downvote count: 0
has comment: http://stackoverflow.com/comment/32166691
favorite count: 0
has comment: http://stackoverflow.com/comment/32166314
has comment: http://stackoverflow.com/comment/32138364
has answer: http://stackoverflow.com/a/21337355
has body: The function CreateQuery(string) in java.persistence.Query is returning a different query from what I requested. My input string to the function is: from Underlying where (SUBSTRING(ticker, (charindex('.', ticker) + 1), (len(ticker) - charindex('.', ticker))) in (:exchanges) order by ticker When I call getResultList() on the Query, I see the following sql in my log: Hibernate: select underlying0_.id as id63_, underlying0_.updated_date as updated2_63_, underlying0_.updated_user as updated3_63_, underlying0_.version as version63_, underlying0_.adr as adr63_, underlying0_.desk as desk63_, underlying0_.enabled as enabled63_, underlying0_.forward_start_enabled as forward8_63_, underlying0_.ticker as ticker63_, underlying0_.vol_shift_type as vol10_63_ from underlyings underlying0_ where (substring(underlying0_.ticker, charindex('.', underlying0_.ticker)+1) in (?)) order by underlying0_.ticker This is query is not a valid SQL Server 2008 query and as expected, I received an error: SQL Error: 174, SQLState: S0001 The substring function requires 3 argument(s). Any one know what is going on here? FYI, I have tried the following two dialects 1) org.hibernate.dialect.SQLServer2008Dialect, and 2) org.hibernate.dialect.SQLServer2008Dialect
tagged with: jpa-2.0
has title: JPA2 CreateQuery SQL Server Dialect
accepted answer: http://stackoverflow.com/a/21337355
upvote count: 1
tagged with: spring
possible better answer: http://stackoverflow.com/a/21325746
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21325746
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/32166597
tagged with: substring
type: Question
answer count: 2

http://stackoverflow.com/comment/32051689
has text: Correct me if I'm wrong, but can't you just iterate through each cell in the grid and check if there is a Flower object there?
score: 1
comment on: http://stackoverflow.com/q/21271867
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21215298
tagged with: matrix
downvote count: 0
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: java
upvote count: 1
tagged with: swing
type: Question
has title: Using KeyListener to modify matrix
has body: I have a mini project for java to do and I have some setbacks. I want to pass the value of a keypress to my main class in order to call some methods that will move a certain value up,down,left or right inside a matrix, and then if possible paint a GUI based of the values inside that matrix. Here is my class that returns the key code of the key I press inside a GUI. import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JFrame; public class Keys extends JFrame implements KeyListener{ public static int keyVALUE;//I want to use this value inside another class public Keys() { addKeyListener( this ); } public void keyReleased(KeyEvent e) { displayInfo(e); } @Override public void keyPressed(KeyEvent arg0) { // TODO Auto-generated method stub } @Override public void keyTyped(KeyEvent arg0) { // TODO Auto-generated method stub } private int displayInfo(KeyEvent e){ int id = e.getID(); if (id == KeyEvent.KEY_TYPED) { char c = e.getKeyChar(); } else { keyVALUE = e.getKeyCode(); System.out.print(keyVALUE); } return keyVALUE;} } My main class where I create and want to modify the matrix is this. import javax.swing.JFrame; import javax.swing.JOptionPane; public class Matrix extends Keys { public static int[][] Matrix = new int[9][9]; public void moveUp(){ } public void moveDown(){ } public void moveLeft(){ } public void moveRight(){ } public static void main(String[] args) { //since there is no GUI, here is a frame that picks up the key releases Keys keyPressed = new Keys(); keyPressed.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); keyPressed.setSize( 800, 600 ); // set frame size keyPressed.setVisible( true); // display frame //set "car "2" and blocks "1" and paint GUI based on this for (int i = 0; i &lt;9; i++) { for (int j = 0; j &lt; 9; j++) { Matrix[i][j] = 0ș Matrix[4][4]=2;//start position System.out.print(Matrix[i][j] + " "); } System.out.println(); } for(;;){ try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(…
tagged with: keylistener
linked to: http://stackoverflow.com/q/5797862
has comment: http://stackoverflow.com/comment/31953302

http://stackoverflow.com/comment/32068696
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21282065
type: AnswerComment
has text: How is that possible? Recursive call is made on the next object which in this case is ((Line) mainObject.getEdgeAt(0)).getSource().

http://stackoverflow.com/comment/32131493
type: AnswerComment
score: 0
has text: Done! Sorry, new user. :)
comment on: http://stackoverflow.com/a/21317205
type: Comment

http://stackoverflow.com/comment/32082490
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21289844
score: 0
has text: Dude. Change you profile picture. I tried reading this so many times. It is so distracting. Ha.

http://stackoverflow.com/q/21289804
tagged with: multidimensional-array
has title: how to make make separate 1D arrays from containing elements as rows of 2D arrays in java?
answer count: 3
downvote count: 1
upvote count: 0
possible better answer: http://stackoverflow.com/a/21290025
has answer: http://stackoverflow.com/a/21290025
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21292259
tagged with: java
has answer: http://stackoverflow.com/a/21290570
score: -1
type: Question
has answer: http://stackoverflow.com/a/21292259
tagged with: split
has body: i want to make separate 1D arrays as row vectors of a n X n matrix taken as a two dimensional array a[n][n]. How to do that in Java ??? What i am trying to do is i have a two dimensional array whose size is nXn where n is specified at run-time and i want to arrange all the row elements in ascending order.Then i cant find any possible way of doing that. Because of that I thought that i will have to separate the row elements and store them separately in another array. But how do i create a new array inside for loop everytime so that the created array stores the row elements. Can you suggest that. Or could you suggest any other method.
favorite count: 0

http://stackoverflow.com/comment/32047926
has text: Right - when I was doing it, it did not work when running "test-only" (as in the [link](http://www.poornerd.com/2013/07/05/how-to-integrate-concordion-in-play-framework-and-write-acceptance-tests-in-natural-language/) article you mentioned). I am pretty sure it was a bug in Play - maybe that is what you are encountering?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21232483
score: 0

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

http://stackoverflow.com/comment/32110184
type: QuestionComment
has text: show complete source code please, this part is missing in original question
comment on: http://stackoverflow.com/q/21304504
score: 0
type: Comment

http://stackoverflow.com/comment/31945220
type: Comment
comment on: http://stackoverflow.com/a/21211263
score: 0
type: AnswerComment
has text: Thanks a lot for you help everyone!!! Thanks for the answer Hovercraft, and thanks for the advise! :-)

http://stackoverflow.com/q/21340082
accepted answer: http://stackoverflow.com/a/21341036
tagged with: war
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jar
has title: Duplicate Error Creating war in Unix
has answer: http://stackoverflow.com/a/21341036
score: 0
answer count: 1
has body: I am trying to create a war file in unix using the command "jar cfv warfile.war * ." and getting an "index.jspjava.util.zip.ZipException: duplicate entry" error. When I search on the file it flags as a duplicate, I do find that same file twice, but in different directories. Is there an option or something I'm missing to maintain the directory structure like winzip has?
tagged with: unix

http://stackoverflow.com/q/21216403
tagged with: ide
tagged with: class
has title: Eclipse doesn't recognize anonymous inner classes
answer count: 1
has body: For some reason, Eclipse does not seem to recognize when anonymous inner classes are used and prints an error message that the anonymous class in question does not exist. After trying to run the following example, which is copied directly from the book Thinking in Java, I get Contents cannot be resolved to a type public class Parcel7 { public Contents contents() { return new Contents() { // Insert a class definition private int i = 11; public int value() { return i; } }; // Semicolon required in this case } public static void main(String[] args) { Parcel7 p = new Parcel7(); Contents c = p.contents(); } } Am I missing something obvious?
accepted answer: http://stackoverflow.com/a/21216456
has comment: http://stackoverflow.com/comment/31952757
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/21216456

http://stackoverflow.com/a/21244722
has comment: http://stackoverflow.com/comment/32004093
has comment: http://stackoverflow.com/comment/32003932
has comment: http://stackoverflow.com/comment/32012461
has comment: http://stackoverflow.com/comment/32003904
has comment: http://stackoverflow.com/comment/32004652
has comment: http://stackoverflow.com/comment/32003849
has comment: http://stackoverflow.com/comment/32004837
has comment: http://stackoverflow.com/comment/32034781
has comment: http://stackoverflow.com/comment/32004323
has comment: http://stackoverflow.com/comment/32004057
type: Answer
has comment: http://stackoverflow.com/comment/32004858
has body: I want to add that we are all very new to programming. Now we are all going to write the same application but in different language because we are all self-taught in different languages. The answer to this statement is easy: don't. Don't even consider doing this. Choose a single language and stick with it. So I have a two questions 1) Is this even possible to do? From what I understand all .NET languages can compile under the same solution? If we write the "modules" as assemblies then they should be able to access some of methods and vice versa or am I wrong here? You can use interlanguage communication tools, but this will requiring learning some pretty advanced stuff. 2) Since friend 2 isn't actually programming in a .NET language, is there an easy way to make a Java solution that will work with this? Could he perhaps write the "card game" modules as DLLs that we can then import into our seperate projects? Or would it just be easier for him to write the application in J#? Again, don't. You're making things much harder than they should be. You can't use JNI or JNA with NET wikis and easily mesh them with Java. Since you are all new to programming, again you will be much better off choosing common standards and sticking with them. Even if you weren't new to programming, you'd be better off with this. Note that I have done some inter-language programs, but not by choice, only because I've had to. These have been simple affairs with information is passed as text using standard input and output (sockets). I've also used JNA to create Java programs that can call programs created in C, however again this has been full of many tricks and traps, several that I've fallen into, and again do not recommend this route if can be avoided. Also, and again, you cannot have Java communicate with .NET languages in this manner. Other options for higher level inter-process communications include using a Remote Procedure Call Library, of which there are many, but which will also add add…
has comment: http://stackoverflow.com/comment/32003821
has comment: http://stackoverflow.com/comment/32025609
has comment: http://stackoverflow.com/comment/32004479
has comment: http://stackoverflow.com/comment/32004602
has comment: http://stackoverflow.com/comment/32004284
downvote count: 1
answers question: http://stackoverflow.com/q/21244694
has comment: http://stackoverflow.com/comment/32004051
has comment: http://stackoverflow.com/comment/32033750
has comment: http://stackoverflow.com/comment/32032860
has comment: http://stackoverflow.com/comment/32004787
upvote count: 5
has comment: http://stackoverflow.com/comment/32003939
score: 4

http://stackoverflow.com/comment/31994829
type: QuestionComment
has text: I'm unsure if this is a Java version issue, but it works on Java 7.
comment on: http://stackoverflow.com/q/21239480
score: 0
type: Comment

http://stackoverflow.com/q/21230874
type: Question
has answer: http://stackoverflow.com/a/36596402
has title: http status 404 while running struts2 application on server
tagged with: jsp
has body: This question may sounds duplicate but fact is that I haven't received a solution for this. I have just into struts2 and trying for a login application. I have attached following libraries: commons-fileupload-1.2.2.jar commons-io-1.4.jar commons-lang-2.4.jar commons-logging-1.0.4.jar freemarker-2.3.15.jar javassist-3.14.0-GA.jar ognl-2.6.11.jar struts2-core-2.0.14.jar struts2-core-2.1.6.jar xwork-2.0.7.jar when I run normal JSP pages(without struts tag) individually it runs okay. But whenever I run jsp pages with struts tag individually it displays http error 500. After creating whole web.xml and struts.xml and run entire application it reports http status 404. I know problem is that my jsp pages are not getting recognized.Please help. web.xml: <?xml version="1.0" encoding="UTF-8"?> Struts2 Application struts2 org.apache.struts2.dispatcher.FilterDispatcher struts2 /* Login.jsp struts.xml: <?xml version="1.0" encoding="UTF-8"?> <constant name="struts.enable.DynamicMethodInvocation" value="false" /> <constant name="struts.devMode" value="false" /> <constant name="struts.custom.i18n.resources" value="ApplicationResources" /> Welcome.jsp Login.jsp
tagged with: struts2
score: 0
answer count: 2
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31986030
has answer: http://stackoverflow.com/a/21235205
tagged with: java
tagged with: http

http://stackoverflow.com/q/21241740
has answer: http://stackoverflow.com/a/21241765
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21241984
type: Question
answer count: 2
tagged with: arrays
downvote count: 0
has title: Any usage difference between two forms of indexing to array middle?
favorite count: 0
has body: I saw that there are two ways to find the middle index in an array. int middle = lowerBound + (upperBound-lowerBound)/2 int middle = (lowerBound + upperBound)/2 Are the same thing? Or they should be used differently? Since I am trying to understand binary search and merge sort. Both have to use it. Thanks a lot.
possible better answer: http://stackoverflow.com/a/21241765
has answer: http://stackoverflow.com/a/21241984

http://stackoverflow.com/q/21319177
has body: i get user reports that the app crash in the online console i find several crash logs like java.lang.RuntimeException: Unable to start service com.chris.mydays.UpdateWidgets@428eb2d8 with null: java.lang.NullPointerException at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2555) at android.app.ActivityThread.access$1900(ActivityThread.java:139) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1328) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5021) 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:789) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at com.chris.mydays.UpdateWidgets.onStart(UpdateWidgets.java:50) at android.app.Service.onStartCommand(Service.java:450) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2538) ... 10 more any idea whats about and i can do? thanks chris
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32134789
has comment: http://stackoverflow.com/comment/32134875
has comment: http://stackoverflow.com/comment/32136162
has comment: http://stackoverflow.com/comment/32138218
tagged with: java
has comment: http://stackoverflow.com/comment/32134827
type: Question
has title: android error: java.lang.NullPointerException
has comment: http://stackoverflow.com/comment/32136107
score: 0
has comment: http://stackoverflow.com/comment/32136044
has comment: http://stackoverflow.com/comment/32134826
answer count: 1
has answer: http://stackoverflow.com/a/21319223

http://stackoverflow.com/comment/32185379
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21346927
has text: I am sure I said chars not Characters

http://stackoverflow.com/comment/31914007
type: QuestionComment
has text: @user1600770 you could lookup the `JAVA_HOME` [environment variable](http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/System.html) and then invoke the java executable in the `/bin` directory. Depending on the [OS](http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html) you are running in
comment on: http://stackoverflow.com/q/21193930
score: 0
type: Comment

http://stackoverflow.com/comment/31975924
comment on: http://stackoverflow.com/q/21229119
score: 0
has text: The quadratic convergence of the newton method is hard to beat. Just make sure, you start with a good initial estimate of the square root. The square root calculated with double precision may be a good start.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32138211
score: 0
has text: @JVMATL I guess UVA is the abbreviation of some university in Eastern Europe. Normally the Online Judge system of a university is named by the university name itself. And you are right, this is a collection of programming contest problems aimed to help those who are interested or are preparing for programming contest. I am looking at it just for fun.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21320178

http://stackoverflow.com/a/21298663
type: Answer
score: 2
has body: In fact this is a simple SQL question. Just join the two tables and everything will work select t1.product -- and other fields you want from T1 t1 inner join T2 on t1.id = t2.id where t1.date = :inputDate Strongly suggest you to give some further study in SQL
downvote count: 0
answers question: http://stackoverflow.com/q/21298580
upvote count: 2

http://stackoverflow.com/comment/32181456
score: 0
has text: Thanks. I didn't mean while in memory, I meant when decoding not encoding. It makes sense now, though.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21344949

macos
tags question: http://stackoverflow.com/q/21210007
tags question: http://stackoverflow.com/q/21299038
tags question: http://stackoverflow.com/q/21220611
tags question: http://stackoverflow.com/q/21242000
tags question: http://stackoverflow.com/q/21194982
tags question: http://stackoverflow.com/q/21243017
tags question: http://stackoverflow.com/q/21207069
tags question: http://stackoverflow.com/q/21214745
tags question: http://stackoverflow.com/q/21186550
tags question: http://stackoverflow.com/q/21206326
type: Tag
tag name: macos
tags question: http://stackoverflow.com/q/21295203

http://stackoverflow.com/comment/32147809
has text: @MChan RE: display DateTime in different formats… Yes. Joda-Time offers standard ISO 8601 formats, other built-in formats, Locale-sensitive formats, and you can define your own formats. Search StackOverflow for "joda format" for many examples.
type: AnswerComment
comment on: http://stackoverflow.com/a/21308891
type: Comment
score: 1

self-signed
type: Tag
tags question: http://stackoverflow.com/q/21238954
tag name: self-signed
tags question: http://stackoverflow.com/q/21238199

http://stackoverflow.com/comment/32178357
has text: @Rami.Q The Javadoc for java.util.Map is the normative reference, not the tutorial, but in any case your link doesn't say there are *only* three implementations. You can't seriously be trying to deny that EnumMap, ConcurrentHashMap, WeakHashMap, Properties, etc., are implementations of Map. Can you?
type: AnswerComment
comment on: http://stackoverflow.com/a/21341393
score: 0
type: Comment

http://stackoverflow.com/q/21245037
has comment: http://stackoverflow.com/comment/32007119
tagged with: exception
tagged with: android
downvote count: 1
has answer: http://stackoverflow.com/a/24992605
accepted answer: http://stackoverflow.com/a/24992605
has comment: http://stackoverflow.com/comment/32006642
has body: First here is the code of the class that is bringing me trouble (its a class defined in a class): public static class MAbilitiesParseStruct{ private List&lt;CardView&gt; cards; private List&lt;String&gt; abilities; private List&lt;Boolean&gt; ask; private List&lt;Integer&gt; regtype; //Used for regitering events. //private List&lt;Integer&gt; pos; private int current = 0; //public MAbilitiesParseStruct(List&lt;CardView&gt; cvs, List&lt;String&gt; abs, List&lt;Boolean&gt; asks, List&lt;Integer&gt; p){ public MAbilitiesParseStruct(List&lt;CardView&gt; cvs, List&lt;String&gt; abs, List&lt;Boolean&gt; asks, List&lt;Integer&gt; regt){ cards = cvs; abilities = abs; ask = asks; regtype = regt; //pos = p; current = 0; } public List&lt;CardView&gt; getCardList(){return cards;} public List&lt;String&gt; getAbilities(){return abilities;} public List&lt;Boolean&gt; getAsk(){return ask;} public List&lt;Integer&gt; getRegTypes(){return regtype;} public void addAbility(CardView v, String ability, boolean askq, int rtype){ cards.add(v); abilities.add(ability); ask.add(askq); regtype.add(rtype); } public void appendAnotherMaps(MAbilitiesParseStruct another){ cards.addAll(another.getCardList()); abilities.addAll(another.getAbilities()); ask.addAll(another.getAsk()); regtype.addAll(another.getRegTypes()); } public boolean done(){if (current == cards.size()) return true; else return false;} public void next(){ //It is assumed that this is called once current ability has finished being parsed. if (cards.size() &gt; 0){ cards.remove(0); abilities.remove(0); ask.remove(0); regtype.remove(0); } } public void purgeOneShots(){ int i = 0; System.err.println("Purge de 1 shot"); while (i &lt; cards.size()){ if (regtype.get(i) == Aux.REG_ONESHOT){ System.err.println("Purge card"); cards.remove(i); System.err.println("Purge ability"); abilities.remove(i); System.err.println("Purge ask"); ask.remove(i); System.err.println("Purge regtype"); regtype.remove(i); } else{ i++; } } } public void purgeTur…
has comment: http://stackoverflow.com/comment/32004353
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32007137
tagged with: java
has comment: http://stackoverflow.com/comment/32006374
type: Question
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/32005164
has title: UnsupportedOperationException in Android when removing from List
favorite count: 0
score: 0

http://stackoverflow.com/q/21313525
has title: Java 8 internal iteration
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21313711
tagged with: java
has answer: http://stackoverflow.com/a/21313851
accepted answer: http://stackoverflow.com/a/21315752
possible better answer: http://stackoverflow.com/a/21313711
type: Question
has comment: http://stackoverflow.com/comment/32124738
has comment: http://stackoverflow.com/comment/32125195
has comment: http://stackoverflow.com/comment/32149270
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21314984
has comment: http://stackoverflow.com/comment/32148705
has body: Is the internal iteration executed only with the forEach method of a Collection object or also with Stream's methods like filter, reduce, etc. ?
has comment: http://stackoverflow.com/comment/32124801
answer count: 4
has answer: http://stackoverflow.com/a/21315752
score: 2
upvote count: 2
linked to: http://stackoverflow.com/q/21219667
tagged with: java-8

lwjgl
tags question: http://stackoverflow.com/q/21222278
tag name: lwjgl
tags question: http://stackoverflow.com/q/21292149
tags question: http://stackoverflow.com/q/21344190
tags question: http://stackoverflow.com/q/21205393
tags question: http://stackoverflow.com/q/21241591
tags question: http://stackoverflow.com/q/21263042
tags question: http://stackoverflow.com/q/21336837
tags question: http://stackoverflow.com/q/21207597
tags question: http://stackoverflow.com/q/21227813
type: Tag
tags question: http://stackoverflow.com/q/21345493
tags question: http://stackoverflow.com/q/21239386
tags question: http://stackoverflow.com/q/21235494

http://stackoverflow.com/comment/31996229
type: Comment
has text: @duffymo I never said that AWT should be used instead of Swing. Just saying that Swing isn't really modern itself anymore. Even though it has no official successor.
type: QuestionComment
comment on: http://stackoverflow.com/q/21237636
score: 0

conflict
tag name: conflict
tags question: http://stackoverflow.com/q/21344165
type: Tag

http://stackoverflow.com/comment/32043371
comment on: http://stackoverflow.com/a/21264385
score: 0
type: AnswerComment
type: Comment
has text: http://www.slideshare.net/tomek_k/sample-chapter-of-practical-unit-testing-with-testng-and-mockito

http://stackoverflow.com/q/21289942
has title: Updating database connection java
accepted answer: http://stackoverflow.com/a/21290766
type: Question
has comment: http://stackoverflow.com/comment/32082716
answer count: 1
score: 0
has body: I have a question regarding updating the java program when something is inserted in a database. The cenario is, is that i can insert a row in the used database, and then when i go to the next screen i can choose the last inserted row. The problem is, is that i have to restart the application to make the change visible so that i can choose the last inserted row. How do i refresh the the application without restarting it so that i can see the added rows (or deleted)? thanks!
tagged with: refresh
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21290766
tagged with: java
tagged with: database
tagged with: mysql

http://stackoverflow.com/q/21323191
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21326977
accepted answer: http://stackoverflow.com/a/21326977
tagged with: spring-batch
answer count: 2
upvote count: 1
has body: Following is the code sample of a reader bean &lt;bean id="reader" class="org.springframework.batch.item.database.JdbcCursorItemReader" scope="step"&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt;property name="sql" value="#{@sqlStatements[jobParameters['key']]}" /&gt; &lt;property name="rowMapper" ref="#{jobParameters['key'] + 'Mapper'}" /&gt; &lt;/bean&gt; There is &lt;util:map id="sqlStatements"/&gt;. I have a similar bean for writer. I want to have a dynamic switcher for processor. The interface ItemProcessor&lt;I,O&gt; needs I &amp; O to be mentioned, either I must switch it in some way or create a custom ItemProcessor. I tried the below code but it didn't work. &lt;batch:job id="springBatch"&gt; &lt;batch:step id="step1"&gt; &lt;batch:tasklet&gt; &lt;batch:chunk reader="reader" processor="#{jobParameters['key'] + 'Processor'}" writer="writer" commit-interval="1"&gt;&lt;/batch:chunk&gt; &lt;/batch:tasklet&gt; &lt;/batch:step&gt; &lt;/batch:job&gt; It gave a org.springframework.expression.spel.SpelEvaluationException for jobParameters, probably because scope=step was not defined for it. Could someone please provide an alternative for this ?
has title: Dynamically switch ItemProcessor based on JobParameters
favorite count: 0
possible better answer: http://stackoverflow.com/a/21323477
has answer: http://stackoverflow.com/a/21323477
tagged with: spring

http://stackoverflow.com/comment/32101686
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21300526
score: 0
has text: Can't you simply reduce the `width` of the area you painting by `10` pixels, something like `g.draw(new RoundRectangle2D.Double(0, 0, width - 11, height + 1, 10, 10));` for example?

http://stackoverflow.com/comment/32039207
score: 1
type: Comment
type: QuestionComment
has text: "Activity from a non "screen" class" you talk about a background task? in this case you must work with Service
comment on: http://stackoverflow.com/q/21264916

http://stackoverflow.com/comment/32160997
has text: Why do you need to be able to list the values for an enum, anyway?
comment on: http://stackoverflow.com/q/21334055
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32010247
comment on: http://stackoverflow.com/q/21248375
has text: remove doesn't need a parameter. and it should be ia.remove();
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31938783
type: AnswerComment
has text: @BoristheSpider Yes `\\2` seems to solve this problem. Possessive quantifier can also improve performance but for now I didn't focus on that :)
comment on: http://stackoverflow.com/a/21208565
type: Comment
score: 0

http://stackoverflow.com/a/21224198
has body: You have a cascade of issues, which aren't going to be easy to solve. Firstly, the over use of static is going not working in your favour, in fact, it's a sign of a bad design. You can begin to correct this by creating a custom component, extending from something like JPanel and using this as the bases for the rest of your application, creating more custom components as you need them, or just using simple containers, like JPanel, to produce more complex UIs Secondly, it "seems" like you have a resource problem. Generally speaking, you have two types of resources you application can use, external and internal (AKA embedded). ImageIcon(String) is looking for an external resource on your disk (ie a File). Based on your cryptic comments, I would assume that the images are actually embedded within the context of your application, making it impossible for ImageIcon(String) to find anything. Instead, you should try using ImageIcon(URL), for example new ImageIcon(getClass().getResource("/path/to/image/image.png") The problem with ImageIcon is it won't throw an Exception when it fails to find or load the image, sometimes simply painting nothing. Instead, you should be using ImageIO.read. Take a look at Reading/Loading images for more details Additional There's nothing in your paintComponent that actually paints anything There's no way for your ActionListener to notify anybody that your game model has updated Separate the game logic and the UI logic, such that the "model" is purely responsible for maintaing the virtual state of the game and notifying interested parties that the model has changed and that the UI portion is simple responsible for rendering the view model. Then allow the controls to change the state of the model.
type: Answer
answers question: http://stackoverflow.com/q/21223502
upvote count: 2
has comment: http://stackoverflow.com/comment/31967871
score: 2
downvote count: 0

http://stackoverflow.com/q/21286836
score: 9
type: Question
upvote count: 9
has body: Is the following code safe: try { URL url = new URL(urlRequest); conn = (HttpURLConnection)url.openConnection(); conn.setConnectTimeout(30000); conn.setReadTimeout(30000); conn.setRequestProperty("Accept-Encoding", "gzip, deflate"); String encoding = conn.getContentEncoding(); return Utils.wrapCompressedStream(conn.getInputStream(), encoding); } catch (IOException e) { if(conn != null) { conn.getContentEncoding(); conn.getErrorStream(); conn.whateverOtherMethodThere(); ... } } Particularly, is it safe in case of InterruptedIOException (say, read timeout) to call methods like getContentEncoding()? As far as I understand this method requires live connection to read HTTP(S) headers. Update (additional info): This question originates from a real-system experience. I believe, the system was run on Oracle/Sun JVM 1.6 then. The code is almost the same: ... } catch (IOException e) { if(conn != null) { try { String response = tryGetResponse(conn); ... The problem happened in the tryGetResponse on HTTPS requests: private static String tryGetResponse(HttpURLConnection conn) { if(conn == null) return "(failed to get)"; InputStream in = null; try { InputStream err = conn.getErrorStream(); if (err != null) { in = Utils.wrapCompressedStream(err, conn.getContentEncoding()); } return Utils.inputStreamToString(in); } catch (IOException e) { return "(failed to get)"; } finally { Utils.closeQuitely(in); } } Spontaneously system hanged on the socket connect (or read) in the getContentEncoding() call: in = Utils.wrapCompressedStream(err, conn.getContentEncoding()); exactly after SocketTimeoutException is thrown in the initial code. So, it seems that getContentEncoding() tries (or tried in Java 6) to establish a new connection without timeouts being set.
has title: Use java http connection instance after exception
has answer: http://stackoverflow.com/a/29094797
has comment: http://stackoverflow.com/comment/46421022
downvote count: 0
tagged with: urlconnection
tagged with: httpurlconnection
favorite count: 0
has answer: http://stackoverflow.com/a/21287690
type: UnansweredQuestion
tagged with: httpsurlconnection
answer count: 4
has answer: http://stackoverflow.com/a/29094777
tagged with: java
has answer: http://stackoverflow.com/a/29095714

log4j
tags question: http://stackoverflow.com/q/21300388
tags question: http://stackoverflow.com/q/21296781
tags question: http://stackoverflow.com/q/21303746
tags question: http://stackoverflow.com/q/21308970
tags question: http://stackoverflow.com/q/21240589
tags question: http://stackoverflow.com/q/21279299
tags question: http://stackoverflow.com/q/21329802
tags question: http://stackoverflow.com/q/21307968
tag name: log4j
tags question: http://stackoverflow.com/q/21267071
tags question: http://stackoverflow.com/q/21255334
tags question: http://stackoverflow.com/q/21298863
tags question: http://stackoverflow.com/q/21327355
tags question: http://stackoverflow.com/q/21300413
tags question: http://stackoverflow.com/q/21316624
type: Tag
tags question: http://stackoverflow.com/q/21282831

http://stackoverflow.com/comment/31940572
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21209348
type: AnswerComment
has text: Oh i didnt downvote. I tried upvoting but it requires 15 reputations. Apologies i will upvote as soon as i get the points. I am new to the site.

http://stackoverflow.com/comment/31993885
comment on: http://stackoverflow.com/q/21234341
type: Comment
type: QuestionComment
has text: Fil, do you want to add that as an answer?
score: 0

http://stackoverflow.com/q/21285974
tagged with: android
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21310875
tagged with: java
tagged with: database
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21286137
has title: How to implement a spinner in my java files?
tagged with: spinner
has body: I am just a beginner so i have a specific question about how i implement the spinner in my java files of a contact app. I have watched a tutorial about a contact app and i want to work on it. So i create a Strings-array with 3 items in there. Now my question is how i implement that into my code of the New Contact java file (code below). It should be a Dropdown menu in the layout. I hope anybody could help me. Ask if you need more information. public class NewContact extends Activity{ Spinner typ; EditText firstName; EditText lastName; EditText phoneNumber; EditText emailAddress; EditText address; EditText preference; EditText information; DBTools dbtools = new DBTools(this); @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.add_contact); typ = (EditText) findViewById(R.id.typ); firstName = (EditText) findViewById(R.id.firstName); lastName = (EditText) findViewById(R.id.lastName); phoneNumber = (EditText) findViewById(R.id.phoneNumber); emailAddress = (EditText) findViewById(R.id.emailAddress); address = (EditText) findViewById(R.id.address); preference = (EditText) findViewById(R.id.preference); information = (EditText) findViewById(R.id.information); } public void AddNewContact(View view){ HashMap&lt;String, String&gt; queryValuesMap = new HashMap&lt;String, String&gt;(); queryValuesMap.put("typ", typ.getText().toString()); queryValuesMap.put("firstName", firstName.getText().toString()); queryValuesMap.put("lastName", lastName.getText().toString()); queryValuesMap.put("phoneNumber", phoneNumber.getText().toString()); queryValuesMap.put("emailAddress", emailAddress.getText().toString()); queryValuesMap.put("address", address.getText().toString()); queryValuesMap.put("preference", preference.getText().toString()); queryValuesMap.put("information", information.getText().toString()); dbtools.insertContact(queryValuesMap); this.callMainActivity(view); } public void callMainActivity(View view){ Intent t…

http://stackoverflow.com/comment/31907693
has text: If this is made with NetBeans GUI builder and if you have 0 knowlege about swing, we can't help you. Btw, answer would be: Use CardLayout.
comment on: http://stackoverflow.com/q/21191101
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/113833724
type: AnswerComment
comment on: http://stackoverflow.com/a/60096314
type: Comment
score: 2
has text: Its @Transactional

http://stackoverflow.com/comment/32116573
type: Comment
has text: My main concern is that i have a webpage in which i am getting google annotated chart from google side. in that same page i had provided to the user a print button option , but when i am clicking onthat button , print window pop ups but google chart doesn't appear , rest of the page is as it is and come into print , but i want the complete webpage to be print along with the chart. I am using window.print() method , and i think chart is in svg or flash format. please help , i wanted to deliver it to my client. and thanks for your quick response Stein G Strindhaug
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21307340

http://stackoverflow.com/comment/31984403
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21233331
has text: Yes, the additional code you have posted confirms what was said above: `group by` and `sorted` are by their nature terminal operations. They must be performed *in full* to be able to produce even the first element of the output. It is not sensible to involve them as non-terminal operations.

http://stackoverflow.com/comment/32038866
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21264862
has text: That's because it's not deterministic behaviour. The garbage collector works just fine, it may not collect when you expect, so unless you're tuning the GC, you shouldn't spend too much time on it.
score: 0

http://stackoverflow.com/comment/36826951
has text: How does `HttpUnit` refers to `HtmlUnit`? Seems that these are different frameworks...
type: Comment
comment on: http://stackoverflow.com/a/21295487
score: 9
type: AnswerComment

http://stackoverflow.com/q/21316846
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21348211
downvote count: 0
answer count: 1
favorite count: 0
tagged with: jface
accepted answer: http://stackoverflow.com/a/21348211
has title: How to know if cell was changed in TableViewer?
upvote count: 2
has body: I created a TableViewer ( jface ). All the columns are editable ( using EditingSupport ) I want to know when cell is changed and then to raise a flag in other column. meaning that you start to write any data in the cell I know that I need to create event of key changed listener to the cells. ( or there is different way ) How I can have access to the cell ? where do I need to add the event //The gridViewer Class public class MyGridViewer extends TableViewer { public MyGridViewer (Composite parent) { super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); final Table table = this.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); this.setContentProvider(new MyModelProvider()); } } @Override protected void inputChanged(Object input, Object oldInput) { removeColumn(); tableCol = new TableViewerColumn(this, SWT.NONE); column = tableCol.getColumn(); column.setText(dataColumnHeader.getName()); column.setWidth(100); column.setResizable(true); column.setMoveable(true); tableCol.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { DataRow r = (DataRow) element; DataCell c = r.getDataCellByName(dataColumnHeader.getName()); if (c != null &amp;&amp; c.getValue() != null) { return c.getValue().toString(); } return null; } }); editingSupport = new StringCellEditingSupport(this, dataColumnHeader); tableCol.setEditingSupport(editingSupport); super.inputChanged(input, oldInput); }
type: Question

named-query
type: Tag
tags question: http://stackoverflow.com/q/21256447
tag name: named-query

http://stackoverflow.com/a/21339625
has body: but the call to m.matches() returns false. It is because Matcher#matches() requires you to match complete input with your regex. From Javadoc: public boolean matches() Attempts to match the entire region against the pattern. If the match succeeds then more information can be obtained via the start, end, and group methods.
upvote count: 4
has comment: http://stackoverflow.com/comment/32171649
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/32171684
accepted answer of: http://stackoverflow.com/q/21339594
type: Answer
answers question: http://stackoverflow.com/q/21339594
has comment: http://stackoverflow.com/comment/32178211

http://stackoverflow.com/comment/32141286
comment on: http://stackoverflow.com/q/21322492
score: 1
has text: @guilo - still wrong. UTF-8 >>does<< support European characters.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32042115
has text: I checked my version, it's 2.0.0. I also tried the query again and noticed that the result differs from using the web console and using the REST api. Console looks fine, with the API the result is wrapped like this: { "columns" : [ "i" ], "data" : [ [ { MANY URLS..., "data": {THE ENTITY} } ] ] }
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21247247

http://stackoverflow.com/comment/32248858
comment on: http://stackoverflow.com/q/21266379
has text: In WordNet antonyms of some words are still missing. But words do have antonyms.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32224996
type: Comment
comment on: http://stackoverflow.com/a/21362761
has text: I am working with fonts as data. I need to make them absolutely portable, so I am to use system font names, but should use specific files for them.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21331334
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/373833
has body: I have the following XML stored in a String 201401140942060 <MessageNotificationPeriod> 2013-11-01T00:00:00.000000 2013-12-01T00:00:00.000000 </MessageNotificationPeriod> US </SalesByCommercialModel> I want to split the string into 3 parts so that it can be printed at different places in the file I will be creating. I want </MessageNotificationPeriod> to end the first part, to end the second part and the remaining to be in the third new string. I've tried to use String.split() but it removes the string I am splitting at.
has comment: http://stackoverflow.com/comment/32156021
has comment: http://stackoverflow.com/comment/32155961
has answer: http://stackoverflow.com/a/21331426
tagged with: java
downvote count: 1
type: Question
tagged with: split
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21336706
tagged with: string
has title: Split XML String in Java into 3 parts
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0

drag
tags question: http://stackoverflow.com/q/21217368
type: Tag
tag name: drag

http://stackoverflow.com/comment/31936808
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/11878871/determine-whether-n-is-fibonacci-or-not-if-not-find-the-largest-fibonacci-numbe
comment on: http://stackoverflow.com/q/21207423
score: 0

http://stackoverflow.com/a/21324382
has body: Refer the Apache byte code manipulation library BCEL. The Byte Code Engineering Library is intended to give users a convenient way to analyze, create, and manipulate (binary) Java class files (those ending with .class). After that you can use reflection to get the count like this : public static int getGetterMethodCount(Class&lt;?&gt; cls) { int n = 0; for (Method m : cls.getMethods()) { // To identify the boolean setter "is" is used if (m.getName().startsWith("get") || m.getName().startsWith("is")) { n++; } } return n; } public static int getSetterMethodCount(Class&lt;?&gt; cls) { int n = 0; for (Method m : cls.getMethods()) { if (m.getName().startsWith("set")) { n++; } } return n; }
type: Answer
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/21324308
upvote count: 3

http://stackoverflow.com/comment/32057586
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21274478
has text: minimum 50 kb and maximum 1 mb image. there are 20 images. i am using ffmpeg in android .

http://stackoverflow.com/q/21311958
has title: How can you sort values in HashMap
has comment: http://stackoverflow.com/comment/32121466
duplicate of: http://stackoverflow.com/q/109383
has comment: http://stackoverflow.com/comment/32121275
has body: For example you have a HashMap&lt;String, String&gt; how can you sort values in the hashmap and print them to console what would be the best ways to do it?
type: AnsweredQuestion
upvote count: 0
linked to: http://stackoverflow.com/q/109383
downvote count: 2
tagged with: collections
type: Question
accepted answer: http://stackoverflow.com/a/21311959
has comment: http://stackoverflow.com/comment/32121270
has comment: http://stackoverflow.com/comment/32125123
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/21311959
has comment: http://stackoverflow.com/comment/32121272
answer count: 1
has comment: http://stackoverflow.com/comment/32121274
has comment: http://stackoverflow.com/comment/32121271
favorite count: 0

http://stackoverflow.com/q/21212467
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31958531
has answer: http://stackoverflow.com/a/21290789
tagged with: java
has title: Packaging multiple Packages, javadoc and external jar dependencies using ANT script in Eclipse
tagged with: eclipse
type: AnsweredQuestion
tagged with: ant
has body: I am making a library. This library has 5 different packages in it. src | ---- |--- pkg.exceptions |--- pkg.a |--- pkg.b |--- pkg.c |--- pkg.main libs | ----someExternalJar.jar The project setup is as follow pkg.main uses classes from all other packages. In fact each package uses classes from each other. I have also written javadoc comments for each class. One of the class from main uses someExternalJar.jar. I have looked through different articles but cannot get my head around the ANT build script. I have tried so far with the following build script... Compile the source code, generate JavaDocs and package the application in a JAR Archive. <property name="srcDir1" value="src/pkg/exceptions"/> <property name="srcDir2" value="src/pkg/a"/> <property name="srcDir3" value="src/pkg/b"/> <property name="srcDir4" value="src/pkg/c"/> <property name="srcDir5" value="src/pkg/main"/> <property name="distDir" value="/dist"/> <property name="buildDir" value="${distDir}/build" /> <property name="docDir" value="${distDir}/docs" /> <property name="library.dir" value="/lib" /> <pathelement path="${library.dir}/someExternalJar.jar" /> <delete dir="${buildDir}"/> <delete dir="${distDir}"/> <delete dir="${deployDir}"/> <tstamp/> <mkdir dir="${buildDir}"/> <mkdir dir="${distDir}"/> <mkdir dir="${deployDir}"/> <mkdir dir="${reportDir}"/> <javac srcdir="${srcDir1}" destdir="${buildDir}" /> <javac srcdir="${srcDir2}" destdir="${buildDir}" /> <javac srcdir="${srcDir3}" destdir="${buildDir}" /> <javac srcdir="${srcDir4}" destdir="${buildDir}" /> <javac srcdir="${srcDir5}" destdir="${buildDir}" /> MyAPI MyAPI MyAPI MyAPI MyAPI MyAPI MyAPI MyAPI MyAPI MyAPI <jar destfile="${distDir}/myapi.jar" basedir="${buildDir}" excludes="**/*Test.class,**/Runner.class" /> but I am getting various errors e.g cannot find symbols from pkg.exceptions, pkg.a etc Can someone help?
accepted answer: http://stackoverflow.com/a/21290789
type: Question

http://stackoverflow.com/q/21255699
favorite count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/21256075
has body: How do i serialize a hashmap containing non-serializable objects, in my case JavaFX Components? final HashMap&lt;String, Button&gt; mapButton = new HashMap&lt;&gt;(); // some for loop adding the components.. try { FileOutputStream fileOut = new FileOutputStream("Resources/"); ObjectOutputStream objStream = new ObjectOutputStream(fileOut); objStream.writeObject(mapButton); objStream.close(); fileOut.close(); System.out.println("Serialized HashMap mapButtons has been stored" + " in /tmp/store"); } catch (IOException i) { i.printStackTrace(); } Throws: java.io.NotSerializableException: javafx.scene.control.Button
type: AnsweredQuestion
tagged with: components
has comment: http://stackoverflow.com/comment/32022156
has answer: http://stackoverflow.com/a/21256109
score: 1
tagged with: java
tagged with: javafx
upvote count: 1
type: Question
tagged with: hashmap
downvote count: 0
possible better answer: http://stackoverflow.com/a/21255787
has title: Serialize hashmap with non-serializable objects
accepted answer: http://stackoverflow.com/a/21256109
has answer: http://stackoverflow.com/a/21255787
answer count: 3
has comment: http://stackoverflow.com/comment/32022875
has comment: http://stackoverflow.com/comment/32022458

http://stackoverflow.com/comment/32055932
has text: `copyDirectory(files.get(i), destination);` is line 32
comment on: http://stackoverflow.com/q/21274034
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31977802
score: 0
type: AnswerComment
type: Comment
has text: Thanks for your answer, but my question is while user type the directory and try to enter some character then all the subdirectories/folders starting with that character need to be displayed to user.So how to achieve this trough the code, Please provide some example programs for same.
comment on: http://stackoverflow.com/a/21228210

http://stackoverflow.com/q/21210444
downvote count: 0
tagged with: jsp
tagged with: glassfish
favorite count: 0
has title: java.lang.RuntimeException: There is no web component by the name of application here
answer count: 1
has answer: http://stackoverflow.com/a/21210521
tagged with: web.xml
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21210521
type: Question
has body: I'm trying to assign a controller to a URL and my descriptor is: <?xml version="1.0" encoding="UTF-8"?> 30 application /* It throws the following error: java.lang.RuntimeException: There is no web component by the name of application here.

http://stackoverflow.com/q/21255016
has title: How to create/call a sql view in Hibernate
answer count: 3
has answer: http://stackoverflow.com/a/21255382
has answer: http://stackoverflow.com/a/21255574
has body: Here is the view created in document.hbm.xml CREATE VIEW docView AS SELECT * from document; GO DROP VIEW docView <dialect-scope name='org.hibernate.dialect.SQLServerDialect' /> Now how to call this view in my method Tried calling like this Session session = sessFactory.openSession(); Query query = session.createSQLQuery("docView"); List<?> list = query.list(); Ended up with Caused by: java.sql.SQLException: The request for procedure 'docView' failed because 'docView' is a view object. at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632) Any Idea or any otherway to call sql view in hibernate? In short is there a way like Is there any way to call view just like a stored procedure??, without creating a new entity??
favorite count: 0
type: UnansweredQuestion
tagged with: orm
score: 3
linked to: http://stackoverflow.com/q/14608667
upvote count: 3
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/901537
type: Question
tagged with: sql
downvote count: 0
has answer: http://stackoverflow.com/a/21255293

http://stackoverflow.com/comment/32096260
comment on: http://stackoverflow.com/q/21296666
score: 0
type: Comment
type: QuestionComment
has text: Check the Android plugin docs for how to pull in the Android plugin.

http://stackoverflow.com/comment/31974782
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21219946
score: 0
has text: Thanks for your input and stating that, "Method calls have negligible effects on the speed of your program". I did wonder how much difference they make.

http://stackoverflow.com/a/21266240
has comment: http://stackoverflow.com/comment/32090957
upvote count: 3
has comment: http://stackoverflow.com/comment/32088378
has comment: http://stackoverflow.com/comment/32144740
accepted answer of: http://stackoverflow.com/q/21265576
answers question: http://stackoverflow.com/q/21265576
has comment: http://stackoverflow.com/comment/32041161
score: 3
type: AcceptedAnswer
has body: If you are wanting to schedule the updates at a set interval, javax.swing.Timer provides a Swing-integrated service for it. Timer runs its task on the EDT periodically, without having an explicit loop. (An explicit loop would block the EDT from processing events, which would freeze the UI. I explained this more in-depth here.) Ultimately doing any kind of painting in Swing you'll still be doing two things: Overriding paintComponent to do your drawing. Calling repaint as-needed to request that your drawing be made visible. (Swing normally only repaints when it's needed, for example when some other program's window passes over top of a Swing component.) If you're doing those two things you're probably doing it right. Swing doesn't really have a high-level API for animation. It's designed primarily with drawing GUI components in mind. It can certainly do some good stuff, but you will have to write a component mostly from scratch, like you're doing. Painting in AWT and Swing covers some of the 'behind the scenes' stuff if you do not have it bookmarked. You might look in to JavaFX. I don't know that much about it personally, but it's supposed to be more geared towards animation. As somewhat of an optimization, one thing that can be done is to paint on a separate image and then paint the image on to the panel in paintComponent. This is especially useful if the painting is long: repaints can be scheduled by the system so this keeps when it happens more under control. If you aren't drawing to an image, then you'd need to build a model with objects, and paint all of them every time inside paintComponent. Here's an example of drawing to an image: import javax.swing.*; import java.awt.*; import java.awt.image.*; import java.awt.event.*; /** * Holding left-click draws, and * right-clicking cycles the color. */ class PaintAnyTime { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new PaintAnyTime(); } }); } Color[…
downvote count: 0
has comment: http://stackoverflow.com/comment/32088027
type: Answer

http://stackoverflow.com/q/21292991
has comment: http://stackoverflow.com/comment/34385833
tagged with: opencv
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32179262
tagged with: image-processing
type: Question
answer count: 2
tagged with: template-matching
tagged with: javacv
has answer: http://stackoverflow.com/a/21394069
has title: Finding image in specific area in image using Matching Template in javacv
has body: I am trying to find the location of image inside a specific area in another. I am using javacv to do this issue. But my code is giving an error when executing cvMatchTemplate function. I think I am miss using cvSetImageROI. This is how I am using it: public static void main(String c[]) { IplImage src = cvLoadImage("test.jpg", 0); IplImage tmp = cvLoadImage("tmp.png", 0); IplImage result = cvCreateImage(cvSize(src.width() - tmp.width() + 1, src.height() - tmp.height() + 1), IPL_DEPTH_32F,1); cvZero(result); cvSetImageROI(src, new CvRect(22, 50, 30, 30)); cvSetImageROI(result, new CvRect(22, 50, 30, 30)); //Match Template Function from OpenCV cvMatchTemplate(src, tmp, result, CV_TM_CCORR_NORMED); double[] min_val = new double[2]; double[] max_val = new double[2]; CvPoint minLoc = new CvPoint(); CvPoint maxLoc = new CvPoint(); cvMinMaxLoc(result, min_val, max_val, minLoc, maxLoc, null); CvPoint point = new CvPoint(); point.x(maxLoc.x() + tmp.width()); point.y(maxLoc.y() + tmp.height()); cvRectangle(src, maxLoc, point, CvScalar.RED, 2, 8, 0); cvShowImage("Lena Image", src); cvWaitKey(0); cvReleaseImage(src); cvReleaseImage(tmp); cvReleaseImage(result); } This is the error: OpenCV Error: Assertion failed (result.size() == cv::Size(std::abs(img.cols - templ.cols) + 1,std::abs(img.rows - templ.rows) + 1) &amp;&amp; result.type() == CV_32F) in unknown function, file ..\..\..\src\opencv\modules\imgproc\src\templmatch.cpp, line 384 Any Help?
score: 0
has comment: http://stackoverflow.com/comment/34407809
has comment: http://stackoverflow.com/comment/34406856
has comment: http://stackoverflow.com/comment/34321322
accepted answer: http://stackoverflow.com/a/21394069
has comment: http://stackoverflow.com/comment/34381234
possible better answer: http://stackoverflow.com/a/27414850
has answer: http://stackoverflow.com/a/27414850

http://stackoverflow.com/comment/32125325
comment on: http://stackoverflow.com/q/21311162
score: 0
type: QuestionComment
has text: Yes, to give an example, every time I do a pull onto my second computer I lose the navigation drawer stuff (that Android Studio auto adds to your project) plus the support libraries etc. Also I couldn't even extend a BaseAdapter last night from a raw pull request which should be standard stuff?
type: Comment

http://stackoverflow.com/comment/31965750
has text: i assume you mean something like:ListView listView=getListView(); listView.addHeaderView; in the onCreate?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21223328
type: Comment

http://stackoverflow.com/a/21185379
answers question: http://stackoverflow.com/q/21185312
upvote count: 1
has body: List&lt;String&gt; tempList = new ArrayList&lt;String&gt;(domainsStr); tempList.removeAll(result.getUnavailable()); for(String domain : tempList){ ..... I put them into a tempt list so you don't lose the items in the domainsStr list.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/32063234
score: 0
type: Comment
type: QuestionComment
has text: @BrianRoach Using a counter would prevent the memory leak however it'd require myself to update the counter with each minecraft update where Mojang allocates more blocks. "Developers are lazy" they say. So I tried to find an automatic code to check at which id no block has been defined yet.
comment on: http://stackoverflow.com/q/21277687

http://stackoverflow.com/q/21285541
has comment: http://stackoverflow.com/comment/32074719
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32074643
accepted answer: http://stackoverflow.com/a/29486690
type: AnsweredQuestion
has body: I have a site that can generate questionnaires to my survey app in android.. all the questionnaires goes to a single folder. Is there a way to download all the questionnaires without knowing every single address of the questionnaires? I already know how to download a single file, but I want to download an entire folder/directory form a website using java from private static String file_url = "http://umsurvey.comlu.com/admin/question/"; to OutputStream output = new FileOutputStream(Environment.getExternalStorageDirectory()+"/Question/");
favorite count: 0
type: Question
tagged with: android
has title: How to download an entire folder/directory from a website in java
has answer: http://stackoverflow.com/a/29486690
tagged with: file-handling
tagged with: download
upvote count: 1
answer count: 1
downvote count: 1

http://stackoverflow.com/comment/32110351
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21305511
type: Comment
has text: So let me try and explain why I need this. I have a set of calculations that need to be performed, lets say 100. Each calculation takes approximately 10 seconds. I have implemented Multithread so that these calculations can be done simultanously (they do not depend on each other) but I need to store each result (a lot of different values) for each computation, so that the results can be reached globally from other methods/classes for plotting. What do you recon is the best to do so?

http://stackoverflow.com/q/21337801
tagged with: java
has answer: http://stackoverflow.com/a/21366172
has answer: http://stackoverflow.com/a/21423220
type: Question
tagged with: hadoop
has body: I am trying to setup a hadoop single node cluster on my local machine. I installed hadoop using the following instructions http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster/ after starting the cluster using bin/start-all.sh I get the following output from jps 19623 TaskTracker 19388 SecondaryNameNode 19670 Jps 19479 JobTracker I can see the nameNode is notrunning. I pulled out the logs from the /logs directory and look like this. 2014-01-24 11:30:20,614 INFO org.apache.hadoop.hdfs.server.common.Storage: Storage directory /app/hadoop/tmp/dfs/name does not exist. 2014-01-24 11:30:20,617 ERROR org.apache.hadoop.hdfs.server.namenode.FSNamesystem: FSNamesystem initialization failed. org.apache.hadoop.hdfs.server.common.InconsistentFSStateException: Directory /app/hadoop/tmp/dfs/name is in an inconsistent state: storage directory does not exist or is not accessible. at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:303) at org.apache.hadoop.hdfs.server.namenode.FSDirectory.loadFSImage(FSDirectory.java:100) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.initialize(FSNamesystem.java:388) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.&lt;init&gt;(FSNamesystem.java:362) at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:276) at org.apache.hadoop.hdfs.server.namenode.NameNode.&lt;init&gt;(NameNode.java:496) at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1279) at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1288) 2014-01-24 11:30:20,619 ERROR org.apache.hadoop.hdfs.server.namenode.NameNode: org.apache.hadoop.hdfs.server.common.InconsistentFSStateException: Directory /app/hadoop/tmp/dfs/name is in an inconsistent state: storage directory does not exist or is not accessible. at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:303) at org.apache.hadoop.hdfs.server.namenode.FSDirec…
has answer: http://stackoverflow.com/a/21344873
answer count: 3
has title: nameNode doesnt start - hadoop-1.0.3 ubuntu 13.10 single node cluster
type: UnansweredQuestion
score: 0

http://stackoverflow.com/q/21212372
has answer: http://stackoverflow.com/a/21212406
type: AnsweredQuestion
tagged with: android-arrayadapter
score: 1
tagged with: java
type: Question
has title: Exception in adapter when trying to inflate layout
possible better answer: http://stackoverflow.com/a/21212406
has body: I'm trying to inflate a layout in my getView method of my adapter: Here is the error: 01-18 20:58:04.873: E/AndroidRuntime(21583): java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView 01-18 20:58:04.873: E/AndroidRuntime(21583): at android.widget.AdapterView.addView(AdapterView.java:478) 01-18 20:58:04.873: E/AndroidRuntime(21583): at android.view.LayoutInflater.inflate(LayoutInflater.java:500) 01-18 20:58:04.873: E/AndroidRuntime(21583): at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 01-18 20:58:04.873: E/AndroidRuntime(21583): at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 01-18 20:58:04.873: E/AndroidRuntime(21583): at com.myname.myapp.gui.MyAdapter.getView(MyAdapter.java:46) The error (according to eclipse happens on the converView =mInflater... @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub if (convertView == null) { convertView = mInflater.inflate( android.R.layout.simple_list_item_1, parent); } ((TextView) convertView.findViewById(R.id.text1)).setText(titles .get(position)); return convertView; } Here is the the constructor to my adapter: public MyAdapter(ArrayList&lt;String&gt; list, Context context) { titles = list; this.context = context; mInflater = LayoutInflater.from(context); }
has answer: http://stackoverflow.com/a/48436935
answer count: 3
tagged with: android-listview
upvote count: 1
tagged with: android
has answer: http://stackoverflow.com/a/21212473
accepted answer: http://stackoverflow.com/a/21212473
tagged with: android-adapter
favorite count: 0
has comment: http://stackoverflow.com/comment/31945989
downvote count: 0

http://stackoverflow.com/a/21285666
has comment: http://stackoverflow.com/comment/32077616
downvote count: 0
score: 1
has body: The error is in this code: private static PanelFunkcji panelFunkcji; //1 private static double a; private static double b; private static double c; private static double d; public void getDane() { a = panelFunkcji.getA(); //9 b = panelFunkcji.getB(); c = panelFunkcji.getC(); d = panelFunkcji.getD(); } public OknoFunkcji(String title) { super(title); JPanel chartPanel = createDemoPanel(); //chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); chartPanel.setSize(500, 270); setContentPane(chartPanel); getDane(); //22 } You declare the variable panelFunkcji on line 1, and use it on line 9. However, you never instantiate the variable. That is what is causing the NullPointerException. To fix it, add the line panelFunkcji = new PanelFunkcji(chartPanel); anywhere in OknoFunkcji's constructor before line 22.
upvote count: 1
answers question: http://stackoverflow.com/q/21285453
has comment: http://stackoverflow.com/comment/32078673
has comment: http://stackoverflow.com/comment/32078010
type: Answer

http://stackoverflow.com/a/21229871
upvote count: 3
has body: Sudoku is a problem with breadcrumbs in it that lead to the optimal solution (even in the hardest cases). What I mean by that is that the constraints confine it that much that the combinatorial explosion of the search space isn't too big (relatively speaking of course): the way to proceed is clear. Other examples of such problems are the Einstein/Zebra puzzle, SendMoreMoney puzzle and n-queens. Those are perfect backtracking cases. While Simulated Annealing does kinda work on those, it's not the correct tool for the job (backtracking is). On the other hand, Simulated Annealing (and other metaheuristics) excel at realistic problems such as course timetabling, employee rostering, vrp, ... An available library you could use is OptaPlanner (Java, open source): Someone already wrote a Sudoku solver for it 2 years ago, for an older version of OptaPlanner (then it was still called Drools Planner). By default it looks like he configured Tabu Search, but it's a 2 line change to switch that to Simulated Annealing.
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21220689
answers question: http://stackoverflow.com/q/21220689
score: 3

http://stackoverflow.com/comment/32097166
comment on: http://stackoverflow.com/q/21297782
score: 0
type: Comment
type: QuestionComment
has text: FWIW I see a lot wrong with the code, but I don't see anything particularly wrong with the question. It is _yet another_ "I've got an NPE" question, but it is a complete question.

http://stackoverflow.com/q/21184351
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31895731
has comment: http://stackoverflow.com/comment/31894776
has comment: http://stackoverflow.com/comment/31895247
has comment: http://stackoverflow.com/comment/31894988
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31894967
tagged with: sql
has comment: http://stackoverflow.com/comment/31895452
has title: Cant create a database android
has answer: http://stackoverflow.com/a/21185846
type: Question
has comment: http://stackoverflow.com/comment/31894675
tagged with: android
answer count: 1
has body: I have created a DatabaseHandler class extended from SQLiteOpenHelper . I have used the same class in another project and it worked perfectly , but when I imported it in the directory of my current project it doesn't work properly . It doesn't even create a database . Here are the methods which creates the database and the tables . private static final int DATABASE_VERSION = 1; // Database Name private static final String DATABASE_NAME = "mydatabase.db"; // Contacts table name private static final String TABLE_WORDS = "words"; private static final String TABLE_SETS = "sets"; // Contacts Table Columns names private static final String KEY_ID = "id"; private static final String KEY_WORD = "word"; private static final String KEY_DEFINITION = "definition"; private static final String KEY_WORDS_SET_ID = "wordssetid"; private static final String KEY_SET_NAME = "setname"; private static final String KEY_SET_ID = "setid"; public DatabaseHandler(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } // Creating Tables @Override public void onCreate(SQLiteDatabase db) { String createWordTable = "CREATE TABLE IF NOT EXISTS " + TABLE_WORDS+ "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_WORD + " TEXT," + KEY_DEFINITION + " TEXT," + KEY_WORDS_SET_ID+" INTEGER) "; String createSetTable = "CREATE TABLE "+TABLE_SETS+"(" +KEY_SET_ID+ " INTEGER PRIMARY KEY, " +KEY_SET_NAME+ " TEXT) "; db.execSQL(createWordTable ); db.execSQL(createSetTable); db.close(); } Creating and using the object in the Activity class private DatabaseHandler dbHandler; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_browse_sets); //... //... //... dbHandler = new DatabaseHandler (this); } I have done the same thing in the other project , but now it doest work . What is the reason ?

http://stackoverflow.com/a/21288572
downvote count: 0
has body: Try this have been works for me fine ImageIO.read(getClass().getResource("images/logo.png"));
answers question: http://stackoverflow.com/q/21288371
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/q/21237127
type: Question
accepted answer: http://stackoverflow.com/a/21238739
tagged with: java
tagged with: wsimport
tagged with: jaxb
has answer: http://stackoverflow.com/a/21238739
has body: When using wsimport the "standard" way: wsimport.exe -d C:/temp/generatedClasses -s C:/temp/sourceFiles C:/temp/myWsdl.wsdl I get source files generated like this: @XmlRootElement(name = "PingRequest") public class PingRequest{ Last time the classes were generated the same WSDL/ XSDs should have been used and generated a output like this: @XmlRootElement(name = "PingRequest", namespace = "http://me.foo.bar/any/") public class PingRequest { So the schemas namespace was included as attribute of the annotation. Since the generated class package-info.java has the following entry: @javax.xml.bind.annotation.XmlSchema(namespace = "http://me.foo.bar/any", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) I assume adding the namespace-attribute is a done by configuration of wsimport/ jaxb schema compiler. Could anyone explain me how to archive the namespace attribute beeing included? Update: As Blaise answered correctly (described in the blog-link) the generated file package-info.java defines the namespace for all classes/ types inside the according package. Above example is obsolete if always the same namespace is included per @RootElement. Setting namespaces on @RootElement level may be used to have a certain @RootElement have its own namespace (which in case of wsimport should happen automaticially). Very many thanks for any suggestions What i tried: used google, found https://www.java.net/node/681149 (exaclty my question from back in 2008) with no answer :( read wsimport/ jaxb schema compiler options, tried out various that only controlled package ouput read 12 similar question/ answer that poped up when i typed in the title of this question Closest i found that has something to do with the namespaces was to have 'elementFormDefault="qualified' specified in both the XSD itself and the import part inside the WSDL which i have done.
tagged with: wsdl
downvote count: 0
answer count: 1
favorite count: 0
has title: Missing namespace in the javas generated by wsimport
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/a/21206856
score: 1
has comment: http://stackoverflow.com/comment/31935785
upvote count: 1
has comment: http://stackoverflow.com/comment/31935800
downvote count: 0
has comment: http://stackoverflow.com/comment/31935559
has body: Suppose your base class has a method that must be overridden in any useful subclass. If you implement the method in the base class, and it is not overridden, the error will not be found until your dummy method body gets run. If you make the method and class abstract, the error will be found at compile time.
answers question: http://stackoverflow.com/q/21206817
type: Answer
has comment: http://stackoverflow.com/comment/31935758
has comment: http://stackoverflow.com/comment/31936259

http://stackoverflow.com/q/21298142
has answer: http://stackoverflow.com/a/21323603
tagged with: java
type: Question
has title: Is there anyway round robin through servers in RetroFit?
score: 0
has body: Specifically, if I have a set of servers that all expose the same REST api, in RetroFit is there a way to specify that set of servers, or is the only option to instantiate multiple retrofit clients and circle through them?
tagged with: retrofit
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/a/21225603
has body: To do exactly what you would like, you would have to create your own linked list with the Task object as the node. For example: public class Task { Task previous, next; Date startTime; ... } In your calling method you would have a reference to the first Task and you could iterate over the list as you see fit. Doing so would allow you to conduct the logic that you have presented, however the downside of rolling your own linked list is that you lose the functionality of the built in LinkedList. Please review whether a "helper" class might be beneficial to you with a method like: calculateStartTime(ListIterator&lt;E&gt; remainderOfList) { while(remainderOfList.hasNext()) { E element = remainderOfList.next(); element.calculateStartTime(); } } The ListIterator can be generated from your LinkedList using the listIterator method
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21225479

http://stackoverflow.com/a/21288535
score: 2
has body: You can read the image file from the classpath using something like this: this.getClass().getResourceAsStream("logo.png"); Take a look at this blog post for a complete example.
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21288371

http://stackoverflow.com/comment/31971864
type: AnswerComment
score: 0
has text: now error is reduced. `com.sun.mail.smtp.SMTPSendFailedException: 530-5.5.1 Authentication Required.` I tried with `properties.setProperty("mail.smtp.auth", "true");` but still not working.
type: Comment
comment on: http://stackoverflow.com/a/21204996

http://stackoverflow.com/q/21335077
has answer: http://stackoverflow.com/a/21335235
has body: The purpose of the method removeDuplicate(ArrayList&lt;Card&gt; l) is that removing the duplicated object based on the attribute card_value in class Card and then add them to an ArrayList and return the arr. But my program return an error: NoSuchElementException at the line dum.add((Card) it.next()); I have no idea what's going on here because I print out the object that returned by the next() method, it prints out perfectly. Someone please show me why I get mistake in the implementation below: private ArrayList&lt;Card&gt; removeDuplicate(ArrayList&lt;Card&gt; l){ int end = l.size(); Set&lt;Card&gt; set = new HashSet&lt;&gt;(); for(int i = 0; i &lt; end; i++){ set.add(l.get(i)); } ArrayList&lt;Card&gt; dummy = new ArrayList&lt;&gt;(); Iterator it = set.iterator(); while(it.hasNext()){ System.out.println(it.next()); dummy.add((Card) it.next()); } return dummy; } And these are override methods: @Override public int hashCode() { int hash = 5; hash = 97 * hash + this.card_value; return hash; } @Override public boolean equals(Object obj) { if (obj == this){ return true; } if (!(obj instanceof Card)){ return false; } Card other = (Card) obj; return (this.card_value == other.card_value); }
has title: NoSuchElementException in method next() Java
favorite count: 0
has answer: http://stackoverflow.com/a/21335096
upvote count: 1
has answer: http://stackoverflow.com/a/21335116
answer count: 4
type: AnsweredQuestion
tagged with: nosuchelementexception
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21335106
type: Question
accepted answer: http://stackoverflow.com/a/21335096
possible better answer: http://stackoverflow.com/a/21335235
downvote count: 0

http://stackoverflow.com/q/21286788
has comment: http://stackoverflow.com/comment/32076796
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21286853
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32076791
type: Question
has comment: http://stackoverflow.com/comment/32076836
score: -2
tagged with: java
answer count: 2
downvote count: 2
has body: I have a method name MakeKK public void MakeKK(String K1, String K2){ .... } I try to call this method in this following way, File f = null; MakeKK(f.getAbsolutePath()+ "\\Text.txt", f.getAbsolutePath()+"\\Text2.txt"); But it gives an error of Error: non-static method MakeKK Can anyone spot my mistake?
linked to: http://stackoverflow.com/q/2671496
has title: calling method gives an error of non-static method
has answer: http://stackoverflow.com/a/21286846

http://stackoverflow.com/q/21250041
accepted answer: http://stackoverflow.com/a/21251003
upvote count: 11
has answer: http://stackoverflow.com/a/21250253
has answer: http://stackoverflow.com/a/21251003
has comment: http://stackoverflow.com/comment/32013045
tagged with: subtraction
has comment: http://stackoverflow.com/comment/32013329
has answer: http://stackoverflow.com/a/21251039
favorite count: 0
tagged with: integer
answer count: 5
has comment: http://stackoverflow.com/comment/32012995
has answer: http://stackoverflow.com/a/21250284
has body: I was recently given a programming puzzle that I cannot for the life of me find a satisfactory answer for: compute the sum of two arbitrarily large integers given by strings, where the second integer may be negative. This was to be done in Java without using any of the BigInteger, BigNumber etc. classes. My initial approach was the following in pseudocode: If the first character of the second string is '-' then set the subtraction flag. Convert each string to an array of integers, one for each digit. Extend the shortest array and left-pad with zeros so both arrays are the same size. Loop through each index of the arrays (from least significant digit to most significant digit) performing the addition/subtraction and using a carry to carry the overflow to the next digit. Check the carry to add any last digits. My algorithm works fine for positive numbers, but gives wildly incorrect results for negative numbers. I've tried to work this out on paper but I just don't seem to be able to understand how to do subtraction digit by digit. My current algorithm for steps 4 and 5 are as follows: int[] result = new int[number1.length]; int carry = 0; for(int i = number1.length - 1; i &gt;= 0; i--) { int newDigit = (negative ? number1[i] - number2[i] : number1[i] + number2[i]); newDigit += carry; if (newDigit &gt;= 10) { carry = 1; newDigit -= 10; } else if (newDigit &lt; 0) { carry = -1; newDigit += 10; } else { carry = 0; } result[i] = newDigit; } // Convert result back into a string. String resultString = intArrayToString(result); // Apply carry. if(carry == 1) { return "1" + resultString; } else if(carry == -1) { return "-" + resultString; } else { return resultString; }
score: 11
has comment: http://stackoverflow.com/comment/32013017
type: AnsweredQuestion
has title: Subtracting two integers digit by digit
downvote count: 0
tagged with: algorithm
has comment: http://stackoverflow.com/comment/32013064
possible better answer: http://stackoverflow.com/a/21250238
has comment: http://stackoverflow.com/comment/32013763
has comment: http://stackoverflow.com/comment/32013111
tagged with: java
has comment: http://stackoverflow.com/comment/32014457
type: Question
has answer: http://stackoverflow.com/a/21250238

http://stackoverflow.com/comment/31998831
comment on: http://stackoverflow.com/a/21241765
score: 0
type: AnswerComment
has text: @user697911 The usage is same. They would give you the same result, when there is no overflow.
type: Comment

http://stackoverflow.com/q/21345770
tagged with: java
has answer: http://stackoverflow.com/a/21352171
tagged with: file
type: Question
has body: Let's say a class AnotherShell public class AnotherShell { private Shell shell; public AnotherShell() { shell = new Shell(Display.getCurrent()); Button btnNewButton = new Button(shell, SWT.NONE); btnNewButton.addSelectionListener(new SelectionAdapter() { @Override public void mouseUp(SelectionEvent e) { System.out.print("Selected\n"); } }); } public void open() { shell.open(); } public void close() { shell.setVisible(false); } } I wonder if it is possible to save this into a file and than from a program that doesn't have this code load the file and "recreate" the windows exactly as if it was part of the code...
answer count: 1
score: 0
tagged with: shell
accepted answer: http://stackoverflow.com/a/21352171
has title: Creating a dynamic shell from loading a file
type: AnsweredQuestion
tagged with: dynamic

http://stackoverflow.com/a/21253457
score: 3
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21250281
upvote count: 3
has body: here is an example for you: import java.awt.Desktop; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import javax.swing.JButton; import javax.swing.JFrame; public class Main extends JFrame { File file = new File("C:\\"); Desktop desktop = Desktop.getDesktop(); public Main() { super("open folder demo/SuRu"); JButton button = new JButton("Open C:\\"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { try { desktop.open(file); } catch (IOException e) { e.printStackTrace(); } } }); add(button); setBounds(100, 100, 200, 200); setDefaultCloseOperation(EXIT_ON_CLOSE); } public static void main(String[] args) { new Main().setVisible(true); } }

jar
tags question: http://stackoverflow.com/q/21203226
tags question: http://stackoverflow.com/q/21230116
tags question: http://stackoverflow.com/q/21213055
tags question: http://stackoverflow.com/q/21312603
tags question: http://stackoverflow.com/q/21342560
tags question: http://stackoverflow.com/q/21311862
tags question: http://stackoverflow.com/q/21249709
tags question: http://stackoverflow.com/q/21240052
tags question: http://stackoverflow.com/q/21345779
tags question: http://stackoverflow.com/q/21255246
type: Tag
tags question: http://stackoverflow.com/q/21193332
tags question: http://stackoverflow.com/q/21239854
tags question: http://stackoverflow.com/q/21259436
tags question: http://stackoverflow.com/q/21337698
tags question: http://stackoverflow.com/q/21293856
tags question: http://stackoverflow.com/q/21205029
tags question: http://stackoverflow.com/q/21276827
tags question: http://stackoverflow.com/q/21310730
tags question: http://stackoverflow.com/q/21308825
tags question: http://stackoverflow.com/q/21285598
tags question: http://stackoverflow.com/q/21342909
tags question: http://stackoverflow.com/q/21270263
tags question: http://stackoverflow.com/q/21311517
tag name: jar
tags question: http://stackoverflow.com/q/21340082
tags question: http://stackoverflow.com/q/21242581
tags question: http://stackoverflow.com/q/21325643
tags question: http://stackoverflow.com/q/21328099
tags question: http://stackoverflow.com/q/21312075
tags question: http://stackoverflow.com/q/21342642
tags question: http://stackoverflow.com/q/21223015
tags question: http://stackoverflow.com/q/21296107
tags question: http://stackoverflow.com/q/21223124
tags question: http://stackoverflow.com/q/21311557
tags question: http://stackoverflow.com/q/21326488
tags question: http://stackoverflow.com/q/21228613
tags question: http://stackoverflow.com/q/21248160
tags question: http://stackoverflow.com/q/21232142
tags question: http://stackoverflow.com/q/21246479
tags question: http://stackoverflow.com/q/21276042
tags question: http://stackoverflow.com/q/21255406

http://stackoverflow.com/comment/31912969
type: QuestionComment
has text: Or adding java.exe to your system filepath. Any programs you use frequently are nice to have in there.
type: Comment
comment on: http://stackoverflow.com/q/21193930
score: 0

http://stackoverflow.com/comment/32172098
type: QuestionComment
comment on: http://stackoverflow.com/q/21339686
has text: @SpaceTrucker It's not that we have very many imports, sometimes only 2 or 3 (but sometimes more). The problem is that Eclipse removes them given the least provocation, and then we have to put them all back in by hand, every time. As for the other, nobody here has time to write our own Eclipse plugins to fix Eclipse bugs.
score: 0
type: Comment

http://stackoverflow.com/comment/32037221
score: 2
comment on: http://stackoverflow.com/q/21264054
has text: i made a similar application in c#, trick i used was one machine was continuously listening to a specific port, the other just sent image bytes to that port!
type: Comment
type: QuestionComment

inputstream
tags question: http://stackoverflow.com/q/21240826
tags question: http://stackoverflow.com/q/21313643
tags question: http://stackoverflow.com/q/21301688
tags question: http://stackoverflow.com/q/21214972
tags question: http://stackoverflow.com/q/21237442
tags question: http://stackoverflow.com/q/21346702
tags question: http://stackoverflow.com/q/21188807
tags question: http://stackoverflow.com/q/21304711
tags question: http://stackoverflow.com/q/21287880
tag name: inputstream
type: Tag
tags question: http://stackoverflow.com/q/21219085
tags question: http://stackoverflow.com/q/21279829
tags question: http://stackoverflow.com/q/21349259

http://stackoverflow.com/comment/32127104
score: 0
has text: Does it work when you do an ls after logging in as the same user?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21315160

http://stackoverflow.com/comment/32151510
has text: The problem with this as mentioned in the question is that the enum is used from multiple packages of the library, so the visibility of additional attributes and methods cannot be reduced.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21328703

http://stackoverflow.com/q/21335034
has comment: http://stackoverflow.com/comment/32248093
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32270106
type: Question
has comment: http://stackoverflow.com/comment/32185190
has comment: http://stackoverflow.com/comment/32172125
score: 0
has body: I have written an android app that streams h.264 frames from a mobile-dvr/nvr and the solution works on all of the devices that I have tested on except for the Nexus 10. It successfully streams video on galaxy devices, the Nexus 7, and multiple Motorola devices without any problems. No exceptions are thrown and the log shows nothing strange, but when debugging MediaCodec.dequeueInputBuffer(10000); always returns -1, thus never supplying a valid input buffer index to send a frame to. I assume that I am configuring the MediaCodec properly considering it works on all other devices that have been tested. Has anyone else had an issue similar to this and if so is there a known fix or reason for this problem with the Nexus 10? public void ConfigureDecoder(Surface s, int w, int h) { try { Decoder = MediaCodec.createDecoderByType("video/avc"); MediaFormat mFormat = MediaFormat.createVideoFormat("video/avc", w, h); Decoder.configure(mFormat, s, null, 0); } catch (Exception e) { e.printStackTrace(); } }
type: UnansweredQuestion
has title: Problems with Android MediaCodec on Nexus 10 specifically
tagged with: android
tagged with: android-mediacodec

http://stackoverflow.com/comment/32171637
score: 3
has text: 8. Developer switches to IntelliJ.
comment on: http://stackoverflow.com/q/21339686
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32142231
type: QuestionComment
has text: Could someone come up with NIO solution?
comment on: http://stackoverflow.com/q/21322375
score: 0
type: Comment

http://stackoverflow.com/a/21276309
score: 1
answers question: http://stackoverflow.com/q/21276225
has body: When two or more threads need access to a shared resource, they need some way to ensure that the resource will be used by only one thread at a time. Synchronized method is used to block the Shared resource between the multiple Threads. So, No need to apply Synchronization for the Single Thread
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/32029145
comment on: http://stackoverflow.com/q/21259795
has text: Make a wrapper around your array which lets the client see only a segment of it. If you make the class final, you'll enjoy almost native speed for the solution.
type: Comment
type: QuestionComment
score: 0

morphia
tag name: morphia
type: Tag
tags question: http://stackoverflow.com/q/21322674
tags question: http://stackoverflow.com/q/21325884

http://stackoverflow.com/a/21247682
has comment: http://stackoverflow.com/comment/32009363
has comment: http://stackoverflow.com/comment/32142840
score: 1
has body: This is basically a little hacky. What this does is uses the screen bounds minus it's insets to calculate not only the height of the window, but also the position to encourage the window to appear within the available desktop space. The main reason for this, is I have my taskbar pinned to the top of my screen... import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.Insets; import java.awt.Rectangle; import java.awt.Toolkit; import javax.swing.Box; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; public class ScrollPaneTest { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab("Tab 1", new JScrollPane(getPanel())); tabbedPane.addTab("Tab 2", new JScrollPane(getPanel())); frame.setContentPane(tabbedPane); frame.pack(); Rectangle viewBounds = getScreenViewableBounds(); frame.setSize(frame.getWidth(), viewBounds.height); frame.setLocation(viewBounds.x, viewBounds.y); frame.setVisible(true); } private JPanel getPanel() { JPanel panel = new JPanel(); Box box = Box.createVerticalBox(); for (int i = 1; i &lt;= 100; i++) { box.add(new JLabel("This is Label #" + i)); } panel.add(box); return panel; } }); } public static Rectangle getScreenViewableBounds() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); Rectangle bounds = new Rectangle(0, 0, 0, 0); if (gd != null) { GraphicsConfiguration gc = gd.getDefaultConfiguration(); bounds = gc.getBounds(); Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc); bounds.x += insets.left; bounds.y += inse…
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32017172
has comment: http://stackoverflow.com/comment/32009419
answers question: http://stackoverflow.com/q/21247623
has comment: http://stackoverflow.com/comment/32142887
type: Answer
accepted answer of: http://stackoverflow.com/q/21247623
downvote count: 0
has comment: http://stackoverflow.com/comment/32010907
has comment: http://stackoverflow.com/comment/32010864

http://stackoverflow.com/q/21210096
type: UnansweredQuestion
score: 2
tagged with: java
has body: I used a surface view and an image overlay on top of the surface view( background). I would like to use a button to take a snapshot of the screen without rooting the device. However when I take a take screenshot using the button, it captures only the foreground overlay, not the entire screen i.e background surface view image and the foreground image overlay.
type: Question
upvote count: 2
answer count: 1
favorite count: 0
has title: How to take a screenshot of an app camera surfaceview and image overlay programatically without rooting?
has answer: http://stackoverflow.com/a/21210247
tagged with: android
downvote count: 0

http://stackoverflow.com/comment/32195899
type: QuestionComment
comment on: http://stackoverflow.com/q/21349111
has text: @NiklasB. Thank you. I'll check out Scanner. Could you tell me the problem in the above code ?
score: 0
type: Comment

http://stackoverflow.com/comment/31998023
has text: @SotiriosDelimanolis : No, I am not sure.. I am using JNA for the first time
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21241371

http://stackoverflow.com/comment/32033682
has text: You can use `binarySearch` only on sorted lists so if you want to keep your list unsorted just use `list.contains(String)`.
comment on: http://stackoverflow.com/q/21262043
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31901481
type: Comment
has text: Are there any restrictions, why not flatten the BSTs into in-order list then compare the lists for common elements and add them to the 3rd BST?
comment on: http://stackoverflow.com/q/21187789
score: 0
type: QuestionComment

http://stackoverflow.com/q/21264610
answer count: 2
tagged with: sql
downvote count: 0
favorite count: 0
has title: SQL Builders in Java
type: UnansweredQuestion
score: 2
upvote count: 2
tagged with: java
linked to: http://stackoverflow.com/q/370818
type: Question
has body: I am currently shopping around for SQL builders in Java. My basic desire is something like this: SelectBuilder sb = new SelectBuilder(source, alias); // Source can be subquery sb.select(column1, alias1); sb.select(column2, alias2); sb.joinWith(joinObj, joinAlias); sb.where(column1, operator, value) sb.orderBy(column1, DESC) // etc etc etc ... and that it does prepared statements I've looked into JOOQ and my impression is that it is too convoluted for my taste. I don't want to set up some xml or xsd file for my schemas. The most I'd allow is to write the beans. I've looked at Squiggle but it only supports SELECT and not the rest. MyBatis is not good enough because it does not fully abstract out the SQL syntax. I've also tried several more recommended by Stack Overflow posts like this and that. One additional thing that I really don't like about several Java-based SQL builder is the chaining syntax: i.e. select().from().where().etc().etc().etc() Anyway, do you guys know of other SQL Builders that may meet my requirements? I've searched two days on web and couldn't find anything yet. Insight would be appreciated!!!
has answer: http://stackoverflow.com/a/21264969
has answer: http://stackoverflow.com/a/53432797

android-cursoradapter
type: Tag
tags question: http://stackoverflow.com/q/21325355
tag name: android-cursoradapter

http://stackoverflow.com/comment/31999927
comment on: http://stackoverflow.com/q/21242528
score: 0
type: QuestionComment
type: Comment
has text: Use layout inflater to call the edit.xml then use addview method to add the view in your linear layout

http://stackoverflow.com/a/21216829
has body: Unlike C/C++, in Java conditionals have to evaluate to a boolean. For example: int i = 1; if (i) { ... } isn't valid in java. Your ternary would need to be: (i &amp; 1) != 0 ? -3.0f : 3.0f;
score: 3
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21216786
has comment: http://stackoverflow.com/comment/31953574
answers question: http://stackoverflow.com/q/21216786
has comment: http://stackoverflow.com/comment/31953665
has comment: http://stackoverflow.com/comment/31953527
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31955843
type: AnswerComment
type: Comment
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/45578/discussion-between-hovercraft-full-of-eels-and-oliver-bak)
comment on: http://stackoverflow.com/a/21217469
score: 0

http://stackoverflow.com/comment/32173155
type: Comment
has text: Hey thanks for explaining. Am new to this. Btw this is th complete question that i need to solve::
comment on: http://stackoverflow.com/a/21340224
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31912661
comment on: http://stackoverflow.com/q/21193802
type: QuestionComment
has text: Where is the variable `vaheaeg` defined?
type: Comment
score: 2

http://stackoverflow.com/comment/32112142
has text: @MichałRybak the controller just contains response embedded in GenericJSON or let me say in different words , how to return HTML which is to obtain from ModelAndView and, the returning JSON also has some more attributes in JSON to return , it's not only HTML which I need to send on client side, Hope this helps.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21306200

http://stackoverflow.com/a/21254792
has comment: http://stackoverflow.com/comment/32062677
downvote count: 0
has comment: http://stackoverflow.com/comment/32066504
type: Answer
answers question: http://stackoverflow.com/q/21254367
score: 3
has comment: http://stackoverflow.com/comment/32028957
upvote count: 3
has comment: http://stackoverflow.com/comment/32070223
has body: Why do you think the "DA" key should be there? The PDF specification clearly states that the DA key is in the "Additional entries common to all fields containing variable text". The fields in your PDF file doen't appear to have variable text (text entered by the user for example). As such the "DA" key is optional and you should be prepared to accept it isn't there.

http://stackoverflow.com/comment/31972976
has text: It Could Happen if your Internet Connection is Bit Slow
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21218318

http://stackoverflow.com/a/21215562
has comment: http://stackoverflow.com/comment/31954763
has comment: http://stackoverflow.com/comment/31957088
has comment: http://stackoverflow.com/comment/31953024
answers question: http://stackoverflow.com/q/21214948
upvote count: 1
has comment: http://stackoverflow.com/comment/31953213
has comment: http://stackoverflow.com/comment/31954660
has body: .Net have the same problem, Finalize method is not reliable. So in .Net 2.0 to address this problem Safe Handles are introduced, which provides a reliable way to release the unmanaged resource. All you have to do is inherit your class from SafeHandle or CriticalHandle. These both indeed derives from CritialFinializationObject which turns to be the key for reliablity. Read more about safehandles here. P.S:This is only partial answer, am a .Net guy so apologizes for no java part of answer.
has comment: http://stackoverflow.com/comment/31956224
has comment: http://stackoverflow.com/comment/31973181
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31952600
has comment: http://stackoverflow.com/comment/31968490
type: Answer

http://stackoverflow.com/comment/32159593
type: QuestionComment
comment on: http://stackoverflow.com/q/21332787
has text: I am trying to find out the most common word in a text using hadoop.and print it
score: 0
type: Comment

http://stackoverflow.com/q/21292074
has comment: http://stackoverflow.com/comment/32086631
tagged with: eclipse-rcp
type: AnsweredQuestion
tagged with: java
has title: What's the best way to create a file with application errors?
type: Question
has answer: http://stackoverflow.com/a/21306969
accepted answer: http://stackoverflow.com/a/21306969
has body: I'm developing an Eclipse RCP application and I want to report bugs on the application, but not for the user, I want to find the root of any possible failure. What is the recomendation? I think a logger like log4j is good option, but I'm not sure.
score: 0
has comment: http://stackoverflow.com/comment/32087182
answer count: 1

hibernate-mapping
tags question: http://stackoverflow.com/q/21204245
tag name: hibernate-mapping
type: Tag
tags question: http://stackoverflow.com/q/21186906

http://stackoverflow.com/comment/32120971
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21311517
has text: Im not sure what you think by import into the classpath. Boris The Spider
score: 0

http://stackoverflow.com/comment/31951497
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21215595
has text: 1) Where you are trying to connect to it **from** (what screen/functionality) 2) The error message indicates that either something still blocks connections (e.g. firewall -- could be even on your end) .. or required port is closed (nothing is listening on that port). 3) Try connecting with `telnet` to that IP:port if you believe it's java's/PhpStorm's fault.

http://stackoverflow.com/comment/31990278
comment on: http://stackoverflow.com/q/21237220
has text: define `2 Key access`
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/21192119
type: Answer
answers question: http://stackoverflow.com/q/21191498
has body: I assume this is a homework problem, because a fixed-size array is not an appropriate representation of a person's friends. People can have many friends, and the list can change. Let's look at the Person class. As you will have noticed, the constructor does not quite work because it constructs a Perspn with null for forelsket and sammenmed. The line this.forelsket = forelsket; \\ Google: forelsket means lover in English. does not work. forelsket is never initialized, so at the beginning of the constructor, this.forelsket is null. Since forelsket does not appear as a constructor argument, the code snippet is interpreted as this.forelsket = this.forelsket; which does nothing. A better constructor would be: Person(final String n, final Person forelsket, final Person sammenmed, final int lengde) { this.navn = n; this.forelsket = forelsket; this.sammenmed = sammenmed; this.kjenner = new Person[lengde]; this.kjennerIkke = new Person[lengde]; } though getting rid of lengde and using ArrayList would be better once you learn about collections. Next, you need to write methods to manipulate the kjenner and kjennerIkke arrays (or lists). You can fill these in yourself: public void setForelsket(final Person forelsket); public Person getForelsket(); public void setSammenmed(final Person sammenmed); public Person getSammenmed(); // Return whether the addition changed anything. public boolean addKjenner(Person kjenner); public boolean removeKjenner(Person kjenner); // Same for kjennerIkke. And after all that, you probably want to create your own equals and hashCode methods; these are necessary for collections.
score: 0

http://stackoverflow.com/comment/32072545
comment on: http://stackoverflow.com/q/21284062
has text: Take a look here, maybe it'll help or give you a solution track: http://stackoverflow.com/questions/5833553/how-to-stop-a-music-clip-in-java
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32084178
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21290591
has text: So you'll need some kind of flag to indicate whether the ball is in play. When they press the space bar, if the flag is not set, you should set the flag, create a `Ball` object, and start some kind of timer that calls the `move` method at regular intervals.

http://stackoverflow.com/comment/31976381
comment on: http://stackoverflow.com/a/21229525
score: 0
type: AnswerComment
type: Comment
has text: Can you explain "immutable view"? I am think in line of returning a const reference if that is possible. like public final Date getDate()

http://stackoverflow.com/q/21219777
has body: Does anyone know the running time in big O notation for the arrays.sort java method? I need this for my science fair project.
has answer: http://stackoverflow.com/a/67933560
has answer: http://stackoverflow.com/a/21219811
answer count: 4
type: AnsweredQuestion
tagged with: performance
tagged with: java
has answer: http://stackoverflow.com/a/74199742
type: Question
score: 10
upvote count: 11
has answer: http://stackoverflow.com/a/21219858
accepted answer: http://stackoverflow.com/a/21219858
downvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/21219811
has title: The Running Time For Arrays.Sort Method in Java

http://stackoverflow.com/a/21298647
has body: Option 3 is the fastest. Options 1 and 2 are roughly the same (option one being to multiply by ten twice). Multiplying by 100 instead gets up near the speed of option 3. Here's my test code: import java.math.BigDecimal; public class TestingStuff { public static void main(String[] args){ BigDecimal d2 = new BigDecimal(0); // to load the big decimal class outside the loop long start = System.currentTimeMillis(); for(int i = 0; i &lt; 1000000; i++) { BigDecimal d = new BigDecimal(99); d2 = d.movePointRight(2); } long end = System.currentTimeMillis(); System.out.println("movePointRight: " + (end - start)); BigDecimal ten = new BigDecimal(10); start = System.currentTimeMillis(); for(int i = 0; i &lt; 1000000; i++) { BigDecimal d = new BigDecimal(99); d2 = d.multiply(ten).multiply(ten); } end = System.currentTimeMillis(); System.out.println("multiply: " + (end - start)); start = System.currentTimeMillis(); for(int i = 0; i &lt; 1000000; i++) { BigDecimal d = new BigDecimal(99); d2 = d.scaleByPowerOfTen(2); } end = System.currentTimeMillis(); System.out.println("scaleByPowerOfTen: " + (end - start)); } } Of course you could just try the various options yourself in your own code. If you can't measure the difference, then why are you optimizing?
has comment: http://stackoverflow.com/comment/32099115
type: Answer
answers question: http://stackoverflow.com/q/21298457
score: 8
accepted answer of: http://stackoverflow.com/q/21298457
downvote count: 1
has comment: http://stackoverflow.com/comment/32098791
upvote count: 9
has comment: http://stackoverflow.com/comment/32098832
has comment: http://stackoverflow.com/comment/32098555
type: AcceptedAnswer

http://stackoverflow.com/comment/32032248
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21261323
has text: But isn't this basically a more hidden and automated if? Because that would still kind of be the same concept. I could be misunderstanding the answer though

sts-springsourcetoolsuite
tags question: http://stackoverflow.com/q/21345949
type: Tag
tag name: sts-springsourcetoolsuite

http://stackoverflow.com/comment/31969718
has text: I scratched my whole project, and just tried using your demo and it works! I'm able to get my post_title to display and retrieve data correctly. Though you demo seems to leave out the middle man adapter. So I only have a listActivity and myEndlessAdapter. Should what would be the easiest way to put in another adapter to serve as the middle man. I need something that can override getView so I can customize my list items.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21217426
type: AnswerComment

http://stackoverflow.com/q/21321229
tagged with: data-structures
has body: The Stack class inherits methods from Vector including get(int index); and add(int index, Object element);. In other words: not very stack-like. The Deque interface implements methods that behave like both a FIFO Queue and a LIFO Stack, hence the acronym "Double Ended Qeueue". So, in reality, is there any Java class or interface which is designed to create a structure which enforces a LIFO rule?
accepted answer: http://stackoverflow.com/a/21321278
has comment: http://stackoverflow.com/comment/32149445
answer count: 1
favorite count: 0
upvote count: 2
duplicate of: http://stackoverflow.com/q/302460
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32138756
has answer: http://stackoverflow.com/a/21321278
tagged with: java
type: Question
has title: Any Java class that enforces LIFO?
downvote count: 0
linked to: http://stackoverflow.com/q/302460

http://stackoverflow.com/a/21336392
downvote count: 0
answers question: http://stackoverflow.com/q/21336368
type: Answer
has body: "sound" is the key corresponding to which you will have a value stored in your SharedPreferences. This is described in the docs as well. In simpler terms, you can consider it as a variable which will hold a value.
upvote count: 1
score: 1

http://stackoverflow.com/comment/31924639
has text: Probably worth looking at the RegEx answer in this question: http://stackoverflow.com/questions/8196771/format-a-string-using-regex-in-java
comment on: http://stackoverflow.com/q/21200363
score: 0
type: Comment
type: QuestionComment

tabs
type: Tag
tags question: http://stackoverflow.com/q/21238468
tags question: http://stackoverflow.com/q/21240413
tag name: tabs

http://stackoverflow.com/comment/32142899
comment on: http://stackoverflow.com/a/21323489
has text: Thanks! I actually removed the runOnUiThread and now the background task seems to work fine, however, I'm not sure how to update the EditText text fields in onPostExecute. I am getting the values but I basically just moved my EditText lines from my previous code to onPostExecute() but no luck. I'll keep trying.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21338318
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21338418
tagged with: java
tagged with: javadoc
tagged with: eclipse
type: Question
has title: Interesting Eclipse JavaDoc commenter error
has answer: http://stackoverflow.com/a/21338418
possible better answer: http://stackoverflow.com/a/21338517
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21338517
has body: So when I was working on a lab for my class, I used the ALT+SHIFT+J Eclipse shortcut to auto generate Javadoc comments for my functions. Here are some examples where I had no problem: // ---------------------------------------------------------- /** * Mutator method for setting processorSpeed. * * @param newProcessorSpeed Updated processor speed value */ public void setProcessorSpeed(double newProcessorSpeed) { processorSpeed = newProcessorSpeed; } // ---------------------------------------------------------- /** * Returns value of computer power * * @return numcores * processorSpeed */ public double computePower() { double temp = numcores * processorSpeed; return temp; } However, when I tried to do the same shortcut for this function: public String toString() { String temp = processor + ", " + String.valueOf(numcores) + " cores at " + String.valueOf(processorSpeed) + "GHz"; return temp; } All I get is: // ---------------------------------------------------------- public String toString() { String temp = processor + ", " + String.valueOf(numcores) + " cores at " + String.valueOf(processorSpeed) + "GHz"; return temp; } Just thought it was an interesting error. Curious as to what makes Eclipse treat the toString function differently.

http://stackoverflow.com/comment/32004165
type: AnswerComment
score: 0
type: Comment
has text: They are indeed in the same package - that's the weird part. The .class files have been generated in the folder, but then the errors pop up. And the errors are telling me it can't find that class, which is preposterous. I'm obviously doing something incorrect, but it's naught to do with the code itself, or where the files are kept. Unless you can't just have them in a folder and run them, but I've never heard of that being an issue
comment on: http://stackoverflow.com/a/21244901

http://stackoverflow.com/comment/113760385
has text: how we can call this class while communicating with the router, if you have GitHub reference code, could you please share?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21686299

http://stackoverflow.com/comment/31964067
has text: @A4L there's no mention whatsoever to package-private in the question.
score: 0
comment on: http://stackoverflow.com/q/21218987
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31999671
has text: okay, is there something wrong with your code?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21242423

http://stackoverflow.com/a/21267880
accepted answer of: http://stackoverflow.com/q/21267755
type: Answer
has comment: http://stackoverflow.com/comment/32044622
has body: If the threads are still execute()-ing they won't stop since you set their state to IDLE just afterwards, ignoring the previous value. And even adding a check before status = IDLE won't work in all cases. I suggest to use an AtomicInteger instead of a volatile int and use its compareAndSet method, i.e.: while (status.get() == RUNNING) { try { execute(); //&lt;-- very intensive if (!status.compareAndSet(RUNNING, IDLE)) break; } catch (Exception e) { logger.info("An exception occured in thread with ID : " + id); e.printStackTrace(); } finally { try { Thread.sleep(DYNAMIC_VALUE); } catch (InterruptedException e) {} if (!status.compareAndSet(IDLE, RUNNING)) break; } } You should also interrupt the thread after setting its status to STOPPED to interrupt the sleep if applicable.
upvote count: 5
has comment: http://stackoverflow.com/comment/32044478
score: 5
answers question: http://stackoverflow.com/q/21267755
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31929018
comment on: http://stackoverflow.com/a/21202944
score: 0
type: AnswerComment
type: Comment
has text: I am getting a new exceptins nw like below **Exception in thread "main" java.lang.Error: Unresolved compilation problem: The public type X must be defined in its own file at X.<init>(ThreadTest.java:1) at ThreadTest.main(ThreadTest.java:18)**

http://stackoverflow.com/q/21262554
answer count: 1
has title: Getting checkout button to navigate to checkout page
tagged with: android-layout
tagged with: java
tagged with: eclipse
tagged with: import
accepted answer: http://stackoverflow.com/a/21263293
type: AnsweredQuestion
type: Question
tagged with: android
has body: I am working in Eclipse and struggling with a certain step in my assignment so any help would be appriciated because I actually dont know how to do it even though I realise how glaringly simple it probably is... I have a shopping app and I have created my CheckoutActivity... now... it needs to start when the user clicks the checkout button in my CartActivity. I need to add code in the ocCreate method of my CartActivity (which I will provide below) that specifies the listener for the Checkout button. then I need to define a button variable named btn inside the onCreate. I then need to assign the button element from the view using the id that you specified in my activity_cart.xml layout. All I have so far is this... and I have no idea what to do... btn.setOnClickListener(new OnClickListener() { public void onClick(final View v) { //I cant figure out how to get it to start the CheckoutActivity } }); Just in case you need to see the code I have so far... here is the code I have for my cartActivty package uk.ac.uk.st265.shopper; import java.text.DecimalFormat; import java.util.List; import java.util.ResourceBundle.Control; import android.os.Bundle; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.support.v4.app.NavUtils; public class CartActivity extends Activity { CartListAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_cart); TextView text = (TextView) findViewById(R.id.total_price); // its not in // XML DecimalFormat df = new DecimalFormat("#.00"); text.setText("£" + df.format(((ShopperApp) getApplication())…
score: 0
has answer: http://stackoverflow.com/a/21263293

http://stackoverflow.com/q/21304711
type: Question
has body: I was able to read files less than 2GB from http location. However if I try to read files greater then 2 GB I get exception. I am not reading fully instead reading in chunks. Below is my code snippet and exception message. Help me incase if you have a clue to proceed further BufferedOutputStream bos = new BufferedOutputStream(os); URL url = new URL(fileName); LOGGER.debug(url.toString()); URLConnection connection = url.openConnection(); LOGGER.debug("Before getting input stream 100 MB, open input stream::" + downloadFileName); // BufferedInputStream in = new BufferedInputStream(url.openStream()); InputStream in = url.openStream(); // InputStreamReader inReader = new InputStreamReader(in); // InputStream in = connection.getInputStream(); LOGGER.debug("Afters getting input stream, open inputstream::" + downloadFileName); // in. // LOGGER.debug("in1::" + in1); final byte[] buffer = new byte[100 * 1024 * 1024]; // 100Mb while (true) { LOGGER.debug("Reading.."); final int read = in.read(buffer); LOGGER.debug("Read.."); if (read &lt; 0) { break; } LOGGER.debug("Writing.."); bos.write(buffer, 0, read); LOGGER.debug("Wrote.."); // bos. }
has comment: http://stackoverflow.com/comment/32108968
has comment: http://stackoverflow.com/comment/32111158
linked to: http://stackoverflow.com/q/141987
has comment: http://stackoverflow.com/comment/32108994
score: 0
linked to: http://stackoverflow.com/q/4826764
answer count: 3
has comment: http://stackoverflow.com/comment/32108987
has title: 2GB limitation Java Input Stream
has answer: http://stackoverflow.com/a/45698896
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21305039
has answer: http://stackoverflow.com/a/21304874
linked to: http://stackoverflow.com/q/13054800
has comment: http://stackoverflow.com/comment/32108959
tagged with: java
linked to: http://stackoverflow.com/q/8477669
tagged with: inputstream

nosuchmethoderror
type: Tag
tags question: http://stackoverflow.com/q/21340637
tags question: http://stackoverflow.com/q/21263216
tag name: nosuchmethoderror

http://stackoverflow.com/comment/32028940
comment on: http://stackoverflow.com/a/21258605
has text: Thanks:-) I finally invoke main method which is located in another .class file. Thanks a lot :D
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32014776
type: Comment
comment on: http://stackoverflow.com/a/21250948
score: 1
type: AnswerComment
has text: i have used that in one of my proj... so u just have to map your key according to your use.

http://stackoverflow.com/q/21218907
linked to: http://stackoverflow.com/q/3145089
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/33113504
has body: I'm having a lot of trouble with showing a dialog while getting a GPS fix :( Code: http://pastie.org/private/5a1yclz1qt7wywafpmdckw MyLocation code from here: https://stackoverflow.com/a/3145655/3210508 locationResult = new MyLocation.LocationResult() { @Override public void gotLocation(Location location) { lat = location.getLatitude(); lon = location.getLongitude(); acc = location.getAccuracy(); Log.i("TRIREC", "Got location: " + lat + ", " + lon + ", " + acc); } }; myLocation = new MyLocation(); myLocation.getLocation(Home.this, locationResult); Error when calling above code outside of runonuithread 20136-20364/nl.deadpixel.trianglerecycling E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1 Process: nl.deadpixel.trianglerecycling, PID: 20136 java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841) Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() at android.os.Handler.&lt;init&gt;(Handler.java:200) at android.os.Handler.&lt;init&gt;(Handler.java:114) at android.location.LocationManager$ListenerTransport$1.&lt;init&gt;(LocationManager.java:221) at android.location.LocationManager$ListenerTransport.&lt;init&gt;(LocationManager.java:221) at android.location.LocationManager.wrapListener(LocationManager.java:844) at android.location.LocationManager.requestLocationUpdates(LocationManager.java:857) at android.location.LocationManager.requestLocationUpdates(LocationManager.java:…
tagged with: android
has comment: http://stackoverflow.com/comment/31957381
linked to: http://stackoverflow.com/q/10523880
has title: Showing a dialog while requesting GPS location in FragmentActivity using a AsyncTask
tagged with: android-asynctask
tagged with: gps
has comment: http://stackoverflow.com/comment/31957492
answer count: 0
type: UnansweredQuestion
tagged with: android-dialog

http://stackoverflow.com/comment/31895365
score: 0
comment on: http://stackoverflow.com/q/21184441
type: Comment
type: QuestionComment
has text: When you say 'working' do you mean running in your IDE?

http://stackoverflow.com/q/21302999
accepted answer: http://stackoverflow.com/a/21362470
possible better answer: http://stackoverflow.com/a/21303231
has title: upload file using post method in android
has answer: http://stackoverflow.com/a/21303231
tagged with: android
type: AnsweredQuestion
tagged with: java
upvote count: 1
tagged with: post
type: Question
has answer: http://stackoverflow.com/a/21362470
tagged with: upload
has body: i want to upload a file to a php server. i could upload file with below method : curl -i -X POST -F file=@1.jpg http://something/sth and after that i can download using browser. but when uploading file using below java code i could not download using browser. URL url = new URL(mUrl); String lineEnd = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; String Tag = "fSnd"; Log.e(Tag, "Starting Http File Sending to URL"); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream( bytes); // Open a HTTP connection to the URL HttpURLConnection conn = (HttpURLConnection) url.openConnection(); // Allow Inputs conn.setDoInput(true); // Allow Outputs conn.setDoOutput(true); // Don't use a cached copy. conn.setUseCaches(false); // Use a post method. conn.setRequestMethod("POST"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary); DataOutputStream dos = new DataOutputStream(conn.getOutputStream()); dos.writeBytes(twoHyphens + boundary + lineEnd); dos.writeBytes("Content-Disposition: form-data; name=\"title\"" + lineEnd); dos.writeBytes(lineEnd); dos.writeBytes("File1"); dos.writeBytes(lineEnd); dos.writeBytes(twoHyphens + boundary + lineEnd); dos.writeBytes("Content-Disposition: form-data; name=\"description\"" + lineEnd); dos.writeBytes(lineEnd); dos.writeBytes("File2"); dos.writeBytes(lineEnd); dos.writeBytes(twoHyphens + boundary + lineEnd); dos.writeBytes("Content-Disposition: form-data; name=\"uploadedfile\";filename=\"" + "File3.jpg" + "\"" + lineEnd); dos.writeBytes(lineEnd); Log.e(Tag, "Headers are written"); byte data[] = new byte[1024 * 2]; int count = 0; while ((count = byteArrayInputStream.read(data)) != -1) { mSoFarLength += count; Log.d("FFF", "count : " + count + " mSoFarLength : " + mSoFarLength + " mTotalLength : " + mTotalLength); dos.write(data, 0, count); mProgress = ((mSoFarLength * 100) / mTotalLength); for (LocalTransmitterListener baseTransmitterL…
answer count: 3
has answer: http://stackoverflow.com/a/76395642
downvote count: 0
score: 1
tagged with: file-upload
favorite count: 0

http://stackoverflow.com/a/21235922
type: AcceptedAnswer
has body: yeah, although reading might be done with br.readLine() (not sure, I'd read it with br.read( char[ 4096 ], off, len ), but writing with pw.println is definitely wrong, as it adds a line-break at the end of each line - something you don't want to see in a binary file. I'd put it like char[] buff = new char[ 4096 ]; int offset = 0; while( -1 != br.read( buff, offset, 4096 ) ){ pw.write( buff ); offset += 4096; } You can also use Input/Output-Streams here, as you don't need to do a character-conversions.
has comment: http://stackoverflow.com/comment/32022749
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21235663
answers question: http://stackoverflow.com/q/21235663
has comment: http://stackoverflow.com/comment/32022857
has comment: http://stackoverflow.com/comment/32018684

http://stackoverflow.com/comment/32179690
has text: @quakkels: From a consumer standpoint, classes and interfaces in Java are almost interchangeable; the creators of Java likely thought that meant there was no need to make them be visibly different, while those of .NET likely thought that absent a naming convention they'd be too likely mistaken for each other in the cases where they weren't interchangeable.
score: 0
comment on: http://stackoverflow.com/q/21340963
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32118370
comment on: http://stackoverflow.com/q/21310194
score: 0
type: Comment
type: QuestionComment
has text: What is the value of `parsedDate`? I guess `3-01-09`.

http://stackoverflow.com/q/21189736
has comment: http://stackoverflow.com/comment/31908375
has answer: http://stackoverflow.com/a/21191299
score: 0
answer count: 2
has body: Can you help me to select an object in Selenium Webdriver which xpath value is dynamical. The xpath is dd.findElement(By.xpath("//*[@id='defaultSwatchContainer_wxnit']/div/div/ul/li[list]")) Here "wxnit" after "defaultSwatchContainer_" changes with every page load. Thanks
has comment: http://stackoverflow.com/comment/31907613
has comment: http://stackoverflow.com/comment/31905851
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21189843
tagged with: selenium-webdriver
tagged with: xpath
tagged with: dynamic
tagged with: java
has comment: http://stackoverflow.com/comment/31910429
type: Question
has title: How to select object with dynamic value in xpath in Selenium Webdriver
has comment: http://stackoverflow.com/comment/31917935

http://stackoverflow.com/a/21207824
has comment: http://stackoverflow.com/comment/31937510
answers question: http://stackoverflow.com/q/21207755
score: 5
has comment: http://stackoverflow.com/comment/31937475
downvote count: 0
has comment: http://stackoverflow.com/comment/31938772
has body: JavaCV interfaces to OpenCV, so when you call something OpenCV related there would be some overhead but in general most of the heavy work will still be on the C++ side and therefore there won't be a very large performance penalty. You would have to do performance benchmarks to find out more. PS. I'm pretty new here but I'm rather sure that this is not a suitable question for StackOverflow.
type: Answer
has comment: http://stackoverflow.com/comment/31937923
upvote count: 5
has comment: http://stackoverflow.com/comment/31937958
has comment: http://stackoverflow.com/comment/31937553

http://stackoverflow.com/comment/32169852
type: AnswerComment
has text: You shouldn't edit the question, since all answers are based on the original one.
type: Comment
comment on: http://stackoverflow.com/a/21338599
score: 2

checkbox
tag name: checkbox
tags question: http://stackoverflow.com/q/21241306
tags question: http://stackoverflow.com/q/21291109
tags question: http://stackoverflow.com/q/21285072
type: Tag
tags question: http://stackoverflow.com/q/21334130

http://stackoverflow.com/comment/32088552
score: 3
has text: Except for the hanging slash `/`left to the `1`, everything seems correct to me :)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21293190

http://stackoverflow.com/q/21189391
has answer: http://stackoverflow.com/a/21192083
tagged with: jsp
linked to: http://stackoverflow.com/q/1256562
possible better answer: http://stackoverflow.com/a/21189588
accepted answer: http://stackoverflow.com/a/21192083
has answer: http://stackoverflow.com/a/21189588
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31904452
has answer: http://stackoverflow.com/a/21190364
has comment: http://stackoverflow.com/comment/31904761
favorite count: 0
has body: I have x.jsp that can either be served as the whole response, or being included in several other jsp files. So how can I know inside x.jsp if it is being included by another file or not?
has comment: http://stackoverflow.com/comment/31904418
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
has title: How to know if a JSP file is beeing included by another one?

http://stackoverflow.com/q/21278484
answer count: 0
has body: I need to show the Facebook album list in my first screen and need to show corresponding album image in the next screen. I used the following code for user authentication and data parsing. In this code the user information and friends lists are showing fined("/me" and "me/friends"), when i tried to get user album and photos it shows the following message, {Response: responseCode: 200, graphObject: GraphObject{graphObjectClass=GraphObject, state={"data":[]}}, error: null, isFromCache:false} may i know, what and where is the problem will occured, i'm using the correct way to get Albums and Photos? Please share your suggestions. AlbumGetMainActivity.Java public class AlbumGetMainActivity extends Activity { Button loginBtn; ListView albumList; private Session.StatusCallback statusCallback = new SessionStatusCallback(); Session session; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_album_get_main); albumList = (ListView) findViewById(R.id.album_list); loginBtn = (Button) findViewById(R.id.loginBtn); Settings.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS); // StrictMode.ThreadPolicy policy = new // StrictMode.ThreadPolicy.Builder() // .permitAll().build(); // StrictMode.setThreadPolicy(policy); session = Session.getActiveSession(); if (session == null) { if (savedInstanceState != null) { session = Session.restoreSession(AlbumGetMainActivity.this, null, statusCallback, savedInstanceState); } if (session == null) { session = new Session(AlbumGetMainActivity.this); } Session.setActiveSession(session); if (session.getState().equals(SessionState.CREATED_TOKEN_LOADED)) { Session.OpenRequest openRequest = null; openRequest = new Session.OpenRequest(AlbumGetMainActivity.this); if (openRequest != null) { openRequest .setDefaultAudience(SessionDefaultAudience.FRIENDS); openRequest.setPermissions(Arrays.asList("user_photos")); openRequest .setLoginBehavior(SessionLoginBehavior.SSO_WITH_F…
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
type: Question
downvote count: 0
tagged with: facebook-graph-api
favorite count: 0
has title: How to get Facebook album and Photos in android application?
tagged with: android
tagged with: facebook

http://stackoverflow.com/comment/31993302
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/21238968
has text: No, you're shadowing your field.

http://stackoverflow.com/comment/32059945
type: QuestionComment
comment on: http://stackoverflow.com/q/21276775
has text: I don't know why the question is downvoted??? I want to check the path on SERVER not on the local machine... File.exists() doesn't work on the server...
type: Comment
score: 0

http://stackoverflow.com/a/21221072
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/21220962
has body: You can use Futuretask (or just Future). for this. It has a get() method that allows you to specify a timeout.
type: Answer

http://stackoverflow.com/q/21233956
tagged with: substring
answer count: 10
has answer: http://stackoverflow.com/a/21234158
has answer: http://stackoverflow.com/a/21234020
has answer: http://stackoverflow.com/a/21234138
has answer: http://stackoverflow.com/a/21234124
has comment: http://stackoverflow.com/comment/31985492
has answer: http://stackoverflow.com/a/21234095
has answer: http://stackoverflow.com/a/21234105
tagged with: arraylist
has answer: http://stackoverflow.com/a/21234213
type: AnsweredQuestion
score: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/21234105
accepted answer: http://stackoverflow.com/a/21234158
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/21234016
has body: lets say i have list of names. ArrayList&lt;String&gt; nameslist = new ArrayList&lt;String&gt;(); nameslist.add("jon"); nameslist.add("david"); nameslist.add("davis"); nameslist.add("jonson"); and this list contains few thousands nameslist in it. What is the fastes way to know that this list contains names start with given name. String name = "jon" result should be 2. I have tried with comparing every element of list with substring function (it works but) it is very slow specially when list is huge. Thanks is advance.
has answer: http://stackoverflow.com/a/21234143
tagged with: performance
has answer: http://stackoverflow.com/a/21234011
has title: Fastest way to find substring in JAVA
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/32031134
score: 1
has text: Are you sure they are on the same timezone? What do you get if you print `new Date(d.getTime());`?
comment on: http://stackoverflow.com/q/21260793
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21287770
has body: Try this: Sample code public static void main(String[] args) { String test ="((6.28 + 3.14) + 7.56)"; String re = "\\(|\\)|\\d+\\.?\\d*|[+-/%^!*]"; List&lt;String&gt; components = new ArrayList&lt;String&gt;(); Pattern p = Pattern.compile(re); Matcher m = p.matcher(test); while(m.find()) { components.add(m.group()); } System.out.println(components); } Output [(, (, 6.28, +, 3.14, ), +, 7.56, )]
answers question: http://stackoverflow.com/q/21245730
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/32083916
score: 1
accepted answer of: http://stackoverflow.com/q/21245730

http://stackoverflow.com/a/21189506
type: Answer
has comment: http://stackoverflow.com/comment/31904780
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31904737
answers question: http://stackoverflow.com/q/21188263
upvote count: 3
has comment: http://stackoverflow.com/comment/31904663
has body: I simplified your code. The following works. You had many extra statements that complicated things such as adding web two times (once to Scroll and once to JFrame). Another example is scrollPane.getVerticalScrollBar().setValue(0); . The scrollbar by default starts at zero. import java.awt.Dimension; import java.io.IOException; import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JScrollPane; public class webPane extends JFrame { public static void main(String args[]) { webPane e = new webPane(); e.setVisible(true); } public webPane() { JEditorPane web = new JEditorPane(); web.setEditable(false); try { web.setPage("http://www.cnn.com"); } catch (IOException e) { web.setContentType("text/html"); web.setText(" Could not load "); } final JScrollPane scrollPane = new JScrollPane(web); getContentPane().add(scrollPane); this.setBounds( 0, 0, 200, 200); } }

http://stackoverflow.com/comment/68050790
comment on: http://stackoverflow.com/q/21338102
score: 0
has text: File an issue with Titan becuase the API must be in `provided` code. Everything you do is a mere workaround.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21234122
has answer: http://stackoverflow.com/a/21234151
has answer: http://stackoverflow.com/a/21234398
tagged with: java
downvote count: 1
tagged with: unit-testing
type: Question
score: -1
upvote count: 0
has title: writing a test for the method
favorite count: 0
has body: Need to write a test for the following method public static boolean isValidSsn(String aSsn) { //ssn = social security number if (aSsn.matches("\\d{3}-\\d{2}-\\d{4}")) { // Match found return true; } // Not a valid number return false; } I tried it, i know it is terribly wrong, but don`t know how to correct it. public void testIsValidSsn() { String actual = "\\d{3}-\\d{2}-\\d{4}"; String exp = "123-45-6789"; assertEquals(actual, exp); }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21234216
answer count: 4
has answer: http://stackoverflow.com/a/21234228

http://stackoverflow.com/comment/32156241
type: Comment
type: QuestionComment
has text: I have the libraries in classpath and I'm using JSF 2.0, so faces-config.xml is not required.
score: 0
comment on: http://stackoverflow.com/q/21307781

http://stackoverflow.com/a/21253579
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21249205
has comment: http://stackoverflow.com/comment/32034731
type: Answer
accepted answer of: http://stackoverflow.com/q/21249205
upvote count: 3
has body: "What I want to do is have the fileset that the target BASETARGET uses be different depending on which target is invoked." Here's a small example for that: you simply create the filesets with a given ID and refer them in your base target. <include name="a.txt" /> <include name="b.txt" />
has comment: http://stackoverflow.com/comment/32035893
score: 3

store
tags question: http://stackoverflow.com/q/21190954
tag name: store
type: Tag

http://stackoverflow.com/q/21348177
tagged with: sql
favorite count: 0
upvote count: 43
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/40819095
downvote count: 0
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
accepted answer: http://stackoverflow.com/a/21349959
has title: NonUniqueDiscoveredSqlAliasException: Encountered a duplicated sql alias [ASC_ID] during auto-discovery of a native-sql query
tagged with: jpa
has answer: http://stackoverflow.com/a/75150037
score: 43
has answer: http://stackoverflow.com/a/21349959
possible better answer: http://stackoverflow.com/a/40819095
has body: I have three tables CREDENTIAL_USER, CREDENTIAL_EXPIRATION and ASC_DETAILS - whose looks like : CREDENTIAL_USER { ASC_ID, name, ITEM}, CREDENTIAL_USER { MONTH, YEAR, ASC_ID} and ASC_DETAILS {ASCID, NAME, ROLE}. I executed a simple native SQL join to select only CREDENTIAL_USER.ASC_ID and ASC_DETAAILS.ASCID as : Query query = entityManager.createNativeQuery("SELECT ad.ASCID,ad.NAME,ad.CRED_EMPLOYEE_FNAME,ad.CRED_EMPLOYEE_LNAME,ad.CRED_EMPLOYEE_EMAIL,ad.CRED_EMPLOYEE_REMINDER,"+ " cu.*, ce.*, cl.* FROM ASC_DETAILS ad,CREDENTIAL_USER cu, CREDENTIAL_EXPIRATION ce, CREDENTIAL_LICENSE cl WHERE"+ " cu.IS_CRD_EMPLOYEE = true AND cl.IS_EMPLOYEE = true AND ce.LICENSE_ID = cl.LICENSE_ID AND cu.ASC_ID=ad.ASCID"+ " AND ce.LICENSE_EXP_YR &gt;= "+year+" AND (ce.IS_LICENSE_YES=1 OR ce.IS_LICENSE_YES=3) AND cu.ASC_ID=ce.ASC_ID AND"+ " cu.ID=ce.EMPLOYEE_ID"); List&lt;Object[]&gt; list = query.getResultList(); Its running fine on local, But getting org.hibernate.loader.custom.NonUniqueDiscoveredSqlAliasException: Encountered a duplicated sql alias [ASC_ID] during auto-discovery of a native-sql query exception on JBoss server Stack-trace : 23:30:00,300 ERROR [stderr] (pool-10-thread-1) javax.persistence.PersistenceException: org.hibernate.loader.custom.NonUniqueDiscoveredSqlAliasException: Encountered a duplicated sql alias [ASC_ID] during auto-discovery of a native-sql query 23:30:00,301 ERROR [stderr] (pool-10-thread-1) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1361) 23:30:00,302 ERROR [stderr] (pool-10-thread-1) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289) 23:30:00,303 ERROR [stderr] (pool-10-thread-1) at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:261) 23:30:00,303 ERROR [stderr] (pool-10-thread-1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 23:30:00,304 ERROR [stderr] (pool-10-thread-1) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja…
answer count: 3

http://stackoverflow.com/comment/32058293
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21275821
has text: Stop talking about middleware, it's like you just learned the word. A WAR file is deployed on a full blown application server or a servlet engine, that's where it runs. It can't run without one. End of story.

http://stackoverflow.com/a/21261640
accepted answer of: http://stackoverflow.com/q/21261188
score: 0
type: AcceptedAnswer
has body: One way to solve is as below... Split the whole class into two arraylists. L1 &amp; L2 create a variable offset = 0 First week assign L1[0] &amp; L2[0+offset] as one couple, L1[1] &amp; L2[1+offset] as another couple and so on. Second week set offset = 1 assign L1[0] &amp; L2[0+offset] as one couple but this time, you will actually be assigning L1[0] and L2[1] as a couple because of increased offset value. 6.To ensure that you don't go beyond length of L2, use (0+offset)%L2.length() This will ensure you have different couple everyweek.
type: Answer
answers question: http://stackoverflow.com/q/21261188

http://stackoverflow.com/comment/31959858
type: Comment
has text: when I put the try-catch in onPostExecute() it wants it back in doInBackground(); and says unreachable catch and underlines JSONException e. Could I just make it so the error changes a global variable and then in onPostExecute it does the toast commands?
comment on: http://stackoverflow.com/a/21220048
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31925080
score: 0
type: Comment
has text: Worked great! Thanks a lot for your help. Just curious, since I am creating the texture in my Main project, why does adding the png to a folder in my Desktop project work?
comment on: http://stackoverflow.com/a/21200546
type: AnswerComment

http://stackoverflow.com/comment/94164068
comment on: http://stackoverflow.com/a/21221016
has text: Maybe some sort of `OutOfMemoryError`?
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/31953900
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21216797
type: Comment
has text: That's what I would expect: the presence or absence of an index should have no effect on the result set, only on the speed of the query. Are you sure you don't have a typo somewhere?

http://stackoverflow.com/comment/31965756
comment on: http://stackoverflow.com/q/21223160
type: Comment
type: QuestionComment
has text: You said was does not happen in Firefox. What actually does happen? You sure it is not set to automatically start downloading?
score: 1

http://stackoverflow.com/a/28412988
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/46920053
has body: The problem you are facing is that JAX-RS does not use the default SSLContext and HostnameVerifier. This is actually a good thing as you can programmatically set these for the client connection rather than having it use the global. In order to do this, you need to create a ClientBuilder and set the hostname verifier and sslcontext to something you control. public Client buildUnsecureRestClient() throws GeneralSecurityException { SSLContext context = SSLContext.getInstance("TLSv1"); TrustManager[] trustManagerArray = { ... }; context.init(myKeyManagers, trustManagerArray, new SecureRandom()); return ClientBuilder.newBuilder() .hostnameVerifier(myhostnameverifier) .sslContext(context) .build(); } By setting the SSLContext to contain your own key manager which you can build programmatically. I have a sample where I used the techique to bypass the SSL certificate checks for JAX-RS, but you can implement the X509KeyManager to provide your keys. The X509TrustManager is a bit tricker to deal with, and I would recommend you use the one that comes with your target JDK even if it will lock you to Oracle's which is sun.security.ssl.X509TrustManagerImpl, but since this is WebStart chances are the JRE you are using is from Oracle rather than IBM JREs.
answers question: http://stackoverflow.com/q/21258705

http://stackoverflow.com/a/21230940
type: Answer
score: 3
has body: The ASCII value of | is &amp;#124; See this link.
accepted answer of: http://stackoverflow.com/q/21230853
upvote count: 3
answers question: http://stackoverflow.com/q/21230853
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21191131
has comment: http://stackoverflow.com/comment/31907653
has comment: http://stackoverflow.com/comment/31908018
type: Answer
has body: The exception you are getting is weird, you'll have to post the full stack trace, but you are not allowed to use scriptlets as you are attempting to in an Expression Language expression. In other words, this ${&lt;%=StringEscapeUtils.escapeXml(variable.content)%&gt;} is syntactically incorrect. Get rid of the ${}.
downvote count: 0
has comment: http://stackoverflow.com/comment/31907631
has comment: http://stackoverflow.com/comment/31907898
has comment: http://stackoverflow.com/comment/31907593
score: 1
accepted answer of: http://stackoverflow.com/q/21190818
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21190818

http://stackoverflow.com/q/21218987
has comment: http://stackoverflow.com/comment/31957517
type: AnsweredQuestion
score: 3
has title: Accessing non public class from other package
tagged with: java
accepted answer: http://stackoverflow.com/a/21219091
has comment: http://stackoverflow.com/comment/31957577
type: Question
has comment: http://stackoverflow.com/comment/31957525
has comment: http://stackoverflow.com/comment/31964067
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21219091
has body: I have a class Logistic in package sequence package sequence; class LogisticSeq { int limit; double lamda; ArrayList &lt;Double&gt; lseq = new ArrayList &lt;Double&gt;(); LogisticSeq(int a, double b, double c) { limit = a; lseq.add(b); lamda = c; } void sequence() throws IOException{ File file = new File("Sequence.txt"); if (!file.exists()) { file.createNewFile(); }} public class Logistic { public static void main (String[] args) throws IOException { LogisticSeq L = new LogisticSeq(50,0.4999,3.9999); L.logisticsequence(); } How to access the class LogisticSeq from class in other package
has comment: http://stackoverflow.com/comment/31957621
upvote count: 3

http://stackoverflow.com/q/21332109
has body: I'm trying to create a project using Project-generator.jar from Linux terminal. I'm using command java -jar project-generator.jar at last step this is showing error [ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format &lt;plugin-prefix&gt;:&lt;goal&gt; or &lt;plugin-group-id&gt;:&lt;plugin-artifact-id&gt;[:&lt;plugin-version&gt;]:&lt;goal&gt;. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, шnstall, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -&gt; [Help 1] org.apache.maven.lifecycle.NoGoalSpecifiedException: No goals have been specified to create a project using Project-generaotot.jar from Linux terminal.
tagged with: command-line
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32158759
upvote count: 1
type: Question
has title: No goals have been specified for this build
has comment: http://stackoverflow.com/comment/32158172
downvote count: 0
tagged with: maven-3
favorite count: 0
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32161258

http://stackoverflow.com/q/21260522
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
tagged with: jaxb
type: Question
has body: I can not seem to find any documentaion on how to use the GeneratedValue annotation when it comes to initialising my object. here is my id field for my object class, I have two other fields which I have left out @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @NotNull @Column(name = "ID") private BigDecimal id; my constructors public Pothole() { } public Pothole(BigDecimal id) { this.id = id; } public Pothole(BigDecimal id, byte[] image, Date pdate) { this.id = id; this.image = image; this.pdate = pdate; } What do I use for my id field?? Do I leave it empty Pothole entity = new Pothole(???,decodedBytes, date);
downvote count: 0
answer count: 2
tagged with: jax-rs
has answer: http://stackoverflow.com/a/21262078
has title: @GeneratedValue Annotation, Constructor value
favorite count: 0
type: UnansweredQuestion
tagged with: annotations
has answer: http://stackoverflow.com/a/21262432

http://stackoverflow.com/comment/31933346
type: QuestionComment
has text: There is so much wrong with your design. Please read [this](http://docs.oracle.com/javase/tutorial/java/javaOO/).
score: 0
comment on: http://stackoverflow.com/q/21205416
type: Comment

http://stackoverflow.com/q/21213162
has comment: http://stackoverflow.com/comment/31947513
has body: Is there a good method to convert between bases in Java in a fashion compatible with PHP's base_convert function? I've been playing around with boolean arrays, but it seems like a really complicated solution to this problem.
downvote count: 0
score: 1
tagged with: php
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22730387
has comment: http://stackoverflow.com/comment/31947319
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/21267879
favorite count: 0
accepted answer: http://stackoverflow.com/a/21267879
possible better answer: http://stackoverflow.com/a/22730387
has answer: http://stackoverflow.com/a/49556693
has title: PHP base_convert in Java

http://stackoverflow.com/a/21203726
has comment: http://stackoverflow.com/comment/62708680
type: Answer
has comment: http://stackoverflow.com/comment/31987992
has comment: http://stackoverflow.com/comment/50870598
has comment: http://stackoverflow.com/comment/50873642
answers question: http://stackoverflow.com/q/21185156
has body: You should have a look at this related bug for help on how to troubleshoot your issue. In summary, the recommendations are: run the application with the -Dprism.verbose=true flag check the detailed log that is produced it may point to a missing graphics library: GTK 2.18 is required to run JavaFX on linux
has comment: http://stackoverflow.com/comment/62709880
has comment: http://stackoverflow.com/comment/102934159
downvote count: 0
score: 30
upvote count: 30

http://stackoverflow.com/q/21253545
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/45004932
favorite count: 0
tagged with: jbpm
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21412666
tagged with: mysql
upvote count: 1
score: 1
has body: I have downloaded JBPM 6 installer and unzipped it. I want to use MySQL instead of H2 database. I have edited jbpm-persistence-JPA2.xml for MySQL and also added Mysql-Connector.jar. But during the demo setup it still uses h2 databse. please help me on this.
tagged with: java
has title: How to install JBPM 6 with MySQL Server
has comment: http://stackoverflow.com/comment/32018523
type: Question

http://stackoverflow.com/comment/32121482
comment on: http://stackoverflow.com/q/21311210
score: 0
has text: can you explain it a little more?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21231449
type: Answer
score: 1
upvote count: 1
has body: Zero-length arrays are rarely "required," but are more often used simply to show that there is no data being passed to a method. in java the memory allocation can be dynamic in nature. The java array enables the user to store values of the same type in contiguous memory allocations. Arrays are always a fixed length abstracted data structure which can not be altered when required. It just occupies the memory.
answers question: http://stackoverflow.com/q/21231237
downvote count: 0

http://stackoverflow.com/q/21209426
has answer: http://stackoverflow.com/a/21209477
tagged with: arraylist
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31940390
has answer: http://stackoverflow.com/a/21210380
has body: I was preparing my test for Monday, but there are no answers. I have done well so far but i'm stuck now. I am clueless what to do. Searched for ages on the internet but im missing a lil thing I guess.. Maybe you guys could help me out? Question: I need to place the activities in a dayplanning ArrayList&lt;...> and print them out I have no clue how to do this. I've tried ArrayList Integers String I have no clue how the ** I do this :P Goal run simulateOneDay() in GarageSimulation. Tester.java public class Tester { public void equalsTest() { Car c1=new Car("Toyota", "Prius", 'p', 1800); Car c2=new Car("Citroen", "C5 Tourer", 'd', 2300); Car c3=new Car("Toyota", "Prius", 'd', 2050); System.out.println(c1.equals(c1)); System.out.println(c1.equals(c2)); System.out.println(c1.equals(c3)); Bicycle b1=new Bicycle("MesserSchmidt", "Targa", false); Car c4=new Car("MesserSchmidt", "Targa", 'p', 950); System.out.println(c4.equals(b1)); /* Expected outcome true false true false */ } public void simulateOneDayTest() { Car c1=new Car("Toyota", "Prius", 'p', 1800); Car c2=new Car("Citroen", "C5 Tourer", 'd', 2300); Car c3=new Car("Toyota", "Prius", 'd', 2050); Bicycle b1=new Bicycle("MesserSchmidt", "Targa", false); Car c4=new Car("MesserSchmidt", "Targa", 'p', 950); Car c5=new Car("Hummer", "XL", 'd', 5600); Car c6=new Car("BMW", "R3", 'd', 6350); Car c7=new Car("Citroen", "C5 Tourer", 'd', 2300); GarageSimulation gs=new GarageSimulation(); gs.addVehicle(c1); gs.addVehicle(c2); gs.addVehicle(c3); gs.addVehicle(b1); gs.addVehicle(c4); gs.addVehicle(c5); gs.addVehicle(c6); gs.addVehicle(c7); gs.simulateOneDay(); /* Expected outcome Eating/drinking takes 15 minutes Current time is 8:15 Visiting the toilet takes 10 minutes Current time is 8:25 Repairing takes 36 minutes Current time is 9:01 Eating/drinking takes 15 minutes Current time is 9:16 Visiting the toilet takes 10 minutes Current time is 9:26 Repairing takes 46 minutes Current time is 10:12 Eating/drinking takes 15 minutes Cur…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31941679
tagged with: compiler-errors
has title: Java issue; can't add activities to an ArrayList<???> Help needed
tagged with: methods
type: Question
tagged with: java
tagged with: compilation

http://stackoverflow.com/a/21377281
score: 0
answers question: http://stackoverflow.com/q/21261817
type: Answer
has body: A uploaded file can either be written to disk on server side or directly processed in the receiving server process. https://vaadin.com/de/book/-/page/components.upload.html

http://stackoverflow.com/comment/32140468
has text: @selbie No I don't have access to the server code, but I have access to the developer. This is a legacy system whose protocol cannot be changed.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21274162
score: 0

http://stackoverflow.com/comment/31982358
type: Comment
has text: Thanks thats good to know...allthough that seems a gwt specific solution. I am not sure how, say, an Android/Processing/Other version would pick/supply the file access stuff they need. I put a gwt tag on this as it was the limiting factor, but ideally i am looking for a generic Javamethod to do it.
comment on: http://stackoverflow.com/a/21221580
type: AnswerComment
score: 0

http://stackoverflow.com/q/21303448
answer count: 6
has answer: http://stackoverflow.com/a/33037584
has answer: http://stackoverflow.com/a/21546203
has answer: http://stackoverflow.com/a/21618537
upvote count: 10
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21486018
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32107554
has title: Is there a way to do source-to-source java refactoring in gradle?
has comment: http://stackoverflow.com/comment/32111558
tagged with: refactoring
tagged with: java
has body: I got some automatically generated Java code. I am willing to refactor automatically before compiling. It is mostly class rename and package modification. Are there any gradle or ant tasks available for this?
tagged with: gradle
type: Question
score: 9
has answer: http://stackoverflow.com/a/21496551
linked to: http://stackoverflow.com/q/704062
has comment: http://stackoverflow.com/comment/32106964
tagged with: ant
has answer: http://stackoverflow.com/a/21516873
has comment: http://stackoverflow.com/comment/32111091

http://stackoverflow.com/comment/32136044
type: QuestionComment
has text: @jakeWilson801.. right its MyDays :) hope it worked for ur ex. and no, its nothing loaded from a server side
score: 0
comment on: http://stackoverflow.com/q/21319177
type: Comment

http://stackoverflow.com/q/21268058
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32060260
has comment: http://stackoverflow.com/comment/32062707
has answer: http://stackoverflow.com/a/21404018
score: 2
downvote count: 0
has body: I am trying to get distance the user has passed from the last time that the codes cleared "Distance traveled since codes cleared" http://en.wikipedia.org/wiki/OBD-II_PIDs But I am not getting any data. I am using this open source library. https://github.com/pires/android-obd-reader and I am constructing the Command with this parameter public ObdKMCommand() { super("01 31"); } what am I missing ?
has comment: http://stackoverflow.com/comment/32083158
favorite count: 0
type: Question
tagged with: android
has title: OBD II Command to get distance
has comment: http://stackoverflow.com/comment/32044924
has comment: http://stackoverflow.com/comment/32044432
tagged with: obd-ii
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/34625696
has comment: http://stackoverflow.com/comment/32059680
has comment: http://stackoverflow.com/comment/32120160
tagged with: java

http://stackoverflow.com/comment/32096051
has text: hi please check my update ..i solve the error but didn't display text..:(
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21296998

http://stackoverflow.com/q/21317135
has body: I'm developing a Java application that does basically: Starts a server in a new thread. This server opens a socket connection and waits for messages. Creates a Shell with a Canvas (in the main thread) and whenever server receives a message, I need to draw a line using the points contained in it. I've already read some threads about this issue (on updating SWT from another thread) and I've tried to create a method called by my server whenever it receives a message: public static void doPaint(final Canvas canvas, final Draw draw){ if (canvas != null &amp;&amp; draw != null){ Display.getDefault().syncExec(new Runnable() { @Override public void run() { canvas.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { System.out.println("Printing line...."); e.gc.setBackground(e.display.getSystemColor(SWT.COLOR_WHITE)); e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_BLACK)); e.gc.setLineWidth(3); e.gc.drawLine((int)draw.getStartX(),(int)draw.getEndX(),(int)draw.getStartY(),(int)draw.getEndY()); } }); } }); } } EDIT This is the loop that waits for socket messages and triggers the actions: while(isConnected()){ try{ System.out.println("Waiting for connection..."); Socket server = getServerSocket().accept(); BufferedReader in = new BufferedReader(new InputStreamReader(server.getInputStream(), Const.ENC_UTF8)); String inputLine; while(((inputLine = in.readLine()) != null)){ processInput(inputLine, canvas); } }catch(IOException ioex){ System.out.println(ioex.getMessage()); ioex.printStackTrace(); }catch (Exception ex) { System.out.println(ex.getMessage()); ex.printStackTrace(); } } and my processInput method is: protected void processInput(String inputLine, Canvas canvas){ //get draw from input stream Draw draw = DrawUtil.getDrawFromInput(inputLine); //draw points on live-mode BBCanvas.doPaint(canvas, draw); //append draw node to XML file DrawUtil.writeDrawToFile(draw); } ... but the runnable in the doPaint method is never executed. Any h…
has comment: http://stackoverflow.com/comment/32131559
has comment: http://stackoverflow.com/comment/32155835
tagged with: java
has comment: http://stackoverflow.com/comment/32256585
has comment: http://stackoverflow.com/comment/32174706
type: Question
tagged with: canvas
has comment: http://stackoverflow.com/comment/32155883
score: 0
has comment: http://stackoverflow.com/comment/32131873
has title: Java SWT updating canvas from another thread
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
tagged with: swt

http://stackoverflow.com/a/21296121
type: Answer
answers question: http://stackoverflow.com/q/21295505
upvote count: 3
score: 3
has body: Use PipedInput/OutputStream, e.g. final PrintStream consoleOutput = System.out; final PipedOutputStream testInput = new PipedOutputStream(); final PipedOutputStream out = new PipedOutputStream(); final PipedInputStream testOutput = new PipedInputStream(out); System.setIn(new PipedInputStream(testInput)); System.setOut(new PrintStream(out)); new Thread(new Runnable() { @Override public void run() { try { PrintStream testPrint = new PrintStream(testInput); BufferedReader testReader = new BufferedReader( new InputStreamReader(testOutput)); while (true) { testPrint.println((int) (Math.random() * 100)); consoleOutput.println(testReader.readLine()); } } catch (IOException e) { e.printStackTrace(consoleOutput); } } }).start(); guessingGame();
has comment: http://stackoverflow.com/comment/32122805
accepted answer of: http://stackoverflow.com/q/21295505
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26717321
answers question: http://stackoverflow.com/q/21207638
type: AcceptedAnswer
downvote count: 0
has body: Spring framework lib version doesn't match with your spring security lib version. you can choose the matching version from MAVEN REPOSITARY SPRING SECURITY good luck
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21207638

serial-number
tag name: serial-number
tags question: http://stackoverflow.com/q/21218958
type: Tag

http://stackoverflow.com/comment/32093711
has text: @Crash re: "Just to clarify, there is no way to connect 32bit Access and Java and then run it on a 64bit JVM." - That is correct. If the application is running under a 64-bit JVM then it cannot use a 32-bit ODBC driver.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21291670

http://stackoverflow.com/comment/31923465
type: Comment
type: QuestionComment
score: 2
has text: You may not know that it is actually spelled `Main`. Maim means something *very* different.
comment on: http://stackoverflow.com/q/21199644

http://stackoverflow.com/comment/44568762
comment on: http://stackoverflow.com/a/21344799
has text: As reference for future searchers: spring mvn would produce a `415` in the same manner if `Content-Type` is set to `application/x-www-form-urlencoded`. Setting to `application/json`, as the poster does, is the adequate way.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21334744
has comment: http://stackoverflow.com/comment/32161991
favorite count: 0
has comment: http://stackoverflow.com/comment/32162187
type: UnansweredQuestion
has title: String input to get a object
score: -3
has answer: http://stackoverflow.com/a/21334798
has answer: http://stackoverflow.com/a/21334925
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/32161782
has comment: http://stackoverflow.com/comment/32161757
type: Question
has comment: http://stackoverflow.com/comment/32161772
has answer: http://stackoverflow.com/a/21334836
answer count: 3
has body: i need to retrive info form a private object but im stuck at this.. its keep say there is a constructor error public class Screen{ private movie movieObject; private Screen(movie movieObject){ this.movieObject = movieObject; } private ArrayList&lt;movie&gt; movie = new ArrayList&lt;movie&gt; public void add(){ String title = keyboard.readString("Enter movie title &gt; "); String name = keyboard.readString("Enter theatre name &gt; "); movie add = new movie(title,name) // there is error in this part
upvote count: 0

http://stackoverflow.com/q/21267929
has answer: http://stackoverflow.com/a/21268006
has comment: http://stackoverflow.com/comment/32044549
has comment: http://stackoverflow.com/comment/32044379
answer count: 2
has comment: http://stackoverflow.com/comment/32044900
has title: regex optional group capturing JAVA
has body: I have a pattern where a user specifies: 1998-2010:Make:model:trim:engine trim and engine are optional, if present I should capture them; if not, the matcher should at least validate YMM. ([0-9]+-*[0-9]+):(.*):(.*):(.*):(.*) This matches if all three are there, but how do I make the last two and only two fields optional?
has comment: http://stackoverflow.com/comment/32044277
downvote count: 0
possible better answer: http://stackoverflow.com/a/21268129
favorite count: 0
has answer: http://stackoverflow.com/a/21268129
accepted answer: http://stackoverflow.com/a/21268006
tagged with: regex
has comment: http://stackoverflow.com/comment/32044626
type: AnsweredQuestion
upvote count: 19
has comment: http://stackoverflow.com/comment/32044481
tagged with: java
has comment: http://stackoverflow.com/comment/32044690
score: 19
type: Question

http://stackoverflow.com/q/21232632
has body: I'm going to preface this with "this is more of an answer". As in, I'm answering this myself. I searched by tags, I searched with Google, I searched using a combination of tags and plaintext (on this site) and I still couldn't find the damn question that this originated from. Some guy pastes the source, or links the source, as an answer. This is (one of the) original source(s), it's all over the web. http://bit.ly/1eYKNXS (code.google.com domain, I can edit with full URL if necessary) It's not perfect. The offset of 0 doesn't always seem to work (tested on my home machine and here, using a multi-monitor setup and without), while an offset of 5 does. It doesn't have multi-monitor support. The snap behaviour is a bit excitable (it keeps on firing). Answer is the answer to this question. Feel free to lock, archive, etc. Just trying to help :)
has title: Snapping JFrame to screen edge
has answer: http://stackoverflow.com/a/21232633
accepted answer: http://stackoverflow.com/a/21232633
favorite count: 0
tagged with: jframe
tagged with: swing
type: AnsweredQuestion
upvote count: 5
tagged with: java
type: Question
score: 5
tagged with: window
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/32066451
type: Comment
comment on: http://stackoverflow.com/a/21264464
type: AnswerComment
score: 0
has text: can't access to "xx3_oracle_tu_2" through spring xml bean conf. I'am using JndiObjectFactoryBean. Maybe i miss something in my jndi path or in my spring config.

http://stackoverflow.com/comment/31967261
type: QuestionComment
comment on: http://stackoverflow.com/q/21224247
score: 5
has text: If you are going to post code, please take the time and effort to format it well.
type: Comment

http://stackoverflow.com/q/21334209
favorite count: 0
has answer: http://stackoverflow.com/a/72996665
has body: I am developing a GUI windows app in java. I need to create an installer now. I got .jar file and now I am creating .exe file using Launch4j free s/w(I hope it is free s/w, Please let me know if it is paid one). Project has many dependencies of external .jar files and .dll files. I have included all jar files and dll files into Launch4j s/w when I run it getting the error as "Exception in thread "main" java.lang.UnsatisfiedLinkError: no jmtp in java.library.path" Please help me how to create a perfect executable file.
has comment: http://stackoverflow.com/comment/32160803
has comment: http://stackoverflow.com/comment/32161870
has comment: http://stackoverflow.com/comment/32164300
has comment: http://stackoverflow.com/comment/32160980
type: UnansweredQuestion
tagged with: swing
type: Question
score: 1
tagged with: java
tagged with: unsatisfiedlinkerror
has title: java.lang.UnsatisfiedLinkError: no jmtp in java.library.path error while creating .jar file to .exe file using Launch4j software
has comment: http://stackoverflow.com/comment/32277184
has comment: http://stackoverflow.com/comment/32188236
upvote count: 1
tagged with: user-interface
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/32134955
has text: `For example, sort by price, by name` if you are sorting by price, then you are not sorting by name. Or are you talking about case where for example "element with same prices should be sorted by name"?
score: 0
comment on: http://stackoverflow.com/q/21319128
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32137929
type: Comment
type: QuestionComment
has text: Thats. Did not know that. Any idea about the actual problem?
comment on: http://stackoverflow.com/q/21320409
score: 0

http://stackoverflow.com/q/21257089
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32024988
has answer: http://stackoverflow.com/a/21257328
type: Question
has comment: http://stackoverflow.com/comment/32024643
has title: Factory for helper classes with static methods?
tagged with: factory-pattern
upvote count: 2
has comment: http://stackoverflow.com/comment/32024580
has comment: http://stackoverflow.com/comment/32024417
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32024514
favorite count: 0
has comment: http://stackoverflow.com/comment/32024489
has body: I have a couple of helper classes (? extends HelperBase) which only have public static methods. I would like to have something similar to what a factory is (with singleton support), but as there is no need for an instance, I am unsure which way to go best. In the end, I would like to have something like: enum HELPER_TYPE { Type_A } abstract class HelperBase { abstract void do(); static HelperBase getHelper(HELPER_TYPE type) { // ... } } class Helper1 extends HelperBase { static void doImpl() { // ... impl here } void do() { doImpl(); } } // ... and then: HelperBase helper = HelperBase.getHelper(HELPER_TYPE.Type_A); helper.do(); Is there a better way ? Any suggestion would be appreciated.
type: UnansweredQuestion
tagged with: architecture
tagged with: oop

http://stackoverflow.com/q/21200127
tagged with: java
tagged with: file
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31924234
has answer: http://stackoverflow.com/a/21200366
has title: Android File Doesn't Exist (But does at the same time!)
has comment: http://stackoverflow.com/comment/31924247
answer count: 3
has comment: http://stackoverflow.com/comment/130160930
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31924320
favorite count: 0
has answer: http://stackoverflow.com/a/21200227
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21200321
tagged with: android
has body: I have an Android program that creates a file and checks for it in an if statement. The purpose of this is to be able to save values in the app. The app works like this. I put the values in on the phone and I crash the app to reset it. The values were saved on the file. When I open the app again, it's supposed to skip the screen that lets me input the values. When I do this, the app acts as if the file never existed. Upon debug, I found that the file was indeed created. It should've been created on internal storage, but I also added the permission for external storage writing just in case. Can someone help me or give me an alternative please? File file = new File("user.txt"); if (file.exists()) { ... }
linked to: http://stackoverflow.com/q/7011991

http://stackoverflow.com/a/21327515
answers question: http://stackoverflow.com/q/21327355
type: Answer
has body: Every thread will have its own name in the log. You have not to do that.
score: 0

jdialog
type: Tag
tags question: http://stackoverflow.com/q/21247208
tags question: http://stackoverflow.com/q/21228932
tag name: jdialog
tags question: http://stackoverflow.com/q/21335820
tags question: http://stackoverflow.com/q/21263965

squish
tags question: http://stackoverflow.com/q/21185532
tag name: squish
type: Tag

http://stackoverflow.com/a/21312346
answers question: http://stackoverflow.com/q/21311933
score: -8
upvote count: 0
has body: Nothing would happen if you not put the @transactional Annotation Basically @Transactional is not mandatory to put on the top of method signature it is just use to inform compiler when your transactional is read only=true (only for the data retrieval purpose) and when it is read only=false(only for the insert update delete operations)
downvote count: 8
type: Answer

http://stackoverflow.com/comment/32104380
type: Comment
has text: "C:\ProjectWorkSpace\myProject\web\WEB-INF\classes;" is a Folder, you cannot execute that. There must be something missing in the batchfile.
score: 0
comment on: http://stackoverflow.com/q/21301953
type: QuestionComment

http://stackoverflow.com/q/21188831
possible better answer: http://stackoverflow.com/a/21188931
downvote count: 1
has body: This may be a strange question but is there way to stop a scanner in an infinite loop if an if statement comes out as true or false? For example if you have: for (;;) { Scanner in = new Scanner(System.in); int a = in.nextInt(); if (a &lt;= 0) { // is there something I could put in here to end the loop? } else { System.out.println("Continue"); } Sorry if this is a dumb question, I'm new to all of this.
favorite count: 0
has answer: http://stackoverflow.com/a/21188931
accepted answer: http://stackoverflow.com/a/21188886
answer count: 4
has title: How to stop a java scanner without ending a loop
type: AnsweredQuestion
tagged with: infinite
has answer: http://stackoverflow.com/a/21188886
has answer: http://stackoverflow.com/a/21188994
tagged with: loops
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21188877
upvote count: 2

http://stackoverflow.com/q/21273360
has body: I created a program that requires ChromeDriver. It works fine on Mac OS X and Linux, but when I try to start it on Windows it hangs on the following: "driver = new ChromeDriver(capabilities);" However no error is generated. I have loaded the chrome driver correctly and I set the binary path to chrome.exe correctly. for some unknown reason it just hangs when initializing the driver. ChromeOptions options = new ChromeOptions(); options.addArguments("window-size=800,600"); options.setBinary(getChromePath()); //Returns Chrome Path (Works) DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability(ChromeOptions.CAPABILITY, options); driver = new ChromeDriver(capabilities); driver.manage().timeouts().pageLoadTimeout(pageLoadTimeout, TimeUnit.SECONDS); I have no idea why this is happening and chromedriver.exe is never even started up as a process. This doesn't work with any Windows computers, but works with every other operating system.
tagged with: selenium-chromedriver
type: AnsweredQuestion
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/32056782
tagged with: google-chrome
has answer: http://stackoverflow.com/a/21399531
type: Question
accepted answer: http://stackoverflow.com/a/21294067
has title: Selenium ChromeDriver won't start on any Windows OS
has answer: http://stackoverflow.com/a/41990965
has answer: http://stackoverflow.com/a/21294067
possible better answer: http://stackoverflow.com/a/51066255
score: 0
linked to: http://stackoverflow.com/q/21009568
has answer: http://stackoverflow.com/a/51066255
tagged with: windows
has comment: http://stackoverflow.com/comment/32072327
answer count: 4

http://stackoverflow.com/a/21344431
upvote count: 1
answers question: http://stackoverflow.com/q/21344280
downvote count: 0
has body: The getBitValue just gets the value of a specified bit (on a certain location) The setBitValue sets the value of a bit on the matched specific location. These getter/setter methods are usually used for image processing, i.e. if you have a musk and you want to change a specific bit value. Nothing more or less.
type: Answer
has comment: http://stackoverflow.com/comment/32180480
score: 1

http://stackoverflow.com/a/21190926
has body: I suppose you determine the collision by calculating the distance of the circles center with the lines. We can simplify the case and tell that the circle colliding with the corner if both distances are equal and smaller than the radius. The equality should have a tolerance of course. More - may be not necessary- realistic approach would be to consider x,y speed and factor it in the equality check.
has comment: http://stackoverflow.com/comment/31931018
has comment: http://stackoverflow.com/comment/31907675
has comment: http://stackoverflow.com/comment/31907502
score: 0
has comment: http://stackoverflow.com/comment/31907949
type: Answer
answers question: http://stackoverflow.com/q/21190553

http://stackoverflow.com/a/21244453
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21243192
answers question: http://stackoverflow.com/q/21243192
score: 1
has body: Here's a picture of an array being sorted in real time and one with every sort displayed simultaneously. These are both on the wikipedia merge sort page. You should not only study the sort function but also the merge function. The sort function is the recursive part of the function whereas the merge function is the meat and potatoes; it's what actually does the sorting part of it. For example, in the first image below, the sort function is what splits the blocks into groups of 4, 2, and then 1. The merge function is what sorts these blocks, comparing the first value of each group (of size 1, 2, and then 4) and then placing them into the new merged array from lowest to highest.

http://stackoverflow.com/q/21273473
type: Question
tagged with: java
tagged with: eclipse
has body: I'm a bit new to programming and haven't used the buffered writer much at all. As far as I can see my code is good. However I have no idea where, or even if, this is printing to a file. I can't find where the file is. if (choice ==2) { String Id; String Name; String Time; int penalty; String Code; new FileWriter("res/dogs.txt",true); try { System.out.println("add a dog"); System.out.println("enter dog ID (cancel to quit)"); Id =k.next (); System.out.println("enter dog name"); Name=k.next(); System.out.println("enter dogs time"); Time = k.next(); System.out.println("enter penalty quantity"); penalty = k.nextInt(); System.out.println ("enter course code"); Code = k.next(); if (!Id .equalsIgnoreCase ("cancel")) { //true = append file FileWriter fileWritter = new FileWriter(Dog.getName(),true); BufferedWriter bufferWritter = new BufferedWriter(fileWritter); bufferWritter.write(Id); bufferWritter.write(" "); bufferWritter.write(Name); bufferWritter.write(" "); bufferWritter.write(Time); bufferWritter.write(" "); bufferWritter.write(penalty); bufferWritter.write(" "); bufferWritter.write(Code); bufferWritter.write(" "); bufferWritter.close(); } } catch(IOException e){ e.printStackTrace(); } } else if (choice == 3) { mainmenu(); } Any ideas as to what I am doing wrong?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21273656
possible better answer: http://stackoverflow.com/a/21273575
has answer: http://stackoverflow.com/a/21273575
has title: Where is the input is going?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21273656

http://stackoverflow.com/comment/31934747
type: AnswerComment
score: 0
type: Comment
has text: didn't pay attention that e() is not synchronized see modified answer.
comment on: http://stackoverflow.com/a/21205895

http://stackoverflow.com/comment/32023583
comment on: http://stackoverflow.com/q/21256586
score: 1
has text: just move the /* tag upwards
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21228929
score: 0
type: Answer
has body: You use GridLayout because of your buttons resize horisontally/vertically always to fill whole grid cell. To prevent that you can use another LayoutManager, for example GridBagLayout. Always read about setting size to components.
has comment: http://stackoverflow.com/comment/32003351
has comment: http://stackoverflow.com/comment/31975336
answers question: http://stackoverflow.com/q/21228740
has comment: http://stackoverflow.com/comment/31975380

http://stackoverflow.com/a/21232668
has body: There are several options. Depending on whether performance or memory consumption are more important, and depending on how large the vector/matrix are in the actual use-case, and how the distribution of indices actually is. But a rather simple (IMHO elegant) and versatile solution might be to create a map that maps each index to the sum of matrix rows that has been computed so far. There might be solutions that are slightly more efficient or require less memory, but they will probably not be so readable. import java.util.Arrays; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; public class AddMatrixRows { public static void main(String[] args) { double vector[] = { 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0}; double matrix[][] = new double[vector.length][]; for (int r=0; r&lt;vector.length; r++) { matrix[r] = new double[] { 12, 34, 56 }; } double sums[][] = computeSums(vector, matrix); for (int r=0; r&lt;sums.length; r++) { System.out.println(Arrays.toString(sums[r])); } } private static double[][] computeSums(double vector[], double matrix[][]) { Map&lt;Integer, double[]&gt; sumsByIndex = new LinkedHashMap&lt;Integer, double[]&gt;(); for (int r=0; r&lt;vector.length; r++) { int index = (int)vector[r]; double array[] = sumsByIndex.get(index); if (array == null) { int numColumns = matrix[index].length; array = new double[numColumns]; sumsByIndex.put(index, array); } add(array, matrix[index]); } return toArray(sumsByIndex.values()); } private static double[][] toArray(Collection&lt;double[]&gt; collection) { double result[][] = new double[collection.size()][]; int i = 0; for (double sum[] : collection) { result[i] = sum; i++; } return result; } private static void add(double array[], double addend[]) { for (int i=0; i&lt;array.length; i++) { array[i] += addend[i]; } } }
score: 1
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21231334
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21231334

http://stackoverflow.com/comment/32182181
type: QuestionComment
comment on: http://stackoverflow.com/q/21344507
has text: It won't have an effect, it will tell you something.
score: 0
type: Comment

http://stackoverflow.com/a/21219693
score: 2
answers question: http://stackoverflow.com/q/21193930
has body: As on your request I summarize my comments in an answer. Your first problem was that you tried to invoke java.exe on a Linux or Mac box, which does not stick to the Microsoft convention of including the file type into the name. Therefore Linux and Mac usually use java instead. The path to the executable can vary also from computer to computer. Therefore the probably most generic way is to locate the java executable using the JAVA_HOME environment variable which can be fetched in Java via System.getenv("JAVA_HOME"); or via System.getProperty("java.home"); Note however that they might not obviously point to the desired directory. Especially some Linux distributions place all binary files inside /bin or /usr/bin and therefore ${JAVA_HOME}/bin/java might not be available. In that case you should create a (hard)link to the executable. If the path is not set you can set it manually in the session of your console you are executing your application (on Windows set JAVA_HOME=C:\Program Files\Java (or setx on newer Windows versions) on Linux export JAVA_HOME=/opt/java). This can also be done with user-priviledges It is further strongly recommended to take care of in- and output-streams when dealing with processes. The linked article explains in depth why you should take care of it - not only to catch exceptions thrown by the invoked process. On invoking a process (especially with the Java executable) you have a couple of options: You can either invoke the Java process directly (assuming Java is on your PATH) with new ProcessBuilder("java", "-cp", "path/to/your/binaries", "package.ClassName"); or you can invoke the Java executable via a shell - on Linux f.e. you could also use new ProcessBuilder("/bin/bash", "-c", "java -cp path/to/your/binaries package.ClassName"); (though the primer one is obviously preferable). On loading classes/libraries dynamically you have to use the fully qualified class name. So, if you invoke the Java process in the root-directory of your project and…
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21193930
upvote count: 2
has comment: http://stackoverflow.com/comment/31958903
has comment: http://stackoverflow.com/comment/31959065

http://stackoverflow.com/comment/32142850
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21323672
type: Comment
has text: I think you meant `while(!found)`. Other than that... yeah, that seems to be what he was asking for. I still say it's a horrible solution for the stated problem, but if the goal is to demonstrate that as the table fills up it becomes progressively harder to find a value which hasn't already been used (perhaps to illustrate the statistics and demonstrate why this *is* a horrible solution), it does accomplish that.

http://stackoverflow.com/comment/32128482
type: Comment
type: QuestionComment
has text: Post your `TaskDataValue` class. I bet that the settings field is `static`
score: 1
comment on: http://stackoverflow.com/q/21315895

http://stackoverflow.com/comment/32047898
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21269417
has text: @kiheru Yes, I am. What does revalidate() do? I can't find the method in `GridLayout`

http://stackoverflow.com/q/21197198
tagged with: jena
upvote count: 6
has answer: http://stackoverflow.com/a/21203137
has title: Fuseki GC overhead limit exceeded during data import
has body: I'm trying to import LinkedMDB (6.1m triples) into my local version of jena-fuseki at startup: /path/to/fuseki-server --file=/path/to/linkedmdb.nt /ds and that runs for a minute, then dies with the following error: Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded at com.hp.hpl.jena.graph.Node$3.construct(Node.java:318) at com.hp.hpl.jena.graph.Node.create(Node.java:344) at com.hp.hpl.jena.graph.NodeFactory.createURI(NodeFactory.java:48) at org.apache.jena.riot.system.RiotLib.createIRIorBNode(RiotLib.java:80) at org.apache.jena.riot.system.ParserProfileBase.createURI(ParserProfileBase.java:107) at org.apache.jena.riot.system.ParserProfileBase.create(ParserProfileBase.java:156) at org.apache.jena.riot.lang.LangNTriples.tokenAsNode(LangNTriples.java:97) at org.apache.jena.riot.lang.LangNTriples.parseOne(LangNTriples.java:90) at org.apache.jena.riot.lang.LangNTriples.runParser(LangNTriples.java:54) at org.apache.jena.riot.lang.LangBase.parse(LangBase.java:42) at org.apache.jena.riot.RDFParserRegistry$ReaderRIOTFactoryImpl$1.read(RDFParserRegistry.java:142) at org.apache.jena.riot.RDFDataMgr.process(RDFDataMgr.java:818) at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:679) at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:211) at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:104) at org.apache.jena.fuseki.FusekiCmd.processModulesAndArgs(FusekiCmd.java:251) at arq.cmdline.CmdArgModule.process(CmdArgModule.java:51) at arq.cmdline.CmdMain.mainMethod(CmdMain.java:100) at arq.cmdline.CmdMain.mainRun(CmdMain.java:63) at arq.cmdline.CmdMain.mainRun(CmdMain.java:50) at org.apache.jena.fuseki.FusekiCmd.main(FusekiCmd.java:141) Is there a way that I can bump up the memory limit or import the data in less intensive way? For comparison's sake, when I used a 1million triple source file, it imports in less than 10 seconds.
favorite count: 0
tagged with: http://stackoverflow.com/tag/rdf
score: 6
has answer: http://stackoverflow.com/a/21197787
accepted answer: http://stackoverflow.com/a/21197787
tagged with: fuseki
tagged with: sparql
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/21203137
answer count: 2

http://stackoverflow.com/a/21291080
upvote count: 1
has body: Think it is because most of your code is closed inside the scope of the first onClickListener, try something like this. Button PageOneButton = (Button) findViewById(R.id.btnPageOne); PageOneButton.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { Intent myIntent = new Intent(Main.this, PageOne.class); startActivity(myIntent); }); Button PageTwoButton = (Button) findViewById(R.id.btnPageTwo); PageTwoButton.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { Intent myIntent = new Intent(Main.this, PageTwo.class); startActivity(myIntent); }); Using v.getContext() should be ok, this is just how I usually would do as the Activity itself is indeed a valid context. I guess it just seems more readable to me. Edit: Just as a clarification to the current state of your code. The second button is assigned a onClickListener only after the first button is pressed. But since the first button takes the app to a new Activity, inherently destroying the Main Activity, the second button will never have a chance to reach it's onClickListener. Hope it makes sense, nevertheless the code above should fix the issue.
has comment: http://stackoverflow.com/comment/32086744
downvote count: 0
answers question: http://stackoverflow.com/q/21290974
type: Answer
has comment: http://stackoverflow.com/comment/32090660
score: 1

http://stackoverflow.com/q/21185208
answer count: 2
possible better answer: http://stackoverflow.com/a/21190085
favorite count: 0
has comment: http://stackoverflow.com/comment/31897272
has comment: http://stackoverflow.com/comment/31896901
has answer: http://stackoverflow.com/a/21188970
accepted answer: http://stackoverflow.com/a/21188970
upvote count: 4
tagged with: spring
has comment: http://stackoverflow.com/comment/31903226
has title: Spring container implementations
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/21190085
has body: I keep on learning Spring and it is very difficult to figure out which implementation of ApplicationContext is intended for. I've standalone J2EE application and I don't interested in Web* or Portlet* implementations. Can you provide me the brief list of possibilities (if isn't clear, see P.S. section of my question) and purposes of each implementation below: ResourceAdapterApplicationContext StaticApplicationContext ClassPathXmlApplicationContext FileSystemApplicationContext P.S. A don't ask you to provide me reference to the docs. For example: ClassPathXmlApplicationContext Standalone XML application context, taking the context definition files from the class path, interpreting plain paths as class path resource names that include the package path But from that definition its not clear that ClassPathXmlApplicationContext also implements AbstractRefreshableApplicationContext and can be used to change beans definition without stopping server.
has comment: http://stackoverflow.com/comment/31897127
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/31904155
has comment: http://stackoverflow.com/comment/31897043
score: 4

http://stackoverflow.com/comment/31904739
type: AnswerComment
comment on: http://stackoverflow.com/a/21186712
type: Comment
score: 1
has text: @ErkiM. I've written a `DifferenceBuilder` that [I've submitted to Apache Commons Lang](https://issues.apache.org/jira/browse/LANG-637), which will probably do exactly what you want. I hope this will be released in February sometime.

http://stackoverflow.com/a/21205079
has body: If you are using Netbeans IDE then you can easily build a jar file of your project. Just go to Run in the Menu above and select clean and build. Now goto to you project folder, find Dist folder inside it and there you have your .jar file.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21205029
downvote count: 0
type: Answer

http://stackoverflow.com/q/21301956
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
has title: Error showing "Description: The requested resource is not available."
has comment: http://stackoverflow.com/comment/32104509
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/32104098
has body: I am deploying my Spring-Hibernate web application on "https://app.j.layershift.co.uk/" server. But it is showing error "The requested resource is not available". This is very small web application on Spring-Hibernate. I made a zip file and upload it on server but server gives error at time of deployment. Dispatcher Servlet: /WEB-INF/views/ .jsp <context:component-scan base-package="com.webscreen.controller"></context:component-scan> <tx:annotation-driven /> <context:annotation-config /> <mvc:annotation-driven /> com.webscreen.bean.Cradentials org.hibernate.dialect.MySQLDialect true update </beans> Web.xml <?xml version="1.0" encoding="UTF-8"?> index.jsp dispatcher org.springframework.web.servlet.DispatcherServlet dispatcher *.do
answer count: 0
downvote count: 0
type: Question
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/32104080

http://stackoverflow.com/comment/73907941
comment on: http://stackoverflow.com/q/21312773
score: 0
type: Comment
type: QuestionComment
has text: Have you set environment variables for Java?

http://stackoverflow.com/comment/32119487
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21309924
has text: how can i call this symbols ( <% %>, <%! %> and <%@ %> )
score: 0

http://stackoverflow.com/q/21263341
answer count: 1
tagged with: tomcat
has comment: http://stackoverflow.com/comment/32037169
has body: I have been having a problem with this exception for a long time. I am trying to connect to an external mysql database but I keep getting this exception. I have looked at many examples and I still have not found the answer. Here is my code, please bare in mind that this is all the code I use for this so please say if I've missed something out: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;context&gt; &lt;!-- Registers Database with JNDI Naming Service as a pooled DataSource --&gt; &lt;Resource name="jdbc/DBNAME" auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" testWhileIdle="true" testOnBorrow="true" testOnReturn="false" validationQuery="SELECT 1" validationInterval="30000" timeBetweenEvictionRunsMillis="30000" maxActive="100" minIdle="10" maxWait="10000" initialSize="10" removeAbandonedTimeout="60" removeAbandoned="true" logAbandoned="true" minEvictableIdleTimeMillis="30000" jmxEnabled="true" jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer" username="****" password="********" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://****:3306/****"/&gt; &lt;/context&gt; And here is my code for calling it: try { InitialContext ic = new InitialContext(); DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/DBNAME"); Connection c = ds.getConnection(); return c; } catch(NamingException ne) { System.out.println(ne.toString()); return null; } catch (SQLException se) { System.out.println(se.toString()); return null; } Usernames, passwords, db urls and connection names have been redacted but the rest is correct.
has answer: http://stackoverflow.com/a/21263651
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/32037273
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32037090
type: Question
tagged with: jndi
has comment: http://stackoverflow.com/comment/32037041
has title: jdbc javax.naming.NameNotFoundException
tagged with: java
has comment: http://stackoverflow.com/comment/32037239
upvote count: 1

http://stackoverflow.com/a/21243000
score: 1
answers question: http://stackoverflow.com/q/21225151
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21225151
has body: go to "Configure" menu then 'Options" then select "JDK Profiles" in the left menu then select your "JDK version 1.7.0_51" profile then click the "Edit..." button then in the "Classes" tab click the "Add" button then select "Add Archive" then go to your "C:\Program Files\Java\jdkX.X.X_X\jre\lib" folder to select "jfxrt.jar" and finally open it, click on "Ok", "Ok", et c. and done. Too long, didn't read: add "jfxrt.jar" to your JDK Profile in JCreator Options =)
type: Answer
upvote count: 1

http://stackoverflow.com/comment/32048539
type: QuestionComment
comment on: http://stackoverflow.com/q/21263528
score: 0
has text: You could always have your managed server down when you deploy... but the answer below is correct, your application should install and sit in the prepared state. How exactly are you deploying it?
type: Comment

http://stackoverflow.com/q/21246157
downvote count: 0
favorite count: 0
tagged with: static
accepted answer: http://stackoverflow.com/a/21246300
tagged with: android
has body: I have a class Settings with static methods which I use to save and load my data. This is for example the Save() method: public static void Save(SETTING_KEY key, String value) { SharedPreferences sp = _context.getSharedPreferences(prefName, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); editor.putString(key.toString(), value); editor.commit(); } Now I'd like to make the class Settings observable. The problem is that extending my Settings-class from Observable does not work, as I don't instantiate this class as I only use its static methods. Is there any easy way to make this static class observable?
has title: Make 'static' class observable
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32006503
has answer: http://stackoverflow.com/a/44057689
score: 1
tagged with: java
upvote count: 1
tagged with: observers
type: Question
possible better answer: http://stackoverflow.com/a/21246185
has answer: http://stackoverflow.com/a/21246300
linked to: http://stackoverflow.com/q/2832297
has answer: http://stackoverflow.com/a/21246185
tagged with: observable
answer count: 3

http://stackoverflow.com/comment/31987996
comment on: http://stackoverflow.com/a/21230733
score: 0
type: Comment
has text: it doesn't make difference having same problem
type: AnswerComment

http://stackoverflow.com/q/21281850
has comment: http://stackoverflow.com/comment/32068503
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21282074
possible better answer: http://stackoverflow.com/a/21282320
has body: I am using Struts2 and IDE Eclipse. I have a chart.xml file, which is placed in WEB-INF folder, I am trying to read this file as: String path=ServletActionContext.getServletContext().getRealPath("/WEB_INF/chart.xml"); File XMLfile = new File(path); But unable to read it. I am getting the following error: javax.xml.bind.UnmarshalException - with linked exception: [java.io.FileNotFoundException: F:\doc\Mavenex\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\EFW11\WEB-INF\chart1.xm (The system cannot find the file specified)] How can i do it?
tagged with: struts2
has answer: http://stackoverflow.com/a/21282320
score: 0
has title: Read file from WEB-INF folder in Eclipse
has comment: http://stackoverflow.com/comment/32068287
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21282074

http://stackoverflow.com/comment/32113555
has text: That's true! But... If you clone the array in the `domore` method, it's no advantage to this problem. In the `run` method the `arr` variable will still hold a reference to the array which contains `0, 1, 2`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21305396
type: Comment

http://stackoverflow.com/comment/32114121
type: Comment
comment on: http://stackoverflow.com/a/21301714
type: AnswerComment
score: 0
has text: @Shmoopy You never stop learning. The more I learn the less I know.

http://stackoverflow.com/comment/32126427
type: Comment
comment on: http://stackoverflow.com/q/21310594
has text: @vefthym Nice, that's way better like that. But I still have to use a temporary file, there is no way to directly pass the data from `Reduce1` to `Map2` ?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32146688
comment on: http://stackoverflow.com/a/21325863
type: Comment
has text: You'll end up with a similar problem because the draw() calls have wait() calls at the end. That will make your sun flicker in front of the hill, so you'd have to rewrite the draw code to make it look good.
score: 0
type: AnswerComment

http://stackoverflow.com/a/21274411
has comment: http://stackoverflow.com/comment/32056642
has body: Soap UI itself is the best one for it. If you wan to do it using java try soapui library for the same. WsdlProject project = new WsdlProject(); WsdlInterface[] wsdls = WsdlImporter.importWsdl(project, "http://webservices.daehosting.com/services/TemperatureConversions.wso?WSDL"); for (Operation operation : wsdls[0].getOperationList()) { WsdlOperation op = (WsdlOperation) operation; System.out.println(op.createRequest(true)); System.out.println(op.createResponse(true)); } The dependency details can be found from pom here. Jars can be directly downloaded from here. Here is another link for more info.
answers question: http://stackoverflow.com/q/21256126
score: 0
type: Answer

http://stackoverflow.com/a/21367240
score: 2
upvote count: 2
has body: The links offered by Peter were partially useful. However, I was able to solve this more or less by trial and error. The Oracle docs that explain how to do this need lots of work. They lack a good example of how to proceed. Anyway, for those who run into the same issues, here's what I did. I created a text file (eg. "Manifest.txt") using Notepad that contains the manifest attributes I wanted to add/update. In creating this file, I made sure to add a new line character to the last line by pressing the key on the keyboard. Next, I created a DOS bat file to do the actual modification. Here's what it looked like... echo Updating manifest permissions... "C:\Program Files\Java\jdk1.7.0_25\bin\jar" -umf "c:\some folder\Manifest.txt" "C:\some folder\jartoupdate.jar" The order of the jar arguments as they relate to the actual paths that follow on the command line is important. The links from Peter's reply pointed that part out.
answers question: http://stackoverflow.com/q/21223015
accepted answer of: http://stackoverflow.com/q/21223015
type: AcceptedAnswer
downvote count: 0
type: Answer