http://stackoverflow.com/comment/46351067
comment on: http://stackoverflow.com/a/21996565
has text: You also need to override the replace(...) method of the DocumentFilter.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33284726
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21956078
type: AnswerComment
has text: @RaviH Stephen C is correct ,I'm not actively trying to run Nashorn with Java 7, the application just seems to be trying to use it. And I have nothing from the customer to indicate they are actively trying to run Nashorn either, although that is a possibility.

http://stackoverflow.com/a/54837353
downvote count: 0
score: 9
answers question: http://stackoverflow.com/q/21990677
type: Answer
upvote count: 9
has body: I encountered the same problem today at work — our code was calling HttpURLConnection.getResponseCode() and ending up with Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: ... — and after some quality time diving through the JDK source code, I ended up figuring out the following: getResponseCode() isn't actually throwing an exception! An exception gets thrown from deep inside getResponseCode(), but it gets caught. Before it's caught, some fields get set inside HttpURLConnection that allow getResponseCode() to succeed, which it does. Also before it's caught, the exception gets saved to a field in a subclass of HttpURLConnection (specifically: sun.net.www.protocol.http.HttpURLConnection.rememberedException). Subsequently, our code called getInputStream() directly, which is supposed to throw an exception in this case. (You're supposed to call getErrorStream() instead.) getInputStream() throws an exception that wraps the original thrown-and-caught exception. So we ended up getting a stacktrace with Caused by-s that referred to our line of code where we were calling getResponseCode(), even though our actual issue was later, in our line of code where we were calling getInputStream() directly. The stacktrace also mentions that later line of code, but I didn't notice that at first. I'm betting that your case was the same.

http://stackoverflow.com/a/22022669
has comment: http://stackoverflow.com/comment/33394538
has body: Here is something you could try: Inside your AsyncTask, define an interface and a method inside it that will pass back the data to the calling activity and inside that method, call the next activity and set the data as an extra. This is the simplest way. In your AsyncTask, inside onPostExecute(result), use a try block to call the method which belongs to the above mentioned interface which must be implemented by the calling activity. HomeActivity.java /public class SampleActivity extends Activity implements SampleAsyncTask.OnUpdateListener{ @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); executeAsync(); } public void executeAsync(){ new SampleAsyncTask(this).execute("someFlagToCheck"); } @Override public void onDataProcessed(String result){ Intent intent = new Intent(this, SecondActivity.class); intent.putExtra("data", result); startActivity(intent); } } SampleAsyncTask.java public class SampleAsyncTask extends AsyncTask&lt;Void, Void, String&gt;{ Context context; //constructor SampleAsyncTask(Context context){ this.context = context; } @Override public void doInBackground(String... params){ //do something depending on the arguments in params return "data"; } @Override public void onPostExecute(String result){ try{ ((OnUpdateListener) context).onDataProcessed(result); }catch(Exception e){ e.printStackTrace(); } } public interface OnUpdateListener{ public void onDataProcessed(String data); } } Follow this example. The calling activity implements the AsyncTask's interface and overrides its method which will be called when the async task is done with the result. I hope this helped.
has comment: http://stackoverflow.com/comment/33387024
has comment: http://stackoverflow.com/comment/33390951
score: 0
answers question: http://stackoverflow.com/q/22000661
has comment: http://stackoverflow.com/comment/33385250
type: Answer
has comment: http://stackoverflow.com/comment/33433028

mapbox
tags question: http://stackoverflow.com/q/21910435
type: Tag
tag name: mapbox

http://stackoverflow.com/comment/71429961
has text: Any solution to this problem? Can we pass Super class type in @RequestBody? ... I am getting exactly the same issue
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21951262
score: 0

http://stackoverflow.com/q/21924690
tagged with: search
score: 0
has answer: http://stackoverflow.com/a/21925125
answer count: 2
has answer: http://stackoverflow.com/a/21924852
has title: Java - Iterative deepening search with nodes
type: UnansweredQuestion
has body: I'm in the process of designing a program that is meant to search through a two-dimensional array of numbers that represents a map for a path to a specified end point. I've been using nodes that have several parameters, most prominently adjacent north, south, east, and west nodes each representing a square within the map. The search method I'm currently trying to finish is with iterative deepening but every time I try running the program, I wind up with a stack overflow error. This is the iterative deepening class. import java.util.*; import java.io.*; public class IDeepeningSearch { private Node start; private Node end; private int[][] map; private ArrayList&lt;Node&gt; solution; //Build using file handler public IDeepeningSearch(String file){ FileHandler handle = new FileHandler(file); //Create map map = handle.getMap(); //Start node coordinates and value start = new Node(); start.setRow(handle.getSRow()); start.setCol(handle.getSCol()); start.setValue(map[start.getRow()][start.getCol()]); //End node coordinates end = new Node(); end.setRow(handle.getERow()); end.setCol(handle.getECol()); end.setValue(map[start.getRow()][start.getCol()]); } //Runs search public void run(){ int i = 0; solution = new ArrayList&lt;Node&gt;(); //Value of i indicates depth to be explored; will increment with each failure while(solution.isEmpty()){ search(start, i); i++; } if(!solution.isEmpty()){ System.out.println("It worked."); } System.out.println("If you're not seeing the other message then it failed."); } //Building tree public void build(Node head){ setNLeaf(head); setSLeaf(head); setELeaf(head); setWLeaf(head); // if(head.getNorth() != null){ // build(head.getNorth()); // } // if(head.getSouth() != null){ // build(head.getSouth()); // } // if(head.getEast() != null){ // build(head.getEast()); // } // if(head.getWest() != null){ // build(head.getWest()); // } } //Performs search public void search(Node head, int depth){ if(head.getRow() == end.getRow() &amp;&amp; head.getCol() ==…
type: Question
tagged with: java

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

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

http://stackoverflow.com/comment/33214209
has text: "each time i am adding elements in this arraylist it is showing only the last element." Only the last common element is adding in newList
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21927779

http://stackoverflow.com/q/21843892
has comment: http://stackoverflow.com/comment/33065540
has comment: http://stackoverflow.com/comment/33065081
has comment: http://stackoverflow.com/comment/33065199
has comment: http://stackoverflow.com/comment/33065394
has comment: http://stackoverflow.com/comment/33065075
has body: I'm having troubling organizing my list of employees. I just need to organize them according to their employee type (first two letters). Each object starts with the employee code which are the first two letters. This is what I need to separate the position types but for some reason I can't grab them. Here is the file that I am creating the objects out of and storing them in the arrays. PW_1234,James,Bond,01/02/10,1,10 PW_1235,John,Brown,02/03/10,2,10.5 PW_1236,Howard,Johnson,03/04/10,3,11 PW_1237,Francis,Themule,04/05/11,4,10.75 PW_1238,Mathew,Lewis,05/06/11,1,12.75 PW_1239,Mark,Bixton,05/13/11,2,13 PW_1242,Sarah,Glover,05/14/11,1,13.75 PW_1245,John,Doe,05/15/11,4,10.5 PW_1245,Mary,Doe,05/15/11,4,10.5 TL_1248,Abel,English,05/16/11,3,16.5,0.01,100,89 TL_1251,Eustis,Clauser,05/17/11,2,16,0.02,100,9 SU_1254,Henry,Hollowman,05/18/11,1,40000,0.01 PW_1240,Luke,Sailor,01/22/12,3,14.5 PW_1243,Jane,Baker,01/23/12,2,14 PW_1243,Jane,Baker,01/23/12,2,14 TL_1246,David,Brief,01/24/12,1,14.75,0.01,100,57 PW_1246,David,Doson,01/24/12,1,14.75 TL_1249,Baker,Anderson,01/25/12,4,11.5,0.01,100,100 TL_1252,Frank,Donson,01/26/12,3,17.5,0.02,100,39 SU_1255,Issac,Asimov,01/27/12,2,43000,0.02 SU_1256,Issac,Shoreman,01/28/12,3,39000,0.01 SU_1257,Issac,Roberts,01/29/12,4,35500,0.01 PW_1241,John,Candy,11/23/13,4,9.5 PW_1244,Kate,Smith,11/24/13,3,15.5 PW_1244,Kate,Handle,11/24/13,3,15.5 TL_1247,Samual,Dempky,11/25/13,2,15,0.01,100,10 TL_1250,Charley,Boman,11/26/13,1,15.75,0.01,100,50 TL_1253,George,Fritzmen,11/27/13,4,12.5,0.02,100,27 Here is the code: private String makeEmployeeList() { String list = ""; for(int i=0; i &lt; employees.length; i++) { list += "\n"+employees[i].toString(); if(employees[i]substring(0,2).equals("SU")) { list += "\n"+employees[i].toString(); } } return list; } **Here is how the employees array is created: private Employee[] employees; **Here is how everything is loaded into it. public void loadEmployeesFromFile(String fileName) { File inFile = new File(fileName); if(i…
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33065152
tagged with: methods
has comment: http://stackoverflow.com/comment/33065086
has comment: http://stackoverflow.com/comment/33065574
has comment: http://stackoverflow.com/comment/33065034
type: Question
answer count: 2
upvote count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/33065059
tagged with: sorting
has comment: http://stackoverflow.com/comment/33065290
has comment: http://stackoverflow.com/comment/33065035
has answer: http://stackoverflow.com/a/21843942
has comment: http://stackoverflow.com/comment/33065044
has comment: http://stackoverflow.com/comment/33065247
has comment: http://stackoverflow.com/comment/33065176
has comment: http://stackoverflow.com/comment/33065067
has answer: http://stackoverflow.com/a/21844134
favorite count: 0
has title: Organizing array list of objects JAVA
downvote count: 0
has comment: http://stackoverflow.com/comment/33065095
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33065216

http://stackoverflow.com/a/21898389
downvote count: 0
has body: Best option is to use Google Play Services and its LocationClient. http://developer.android.com/google/play-services/location.html This gives you a provider that automatically picks the best available information from all the provider types and can return the location immediately in some cases using getLastLocation()
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21898272

http://stackoverflow.com/comment/33328377
score: 0
type: AnswerComment
type: Comment
has text: Can you tell me, where Windows (I speak of Windows, not Java, as the question refers to the command prompt) is using forward slashes?
comment on: http://stackoverflow.com/a/21991708

http://stackoverflow.com/comment/33065001
has text: Are you manually editing R.java yourself?
type: QuestionComment
score: 1
type: Comment
comment on: http://stackoverflow.com/q/21843865

http://stackoverflow.com/q/21938868
score: 3
tagged with: junit
accepted answer: http://stackoverflow.com/a/21938980
favorite count: 0
has title: Making a percentage of JUnit tests pass
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21938942
downvote count: 1
type: Question
has body: Is there an easy way to tell JUnit that you only want a certain percentage or number of tests to pass? I'm mainly looking for something at the method level but class level is fine too. I understand this is unconventional for unit tests but I mostly work on machine learning where I don't expect every single test to pass.
possible better answer: http://stackoverflow.com/a/21938942
has answer: http://stackoverflow.com/a/21938980
tagged with: java
upvote count: 4
has comment: http://stackoverflow.com/comment/33238719
answer count: 2

http://stackoverflow.com/q/21900463
has answer: http://stackoverflow.com/a/21900794
answer count: 3
has body: I have a very basic test which fails on me and I can't figure out why. Here is my code System.out.println(URLEncoder.encode("去", "UTF-8")); // result = "%E5%8E%BB" System.out.println(URLDecoder.decode("%E5%8E%BB", "UTF-8")); result = ? Why does the second system.out result in a ? I am expecting to see 去 again. To add to the larger picture, I will be using encodeURIComponent() in javascript to post my data to a servlet in which I want to use the URLDecoder.decode but I can't even get the above example to work. What am I missing? UPDATE: Just noticed something strange, when I run the code in a servlet I get the result I described but if I just run it in a main method it works. Here is my servlet code import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.net.URLDecoder; import java.net.URLEncoder; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class SaveFile extends BasicServiceServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //request.setCharacterEncoding("UTF-8"); //response.setContentType("text/html; charset=UTF-8"); String DIR = getBaseUrl(); String project = request.getParameter("project"); String foldername = request.getParameter("foldername"); String filename = request.getParameter("filename"); String fileContent = (String)request.getParameter("content"); String ch = (String)request.getParameter("char"); //char = 去 String pathToFile = DIR + project + "/" + foldername + "/" + filename; System.out.println(URLEncoder.encode("去", "UTF-8")); //reults in %E5%8E%BB System.out.println(URLDecoder.decode(ch, "UTF-8")); // results in ? System.out.println(URLDecoder.decode("%E5%8E%BB", "UTF-8")); //results in ? System.out.println("去".equals(URLDecoder.decode("%E5%8E%BB", "UTF-8"))); //this results in true try { //writing it to file results in ? BufferedWriter out =…
tagged with: java-5
has answer: http://stackoverflow.com/a/21900657
tagged with: encodeuricomponent
tagged with: unicode
has comment: http://stackoverflow.com/comment/33166278
score: 0
possible better answer: http://stackoverflow.com/a/21900657
has title: Java URLDecoder returns?
has answer: http://stackoverflow.com/a/21900549
accepted answer: http://stackoverflow.com/a/21900549
has comment: http://stackoverflow.com/comment/33166215
type: Question
type: AnsweredQuestion
tagged with: url-encoding
tagged with: java

http://stackoverflow.com/a/21977553
upvote count: 4
has body: Add an ActionListener to the instance of the JButton, get the content of the JTextField (say with name aTextField), and store it to a list (say you have a class member JList dataInputted ) button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Execute when button is pressed dataInputted.addElement(aTextField.getText()); } });
downvote count: 0
has comment: http://stackoverflow.com/comment/33303651
has comment: http://stackoverflow.com/comment/33303723
has comment: http://stackoverflow.com/comment/33303831
has comment: http://stackoverflow.com/comment/33303670
score: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21977285
answers question: http://stackoverflow.com/q/21977285
type: Answer

jboss-arquillian
tags question: http://stackoverflow.com/q/21959564
tags question: http://stackoverflow.com/q/21958113
tag name: jboss-arquillian
type: Tag
tags question: http://stackoverflow.com/q/21848832
tags question: http://stackoverflow.com/q/21910789

http://stackoverflow.com/comment/33359756
has text: There is no need for details in my opinion. The answer below provides exactly the information I needed to both of my questions, by stating that memory processing is faster and by providing a very useful technique for the operations I described. I haven't coded it yet, since I wanted to ensure efficiency before writing hundreds of lines of code (and maybe realize later I could have done it in ten!)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21985646
type: Comment

http://stackoverflow.com/comment/33405649
type: AnswerComment
type: Comment
has text: Oh, then if you are maintaining single class throughout your test you can make use of @BeforeClass which I am not sure would work. But it may be a good time to switch on TestNG to achieve many benefits. May be you can also make use of FactoryMethod to create Driver whose instance is created only once - http://en.wikipedia.org/wiki/Factory_method_pattern In this you maintain the copy of your driver on object level and always call getDriver method which gives the original created instance rather creating new instance all time
comment on: http://stackoverflow.com/a/22008027
score: 0

java
tags question: http://stackoverflow.com/q/21974758
tags question: http://stackoverflow.com/q/21906723
tags question: http://stackoverflow.com/q/21950344
tags question: http://stackoverflow.com/q/21949674
tags question: http://stackoverflow.com/q/21896509
tags question: http://stackoverflow.com/q/21977925
tags question: http://stackoverflow.com/q/21920337
tags question: http://stackoverflow.com/q/21863578
tags question: http://stackoverflow.com/q/21989082
tags question: http://stackoverflow.com/q/21984304
tags question: http://stackoverflow.com/q/21865095
tags question: http://stackoverflow.com/q/21973991
tags question: http://stackoverflow.com/q/21975190
tags question: http://stackoverflow.com/q/21966501
tags question: http://stackoverflow.com/q/21949998
tags question: http://stackoverflow.com/q/21953833
tags question: http://stackoverflow.com/q/21975137
tags question: http://stackoverflow.com/q/21919009
tags question: http://stackoverflow.com/q/21897067
tags question: http://stackoverflow.com/q/21854680
tags question: http://stackoverflow.com/q/21958662
tags question: http://stackoverflow.com/q/21934744
tags question: http://stackoverflow.com/q/21961729
tags question: http://stackoverflow.com/q/21883236
tags question: http://stackoverflow.com/q/21947313
tags question: http://stackoverflow.com/q/21899237
tags question: http://stackoverflow.com/q/21952308
tags question: http://stackoverflow.com/q/21934310
tags question: http://stackoverflow.com/q/21905386
tags question: http://stackoverflow.com/q/21937573
tags question: http://stackoverflow.com/q/22000513
tags question: http://stackoverflow.com/q/21865037
tags question: http://stackoverflow.com/q/21849039
tags question: http://stackoverflow.com/q/21985068
tags question: http://stackoverflow.com/q/21927008
tags question: http://stackoverflow.com/q/21971577
tags question: http://stackoverflow.com/q/21952991
tags question: http://stackoverflow.com/q/21925546
tags question: http://stackoverflow.com/q/21890479
tags question: http://stackoverflow.com/q/21978514
tags question: http://stackoverflow.com/q/21984297
tags question: http://stackoverflow.com/q/21873906
tags question: http://stackoverflow.com/q/21851514
tags question: http://stackoverflow.com/q/21901118
tags question: http://stackoverflow.com/q/21891125
tags question: http://stackoverflow.com/q/21883014
tags question: http://stackoverflow.com/q/21887049
tags question: http://stackoverflow.com/q/21914116
tags question: http://stackoverflow.com/q/21953033
tags question: http://stackoverflow.com/q/22001529
tags question: http://stackoverflow.com/q/21929790
tags question: http://stackoverflow.com/q/21904761
tags question: http://stackoverflow.com/q/21998950
tags question: http://stackoverflow.com/q/21859595
tags question: http://stackoverflow.com/q/21988412
tags question: http://stackoverflow.com/q/21916191
tags question: http://stackoverflow.com/q/21922354
tags question: http://stackoverflow.com/q/21879426
tags question: http://stackoverflow.com/q/21955506
tags question: http://stackoverflow.com/q/22002712
tags question: http://stackoverflow.com/q/21846878
tags question: http://stackoverflow.com/q/21865266
tags question: http://stackoverflow.com/q/21992526
tags question: http://stackoverflow.com/q/21974737
tags question: http://stackoverflow.com/q/21931488
tags question: http://stackoverflow.com/q/21941823
tags question: http://stackoverflow.com/q/21905938
tags question: http://stackoverflow.com/q/21910023
tags question: http://stackoverflow.com/q/21973297
tags question: http://stackoverflow.com/q/21969843
tags question: http://stackoverflow.com/q/21855004
tags question: http://stackoverflow.com/q/21892390
tags question: http://stackoverflow.com/q/21907494
tags question: http://stackoverflow.com/q/21866297
tags question: http://stackoverflow.com/q/21941641
tags question: http://stackoverflow.com/q/21957595
tags question: http://stackoverflow.com/q/21863856
tags question: http://stackoverflow.com/q/21956042
tags question: http://stackoverflow.com/q/21925839
tags question: http://stackoverflow.com/q/21928960

http://stackoverflow.com/comment/33167292
score: 0
has text: Caused by: java.lang.NoClassDefFoundError: javax/ejb/EJBObject , Do you have jar file for that class? , It is complaining about need a class that is not in the classpath
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21901186

http://stackoverflow.com/comment/33289405
score: 0
comment on: http://stackoverflow.com/q/21969533
type: QuestionComment
type: Comment
has text: What are you trying to output? You should store the input in a variable of some kind and then call `toString()` for that.

http://stackoverflow.com/comment/33198334
score: 0
type: Comment
has text: When I call the servlet with apache Tomcat, it gives entity_id and attributename but after that throws an exception ... with isGet=null .....
type: AnswerComment
comment on: http://stackoverflow.com/a/21918358

google-app-engine
tags question: http://stackoverflow.com/q/21949020
tags question: http://stackoverflow.com/q/21869524
tags question: http://stackoverflow.com/q/21972914
tags question: http://stackoverflow.com/q/21926312
tag name: google-app-engine
tags question: http://stackoverflow.com/q/21998061
tags question: http://stackoverflow.com/q/21943726
tags question: http://stackoverflow.com/q/21951482
type: Tag
tags question: http://stackoverflow.com/q/21890423
tags question: http://stackoverflow.com/q/21850826
tags question: http://stackoverflow.com/q/21915793
tags question: http://stackoverflow.com/q/21969659
tags question: http://stackoverflow.com/q/21875013
tags question: http://stackoverflow.com/q/21940157
tags question: http://stackoverflow.com/q/21993834
tags question: http://stackoverflow.com/q/21964951
tags question: http://stackoverflow.com/q/21916156
tags question: http://stackoverflow.com/q/21912377
tags question: http://stackoverflow.com/q/21854358
tags question: http://stackoverflow.com/q/21882166
tags question: http://stackoverflow.com/q/21942039
tags question: http://stackoverflow.com/q/21927774
tags question: http://stackoverflow.com/q/21967641
tags question: http://stackoverflow.com/q/21914766
tags question: http://stackoverflow.com/q/21979688
tags question: http://stackoverflow.com/q/21976358
tags question: http://stackoverflow.com/q/21845301
tags question: http://stackoverflow.com/q/21952200
tags question: http://stackoverflow.com/q/21867404
tags question: http://stackoverflow.com/q/21869946
tags question: http://stackoverflow.com/q/21857257
tags question: http://stackoverflow.com/q/22002782
tags question: http://stackoverflow.com/q/21953465
tags question: http://stackoverflow.com/q/21926709
tags question: http://stackoverflow.com/q/21866881
tags question: http://stackoverflow.com/q/21991623

http://stackoverflow.com/a/21917014
has comment: http://stackoverflow.com/comment/33195469
has comment: http://stackoverflow.com/comment/33195495
downvote count: 0
type: Answer
upvote count: 3
has body: You should avoid using ordinals for your enum. Rather give a value to each enum constant, and have a field. So, your enum should look like: public enum TestEnum { h1("h1"), h2("h2"), h3("h3"), h4("h4"); private final String value; TestEnum(String value) { this.value = value; } public static TestEnum forValue(String value) { // You can cache the array returned by `values()` in the enum itself // Or build a map from `String` to `TestEnum` and use that here for (TestEnum val: values()) { if (val.value.equals(value)) { return val; } } } } And then for a given String, you can check if it's valid value or not like this: String value = "h1"; TestEnum enumValue = TestEnum.forValue(value); if (enumValue == null) { System.out.println("Invalid value"); }
score: 3
has comment: http://stackoverflow.com/comment/33195554
has comment: http://stackoverflow.com/comment/33195712
answers question: http://stackoverflow.com/q/21916812

http://stackoverflow.com/q/21965121
accepted answer: http://stackoverflow.com/a/21978217
has body: I'm using Andengine and Android Studio. I'm trying to create an Activity called MyBaseGameActivity which is abstract and extends from BaseGameActivity. My actual game extends from this abstract class. Inside the abstract class I'm loading a startScene and a gameOverScene, which all games I create should use. The reason for that is that startScene and gameOverScene should always look the same for every game. However when I try to run the app just nothing happens. The app gets installed, but when I click on the app icon it says "app not installed". When I try to start another testgame which directly extends BaseGameActivity everything just works fine. Did I miss to care about something when implementing MyBaseGameActivity?
type: Question
tagged with: java
tagged with: andengine
score: 0
has answer: http://stackoverflow.com/a/21978217
answer count: 1
has title: AndEngine abstract subclass - App not starting
tagged with: abstract
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/comment/33289777
type: QuestionComment
comment on: http://stackoverflow.com/q/21969231
score: 0
type: Comment
has text: I get the feeling you are heading in the wrong direction by using windbg here. If you believe the leak is in your Java code, a tool like [jhat](http://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-VM/html/memleaks.html#gbywe) or some other heap profiler makes more sense.

http://stackoverflow.com/comment/33380516
score: 0
type: Comment
type: QuestionComment
has text: If your intent is to learn to write good Java code, I suggest throwing this example away. It might be useful if you want to learn how to fix up bad code.
comment on: http://stackoverflow.com/q/22001041

http://stackoverflow.com/a/21976116
answers question: http://stackoverflow.com/q/21976000
upvote count: 3
has body: Anything that interacts or can change the UI in anyway MUST do so from within the context of the Event Dispatching Thread. Swing, by design, is not thread safe. That is, there are no checks in the default libraries to make determinations about what thread the various models and components are been executed on, it is assumed the developer will already have made these determinations. So question1- When is the best time to put my Gui on edt.When i create View? Immediately. You have no way of knowing when a component may become realised (displayed on the screen and/or attached to a native peer) question 2- Do i have to do updates from my controller like this?Each time? - No, in fact, I'd be very worried if I found myself coding like this all time. Make the determination that the models and components MUST be executed within the context of the EDT and make whatever is interacting with these models and components meet these requirements. This would mean, if you are loading data from a separate Thread, you would need to ensure that any time they update the model, they are synchronizing these updates to the EDT to ensure that if the model notifies the UI, it all occurs within the context of the EDT. Don't make assumptions about the state of the model, statements like "I know..." will come back to haunt you, especially when some one else makes use of your API. Unless you physically create the model yourself (outside the EDT) and guarantee it's isolation while it's being loaded, don't assume anything that is given to you isn't attached to the UI in some way. An easier solution is to use a SwingWorker when you want to perform operations off the EDT, as it provides this synchronisation via it's publish/process/done methods
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/33301401
downvote count: 0
has comment: http://stackoverflow.com/comment/33301421
accepted answer of: http://stackoverflow.com/q/21976000
score: 3

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/21947708
tags question: http://stackoverflow.com/q/21899463
tags question: http://stackoverflow.com/q/21960486
tags question: http://stackoverflow.com/q/21979741
tags question: http://stackoverflow.com/q/21854680
tags question: http://stackoverflow.com/q/21914583
tags question: http://stackoverflow.com/q/21872056
tags question: http://stackoverflow.com/q/21936750
tags question: http://stackoverflow.com/q/21996872
tags question: http://stackoverflow.com/q/21922333
tag name: jfreechart
tags question: http://stackoverflow.com/q/21912885
tags question: http://stackoverflow.com/q/21899054

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

http://stackoverflow.com/a/21947722
accepted answer of: http://stackoverflow.com/q/21947486
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21947486
type: Answer
score: 2
upvote count: 2
has body: The generic "archive" file terminology simply suggests a way to package all the required components into a single file that you submit. A "zip" file should be fine (there are other formats, "rar" etc.) You would probably be better off sending a short eMail to your instructor with your assumptions and ask if they are correct. ("I assume that a "zip" file with all the components, properly named, will satisfy your submittal requirements? If not, do you have another preference?")

http://stackoverflow.com/comment/33183708
comment on: http://stackoverflow.com/q/21910614
type: Comment
has text: Next time you have this question, first scan through [this list](http://en.wikipedia.org/wiki/Software_design_pattern#Classification_and_list).
score: 0
type: QuestionComment

http://stackoverflow.com/a/22639447
score: 0
answers question: http://stackoverflow.com/q/21970226
type: Answer
has body: If you want to keep the GridBagLayout i believe you need something like this: add(activateServer,new GridBagConstraints(0,0,1,1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0,0,0,0), 0,0)); add(addFiles,new GridBagConstraints(1,0,1,1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0,0,0,0), 0,0)); add(table,new GridBagConstraints(0,1,2,1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0,0)); if you are having problems using the creator of GridBagConstraints you should try using the easier way like in this example for more info try the oracle documentation

http://stackoverflow.com/q/21997745
score: 0
tagged with: file-io
has answer: http://stackoverflow.com/a/21997841
linked to: http://stackoverflow.com/q/7887078
tagged with: android
has answer: http://stackoverflow.com/a/21998420
has comment: http://stackoverflow.com/comment/33341966
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33339713
has comment: http://stackoverflow.com/comment/33340027
has comment: http://stackoverflow.com/comment/33340231
has comment: http://stackoverflow.com/comment/33340776
has comment: http://stackoverflow.com/comment/33340662
has body: I am trying to write a new wave file to the Ringtones folder on external storage. But unfortunately the file is not being created. I have followed the android docs on how to do this, and have implemented it the way it is suggested. I have also added the proper permissions in manifest. As well, I have checked that my device external storage is readable/writable. The following code writes the log statement "directory not created". As well, any subsequent calls to stream cause nullPointer. public WavFileOutStream(String fileName) { // Get the directory for the user's public pictures directory. File file = new File(Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_RINGTONES), fileName); if (!file.getParentFile().mkdirs()) { Log.e("trace", "Directory not created"); } try { stream = new DataOutputStream(new FileOutputStream(file)); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
tagged with: java
has title: Write file to external storage
has comment: http://stackoverflow.com/comment/33340648
has comment: http://stackoverflow.com/comment/33340449
type: Question
has comment: http://stackoverflow.com/comment/33340532
answer count: 2
has comment: http://stackoverflow.com/comment/33339892
has comment: http://stackoverflow.com/comment/33339864

http://stackoverflow.com/comment/33234507
has text: Change the `while` loop condition to `i <= number`
comment on: http://stackoverflow.com/q/21939224
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/122212518
type: Comment
has text: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-ask).
comment on: http://stackoverflow.com/a/69145500
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33206512
has text: @Jona I'd hardly call myself a computer scientist, may be a computer breaker ;)
score: 0
comment on: http://stackoverflow.com/q/21922855
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21848557
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21848667
accepted answer: http://stackoverflow.com/a/21848689
has answer: http://stackoverflow.com/a/21848667
tagged with: android
has body: I have a question about inserting default values in a SQLite db table in android. I have a DBHandler (obviously) which takes care of creating the db, the tables and executing CRUD queries. But what I can't seem to figure out, is how to insert default values in a table. First I tried inserting the default values in my DBHandler with the following method: // Write settings to db public void addSetting(String key, String value) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(SETTING_KEY, key); values.put(SETTING_VALUE, value); db.insert(TABLE_APP_SETTINGS, null, values); db.close(); } Which is called with the method onCreate() like this: @Override public void onCreate(SQLiteDatabase db) { // creating tables db.execSQL(DATABASE_CREATE); db.execSQL(CREATE_TABLE_SETTINGS); // insert default values this.addSetting("access_admin_fingers", "2"); } But for some reason, this caused the app to crash, giving me the following LogCat messages: 02-18 09:43:52.050: W/dalvikvm(14297): threadid=1: thread exiting with uncaught exception (group=0x41f3d930) 02-18 09:43:52.060: E/AndroidRuntime(14297): FATAL EXCEPTION: main 02-18 09:43:52.060: E/AndroidRuntime(14297): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.customerratingsystem/com.customerratingsystem.AdminActivity}: java.lang.IllegalStateException: getDatabase called recursively 02-18 09:43:52.060: E/AndroidRuntime(14297): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) 02-18 09:43:52.060: E/AndroidRuntime(14297): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 02-18 09:43:52.060: E/AndroidRuntime(14297): at android.app.ActivityThread.access$600(ActivityThread.java:141) 02-18 09:43:52.060: E/AndroidRuntime(14297): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 02-18 09:43:52.060: E/AndroidRuntime(14297): at android.os.Handler.dispatchMessage(Handler.java:99) 02-18 09:…
type: AnsweredQuestion
tagged with: java
tagged with: android-sqlite
type: Question
has title: How to insert default values in Android SQLite ?
has answer: http://stackoverflow.com/a/21848689

http://stackoverflow.com/a/21962179
answers question: http://stackoverflow.com/q/21961883
has body: First you want to loop the ArrayList starting with i = 2 or 2nd element(assuming you have more than 1 element in the list), if you have 1 or less than 1 element in then it simply skips the loop and returns 0 index(frst element). If the element of if you have more than 1 element in the list, then it compares the value in the 2nd element to the value element before it, if it is higher or the same,then it sets it as the highestIntIdx. public static int search(List list) { int highestIntIdx= 0; for (int i = 1;i&lt;list.size();i++){ if(list.isEmpty()) break; if (list.get(i) &gt;= list.get(i-1)){ highestIntIdx = i; } } return highestIntIdx; } }
score: 0
type: Answer

http://stackoverflow.com/comment/33190413
has text: Are your firstName and lastName variables being set correctly?
type: Comment
comment on: http://stackoverflow.com/q/21913955
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33352443
comment on: http://stackoverflow.com/q/22005007
type: Comment
type: QuestionComment
score: 1
has text: n-Sided Rubik's Cube program

http://stackoverflow.com/q/21852027
has comment: http://stackoverflow.com/comment/33078521
tagged with: variadic-functions
has body: Can any one tell the use of varargs method in java? And, I have requirement that in html there are too many fields so can we use vararg method for null validation, if possible please tell me how ?
has comment: http://stackoverflow.com/comment/33078694
has answer: http://stackoverflow.com/a/21852894
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33078701
tagged with: java
type: Question
score: 0
answer count: 2
has title: Can we use varargs for null validation in Java?
possible better answer: http://stackoverflow.com/a/21852894
has answer: http://stackoverflow.com/a/21852241
accepted answer: http://stackoverflow.com/a/21852241

http://stackoverflow.com/a/21982119
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33311841
has body: The problem is when you create an instace of a fragment, it is not attached to the activity yet. So drawing a tab before onAttach method will cause a NPE error. Try to do something below: public class StartActivity extends Fragment { // TODO: add your other/current fields here boolean mDrawTabWhileInitializing = false; public StartActivity(boolean drawTabWhileInitializing) { mDrawTabWhileInitializing = drawTabWhileInitializing; } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.main, container, false); if(mDrawTabWhileInitializing) { drawTab(); } return rootView; } // TODO: add your other/current methods here } Use the boolean flag while initializing your fragment: private void selectItem(int position) { Toast.makeText(getBaseContext(), Integer.toString(position), 1).show(); Fragment fragment1 = null; switch (position) { case 1: fragment1 = new StartActivity(true); FragmentManager fragmentManager1 = getFragmentManager(); fragmentManager1.beginTransaction().replace(R.id.content_frame, fragment1).commit(); break; default: break; } } Note: Just an advice, the name of a fragment is annoying. Why don't you name it StartFragment?
answers question: http://stackoverflow.com/q/21982077
has comment: http://stackoverflow.com/comment/33312355
has comment: http://stackoverflow.com/comment/33324474
has comment: http://stackoverflow.com/comment/33312230
has comment: http://stackoverflow.com/comment/33314161
downvote count: 0
has comment: http://stackoverflow.com/comment/33312179
type: Answer
has comment: http://stackoverflow.com/comment/33312845

http://stackoverflow.com/comment/33270887
comment on: http://stackoverflow.com/a/21958973
score: 0
type: Comment
has text: Right I'll just use CallerRunsPolicy, somewhat simpler.
type: AnswerComment

http://stackoverflow.com/comment/33236507
type: Comment
score: 0
has text: No, I dont know if that helps me
comment on: http://stackoverflow.com/q/21936789
type: QuestionComment

http://stackoverflow.com/a/21964522
has body: The error is because your Spring XML file does not reference the Camel schema, so it does not understand what camelContext is. As per the Camel Spring documentation you need add Camel to the schemaLocation list and either create a camel namespace prefix or explicitly mention it. Step 1: Update beans &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"&gt; Step 2: Use &lt;camel:camelContext&gt; instead of &lt;camelContext&gt;
has comment: http://stackoverflow.com/comment/33281023
has comment: http://stackoverflow.com/comment/33281033
has comment: http://stackoverflow.com/comment/33280848
downvote count: 0
answers question: http://stackoverflow.com/q/21964254
has comment: http://stackoverflow.com/comment/33280858
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/33282401
has comment: http://stackoverflow.com/comment/33280883
has comment: http://stackoverflow.com/comment/33282396
upvote count: 1
has comment: http://stackoverflow.com/comment/33280782
has comment: http://stackoverflow.com/comment/33280759
has comment: http://stackoverflow.com/comment/33280750
has comment: http://stackoverflow.com/comment/33280596

http://stackoverflow.com/comment/33226977
type: Comment
type: QuestionComment
has text: the only thing that comes to mind for me is that the File constructor doesnt like your path... can you check what the path-variable actually contains here?
comment on: http://stackoverflow.com/q/21934994
score: 0

http://stackoverflow.com/q/21892723
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/33233338
has comment: http://stackoverflow.com/comment/33152583
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/33152566
has title: Http 404 error is getting when static page is deployed
score: 0
type: UnansweredQuestion
has body: I created a web project using Eclipse. I added one html page index.html inside the WebContent folder. I deployed the project using tomcat 7. When try to run on the server it is giving 404 resource not found error index.html: Simple Servlet ` Hey I am creating simple HTML Page!
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/21894271

http://stackoverflow.com/q/21933981
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
tagged with: android
has answer: http://stackoverflow.com/a/21934163
score: 2
type: AnsweredQuestion
tagged with: rfcomm
has title: Android to PC RFCOMM Channel
tagged with: java
accepted answer: http://stackoverflow.com/a/21934163
type: Question
tagged with: spp
tagged with: bluetooth
has body: So im working an an App that directly connect via Bluetooth to accept String commands from an RFCOMM channel and send responses. So those are the 2 Classes i am currently working with Bluetooth_Manager import android.bluetooth.*; import android.content.Intent; public class Reader_BluetoothManager { protected Reader_MainScreen main; protected BluetoothAdapter bAdapter; private Reader_AcceptThread bAccept; public Reader_BluetoothManager(Reader_MainScreen main) { this.main = main; initiate(); } public void initiate(){ checkForBluetooth(); enableBluetooth(); } public void log(String l){ main.log(l); } public void checkForBluetooth(){ bAdapter = BluetoothAdapter.getDefaultAdapter(); if (bAdapter == null) { main.log("No Bluetooth supported!"); return; } main.log("Bluetooth supported..."); } public void enableBluetooth(){ if (!bAdapter.isEnabled()) { main.log("Bluetooth not enabled... requesting activation"); Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); main.startActivityForResult(enableBtIntent, main.BLUETOOTH_ENABLE_CODE); } } public void enableConnection(){ main.log("Connecting..."); if (bAccept != null) bAccept.interrupt(); bAccept = new Reader_AcceptThread(this); bAccept.start(); } public void stopConnection(){ if (bAccept != null) bAccept.interrupt(); } } And AcceptThread import java.io.IOException; import java.util.UUID; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothServerSocket; import android.bluetooth.BluetoothSocket; public class Reader_AcceptThread extends Thread{ private BluetoothServerSocket serverSocket; private BluetoothSocket socket; private BluetoothDevice device; private Reader_BluetoothManager main; public Reader_AcceptThread(Reader_BluetoothManager main) { this.main = main; } public void run(){ try { serverSocket = main.bAdapter.listenUsingRfcommWithServiceRecord("XXXXXX", UUID.fromString("00001101-0000-1000-8000-00805F9B34FB")); main.log("checkPoint 1"); socket = serverSocket.accept(); main.…

http://stackoverflow.com/q/21996776
score: -1
has title: Free SMS library on java
downvote count: 2
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/33338489
favorite count: 0
has answer: http://stackoverflow.com/a/21997274
tagged with: sms
type: UnansweredQuestion
tagged with: web-services
type: Question
has body: Does anyone know of a java API that I could download in order to send a free SMS to a mobile number ? If non could be found, is there a Web Service I could connect to that would do the job ? The things is that I want to send a pin code to a user's phone in order to complete his/her registration for my mobile application, exactly how whatsapp does it (Insert phone number, receive SMS with unique pincode), but I am not yet willing to pay for an SMS service like simple wire during the development phase. Thanks.
tagged with: java

http://stackoverflow.com/q/21868243
favorite count: 0
has body: For this assignment, I need to accept a lock combination and check if: It is 9 chars long At position 2,8 the char is R or r At position 5 the char is l or L All of the other positions are integers 0-9 I am wondering if there is a better way to do this than checking each position for a digit? Scanner input = new Scanner(System.in); String lockComb; System.out.print("Please enter a lock combination ( ddRddLddR ): "); lockComb = input.nextLine(); if((lockComb.length() == 9) &amp;&amp; ((lockComb.charAt(2) == 'r') || (lockComb.charAt(2) == 'R')) &amp;&amp; ((lockComb.charAt(5) == 'l') || (lockComb.charAt(5) == 'L')) &amp;&amp; ((lockComb.charAt(8) == 'r') || (lockComb.charAt(8) == 'R'))) { if((Character.isDigit(lockComb.charAt(0))) &amp;&amp; (Character.isDigit(lockComb.charAt(1))) &amp;&amp; (Character.isDigit(lockComb.charAt(3)) &amp;&amp; (Character.isDigit(lockComb.charAt(4))) &amp;&amp; (Character.isDigit(lockComb.charAt(6))) &amp;&amp; (Character.isDigit(lockComb.charAt(7))))) { System.out.println(lockComb + " is a valid lock combination!"); } else { System.out.println(lockComb + " is not a valid lock combination!"); } } else { System.out.println(lockComb + " is not a valid lock combination!"); }
has answer: http://stackoverflow.com/a/21868552
possible better answer: http://stackoverflow.com/a/21868552
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33108725
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21868295
has comment: http://stackoverflow.com/comment/33108730
has comment: http://stackoverflow.com/comment/33108743
has title: Is there a more efficient way to check characters in a string?
has comment: http://stackoverflow.com/comment/33108727
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21868295

http://stackoverflow.com/comment/33090997
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21854961
has text: You can reorder them *temporally*, but not *causally*. In other words, the reordering is not perceivable by the current thread. You can reorder those because there is no hb-edge going from either of them directly to an action by another thread. They both, as a unit, happen before the monitor-release action, which happens before the monitor acquire action.
score: 0

fullscreen
tags question: http://stackoverflow.com/q/21979631
type: Tag
tag name: fullscreen
tags question: http://stackoverflow.com/q/21991845

http://stackoverflow.com/comment/33342073
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21998786
type: AnswerComment
has text: Thank u for your answer....it is useful..!!Keep helping sir.

http://stackoverflow.com/comment/33115839
type: Comment
comment on: http://stackoverflow.com/a/21871923
score: 0
type: AnswerComment
has text: it is doubly linked yes so i don't know whats happening

http://stackoverflow.com/comment/33159850
has text: @user3326710 but your `while` loops are not going to be executed even once, because your `InputTemp` is zero initially
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21896566

http://stackoverflow.com/a/73789023
score: 0
has body: Split the head of the for loop into multiple lines for (int i = numbers.indexOf(number), j = -1; i > j; j = i, i += numbers.subList(i + 1, numbers.size()).indexOf(number) + 1) { System.out.println("found number: " + number + " at position: " + i); }
type: Answer
answers question: http://stackoverflow.com/q/21940873

http://stackoverflow.com/q/21890216
tagged with: java
has answer: http://stackoverflow.com/a/21890374
type: Question
has comment: http://stackoverflow.com/comment/33148043
has comment: http://stackoverflow.com/comment/33148461
has comment: http://stackoverflow.com/comment/33148166
tagged with: memory
has comment: http://stackoverflow.com/comment/33148208
tagged with: servlets
has comment: http://stackoverflow.com/comment/33593779
has comment: http://stackoverflow.com/comment/33147897
has comment: http://stackoverflow.com/comment/33147899
has comment: http://stackoverflow.com/comment/33148024
has title: Java VS RAM: How much data Java can handle without 'OutOfMemory'?
favorite count: 0
has answer: http://stackoverflow.com/a/21890268
tagged with: out-of-memory
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/21890658
has body: We all have beaten with the error of OutOfMemory. It occurs if we store more characters than the String limit, if we exceed the StringBuffer limit, if we exceed the ArrayList limit and so on. There is a large list. But it is worth noting that world's biggest Big Data projects are built with Java, including Amazon. So I have a question. Can Java store a 70 MB file in memory? This file contains text, and each single line of this file will be saved as an element in a LinkedList. So, if the file got 200,000 lines, the the LinkedList will have 200,000 elements. Imagine I have a RAM of 4-5 GB. Can Java handle something like this, without throwing OutOfMemory? I do not want to manually adjust the heap size anyway. What is your advice? Update Don't target to 70MB. Imagine in future, this fill be 300GB. I have a RAM of 500 GB (Yes, I am in a big data project, RAM is bigger than this anyway). Now what?
answer count: 4
downvote count: 6
has answer: http://stackoverflow.com/a/21890284
has comment: http://stackoverflow.com/comment/33148566
has comment: http://stackoverflow.com/comment/33148125
tagged with: memory-management
has comment: http://stackoverflow.com/comment/33148278
upvote count: 3

http://stackoverflow.com/a/21953205
accepted answer of: http://stackoverflow.com/q/21953122
score: 0
type: AcceptedAnswer
has body: I have given a basic example similar to your problem go through it you will get your answer. This is the concept of runtime polymorphism Inheritance creates typecompatibility. It allows a super class reference to refer to the object of sub class. (Reverse is not true). A super class reference, that refers to object of sub class, can only be used to access the inherited and overrridden methods of sub class. The members newly defined in sub class are not accessible using reference of super class. class A { void f1()//this holds address of object of B { System.out.println("A f1"); } void f2() { System.out.println("A f2"); } }//A class B extends A { void f3()//new method { System.out.println("B f3"); } void f2()//this holds address of object of B { System.out.println("B f2 starts"); f3(); //this.f3() System.out.println("B f2 ends "); } }//B class TypeCmptbl { public static void main(String args[]) { A ref; //reference of A ref = new B();//Object of B //ref.inherited() allowed ref.f1(); //ref.overridden() allowed ref.f2(); //ref.newMembersOfChild() not allowed //ref.f3(); }//main } Consider the statement ref.f2(); Here ref is a reference of class A and it has address of object of class B f2() is a overridden method. When compiler detects such a statement then it doesn't bind the function call with any definition. It only validates the call. Binding of such calls is left for the runtime environment. At program runtime system identifies the datatype of the object and binds the function call with the function definition provided by the class of object. This type of binding between the function call and function definition is called as "runtime polymorphism" .
type: Answer
answers question: http://stackoverflow.com/q/21953122

http://stackoverflow.com/a/21856902
type: Answer
has comment: http://stackoverflow.com/comment/33087429
has comment: http://stackoverflow.com/comment/33087322
score: 0
has comment: http://stackoverflow.com/comment/33087300
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/21856860
has body: Change the while-condition to hasNext() and use next() inside of the loop to move the database cursor forward.

http://stackoverflow.com/q/21931113
tagged with: excel
type: Question
has answer: http://stackoverflow.com/a/26462467
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/40528442
has comment: http://stackoverflow.com/comment/33219961
has comment: http://stackoverflow.com/comment/33219919
has title: Exporting Jtable into the Excelsheet using HSSFWorkbook
tagged with: java
tagged with: poi-hssf
accepted answer: http://stackoverflow.com/a/21931689
tagged with: export
has comment: http://stackoverflow.com/comment/33220017
downvote count: 0
has answer: http://stackoverflow.com/a/21931201
has answer: http://stackoverflow.com/a/40576063
favorite count: 0
answer count: 5
has body: Hello I am trying to Export Jtable Data into the Excel Sheet using HSSFWorkbook. and i am getting all the content what Table have but i am not getting Table Headers please can anyone help for the same. Here the Command used for Taking content of the Jtable. try { HSSFWorkbook fWorkbook = new HSSFWorkbook(); HSSFSheet fSheet = fWorkbook.createSheet("new Sheet"); HSSFFont sheetTitleFont = fWorkbook.createFont(); File file = new File("/home/kishan/NetBeansProjects/JavaChecking/src/com/verve/SwingChecking/book.xls"); HSSFCellStyle cellStyle = fWorkbook.createCellStyle(); sheetTitleFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); //sheetTitleFont.setColor(); TableModel model = jTable1.getModel(); for (int i = 0; i &lt; model.getRowCount(); i++) { HSSFRow fRow = fSheet.createRow((short) i); for (int j = 0; j &lt; model.getColumnCount(); j++) { HSSFCell cell = fRow.createCell((short) j); cell.setCellValue(model.getValueAt(i, j).toString()); cell.setCellStyle(cellStyle); } } FileOutputStream fileOutputStream; fileOutputStream = new FileOutputStream(file); BufferedOutputStream bos = new BufferedOutputStream(fileOutputStream); fWorkbook.write(bos); bos.close(); fileOutputStream.close(); }catch(Exception e){ } for (int i = 0; i &lt; model.getColumnCount(); i++) { HSSFRow fRow = fSheet.createRow((short) i); for(int j = 0; j &lt; model.getColumnCount(); j++) { HSSFCell cell = fRow.createCell((short) j); cell.setCellValue(model.getValueAt(i, j).toString()); System.out.println(model.getColumnName(j)); } } last for loop is not addind data of table header. and i am getting this excel file how to get Table header along with that??
has comment: http://stackoverflow.com/comment/33219968
has answer: http://stackoverflow.com/a/21931689
has answer: http://stackoverflow.com/a/40528442
upvote count: 3
tagged with: swing

http://stackoverflow.com/comment/33297232
score: 0
type: Comment
has text: @AnotherCompilerError Have a closer look, that's different ;-)
comment on: http://stackoverflow.com/a/21973938
type: AnswerComment

http://stackoverflow.com/comment/33345919
type: QuestionComment
has text: In your Main() Methode after devide Square. Make frame global (jFrame frame = null;) that you can use it evereythere.
comment on: http://stackoverflow.com/q/21995995
score: 0
type: Comment

http://stackoverflow.com/comment/33373875
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22000983
type: AnswerComment
has text: It is possible that the data type can change from a double to int to bool to custom class all within the same execution (the fun of the evolutionary algorithm is that what happens is anybody's guess). I definitely don't want to overcomplicate it if I don't have to however.

http://stackoverflow.com/comment/33283147
has text: @christopher I am pretty sure that BitSet uses long's to store the values of the bits and not booleans.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21965833
score: 0

http://stackoverflow.com/comment/33159532
type: QuestionComment
comment on: http://stackoverflow.com/q/21896301
score: 0
type: Comment
has text: take a look at my answer : )

http://stackoverflow.com/q/21989440
tagged with: http://stackoverflow.com/tag/json
type: Question
tagged with: jersey
has body: I have designed the needed REST Service with JERSEY 1.5, using declared interface like: @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public IMyDTO doIt(ICustomer customer) { return MySupport.createDTO(customer); } If i trying to call this service, using JERSEY 1.5 Client API, the following error occured: Can not construct instance of test.ICustomer, problem: abstract types either need to be mapped to concrete types, have custom deserializer, or be instantiated with additional type information Currently i specify such parameter by client: ClientConfig clientConfig = new DefaultClientConfig(); clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE); Client client = Client.create(clientConfig); WebResource webResource = client.resource(restResource); ClientResponse response = webResource.path(restResourcePath) .type(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON) .post(ClientResponse.class, customer); if (response != null) { if (response.hasEntity()) { result = response.getEntity(IMytDTO.class); } .... . The ICustomer and IMyDTO are java interfaces without any jackson annotation. The implementations have no jackson annotations too. My Question: how to (de) serialize the objects , if REST Service (Client) are used? I would not change the java interfaces and use the implementations on service and client side...
score: 0
linked to: http://stackoverflow.com/q/12883287
answer count: 1
tagged with: rest
type: UnansweredQuestion
has title: REST with Jersey 1.x using interfaces. How to
has answer: http://stackoverflow.com/a/21989528
tagged with: java

http://stackoverflow.com/a/21960890
has comment: http://stackoverflow.com/comment/33274383
has comment: http://stackoverflow.com/comment/33274735
has comment: http://stackoverflow.com/comment/33274206
upvote count: 3
has comment: http://stackoverflow.com/comment/33274534
answers question: http://stackoverflow.com/q/21960861
score: 3
has comment: http://stackoverflow.com/comment/33274700
has comment: http://stackoverflow.com/comment/33274163
has comment: http://stackoverflow.com/comment/33274366
has body: This is the problem: if (arr[Arraylength] &gt; tmp) Valid array indexes go from 0 to length-1 inclusive. array[array.length] is always invalid, and on the initial call, ArrayLength is equal to arr.length. It's not clear why you're using recursion at all, to be honest. An iterative solution would be much simpler - but you'll need to work out what you want to do if the array is empty. EDIT: If you really want how I would write the recursive form, it would be something like this: /** Returns the maximum value in the array. */ private static int maximum(int[] array) { if (array.length == 0) { // You need to decide what to do here... throw an exception, // return some constant, whatever. } // Okay, so the length will definitely be at least 1... return maximumRecursive(array, array.length); } /** Returns the maximum value in array in the range [0, upperBoundExclusive) */ private static int maximumRecursive(int[] array, int upperBoundExclusive) { // We know that upperBoundExclusive cannot be lower than 1, due to the // way that this is called. You could add a precondition if you really // wanted. if (upperBoundExclusive == 1) { return array[0]; } int earlierMax = maximumRecursive(array, upperBoundExclusive - 1); int topValue = array[upperBoundExclusive - 1]; return Math.max(topValue, earlierMax); // Or if you don't want to use Math.max // return earlierMax &gt; topValue ? earlierMax : topValue; }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21960861
has comment: http://stackoverflow.com/comment/33274576
type: Answer

http://stackoverflow.com/q/21928009
has answer: http://stackoverflow.com/a/21928200
has comment: http://stackoverflow.com/comment/33214788
tagged with: oracle-database
favorite count: 0
has body: Question 2: What is wrong with the following interface? public interface SomethingIsWrong { void aMethod(int aValue) { System.out.println("Hi Mom"); } } Answer 2: It has a method implementation in it. Only default and static methods have implementations(I THINK THIS IS WRONG BECAUSE INTERFACE CANNOT HAVE METHODS WITH BODY BECAUSE BY DEFAULT ITS METHODS ARE ABSTRACT). Question 3: Fix the interface in Question 2. Answer 3: public interface SomethingIsWrong { void aMethod(int aValue); } Alternatively, you can define aMethod as a default method: public interface SomethingIsWrong { default void aMethod(int aValue) { System.out.println("Hi Mom"); } } I found this in docs.oracle.com and I wonder that are these the correct answers provided by ORACLE? in my opinion. 1.In answer 2,it is written that Only default and static methods have implementations? 2.In answer 3 alternative ,its given that aMethod can be defined as default Method but interface cannot have methood body in it because by default methods in interface are abstract we can only implement its method in its subclass. Please let me know is ORACLE site right or wrong?
upvote count: 3
type: UnansweredQuestion
score: -3
tagged with: java-8
has comment: http://stackoverflow.com/comment/33214552
downvote count: 6
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33214567
has answer: http://stackoverflow.com/a/21928129
has title: Default method in java 8

android-spinner
tags question: http://stackoverflow.com/q/21999170
tags question: http://stackoverflow.com/q/21859410
tags question: http://stackoverflow.com/q/21854677
type: Tag
tag name: android-spinner

http://stackoverflow.com/comment/33340662
has text: do you have write permission in the manifest?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21997745

http://stackoverflow.com/q/21909943
tagged with: java
has body: I want my main activity to show a popup the on launch, this activity is the first activity that is created, but multiple instances of this activity could be created and I only want the first since launch to display this popup, so I would like to know if there how I can check this.
answer count: 3
upvote count: 1
accepted answer: http://stackoverflow.com/a/21910526
has comment: http://stackoverflow.com/comment/33182656
has comment: http://stackoverflow.com/comment/33182548
has comment: http://stackoverflow.com/comment/33183262
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: android-activity
has title: check if activity is the first since launch
favorite count: 0
has comment: http://stackoverflow.com/comment/33182887
has answer: http://stackoverflow.com/a/21910407
type: Question
has comment: http://stackoverflow.com/comment/33182491
tagged with: android
possible better answer: http://stackoverflow.com/a/21910146
has answer: http://stackoverflow.com/a/21910526
has answer: http://stackoverflow.com/a/21910146
has comment: http://stackoverflow.com/comment/33182514

http://stackoverflow.com/q/21924999
has comment: http://stackoverflow.com/comment/33209570
has comment: http://stackoverflow.com/comment/33209655
answer count: 1
accepted answer: http://stackoverflow.com/a/21970379
has comment: http://stackoverflow.com/comment/33209523
has comment: http://stackoverflow.com/comment/33209614
tagged with: turtle-graphics
has comment: http://stackoverflow.com/comment/33209525
has title: draw rectangle in java beginner
has comment: http://stackoverflow.com/comment/33209779
has comment: http://stackoverflow.com/comment/33209717
has body: I'm trying to modify a current method for drawing a square: length = 100; int index = 1; while (index &lt;= 4) { tParam.forward(length); tParam.turn(90); index++; } Basically can't figure out what to change tParam.turn(); to. Help?
has comment: http://stackoverflow.com/comment/33209543
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33209546
has comment: http://stackoverflow.com/comment/33209556
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21970379
type: Question
has comment: http://stackoverflow.com/comment/33209552
has comment: http://stackoverflow.com/comment/33209522
has comment: http://stackoverflow.com/comment/33209591
has comment: http://stackoverflow.com/comment/33209586

http://stackoverflow.com/q/21969505
downvote count: 0
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/33289478
has answer: http://stackoverflow.com/a/21969748
has answer: http://stackoverflow.com/a/21970063
tagged with: lwjgl
has body: I have a problem with my .obj-file reader. The .obj-File looks like the following: # Blender3D v249 OBJ File: untitled.blend # www.blender3d.org mtllib cube.mtl v 1.000000 -1.000000 -1.000000 v 1.000000 -1.000000 1.000000 v -1.000000 -1.000000 1.000000 v -1.000000 -1.000000 -1.000000 v 1.000000 1.000000 -1.000000 v 0.999999 1.000000 1.000001 v -1.000000 1.000000 1.000000 v -1.000000 1.000000 -1.000000 vt 0.748573 0.750412 vt 0.749279 0.501284 vt 0.999110 0.501077 vt 0.999455 0.750380 vt 0.250471 0.500702 vt 0.249682 0.749677 vt 0.001085 0.750380 vt 0.001517 0.499994 vt 0.499422 0.500239 vt 0.500149 0.750166 vt 0.748355 0.998230 vt 0.500193 0.998728 vt 0.498993 0.250415 vt 0.748953 0.250920 vn 0.000000 0.000000 -1.000000 vn -1.000000 -0.000000 -0.000000 vn -0.000000 -0.000000 1.000000 vn -0.000001 0.000000 1.000000 vn 1.000000 -0.000000 0.000000 vn 1.000000 0.000000 0.000001 vn 0.000000 1.000000 -0.000000 vn -0.000000 -1.000000 0.000000 usemtl Material_ray.png s off f 5/1/1 1/2/1 4/3/1 f 5/1/1 4/3/1 8/4/1 f 3/5/2 7/6/2 8/7/2 f 3/5/2 8/7/2 4/8/2 f 2/9/3 6/10/3 3/5/3 f 6/10/4 7/6/4 3/5/4 f 1/2/5 5/1/5 2/9/5 f 5/1/6 6/10/6 2/9/6 f 5/1/7 8/11/7 6/10/7 f 8/11/7 7/12/7 6/10/7 f 1/2/8 2/9/8 3/13/8 f 1/2/8 3/13/8 4/14/8 Model-Loader-Class: package com.crystalcode.lwjgl; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import org.lwjgl.util.vector.Vector3f; public class Model { private ArrayList &lt;Vector3f&gt; vertexList; private ArrayList &lt;Vector3f&gt; textureList; private ArrayList &lt;Vector3f&gt; normalList; public Model(String obj) { vertexList = new ArrayList&lt;&gt;(); textureList = new ArrayList&lt;&gt;(); normalList = new ArrayList&lt;&gt;(); try { BufferedReader bufferedReader = new BufferedReader(new FileReader(obj)); String line = ""; while ((line = bufferedReader.readLine()) != null) { if (line.startsWith("f ")) { // Split the line String[] values = line.sp…
answer count: 2
upvote count: 1
tagged with: opengl
tagged with: java
type: UnansweredQuestion
has title: Read .obj file in LWJGL not loaded correctly

http://stackoverflow.com/comment/33098334
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21857206
has text: Decided to make the whole activity full-screen, which is ok for my purposes. Thanks.
score: 0

http://stackoverflow.com/q/21925092
answer count: 1
has answer: http://stackoverflow.com/a/21925124
has comment: http://stackoverflow.com/comment/33209701
tagged with: java
has comment: http://stackoverflow.com/comment/33209726
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33209707
accepted answer: http://stackoverflow.com/a/21925124
favorite count: 0
has title: A regular expression to match the same letter one or more times
type: Question
tagged with: regex
score: -2
downvote count: 3
has body: I need a regular expression that matches a string made of a single letter repeated one or more times. For instance the regular expression must match: a b bb aa cccc ddddd But must not match ab bbc ddddddddde ac cde art. I am using Java.
upvote count: 1

http://stackoverflow.com/q/21937377
upvote count: 3
has answer: http://stackoverflow.com/a/21937477
accepted answer: http://stackoverflow.com/a/21937477
has answer: http://stackoverflow.com/a/21937750
possible better answer: http://stackoverflow.com/a/21937403
type: Question
score: 3
has title: Regex Extract Lat and Long from GPGGA String
tagged with: java
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21937403
tagged with: regex
answer count: 4
has body: I have a GPS logger outputting GPGGA Strings, for example $GPGGA,1714.0,3723.465874,N,12202.26954,W,2,6,1.2,18.893,M,-25.669,M,2.0,0031*4F The string is comma delimited. Working in Java, I am trying to extract the location information. Could someone help me with the required Regex statements 3723.465874 Between the 2nd and 3rd comma N Between the 3rd and 4th comma 12202.26954 Between the 4th and 5th comma W Between the 5th and 6th comma Or, perhaps just one example, so I can infer the others. Thank you.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21937594

http://stackoverflow.com/a/21953020
type: Answer
answers question: http://stackoverflow.com/q/21952117
has comment: http://stackoverflow.com/comment/33263461
has comment: http://stackoverflow.com/comment/33259737
has body: Efficiency is important to me for this program. That may be so. However, the chances are that the efficiency of the argument parsing is not significant. It happens only once during the execution of the program. Unless it is exceedingly complicated (or very poorly designed) the parsing probably takes much less time than the time taken to bootstrap the JVM, load your application and various other "warmup" overheads. JVM-based applications, simply don't launch quickly. So I'm going to suggest that put off trying to make the command argument parsing / processing until you have the rest of your application coded, tested and running. Then do the following: Benchmark the application runs doing a typical task. If it is "fast enough" then you are done. Profile the application using a CPU performance profiler to work out the performance hotspots where "most" of the time goes. Identify a potential optimization for one of the biggest hotspots, and code it and test it, and then rerun your benchmark to see if you have actually improved performance. Repeat from step 2 ... until you run out of worthwhile hotspots and potential optimizations. I expect that you will find that despite your intuition, your argument processing never makes it onto "the front page" of performance hotspots. That means that the payoff for optimizing that code won't be large enough to justify the effort. The other thing is that what you seem to be doing is some kind of natural language processing. If you are doing language processing "for real" (as distinct to something simple and heuristic), then this is a really difficult and technical area. You would be better off looking for an existing library and using that ... and relying on the library implementors to deal with efficiency concerns.
score: 0

http://stackoverflow.com/comment/33325399
comment on: http://stackoverflow.com/a/21990181
type: AnswerComment
score: 0
type: Comment
has text: Should i get office 64 bit or jdk 32 bit...(jdk is 64 bit)

http://stackoverflow.com/a/21904903
has comment: http://stackoverflow.com/comment/33176989
score: 1
answers question: http://stackoverflow.com/q/21904662
has body: You can't directly convert the InputStream to String. This might be the issue. String str = inStream.toString(); Take a look at this to identify the way of converting the InputStream to String.
downvote count: 0
has comment: http://stackoverflow.com/comment/33191945
has comment: http://stackoverflow.com/comment/33174327
type: Answer
upvote count: 1

http://stackoverflow.com/q/21902859
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21903262
type: AnsweredQuestion
has title: How to make window to be able to be thin in SWT?
upvote count: 3
tagged with: java
tagged with: swt
type: Question
accepted answer: http://stackoverflow.com/a/21903262
has body: Why doesn't the following application allow me to make window very thin? The minimal width allows to layout 3 columns of images while I wish to make one-column-wide possible. How to allow narrowing more? package tests; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; public class TryRowLayout { public static void main(String[] args) { RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL); rowLayout.wrap = true; Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); shell.setMinimumSize(1, 1); //shell.setLayout(rowLayout); Composite composite = new Composite(shell, SWT.NONE); composite.setLayout(rowLayout); Image image = new Image(display, "images/alt_window_32.gif"); Label label; for(int i=0; i&lt;100; ++i) { //label = new Label(shell, SWT.NONE); label = new Label(composite, SWT.NONE); label.setImage(image); } shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } } }
score: 3

http://stackoverflow.com/a/21938581
has body: Use Point2D.Double, which is exactly meant to store 2 doubles in a Point object. You can keep multiple points in an ArrayList, as you are now. To check whether a point already exists, you'd just loop through it and call .equals(newPoint) to compare the points. However, as double precision points might not ever equal each other, you probably want to check whether two points are within a certain small distance from each other (again, with equals() for example).
downvote count: 0
has comment: http://stackoverflow.com/comment/33233748
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21938141
has comment: http://stackoverflow.com/comment/33233673
type: Answer

static-methods
tags question: http://stackoverflow.com/q/21940162
tags question: http://stackoverflow.com/q/21952648
tags question: http://stackoverflow.com/q/21927132
tag name: static-methods
tags question: http://stackoverflow.com/q/21920715
type: Tag

http://stackoverflow.com/q/21984208
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21984397
type: Question
has title: java - Drawing multiple diagonal lines on a BufferedImage
has answer: http://stackoverflow.com/a/21984300
has body: im trying to draw multiple diagonal lines across the whole image (leaving a space between them) i've used this code to draw horizontal and vertical lines: for (int z = 1; z &lt; partToCrop; z++) { Shape hLines = new Line2D.Float(0, cropInPartWidth*z, chunkWidth, cropInPartWidth*z); Shape vLines = new Line2D.Float(cropInPartHeight*z, 0, cropInPartHeight*z, chunkHeight); gr.draw(hLines); //gr is a BufferedImage gr.draw(vLines); } where int partToCrop = 5; float cropInPartWidth = imgWidth / partToCrop; float cropInPartHeight = imgHeight / partToCrop; and works good. Now i need to draw multiple diagonal lines (i.e 4 diagonal lines) with 45° and -45° degrees of inclination across the whole image, hope you will help me. Thanks.
tagged with: image
tagged with: draw

http://stackoverflow.com/comment/33325793
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21990405
has text: So you want to create a geocoordinates on the 1-mile circle around the user? Why?
score: 0

http://stackoverflow.com/q/21954314
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21954578
score: 2
has title: Hibernate: java.lang.StackOverflowError while trying to persist an object graph
tagged with: java
tagged with: hibernate
has body: I'm stuck while trying to persist a many-to-one relationship in the database. My approach seems logic to me, but hibernate hits my face with a java.lang.StackOverflowError. Let me illustrate the starting situation: Account and Person records have already been persisted in the databse, however Account and Person still have to be linked together through a statement like account.setPerson(person); I tried the following code. Let me introduce you into the code step by step. Open a session: Session session = sessionFactory.openSession(); session.beginTransaction(); Query all accounts with a to_attribute. This attribute is used to link with a source attribute in person called from_attribute. These attributes are fetched from an xml config file and serve as a basis to define the foreign key relationship. List&lt;Account&gt; queried_accounts = HibernateUtils.queryList( session.createQuery("" + "select distinct acc from Account as acc" + " inner join acc.accountAttributes as accAtt" + " inner join accAtt.aa_pk.attribut as attr" + " where attr.name='" + to_attribute + "'") ); Query all persons List&lt;Person&gt; queried_persons = HibernateUtils.queryList(session.createQuery("from Person")); Link together all accounts with a matching person. A person matches, if the value in his from_attribute is equal to the value of the to_attribute in account. I suppose that this piece of code causes a StackOverflow, but im not sure why. First, i thought its due to the fact, that many objects are altered before session.getTransaction().commit(). But even session.flush() didn't do the trick. I know, this code isnt very smart. It causes "Amount of Account records" x "Amount of person records" read operations plus the same amount for equal checks. So, its a runtime complexity of O(n^2). Correct me, if im wrong. for (Account account : queried_accounts) { String account_to_attribut_wert = account.getAttributeValue(to_attribute); for (Person person : queried_persons) { if (person.getAttributeValu…
type: Question
tagged with: stack-overflow
answer count: 1

http://stackoverflow.com/comment/33134366
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21882004
has text: @user2763361 I have never tried :). Provided that you don't have duplicates, it should not be a problem.
score: 0

http://stackoverflow.com/comment/33234608
type: QuestionComment
comment on: http://stackoverflow.com/q/21939246
score: 5
has text: this has nothing to do with mockito. If you access the object through the "car" interface you cannot call any method without downcasting, let alone mock it...
type: Comment

http://stackoverflow.com/a/21884480
type: Answer
has body: The documentation you linked actually has the answer in the link associated with the "Java class located out of the source root." Configure your source and test roots and it should work. https://www.jetbrains.com/idea/webhelp/configuring-content-roots.html Since you stated that these are tests you should probably go with them marked as Test Source Root instead of Source Root.
has comment: http://stackoverflow.com/comment/33138723
downvote count: 3
upvote count: 76
accepted answer of: http://stackoverflow.com/q/21884217
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33147919
answers question: http://stackoverflow.com/q/21884217
score: 73

http://stackoverflow.com/comment/33249937
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21946216
score: 1
has text: Yes, but you are assuming Java 7, and you are getting a version for Java 6, so you are double likely to be in the wrong folder.

http://stackoverflow.com/comment/33327328
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21991192
has text: Possible duplicate of [Converting String to “Character” array in Java](http://stackoverflow.com/questions/10006165/converting-string-to-character-array-in-java)

http://stackoverflow.com/q/21889350
has answer: http://stackoverflow.com/a/21889403
has body: I have a class imagine Entity, Entity class wants to provide deserialize method this method accept a xml string and it will rebuild the object. which one looks better? 1- having a constructor which accept xmlString parameter and there deSerilaize Entity. 2- having a constructor without parameter and then call deserialize method with xmlString. 3- having a static method in Entity accept xmString as parameter and return a deserialized Entity as a function call. or any other solution?
type: Question
has title: what is good pattern to de serialize object?
tagged with: c#
answer count: 1
tagged with: serialization
type: UnansweredQuestion
tagged with: design-patterns
score: 0
tagged with: java

http://stackoverflow.com/comment/33239778
has text: That's an anonymous inner class. It's a class that implements or extends LocalConfig but the new class itself has no name.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21942126

http://stackoverflow.com/a/21894356
downvote count: 0
type: Answer
has body: No, there's no built-in traversal for something like this, and remember that Java Strings are immutable, so you can't actually trim in place--you have to trim and replace. Some objects may not permit modification of their String variables.
score: 10
answers question: http://stackoverflow.com/q/21894187
upvote count: 10

http://stackoverflow.com/comment/33113699
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21871092
has text: @ajb @ Christian howcome its printing out a negative answer and its printing it in a loop? im confused
type: AnswerComment

http://stackoverflow.com/comment/33064081
has text: It is not working, it is only repeating the word once rather than the three times I want
comment on: http://stackoverflow.com/q/21843250
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21996899
has body: I´m trying to process an image from a BroadcastReceiver on Android but my log display the following error: call to OpenGL ES API with no current context (logged once per thread). Any ideas. this is my code: public void processingImage(String image){ try { if(image != null){ bmp = convertBitmap(image); ByteArrayOutputStream stream = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.PNG, 100, stream); bitmaps.add(bmp); byteArray = stream.toByteArray(); } } catch (Exception e) { } } private Bitmap convertBitmap(String image) throws MalformedURLException, IOException{ Bitmap b = BitmapFactory.decodeStream((InputStream)new URL("http://mydomain.com/upload/" + image ).getContent()); return b; }
type: AnsweredQuestion
tagged with: bitmap
type: Question
linked to: http://stackoverflow.com/q/3383049
has answer: http://stackoverflow.com/a/21997189
accepted answer: http://stackoverflow.com/a/21997189
tagged with: java
has title: Processing image from a BroadcastReceiver on Android
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33338477
tagged with: android

http://stackoverflow.com/comment/33195359
comment on: http://stackoverflow.com/q/21916942
type: QuestionComment
has text: There is naming convention that variable shall start with lower case characters and classes with upper case. The code is then easier to read.
type: Comment
score: 1

http://stackoverflow.com/comment/33324695
type: Comment
has text: @farvilain Can you show us what your command object actually looks like? I don't think I understand what you want.
comment on: http://stackoverflow.com/a/21989794
type: AnswerComment
score: 0

http://stackoverflow.com/a/21936149
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 5
upvote count: 5
accepted answer of: http://stackoverflow.com/q/21936103
answers question: http://stackoverflow.com/q/21936103
has body: but could someone explain me why Sure - arrays don't override equals, therefore they inherit the behaviour from Object, where any two distinct objects are non-equal. It's even simpler than the version you showed if you use a 0-element array: System.out.println(new int[0].equals(new int[0])); // false That's why when checking for equality in non-test code you use Arrays.equals, and when checking for equality in test code you use a dedicated assertXyz method (where the exact method depends on the version of JUnit etc).

http://stackoverflow.com/q/21975117
upvote count: 6
favorite count: 0
linked to: http://stackoverflow.com/q/15259229
has answer: http://stackoverflow.com/a/21992775
score: 6
has comment: http://stackoverflow.com/comment/33299747
possible better answer: http://stackoverflow.com/a/21975309
tagged with: gps
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22072946
has answer: http://stackoverflow.com/a/21975309
tagged with: java
has comment: http://stackoverflow.com/comment/33299557
has comment: http://stackoverflow.com/comment/33299949
tagged with: google-play-services
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/33445217
has comment: http://stackoverflow.com/comment/33300300
accepted answer: http://stackoverflow.com/a/22072946
has comment: http://stackoverflow.com/comment/33299692
answer count: 3
tagged with: android
has title: Android GPS does not work until restart on new phones
tagged with: restart
has body: I have posted about this issue before, and found a few other people who have had the same issue with no solutions found. I am developing an Android app that submits a JSON query to a server with the obtained GPS coordinates and geocoded Zip Code. For brand new users that have never downloaded the app, GPS does not work whatsoever. It is not until rebooting the phone that GPS will work. After installing the app and then rebooting, the GPS will work every time without problem, even if they restart again. There is precious little information on this issue, and the only issue I have found refers to using Google Play Location Services, with no further details. Has anyone else had this issue? My development is completely halted until this issue can be resolved. EDIT: Here is the link to the MainActivity.java file that calls the geopositioning functions. Here is the link to the MyLocation.java file that contains the actual logic for multiple sources of geolocation I have no doubt that there are much better ways of doing GPS. I'm very new to Android development, so any help on this front is very much appreciated. EDIT 2: I have wiped my phone with a factory reset, and started from scratch. I still cannot replicate the issue on this device, only on phones using the app for the very first time prior to a restart.

http://stackoverflow.com/a/21956211
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21954515
upvote count: 3
has comment: http://stackoverflow.com/comment/108345061
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21954515
score: 3
has body: you have severals errors in your animation xml files: the duration property is in milliseconds, so 1ms is way too short for a noticeable fade in/fade out animation the alpha property is a float between 0 et 1, 100 is way too much. you don't need a set in your xml files if there is only one animation : just add the alpha or rotate tag as a root So, you should have now these files: fade_in.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;alpha xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1000" android:fromAlpha="0" android:toAlpha="1" /&gt; fade_out.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;alpha xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1000" android:fromAlpha="1" android:toAlpha="0" /&gt; image_rotate.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;rotate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="2500" android:pivotX="50%" android:pivotY="50%" android:toDegrees="120" /&gt; Then, in your code, you need a add an offset between each animation. Otherwise, all the animations will be triggered at the same time. Moreover, the fillAfter flag must be set on the root animation object (here, your AnimationSet) Animation animRotate= AnimationUtils.loadAnimation(context, R.anim.image_rotate); Animation fade_in = AnimationUtils.loadAnimation(context, R.anim.fade_in); Animation fade_out = AnimationUtils.loadAnimation(context, R.anim.fade_out); AnimationSet s = new AnimationSet(false); s.addAnimation(fade_in); animRotate.setDuration((long) duration); animRotate.setStartOffset(fade_in.getDuration()); s.addAnimation(animRotate); fade_out.setStartOffset(fade_in.getDuration() + animRotate.getDuration()); s.addAnimation(fade_out); s.setFillAfter(true); image.startAnimation(s);

http://stackoverflow.com/comment/33279669
comment on: http://stackoverflow.com/q/21964026
type: QuestionComment
has text: `"I think a text area."` -- I think you're confused. If you want to open a file an display it's contents, then do so. But a GIThup concept is something entirely different. Perhaps you want to re-think your question and try to clarify it from the ground up.
score: 0
type: Comment

lis
tags question: http://stackoverflow.com/q/21969345
tag name: lis
type: Tag

http://stackoverflow.com/a/21888383
type: Answer
has comment: http://stackoverflow.com/comment/33146067
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/33145011
downvote count: 0
has body: Interfaces are most valuable in any language because let you separate interface and implementation completely. Clients deal with the interface; they don't need to know how something is done. If you decide to swap in a new implementation later, you can do it without affecting clients. If you do it with your CRUD class you'll have to rewrite every client that uses it. Look at the java.sql package - it's all interfaces. JDBC driver vendors supply the implementations, so you don't have to worry about vendors. If you swap databases, you simply put a new JAR in your CLASSPATH. All your code that deals with interfaces still works. Another great example is in the java.util Collections API. You should prefer the interface java.util.List. Whether or not it's ArrayList or LinkedList behind it won't matter to your clients. This is the basis for dynamic proxy generation, aspect oriented programming, mocking, all sorts of stuff. You can't consider yourself an object-oriented developer unless you understand how to use interfaces well.
answers question: http://stackoverflow.com/q/21888318

http://stackoverflow.com/comment/33072944
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21848360
score: 0
has text: Could you please provide a minimal example with an XML document, the method call (`deleteParameter(1,2)` for example), the expected result and what you currently see?

http://stackoverflow.com/comment/33226258
has text: You should use radio buttons for that. They're there explicitly if the user needs to choose exactly one from a set of options.
score: 1
comment on: http://stackoverflow.com/q/21934734
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33231228
type: Comment
score: 0
type: QuestionComment
has text: Ok but when a new certificate is issued by the third party that would also be included in the certificate chain, so may be we need to periodically check for new certificates by making an ssl connection. Please correct if i am wrong
comment on: http://stackoverflow.com/q/21936465

http://stackoverflow.com/comment/33174416
type: QuestionComment
has text: there is no more log cat for this app, this is all
comment on: http://stackoverflow.com/q/21904464
score: 0
type: Comment

http://stackoverflow.com/a/21965804
answers question: http://stackoverflow.com/q/21965771
has body: Something like the following code would work in your situation: public Point flip(Point point) { return new Point(-point.getY(), -point.getX()); }
score: 0
type: Answer

http://stackoverflow.com/comment/33143372
type: AnswerComment
has text: I also understand it that current session should be associated with Thread who opens it. Since Session isn't AutoCloseable, try-with-resources can't be used, but it seems that opening and closing of Session after each transaction works: Session session = HibernateUtil.getSessionFactory().openSession(); try { Transaction tx = session.beginTransaction(); // do queries tx.commit(); } finally { session.close(); }. Thank you Steve!
type: Comment
comment on: http://stackoverflow.com/a/21886387
score: 0

http://stackoverflow.com/q/21936297
has comment: http://stackoverflow.com/comment/33228968
type: AnsweredQuestion
tagged with: reflection
tagged with: java
has body: I have a program that asks the user for a String, which should be the name of a class that implements the Message interface. All the java classes are in package ist.ap.labs The code is this one: Class cl = null; try { cl = Class.forName(className); } catch (ClassNotFoundException clnfe) { System.out.println("Class not found!"); System.exit(1); } if (!cl.isAssignableFrom(ist.ap.labs.Message)) { System.out.println("Class not implements Message!"); System.exit(1); } But I always get an error saying cannot find a symbol:class labs Any help?
accepted answer: http://stackoverflow.com/a/21936427
type: Question
has answer: http://stackoverflow.com/a/21936523
score: 0
has title: Want to know if a certain class implements an specific interface
has comment: http://stackoverflow.com/comment/33229435
answer count: 2
has comment: http://stackoverflow.com/comment/33229075
possible better answer: http://stackoverflow.com/a/21936523
has comment: http://stackoverflow.com/comment/33228978
has answer: http://stackoverflow.com/a/21936427

http://stackoverflow.com/q/21858276
tagged with: java
tagged with: gson
tagged with: android-sqlite
downvote count: 1
type: Question
score: 5
has body: My model object has simple datatypes as well as other types of model objects @SerializedName("account") Account account;` I serialize these model objects from a network api call using GSON. GSON needs my model objects to be their respective types. I want to then write my model objects to a database using Ormlite and batch tasks, but Ormlite requires ForeignCollection&lt;T&gt; even if I only have one foreign object (instead of a list of foreign objects) in my model. How do I get from one serialized element of T into ForeignCollection&lt;T&gt; in my model file? The real question of course is how to serialize and store models in my database which contain references to other models.
has comment: http://stackoverflow.com/comment/33275109
has answer: http://stackoverflow.com/a/22049801
answer count: 1
tagged with: ormlite
favorite count: 0
tagged with: serialization
has comment: http://stackoverflow.com/comment/33344992
accepted answer: http://stackoverflow.com/a/22049801
has title: GSON to Ormlite foreign collection
upvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33467515

http://stackoverflow.com/comment/33095137
type: AnswerComment
comment on: http://stackoverflow.com/a/21861116
score: 0
type: Comment
has text: He has the source, so decompiling isn't necessary.

http://stackoverflow.com/comment/33243930
comment on: http://stackoverflow.com/q/21941729
type: QuestionComment
has text: nvm, got it. little tip for people with similar problems http://www.scs.ryerson.ca/~mes/courses/cps530/programs/threads/Repaint/index.html TL;DR dont call repaint() frequently without actively giving enough time to repaint
score: 0
type: Comment

http://stackoverflow.com/comment/33280132
has text: @JasonC I updated my code and added the input file,as well as a chunk of code I wrote trying it out, having problems with one line though as described above
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21963652

http://stackoverflow.com/a/21920247
accepted answer of: http://stackoverflow.com/q/21887049
downvote count: 0
answers question: http://stackoverflow.com/q/21887049
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/33335679
score: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33343227
has body: I see two problems here: &lt;rs&gt;&lt;r&gt;...&lt;/r&gt;&lt;/rs&gt; are nested tags of the root element (not sure if @Path can handle this ...) the two tags of each entry (&lt;c&gt;&lt;v&gt;...&lt;/v&gt;&lt;/c&gt;) are not possible through @ElementList annotations (and @Path can't be set for each entry) As a solution you can write two wrapper classes: One, that wraps the root-node Another one, that's put in the list, wrapping each a entry And here comes the implementation: Class FooWrapper This class wraps a Foo class; you get rs-tag through the wrapper and the r-tag with the actual object. @Root(name = "rs") public class FooWrapper { @Element(name = "r", required = true) private Foo f; public FooWrapper(Foo f) // Required just in case you want to serialize this object { this.f = f; } FooWrapper() { } // At least a default ctor is required for deserialization } Class Foo Nothing special here. Only the type of the list entries is changed to the EntryWrapper. @Root(strict = false) public class Foo /* A */ { @Element(name = "id") public int id; /* B */ @Element(name="bar") public String info; @ElementList(entry="c", inline=true, required=false, empty = false) public List&lt;EntryWrapper&gt; values; // Replacing the String with the EntryWrapper // ... } /* A */: In your code, this was static too, i've just removed it since i put it into a own class file. /* B */: Better: encapsulate the fields, make them private and write getter / setter. Class EntryWrapper Each entry in the list is wrapped into such a wrapper object. Btw. no need to expose this class public. public class EntryWrapper { @Element(name = "v") private String value; public EntryWrapper(String value) { this.value = value; } EntryWrapper() { } // Once again, at least one default ctor is required for deserialization // ... }

http://stackoverflow.com/a/21896638
score: 4
has comment: http://stackoverflow.com/comment/33302164
has comment: http://stackoverflow.com/comment/33302155
has comment: http://stackoverflow.com/comment/33302678
has comment: http://stackoverflow.com/comment/33302153
has comment: http://stackoverflow.com/comment/33302286
has comment: http://stackoverflow.com/comment/33302459
has comment: http://stackoverflow.com/comment/33302765
type: Answer
has comment: http://stackoverflow.com/comment/33302489
has comment: http://stackoverflow.com/comment/33302553
has comment: http://stackoverflow.com/comment/33302799
answers question: http://stackoverflow.com/q/21896544
downvote count: 1
has body: Why are you calling finish() ? That will definately make you activity stop
upvote count: 5

http://stackoverflow.com/q/21863035
tagged with: xpath
answer count: 1
has answer: http://stackoverflow.com/a/21863152
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/21863152
type: AnsweredQuestion
has body: I have been struggling concatenating child node values using XPath. We have an XML file with a parent node and three child nodes each, what I am trying to achieve is to get only two of these child nodes and concatenate their values as CHILDNODE1 [CHILDNODE2] E.g. The parent node would look like this 24 <Code>abc xyz XPath Call: Code[Name] Result: abc[xyz] Almost missed to mention, I am trying to get an ArrayList as outcome for all the similar nodes, i.e. Instead of looping over these nodes and concatenate one by one, get all these values in one XPath query (not sure that's even possible). I would like to know if this is possible at all and some suggestions/examples would be really great. If it cannot be achieved suing XPath then would be the other options.
has title: Concat values of selected child nodes using XPath
type: Question
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/33266470
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21956809
has text: Thanks, makes sense, but now it's asking me to initialise Car2 o.o
type: AnswerComment

http://stackoverflow.com/q/21860883
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: java-stored-procedures
downvote count: 0
has body: Normally, we register cursor as an out parameter to retreive the values from oracle stored procedure. Below code is for Spring: RowMapper&lt;?&gt; rowMapper = new DataRowMapper(tableName); declareParameter(new SqlOutParameter(DAOConstants.DROP_DOWN_CURSOR, OracleTypes.CURSOR,rowMapper)); compile(); How can we supply create cursor in spring/java and pass as input parameter to the oracle stored procedure?
tagged with: plsql
has title: Java ,Spring Framework Calling Oracle Stored Procedure with CURSOR as input Parameter
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
tagged with: spring
answer count: 0

http://stackoverflow.com/comment/33280596
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21964522
has text: Ok, Thanks, Let me try

http://stackoverflow.com/comment/33085198
score: 0
type: QuestionComment
type: Comment
has text: how to solve this problem ??
comment on: http://stackoverflow.com/q/21854776

http://stackoverflow.com/comment/84776551
has text: lets I have URL /abc/def/ghi/hkl... How can I get the value of first three words /abc/def/ghi ?
comment on: http://stackoverflow.com/a/21867940
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21940745
score: 2
has body: Here you assign x.left and x.right to x: if(x.left!=null) { ... rightmost=x; x.left=rightmost; ... } if(x.right!=null) { ... leftmost=x; x.right=leftmost; ... } I can't tell what it's supposed to be to say what to change it to but that's probably your bug. The list won't be relinked.
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33240128
type: Answer
answers question: http://stackoverflow.com/q/21940364

http://stackoverflow.com/q/21954481
has body: I am using log4j for logging in my web application. Its working fine. But whenever i start my tomcat server i get the below exception : log4j:ERROR JDBCAppender::flush_buffer(), : java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/MYPROJECT?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true at java.sql.DriverManager.getConnection(DriverManager.java:602) at java.sql.DriverManager.getConnection(DriverManager.java:185) at org.apache.log4j.jdbcplus.JDBCDefaultConnectionHandler.getConnection(JDBCDefaultConnectionHandler.java:77) at org.apache.log4j.jdbcplus.JDBCDefaultConnectionHandler.getConnection(JDBCDefaultConnectionHandler.java:53) at org.apache.log4j.jdbcplus.JDBCLogger.prepareConnection(JDBCLogger.java:489) at org.apache.log4j.jdbcplus.JDBCLogger.append(JDBCLogger.java:555) at org.apache.log4j.jdbcplus.JDBCAppender.flush_buffer(JDBCAppender.java:887) at org.apache.log4j.jdbcplus.JDBCAppender.append(JDBCAppender.java:867) at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230) at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65) at org.apache.log4j.Category.callAppenders(Category.java:203) at org.apache.log4j.Category.forcedLog(Category.java:388) at org.apache.log4j.Category.log(Category.java:853) at org.jboss.logging.Log4jLogger.doLogf(Log4jLogger.java:53) at org.jboss.logging.Logger.logf(Logger.java:2112) at org.hibernate.internal.CoreMessageLogger_$logger.recognizedObsoleteHibernateNamespace(CoreMessageLogger_$logger.java:2397) at org.hibernate.internal.util.xml.DTDEntityResolver.resolveEntity(DTDEntityResolver.java:74) at org.hibernate.cfg.EJB3DTDEntityResolver.resolveEntity(EJB3DTDEntityResolver.java:59) at org.apache.xerces.util.EntityResolverWrapper.resolveEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.resolveEntity(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.…
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/33309864
type: Question
has comment: http://stackoverflow.com/comment/33782296
has comment: http://stackoverflow.com/comment/33306527
has title: log4j:ERROR JDBCAppender::flush_buffer(), : java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/
has comment: http://stackoverflow.com/comment/33262600
score: 0
tagged with: sql
tagged with: log4j
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/comment/33318345
type: AnswerComment
has text: This stackoverflow question lists few of benefits of Guava. http://stackoverflow.com/questions/3759440/the-guava-library-for-java-what-are-its-most-useful-and-or-hidden-features
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21985563

http://stackoverflow.com/comment/33109786
score: 0
comment on: http://stackoverflow.com/q/21868601
type: Comment
type: QuestionComment
has text: @DennisMeng you must be kidding, it is one of main feature.

http://stackoverflow.com/a/53924128
downvote count: 0
has body: Add following syntax to the test case: @Rule public TestRule timeout = new DisableOnDebug(new Timeout(20)); Reference: https://junit.org/junit4/javadoc/4.12/org/junit/rules/DisableOnDebug.html
upvote count: 2
answers question: http://stackoverflow.com/q/21912348
type: Answer
score: 2

http://stackoverflow.com/comment/33208230
type: Comment
has text: &kevin.speak(1) makes no sense - are you doing &Kevin::Speak (the class) or are you doing &kevin1.Speak (the instance of your class)? (the later is the correct way)
comment on: http://stackoverflow.com/a/21924140
type: AnswerComment
score: 0

http://stackoverflow.com/a/21956766
has comment: http://stackoverflow.com/comment/33268354
accepted answer of: http://stackoverflow.com/q/21956655
upvote count: 1
has comment: http://stackoverflow.com/comment/33273872
has comment: http://stackoverflow.com/comment/33271246
answers question: http://stackoverflow.com/q/21956655
has body: Now I have two questions, the first one is that my application keeps crashing whenever I try to use the Globals class, here is the code: Did I use context incorrectly? you should use getApplication() method for that, or make your application class singleton, so you would call Globals.getInstance().getMyVariable() etc. My last question is this : I have read on some answers here that if my application becomes a background process then all the data in the context will be set to null, and I will lose my context. Is there is any method to overcome this point? or should I switch to SharedPreferences ? if your app becomes background then Android is more likely to kill your app, and this way also destroy all your static objects. Inside your Globals class you should not store your data in static variables but rather in some persistant storage - if its small then use SharedPreferences, if its large then you can store it in json and save to application memory, or use sqlite db.
has comment: http://stackoverflow.com/comment/33269424
has comment: http://stackoverflow.com/comment/33266677
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33266440
type: Answer
has comment: http://stackoverflow.com/comment/33266391
has comment: http://stackoverflow.com/comment/33266241
has comment: http://stackoverflow.com/comment/33267645
score: 1

http://stackoverflow.com/comment/33111068
has text: ... or return in some other way, or do a labelled `break`... Note that a `finally` clause executes even if one of those cases does apply.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21869575
type: Comment

http://stackoverflow.com/a/21954935
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21954808
has comment: http://stackoverflow.com/comment/33263524
has body: public class Test { public static int x = 0; public static void main(String[] args) throws InterruptedException{ Runnable r1 = new Runnable() { public void run() { while(true){ x = x + 1; System.out.println("increment x"); try { Thread.sleep(5000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }; Runnable r2 = new Runnable() { public void run() { while(true){ System.out.println("x is "+x); } } }; Thread t1 = new Thread(r1); Thread t2 = new Thread(r2); t1.start(); t2.start(); // Thread.sleep(5000); } } something like this.. but keep in mind points made above
score: -1
downvote count: 2
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/33263034
accepted answer of: http://stackoverflow.com/q/21954808

http://stackoverflow.com/q/21900755
has body: I created inventory application, when display transaction list from database I use JTabel inside JScrollPane. Set JScrollPane horizontalScrollBar Policy to AS_NEED and JTable setAutoResize to false and Column width set using TableColumnModel as I need. When Width set manually table width going out of viewport and HorizotalScrollBar activate. But I run program and Use scrollbar to see column outside viewport, text and header text get blur during scroll. Follow given code an screen shoot of project SetTableModel using DefaultTableModel DefaultTableModel dm; dm = new DefaultTableModel(0, 0){ @Override public boolean isCellEditable(int row, int column) { return false; } }; String titleCol[] = new String[]{"ID","Invoice No","Date","Account Name","Total Amount","Taxeble Amount","Tax %","Tax Amount","Discount Amount","Grand Total"}; dm.setColumnIdentifiers(titleCol); table1.setModel(dm); table1.getTableHeader().setFont(new Font("Tahoma", Font.BOLD, 14)); Set Width of Column using TableColumnModel table1.getTableHeader().setPreferredSize(new Dimension(table1.getTableHeader().getPreferredSize().width, 35)); TableColumnModel columnModel = table1.getColumnModel(); columnModel.getColumn(0).setMinWidth(50); columnModel.getColumn(0).setMaxWidth(50); columnModel.getColumn(1).setMinWidth(85); columnModel.getColumn(1).setMaxWidth(85); columnModel.getColumn(2).setMinWidth(100); columnModel.getColumn(2).setMaxWidth(100); columnModel.getColumn(3).setMinWidth(250); columnModel.getColumn(4).setMinWidth(100); columnModel.getColumn(4).setMaxWidth(100); columnModel.getColumn(5).setMinWidth(130); columnModel.getColumn(5).setMaxWidth(130); columnModel.getColumn(6).setMinWidth(75); columnModel.getColumn(6).setMaxWidth(75); columnModel.getColumn(7).setMinWidth(130); columnModel.getColumn(7).setMaxWidth(130); columnModel.getColumn(8).setMinWidth(130); columnModel.getColumn(8).setMaxWidth(130); columnModel.getColumn(9).setMinWidth(130); columnModel.getColumn(9).setMaxWidth(130); Screenshot of Bef…
has comment: http://stackoverflow.com/comment/33178158
tagged with: jtable
linked to: http://stackoverflow.com/q/11686535
score: 0
has answer: http://stackoverflow.com/a/21901046
tagged with: jtableheader
has comment: http://stackoverflow.com/comment/33166677
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33168279
tagged with: java
has title: JTable Column Title Blurred
type: Question
linked to: http://stackoverflow.com/q/7229226
accepted answer: http://stackoverflow.com/a/21901046
answer count: 1

http://stackoverflow.com/comment/33139613
score: 0
comment on: http://stackoverflow.com/q/21847972
type: Comment
type: QuestionComment
has text: Thanks for the response, the chat commands look like this: :nugshow!nugshow@nugshow.testserver.local PRIVMSG #nugshow :dddd where nugshow is the username, #nugshow is the channel, and dddd is the message. I need to get it into the format of nugshow: dddd

http://stackoverflow.com/comment/33135856
score: 0
has text: It is a very ineffective method of communication, but it DOES provide communication. I would prefer the second method though, but it's a bit harder to implement. The first method works with but a few lines of code. Good for a quick test, but not much more.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21882840

http://stackoverflow.com/q/21939353
score: 0
answer count: 1
tagged with: android
has answer: http://stackoverflow.com/a/21957175
accepted answer: http://stackoverflow.com/a/21957175
type: AnsweredQuestion
has title: How to check if my Live-Wallpaper is running
type: Question
has body: I have a Live Wallpaper and an Activity. How can I check in the Activity if the User activated my Wallpaper and how can I send him to the Live Wallpaper Settings if not?
tagged with: java
tagged with: live-wallpaper

http://stackoverflow.com/comment/33120210
has text: Launch a separate thread to run `playOneTurn`, and put `Thread.sleep()` into your loop, to save cpu cycles
comment on: http://stackoverflow.com/q/21874923
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33600395
type: QuestionComment
comment on: http://stackoverflow.com/q/21897412
score: 0
has text: You might want to divide template and data spreadsheet. The template has only formatting. Read datas from spreadsheets and put them into temporary list. When the datas output, copy the template spreadsheet.
type: Comment

http://stackoverflow.com/a/21873146
upvote count: 4
downvote count: 0
score: 4
type: Answer
has body: try this int x = (int)Long.parseLong(s, 2); Integer.parseInt cannot parse "11111111111111111111111111111110" because it takes it as a positive binary number
answers question: http://stackoverflow.com/q/21873011

http://stackoverflow.com/q/21945227
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21945904
score: 1
tagged with: java
type: Question
tagged with: algorithm
tagged with: arrays
downvote count: 0
accepted answer: http://stackoverflow.com/a/21945904
tagged with: dynamic-programming
answer count: 1
has title: combination sum of array - dynamic programming - fix needed
favorite count: 0
has body: I have implemented the code to output all the different unique possibilities of getting a target sum from the elements of input array. for example given the arr -&gt; [1, 2, 3, 5, 6, 7, 10] and target sum of 8, the output should be [1, 2, 5], [1, 7], [2, 6], [3, 5]. In my code below, I get an extra [2, 3] in the output. Also for the target of 33, with the same input list as above I get strange results I need some assistance here in fixing this code. public class CombinationSum { public static void main(String[] args){ List&lt;Integer&gt; temp = new ArrayList&lt;Integer&gt;(); List&lt;Set&lt;Integer&gt;&gt; resultList = new ArrayList&lt;Set&lt;Integer&gt;&gt;(); int[] arr={10,1,2,7,6,3,5}; Arrays.sort(arr); System.out.println(Arrays.toString(arr)); int target=8; sumCombinations(resultList, temp, target, arr, 0); System.out.printf("target is %s; resultList is %s%n",target,resultList); int target2=33; List&lt;Integer&gt; temp2 = new ArrayList&lt;Integer&gt;(); List&lt;Set&lt;Integer&gt;&gt; resultList2 = new ArrayList&lt;Set&lt;Integer&gt;&gt;(); sumCombinations(resultList2, temp2, target2, arr, 0); System.out.printf("target is %s; resultList is %s%n",target2,resultList2); } public static void sumCombinations(List&lt;Set&lt;Integer&gt;&gt; resultList, List&lt;Integer&gt; temp, int target, int[] arr, int start){ for (int i=start;i&lt;arr.length;i++){ if (arr[i]==target){ temp.add(arr[i]); Set&lt;Integer&gt; scratch = new HashSet&lt;Integer&gt;(temp); if (!resultList.contains(scratch)) resultList.add(scratch); } else if (target&gt;arr[i]){ temp.add(arr[i]); sumCombinations(resultList, temp, target-arr[i], arr, start+1); } else return; if (temp.size()&gt;0) temp.remove(temp.size()-1); } } } Output: target is 8; resultList is [[1, 2, 5], [1, 7], [2, 3], [2, 6], [3, 5]]` target is 33; resultList is [[1, 2, 3, 7, 10], [1, 2, 5, 10], [1, 2, 6, 7, 10], [1, 2, 10], [1, 3, 6, 10], [1, 3, 5, 7, 10], [1, 3, 6, 7, 10], [1, 5, 7, 10], [1, 5, 6, 10], [1, 5, 6, 7], [1, 6, 7], [1, 6, 1…

http://stackoverflow.com/comment/33177604
has text: But when I download from this link and extract, only exe file is there
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21906927

http://stackoverflow.com/q/21889718
score: 1
tagged with: java
type: Question
tagged with: jakarta-mail
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21894268
accepted answer: http://stackoverflow.com/a/21894268
has title: IO Exception while sending mail using JavaMail (Access is denied )
upvote count: 1
has body: I am trying to send a mail using JavaMail but getting IO exception saying Access is denied Please let me know where i am making a mistake. I have used java mail and internet APIs along with the datasource , datahandler APIs. Also the html file i m trying to send as an attachment is in appropriate path and i have the access rights to that file. Below is my code import javax.activation.DataHandler; import javax.activation.DataSource; import javax.activation.FileDataSource; import javax.mail.*; import javax.mail.internet.*; import java.util.*; public class SendMail { public static void execute(String reportFileName) throws Exception { String path="C:/reports"; String[] to={"xyz@gmail.com"}; String[] cc={"xyz@gmail.com"}; String[] bcc={"abc@gmail.com"}; SendMail.sendMail("xyz@gmail.com", "******", "smtp.gmail.com", "465", "true", "true", true, "javax.net.ssl.SSLSocketFactory", "false", to, cc, bcc, "Test Mail", "Test Message", path, reportFileName); } public static boolean sendMail(String userName, String passWord, String host, String port, String starttls, String auth, boolean debug, String socketFactoryClass, String fallback, String[] to, String[] cc, String[] bcc, String subject, String text, String attachmentPath, String attachmentName){ //Object Instantiation of a properties file. Properties props = new Properties(); props.put("mail.smtp.user", userName); props.put("mail.smtp.host", host); props.put("mail.smtp.password", passWord); props.put("mail.smtps.auth", "true"); if(!"".equals(port)){ props.put("mail.smtp.port", port); } if(!"".equals(starttls)){ props.put("mail.smtp.starttls.enable",starttls); props.put("mail.smtp.auth", auth); } if(debug){ props.put("mail.smtp.debug", "true"); }else{ props.put("mail.smtp.debug", "false"); } if(!"".equals(port)){ props.put("mail.smtp.socketFactory.port", port); } if(!"".equals(socketFactoryClass)){ props.put("mail.smtp.socketFactory.class",socketFactoryClass); } if(!"".equals(fallback)){ props.put("mail.smtp.socketFactory.fa…
type: AnsweredQuestion

http://stackoverflow.com/comment/33198076
has text: What have you tried? What OS are you on? This does not sound like something for which you need Java if you have scripting tools (awk, Perl) available.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21918283

http://stackoverflow.com/comment/33281748
type: QuestionComment
comment on: http://stackoverflow.com/q/21965116
has text: Chit, your code doesn't even compile. But also important, what is your goal. Per your question, you sound as if you want to start, stop, then start and stop a Swing GUI repeatedly? Why? What UI experience are you driving at?
score: 3
type: Comment

http://stackoverflow.com/comment/33317163
has text: @Panagiotis please show us your grammar then. Especially the header and the uses of your classes
comment on: http://stackoverflow.com/a/21984523
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33241001
type: QuestionComment
comment on: http://stackoverflow.com/q/21942720
score: 0
has text: Well sequential search would just search for the first index, correct? Then move on to the next one until it finds the correct one.
type: Comment

http://stackoverflow.com/comment/33127342
comment on: http://stackoverflow.com/q/21873476
has text: Please post Global class here and also is there any exception while writing array to socket?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21945579
has comment: http://stackoverflow.com/comment/33247980
has body: This has little to do with constructors and more to do with passing information between objects of different classes. For one you don't mis-use of inheritance for this purpose as you appear to be doing. Instead you use composition -- the class that needs information from another class needs a valid reference to the active object of the other class. Then the first class can call methods on the other one. I think that for your purposes, you will likely be better off getting the user's information in a modal fashion using an internal option pane such as a JOptionPane.showInternalConfirmDialog(...). Whenever you open a modal dialog, the calling code halts at the point where you display the modal dialog. The calling code will then resume once the modal dialog is no longer visible, and at that point you can query the JPanel class that is displayed in your option pane for the data that it holds. Note as an aside: if you are asking question about code, and you state that your code has an "error", you will want to post the full error message for all to see. Also, this isn't valid Java: AccountType.getText() = acType; as you can't have a method call on the left side of an assignment statement.
has comment: http://stackoverflow.com/comment/33399846
has comment: http://stackoverflow.com/comment/33373776
accepted answer of: http://stackoverflow.com/q/21945368
type: Answer
answers question: http://stackoverflow.com/q/21945368
has comment: http://stackoverflow.com/comment/33247293
has comment: http://stackoverflow.com/comment/33267597
has comment: http://stackoverflow.com/comment/33248339
has comment: http://stackoverflow.com/comment/33246897
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/21963356
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21963455
tagged with: android
has body: My app is working perfectly for the first five minutes but then after a period of time it crashes.` package com.me.fixGame; import java.util.Random; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.graphics.GL10; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.sun.jmx.snmp.tasks.Task; public class fixGame implements ApplicationListener { SpriteBatch batch; SpriteBatch spriteBatch; Texture trash; Texture paper; SpriteBatch spritebatch; Vector2 position; Vector2 size; Vector2 size2; Vector2 pos; Rectangle bounds; Rectangle bounds2; float delay = 1; // seconds boolean counted= false; int score = 3; String myScore; CharSequence str; // = myScore; BitmapFont font; boolean collision = false; @Override public void create() { float delaySeconds = 1; spriteBatch = new SpriteBatch(); trash = new Texture(Gdx.files.internal("data/trash.png")); paper = new Texture(Gdx.files.internal("data/paper1.jpg")); position = new Vector2(100, 50); pos = new Vector2(54, 14); batch = new SpriteBatch(); BitmapFont font = new BitmapFont(); size2 = new Vector2(trash.getWidth() ,trash.getHeight() ); //size2.y = trash.getHeight(); //size2.x = trash.getWidth(); size = new Vector2(paper.getWidth() ,paper.getHeight()); bounds= new Rectangle(pos.x, pos.y, size.x, size.y); bounds2= new Rectangle(position.x, position.y, size2.x, size2.y); } @Override public void dispose() { } public void update(){ bounds.set(pos.x, pos.y, size.x, size.y); bounds2.set(position.x, position.y, size2.x, size2.y); position.x = position.x -2- Gdx.input.getAccelerometerX(); } @Override public void render() { if(bounds.overlaps(bounds2)){ collision=true; counted=true; }els…
score: 2
type: AnsweredQuestion
upvote count: 2
type: Question
tagged with: crash
has answer: http://stackoverflow.com/a/21963455
tagged with: libgdx
tagged with: java
has title: After 5 minutes of running , my libgdx game crashes and turns black
answer count: 1

http://stackoverflow.com/comment/33125625
type: Comment
comment on: http://stackoverflow.com/q/21878074
score: 0
type: QuestionComment
has text: It's not the `P#out` method which "accesses" the variable, but the class `M`.

http://stackoverflow.com/comment/33335624
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21992463
has text: Where is relation between `BankDebit` and `Mandate` declared? show us.

http://stackoverflow.com/comment/33260078
type: QuestionComment
comment on: http://stackoverflow.com/q/21953317
has text: Initial capacity is unknown so maybe I go with changing Customer class.(Changing that is expensive but if it is my only choice I will do that) What method should I add to Customer? Could you please explain that?
score: 0
type: Comment

http://stackoverflow.com/a/21876424
has comment: http://stackoverflow.com/comment/33167819
upvote count: 1
type: AcceptedAnswer
has body: you can do like this For CSV public static Object[][] getCsvData(File csvFile) { CsvConfiguration conf = new CsvConfiguration(1); DataContext csvContext = DataContextFactory.createCsvDataContext( csvFile, conf); Schema schema = csvContext.getDefaultSchema(); Table[] tables = schema.getTables(); Table table = tables[0]; DataSet dataSet = csvContext.query().from(table).selectAll().where("run").eq("Y").execute(); List&lt;Row&gt; rows = dataSet.toRows(); Object[][] myArray = new Object[rows.size()][2]; int i = 0; SelectItem[] cols = rows.get(0).getSelectItems(); for (Row r : rows) { Object[] data = r.getValues(); for (int j = 0; j &lt; cols.length; j++) { if (data[j] == null) data[j] = ""; // force empty string where there are NULL // values } myArray[i][0] = cols; myArray[i][1] = data; i++; } logger.info("Row count: " + rows.size()); logger.info("Column names: " + Arrays.toString(cols)); return myArray; } I figured it out For XmlDataProvider you can do like this @Test public void testXML() { XmlSaxTableDef employeeTableDef = new XmlSaxTableDef( "/root/organization/employees/employee", new String[] { "/root/organization/employees/employee/name", "/root/organization/employees/employee/gender", "index(/root/organization)"}); XmlSaxTableDef organizationTableDef = new XmlSaxTableDef( "/root/organization", new String[] { "/root/organization/name", "/root/organization@type" }); DataContext dc = new XmlSaxDataContext(xmlFile, employeeTableDef, organizationTableDef); Table employeeTable = dc.getTableByQualifiedLabel("/employee"); Column fk = employeeTable.getColumnByName("index(/root/organization)"); Column empName = employeeTable.getColumnByName("/name"); Table organizationTable = dc.getTableByQualifiedLabel("/organization"); Column orgId = organizationTable.getColumnByName("row_id"); Column orgName = organizationTable.getColumnByName("/name"); Query q = dc.query().from(employeeTable) .innerJoin(organizationTable).on( fk, orgId ) .select(empName).as("employeename") .select(org…
has comment: http://stackoverflow.com/comment/33235474
type: Answer
has comment: http://stackoverflow.com/comment/33769374
downvote count: 0
has comment: http://stackoverflow.com/comment/33235167
score: 1
has comment: http://stackoverflow.com/comment/33139874
accepted answer of: http://stackoverflow.com/q/21870739
answers question: http://stackoverflow.com/q/21870739
has comment: http://stackoverflow.com/comment/33248160
has comment: http://stackoverflow.com/comment/33235748

http://stackoverflow.com/a/22523288
downvote count: 0
score: 1
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34708944
answers question: http://stackoverflow.com/q/21912182
has body: There is this method newLatLngZoom (LatLng latLng, float zoom), which will zoom to the point located at latLng. For your case of zooming to a point P that is off the center, it is able to do it with some math involves. To reverse thinking about the problem, we know the screen coordinate of the map center C after the zoom so that we know the LatLng of C. This LatLng needs to be passed in to the newLatLngZoom method so that it will center to the point and P is the same as before (which is as we defined the problem, zoom to P). So we need to find the screen coordinate of C before the zoom. Let's assume the zoom value before zoom is z1, and after zoom is z1 + dz. Google map API states that at zoom level N, the width of the world is approximately 256*2^N dp. So the width of the world before is 256*2^z1, and after is 256*2^(z1 + dz). We also know that the ratio of the distance of P to C to the whole world doesn't change before and after the zoom. The coordinate of C after the zoom is just center of your map view, which is known. Let's assume coordinate of C before the zoom as (Cx, Cy), then we can have our equation as (Px - Cx) / 256*2^z1 = (Px - C'x) / 256*2^(z1 + dz), and (Py - Cy) / 256*2^z1 = (Py - C'y) / 256*2^(z1 + dz). I ignore the aspect ratio to transfer width to height, because it will be cancelled out as you solve the equation. Solve the equation for Cx and Cy, and use that value as your parameters in newLatLngZoom. If you want to add panning and you know the dx dy value that needs to be panned, then just calculate the dx' dy' in the map after the zoom and add that to C.
has comment: http://stackoverflow.com/comment/34376477

http://stackoverflow.com/a/21977232
answers question: http://stackoverflow.com/q/21977204
score: 0
type: Answer
has body: You may have imported the wrong Map class. java.util.Map takes parameters.

http://stackoverflow.com/q/21868321
type: UnansweredQuestion
tagged with: android
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33264752
has body: I'm getting the following error when trying to get a response using RoboSpice with Jackson mapping do to an incorrect mapping for the error JSON returned POST request for "https://****/api/register?email=jam@yum.com&amp;first_name=Vege&amp;last_name=Mite&amp;password=qwerty12345&amp;invite_token=oXlTvAvbVR5fiQP6DKCEVQ" resulted in 422 (Unprocessable Entity); invoking error handler E//RequestRunner.java:134﹕ 19:01:34.881 Thread-15097 An exception occurred during request network execution :422 Unprocessable Entity using Curl I get the following correct response: {"object":"Error","errors":{"email":["has already been taken"]}} My Model Object for the repose that is failing is as follows, the issue is the "errors" item not mapping correctly but I am not sure what it should be since the variable name "email" can change (i.e. "agent", "vendor" , etc..) @JsonIgnoreProperties(ignoreUnknown = true) public class BaseModel { private String id; private String email; private String first_name; private String last_name; private String street1; private String street2; private String city; private String state; private String zipcode; private String country; private String phone; private String create_at; private String object; private Map&lt;String, ArrayList&lt;String&gt;&gt; errors; //Getters and Setters Removed
type: Question
has comment: http://stackoverflow.com/comment/33327487
tagged with: jackson
has title: Incorrect mapping for Jackson model with nested JSON and name as variable
has comment: http://stackoverflow.com/comment/33408513
score: 0
tagged with: robospice

http://stackoverflow.com/q/21978553
score: -2
favorite count: 0
has comment: http://stackoverflow.com/comment/33305507
has comment: http://stackoverflow.com/comment/33305696
type: Question
downvote count: 2
has comment: http://stackoverflow.com/comment/33305502
has comment: http://stackoverflow.com/comment/33305456
has comment: http://stackoverflow.com/comment/33305499
tagged with: java
has comment: http://stackoverflow.com/comment/33305579
has answer: http://stackoverflow.com/a/21978681
has title: How to solve Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3
upvote count: 0
type: UnansweredQuestion
has body: I am a newbie and i have no idea what is wrong with my code here. I am going to write both the questions and my code here. Please if anyone can help me. So the question says: You have to tell the total number of chores the person can perform in the given time. The first input is the total number of time the user got. The second input is the total number of chores the user wants to perform. The final inputs is the time it will take to complete each task. and here goes my code: public static void main (String[] args) { Scanner scan = new Scanner(System.in); int totalmins, chores=0, eachtime, totalchores, counter=0; // getting the input System.out.println("Enter the total time:"); totalmins=scan.nextInt(); while (totalmins&gt;100000) { System.out.println("Enter again. Less than 100000:"); totalmins=scan.nextInt(); } System.out.println("Enter the total chores:"); chores=scan.nextInt(); int [] time = new int[chores]; for (int i=1; i&lt;chores; i++) { System.out.println("Enter time:"); eachtime=scan.nextInt(); time[i]=eachtime; } // arranging in ascending order for (int i=0;i&lt;time.length; i++) { if (time[i] &gt; time[i+1]) { int temp = time[i]; time[i]=time[i+1]; time[i+1]=temp; } } for (int i=0;i&lt;time.length; i++) { totalchores=time[i] + time[i+1]; counter++; if (totalchores&gt;totalmins) { counter=counter-1; System.out.println(counter); } } }
tagged with: exception
answer count: 1

http://stackoverflow.com/a/21947246
answers question: http://stackoverflow.com/q/21946955
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: This is not dissimilar to the way any GUI application/framework is designed. Even Java Swing works in a similar fashion. You implement the "callbacks" that are hooked to UI control events, and your "main" function usually only serves to kick off the main event loop and exit. Note that here, when main() exits, the program itself does not exit.

postgresql
tags question: http://stackoverflow.com/q/21862117
tags question: http://stackoverflow.com/q/21910023
tags question: http://stackoverflow.com/q/21940642
tags question: http://stackoverflow.com/q/21863637
tags question: http://stackoverflow.com/q/21982652
tags question: http://stackoverflow.com/q/21925083
tag name: postgresql
tags question: http://stackoverflow.com/q/21845080
tags question: http://stackoverflow.com/q/21850865
type: Tag
tags question: http://stackoverflow.com/q/21948619
tags question: http://stackoverflow.com/q/21931327

http://stackoverflow.com/comment/44706580
type: Comment
comment on: http://stackoverflow.com/a/27625026
type: AnswerComment
score: 0
has text: How should one use this with the MapView? Does it check if there is an offline version automatically? Or do you have to specify in the mapview that you want to use a offline version.

http://stackoverflow.com/comment/117994647
score: 0
comment on: http://stackoverflow.com/a/58527875
type: AnswerComment
has text: This solution allows running VisualVM (currently not supporting JDK 16) with both JDK 15 and 16 installed.
type: Comment

http://stackoverflow.com/comment/33295455
type: AnswerComment
comment on: http://stackoverflow.com/a/21970528
type: Comment
has text: All swing components "look" depends on the [Look and Feel](http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/) (see the link for more details). Java has a default cross-platform L&F also called Metal, and yes, internal frames look pretty bad. My best advice is please start using an IDE such as [Eclipse](https://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/keplersr1) or [NetBeans](https://netbeans.org/downloads/). Your coding style isn't bad, you just need to keep in mind that anyone who reads your code must be able to understand it. See code conventions! @Toms
score: 0

http://stackoverflow.com/comment/43379917
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21863134
has text: I cannot describe how badly I want this feature. It KILLS me to navigate back to my working file, but the rest of my windows are in a state of chaos. I tried mapping a key to "open in opposite window", so that by default, the window I'm in will bring forward that file. But it's hard to remember when I need to duplicate the window (ie: if it's new).

http://stackoverflow.com/a/75232791
score: 0
type: Answer
has body: private static void createFlatJSon(Bundle appRestrictions, JSONObject jsonObject) throws JSONException{ for (String key : appRestrictions.keySet()) { if (appRestrictions.get(key) instanceof Bundle) { Bundle bundle = (Bundle)appRestrictions.get(key); Map<String, String> map = ((Bundle)appRestrictions.get(key)).keySet().stream().collect(Collectors.toMap(x -> x, x -> bundle.get(x).toString())); JSONObject jsonNested = new JSONObject(map); jsonObject.put(key,jsonNested); //createFlatJSon((Bundle) appRestrictions.get(key),jsonObject); }else if (appRestrictions.get(key) instanceof Parcelable[]){ for (int i=0;i< ((Parcelable[]) appRestrictions.get(key)).length; i++){ createFlatJSon((Bundle)((Parcelable[]) appRestrictions.get(key))[i],jsonObject); } //Log.e("KEY skipped",appRestrictions.get(key).toString()); }else{ // map = appRestrictions.keySet().stream().collect(Collectors.toMap(x -> x, x -> appRestrictions.get(x).toString()));// Use this if don't want to modify the keys Log.e("KEY: ", key + " Value:" + appRestrictions.getString(key)); Log.e("KEY: ", key + " Value:" + appRestrictions.get(key).getClass().getSimpleName()); if (appRestrictions.get(key) instanceof String[]){ JSONArray jsonArray = new JSONArray(); for (String value : (String[])appRestrictions.get(key)) { jsonArray.put(value); } jsonObject.put(key,jsonArray); }else { jsonObject.put(key, appRestrictions.get(key).toString()); } } } }
answers question: http://stackoverflow.com/q/21858528

http://stackoverflow.com/comment/33193180
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21915289
score: 1
has text: @hveiga, it is simple jdbc connection steps. I Want to know sql query string to form to execute the below FMP command in java

http://stackoverflow.com/a/21942460
upvote count: 1
has body: That is happening because the method named g declared in your class, is shadowing the method named g that is statically-imported on demand. See JLS &sect;6.4.1 - Shadowing: A declaration d of a method named n shadows the declarations of any other methods named n that are in an enclosing scope at the point where d occurs throughout the scope of d.
has comment: http://stackoverflow.com/comment/33240709
score: 1
accepted answer of: http://stackoverflow.com/q/21942059
answers question: http://stackoverflow.com/q/21942059
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33240548
type: Answer

http://stackoverflow.com/comment/33283054
type: Comment
comment on: http://stackoverflow.com/a/21965801
type: AnswerComment
has text: OP's code does both an inversion, and flip. As did I. I think....
score: 0

http://stackoverflow.com/a/21982684
has body: The feature you're trying to use doesn't exist. Oracle Coherence allows you to define a near cache into your application side, but it have to be supported by the far cache server. Without it you can't save anything. The client side near cache requires it server side for interact as a big DB for loading and updating the data received from the application. The trick you are trying for set 1 unit only is wrong as well. Each client side is trying to update the values by themselves. The issue here is that when client side 'A' sends an update while 'B' sends as well, one of the is received before (you don't know which) and the other is marked as invalid. And then, if you have in cache 1 1, 'A' sends 2 2 and 'B' 3 3, one of them (i.e. 3 3) will remain and 2 2 will be marked as invalid as 1 1 was in an hypothetical side 'C'. You are abusing the capability of the near cache - It was not designated for that. Coherence is a reliable cache and then if server side doesn't work, you app will not as well. If you need near caches to be sometimes updated with a remote server (sounds like this) consider using another solution. Hope I helped you.
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/33570093
has comment: http://stackoverflow.com/comment/33649962
answers question: http://stackoverflow.com/q/21909490
has comment: http://stackoverflow.com/comment/33328301
has comment: http://stackoverflow.com/comment/33328436
downvote count: 0

http://stackoverflow.com/a/21877803
upvote count: 2
answers question: http://stackoverflow.com/q/21875013
type: Answer
score: 2
downvote count: 0
has body: A Google App Engine App does not automatically track Gmail Login/Logout for user session. So signing out of gmail won't log user out of your app. That said, Google Id can be used to sign in/out of your app. If you want your user to logout from your app, then create a logout Url and let user use that to logout. Read more here.
has comment: http://stackoverflow.com/comment/33144612
has comment: http://stackoverflow.com/comment/33142529

http://stackoverflow.com/q/21884737
has comment: http://stackoverflow.com/comment/33140437
answer count: 2
has comment: http://stackoverflow.com/comment/33138461
has comment: http://stackoverflow.com/comment/33138286
has answer: http://stackoverflow.com/a/31926557
linked to: http://stackoverflow.com/q/18347141
has title: @ControllerAdvice Not Firing
score: 8
favorite count: 0
tagged with: exception
type: UnansweredQuestion
has body: I'm working on a Spring MVC/Webflow Application (version 3.2) and trying to get exception handling working where I can output a custom exception message to a logfile and error.jsp. The problem I'm having is that the Exception Handler is not getting fired. I've created the following class and annotated it "@ControllerAdvice" and put it into the same package as my controller that is throwing the exception: @ControllerAdvice public class MyCustomExceptionController { @ExceptionHandler(MyCustomException.class) public ModelAndView handleMyException(MyCustomException ex) { ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("/error/error"); modelAndView.addObject("errorId", ex.getErrorId()); modelAndView.addObject("message", ex.getErrorMessage()); return modelAndView; } } and added the following to the mvc-config File: &lt;mvc:annotation-driven/&gt; And included the following in my app-config File: &lt;context:component-scan base-package="package containing my controllers and MyCustomExceptionController"&gt; &lt;context:include-filter type="annotation" expression="org.springframework.web.bind.annotation.ControllerAdvice" /&gt; &lt;/context:component-scan&gt; Any ideas why this isn't working?
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/40085586
has answer: http://stackoverflow.com/a/21894894
has comment: http://stackoverflow.com/comment/33139477
downvote count: 0
has comment: http://stackoverflow.com/comment/33144412
tagged with: java
upvote count: 8
type: Question

http://stackoverflow.com/comment/33233309
comment on: http://stackoverflow.com/q/21938292
type: Comment
type: QuestionComment
has text: Are you sure the second new rectangle is in between braces, always use braces to contain functionality in loops or if statements.
score: 0

http://stackoverflow.com/q/21946520
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21947088
has comment: http://stackoverflow.com/comment/33248636
downvote count: 0
has comment: http://stackoverflow.com/comment/33248496
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33248418
has answer: http://stackoverflow.com/a/21947088
has body: Can somebody please explain in plain English how this works (or at least why my structure doesn't)? I want a function called ExportLicenseInfo in my Jersey servlet resource, which I have called ExportResource, to map to http://example.com/myApp/export/software_licenses.{year}-{month}.{format}, for example: http://example.com/myApp/export/software_licenses_2013-10.csv Servlet config in web.xml: ExportServlet org.glassfish.jersey.servlet.ServletContainer javax.ws.rs.Application com.mycompany.app.ExportApplication 1 My servlet mapping in web.xml: ExportServlet /export My code with @Path annotations: @Path("/export") public class ExportResource { ... @GET @Produces({"text/csv", "application/json"}) @Path("/software_licenses_{year: [0-9][0-9][0-9][0-9]}-{month: [0-1][0-9]}.{format}") public String ExportLicenseInfo( ... ) { ... } When I try to access the resource, I get a 404. Jersey trace log: Feb 21, 2014 2:41:46 PM org.glassfish.jersey.filter.LoggingFilter log INFO: 6 * LoggingFilter - Request received on thread http-bio-8080-exec-67 6 > GET http://localhost:8080/app/export/software_licenses_2013-10.csv 6 > host: localhost:8080 6 > connection: keep-alive 6 > cache-control: max-age=0 6 > accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 6 > user-agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36 6 > accept-encoding: gzip,deflate,sdch 6 > accept-language: en 6 > cookie: JSESSIONID=DB64E0B066BDEE8CABFC94686AD6ACDC.test; JSESSIONIDSSO=61B51CEED61F8F6CE8A8DB46B38BAC9F; i18next=en Feb 21, 2014 2:41:46 PM org.glassfish.jersey.filter.LoggingFilter log INFO: 6 * LoggingFilter - Response received on thread http-bio-8080-exec-67 6 < 404
has comment: http://stackoverflow.com/comment/33248483
tagged with: servlets
upvote count: 1
has title: Jersey servlet mapping confusion
answer count: 1
tagged with: jersey-2.0
has comment: http://stackoverflow.com/comment/33248492
favorite count: 0
has comment: http://stackoverflow.com/comment/33248553
tagged with: web-services

http://stackoverflow.com/a/21891966
score: -1
type: Answer
answers question: http://stackoverflow.com/q/21891403
has body: You can use a stringbuilder to append each sum to a string and then print it out after the loop is over. StringBuilder columnTotal = new StringBuilder(); for (....){ columnTotal.append(sum) } System.out.println(columnTotal)
downvote count: 1
upvote count: 0

equals
tags question: http://stackoverflow.com/q/21977130
tags question: http://stackoverflow.com/q/21926248
tags question: http://stackoverflow.com/q/21975823
type: Tag
tags question: http://stackoverflow.com/q/21936103
tags question: http://stackoverflow.com/q/21973180
tags question: http://stackoverflow.com/q/21908158
tags question: http://stackoverflow.com/q/21888802
tag name: equals

http://stackoverflow.com/comment/33299313
has text: @Radiodef What I have works but what bothered me as I contemplated adding another four parameters was readability and maintainability. I had a feeling there could be a neater solution and that's why I wanted to ask how people do this generally.
comment on: http://stackoverflow.com/q/21974920
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33302591
type: Comment
has text: public static Map<Double, Character> memory = new HashMap<Double, Character>(); this syntax works for me. Have you added import java.util.Map; in your code
comment on: http://stackoverflow.com/a/21976722
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33360165
has text: @Samhain ultimately my goal is to be able to get those functions called and then let the C# code know about it, what is the correct way to do that?
comment on: http://stackoverflow.com/q/21951711
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33279352
comment on: http://stackoverflow.com/a/21963837
score: 0
type: AnswerComment
has text: maybe that's what I am lacking the "path of dynamicreports jar" which is not present in the code Run path.
type: Comment

http://stackoverflow.com/q/21873315
linked to: http://stackoverflow.com/q/3721572
score: 0
has comment: http://stackoverflow.com/comment/33121824
answer count: 3
has body: I've been seraching for this for quite a long time, but found no good answer. I have four fields which accept files from user, Left File : Right File : Config File : my File : upload how to identify if the user chooses to upload same file all the four times and prevent it (i.e duplicate uploads)? this may be on the JSP side or on the sevlet java side. Using commons file upload. I've found on my search here that I need to use DigestOutputStream, but no where I could find how to use it and was of no use. ---------------------------------------------EDIT-------------------------------------- Based on the answers below, I've updated my code as follows, Left File : Right File : Config File : Geco File : Click to Upload Still the code doesn't work what is my mistake?
has title: JSP identify duplicate file upload
has comment: http://stackoverflow.com/comment/33122425
has comment: http://stackoverflow.com/comment/33121894
has comment: http://stackoverflow.com/comment/33121745
has answer: http://stackoverflow.com/a/21873864
has answer: http://stackoverflow.com/a/21873394
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21874103
accepted answer: http://stackoverflow.com/a/21874103
tagged with: apache-commons
tagged with: java
type: Question
tagged with: jsp
tagged with: javascript
possible better answer: http://stackoverflow.com/a/21873394
linked to: http://stackoverflow.com/q/5470219

http://stackoverflow.com/a/21899903
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You can use sequence generator to generate your unique Id. For each category you said above(eg: doctor, patient) you can create different sequence. The method and syntax to create a sequence depends on the DB that you are using. Furthermore, if you are using JPA or Hibernate or any other persistence API, then most probably you will be enable to generate such sequence with the help of API only. For ex: In JPA you can use the following annotation to create a sequence(Note that there are other ways to do the same but this is just for your reference). @GeneratedValue(generator="my_seq") @SequenceGenerator(name="my_seq",sequenceName="MY_SEQ", allocationSize=1)
answers question: http://stackoverflow.com/q/21899237
accepted answer of: http://stackoverflow.com/q/21899237
upvote count: 1
score: 1

http://stackoverflow.com/comment/33065385
score: 0
type: Comment
has text: Can you post a small code sample that explains why you think it cached the result?
type: QuestionComment
comment on: http://stackoverflow.com/q/21843956

http://stackoverflow.com/q/21977591
tagged with: swing
tagged with: mouse
type: AnsweredQuestion
has title: Making a paint program, previous location color changing
tagged with: java
type: Question
tagged with: graphics
accepted answer: http://stackoverflow.com/a/21977721
score: 0
has answer: http://stackoverflow.com/a/21977721
answer count: 1
has body: Im making a small painting program that basically has buttons on the left, indicating the colors, and wherever you click and drag, it'll draw a circle using graphics. i know, not efficient at all, and i can be using strokes and stuff, but im still learning and didn't get to that yet, so im testing it out with what i know. Everything seems to be working, with one small problem. I can click, drag, and a line is drawn. But when i change the color, and go draw something else, the first circle drawn is the previous color. I have tried many things but cant seem to fix it. import java.awt.Color; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.util.ArrayList; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.Timer; public class painting extends JFrame{ ArrayList&lt;Integer&gt; mouseLocXList = new ArrayList&lt;Integer&gt;(); ArrayList&lt;Integer&gt; mouseLocYList = new ArrayList&lt;Integer&gt;(); ArrayList&lt;Color&gt; colors = new ArrayList&lt;Color&gt;(); Color colorChosen = Color.black; String[] colorsSideBarButtonString = {"Red", "Blue", "Green", "Orange", "Pink"}; Color[] colorsSideBar = {Color.red, Color.blue, Color.green, Color.orange , Color.pink}; JButton[] buttons = new JButton[colorsSideBarButtonString.length]; public painting(){ setSize(1200,700); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); setBackground(Color.WHITE); setLayout(null); setFocusable(true); addMouseMotionListener(new handler()); colors.add(Color.black); for(int x = 0; x &lt; colorsSideBarButtonString.length; x++){ buttons[x] = new JButton(colorsSideBarButtonString[x]); buttons[x].setBounds(2,(x*50)+30,70,46); add(buttons[x]); buttons[x].addActionListener(new buttonListener()); } setVisible(true); } public static void main(String[] args){ new painting(); } public void pa…
tagged with: jframe

selenium
tags question: http://stackoverflow.com/q/21854085
tags question: http://stackoverflow.com/q/21899641
tags question: http://stackoverflow.com/q/21949689
tags question: http://stackoverflow.com/q/21982686
tags question: http://stackoverflow.com/q/21868197
tags question: http://stackoverflow.com/q/21878474
tags question: http://stackoverflow.com/q/21942680
tags question: http://stackoverflow.com/q/21918741
tags question: http://stackoverflow.com/q/21871568
tags question: http://stackoverflow.com/q/21992302
tags question: http://stackoverflow.com/q/21877839
tags question: http://stackoverflow.com/q/21987471
tags question: http://stackoverflow.com/q/21892347
tags question: http://stackoverflow.com/q/21866395
tags question: http://stackoverflow.com/q/21849063
tags question: http://stackoverflow.com/q/21954424
tags question: http://stackoverflow.com/q/22004176
tags question: http://stackoverflow.com/q/21908112
tag name: selenium
tags question: http://stackoverflow.com/q/21926171
tags question: http://stackoverflow.com/q/21962701
tags question: http://stackoverflow.com/q/21910789
tags question: http://stackoverflow.com/q/21967914
tags question: http://stackoverflow.com/q/21885075
tags question: http://stackoverflow.com/q/21888317
tags question: http://stackoverflow.com/q/21907007
tags question: http://stackoverflow.com/q/21887677
tags question: http://stackoverflow.com/q/21985993
tags question: http://stackoverflow.com/q/21892880
tags question: http://stackoverflow.com/q/21994459
tags question: http://stackoverflow.com/q/21987383
tags question: http://stackoverflow.com/q/21871000
tags question: http://stackoverflow.com/q/21904543
tags question: http://stackoverflow.com/q/21863025
tags question: http://stackoverflow.com/q/21955059
tags question: http://stackoverflow.com/q/21852298
tags question: http://stackoverflow.com/q/21879435
tags question: http://stackoverflow.com/q/21858260
tags question: http://stackoverflow.com/q/21850193
tags question: http://stackoverflow.com/q/21929341
type: Tag
tags question: http://stackoverflow.com/q/21874865
tags question: http://stackoverflow.com/q/21930969
tags question: http://stackoverflow.com/q/21959564
tags question: http://stackoverflow.com/q/21865501
tags question: http://stackoverflow.com/q/21945377
tags question: http://stackoverflow.com/q/21879867

http://stackoverflow.com/comment/33344108
comment on: http://stackoverflow.com/q/22000062
score: 0
type: Comment
type: QuestionComment
has text: Can the user ask: 'What is `.5` degree's C ?'

http://stackoverflow.com/q/21926349
downvote count: 4
tagged with: for-loop
has comment: http://stackoverflow.com/comment/33212016
upvote count: 0
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/33212091
has answer: http://stackoverflow.com/a/21926463
has answer: http://stackoverflow.com/a/21926404
duplicate of: http://stackoverflow.com/q/19435242
has comment: http://stackoverflow.com/comment/33211772
favorite count: 0
has answer: http://stackoverflow.com/a/21926471
has comment: http://stackoverflow.com/comment/33211829
type: Question
has body: I need this code to print out the lowest score entered and I'm sitting here for hours and I can't figure out how to do it.I know how to make it using arrays but I need to use for loops.Do you have any hints? Example output: How many scores? 3 Enter score 1: 90 Enter score 2: 80 Enter score 3: 100 Lowest score is 80 My code: int score,numScore,count; Scanner keyboard = new Scanner(System.in); System.out.print("How many scores? "); numScore = keyboard.nextInt(); for(count = 1; count &lt;= numScore; count++){ System.out.print("Enter score " + count + ":"); score = keyboard.nextInt(); }
tagged with: java
tagged with: loops
has answer: http://stackoverflow.com/a/21926400
linked to: http://stackoverflow.com/q/19435242
has title: How do I find the lowest score entered using for loops
answer count: 4

http://stackoverflow.com/a/21982296
has body: i think you forgot to add an ActionListener to your newSet Button, below you'll find a working example. I commented the two lines with the icon, so uncomment and try it. import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; /** * * @author ottp * @version 1.0 */ public class CardPanel extends JPanel { final private JLabel label; private JButton addSetButton; private JPanel actives, optionsPanel,cardPanel, flashCardsPanel, bottomPanel; public CardPanel() { actives = new JPanel(); actives.setPreferredSize(new Dimension(1000, 50)); actives.setBackground(Color.BLUE); this.add(actives); label = new JLabel(); actives.add(label); optionsPanel = new JPanel(); optionsPanel.setPreferredSize(new Dimension(200, 350)); optionsPanel.setBackground(Color.cyan); this.add(optionsPanel); cardPanel = new JPanel(); cardPanel.setPreferredSize(new Dimension(580, 350)); cardPanel.setBackground(Color.green); this.add(cardPanel); flashCardsPanel = new JPanel(); flashCardsPanel.setPreferredSize(new Dimension(200, 350)); flashCardsPanel.setBackground(Color.white); this.add(flashCardsPanel); bottomPanel = new JPanel(); bottomPanel.setLayout(new FlowLayout()); bottomPanel.setPreferredSize(new Dimension(1000, 400)); bottomPanel.setBackground(Color.black); this.add(bottomPanel); this.addSetButton = new JButton("Add Set"); addSetButton.setPreferredSize(new Dimension(150, 30)); optionsPanel.add(addSetButton, BorderLayout.WEST); addSetButton.addActionListener(new ButtonListener()); } public class ButtonListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { label.setForeground(Color.WHITE); label.setText("Active set: " + e.getActionCommand()); if(e.getSource().equals(addSetButton)) { getSetInfo(); } } …
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21978743
answers question: http://stackoverflow.com/q/21978743

http://stackoverflow.com/comment/33149520
score: 0
has text: The last thing in the world I want to be is a burden :) But as I said in my OP, I'm not great with Encryption stuff so I really dont' know how to add in the 0 padding (worst practice or not). Can you provide me with a small code sample to start with? Muchas.
comment on: http://stackoverflow.com/a/21891059
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21998826
has comment: http://stackoverflow.com/comment/33393285
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/22019815
accepted answer: http://stackoverflow.com/a/22019815
type: AnsweredQuestion
downvote count: 0
type: Question
has title: Getting unwanted characters in response from service
has comment: http://stackoverflow.com/comment/33725418
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33342390
has comment: http://stackoverflow.com/comment/33378571
upvote count: 1
has body: Getting unwanted characters in response. I have a simple Restful service that takes objects as input and converts them into JSON string and returns it back. I am using google json api for this task. However all the "=" is getting converted to "=" in the response from the service. Input to the service: [{PageViewEvent=PageViewEvent{pageName=Home Page, pageType=Home}}] Output from service: "[{PageViewEvent=PageViewEvent{pageName=Home Page, pageType=Home}}]" Service.java @POST @Path("/events") @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.APPLICATION_JSON) public String handlePost(String events) { log.debug("before: " + events); String jsonResponse = JsonConverter.toJSON(events); log.debug("atfter: " + jsonResponse); return jsonResponse; } Please guide.
answer count: 1

http://stackoverflow.com/comment/33160000
type: Comment
type: AnswerComment
has text: what do you mean? you are doing this in the code: mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); it means that you have drawer_layout in the xml file. just add the gravity property to it
score: 0
comment on: http://stackoverflow.com/a/21896454

http://stackoverflow.com/comment/33105644
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21861004
has text: If it does not need to be editable, use a `JLabel` with HTML and a body width set.

http://stackoverflow.com/a/21873148
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/21872888
has body: 0x1000000 is not an arithmetic expression, it's hexadecimal value for 16777216. Math.random returns a random value between 0 and 1, which you then can multiply with the range you're looking for; in your case a full integer. That integer is then used as argument to a Color-instance which will extract 3 bytes; red, green, and blue m, creating a very random color. As requested. Alternatively, you could create each color-component individually, making more sense, perhaps, using something like; color = new Color( Math.random() * 255, //red Math.random() * 255, //green Math.random() * 255); //blue
score: 2

http://stackoverflow.com/comment/33251356
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21948318
has text: Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.anshikka.datagushalpha .slidingpanelayout.ListBookmarkFragment: make sure class name exists, is public, and has an empty constructor that is public
score: 0

http://stackoverflow.com/comment/33149997
has text: The way you have this written you would need to enter **12** numbers in total (one before, then eleven in the loop) for that loop to complete.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21891352

http://stackoverflow.com/a/21952022
answers question: http://stackoverflow.com/q/21951966
has comment: http://stackoverflow.com/comment/33258026
accepted answer of: http://stackoverflow.com/q/21951966
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has body: Any initializaton should be done inside the onCreate() method of your Activity. So please move, setContentView(R.layout.activity_main); TextView textView = (TextView) findViewById(R.id.outputView); to your onCreate method. And only call textView.setText(result); in the postExecute() method. Also ensure your textView is a class level variable to access it outside your onCreate().
has comment: http://stackoverflow.com/comment/33257968
has comment: http://stackoverflow.com/comment/33258068
score: 1

http://stackoverflow.com/comment/33227520
comment on: http://stackoverflow.com/a/21934280
type: AnswerComment
score: 0
type: Comment
has text: @BennX, added one more possible reason for this issue.

http://stackoverflow.com/a/21941229
downvote count: 0
score: 1
has body: count will never be greater than 5. It is declared at the top of your for loop, which terminates at 4 (&lt; 5). You need to keep an activity-level (class level) variable that will track how many times the button has been clicked, instead of using the for loop.
upvote count: 1
answers question: http://stackoverflow.com/q/21941146
type: Answer

jsf-2
tags question: http://stackoverflow.com/q/21881767
type: Tag
tags question: http://stackoverflow.com/q/21882974
tags question: http://stackoverflow.com/q/21948157
tags question: http://stackoverflow.com/q/21904544
tag name: jsf-2
tags question: http://stackoverflow.com/q/21889574
tags question: http://stackoverflow.com/q/21960763
tags question: http://stackoverflow.com/q/21906255
tags question: http://stackoverflow.com/q/21878146
tags question: http://stackoverflow.com/q/21887122
tags question: http://stackoverflow.com/q/21871174
tags question: http://stackoverflow.com/q/21980309
tags question: http://stackoverflow.com/q/21942116
tags question: http://stackoverflow.com/q/21888001
tags question: http://stackoverflow.com/q/21878342

http://stackoverflow.com/comment/33268360
type: Comment
has text: Could you tell me what happens when synchronized (System.out) is executed.synchronized is used for synchronizing a thread ,how System.out is a thread?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21957744

http://stackoverflow.com/q/21843270
has answer: http://stackoverflow.com/a/21843368
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33063989
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/21843368
has comment: http://stackoverflow.com/comment/33064003
upvote count: 2
score: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/33064075
possible better answer: http://stackoverflow.com/a/21843348
has answer: http://stackoverflow.com/a/21843348
has body: This is what I have... { public static void main(String[] args) { //variable declaration char letter; getLetter(); letter = ""; System.out.println(letter) } public static int getLetter() { String text; char letter; text = JOptionPane.showInputDialog("Enter a letter."); letter = text.charAt(0); System.out.println(letter); return letter; } } I want to get the letter the user inputs from the method getLetter and transfer it in the main method where I can display it on the screen. What am I doing wrong here?
has title: How to return a char value from one method to another?
has comment: http://stackoverflow.com/comment/33063957
tagged with: java
answer count: 2

http://stackoverflow.com/comment/33269055
type: AnswerComment
comment on: http://stackoverflow.com/a/21958307
has text: Sorry, but your advice is bad. This means that your code won't work if the user tabs into the field for example. It's rare that you want to use a MouseListener on a JTextField.
type: Comment
score: 2

http://stackoverflow.com/a/21847520
upvote count: 1
has comment: http://stackoverflow.com/comment/33071910
has comment: http://stackoverflow.com/comment/33108584
downvote count: 0
answers question: http://stackoverflow.com/q/21847418
has body: Chuck all the letters into a map with the value being what you want. E.g. HashMap hm = new HashMap(); hm.put ('A', new Integer (1)); hm.put ('B', new Integer (2)); Then to use int arr [] = new int [myString.length ()]; for (int x = 0; x &lt; myString.length ();) { Integer i = (Integer) hm.get (myString.charAt(x)); if (i!=null) { arr[x++] = i; } }
has comment: http://stackoverflow.com/comment/33117708
type: Answer
has comment: http://stackoverflow.com/comment/33073572
score: 1
has comment: http://stackoverflow.com/comment/33072268

http://stackoverflow.com/comment/33102090
comment on: http://stackoverflow.com/a/21864408
score: 0
type: Comment
type: AnswerComment
has text: Not only does it make sense, it is documented in the Javadoc. If the peer is creating an ObjectOutputStream, it must be doing so *after* creating its ObjectInputStream, which causes a deadlock, as I said above.

http://stackoverflow.com/a/21920224
has comment: http://stackoverflow.com/comment/33202055
has comment: http://stackoverflow.com/comment/33201719
type: AcceptedAnswer
has body: You have forgotten the generics on your BiFunction: public static void main(final String[] args) throws Exception { final Map&lt;String, Integer&gt; map = new HashMap&lt;&gt;(); map.put("A", 1); map.put("B", 2); map.put("C", 3); final BiFunction&lt;String, Integer, Integer&gt; remapper = (k, v) -&gt; v == null ? 42 : v + 41; map.compute("A", remapper); } Running: PS C:\Users\Boris&gt; java -version java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b120) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b62, mixed mode)
score: 52
has comment: http://stackoverflow.com/comment/33201848
type: Answer
answers question: http://stackoverflow.com/q/21920039
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21920039
upvote count: 52
has comment: http://stackoverflow.com/comment/33216541
has comment: http://stackoverflow.com/comment/33207618
has comment: http://stackoverflow.com/comment/33202432

http://stackoverflow.com/a/23871715
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
has body: I've implemented grid view with data provider which requires only iterator, without size information - its called IterableGridView Here is the code: https://github.com/maciejmiklas/cyclop/tree/master/cyclop-wicket-components Iterable Grid View is based on Wicket's GridView, however it does not work with IDataProvider but with IterableDataProvider. This new data provider relies only on plain java iterator - size information is not needed, and there is also no need to create range iterators for each page. final List&lt;String&gt; myGridData = new ArrayList&lt;&gt;(); myGridData.add("value 1"); myGridData.add("value 2"); IterableDataProvider&lt;String&gt; iterableDataProvider = new IterableDataProvider&lt;String&gt;(10) { @Override protected Iterator&lt;String&gt; iterator() { return myGridData.iterator(); } @Override public IModel&lt;String&gt; model(String s) { return Model.of(s); } @Override public void detach() { } }; IterableGridView&lt;String&gt; myGrid = new IterableGridView&lt;String&gt;("myGrid", iterableDataProvider) { @Override protected void populateEmptyItem(Item&lt;String&gt; item) { item.add(new Label("myValue")); } @Override protected void populateItem(Item&lt;String&gt; item) { item.add(new Label("myValue", item.getModelObject())); } }; add(myGrid); myGrid.setItemsPerPage(10); // you have to use custom pager and not AjaxPagingNavigator IterablePagingNavigator pager = new IterablePagingNavigator("rowNamesListPager", rowNamesList); resultTable.add(pager);
accepted answer of: http://stackoverflow.com/q/21846927
upvote count: 1
answers question: http://stackoverflow.com/q/21846927

http://stackoverflow.com/comment/33326905
has text: Are you using an old android device? it's probably a GPU problem.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21990699

m2eclipse
tags question: http://stackoverflow.com/q/21996804
type: Tag
tag name: m2eclipse
tags question: http://stackoverflow.com/q/21912921
tags question: http://stackoverflow.com/q/21955207

http://stackoverflow.com/comment/33104234
type: Comment
comment on: http://stackoverflow.com/q/21864521
score: 0
has text: In my experience NoSuchFieldError usually means that you compiled with one version of a library/jarfile, but are executing against another which has revised that class. If you moved from one environment to another, check that your libraries were at the same levels (you may need to drag private copies of them with you and play classloader ordering games), and/or rebuild against the version the new environment provides.
type: QuestionComment

http://stackoverflow.com/a/21901509
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21901436
has body: Not the execution of the line B.compute(); alone creates a new thread; the line executorService.submit submits a new Callable to the ExecutorService which runs in a new thread.

http://stackoverflow.com/q/21989283
tagged with: gwt
accepted answer: http://stackoverflow.com/a/21989342
has comment: http://stackoverflow.com/comment/33323706
has answer: http://stackoverflow.com/a/21989342
has comment: http://stackoverflow.com/comment/33323658
downvote count: 0
answer count: 1
tagged with: string
favorite count: 0
has body: I've to replace everything between two strings in GWT. For example, In The string "&lt;script&gt; something ... start .... &lt;/script&gt;" I want to replace everything between start and &lt;/script&gt;. I used theString.replaceAll("start.*?&lt;/script&gt;", "") but nothing happens. I tried this in a Java program it replace everything from start but this doesn't happen in GWT client side code. How do we achieve this?
has title: GWT String.replace not working
tagged with: regex
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
type: Question

http://stackoverflow.com/comment/33539621
comment on: http://stackoverflow.com/q/21923158
score: 1
has text: JSF implementations (RichFaces, Primefaces, ...) already have rich text editor component. This editor works in all major browsers (IE included).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33166518
type: Comment
has text: Is the cause that why you are getting \Unknown column 'providerti0_.provider_id' in 'field list'
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21898806

recursion
type: Tag
tags question: http://stackoverflow.com/q/22000745
tags question: http://stackoverflow.com/q/21996728
tags question: http://stackoverflow.com/q/21957728
tags question: http://stackoverflow.com/q/21916653
tags question: http://stackoverflow.com/q/21867193
tag name: recursion
tags question: http://stackoverflow.com/q/22000977
tags question: http://stackoverflow.com/q/21874340
tags question: http://stackoverflow.com/q/21896303
tags question: http://stackoverflow.com/q/21951612
tags question: http://stackoverflow.com/q/21864019
tags question: http://stackoverflow.com/q/22004321
tags question: http://stackoverflow.com/q/21998015
tags question: http://stackoverflow.com/q/21924315
tags question: http://stackoverflow.com/q/21915432
tags question: http://stackoverflow.com/q/21942720
tags question: http://stackoverflow.com/q/21865625
tags question: http://stackoverflow.com/q/21867973
tags question: http://stackoverflow.com/q/21913159
tags question: http://stackoverflow.com/q/21897308
tags question: http://stackoverflow.com/q/21985776
tags question: http://stackoverflow.com/q/21843649
tags question: http://stackoverflow.com/q/21998306
tags question: http://stackoverflow.com/q/21988660
tags question: http://stackoverflow.com/q/21976850
tags question: http://stackoverflow.com/q/21842585
tags question: http://stackoverflow.com/q/22003994
tags question: http://stackoverflow.com/q/22004235
tags question: http://stackoverflow.com/q/21897093

http://stackoverflow.com/comment/95472228
type: Comment
has text: Doesn't work. I ran the exact same steps and I still see jdk 8 instead of `9.0.1`.
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/24657630

http://stackoverflow.com/a/21952204
has body: Please take a look at the reporting examples. They involve an existing PDF: state.pdf that can be filled out in different ways. One could fill out the PDF and submit it, as is done in the example from my book: subscribe.pdf. Unfortunately, a number of PDF viewers (such as Chrome PDF viewer) don't support this. You can also fill out an HTML form and use the data to fill out the PDF. See for instance the iText samples I prepared for a tutorial video. You can pre-fill a form or flatten it. The standalone examples can be found on itextpdf.com; the web app examples are available on github. Some additional remarks: The examples explain how to work with AcroForm technology. They don't discuss XFA. If you intend to create a commercial product, please understand that you may need to purchase a license for your use of iText. Tax authorities of different countries (including the IRS in the US) are a customer of iText Software, using iText in the exact way you're describing.
type: Answer
answers question: http://stackoverflow.com/q/21943243
score: 0

http://stackoverflow.com/q/21859598
accepted answer: http://stackoverflow.com/a/45316788
tagged with: asynchronous
has comment: http://stackoverflow.com/comment/33093149
score: 14
type: AnsweredQuestion
has body: I don't understand when AsyncListener#onError method is called. Javadoc doesn't help: Notifies this AsyncListener that an asynchronous operation has failed to complete. How could it fail? How can I reproduce this error? UPDATE: // in HttpServlet doGet method AsyncContext asyncContext = req.startAsync(); asyncContext.addListener(new AsyncListener() { // some code @Override public void onError(AsyncEvent event) { // when is it called? } }); executeInSomeOtherThread(asyncContext); What do I need to do in other thread to fail this async operation?
has title: Usage of AsyncListener#onError
type: Question
has comment: http://stackoverflow.com/comment/33106885
tagged with: java
tagged with: servlet-3.0
upvote count: 14
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33106495
has answer: http://stackoverflow.com/a/45316788

android
tags question: http://stackoverflow.com/q/21889247
tags question: http://stackoverflow.com/q/22003338
tags question: http://stackoverflow.com/q/21900999
tags question: http://stackoverflow.com/q/21946744
tags question: http://stackoverflow.com/q/21966026
tags question: http://stackoverflow.com/q/22002691
tags question: http://stackoverflow.com/q/21914770
tags question: http://stackoverflow.com/q/21980189
tags question: http://stackoverflow.com/q/21848957
tags question: http://stackoverflow.com/q/21990667
tags question: http://stackoverflow.com/q/21910145
tags question: http://stackoverflow.com/q/21866559
tags question: http://stackoverflow.com/q/21887402
tags question: http://stackoverflow.com/q/21958519
tags question: http://stackoverflow.com/q/21851552
tags question: http://stackoverflow.com/q/21868264
tags question: http://stackoverflow.com/q/21952933
tags question: http://stackoverflow.com/q/21966714
tags question: http://stackoverflow.com/q/21888202
tags question: http://stackoverflow.com/q/21843117
tags question: http://stackoverflow.com/q/21984880
tags question: http://stackoverflow.com/q/21922474
tags question: http://stackoverflow.com/q/21866078
tags question: http://stackoverflow.com/q/21872636
tags question: http://stackoverflow.com/q/21860557
tags question: http://stackoverflow.com/q/21973808
tags question: http://stackoverflow.com/q/21922766
tags question: http://stackoverflow.com/q/21975898
tags question: http://stackoverflow.com/q/21930817
tags question: http://stackoverflow.com/q/21891919
tags question: http://stackoverflow.com/q/21844036
tags question: http://stackoverflow.com/q/21918553
tags question: http://stackoverflow.com/q/22000046
tags question: http://stackoverflow.com/q/21902533
tags question: http://stackoverflow.com/q/21870959
tags question: http://stackoverflow.com/q/21950066
tags question: http://stackoverflow.com/q/21927221
tags question: http://stackoverflow.com/q/21943471
tags question: http://stackoverflow.com/q/21869604
tags question: http://stackoverflow.com/q/21949591
tags question: http://stackoverflow.com/q/21907429
tags question: http://stackoverflow.com/q/21902360
tags question: http://stackoverflow.com/q/21904662
tags question: http://stackoverflow.com/q/21854552
tags question: http://stackoverflow.com/q/21857829
tags question: http://stackoverflow.com/q/21971627
tags question: http://stackoverflow.com/q/21925271
tags question: http://stackoverflow.com/q/21962229
tags question: http://stackoverflow.com/q/21942092
tags question: http://stackoverflow.com/q/21905287
tags question: http://stackoverflow.com/q/21960068
tags question: http://stackoverflow.com/q/21963228
tags question: http://stackoverflow.com/q/21974786
tags question: http://stackoverflow.com/q/21945358
tags question: http://stackoverflow.com/q/21931433
tags question: http://stackoverflow.com/q/21933832
tags question: http://stackoverflow.com/q/21945322
tags question: http://stackoverflow.com/q/21973396
tags question: http://stackoverflow.com/q/21913298
tags question: http://stackoverflow.com/q/21922082
tags question: http://stackoverflow.com/q/21962276
tags question: http://stackoverflow.com/q/21846539
tags question: http://stackoverflow.com/q/21893910
tags question: http://stackoverflow.com/q/21979722
tags question: http://stackoverflow.com/q/21918897
tags question: http://stackoverflow.com/q/21865621
tags question: http://stackoverflow.com/q/21940258
tags question: http://stackoverflow.com/q/21937256
tags question: http://stackoverflow.com/q/21851034
tags question: http://stackoverflow.com/q/21956070
tags question: http://stackoverflow.com/q/21892760
tags question: http://stackoverflow.com/q/21973682
tags question: http://stackoverflow.com/q/21938292
tags question: http://stackoverflow.com/q/21949983
tags question: http://stackoverflow.com/q/22000137
tags question: http://stackoverflow.com/q/21962495
tags question: http://stackoverflow.com/q/22005012
tags question: http://stackoverflow.com/q/21867274
tags question: http://stackoverflow.com/q/21982367
tags question: http://stackoverflow.com/q/21915254

http://stackoverflow.com/comment/33198959
has text: hell, i don't even understand the first line.. what is the significance of those chars?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21903473
type: AnswerComment

http://stackoverflow.com/a/21880569
upvote count: 3
has comment: http://stackoverflow.com/comment/33134695
type: Answer
has comment: http://stackoverflow.com/comment/33131782
has comment: http://stackoverflow.com/comment/33130872
downvote count: 0
has comment: http://stackoverflow.com/comment/33131078
has comment: http://stackoverflow.com/comment/33131731
score: 3
has comment: http://stackoverflow.com/comment/33130275
has body: While sending Instead of int[] xPATHS = {PATH_1,PATH_2, PATH_3, PATH_4, PATH_5}; Intent intent = new Intent(Examples.this, ExamplesViewer.class); intent.putExtra("PATHS", xPATHS); try int[] xPATHS = {PATH_1,PATH_2, PATH_3, PATH_4, PATH_5}; Intent intent = new Intent(Examples.this, ExamplesViewer.class); Bundle bundle =new Bundle(); bundle.putIntArray("PATHS", xPATHS); // Change here Instead of Bundle intent = getIntent().getExtras(); int[] PATHS = intent.getIntArray("PATHS"); try Bundle bundle = new Bundle(); int[] PATHS = bundle.getIntArrayExtra("PATHS"); // change here
answers question: http://stackoverflow.com/q/21880450

http://stackoverflow.com/a/21977337
has body: Joda-Time Joda-Time and its Interval class with the overlap method is just what you need. Very easy. Time Zone Unlike java.util.Date, a DateTime truly knows its assigned time zone. Generally better to specify than rely on default. Note that if you are tracking date+time (a DateTime rather than a LocalDate), then time zone is critical. The definition of a "day" beginning and ending depends on time zone. Businesses that work across time zones may choose to use UTC for this purpose. Span of Time FYI, besides Interval, Joda-Time also offers the Period and Duration classes for working with a span of time. Start of Day When working with date-time values but focusing on a "day", then adjust the time portion to the first moment of the day for that particular time zone. In Joda-Time, simply call the withTimeAtStartOfDay method. Avoid the "midnight"-related classes and methods. They are no longer recommended by the Joda-Time team. Half-Open Joda-Time uses the "Half-Open" approach when comparing spans of time. The beginning in inclusive and the ending is exclusive. That means since you want from December 1 to March 31 that we define an Interval of the first moment of the day of December 1 to the first moment of the day of April 1. If you ponder this, and search StackOverflow for other postings on "joda interval", you'll come to see the wisdom of this approach. Comparison The Interval class offers handy comparison methods: contains, abuts, overlap, and gap. Be sure to read the doc to understand exact details. java.time Java 8 brings the new java.time package, inspired by Joda-Time, defined by JSR 310. Joda-Time continues to work in Java 8, but you may want to learn java.time rather than Joda-Time if you are new to date-time work. Example Code DateTimeZone timeZone = DateTimeZone.forID( "Europe/Budapest" ); // Or, perhaps DateTimeZone.UTC // Inputs DateTime contractStart = new DateTime( 2014, 1, 2, 0, 0, 0, timeZone ); DateTime contractStop = new DateTime( 2014, 5, 6, 0, 0, 0, t…
accepted answer of: http://stackoverflow.com/q/21973842
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21973842

http://stackoverflow.com/comment/33199239
score: 0
type: AnswerComment
type: Comment
has text: It is also a bad practice to call non-final methods in a constructor as you describe; there are no guarantees as to their behavior in the subclass.
comment on: http://stackoverflow.com/a/21919080

http://stackoverflow.com/q/21932017
accepted answer: http://stackoverflow.com/a/21932436
possible better answer: http://stackoverflow.com/a/56989654
type: AnsweredQuestion
tagged with: validation
has comment: http://stackoverflow.com/comment/33226010
downvote count: 0
score: 1
has body: I'm trying to validate an XML file against an XSD file in JAVA. My problem is not the validation itself, since this is working fine. My problem is, that the XMLfile is not released after the validation. If I'm trying to access the file afterwards, I get the error "The file is used by another resource". This error only happens, when the validation fails (an exception is trown from the validator.validate(xmlSource);) If the file is validated without problems, the file is released and can be accessed by others. Any idears? public void validateXMLAgainstXSD(String xmlPath, String xsdPath) throws ParserException, IOException { Source xmlSource = null; File schemaFile = null; SchemaFactory schemaFactory = null; Schema schema = null; Validator validator = null; try { schemaFile = new File(xsdPath); xmlSource = new StreamSource(new File(xmlPath)); schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schema = schemaFactory.newSchema(schemaFile); validator = schema.newValidator(); validator.validate(xmlSource); } catch (SAXException e) { //_log.error("ParsingDataFile: XML file could not be validated against XSD file: XML File=&lt;", xmlFile.getAbsolutePath(), "&gt; XSD file=&lt;", xsdFile.getAbsolutePath(), "&gt;. Exception=&lt;", e, "&gt;"); xmlSource = null; schemaFile = null; schemaFactory = null; schema = null; validator.reset(); validator = null; //throw new ParserException(-1, ParserException.ERROR_CODE_XML_NOT_VALID, e); } }
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: Question
answer count: 2
has title: XML validation does not release the xml file
has comment: http://stackoverflow.com/comment/33229879
has answer: http://stackoverflow.com/a/21932436
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33221760
has answer: http://stackoverflow.com/a/56989654
has comment: http://stackoverflow.com/comment/33229949

http://stackoverflow.com/q/21981375
score: 0
has comment: http://stackoverflow.com/comment/33329774
answer count: 1
tagged with: outputstream
tagged with: bufferedreader
accepted answer: http://stackoverflow.com/a/21994379
tagged with: sockets
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33329723
has comment: http://stackoverflow.com/comment/33311104
has body: I am working on class project for a remote string processor. It's my very first project in Java, so I do not really understand what all is going on... I have everything finally working from Client to Server, but when it comes for the server to send the results back to the client, they both stay hang up and won't do anything until I forcefully close the server. Then "voilà!"... everything I was waiting for shows up on the client side. If you have encountered such an issue, you probably are smiling right now as you click in the Answer box down below :) Here is part of the server-side functions code, they give an idea about what I'm expecting to see on client-side as output. //Get an output stream for writing to the client socket dataSocket PrintStream socketOutput = new PrintStream(dataSocket.getOutputStream()); // some code here then // This is where the various functions are executed depending on // the value of the code entered by the user. // A string, an integer, or a // Boolean value depending on the case will be returned and printed if (string1 != null &amp;&amp; string2 != null) { System.out.println("STRINGS 1 AND 2 WERE NOT NULL, SO LET'S ENTER SWITCH"); switch (code) { case 1: System.out.println("IN CASE 1"); int returnedSign = string1.compareTo(string2); if (returnedSign &gt; 0) { System.out.println("IN CASE 1, returnedSign &gt; 0"); socketOutput.println(string1+" lexically follows "+string2); } else if (returnedSign &lt; 0) { System.out.println("IN CASE 1, returnedSign &lt; 0"); socketOutput.println(string2+" lexically follows "+string1); } else if (returnedSign == 0) { System.out.println("IN CASE 1, returnedSign == 0"); socketOutput.println(string1+" equals "+string2); } System.out.println("AT END OF CASE 1"); socketOutput.flush();// forcing the socketOutput to let go of any data break; Alright, and here is some client-side code that's supposed to receive the output of the server and display it on the client screen: // Get an output stream for writing to …
type: Question
has title: Why? Client won't get any feedback from the server unless server is closed (Control+C on Mac)
tagged with: java
has answer: http://stackoverflow.com/a/21994379
tagged with: inputstream
has comment: http://stackoverflow.com/comment/33311206

http://stackoverflow.com/comment/33235294
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21939274
has text: @user3304653 It's because you divided 120 down to 5, then your loop checked if `i<5` where i=5. 5<5 is false, as they're equal, so the loop exited.

http://stackoverflow.com/q/21889756
accepted answer: http://stackoverflow.com/a/21889995
score: 0
has comment: http://stackoverflow.com/comment/33150623
tagged with: spring
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33149580
has answer: http://stackoverflow.com/a/21889995
has body: I've started to read a book about Spring and I keep asking myself one question: What is the difference between defining beans using Spring Expression Language in spring's XML file and the normal way in Java class. For example we have two equivalent implementations: &lt;bean id="carl" class="springinaction.springidol.Instrumentalist" &gt; &lt;property name="song" value="#{kenny.song}" /&gt; &lt;/bean&gt; and Instrumentalist carl = new Instrumentalist(); carl.setSong(kenny.getSong()); When and why should I use one way instead of the other one?
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21889781
tagged with: dependency-injection
has answer: http://stackoverflow.com/a/21889781
has title: Defining beans with Spring
linked to: http://stackoverflow.com/q/130794

http://stackoverflow.com/q/21914198
has body: Any suggestions on how to solve this, I am unclear on where else to look. I am using a WAS 6.1 App Server, 1.5 jdk in RAD 8. SRVE0100E: Did not realize init() exception thrown by servlet SchedulerServlet: java.lang.ExceptionInInitializerError at java.lang.J9VMInternals.initialize(J9VMInternals.java:218) at com.met.ca.b2b.managers.ShedulerManager.loadParams(ShedulerManager.java:191) at com.met.ca.scheduler.servlet.SchedulerServlet.init(SchedulerServlet.java:87) at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:229) at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.init(ServletWrapper.java:350) at com.ibm.ws.webcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:1308) at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:183) at com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor.createServletWrapper(WebExtensionProcessor.java:99) at com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:902) at com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:824) at com.ibm.ws.webcontainer.webapp.WebApp.initializeTargetMappings(WebApp.java:542) at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:379) at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:338) at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:93) at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplication(VirtualHost.java:162) at com.ibm.ws.wswebcontainer.WebContainer.addWebApp(WebContainer.java:673) at com.ibm.ws.wswebcontainer.WebContainer.addWebApplication(WebContainer.java:626) at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:395) at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:611) at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1250) at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1…
answer count: 0
has comment: http://stackoverflow.com/comment/33367749
tagged with: classloader
type: UnansweredQuestion
tagged with: java
tagged with: jaxb
type: Question
has comment: http://stackoverflow.com/comment/33190536
has title: ExceptionInitializerError triggering javax.xml.bind.annotation.AccessType incompatible with javax.xml.bind.annotation.XmlAccessType
score: 0
tagged with: websphere
has comment: http://stackoverflow.com/comment/33326593
has comment: http://stackoverflow.com/comment/33200930

http://stackoverflow.com/a/21955547
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21955529
has body: Yes, the best way is to create only one instance of your class. It's the Singleton design pattern.
downvote count: 0

http://stackoverflow.com/q/21921763
tagged with: casting
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21922071
has answer: http://stackoverflow.com/a/21921999
downvote count: 0
favorite count: 0
tagged with: class
has body: As part of an autograder for a class I'm teaching, I would like to be able to test whether a student wrote a method whose return type was a numeric type (int, double, Integer, Double, etc.). I tried to do this as follows: Method m = StudentClass.class.getDeclaredMethod(/* ... */); return Number.class.isAssignableFrom(m.getReturnType()); This code will work correctly if the return type of the method is Integer or Double, but not if it's int or double. This confuses me, since it's legal to write Number n = 137; // Assign an int to a Number and Number n = 1.608; // Assign a double to a Number Why doesn't the code I've written above correctly if the method returns int or double? Aside from hardcoding tests to see if the result is int, long, char, double, etc., what can I do to test if the method returns a result of numeric type? Thanks!
type: Question
score: 3
has comment: http://stackoverflow.com/comment/33204839
has comment: http://stackoverflow.com/comment/33204779
upvote count: 3
answer count: 2
has title: Testing whether a method's return type is a number?
has answer: http://stackoverflow.com/a/21922071
has comment: http://stackoverflow.com/comment/46160845
tagged with: numbers
tagged with: reflection
tagged with: java
has comment: http://stackoverflow.com/comment/33204411
possible better answer: http://stackoverflow.com/a/21921999

http://stackoverflow.com/comment/33106152
comment on: http://stackoverflow.com/a/21866817
has text: @DavidWallace Why line by line when `org.apache.commons.io.FileUtils` reads the entire file to a String? :-)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33090854
type: QuestionComment
comment on: http://stackoverflow.com/q/21858451
has text: Also, since it appears that some [configuration](http://jena.apache.org/documentation/query/text-query.html#configuration) is needed in advance, you'll probably need to provide that, too, if you hope to get useful responses. There's not enough here yet to reproduce the problem that you're seeing.
score: 0
type: Comment

http://stackoverflow.com/comment/33102832
score: 0
has text: see: http://stackoverflow.com/questions/4517653/thread-safe-iteration-over-a-collection
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21865095

http://stackoverflow.com/q/21891125
has comment: http://stackoverflow.com/comment/33151962
type: AnsweredQuestion
tagged with: java
has body: I'm trying execute a vaadin7 application with JPA EclipseLink. I created a folder META-INF on src/ but doesn't work and returns this error bellow: javax.servlet.ServletException: com.vaadin.server.ServiceException: javax.persistence.PersistenceException: No Persistence provider for EntityManager named myapp com.vaadin.server.VaadinServlet.service(VaadinServlet.java:240) javax.servlet.http.HttpServlet.service(HttpServlet.java:723) I added all jars in Build-Path and WEB-INF/lib and my persistences.xml in src/META-INF is bellow. <?xml version="1.0" encoding="UTF-8"?> org.eclipse.persistence.jpa.PersistenceProvider com.example.testejpa.HelloWorld <property name="javax.persistence.jdbc.driver" value="com.mysq.jdbc.Driver" /> <property name="javax.persistence.jdbc.url" value="jdbc:mysql://xxx.xxx.xxx.xxx:3306/mydb" /> <property name="javax.persistence.jdbc.user" value="user" /> <property name="javax.persistence.jdbc.password" value="pass" /> <property name="eclipselink.logging.level" value="FINE"/> Any idea why this exception ?
tagged with: vaadin
possible better answer: http://stackoverflow.com/a/21891539
type: Question
has answer: http://stackoverflow.com/a/21891539
accepted answer: http://stackoverflow.com/a/21892047
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21892047
has title: Where to place persistence.xml when using eclipselink?
tagged with: jpa
tagged with: vaadin7

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

http://stackoverflow.com/a/21889828
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21886778
upvote count: 2
has body: Tomcat itself does not provide this functionality. However, as a workaround, you could work with your client to have a DMZ server or a location on their server which you can drop off files. Then they can have a job scheduler run a batch script (on windows) or shell script (on linux/unix platform) to check the newly arrived files/jar files using the jarsigner tool. if the files pass the test then they can be moved to Deploy directory of tomcat otherwise an email should go out to server administers about this unsigned file. example of command : jarsigner -verify jar-file http://docs.oracle.com/javase/tutorial/deployment/jar/verify.html

http://stackoverflow.com/comment/33173430
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21904181
type: Comment
has text: How to set image icon and icon margin if i add icon to the menu? I have tried to used html code, but the icon not showing. JMenu jmenuFile = new JMenu(" File ");. The "images" folder is in "src" folder.

http://stackoverflow.com/q/21925296
answer count: 1
tagged with: ms-access
score: 0
has comment: http://stackoverflow.com/comment/33211064
has title: Driver for MS Access in java
type: UnansweredQuestion
has body: My requirement is to use MS Access database using java. What would be the best solution? Should I download and use sun.jdbc.odbc.JdbcOdbcDriver or should I follow the usual way of connecting to Access database by configuring it in WIndows system? The application will run on Windows system and I am using Ubuntu for development. What will be the best approach?
has comment: http://stackoverflow.com/comment/33210079
tagged with: java
tagged with: database
type: Question
has answer: http://stackoverflow.com/a/21925410

http://stackoverflow.com/q/21849187
answer count: 1
downvote count: 0
favorite count: 0
tagged with: bouncycastle
has comment: http://stackoverflow.com/comment/33082991
tagged with: http://stackoverflow.com/tag/pdf
tagged with: trusted-timestamp
tagged with: pdf-generation
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/33076824
has body: I have an issue creating a valid CMS signature with Bouncy Castle using a trusted timestamp. The signature creation works well (I want to include the signature to a PDF file), the signature is valid. But after I include a trusted timestamp to the signature's unsigned attribute table, the signature still stays valid, but the Reader reports that The signature includes an embedded timestamp but it is invalid. This leads me to believe, that the hash I timestamp is not the correct one, but I cannot seem to figure out what is the problem with it. Signing code: Store store = new JcaCertStore(Arrays.asList(certContainer.getChain())); CMSSignedDataGenerator signedDataGenerator = new CMSSignedDataGenerator(); JcaSignerInfoGeneratorBuilder infoGeneratorBuilder = new JcaSignerInfoGeneratorBuilder(new JcaDigestCalculatorProviderBuilder().setProvider("BC").build()); JcaContentSignerBuilder contentSignerBuilder = new JcaContentSignerBuilder("SHA1withRSA"); signedDataGenerator.addSignerInfoGenerator( infoGeneratorBuilder.build(contentSignerBuilder.build(certContainer.getPrivateKey()), (X509Certificate)certContainer.getSignatureCertificate())); signedDataGenerator.addCertificates(store); CMSTypedData cmsData = new CMSProcessableByteArray(data); signedData = signedDataGenerator.generate(cmsData, false); Collection&lt;SignerInformation&gt; ss = signedData.getSignerInfos().getSigners(); SignerInformation si = ss.iterator().next(); // get first signer (should be only one) ASN1EncodableVector timestampVector = new ASN1EncodableVector(); Attribute token = createTSToken(si.getSignature()); timestampVector.add(token); AttributeTable at = new AttributeTable(timestampVector); si = SignerInformation.replaceUnsignedAttributes(si, at); ss.clear(); ss.add(si); SignerInformationStore newSignerStore = new SignerInformationStore(ss); CMSSignedData newSignedData = CMSSignedData.replaceSigners(signedData, newSignerStore); The createTSToken code: public Attribute createTSToken(byte[] data) throws NoSuc…
has title: Digital signature with timestamp in Java
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21875456
accepted answer: http://stackoverflow.com/a/21875456
has comment: http://stackoverflow.com/comment/33078315
upvote count: 3
linked to: http://stackoverflow.com/q/21733486

http://stackoverflow.com/q/21947411
favorite count: 0
has answer: http://stackoverflow.com/a/21947427
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33249721
has answer: http://stackoverflow.com/a/21947424
tagged with: java
has title: Java - Two variables in the same System.out.println
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/21947473
downvote count: 5
answer count: 6
has comment: http://stackoverflow.com/comment/33249741
has comment: http://stackoverflow.com/comment/33249681
has answer: http://stackoverflow.com/a/21947449
score: -5
has answer: http://stackoverflow.com/a/21947440
has answer: http://stackoverflow.com/a/21947428
has body: I need to put 2 variables in the same System.out.println, what's wrong with this code? I have these errors every time I try to put two variables in the same system.out.println, so I always end separating them in several lines //ejercicio 6 import java.util.Scanner; public class mayor{ public static void main (String [] args){ Scanner In = new Scanner(System.in); System.out.println("Introduzca 3 numeros distintos a continuación"); Double uno = In.nextDouble(); Double dos = In.nextDouble(); Double tres = In.nextDouble(); if (uno&gt;dos &amp;&amp; dos&gt;tres){ System.out.println(+ uno " sería el mayor y " + tres" el menor"); }else if (dos&gt;tres &amp;&amp; tres&gt;uno){ System.out.println(+ dos " sería el mayor y " + uno" el menor"); }else if (tres&gt;uno &amp;&amp; uno&gt;dos){ System.out.println(+ tres " sería el mayor y " + dos" el menor"); } } } I keep getting these errors mayor.java:24: ')' expected System.out.println(+ tres " sería el mayor y " + dos" el menor"); ^ mayor.java:24: not a statement System.out.println(+ tres " sería el mayor y " + dos" el menor"); ^ mayor.java:24: ';' expected System.out.println(+ tres " sería el mayor y " + dos" el menor"); Thanks

http://stackoverflow.com/q/21934278
type: UnansweredQuestion
tagged with: android
tagged with: repeat
has body: this is my activiy_main.xml &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:gravity="center_vertical" xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;TextView android:id="@+id/textView1" android:gravity="center_horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Example" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;Button android:id="@+id/button1" android:layout_marginTop="25dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Schedule" android:onClick="scheduleAlarm"/&gt; &lt;/LinearLayout&gt; My MainActivity.java public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void scheduleAlarm(View V) { Long time = new GregorianCalendar().getTimeInMillis()+10*1000; Intent intentAlarm = new Intent(this, AlarmReciever.class); AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); alarmManager.setRepeating(1, time, time, PendingIntent.getBroadcast(this, 1, intentAlarm, PendingIntent.FLAG_UPDATE_CURRENT)); Toast.makeText(this, "Alarm Scheduled for 10 Seconds", Toast.LENGTH_LONG).show(); } } AlarmReceiver: public class AlarmReciever extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Toast.makeText(context, "Alarm Triggered", Toast.LENGTH_LONG).show(); } } I also have these added to my Manifest file: &lt;receiver android:name=".AlarmReciever"/&gt; &lt;uses-permission android:name="com.android.alarm.permission.SET_ALARM"/&gt; &lt;uses-permission android:name="android.permission.SEND_SMS"/&gt; This is my whole example application. When I click the Button it does what I want it to do after 10 seconds, display a Toast saying "Alarm Triggered". But does it only once with set…
score: 2
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21934474
tagged with: alarmmanager
answer count: 1
downvote count: 0
favorite count: 0
has title: AlarmManager's setRepeating() does not repeat, setInexactRepeating() does not work at all

http://stackoverflow.com/a/21914965
upvote count: 2
type: Answer
has body: If you can afford Guava, go for it and use its PercentEscaper (available as of Guava 15.0). As nearly always with Guava, well written and performs admirably. Note that it will not encode ASCII letters or digits (a-z, A-Z, 0-9).
score: 2
has comment: http://stackoverflow.com/comment/33193781
accepted answer of: http://stackoverflow.com/q/21914868
answers question: http://stackoverflow.com/q/21914868
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33351484
type: Comment
type: QuestionComment
has text: Looks like you would benefit from using an `enum` instead of `int`, then you could add behaviour to the enum and throw away your switch statements. You also wouldn't need range checking etc. See [Enum vs. Int](http://stackoverflow.com/questions/9254637/java-enum-vs-int/9254703#9254703)
score: 0
comment on: http://stackoverflow.com/q/22003767

http://stackoverflow.com/comment/33120852
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21875335
type: AnswerComment
has text: The problem is I am getting the classname from JSON before-hand, so I do not know what type it is when compiling

http://stackoverflow.com/comment/33072882
comment on: http://stackoverflow.com/q/21848508
type: Comment
type: QuestionComment
has text: @WeiboLi Actually, no! :) I simulate an LFU-like replacement algorithm for web caching. I have a sliding window of the last K requests and I restrict the LFU principle in this sliding "time-frame". In other words, any time a request is inserted into the window (pushing one index right the previous requests), the score of that item increases by 1, and each time a request is evicted from the window, the score of that item is decreased by 1. According to the score of the items in the cache, I maintain the cache ordered using e.g. a reordering method when there is a cache hit (+1 for an
score: 0

http://stackoverflow.com/a/21880605
answers question: http://stackoverflow.com/q/21880536
has comment: http://stackoverflow.com/comment/33130913
has body: Both are different in the sense that System.gc() invoke the garbage collector to start to run but it is not sure that it would run. If it finds no more memory then then it start to free the allocated memory. Android system killing process for low memory ? If android find available free memory is low of the device then it tries to kill the long running process and free the associated memory Update It is best not to call the System.gc() because android system own call this method when it finds there is no free memory.
score: 0
type: Answer

http://stackoverflow.com/a/21996393
downvote count: 0
has comment: http://stackoverflow.com/comment/33343226
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/33342832
accepted answer of: http://stackoverflow.com/q/21987639
answers question: http://stackoverflow.com/q/21987639
upvote count: 8
has body: You can't combine two structural object classes. It's like a single inheritance rule. However you can add 'extensibleObject' instead of 'country', then you can use the 'c' attribute.
has comment: http://stackoverflow.com/comment/33363003
type: AcceptedAnswer

http://stackoverflow.com/q/21946482
has comment: http://stackoverflow.com/comment/33248075
has comment: http://stackoverflow.com/comment/33312024
has comment: http://stackoverflow.com/comment/33248683
has comment: http://stackoverflow.com/comment/33248078
has comment: http://stackoverflow.com/comment/33248580
possible better answer: http://stackoverflow.com/a/21946517
downvote count: 0
has answer: http://stackoverflow.com/a/21946517
has comment: http://stackoverflow.com/comment/33248848
has comment: http://stackoverflow.com/comment/33312193
accepted answer: http://stackoverflow.com/a/21946823
has answer: http://stackoverflow.com/a/21946678
has comment: http://stackoverflow.com/comment/33248064
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33248754
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21946880
type: Question
has answer: http://stackoverflow.com/a/21946656
linked to: http://stackoverflow.com/q/1540673
has comment: http://stackoverflow.com/comment/33248085
has comment: http://stackoverflow.com/comment/33248897
has comment: http://stackoverflow.com/comment/33248046
has answer: http://stackoverflow.com/a/21946526
tagged with: python
has title: Java equivalent of Python dictionary
tagged with: dictionary
has comment: http://stackoverflow.com/comment/33248156
answer count: 6
has body: Is there a cleaner way for doing this ? public void change(char x) { if(x == 'a') { return 'b'; } else if(x == 'b') { return 'a'; } else if(x == 't') { return 'r'; } else if(x == 'r') { return 't'; } return 'z'; } I was wondering if there was anything built into Java so that I can swap pairs of characters like a dictionary in Python or is this the best way to do this?
has comment: http://stackoverflow.com/comment/33248010
has answer: http://stackoverflow.com/a/21946823
tagged with: java
upvote count: 1

http://stackoverflow.com/q/21986871
type: Question
answer count: 2
tagged with: bean-validation
has body: Is there the possibility that future versions of the bean validation (JSR 303) specification will allow us to configure (add, modify, delete) constraints dinamically, as Hibernate Validator does? There is a big need for this feature in a project of mine.
score: 0
has answer: http://stackoverflow.com/a/21992282
tagged with: hibernate-validator
has comment: http://stackoverflow.com/comment/33320743
favorite count: 0
has title: Configure constraints at runtime
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21987548
tagged with: java
downvote count: 1

http://stackoverflow.com/comment/33224931
type: AnswerComment
comment on: http://stackoverflow.com/a/21933215
type: Comment
has text: @OP why do you accept the only answer that does not compile? The `-` operator is not defined on strings, so the expression should be in brackets.
score: 0

http://stackoverflow.com/a/22001117
type: Answer
upvote count: 1
has body: Yes, both the stmt.close() methods are necessary. You should always explicitly close the Statement or PreparedStatement object to ensure proper cleanup.
score: 1
answers question: http://stackoverflow.com/q/22000915
has comment: http://stackoverflow.com/comment/33345773
has comment: http://stackoverflow.com/comment/33346077
downvote count: 0

shell
tags question: http://stackoverflow.com/q/21901790
tags question: http://stackoverflow.com/q/22000318
tag name: shell
tags question: http://stackoverflow.com/q/22002963
tags question: http://stackoverflow.com/q/21975808
tags question: http://stackoverflow.com/q/21957252
tags question: http://stackoverflow.com/q/21901462
type: Tag

http://stackoverflow.com/q/21903812
type: Question
tagged with: java
tagged with: hibernate
upvote count: 1
tagged with: jboss
has title: How to optimize the hibernate queries.especially in inheritence
has comment: http://stackoverflow.com/comment/33172528
tagged with: jpa
answer count: 0
downvote count: 0
type: UnansweredQuestion
has body: For hibernate optimization of queries, in Inheritence Type Table_Per_Class, how to avoid where clause on (union of both class) and instead on apply where clause on each subclass @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public abstract class Animal { int pkey; String name; } public class Dog extends Animal { long numSlippersChewed; // int is not large enough... } public class Cat extends Animal { short miceCaught; // ... but here int is far bigger than required :-) } In the above code, if I have subclasses like elephant,etc, And i make a query on Animal of where clause on name,then current hibernate implementation unions all the tables, and then applies the where clause, which causing sql memory space issues Can Hibernate individually apply where clause on each of the subclass and then make a union Any pointers on this issue
score: 1
favorite count: 0

http://stackoverflow.com/comment/33145100
has text: if you are able to debug, could you send a request that would take this 5 min, and "pause" to see where is it stuck? And maybe... download the Jar code and link the files to it (assuming you are using Eclipse or that you have this functionality) to help you with this.
comment on: http://stackoverflow.com/q/21888605
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21877682
has answer: http://stackoverflow.com/a/21887860
accepted answer: http://stackoverflow.com/a/21887860
answer count: 2
favorite count: 0
possible better answer: http://stackoverflow.com/a/21909472
has answer: http://stackoverflow.com/a/21909472
has title: Oracle coherence caching, specifying expiry timeout while adding the object into cache
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: oracle-coherence
type: Question
tagged with: java
has body: I am using oracle coherence caching. For configuring expiry, there is a parameter called 'expiry-delay' to configure the expiry in xml file. I would like to know if it is possible to pass the expiry duration while adding the object into the cache. Appreciate any help on this.
tagged with: caching
upvote count: 2

http://stackoverflow.com/comment/33144011
type: Comment
comment on: http://stackoverflow.com/a/21888020
has text: Yes, both connect to the server separately and share data via it using the random number to work out which sockets to connect.
type: AnswerComment
score: 0

http://stackoverflow.com/a/22004279
answers question: http://stackoverflow.com/q/22004096
has comment: http://stackoverflow.com/comment/33351555
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33351840
has body: EDIT: The change from C# to java occurred while I was creating this. As such, this may not work. Simple question, semi-complicated answer. You could create a Dictionary &lt;char, object&gt; where object is some other Type that will work for you. After that, in your iterating through the string, check if the Dictionary contains the key and then... well, you can sort it out from there. :) A suggestion, you could use a delegate or one of it's child types (Action, Predicate, or Func). I can't be any more specific as you did not post any code...
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33374411

http://stackoverflow.com/comment/33309848
has text: it's your Action bar text, Which you want to change.
score: 0
comment on: http://stackoverflow.com/a/21980541
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21925560
has answer: http://stackoverflow.com/a/34314763
has body: I am getting Number stored as text warning for the created excel file using POI. I am trying to display percentage. This question discusses the same, but it's for python. Can some one please suggest me how to avoid this in java using POI? Below are the lines where I get this warning. workbook= new XSSFWorkbook(); sh1 = wb.createSheet("Data Sheet"); cell = row.createCell(3); cell.setCellValue(37 + "%"); Based on Gagravarr answer I did it this way. XSSFDataFormat df = workbook.createDataFormat(); CellStyle cs = wb.createCellStyle(); cs.setDataFormat(df.getFormat("%")); cell.setCellValue(0.37); cell.setCellStyle(cs); But it just shows up as 0.37 with no warning now, not 37%.
has answer: http://stackoverflow.com/a/42950199
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/33216358
score: 11
accepted answer: http://stackoverflow.com/a/21936120
tagged with: excel
has answer: http://stackoverflow.com/a/77794929
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/18939273
downvote count: 0
has title: Number stored as text warning in excel using POI
possible better answer: http://stackoverflow.com/a/25814141
tagged with: java
has answer: http://stackoverflow.com/a/25814141
favorite count: 0
has answer: http://stackoverflow.com/a/21936120
type: Question
upvote count: 11
answer count: 6
has comment: http://stackoverflow.com/comment/33231600
has answer: http://stackoverflow.com/a/52896892

http://stackoverflow.com/comment/33099600
score: 0
has text: Google the following phrase "java api String"
comment on: http://stackoverflow.com/q/21863516
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21877482
has answer: http://stackoverflow.com/a/22194503
has answer: http://stackoverflow.com/a/32373138
tagged with: java
has answer: http://stackoverflow.com/a/21877656
possible better answer: http://stackoverflow.com/a/22194503
has comment: http://stackoverflow.com/comment/54748427
type: AnsweredQuestion
tagged with: jersey-2.0
tagged with: jax-rs
has body: I am getting this exception while running web service in net beans What exactly I am missing? I Tried to deploy web service using mvn and stuff command but still same exception. Newbie in Java. Help Appreciated highly. Web.xml async-app org.glassfish.jersey.servlet.ServletContainer javax.ws.rs.Application org.glassfish.jersey.examples.server.async.AsyncJaxrsApplication 1 true async-app /* pom.xml 4.0.0 - org.glassfish.jersey.examples server-async-standalone 2.0 server-async-standalone-webapp war jersey-examples-server-async-standalone-webapp Standalone Jersey JAX-RS asynchronous server-side processing example web application. - - org.glassfish.jersey.containers jersey-container-servlet provided - - examples-source-zip - - - - org.apache.maven.plugins maven-assembly-plugin - true Exception Message:- [#|2014-02-19T15:01:10.928+0530|SEVERE|glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=73;_ThreadName=Thread-2;|Exception while invoking class com.sun.enterprise.web.WebApplication start method java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.NoClassDefFoundError: com/google/common/collect/Lists at com.sun.enterprise.web.WebApplication.start(WebApplication.java:138) at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130) at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269) at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363) …
tagged with: glassfish
type: Question
accepted answer: http://stackoverflow.com/a/21877656
has title: Jersey 2.0 (Jax-RS 2.0) Restfull Webservice With Maven Throwing Exception While Running on Glassfish 3.1.2?
score: 0
answer count: 3
tagged with: maven

http://stackoverflow.com/q/21952790
score: 0
has comment: http://stackoverflow.com/comment/33259061
has title: how to convert a unix date like 20140222T08:27:11 to Date() in java
has body: I am to convert this date 20140222T08:27:11 into a Date object in java. Since, it is containing a character "T" thats why i am having a problem in conversion. Help!
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/21952804
tagged with: java
answer count: 1

android-fragments
tags question: http://stackoverflow.com/q/21962495
tags question: http://stackoverflow.com/q/21850915
tags question: http://stackoverflow.com/q/21984912
tags question: http://stackoverflow.com/q/21956316
type: Tag
tags question: http://stackoverflow.com/q/21919177
tags question: http://stackoverflow.com/q/21995264
tags question: http://stackoverflow.com/q/21995124
tags question: http://stackoverflow.com/q/21889926
tags question: http://stackoverflow.com/q/21982934
tags question: http://stackoverflow.com/q/21962656
tags question: http://stackoverflow.com/q/21910744
tags question: http://stackoverflow.com/q/21902844
tags question: http://stackoverflow.com/q/21863003
tags question: http://stackoverflow.com/q/21982077
tags question: http://stackoverflow.com/q/21962500
tags question: http://stackoverflow.com/q/21894007
tags question: http://stackoverflow.com/q/21868099
tags question: http://stackoverflow.com/q/21929529
tags question: http://stackoverflow.com/q/21915254
tags question: http://stackoverflow.com/q/21895458
tags question: http://stackoverflow.com/q/21956147
tags question: http://stackoverflow.com/q/21856020
tags question: http://stackoverflow.com/q/21937696
tags question: http://stackoverflow.com/q/21978503
tags question: http://stackoverflow.com/q/21940668
tags question: http://stackoverflow.com/q/21949079
tags question: http://stackoverflow.com/q/21962659
tags question: http://stackoverflow.com/q/21961725
tags question: http://stackoverflow.com/q/21882840
tag name: android-fragments
tags question: http://stackoverflow.com/q/21945322

http://stackoverflow.com/comment/33183138
comment on: http://stackoverflow.com/a/21910367
score: 3
type: Comment
has text: Or `!ret.isEmpty()`. Just confirmed this is what caused the problem.
type: AnswerComment

http://stackoverflow.com/q/21889920
has answer: http://stackoverflow.com/a/21891712
has comment: http://stackoverflow.com/comment/33147360
score: 0
has title: Tokenizing text content of an XML element using Dom Java
has comment: http://stackoverflow.com/comment/33147438
has comment: http://stackoverflow.com/comment/33147363
has answer: http://stackoverflow.com/a/21890866
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21890538
type: Question
has answer: http://stackoverflow.com/a/21896878
tagged with: java
has body: I have an XML file that contains tags such as: (b) <E T="03">Filing of financial reports.</E> (1)(i) Except as provided in paragraphs (b)(3) and (h) of this section, I need to parse the text content and get the results back as an array of strings ["(b)", "Filing of financial reports.", "(1)(i) Except as provided in paragraphs (b) (3) and (h) of this section,"]. In other words, I need to tokenize the text content of a element according to <E T=03"> and store the results in an array of strings.

http://stackoverflow.com/a/21880913
has comment: http://stackoverflow.com/comment/33130394
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33130492
upvote count: 1
has body: Usually you put methods dealing with an object's internal state inside its class definition. If you have a utility method for dealing with related stuff and you don't know where to put it, you can make it a static method inside the class.
answers question: http://stackoverflow.com/q/21880819
type: Answer

http://stackoverflow.com/q/21918965
has title: Why does a Java process hang from Gradle when sub-process is still open?
linked to: http://stackoverflow.com/q/10052383
tagged with: jvm
has answer: http://stackoverflow.com/a/21922853
linked to: http://stackoverflow.com/q/4633678
tagged with: subprocess
upvote count: 14
type: UnansweredQuestion
tagged with: process
has body: If a process created in java creates a sub-process, but then returns, the JVM hangs, but with no process id. Example application below (requires Windows and Java 7) import java.io.File; import java.io.IOException; import java.lang.ProcessBuilder.Redirect; import java.nio.file.Files; public class SubProcessHang { public static void main(String[] args) throws IOException, InterruptedException { ProcessBuilder builder = new ProcessBuilder("cmd", "/c", "start", "notepad.exe"); File output = Files.createTempFile("output", "txt").toFile(); builder.redirectError(Redirect.to(output)); builder.redirectOutput(Redirect.to(output)); Process process = builder.start(); process.waitFor(); int exitValue = process.exitValue(); System.out.println("Process exit value:: " + exitValue); System.out.println("Output file length:: " + output.length()); System.exit(exitValue); } } When the application runs, it creates three processes: java --> cmd --> notepad cmd immediately returns and java calls System.exit(0), which kills the java process. But notepad is still there, and, when run from gradle (or eclipse for that matter,) the JVM hangs around until that process goes away, not returning it's return value. So the children process is still alive but the parent process has been partially killed, but is now stranded forever. The build.gradle script to reproduce this apply plugin: 'java' apply plugin: 'application' mainClassName = "SubProcessHang" Execute 'gradle run' and get this output: C:\HangDemo&gt;gradlew run :compileJava :processResources UP-TO-DATE :classes :run Process exit value:: 0 Output file length:: 0 &gt; Building 75% &gt; :run I know it must have something to do with how the java processes are created, but I have no idea what to do. What can I do short of getting the ID of the running java process and killing all sub-processes in a shutdown hook?
score: 14
tagged with: java
tagged with: gradle
type: Question
has comment: http://stackoverflow.com/comment/33246680
answer count: 2
has comment: http://stackoverflow.com/comment/33205802
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22175341

http://stackoverflow.com/q/21923993
has title: Cost of array lists
tagged with: arrays
tagged with: arraylist
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21924533
has body: I know that to find the number of stores needed for n elements to be appended to a list when the size is doubled can be found by the summation ∑ from n=1 to log(2,n) of 2^n = 2n-1. My question is how I could use a summation to find a formula for when instead of doubling in size the list grows by exactly 2000 elements each time it grows?
type: UnansweredQuestion
tagged with: performance
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/q/22000513
answer count: 2
has title: Communicating between classes java
downvote count: 0
has answer: http://stackoverflow.com/a/22001175
favorite count: 0
has body: I have a class called myJPanel1, in which I've created an instance of the class Student. I've also created a button in myJPanel1 that displays info about this new student. When I click on that button, I want to change the text of a button in a separate JPanel, written in class called myJPanel2. My problem is that I don't know how to get the myJPanel1 to recognize the buttons in myJPanel2 so I can modify the button's text. myJPanel1: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class myJPanel1 extends JPanel implements ActionListener { public myJPanel1() { super(); setBackground(Color.yellow); Student st1 = new Student("John", "Lodger", 44); // the whatsUp of this student has to shown in the other panel JButton j11 = new JButton(st1.getInfo()); j11.addActionListener(this); add(j11); } public void actionPerformed(ActionEvent Event) { Object obj = Event.getSource(); if (obj == j11) { j2.setText(st1.whatsUp()); } } } myJPanel2: import java.awt.*; import javax.swing.*; import java.awt.event.*; public class myJPanel2 extends JPanel { public myJPanel2() { super(); setBackground(Color.pink); //setLayout(new GridLayout(3,1)); JButton j1 = new JButton("When the user clicks on the button in the UPPER panel"); add(j1); JButton j2 = new JButton("Display here whatsUp from the student in UPPER Panel"); add(j2); JButton j3 = new JButton("===&gt;&gt;&gt;&gt;You CANNOT create a student here &lt;======"); add(j3); JButton j4 = new JButton("It has to be the student from the UPPER Panel"); add(j4); } }
score: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22000588
upvote count: 1
tagged with: swing
tagged with: java
type: Question

http://stackoverflow.com/comment/33338211
score: 0
has text: sounds fun but I wouldn't know where to begin. In the meantime you can run the call repeater in 2 separate browsers, it would be a start.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21847658

http://stackoverflow.com/comment/33206818
comment on: http://stackoverflow.com/q/21923301
has text: are u using the emulator?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33427993
has text: Haha xD Thanks anyway!
score: 0
comment on: http://stackoverflow.com/q/21995483
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33171710
type: AnswerComment
comment on: http://stackoverflow.com/a/21901615
type: Comment
has text: Interesting, About 2 years working with lucene i have never seen this error before, any way i think there is a search object still a live, so you need to debug your code.
score: 0

http://stackoverflow.com/comment/33281250
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21964768
has text: *"just trying to get set up quickly"* ..by 'set up DYM 'down-votes'? Here is a -1 for your collection. Show some effort in future.
score: 1

http://stackoverflow.com/comment/33275893
comment on: http://stackoverflow.com/a/21961731
score: 0
has text: Ah, well. That's what I get for not looking up the documentation before I answer questions. I should probably delete this answer.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21915629
has body: Of course you can, but it depends on what are you trying to achieve. You could simply define an ArrayList&lt;TableRow&gt; and add them via the .add() method. But usually, TableRows are meant to be within a TableLayout. This latter is basically the equivalent to the &lt;table&gt; HTML statement, which defines a table, and the TableRow would be the &lt;tr&gt; statement. You'll find more info about those concepts: Here about ArrayLists. Here about TableRows. Here about TableLayouts.
accepted answer of: http://stackoverflow.com/q/21915456
has comment: http://stackoverflow.com/comment/33194759
answers question: http://stackoverflow.com/q/21915456
type: Answer
has comment: http://stackoverflow.com/comment/33193207
has comment: http://stackoverflow.com/comment/33193140
has comment: http://stackoverflow.com/comment/33193323
has comment: http://stackoverflow.com/comment/33193240
has comment: http://stackoverflow.com/comment/33193357
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/33138741
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21863134
has text: I suggest you open a feature request: http://youtrack.jetbrains.com

http://stackoverflow.com/q/21919151
has answer: http://stackoverflow.com/a/21919331
has answer: http://stackoverflow.com/a/21919285
has body: When I pass this static method a linked list from main and remove the duplicates, the list remains un-changed. I assume this is because of some weird pass by value problem...Anyone know why? public class LinkedListHelper{ public static &lt;T&gt; void eliminateDuplicates(LinkedList&lt;T&gt; list) { LinkedList&lt;T&gt; temp = new LinkedList&lt;&gt;(); temp.add(list.peekFirst()); //initialize this list with first element ListIterator&lt;T&gt; itr1 = list.listIterator(); ListIterator&lt;T&gt; itr2 = temp.listIterator(); while(itr1.hasNext()) { T element = itr1.next(); boolean found = false; while(itr2.hasNext() &amp;&amp; !found) { T current = itr2.next(); if(element == current) found = true; } if(!found) temp.add(element); itr2 = temp.listIterator(); } list = temp; //Why does this not work???? } }
has comment: http://stackoverflow.com/comment/33199407
duplicate of: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/21919250
type: UnansweredQuestion
tagged with: parameter-passing
answer count: 4
has title: Why can't I reassign a LinkedList reference that was passed to a static method?
tagged with: reference
tagged with: linked-list
tagged with: java
has answer: http://stackoverflow.com/a/21919195
linked to: http://stackoverflow.com/q/40480
type: Question
score: 0

webrtc
tags question: http://stackoverflow.com/q/21864035
type: Tag
tag name: webrtc

http://stackoverflow.com/q/21931974
score: 0
tagged with: config
has comment: http://stackoverflow.com/comment/33221439
has body: I want to open a .config file outside of the .jar file so that I can use its properties inside of the .jar. How would I do this?
has answer: http://stackoverflow.com/a/21932283
type: UnansweredQuestion
has title: Getting a config file outside of a jar file?
tagged with: java
has comment: http://stackoverflow.com/comment/33221628
type: Question
has answer: http://stackoverflow.com/a/21932181
answer count: 2

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/21867973
tags question: http://stackoverflow.com/q/21945771
tags question: http://stackoverflow.com/q/21971758
tags question: http://stackoverflow.com/q/21977591
tags question: http://stackoverflow.com/q/21905926
tags question: http://stackoverflow.com/q/21977068
tags question: http://stackoverflow.com/q/21957579
type: Tag
tags question: http://stackoverflow.com/q/21896919
tags question: http://stackoverflow.com/q/21979311
tags question: http://stackoverflow.com/q/21989082
tags question: http://stackoverflow.com/q/21899928
tags question: http://stackoverflow.com/q/21855431
tags question: http://stackoverflow.com/q/21952475
tags question: http://stackoverflow.com/q/21868284
tags question: http://stackoverflow.com/q/21855420
tags question: http://stackoverflow.com/q/21869708
tags question: http://stackoverflow.com/q/21946425
tags question: http://stackoverflow.com/q/21974367

http://stackoverflow.com/a/21990490
has body: The latitude and longitude are not being retrieved, since the methods getLat() and getLng() are retrieving it wrong from the cursor. Since you are selecting only one column from database, you must get the column index 0, and not 1 or 2 as you were doing inside getLat() and getLng() methods. Inside those methods, do this: // getLat() method _lat = latQuery.getDouble(0); // getLng() method _lng = lngQuery.getDouble(0);
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21973396
answers question: http://stackoverflow.com/q/21973396
score: 1

http://stackoverflow.com/comment/33271840
type: AnswerComment
score: 0
type: Comment
has text: i want to insert unicode control characters in specific points. the prb is that all read methods give me an array of fixed size so i can't extend it. my only choice is to use input.read() which will return the byte i read. but u said that read slows my performance down. so what can i do? ur readFully won't work which u realized as soon as u read the purpose of my app. btw, whats the diff between them and the 2 read methods? same parameters, same array tht gets bytes saved. at least with read, i get int back so i can use it as a check to make sure i read the whole file.
comment on: http://stackoverflow.com/a/21955385

http://stackoverflow.com/a/67931548
type: Answer
answers question: http://stackoverflow.com/q/21964709
upvote count: 0
score: -1
has body: I'm using this fish function I wrote: function javav set min_version 8 set max_version 99 set java_home_cmd '/usr/libexec/java_home 2>/dev/null --failfast --version' if ! test (eval $java_home_cmd $argv) echo "Version not found" return 1 end for current_version in (seq $min_version $max_version) set path_to_remove (eval $java_home_cmd $current_version) if ! test -z $path_to_remove echo 'Removing' $path_to_remove 'from PATH' set PATH (string match --invert $path_to_remove/bin $PATH) end end echo 'Setting up env for Java' $argv set -x JAVA_HOME (eval $java_home_cmd $argv) set PATH $JAVA_HOME/bin $PATH end It basically automates the step in this answer, similarly to this one, but also taking care of setting the PATH. Just put it in .config/fish/functions/ and then use it like this: javav 11 # Sets to Java 11 javav 16 # Sets to Java 16
downvote count: 1

http://stackoverflow.com/comment/33168564
has text: *Exceptions* were made to handle... *exceptions*. But since you can know the problem, it's better for you to simply check the indexes..
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21901875
type: QuestionComment

http://stackoverflow.com/comment/33247413
type: Comment
comment on: http://stackoverflow.com/q/21946162
score: 1
type: QuestionComment
has text: `To the power of 12*5`. Why not just do `^60`?

http://stackoverflow.com/comment/111026353
score: 1
comment on: http://stackoverflow.com/q/21908785
type: Comment
type: QuestionComment
has text: For 2020, it is at - C:\Users\<user>\AppData\Local\JetBrains\IdeaIC2020.1\log

http://stackoverflow.com/comment/33310383
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21951892
has text: No problem, you've already posted the answer, just accept that - I'm not worried about the rep, just as long as you're sorted :-)

http://stackoverflow.com/a/22001590
has body: A map does not allow duplicate keys. If an element with the same key is inserted the Old value will be replaced with the new one. For example : Say my map is as follows : Key Value Bucket A Val1 1 B Val2 2 C Val3 1 Bucket Structure : Bucket 1 : A -&gt; C Bucket 2 : B When someone tries to enter another element (C, Val6) where C is the key; then the map structure will be as follows after insertion : Key Value Bucket A Val1 1 B Val2 2 C Val6 1 So the Value is replaced in the Map. Bucket Structure : Bucket 1 : A -&gt; C Bucket 2 : B Now to address the second part of your question : When different key with the same value is entered in the same bucket it is just added to the bucket (Internally each bucket might be like a ArrayList where elements are added at the end of the list). For example : Lets assume we are adding the following pair (D, Val 7)to the above Map and assume the Key D maps to bucket 1. Then the map structure will be as follows after the insertion : Key Value Bucket A Val1 1 B Val2 2 C Val6 1 D Val7 1 Bucket Structure : Bucket 1 : A -&gt; C -&gt; D Bucket 2 : B
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22001509
upvote count: 1
type: Answer

http://stackoverflow.com/q/21845768
favorite count: 0
tagged with: jtable
accepted answer: http://stackoverflow.com/a/21845803
tagged with: tablecelleditor
has body: how to set toggle button text value (depend on database) on jtable Here is the code private class CheckBoxCellEditor extends AbstractCellEditor implements TableCellEditor, ItemListener { protected JToggleButton toggle; private String buttonValue; public CheckBoxCellEditor() { toggle = new JToggleButton("off"); toggle.setHorizontalAlignment(SwingConstants.CENTER); toggle.addItemListener(this); } public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { buttonValue = (value == null) ? "" : value.toString(); return toggle; } public Object getCellEditorValue() { // System.out.println( buttonValue); return buttonValue; } @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { toggle.setText("On!"); System.out.println(buttonValue); } else { toggle.setText("Off"); System.out.println(buttonValue); } } } Here the image shows the toggle but it's not shows the text. when i click the button the text shows then click next button the 1st one is not visible. if you know the answer please share here.. with regards...
has title: how to set toggle button text value from db on jtable
upvote count: 1
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21845803
type: Question
tagged with: jtogglebutton
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/33331748
has text: Can you give some details about your custom `HttpServletRequest`?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21993368
score: 3

http://stackoverflow.com/q/21879880
score: 2
upvote count: 2
tagged with: java
has body: I'm loading data in a webview using loadDataWithBaseURL from a string. I want to implement a listener which tells me when the data is loaded completely so that i may proceed with my code. I've searched a lot but could not find any relevant topic if (new String(rowData.getResource().getData()) != null) webView.loadDataWithBaseURL("", new String(rowData.getResource().getData()), "text/html", "UTF-8", "about:blank");
tagged with: webview
type: Question
has title: WebView loadDataWithBaseURL on finished loading listener
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21880050
favorite count: 0
has answer: http://stackoverflow.com/a/21880121
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4065134
tagged with: android

http://stackoverflow.com/comment/33092946
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21854842
has text: @MarkoTopolnik the reordering of the effect of the operations as visible between threads is not the result of the compiler reordering the operations. The compiler cannot reorder those operations, but the result can become visible to another thread in a different order. For other operations where the compiler could reorder, memory fences prevent the compiler doing so, but the example is not such a case. The temporal order of the operations remains the same, unless you're running java in a time machine - its an effect of caching and when global memory is written to.

http://stackoverflow.com/comment/33868807
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22013219
has text: when you are call this method??
score: 0

http://stackoverflow.com/comment/33226311
comment on: http://stackoverflow.com/q/21934168
type: Comment
score: 1
type: QuestionComment
has text: Just to let you know `[^[^0-9]]` is not same as `[0-9]`

http://stackoverflow.com/a/21922205
downvote count: 0
has comment: http://stackoverflow.com/comment/33208012
type: Answer
answers question: http://stackoverflow.com/q/21922156
accepted answer of: http://stackoverflow.com/q/21922156
has body: The short answer is, yes, you will need multiple instances of JButton. You can use an Action which can be applied to multiple instance of a button (the same instance of Action). The Action class carries properties which will be used to configure the buttons, such as text and icon properties. A component (like JButton) can only reside within in a single container, therefore, you will need multiple instances of JButton. Take a look at How to Use Actions and How to Use Buttons, Check Boxes, and Radio Buttons for more details... Generally, you should avoid using setLocation and setSize and rely more on the use of layout managers, but you've not provided enough context to say if this useful to you or not.
score: 4
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/33245550
score: 0
has text: +1, You should NOT be using listTable.setBounds(). Also, make sure you are NOT using a null layout on the guestFixturesPanel. Swing was designed to be used with layout managers NOT a null layout. The scrollpane won't work if you use null layouts.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21945133

http://stackoverflow.com/comment/33195802
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21914978
has text: Here is how to load a Bitmap correctly from the resources: http://pastebin.com/LsEWpSMq simply use Bitmap b = BitmapResloader.decodeBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight); Also, please select my answer as correct if it answered the original question.

http://stackoverflow.com/q/21964962
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/44044604
tagged with: cucumber
answer count: 2
has answer: http://stackoverflow.com/a/21987576
upvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: cucumber-junit
downvote count: 0
has answer: http://stackoverflow.com/a/53664870
type: Question
has body: I have the following feature that I would like to test in cucumber. But, I would like to process the input file only once ( @Given in the below feature ). But, it seems to be executing the @Given step each time. Is it possible to execute this @Given in the following feature only once? @fileValidation Scenario Outline: File Validation Given a file is uploaded with name "something.csv" Then response filename created should not match input filename "something.csv" And reason for errors should be "&lt;Reason&gt;" with error code "&lt;Error code&gt;" for row with RequestId "&lt;RequestId&gt;" Examples: | RequestId | Error code | Reason | | 123 | 101 | Failure 1 | | 124 | 102 | Failure 1; Failure 2 | I also tried Before and After hooks by removing Given step with no luck. I also tried before hooks, still it is coming to this loop for each row in the examples. @Before("@fileValidation") public void file_is_uploaded() throws Throwable { String fileName = "something.csv"; processInputFile(fileName); } @After("@fileValidation") public void clear() { outputFileName = null; } and in the feature file I have something like this: @fileValidation Scenario Outline: File Validation Background: Read the uploaded file "something.csv" Then response filename created should not match input filename "something.csv" And reason for errors should be "&lt;Reason&gt;" with error code "&lt;Error code&gt;" for row with RequestId "&lt;RequestId&gt;" Examples: | RequestId | Error code | Reason | | 123 | 101 | Failure 1 | | 124 | 102 | Failure 1; Failure 2 |
has title: Execute @Given only once in cucumber feature file

http://stackoverflow.com/comment/33199732
comment on: http://stackoverflow.com/q/21918275
has text: Terminology please. What you have is either (1) *real numbers,* in ASCII, represented in *scientific notation,* and you want to *convert* them to floats, or (2) real binary float values, in which case you should be using DataInputStream.readFloat().
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/33263714
comment on: http://stackoverflow.com/a/21954919
score: 0
type: AnswerComment
type: Comment
has text: after I get uri from file, how can I read apk content (i.e. manifest file, etc..)?

http://stackoverflow.com/a/21951788
type: Answer
has body: Here is a complete (almost) program that may answer the first part of your question : import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class TestClass { public static void main(String[] args) { Y y = new Y(); y.makeZ(); Iterator&lt;Object&gt; it = X.list.iterator(); while (it.hasNext()) System.out.println(it.next()); } } class X { public static List&lt;Object&gt; list = new ArrayList&lt;Object&gt;(); } class Y { void makeZ() { Z xObject1 = new Z(10) ; Z xObject2 = new Z(11) ; } } class Z { int a; Z(int j) { // put Z into X's list a = j; X.list.add(this); } public String toString() { return a + ""; } } and for the second part of your question : I'm always committed to just initialize objects in constructors. If adding an object from the z class is part of the initialization I think it's the good choice otherwise do it somewhere else.(always keep your codes tidy)
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21951306
answers question: http://stackoverflow.com/q/21951306

http://stackoverflow.com/a/21950591
type: AcceptedAnswer
has body: If I understand your question correctly, a job is defined by its start and end times, {a,b}. {{7,8}, {2,11}, {7,8}, {1,7}, {2,3}, {2,7}, {1,9}} Sort the jobs by their starting times. {{1,7}, {1,9}, {2,11}, {2,3}, {2,7}, {7,8}, {7,8}} When a job is due to start, there may be several machines free. WLOG, imagine that the machines have "rank", so that the highest-ranking of all the free machines takes the job. (If several jobs start at the same time, it doesn't matter which one the highest-ranking machine takes.) Now we can see which jobs the highest-ranking machine takes, and remove them from the pool. Repeat with the next-highest-ranking machine, and so on until all jobs are spoken for. {{1,7}, {1,9}, {2,11}, {2,3}, {2,7}, {7,8}, {7,8}} {{1,9}, {2,11}, {2,3}, {2,7}, {7,8}} {{2,11}, {2,3}, {2,7}, {7,8}} {{2,3}, {2,7}, {7,8}} {{2,7}} In this case 5 machines are needed.
type: Answer
answers question: http://stackoverflow.com/q/21950032
accepted answer of: http://stackoverflow.com/q/21950032
score: 0

http://stackoverflow.com/comment/33241011
has text: Thanks Jan. One last thing, currently it is sorting out in ascending order.. How would I sort this out in descending order?
type: Comment
comment on: http://stackoverflow.com/a/21942526
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33140452
type: Comment
comment on: http://stackoverflow.com/a/21877965
score: 0
type: AnswerComment
has text: Thanks. I'm seeing this error now "the content of element type 'action' must match (param|result|interceptor-ref|exception-mapping). It's really frustrating because I can't resolve the error 09:17:57,121 ERROR [com.opensymphony.xwork2.util.DomHelper] vfs:/C:/jboss-eap-6.1/bin/content/XXXXX.war/WEB-INF/classes/struts.xml; lineNumber: 22; columnNumber: 18; The content of element type "action" must match "(param|result|interceptor-ref|exception-mapping)*".

http://stackoverflow.com/comment/33340803
comment on: http://stackoverflow.com/q/21998184
has text: if you looking to create an executable jar file that runs without needing eclipse, here is a link on how to do that. http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftasks-37.htm
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33227640
type: QuestionComment
has text: google for array copy to get an example.
comment on: http://stackoverflow.com/q/21935320
type: Comment
score: 0

http://stackoverflow.com/comment/33246897
type: AnswerComment
type: Comment
has text: sorry i forgot to mention the error messages. i'll edit my post.
comment on: http://stackoverflow.com/a/21945579
score: 0

http://stackoverflow.com/a/54116072
score: 5
downvote count: 0
type: Answer
has body: Just use the following code from any Java class: Intent i = new Intent(getContext(),TargetActivity.class); getContext().startActivity(i);
answers question: http://stackoverflow.com/q/21888385
upvote count: 5

http://stackoverflow.com/a/34617274
downvote count: 0
has body: Facing this issue, we found that a cleaner fix was to simply add this line in the &lt;h:head&gt; tag in the main template: &lt;h:outputScript library="primefaces-extensions" name="primefaces-extensions.js"/&gt; No need to add the xmlns:pe namespace, no need to add a dummy tag!
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21904812

http://stackoverflow.com/q/22004531
tagged with: java
has answer: http://stackoverflow.com/a/22004553
upvote count: 1
linked to: http://stackoverflow.com/q/6100712
downvote count: 1
type: Question
has body: I want to find a character within a string. If the character is found, add one to char_counter. How can I implement this? Example: int char_counter = 0; String password = "1234"; String search = "1234"; for(int i = 0; i &lt; password.length() - 1; i++) { for(int j = 0; j &lt; search.length() - 1; j++) { //This is just pseudo code since I don't know how to properly search a string if(password[i] == search[j]) { char_counter = char_counter + 1; } } }
has answer: http://stackoverflow.com/a/22004808
duplicate of: http://stackoverflow.com/q/6100712
score: 0
tagged with: string-search
tagged with: char
answer count: 3
has answer: http://stackoverflow.com/a/22004782
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/33351821
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/20095073
has title: How can I search a string for each character in Java

http://stackoverflow.com/q/21973777
favorite count: 0
has title: Easiest way to read in svg path data with Java?
type: Question
has body: I'm looking to consume an svg image and parse/process the different paths to do a custom conversion. What is the easiest way, in Java, to simply extract the path data? I was looking at the apache xmlgraphics/batik packages, but it's not real obvious how to return the path types and parameters. Any suggestions?
tagged with: batik
tagged with: xpath
has answer: http://stackoverflow.com/a/21974419
tagged with: http://stackoverflow.com/tag/svg
score: 5
answer count: 1
linked to: http://stackoverflow.com/q/26027313
upvote count: 5
tagged with: java
duplicate of: http://stackoverflow.com/q/26027313
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/21923236
downvote count: 0
type: AcceptedAnswer
upvote count: 11
has body: I've created an Abstract Screen class that contains all the common objects for a screen, every one of my screens extend this abstract class. And that looks like this: public abstract class AbstractScreen implements Screen { protected final Game game; protected InputMultiplexer multiInputProcessor; protected ScreenInputHandler screenInputHandler; protected Stage uiStage; protected Skin uiSkin; public AbstractScreen(Game game) { this.game = game; this.uiStage = new Stage(); this.uiSkin = new Skin(); this.screenInputHandler = new ScreenInputHandler(game); this.multiInputProcessor = new InputMultiplexer(); multiInputProcessor.addProcessor(uiStage); multiInputProcessor.addProcessor(screenInputHandler); Gdx.input.setInputProcessor(multiInputProcessor); } private static NinePatch processNinePatchFile(String fname) { final Texture t = new Texture(Gdx.files.internal(fname)); final int width = t.getWidth() - 2; final int height = t.getHeight() - 2; return new NinePatch(new TextureRegion(t, 1, 1, width, height), 3, 3, 3, 3); } @Override public void render (float delta) { Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); uiStage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f)); uiStage.draw(); Table.drawDebug(uiStage); } @Override public void resize (int width, int height) { } @Override public void show() { } @Override public void hide() { dispose(); } @Override public void pause() { } @Override public void resume() { } @Override public void dispose() { uiStage.dispose(); uiSkin.dispose(); } } When I want to create a new class I just extend the abstract screen and add what I need. For example I have a basic credits screen, I just need to create the components but the abstract screen draws it: public class CreditsScreen extends AbstractScreen { public CreditsScreen(final Game game) { super(game); // Generate a 1x1 white texture and store it in the skin named "white". Pixmap pixmap = new Pixmap(1, 1, Format.RGBA8888); pixmap.setColor(Color.WHI…
has comment: http://stackoverflow.com/comment/41968331
type: Answer
accepted answer of: http://stackoverflow.com/q/21923141
answers question: http://stackoverflow.com/q/21923141
has comment: http://stackoverflow.com/comment/33218700
score: 11
has comment: http://stackoverflow.com/comment/33207797

http://stackoverflow.com/comment/33161612
score: 0
type: Comment
has text: You will get too many recursive calls if you use recursion, that's why you get `stackoverflow` error. For small arrays it may be Ok though
type: AnswerComment
comment on: http://stackoverflow.com/a/21897621

http://stackoverflow.com/q/21925083
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/57370747
score: 20
answer count: 3
has answer: http://stackoverflow.com/a/22001931
downvote count: 0
favorite count: 0
has title: SQL Error: 0, SQLState: 08006
has answer: http://stackoverflow.com/a/21925336
tagged with: postgresql
has body: I have a web application with hibernate connection. application is connecting to PostgreSQL db. Some times I am getting below exceptions in my logs. Caused by: **org.postgresql.util.PSQLException: An I/O error occured while sending to the backend.** at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:283) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:252) at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) at org.geotools.jdbc.JDBCFeatureReader.<init>(JDBCFeatureReader.java:150) at org.geotools.jdbc.JDBCFeatureSource.getReaderInternal(JDBCFeatureSource.java:567) ... 101 more **Caused by: java.io.EOFException** at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:261) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1620) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) Caused by: org.postgresql.util.PSQLException: **An I/O error occured while sending to the backend.** at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:283) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:252) at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) at org.geotools.jdbc.JDBCFeatureReader.<init>(JDBCFeatureReader.java:150) at org.geotools.jdbc.JDBCFeatureSource.getReaderInternal(JDB…
accepted answer: http://stackoverflow.com/a/22001931
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/33347194
has answer: http://stackoverflow.com/a/57370747
upvote count: 20

http://stackoverflow.com/a/22026259
answers question: http://stackoverflow.com/q/21987144
has comment: http://stackoverflow.com/comment/33408263
has body: Import/Export work on per-table basis. Alternatively, you could use Hadoop’s distcp command to copy the whole /hbase directory from one HDFS cluster to the other. However, this can leave your data in an inconsistent state, so it should be avoided. I would like to point out to a backup tool developed by folks at Mozilla which they say eliminates the limitations of distcp. See their post for more details.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21987144
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/33242955
comment on: http://stackoverflow.com/q/21943604
score: 0
type: Comment
type: QuestionComment
has text: Did you start coding for your problem ?

http://stackoverflow.com/q/21859099
has answer: http://stackoverflow.com/a/21859198
type: Question
has answer: http://stackoverflow.com/a/21859461
linked to: http://stackoverflow.com/q/12369957
downvote count: 0
has comment: http://stackoverflow.com/comment/118868897
tagged with: generics
linked to: http://stackoverflow.com/q/7969023
has body: Consider the following test of Java's ArrayList#toArray method. Note that I borrowed the code from this helpful answer. public class GenericTest { public static void main(String [] args) { ArrayList&lt;Integer&gt; foo = new ArrayList&lt;Integer&gt;(); foo.add(1); foo.add(2); foo.add(3); foo.add(4); foo.add(5); Integer[] bar = foo.toArray(new Integer[10]); System.out.println("bar.length: " + bar.length); for(Integer b : bar) { System.out.println(b); } String[] baz = foo.toArray(new String[10]); // ArrayStoreException System.out.println("baz.length: " + baz.length); } } But, notice that there will be a ArrayStoreException when trying to put an Integer into a String[]. output: $&gt;javac GenericTest.java &amp;&amp; java -cp . GenericTest bar.length: 10 1 2 3 4 5 null null null null null Exception in thread "main" java.lang.ArrayStoreException at java.lang.System.arraycopy(Native Method) at java.util.ArrayList.toArray(Unknown Source) at GenericTest.main(GenericTest.java:16) Can this error be prevented through Java generics at compile-time?
accepted answer: http://stackoverflow.com/a/21859461
favorite count: 0
linked to: http://stackoverflow.com/q/18666710
has answer: http://stackoverflow.com/a/21862240
has answer: http://stackoverflow.com/a/44523984
answer count: 4
type: AnsweredQuestion
score: 3
has title: Catching ArrayStoreException at Compile-time
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/21859198

http://stackoverflow.com/comment/33322712
type: QuestionComment
comment on: http://stackoverflow.com/q/21988625
score: 0
has text: from your logcat may be your databse object **mDb** is null
type: Comment

jpa
tags question: http://stackoverflow.com/q/21845301
tags question: http://stackoverflow.com/q/21903812
tags question: http://stackoverflow.com/q/21892957
tags question: http://stackoverflow.com/q/21999484
tags question: http://stackoverflow.com/q/21969197
tags question: http://stackoverflow.com/q/21878388
tags question: http://stackoverflow.com/q/21985308
tags question: http://stackoverflow.com/q/21984055
tags question: http://stackoverflow.com/q/21924709
tags question: http://stackoverflow.com/q/21895932
tags question: http://stackoverflow.com/q/21853995
tags question: http://stackoverflow.com/q/21931091
tags question: http://stackoverflow.com/q/21943526
tags question: http://stackoverflow.com/q/21955816
tags question: http://stackoverflow.com/q/21857301
tags question: http://stackoverflow.com/q/21880923
tags question: http://stackoverflow.com/q/21875214
tags question: http://stackoverflow.com/q/21871497
tags question: http://stackoverflow.com/q/21881361
tags question: http://stackoverflow.com/q/21910968
tags question: http://stackoverflow.com/q/21883609
tags question: http://stackoverflow.com/q/21925091
tags question: http://stackoverflow.com/q/21888318
tags question: http://stackoverflow.com/q/22002167
tags question: http://stackoverflow.com/q/21952318
tags question: http://stackoverflow.com/q/21855065
tags question: http://stackoverflow.com/q/21904378
tags question: http://stackoverflow.com/q/21972914
tags question: http://stackoverflow.com/q/21988519
tags question: http://stackoverflow.com/q/21998061
tags question: http://stackoverflow.com/q/21943459
tags question: http://stackoverflow.com/q/21940600
tags question: http://stackoverflow.com/q/21874393
tags question: http://stackoverflow.com/q/21844207
type: Tag
tags question: http://stackoverflow.com/q/21971428
tags question: http://stackoverflow.com/q/22000110
tags question: http://stackoverflow.com/q/21901196
tags question: http://stackoverflow.com/q/21923058
tags question: http://stackoverflow.com/q/21926906
tags question: http://stackoverflow.com/q/21847236
tags question: http://stackoverflow.com/q/21983109
tags question: http://stackoverflow.com/q/21976186
tags question: http://stackoverflow.com/q/21855218
tags question: http://stackoverflow.com/q/21853994
tags question: http://stackoverflow.com/q/21908086
tags question: http://stackoverflow.com/q/21920337
tags question: http://stackoverflow.com/q/21952991
tags question: http://stackoverflow.com/q/21891125
tags question: http://stackoverflow.com/q/21998950
tags question: http://stackoverflow.com/q/22002739
tags question: http://stackoverflow.com/q/21917720
tags question: http://stackoverflow.com/q/21904037
tags question: http://stackoverflow.com/q/21908639
tags question: http://stackoverflow.com/q/21996396
tags question: http://stackoverflow.com/q/21931327
tags question: http://stackoverflow.com/q/21888001
tags question: http://stackoverflow.com/q/21988500
tags question: http://stackoverflow.com/q/21844459
tags question: http://stackoverflow.com/q/22002254
tag name: jpa
tags question: http://stackoverflow.com/q/21929978
tags question: http://stackoverflow.com/q/21946934
tags question: http://stackoverflow.com/q/21960242
tags question: http://stackoverflow.com/q/21909285
tags question: http://stackoverflow.com/q/21846404
tags question: http://stackoverflow.com/q/21958819
tags question: http://stackoverflow.com/q/21882974
tags question: http://stackoverflow.com/q/21924918
tags question: http://stackoverflow.com/q/21927904
tags question: http://stackoverflow.com/q/21879943
tags question: http://stackoverflow.com/q/21858952
tags question: http://stackoverflow.com/q/21935374
tags question: http://stackoverflow.com/q/22004428
tags question: http://stackoverflow.com/q/21846944
tags question: http://stackoverflow.com/q/21892690
tags question: http://stackoverflow.com/q/21961393
tags question: http://stackoverflow.com/q/21847550
tags question: http://stackoverflow.com/q/21919884
tags question: http://stackoverflow.com/q/21944946

http://stackoverflow.com/comment/33134558
type: Comment
comment on: http://stackoverflow.com/a/21878893
has text: A customs method to handle your events... @ Biy
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33294510
has text: @user3043882 Did you take a look at the `ListIterator` documentation? Does it have any method to give you indexed access?
score: 0
comment on: http://stackoverflow.com/q/21972108
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21945178
has comment: http://stackoverflow.com/comment/33245791
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21946081
has body: private interface Internal { &lt;T extends Comparable&lt;? super T&gt;&gt; void compare(final T left, T right); } private final Internal internal = ...; public &lt;T&gt; void compare(final Comparable&lt;T&gt; left, final Comparable&lt;T&gt; right) { this.internal.compare(left, right); } I'm seeing a compiler error on .compare(left, right): Bound mismatch: The generic method compare(T, T) of type MyClass.Internal is not applicable for the arguments (Comparable&lt;T&gt;, Comparable&lt;T&gt;). The inferred type Comparable&lt;T&gt; is not a valid substitute for the bounded parameter &lt;T extends Comparable&lt;? super T&gt;&gt; Is there any reasonable way to accomplish the transition I'm trying to make - taking in Comparable from the public-facing method and using it in a type-safe manner in the internal implementation? Or do I need the same type information for my outer method as I have for the inner one?
score: 0
answer count: 1
tagged with: generics
accepted answer: http://stackoverflow.com/a/21946081
has title: Nested compare() call - possible to change generics information?
has comment: http://stackoverflow.com/comment/33247689
type: AnsweredQuestion

http://stackoverflow.com/q/21999974
tagged with: box2d
tagged with: jbox2d
type: Question
has answer: http://stackoverflow.com/a/22003115
tagged with: libgdx
has answer: http://stackoverflow.com/a/22069131
score: 5
answer count: 3
possible better answer: http://stackoverflow.com/a/22071319
has body: So, I have a player body + fixture etc, it is essentially a ball that bounces around. I want to detect when it is 'pretty much' finished moving. At the moment I do this: public Boolean isStopped() { return body.getLinearVelocity().x &lt;= 0.3f &amp;&amp; body.getLinearVelocity().y &lt;= 0.3f; } This mostly works, the problem being when the player hits something, there's a split second where its velocity is 0, so this returns true. What I really wanted is to just return true when it is basically finished. Preferably within a range that I can set to whatever I like as I tweak the physics of my game world. I can't use a check on whether it is sleeping or not as that comes too late, it doesn't sleep until after it has stopped having forces act upon it, I need just before. I could just store how long it has been stopped/a count of stopped steps, but I was hoping there would be a nice pre existing method that I missed. Any ideas?
has answer: http://stackoverflow.com/a/22071319
favorite count: 0
has title: How to check if a body has almost stopped moving in libgdx + box2d
upvote count: 5
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22003115
downvote count: 0
tagged with: java

http://stackoverflow.com/q/21958112
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21967523
tagged with: c++
has title: Easy way to get Number from primitive in JNI?
score: 0
type: Question
has body: I want to call a java method from C that takes an argument T extends Number. I know java by default does the autoboxing for these types for you, but when I try to pass a float or jfloat in the JNI call, I get the following error: FATAL ERROR in native method: Bad JNI oop argument Is there an easy way to generate a Number java class or pass it to a Java method argument from C using JNI without caring about the actual primitive type?
tagged with: java-native-interface
linked to: http://stackoverflow.com/q/12216326
tagged with: java
answer count: 1

http://stackoverflow.com/q/21882660
has title: Create nested JSON with minimal-json?
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/21883204
has body: I'm using minimal-json (github) and am trying to create a nested JSON like so: String jsonInner = new JsonObject().add("Inner", "i").toString(); String jsonMiddle = new JsonObject().add("Middle", jsonInner).toString(); String jsonOuter = new JsonObject().add("Outer", jsonMiddle).toString(); In my debug console, the result looks like this: {"Outer":"{\"Middle\":\"{\\\"Inner\\\":\\\"i\\\"}\"}"} Not quite what I was expecting; there is a bit much escaping going on... I'm a bit slow today; can anyone please point out how to do this properly?
answer count: 1
tagged with: nested
accepted answer: http://stackoverflow.com/a/21883204

http://stackoverflow.com/q/21855004
type: AnsweredQuestion
tagged with: android-edittext
tagged with: java
has comment: http://stackoverflow.com/comment/33084136
type: Question
accepted answer: http://stackoverflow.com/a/21855157
answer count: 1
tagged with: textwatcher
has body: How are start, before, and count values called when we choose a prediction, for ex Do->Doc->Document. It sometimes deletes the word and inserts again with 2 calls, sometimes in the same call. Please advice.
score: 0
has answer: http://stackoverflow.com/a/21855157
has title: How does TextWatcher.onTextChanged() handle predictive text?
tagged with: android
linked to: http://stackoverflow.com/q/8543449

http://stackoverflow.com/q/21846404
tagged with: eclipselink
tagged with: jpa
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38298187
upvote count: 5
type: UnansweredQuestion
downvote count: 0
tagged with: java
has title: How to soft delete (logical delete) for all entities in eclipselink
has body: I researched about cascade soft delete in eclipselink and i saw we can do that with DescriptorCustomizer and AdditionalCriteria. But my problem is that i have a huge project and the customer wants to have all the records (also deleteds). I want a solution to implement this without creating too many descriptor customizer classes. I have too many relationships and that's too hard to handle that with writing sql update for all of childs. can i cascade soft delete that for all my entities and their childs in easier way?
type: Question
score: 5
has answer: http://stackoverflow.com/a/30080166

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

http://stackoverflow.com/a/21922754
answers question: http://stackoverflow.com/q/21922354
type: Answer
downvote count: 0
score: 1
upvote count: 1
has body: Let's say you create a method that operates on a single-dimensional array. You break the problem down into extracting strips of numbers from your 2d array into a 1d array. It's signature might look like boolean containsDupes(int[] strip) { ... }. There are a couple of approaches in that method that would make it easier to solve. One would be to sort that array so the dupes are next to each other. Another would be to populate a HashSet with each value and compare the size of the Set with the length of your array.

http://stackoverflow.com/q/21894382
favorite count: 0
has body: Is there a way to add an arrow head to a cubic curve? I can think of a very tedious way to do it (adding a shape, and control its direction, etc). But I am hoping there is a cleaner solution.
has answer: http://stackoverflow.com/a/21900066
type: AnsweredQuestion
tagged with: java
tagged with: javafx
has title: Add Arrow Head to CubicCurve, JavaFX
possible better answer: http://stackoverflow.com/a/21895192
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21895192
accepted answer: http://stackoverflow.com/a/21900066
score: -1
answer count: 2
upvote count: 0

http://stackoverflow.com/a/21967448
has body: For given use case, where there are only 3 long-runnung processes, threads are the best choice. Just wrap slowProcess in a class which implements Runnable and saves result inside. Start threads, wait them with Thread.join(), and extract results. Asynchronous model is good not only for I/O operations, but for any situation with many short tasks.
answers question: http://stackoverflow.com/q/21964599
has comment: http://stackoverflow.com/comment/33315395
score: 0
has comment: http://stackoverflow.com/comment/33307875
type: Answer

http://stackoverflow.com/comment/33298674
has text: Thank you. We didn't really go over for-each in class and I couldn't make heads or tails of anything I found explaining them online.
type: Comment
comment on: http://stackoverflow.com/a/21974797
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33297914
type: Comment
has text: inside notify put your notifcation code. below I posted the link to make notify in all devices
type: AnswerComment
comment on: http://stackoverflow.com/a/21974349
score: 0

http://stackoverflow.com/q/21878566
answer count: 1
accepted answer: http://stackoverflow.com/a/21878725
has title: File Upload with spring data - gridfs
has body: Hi i am trying to upload a file using spring data. When i try to upload file, i get an exception. My code for file upload is try { File file = new File(this.TEMPORARY_FILES_DIRECTORY, Calendar.getInstance().getTimeInMillis() + "_" + fileNameUnderscored); writeByteArrayToFile(file, form.getFile().getBytes()); FileInputStream inputStream = new FileInputStream(file); GridFSFile gridFSFile = gridFsTemplate.store(inputStream, "test.png"); PropertyImage img = new PropertyImage(); img.setPropertyUid(gridFSFile.getFilename()); imagesRepository.save(img); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } where TEMPORARY_FILES_DIRECTORY = new File("/home/temp/"); the exception i am getting is java.io.IOException: File '/home/temp/1392807425028_file' could not be created on debugging FileUtils class if (parent.mkdirs() == false) { throw new IOException("File '" + file + "' could not be created"); } parent.mkdirs() is false. Can anyone kindly tell me what is wrong with this code.
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
tagged with: spring-data
tagged with: fileutils
has answer: http://stackoverflow.com/a/21878725
type: Question
score: 0

http://stackoverflow.com/a/21900057
has body: Here is the solution , The first thing is , please check your Servlet URL path is ScriptServlet.java in your web.xmland put system.out.println() to print the values in the console. Then please change the following, You are doing completely wrong . Here you don't need to submit the form. Instead of , send only the ajax request to the servlet, and pass the paramters to the servlet . Your jsp page will be &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt; &lt;title&gt;Calculator&lt;/title&gt; &lt;/head&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt; &lt;/script&gt; &lt;script type="text/javascript"&gt; $( document ).ready(function() { //alert("DOM is ready"); }); function calc() { //This two values need for only option one to send the data var number1 = $.trim($("#n1").val()); var number2 = $.trim($("#n2").val()); $.ajax({ type: "POST", url: "ScriptServlet.java", data: "&amp;n1=" + number1 + "&amp;n2=" + number2, // option one //data: $('#calcForm').serialize(); This is a second option to send the data to the servlet. Here no need to send the data separately. dataType: "html", success: function(response) { //alert("Success : "+response); if(response != null &amp;&amp; response !="" &amp;&amp; response !="null"){ $('#result').val(response); } }, error: function(e) { alert('Error: ' + e.message); } }); } &lt;/script&gt; &lt;body&gt; &lt;form id='calcForm'&gt; &lt;table border="3"&gt; &lt;tr&gt; &lt;td&gt;Enter 1st number :&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="n1" id="n1"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Enter 2nd number :&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="n2" id="n2"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Result :&lt;/td&gt; &lt;td&gt;&lt;input type="text" value="" id="result"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;t…
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33217212
has comment: http://stackoverflow.com/comment/33213360
has comment: http://stackoverflow.com/comment/33218012
has comment: http://stackoverflow.com/comment/33308240
type: Answer
has comment: http://stackoverflow.com/comment/33223257
has comment: http://stackoverflow.com/comment/33213215
downvote count: 0
has comment: http://stackoverflow.com/comment/33303255
accepted answer of: http://stackoverflow.com/q/21896148
has comment: http://stackoverflow.com/comment/33216098
has comment: http://stackoverflow.com/comment/33208742
answers question: http://stackoverflow.com/q/21896148
score: 1
has comment: http://stackoverflow.com/comment/33319858
has comment: http://stackoverflow.com/comment/33212240
has comment: http://stackoverflow.com/comment/33212224
upvote count: 1

http://stackoverflow.com/comment/33375143
comment on: http://stackoverflow.com/a/22006491
has text: Yea I was thinking about just averaging the sentiment of the sentences together but I don't feel like that would give an accurate representation. What I think my approach will be to call `SentimentPipeline.main(String[])` in a new thread and just somehow throw strings in the `stdin` and get the sentiment that way.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21857572
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/21857768
type: AnsweredQuestion
score: 1
tagged with: java
has body: I really like of dropwizard, but have a old version of frameworks and not have maintenance for a long time, any have a idea if this framework will survive?
type: Question
has title: Dropwizard stop maintenance?
has comment: http://stackoverflow.com/comment/33090026
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21857768
tagged with: dropwizard

http://stackoverflow.com/comment/33157796
type: Comment
has text: You can change the layout manager used by NetBeans, I recommend making your own to achieve what it is you are trying to do, otherwise, every time the container is invalidated and validated, everything you've done will be discard by the currently installed layout manager
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21894728

junit
tags question: http://stackoverflow.com/q/21992118
type: Tag
tags question: http://stackoverflow.com/q/21929341
tags question: http://stackoverflow.com/q/21949420
tags question: http://stackoverflow.com/q/21987675
tags question: http://stackoverflow.com/q/21863057
tags question: http://stackoverflow.com/q/21998636
tags question: http://stackoverflow.com/q/21995411
tags question: http://stackoverflow.com/q/21902795
tags question: http://stackoverflow.com/q/21907116
tags question: http://stackoverflow.com/q/21912348
tags question: http://stackoverflow.com/q/21878474
tags question: http://stackoverflow.com/q/21936103
tags question: http://stackoverflow.com/q/21911070
tags question: http://stackoverflow.com/q/21909637
tags question: http://stackoverflow.com/q/21929107
tags question: http://stackoverflow.com/q/21908990
tags question: http://stackoverflow.com/q/21848525
tags question: http://stackoverflow.com/q/21979228
tag name: junit
tags question: http://stackoverflow.com/q/21882245
tags question: http://stackoverflow.com/q/21998195
tags question: http://stackoverflow.com/q/21950670
tags question: http://stackoverflow.com/q/21975254
tags question: http://stackoverflow.com/q/21916100
tags question: http://stackoverflow.com/q/21929932
tags question: http://stackoverflow.com/q/21946851
tags question: http://stackoverflow.com/q/21938868
tags question: http://stackoverflow.com/q/21879804
tags question: http://stackoverflow.com/q/21974213
tags question: http://stackoverflow.com/q/21876385
tags question: http://stackoverflow.com/q/21937801
tags question: http://stackoverflow.com/q/21994981
tags question: http://stackoverflow.com/q/21987383
tags question: http://stackoverflow.com/q/21937576
tags question: http://stackoverflow.com/q/21941238
tags question: http://stackoverflow.com/q/21960480
tags question: http://stackoverflow.com/q/21907654
tags question: http://stackoverflow.com/q/21866449
tags question: http://stackoverflow.com/q/21966334
tags question: http://stackoverflow.com/q/21846183
tags question: http://stackoverflow.com/q/21958316
tags question: http://stackoverflow.com/q/21951262

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

http://stackoverflow.com/q/21964026
answer count: 1
has comment: http://stackoverflow.com/comment/33279669
tagged with: url
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/33279553
has comment: http://stackoverflow.com/comment/33279559
has comment: http://stackoverflow.com/comment/33279566
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33279578
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/33279955
has title: How to read from URL after a button press
linked to: http://stackoverflow.com/q/9554636
has answer: http://stackoverflow.com/a/21964079
has body: Ok hello, What I want is when my button is pressed I want read the text from a URL and display it in the GUI, private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { //??????????????????? } I am very confused on this. I saw it in a Open Source project and I can't get it to work :/ All I really want is it to open up to a raw github file (in the GUI) to display the contents of the github. This is the github link I want the text to display as if it where actually in the application. Thanks for any help

http://stackoverflow.com/comment/33245530
has text: Well, all I can do to help is to say that the error doesn't seem to be in the code you have shown us. Which slightly reduces the places you have to look.
type: Comment
comment on: http://stackoverflow.com/a/21932368
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33351121
comment on: http://stackoverflow.com/q/22004092
has text: Can `cursor` ever be `null`?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21851687
has comment: http://stackoverflow.com/comment/33078270
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/33078249
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21851477
answers question: http://stackoverflow.com/q/21851477
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33077811
has body: You can't @Autowired a static field. But there is a tricky skill to deal with this: public class Foo { private static IAuditLogRepository iAuditLogRepository; @Autowired private IAuditLogRepository iaRepos; @PostConstruct public void someFunction () { iAuditLogRepository = iaRepos; } public static int saveLog(LogFile logFile){ iAuditLogRepository.saveLog(logFile); } } In one word, @Autowired a instance field, and assign the value to the static filed when your object is constructed.
has comment: http://stackoverflow.com/comment/33078160
has comment: http://stackoverflow.com/comment/33078232

http://stackoverflow.com/a/21885205
type: Answer
answers question: http://stackoverflow.com/q/21884858
has body: Try changing either while (leftmark &lt;= rightmark &amp;&amp; toSortArray[leftmark] &lt; pivot) { leftmark++; } to while (leftmark &lt;= rightmark &amp;&amp; toSortArray[leftmark] &lt;= pivot) { leftmark++; } or, while (leftmark &lt;= rightmark &amp;&amp; toSortArray[rightmark] &gt; pivot) { rightmark--; } to while (leftmark &lt;= rightmark &amp;&amp; toSortArray[rightmark] &gt;= pivot) { rightmark--; } (That is, change the &lt; to &lt;= or &gt; to &gt;=.) This will ensure that it doesn't quit when it comes to a non-unique value.
score: 0

http://stackoverflow.com/comment/33134181
comment on: http://stackoverflow.com/q/21882840
has text: your problem is getting fragment class instance in Activity?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21861842
has body: You are setting the Authorization header correctly. There is probably a problem with your API Key. You do have a problem in your registration ID and payload (which is not related to the 401 error). This is wrong : urlParameters.add(new BasicNameValuePair("registration_id=", "MY_DEVICE_GSM_REG_ID")); urlParameters.add(new BasicNameValuePair("data=", "Type=value,Lat=58.365547,Long=8.613235,Comment=value")); You should remove the = from the key and each payload parameter should start with data.. Therefore you should have: urlParameters.add(new BasicNameValuePair("registration_id", "MY_DEVICE_GSM_REG_ID")); urlParameters.add(new BasicNameValuePair("data.Type", "value")); urlParameters.add(new BasicNameValuePair("data.Lat", "58.365547")); urlParameters.add(new BasicNameValuePair("data.Long", "8.613235")); urlParameters.add(new BasicNameValuePair("data.Comment", "value"));
has comment: http://stackoverflow.com/comment/33097561
has comment: http://stackoverflow.com/comment/33098928
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21861363
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33101206

http://stackoverflow.com/a/21945133
has body: guestFixturesPanel.add(listTable); is wrong ! you must add the scroll like this: guestFixturesPanel.add(scroll);
has comment: http://stackoverflow.com/comment/33245710
type: Answer
has comment: http://stackoverflow.com/comment/33245610
upvote count: 1
answers question: http://stackoverflow.com/q/21945087
has comment: http://stackoverflow.com/comment/33245920
score: 1
has comment: http://stackoverflow.com/comment/33245550
downvote count: 0

http://stackoverflow.com/comment/33089807
type: AnswerComment
comment on: http://stackoverflow.com/a/21857907
score: 0
type: Comment
has text: @VladSchnakovszki i think the problem comes from activity_main?

http://stackoverflow.com/comment/33273411
type: QuestionComment
score: 1
has text: AFAIK, a package is actually a combination of the class loader and the package name. OSGi for example doesn't allow a package to be used from multiple modules (and each one has it's own classloader)
comment on: http://stackoverflow.com/q/21960255
type: Comment

http://stackoverflow.com/a/21955601
has comment: http://stackoverflow.com/comment/33264194
has comment: http://stackoverflow.com/comment/33264297
has comment: http://stackoverflow.com/comment/33264115
downvote count: 0
has comment: http://stackoverflow.com/comment/33264154
has body: You cannot remove an item from the ArrayList while you uterate over it. You should change your code to use an Iterator and then call .remove () Something like Iterator &lt;String&gt; it = players.iterator (); while (it.hasNext ()) it.remove (); It will remove every item from players. But you can use better methods to clear the array. It will fix your problem, of course you should adapt this example to your real code. But the problem is caused when you remove an item from an ArrayList whioe you are reading it. You should use the appropriate .remove item or use an index..
answers question: http://stackoverflow.com/q/21955506
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/21932333
type: UnansweredQuestion
tagged with: soap
tagged with: web-services
has body: I am creating the web-service with the use of SOAP & WSDL. After creating WSDL I am generating the "Java bean skeleton" using eclipse. From the generated stubs I can able to call the web-service from IOS app. In the web-service response I am returning the complex data type to the user. The problem is, I am getting the unique response tag for the complex type as given below. My WSDL is, <?xml version="1.0" encoding="UTF-8" standalone="no"?> <wsdl:definitions xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://service.cmp.app.com" xmlns:intf="http://service.cmp.app.com" xmlns:tns1="http://request.cmp.app.com" xmlns:tns2="http://response.cmp.app.com" xmlns:tns3="http://bean.cmp.app.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://service.cmp.app.com"> <wsdl:types> <import namespace="http://response.cmp.app.com"/> <import namespace="http://request.cmp.app.com"/> <import namespace="http://bean.cmp.app.com"/> <import namespace="http://response.cmp.app.com"/> <import namespace="http://service.cmp.app.com"/> <import namespace="http://bean.cmp.app.com"/> <import namespace="http://response.cmp.app.com"/> <import namespace="http://service.cmp.app.com"/> <import namespace="http://request.cmp.app.com"/> <import namespace="http://service.cmp.app.com"/> <import namespace="http://request.cmp.app.com"/> <import namespace="http://bean.cmp.app.com"/> </wsdl:types> <wsdl:message name="ViewAppTrackRequest"> <wsdl:part element="impl:ViewAppTrack" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:message name="ViewAppTrackResponse"> <wsdl:part element="impl:ViewAppTrackResponse" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:portType name="AppWeb"> <wsdl:operation name="ViewAppTrack"> <wsdl:input message="impl:ViewAppTrackRequest" name="ViewAppTrackRequest"> </wsdl:input> <wsdl:output message="impl:ViewAppTrackResponse" name="ViewAppTrac…
answer count: 0
has title: SOAP - response XML unique tag
has comment: http://stackoverflow.com/comment/33223416
tagged with: java
type: Question
tagged with: iphone
has comment: http://stackoverflow.com/comment/33685692
has comment: http://stackoverflow.com/comment/33221939
score: 0
has comment: http://stackoverflow.com/comment/33637663
has comment: http://stackoverflow.com/comment/33656690
tagged with: wsdl

http://stackoverflow.com/q/21950032
answer count: 1
has comment: http://stackoverflow.com/comment/33254477
favorite count: 0
tagged with: dynamic-programming
tagged with: c++
score: -4
has comment: http://stackoverflow.com/comment/33254655
has title: minimum number of machine for overlapping jobs
accepted answer: http://stackoverflow.com/a/21950591
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21950591
type: Question
has body: Given a list of overlapping jobs that need to be scheduled. Determine the minimum number of machines needed. so for example, the input is: {{1,6}, {2, 3}, {4,5}}. we can have two machines: M1 to work on {1, 6}. and M2 to work on {2, 3} and {4, 5}. my initial take is to use a vector of stacks, each stack represent a machine. But that takes too much space. my other guess is to use dynamic programming... any help? Java or C++.
downvote count: 4
has comment: http://stackoverflow.com/comment/33254474
upvote count: 0

http://stackoverflow.com/comment/33236215
comment on: http://stackoverflow.com/a/21939826
has text: @jessemac Then check if the array `timestring` is null or not.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21976691
has comment: http://stackoverflow.com/comment/33302192
tagged with: java
has answer: http://stackoverflow.com/a/21976718
has comment: http://stackoverflow.com/comment/33302158
downvote count: 1
type: Question
upvote count: 0
score: -1
has answer: http://stackoverflow.com/a/21976722
answer count: 2
has comment: http://stackoverflow.com/comment/33302177
has title: Creating a map in Java
favorite count: 0
type: UnansweredQuestion
tagged with: dictionary
has body: Im wanting to create a map with a float (or double) key and a char value. I have: Map&lt;double, char&gt; memory = new HashMap&lt;double, char&gt;(); However this is returning errors when compiling. The errors are saying unexpected error type for all 4 types (left and right). Another error says: type Map does not take parameters How do I fix this? Or is there a better approach to making a dictionary? Thank you, David Adapted The code is now: Map&lt;Double, Character&gt; memory = new HashMap&lt;Double, Character&gt;(); It is in the class named GameLogic. But this returns this error message upon compiling: GameLogic.java:5: type Map does not take parameters Map&lt;Double, Character&gt; memory = new HashMap&lt;Double, Character&gt;(); Extended code: public class GameLogic { Map&lt;Double, Character&gt; memory = new HashMap&lt;Double, Character&gt;(); public static int position; public static char currentBlock; public static int currentGold; public static int startingPosition; public GameLogic() { currentGold=0; } public void player_position() { ...

http://stackoverflow.com/a/21997433
type: Answer
has body: Without a regex a substr would be faster. Pseudo code: String strWorld = "World"; String string1 = "Hello World View"; bool bFound = false; bFound = ( strWorld == string1.substr(6, strWorld.length()) ) ? true : false; if ( bFound ) { }
has comment: http://stackoverflow.com/comment/33346168
score: 0
answers question: http://stackoverflow.com/q/21996884

http://stackoverflow.com/q/21899928
tagged with: graphics
has comment: http://stackoverflow.com/comment/33165610
has comment: http://stackoverflow.com/comment/33165632
answer count: 1
downvote count: 0
has body: Please have a look at the following image, it is a black and white print of a colour photo. This is a Fuel level indicator. User click on the up-down arrows and the fuel bar goes up-down. I have never done graphics like this before, and since this is a for a office software, I have no idea what kind of library can do this. There is one other image. This is your Car Dashboard Mileage meter. You can click in this and type the value and the numbers in the image will count down/ count up for the typed value. You are not creating a Game here and therefore, can you create something like this in Android?
has answer: http://stackoverflow.com/a/21900405
has comment: http://stackoverflow.com/comment/33165322
has comment: http://stackoverflow.com/comment/33169610
tagged with: android
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: animation
upvote count: 1
has title: Limitation of Android Graphics
has comment: http://stackoverflow.com/comment/33178209
tagged with: java
type: Question

http://stackoverflow.com/q/21938352
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21938432
score: 0
has body: I got a regexp to validate an email address like this ^[\\w\\d_\\.]+@[[a-z]+\\.]*[a-z]{2,3}$ The last part {2,3} means that there have to be 2 or 3 characters at the end of the input string. But for an input shown below it returns true. String input = "person.name@domain.gov.ukzzz"; Pattern pattern = Pattern.compile("^[\\w\\d_\\.]+@[[a-z]+\\.]*[a-z]{2,3}$"); Matcher matcher = pattern.matcher(input); System.out.println(input + " --&gt; " + matcher.matches()); output is person.name@domain.gov.ukzzz --&gt; true Why?
has comment: http://stackoverflow.com/comment/33236128
accepted answer: http://stackoverflow.com/a/21938432
has answer: http://stackoverflow.com/a/21938451
tagged with: regex
type: AnsweredQuestion
has title: What is wrong with my regexp {2,3}
possible better answer: http://stackoverflow.com/a/21938451
tagged with: java

http://stackoverflow.com/q/21978192
tagged with: java
has comment: http://stackoverflow.com/comment/33304964
has comment: http://stackoverflow.com/comment/33305007
has comment: http://stackoverflow.com/comment/33304775
type: Question
has answer: http://stackoverflow.com/a/21978409
has comment: http://stackoverflow.com/comment/33304986
favorite count: 0
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33304789
has body: When I run my program, the JFrame shows what is in the JFrame and then what is behind the JFrame when it is opened. public class ChuckysAdventure extends JFrame { // Main Class public ChuckysAdventure(){ setTitle("Chuckys Adventure"); setSize(700, 700); setResizable(false); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void paint (Graphics g){ g.drawString("Hi. I'm Chucky. Wanna play?", 250, 250); } public static void main(String[] args){ // Starts game new ChuckysAdventure(); }
has comment: http://stackoverflow.com/comment/33304941
has comment: http://stackoverflow.com/comment/33305057
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33304888
tagged with: transparent
has title: Java JFrame is displayed incorrectly
upvote count: 1
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/33304967

http://stackoverflow.com/a/21976168
answers question: http://stackoverflow.com/q/21973321
score: 4
type: Answer
upvote count: 4
has body: TCP is designed to maintain a connection indefinitely even when no data is moving across the connection in either direction. This means that the connection will not close and you will not see an exception if the client's network or an intermediate network goes down - and in fact, if such a network goes down, and then later comes back up, even hours later, a TCP connection that was unused during that period will by default still be there and usable for further communications afterwards. You will also not get an exception if the client computer crashes or is abruptly powered off. You might get an exception if the client computer is shut down normally, since its shutdown process might include closing all connections, depending on the operating system. If you want to disconnect when the network is lost for a certain period or when the client crashes, usually the best way to do it is by setting TCP keepalive. In Java, you can enable TCP keepalive by calling Socket.setKeepalive(true). This causes your socket to send occasional probe packets to check if the other end of the connection is still alive. Note that the default interval between TCP keepalive checks is typically two hours, and it is typically a system wide property. If you want the interval to be less, you'll need to change the system configuration.
downvote count: 0

http://stackoverflow.com/q/21975269
has answer: http://stackoverflow.com/a/21975282
has answer: http://stackoverflow.com/a/21993754
type: UnansweredQuestion
has title: Why won't Eclipse find my main class
tagged with: java
linked to: http://stackoverflow.com/q/146576
type: Question
tagged with: program-entry-point
has answer: http://stackoverflow.com/a/21975383
score: 0
has answer: http://stackoverflow.com/a/21975288
has body: Why won't my program find my main class? I don't think you need the rest of the parse() function to understand what is wrong... let me know package help; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class help { ArrayList&lt;Character&gt; StringList = new ArrayList&lt;Character&gt;(); static char[] data; String val; public void main(String[] args){ InputStreamReader ISR = new InputStreamReader (System.in); BufferedReader BR = new BufferedReader(ISR); try{ int sCurrentChar; while ((sCurrentChar = BR.read()) != -1) { parse((char) sCurrentChar); } } catch(IOException e){ e.printStackTrace(); } } public void parse(char x){ boolean done =false; int state =0;
answer count: 4

http://stackoverflow.com/q/21978872
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has body: Explanation: I have an int variable to keep track of how many times button is pushed. I have a JLabel that shows this variable in the form of a string basically. When I click Add, I want the variable to update and then the jlabel to show the updated variable. I have a secondary button listener class that implements the actionlistener code. I can't post all my code because my professor is strict about her plagiarism checks. EDIT: I see when I add the JLabel.setText to the action listener, it will update. Not sure if this is the best method. Code: int counter = 0; JLabel label = new JLabel("Count is: " + counter); JButton increment = new JButton("Increment Here"); increment.addActionListener(new ButtonListener()); My button listener class contains this code: counter++; Let me know if more code is necessary, I am just trying to simplify my issue. I tried adding an UpdateUI(); method, but nothing happened.
has answer: http://stackoverflow.com/a/21978898
type: UnansweredQuestion
upvote count: 1
type: Question
tagged with: actionlistener
tagged with: java
has title: How to update JLabel from action listener?

http://stackoverflow.com/a/21903700
accepted answer of: http://stackoverflow.com/q/21903583
answers question: http://stackoverflow.com/q/21903583
has comment: http://stackoverflow.com/comment/33172115
has body: The problem is coming because of : throw e; Since you are throwing a java.lang.Exception object from your catch block your method signature has to include throws clause stating this and therefore your method signature now becomes (or else your compiler will complain): public double getValueFrom(String widgName) throws Exception This change will resolve the problem.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33171746
has comment: http://stackoverflow.com/comment/33171801
type: Answer
has comment: http://stackoverflow.com/comment/33172829
score: 3
has comment: http://stackoverflow.com/comment/33172123
upvote count: 3
has comment: http://stackoverflow.com/comment/33172850

http://stackoverflow.com/q/21882143
answer count: 1
has title: equivalent of like in mongodb spring
has body: I would like to find the equivalent of LIKE in mongodb spring Here is the request with the exact match query.addCriteria(Criteria.where(field).is("myfield")) I would like something like: query.addCriteria(Criteria.where(field).LIKE("myfield"))
tagged with: java
tagged with: mongodb
type: AnsweredQuestion
tagged with: spring-mongo
has answer: http://stackoverflow.com/a/21882324
type: Question
tagged with: spring
accepted answer: http://stackoverflow.com/a/21882324
score: 0

http://stackoverflow.com/comment/33295257
has text: You said you tried i=0, but I don't see it in the code form button2
comment on: http://stackoverflow.com/q/21971627
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33327456
type: QuestionComment
has text: Added a screenshot of the heap. Also, I'm using GL2.0. Should I try 1.0 instead?
comment on: http://stackoverflow.com/q/21990699
score: 0
type: Comment

http://stackoverflow.com/comment/33117809
type: QuestionComment
comment on: http://stackoverflow.com/q/21873325
type: Comment
score: 0
has text: you can use swipe functonality for this..

http://stackoverflow.com/comment/33208783
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21924478
score: 0
has text: @VasiliSyrakis, cool! I didn't know that! learn somthin new every day! :)

http://stackoverflow.com/comment/33142952
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21887224
type: Comment
has text: fromDouble is initialized to 0.0. Its not being correctly assigned the value parsed from fromstr

http://stackoverflow.com/comment/33118655
type: AnswerComment
comment on: http://stackoverflow.com/a/21873875
score: 0
type: Comment
has text: Might not recompile .. Java class file should work cross platform

http://stackoverflow.com/a/21937067
accepted answer of: http://stackoverflow.com/q/21936741
type: Answer
has body: Java BE stands for Java Browser Edition. It was an edition of Java with a limited set of libraries, in order to make the JRE package very small, such as few MegaBytes of size, instead of the standard package that is around 100 MegaBytes of size. You can find an interesting article here. I said 'it was' because it seems the project was abandoned by Oracle, because there's no page or documentation on their website about it.
score: 8
answers question: http://stackoverflow.com/q/21936741
type: AcceptedAnswer
downvote count: 0
upvote count: 8

visual-foxpro
tags question: http://stackoverflow.com/q/21856285
type: Tag
tag name: visual-foxpro

http://stackoverflow.com/comment/33728404
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22194145
has text: Yes I tried adding prefix of root context in url but that also did not helped. :(

http://stackoverflow.com/comment/33142493
has text: @nos thx for your comment - I will try an see if removing the final csv output may help.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21886857
type: QuestionComment

http://stackoverflow.com/comment/33203771
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21921444
type: QuestionComment
has text: How about just using matcher.replaceAll("ab", "pq"); (could also be just Replace, haven't used either in a while)

http://stackoverflow.com/q/21924881
upvote count: 4
tagged with: abstract-syntax-tree
answer count: 1
downvote count: 0
has title: Eclipse JDT ASTParser convert enum declaration node incorrectly
favorite count: 0
type: UnansweredQuestion
tagged with: java
has body: I am working on analyzing Java code by using JDT and going to build a standalone analysis tool depend on org.eclipse.jdt.core package instead of an eclipse plug-in. But I found that my tool did not work correctly on enum declaration node which appeared in Java code. In my AST which created by jdt, keyword enum was regarded as a typename instead of an enum declaration. So I want to know how I should be can ensure that my tool can deal the enum declaration correctly. The jdt package that I used is "org.eclipse.jdt.core_3.8.3.v20130121-145325.jar". The createAST code is: char[] javaprogram=getJavaFile(javaFileName); ASTParser parser = ASTParser.newParser(AST.JLS4); parser.setSource(javaprogram); parser.setKind(ASTParser.K_COMPILATION_UNIT); final CompilationUnit cu = (CompilationUnit) parser.createAST(null); the java input is like below: package test; enum Color { RED(255, 0, 0), BLUE(0, 0, 255), BLACK(0, 0, 0), YELLOW(255, 255, 0), GREEN(0, 255, 0); private int redValue; private int greenValue; private int blueValue; private Color(int rv, int gv, int bv) { this.redValue = rv; this.greenValue = gv; this.blueValue = bv; } public String toString() { return super.toString() + "(" + this.redValue + "," + this.greenValue + "," + this.blueValue + ")"; } } But using astparser.createAST() to get CompilationUnit node just got the code which is just contained the package code: package test; The problem is solved by adding the CompilerOptions which code is shown below: Map options = JavaCore.getOptions(); options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5); options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); parser.setCompilerOptions(options);
tagged with: eclipse-jdt
has answer: http://stackoverflow.com/a/22211511
type: Question
tagged with: enums
score: 4

http://stackoverflow.com/q/21983171
has title: Not able to print Value returned by a C function in java using JNI
tagged with: java-native-interface
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21987214
score: 0
answer count: 1
type: UnansweredQuestion
has body: I need to call function C function "hashvalue(string)" inside my java program decryption(). I used JNI to build .dll library called HashValue.dll. The issue is whenever i call hashvalue, the java program terminates. Here is my headerfile, C program and the java program. java Program BufferedReader line = null; String support=""; int itemhashtableno; int maxhashvalue; int itemsetsize; try { line = new BufferedReader(new FileReader("F:/workspace/MTechProject-Frugal Scheme/src/authors205.txt")); String itemset; while((itemset=line.readLine())!=null) { System.out.println(itemset); StringTokenizer st = new StringTokenizer(itemset); FrequentItemset frequentitemset = new FrequentItemset(); for(i=0;i&lt;st.countTokens()-1;i++) frequentitemset.getItemset().add(st.nextToken()); support=st.nextToken().replaceAll("[()]",""); frequentitemset.setSupport(Integer.parseInt(support)); itemsetsize = frequentitemset.getItemset().size(); String first_item=frequentitemset.getItemset().get(0); String targetitem=""; System.out.println("hi"); maxhashvalue = hashvalue(first_item); System.out.println(maxhashvalue); System.out.println("over"); // if the first item if(AddedItemList.contains(first_item)) { int firstitemhashtableno = ItemHashTable.get(first_item); targetitem=first_item; maxhashvalue = hashvalue(first_item); System.out.println("hi"); System.out.println(maxhashvalue); for(i=1;i&lt;itemsetsize;i++) { String temp_item = frequentitemset.getItemset().get(i); if(AddedItemList.contains(temp_item)) { itemhashtableno = ItemHashTable.get(temp_item); if(itemhashtableno==firstitemhashtableno) { if(hashvalue(temp_item)&gt; maxhashvalue) { maxhashvalue=hashvalue(temp_item); targetitem=temp_item; } } else { System.out.println(frequentitemset.toString()); break; } } else { System.out.println(frequentitemset.toString()); break; } } if(i==itemsetsize) { int synopsisindex = hashvalue(synopsislist.get(firstitemhashtableno).get(0).getItem()) - hashvalue(targetitem)-1; frequentitemset.setSupport(freque…

http://stackoverflow.com/a/21876071
answers question: http://stackoverflow.com/q/21876004
has body: You cannot execute the same AsyncTask multiple times. Before executing the AsyncTask, instantiate a new instance first: private void askForData(){ asyncTask = new MyTask(); asyncTask.delegate = this; asyncTask.execute(urlServer+"test.php"); } Also remove the instantiation of the AsyncTask at the beginning of your class.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21876004

http://stackoverflow.com/comment/33135238
comment on: http://stackoverflow.com/q/21883523
type: Comment
score: 1
has text: Why you would name your local variable name same as your class name??
type: QuestionComment

http://stackoverflow.com/a/21943901
score: 4
has body: This is just the declaration, to start it, use: t.start(); More info here. To know how to run your Thread periodically, see this.
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21943865
type: Answer
answers question: http://stackoverflow.com/q/21943865

http://stackoverflow.com/a/21888092
has body: You have to inject the scanner instance to other classes through constructor. Like below: import java.util.*; public class Test1 { private Scanner _scanner; public Test1(Scanner sc) { _scanner = sc; } } public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Test1 testObj = new Test1(sc); } }
score: 2
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/21887928

http://stackoverflow.com/comment/33316816
comment on: http://stackoverflow.com/a/21985426
type: Comment
has text: Moreover this solution will not preserve insertion order; you'd need a `LinkedHashSet`.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21969111
has body: So I had an Eclipse project given to me, which I opened in Eclipse and converted to a web project and began writing a servlet + JSP pages for it. It was working fine, until this morning when I cleaned the project using Eclipse's in-built clean function. Now I am getting the 404 with 'Requested resource is not available' where it was working fine before. Here is the Servlet code: package servlets; import is2.data.SentenceData09; import is2.lemmatizer.Lemmatizer; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class FYPServlet */ @WebServlet("/FYPServlet") public class FYPServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * Default constructor. */ public FYPServlet() { // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if(request.getParameter("sentence")!=null){ //Create container SentenceData09 sentence = new SentenceData09(); //Split input up String[] words = request.getParameter("sentence").split(" "); String lastword = words[words.length-1]; int sizeoflastword = lastword.length(); //If sentence has a full stop, remove it if(lastword.charAt(sizeoflastword-1)=='.'){ words[words.length-1] = lastword.substring(0,sizeoflastword-1); } //Add &lt;root&gt; to start and a full stop to end String[] fullsentencewords = new String[words.length+2]; fullsentencewords[0] = "&lt;root&gt;"; int i=1; for(String word : words){ fullsentencewords[i] = word; i++; } fullsentencewords[fullsentencewords.length-1] = "."; //Initialise the container sentence.init(fullsentencewords); //Give lemmatiz…
type: AnsweredQuestion
has title: Previously working Java servlet now no longer working after 'Clean' - Tomcat v7.0 and Eclipse
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/33293767
type: Question
has comment: http://stackoverflow.com/comment/33288622
tagged with: eclipse
tagged with: servlets
score: 2
has answer: http://stackoverflow.com/a/22045269
downvote count: 0
answer count: 1
tagged with: tomcat
favorite count: 0
accepted answer: http://stackoverflow.com/a/22045269

http://stackoverflow.com/comment/33282423
comment on: http://stackoverflow.com/a/21965101
type: AnswerComment
has text: Here is the bean that I defined:
score: 0
type: Comment

http://stackoverflow.com/a/21920935
has body: You could use System.out.printf() like so, public static void main(String[] args) { System.out.printf("%03d - %s, %s.\n", 7, "Bond", "James Bond"); } Outputs, 007 - Bond, James Bond.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21920433

http://stackoverflow.com/comment/33222929
comment on: http://stackoverflow.com/a/21921784
type: AnswerComment
score: 0
type: Comment
has text: It does, for the same reason. the regexp matches the entire tag. It is only looking for other matches AFTER the first match. Ou'll need lookaheads and lookbehinds to make it work - but I'm not sure if Javascript supports those. If it doesn't, there is no way. (YOur original code should have only replaced one tag per page, not one per tag)

http://stackoverflow.com/q/21897794
has body: Hello i am writing a program that creates a method that can remove items from an arraylist and add them to another ArrayList (under certain conditions). This is the method I am supposed to create: A method called giveAwayFish() which represents a person returning his fish to the pond and/or giving them away to another fisher. It will go through all of this person's fish ( the one giving the fish away) and see if the other fisher ( the one who will be receiving the fish) is willing to keep any. If the other fisher wants any, they are to be given to that fisher. If the fisher is unwilling to keep the fish, then these fish must be returned to the pond. I tried writing out this method about a hundred times and I can not for the life of me figure out what to do. I was able to remove all the fish from the persons array but I do not know how to add them back. This is what I need help with. Here is my code if it helps: import java.util.*; public class Fisher { private String name; private Fish [] fishCaught; private int numFishCaught; private int keepSize; public static int LIMIT = 10; public String getName() { return this.name; } public int getNumFishCaught() { return this.numFishCaught; } public int getKeepSize() { return this.keepSize; } public Fisher(String n, int k) { name = n; keepSize = k; } public String toString() { return(this.name + " with " + this.numFishCaught + " fish as follows:"); } private ArrayList&lt;Fish&gt; fishesCaught = new ArrayList&lt;Fish&gt;(); public void keep(Fish fish) { if(this.numFishCaught &lt; LIMIT) { fishesCaught.add(fish); numFishCaught++; } } public boolean likes(Fish fish) { if(fish.size &gt;= this.keepSize &amp;&amp; fish.species != "Sunfish") { return true; } else { return false; } } public void listFish() { System.out.println(this.toString()); for(Fish fish : fishesCaught) { System.out.println(fish.toString()); } } public void goFishingIn(Pond pond) { Fish fish = pond.catchAFish(); if(likes(fish)) { this.keep(fish); } else { pond.ad…
downvote count: 0
has comment: http://stackoverflow.com/comment/33162191
type: AnsweredQuestion
tagged with: oop
score: 1
tagged with: java
has title: creating a method that can remove items from an arraylist and add them to another arraylist (under certain conditions)
tagged with: methods
has comment: http://stackoverflow.com/comment/33161875
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/33161937
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/33161694
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/21897982
accepted answer: http://stackoverflow.com/a/21897982
has comment: http://stackoverflow.com/comment/33162270

http://stackoverflow.com/comment/33337923
has text: @AndrewAngell: The class is 'DoExpressCheckoutPaymentResponseType'. The full package is urn.ebay.api.PayPalAPI.DoExpressCheckoutPaymentResponseType
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21946481

http://stackoverflow.com/q/22002708
linked to: http://stackoverflow.com/q/13794295
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22002750
upvote count: 1
has title: Declaring a private instance variable and referencing it in a different class
duplicate of: http://stackoverflow.com/q/13794295
has answer: http://stackoverflow.com/a/22002936
type: Question
has answer: http://stackoverflow.com/a/22002746
accepted answer: http://stackoverflow.com/a/22002803
answer count: 6
possible better answer: http://stackoverflow.com/a/22002745
has answer: http://stackoverflow.com/a/22002745
has body: I'm not really sure how to word the title nor this but I'll try to be as specific as I can. I have created a class that contains a constructor that allows me to create objects of "Circle" type, and this circle has an argument radius. Here is that class: public class Circle { private double radius; public Circle(double radius) { this.radius = radius; // this.radius refers to the instance variable above } public Circle() { } public double getArea() { double area = radius * radius * Math.PI; return area; } public double getCircumference() { double circumference = 2 * Math.PI * radius; return circumference; } } I think the methods contained in this code are straight forward. I create an object given a radius, and it computes the circumference and area. I also have another class, CircleTester, where I have created 2 objects of Circle type, c1 and c2, with a radius of 5 and 10, respectively. public class CircleTester { public static void main (String[] args) { Circle c1 = new Circle(5); double circumference1 = c1.getCircumference(); double area1 = c1.getArea(); System.out.println("Radius of c1: " + c1.radius); System.out.printf("The circle c1 with circumference %.3f has area %.3f%n", circumference1, area1); Circle c2 = new Circle(10); double area2 = c2.getArea(); //objectReference.methodName() double circumference2 = c2.getCircumference(); //objectReference.methodName() System.out.println("Radius of c2: " + c2.radius); System.out.printf("The circle c2 with circumference %.3f has area %.3f%n", circumference2, area2); } } I'm having errors with the following 2 lines: System.out.println("Radius of c2: " + c2.radius); System.out.println("Radius of c2: " + c2.radius); The program is failing to recognize c2.radius as the instance variable "radius" is declared as private in the circle class. My question is is there any way to allow the CircleTester program to read the values of the radius of each object, without changing the instance variable from private to public? c1.radius an…
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22002803
has answer: http://stackoverflow.com/a/22002759
type: AnsweredQuestion

http://stackoverflow.com/comment/33272881
type: AnswerComment
comment on: http://stackoverflow.com/a/21958432
type: Comment
has text: `setSize` will have no effect if the buttons are under the control of a layout manager, which they should be, but that's another rant. `setSize` and `setLoaction` should be avoid and approximate layout managers should be employed. This would allow the OP to use `JFrame#pack` to set the initial size of the frame, taking into account the preferred size of the overall container, which would solve the issue automatically. It would also solve the issue of involving different font metrics on different systems, making the application more portable...
score: 0

http://stackoverflow.com/comment/33308758
type: Comment
comment on: http://stackoverflow.com/a/21938822
score: 0
type: AnswerComment
has text: PS, saying you get 25000 free emails per month if you sign up via Google App Engine is misleading if your daily sent limit is limited to 200 emails - that means in 31 day month I'll only be able to use 6200 mail credits of that 25000

http://stackoverflow.com/comment/33105776
type: Comment
comment on: http://stackoverflow.com/a/21866356
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/47797/discussion-between-nathaniel-waggoner-and-user3245658)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/67324530
type: AnswerComment
has text: Please note that in HBase 0.98 (and maybe earlier), They changed the API to setFilter. scan.setFilter(prefixFilter);
comment on: http://stackoverflow.com/a/21843961
type: Comment
score: 3

http://stackoverflow.com/comment/33227380
score: 0
has text: Probably the easiest way is grab the `tika-app` jar from Apache Tika, and use the `-z` flag - that'll handle calling POI to do the extraction
comment on: http://stackoverflow.com/q/21879809
type: Comment
type: QuestionComment

http://stackoverflow.com/a/29004803
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21955207
has body: Go to Your Project Property search for project facet and change java version
has comment: http://stackoverflow.com/comment/46264671
upvote count: 4
downvote count: 4

http://stackoverflow.com/comment/34395992
type: AnswerComment
has text: Yeah.. actually until now I did not had the privileged to upvote; being a newbie to stackoverflow
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21879423

http://stackoverflow.com/q/21927132
has answer: http://stackoverflow.com/a/21927337
accepted answer: http://stackoverflow.com/a/21927337
has comment: http://stackoverflow.com/comment/33213296
has title: How to show all factors of a number?(Edited)
tagged with: factorization
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33213228
has body: I need help on fixing my FactorX method. It needs to be like this&gt;&gt;.. The factors of x. (For example, if x is 120 then the factors would be 2, 2, 2, 3, 5). ppublic static String factorX(long x){ String factor=""; long number = x; long i = 2; while (i &lt; number) { if (number % i == 0) { factor += i+", "+i+", "; number /= i; } else { i++; } } return factor; I need my method to show all factors, now it is showing only one. I was told about List, but I cannot make to work.
tagged with: java
has comment: http://stackoverflow.com/comment/33299115
tagged with: methods
has comment: http://stackoverflow.com/comment/33213144
type: Question
answer count: 1
tagged with: static-methods
score: 0
has comment: http://stackoverflow.com/comment/33213285
has comment: http://stackoverflow.com/comment/33213368
has comment: http://stackoverflow.com/comment/33213809
has comment: http://stackoverflow.com/comment/33213103

http://stackoverflow.com/q/21935296
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21936772
has body: Hi i am using Tapestry3 framework. Here i can simply call a getter method by doing ognl:myMethod. It will simply invoke getMyMethod(). But how will call setMyMethod..Is there any way. Or is it possible to to call a java method from html page with a parameter. or more precisely ,,just how to set a value from html page to java page in Tapestry3
has title: How to call a setter method from html file in Tapestry3
downvote count: 0
answer count: 1
tagged with: tapestry
favorite count: 0
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
score: 1

http://stackoverflow.com/comment/33265221
type: QuestionComment
has text: Is there a clear distinction between the methods that initialise the class and the methods that use the data?
score: 0
comment on: http://stackoverflow.com/q/21956171
type: Comment

http://stackoverflow.com/q/21863057
downvote count: 1
has comment: http://stackoverflow.com/comment/33098930
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33099548
has body: Why the debug point not moving to if else clause below, there was no error in testServ method and working as expected. @Test public void testXMAS() { StringBuffer fb = xmsObj.testServ("XZXZXXX", 25, "", "", ""); if (fb != null) logger.debug("ABCD done , issues: " + fb.toString()); else logger.debug("ABCD not done , successfull:"); } } after executing below loop is not going to return sb statement in the testServ() method? That is why debug point in @Test class is not triggering. while (br.readLine() != null) { String returnString = br.readLine(); if (rString.contains("eee")) { log.debug(" Mie:" + rString); } }
tagged with: junit
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21863170
has comment: http://stackoverflow.com/comment/33098851
has title: debug test case in java
has answer: http://stackoverflow.com/a/21863306
has comment: http://stackoverflow.com/comment/33099106
has comment: http://stackoverflow.com/comment/33098865
tagged with: java
upvote count: 1

http://stackoverflow.com/a/21985883
has comment: http://stackoverflow.com/comment/33317961
type: Answer
has comment: http://stackoverflow.com/comment/33320361
has comment: http://stackoverflow.com/comment/33318237
has comment: http://stackoverflow.com/comment/33318164
has body: You can use Jackson for that and its JsonNode: final ObjectMapper mapper = new ObjectMapper(); final JsonNode input = mapper.readTree(yourSourceHere); Map.Entry&lt;String, JsonNode&gt; entry; final Iterator&lt;Map.Entry&lt;String, JsonNode&gt;&gt; iterator = input.get("List").get("Summary").fields(); while (iterator.hasNext()) { entry = iterator.next(); // work with entry } NOTE however: object member order is NOT significant in JSON (see RFC 4627). It is strange that the internal objects are not stored in an array instead (since array element order is significant). That is: {"0": null, "1": null} and {"1": null, "0": null} are the same object, but [0, 1] and [1, 0] are not the same array. Jackson will read in the order of appearance, but that's an "accident". Do NOT rely on it.
score: 0
accepted answer of: http://stackoverflow.com/q/21985770
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33318953
answers question: http://stackoverflow.com/q/21985770
has comment: http://stackoverflow.com/comment/33318025

http://stackoverflow.com/q/21944222
tagged with: multithreading
has answer: http://stackoverflow.com/a/21945274
linked to: http://stackoverflow.com/q/8091350
tagged with: java
has title: Get list of running apps on UI Thread
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21944315
score: 0
tagged with: android
linked to: http://stackoverflow.com/q/5274874
has body: I know that a list of running apps can be attained in the following way: ActivityManager manager = (ActivityManager) getActivity() .getSystemService(ACTIVITY_SERVICE); List&lt;RunningAppProcessInfo&gt; processes = manager.getRunningAppProcesses(); This, however, returns all running processes. My goal is to get the list of running apps that you seen when you long press the Home button (i.e. apps you are interacting with), not background processes, which I believe are on the UI thread but could be incorrect. Is there a way to do this?
type: UnansweredQuestion

http://stackoverflow.com/q/21891403
has title: How to make sum of columns and sum of rows method for Two-dimensional array?
has answer: http://stackoverflow.com/a/21891737
tagged with: multidimensional-array
type: Question
score: 1
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/21891966
accepted answer: http://stackoverflow.com/a/21891737
tagged with: java
tagged with: methods
type: AnsweredQuestion
has body: So far I have a method that totals the columns, but it's not exactly what I need. I need to have the total of each row to the right of each row, and the total of each column at the bottom of each column. Something like this 1 2 3 4 = 10 3 4 5 6 = 18 4 6 8 10 &lt; - Total What I have now gives me the total of each column, but not under the columns. Method // method to add the sum of columns public static int[] columnSum(int x[][]){ int temp[] = new int[x[0].length]; for (int i = 0; i &lt; x[0].length; i++){ int sum = 0; for (int j = 0; j &lt; x.length; j++){ sum += x[j][i]; } temp[i] = sum; System.out.println("Index is: " + i + " Sum is: "+sum); } return temp; } }
tagged with: arrays
downvote count: 0
possible better answer: http://stackoverflow.com/a/21891577
favorite count: 0
has answer: http://stackoverflow.com/a/21891577

http://stackoverflow.com/a/21991157
has body: The 401 error indicates an issue with authentication. There are 3 factors that comprise authentication here: (1) organization name, (2) username and (3) password. The (1) organization name and (2) are username are configured in setenv.sh. The (3) password is prompted for from deploy.sh. Make sure you have set your org and username by modifying the following two lines in setenv.sh : org="Enter the name of your organization here" username="Enter your Apigee username"
has comment: http://stackoverflow.com/comment/33351871
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21988784

http://stackoverflow.com/q/21956957
has comment: http://stackoverflow.com/comment/33266744
tagged with: java
type: Question
has title: How do I make the NoSuchElementException not show up and replace it with my own error message
has answer: http://stackoverflow.com/a/21957012
accepted answer: http://stackoverflow.com/a/21957012
score: 0
has comment: http://stackoverflow.com/comment/33266684
answer count: 2
has comment: http://stackoverflow.com/comment/33269158
possible better answer: http://stackoverflow.com/a/21957149
has body: So what I am supposed to do it have this code search through the file names.txt (contains about a thousand baby names and their rankings from 1900 to now) for the name that I type in and have the program print out the name and the rankings. If the name does not exist in the file, it is supposed to print out something like "name not found" or whatever. My problem is that it either prints out 'name not found' about 2k times before it finds the name, or it jsut prints out 'name not found' for every year until I get to the last name and it realizes it's not there. It then prints out the cpu generated error. I also am not supposed to have the error just be the computer generated error. Please help. import java.util.Scanner; import java.io.*; public class BabyNames { public static void main(String[] args) throws FileNotFoundException { Scanner input = new Scanner(System.in); Scanner reader = new Scanner(new File("names.txt")); String findNameOriginal = " "; String findName = " "; int space = 0; int rank = 0; int year = 1900; System.out.println("This program graphs the popularity of a name in 11 decades' worth of statistics recorded since the year 1900."); System.out.print("Type a name: "); String name = input.next(); System.out.println("\nPopularity ranking of name \"" + name + "\""); while (!findName.equalsIgnoreCase(name)) { findNameOriginal = reader.nextLine(); Scanner nameLine = new Scanner(findNameOriginal); space = findNameOriginal.indexOf(" "); findName = nameLine.next(); for (year = 1900; year &lt;= 2000; year += 10) { rank = nameLine.nextInt(); if (findName.equalsIgnoreCase(name)) { System.out.println(year + ": " + rank); } else { System.out.println("Name not found"); } } } } } (not sure if this link to the names and data will work) http://fcps.blackboard.com/@@/3773575E3802F997E96CECF10E46CA25/courses/1/030-1-348-31840002-1314-YR/content/_27024448_1/names.txt
has comment: http://stackoverflow.com/comment/33266851
has answer: http://stackoverflow.com/a/21957149
type: AnsweredQuestion

http://stackoverflow.com/a/21922640
has comment: http://stackoverflow.com/comment/33205750
has comment: http://stackoverflow.com/comment/33205872
has comment: http://stackoverflow.com/comment/33205790
upvote count: 3
has comment: http://stackoverflow.com/comment/33205860
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer
has body: Subtype polymorphism works in the first way you mentioned but it has nothing to do with your other example. An Animal instance is able to respond to method fly(), then if the instance is an Unicorn (which is an Animal), the more specified version of the method will be called (and this is polymorphism). But an Animal is not an Unicorn, so walk() doesn't belong to Animal class, the subtyping relation is not symmetric. In a situation like: void method(Animal animal) { animal.walk(); } method(new Unicorn()); You receive a compilation error because the signature of method accepts an Animal. Inside that method, the variable animal (even if at runtime is an Unicorn) at compile time is just known to be an Animal, which doesn't have method walk(). So the additional information on the type is discarded inside that method. Java has a static strong type checker, which means that every verification is made at compile time. A different programming language could allow you to do what you want and throw a runtime error if you pass something which is not able to answer to walk method.
answers question: http://stackoverflow.com/q/21922554
accepted answer of: http://stackoverflow.com/q/21922554

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

http://stackoverflow.com/a/21904435
type: Answer
has body: Think you are trying to access a collection which is detached... Remove the @Lazy(false) and try with @ManyToOne(fetch = FetchType.EAGER) If this is working revert the changes and add Hibernate.initizlize(department); Also there is an error in you mapping too.. One user can have many departments so in that case in user class department should be a Set instead of one object.. Try the same with privileges too.. department object is not initialized to get privileges..
score: 0
answers question: http://stackoverflow.com/q/21903098

wfp
tags question: http://stackoverflow.com/q/21968230
tag name: wfp
type: Tag

http://stackoverflow.com/q/21989914
tagged with: websphere
linked to: http://stackoverflow.com/q/8131529
score: 3
has body: I would like to know how to utilize Log4J to log SOAP messages in WebSphere 7, I am using JAX-WS which uses AXIS2 engine that ships with WebSphere 7. I was able to log the SOAP messages using "tracing" in WebSphere but I would like to know if there is a way to use Log4J to log SOAP messages and use a File Appender. I would appreciate if someone can tell me exactly how to configure it, I tried a few things but it did not work. I did put log4j.properties file in WEB-INF/classes as follows but it does not log SOAP messages. log4j.rootCategory=DEBUG, LOGFILE log4j.logger.org.apache.axis2=DEBUG, LOGFILE log4j.category.org.apache.axis2=DEBUG, LOGFILE log4j.logger.org.apache.axis2.transport.http=DEBUG, LOGFILE log4j.category.org.apache.axis2.transport.http=DEBUG, LOGFILE log4j.logger.com.ibm.ws.websvcs=DEBUG, LOGFILE log4j.category.com.ibm.ws.websvcs=DEBUG, LOGFILE log4j.appender.LOGFILE=org.apache.log4j.FileAppender log4j.appender.LOGFILE.File=C:/K1/logs/axis.log log4j.appender.LOGFILE.Append=true log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout log4j.appender.LOGFILE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%t] %-5p %c %x - %m%n
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/1945618
has answer: http://stackoverflow.com/a/21996427
type: Question
tagged with: soap
has answer: http://stackoverflow.com/a/22340880
upvote count: 3
tagged with: java
answer count: 2
tagged with: jax-ws
has title: WebSphere 7 JAX-WS Log Soap Messages using log4j
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33491390

http://stackoverflow.com/a/21950511
answers question: http://stackoverflow.com/q/21950439
has comment: http://stackoverflow.com/comment/33256870
score: 0
type: AcceptedAnswer
type: Answer
has body: direct answer: final String st1 = "1005 random array 2.2"; final int idx1 = st1.indexOf(' '); final int idx2 = st1.lastIndexOf(' '); final int a = Integer.valueOf(st1.substring(0, idx1)).intValue(); final char[] s2 = st1.substring(idx1, idx2).toCharArray(); final float b = Float.valueOf(st1.substring(idx2+1)).floatValue();
accepted answer of: http://stackoverflow.com/q/21950439

http://stackoverflow.com/comment/33292105
type: Comment
comment on: http://stackoverflow.com/q/21971079
type: QuestionComment
has text: you are trying to store `0008` and `0009` in int but that may not be happening..see here http://stackoverflow.com/questions/275711/add-leading-zeroes-to-number-in-java
score: 0

http://stackoverflow.com/comment/33265014
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21956042
has text: what you mean. in efficent ? is it taking too much time

http://stackoverflow.com/comment/33209249
comment on: http://stackoverflow.com/q/21924802
type: Comment
type: QuestionComment
has text: @EJP you can code one though.
score: 1

http://stackoverflow.com/q/21856350
possible better answer: http://stackoverflow.com/a/43358985
has answer: http://stackoverflow.com/a/43358985
has answer: http://stackoverflow.com/a/21856564
upvote count: 1
has body: I am trying to use elasticsearch in my J2EE application but I am getting java.lang.ClassNotFoundException: org.elasticsearch.common.transport.TransportAddress during deployment to Glassfish 3.1. IntelliJ shows no error during compilation. I use maven with dependency in pom.xml: org.elasticsearch elasticsearch 1.0.0 This happens when use this code in my project: Client client = new TransportClient().addTransportAddress(new InetSocketTransportAddress("localhost", 9200)); I took look into elasticsearch-1.0.0.jar used by maven and found that TransportAddress is interface. Probably the whole library it not being put into glassfish. Here is complete stacktrace: [#|2014-02-18T15:05:00.963+0100|INFO|glassfish3.1.2|org.jboss.weld.ClassLoading|_ThreadID=51;_ThreadName=Thread-2;|catching org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class modules.core.service.CmsViewerServiceImpl at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:167) at org.jboss.weld.bootstrap.BeanDeployer.loadWeldClass(BeanDeployer.java:108) at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:79) at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:123) at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:184) at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:350) at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:179) at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128) at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:277) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunner…
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: glassfish
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/21856564
tagged with: classnotfound
downvote count: 0
has title: java.lang.ClassNotFoundException: org.elasticsearch.common.transport.TransportAddress
favorite count: 0
tagged with: elasticsearch

http://stackoverflow.com/q/21923138
has comment: http://stackoverflow.com/comment/33206538
tagged with: string-concatenation
tagged with: substring
has answer: http://stackoverflow.com/a/21923242
has answer: http://stackoverflow.com/a/21923441
type: UnansweredQuestion
score: 0
has title: Given 2 strings with 1 or more common letters , put them together ,e.g "ab" + "bc" = "abc"
tagged with: java
has comment: http://stackoverflow.com/comment/33206533
has body: I m confused when the strings have more than 2 common letters: "abc" + "bcd" = "abcd" , no repetitions like "abccd" or "abbccd" public static String make_new_name(String name1, String name2) { String result = ""; for (int i = 0 ; i &lt; name1.length() ; i++) { System.out.println("=========== i " + name1.charAt(i) + " ================="); for (int j = 0 ; j &lt; name2.length() ; j++) { System.out.println(" j : " + name2.charAt(j)); if (name1.charAt(i) != name2.charAt(j)) { result += name1.charAt(i); } else { result += name1.charAt(j); } } } System.out.println(result) ; return result ; } but this code does not work! Please help.
type: Question
answer count: 2

http://stackoverflow.com/q/21853856
has comment: http://stackoverflow.com/comment/33081890
type: AnsweredQuestion
score: 2
tagged with: java
has body: I have a java application which is implemented as a main method, with a try, catch finally block. The work is done inside the try. If I kick of the application via a bash script, and during its execution issue a CTRL+C, I'm noticing inconsistent behaviour. Sometimes the catch block executes and sometimes it does not. Can this be explained? (sample code below - where sometimes neither "Caught" or "Shutdown Complete" are logged) public class Foo { public static void main(String[] args) { try { doStuff(); } catch (Throwable e) { LOGGER.error("Caught.", e); } finally { LOGGER.info("Shutdown complete."); } } }
has comment: http://stackoverflow.com/comment/33081849
has title: When is control CTRL+C ignored
has comment: http://stackoverflow.com/comment/33081887
type: Question
has comment: http://stackoverflow.com/comment/33081699
linked to: http://stackoverflow.com/q/4147288
has comment: http://stackoverflow.com/comment/33081798
has answer: http://stackoverflow.com/a/21854484
downvote count: 0
has comment: http://stackoverflow.com/comment/33081663
has comment: http://stackoverflow.com/comment/33081732
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33081719
accepted answer: http://stackoverflow.com/a/21854484
upvote count: 2
tagged with: exception

http://stackoverflow.com/comment/33197446
has text: I have read somewhere that ExecutorService **does not** guarantee a FIFO manner. I need it - that is why I use `LinkedBlockingQueue` in my app. Anyway, thank you for your attention - I am a 1-day-cocnurrence-user, and find such suggestions informative, anyway :)
comment on: http://stackoverflow.com/a/21917686
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33266517
comment on: http://stackoverflow.com/a/21956646
score: 0
type: Comment
has text: Thanks I had eventually figured this out, thanks for all of your help!
type: AnswerComment

http://stackoverflow.com/q/21886981
favorite count: 0
has answer: http://stackoverflow.com/a/21892573
tagged with: hbase
type: UnansweredQuestion
downvote count: 0
has title: Exception :org.apache.hadoop.hbase.masternotrunningexception
score: 1
tagged with: java
has body: I am running hbase using java,my hbase started earlier with ease ,now when I am giving "list" command in hbase(main) :001:0:>>list It types "TABLE" and give so many lines of java on terminal and ended with ERROR :org.apache.hadoop.hbase.masternotrunningexception: Retried 7 times I stopped the hbase and restarted, but it didn't work for me. This is the trace of logs: 14/02/18 07:16:17 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection 14/02/18 07:16:17 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) 14/02/18 07:16:17 INFO zookeeper.RecoverableZooKeeper: The identifier of this process is 5461@ubuntu 14/02/18 07:16:17 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:597) at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068) 14/02/18 07:16:17 WARN zookeeper.RecoverableZooKeeper: Possibly transient ZooKeeper exception: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid 14/02/18 07:16:17 INFO util.RetryCounter: Sleeping 2000ms before retry #1... 14/02/18 07:16:18 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) 14/02/18 07:16:18 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.fin…
type: Question
tagged with: hadoop
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/33315834
has text: @Mureinik Thanks, that seems to have done the trick. Much appreciated :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21984628
type: AnswerComment

http://stackoverflow.com/a/21881101
type: Answer
has comment: http://stackoverflow.com/comment/33130846
has comment: http://stackoverflow.com/comment/33131007
has comment: http://stackoverflow.com/comment/33131026
has comment: http://stackoverflow.com/comment/33132347
has comment: http://stackoverflow.com/comment/33130845
accepted answer of: http://stackoverflow.com/q/21880728
has comment: http://stackoverflow.com/comment/33131132
has body: Get the password from user and store it in String object. String pass = "yourpassword"; // or get it from System using Scanner String username = "username"; Now make a function where you will Fetch the data from table public int present(){ // make query for Oracle data base String yourQry = "select * from yourtable where password = '"+pass+"' and username='"+username+"'" . //Use this query when you are fetching data from user. Resultset rs;// fetch your data in resultset if(rs.next()){ // if data got fetched return 1;// In other languages(C,C++) 0 and 1 are treated as true or false // 1 means true } else{ return 0; // 0 means false (No datafound) } } Now call this function from main() int a = present(); if (a==0){ System.out.print("data not found") } else{ System.out.print("data found") }
score: 0
answers question: http://stackoverflow.com/q/21880728
has comment: http://stackoverflow.com/comment/33130901
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33131224

http://stackoverflow.com/q/21877718
has body: I am writing a server application with Java servlets and at some point, a Python script that was uploaded by a user has to be executed. Is it possible to create a process with restrictions like only beeing able to access a certain directory (probably using ProcessBuilder)? I already had a look at pysandbox, but I am not sure if this alone is a safe enough measure when executing an unknown Python script. All the script has to do is process a given String using certain libraries and return a String using the print function. Is my approach correct or is there a better way to execute an unknown script?
score: 0
tagged with: processbuilder
tagged with: python
has comment: http://stackoverflow.com/comment/33125568
accepted answer: http://stackoverflow.com/a/21878224
type: AnsweredQuestion
tagged with: java
has title: Executing unknown Python script in Java
type: Question
has answer: http://stackoverflow.com/a/21878224
answer count: 1

arraylist
tags question: http://stackoverflow.com/q/21992526
tags question: http://stackoverflow.com/q/21958751
tags question: http://stackoverflow.com/q/21936336
tags question: http://stackoverflow.com/q/21845231
tags question: http://stackoverflow.com/q/21867359
tags question: http://stackoverflow.com/q/21878972
tags question: http://stackoverflow.com/q/21907384
tags question: http://stackoverflow.com/q/21858686
tags question: http://stackoverflow.com/q/21926407
tags question: http://stackoverflow.com/q/21964575
tags question: http://stackoverflow.com/q/21900810
tags question: http://stackoverflow.com/q/21976392
tags question: http://stackoverflow.com/q/21897794
tags question: http://stackoverflow.com/q/21990252
tags question: http://stackoverflow.com/q/21893782
tags question: http://stackoverflow.com/q/21868178
tags question: http://stackoverflow.com/q/21996475
tags question: http://stackoverflow.com/q/21995409
tags question: http://stackoverflow.com/q/21862588
tags question: http://stackoverflow.com/q/21974361
tags question: http://stackoverflow.com/q/21909385
tags question: http://stackoverflow.com/q/21845020
tags question: http://stackoverflow.com/q/21910503
tags question: http://stackoverflow.com/q/21961450
tags question: http://stackoverflow.com/q/21965671
tags question: http://stackoverflow.com/q/21945611
tags question: http://stackoverflow.com/q/21970441
tags question: http://stackoverflow.com/q/22004351
tags question: http://stackoverflow.com/q/21896242
tags question: http://stackoverflow.com/q/21952850
tags question: http://stackoverflow.com/q/21973874
tags question: http://stackoverflow.com/q/21989020
tags question: http://stackoverflow.com/q/21920660
tags question: http://stackoverflow.com/q/21850539
tags question: http://stackoverflow.com/q/21962522
tags question: http://stackoverflow.com/q/21924626
tags question: http://stackoverflow.com/q/21886196
tags question: http://stackoverflow.com/q/21997580
tags question: http://stackoverflow.com/q/21868663
tags question: http://stackoverflow.com/q/21942637
tags question: http://stackoverflow.com/q/21944625
tags question: http://stackoverflow.com/q/21923674
tags question: http://stackoverflow.com/q/21978005
tags question: http://stackoverflow.com/q/21972168
tags question: http://stackoverflow.com/q/21982619
tags question: http://stackoverflow.com/q/21927749
tags question: http://stackoverflow.com/q/21976405
tags question: http://stackoverflow.com/q/21924315
tags question: http://stackoverflow.com/q/21843417
tags question: http://stackoverflow.com/q/21976310
tags question: http://stackoverflow.com/q/21968851
tags question: http://stackoverflow.com/q/21991993
tags question: http://stackoverflow.com/q/21942720
tags question: http://stackoverflow.com/q/21972488
tags question: http://stackoverflow.com/q/21949446
tags question: http://stackoverflow.com/q/21935747
tags question: http://stackoverflow.com/q/21844540
tags question: http://stackoverflow.com/q/21973141
tags question: http://stackoverflow.com/q/21888382
tags question: http://stackoverflow.com/q/21957216
tags question: http://stackoverflow.com/q/21966663
tags question: http://stackoverflow.com/q/21973569
tags question: http://stackoverflow.com/q/21869923
tags question: http://stackoverflow.com/q/21852718
tags question: http://stackoverflow.com/q/21985397
tags question: http://stackoverflow.com/q/21988341
tags question: http://stackoverflow.com/q/22001415
tags question: http://stackoverflow.com/q/21879690
tags question: http://stackoverflow.com/q/21910145
tags question: http://stackoverflow.com/q/21930817
tags question: http://stackoverflow.com/q/21856319
tags question: http://stackoverflow.com/q/21844180
tags question: http://stackoverflow.com/q/21928665
tags question: http://stackoverflow.com/q/21934994
tags question: http://stackoverflow.com/q/21847606
tags question: http://stackoverflow.com/q/21994005
tags question: http://stackoverflow.com/q/21969714
tags question: http://stackoverflow.com/q/21848508
tags question: http://stackoverflow.com/q/21951867
tags question: http://stackoverflow.com/q/22000167

http://stackoverflow.com/q/21912626
has title: I have problems sending email with javamail + glassfish 4
tagged with: glassfish
tagged with: jakarta-mail
answer count: 2
has comment: http://stackoverflow.com/comment/33187584
upvote count: 1
has answer: http://stackoverflow.com/a/21943371
accepted answer: http://stackoverflow.com/a/21943371
favorite count: 0
has body: I have this same code in glassfish 2.1 and running, but to deploy it in glassfish 4 throws me following error: Grave: javax.mail.MessagingException: 501 5.5.4 Invalid Address. the error is thrown right over the code: t.connect(mailhost, user, password); public void sendmailto(String amsg, String mailaddress, String asubject) { String to = mailaddress; // to address String from = "soporte@EMNI.MOA.MINEM.CU"; // from address String subject = asubject; // the subject line String message = amsg; // the body of the message String mailhost = "atlas"; // SMTP server String user = "soporte"; // user ID String password = "soportepass"; // password boolean auth = true; boolean ssl = false; Properties props = System.getProperties(); if (mailhost != null) { props.put("mail.smtp.host", mailhost); } if (auth) { props.put("mail.smtp.auth", "true"); } javax.mail.Session session = javax.mail.Session.getInstance(props, null); javax.mail.Message msg = new MimeMessage(session); try { msg.setFrom(new InternetAddress(from)); msg.setRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(to)); msg.setSubject(subject); msg.setSentDate(new Date()); msg.setText(message); SMTPTransport t = (SMTPTransport) session.getTransport(ssl ? "smtps" : "smtp"); try { if (auth) { t.connect(mailhost, user, password); } else { t.connect(); } t.sendMessage(msg, msg.getAllRecipients()); } finally { t.close(); } } catch (Exception e) { e.printStackTrace(); } } Stacktrace Grave: javax.mail.MessagingException: 501 5.5.4 Invalid Address at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:2076) at com.sun.mail.smtp.SMTPTransport.helo(SMTPTransport.java:1469) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:660) at javax.mail.Service.connect(Service.java:345) at javax.mail.Service.connect(Service.java:226) at util.MailSender.sendmailto(MailSender.java:80) at tools.MailManager.enviarMail(MailManager.java:119) at tools.MailManager.sendmailto(MailManager.java:42) at sun.…
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21920231
score: 1
tagged with: java
type: Question
tagged with: jakarta-ee
possible better answer: http://stackoverflow.com/a/21920231
has comment: http://stackoverflow.com/comment/33192790

http://stackoverflow.com/comment/33265080
comment on: http://stackoverflow.com/a/21888503
type: Comment
has text: I reached out the jsch folks and they have provided a fix - can you check it out? https://jira.springsource.org/browse/INT-3305?focusedCommentId=99180&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-99180
score: 1
type: AnswerComment

cisco
type: Tag
tag name: cisco
tags question: http://stackoverflow.com/q/21872422

http://stackoverflow.com/comment/33255830
has text: The point of a linked list is to reap the benefits of not using an array so theres no point in attempting to implement such a thing.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21950868

http://stackoverflow.com/comment/33338147
type: Comment
score: 1
has text: `String.matches` requires the whole string to match, so you need `.*` at the end of the regex. (And you don't need `^`.)
type: AnswerComment
comment on: http://stackoverflow.com/a/21996980

http://stackoverflow.com/q/21997208
has title: android unable to start receiver java.lang.NullPointerException
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/21997496
upvote count: 0
has body: i created appwidget and i try to show json's items'(image's and text) in my appwidget(stackview widget) i successfully created app widget and i also can show json in widget but when i should click in widget i have error NullPointerException this is a my code : public class BriGeRemoteViewsService extends RemoteViewsService { @Override public RemoteViewsFactory onGetViewFactory(Intent intent) { return new BriGeRemoteViewsFactory(this.getApplicationContext(), intent); } static class BriGeRemoteViewsFactory implements RemoteViewsFactory { public static ArrayList&lt;ItemI&gt; itemList; private static Context context; private int appWidgetId; public BriGeRemoteViewsFactory(Context context, Intent intent) { this.context = context; itemList = new ArrayList&lt;ItemI&gt;(); this.appWidgetId = intent.getIntExtra( AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); } @Override public void onCreate() { itemList = getData(); } @Override public void onDataSetChanged() { itemList = getData(); } @Override public void onDestroy() { itemList.clear(); } @Override public int getCount() { if (itemList != null) return itemList.size(); else return 0; } @Override public RemoteViews getViewAt(int position) { ItemI item = itemList.get(position); RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.item_view); rv.setTextViewText(R.id.widgettitle, item.getTitle()); rv.setImageViewBitmap(R.id.img, getImageBitmap(item.getImage())); Bundle extras = new Bundle(); extras.putInt(BriGeWidgetProvider.EXTRA_ITEM, position); Intent fillIntent = new Intent(); fillIntent.putExtras(extras); rv.setOnClickFillInIntent(R.id.item_root, fillIntent); return rv; } private Bitmap getImageBitmap(String url) { Bitmap bm = null; try { URL aURL = new URL(url); URLConnection conn = aURL.openConnection(); conn.connect(); InputStream is = conn.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); bm = BitmapFactory.decodeStream(bis); bis.close(); is.close(); } ca…
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33339361
tagged with: android-appwidget
type: UnansweredQuestion
tagged with: android
tagged with: appwidgetprovider
has comment: http://stackoverflow.com/comment/33338873
downvote count: 1
has comment: http://stackoverflow.com/comment/33339779
type: Question

http://stackoverflow.com/q/21914705
has answer: http://stackoverflow.com/a/21915409
tagged with: iteration
has title: Java TreeMultimap - how to remove key AND nearest key?
tagged with: multimap
type: AnsweredQuestion
tagged with: guava
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33191260
accepted answer: http://stackoverflow.com/a/21915409
tagged with: search
score: 0
has body: Let's say I have a TreeMultimap (from the Google Guava libraries) with pairs of keys/values. If I have a key (assume keys are of type int), how would I go about getting the values of both that key and the nearest key? So for example, my treemultimap is: 1 -> "Hello" 3 -> "Hola" 5 -> "Bonjour" My key is 5. I want to retrieve the nearest key (which would be 3). I could then use that key to retrieve the nearest value. It seems like this should be a simple matter of navigating to the possessed key and then iterating to the next one, but I can't find any functionality with TreeMultimap which would allow me to do this (ie. there is no function that gives me access to the nodes themselves, I can allow retrieve collections of keys and iterate through them in linear fashion, which defeats the purpose of having a sorted tree). I feel like there's a simple solution to this that I'm missing. ANy help would be greatly appreciated!
answer count: 1

http://stackoverflow.com/comment/33146428
score: 0
type: QuestionComment
has text: Ouch. Sorry I pasted some of it wrong. Fixed it though. How embarrassing!
type: Comment
comment on: http://stackoverflow.com/q/21889389

http://stackoverflow.com/comment/33242157
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21912237
has text: @AliNaddaf please put this as an answer so I can accept it :)
score: 0

http://stackoverflow.com/comment/33157051
has text: Do you want a bespoke solution written in Java, to write output to a file? What have you tried already?
comment on: http://stackoverflow.com/q/21894873
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33201635
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21920082
has text: Are any of these non-static inner classes?
score: 0

http://stackoverflow.com/a/21938451
downvote count: 0
has body: This is because there are 2-3 a-z characters at the end of the string: zz and zzz both satisfy it. The [[a-z]+\\.]* is not required (and should probably be in parentheses anyway). I thought you want it to be something like: ([a-z]*\\.) The . should probably be required.
type: Answer
answers question: http://stackoverflow.com/q/21938352
upvote count: 1
score: 1

http://stackoverflow.com/comment/47626830
comment on: http://stackoverflow.com/a/21876380
type: Comment
has text: @oleg I'm getting a null as resource here, any idea of what could be an issue to this? I've added http core and client to my libs folder of the project.
score: 1
type: AnswerComment

http://stackoverflow.com/a/26509242
downvote count: 0
answers question: http://stackoverflow.com/q/21863578
has body: I had the same issue (although I'm using maven / javafx-maven-plugin; shouldn't make a difference). FX build tools signing seems broken at the moment, since as you noticed, jarsigner does not recognize the fact that the jar is signed, nor does the webstart launcher when running the deployed application. I ended up signing my JavaFX application jars using a separate plugin (maven-jarsigner) in my build script. I'd imagine you could use Ant's SignJar similarly. See also this JavaFX JIRA issue, which is currently set to won't fix.
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/59434335
upvote count: 1

http://stackoverflow.com/q/21897067
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33160574
tagged with: android
has comment: http://stackoverflow.com/comment/33160627
has comment: http://stackoverflow.com/comment/33160658
type: Question
has comment: http://stackoverflow.com/comment/33160578
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33160468
has answer: http://stackoverflow.com/a/21897330
has title: Java/Android App unexpectedly closing / POSTing to server
tagged with: https
has body: I have no errors or warnings in Eclipse and I'm completely new to Android Programming so I don't even know where to start with this. My app is just a simple form that I need to post to a php script online. Here's the bulk of my main Activity minus the imports.. I don't have it set up to do anything with return values or any of that, and TBH i don't even know what would happen if it did work other than the data would be in my DB.. but the PHP script is not even being called by my app at all. Based on things I found in Google, I have tried -Adding Support Libraries -Changing the target sdk version from 19 to 18 Please, what am I doing wrong? @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_apply); subm = (Button) findViewById(R.id.button1); fname = (EditText) findViewById(R.id.editText1); lname = (EditText) findViewById(R.id.editText2); addr = (EditText) findViewById(R.id.editText3); city = (EditText) findViewById(R.id.editText4); state = (EditText) findViewById(R.id.editText5); zip = (EditText) findViewById(R.id.editText6); phone = (EditText) findViewById(R.id.editText7); dob = (EditText) findViewById(R.id.editText8); email = (EditText) findViewById(R.id.editText9); ssn = (EditText) findViewById(R.id.editText10); subm.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { try{ String httpsURL = "https://example.com/apis/submit_credit_application.php"; String query = "fname="+URLEncoder.encode(fname.getText().toString(),"UTF-8"); query += "&amp;lname="+URLEncoder.encode(lname.getText().toString(),"UTF-8"); query += "&amp;addr="+URLEncoder.encode(addr.getText().toString(),"UTF-8"); query += "&amp;city="+URLEncoder.encode(city.getText().toString(),"UTF-8"); query += "&amp;state="+URLEncoder.encode(state.getText().toString(),"UTF-8"); query += "&amp;zip="+URLEncoder.encode(zip.getText().toString(),"UTF-8"); query += "&amp;phone="+URLEncoder.encode(phone.ge…
possible better answer: http://stackoverflow.com/a/21897277
tagged with: java
has answer: http://stackoverflow.com/a/21897277
has comment: http://stackoverflow.com/comment/33160635
tagged with: post
has comment: http://stackoverflow.com/comment/33160465
accepted answer: http://stackoverflow.com/a/21897330
has comment: http://stackoverflow.com/comment/33186947
linked to: http://stackoverflow.com/q/18388468
has comment: http://stackoverflow.com/comment/33160675

http://stackoverflow.com/comment/33156083
has text: Edit: Actually nevermind my response was stupid. Thanks this solution works.
comment on: http://stackoverflow.com/a/21894455
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21949446
score: 0
answer count: 1
tagged with: arraylist
tagged with: android
has title: Save data in ArrayList of ArrayList
has answer: http://stackoverflow.com/a/21949519
accepted answer: http://stackoverflow.com/a/21949519
type: AnsweredQuestion
has body: I want to save data in a list that's the instance of another list. like a 2D ArrayList But, data is not being read properly here is the code of constructor ArrayList&lt;ArrayList&lt;Integer&gt;&gt; Planets; Planets = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); here is the function that is reading data from file public boolean readFile(String str){ try(BufferedReader br = new BufferedReader(new FileReader(str))) { StringBuilder sb = new StringBuilder(); String line = br.readLine(); ArrayList temp = new ArrayList&lt;Integer&gt;(); while (line != null) { temp.addAll(Arrays.asList(line.split(" "))); temp = getIntegerArray(temp); Planets.add(temp); temp.clear(); line = br.readLine(); } System.out.println(Planets); } catch(Exception e){ return false; } return true; } Here is the content of file "input.txt" 1 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Generated output for System.out.println(Planets); is [[1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], []] But it should be [[1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]] I dont know where is the problem. Anyone who know, Please help me.
tagged with: java
type: Question

http://stackoverflow.com/comment/33292845
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21971452
type: AnswerComment
has text: Escaping those characters isn't necessary, but at least credit [the place](http://www.regular-expressions.info/quickstart.html) you're lifting that text from.

http://stackoverflow.com/comment/33413193
comment on: http://stackoverflow.com/a/21900489
type: AnswerComment
has text: I mean, if there's a SQL driver for Google App Engine datastore, would it be supported by jOOQ?
score: 0
type: Comment

http://stackoverflow.com/comment/33062149
has text: I am up-voting your answer because it is better than the one that I had posted. Good catch on also realizing that only the original text was being printed.
score: 2
type: Comment
comment on: http://stackoverflow.com/a/21842192
type: AnswerComment

http://stackoverflow.com/q/21995125
has answer: http://stackoverflow.com/a/22011419
has answer: http://stackoverflow.com/a/22010809
has answer: http://stackoverflow.com/a/22010831
score: 0
answer count: 3
tagged with: android-listview
tagged with: android
has comment: http://stackoverflow.com/comment/33334799
has comment: http://stackoverflow.com/comment/33334731
type: UnansweredQuestion
has title: Android - ListView show empty
tagged with: java
tagged with: listview
type: Question
has body: TestAdapter: public class TestAdapter extends Activity { ArrayList&lt;Horario&gt; array = new ArrayList&lt;Horario&gt;(); protected static final String TAG = "DataAdapter"; private final Context mContext; private SQLiteDatabase mDb; private DataBaseHelper mDbHelper; public TestAdapter(Context context) { this.mContext = context; mDbHelper = new DataBaseHelper(mContext); } public TestAdapter createDatabase() throws SQLException { try { mDbHelper.createDataBase(); } catch (IOException mIOException) { Log.e(TAG, mIOException.toString() + " UnableToCreateDatabase"); throw new Error("UnableToCreateDatabase"); } return this; } public TestAdapter open() throws SQLException { try { mDbHelper.openDataBase(); mDbHelper.close(); mDb = mDbHelper.getReadableDatabase(); } catch (SQLException mSQLException) { Log.e(TAG, "open &gt;&gt;"+ mSQLException.toString()); throw mSQLException; } return this; } public void close() { mDbHelper.close(); } ArrayList&lt;Horario&gt; getorigem(){ String query = "select origem, destino From horarios"; Cursor cursor = mDb.rawQuery(query, new String[]{}); ArrayList&lt;Horario&gt; array = new ArrayList&lt;Horario&gt;(); while (cursor.moveToNext()) { String _origem = cursor.getString(cursor.getColumnIndex("origem")); String _destino = cursor.getString(cursor.getColumnIndex("destino")); array.add(new Horario(_origem, _destino)); } return array; } } MainActivity(and MyListAdapter): public class MainActivity extends Activity { ArrayList&lt;Horario&gt; array = new ArrayList&lt;Horario&gt;(); SQLiteDatabase mDb; Button bt_search; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); bt_search = (Button) findViewById(R.id.btnsearch); TestAdapter mDbHelper = new TestAdapter(getBaseContext()); mDbHelper.createDatabase(); bt_search.setOnClickListener(new OnClickListener() { public void onClick(View v) { search(v); } }); } public void search(View v) { setContentView(R.layout.list…
has comment: http://stackoverflow.com/comment/33336343

http://stackoverflow.com/q/21948738
has comment: http://stackoverflow.com/comment/33252358
answer count: 4
has answer: http://stackoverflow.com/a/21948786
has comment: http://stackoverflow.com/comment/81960799
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33252388
has title: Java adding functionality to an existing class with a new class while still exposing all methods of previous class
has comment: http://stackoverflow.com/comment/33252160
has answer: http://stackoverflow.com/a/21948914
upvote count: 1
has answer: http://stackoverflow.com/a/21948916
has comment: http://stackoverflow.com/comment/33252234
type: Question
has body: I want to do something like a super() but without passing anything to the constructor. Something like copying all the variables in their current states, which were set to methods inside that class. I want to avoid doing stuff like getPlayer() in a wrapper class when the wrapper class is the Player just with extra methods. I don't want to move these extra methods into the Player class because it's not part of the Player class it's something a Player class may become into but not at all times. I still want to be able to run constructor of the SpecialPlayer with it's own variables it has to set while still maintaining it as a Player from whatever instance I pass into it. The Player class variables may change at any time while it's casted into a SpecialPlayer class and the SpecialPlayer class should have up to date variables same as Player at all times.. Yes it has to the same reference exactly at all times by the looks of it. Here is some pseudo code I wrote to try to illustrate the problem public class Player { private int money; private boolean bar; public Player(int money) { this.money = money; bar = true; } public void toggleBar() { bar != bar; } } public class SpecialPlayer extends Player { private Player player; private long foo; public SpecialPlayer(Player player) { this.player = player; //wrapper way not good... //this = player; ??? doesn't compile... foo = System.currentTimeMillis(); } public long getFoo() { return foo; } public Player getPlayer() { //&lt;-- this is stupid. return player; } } Player player = new Player(12345); player.toggleBar(); //it's now false, also it's not a constructor variable. SpecialPlayer specialPlayer = new SpecialPlayer(player); specialPlayer.getFoo(); //some long number value. specialPlayer.toggleBar(); //now it should be true!. player.toggleBar(); //should be false. specialPlayer.toggleBar(); //should be true.
has comment: http://stackoverflow.com/comment/33252133
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/21948859
has answer: http://stackoverflow.com/a/21948859
tagged with: class
tagged with: this
downvote count: 0
has comment: http://stackoverflow.com/comment/33252118
accepted answer: http://stackoverflow.com/a/21948916
favorite count: 0
tagged with: extends
tagged with: subclass
linked to: http://stackoverflow.com/q/2427883
has comment: http://stackoverflow.com/comment/33252101

http://stackoverflow.com/comment/33120916
type: QuestionComment
has text: `new FSDataInputStream(inputStream);`? :)
comment on: http://stackoverflow.com/q/21875264
score: 2
type: Comment

http://stackoverflow.com/a/21961633
has comment: http://stackoverflow.com/comment/33275575
type: Answer
has body: Remove this line from the GUI constructor: frame.setVisible(true); Add this line at the end of the GUI constructor: frame.pack(); Add this method to your GUI class: public void showFrame() { frame.setVisible(true); } Remove this line from your main class: AirlineReservation airlineReservation = new AirlineReservation(); And add the following to your main method: SwingUtilities.invokeLater(new Runnable() { @Override public void run() { AirlineReservation airlineReservation = new AirlineReservation(); airlineReservation.showFrame(); } }); This is basically what is covered by the "Getting started" part of the Swing tutorial. Read it. You should never write such a huge piece of code without testing it after each small step, especially if you're a newbie. These lines above should have been the first lines of the application.
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/33275735
has comment: http://stackoverflow.com/comment/33275498
upvote count: 3
answers question: http://stackoverflow.com/q/21961516
has comment: http://stackoverflow.com/comment/33275717
has comment: http://stackoverflow.com/comment/33275838

http://stackoverflow.com/q/21944462
tagged with: jcr
has body: I have a webservice which searches for pieces of texts in modeshape content repository. The interface looks something like this : @POST @Path("globalSearch") @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_XML) public String globalSearch(String search) { XMLConverterService xmlOb = new XMLConverterService(); Map&lt;String,String&gt; param = xmlOb.fetchMapFromXml(search); StringBuffer xmlString = new StringBuffer(); xmlString.append("&lt;xml&gt;"); int count = 0; List&lt;Map&lt;String, String&gt;&gt; result = (new DataInterfaceService()) .fetchGlobalSearch(param); if(result!=null){ for (Map&lt;String, String&gt; map : result) { count++; xmlString.append("&lt;result" + count + "&gt;") .append(xmlOb.fetchXmlFromMap(map)) .append("&lt;/result" + count + "&gt;"); } xmlString.append("&lt;/xml&gt;"); return xmlString.toString(); } return null; } the fetchGlobalSearch() function looks something like this : public List&lt;Map&lt;String, String&gt;&gt; fetchGlobalSearch(Map&lt;String, String&gt; param) { logger.log(Level.INFO, "entering fetchGlobalSearch"); String keyWord = param.get("keyword"); String type = param.get("type"); List&lt;Map&lt;String, String&gt;&gt; listOfMaps = null; Map&lt;String, String&gt; retValue = null; String qry = ""; if (type.equalsIgnoreCase("GRA")) { qry = "SELECT [med:UNIQUE_ID],[med:GRPNAME],[med:CSR],[med:UW],[med:GROUP_STATE],[med:STR_DATE] " + "FROM [med:notes] where contains([med:XML_STORE], $uuid)"; } else { qry = "SELECT [fur:UNIQUE_ID],[fur:MM],[fur:FROMUW],[fur:INSURED],[fur:POLICY_NUM],[fur:UWCSRDATE],[fur:FURCOMPDATE],[fur:FUR_DATE],[fur:CSRCOMPDATE] " + "FROM [fur:notesfur] where contains([fur:XML_STORE], $uuid)"; } try { Query qr = qrym.createQuery(qry, Query.JCR_SQL2); Value uid = session.getValueFactory().createValue(keyWord); qr.bindValue("uuid", uid); QueryResult resultSet = qr.execute(); String[] columns = resultSet.getColumnNames(); RowIterator rowiter = resultSet.getRows(); while (rowiter.hasNext()) { if (listOfMaps ==…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33248144
has answer: http://stackoverflow.com/a/21996950
has title: Rest webservice not returning any results
has comment: http://stackoverflow.com/comment/33245385
tagged with: rest
type: Question
tagged with: web-services
tagged with: modeshape
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/21996950
answer count: 1

http://stackoverflow.com/a/21868324
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21866439
has comment: http://stackoverflow.com/comment/33119146
has comment: http://stackoverflow.com/comment/33119472
has comment: http://stackoverflow.com/comment/33119231
has comment: http://stackoverflow.com/comment/33118988
score: 1
has comment: http://stackoverflow.com/comment/33118943
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33119279
has comment: http://stackoverflow.com/comment/33118807
has comment: http://stackoverflow.com/comment/33119262
has body: This is a lot of fun. Basically, there is no way for the RowFilter to know where the RowSorter will want to check for included lines, so you can't place some kind of "counter" in the RowFilter and simply start returning false after a predetermined limit. The RowSorter also makes no guarantee that it will actually look for included lines in any order or as a whole group...it could check random lines, for example... What you can do though, is create a RowSorter of your own and override it's sort method, which generally gets called whenever the underlying model has changed in some way or the model reference itself changes. Here you can then tell the RowFilter that it needs to reset it's count. The Row Sorter Basically, this is an implementation of TableRowSorter that looks for a special type of RowFilter and calls its reset method whenever it is called, this is meant to reset the number of lines that have been filtered back to 0 public class MyRowSorter extends TableRowSorter&lt;TableModel&gt; { public MyRowSorter(TableModel model) { super(model); } @Override public void sort() { RowFilter&lt;? super TableModel, ? super Integer&gt; filter = getRowFilter(); if (filter instanceof LimitedRowFilter) { LimitedRowFilter lrf = (LimitedRowFilter) filter; lrf.reset(); } super.sort(); } } The LimitedRowFilter This is a special, base, RowFilter which provides a lineCount and lineLimit which can be used by implementations to check if the number of filtered lines exceeds the maximum number of allowed lines. It also provides the reset method used by the RowSorter This could use some more additional functionality like includeAndIncrement which could return true if the line should be included or false if it would exceed the line count limit and would increment the lineCount automatically... public abstract class LimitedRowFilter&lt;M, I&gt; extends RowFilter&lt;M, I&gt; { private int lineLimit; private int lineCount; public void reset() { lineCount = 0; } public int getLineCount() { r…
type: Answer
has comment: http://stackoverflow.com/comment/33118873
has comment: http://stackoverflow.com/comment/33118939
answers question: http://stackoverflow.com/q/21866439
has comment: http://stackoverflow.com/comment/33119031

http://stackoverflow.com/q/21890479
has title: project Euler #2 in java
downvote count: 1
tagged with: fibonacci
tagged with: java
has answer: http://stackoverflow.com/a/21891262
type: Question
has comment: http://stackoverflow.com/comment/33148552
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33148541
has comment: http://stackoverflow.com/comment/33148402
has comment: http://stackoverflow.com/comment/33148973
score: 0
has body: Can anyone take a look at my java code, and telling me how to fix my code. The question is below. I would really appreciate any help :) public class problem { public static void main (String args []){ int a = 0; int b = 1; problem(); } public static int problem(){ int c = a + b; if (c&gt;10){ System.out.println(c); return c; } int a = b; int b = c; problem(); } } Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
answer count: 1
has comment: http://stackoverflow.com/comment/33148707
type: UnansweredQuestion

http://stackoverflow.com/a/40275981
answers question: http://stackoverflow.com/q/21997923
type: Answer
has body: Solution i used the private IP of my laptop and then it works!!! i was using teh public IP of my network till now so was unsuccessful!!
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21997923

http://stackoverflow.com/a/22315089
accepted answer of: http://stackoverflow.com/q/21944625
upvote count: 1
has comment: http://stackoverflow.com/comment/33949299
score: 1
answers question: http://stackoverflow.com/q/21944625
type: AcceptedAnswer
downvote count: 0
has body: Putting your arraylist inside a method means it can only be accessed by the method it is in and is lost when the method is finished running. You have two options. Change the return type of your method as an arraylist and return and manipulate your arraylist Create the arraylist outside of a method global to the whole class. This code block should help: public class mVentoryHome extends javax.swing.JFrame { private static ArrayList &lt;ProductInfo&gt; Inventory = new ArrayList&lt;ProductInfo&gt;(); }
has comment: http://stackoverflow.com/comment/33994944
has comment: http://stackoverflow.com/comment/34086761
type: Answer

http://stackoverflow.com/comment/33267061
score: 1
type: AnswerComment
has text: Checkout the standalone directory, and there should be a `standalone.xml`file in it.
type: Comment
comment on: http://stackoverflow.com/a/21957225

http://stackoverflow.com/comment/33272119
type: Comment
type: QuestionComment
has text: I would use labels instead of text nodes.
score: 0
comment on: http://stackoverflow.com/q/21959831

http://stackoverflow.com/comment/33068460
score: 0
type: Comment
type: QuestionComment
has text: Shekhar, above bean does not hold any state right? When a bean does not contain any state then it can be Singleton right?
comment on: http://stackoverflow.com/q/21845969

http://stackoverflow.com/q/21927099
score: 2
upvote count: 2
has body: Im running an eclipse based Java application and im unable to catch the exception. Im trying to read an excel file and get its contents.Below is the sample code The program is able to identify the excel file and the execution stops when the program tries to create a new xssfworkbook = new XSSFWorkbook(file); object. FileInputStream file = null; XSSFWorkbook xssfworkbook = null; try { //TODO Read file from Actual Path file = new FileInputStream("D:\\Import_Model_1.xlsx"); xssfworkbook = new XSSFWorkbook(file); } catch(IOException e) { // TODO Handle the IO Exception with Logs, and User Friendly Message to User e.printStackTrace(); } catch( Exception e) { e.printStackTrace() ; } The execution of the program halts abruptly without specifying the cause. I have all the required jars available in the class path. But unable to catch the exception. Any help on this is much appreciated.
tagged with: java
has comment: http://stackoverflow.com/comment/33215598
has answer: http://stackoverflow.com/a/21927469
type: Question
tagged with: runtime
has title: Exception not caught in java program
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33212987
favorite count: 0
has comment: http://stackoverflow.com/comment/33213538
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33441488
has comment: http://stackoverflow.com/comment/33213033

http://stackoverflow.com/a/21997655
has body: Yes, take a look on a add() method implementation, for example: public boolean add(E object) { Object[] a = array; int s = size; if (s == a.length) { Object[] newArray = new Object[s + (s &lt; (MIN_CAPACITY_INCREMENT / 2) ? MIN_CAPACITY_INCREMENT : s &gt;&gt; 1)]; System.arraycopy(a, 0, newArray, 0, s); array = a = newArray; } a[s] = object; size = s + 1; modCount++; return true; } Since ArrayList.size() returns just the value of size variable, it's clear, that if you add null, the size will be increased by 1, so, yes, null is counted.
downvote count: 0
answers question: http://stackoverflow.com/q/21997580
type: Answer
score: 6
upvote count: 6

http://stackoverflow.com/q/21984226
has comment: http://stackoverflow.com/comment/33315383
answer count: 2
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21984430
accepted answer: http://stackoverflow.com/a/21984430
tagged with: android
possible better answer: http://stackoverflow.com/a/21984296
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has title: LayoutInflater wordSpan
has answer: http://stackoverflow.com/a/21984296
type: Question
has body: I want to set wordtoSpan string at OnCreateView. my code: package com.tachles; import android.os.Bundle; import android.support.v4.app.Fragment; import android.text.Spannable; import android.text.SpannableString; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; public class History_moadim_a extends Fragment { TextView horef; TextView kaiz; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.history_moadim_a, container, false); return rootView; horef = (TextView) findViewById(R.id.textView3); Spannable wordtoSpan = new SpannableString("hgh"); horef.setText(wordtoSpan); } } Eclipse says that I cant use findViewById, so I tried to insert getView() but still the same problem. Please show me my mistake Thank you
has comment: http://stackoverflow.com/comment/33315095

http://stackoverflow.com/q/21970492
tagged with: arrays
has answer: http://stackoverflow.com/a/40136324
has body: I got an JSON Array for my Twitch Following user checker. I would like to get only the first date (cause thats the newest one) out of the array but everytime my code gets executed it just swap to the next "date" then. How can i change this? Code; import org.jibble.pircbot.*; import org.json.JSONException; import org.json.simple.*; import org.json.simple.parser.*; import org.w3c.dom.ranges.RangeException; import org.json.JSONArray; import org.json.JSONObject; import org.json.*; //////////////////////////////////////////////////////////////////////////////////// // Twitch Follower Ticker //////////////////////////////////////////////////////////////////////////////////// private String readAll4(Reader rd) throws IOException { StringBuilder sb = new StringBuilder(); int cp; while ((cp = rd.read()) != -1) { sb.append((char) cp); } return sb.toString(); } public JSONObject readJsonFromUrl4(String url) throws IOException, JSONException { InputStream is = new URL(url).openStream(); try { BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); String jsonText = readAll4(rd); JSONObject json = new JSONObject(jsonText); return json; } finally { is.close(); } } public void FollowerTicker() throws IOException, JSONException { json = readJsonFromUrl2("https://api.twitch.tv/kraken/channels/"+ownerchannel+"/follows"); JSONArray followerarray = json.getJSONArray("follows"); for(int n = 0; n &lt; followerarray.length(); n++) { JSONObject followertime = followerarray.getJSONObject(n); String ftime = followertime.getString("created_at"); int maxfollows = json.getInt("_total"); System.out.println("Total Follows : "+maxfollows); System.out.println("Loop Follow Date: "+ftime); } } edited Code; private String readAll4(Reader rd) throws IOException { StringBuilder sb = new StringBuilder(); int cp; while ((cp = rd.read()) != -1) { sb.append((char) cp); } return sb.toString(); } public JSONObject readJsonFromUrl4(String url) throws IOException, JSONExcept…
favorite count: 0
upvote count: 12
has comment: http://stackoverflow.com/comment/33291462
has answer: http://stackoverflow.com/a/21970784
accepted answer: http://stackoverflow.com/a/21970784
possible better answer: http://stackoverflow.com/a/40136324
has title: JSON array Read first element?
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33291280
score: 12
type: Question
answer count: 2

http://stackoverflow.com/comment/46160845
type: QuestionComment
comment on: http://stackoverflow.com/q/21921763
has text: Downvoter - is there anything wrong with this question that I can try to improve?
score: 0
type: Comment

http://stackoverflow.com/a/21958545
answers question: http://stackoverflow.com/q/21957579
has comment: http://stackoverflow.com/comment/33272198
type: Answer
has comment: http://stackoverflow.com/comment/33272841
downvote count: 0
score: 1
has body: I would recommend making a Line class with an isVisible instance variable. Keep track of all the lines in an ArrayList&lt;Line&gt;, and then toggle them on or off with the isVisible variable.
has comment: http://stackoverflow.com/comment/33270950
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21957579

http://stackoverflow.com/comment/33345576
type: AnswerComment
score: 5
type: Comment
comment on: http://stackoverflow.com/a/21984264
has text: Official answer: we have no plans for adding this feature to Guava - sorry!

http://stackoverflow.com/comment/33084563
comment on: http://stackoverflow.com/q/21855290
score: 0
type: Comment
type: QuestionComment
has text: what do you mean by _"write this as a Variable "_ ? also, show what you have tried so far

http://stackoverflow.com/comment/47688021
type: Comment
has text: @GordThompson, Have you tried UCanAccess on a Win10 Tech Preview system? See: http://stackoverflow.com/questions/29761407/how-to-write-to-an-access-database-on-windows-10
comment on: http://stackoverflow.com/a/21955257
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36822202
has text: @Matthias i also solved already, by installing fonts
comment on: http://stackoverflow.com/q/21871568
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33225341
type: QuestionComment
score: 1
has text: @Stewart Yes that is problem.
comment on: http://stackoverflow.com/q/21934214
type: Comment

http://stackoverflow.com/q/21986085
answer count: 1
has comment: http://stackoverflow.com/comment/33318179
has answer: http://stackoverflow.com/a/21987723
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33318554
has comment: http://stackoverflow.com/comment/33318231
tagged with: java
tagged with: eclipse
has title: Eclipse is letting me export my project with errors
type: Question
has body: I set android:minSdkVersion="7" while my code had GridLayouts (which were added in api level 14). Now, unless I click on my gridlayout in the java file, make a change, then save it - eclipse won't say that there is an error and I can export the project and create an apk from it. I would really like eclipse to be able to detect when a method etc has been added in an api higher than your minimum. Is there anything I can do?
has comment: http://stackoverflow.com/comment/33318337
score: 0

http://stackoverflow.com/q/21915169
type: Question
has comment: http://stackoverflow.com/comment/33192580
score: -1
has answer: http://stackoverflow.com/a/21915220
downvote count: 1
answer count: 1
has title: Possible loss of precision and symbol errors in Java
favorite count: 0
has comment: http://stackoverflow.com/comment/33192038
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33192519
upvote count: 0
has comment: http://stackoverflow.com/comment/33192002
has comment: http://stackoverflow.com/comment/33192005
tagged with: java
has body: This is the line of code I'm trying to make work: if (rend &gt; num) rend = num; But Dr.Java spits out this error: File: /Users/spencer/Downloads/MergeTDNonrecursive.java [line: 75] Error: /Users/spencer/Downloads/MergeTDNonrecursive.java:75: possible loss of precision found : long required: int Similarly, sort(a, aux, 0, a.length-1); is prompting the error: File: /Users/spencer/Downloads/MergeTDNonrecursive.java [line: 106] Error: /Users/spencer/Downloads/MergeTDNonrecursive.java:106: cannot find symbol symbol : method sort(java.lang.Comparable[],java.lang.Comparable[],int,int) location: class MergeTDNonrecursive I've searched hi and lo (lol), but in all seriousness I can't see what's going wrong with my code. EDIT: I should mention that I don't know the difference between long and int, specifically because I don't know what long is. How can I remedy this in my code? And no, these errors are popping up when I try to compile.

http://stackoverflow.com/comment/33298525
has text: @PeterHiggs The indexes will only be changing if you are inserting in the middle or beginning of the array. Do you have to do this? Could you append instead? Or, do you add all objects prior to having to find any? If you must insert objects but you do all insertions first, you can build the map after all objects are inserted.
comment on: http://stackoverflow.com/q/21974687
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/a/22415286
accepted answer of: http://stackoverflow.com/q/21889708
answers question: http://stackoverflow.com/q/21889708
score: 0
type: AcceptedAnswer
type: Answer
has body: I've solved this using the annotations @JsonTypeInfo and @JsonSubTypes on the generic class Sheet like the following: public class Json { public Sheet[] sheets = {}; @JsonTypeInfo(use=Id.NAME, include=As.PROPERTY, property="sheetName") @JsonSubTypes({ // list all sheet name : class mapping here @Type(name=MetadataSheet.sheetName, value=MetadataSheet.class) }) static class Sheet {} static class Sheet1 extends Sheet { public static final String sheetName = "Sheet 1"; public Sheet1Rows[] rows; // subclasses a generic class Row } } This way, all sheets with a given sheet name will be mapped to a specific subclass of sheet and you can then just define the specific subclass of row you want inside the Sheet subclass i.e. Sheet1 can have Sheet1Rows[] field, etc. I didn't find a way to just directly subclass the type of rows, because I think subclassing applies to the contained values, not the container but this gets the job done as well.

http://stackoverflow.com/comment/33078358
has text: Spring will only intercept beans it knows about (beans managed by the applicationcontext). If your view bean is managed by JSF then spring doesn't know the bean and will not intercept it. Your current code doesn't have an annotation so nothing will be intercepted.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21851628

http://stackoverflow.com/q/21869416
has body: I'm implementing Spring Security using Java configuration in my Spring Web MVC project, and for some reason the @Autowired annotation is not injecting fields in my security config class. I found this very similar question on SO, but my setup is much simpler and the accepted answer doesn't apply at all in my case. For reference, I followed the first three chapters of Spring's own security documentation (here) and got in-memory authentication working pretty quickly. I then wanted to switch to JDBC authentication and inject a DataSource with the @Autowired annotation (as shown in this example). However, I get this error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityConfig': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource com.tyedart.web.config.security.SecurityConfig.dataSource; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.sql.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} Here is my security config class. As you can see I'm working around the problem by explicitly looking up my data source: @Configuration @EnableWebMvcSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { // @Autowired // private DataSource dataSource; // @Autowired // public PasswordEncoder passwordEncoder; @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { InitialContext ctx = new InitialContext(); DataSource dataSource = (DataSource) ctx.lookup("java:/comp/env/jdbc/TyedArtDB"); PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); auth .jdbcAuthentication() .dataSource(dataSource) .passwordEncoder(passwordEncoder);…
has answer: http://stackoverflow.com/a/21870072
linked to: http://stackoverflow.com/q/20753979
answer count: 3
linked to: http://stackoverflow.com/q/15440559
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: spring
tagged with: autowired
has answer: http://stackoverflow.com/a/47918489
tagged with: spring-mvc
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21884362
has title: @Autowired not working in Spring Security
type: Question
downvote count: 0
tagged with: spring-security

http://stackoverflow.com/comment/33311321
type: QuestionComment
comment on: http://stackoverflow.com/q/21981234
has text: 0 means it is not deleting from the database. What is the data type of Complaint NO ?
score: 0
type: Comment

http://stackoverflow.com/comment/33109939
type: AnswerComment
has text: I will try to implement this way and see if it works..Thanks for your help!
type: Comment
comment on: http://stackoverflow.com/a/21868737
score: 0

http://stackoverflow.com/comment/33147526
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21889999
has text: It means that the argument to charAt is outsde of the allowed range - either < 0 or >= the length of the String. Classical off-by-one error on your side.

http://stackoverflow.com/comment/33171208
type: AnswerComment
comment on: http://stackoverflow.com/a/21903234
has text: Thanks you so much, I didn't know it was that simple, just a little tweak in the text.
score: 0
type: Comment

http://stackoverflow.com/comment/33212240
score: 0
type: AnswerComment
type: Comment
has text: I possible , post your `servlet` also.
comment on: http://stackoverflow.com/a/21900057

xsd
tags question: http://stackoverflow.com/q/21896539
tags question: http://stackoverflow.com/q/21902705
tags question: http://stackoverflow.com/q/21929157
tags question: http://stackoverflow.com/q/21997051
tag name: xsd
type: Tag
tags question: http://stackoverflow.com/q/21852317
tags question: http://stackoverflow.com/q/21957141

http://stackoverflow.com/q/21871656
has comment: http://stackoverflow.com/comment/33115145
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/33115175
has comment: http://stackoverflow.com/comment/33115646
has comment: http://stackoverflow.com/comment/33115109
has comment: http://stackoverflow.com/comment/33114593
score: 0
has comment: http://stackoverflow.com/comment/33115401
has answer: http://stackoverflow.com/a/21872708
answer count: 1
has body: I have a list of users registered on a website and when the admin clicks to approve, it must be inserted into another table called login. I have the code , its not throwing any exception or any error but it's simply not transferring row data from one table to another. Below is my servlet: And my DAO: PreparedStatement ps=conn.prepareStatement("insert into login(id,FirstName,LastName,Gender,Category,Dateofbirth,Age,Address,Country,State,city,PinCode,EmailId,ContactNo,MobileNo)select * from register where id=?"); ps.setInt(1, id); ps.executeUpdate(); } Please someone help me fix this, thanks in advance.
has comment: http://stackoverflow.com/comment/33114703
has comment: http://stackoverflow.com/comment/33114678
has comment: http://stackoverflow.com/comment/33115698
has comment: http://stackoverflow.com/comment/33115681
has comment: http://stackoverflow.com/comment/33115929
type: UnansweredQuestion
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/33115252
tagged with: java
has title: inserting a row from one table to another in mysql on clicking a hyperlink
has comment: http://stackoverflow.com/comment/33115444
tagged with: mysql

http://stackoverflow.com/q/21952445
has answer: http://stackoverflow.com/a/21952465
upvote count: 15
answer count: 4
type: AnsweredQuestion
has title: Perform "mvn dependency:tree" *within Eclipse*
downvote count: 0
accepted answer: http://stackoverflow.com/a/21952465
has body: I have a Maven project which I program within Eclipse. In Eclipse, everything works, but when building it with Maven, I get a NoSuchMethodError on a call to a third-party jar. So I suspect that Eclipse uses a different version of that jar when compiling. I can see which version of what Maven uses, but I'd like to see which version of what Eclipse uses. I don't see how to perform a "mvn dependency:tree" from within Eclipse, such that I would see the result form "Eclipse's point-of-view". The project was created using "File/Import.../Existing Maven Project". I am using "Eclipse IDE for Java Developers", Version: "Kepler Service Release 1" To perform any Maven command from Eclipse, I just found this SO question
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/7858495
has answer: http://stackoverflow.com/a/58516476
score: 15
possible better answer: http://stackoverflow.com/a/21953946
tagged with: maven
has answer: http://stackoverflow.com/a/21953946
tagged with: java
has answer: http://stackoverflow.com/a/55095701
tagged with: eclipse

http://stackoverflow.com/q/21962731
has comment: http://stackoverflow.com/comment/33277698
downvote count: 0
has title: Floating Point Variable Not Working
favorite count: 0
has comment: http://stackoverflow.com/comment/33277795
has answer: http://stackoverflow.com/a/21962890
linked to: http://stackoverflow.com/q/10682382
has comment: http://stackoverflow.com/comment/33277364
has answer: http://stackoverflow.com/a/21962818
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33278535
type: Question
score: 3
tagged with: java
linked to: http://stackoverflow.com/q/588004
has body: When I run the program posted below, I get some weird results. The program is suppose to print a message at multiples of when i = 5,000,000, however, it sometimes prints the message when i is not equal to a multiple of 5 million. When I change the numberOfTests from 50 million to 5 million, the program runs fine. Also, if I change it from a float to a double, the program works fine as well. What's wrong with my current code? Is the floating variable not working? Why is this happening? How can I prevent this in the future? public static void main(String[] args) { final int numberOfTests = 50 * 1000 * 1000; final float IncrementsPercentageToPrintResults = .10f; for(int i = 1; i &lt;= numberOfTests; i++) { if(i % (IncrementsPercentageToPrintResults * numberOfTests) == 0) { System.out.println("Currently at " + (int) (((float) i / numberOfTests) * 100) + "%." ); System.out.println(" i = " + i); } } } Output: Currently at 10%. i = 5000000 Currently at 20%. i = 10000000 Currently at 30%. i = 15000000 Currently at 40%. i = 19999999 Currently at 40%. i = 20000000 Currently at 40%. i = 20000001 Currently at 50%. i = 24999999 Currently at 50%. i = 25000000 Currently at 50%. i = 25000001 Currently at 60%. i = 29999999 Currently at 60%. i = 30000000 Currently at 60%. i = 30000001 Currently at 70%. i = 34999998 Currently at 70%. i = 34999999 Currently at 70%. i = 35000000 Currently at 70%. i = 35000001 Currently at 70%. i = 35000002 Currently at 80%. i = 39999998 Currently at 80%. i = 39999999 Currently at 80%. i = 40000000 Currently at 80%. i = 40000001 Currently at 80%. i = 40000002 Currently at 90%. i = 44999998 Currently at 90%. i = 44999999 Currently at 90%. i = 45000000 Currently at 90%. i = 45000001 Currently at 90%. i = 45000002 Currently at 100%. i = 49999998 Currently at 100%. i = 49999999 Currently at 100%. i = 50000000
possible better answer: http://stackoverflow.com/a/21962818
upvote count: 3
answer count: 2
accepted answer: http://stackoverflow.com/a/21962890
has comment: http://stackoverflow.com/comment/33277589

http://stackoverflow.com/q/21939681
has answer: http://stackoverflow.com/a/21939764
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: android
linked to: http://stackoverflow.com/q/11245829
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21940744
tagged with: onclick
tagged with: java
has comment: http://stackoverflow.com/comment/33236268
downvote count: 2
has title: Android XML OnClick attribute failing. Not sure Why
type: Question
has answer: http://stackoverflow.com/a/34604638
has comment: http://stackoverflow.com/comment/33235430
has comment: http://stackoverflow.com/comment/33236258
upvote count: 0
score: -2
accepted answer: http://stackoverflow.com/a/21940744
has comment: http://stackoverflow.com/comment/33236635
linked to: http://stackoverflow.com/q/21457929
has answer: http://stackoverflow.com/a/26228627
has body: So, to be more specific, OnClick is working just fine if I'm using a view item (Such as a button). As far as menu items go though, it's failing completely. Here's my main.xml from the menu folder: &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;item android:id="@+id/action_settings" android:orderInCategory="100" android:showAsAction="never" android:title="@string/action_settings" android:onClick="openSettings" /&gt; &lt;item android:id="@+id/action_high_scores" android:orderInCategory="100" android:showAsAction="always" android:title="@string/action_high_scores" /&gt; And here's the relevant code from MainActivity.java: public void openSettings(MenuItem item) { Intent openSettings = new Intent(getApplicationContext(), Settings.class); startActivity(openSettings); } I've placed the openSettings method before and after the onCreateOptionsMenu() method declaration but it made no difference. Every time, it returns the same error: NoSuchMethodException Ideas? Thanks in advance. (UPDATE: I'm on API 15 so no, it's NOT an API compatibility issue. Using onClick in the Menu list works 100% with API's 11 and greater, so please don't tell me to use the onMenuItemSelected method.) UPDATE: So I plugged in my tablet (API 11, Honeycomb) and POOF! It works! For some reason or another, API 15, 4.0.4 ISC isn't working with this!?!?! Any ideas what would be causing it? (In the meantime, for compatability, it looks like I may have to override onMenuItemSelected after all, despite my wishes otherwise. Did I just hit a major bug with API 15?
possible better answer: http://stackoverflow.com/a/21939764

http://stackoverflow.com/q/22000423
has answer: http://stackoverflow.com/a/39228758
has answer: http://stackoverflow.com/a/61726257
type: AnsweredQuestion
score: 41
has comment: http://stackoverflow.com/comment/33359628
downvote count: 0
has title: JavaFX and maven: NullPointerException: Location is required
favorite count: 0
has answer: http://stackoverflow.com/a/32609555
type: Question
has comment: http://stackoverflow.com/comment/33344762
has body: I have been trying to get Maven set up with JavaFX. Even though I was unexperienced with Maven and JavaFX, I didn't expect it to be so much of a challenge. My Java knowledge is pretty solid (including Swing), and didn't expect to have this much difficulty getting it set up. I started with a JavaFX project supplied by IntelliJ 13.0 Community Edition. The code in my Main class is relatively small: package sample; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception { //getClass().getResource("../../resources/sample.fxml"); Parent root = FXMLLoader.load(getClass().getResource("../sample.fxml")); primaryStage.setTitle("Hello World"); primaryStage.setScene(new Scene(root, 300, 275)); primaryStage.show(); } public static void main(String[] args) { launch(args); } } and my pom.xml isn't too big either: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 sample JavaFXDemo 1.0-SNAPSHOT jar RubberDucky com.zenjava javafx-maven-plugin 2.0 com.zenjava javafx-maven-plugin 2.0 sample.Main com.oracle javafx 2.2 ${java.home}/lib/jfxrt.jar system I'm using the JavaFX Maven Plugin to build the application. After running mvn clean jfx:jar everything seems fine, all builds succeed. But when I try to run the application I get the following error: Exception in Application start method java.lang.reflect.InvocationTargetException 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.javafx.main.Main.launchApp(Main.java:698) at com.javafx.main.Main.main(Main.java:871) Caused by: java.lang.RuntimeException: Exception in Application start method at com.sun.javafx.application.LauncherImpl.launchApplication1…
has answer: http://stackoverflow.com/a/69825225
possible better answer: http://stackoverflow.com/a/34239165
has answer: http://stackoverflow.com/a/35832191
has answer: http://stackoverflow.com/a/34239165
has answer: http://stackoverflow.com/a/22011185
upvote count: 41
tagged with: maven
answer count: 7
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/22011185

http://stackoverflow.com/comment/33350103
score: 1
has text: The better choice here would have been to provide an answer to the original question like I did since this is basically a dup.
type: AnswerComment
comment on: http://stackoverflow.com/a/22003452
type: Comment

http://stackoverflow.com/comment/33111627
type: QuestionComment
has text: @ luiggi , Ok I tried it still doesn't pic anything up, my guess is that my for statement is not working properly
type: Comment
comment on: http://stackoverflow.com/q/21869923
score: 0

http://stackoverflow.com/a/21910526
type: Answer
downvote count: 1
upvote count: 6
has body: The most simplest way of doing it is use a static variable How do you use it: Define a static boolean flag and assign it false value, once the activity is created for the first time, make the flag true, and now you do your task with simple if/else condition public static boolean flag=false; then in onCreate if(flag==true) { //Activity is not calling for first time now } if(flag==false) { //first time calling activity flag=true; }
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21909943
answers question: http://stackoverflow.com/q/21909943

http://stackoverflow.com/a/21944406
downvote count: 0
answers question: http://stackoverflow.com/q/21944361
has body: Remove DOTALL to make sure to match on a single line and convert \s to " " Pattern p = Pattern.compile("^(Please( )(match)( )(.*?) this (.*))$"); DOTALL makes a dot match newlines as well \s can match any whitespace including new lines.
type: Answer
has comment: http://stackoverflow.com/comment/33244252
score: 2
has comment: http://stackoverflow.com/comment/33244663
upvote count: 2
has comment: http://stackoverflow.com/comment/33244312
has comment: http://stackoverflow.com/comment/33244255
has comment: http://stackoverflow.com/comment/33244200

http://stackoverflow.com/q/21859020
type: AnsweredQuestion
has body: This code: String file = ""; String filename = ""; try{ BufferedReader ins = new BufferedReader(new FileReader(new File("filename.txt")));//get file name while (ins.ready()) { filename = ins.readLine(); } ins.close(); }catch(Exception e){ } String[] sa = filename.split("/"); file = sa[sa.length - 1]; try { System.out.println(filename); } catch (Exception e) { e.printStackTrace(); } Prints: http://wordpress.org/plugins/about/readme.txt When I try to do : URL url = new URL(filename); I get the malformed URL exception : no protocol This is happening for no reason. If I manually assign the filename string to "http://wordpress.org/plugins/about/readme.txt" it will work perfectly , is there something wrong with the file reader? The thing goes like Read a string from the file and then make it a URL! Stop editing wrongly!
has answer: http://stackoverflow.com/a/21859861
tagged with: java
tagged with: file
has answer: http://stackoverflow.com/a/21859171
has comment: http://stackoverflow.com/comment/33092501
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21859171
has title: Java - Malformed URL - Not correct - No protocol
tagged with: url
has comment: http://stackoverflow.com/comment/33092175
accepted answer: http://stackoverflow.com/a/21859861
favorite count: 0
has comment: http://stackoverflow.com/comment/33092094
score: 0
has comment: http://stackoverflow.com/comment/33091419
has comment: http://stackoverflow.com/comment/33092056
tagged with: exception
has comment: http://stackoverflow.com/comment/33092519
tagged with: malformed
has comment: http://stackoverflow.com/comment/33092540
upvote count: 1
has comment: http://stackoverflow.com/comment/33092274
has comment: http://stackoverflow.com/comment/33092276
downvote count: 1

http://stackoverflow.com/q/21945322
tagged with: onclicklistener
has title: Change what happens onClick depending on which fragment is visible?
has answer: http://stackoverflow.com/a/21946825
has comment: http://stackoverflow.com/comment/33245960
type: AnsweredQuestion
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/33245788
tagged with: java
type: Question
has body: I have a layout with an image which should play a sound when clicked depending on which fragment is shown in the frame below the image. All my fragments are in inner class. I get a force close when I start the activity. Here's the issue... This code is in all three of my fragments but with different sounds, sound1 for fragment, sound2 for fragment2 and so on.... public class Fragment_gehorINTbeginnerR8 extends Fragment{ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { return null; } LinearLayout mLinearLayout = (LinearLayout) inflater.inflate(R.layout.fragment_musikteori_gehortest_int_beg, container, false); Button buttonR1 = (Button) mLinearLayout.findViewById(R.id.button_r1); Button buttonR5 = (Button) mLinearLayout.findViewById(R.id.button_r5); Button buttonR8 = (Button) mLinearLayout.findViewById(R.id.button_r8); ImageView imagePlay = (ImageView) findViewById(R.id.imageViewPlayGehorSound); if(mp != null &amp;&amp; mp.isPlaying()){ mp.stop(); } mp = MediaPlayer.create(getApplicationContext(), R.raw.inter_oktav); mp.start(); imagePlay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mp != null &amp;&amp; mp.isPlaying()) { mp.stop(); } mp = MediaPlayer.create(getApplicationContext(), R.raw.inter_prim); mp.start(); } }); some buttons....
accepted answer: http://stackoverflow.com/a/21946825
answer count: 1
has comment: http://stackoverflow.com/comment/33246244
has comment: http://stackoverflow.com/comment/33246054
has comment: http://stackoverflow.com/comment/33245707
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/33245795

http://stackoverflow.com/q/21850298
accepted answer: http://stackoverflow.com/a/33944296
tagged with: classnotfoundexception
has title: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.mapreduce.TableOutputFormat
downvote count: 0
favorite count: 0
tagged with: hbase
possible better answer: http://stackoverflow.com/a/21851015
upvote count: 1
has answer: http://stackoverflow.com/a/21851015
has body: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.mapreduce.TableOutputFormat I cannot put the hbase jar files to Hadoop lib directory, because I am not allowed to change such configurations on the given cluster. What other alternatives can you offer?
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/33944296
tagged with: java
type: Question
tagged with: hadoop
tagged with: apache
linked to: http://stackoverflow.com/q/10980072
answer count: 2

http://stackoverflow.com/comment/33094626
has text: I cannot use FileInputStream, etc..., as it was not part of the assignment. I decided to use the Scanner class to store the values into a string, but the FileReader stops inputting the values after the first line because of the break. Is there a way to tell FileReader to continue after the line ends?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21860029

http://stackoverflow.com/comment/33169456
has text: just trying to learn.Please do help/ i know JSTL is better but i want to just add java first then leter start JSTL
type: Comment
comment on: http://stackoverflow.com/a/21901264
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33245172
comment on: http://stackoverflow.com/a/21944983
type: AnswerComment
type: Comment
has text: Except for the risk of an empty array, this makes sense
score: 1

http://stackoverflow.com/q/21925462
tagged with: android
has comment: http://stackoverflow.com/comment/57554392
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/64832602
upvote count: 1
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/33211921
tagged with: testing
has title: Mocking a database with RenamingDelegatingContext
has body: I am trying to figure out how to use RenamingDelegatingContext to mock a database for testing purposes. The tutorials I have found about this class are great but don't quite answer my questions. dtmilano discusses mocking a file with RenamingDelegatingContext. jayway gives a tutorial about mocking a ContentResolver, but only focus on openInputStream() rather than query() and the other database-like operations As far as I can tell, there isn't a tutorial about mocking databases. If I am missing it in my googling, please provide a link. Otherwise, this would be an excellent home for such a tutorial. Update: Testing database on Android: ProviderTestCase2 or RenamingDelegatingContext? is close to what I am trying to do. The difference is that I have already written tests for my ContentProvider using ProviderTestCase2. Now I am doing some functional testing with ActivityInstrumentationTestCase2 subclasses for some activities which use that ContentProvider. I need the instrumentation for menu and button clicks. If I create a mock context with RenamingDelegatingContext context = new RenamingDelegatingContext(getTargetContext(), TEST_FILE_PREFIX); how and when do I inject it into the instrumentation?
has comment: http://stackoverflow.com/comment/60044436
tagged with: mocking
has comment: http://stackoverflow.com/comment/33210688
has comment: http://stackoverflow.com/comment/33211366
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33210392
favorite count: 0
has comment: http://stackoverflow.com/comment/33210623
linked to: http://stackoverflow.com/q/3096378

http://stackoverflow.com/comment/37563580
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21952467
has text: So please submit the resolution as an answer to close this question.

http://stackoverflow.com/q/21858308
has comment: http://stackoverflow.com/comment/33091506
type: Question
accepted answer: http://stackoverflow.com/a/21886423
has comment: http://stackoverflow.com/comment/33091151
score: 0
answer count: 1
has title: Spooky Java Reflection Bug
has comment: http://stackoverflow.com/comment/33090107
has comment: http://stackoverflow.com/comment/33090377
has answer: http://stackoverflow.com/a/21886423
has comment: http://stackoverflow.com/comment/33090210
has comment: http://stackoverflow.com/comment/33090803
has body: So, here is the problem. I'm attempting to use reflection in Java to define a type of 'view' for output to an excel sheet through ordered method declarations. (ordered numerically) and in theory, this should work just fine, and it does to a point. The issue is that the reflective method seemingly randomly decides to work sometimes, and not the others. It's not throwing an exception, it's finding the method names without any trouble, but as soon as it hits the boolean check for whether or not the method starts with the appropriate tag, it will sometimes stop at j = 5. Here's the code of the method to clarify: public boolean objectWriter(List&lt;Object&gt; input, String sheetName, int startingRow, String tag){ ArrayList&lt;Object&gt; myList = new ArrayList&lt;&gt;(); jxl.write.Number number; Label label; //This is just an internal counter since we're using a for-each loop. int j; try{ for (int i = 0; i &lt; input.size(); i++){ j = 0; //we want to iterate over all of the available methods in the given class with reflection for (Method m: input.get(i).getClass().getMethods()){ //Check to see if the method name has our requested tag, plus the appropriate counter //tacked on, and ZERO parameters, in our case. myLog.debug("this is our boolean check: " + m.getName().startsWith((tag + j))); if (m.getName().startsWith((tag + j))){ myLog.debug("m.getname inside: " + m.getName()); //Invoke the method, give it's return value to r (return) final Object r = m.invoke(input.get(i)); //Since we defined in the requirements of this class that it must be a string //those types of methods returned, this works just fine, just case it to //String (Since String extends object) and call it a day. if (isNumeric((String)r)){ //if it's a number, make a number object out of it. number = new jxl.write.Number(j, startingRow + i , Double.parseDouble((String)r) , buildNumberFormat((String)r)); myList.add(number); }else{ label = new Label(j,startingRow + i,(String)r); myList.add(label); } j++; } } } …
type: AnsweredQuestion
tagged with: reflection
tagged with: java
has comment: http://stackoverflow.com/comment/33090967
tagged with: excel

http://stackoverflow.com/comment/33274528
type: QuestionComment
comment on: http://stackoverflow.com/q/21961159
score: 4
has text: Is the constructor public too?
type: Comment

http://stackoverflow.com/q/21855291
answer count: 1
has comment: http://stackoverflow.com/comment/33084719
has comment: http://stackoverflow.com/comment/33087241
has comment: http://stackoverflow.com/comment/33088245
tagged with: runtime-error
score: 0
has title: import MySQL DB from java not working
has body: I use this code to import (restore) .sql file: String command2="/Users/macbookpro/mysql-5.6.16-osx10.7-x86_64/bin/mysql --host mydb.ckwwsnbi2lvi.us-west-2.rds.amazonaws.com --port 3306 -u XXX -pXXXX testcomm &lt;/Users/macbookpro/Downloads/world3.sql" Process runtimeProcess; try { runtimeProcess = Runtime.getRuntime().exec(command2); processComplete = runtimeProcess.waitFor(); if (processComplete == 0) { System.out.println("Backup restored successfully"); // return true; } else { System.out.println("Could not restore the backup"); } } catch (Exception ex) { ex.printStackTrace(); } The command is working well in the terminal, but it's not working when I run Java code. Any help will be appreciated.
tagged with: sql
has comment: http://stackoverflow.com/comment/33087566
linked to: http://stackoverflow.com/q/9093958
has comment: http://stackoverflow.com/comment/33086961
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33085830
has answer: http://stackoverflow.com/a/21940063
has comment: http://stackoverflow.com/comment/33086224
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/33085364

http://stackoverflow.com/comment/33157455
score: 0
type: Comment
type: QuestionComment
has text: you check if all raido buttons is false in the group ?? i think this condition doesn't occur , this case in first time you begin the activity only
comment on: http://stackoverflow.com/q/21895128

constructor
tags question: http://stackoverflow.com/q/21952549
tags question: http://stackoverflow.com/q/21962687
tags question: http://stackoverflow.com/q/21867038
tags question: http://stackoverflow.com/q/21908447
tags question: http://stackoverflow.com/q/21923269
tags question: http://stackoverflow.com/q/21918835
tags question: http://stackoverflow.com/q/21978514
tag name: constructor
tags question: http://stackoverflow.com/q/21984586
tags question: http://stackoverflow.com/q/21857063
type: Tag
tags question: http://stackoverflow.com/q/21963797
tags question: http://stackoverflow.com/q/21929394
tags question: http://stackoverflow.com/q/21912874
tags question: http://stackoverflow.com/q/21891449
tags question: http://stackoverflow.com/q/21912362
tags question: http://stackoverflow.com/q/21985975

http://stackoverflow.com/q/21917402
has answer: http://stackoverflow.com/a/21917536
tagged with: java
has body: So i'm struggling a bit here to get the values from one activity passed to another. I've tried everything and have looked elsewhere here, but everything I've found didn't work or was unrelated to my issue. I'm instantiating the intent and using Extras to pass the value. I'm using Eclipse and it's not giving any errors in the IDE. According to LogCAT, it's a NullExceptionPointer Error getting thrown out as i'm using the getIntExtra() method of the intent. Here's the code from Main Activity: int tempScore = GUESS_COUNT; Intent intent = new Intent(getApplicationContext(), SubmitScore.class); intent.putExtra("PASSED_SCORE", tempScore); startActivity(intent); And here's the code from the new activity: private Intent i = getIntent(); //declared in the class header tempScore = i.getIntExtra("PASSED_SCORE", 999); //exists inside of a private method for the class //(ALSO: THIS tempScore is a private int variable localized to only this class, so that's not the problem) The moment it tries to store the getIntExtra() returned value to tempScore, it throws the NullPointerException error. Meaning: it's trying to pull a value where there is none. Shouldn't it push 999 as the default value at least though? Why the Error instead? Also, why did the value not getting pushed to the new activity? Thanks in advance for your help. JRad
tagged with: eclipse
score: 0
answer count: 2
has title: Trouble Passing a Value Through Intent to new Activity
tagged with: android
possible better answer: http://stackoverflow.com/a/21917687
has answer: http://stackoverflow.com/a/21917687
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21917536
tagged with: android-intent
type: Question

http://stackoverflow.com/comment/33215296
comment on: http://stackoverflow.com/q/21927760
score: 0
has text: That sounds like a different problem. Is there a row with similar value in the xls file?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33210688
comment on: http://stackoverflow.com/q/21925462
has text: Did you see this? http://stackoverflow.com/questions/3096378/testing-database-on-android-providertestcase2-or-renamingdelegatingcontext May be it will help.
score: 0
type: Comment
type: QuestionComment

event-dispatch-thread
tags question: http://stackoverflow.com/q/21976000
tag name: event-dispatch-thread
type: Tag

http://stackoverflow.com/q/21985674
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: I am newbie to Java Mail API. Can anyone please tell me how can i subclass javamail Message because I need this to marshal and unmarshall the code. When i subclass, I have to implement a lot of functions, is this the way of subclassing? After subclassing, following snippet occurs: &lt;code&gt; public class MailMessage extends Message{ @Override public void addHeader(String arg0, String arg1) throws MessagingException { // TODO Auto-generated method stub } @Override public Enumeration getAllHeaders() throws MessagingException { // TODO Auto-generated method stub return null; } @Override public Object getContent() throws IOException, MessagingException { // TODO Auto-generated method stub return null; } @Override public String getContentType() throws MessagingException { // TODO Auto-generated method stub return null; } @Override public DataHandler getDataHandler() throws MessagingException { // TODO Auto-generated method stub return null; } @Override public String getDescription() throws MessagingException { // TODO Auto-generated method stub return null; } @Override public String getDisposition() throws MessagingException { // TODO Auto-generated method stub return null; } @Override public String getFileName() throws MessagingException { // TODO Auto-generated method stub return null; } @Override public String[] getHeader(String arg0) throws MessagingException { // TODO Auto-generated method stub return null; } @Override public InputStream getInputStream() throws IOException, MessagingException { // TODO Auto-generated method stub return null; } @Override public int getLineCount() throws MessagingException { // TODO Auto-generated method stub return 0; } @Override public Enumeration getMatchingHeaders(String[] arg0) throws MessagingException { // TODO Auto-generated method stub return null; } @Override public Enumeration getNonMatchingHeaders(String[] arg0) throws MessagingException { // TODO Auto-generated method stub return null; } @Override public int getSize() t…
score: 1
has comment: http://stackoverflow.com/comment/33317984
tagged with: java
upvote count: 1
has title: How to subclass Java Mail Message
type: Question
has answer: http://stackoverflow.com/a/21986112
tagged with: class
tagged with: jakarta-mail
answer count: 2
has answer: http://stackoverflow.com/a/21997065

http://stackoverflow.com/comment/33252014
score: 0
has text: Don't forget it's about the names. It doesn't have to be the same type.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21948701

http://stackoverflow.com/comment/110928297
has text: Word wrapping in Netbeans can be disabled.
comment on: http://stackoverflow.com/a/29434641
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33160881
type: AnswerComment
has text: thanks buddy, i'm not quite sure where or how to insert the code to sort the results in ascending order also?
comment on: http://stackoverflow.com/a/21895102
type: Comment
score: 0

http://stackoverflow.com/q/21974588
possible better answer: http://stackoverflow.com/a/21974647
has comment: http://stackoverflow.com/comment/33298197
has answer: http://stackoverflow.com/a/21974647
type: AnsweredQuestion
has title: Summing two arrays by element, issue with carrying the 1
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21974651
type: Question
answer count: 2
downvote count: 0
has body: So I've gotten these two arrays to add properly when there is no need to carry anything. so a[0,1,1] + b[0,1,1] will give me c[0,0,2,2], but if I similarly do a[0,9,9] + b[0,9,9] I only get c[0, 0, 8, 8]. The loop in method addBigInts doesn't seem to work the way I thought it would. Any thoughts are appreciated. import java.util.*; public class AddBigInts { public static void main(String[] args) { Scanner console = new Scanner(System.in); //init firstNum array int[] firstNum = new int[getDigit()]; System.out.println("First number:"); //gets input to pop array firstNum = getInt(firstNum); //second array is same length int[] secondNum = new int[firstNum.length]; System.out.println("Second number:"); //pop second array secondNum = getInt(secondNum); System.out.println(Arrays.toString(firstNum)); System.out.println(Arrays.toString(secondNum)); addBigInts(firstNum, secondNum); } //creates array that is one place bigger than entered # public static int getDigit (){ Scanner console = new Scanner(System.in); System.out.print("How many digits? "); int arraySize = console.nextInt(); return arraySize + 1; } //populates array public static int[] getInt (int[] num){ Scanner console = new Scanner(System.in); for (int i=num.length-1; i&gt;0; i--){ System.out.print("Digit " + i + ": "); num[i] = console.nextInt(); } return num; } //adds both arrays by index into the sum array public static int[] addBigInts (int[]numArray1, int[] numArray2){ int count = Math.max(numArray1.length, numArray2.length); int[] sum = new int[count+1]; //starting at numArray1 &amp; 2 index, sums ints for (int i=count-1; i&gt;=0; i--){ //sum has to be +1 for numArray1 &amp; 2 indexes sum[i+1] = numArray1[i] + numArray2[i]; if (sum[i+1]&gt;9){ //this line below doesn't seem to execute sum[i]++; sum[i+1] = sum[i+1] - 10; } else; } System.out.println(Arrays.toString(sum)); return sum; } }
has comment: http://stackoverflow.com/comment/33298395
has comment: http://stackoverflow.com/comment/33298303
favorite count: 0
has answer: http://stackoverflow.com/a/21974651
has comment: http://stackoverflow.com/comment/33298253
upvote count: 1

http://stackoverflow.com/q/22001158
type: Question
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/22001239
has answer: http://stackoverflow.com/a/22001225
has body: I made a simple JOptionPane class that should pop up with a string, when I type: javac Hellodialog.java nothing happens at all. No error messages but nothing comes up. import javax.swing.JOptionPane; public class Hellodialog { public static void main(String[] args) { JOptionPane.showMessageDialog(null, "fsdfsdfdsfds"); } }
tagged with: command-line
type: UnansweredQuestion
has title: Why isn't JOptionPane showing up?
tagged with: swing
has comment: http://stackoverflow.com/comment/33345898
tagged with: java

http://stackoverflow.com/q/21964003
tagged with: object
has answer: http://stackoverflow.com/a/21964080
has body: This program creates 10 accounts and sets the balance to $100 each. I wrote a for loop to initialize the balance but doesn't work. The setBalance() method is not recognize within the AccountArray Class How do I assign $100 balance to each account? public class AccountArray{ public static AccountArray[] createAccountArray(){ AccountArray[] atm = new AccountArray [10]; for(int i = 0; i &lt; atm.length; i++){ atm[i] = new AccountArray(setBalance(100)); } return atm; } } import java.util.Date; public class Account{ public int id = 0; public double balance = 0; public double annualInterestRate = 0; public double withdraw; public double deposit; java.util.Date date = new java.util.Date(); public Account(){ } public Account(int id, double balance, double annualInterestRate){ this.id = id; this.balance = balance; this.annualInterestRate = annualInterestRate; } public Account(int id, double balance, double annualInterestRate, Date date){ this.id = id; this.balance = balance; this.annualInterestRate = annualInterestRate; this.date = date; } public void setID(int id){ this.id = id; } public int getID(){ return id; } public double getBalance(){ return balance - withdraw + deposit; } public void setAnnualInterestRate(double annualInterestRate){ this.annualInterestRate = annualInterestRate; } public double getAnnualInterestRate(){ return (annualInterestRate/100); } public Date getDateCreated(){ return date; } public double getMonthlyInterestRate(){ return getBalance() * ((annualInterestRate/100) / 12); } public void withdraw(double withdraw){ this.withdraw = withdraw; } public double deposit(){ return balance + deposit; } public void deposit (double deposit){ this.deposit = deposit; } } . public class TestAccount extends AccountArray{ public static void main(String[] args) { Account account1122 = new Account(1122, 20000, 4.5); account1122.withdraw(2500); account1122.deposit(3000); System.out.println("Your account balance is: \t" + "$"+ account1122.getBalance() + "\nYour monthly i…
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33279555
type: Question
has title: Initializing array of objects to $100
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/33279493
linked to: http://stackoverflow.com/q/3730019
has comment: http://stackoverflow.com/comment/33279510
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33279570

http://stackoverflow.com/tag/c
tags question: http://stackoverflow.com/q/21916653
tags question: http://stackoverflow.com/q/21869975
tag name: c
tags question: http://stackoverflow.com/q/22003376
type: Tag
tags question: http://stackoverflow.com/q/21906821
tags question: http://stackoverflow.com/q/21931738
tags question: http://stackoverflow.com/q/21967250
tags question: http://stackoverflow.com/q/21946796
tags question: http://stackoverflow.com/q/21906162
tags question: http://stackoverflow.com/q/21862754
tags question: http://stackoverflow.com/q/21971143

http://stackoverflow.com/a/22073414
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21929032
answers question: http://stackoverflow.com/q/21929032
type: Answer
score: 0
has body: the latest and correct version of pom.xml <?xml version="1.0" encoding="utf-8"?> 4.0.0 com.a.zxing zxing 1.0.0 apklib zxing library com.google.android android ${android.platform.version} provided com.google.android support-v4 r7 src com.jayway.maven.plugins.android.generation2 android-maven-plugin 3.8.0 ${android.sdk.platform} ${android.sdk.path} false false /tmp/predexedLibs true true maven-compiler-plugin 3.1 1.6 1.6 org.codehaus.mojo build-helper-maven-plugin generate-sources add-source srccore

http://stackoverflow.com/comment/33210279
has text: It would help if you annotated the stack trace lines in your posted source so we didn't have to count lines.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21925447
score: 2

http://stackoverflow.com/a/21944916
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21942367
has body: Best suggestion I've got: DocumentBuilder.parse() does have variants which will read from a provided stream or reader. So write an instrumented version of FileInputStream/FileReader that reports how far it has read through the file (vs. the file's total length), and pass that to the parser.

http://stackoverflow.com/q/21992460
has comment: http://stackoverflow.com/comment/33329709
type: Question
downvote count: 5
has answer: http://stackoverflow.com/a/21992572
has comment: http://stackoverflow.com/comment/33330008
has body: I need a regex expression that matches forward slash, number and letters for example: a regex that matches 03/89/040/00293/AM13 i am new to java so any help would be appreciated
has comment: http://stackoverflow.com/comment/33329996
answer count: 1
favorite count: 0
score: -4
has title: Regex for Special Characters, Number, and letter
upvote count: 1
tagged with: regex
accepted answer: http://stackoverflow.com/a/21992572
type: AnsweredQuestion
tagged with: java

string
tags question: http://stackoverflow.com/q/22002992
tags question: http://stackoverflow.com/q/21978926
tags question: http://stackoverflow.com/q/21956239
tags question: http://stackoverflow.com/q/21914135
tags question: http://stackoverflow.com/q/21963529
tags question: http://stackoverflow.com/q/21858558
tags question: http://stackoverflow.com/q/21864516
tags question: http://stackoverflow.com/q/21915432
tags question: http://stackoverflow.com/q/21979151
tags question: http://stackoverflow.com/q/21866231
tags question: http://stackoverflow.com/q/21913905
tags question: http://stackoverflow.com/q/21975567
tags question: http://stackoverflow.com/q/21890141
tags question: http://stackoverflow.com/q/22003104
tags question: http://stackoverflow.com/q/21847418
tags question: http://stackoverflow.com/q/21914728
tags question: http://stackoverflow.com/q/21865370
tags question: http://stackoverflow.com/q/21934428
tags question: http://stackoverflow.com/q/21935814
tags question: http://stackoverflow.com/q/21933053
tags question: http://stackoverflow.com/q/21893856
tags question: http://stackoverflow.com/q/21947290
tags question: http://stackoverflow.com/q/21881484
tags question: http://stackoverflow.com/q/21905913
tags question: http://stackoverflow.com/q/21970890
tags question: http://stackoverflow.com/q/21976901
tags question: http://stackoverflow.com/q/21970256
tags question: http://stackoverflow.com/q/21949874
tags question: http://stackoverflow.com/q/21897667
tags question: http://stackoverflow.com/q/21973762
tags question: http://stackoverflow.com/q/21863927
tags question: http://stackoverflow.com/q/22002412
tags question: http://stackoverflow.com/q/21846698
tags question: http://stackoverflow.com/q/21887204
tags question: http://stackoverflow.com/q/21887844
tags question: http://stackoverflow.com/q/21871084
tags question: http://stackoverflow.com/q/21933704
tags question: http://stackoverflow.com/q/21970944
tags question: http://stackoverflow.com/q/21889999
tags question: http://stackoverflow.com/q/21878302
tags question: http://stackoverflow.com/q/21914868
tag name: string
tags question: http://stackoverflow.com/q/21923361
tags question: http://stackoverflow.com/q/21974780
tags question: http://stackoverflow.com/q/21946042
tags question: http://stackoverflow.com/q/21894187
tags question: http://stackoverflow.com/q/21912690
tags question: http://stackoverflow.com/q/22002188
tags question: http://stackoverflow.com/q/21967329
tags question: http://stackoverflow.com/q/22002447
tags question: http://stackoverflow.com/q/21989714
tags question: http://stackoverflow.com/q/21916881
tags question: http://stackoverflow.com/q/21992023
tags question: http://stackoverflow.com/q/21844012
tags question: http://stackoverflow.com/q/22003417
tags question: http://stackoverflow.com/q/21918191
tags question: http://stackoverflow.com/q/21865314
tags question: http://stackoverflow.com/q/21928653
tags question: http://stackoverflow.com/q/21976317
tags question: http://stackoverflow.com/q/21924826
tags question: http://stackoverflow.com/q/21877834
tags question: http://stackoverflow.com/q/21942882
tags question: http://stackoverflow.com/q/21989283
type: Tag
tags question: http://stackoverflow.com/q/21949279
tags question: http://stackoverflow.com/q/21964606
tags question: http://stackoverflow.com/q/21910271
tags question: http://stackoverflow.com/q/21878415
tags question: http://stackoverflow.com/q/21850156
tags question: http://stackoverflow.com/q/21931195
tags question: http://stackoverflow.com/q/21851958
tags question: http://stackoverflow.com/q/21896303
tags question: http://stackoverflow.com/q/21963919
tags question: http://stackoverflow.com/q/22005080
tags question: http://stackoverflow.com/q/21852578
tags question: http://stackoverflow.com/q/21891303
tags question: http://stackoverflow.com/q/21950346
tags question: http://stackoverflow.com/q/21847103
tags question: http://stackoverflow.com/q/21950729
tags question: http://stackoverflow.com/q/21859667

http://stackoverflow.com/q/21910532
has body: I'm using Eclipse and I have two different projects: A and B. In project A, I have a class classA where I need to call a method methodB() from a class classB contained in the project B, how can I do that? I've tried adding the project B to project A build path, but still doesn't work. Thanks.
has answer: http://stackoverflow.com/a/21910870
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33183542
has title: How to call a class from another project in Eclipse?
type: Question
has comment: http://stackoverflow.com/comment/33183474
has comment: http://stackoverflow.com/comment/33189048
tagged with: project
downvote count: 0
tagged with: class
upvote count: 2
has comment: http://stackoverflow.com/comment/33183505
has comment: http://stackoverflow.com/comment/33183678
linked to: http://stackoverflow.com/q/1106023
has answer: http://stackoverflow.com/a/21910610
has answer: http://stackoverflow.com/a/45190169
has comment: http://stackoverflow.com/comment/33183468
favorite count: 0
has answer: http://stackoverflow.com/a/21910985
type: UnansweredQuestion
answer count: 4
score: 2
tagged with: java

http://stackoverflow.com/comment/33283092
has text: Please post code, and screen shots of the problem. We can not debug what we can not see.
comment on: http://stackoverflow.com/q/21965837
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/33283896
comment on: http://stackoverflow.com/a/21966157
score: 0
type: AnswerComment
type: Comment
has text: where to put db.close();

http://stackoverflow.com/q/22001161
tagged with: loops
has body: I cant figure out how to loop through this instead of just repeating the code, bugging the hell outta me! FYI assignment has already been turned in using 5 iterations of code, just wanted to learn how to implement the string array holding file contents into a for loop for future knowledge. I have tried for a few hours but it just prints the filename, cant seem to get the file contents. /************************************************************************* * LinuxSys.java * * This program reads text from a file **************************************************************************/ import java.util.*; import java.io.*; public class LinuxSys { public static void main (String[] args) { String systemInfo[] = new String [5]; int i = 0; // using _ to simulate file paths to test on local cpu, as it is easier/quicker // than logging onto server/copy pasting code into new pico file systemInfo[0] = "_proc_sys_kernel_hostname.txt"; //local files systemInfo[1] = "_proc_meminfo.txt"; //local files systemInfo[2] = "_proc_version.txt"; //local files systemInfo[3] = "_proc_sys_kernel_hostname.txt"; //local files //systemInfo[0] = "_proc_sys_kernel_hostname.txt"; //local files // 1st try to print server host name file try { BufferedReader inputStream = new BufferedReader(new FileReader(systemInfo[i])); String line = "blank"; while (line != null) { if((line = inputStream.readLine()) != null) { System.out.println(line); i++; // increment systemInfo[] array position } // end if } //end while System.out.println(); // create space inputStream.close(); } // end try catch(FileNotFoundException e) { System.out.println("File was not found"); System.out.println("or could not be opened"); } //end catch catch(IOException e) { System.out.println("Error reading from file"); } //end catch // 2nd try to print server memory file { BufferedReader inputStream = new BufferedReader(new FileReader(systemInfo[i])); String line = "blank"; while (line != null) { if((line = inputStream.readLine()) !=…
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/33345900
score: 0
tagged with: for-loop
answer count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/33346173
has title: Issue with using an array to store/print files from Linux
has answer: http://stackoverflow.com/a/22001652
has comment: http://stackoverflow.com/comment/33345926
type: UnansweredQuestion
tagged with: file

http://stackoverflow.com/q/21864372
has answer: http://stackoverflow.com/a/21864420
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: multithreading
has body: package BroadCast; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.SocketException; public class Server extends Thread { private DatagramSocket sock; public static boolean ServerUp = false; // Wierdly not running this as a thread. private void Server() { try { sock = new DatagramSocket(Constants.port); ServerUp = true; // Prints on console. Constants.Server(Constants.ServerName + ", loaded sucessfully on port: " + Constants.port); } catch (SocketException e) { e.printStackTrace(); } } public static void main(String[] args) { new Server().start(); } @Override public void run() { while (ServerUp) { byte[] data = new byte[1024]; DatagramPacket Packet = new DatagramPacket(data, data.length); try { sock.receive(Packet); } catch (IOException e) { e.printStackTrace(); } // Prints on console. Constants.Server(new String(data).trim()); } } public void ServerData(byte[] data, InetAddress ip, int port) { DatagramPacket Packet = new DatagramPacket(data, data.length, ip, port); try { sock.send(Packet); } catch (IOException e) { e.printStackTrace(); } } } I ran the main void for my Server class, and it didn't have an output (Like it's suppost to). But when I put: new Server().Server(); (to run the Server void), it worked. But, It won't loop correctly (Like a normal thread would). If you could help me, that would be great (it's probably a minor mistake).
tagged with: java
type: Question
tagged with: datagram
has title: Java Thread not starting?

http://stackoverflow.com/a/22019230
has comment: http://stackoverflow.com/comment/33378170
type: Answer
answers question: http://stackoverflow.com/q/21968909
has body: It is practically impossible to understand what you want at the moment of writing this.. However, I'll take a stab in the dark and hopefully what I say can help you.. Characters in Java is 2 bytes each. Each byte can hold a code-point or both can hold a single code-point. Java's chars are thus UTF-16 encoded. If the character's code-point is greater than 0xFFFF then it will be encoded with 2 chars (surrogate pairs) You can read here for more on handling this: http://www.oracle.com/us/technologies/java/supplementary-142654.html TLDR (You'll need these): Character.toCodePoint(char high, char low) Character.toChars(int codePoint) Character.codePointAt(char[] a, int index) Character.isHighSurrogate(char ch) Character.isLowSurrogate(char ch) Character.isLetter(int codePoint) Character.isValidCodePoint And if you ever need to use native strings: Then you can pass then back and forth to Java like so: void Java_natives_toUTF8(JNIEnv* env, jobject obj, jstring utf16) { const char* utf8 = reinterpret_cast&lt;const char*&gt;(env-&gt;GetStringUTFChars(utf16, NULL)); //Do whatever with utf8.. it is UTF8 format. env-&gt;ReleaseStringUTFChars(utf8, reinterpret_cast&lt;const char*&gt;(utf16)); }
score: 0

http://stackoverflow.com/comment/33186859
type: AnswerComment
has text: You not have the SAX parser JAR file in the classpath? Check.
type: Comment
comment on: http://stackoverflow.com/a/21858368
score: 0

http://stackoverflow.com/a/21968979
answers question: http://stackoverflow.com/q/21968894
type: Answer
score: 0
has body: You are modifying list after you produce the Iterator. Just swap lines Iterator&lt;Cliente&gt; miIterador = miLista.iterator(); miLista.add(cliente1); and everything will work fine.

http://stackoverflow.com/comment/33347879
has text: As far as I know the only wait to accomplish passive monitoring (not polling) is with some sort of event generation. A wrapper startup script seems like the easiest. The only other options I can think of are fairly complex. It will be interesting to see what solutions you get. Cheers!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21994092
type: Comment

http://stackoverflow.com/q/21879690
tagged with: android
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33129182
type: Question
has comment: http://stackoverflow.com/comment/33128913
has comment: http://stackoverflow.com/comment/33129133
has answer: http://stackoverflow.com/a/21880736
accepted answer: http://stackoverflow.com/a/21880736
has comment: http://stackoverflow.com/comment/33128986
has title: How should I save string from the Radio Button in arraylist and display it on next page in text box
has comment: http://stackoverflow.com/comment/33128717
tagged with: arraylist
score: 0
answer count: 1
has body: I am working on Quiz app in which there is a question activity which contains 10 questions. Now the problem is I want to get the selected text on radio button in array and display it on next page in textbox where I am already displaying the correct answer and the question from database here is the code from first page of radio buttons List&lt;String&gt; ls = new ArrayList&lt;String&gt;(); private boolean checkAnswer() { String answer = getSelectedAnswer(); if (answer == null) { return false; } else { ls.add(answer); if (currentQ.getAnswer().equalsIgnoreCase(answer)) { currentGame.incrementRightAnswers(); } else { currentGame.incrementWrongAnswers(); } return true; } } /** * */ public String getSelectedAnswer() { if (c1.isChecked()) { return c1.getText().toString(); } if (c2.isChecked()) { return c2.getText().toString(); } if (c3.isChecked()) { return c3.getText().toString(); } if (c4.isChecked()) { return c4.getText().toString(); } return null; } @Override public void onCheckedChanged(RadioGroup group, int checkedId) { // TODO Auto-generated method stub // Log.d("Questions", "Moving to next question"); a++; qno++; if (!checkAnswer()) return; if (currentGame.isGameOver()) { // stoptime(); db.open(); String total = currentGame.getRight() + ""; db.insertOptions(topic1, total, mon); db.close(); alertb(); // mCountDown.cancel(); a = 0; qno = 1; } else { Intent i = new Intent(this, QuestionActivity.class); startActivity(i); finish(); } } public String show(int i) { String a = ls.get(i); return a; } In my checkanswer() I am adding the text of radio button in list ls.add(Item). but here I am making some mistake please correct me I have written show() on above page which would help me to get elements of arraylist on next page here is my code on next page public static String getAnswers(List&lt;Question&gt; questions) { int question = 1; StringBuffer sb = new StringBuffer(); for (Question q : questions){ sb.append("Q").append(question).append(") ").append(q.getQuestion()).app…

http://stackoverflow.com/q/21968661
favorite count: 0
has comment: http://stackoverflow.com/comment/33368113
upvote count: 2
has comment: http://stackoverflow.com/comment/33371132
tagged with: ojdbc
has comment: http://stackoverflow.com/comment/33331510
has title: J2CA0081E Websphere 6 Exception
type: AnsweredQuestion
score: 2
tagged with: websphere-6.1
accepted answer: http://stackoverflow.com/a/38596442
has comment: http://stackoverflow.com/comment/33501274
tagged with: java
type: Question
tagged with: websphere
has comment: http://stackoverflow.com/comment/33428378
has body: Occasionally I see this exception. It affects some of the crucial business processes in the application. What could it be? Did anyone have similar error? I use WebSphere 6 with OJDBC14 &amp; Hibernate 3. [21.02.14 06:46:03:209 PST] 00000031 MCWrapper E J2CA0081E: Method cleanup failed while trying to execute method cleanup on ManagedConnection WSRdbManagedConnectionImpl@4d34b403 from ressource jdbc/MYDS. Caught exception: com.ibm.ws.exception.WsException: DSRA0080E: An exception was received by the Data Store Adapter. See original exception message: Cannot call 'cleanup' on a ManagedConnection while it is still in a transaction.. at com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException.&lt;init&gt;(DataStoreAdapterException.java:226) at com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException.&lt;init&gt;(DataStoreAdapterException.java:177) at com.ibm.ws.rsadapter.AdapterUtil.createDataStoreAdapterException(AdapterUtil.java:232) at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.cleanupTransactions(WSRdbManagedConnectionImpl.java:3392) at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.cleanup(WSRdbManagedConnectionImpl.java:3025) at com.ibm.ejs.j2c.MCWrapper.cleanup(MCWrapper.java:1353) at com.ibm.ejs.j2c.poolmanager.FreePool.returnToFreePool(FreePool.java:462) at com.ibm.ejs.j2c.poolmanager.PoolManager.release(PoolManager.java:1543) at com.ibm.ejs.j2c.MCWrapper.releaseToPoolManager(MCWrapper.java:2031) at com.ibm.ejs.j2c.ConnectionEventListener.connectionClosed(ConnectionEventListener.java:263) at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.processConnectionClosedEvent(WSRdbManagedConnectionImpl.java:1477) at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.closeWrapper(WSJdbcConnection.java:724) at com.ibm.ws.rsadapter.jdbc.WSJdbcObject.close(WSJdbcObject.java(Compiled Code)) at com.ibm.ws.rsadapter.jdbc.WSJdbcObject.close(WSJdbcObject.java(Compiled Code)) at org.hibernate.connection.DatasourceConnectionProvider.closeConnection(DatasourceConnection…
has comment: http://stackoverflow.com/comment/33311056
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33303581
has answer: http://stackoverflow.com/a/38596442

http://stackoverflow.com/q/21868178
tagged with: java-7
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21868196
has body: Is there any difference between the following declarations - List&lt;String&gt; list = new ArrayList&lt;String&gt;(); and List&lt;String&gt; list = new ArrayList&lt;&gt;(); In both cases anyhow , list will have elements of type String only.
type: AnsweredQuestion
tagged with: list
has answer: http://stackoverflow.com/a/21868196
upvote count: 3
tagged with: java
has title: Specifying collection elements type while instance creation
tagged with: collections
type: Question
score: 3
has comment: http://stackoverflow.com/comment/33108527
has comment: http://stackoverflow.com/comment/33108989
tagged with: arraylist

http://stackoverflow.com/q/21969277
type: Question
tagged with: jackson
score: 0
answer count: 1
tagged with: http-status-code-406
has title: 406 error in spring, json output with jackson mapper
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33305636
tagged with: spring-mvc
has body: i am getting a 406 error while running the below code on my localhost:- Controller Code:- //imports import AvailabilityReportService; import SAvailabilityReport; @Controller @RequestMapping("/service/*") public class SAvailabilityController { @Autowired @Qualifier("AvailabilityReportService") private AvailabilityReportService availabilityReportService; @RequestMapping(value = "/{cat}", method = RequestMethod.GET) public @ResponseBody SAvailabilityReport getAvailabilityReport(@PathVariable String cat) { try { return availabilityReportService.generateAvailabilityReport(cat); } catch (Exception e) { e.printStackTrace(); return null; } } } The Availability Report Service Class:- import SAvailabilityReport; public interface AvailabilityReportService { public SAvailabilityReport generateAvailabilityReport(String cat) throws Exception; } Now the availabilityreportserviceimpl class that implements the above class:- //The required imports @Service("AvailabilityReportService") public class AvailabilityReportServiceImpl implements AvailabilityReportService { private @Value("${username}") String username; private @Value("${password}") String password; private @Value("${username1}") String username1; private @Value("${password1}") String password1; private PropertiesConfiguration propConfig; @PostConstruct public void initIt() throws Exception { String propertiesFile = "/META-INF/common.properties"; propConfig = new PropertiesConfiguration(this.getClass().getResource( propertiesFile)); propConfig.setReloadingStrategy(new FileChangedReloadingStrategy()); } public SAvailabilityReport generateAvailabilityReport(String cat) throws Exception { String user; String pass; String time; if (cat == null) return null; String url = (String) propConfig.getProperty("s_" + cat.toLowerCase()); if (url == null) return null; SAvailabilityReport availabilityReport = new SAvailabilityReport(); if((cat.toLowerCase()).equals("h") || (cat.toLowerCase()).equals("f")) { user=username; pass=password; } el…
has comment: http://stackoverflow.com/comment/33292912
has comment: http://stackoverflow.com/comment/33306229
has answer: http://stackoverflow.com/a/21979914
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/33174367
comment on: http://stackoverflow.com/a/21905402
score: 0
type: AnswerComment
has text: FYI These are the entries from POM of my running spring hibernate project.
type: Comment

http://stackoverflow.com/q/21880653
tagged with: mysql
has title: Database connectivity error in my Swing application as cast to statement
has body: This is my code. I am getting error as cast to statement in the statement line: Statement st=null; Connection con=null; Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost/mydb","root",""); st=(Statement) con.createStatement(); How to overcome this?
has comment: http://stackoverflow.com/comment/33130328
type: Question
score: 0
answer count: 1
tagged with: compiler-errors
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21880785
tagged with: swing
tagged with: java

http://stackoverflow.com/q/21910529
tagged with: exploit
possible better answer: http://stackoverflow.com/a/21910756
has title: Reflection improvements to access field secret, when field type is unknown
has comment: http://stackoverflow.com/comment/33183635
has answer: http://stackoverflow.com/a/21910756
score: 0
accepted answer: http://stackoverflow.com/a/21913481
has answer: http://stackoverflow.com/a/21911346
type: AnsweredQuestion
has body: I am learning about Security and looking at storing secrets in the clear. When I retrieve the contents of a private field, it returns an Object. My mal code correctly assumes and casts the Object as an int, however if I change/parse the field type from int secretInt = 42; to String secretInt = (new Integer(42).intValue()).tostring the Mal code fails miserably. EDIT: The unusual wrapping (new Integer(42).intValue()).tostring is created by a automated parser, it is not written by a programmer. how can I add robustness to Mal code so the assumption of the returned type is removed. Is this possible? I need to use this value as int param. EDIT: 'String' is one example but the parser may choose a data-structure as suitably-inappropriate as byte[], char[]. This is my non-compliant code. public final class SecretInClear implements Check4SecretsInClear { //Non-Compliant: Secret int stored in Clear. private final int secretInt = 42; @Override public boolean isSecretInt(int check) { return (check == secretInt); } } This is my mal code. public class ReadClearSecret implements Tester { //Example of running public static void main(String[] args) { String testResult = new ReadClearSecret().test(new SecretInClear()); System.out.println(testResult); } private Object readPrivateField(Object o, String fieldName) { try { Field field = o.getClass().getDeclaredField(fieldName); field.setAccessible(true); return field.get(o); } catch(Exception e) { throw new IllegalArgumentExecption(e); } @Override public String test(final Object secretChecks) { final Check4SecretsInClear check4SecretsInClear = (Check4SecretsInClear)secretChecks; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("class:"). append(check4SecretsInClear.getClass().getSimpleName()); boolean bSecretInt = false; String s = ""; try { int secretInt = (Integer)readPrivateField(check4SecretsInClear,"secretInt"); //<<< HERE! It's cast as an integer!!! bSecretInt = check4SecretsInClear.isSecretInt(secretInt); //…
tagged with: reflection
has comment: http://stackoverflow.com/comment/33183780
tagged with: refactoring
tagged with: java
has comment: http://stackoverflow.com/comment/33184359
has comment: http://stackoverflow.com/comment/33183548
type: Question
has comment: http://stackoverflow.com/comment/33183696
answer count: 3
has answer: http://stackoverflow.com/a/21913481
has comment: http://stackoverflow.com/comment/33183944
tagged with: security

jsch
tags question: http://stackoverflow.com/q/21952467
tag name: jsch
tags question: http://stackoverflow.com/q/21870962
tags question: http://stackoverflow.com/q/21891498
type: Tag

http://stackoverflow.com/a/21943262
has comment: http://stackoverflow.com/comment/119759018
downvote count: 0
answers question: http://stackoverflow.com/q/21943169
has body: Internally, both loops compile to the same machine code. The existence of two ways to repeat execution of code stems from two different use cases for each of them: for loops are usually used to iterate through a finite collection of identical objects, processing them in the same way. while loops, on the other hand, are slightly more versatile, and are usually used to repeat a piece of code until a condition is fulfilled. For example, in this piece of pseudocode: while(document.nextLine()) document.doStuff(); the while loop iterates through the lines of a document, and processing each line. It is not known in advance how many lines are there. This could not be done easily in a for loop, where you need to know in advance when you are going to stop.
upvote count: 2
has comment: http://stackoverflow.com/comment/33241900
type: Answer
score: 2

http://stackoverflow.com/a/21931584
has comment: http://stackoverflow.com/comment/33222402
has body: Don't store your coordinates in a HashMap. It would be difficult to store multiple coordinates with the key (latitude?) being the same. e.g. a simple Map&lt;Integer, Integer&gt; would only hold one longitude value for a latitude, and that would prevent your route from having multiple destinations along the same longitude line. I would rather use: List&lt;Coord&gt; where Coord is your lat/long pair. The List will preserve order, whereas a normal HashMap wouldn't. Note that I'm deliberately encapsulating the lat/long pair as a specific object. You could store it as a tuple of integers but I'd rather a specific object to enforce typing, permitting addition of functionality etc. As noted elsewhere, Java is an OO language and you shouldn't shy from creating classes to represent these concepts (a sign that you should do this is when you create something like Map&lt;String,List&lt;Integer,Integer&gt;&gt;)
type: Answer
score: 2
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21931488
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21931488
has comment: http://stackoverflow.com/comment/33221193

http://stackoverflow.com/comment/33367084
score: 0
comment on: http://stackoverflow.com/q/21912690
type: Comment
type: QuestionComment
has text: Use File.separator instead of hardcoding "/" otherwise it won't work in Unix.

user32
type: Tag
tag name: user32
tags question: http://stackoverflow.com/q/21962086

http://stackoverflow.com/comment/33330600
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21992951
has text: Start by understanding [what a `synchronized` block does](http://docs.oracle.com/javase/tutorial/essential/concurrency/locksync.html) and what `getClass()` returns. You should also understand what a `.class` literal is.

http://stackoverflow.com/comment/34850336
comment on: http://stackoverflow.com/a/21850690
type: Comment
has text: The thing is, my experience so far has been in line with his answer. For example, if the speed is mostly determined by I/O, why does a multithreaded lbzip2 (that is implementing, I believe, a more CPU-intensive algorithm) typically takes less than half the time of zip/unzip in either direction? Or why does a copy operation between the same file systems take much less than that? Also, we do not know how fast is the disk of the person who originally answered the question: what if it's a RAM drive? I'll do some more testing though.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33260333
score: 0
comment on: http://stackoverflow.com/q/21953465
type: Comment
type: QuestionComment
has text: It seems quite clear that you don't have the precise index the error is calling for. What about that is confusing you?

http://stackoverflow.com/a/21861287
upvote count: 1
downvote count: 0
has body: Do you mean this applet? What is the java version you are using? Do you use an jnlp file (like this one)? In the latest java update 7u51 (1.7.0_51) by default you are not able to run self signed applets anymore. So what can you do? Use an official certificate OR Decrease the security level in your system properties\Java\Security to medium OR Add your page to the exception site list Here is an overview of what changed in the latest java version. Important for you is especially the permissions Manifest attributes (because it is not set in the jssc.jar nor in the jSSC-Terminal.jar file) Regarding the message with the mixed security could it be that you only signed your applet.jar and not the 3rd party libs (like jssc.jar)?
type: Answer
answers question: http://stackoverflow.com/q/21841991
score: 1

http://stackoverflow.com/comment/33266720
comment on: http://stackoverflow.com/a/21956984
type: AnswerComment
has text: @zibi The constructor demands that the list have at least 3 items.
score: 0
type: Comment

http://stackoverflow.com/q/21963781
score: 0
has comment: http://stackoverflow.com/comment/33279280
answer count: 2
has title: Java sorting text file with Comparable
favorite count: 0
has answer: http://stackoverflow.com/a/21963906
type: UnansweredQuestion
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/33279992
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21966675
has body: I need a program that reads in data and sorts the file in descending order using quicksort based on the index provided for instance this is the data using comparable adviser,32/60,125,256,6000,256,16,128,198,199 amdahl,470v/7,29,8000,32000,32,8,32,269,253 amdahl,470v/7a,29,8000,32000,32,8,32,220,253 amdahl,470v/7b,29,8000,32000,32,8,32,172,253 amdahl,470v/7c,29,8000,16000,32,8,16,132,132 And i need to sort by the 5th index(mmax) case 2 and the 6th(cache) case 3 and the ninth index(php) case 4 in descending order &amp; print the first index which is already sorted case 1 The problems with my code are as follows: It doesn't sort based off the index It gives me an error at runtime with the code: Arrays.sort(c); Please help with suggestions Thanks import java.io.File; import java.io.FileNotFoundException; import java.util.Arrays; import java.util.Scanner; public class Prog4 { static Scanner input; static File filename; /** * This function displays the menu for the user to choose an option from */ public void menu() { System.out.println("Option 1: Sort by VENDOR: "); System.out.println("Option 2: Sort decreasing number by MMAX: "); System.out.println("Option 3: Sort decreasing number by CACH: "); System.out.println("Option 4: Sort decreasing number by PRP: "); System.out.println("Option 5: Quit program"); } /** * Constructor to handle the cases in the menu options * @throws FileNotFoundException * @throws IOException */ public Prog4() throws FileNotFoundException { //Accepts user input Scanner in = new Scanner(System.in); //calls the menu method menu(); //Initializes the run variable making the program loop until the user terminates the program Boolean run = true; //While loop while (run) { switch (in.nextInt()) { case 1: System.out.println("Option 1 selected"); System.out.println("Sorted by vendor:"); filename = new File("machine.txt"); //Instantiate Scanner s with f variable within parameters //surround with try and catch to see whether the file was read or not try { i…
tagged with: sorting

http://stackoverflow.com/a/22003830
type: AcceptedAnswer
has body: Hovercraft Full Of Eels is correct. You need to re-think what you are trying to do, it is a nasty waste of resources, and is a disaster waiting to happen. You would be better to create a glass pane that can capture action events and trigger actions depending on their co-ordinates. That would use a single action listener, rather than what you want with over 1000 action listeners. If you want visual effects, then simply override the paint(Graphics g) method of the container that you want to put the buttons into: Performing Custom Painting However the following demonstrates what you have asked for. It uses a for loop to create a grid of buttons in a GridLayout, but i strongly recommend against it: public static void createGrid(JPanel panel, int numberOfRows, int numberOfColumns) { panel.setLayout(new GridLayout(numberOfRows, numberOfColumns)); for (int c = 0; c &lt; numberOfColumns; c++) { for (int r = 0; r &lt; numberOfRows; r++) { JButton button = new JButton(); button.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { //Add your code here for action event } }); panel.add(button); } } }
accepted answer of: http://stackoverflow.com/q/22002646
answers question: http://stackoverflow.com/q/22002646
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/33125940
type: QuestionComment
comment on: http://stackoverflow.com/q/21878302
has text: We want to help you, but without a specific question we can't do anything. Please post your code (working or not), and specify the exact problem.
score: 0
type: Comment

http://stackoverflow.com/q/21904290
has answer: http://stackoverflow.com/a/21905806
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21904600
has comment: http://stackoverflow.com/comment/33172552
score: 0
type: UnansweredQuestion
has body: I am trying to execute the below code String command="cmd /c ls"; String location="C:\\project"; final Process process = Runtime.getRuntime().exec( dosCommand + " " + location); I am getting the files, but when I run the cmd /c java I didn't get the output. my Java home is added to environment variables. When I give Java in command prompt I am getting the Java related files. I am not getting through my program.
has title: How to run Java command through code?
tagged with: java
has comment: http://stackoverflow.com/comment/33172990
has comment: http://stackoverflow.com/comment/33172720

http://stackoverflow.com/a/21865457
has comment: http://stackoverflow.com/comment/33103666
has comment: http://stackoverflow.com/comment/33103578
score: 0
has body: You could try this: If the length of the mask is greater than the length of the input, take the difference and add that many plus signs to the front of the input.
type: Answer
has comment: http://stackoverflow.com/comment/33103543
answers question: http://stackoverflow.com/q/21865314

http://stackoverflow.com/a/64167318
has comment: http://stackoverflow.com/comment/113507701
score: 0
has comment: http://stackoverflow.com/comment/113475062
has body: #Binary Heap with all the common operations """This Code will generate Min Binary Heap with all action that we can perform on Binary Heap. The Formula i have taken is in array 0'th position will be None, Will start from 1'st Position. So root will be at 1 ant left will be at 2x(2) right will be 2x+1(3) Position. """ class MinHeap(): """ Min Heap:-Node values will always be lees than the left and right child """ def __init__(self): #Creating a Array to push heap values self.heap_list=[None] def push_element(self,value): self.heap_list.append(value) #Getting right child from postion 2x def get_left_child(self,index): for i in range(len(self.heap_list)): if i==2*index: return self.heap_list[2*index] return 999 #Getting right child from postion 2x+1 def get_right_child(self,index): for i in range(len(self.heap_list)): if i==2*index+1: return self.heap_list[2*index+1] return 999 # I have considered a logic node if node will on x index then left child woul bw at 2*x and right child will be at 2*x+1 postion in array def re_construct_heap(self): for i in range(1,(len(self.heap_list)//2)+1): left_child=self.get_left_child(i) right_child=self.get_right_child(i) if self.heap_list[i]>left_child : v_parent=self.heap_list[i] self.heap_list[i]=left_child self.heap_list[2*i]=v_parent elif self.heap_list[i]>right_child: v_parent=self.heap_list[i] self.heap_list[i]=right_child self.heap_list[2*i+1]=v_parent #Re cunstructing heap till the heap property satisfies def build_min_heap(self): for i in range(len(self.heap_list)//2, 0, -1): self.re_construct_heap() #Deleing a root node and trying to rebuild Min Heap with heap property def delte_node_heap(self,value): if self.heap_list[1]==value: self.heap_list[1]=self.heap_list[-1] self.heap_list.pop(-1) self.build_min_heap() #Min Value of Heap def min_value(self): return self.heap_list[1] #Max Value of Heap def max_value(self): return self.heap_list[-1] #size of heap def size_of_heap(self): return len(self.heap_list) #Printin Heap Values de…
type: Answer
answers question: http://stackoverflow.com/q/21863609

hibernate-validator
tags question: http://stackoverflow.com/q/21961239
tags question: http://stackoverflow.com/q/21874349
tags question: http://stackoverflow.com/q/21894079
type: Tag
tags question: http://stackoverflow.com/q/21947796
tags question: http://stackoverflow.com/q/21969909
tags question: http://stackoverflow.com/q/21954488
tags question: http://stackoverflow.com/q/21986871
tag name: hibernate-validator

http://stackoverflow.com/q/21927431
favorite count: 0
tagged with: encryption
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34277614
has body: I need to convert encrypted image stored in byte[] to BufferedImage. I used the following code: InputStream in = new ByteArrayInputStream(imageInByte); BufferedImage bImageFromConvert = ImageIO.read(in); But bImageFromConvert is null. I googled and found the reason that its because the image is encrypted ImageIO can't read it. The solutions suggested in stack overflow is to decrypt the image and then convert. But it is not applicable in my case because i need to embed a message in this encrypted image and for that iam using the code below: public class EmbedMessage { //BufferedImage sourceImage,embeddedImage; public static BufferedImage embedMsg(BufferedImage sourceImage,String mess) { //String mess = "hai"; BufferedImage embeddedImage = sourceImage.getSubimage(0,0, sourceImage.getWidth(),sourceImage.getHeight()); embedMessage(embeddedImage, mess); return embeddedImage; } private static void embedMessage(BufferedImage img, String mess) { int messageLength = mess.length(); int imageWidth = img.getWidth(), imageHeight = img.getHeight(), imageSize = imageWidth * imageHeight; if(messageLength * 8 + 32 &gt; imageSize) { return; } embedInteger(img, messageLength, 0, 0); byte b[] = mess.getBytes(); for(int i=0; i&lt;b.length; i++) embedByte(img, b[i], i*8+32, 0); } private static 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 static 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=sta…
has title: Converting encrypted image in byte[] to BufferedImage in java without decrypting
has answer: http://stackoverflow.com/a/22449445
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22449445
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33213749

http://stackoverflow.com/comment/33164130
has text: Think about how recursion works -- you push the current state onto the program stack, process the new subset of the data, return the result to the caller, pop the previous state back off the stack and continue. All you're really doing in this exercise is to replace call/return with push-iterate-pop.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21897184

http://stackoverflow.com/comment/33242058
comment on: http://stackoverflow.com/q/21942861
has text: You don't need to import it, you said yourself that both classes are in the same package. It's not recognizing it because `new Derived()` is NOT the same as `new derived()`. Capitalization matters in Java, and your class name is lower case, while you're trying to make an object with upper case. Derived should be capitalized in the file name, class name, constructor, and ANY calls to the constructor.
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/33177070
has text: have you tried with somecodes or find in Google or in SO ? I think there has many sample useful codes. Or post your codes these had you tried.
score: 1
comment on: http://stackoverflow.com/q/21906899
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21978666
has comment: http://stackoverflow.com/comment/33305849
has comment: http://stackoverflow.com/comment/33305819
type: Question
score: -1
has answer: http://stackoverflow.com/a/21978675
tagged with: types
downvote count: 1
answer count: 1
has body: I am trying to create a computer generated Black Jack that shuffles 54 cards and displays them along with the score and if the person gets blackjack or not. I keep on getting this error and I have no idea why, if anyone can help, that would be great (: import java.awt.GridLayout; import java.util.Random; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; public class DisplayCards extends JFrame { public DisplayCards() { int cardCount = 54; Random ran = new Random(); setLayout(new GridLayout(1,4,5,5)); //Generate 3 random numbers for(int i=0;i&lt;3;i++){ int imageId = ran.nextInt(cardCount)+1; int blackjack = 0, result = 0; add(new JLabel(new ImageIcon("image/card/"+imageId+".png"))); switch (imageId) { case 1: blackjack = 1; case 2: blackjack = 2; case 3: blackjack = 3; case 4: blackjack = 4; case 5: blackjack = 5; case 6: blackjack = 6; case 7: blackjack = 7; case 8: blackjack = 8; case 9: blackjack = 9; case 10: blackjack = 10; case 11: blackjack = 10; case 12: blackjack = 10; case 13: blackjack = 10; case 14: blackjack = 1; case 15: blackjack = 2; case 16: blackjack = 3; case 17: blackjack = 4; case 18: blackjack = 5; case 19: blackjack = 6; case 20: blackjack = 7; case 21: blackjack = 8; case 22: blackjack = 9; case 23: blackjack = 10; case 24: blackjack = 10; case 25: blackjack = 10; case 26: blackjack = 10; case 27: blackjack = 1; case 28: blackjack = 2; case 29: blackjack = 3; case 30: blackjack = 4; case 31: blackjack = 5; case 32: blackjack = 6; case 33: blackjack = 7; case 34: blackjack = 8; case 35: blackjack = 9; case 36: blackjack = 10; case 37: blackjack = 10; case 38: blackjack = 10; case 39: blackjack = 10; case 40: blackjack = 1; case 41: blackjack = 2; case 42: blackjack = 3; case 43: blackjack = 4; case 44: blackjack = 5; case 45: blackjack = 6; case 46: blackjack = 7; case 47: blackjack = 8; case 48: blackjack = 9; case 49: blackjack = 10; case 50: blackjack = 10; case 51: blackjack = 10; case 52: blackjack = 10; …
tagged with: variables
favorite count: 0
type: UnansweredQuestion
has title: Getting an error that says: found value, required variable in Java
upvote count: 0
tagged with: blackjack
tagged with: java

jakarta-mail
tags question: http://stackoverflow.com/q/21856211
tags question: http://stackoverflow.com/q/21925529
tags question: http://stackoverflow.com/q/21941535
tags question: http://stackoverflow.com/q/21918007
tags question: http://stackoverflow.com/q/21889718
tags question: http://stackoverflow.com/q/21857975
tag name: jakarta-mail
tags question: http://stackoverflow.com/q/22002170
tags question: http://stackoverflow.com/q/21884126
type: Tag
tags question: http://stackoverflow.com/q/21912626
tags question: http://stackoverflow.com/q/21991928
tags question: http://stackoverflow.com/q/21907341
tags question: http://stackoverflow.com/q/21959235
tags question: http://stackoverflow.com/q/22004787
tags question: http://stackoverflow.com/q/21852582
tags question: http://stackoverflow.com/q/21985674
tags question: http://stackoverflow.com/q/21992901
tags question: http://stackoverflow.com/q/21979688

http://stackoverflow.com/comment/33294508
comment on: http://stackoverflow.com/q/21972168
score: 0
type: Comment
has text: Are you trying to add selected items to a arraylist or just all the items in the jList at once?
type: QuestionComment

http://stackoverflow.com/comment/33504951
type: AnswerComment
has text: @AndréSchild Thanks for suggesting me some good solutions.Will give a try!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21984687

http://stackoverflow.com/comment/33285008
comment on: http://stackoverflow.com/a/21966867
type: Comment
score: 1
has text: Imports are only used in class in which they are placed. If you want to use `Exceptions` class from `MyProject.MyExceptions` in other classes you need to include them there as well.
type: AnswerComment

http://stackoverflow.com/a/21912325
has comment: http://stackoverflow.com/comment/33186961
type: Answer
answers question: http://stackoverflow.com/q/21912219
has comment: http://stackoverflow.com/comment/33187654
has comment: http://stackoverflow.com/comment/33186921
has body: I would have an enum like so: enum Kind { GREEN { @Override public void doSomething() { GreenKind.doSomething(); } }, WHITE { @Override public void doSomething() { WhiteKind.doSomething(); } }; public abstract void doSomething(); } And pass around an enum constant, for example this method: public static void invoke(Kind kind) { kind.doSomething(); } and call it like: invoke(Kind.GREEN); This way looks cleaner, and moreover it's safer, as you can have only a fixed set of inputs.
accepted answer of: http://stackoverflow.com/q/21912219
upvote count: 15
has comment: http://stackoverflow.com/comment/33187177
score: 15
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33094055
comment on: http://stackoverflow.com/q/21859981
score: 0
type: Comment
type: QuestionComment
has text: I am sorry to say that, but your "example code" made me laugh. If I may rephrase your question: *I want to build a complex enterprise project and I already have a Java Hello World program. Please provide the rest!* xD I would usually add a few helpful links to tutorials too, but there are already some helpful answers.

http://stackoverflow.com/comment/33182435
type: Comment
type: QuestionComment
has text: how did you get the error? what is your code?
comment on: http://stackoverflow.com/q/21909165
score: 0

http://stackoverflow.com/a/21917580
type: Answer
answers question: http://stackoverflow.com/q/21916653
has body: The nicety of C++ is the aliasing, changing a passed variable. Here the same effect can be reached by using a function result. public Element&lt;T&gt; recursiveReverse(Element&lt;T&gt; currElement) { if (currElement == null) return null; Element&lt;T&gt; rest = currElement.next; if (rest == null) return currElement; Element&lt;T&gt; reversed = recursiveReverse(rest); rest.next = currElement; currElement.next = null; return reversed; } In java one normally declares at first usage. And I find rest.next more clear than first.next.next.
has comment: http://stackoverflow.com/comment/33202842
has comment: http://stackoverflow.com/comment/33198810
score: 0

http://stackoverflow.com/q/21944450
answer count: 2
has comment: http://stackoverflow.com/comment/33244111
has answer: http://stackoverflow.com/a/21944531
has answer: http://stackoverflow.com/a/21944974
score: 0
has comment: http://stackoverflow.com/comment/33244148
tagged with: java.util.scanner
has title: Problems with reading a file in java
type: UnansweredQuestion
tagged with: file
has body: I'm doing a project for a class, but for the life of me I'm having the hardest time figuring out how to read text from a file. We have to create a traffic light that queues trucks and cars coming from North, South, East, and West. It's been a long time since I've done any coding, so I'm struggling immensely. I think it just reads the memory location. Here's my code for reading in a file. package Project1; import java.io.*; import java.util.*; public class TrafficSim { public String input; public TrafficSim(String input) { this.input = input; readFromFile(); } private boolean readFromFile() { File inputText = new File("input1.txt"); try { Scanner scan = new Scanner(inputText); while(scan.hasNextLine()) { String direction = scan.nextLine(); int num = scan.nextInt(); } } catch(FileNotFoundException e) { e.printStackTrace(); } return false; } public static void main(String[] args) { // TODO Auto-generated method stub TrafficSim sim = new TrafficSim("input1.txt"); System.out.println(sim); } }
has comment: http://stackoverflow.com/comment/33244239
tagged with: java
type: Question

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

http://stackoverflow.com/q/21896919
has body: I am creating a flappy bird esque minigame. For some reason there is an error when I try to enter my actual "playing" state from the "menu" state and the "level" state holds it all together, a new error is thrown as it was working before. Any help would be greatly appreciated, thanks! Level state: holds it all together: package gamepackage; import org.newdawn.slick.*; import org.newdawn.slick.state.*; public class level extends StateBasedGame{ public static final String gamename = "Flight 1.0 "; public static final int menu = 0; public static final int playing = 1; public level(String gamename){ super(gamename); this.addState(new Menu(menu)); this.addState(new Playing(playing)); } public void initStatesList(GameContainer gc)throws SlickException{ this.getState(menu).init(gc, this); this.getState(playing).init(gc, this); this.enterState(menu); } public static void main(String args[]){ AppGameContainer appgc; try{ appgc = new AppGameContainer(new level(gamename)); appgc.setDisplayMode(800, 550, false); appgc.start(); }catch(SlickException e){ e.printStackTrace(); } } } My Menu State: Is where the player clicks play to enter the "playing" state: package gamepackage; import org.lwjgl.input.Mouse; import org.newdawn.slick.*; import org.newdawn.slick.state.*; public class Menu extends BasicGameState{ Image play; int xpos = Mouse.getX(); int ypos = Mouse.getY(); public Menu(int state){ } public void init(GameContainer gc, StateBasedGame sbg)throws SlickException{ play = new Image("res/play.jpg"); } public void render(GameContainer gc, StateBasedGame sbg, Graphics g)throws SlickException{ g.drawImage(play, 0, 0); } public void update(GameContainer gc, StateBasedGame sbg, int delta)throws SlickException{ Input input = gc.getInput(); if((xpos &gt;= 0 &amp;&amp; xpos &lt;= 127) &amp;&amp; (ypos&gt;= 0 &amp;&amp; ypos &lt;= 33)){ if(input.isMouseButtonDown(0)){ sbg.enterState(1); } } } public int getID(){ return 0; } } Playing State, where the gameplay occurs: package gamepacka…
has title: Enter State error, Slick2d
downvote count: 1
type: Question
tagged with: graphics
score: -1
has comment: http://stackoverflow.com/comment/33161092
tagged with: state
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: flappy-bird-clone
has answer: http://stackoverflow.com/a/21897471
tagged with: java
tagged with: slick2d

http://stackoverflow.com/comment/33151287
comment on: http://stackoverflow.com/a/21891886
score: 0
has text: Thanks i added a private int spinnerField; with the getters and setters, but for some reason it is still showing up as unkown property
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21864216
has comment: http://stackoverflow.com/comment/33101274
has body: I want to have a linked list containing an object Here we have the class. It is simple and only has a String and one int. Called s and n respectively. public class test { String string = new String (); int n; public metodo (String string, int n ){ sets(string); setn(n); } public void sets(String string){ this.string = string; } public void setn(int n){ this.n = n; } public String gets(){ return string; } public int getn(){ return n; } } In each node there will be an instance of the class test. I want to be able to call each node and then call the object in the node calling the class test. Here is my linked list import java.io.*; public class Node { BufferedReader br = new BufferedReader( new InputStreamReader ( System.in)); test m; int n; static Node next = null; String string = new String (); Nodo head = null; public Nodo (test m, Nodo next) { this.next = next; } public void hoho() throws IOException{ while ( true ) { // This loop is for making several nodes with diferent information System.out.println("String"); string n = br.readLine(); System.out.println(" Int "); n = Integer.parseInt(br.readLine()); m = new test(string, n); Nodo nod = new Nodo (m, null); Nodo.siguiente = head; head = nod; if ( n == 0 ){ // Manual close of the loop by inserting 0 break; } } } } Now I don't really know when to start the object m, if in the start or in the while.
has comment: http://stackoverflow.com/comment/33110434
score: 0
has title: How to make a linked list holding objects
type: UnansweredQuestion
tagged with: object
tagged with: linked-list
answer count: 0
tagged with: java
type: Question

http://stackoverflow.com/a/21951917
accepted answer of: http://stackoverflow.com/q/21940410
has comment: http://stackoverflow.com/comment/63692625
score: 3
has comment: http://stackoverflow.com/comment/33373364
has body: By default Nav uses Windows Active Directory authorization. I'm not sure what wsimport do in java but credentials provided in url unlikely to work. You need to go through negotiation procedure to authorize with server or change authorization type in Nav Server Administration snap-in on server (or in configuration file). See here about credential types and here is how to configure server. Also see usefull post in Freddy's blog on how to connect to Nav from Java (I believe its still relevant though it's for Nav 2009). soapUI can handle NTLM authorization type so you can see all requests and responses through negotiation process in it's logs.
has comment: http://stackoverflow.com/comment/33373849
type: AcceptedAnswer
upvote count: 3
has comment: http://stackoverflow.com/comment/63702684
has comment: http://stackoverflow.com/comment/63662644
type: Answer
answers question: http://stackoverflow.com/q/21940410
has comment: http://stackoverflow.com/comment/63632493
has comment: http://stackoverflow.com/comment/63649879
downvote count: 0

http://stackoverflow.com/comment/33341693
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21998827
type: QuestionComment
has text: NullPointerException is Thrown when trying to access something uninitialized. Check What is there

http://stackoverflow.com/q/21895084
tagged with: java
favorite count: 0
tagged with: loops
type: Question
tagged with: for-loop
has answer: http://stackoverflow.com/a/21895191
score: -1
has answer: http://stackoverflow.com/a/21895115
accepted answer: http://stackoverflow.com/a/21895115
downvote count: 2
has comment: http://stackoverflow.com/comment/33157113
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/21895133
has body: This is a homework assignment. I am prompting the user to input any amount of numbers, followed by a word. Because I do not know the amount of numbers that will be input, I am storing them in a String[], then moving them to an ArrayList. I am storing the input correctly into the String[] by splitting the scanner input at white spaces. Now I am attempting to add the contents of a String[] into an ArrayList with the following: int i = 0; for ( i = 0; i &lt; inputToStringArray.length; i++) { if(values.add(Double.parseDouble(inputToStringArray[i]))){ //if you can parse a double, parse a double values.add(Double.parseDouble(inputToStringArray[i])); } } Because I do not want the word at the end of the input, I am parsing the String[] for doubles. Problem is, the ArrayList copies each number, storing it twice consecutively. An input of 1, 2.2, 3.3 will store as 1.0, 1.0, 2.2, 2.2, 3.3, 3.3. Why?
possible better answer: http://stackoverflow.com/a/21895133
has comment: http://stackoverflow.com/comment/33157062
has title: Why is this for loop doubling the size of my ArrayList?
type: AnsweredQuestion

http://stackoverflow.com/q/21854085
has body: This is my source code WebDriver driver = new HtmlUnitDriver(true); driver.get("http://www.example.com"); Cookie cookie = new Cookie("key", "value"); driver.manage().addCookie(cookie); Set&lt;Cookie&gt; allCookies = driver.manage().getCookies(); for (Cookie loadedCookie : allCookies) { System.out.println(String.format("%s -&gt; %s", loadedCookie.getName(), loadedCookie.getValue())); } The request header to server doesn't contain the cookie. If I change the position of the get() method after addCookie(), the getCookies() will return empty. I try it all day long. no matter how I google it, i can't find any way to solve my problem Hope somebody can help me! I'll appreciate your help!
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21854306
tagged with: selenium
tagged with: request
has title: How to set request cookies using selenium webdriver?
tagged with: cookies
tagged with: java
type: Question
answer count: 1

http://stackoverflow.com/q/21906736
has answer: http://stackoverflow.com/a/74512319
upvote count: 9
has comment: http://stackoverflow.com/comment/33216366
has answer: http://stackoverflow.com/a/21936624
answer count: 3
possible better answer: http://stackoverflow.com/a/41741060
has answer: http://stackoverflow.com/a/41741060
downvote count: 0
accepted answer: http://stackoverflow.com/a/21936624
tagged with: jvm
favorite count: 0
tagged with: bamboo
has body: When I set GRADLE_OPTS or JAVA_OPTS, these are set for GradleWrapperMain when I run ./gradlew build for my project. But I need them to be set for GradleWorkerMain as well. How do I do that? Here's the ps listing when that Gradle job is running in Bamboo. My JAVA_OPTS (such as -Dcool.opt=1) is missing from GradleWorkerMain. 53854 ? Sl 2:13 /home/apps/jdk7/bin/java -Dorg.gradle.daemon=false -Dcool.opt=1 -Xms1g -Xmx8g -XX:PermSize=256m -XX:MaxPermSize=768m -Djava.security.egd=file:/dev/./urandom -Dorg.gradle.appname=gradlew -classpath /path/to/gradle/wrapper/gradle-wrapper.jar org.gradle.wrapper.GradleWrapperMain build 54272 ? Sl 0:19 /home/apps/jdk1.7.0_45/bin/java -Dfile.encoding=ISO-8859-1 -cp /path/to/lots/of/jars.jar org.gradle.process.internal.launcher.GradleWorkerMain
type: AnsweredQuestion
tagged with: java
has title: How do I set JVM options for GradleWorkerMain?
tagged with: gradle
has comment: http://stackoverflow.com/comment/33189123
score: 9
type: Question

http://stackoverflow.com/comment/33349799
score: 0
has text: If there will ever be more than 4 numbers, you should look into arrays
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22003417

http://stackoverflow.com/a/21935895
has comment: http://stackoverflow.com/comment/76085572
has comment: http://stackoverflow.com/comment/76089268
type: Answer
has comment: http://stackoverflow.com/comment/33232286
accepted answer of: http://stackoverflow.com/q/21935598
downvote count: 0
answers question: http://stackoverflow.com/q/21935598
has comment: http://stackoverflow.com/comment/76099299
score: 3
upvote count: 3
has body: Here is some sample code, provided you use Java 7: @DataProvider public Iterator&lt;Object[]&gt; testData() throws IOException { final List&lt;Object[]&gt; list = new ArrayList&lt;&gt;(); for (final String line: Files.readAllLines(Paths.get("whatever"), StandardCharsets.UTF_8) list.add(new Object[]{ line, process(line) }; return list.iterator(); } private static Whatever process(final String line) { // whatever }
has comment: http://stackoverflow.com/comment/33232086
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33320930
has comment: http://stackoverflow.com/comment/33232207

http://stackoverflow.com/comment/33298676
type: QuestionComment
has text: java has not function.
comment on: http://stackoverflow.com/q/21974786
score: 0
type: Comment

http://stackoverflow.com/comment/33231115
has text: It seems to be a question of definition. So it would be the next logic step to ask the person/organisation that use the term what **their** understanding is instead of asking a bunch of strangers on the web without linking the respective source.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21937170

http://stackoverflow.com/a/38980224
upvote count: 2
answers question: http://stackoverflow.com/q/21940693
has body: You can simply call reduce to add directly in the bigdecimal rather than converting into long. list.parallelStream() .filter(n -&gt; n.mod(new BigInteger("2")).equals(BigInteger.ZERO)) .reduce(BigDecimal.ZERO, BigDecimal::add)
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/33351114
comment on: http://stackoverflow.com/q/22004125
score: 0
type: Comment
type: QuestionComment
has text: Correct, you can't access `x` directly in the subclass because it's declared `private` in the parent.

http://stackoverflow.com/comment/42573514
score: 0
comment on: http://stackoverflow.com/q/21909617
type: Comment
type: QuestionComment
has text: Is it a type or error that your package path is misspelled in -outdir? Have you tried to compare generated .cpp files with some diff utility? Is difference is truly only in package names or is there something else? And final question: that is the point of crash in java/swig generated file, you can find some hints from the stack.

http://stackoverflow.com/comment/33122127
score: 0
type: AnswerComment
has text: @Suresh look at your previous post. It shows how to load am image. You're making the same mistake your were before.
comment on: http://stackoverflow.com/a/21874284
type: Comment

http://stackoverflow.com/a/52761204
has body: I got this error when using Spring Boot 2.0.5 with Hibernate on Java 11 (JDK11). To fix it, I had to force an upgrade of the javassist library (this is for Gradle): compile('org.javassist:javassist:3.23.1-GA') {force = true} For more info on migrating to JDK11, I found this blog post useful. Alternatively, upgrading to Spring Boot to 2.1 will fix this issue.
has comment: http://stackoverflow.com/comment/121441894
type: Answer
answers question: http://stackoverflow.com/q/21951895
downvote count: 0
upvote count: 8
score: 8

http://stackoverflow.com/comment/33227808
comment on: http://stackoverflow.com/q/21935589
has text: what does `tar -tvf C:\\tarFile` show you ?
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/33331510
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21968661
score: 0
has text: Have you seen following article: http://www.ibm.com/developerworks/websphere/techjournal/0609_alcott/0609_alcott.html

http://stackoverflow.com/q/21886142
score: 0
has body: I made a web app with a ServletContextListener that in its contextInitialized() just calls two methods from two jars. The jars use log4j to print logs in its execution, what is useful for me on testing. Now, I package this app in an ear file, and deploy into a WAS, that is located into a server to which I don't have access (meaning, I can't access FTP to see paths on the server, etc) to set the path for the logs in the server, and it will take some time to get actual permission to set this. I thought that maybe I could set log4j to print the logs in my working machine (that is also connected to the network the server is connected) Is there anyway to do this?
tagged with: ear
answer count: 1
tagged with: log4j
type: UnansweredQuestion
has title: Can i write log to another machine in the network?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21886756

http://stackoverflow.com/comment/33239213
type: QuestionComment
comment on: http://stackoverflow.com/q/21941777
type: Comment
has text: The enum is massive in my code, so that makes it more readable. I copied it from my code and removed the noise but didn't change that. Fixed it here now.
score: 0

http://stackoverflow.com/comment/33113356
type: QuestionComment
score: 0
has text: You have to unload the sound when switching scenes
type: Comment
comment on: http://stackoverflow.com/q/21870800

http://stackoverflow.com/comment/33131208
score: 0
has text: Enable Horizontal and vertical scrolling for ScrollView
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21881289

http://stackoverflow.com/q/21995617
possible better answer: http://stackoverflow.com/a/21995695
tagged with: arrays
has body: Is it possible to call 2D array in a method? JButton[][] buttons = new JButton[3][3]; int number = 0; for (int i = 0; i &lt; buttons.length; i++) { for (int j = 0; j &lt; buttons.length; j++){ buttons[i][j] = new JButton(); // create buttons frame.add(buttons[i][j]); buttons[i][j].setText("."); buttons[i][j].setName("button" + number); number++; } } I have tried this but it isn't working. private void test(buttons[i][j]) { } edited: And also, would I need to use the same way to call all the buttons in other places, say for example I have this. JButton[] button = {//call the array here of buttons here //}; Random rand = new Random(); JButton newbutton = button[rand.nextInt(button.length)]; I want to call all the buttons in the parameter of the button variable. the piece of code above will select one button at random by number of given buttons. for example, if i have; JButton[] button = {button1, button2, button3, button4, button5, button6}; given the code above, it will select from one of the buttons in the list and then put the chosen button in the variable newbutton. but since I have used an array, I can't have button1, button2, button and so on in the random selection. So I was wondering if it is possible to somehow call the array inside this array of button. I have tried this but it doesn't work. JButton[] button = {buttons[i][j]};
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21995740
type: Question
score: 0
tagged with: java
has title: Calling 2D array in method parameter java
accepted answer: http://stackoverflow.com/a/21995740
has answer: http://stackoverflow.com/a/21995695
has answer: http://stackoverflow.com/a/21995715
has answer: http://stackoverflow.com/a/21995710
answer count: 4

http://stackoverflow.com/q/21952041
possible better answer: http://stackoverflow.com/a/21956041
upvote count: 1
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/48939943
type: Question
linked to: http://stackoverflow.com/q/5399347
has answer: http://stackoverflow.com/a/21956041
has title: How to pass multiple values from the form to a controller using Spring MVC?
has body: I am working with Spring MVC pattern and I am trying to make a JSP file which is like this as of now - In the form, I have four rows, first row is just for labelling and other three rows I need to put my data in the text box. For example- for DC1, I will insert numServers value in the textbox, I will insert ipaddress value in the textbox and hostname value in the textbox. &lt;form method="post" enctype="multipart/form-data"&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;Datacenter Name&lt;/td&gt; &lt;td&gt;Number of Servers&lt;/td&gt; &lt;td&gt;IP Address(comma separated)&lt;/td&gt; &lt;td&gt;Host Name(comma separated)&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;label for="dc1"&gt;DC1&lt;/label&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="numservers" size="20"&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="ipaddress" size="60"&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="hostname" size="60"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;label for="dc1"&gt;DC2&lt;/label&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="numservers" size="20"&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="ipaddress" size="60"&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="hostname" size="60"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;label for="dc1"&gt;DC3&lt;/label&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="numservers" size="20"&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="ipaddress" size="60"&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="hostname" size="60"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td colspan="2"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;input type="submit"&gt; &lt;/form&gt; Now I am supposed to read these values after hitting the submit button as I will be typing necessary values in the textbox. I am using RequestMapping in my below code - @RequestMapping(value = "test", method = RequestMethod.GET) public HashMap&lt;String, String&gt; testRequest(@RequestParam MultiValueMap&lt;?, ?&g…
answer count: 3
has answer: http://stackoverflow.com/a/21952161
downvote count: 0
accepted answer: http://stackoverflow.com/a/21952161
favorite count: 0

http://stackoverflow.com/comment/33351058
type: Comment
has text: Any time you want to override a method, annotate it with `@Override`.
comment on: http://stackoverflow.com/q/22004125
score: 1
type: QuestionComment

http://stackoverflow.com/q/21842634
tagged with: printing
has comment: http://stackoverflow.com/comment/33062936
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/33063229
tagged with: count
accepted answer: http://stackoverflow.com/a/21842676
tagged with: tree
type: AnsweredQuestion
has body: public int countOccurrences(String target){ int count=0; node cursor=root; while(cursor!=null){ int compare=target.compareTo(cursor.word); if(compare==0) { //System.out.println("aa"); stuck in here count++; } else if(compare&gt;0) cursor=cursor.right; else cursor=cursor.left; } System.out.println(count); return count; } I want to find the occurrences of a word in a tree (that is already sorted in a lexicographic order). My code now keeps printing out "aa" all over the screen... help?
has title: How to count the occurrence of an element in a tree?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21842676
linked to: http://stackoverflow.com/q/21841283
score: 0

http://stackoverflow.com/comment/33073097
has text: Yes, I agree. If I have to do this across all the PIDs, how do I change my script?
type: Comment
comment on: http://stackoverflow.com/a/21848812
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33133324
type: QuestionComment
has text: the problem appears at midnight when log4j creates the new logfile
type: Comment
comment on: http://stackoverflow.com/q/21861944
score: 0

http://stackoverflow.com/comment/33297572
type: AnswerComment
type: Comment
has text: This code is wrong... The array should start at CMD[3] because there will be elements: a[0] = "my", a[1]="name", and a[2] = "is".
comment on: http://stackoverflow.com/a/21974165
score: 1

http://stackoverflow.com/a/21920364
answers question: http://stackoverflow.com/q/21920112
type: Answer
has body: I'm quite foggy on what your context is with this, but your draw() method uses a constructor to create a new instance of Recangle you do not have so far: private void draw() { if(isVisible) { Canvas canvas = Canvas.getCanvas(); canvas.draw(this, color, new Rectangle(xPosition, yPosition, width, height)); &lt;-- Problem canvas.wait(10); } } You could add to your class the needed constructor, something like this: public Rectangle(xPos, yPos, width, height) { this.height = height; this.width = width; this.xPosition = xPos; this.yPosition = yPos; color = "red"; isVisible = false; } This would make the error concerning your draw() method go away, but i'm not sure this is all you need to fix your problem. Can you give more context? I think your draw method should be rather looking something like this: private void draw() { if(isVisible) { Canvas canvas = Canvas.getCanvas(); canvas.drawRect(color, this.xPosition, this.yPosition, this.width, this.height); canvas.wait(10); } }
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/21998846
score: 1
upvote count: 1
has body: I have a loop which iterate for 10 times and in each time it executes some interrelated methods.So is there any solution that can do the same task parallaly for each instance of that loop. First thing to realize is that you don't have specific control over task to core mapping unless you utilize 3rd party libraries. In general you don't want to do this anyway -- just let the JVM be smart about it. To utilize all of the cores on your hardware, typically you change the number of threads in a fixed thread pool. You can use a cached thread pool which will increase the tasks depending on the number of tasks submitted to the ExecutorService. On modern JVMs and operating systems thrashing is less of a worry so this works well unless you are talking about 1000s of tasks. But typically I set a fixed number of threads in the pool. If the tasks are 100% CPU bound then I may set the number of threads to match the number of virtual processors the JVM has. Typically with log output, network transactions, and other IO you might need to increase the number of threads to utilize all of the processors. I'd run your program a couple of times with different values. In your case you seem to want to specifically run jobs 0,1,2,3 in one thread while 4,5 run in another thread in parallel (hopefully). To accomplish this you should submit 4 tasks to your ExecutorService and have each task run the iteration numbers that you want. Maybe something like: executorService.submit(new MyTask(new int[] { 0, 1, 2, 3})); executorService.submit(new MyTask(new int[] { 4, 5 })); If the number to thread mapping is arbitrary then I'd just submit 10 tasks to the ExecutorService and it will run the tasks in parallel in a FIFO manner.
has comment: http://stackoverflow.com/comment/33341773
downvote count: 0
has comment: http://stackoverflow.com/comment/33341787
has comment: http://stackoverflow.com/comment/33342087
has comment: http://stackoverflow.com/comment/33342158
type: Answer
has comment: http://stackoverflow.com/comment/33342010
has comment: http://stackoverflow.com/comment/33341790
answers question: http://stackoverflow.com/q/21998701

http://stackoverflow.com/comment/33321189
has text: Why are you doing it from Java code? Any specific use case?
type: AnswerComment
comment on: http://stackoverflow.com/a/21987744
score: 0
type: Comment

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/21924236
tags question: http://stackoverflow.com/q/21860865
tags question: http://stackoverflow.com/q/21917165
tags question: http://stackoverflow.com/q/21942367
tags question: http://stackoverflow.com/q/21957470
tags question: http://stackoverflow.com/q/21875500
tags question: http://stackoverflow.com/q/21881657
tags question: http://stackoverflow.com/q/21933312
tags question: http://stackoverflow.com/q/21854369
tags question: http://stackoverflow.com/q/21888674
tags question: http://stackoverflow.com/q/21932017
tags question: http://stackoverflow.com/q/21884498
tags question: http://stackoverflow.com/q/21865179
tags question: http://stackoverflow.com/q/21984304
tags question: http://stackoverflow.com/q/21950952
tags question: http://stackoverflow.com/q/21852048
tags question: http://stackoverflow.com/q/21928419
type: Tag
tags question: http://stackoverflow.com/q/21979699
tags question: http://stackoverflow.com/q/21929889
tags question: http://stackoverflow.com/q/21954515
tags question: http://stackoverflow.com/q/21963137
tags question: http://stackoverflow.com/q/21870677
tags question: http://stackoverflow.com/q/21939681
tags question: http://stackoverflow.com/q/21962500
tags question: http://stackoverflow.com/q/21984604
tags question: http://stackoverflow.com/q/21958014
tags question: http://stackoverflow.com/q/21994616
tags question: http://stackoverflow.com/q/21896990
tags question: http://stackoverflow.com/q/21879016
tags question: http://stackoverflow.com/q/21922474
tags question: http://stackoverflow.com/q/21951669
tags question: http://stackoverflow.com/q/21869604
tags question: http://stackoverflow.com/q/21998672
tags question: http://stackoverflow.com/q/21853800
tags question: http://stackoverflow.com/q/21930270
tags question: http://stackoverflow.com/q/21892760
tags question: http://stackoverflow.com/q/21889920
tags question: http://stackoverflow.com/q/21848360
tags question: http://stackoverflow.com/q/21939804
tags question: http://stackoverflow.com/q/21944321
tags question: http://stackoverflow.com/q/21878290
tags question: http://stackoverflow.com/q/21901630
tags question: http://stackoverflow.com/q/21857567
tags question: http://stackoverflow.com/q/21984686
tags question: http://stackoverflow.com/q/21959667
tags question: http://stackoverflow.com/q/21967222
tags question: http://stackoverflow.com/q/21962531
tags question: http://stackoverflow.com/q/21995818
tags question: http://stackoverflow.com/q/21862547
tags question: http://stackoverflow.com/q/21904443
tags question: http://stackoverflow.com/q/21897419
tags question: http://stackoverflow.com/q/21971831
tags question: http://stackoverflow.com/q/21969717
tags question: http://stackoverflow.com/q/21942828
tags question: http://stackoverflow.com/q/21949399
tags question: http://stackoverflow.com/q/21954118
tags question: http://stackoverflow.com/q/21907852
tags question: http://stackoverflow.com/q/21972642
tags question: http://stackoverflow.com/q/21961725
tags question: http://stackoverflow.com/q/21863496
tags question: http://stackoverflow.com/q/21927249
tags question: http://stackoverflow.com/q/21867386
tags question: http://stackoverflow.com/q/21970597
tags question: http://stackoverflow.com/q/21854552
tags question: http://stackoverflow.com/q/21852317
tags question: http://stackoverflow.com/q/21965812
tags question: http://stackoverflow.com/q/21868282
tags question: http://stackoverflow.com/q/21896301
tags question: http://stackoverflow.com/q/21879321
tags question: http://stackoverflow.com/q/21918897
tags question: http://stackoverflow.com/q/21859346
tags question: http://stackoverflow.com/q/21867274
tags question: http://stackoverflow.com/q/21889404
tags question: http://stackoverflow.com/q/21994957
tags question: http://stackoverflow.com/q/21908545
tags question: http://stackoverflow.com/q/21928424
tags question: http://stackoverflow.com/q/21910803
tags question: http://stackoverflow.com/q/21954281
tag name: xml

http://stackoverflow.com/comment/33101311
score: 0
comment on: http://stackoverflow.com/q/21864320
has text: can we see what you already have? It's unclear what exactly you are stuck at
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33226178
type: QuestionComment
comment on: http://stackoverflow.com/q/21934649
has text: When your runnable starts running, set the start time to the current time. Inside its code, regularly check that the current time is lower then the limit added to the start time, and stop running if it's the case.
score: 0
type: Comment

http://stackoverflow.com/comment/33151498
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21892068
type: QuestionComment
has text: it is not xml format it JSON format so try to use JSON parser provide in sdk

http://stackoverflow.com/q/21937842
has comment: http://stackoverflow.com/comment/33232067
has comment: http://stackoverflow.com/comment/33232134
has comment: http://stackoverflow.com/comment/33235320
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33234558
has body: I have a very simple file copy in Java. It is copies the DB file about 6 minutes to my external (usb3) HDD. //First database: try { fileInputStream = new FileInputStream(selectedfile); bufferedInputStream = new BufferedInputStream(fileInputStream); outputFile = new File("" + chosenDestination); fileOutputStream = new FileOutputStream(outputFile); bufferedOutputStream = new BufferedOutputStream(fileOutputStream); size = selectedfile.length(); byte[] buffer = new byte[1024 * 6]; dbLabel.setText("Copying Database..."); while ((data = bufferedInputStream.read(buffer)) &gt; 0) { bufferedOutputStream.write(buffer, 0, data); total += data; String percent = "" + total / (size / 100); pbar.setValue(Integer.valueOf(percent)); sizeLabel.setText("(" + total / (1024 * 1024) + " / " + (size / (1024 * 1024)) + " MB) "); } } finally { bufferedOutputStream.close(); fileInputStream.close(); fileOutputStream.close(); bufferedInputStream.close(); } Yesterday I bought a Transcend TS-PDU3 (PCI-E) USB additon card. So my computer and my HDD are able to USB3 too. But when I tried the copyjob, it is copy the file with same speed. It is a Linux server so don't need driver (lspci see it) and I think everything work good so I think the error is in the java code. What buffer size I need to choose for USB3. Is the 6 * 1024 is a small buffer size. Or I need to search the error in elsewhere? Thanks.
tagged with: linux
type: Question
has comment: http://stackoverflow.com/comment/33234598
has title: Java filecopy with the same speed (USB2 -> USB3 on Linux server). What's wrong?
tagged with: java
tagged with: file-copying
has answer: http://stackoverflow.com/a/21938129
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/33232340
has comment: http://stackoverflow.com/comment/33232094
tagged with: usb
type: UnansweredQuestion

http://stackoverflow.com/comment/33143671
has text: @duffymo : I didn't get you.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21887870

http://stackoverflow.com/q/21910023
has comment: http://stackoverflow.com/comment/33192304
has comment: http://stackoverflow.com/comment/43921551
tagged with: java
has title: JBoss7 + PostgreSQL New missing/unsatisfied dependencies
type: Question
has comment: http://stackoverflow.com/comment/33215658
downvote count: 0
accepted answer: http://stackoverflow.com/a/23281388
tagged with: persistence
favorite count: 0
has comment: http://stackoverflow.com/comment/33182994
tagged with: postgresql
has body: im migrating a Project from JBoss3 to JBoss7. I just started yesterday and reconfigured my standalone.xml, module.xml and persistence.xml. In the JBoss modules folder, i created the org/postgres/main dir. In this dir i got the new Postgres JDBC41 Driver and my module.xml. This is what i get, if i want to start the JBoss: 14:42:53,697 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report JBAS014775: New missing/unsatisfied dependencies: service jboss.jdbc-driver.postgresql (missing) dependents: [service jboss.data-source.java:jboss/datasources/RESyDS] 14:42:53,725 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990 14:42:53,726 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 3800ms - Started 155 of 234 services (2 services failed or missing dependencies, 76 services are passive or on-demand) Here is my module.xml in /modules/org/postgresql/main <?xml version="1.0" encoding="UTF-8"?> <resource-root path="postgresql-9.3-1101.jdbc41.jar"/> standalone.xml datasources-part: jdbc:postgresql://192.168.28.123:5432/dgap postgresql org.postgresql.Driver resy resy org.postgresql.Driver persistence.xml <?xml version="1.0" encoding="UTF-8"?> java:jboss/datasources/RESyDS <property name="hibernate.archive.autodetection" value="class" /> I have no Idea, how to solve the problem. Already tried to deploy the driver file, but it doesnt change anything. I checked all file names, asked my colleagues,im feeling like checked the whole internet for this issue. Nobody knows the hint. I hope someone can help ;) Cheers
answer count: 1
tagged with: jboss7.x
has comment: http://stackoverflow.com/comment/33183644
has answer: http://stackoverflow.com/a/23281388
has comment: http://stackoverflow.com/comment/33215709
tagged with: http://stackoverflow.com/tag/xml
upvote count: 3
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33182802
score: 3

http://stackoverflow.com/a/21941792
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21941625
type: Answer
answers question: http://stackoverflow.com/q/21941625
upvote count: 15
has comment: http://stackoverflow.com/comment/51987514
score: 15
has comment: http://stackoverflow.com/comment/85520678
has body: It all depends on what you want. The documentation says: For backwards compatibility, the default implementation calls onStart(Intent, int) and returns either START_STICKY or START_STICKY_COMPATIBILITY. So returning super.onStartCommand() is equivalent to returning START_STICKY. If you don't want the default behavior you can return another constant.

http://stackoverflow.com/q/21981101
score: 0
tagged with: abstract-syntax-tree
has title: Get the type of a FieldDeclaration in AST
answer count: 1
accepted answer: http://stackoverflow.com/a/21982511
has body: I am working with a Java AST. How can I get the Type (e.g. String or MyOwnType) of a FieldDeclaration or VariableDeclaration? In ASTView I can see it under SimpleName > type binding, but with getters I cannot reach the member. I tried the solution from FieldDeclaration to IField - Getting IBinding from FieldDeclaration but resolveBinding returns null when visiting the FieldDeclaration. Why does resolveBinding() return null even though I setResolveBindings(true) on my ASTParser? not working either
linked to: http://stackoverflow.com/q/2017945
linked to: http://stackoverflow.com/q/11131793
type: AnsweredQuestion
tagged with: java
tagged with: eclipse-jdt
type: Question
linked to: http://stackoverflow.com/q/2631981
has answer: http://stackoverflow.com/a/21982511

generics
tags question: http://stackoverflow.com/q/21908768
tags question: http://stackoverflow.com/q/21887358
tags question: http://stackoverflow.com/q/21864583
tags question: http://stackoverflow.com/q/21856319
tags question: http://stackoverflow.com/q/21994005
tags question: http://stackoverflow.com/q/21954680
tags question: http://stackoverflow.com/q/21987295
tags question: http://stackoverflow.com/q/22002100
tags question: http://stackoverflow.com/q/21857613
tags question: http://stackoverflow.com/q/21929497
tags question: http://stackoverflow.com/q/21935549
tags question: http://stackoverflow.com/q/22004636
type: Tag
tags question: http://stackoverflow.com/q/21855198
tags question: http://stackoverflow.com/q/21989564
tags question: http://stackoverflow.com/q/21851514
tags question: http://stackoverflow.com/q/21905169
tags question: http://stackoverflow.com/q/21854077
tags question: http://stackoverflow.com/q/21893782
tags question: http://stackoverflow.com/q/21969625
tags question: http://stackoverflow.com/q/21893223
tags question: http://stackoverflow.com/q/21971921
tags question: http://stackoverflow.com/q/21859099
tags question: http://stackoverflow.com/q/21971358
tags question: http://stackoverflow.com/q/21861172
tags question: http://stackoverflow.com/q/21942637
tags question: http://stackoverflow.com/q/21931692
tags question: http://stackoverflow.com/q/21974711
tags question: http://stackoverflow.com/q/21853556
tags question: http://stackoverflow.com/q/21932729
tags question: http://stackoverflow.com/q/21929196
tags question: http://stackoverflow.com/q/21950880
tag name: generics
tags question: http://stackoverflow.com/q/21977613
tags question: http://stackoverflow.com/q/21972488
tags question: http://stackoverflow.com/q/21912606
tags question: http://stackoverflow.com/q/21945178
tags question: http://stackoverflow.com/q/21980473
tags question: http://stackoverflow.com/q/21858449
tags question: http://stackoverflow.com/q/21862227

http://stackoverflow.com/comment/33321701
has text: @user3304333: I edited the question and tried to answer to your doubts.
type: Comment
comment on: http://stackoverflow.com/a/21988001
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33109968
type: QuestionComment
has text: Are you using maven or do you want to do this purely with Intellij?
score: 0
comment on: http://stackoverflow.com/q/21868863
type: Comment

http://stackoverflow.com/a/21976722
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/33302529
score: 2
has body: Right way to declare the map is : Map&lt;Double, Character&gt; memory = new HashMap&lt;Double, Character&gt;(); Is there any specific reason why you are using Double values as key ?
has comment: http://stackoverflow.com/comment/33302232
has comment: http://stackoverflow.com/comment/33302204
downvote count: 0
answers question: http://stackoverflow.com/q/21976691
has comment: http://stackoverflow.com/comment/33302248
has comment: http://stackoverflow.com/comment/33302656
has comment: http://stackoverflow.com/comment/33302766
has comment: http://stackoverflow.com/comment/33302591
has comment: http://stackoverflow.com/comment/33302467
has comment: http://stackoverflow.com/comment/33302618
has comment: http://stackoverflow.com/comment/33302412

http://stackoverflow.com/comment/33243995
has text: What's the expected output? What output are you receiving?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21944361

http://stackoverflow.com/q/21935262
has comment: http://stackoverflow.com/comment/33227991
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33227737
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/33227623
has comment: http://stackoverflow.com/comment/33227294
has comment: http://stackoverflow.com/comment/33227348
answer count: 1
has comment: http://stackoverflow.com/comment/33228022
favorite count: 0
has body: Requirement : One Excel sheet is present on a network drive say 'P:' drive whose ip address is like 192.XXX.X.XXX . This drive is mapped onto my local system. On this network drive, in a folder (name it 'My Folder') that excel sheet is present which can be accessed from many other computers. but it can be opened in editable mode on only one computer at a time. I just want to write a desktop java program which runs in background continuously and keeps checking that excel sheet is in editable mode or not. As soon as it finds that sheet is in editable mode,program opens that excel sheet in default program on my local system.
linked to: http://stackoverflow.com/q/1390592
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21936518
tagged with: excel
has title: Open a excel file from java program

http://stackoverflow.com/a/22093202
type: AcceptedAnswer
type: Answer
has body: You create EmpHandler by call the new method. Therefore that's methods do not handle by Spring Framework and some other containers. You do not should create the EmpHandler object by yourself. Spring Framework should create this object. You can do following: Class A { private IEmpHandler handler; public void setEmpHandler(IEmpHandler handler) { this.handler = handler; } @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public void processEmployees(List&lt;Employee&gt; empList) { for (Employee emp : empList) handler.processEmployee(emp); } } class EmpHandler implements IEmpHandler { @Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public void processEmployee(...) { } } In your context.xml: &lt;bean id="handler" class="...EmpHandler"/&gt; &lt;bean id="a" class = "...A"&gt; &lt;property name="handler" ref="handler"/&gt; &lt;/bean&gt;
accepted answer of: http://stackoverflow.com/q/21931299
answers question: http://stackoverflow.com/q/21931299
score: 0

http://stackoverflow.com/comment/33300034
comment on: http://stackoverflow.com/a/21972163
score: 0
type: AnswerComment
has text: This has nothing to do with the code. It means your Java runtime cannot find the compiled class!
type: Comment

http://stackoverflow.com/a/22004376
has comment: http://stackoverflow.com/comment/33351474
type: AcceptedAnswer
upvote count: 3
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22004321
has body: You initialize low, high, and mid every recursion from an external value that dosen't change. So they don't actually get any smaller. pLow and pHigh is never used, but they are the new values you just worked with in the previous recursion..
score: 3
answers question: http://stackoverflow.com/q/22004321
has comment: http://stackoverflow.com/comment/33351534

http://stackoverflow.com/a/21998949
type: Answer
has body: You are setting the paint correctly however there are 2 things you should realize. Gradient paints in java declare a start and end point. The first color will start at point 1 and transform into color 2 at point 2. If you use it to draw a polygon then the points are not relative to the polygons dimensions. Heres a picture to display, pt1 and pt2 in the picture are where your gradient start and end points are defined. In an ideal world every setting is editable in a library but many times this just isnt the case. We can overcome that by overwriting methods in a subclass. You will need to override the SpiderWebPlot class and implement some of the painting methods. Heres a quick class I wrote up that does just that. Take a look at the very end where it actually draws the polygon. I took this directly from the SpiderWebPlot source and altered the very end. To use this in your program call it like this GradientSpiderWebPlot plot = new GradientSpiderWebPlot(categorydataset, Color.decode("#4282CE"), Color.decode("#9BC1FF"), .8f); Here are the results public class GradientSpiderWebPlot extends SpiderWebPlot { private Color startColor, endColor; private float alpha; public GradientSpiderWebPlot(CategoryDataset data, Color startColor, Color endColor, float alpha) { // TODO Auto-generated constructor stub super(data); this.startColor = startColor; this.endColor = endColor; this.alpha = alpha; } @Override protected void drawRadarPoly(Graphics2D g2, Rectangle2D plotArea, Point2D centre, PlotRenderingInfo info, int series, int catCount, double headH, double headW) { Polygon polygon = new Polygon(); EntityCollection entities = null; if (info != null) { entities = info.getOwner().getEntityCollection(); } // plot the data... for (int cat = 0; cat &lt; catCount; cat++) { Number dataValue = getPlotValue(series, cat); if (dataValue != null) { double value = dataValue.doubleValue(); if (value &gt;= 0) { // draw the polygon series... // Finds our starting angle from the centre for this a…
upvote count: 5
accepted answer of: http://stackoverflow.com/q/21996872
score: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21996872

http://stackoverflow.com/comment/33349707
has text: Hey Thanks, unfortunately I'm still getting the same error.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22003319

http://stackoverflow.com/q/21851667
has answer: http://stackoverflow.com/a/21851733
tagged with: jtable
score: 0
answer count: 2
tagged with: parseint
possible better answer: http://stackoverflow.com/a/21851733
has body: i have made a jtable where i am giving the values manually,and saving the data in the sql by clicking the save(jButton2) button.now the problem is that when i am keeping the jtable blank and saving it..its showing data saved,but nothing is saving in the database. And when i am putting the data in the jtable and trying to save its giving exception. column(i,5) is getting value by multiplying column(i,3) and column(i,4) jButton2ActionPerformed(save button) method is as follows: private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try { String sql="insert into `sampleDB`.`Item_detail` (P_name,Manuf_name,Model_no,Purchase_price,Available,total Price,Sell_price,Quality,Color,Description,profit,Cost_price,idDealerItem) values(?,?,?,?,?,?,?,?,?,?,?,?,?)"; pst=con.prepareStatement(sql); int last=jTable1.getRowCount(); for( int i=0;i&lt;last;i++){ if(((String) jTable1.getValueAt(i,0))!=null){ String column1= (String) jTable1.getValueAt(i,0); String column2= (String) jTable1.getValueAt(i,1); String column3= (String) jTable1.getValueAt(i,2); String column4= (String) jTable1.getValueAt(i,3); String column5= (String) jTable1.getValueAt(i,4); String column6= (String) jTable1.getValueAt(i,5); String column7= (String) jTable1.getValueAt(i,6); pst.setString(1,column1); pst.setString(2,column2); pst.setString(3,column3); pst.setString(4,column4); pst.setString(5,column5); pst.setString(6,column6); pst.setString(7,null); pst.setString(8,column7); pst.setString(9,null); pst.setString(10,null); pst.setString(11,null); pst.setString(12,null); pst.setString(13,null); pst.execute(); } } JOptionPane.showMessageDialog(null, "data saved"); } catch(Exception e) { e.printStackTrace(); } Method where columns are getting multiplied is as follow.: private void jTable1KeyPressed(java.awt.event.KeyEvent evt) { // TODO add your handling code here: if(evt.getKeyCode()==KeyEvent.VK_TAB){ int r = jTable1.getRowCount(); for (int i = 0; i &lt; r; i++)…
accepted answer: http://stackoverflow.com/a/21851780
type: AnsweredQuestion
tagged with: java
tagged with: swing
type: Question
has title: data not saving in database through jtable (Edited)
has answer: http://stackoverflow.com/a/21851780

http://stackoverflow.com/q/21919547
favorite count: 0
possible better answer: http://stackoverflow.com/a/21919788
has comment: http://stackoverflow.com/comment/33200395
has comment: http://stackoverflow.com/comment/33200302
has answer: http://stackoverflow.com/a/21919821
accepted answer: http://stackoverflow.com/a/21919821
has comment: http://stackoverflow.com/comment/33200331
has title: is it possible to make if else statement code smaller?
has comment: http://stackoverflow.com/comment/33200478
has answer: http://stackoverflow.com/a/21919788
has comment: http://stackoverflow.com/comment/33201765
type: AnsweredQuestion
has body: I was wondering if it would be possible to make the code below any smaller, basically its if else statement and each time only 3 things are changing and I was think I am just repeating my self, so I though if there is any way to make it any smaller. if (text1.getText == "1" &amp;&amp; text2.text == "2"){ text3.setText("3"); } else if(text3.getText == "1" &amp;&amp; text4.text == "2"){ text7.setText("3"); } else if(text5.getText == "1" &amp;&amp; text6.text == "2"){ text4.setText("3"); } else if(text7.getText == "1" &amp;&amp; text8.text == "2"){ text5.setText("3"); } else if(text9.getText == "1" &amp;&amp; text10.text == "2"){ text6.setText("3"); } else if(text11.getText == "1" &amp;&amp; text12.text == "2"){ text2.setText("3"); } else if(text13.getText == "1" &amp;&amp; text14.text == "2"){ text14.setText("3"); } ...... else{ Statement here }
has comment: http://stackoverflow.com/comment/33200043
has comment: http://stackoverflow.com/comment/33204145
linked to: http://stackoverflow.com/q/21836049
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/33200231
upvote count: 1
has comment: http://stackoverflow.com/comment/33200580
has comment: http://stackoverflow.com/comment/33200480
has comment: http://stackoverflow.com/comment/33200298
type: Question
has comment: http://stackoverflow.com/comment/33201096
tagged with: if-statement
score: -2
has comment: http://stackoverflow.com/comment/33200479
has comment: http://stackoverflow.com/comment/33200323
has comment: http://stackoverflow.com/comment/33200085
has answer: http://stackoverflow.com/a/21919809
answer count: 3
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/33200114
has comment: http://stackoverflow.com/comment/33200069
has comment: http://stackoverflow.com/comment/33200032
has comment: http://stackoverflow.com/comment/33200228

http://stackoverflow.com/comment/33184021
score: 2
comment on: http://stackoverflow.com/a/21910859
has text: I think the readability is subjective, but one thing it does help with is it decreased the slight overhead you get from calling an extra method just to get a field's value.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/33342694
has text: Is it a big performance hit if I loop that repaint so many times?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21999207
type: Comment

http://stackoverflow.com/comment/33348366
comment on: http://stackoverflow.com/a/22002637
score: 0
type: Comment
has text: I did have that wrong! But changing it doesn't seem to fix the problem
type: AnswerComment

http://stackoverflow.com/q/21949430
tagged with: java
has comment: http://stackoverflow.com/comment/33253445
has answer: http://stackoverflow.com/a/21949565
has comment: http://stackoverflow.com/comment/33253331
upvote count: 1
downvote count: 1
type: Question
has body: This is my code. There is an error showing on the terminal window. It says java.lang.ArrayIndexOutOfBoundsException: -1 at top--; and while (!stack.isEmpty()). Please help me solve this issue. I looked it up online but it did not help much. That is why I am asking you for help. import java.util.*; public class ArrayStack&lt;T&gt; implements StackADT&lt;T&gt; { private final static int DEFAULT_CAPACITY = 100; private int top; private T[] stack; public ArrayStack() { this(DEFAULT_CAPACITY); } public ArrayStack(int initialCapacity) { top = 0; stack = (T[])(new Object[initialCapacity]); } public void push(T element) { if (size() == stack.length) expandCapacity(); stack[top] = element; top++; } private void expandCapacity() { stack = Arrays.copyOf(stack, stack.length * 2); } public T pop() throws EmptyCollectionException { if (isEmpty()) throw new EmptyCollectionException("stack"); top--; T result = stack[top]; stack[top] = null; return result; } public T peek() throws EmptyCollectionException { if (isEmpty()) throw new EmptyCollectionException("stack"); return stack[top-1]; } public boolean isEmpty() { return stack.length == 0; } public int size() { return top; } public static void main(String[] args) { ArrayStack&lt;Character&gt; stack = new ArrayStack&lt;Character&gt;(); String sentence = " ", word; Scanner in = new Scanner(System.in); System.out.println("Enter a sentence:"); sentence= in.nextLine(); System.out.println("Reversing each word:"); Scanner sentenceScanner = new Scanner(sentence); while(sentenceScanner.hasNext()) { word = sentenceScanner.next(); for(int i= 0; i&lt;word.length(); i++) { stack.push(word.charAt(i)); } while (!stack.isEmpty()) { System.out.print(stack.pop()); } } } }
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21949504
has title: Error java.lang.ArrayIndexOutOfBoundsException: -1 on my code
has comment: http://stackoverflow.com/comment/33253362
favorite count: 0
has comment: http://stackoverflow.com/comment/33253323
has comment: http://stackoverflow.com/comment/33253493
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33253325

http://stackoverflow.com/comment/33152320
score: 0
has text: Yes, they are the same.
type: Comment
comment on: http://stackoverflow.com/a/21891970
type: AnswerComment

http://stackoverflow.com/comment/33246604
type: AnswerComment
has text: I am piping the output streams of the actual offending process. That is not the problem. In the example, notepad.exe has no output. It's simply that it is still alive.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21922853

http://stackoverflow.com/comment/33133878
type: AnswerComment
comment on: http://stackoverflow.com/a/21867780
type: Comment
has text: If you're new to both, you should check out Android programming by TheNewBoston (YouTube). Well explained and perfect for beginner level. The link I gave you last time is a bit more advanced (requires some knowledge in Java).
score: 0

http://stackoverflow.com/comment/102459163
score: 0
type: Comment
comment on: http://stackoverflow.com/a/34239165
type: AnswerComment
has text: You saved my day ... i really needed this, otherwise it was not getting executed on mvn clean install. It worked for me. But I have a query here, well if we get the jar, i was thinking everything should go in to jar and nothing else should be visible to outsiders so that i can just have one file to execute, how to acheive this? any help on this is appreciated

http://stackoverflow.com/comment/33121310
has text: How did you declare the Contact class ? Does your class implements Comparable ?
comment on: http://stackoverflow.com/q/21875574
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/a/21909733
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21909637
answers question: http://stackoverflow.com/q/21909637
type: Answer
upvote count: 3
score: 3
has body: actual is what your method returns. So, e.g., you could do something like this: @Test public void testMonth() { String expected = "feb"; String actual = ex2.month(2); assertEquals(expected, actual); }

http://stackoverflow.com/comment/33211158
has text: Yes dunni i added as a new question please go with below link http://stackoverflow.com/questions/21926003/java-lang-classnotfoundexception-org-springframework-web-servlet-dispatcherserv
type: Comment
comment on: http://stackoverflow.com/a/21905358
score: 0
type: AnswerComment

http://stackoverflow.com/q/21879243
has answer: http://stackoverflow.com/a/21880520
has body: My task is to retrieve the value of a text field and display it in an alert box when clicking a button. How do I generate the on click event for a button in Java Swing?
has answer: http://stackoverflow.com/a/65644244
favorite count: 0
answer count: 5
type: UnansweredQuestion
has title: How to create on click event for buttons in swing?
downvote count: 2
has answer: http://stackoverflow.com/a/21879526
tagged with: swing
score: 34
has answer: http://stackoverflow.com/a/75224494
tagged with: jbutton
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/73837189
upvote count: 36

http://stackoverflow.com/a/21954106
has body: Solution: The problem was caused by the AutoCompleteDecorator. I deactivated it and used instead the AutoCompletion.enable(employeeDelete). I appreciate all the comments that helped me.
type: Answer
accepted answer of: http://stackoverflow.com/q/21945229
answers question: http://stackoverflow.com/q/21945229
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/21982230
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/21967250
upvote count: 1
has body: Use GetProcessTimes windows api to get the information about a process. http://msdn.microsoft.com/en-us/library/windows/desktop/ms683223(v=vs.85).aspx

http://stackoverflow.com/q/21987685
tagged with: andengine
type: Question
has answer: http://stackoverflow.com/a/21988107
downvote count: 0
answer count: 1
favorite count: 0
has body: First I start by loading the resources this.mTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 130, 130); this.m1TextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mTextureAtlas, this, "p1.png", 0, 0); this.m2TextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mTextureAtlas, this, "p2.png", 0, 0); this.m3TextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mTextureAtlas, this, "p3.png", 0, 0); this.m4TextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mTextureAtlas, this, "p4.png", 0, 0); this.mTextureAtlas.load(); Then I do int x; x = MathUtils.random(1, 4); Log.e("euatl", "is" + x); p = null; if(x == 1){ p = new Sprite(mCameraWidth-pX, pY, this.mB1TextureRegion, this.getVertexBufferObjectManager()); } else if(x == 2){ p = new Sprite(mCameraWidth-pX, pY, this.m2TextureRegion, this.getVertexBufferObjectManager()); } else if(x == 3){ p = new Sprite(mCameraWidth-pX, pY, this.mB3TextureRegion, this.getVertexBufferObjectManager()); } else if(x == 4){ p = new Sprite(mCameraWidth-pX, pY, this.m4TextureRegion, this.getVertexBufferObjectManager()); } mScene.attachChild(p); currently always the p4 sprite spawns, the last one in the TextureAtlas. My logcat says that x was random sometimes 1, 2, 3, and 4. But in the phone the sprite is always the last one (p4)
tagged with: android
upvote count: 1
has title: Android AndEngine generating random sprites weird probleem
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/21988107
tagged with: java

http://stackoverflow.com/q/21873476
has comment: http://stackoverflow.com/comment/33162832
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33121193
type: Question
has comment: http://stackoverflow.com/comment/33117698
has comment: http://stackoverflow.com/comment/33127342
has title: Cant send string array from java server to android client using socket
downvote count: 0
has comment: http://stackoverflow.com/comment/33121018
favorite count: 0
has comment: http://stackoverflow.com/comment/33117823
has comment: http://stackoverflow.com/comment/33117773
tagged with: android
has comment: http://stackoverflow.com/comment/33163210
has body: I am trying to create an android application that interact with the java server. The server needs to send a string array to the client. The client(android) receives the string array and need to display it in a listview. I try the following code but the client didn't print the received string in logcat. Android Client ObjectInputStream objectinput=new ObjectInputStream(client.getInputStream()); operation=(String[])objectinput.readObject(); Log.i("operation",operation[0]); Java Server ObjectOutputStream objectoutput=new ObjectOutputStream( clientSocket.getOutputStream()); objectoutput.writeObject(G.opername); objectoutput.flush(); Full Server Code public class Project { private static ServerSocket serverSocket; private static Socket clientSocket; private static InputStreamReader inputStreamReader; private static BufferedReader bufferedReader; private static String message; private static byte[] bytearray; private static Global G = new Global(); private static String msg = "Hai"; public static void main(String[] args) throws ClassNotFoundException, SQLException { try { serverSocket = new ServerSocket(7575); // Server socket } catch (IOException e) { System.out.println("Could not listen on port: 7575"); } System.out.println("Server started. Listening to the port 7575"); while (true) { try { clientSocket = serverSocket.accept(); // accept the client // connection inputStreamReader = new InputStreamReader(clientSocket.getInputStream()); bufferedReader = new BufferedReader(inputStreamReader); // get the client message message = bufferedReader.readLine(); Dbsearch db = new Dbsearch(); db.search(message); System.out.println(message); inputStreamReader.close(); ObjectOutputStream objectoutput = new ObjectOutputStream( clientSocket.getOutputStream()); objectoutput.writeObject(G.opername); objectoutput.flush(); clientSocket.close(); } catch (IOException ex) { System.out.println("Problem in message reading"); } } } } GLOBAL CLASS class Global { public static String opername[]=ne…
has comment: http://stackoverflow.com/comment/33121414
tagged with: objectoutputstream
answer count: 0
has comment: http://stackoverflow.com/comment/33120492
type: UnansweredQuestion
tagged with: sockets
upvote count: 1
has comment: http://stackoverflow.com/comment/33162881

http://stackoverflow.com/a/22000932
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: You expect the following I am expecting the output will be the same in all three cases because Unicode value of fifth char in every case (1, 2, 2) is greater than fifth char in "str1" (-). This expectation is wrong. The unicode value of - is smaller than the others. Run this test System.out.println((int) '-'); System.out.println((int) '1'); System.out.println((int) '2'); It will print 45 49 50 45 is smaller than 49, so the method will return a negative value. As the javadoc says the value 0 if the argument string is equal to this string; a value less than 0 if this string is lexicographically less than the string argument; and a value greater than 0 if this string is lexicographically greater than the string argument. For reference, the implementation of String#compareTo(String) in Java Oracle 7 public int compareTo(String anotherString) { int len1 = value.length; int len2 = anotherString.value.length; int lim = Math.min(len1, len2); char v1[] = value; char v2[] = anotherString.value; int k = 0; while (k &lt; lim) { char c1 = v1[k]; char c2 = v2[k]; if (c1 != c2) { return c1 - c2; // important!!!! } k++; } return len1 - len2; }
accepted answer of: http://stackoverflow.com/q/22000890
answers question: http://stackoverflow.com/q/22000890
type: AcceptedAnswer

http://stackoverflow.com/comment/33094757
has text: Can someone confirm or deny that both loops will be optimized by JIT to behave the same?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21860573

http://stackoverflow.com/comment/33261738
score: 1
type: QuestionComment
has text: What is it you're trying to accomplish? There's probably a more idiomatic and reliable approach.
comment on: http://stackoverflow.com/q/21954319
type: Comment

http://stackoverflow.com/comment/33087384
type: Comment
comment on: http://stackoverflow.com/a/21855899
has text: Works like a charm thanks to all for your answers. I can't give points to all because I'm noob.
score: 0
type: AnswerComment

http://stackoverflow.com/a/21967889
accepted answer of: http://stackoverflow.com/q/21967500
has body: It looks like that "index" in the begin() can be index of a array, so you want to check the status of the Server socket port form 0 to x or something. Probably you should post more source code, but it looks like you are using single port value in the checkStatus(), which means ServerSocket will be bound same port every time. It's OK at first iteration because server socket is not bound at any port, but at then end of first iteration you didn't close server socket at all. So Server socket is still bound at given port, and creating new ServerSocket with same port number will be failed since it's already bound and you can't bind it again unless you close it first. You should use single ServerSocket, and once serverSocket.accept() return socket, then you can store it to array and check it's status frequently. Or maybe you can differentiate port number every time and let client connect different port every time would also work, but I don't think that's what you want to do.
has comment: http://stackoverflow.com/comment/33343070
answers question: http://stackoverflow.com/q/21967500
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33288266
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33288351
has comment: http://stackoverflow.com/comment/33342992

http://stackoverflow.com/q/21880071
has title: Login verification using database
has comment: http://stackoverflow.com/comment/33129194
possible better answer: http://stackoverflow.com/a/21881016
has answer: http://stackoverflow.com/a/21880441
has body: When the entered user exists in the database the if part of resultset runs but when it doesn't, the else part isn't. why? Here's my code. String thisname=request.getParameter("username"); String thispwd=request.getParameter("password"); //Query for selecting user name and password from database. String query = "select * from login where username=?"; pstmt = (PreparedStatement) con.prepareStatement(query); pstmt.setString(1, thisname); res = pstmt.executeQuery(); while(res.next()) { System.out.println("hhh"); if ((thisname.equals(res.getString("username"))) &amp;&amp; (thispwd.equals(res.getString("password")))) { System.out.println("hello"); } else { System.out.println("in"); session.invalidate(); response.sendRedirect("index.html"); } }
score: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33129268
tagged with: java
tagged with: database
accepted answer: http://stackoverflow.com/a/21880441
tagged with: servlets
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21881016

http://stackoverflow.com/q/21963780
tagged with: java
has comment: http://stackoverflow.com/comment/33279081
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/33398778
has comment: http://stackoverflow.com/comment/33279193
has comment: http://stackoverflow.com/comment/33397925
score: 0
has answer: http://stackoverflow.com/a/21963819
has comment: http://stackoverflow.com/comment/33398101
has answer: http://stackoverflow.com/a/22155272
has answer: http://stackoverflow.com/a/22149440
possible better answer: http://stackoverflow.com/a/21963819
accepted answer: http://stackoverflow.com/a/22155272
tagged with: android
has comment: http://stackoverflow.com/comment/33279167
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33398844
has body: I'm trying to use an ImageView in my java code that is inside the second RelativeLayout node in the XML. However, I can't get references to the ImageViews as seen by the setVisibility method that does not make the images invisible. [DOUBLE EDIT] Here is my revised Activity Class: package com.scopelyapplication.tictactoe; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.view.MenuItem; import android.view.View; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.RelativeLayout; public class TicTacToeActivity extends ActionBarActivity { private static final String LOGTAG = "TicTacToeActivity"; private ModelComputerGameHelper comHelp; boolean humanIsX; RelativeLayout layout; ImageView blueX; ImageView greyX; ImageView blueO; ImageView greyO; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); layout = (RelativeLayout)findViewById(R.id.mainLayout); Log.d(LOGTAG, "onCreate"); //Set up action bar ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayUseLogoEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); Log.d(LOGTAG, "set action bar"); //Initialize X's and O's blueX = (ImageView)findViewById(R.id.blueXTopLeft); greyX = (ImageView)findViewById(R.id.greyXTopLeft); blueO = (ImageView)findViewById(R.id.blueOTopLeft); greyO = (ImageView)findViewById(R.id.greyOTopLeft); Log.d(LOGTAG, "X's and O's initialized"); //Turn off their visibility until one is clicked. blueX.setVisibility(View.INVISIBLE); //where the NPE occurs greyX.setVisibility(View.INVISIBLE); blueO.setVisibility(View.INVISIBLE); greyO.setVisibility(View.INVISIBLE); Bundle extras = getIntent().getExtras(); boolean gameIsPVP = extras.getBoolean("gameIsPVP"); humanIsX = extras.getBoolean("humanIsX"); if (gameIsPVP) { ; //in progress } else…
has title: How do I access views in nested layouts programmatically?
has answer: http://stackoverflow.com/a/22110746

http://stackoverflow.com/q/21881815
score: 0
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21881864
downvote count: 1
type: Question
has title: Parsing error; I have tried and can't figure out what's wrong?
has answer: http://stackoverflow.com/a/21881948
has comment: http://stackoverflow.com/comment/33132091
has answer: http://stackoverflow.com/a/21881926
tagged with: parsing
favorite count: 0
has answer: http://stackoverflow.com/a/21881912
has body: THIS CODE IS DRIVING ME BONKERS!! I've spent a week now trying to figure out what is wrong. In fact, my instructor also could not find an issue within the code-so that's quite frustrating...especially because it won't compile due to a supposed parsing issue. Any help would be more than amazing and very much appreciated!! (and if it's not too much of a bother, could you please explain to me why you make the adjustments that you do?) import java.util.Scanner; public class ChooseYourOwnAdventure { public static void main( String[] args ) { Scanner keyboard = new Scanner(System.in); String Wh, Kt, yn, WH2, ny; System.out.println("WELCOME TO MITCHELL'S TINY ADVENTURE!"); System.out.println("You are in a creepy house! Would you like to go \"upstairs\" or into the \"kitchen\"?"); Wh = keyboard.next(); { if (Wh.equals("kitchen")) { System.out.println( "There is a long counter top with dirty dishes everywhere. Off to one side there is, as you'd expect, a refrigerator. You may open the \"refrigerator\" or look in a \"cabinet\"."); Kt = keyboard.next(); } if (Wh.equals(("kitchen") &amp;&amp; Kt.equals ("refrigerator"))) { System.out.println("Inside the refrigerator you see food and stuff. It looks pretty nasty. Would you like to eat some of the food? (\"yes\" or \"no\") "); yn = keyboard.next(); } if (Kt.equals (("refrigerator") &amp;&amp; yn.equals("no"))) { System.out.println("You die of starvation...eventually."); } if (Wh.equals(("kitchen") &amp;&amp; Kt.equals ("cabinet"))) { System.out.println("Everything is rodent infested. Roaches everywhere! I think we even saw a rat!"); } if (Wh.equals("upstairs")) { System.out.println("Upstairs you see a hallway. At the end of the hallway is the master \"bedroom\". There is also a \"bathroom\" off the hallway. Where would you like to go?"); WH2 = keyboard.next(); } if (WH2.equals("bedroom")) { System.out.println("You are in a plush bedroom, with expensive-looking hardwood furniture. The bed is unmade. In the back of the room, the cl…
type: UnansweredQuestion
answer count: 4
has comment: http://stackoverflow.com/comment/33132099
tagged with: java.util.scanner

http://stackoverflow.com/q/21920268
has answer: http://stackoverflow.com/a/70016798
has body: I am completely new in RestTemplate and basically in the REST APIs also. I want to retrieve some data in my application via Jira REST API, but getting back 401 Unauthorised. Found and article on jira rest api documentation but don't really know how to rewrite this into java as the example uses the command line way with curl. I would appreciate any suggestion or advice how to rewrite: curl -D- -X GET -H "Authorization: Basic ZnJlZDpmcmVk" -H "Content-Type: application/json" "http://kelpie9:8081/rest/api/2/issue/QA-31" into java using spring rest template. Where the ZnJlZDpmcmVk is a base64 encoded string of username:password. Thank you very much.
score: 129
has title: Basic authentication for REST API using spring restTemplate
has answer: http://stackoverflow.com/a/74266205
linked to: http://stackoverflow.com/q/9376549
tagged with: spring
possible better answer: http://stackoverflow.com/a/44370474
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40551383
has answer: http://stackoverflow.com/a/53394971
has answer: http://stackoverflow.com/a/72240058
has answer: http://stackoverflow.com/a/74531717
has answer: http://stackoverflow.com/a/28981183
has answer: http://stackoverflow.com/a/34947604
tagged with: jira-rest-api
tagged with: java
tagged with: resttemplate
linked to: http://stackoverflow.com/q/42240927
has answer: http://stackoverflow.com/a/63835298
type: Question
accepted answer: http://stackoverflow.com/a/21920398
has answer: http://stackoverflow.com/a/44370474
has answer: http://stackoverflow.com/a/49297964
has answer: http://stackoverflow.com/a/21920398
downvote count: 0
upvote count: 129
has answer: http://stackoverflow.com/a/58040587
favorite count: 0
answer count: 12
has comment: http://stackoverflow.com/comment/38936637

http://stackoverflow.com/q/21873660
tagged with: jquery
tagged with: ajax
has title: How to pass values (which is not a form values) to action in struts 1.3 by using ajax
type: Question
has answer: http://stackoverflow.com/a/21873818
has answer: http://stackoverflow.com/a/21873851
tagged with: java
score: 0
answer count: 3
has body: I have the following jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> <%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> <%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> Get the best deal on Qnatas Partner credit cards Welcome to card selector <html:text name="cardsListForm" property="message" maxlength="250"/> sample myname and this is my form import java.util.List; import org.apache.struts.action.ActionForm; public class CardsListForm extends ActionForm{ private static final long serialVersionUID = 1L; private String message; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } } And this is my action public class MailAction extends Action { private CardManagementService cardManagementService; @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { try { // Need to get the value of name from jsp input text } catch (Exception e) { System.out.println("Error:" + e.getMessage()); e.printStackTrace(); } return mapping.findForward("success"); } } Now I want to pass the value of myname from jsp tp my action class by using ajax on clicking of a button. please note this name is not an property of my form class. Is it possible please help !
accepted answer: http://stackoverflow.com/a/21873818
has comment: http://stackoverflow.com/comment/33118203
has comment: http://stackoverflow.com/comment/33118010
has answer: http://stackoverflow.com/a/21873907
tagged with: struts
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21873907
tagged with: jsp

http://stackoverflow.com/comment/33298392
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21974285
type: Comment
has text: Don't use setPreferredSize(). Override the getPreferredSize() method of the custom panel as demonstrated in the Swing tutorial.

http://stackoverflow.com/a/21938553
score: 0
has body: I'm not able to give a solution that I would adopt as your problem is not very clear to me. What I would suggest is to create a holder object to store the references of A and B: public class Test { List&lt;Object&gt; colectionA = new LinkedList&lt;&gt;(); List&lt;Object&gt; colectionB = new LinkedList&lt;&gt;(); Holder&lt;Object&gt; holderA; Holder&lt;Object&gt; holderB; { collectionA.add(holderA); collectionB.add(holderB); } public void setA(Object a) { this.holderA.set(a); } public void setB(Object b) { this.holderB.set(b); } } In this case, the references of A and B will be stored by the holders which are already in the lists.
answers question: http://stackoverflow.com/q/21938181
type: Answer

http://stackoverflow.com/q/21966663
accepted answer: http://stackoverflow.com/a/21966689
has answer: http://stackoverflow.com/a/21966701
has body: I am trying to insert values of a String and ArrayList&lt;String&gt; into a HashMap&lt;String, ArrayList&lt;String&gt;&gt;. The code in the for loop works fine but it does not insert the values that I wanted when inserting ArrayList values into the HashMap. My code: for(int i=0; i&lt;fileNames.length; i++) { File imageFile = new File(fileNames[i]); metadata = ImageMetadataReader.readMetadata(imageFile); String[] results; container.clear(); println(container); for (Directory directory : metadata.getDirectories()) { for (Tag tag : directory.getTags()) { if(tag.getTagName() == "Keywords") { results = tag.getDescription().split(";"); for(int k=0; k&lt;results.length; k++) { keywords.add(results[k]); container.add(results[k]); } println(fileNames[i] + ", " + container); imageTag.put(fileNames[i], container); } } } } println(imageTag.entrySet()); } which prints out: [] gardensbythebay.jpg, [gardens, gardens by the bay, supertree, singapore] [] mbs.jpg, [marina, bay, sands, ferris, wheel, skyline, singapore] [] supertree.jpg, [architecture, marina, gardens, bay, tower, supertree, singapore, gardens by the bay, plants, nature] [] uss.JPG, [universal, uss, rws, resort, world, sentosa, studios] [mbs.jpg=[universal, uss, rws, resort, world, sentosa, studios], uss.JPG=[universal, uss, rws, resort, world, sentosa, studios], supertree.jpg=[universal, uss, rws, resort, world, sentosa, studios], gardensbythebay.jpg=[universal, uss, rws, resort, world, sentosa, studios]]
score: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33284561
tagged with: hashmap
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33284552
possible better answer: http://stackoverflow.com/a/21966694
has title: Inserting values into HashMap not functioning properly
has answer: http://stackoverflow.com/a/21966694
has answer: http://stackoverflow.com/a/21966689
tagged with: arraylist
answer count: 3

http://stackoverflow.com/comment/33256478
has text: I understood the case as it is running in 2 different JVM, it is failing. If this is situation how to handle it. If any suggestion?
comment on: http://stackoverflow.com/a/21950869
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33306238
comment on: http://stackoverflow.com/a/21978795
type: AnswerComment
score: 0
has text: It all works fine, except that only one circle appears.
type: Comment

http://stackoverflow.com/q/21952887
has body: Problem:: Whenever i am running my app on my emulator(I have set Background to #FFFFFF), I can see light grid-lines in the background. Clearly its not 100% white background. Why is this happening ? Is this just the behavior of emulator or Theme behavior Has anyone other than me noticed this ? How can i get 100% white background ? Theme i am using:: styles.xml &lt;resources&gt; &lt;!-- Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. --&gt; &lt;style name="AppBaseTheme" parent="android:Theme.Light"&gt; &lt;!-- Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. --&gt; &lt;/style&gt; &lt;!-- Application theme. --&gt; &lt;style name="AppTheme" parent="AppBaseTheme"&gt; &lt;!-- All customizations that are NOT specific to a particular API-level can go here. --&gt; &lt;/style&gt; &lt;/resources&gt; SNAPSHOT:: (Check the white region in the image)
type: UnansweredQuestion
tagged with: android-xml
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/33259208
has comment: http://stackoverflow.com/comment/33365543
tagged with: android-emulator
has comment: http://stackoverflow.com/comment/33366075
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/33383813
has comment: http://stackoverflow.com/comment/33259219
answer count: 0
has title: Gridlines Visible in android background even for white background

http://stackoverflow.com/q/21985397
has answer: http://stackoverflow.com/a/21985426
has comment: http://stackoverflow.com/comment/33317194
favorite count: 0
linked to: http://stackoverflow.com/q/203984
has answer: http://stackoverflow.com/a/63805740
has answer: http://stackoverflow.com/a/39317497
has body: I have one Arraylist of String and I have added Some Duplicate Value in that. and i just wanna remove that Duplicate value So how to remove it. Here Example I got one Idea. List&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("Krishna"); list.add("Krishna"); list.add("Kishan"); list.add("Krishn"); list.add("Aryan"); list.add("Harm"); System.out.println("List"+list); for (int i = 1; i &lt; list.size(); i++) { String a1 = list.get(i); String a2 = list.get(i-1); if (a1.equals(a2)) { list.remove(a1); } } System.out.println("List after short"+list); But is there any Sufficient way remove that Duplicate form list. with out using For loop ? And ya i can do it by using HashSet or some other way but using array list only. would like to have your suggestion for that. thank you for your answer in advance.
answer count: 18
has answer: http://stackoverflow.com/a/21985684
accepted answer: http://stackoverflow.com/a/21985571
type: AnsweredQuestion
tagged with: list
score: 21
has answer: http://stackoverflow.com/a/30611895
tagged with: java
downvote count: 2
has title: Removing Duplicate Values from ArrayList
has answer: http://stackoverflow.com/a/21985521
upvote count: 23
type: Question
linked to: http://stackoverflow.com/q/3759440
has answer: http://stackoverflow.com/a/30285891
has answer: http://stackoverflow.com/a/46795893
has answer: http://stackoverflow.com/a/21985563
has comment: http://stackoverflow.com/comment/33316836
tagged with: sorting
has answer: http://stackoverflow.com/a/43025678
has answer: http://stackoverflow.com/a/48625490
has answer: http://stackoverflow.com/a/45078796
possible better answer: http://stackoverflow.com/a/21985495
tagged with: arraylist
has answer: http://stackoverflow.com/a/30320626
has answer: http://stackoverflow.com/a/21985571
has answer: http://stackoverflow.com/a/21985495
has answer: http://stackoverflow.com/a/21986095
has answer: http://stackoverflow.com/a/25665406
has answer: http://stackoverflow.com/a/29951018

http://stackoverflow.com/q/21993464
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/21994185
accepted answer: http://stackoverflow.com/a/28478518
tagged with: spring
has answer: http://stackoverflow.com/a/58545075
has answer: http://stackoverflow.com/a/57500778
tagged with: java
score: 113
has comment: http://stackoverflow.com/comment/123003200
has answer: http://stackoverflow.com/a/34646639
has answer: http://stackoverflow.com/a/63055459
upvote count: 113
answer count: 9
linked to: http://stackoverflow.com/q/29796651
has answer: http://stackoverflow.com/a/72043269
has answer: http://stackoverflow.com/a/57196197
has answer: http://stackoverflow.com/a/21994157
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21994185
has body: I have several methods annotated with @Scheduled(fixedDelay=10000). In the application context, I have this annotation-driven setup: &lt;task:annotation-driven /&gt; The problem is, sometimes some of the method executions get delayed by seconds and even minutes. I'm assuming that even if a method takes a while to finish executing, the other methods would still execute. So I don't understand the delay. Is there a way to maybe lessen or even remove the delay?
has title: Does spring @Scheduled annotated methods runs on different threads?
has answer: http://stackoverflow.com/a/28478518
tagged with: scheduled-tasks

http://stackoverflow.com/comment/33296019
has text: What do you want the annotations to do, and what kind of XML are you trying to add them to? The official mechanism for passing hints to specific applications is Processing Instructions...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21969717

http://stackoverflow.com/q/21929394
tagged with: default-constructor
score: 1
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21929471
has answer: http://stackoverflow.com/a/21929417
linked to: http://stackoverflow.com/q/4488716
has answer: http://stackoverflow.com/a/21929414
has answer: http://stackoverflow.com/a/21929442
duplicate of: http://stackoverflow.com/q/4488716
favorite count: 0
tagged with: constructor
answer count: 5
accepted answer: http://stackoverflow.com/a/21929417
downvote count: 2
has title: When is a constructor called a default constructor?
possible better answer: http://stackoverflow.com/a/21929424
has body: Which of the below classes will use a default constructor, when we initialize an object from them? class X {} class Y { Y () {} } class Z { Z(int i ) {} } class Z will not use a default constructor. class X will use a default constructor. But what about Y? is a user defined empty constructor called a default constructor? Like they say on wikipedia (Java section) http://en.wikipedia.org/wiki/Default_constructor Or should there be no constructor defined in the class when we can speak of a default constructor when initializing an object?
has answer: http://stackoverflow.com/a/21929424
type: AnsweredQuestion

http://stackoverflow.com/comment/33077624
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21851587
has text: whould you please provide me with an example I have never used this annotation before

http://stackoverflow.com/comment/116719038
score: 0
comment on: http://stackoverflow.com/q/21894873
has text: No i did not.This was a long time back.It can be scripted but I realized later on it is not worth it.It is a good hackathon project but wont be useful for unit testing.It is always better to have a clear expected output and input as tests serve as documentation.For integration test we can always using templating language like freemarker or Velocity to achieve what we want.Java never added string interpolation like Groovy, scala so 3rd libraries would be needed
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21951895
has title: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
type: Question
has body: I am trying to learn to insert a simple record to a MySQL database using hibernate and I was following this article from Mkyong and I am stuck at the last step,i.e,when running App.Java. Please help.Thanks in advance. pom.xml: 4.0.0 com.mkyong.common HibernateExample jar 1.0-SNAPSHOT HibernateExample http://maven.apache.org junit junit 3.8.1 test mysql mysql-connector-java 5.1.9 org.hibernate hibernate-core 3.6.3.Final dom4j dom4j 1.6.1 commons-logging commons-logging 1.1.1 commons-collections commons-collections 3.2.1 cglib cglib 2.2 javax.transaction jta 1.1 Exception Stacktrace: Maven + Hibernate + MySQL 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. Initial SessionFactory creation failed.org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer] Exception in thread "main" java.lang.ExceptionInInitializerError at com.mkyong.persistence.HibernateUtil.buildSessionFactory(HibernateUtil.java:18) at com.mkyong.persistence.HibernateUtil.<clinit>(HibernateUtil.java:8) at com.mkyong.common.App.main(App.java:11) Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer] at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:108) at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:133) at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:80) at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:322) at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:485) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:133) at org.hibern…
accepted answer: http://stackoverflow.com/a/21952125
downvote count: 0
tagged with: maven-3
has answer: http://stackoverflow.com/a/22981852
favorite count: 0
has answer: http://stackoverflow.com/a/52761204
has answer: http://stackoverflow.com/a/21951994
has answer: http://stackoverflow.com/a/21952125
possible better answer: http://stackoverflow.com/a/52761204
answer count: 4
type: AnsweredQuestion
score: 7
tagged with: java
tagged with: hibernate
upvote count: 7

http://stackoverflow.com/comment/64113219
type: Comment
comment on: http://stackoverflow.com/a/21996426
score: 0
type: AnswerComment
has text: I don't see how this implements pessimistic locking. So if the flow is: 1. Start transaction 2. SELECT 3. UPDATE (with current values) 4. (some application code) 5. UPDATE (with updated value) 6. Commit If 2 thread do this at the same time, thread 2 will block at step #3. However, when the first thread commits, thread 2 will continue and the update from step #3 will execute, overwriting the value saved in thread one. -> Lost update. So I don't think this strategy actually works? I need to be able to do SELECT ... FOR UPDATE . Any tips welcome,

http://stackoverflow.com/comment/33252343
has text: You simply return the last because you iterate over the entire list and always store the current item in `copied`.
comment on: http://stackoverflow.com/q/21948791
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21855153
accepted answer: http://stackoverflow.com/a/21855515
tagged with: boolean
score: 0
has comment: http://stackoverflow.com/comment/33084710
has comment: http://stackoverflow.com/comment/33084935
has title: Java - An array of int that will return Boolean and the index
has answer: http://stackoverflow.com/a/21855469
has comment: http://stackoverflow.com/comment/33084184
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33084218
has comment: http://stackoverflow.com/comment/33085055
tagged with: java
has answer: http://stackoverflow.com/a/21855483
has answer: http://stackoverflow.com/a/21855316
has comment: http://stackoverflow.com/comment/33084415
has answer: http://stackoverflow.com/a/21855232
has body: Is there a way for java to check an array of integers for a specified user input and return boolean value and also the index where it resides? I have my way but I also wanted to know which index did it found the exact integer Snippet of the code: int numUser = Integer.parseInt(inputUser); boolean ispresent = false; for(int x = 0; x&lt;=4; x++){ if(sum[x] == numUser){ ispresent = true; }else{ ispresent = false; } } if(ispresent== true){ System.out.println("The number is in the array"); }else{ System.out.println("The number is not in the array"); }
has answer: http://stackoverflow.com/a/21855190
type: Question
linked to: http://stackoverflow.com/q/4962361
tagged with: arrays
answer count: 6
possible better answer: http://stackoverflow.com/a/21855190
has answer: http://stackoverflow.com/a/21855515

http://stackoverflow.com/a/21978763
has comment: http://stackoverflow.com/comment/33370197
score: 5
type: AcceptedAnswer
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/21939246
has body: A few options, in order from least-hacky to most-hacky: Acknowledge that mocking a Car here makes as little sense as mocking a Serializable, and that you should actually pick an implementation to mock. You won't have the same trouble mocking a concrete BigCar or Pickup, and you can run through a few different implementations in a few test cases. Refactor to a common properly-polymorphic interface as TrustNoOne described, rather than using ersatz polymorphism the way you have here. I know you may have your hands tied, but whoever stumbles across this question next might not. You can do something similar to what you're describing—matching methods by name instead of signature—by supplying a default Answer when you create the mock: Car car = Mockito.mock(Car.class, new Answer&lt;Object&gt;() { @Override public Object answer(InvocationOnMock invocation) { if (invocation.getMethod().getName().equals("isVeryBig")) { return false; } // Delegate to the default answer. return Mockito.RETURNS_DEFAULTS.answer(invocation); } }; Bear in mind, though, that your particular situation (of being able to downcast to one of a variety of implementations with different signatures) may require use of the extraInterfaces feature to let Java downcast as needed, which makes this entire thing tricky and fragile. You'd probably be better off using one of the other above solutions instead.
answers question: http://stackoverflow.com/q/21939246
downvote count: 0

http://stackoverflow.com/a/21917599
score: 0
answers question: http://stackoverflow.com/q/21917165
has body: //Normalize your XML then create a Document by that XML then follow the below code NodeList nList = doc.getElementsByTagName("foo"); for (int temp = 0; temp &lt; nList.getLength(); temp++) { // loop for foo Node nodeTable = nList.item(temp); Element xmlFoo = (Element) nodeTable; if (nodeTable.getNodeType() == Node.ELEMENT_NODE) { NodeList nodeListFoo1 = xmlFoo.getElementsByTagName("foo1"); for (int i = 0; i &lt; nodeListFoo1.getLength(); i++) { // loop for foo1 Node nodefoo2 = nodeListFoo1.item(i); Element elementfoo1 = (Element) nodefoo2; // Collect foo2 NodeList nodeListfoo2Name = elementfoo1.getElementsByTagName("foo2"); for (int j = 0; j &lt; nodeListfoo2Name.getLength(); j++) { //// loop for foo2 Node nodefoo2Name = nodeListfoo2Name.item(j); Element elementfoo2Name = (Element) nodefoo2Name; //TODO: write code here, what you want to collect from foo2 } } } }
accepted answer of: http://stackoverflow.com/q/21917165
type: Answer
type: AcceptedAnswer

http://stackoverflow.com/q/21915189
has answer: http://stackoverflow.com/a/21920519
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21920519
has title: Loading docx file from resources folder in runnable jar
has body: I need to load an existing docx template and I would like to include the template file inside the jar so there would only be the jar file for the user. I've tried the following ... String inputfilepath = (getClass().getResource("/letter.docx")).toString(); WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage .load(new java.io.File(inputfilepath)); However, I think because .load(File) is expecting a File parameter it cannot load the docx. Is there a way to load the file for WordprocessingMLPackage from the resources folder? Thanks
score: 2
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/docx
upvote count: 2
tagged with: resources
type: Question
tagged with: java
tagged with: docx4j

http://stackoverflow.com/q/21985118
tagged with: maven
has comment: http://stackoverflow.com/comment/33317267
answer count: 0
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33316505
has comment: http://stackoverflow.com/comment/33316890
has title: intellij new maven project have an error
type: Question
has comment: http://stackoverflow.com/comment/33317064
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/33316842
upvote count: 1
has body: I create a new maven web project in intellij. I add tomcat server for it and in deployment section of server add my artifact. My project name is spline and output directory in project structure-aritfact is: C:\Users\abasaleh\Desktop\myChart\spline\out\artifacts\spline. when I run it, I encounter with this alert: C:\Users\abasaleh\Desktop\myChart\spline\out\artifacts\spline\spline.war not found for the web module. and this server error: [2014-02-24 01:58:34,679] Artifact spline: Error during artifact deployment. See server log for details. please help me. thankes. my pom.xml is: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 spline spline 1.0-SNAPSHOT
favorite count: 0
linked to: http://stackoverflow.com/q/5351948
type: UnansweredQuestion

fix-protocol
tags question: http://stackoverflow.com/q/22004162
type: Tag
tag name: fix-protocol

http://stackoverflow.com/comment/33441488
has text: Are you sure your application halts unexpectedly? Is there a chance that it just runs to the end and prints nothing?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21927099
type: QuestionComment

http://stackoverflow.com/comment/33229013
comment on: http://stackoverflow.com/a/21928077
score: 0
type: AnswerComment
has text: 975125351237 is 9.78818477144237E12, so that's entirely as expected. I'd suggest you read up on floating point, scientific notation, then how to tell java what format you want integers turned to strings with
type: Comment

http://stackoverflow.com/comment/33343243
type: Comment
type: QuestionComment
has text: @DavidWallace: I checked the html code of the page, it cojntains it : <th...... User Rating Num Votes 1. Guardians of the Galaxy (2014)
comment on: http://stackoverflow.com/q/21998827
score: 0

http://stackoverflow.com/comment/33172486
has text: Sorry for the unformatted code snippet, I somehow can't get it right. I can't found code formatter..
type: QuestionComment
comment on: http://stackoverflow.com/q/21904177
score: 0
type: Comment

http://stackoverflow.com/comment/33209910
type: QuestionComment
score: 2
has text: Yep, you never initialize it.
type: Comment
comment on: http://stackoverflow.com/q/21925178

http://stackoverflow.com/q/21864726
tagged with: java
has comment: http://stackoverflow.com/comment/33102338
type: Question
tagged with: jodatime
has answer: http://stackoverflow.com/a/25673303
accepted answer: http://stackoverflow.com/a/25673303
has body: my version of JodaTime is 2.2. I have code: DateTimeFormatter df = DateTimeFormat.forPattern("HHmmss"); DateTime dt = df.parseDateTime(time); which throws error: Caused by: java.lang.IllegalArgumentException: Invalid format: "060000" is malformed at "" at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:871) Please help me to understand what am I doing wrong.
answer count: 1
has comment: http://stackoverflow.com/comment/33102254
has title: Invalid format exception parsing string to JodaTime
score: 0
tagged with: datetime
has comment: http://stackoverflow.com/comment/33102929
tagged with: parsing
has comment: http://stackoverflow.com/comment/33102167
type: AnsweredQuestion

http://stackoverflow.com/comment/33197373
score: 0
type: AnswerComment
has text: @Jakub Godoniuk tnx I use opencvs and expects for a String[]..you have an idea to do this without reflection?
type: Comment
comment on: http://stackoverflow.com/a/21917155

http://stackoverflow.com/comment/33264297
comment on: http://stackoverflow.com/a/21955601
type: AnswerComment
score: 0
type: Comment
has text: it.remove () removes the player from the list.

http://stackoverflow.com/q/21893726
has comment: http://stackoverflow.com/comment/33154622
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/218384
accepted answer: http://stackoverflow.com/a/21893779
score: -1
has body: I have a program I need to write for a project that has been giving me a boat load of trouble. I'm writing a guessing game that allows you to try to guess a number and for you to give a number and the computer will try to guess it. My major problem is getting the computer to guess and when I try to make it guess it gives me a null pointer exception and I can't figure out how. I know it's a lot but I would be extremely grateful for any help. This is my program... (I will put ///// by the place where I get the null pointer exception) import java.util.Scanner; public class NumberGuessClient { public static void main(String[]args) { Scanner kb = new Scanner (System.in); Die number1 = new Die(99); int guess; String highLow; System.out.println("What is your name?"); HumanPlayer player1 = new HumanPlayer(kb.next(), 0, 0, 100, 0, 0); ComputerPlayer computer = new ComputerPlayer(100, "Computer", 0, 0, 0, 0, 100, 1); System.out.println(player1.toString()); System.out.println("How many points would you like to wager?"); player1.setWager(kb.nextInt()); while(player1.getWager() &gt; player1.getBalance()) { System.out.println("You don't have that many points to wager."); System.out.println("How many points would you like to wager?"); player1.setWager(kb.nextInt()); } //computer chooses number, human player guesses int num = number1.roll(); player1.setGuess(-5); int guesses = 0; while (player1.getGuess() != num) { System.out.println("Enter your guess."); player1.setGuess(kb.nextInt()); if(player1.getGuess() &lt; num) { System.out.println("Guess is too low!"); guesses++; } else { if(player1.getGuess() &gt; num) System.out.println("Guess is too high!"); guesses++; } } System.out.println("Congratulations!!! You took " + guesses + " turns to guess correctly."); if(guesses &gt;= 10){ System.out.println("You took to many guesses. You lose."); player1.lose(); System.out.println(player1.toString()); } else{ System.out.println("You win!"); player1.win(); System.out.println(player1.toString…
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/21893779
favorite count: 0
linked to: http://stackoverflow.com/q/2707322
type: AnsweredQuestion
has title: Null pointer exception when generating a random number
upvote count: 0

http://stackoverflow.com/a/34517868
has body: Try Reading input as character stream and use Input source to encode. UTF-8 need's to be read character by character. InputStream can't be encoded as UTF-8. Something like this will help you. If you are parsing XML make sure you read clob as Something.getcharacterStream(); Reader F; F=clob.getcharacterStream(); (If getting clob from database make sure you are reading it as character stream) BuffeReader Readfile = new BufferReader(F); InputSource Encode = new InputSource(Readfile); Encode.setEncoding("UTF-8");
type: Answer
answers question: http://stackoverflow.com/q/21994616
score: 0

http://stackoverflow.com/q/21843505
has answer: http://stackoverflow.com/a/21843831
has answer: http://stackoverflow.com/a/21843563
has title: Calculating max field goal percentage in a method in java program
answer count: 3
has answer: http://stackoverflow.com/a/21843600
score: 0
accepted answer: http://stackoverflow.com/a/21843563
possible better answer: http://stackoverflow.com/a/21843600
type: AnsweredQuestion
tagged with: java
type: Question
has body: Have to find both max and min in a set of data of a team's field goal percentage. import java.io.*; import java.util.Scanner; public class kstatebball { public static void main(String [] args) throws FileNotFoundException { Scanner in = new Scanner(new File("data1.txt")); String[] firstname = new String [100]; String[] lastname = new String [100]; int fgm[] = new int [100]; int fga[] = new int [100]; double fgp = 0; int maxFGP; int minFGP; System.out.print(" Player FGM FGA FGP%\n"); int count = 0; for( int i = 0;in.hasNext(); i++) { firstname[i] = in.next(); lastname[i] = in.next(); fgm[i] = in.nextInt(); fga[i] = in.nextInt(); fgp = (1.0 * fgm[i]) / (1.0 * fga[i]) * 100; count++; System.out.printf("%10s %10s %3d %3d %3.1f \n",firstname[i],lastname[i],fgm[i],fga[i],fgp); } maxFGP = maxFGP(fgm,fga,count); minFGP = minFGP(fgm,fga,count); System.out.printf("\n\nThe player with the highest field goal percentage is: %3d ",maxFGP(fgm,fga,count)); System.out.printf("\nThe player with the lowest field goal percentage is : %3.1f",fgp); } public static int maxFGP(int[] fgm, int[] fga, int count) { int max = 0; for(int i = 0; i &lt; count; i++) { if((1.0 * fgm[i]) / (1.0 * fga[i]) * 100 &gt; max) max = i; } return max; } public static int minFGP(int[]fgm, int[]fga, int count) { int min = 0; for(int i = 0; i &gt; 13; i++) { if(fgm[i] &gt; fgm[count]) count = i; } return min; } } Need help with the "if" statement for it to return the correct max. We have our percentages for all of the players, but need to use the methods in order to find the player with the greatest field goal percentage and also the lowest. Here's the data file I am using: Marcus Foster 123 288 Thomas Gipson 102 178 Shane Southwell 88 224 Will Spradling 58 144 Wesley Iwundu 53 111 Nino Williams 49 96 Nigel Johnson 28 80 Jevon Thomas 15 58 D.J. Johnson 34 68 Omari Lawrence 27 65 Shawn Meyer 2 4 Ryan Schultz 2 9 Jack Karapetyan 1 4 Brian Rohleder 1 2

http://stackoverflow.com/a/21946880
has comment: http://stackoverflow.com/comment/33249771
downvote count: 1
score: 2
answers question: http://stackoverflow.com/q/21946482
type: Answer
has body: another cool way is using enum, that way adding new swap value is easy, just add a mapping into the enum public enum swap{ a('b'), b('a'), t('r'), r('t'), z('z'); private swap(char c){ this.value=c; } public final char value; } and the use is: public char change(char x) { swap swapObject = swap.valueOf(Character.toString(x)); return swapObject.value; }
has comment: http://stackoverflow.com/comment/33251674
upvote count: 3

http://stackoverflow.com/q/21967984
has title: Html Select tag with numbers end to a variable JSP
has answer: http://stackoverflow.com/a/21968048
type: Question
has body: I have a number (0 - 10) stored in a variable. I want to display a select tag in my JSP page, which would start from 0 and end to that number. How can I do that? For example, if number=4, then the select tag would have options 0, 1, 2, 3 and 4.
answer count: 2
tagged with: jstl
accepted answer: http://stackoverflow.com/a/21968048
tagged with: jsp
tagged with: javascript
tagged with: html-select
possible better answer: http://stackoverflow.com/a/21968083
has answer: http://stackoverflow.com/a/21968083
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33286788
score: 0
tagged with: java

http://stackoverflow.com/comment/33094577
has text: In the original code (since edited) no strings were created anywhere. "foo" was a string literal that pre-existed.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21860647
type: Comment

http://stackoverflow.com/a/21977640
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/33424793
has body: mProgressBar.setProgress(i); if(i == 0) { mProgressBar.setProgress(100); } if you want your counter automatically restarts when it reaches 0 uses this. otherwise do the opposite
answers question: http://stackoverflow.com/q/21971627

http://stackoverflow.com/q/21969395
tagged with: servlets
downvote count: 0
has answer: http://stackoverflow.com/a/21988093
tagged with: jsp
has title: Java Servlets Forwarding a view in which there is a link to a css
favorite count: 0
has answer: http://stackoverflow.com/a/21970147
answer count: 3
score: 2
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33290004
has comment: http://stackoverflow.com/comment/33291688
type: Question
has answer: http://stackoverflow.com/a/21986061
tagged with: java
has body: I have a servlet in which doGet and doPost call a processRequest method. processRequest method: protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); request.setAttribute("content", this.getViewContent(request, response)); request.getRequestDispatcher("views/layouts/default.jsp").forward(request, response); } getViewContent method: protected String getViewContent(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { CharArrayWriterResponse content = new CharArrayWriterResponse(response); request.getRequestDispatcher("views/frontend/home.jsp").forward(request, content); return content.getOutput(); } default.jsp: &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/&gt; &lt;link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/assets/css/style.css" /&gt; &lt;/head&gt; &lt;body&gt; &lt;%= request.getAttribute("content") %&gt; &lt;/body&gt; &lt;/html&gt; The problem is that the style.css file returns: HTTP Status 500 - Cannot forward after response has been committed I haven't touched the web.xml. Using apache tomcat 7+ under 64bit ubuntu.

http://stackoverflow.com/comment/33299292
type: Comment
has text: I am still getting the error though after adding to three line of codes.
comment on: http://stackoverflow.com/a/21975052
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33297093
score: 0
comment on: http://stackoverflow.com/q/21973719
type: QuestionComment
type: Comment
has text: Well I am sorry for the messy code, I was just frustrated and post it unformated like that. I am new to stackoverflow, first time asking for code help online. I will try to get better in the future.

http://stackoverflow.com/a/21903824
answers question: http://stackoverflow.com/q/21903539
type: Answer
has body: Observe this statement once, swhere=swhere.substring(0,swhere.length()-1); replace the above statement with the following shere=swhere.substring(0,swhere.length()-2); Because an extra comma(,) is included in your sql statement.
score: 0

http://stackoverflow.com/comment/33209299
type: Comment
score: 1
has text: A copy constructor is just a special case of "new object". Clone is simply a way to invoke a copy constructor. There is no difference to speak of, other than it's usually not that useful to copy other objects vs create new ones with new content.
type: QuestionComment
comment on: http://stackoverflow.com/q/21924802

http://stackoverflow.com/q/21890331
has body: I need to pull the phone orientation as an integer from 1-360 without using OrientationEventListener to check onOrientationChanged() Can this be done? I've done a good bit of Googling and haven't gotten far. Thanks
has comment: http://stackoverflow.com/comment/33148319
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21890897
type: Question
has comment: http://stackoverflow.com/comment/33148092
tagged with: android
tagged with: orientation
has comment: http://stackoverflow.com/comment/33148434
score: 0
tagged with: java
answer count: 2
accepted answer: http://stackoverflow.com/a/21890897
linked to: http://stackoverflow.com/q/2795833
has answer: http://stackoverflow.com/a/21890653
has comment: http://stackoverflow.com/comment/33148379
has title: android - how can I get current orientation?
possible better answer: http://stackoverflow.com/a/21890653

http://stackoverflow.com/comment/33102595
score: 0
comment on: http://stackoverflow.com/a/21864714
type: AnswerComment
type: Comment
has text: JLabel lable = new JLabel(); lable.add(new Bubbles(10, 10, 10, null)); lable.setOpaque(false); lable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e ){ System.out.println("mouseClicked"); } });

http://stackoverflow.com/a/21933173
has comment: http://stackoverflow.com/comment/33259510
has body: As you finish with a negative integer the inputNumber will always be less than 4 so if (inputNumber&lt;4 || inputNumber&gt;10) { System.out.println("Invalid grade!"); } is always true. Change it to following (slightly easier to read): do { System.out.print("Input a grade (4-10): "); inputNumber = reader.nextInt(); if (inputNumber&lt;4 || inputNumber&gt;10) { break ; // } sum += inputNumber; count++; }while (count &lt;= 4) { if (count==0) { System.out.print("You didn't enter any data!"); }
answers question: http://stackoverflow.com/q/21932974
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33224384

http://stackoverflow.com/comment/33329155
score: 0
type: Comment
type: AnswerComment
has text: Yes I changed line delimiters to UNIX and retried all of the find and replaces with the same results.
comment on: http://stackoverflow.com/a/21990905

http://stackoverflow.com/comment/33094815
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21860834
score: 0
has text: SO I presume it just gives you the ability of the random access file, with a nice abstraction of writing/reading from RAM and good performance

http://stackoverflow.com/comment/33176184
score: 1
has text: I am sorry then, I misunderstood you. Does the stack trace give you any additional information? Because the "No suitable driver..." error sounds strongly like a problem executing DriverManager.getConnection :S
type: AnswerComment
comment on: http://stackoverflow.com/a/21906260
type: Comment

http://stackoverflow.com/a/21985426
has comment: http://stackoverflow.com/comment/33316816
has comment: http://stackoverflow.com/comment/33316773
downvote count: 0
has body: This will be the best way List&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("Krishna"); list.add("Krishna"); list.add("Kishan"); list.add("Krishn"); list.add("Aryan"); list.add("Harm"); Set&lt;String&gt; set=new HashSet&lt;&gt;(list);
answers question: http://stackoverflow.com/q/21985397
type: Answer
has comment: http://stackoverflow.com/comment/33316765
score: 1
upvote count: 1

http://stackoverflow.com/q/21903263
tagged with: nosql
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/23343556
tagged with: java
tagged with: graph-databases
tagged with: tinkerpop
has body: I was wondering whether it's possible to get the corresponding Blueprints Vertex from a Neo4j Node object? I've been having a look at Neo4j's documentation but I cannot manage to find the way to do it...
score: 0
answer count: 2
tagged with: neo4j
has answer: http://stackoverflow.com/a/21903483
has title: How can I convert a Neo4j Node to a Blueprints Vertex?

http://stackoverflow.com/q/21988660
tagged with: recursion
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33322573
has comment: http://stackoverflow.com/comment/33322939
tagged with: java
type: Question
tagged with: algorithm
accepted answer: http://stackoverflow.com/a/21989111
tagged with: maze
score: 0
has title: Recursive Division Random Maze Generation
has answer: http://stackoverflow.com/a/21989111
answer count: 1
has comment: http://stackoverflow.com/comment/33322711
has body: I'm currently doing a project where I want to randomly generate mazes for a game. After studying performance levels etc for maze generation I've decided to use the Recursive Division method. Whilst the explanation of the algorithm is somewhat understandable I'm struggling to formulate the algorithm in a pseudo format so that I can understand it fully and begin coding it. Can someone help me with a detailed explanation of the process or some pseudo-code? All help is greatly appreciated. EDIT: From what I understand I will need to decide whether to divide horizontally or vertically. How is this decision made and what is the process of this division with regards to starting point and finishing point?

http://stackoverflow.com/comment/33165189
comment on: http://stackoverflow.com/a/21899855
type: Comment
score: 0
type: AnswerComment
has text: Ah, what I meant from my previous comment was that what I'm getting at. I might have different numbers of values for this set in different environments, thus using the hard-coded set in the xml won't work. That's why I need to get these values from a properties file

http://stackoverflow.com/comment/33062509
score: 1
has text: that's not garbage, that's the identity hashcode of the object
type: Comment
comment on: http://stackoverflow.com/q/21842449
type: QuestionComment

http://stackoverflow.com/a/21943018
has body: Using BlockingQueue we can achieve this task. As per Java Doc "A Queue that additionally supports operations that wait for the queue to become non-empty when retrieving an element, and wait for space to become available in the queue when storing an element. " More Info enter link description here
score: 0
answers question: http://stackoverflow.com/q/21919016
type: Answer

http://stackoverflow.com/comment/33082542
type: AnswerComment
comment on: http://stackoverflow.com/a/21853600
score: 0
type: Comment
has text: what is said on that page is not what I'm experiencing. you will get error for leaving out the "Autoincrement" field.

http://stackoverflow.com/comment/33301677
comment on: http://stackoverflow.com/a/21976252
score: 0
type: AnswerComment
has text: @user3315017 How does it "not work"? I have no idea how to test this or answer it in a better way because I have no information on your actual code. You pass it a number, assign the return value to a boolean. I'm not sure what's not working.
type: Comment

http://stackoverflow.com/comment/33217069
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21929256
has text: Did you check this - https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/indexing/IndexingOperationListener.java , this is a listener which gets invoked once the index gets updated , see if you can override the postIndex method and then sync up the MySql DB
score: 0

http://stackoverflow.com/comment/33090000
score: 0
has text: Please explain what the 'issues' are
comment on: http://stackoverflow.com/q/21858063
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21885501
tagged with: android
has answer: http://stackoverflow.com/a/21896986
has comment: http://stackoverflow.com/comment/33139883
possible better answer: http://stackoverflow.com/a/21885708
has comment: http://stackoverflow.com/comment/33138831
tagged with: android-tabhost
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21885708
has comment: http://stackoverflow.com/comment/33139683
has comment: http://stackoverflow.com/comment/33139014
tagged with: java
has comment: http://stackoverflow.com/comment/33139814
has comment: http://stackoverflow.com/comment/33140482
has comment: http://stackoverflow.com/comment/33139041
type: Question
has comment: http://stackoverflow.com/comment/33139487
has body: I have Activity that got TabHost. XML file is: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/wikibilim" /> <TextView android:id="@+id/textFavourite" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/wiki" /> In my MainActivity at the begining onCreate method, I wrote: tabHost = (TabHost) findViewById(android.R.id.tabhost); tabHost.setup(); // TabHost.TabSpec tabSpec; View indicator1 = getLayoutInflater().inflate(R.layout.tab1, null); im1 = (ImageView) indicator1.findViewById(R.id.imageView1); View indicator2 = getLayoutInflater().inflate(R.layout.tab2, null); im2 = (ImageView) indicator2.findViewById(R.id.imageView1); View indicator3 = getLayoutInflater().inflate(R.layout.tab3, null); im3 = (ImageView) indicator3.findViewById(R.id.imageView1); TabHost.TabSpec tabSpec; tabSpec = tabHost.newTabSpec("tag1"); tabSpec.setIndicator(indicator1); tabSpec.setContent(R.id.tab1); tabHost.addTab(tabSpec); tabSpec = tabHost.newTabSpec("tag2"); tabSpec.setIndicator(indicator2); tabSpec.setContent(R.id.tab2); tabHost.addTab(tabSpec); tabSpec = tabHost.newTabSpec("tag3"); tabSpec.setIndicator(indicator3); tabSpec.setContent(R.id.tab3); tabHost.addTab(tabSpec); dialog = new ProgressDialog(this); dialog.setMessage(getString(R.string.loading)); dialog.setCanceledOnTouchOutside(false); dictionaryList = (ListView) this.findViewById(R.id.listDictionary); I'm easily uploaded data to dictionaryList using async task. …
answer count: 2
tagged with: listview
has comment: http://stackoverflow.com/comment/33139365
score: 0
accepted answer: http://stackoverflow.com/a/21896986
has comment: http://stackoverflow.com/comment/33140065
has title: Android can not get ListView on second tab

http://stackoverflow.com/comment/33202025
comment on: http://stackoverflow.com/a/21920057
score: 0
type: AnswerComment
type: Comment
has text: @user3334639 See my edit. I think this may be what you're looking for.

http://stackoverflow.com/q/21949399
type: Question
has body: I'm trying to send a soap message that which has a CDATA section that includes another XML, but I'm getting parse error. I need to embed the XML data into the CDATA section. here is my code down below; import java.rmi.RemoteException; import javax.xml.rpc.ServiceException; import org.apache.axis.AxisFault; import com.levo.rec.*; public class REC { public static void main(String args[]) { String mesaj = "&lt;![CDATA[ " + " &lt;REC_DATA xmlns=\"http://www.levo.com/REC\"&gt; " + " &lt;RECheader RECID=\"\" REClabel=\"\"/&gt; " + " &lt;RECattributes&gt; " + " &lt;attribute name=\"USERNAME\" value=\"" + userName + "\"/&gt; " + " &lt;attribute name=\"DATA\" value=\"" + userData + "\"/&gt; " + " &lt;/RECattributes&gt; " + " &lt;/REC_DATA&gt; " + "]]&gt; " ; try { y = new RECPortStub(); y.sendMsg(mesaj); } catch (AxisFault e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } code of "RECPortStub" class is as follows; public class RECPortStub extends org.apache.axis.client.Stub implements com.levo.rec.RECPort { private java.util.Vector cachedSerClasses = new java.util.Vector(); private java.util.Vector cachedSerQNames = new java.util.Vector(); private java.util.Vector cachedSerFactories = new java.util.Vector(); private java.util.Vector cachedDeserFactories = new java.util.Vector(); static org.apache.axis.description.OperationDesc[] _operations; static { _operations = new org.apache.axis.description.OperationDesc[1]; _initOperationDesc1(); } private static void _initOperationDesc1() { org.apache.axis.description.OperationDesc oper; org.apache.axis.description.ParameterDesc param; oper = new org.apache.axis.description.OperationDesc(); oper.setName("sendMsg"); param = new org.apache.axis.description.ParameterDesc( new javax.xml.namespace.QName("", "inputXMLMessage"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName( "http://www.w3.org/2001/XMLSchema"…
downvote count: 0
has comment: http://stackoverflow.com/comment/33253293
has comment: http://stackoverflow.com/comment/41819760
has title: Parse error when embedding XML into the CDATA section in a SOAP Request
answer count: 1
accepted answer: http://stackoverflow.com/a/26603517
tagged with: soap
score: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: character
has comment: http://stackoverflow.com/comment/33253300
type: AnsweredQuestion
tagged with: escaping
has comment: http://stackoverflow.com/comment/33253318
has comment: http://stackoverflow.com/comment/33260838
tagged with: java
has comment: http://stackoverflow.com/comment/33261790
upvote count: 1
has answer: http://stackoverflow.com/a/26603517

http://stackoverflow.com/comment/33181393
comment on: http://stackoverflow.com/a/21882236
type: AnswerComment
score: 0
type: Comment
has text: thanks mthmulders, but dont know how to use ByteArrayOutputStream. Could you please share any example link.

http://stackoverflow.com/comment/33243392
comment on: http://stackoverflow.com/a/21943061
score: 0
type: Comment
has text: @andand Actually, it is an (and, apparently, _the_ answer). It's just a very short one.
type: AnswerComment

http://stackoverflow.com/q/21904443
score: 2
type: Question
has answer: http://stackoverflow.com/a/21905593
accepted answer: http://stackoverflow.com/a/21905593
tagged with: java
has title: Sending XML via CMD, from Java
upvote count: 2
answer count: 1
downvote count: 0
favorite count: 0
has body: I am having trouble getting this code to execute correct. After a hunt about on the internet and trying various things, it still won't. The code below should send a command to an OpenVAS server using "omp". This command works ok from the commandline on the same machine. I think it may have something to do with passing the XML. private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) { try { Runtime rt = Runtime.getRuntime(); String cmdString = "cmd /K omp -u admin -w admin --xml=\"<create_task> Nigni Deep scan on server 3 <config id='daba56c8-73ec-11df-a475-002264764cea'/><target id='2c57a13e-5174-4c88-83ec-13a1e18f1f75'/></create_task>\""; System.out.println(cmdString); Process pr = rt.exec(cmdString); // Process pr = rt.exec("c:\\helloworld.exe"); BufferedReader input = new BufferedReader(new InputStreamReader( pr.getInputStream())); String line = null; while ((line = input.readLine()) != null) { System.out.println(line); jTextArea1.append(line + "\n\n"); } int exitVal = pr.waitFor(); System.out.println("Exited with error code " + exitVal); } catch (Exception e) { System.out.println(e.toString()); e.printStackTrace(); } } Any help would be greatly appreciated Thanks
tagged with: openvas
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: netbeans

http://stackoverflow.com/q/21931802
tagged with: time-format
has title: How to use java7 to get current Windows time format
has comment: http://stackoverflow.com/comment/33231065
type: UnansweredQuestion
has body: Currently, both display language and format language of Windows 7 are English. So the short time format is "h:mm tt" Run the following code: Date today = Calendar.getInstance().getTime(); DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT, Locale.getDefault()); String dateOut = timeFormatter.format(today); System.out.println("short: " + dateOut); Get the result: short: 10:36 AM Then change the short time format to "H:mm", run the code again, still get the result: short: 10:36 AM But what I expect is short: 10:36 And I don't want to hard code the format pattern, it should be following the short time format changes. Does anyone have any idea? Thanks a lot.
has comment: http://stackoverflow.com/comment/33221585
has answer: http://stackoverflow.com/a/21932046
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33398820
type: Question
has comment: http://stackoverflow.com/comment/33230486
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/a/21947986
has comment: http://stackoverflow.com/comment/33250801
answers question: http://stackoverflow.com/q/21947873
score: 0
has comment: http://stackoverflow.com/comment/33250710
type: Answer
has body: Why don't you clone the object before persisting it? Why do you clone it after un-persisting it?... Anyhow, have you tried to load the object from the cache? For performance reasons, you don't need to hit the database if your object resides in the cache. Gadget savedGadg = (Gadget) session.load(Gadget.class, gadg.getId()); Further you may need to initialize the object (and perhaps its fields), all before committing the transaction. Hibernate.initialize(savedGadg); Hibernate.initialize(savedGadg.getCertainCollection());

http://stackoverflow.com/comment/33754536
has text: Actually I'm getting: `org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee(requiredType=RestContext,parent=RestContextFilter,qualifiers={}),position=0,optional=false,self=false,unqualified=null,1983762179)`. Did my binding not work? I added a `RestContextBinder.class` to the list of classes in the constructor of my `ResourceConfig` object. Is that not going to work?
comment on: http://stackoverflow.com/a/22228988
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33142032
has text: The IO/Controller might be an additional bottleneck, it doesn't necessarily have to be the disk itself; I've seen that first-hand on a development machine. But it might just as easily be the configuration of the Java runtime that is off. A dump of the runtime configuration settings would be in order to rule that out.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21887015

http://stackoverflow.com/q/21879010
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21879545
type: UnansweredQuestion
tagged with: servlets
has answer: http://stackoverflow.com/a/21881810
answer count: 4
has answer: http://stackoverflow.com/a/21879260
tagged with: jsp
has body: I want to create a global session in JSP to be used in all Servlets and JSP files as is done in PHP with the instruction: &lt;?php session_start (); ?&gt; Tried with: HttpSession s = request.getSession (); and set. It works, but I have to make several passes from one class to another to have it in another JSP file. How can I do?
type: Question
has title: How to create global session in JSP?
tagged with: php
has answer: http://stackoverflow.com/a/21879267

http://stackoverflow.com/a/21979843
has comment: http://stackoverflow.com/comment/33321890
has comment: http://stackoverflow.com/comment/33321422
upvote count: 2
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21979699
score: 1
has body: 1 : yes it's ok! and you can add some other options. see http://logging.apache.org/log4j/2.x/manual/configuration.html 2 : you can use a HTMLLayout for your file appender. see http://logging.apache.org/log4j/2.x/manual/layouts.html and http://www.tutorialspoint.com/log4j/log4j_htmllayout.htm

http://stackoverflow.com/q/21988039
tagged with: netbeans
has title: Explanation of java output (hibernate)
tagged with: java
has comment: http://stackoverflow.com/comment/33321508
tagged with: hibernate
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33321925
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/33321990
has body: When I run a java project: but the application does not fails. What is the message? My other project (with hibernate) don't have such messages. How can hide this messages?
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21988368

http://stackoverflow.com/comment/33352023
type: AnswerComment
has text: Thank you TylerAndFriends for your straightforward answer :D I'm grateful :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22004553

http://stackoverflow.com/q/21970077
has body: I am running some insert queries using JDBC's executeBatch method. Let me first explain a little bit about the application. There's a web app which will send some insert statements to a cache in async way when user navigates through some webpages. When the size of the cached queries grows to certain number, say 'n', the queries will be executed as a batch using the executeBatch method of JDBC. I am not really from a DB background and not sure how to come up with the value of 'n'. What all factors will determine it and how do I figure out some approximate value mathematically before doing load test. As far as usage is concerned, I am expecting around 72000 insert queries in an hour and the priority is the smooth running of the web app and not insertion of the data. Please suggest. Edit - update number of queries to 72000 per hour from 2000, my apologies, had wrong data before :(
has title: Optimum number of insert queries in a Batch Execute
possible better answer: http://stackoverflow.com/a/21991144
type: AnsweredQuestion
tagged with: sql
downvote count: 0
has answer: http://stackoverflow.com/a/21991144
score: 1
has answer: http://stackoverflow.com/a/21970353
type: Question
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/21970353
favorite count: 0
has comment: http://stackoverflow.com/comment/33291681
has comment: http://stackoverflow.com/comment/33290396
has comment: http://stackoverflow.com/comment/33290466
answer count: 2
upvote count: 1
tagged with: performance
tagged with: java
has comment: http://stackoverflow.com/comment/33326617

http://stackoverflow.com/a/22193258
type: Answer
has comment: http://stackoverflow.com/comment/33701298
downvote count: 1
upvote count: 0
score: -1
has body: 2014-02-24 13:02:31,258 [INFO] HTTPSender - Unable to sendViaPost to url[http://127.0.0.1:8081/axis2/services/MYSERVICE1.MYSERVICE1HttpSoap12Endpoint/] Well, if you look closely, the message which you are trying to catch isn't an ERROR at all. It's an INFO log generated from HTTPSender. Only thing which you should catch in this entire stacktrace is java.net.ConnectException and check for message Connection refused. You can make it easier for your clients though and provide a message, by wrapping the java.net.ConnectException with message Connection refused or throwing a custom exception with the original exception as the cause. UPDATE java.net.ConnectException is an elementary exception in network transactions. Generally standard libraries do not catch them unless there is something specific to be done. In this case, if you are unable to catch hold of java.net.ConnectException, then you can look out to catch AxisFault thrown by org.apache.axis2.description.OutInAxisOperationClient.send. Below snippet may be useful for you. try { ... } catch (RemoteException ex) { if(ex instanceof AxisFault){ logger.error("Axis Fault error: " + ((AxisFault)ex).getFaultString()); throw new CustomExcpetion(" Custom Message "); } } Also note that AxisFault is a subclass of java.rmi.RemoteException and this will not get caught when you use java.lang.Exception in a catch statement. Shishir
has comment: http://stackoverflow.com/comment/33726403
answers question: http://stackoverflow.com/q/21987322
has comment: http://stackoverflow.com/comment/33690207

http://stackoverflow.com/a/29853050
type: Answer
answers question: http://stackoverflow.com/q/21877127
score: 9
upvote count: 9
has body: I've found one very narrow use case when this will be a problem. If you are running Android system app, with android:sharedUserId="android.uid.system" in manifest, either pre-installed to the device, or signed with the platform certificate, and you are trying to call System.loadLibrary twice to load the same library (either by running the same app twice, or creating two separate system apps loading the same library), Android will reboot. Invoking JNI method from this library, if it was not yet loaded, will not generate an exception when running inside android.uid.system process, as with normal Android app - it will reboot Android. To prevent that, and find out if the library was already loaded, you can read file /proc/self/maps and search for your library name there. ClassLoader and reflection will not help here - they will show JNI methods as accessible even when the library is not yet loaded. Note that you cannot do if (Runtime.getRuntime().exec("/system/bin/grep &lt;library-name&gt; /proc/self/maps").waitFor() == 0) - system process is forbidden from launching any external commands by SELinux, you will have to read the file from the Java code. Another quirk is that the library must be preinstalled to device to the /system/lib directory - if you bundle the library with your app, and install the app to device, library will end up in /data/app/..../lib, and when you will try lo load it from /data partition, well you already guessed - Android will reboot.
downvote count: 0
has comment: http://stackoverflow.com/comment/47903430

http://stackoverflow.com/a/21947545
upvote count: 8
type: Answer
score: 8
answers question: http://stackoverflow.com/q/21947375
has body: Your approach is fine. If you prefer to use more built-in BitSet methods, you can clone the first bit set and do a logical AND with the second then check for equality with the second. private static boolean containsAll(BitSet s1, BitSet s2) { BitSet intersection = (BitSet) s1.clone(); intersection.and(b2); return intersection.equals(s2) }
accepted answer of: http://stackoverflow.com/q/21947375
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33336282
comment on: http://stackoverflow.com/q/21992936
type: Comment
type: QuestionComment
has text: check the last update @AthaNor
score: 0

http://stackoverflow.com/comment/98529580
has text: This is actually a better example than the accepted answer because it shows a more typical usage than `doNothing()`
comment on: http://stackoverflow.com/a/40411151
type: AnswerComment
type: Comment
score: 8

http://stackoverflow.com/comment/33310206
type: Comment
type: QuestionComment
has text: gosh, the reason is in the type of thrown exception
score: 0
comment on: http://stackoverflow.com/q/21981321

http://stackoverflow.com/comment/33214879
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21928277
has text: what regex did you try so far?

http://stackoverflow.com/comment/66188656
type: AnswerComment
comment on: http://stackoverflow.com/a/21916904
type: Comment
has text: But what if you want to replace a literal dot? The OP's example is a toy one, not reflective of real world edge cases.
score: 1

http://stackoverflow.com/comment/33082630
score: 1
type: Comment
type: QuestionComment
has text: It depends on how the list is created. Show us the code of `myMethod2.getAllItems()`
comment on: http://stackoverflow.com/q/21854353

http://stackoverflow.com/a/21881108
answers question: http://stackoverflow.com/q/21875920
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21875920
type: Answer
has body: Change the character set to unicode and try &lt;%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;

http://stackoverflow.com/q/21941238
has title: resteasy return 403 not handle in junit
has answer: http://stackoverflow.com/a/21945561
has body: This is in a reference of Return HTTP error from RESTeasy interface I am doing the same just for reference @Path("/foo") public class FooBar { @GET @Path("/bar") @Produces("application/json") public Object testMethod(@HeaderParam("var_1") @DefaultValue("") String var1, @HeaderParam("var_2") @DefaultValue("") String var2 { if (var1.equals(var2)) { return "All Good"; } else { throw new WebApplicationException(HttpURLConnection.HTTP_FORBIDDEN); } } } But when it throws the error I can not catch it in my junit test. It is not comming in any asserts below. @Test @RunAsClient public void test403() { try { Object obj = fooBarService.testMethod("test2", "test"); Assert.assertFalse(true); } catch(WebApplicationException ex) { Assert.assertTrue(true); } } How to check the 403 ? Thank you
tagged with: resteasy
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/9694169
accepted answer: http://stackoverflow.com/a/21945561
type: Question
score: 0
tagged with: junit
answer count: 1

http://stackoverflow.com/a/22319647
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21888535
type: Answer
has comment: http://stackoverflow.com/comment/33926512
accepted answer of: http://stackoverflow.com/q/21888535
has body: What you are seeing is expected, because you are (probably) comparing two different things: When forcing a rebuild in the Eclipse IDE, you are simply compiling all java-files. (For our 270-bundle project, this takes about 1-2 minutes.) When building with PDE-build, you are packaging the product as well (generating bundles and features, resolving plugin dependencies, JAR-ing everything, etc), and this takes much more time. (For our project this takes about 6-7 minutes.) The equvivalent of this in the IDE would be to open your .product file, and on the "overview"-tab in the editor, you select "eclipse product export wizard". As for tips on how to speed up the build: There is no silver bullet that I know of. But: Search for "tycho build eclipse", and/or see http://www.vogella.com/tutorials/EclipseTycho/article.html and https://eclipse.org/tycho/. In other words: You can change your build to use Tycho, which enabeles you to build each plugin separately (and incrementally if you want).
upvote count: 2

http://stackoverflow.com/comment/33172546
type: Comment
has text: Beaten to it :p I also make `sourcesJar` (which you call `packageSources` depend on `classes`; it avoids generating a source jar if the source fails to compile :p
score: 6
type: AnswerComment
comment on: http://stackoverflow.com/a/21904270

http://stackoverflow.com/comment/33151379
has text: @user2962401 I meant the `Marking` class, not `MarkingBean`.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21891886

http://stackoverflow.com/a/21857855
answers question: http://stackoverflow.com/q/21857528
has body: I would probably use URLEncodedUtils from Appache Commons. String url = "http://www.website.com/search?productId=1500"; List&lt;NameValuePair&gt; paramsList = URLEncodedUtils.parse(new URI(url),"utf-8"); for (NameValuePair parameter : paramsList) if (parameter.getName().equals("productId")) System.out.println(parameter.getValue()); outpit 1500. But if you really want to use regex you can try Pattern p = Pattern.compile("[?&amp;]productId=(\\d+)"); Matcher m = p.matcher(url); // _____________↑ group 1 if (m.find()) // | System.out.println(m.group(1));
upvote count: 8
type: AcceptedAnswer
score: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/21857528
downvote count: 0

http://stackoverflow.com/comment/33271284
comment on: http://stackoverflow.com/a/21910930
score: 0
type: AnswerComment
type: Comment
has text: I have figured this out. I do have operadriver.jar in my repository, but it was broken. I fixed it by deleting this file and rebuild the project. Thanks for your help!

http://stackoverflow.com/comment/33535866
score: 0
has text: Thank you Abhinav for your prompt input. The token generated is the same as before and differs from SOAPUI generated one.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21944778

http://stackoverflow.com/q/21986752
has answer: http://stackoverflow.com/a/21986805
has body: I'm using the following code: List&lt;Object&gt; dest = new LinkedList&lt;Object&gt;(); Collections.copy(oldList, src); When i execute the code, I get an exception: java.lang.IndexOutOfBoundsException: Source does not fit in dest at java.util.Collections.copy(Collections.java:589) I know how to fix that, but what i don't understand is: When i add elements manually, the list would increase the capacity automaticly. Why can't Collections#copy do that?
upvote count: 6
has answer: http://stackoverflow.com/a/21986903
tagged with: list
tagged with: java
has answer: http://stackoverflow.com/a/21987034
tagged with: collections
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21987006
has answer: http://stackoverflow.com/a/21986984
score: 5
answer count: 6
has answer: http://stackoverflow.com/a/21987391
has title: Why doesn't Collections.copy increase the size of the destination?
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/33105012
type: Comment
comment on: http://stackoverflow.com/q/21866014
type: QuestionComment
has text: @qqilihq, So basically, I have a database which contains two tables - customer and house. Customer table has a column called noOfTimesRecycled and tagNo. In a text file, I have a list of tagNo and the number of times that they appear in that file gets stored in the fiel noOfTimesRecycled. So in the updateTag class, this is what I'm trying to do! So I first call the getCustomer method from my DatabaseInterface to be able to have an update method on it. Hope it makes more sense now.
score: 0

http://stackoverflow.com/q/21843269
tagged with: if-statement
tagged with: java
has answer: http://stackoverflow.com/a/21843286
type: Question
has body: import java.util.Scanner; import java.util.Random; public class random { public static void main(String[] args) { System.out.println("===== CS302 TOOL BOX ====="); System.out.println("T &gt; COIN TOSS SIMULATOR"); System.out.println("G &gt; GRADE ESTIMATOR"); System.out.println("C &gt; COLOR CHALLENGE"); System.out.println("Q &gt; QUIT"); System.out.print("Type code letter for your choices: "); String Menuchoices = "TGCQ"; String initial_input = scanner.next(); String code_choice = initial_input.toUpperCase(); boolean code_letter; if (code_choice.equals(Menuchoices.substring(0,1)) ||code_choice.equals(Menuchoices.substring(1,2)) ||code_choice.equals(Menuchoices.substring(2,3)) ||code_choice.equals(Menuchoices.substring(3,4))); {System.out.println("success");} else {System.out.println("Failure");} } } Eclipse won't allow me to put this else statement in. Any ideas why?
answer count: 1
score: -1
favorite count: 0
tagged with: compiler-errors
has title: Eclipse won't allow me to use an else statement while trying to validate user input
type: UnansweredQuestion
downvote count: 2
upvote count: 1

http://stackoverflow.com/comment/33081223
has text: @LadislavDANKO yes, I just run test class with main method.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21850865

http://stackoverflow.com/comment/33332689
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21993531
type: Comment
has text: As I mentioned, it's a suggestion for a general threading-scheme, rather than a specific solution to your problem. I have added a description line above each of the coding blocks provided in the answer. And as I mentioned in the previous comment, if it's completely unhelpful to your needs then I will remove it.

http://stackoverflow.com/comment/33092064
type: Comment
has text: You're basically asking if you can, via a URL, load a class that is completely outside of your control. This would let me do something like take all your app's bytecode--surely this would be the most epic security whole ever.
score: 3
comment on: http://stackoverflow.com/q/21859378
type: QuestionComment

http://stackoverflow.com/comment/33218347
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21911419
has text: Yes mail.smtp=mock is commented ? It's regular ?

http://stackoverflow.com/comment/33066765
score: 0
comment on: http://stackoverflow.com/q/21844180
type: Comment
type: QuestionComment
has text: And the output still contains comma delimiters.

http://stackoverflow.com/a/21892466
score: 0
type: Answer
has body: The onPostExecute() method of AsyncTask is is used to provide an output to the user about what happens within the AsyncTask. Since you cannot pass on an Exception to onPostEexecute() (well, theoretically, you could - but it's obviously more important to pass the result which is not an exception), the best option in your case would be to set a flag depending on whether the method passed or failed and then read this flag in onPostExecute() and then proceed to do whatever it is that you need to do.
answers question: http://stackoverflow.com/q/21892289

listview
tags question: http://stackoverflow.com/q/21886678
tags question: http://stackoverflow.com/q/21853826
tags question: http://stackoverflow.com/q/21995125
tags question: http://stackoverflow.com/q/21867720
tags question: http://stackoverflow.com/q/21991857
tags question: http://stackoverflow.com/q/21953786
tags question: http://stackoverflow.com/q/21896357
tags question: http://stackoverflow.com/q/21866309
tag name: listview
tags question: http://stackoverflow.com/q/21937327
tags question: http://stackoverflow.com/q/21885501
tags question: http://stackoverflow.com/q/21912534
tags question: http://stackoverflow.com/q/21924500
tags question: http://stackoverflow.com/q/21899543
tags question: http://stackoverflow.com/q/22002709
tags question: http://stackoverflow.com/q/21915254
tags question: http://stackoverflow.com/q/21999151
tags question: http://stackoverflow.com/q/21943308
tags question: http://stackoverflow.com/q/21944845
tags question: http://stackoverflow.com/q/21981456
tags question: http://stackoverflow.com/q/21962495
tags question: http://stackoverflow.com/q/21919841
tags question: http://stackoverflow.com/q/21988625
type: Tag
tags question: http://stackoverflow.com/q/21953655
tags question: http://stackoverflow.com/q/21894766

http://stackoverflow.com/q/21950157
favorite count: 0
tagged with: memory-management
has title: Java-after many iterations, why won't string variable hold full filename?
has answer: http://stackoverflow.com/a/21950295
tagged with: memory-leaks
has body: Here's a brief outline of my Java code to upload archive files to a server. It's been working fine for a couple years. But it usually just uploads a small number of files at a time. Now it is needing to upload hundreds or thousands. And it is failing after a large-ish number of iterations. public class BatchUploader implements Runnable { private int processUploads() { String myFilename; try { BufferedReader input = new BufferedReader(new FileReader(infile)); try { while (!stopRunning &amp;&amp; (myFilename = input.readLine()) != null) { if (myFilename.trim().isEmpty()) { continue; } myFile = FileHelper.getFileFromFullyQualifiedName(myFilename); upload(myFile); } } finally { input.close(); isUploading = false; } } } } After several hundred to several thousand uploads, I get an error like this: 02/20 23:17:05.314 java.io.FileNotFoundException: /home/baz (No such file or directory): java.io.FileInputStream.open(Native Method) java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:137) java.io.FileReader.&lt;init&gt;(FileReader.java:72) bk.a(SourceFile:41) bk.d(SourceFile:123) aU.e(SourceFile:181) aU.run(SourceFile:24) java.lang.Thread.run(Thread.java:679) The problem is that the string containing the path to the file (held in the String var myFilename) is truncated. Instead of /home/baz is should be /home/bazillion/data/filename.arc Something seems to run out of memory in this loop. I have no idea what is going on. Can anyone give a suggestion? Would it help to break out of the while-loop after a certain count, then resume after a few minutes? To add insult to injury, the list of filenames to upload is wiped out after this exception. I'm sure there's an easy fix for that in my code, but I don't know what it is. I don't work in Java much.
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33255063
score: 1
tagged with: java
tagged with: memory
type: Question
accepted answer: http://stackoverflow.com/a/21950295
linked to: http://stackoverflow.com/q/21958636
answer count: 1
downvote count: 0
tagged with: file-upload
has comment: http://stackoverflow.com/comment/33254933

http://stackoverflow.com/comment/33330006
comment on: http://stackoverflow.com/q/21992659
type: Comment
type: QuestionComment
score: 2
has text: Don't google it, just try it and see what happens. What do you think will happen?

http://stackoverflow.com/comment/33195601
type: QuestionComment
comment on: http://stackoverflow.com/q/21913859
score: 0
has text: Thanks Gilberto. I didn't use @RemoteServiceRelativePath("comp/ChartGenerator") in my RPC interface. Just now I added this relative path and test my application again, the error is still the same. Any suggestion?
type: Comment

http://stackoverflow.com/q/21919057
favorite count: 0
has comment: http://stackoverflow.com/comment/33327991
has comment: http://stackoverflow.com/comment/33331330
accepted answer: http://stackoverflow.com/a/21932227
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33203185
has body: I am going crazy with this problem! My solution is in Java - I have tried different inputs and haven't been able to reproduce the alleged wrong answer. Maybe someone here could possibly point to my solutions bottlenecks? The verdict I am getting from UVa judge is "Wrong Answer". // FOUND THE SOLUTION - I WAS PRINTING null chars at the end of some lines ('\u0000'). The problem is solved by adding if(maze[j][i] != '\u0000') before calling bufferedWriter.write(maze[j][i] Thanks to everyone! The intial code: import java.io.*; class Main { public static final int MAX_NUMBER_OF_LINES = 31; public static final int MAX_NUMBER_OF_CHARACTERS_PER_LINE = 81; public static char[][] maze; public static boolean[][] visitedLocations; public static int numberOfMazes; public static int numberOfLines; public static int numberOfChars; public static BufferedReader bufferedReader; public static BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(System.out)); public static void main(String args[]) throws IOException { readFromStandardInput(); bufferedWriter.flush(); } public static void readFromStandardInput() throws IOException { bufferedReader = new BufferedReader(new InputStreamReader(System.in)); String line; numberOfMazes = Integer.parseInt(bufferedReader.readLine()); int lineCounter = 0; while (numberOfMazes &gt; 0) { maze = new char[MAX_NUMBER_OF_CHARACTERS_PER_LINE][MAX_NUMBER_OF_LINES]; visitedLocations = new boolean[MAX_NUMBER_OF_CHARACTERS_PER_LINE][MAX_NUMBER_OF_LINES]; lineCounter = 0; while ((line = bufferedReader.readLine()) != null) { if (line.charAt(0) == '_') { break; } else { constructArrayLineByLine(line, lineCounter); } lineCounter++; } numberOfLines = lineCounter; solvePreviousMaze(); bufferedWriter.write(line); numberOfMazes--; if (numberOfMazes &gt; 0) { bufferedWriter.write("\n"); } } } public static void solvePreviousMaze() throws IOException { for (int i = 1; i &lt; numberOfLines; i++) { for (int j = 1; j &lt; numberOfChars; j++) { if (maz…
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33210607
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33221738
tagged with: algorithm
tagged with: flood-fill
score: 0
has answer: http://stackoverflow.com/a/21932227
answer count: 1
has title: UVa-784 Wrong Answer

http://stackoverflow.com/comment/33246054
comment on: http://stackoverflow.com/q/21945322
type: Comment
has text: Ok, the error is in your `onCreateView` method, could you show me? especially this line: _Gehortestet_intervallerBeginner.java:292_
type: QuestionComment
score: 1

http://stackoverflow.com/comment/33301511
score: 0
type: Comment
has text: My question is how do you connect a boolean method from a different class to the main. I just provided an example code I'm testing to provide a visual example of what I need help on.
comment on: http://stackoverflow.com/a/21976252
type: AnswerComment

http://stackoverflow.com/comment/33220735
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21868601
has text: @Jherico can you explain at more detail how to set up this one at eclipse kepler. you able to write answer for clarify.

http://stackoverflow.com/comment/33236768
has text: @Powerlord So, waiting for another Maven compile eh? ;)
comment on: http://stackoverflow.com/a/21940077
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21995297
downvote count: 0
answers question: http://stackoverflow.com/q/21995185
upvote count: 2
has body: Try changing in the eclipse.ini file. Here is an example configuration -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20120913-144807 -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vmargs -Xms512m -Xmx1024m -XX:+UseParallelGC -XX:PermSize=256M -XX:MaxPermSize=512M
type: Answer
score: 2

http://stackoverflow.com/comment/33238113
score: 0
type: AnswerComment
has text: Nipun, the latest version of Kafka spout provided in storm contrib only support Kafka 0.7.0. See documention here: https://github.com/nathanmarz/storm-contrib/tree/0.9.0-wip16b-scala292/storm-kafka
comment on: http://stackoverflow.com/a/21916356
type: Comment

http://stackoverflow.com/a/21928770
has comment: http://stackoverflow.com/comment/33224132
answers question: http://stackoverflow.com/q/21928653
upvote count: 2
downvote count: 1
has body: Do you need to apply the 2's complement operation to this value, or do you need to just interpret it as a 2's complement number? If the latter, then skip the second line of code below. I think this will work for you. int val = Integer.parseInt("FF30", 16); int result = (~val) + 1; Update Since you imply in your comments that you want the result converted back to a string, that's a simple matter of calling "toHexString" and chopping off any padded bits that were prefixed String hex = "FF30"; int length = hex.length(); long value = Long.parseLong(hex, 16); // convert hex string to long long result = (~value) + 1; // compute the 2's complement // convert the result value back to a hex string (keeping the same length and dropping any sign-extension bits) String resultAsString = Long.toHexString(result); // chop off the prefix of the string so the result is the same length as the input int newLength = resultAsString.length(); if (newLength &gt; length) { resultAsString = resultAsString.substring(newLength-length); } System.out.print(resultAsString);
has comment: http://stackoverflow.com/comment/33215828
type: Answer
score: 1

http://stackoverflow.com/q/21976317
has answer: http://stackoverflow.com/a/21976372
tagged with: string
tagged with: exception
accepted answer: http://stackoverflow.com/a/21976420
tagged with: words
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21976420
possible better answer: http://stackoverflow.com/a/21976372
type: Question
has body: I'm able to compile, but encountering runtime errors when it hits line 12 that reads char x = input.charAt(i); I don't understand why I'm getting this. Is it something to do with the position of charAt(x)? Exception in thread "main" java.lang.StringIndexOutOfBoundsExceptio... String index out of range: 12 at java.lang.String.charAt(String.java:658) at HW12.main(HW12.java:12) import java.util.Scanner; public class HW12 { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("Enter a sentence in the following format: 'EnterASentenceInTheFollowingFormat.'"); String input = keyboard.nextLine(); StringBuilder token = new StringBuilder(); for (int i = 0; i &lt;= input.length(); i++) { char x = input.charAt(i); if (i == 0) { token.append(x); } else if (Character.isLowerCase(x)) { token.append(x); } else if (Character.isUpperCase(x) &amp;&amp; i &gt; 0) { token.append(" "); } } System.out.println(" " + token); } }
tagged with: java
tagged with: bounds
has title: Trying separate words in strings -- getting out of bounds exception on my index
score: 0
answer count: 2

http://stackoverflow.com/comment/33200338
score: 0
has text: Hi, thank you for your answer. I am now getting this error though and I am not too sure what it means? "The argument of type String[] should explicitly be cast to Object[] for the invocation of the varargs method format(String, Object...) from type PrintStream. It could alternatively be cast to Object for a varargs invocation"
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21919528

http://stackoverflow.com/q/21908990
tagged with: junit
has comment: http://stackoverflow.com/comment/33184966
has answer: http://stackoverflow.com/a/21909321
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/34786978
has comment: http://stackoverflow.com/comment/33181516
tagged with: junit-theory
tagged with: java
type: Question
answer count: 2
has title: junit theories resolve to ParameterizedAssertionError instead of failure
score: 0
has body: I run theories test like this @Theory public void qlIsNotNullAndReservationWithRefIdDoesntHaveItemReference( @TestedOn(ints = {100, 200, 300}) final int value) { assertTrue("should be no error", false); } It will always end up in ParameterizedAssertionError errors without any meaningful message. As there anyway to show a "proper" failure with message? Logs: [INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ stock --- [INFO] Compiling 25 source files to /Users/user/repository/reboot/trunk/company-stock/target/test-classes [INFO] [INFO] --- maven-surefire-plugin:2.14.1:test (default-test) @ stock --- [INFO] Surefire report directory: /Users/user/repository/reboot/trunk/company-stock/target/surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Picked up _JAVA_OPTIONS: -Xms1024m -Xmx1024m -XX:MaxPermSize=512m Running de.company.stock.webservice.CornerCaseAnalysisIT Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.265 sec &lt;&lt;&lt; FAILURE! test1(de.company.stock.webservice.CornerCaseAnalysisIT) Time elapsed: 0.082 sec &lt;&lt;&lt; ERROR! org.junit.experimental.theories.internal.ParameterizedAssertionError: test1(ints) at org.junit.Assert.fail(Assert.java:88) at org.junit.Assert.failNotEquals(Assert.java:743) at org.junit.Assert.assertEquals(Assert.java:118) at org.junit.Assert.assertEquals(Assert.java:555) at de.company.stock.webservice.CornerCaseAnalysisIT.test1(CornerCaseAnalysisIT.java:60) Results : Tests in error: ? ParameterizedAssertion test1(ints) Tests run: 1, Failures: 0, Errors: 1, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 46.763s [INFO] Finished at: Thu Feb 20 17:57:56 CET 2014 [INFO] Final Memory: 34M/989M [INFO] -----------------------------------------------------…

http://stackoverflow.com/q/21985416
favorite count: 0
has title: How to replace zk session HttpSession in Java
has comment: http://stackoverflow.com/comment/33358645
upvote count: 1
tagged with: zk
downvote count: 1
has answer: http://stackoverflow.com/a/21985868
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33319626
tagged with: session
tagged with: java
accepted answer: http://stackoverflow.com/a/21985868
type: Question
has comment: http://stackoverflow.com/comment/33321454
has body: I have a ZK web project that had .zul files with corresponding composers.I am trying to remove .zul files and replacing them by .jsp files. Please have a look at the following snippet of code and suggest if I can replace them with HttpSession ? Please also let me know if I need to provide further additional information. Any suggestions/feedbacks/guidance would be appreciated.Thanks in advance. Code Snippet import org.zkoss.zk.ui.Session; import org.zkoss.zk.ui.Sessions; public static void loadUserCustomProperties(String userFolder){ // Create a properties object with system wide properties as defaults Properties userCustomProperties = new Properties(CustomProperties); Session session = Sessions.getCurrent(); //Line 5 session.setAttribute(Constants.USER_PROPERTIES, userCustomProperties); //Line 6 }
score: 0
answer count: 1

http://stackoverflow.com/comment/33192647
type: AnswerComment
comment on: http://stackoverflow.com/a/21913346
has text: How would you suggest I do that? I tried adding the textFields outside the paintComponent and I get errors every time. Are you saying add the textFields inside the extended JPanel class, but outside the paintComponent? Or add it somewhere in the Main constructor, which is where I am adding PaintPane to the Frame?
type: Comment
score: 0

http://stackoverflow.com/comment/33254652
comment on: http://stackoverflow.com/a/21949939
type: Comment
score: 0
type: AnswerComment
has text: Yes, let's say, for example: after animation finishes, wait 3 seconds, show `ActionBar`.

http://stackoverflow.com/comment/33356377
comment on: http://stackoverflow.com/a/22004340
score: 0
type: AnswerComment
has text: Thanks and I do submit and follow AppEngine bug reports. What I meant to ask was whether bug reports about GoogleCredential.Builder() should go to AppEngine or elsewhere, or whether this is about File(). I second your getResourceAsStream suggestion.
type: Comment

http://stackoverflow.com/comment/33270748
comment on: http://stackoverflow.com/a/21921069
score: 0
type: AnswerComment
has text: Thank you for your answer but this not what I was looking for. I already tried ignoring the case when adding the order but it wasn't working as expected. Thanks anw
type: Comment

http://stackoverflow.com/q/21922209
has comment: http://stackoverflow.com/comment/33205524
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33205436
has answer: http://stackoverflow.com/a/21922243
has title: Android App crash with two activity
score: 0
has body: I follow this tutorial and i follow all the steps but when i start the app on my device it says it crashed.So i want to make the MainActivity show first and then if i click a Action bar menu, it will load the second activity (upload.java) ant it will show the upload_layout.I'm training making app for android so i'm not good to program ;) HERE MY CODE: MainActivity.java package com.example.tosseapp.app; import android.content.Intent; import android.content.res.AssetManager; import android.content.res.Resources; import android.media.AudioManager; import android.media.MediaPlayer; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.*; import java.io.IOException; import java.io.FileInputStream; import java.io.IOException; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public void tosse1(View v) { Button one = (Button)this.findViewById(R.id.button1); final MediaPlayer mp = MediaPlayer.create(this, R.raw.toxxe); one.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Resume the music player mp.start(); } }); } public void tosse2(View v) { Button two = (Button)this.findViewById(R.id.button2); final MediaPl…
tagged with: android
has comment: http://stackoverflow.com/comment/33205334
has comment: http://stackoverflow.com/comment/33205040
has comment: http://stackoverflow.com/comment/33205960
has comment: http://stackoverflow.com/comment/33205266
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33205353
has answer: http://stackoverflow.com/a/21923350

http://stackoverflow.com/a/21970372
type: Answer
answers question: http://stackoverflow.com/q/21970256
score: 0
has body: You can use regular expressions to extra data from a String: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html and more specifically http://docs.oracle.com/javase/7/docs/api/java/util/regex/Matcher.html

http://stackoverflow.com/comment/106758620
has text: I'm able to logout with 200 response. But suppose token flush, when i try to access some API using postman with that token it allow me to do that.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/32320860

http://stackoverflow.com/q/21951606
has title: AppStateManager cannot be resolved - Cloud Save
upvote count: 3
tagged with: java
type: Question
score: 3
tagged with: google-play-services
answer count: 2
has body: I am having trouble adding Cloud Save to my app. I have already added Leaderboards and Achievements so my Activity extends BaseGameActivity. These are the links I am following: https://developers.google.com/games/services/android/cloudsave https://github.com/playgameservices/android-samples/blob/master/BasicSamples/CollectAllTheStars/src/main/java/com/google/example/games/catt/SaveGame.java https://developers.google.com/games/services/common/concepts/cloudsave#conflicts However, when I, for example, type this code taken directly from the sample AppStateManager.update(getApiClient(), OUR_STATE_KEY, mSaveGame.toBytes()); There is an error on AppStateManager and getApiClient(). AppStateManager cannot be resolved and getApiClient() is undefined for MainActivity. I think part of the problem is that import com.google.android.gms.appstate.AppStateManager; does not exist is my google play services library.
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21953043
has answer: http://stackoverflow.com/a/33058367
tagged with: google-play-games
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/21954515
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/135871484
type: Question
tagged with: rotation
has body: I want to do a multiple animations on my image (appear -> rotate -> disappear). I've got this code: fade_in.xml <?xml version="1.0" encoding="utf-8"?> <alpha android:duration="1" android:fromAlpha="0" android:toAlpha="100" /> fade_out.xml <?xml version="1.0" encoding="utf-8"?> <alpha android:duration="1" android:fromAlpha="100" android:toAlpha="0" /> image_rotate.xml <?xml version="1.0" encoding="utf-8"?> <rotate android:duration="2500" android:pivotX="50%" android:pivotY="50%" android:toDegrees="120" /> Also in my java code: animRotate= AnimationUtils.loadAnimation(context, R.anim.image_rotate); animRotate.setDuration((long) duration); fade_in = AnimationUtils.loadAnimation(context, R.anim.fade_in); fade_out = AnimationUtils.loadAnimation(context, R.anim.fade_out); AnimationSet s = new AnimationSet(false); s.addAnimation(fade_in); s.addAnimation(animRotate); s.addAnimation(fade_out); image.startAnimation(s); but unfortunately it doesn't work correctly...
has title: Animations appear, rotate and disappear
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/21956211
accepted answer: http://stackoverflow.com/a/21956211
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/33262148
tagged with: android
tagged with: animation
type: AnsweredQuestion

http://stackoverflow.com/q/21944732
favorite count: 0
has title: Converting numbers to words in Java
has body: My program is to convert numbers between 0 and 100 to words. I'm not sure which strategy would be best to go about this but I would like to use math operators like modules, etc.This is what I've got so far. package project.pkg1; import java.util.Scanner; public class Project1 { public static final int MINUMUN_NUMBER = 0; public static final int MAXIMUM_NUMBER = 100; public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int num, x; do{ System.out.println("Enter a number between 0 and 100: "); num = keyboard.nextInt(); } while ((num &lt; 0) || (num &gt; 100)); if(num == 0) System.out.println("zero"); if(num == 100) System.out.println("one hundred"); I don't want to use the if(num == x) every time. My validation trap to make sure it is between 0 and 100 works fine. I'm just not sure how to approach the rest of it. This is what I can get to print: run: Enter a number between 0 and 100: -1 Enter a number between 0 and 100: 101 Enter a number between 0 and 100: 34 BUILD SUCCESSFUL (total time: 23 seconds) I need that 34 to print "thirty four" Any feedback would be greatly appreciated!
has answer: http://stackoverflow.com/a/21945053
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33244777
has comment: http://stackoverflow.com/comment/33244853
tagged with: module
has answer: http://stackoverflow.com/a/21944857
has comment: http://stackoverflow.com/comment/33244758
tagged with: numbers
has comment: http://stackoverflow.com/comment/33244790
tagged with: java
has comment: http://stackoverflow.com/comment/33244869
upvote count: 1
linked to: http://stackoverflow.com/q/3911966
type: Question
has answer: http://stackoverflow.com/a/21944776
duplicate of: http://stackoverflow.com/q/3911966
answer count: 3
has comment: http://stackoverflow.com/comment/33245106
tagged with: words
downvote count: 0
score: 1

http://stackoverflow.com/q/21896589
favorite count: 0
has body: This is homework. I am trying to find every occurrence of a Sunday landing on the first of a month between Jan 1 1900 (which we are assuming was a Monday) and Dec 31 of a year that the user inputs. The calendar extension is off-limits. I am returning dates in the correct format, but they do not match up with the example code our instructor provided. In the given example, an input of 1902 should return: 1 Apr 1900 1 Jul 1900 1 Sep 1901 1 Dec 1901 1 Jun 1902 For 1902, my code returns: 1 Mar 1900 1 Jan 1901 1 Apr 1901 1 May 1901 1 Feb 1902 1 Jun 1902 1 Jul 1902 import java.util.Scanner; public class Sundays { public static void main(String[] args) { Scanner reader = new Scanner(System.in); System.out.print("Enter the ending year: "); int userInputYear = reader.nextInt(); int[] orderedLengthOfMonthsArray = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; String[] orderedNamesOfMonthsArray = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; int month = 0; int dayOfWeek = 1; // initialized to MONDAY Jan 1, 1900 -- Sunday would be #7 int dayOfMonth = 1; for (int year = 1900; year &lt;= userInputYear; year++) { for (month = 0; month &lt; orderedLengthOfMonthsArray.length; month++) { for (dayOfMonth = 1; dayOfMonth &lt;= orderedLengthOfMonthsArray[month]; dayOfMonth++) { dayOfWeek++; if (dayOfMonth == 1 &amp;&amp; dayOfWeek == 7) { System.out.println(dayOfMonth + " " + orderedNamesOfMonthsArray[month] + " " + year); } if (dayOfWeek == 8) { dayOfWeek = 1; } } } } } }
has answer: http://stackoverflow.com/a/21897021
possible better answer: http://stackoverflow.com/a/21896708
upvote count: 1
answer count: 4
has answer: http://stackoverflow.com/a/21897662
linked to: http://stackoverflow.com/q/6850874
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33159863
has title: Finding every first Sunday of the month between 1900 and a user-input year
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33160205
type: Question
accepted answer: http://stackoverflow.com/a/21897021
has answer: http://stackoverflow.com/a/21901080
tagged with: date
downvote count: 0
has answer: http://stackoverflow.com/a/21896708

static
tags question: http://stackoverflow.com/q/21917917
tags question: http://stackoverflow.com/q/21943025
tags question: http://stackoverflow.com/q/21971143
tags question: http://stackoverflow.com/q/21923269
tags question: http://stackoverflow.com/q/21940162
tags question: http://stackoverflow.com/q/21976467
tags question: http://stackoverflow.com/q/21951306
tags question: http://stackoverflow.com/q/21893385
tags question: http://stackoverflow.com/q/21857063
tags question: http://stackoverflow.com/q/21942059
tags question: http://stackoverflow.com/q/21902306
tags question: http://stackoverflow.com/q/21998655
tags question: http://stackoverflow.com/q/21864807
tags question: http://stackoverflow.com/q/21864252
tags question: http://stackoverflow.com/q/21857326
tag name: static
tags question: http://stackoverflow.com/q/21975471
tags question: http://stackoverflow.com/q/21872406
tags question: http://stackoverflow.com/q/21943647
tags question: http://stackoverflow.com/q/21968212
type: Tag
tags question: http://stackoverflow.com/q/21915537
tags question: http://stackoverflow.com/q/21851477
tags question: http://stackoverflow.com/q/21869969

http://stackoverflow.com/q/21999750
accepted answer: http://stackoverflow.com/a/22000071
duplicate of: http://stackoverflow.com/q/564
has comment: http://stackoverflow.com/comment/78678909
tagged with: android
has answer: http://stackoverflow.com/a/21999797
possible better answer: http://stackoverflow.com/a/21999773
answer count: 4
has answer: http://stackoverflow.com/a/22000071
tagged with: integer
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21999773
has body: which is the best way to set already defined int to null? private int xy(){ int x = 5; x = null; //-this is ERROR return x; } so i choose this private int xy(){ Integer x = 5; x = null; //-this is OK return (int)x; } Then i need something like : if(xy() == null){ // do something } And my second question can i safely cast Integer to int? Thanks for any response.
type: Question
has title: How to set to int value null? Java Android
score: 1
tagged with: java
tagged with: int
upvote count: 3
downvote count: 2
has answer: http://stackoverflow.com/a/21999806
tagged with: null
linked to: http://stackoverflow.com/q/564
favorite count: 0

http://stackoverflow.com/comment/33116681
type: Comment
has text: I guess there's some mistake! The first solution which you provided has the same code from my question!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21872790

http://stackoverflow.com/q/21958519
upvote count: 3
type: Question
type: AnsweredQuestion
has body: I am trying to push following method onto android: On my PC-version I got a color which keeps changing it's hue: (The update method gets repeatedly called every 5ms or so): int hue = 0; Color color; public void update() { hue += 0.0125; color = Color.getHSBColor(hue, 1, 1); } This method gives returns me a color permanently changing its color. I would like to use this method on android, too, but there I am missing the Color.getHSBColor() feature... Any ideas how to change the hue of an android color? In addition to this question: How can I apply this color to my paint? paint.setColor() requires an integer.
tagged with: java
has title: how to use getHSBColor() in android Color or android Paint?
accepted answer: http://stackoverflow.com/a/21959136
score: 3
answer count: 1
downvote count: 0
favorite count: 0
tagged with: colors
tagged with: android
has answer: http://stackoverflow.com/a/21959136

http://stackoverflow.com/comment/57333177
comment on: http://stackoverflow.com/q/21992901
type: Comment
has text: Back in the day, when we did email integration, we implemented our own handler using Apache JAMES http://james.apache.org/server/ which seemed more robust in general.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33134900
type: Comment
comment on: http://stackoverflow.com/a/21883096
has text: jsf is one of many java web mvc frameworks out there. your pages should be sending requests to the front controller, which passes them on to action/handler classes.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33274336
type: Comment
comment on: http://stackoverflow.com/a/21960166
has text: Again .. recognize what is different between the student "types", in this case ONLY the hourly cost is different. So best practice would be to create an array of the hourly costs and determine the index into that array ... then you only have to write the rest of the statements once.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21962574
tagged with: binary-search-tree
accepted answer: http://stackoverflow.com/a/21962733
type: Question
has comment: http://stackoverflow.com/comment/33312372
score: 0
tagged with: java
upvote count: 1
downvote count: 1
answer count: 1
tagged with: api
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33277183
has answer: http://stackoverflow.com/a/21962733
has body: My assignment asks me to implement a point set API class using a binary search tree, using java.util.TreeSet. the PointSet API outline is shown below: public class PointSET { public PointSET() {} // construct an empty set of points public boolean isEmpty() {} // is the set empty? public int size() {} // number of points in the set public void insert(Point2D p) {} // add the point p to the set (if it is not already in the set) public boolean contains(Point2D p) {} // does the set contain the point p? public Collection&lt;Point2D&gt; range(RectHV rect) {} // all points in the set that are inside the rectangle public Point2D nearest(Point2D p) {} // a nearest neighbor in the set to p; null if set is empty } The Point2 object is a simple point with x and y coordinates and a few other methods to calculate distances between two points. The RectHV object represents a rectangle used in a range search for points within the rectangle. I guess I'm unsure of how to implement this API class in a BST. We've learned about BST's in class, but only in a broad sense; what they are and the postorder/preorder/inorder ways to search through them. I'm also confused as to what an API is in and of itself. What makes this an API as opposed to something that is not an API? What does "implementing" the API involve? and how do I use java.util.TreeSet to do it? I would appreciate any help.
favorite count: 0
has title: Using a binary search tree to implement a set of points

http://stackoverflow.com/comment/33188029
type: AnswerComment
has text: Like I said in my answer, using public-everything is bad *as a default* but using them *when it makes sense* doesn't automatically get you kicked out of the Java club.
comment on: http://stackoverflow.com/a/21910859
score: 0
type: Comment

http://stackoverflow.com/q/21940966
type: Question
has body: I have an RCP application in Eclipse 4.x for a cross-platform software. I would like to place the osgi.instance.area in the application specific folder. For example on Windows it generally is C:\Users[Username]\AppData[Name]. Something similar to the directories outlined here - http://www.chromium.org/user-experience/user-data-directory. I have seen the solution here - https://bugs.eclipse.org/bugs/show_bug.cgi?id=241192 but I haven't understood it really well. I use the product editor on Eclipse and under the Configuration tab, I have added the osgi.instance.area property in the Properties section with another directory at the moment. Then I tried the solution from the bug - $APPDATA$/COMPANY/PROGRAM/instance but I couldn't find the directory anywhere at the expected location. Also, how does this work for Linux and Mac OS X?
has answer: http://stackoverflow.com/a/21942250
tagged with: eclipse
answer count: 2
possible better answer: http://stackoverflow.com/a/21942250
downvote count: 0
favorite count: 0
tagged with: eclipse-rcp
has answer: http://stackoverflow.com/a/22467354
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22467354
has title: Eclipse RCP: application specific folder
upvote count: 1

http://stackoverflow.com/comment/33219913
type: Comment
type: QuestionComment
has text: maybe, if you do some spelling mistake in <form action="". then No action should not process.
score: 1
comment on: http://stackoverflow.com/q/21929436

http://stackoverflow.com/q/21870912
accepted answer: http://stackoverflow.com/a/21871218
has comment: http://stackoverflow.com/comment/33113196
has answer: http://stackoverflow.com/a/21871218
type: AnsweredQuestion
tagged with: java
tagged with: jboss
type: Question
has body: made an application api rest and I need to recover parameters web.xml but not as I am using jboss 7.1 WEB-INF --lib --web.xml
answer count: 1
has comment: http://stackoverflow.com/comment/33113486
has title: how to retrieve parameters in web.xml jboss
tagged with: servlets
score: 0

http://stackoverflow.com/a/21886166
upvote count: 1
has body: first of all, all your code that is currently showing is mixing up some things... You define a @JoinTable annotation, which means that you have 3 tables, 1 with units, 1 with modules and one with the id's of both entities in it... 2nd remark I have is that you talk about a One-To-Manny relationship between a module and units, but in your example code you put a Many-To-Many... If I follow your description I would build it like this in code: @Entity @Table(name = "unit") public class Unit { @Column(name = "nid") private int nid; @Id @GeneratedValue @Column(name = "unnr") private int unnr; @Column(name = "unhwtype") private int unhwtype; @Column(name = "unslot") private int unslot; @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name = "nid") private Module module; @Entity @Table(name = "module") public class Module { @Column(name = "nid") private int nid; @Id @Column(name = "mpos") private int mpos; @Column(name = "mhwtype") private int mhwtype; @OneToMany(mappedBy = "module", cascade = {CascadeType.ALL}) private Set units; The problem her is that I'm not sure if this is going to work, since the nid is not an ID column in the module Entity, I think you will need to change your design so that nid is an Id column... You can give it a try with this code and hope it works, otherwise change the nid in the module Entity to an ID..
has comment: http://stackoverflow.com/comment/33142484
downvote count: 0
has comment: http://stackoverflow.com/comment/33192248
type: Answer
answers question: http://stackoverflow.com/q/21883366
score: 1

http://stackoverflow.com/q/21927871
has title: How to get a random integer in java?
has answer: http://stackoverflow.com/a/21927915
linked to: http://stackoverflow.com/q/7961788
has answer: http://stackoverflow.com/a/21927910
upvote count: 3
has answer: http://stackoverflow.com/a/21927928
accepted answer: http://stackoverflow.com/a/21927910
possible better answer: http://stackoverflow.com/a/21927908
has body: I'm trying to get a random integer, but the way I'm doing it takes a really long time to get that random number ( like 10 seconds!) Random generator=new Random(); do { id=generator.nextInt(); } while(id&lt;=0||id&gt;=4); I'm trying to get a random number between (and include) 0 to 4 This code so far gets the job done, but 10 seconds is too long! what is a better way to do this? Thanks!
has answer: http://stackoverflow.com/a/21927908
tagged with: java
has comment: http://stackoverflow.com/comment/33214226
answer count: 5
has comment: http://stackoverflow.com/comment/33214297
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33214351
type: Question
linked to: http://stackoverflow.com/q/20837579
score: 3
has answer: http://stackoverflow.com/a/21927938

memory
tags question: http://stackoverflow.com/q/21969231
tag name: memory
tags question: http://stackoverflow.com/q/21936237
tags question: http://stackoverflow.com/q/21890216
tags question: http://stackoverflow.com/q/21976467
tags question: http://stackoverflow.com/q/21919703
tags question: http://stackoverflow.com/q/21920113
tags question: http://stackoverflow.com/q/21998655
type: Tag
tags question: http://stackoverflow.com/q/21963972
tags question: http://stackoverflow.com/q/21950157

http://stackoverflow.com/comment/33225071
type: Comment
has text: the problem is you override the coords with every iteration in the while loop. if you dont store temp into a list of coordinates...now you are printing temp in the loop and it works, but if you want to access the coordinates after the loop, it wont work because you have only the last coordinates in temp object.
type: AnswerComment
comment on: http://stackoverflow.com/a/21934059
score: 0

http://stackoverflow.com/q/21946855
tagged with: synchronization
has comment: http://stackoverflow.com/comment/33248728
has comment: http://stackoverflow.com/comment/33249725
has comment: http://stackoverflow.com/comment/33254041
tagged with: sockets
has comment: http://stackoverflow.com/comment/33259378
has comment: http://stackoverflow.com/comment/33251464
has answer: http://stackoverflow.com/a/21947184
has comment: http://stackoverflow.com/comment/33248901
has comment: http://stackoverflow.com/comment/33258003
linked to: http://stackoverflow.com/q/6672413
accepted answer: http://stackoverflow.com/a/21947184
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/33250511
type: Question
has comment: http://stackoverflow.com/comment/33260028
has comment: http://stackoverflow.com/comment/33260082
type: AnsweredQuestion
has body: I actually had a much bigger question, but I reduced it: How does Socket.connect() behave when close() was called on that Socket before, but no connection attempt was made previously? Multithreading/Threads is related, because I have one thread that is doing the connecting and one that invokes this and may abort the connection before being connected. Due to the joys of multithreading, an abort could be made before connect() is actually called, even if I synchronized-check with a boolean before. (lets say the abort code gets called just before connect() is doing its work, but after connect() was called - at the beginning of the method for example.) Some code, heavily reduced: public class Connecter { private Socket socket; public void connect() { // start the connecting thread, synchronized } public void abort() { // synchronized as well: closes the socket, nulls the refernce, sets a boolean value to true (aborted) } private class ConnectingThread extends Thread { public void run() { try { // synchronized: create a socket object and set stuff such as TCP_NODELAY socket.connect(new InetSocketAddress(ip, port)); // handle stuff afterwards, synced of course } catch (Exception ex) { // wow. such exceptions. much handling. } } } }
has comment: http://stackoverflow.com/comment/33250661
has comment: http://stackoverflow.com/comment/33249031
score: 0
has title: Socket.connect after close but before being connected
has comment: http://stackoverflow.com/comment/33250785
answer count: 1
has comment: http://stackoverflow.com/comment/33248789

http://stackoverflow.com/a/56646715
upvote count: 1
answers question: http://stackoverflow.com/q/21912390
type: Answer
has body: I propose this "simple" solution to read a csr You must add dependency with org.bouncycastle bcmail-jdk15on 1.62 Create new object CSRObject import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.x500.RDN; import org.bouncycastle.asn1.x500.X500Name; import org.bouncycastle.openssl.PEMParser; import org.bouncycastle.pkcs.PKCS10CertificationRequest; import java.io.*; public class CSRObject { private final X500Name x500Name; public CSRObject(final String csr) throws IOException { final Reader pemReader = new StringReader(csr); final PEMParser pemParser = new PEMParser(pemReader); x500Name = ((PKCS10CertificationRequest) pemParser.readObject()).getSubject(); } public String get(final CSRObjectEnum field) { RDN[] rdnArray = x500Name.getRDNs(new ASN1ObjectIdentifier(field.code)); String retVal = null; for (RDN item : rdnArray) { retVal = item.getFirst().getValue().toString(); } return retVal; } public enum CSRObjectEnum { COUNTRY("2.5.4.6"), STATE("2.5.4.8"), LOCALE("2.5.4.7"), ORGANIZATION("2.5.4.10"), ORGANIZATION_UNIT("2.5.4.11"), COMMON_NAME("2.5.4.3"),// ; private final String code; CSRObjectEnum(final String sCode) { code = sCode; } } } And you can test with this method : @Test public void test() throws IOException { final CSRObject csr = new CSRObject(TEST_CERTIF); for (final CSRObject.CSRObjectEnum field : CSRObject.CSRObjectEnum.values()){ LOGGER.info("{}:{}", field.name(), csr.get(field)); } } with TEST_CERTIF is String private static final String TEST_CERTIF = "-----BEGIN CERTIFICATE REQUEST-----\n" + "...\n" + "-----END CERTIFICATE REQUEST-----\n";
downvote count: 0
score: 1

http://stackoverflow.com/a/21882714
has comment: http://stackoverflow.com/comment/33134561
has comment: http://stackoverflow.com/comment/33135007
score: 0
answers question: http://stackoverflow.com/q/21872096
type: Answer
has body: There are multiple ways to approach this. You could populate an array (or a List, or some other data structure) with some predefined rectangles and sprites. Then you could choose from the data structure randomly when you want to add a rectangle to the world. Or you could generate the rectangles on the fly using a random number generator. Which approach you take depends entirely on your context, which we don't have.

http://stackoverflow.com/comment/33318164
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21985883
type: Comment
has text: Btw thanks for the code. For final Iterator<Map.Entry<String, JsonNode>> iterator = input.get("List").get("Summary"); I have a problem of cast "cannot convert from JsonNode to Iterator<Map.Entry<String,JsonNode>>"

http://stackoverflow.com/a/21862609
type: Answer
has comment: http://stackoverflow.com/comment/33201545
has comment: http://stackoverflow.com/comment/33098537
has comment: http://stackoverflow.com/comment/33201861
has body: To answer your question, I don't think that you need a chain of certificates. I already used tomcat with a self signed server certificate and connected to it with another self signed client certificate. I don't know about tomEE but I guess it would be the same. To help you figure out what is goining on, I think about these possible debugging actions: before going into automation, try to make things work without scripting. Generating the right configuration will than be easier. make sure the script is running correctly: check if tje contents of the stores are as expected and make sure the server.xml files point to the right ones. Try to test the servers separately using a browser client authentication if you can. Above all, make sure you really need https between your servers. If you are in a protected realm, you are probably over using security and just slowing your application.
has comment: http://stackoverflow.com/comment/33098600
score: 0
answers question: http://stackoverflow.com/q/21859371
has comment: http://stackoverflow.com/comment/33198096

http://stackoverflow.com/a/21982708
answers question: http://stackoverflow.com/q/21982512
has comment: http://stackoverflow.com/comment/33313557
has body: As the compiled class is in WEB-INF/classes if you do not have to the servlet context you could open the file at ../../images/picture.jpg
score: 0
has comment: http://stackoverflow.com/comment/33312600
has comment: http://stackoverflow.com/comment/33312493
type: Answer
has comment: http://stackoverflow.com/comment/33312933
has comment: http://stackoverflow.com/comment/33312442

http://stackoverflow.com/a/21970055
answers question: http://stackoverflow.com/q/21957123
type: Answer
has body: This might not be the best way, but it's a way: apply plugin: 'java' task unjar &lt;&lt;{ ant.unzip(src: jar.archivePath, dest: "$buildDir/somefolder") { ant.cutdirsmapper(dirs: "1") } } Just change the src and dest arguments to your needs.
score: 0

http://stackoverflow.com/comment/33303854
has text: _but it will not work_ How do you figure?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21977659

http://stackoverflow.com/comment/33174902
comment on: http://stackoverflow.com/q/21904186
score: 0
type: Comment
type: QuestionComment
has text: are you able to show the desired value in jsp

http://stackoverflow.com/q/21949998
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 0
score: -4
has answer: http://stackoverflow.com/a/21950648
type: Question
tagged with: java
has title: Save data from online text file to local variable
answer count: 2
downvote count: 4
has body: If I have a text file online containing a string. How can I pull the data from it and save it into a local String variable? For example, say there is a file located at www.myserver.com/File.txt and it only contains one line: "12345" How can I have my app read the file, and save the "12345" as a string variable that can be used within the app? So here is how I managed to do this: final AsyncTask &lt; Object, Object, String &gt; task = new AsyncTask &lt; Object, Object, String &gt; () { protected String doInBackground (Object. . .o) { try { URL site = new URL ("www.myserver.com/File.txt"); Scanner s = new Scanner (site.openStream ()); return s.nextLine (); } catch (MalformedURLException e) { throw new RuntimeException ("Incorrect URL", e); } catch (IOException e) { throw new RuntimeException ("Can't fetch file content from url", e); } }
has answer: http://stackoverflow.com/a/21950033

python
tags question: http://stackoverflow.com/q/21869056
tags question: http://stackoverflow.com/q/21941819
tag name: python
tags question: http://stackoverflow.com/q/21995426
tags question: http://stackoverflow.com/q/21973182
tags question: http://stackoverflow.com/q/21909165
tags question: http://stackoverflow.com/q/21877718
tags question: http://stackoverflow.com/q/21870819
tags question: http://stackoverflow.com/q/21990258
tags question: http://stackoverflow.com/q/21942680
type: Tag
tags question: http://stackoverflow.com/q/21934430
tags question: http://stackoverflow.com/q/21982389
tags question: http://stackoverflow.com/q/21968404
tags question: http://stackoverflow.com/q/21969235
tags question: http://stackoverflow.com/q/21946482

http://stackoverflow.com/a/21976648
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21976592
accepted answer of: http://stackoverflow.com/q/21976592
type: Answer
upvote count: 1
score: 1
has body: 500 is the status code for Internal Server Error, this means its not a problem on your end. Perhaps the response contains other http headers that might describe the problem in more detail? As it stands now, it can be pretty much anything. So either the service will start working.. or not. You can hopefully ask the provider of the service for help.

http://stackoverflow.com/a/21866506
downvote count: 1
has comment: http://stackoverflow.com/comment/84257450
has body: Use Context.getFilesDir(). Your application can read and write files in that folder and they'll automatically get deleted if your application gets uninstalled. From that point forward, you can create, delete and read from files like any other Java application.
type: Answer
upvote count: 2
score: 1
answers question: http://stackoverflow.com/q/21842678

http://stackoverflow.com/comment/33081157
comment on: http://stackoverflow.com/q/21852759
score: 0
type: QuestionComment
type: Comment
has text: can you post the `Home` class from where you calling this `APIHandler` asynctask?

http://stackoverflow.com/a/21909268
type: Answer
accepted answer of: http://stackoverflow.com/q/21904933
answers question: http://stackoverflow.com/q/21904933
has body: You are treating a binary file as a String. A binary file will contain many characters that cannot be treated as a character. Please rewrite your code and assume the PKCS#12 file is binary (using e.g. a FileInputStream / FileOutputStream combination or - for not such a big file - use readAllBytes instead of the input stream.
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33181847

http://stackoverflow.com/a/21958238
accepted answer of: http://stackoverflow.com/q/21958126
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21958126
has comment: http://stackoverflow.com/comment/33269072
has body: You can create a connection with socket, or with RMI. If I remember right, the RMI is newer than socket.. However you can find there about socket: All About Socket and here: About RMI
score: 0

http://stackoverflow.com/q/21863503
has answer: http://stackoverflow.com/a/21864287
tagged with: json-deserialization
linked to: http://stackoverflow.com/q/7792156
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33099724
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/21864287
linked to: http://stackoverflow.com/q/11940975
linked to: http://stackoverflow.com/q/14523831
type: Question
score: 3
has title: How to deserialize this JSON in an elegant way using flexjson
accepted answer: http://stackoverflow.com/a/22233497
linked to: http://stackoverflow.com/q/13843270
has body: I am working with Oracle OPAM and it has a REST API that has methods like this { "Target Collection":[ { "target":{ "uri":"https:\/\/opam_server_host:opam_ssl_port\/opam\/target\ /9bbcbbb087174ad1900ea691a2573b61", "type":"ldap", "name":"person1-ldap", "host":"opam_server_host", "domain":"berkeley" "description" : "Ldap target" } }, { "target":{ "uri":"https:\/\/opam_server_host:opam_ssl_port\/opam\/target\ /ac246a162ce948c7b1cdcc17dfc92c15", "type":"ldap", "name":"person1-ldap2", "host":"opam_server_host:opam_ssl_port", "domain":"berkeley" "description" : "Ldap target" } } ] } I am using FlexJSON to deserialize these entities. If I could, I'd use Apache CXF to generate the beans for me, but the problem is that the WADL is under an invalid https certificate + basic authentication, and getting wadl2java to work under these conditions are taking more time than I'd like to spend (too bad it isn't WSDL, so I could just create the stubs from inside eclipse fast and easy). So I am using this cumbersome approach with flexjson to parse this REST API JSONDeserializer&lt;Map&lt;String,List&lt;Map&lt;String,Map&lt;String,String&gt;&gt;&gt;&gt;&gt; json = new JSONDeserializer&lt;&gt;(); Map&lt;String,List&lt;Map&lt;String,Map&lt;String,String&gt;&gt;&gt;&gt; targetCollection = json.deserialize(new InputStreamReader(content)); List&lt;Map&lt;String,Map&lt;String,String&gt;&gt;&gt; col = targetCollection.get("Target Collection"); Map&lt;String,Map&lt;String,String&gt;&gt; keyVal = col.get(0); Map&lt;String,String&gt; targetVal = keyVal.get("target"); System.out.println(targetVal); This obviously works, but it has so many brackets that reminds me LISP. It would be so much better if we could just use POJOs instead (even better if I could have then generated automatically by some GUI tool, but I know I am asking too much, we're living in 2014). I know there is some documentation about how to map attributes here : http://flexjson.sourceforge.net/#Deserialization but I really wish the…
has comment: http://stackoverflow.com/comment/33099764
has comment: http://stackoverflow.com/comment/33100084
upvote count: 3
answer count: 2
has answer: http://stackoverflow.com/a/22233497
favorite count: 0
tagged with: wadl

http://stackoverflow.com/q/21972168
answer count: 2
downvote count: 0
has title: Adding JList items line by line into a string arraylist
tagged with: string
favorite count: 0
tagged with: arraylist
tagged with: jlist
has comment: http://stackoverflow.com/comment/33294508
has body: Im trying to put items from a jList line by line into a ArrayList This is my theory but the output is not correct. The output is just [Ljava.awt.Component;@7b066956 StringTokenizer comp = new StringTokenizer(lb_breakdown_components.toString(), ","); if(comp.hasMoreTokens())//check for tokens { textfile.add(comp.nextToken());//adding the data as tokens }
has comment: http://stackoverflow.com/comment/33294342
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33295536
has answer: http://stackoverflow.com/a/21972682
has comment: http://stackoverflow.com/comment/33294204
upvote count: 1
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22008912

http://stackoverflow.com/q/21918012
tagged with: swt
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21918406
has title: Image on Canvas vs Label
tagged with: java
tagged with: image
answer count: 1
downvote count: 0
tagged with: controls
score: 1
accepted answer: http://stackoverflow.com/a/21918406
favorite count: 0
type: AnsweredQuestion
has body: What are the differences between using a Canvas control or a Label control for drawing an image? Both controls seem to have similar capabilities in terms of drawing images onto their displayable area, and can both use PaintListeners to further customize the act. I have always assumed that Canvases are more suited for the purpose than labels simply due to their name, but I cannot determine the actual practical differences. In what scenarios would you use one over the other for loading an image file and painting the image onto the control?

http://stackoverflow.com/q/21852718
linked to: http://stackoverflow.com/q/13226263
tagged with: parcelable
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/21852820
has body: I'm developing a Media Player Application where I'm using ArrayList to store the list of songs, and want to use that same list between a Service and other Activities. I've written a custom type Songs implementing Parcelable Interface. This is how I did it: String ID, Title, Artist, Album, Genre, Duration, Path; byte[] AlbumArt; //constructors go here //getters and setters go here public Songs(Parcel in) { readFromParcel(in); } @Override public void writeToParcel(Parcel dest, int flags) { // TODO Auto-generated method stub dest.writeString(this.ID); dest.writeString(this.Title); dest.writeString(this.Artist); dest.writeString(this.Album); dest.writeString(this.Genre); dest.writeString(this.Duration); dest.writeByteArray(this.AlbumArt); dest.writeString(this.Path); } private void readFromParcel(Parcel in) { this.ID = in.readString(); this.Title = in.readString(); this.Artist = in.readString(); this.Album = in.readString(); this.Genre = in.readString(); this.Duration = in.readString(); in.readByteArray(this.AlbumArt); this.Path = in.readString(); } public static final Parcelable.Creator&lt;Songs&gt; CREATOR = new Parcelable.Creator&lt;Songs&gt;() { @Override public Songs createFromParcel(Parcel source) { // TODO Auto-generated method stub return new Songs(source); // using parcelable constructor } @Override public Songs[] newArray(int size) { // TODO Auto-generated method stub return new Songs[size]; } }; Now the Problem is I'm getting FAILED BINDER TRANSACTION when I try to pass the Arraylist&lt;Songs&gt; in an Intent. As a workaround I'm using static variables. Any ideas as on how to overcome this solution and pass the ArrayList&lt;Songs&gt; in an Intent.
has title: Android - Parcel Custom Type - FAILED BINDER TRANSACTION
has comment: http://stackoverflow.com/comment/128717593
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21852820
linked to: http://stackoverflow.com/q/42062417
upvote count: 3
tagged with: java
type: Question
score: 3

http://stackoverflow.com/q/21948927
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33350439
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33339953
tagged with: h.264
tagged with: vlcj
tagged with: decode
has title: How to directly decode h264 stream in byte[] format with VLCJ
downvote count: 0
tagged with: media
favorite count: 0
has comment: http://stackoverflow.com/comment/33403924
has comment: http://stackoverflow.com/comment/33252581
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33357187
answer count: 0
has body: I have searched everywhere in the whole VLCJ project,only to find out the method to decode and play h264 stream. The only available method is boolean playMedia(String mrl, String... mediaOptions); in which the MRL can be either a file path or a network address. I use the udpsocket to receive real-time H264 byte stream and I hope that the VLCJ is able to provide the method to directly decode the byte stream and play. So I hope I can use a method like playStream(byte[],...)

http://stackoverflow.com/comment/33264918
has text: what do i do with this part ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21956026
type: AnswerComment

http://stackoverflow.com/a/21957214
has comment: http://stackoverflow.com/comment/33267149
downvote count: 0
type: Answer
score: 11
has body: Arrays don't override the Object.equals() method (that ArrayList.contains() uses to compare objects). So an array is only equal to itself. You'll have to loop through the list and compare each element with your array using Arrays.equals(). What I suspect, though, is that you shouldn't have a List&lt;int[]&gt;, but a List&lt;Coordinate&gt;. The Coordinate class could then override equals() and hashCode(), and you would be able to use example.contains(new Coordinate(2, 4)) You could also use a List&lt;List&lt;Integer&gt;&gt;, but if what I suspect is true (i.e. you're using arrays to hold two coordinates that should be in class), then go with the custom Coordinate class.
upvote count: 11
answers question: http://stackoverflow.com/q/21957172

http://stackoverflow.com/comment/33349237
type: AnswerComment
type: Comment
has text: Yes, that will work, if you want to do it in two steps.
comment on: http://stackoverflow.com/a/21998044
score: 0

http://stackoverflow.com/a/21919029
score: 1
upvote count: 1
has body: You've got a whack of syntax errors anyways: String query = String.format([..snip...] + " LIKE '%" searchText ^---missing +
answers question: http://stackoverflow.com/q/21918946
downvote count: 0
type: Answer

http://stackoverflow.com/comment/33333834
score: 0
has text: every compenent has it's buffer. with flush you are forcing to empty the buffer on the PC side, but ssems like DT module has it's own buffer. Tecnically BT module is transparent to PC BUT maybe it give some way to force flush, using a non-serial-standard call. But RXTX is old. ifactc even the arduino from the newest versione (1.5.6) use another lib. try it!
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21985123

http://stackoverflow.com/q/21879831
type: UnansweredQuestion
tagged with: windows
tagged with: javafx-2
answer count: 0
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/33130859
has comment: http://stackoverflow.com/comment/33135923
type: Question
has comment: http://stackoverflow.com/comment/45756605
has comment: http://stackoverflow.com/comment/33142046
score: 0
tagged with: javafx-8
has body: We are working on JavaFx for alerting application on desktops, but its showing very random crash issue in different machine, there is no pattern for CPU or memory consumption. on machines with good RAM more than 6GB Windows Server 2008, it is crashing on 85 alerts and on machines with 2GB RAM Windows XP it goes upto 300+ alerts. I tried with jconsole, it shown CPU peak to 10-15% before crash. and mostly it scrashes in Windows 7 machines. then i tried running my application with -Xcheck:jni parameter with JVM and it shows following error : with java 7_40 FATAL ERROR in native method: Bad global or local ref passed to JNI with java 8 it run but with following warning message Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical I know this question is not much clear, but this is all data i have, can anyone guide me from where and how i should start debugging this issue?
has title: JavaFx Crash in Windows 7 machines

http://stackoverflow.com/comment/136641682
type: AnswerComment
has text: Good catch Rasika
score: 0
comment on: http://stackoverflow.com/a/22030994
type: Comment

http://stackoverflow.com/a/21929164
has body: Don't call search.run(); Call new Thread(search).start(); instead. In your actionPerformed you are just invoking method run in the current thread. If you call start() instead, it does the magic and starts the new thread that executes run(). Then you should modify the way you show result because you can't change UI in a thread that is not AwtEventQueue... you can consider something like this: //... // show result final String myResult=result; SwingUtilities.invokeLater(new Runnable(){ public void run(){ JTF_address.setText(myResult); } });
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21922350
score: 1
answers question: http://stackoverflow.com/q/21922350
type: AcceptedAnswer
upvote count: 1
type: Answer

http://stackoverflow.com/q/21867177
favorite count: 0
tagged with: arraylist
type: Question
has answer: http://stackoverflow.com/a/21867347
possible better answer: http://stackoverflow.com/a/21867347
tagged with: list
has answer: http://stackoverflow.com/a/21867195
answer count: 2
downvote count: 1
accepted answer: http://stackoverflow.com/a/21867195
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/33108211
type: AnsweredQuestion
score: 2
has title: List of heterogeneous elements
has body: Why doesn't the following code give an error when I am trying to add two elements of different types in one list? List list1 = new ArrayList&lt;&gt;(); list1.add(1); list1.add("1");

http://stackoverflow.com/a/21926027
type: Answer
upvote count: 0
has body: Try the code mentioned below public static void main(String[] args) { int smallest=0; int large=0; int num; System.out.println("enter the number"); Scanner input=new Scanner(System.in); int n=input.nextInt(); num=input.nextInt(); smallest = num; for(int i=0;i&lt;n-1;i++) { num=input.nextInt(); if(num&lt;smallest) { smallest=num; } } System.out.println("the smallest is:"+smallest); }
downvote count: 6
score: -6
answers question: http://stackoverflow.com/q/21925830

swing
tags question: http://stackoverflow.com/q/21976409
tags question: http://stackoverflow.com/q/22000513
tags question: http://stackoverflow.com/q/21859595
tags question: http://stackoverflow.com/q/21866297
tags question: http://stackoverflow.com/q/21872760
tags question: http://stackoverflow.com/q/21921135
tags question: http://stackoverflow.com/q/21894943
tags question: http://stackoverflow.com/q/21965837
tags question: http://stackoverflow.com/q/21896290
tags question: http://stackoverflow.com/q/21987967
tags question: http://stackoverflow.com/q/21977285
tags question: http://stackoverflow.com/q/22002085
tags question: http://stackoverflow.com/q/21875412
tags question: http://stackoverflow.com/q/21855431
tags question: http://stackoverflow.com/q/21846936
tags question: http://stackoverflow.com/q/21978245
tags question: http://stackoverflow.com/q/21949967
tags question: http://stackoverflow.com/q/22002636
tags question: http://stackoverflow.com/q/21994640
tags question: http://stackoverflow.com/q/22001589
tags question: http://stackoverflow.com/q/21990456
tags question: http://stackoverflow.com/q/21957696
tags question: http://stackoverflow.com/q/22003943
tags question: http://stackoverflow.com/q/21948734
tags question: http://stackoverflow.com/q/21900755
tags question: http://stackoverflow.com/q/21854827
tags question: http://stackoverflow.com/q/21858933
tags question: http://stackoverflow.com/q/21869693
tags question: http://stackoverflow.com/q/21916279
tags question: http://stackoverflow.com/q/21962031
tags question: http://stackoverflow.com/q/21844669
tags question: http://stackoverflow.com/q/21974225
tags question: http://stackoverflow.com/q/21850079
tags question: http://stackoverflow.com/q/21931344
tags question: http://stackoverflow.com/q/21957095
tags question: http://stackoverflow.com/q/21856733
tags question: http://stackoverflow.com/q/21921344
tags question: http://stackoverflow.com/q/21841821
tags question: http://stackoverflow.com/q/21995100
tags question: http://stackoverflow.com/q/21959786
tags question: http://stackoverflow.com/q/21902673
tags question: http://stackoverflow.com/q/21855677
tags question: http://stackoverflow.com/q/21920928
tags question: http://stackoverflow.com/q/21859815
tags question: http://stackoverflow.com/q/21970546
tags question: http://stackoverflow.com/q/21970390
tags question: http://stackoverflow.com/q/22001596
tags question: http://stackoverflow.com/q/21892526
tags question: http://stackoverflow.com/q/21889618
tags question: http://stackoverflow.com/q/21999145
tags question: http://stackoverflow.com/q/21905494
tags question: http://stackoverflow.com/q/21845695
tags question: http://stackoverflow.com/q/21952475
tags question: http://stackoverflow.com/q/21860016
tags question: http://stackoverflow.com/q/21997130
tags question: http://stackoverflow.com/q/21851207
tags question: http://stackoverflow.com/q/21974366
tags question: http://stackoverflow.com/q/22004457
tags question: http://stackoverflow.com/q/21868284
tags question: http://stackoverflow.com/q/21959206
tags question: http://stackoverflow.com/q/21957612
tags question: http://stackoverflow.com/q/21847733
tags question: http://stackoverflow.com/q/21900222
tags question: http://stackoverflow.com/q/21891355
tags question: http://stackoverflow.com/q/21970388
tags question: http://stackoverflow.com/q/21988426
tags question: http://stackoverflow.com/q/21872888
tags question: http://stackoverflow.com/q/21898425
tags question: http://stackoverflow.com/q/21910724
tags question: http://stackoverflow.com/q/21963815
tags question: http://stackoverflow.com/q/21928202
tags question: http://stackoverflow.com/q/21946267
tags question: http://stackoverflow.com/q/21999439
tags question: http://stackoverflow.com/q/21937518
tags question: http://stackoverflow.com/q/21848895
tags question: http://stackoverflow.com/q/21883597
tags question: http://stackoverflow.com/q/21866439
tags question: http://stackoverflow.com/q/21853300
tags question: http://stackoverflow.com/q/21924748
tags question: http://stackoverflow.com/q/21998073

http://stackoverflow.com/a/21898973
has comment: http://stackoverflow.com/comment/33164300
has comment: http://stackoverflow.com/comment/33164627
has comment: http://stackoverflow.com/comment/33304817
answers question: http://stackoverflow.com/q/21897599
has body: Try using following: if(i % 2 == 0) { merge[i] = input1[i/2]; } else { merge[i] = input2[i/2]; } For The updated code, readInput(aScanner, input1); should become int index1 = readInput(aScanner, input1); For all readInputs and then output loop for (int i = 0; i &lt; input1.length; i++) { System.out.println(input1[i]); } should become for (int i = 0; i &lt; index1; i++) { System.out.println(input1[i]); } for all output loops (Note that you need to use different index variable for all 3 inputs and loops i.e. index1, index2 and index3.
has comment: http://stackoverflow.com/comment/33303903
has comment: http://stackoverflow.com/comment/33164387
score: 0
has comment: http://stackoverflow.com/comment/33448273
has comment: http://stackoverflow.com/comment/33446716
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33168496
type: Answer
accepted answer of: http://stackoverflow.com/q/21897599

http://stackoverflow.com/q/21977683
has title: cannot resolve constructor 'arrayadapter(android.widget.adapterview.onitemselectedlistener, int, java.util.arraylist)'
type: Question
score: 3
tagged with: java
has body: This is my problem: public class captura_actividad extends Activity { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyymmdd"); String date = dateFormat.format(new Date() ); private final String ruta_fotos = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "/CivilControl/" + date + "/"; private File file = new File(ruta_fotos); private Button boton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.captura_actividad); final ImageButton boton_categoria_actividad = (ImageButton) findViewById(R.id.crearCapturaActividad); boton_categoria_actividad.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent boton_intent_categoria_actividad = new Intent (captura_actividad.this, categoria_actividad.class); startActivity(boton_intent_categoria_actividad); } }); // MANEJO SPINNER O SELECT CATEGORIA Spinner spinnerCategoria = (Spinner) findViewById(R.id.spinnerCategoria); // String[] dbNombreCategoria = {"a","b","c","d","e","f", "g", "h"}; crearBD usdbh = new crearBD (this, "civilControl", null, 1); SQLiteDatabase db; db = usdbh.getWritableDatabase(); String[] campos = new String[] {"_id","nombreCategoria"}; //String[] args = new String[] {""}; //Se ejecuta la consulta Cursor c; c = db.query("categoria", campos, null, null,null, null, null); final ArrayList&lt;String&gt; dbNombreCategoria = new ArrayList&lt;String&gt;(); String categoria; if(c.getCount()!=0){ if(c.moveToFirst()){ do{ categoria = c.getString(1); dbNombreCategoria.add(categoria); }while(c.moveToNext()); } } else{ dbNombreCategoria.add("No existen categorias"); } spinnerCategoria.setAdapter(new ArrayAdapter&lt;String&gt;(this, simple_spinner_item, dbNombreCategoria)); spinnerCategoria.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; adapterView, View view, int position, long id) { /*********************…
has answer: http://stackoverflow.com/a/21978135
answer count: 2
downvote count: 0
tagged with: spinner
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21977730
upvote count: 3

http://stackoverflow.com/comment/33181283
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21851383
has text: Entities are not normally transactional when you buy into the "transaction script" architectural pattern, which is not related to his question.
score: 0

http://stackoverflow.com/q/21854685
tagged with: java
tagged with: multithreading
tagged with: happens-before
linked to: http://stackoverflow.com/q/21738690
possible better answer: http://stackoverflow.com/a/21854961
type: Question
has answer: http://stackoverflow.com/a/21854961
has comment: http://stackoverflow.com/comment/33087840
accepted answer: http://stackoverflow.com/a/21854842
answer count: 2
has title: Java - happens-before relationship for monitor unlock
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/33087902
favorite count: 0
has comment: http://stackoverflow.com/comment/33088873
has body: I have recently read http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html which clearly describes a lot of intrinsics of Java memory model. One particular excerpt got my attention namely: The rule for a monitorexit (i.e., releasing synchronization) is that actions before the monitorexit must be performed before the monitor is released. Seems obvious to me, however having read http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html and happens-before definition, all I could find about the monitor unblock is when one thread unlocks the monitor that happens-before the other thread locking it again (which makes perfect sense as well). Could someone explain how JLS explains the obvious condition that all the actions within the synchronization block must happen-before the unlock operation? FURTHER COMMENTS: Based on a couple of responses I wanted to write up further comments to what you guys have been saying: Reodering within a single-thread A couple of "truths" from the source I cited: a = new A() if new A() involves a hundred operations, followed by assignment of address on a heap to a, compiler can simply reorder those to assign the heap address to a and then follow the usual initialization (problem from double checked locking) synchronized{ a = 5; } print a; can be changed to synchronized{ a = 5; print a; } SO we reordered monitorexit with print statement (also valid according to JLS) Now, the simple case I mentioned: x = 1; y = 2; c = x + y; print c; I see no reason that stops a compiler from either assigning x first or y first. There is completely nothing stopping it, as the final output is unchanged regardless of whether x is assigned first or y is. So the reordering is perfectly possible. monitor.unlock Based on the example with print statement being "pulled into" the synchronization block, let's try to reverse this i.e. startwing with synchronized{ a = 5; print a; } I could expect the compiler to do this: synchronized{ a = 5; } print a; See…
tagged with: jls
tagged with: memory-model
has answer: http://stackoverflow.com/a/21854842
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33089428
upvote count: 3

http://stackoverflow.com/a/21940819
answers question: http://stackoverflow.com/q/21940631
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/101818098
upvote count: 11
type: Answer
has body: You can only use @Inject simply on Eclipse 4.x application model objects (the Eclipse 4.x API is known as e4). So unless you do extra work you can't use injection in the Eclipse 3.x API. More recent versions of Eclipse do support views declared using the e4view element of the org.eclipse.ui.views extension point. These can make use of @Inject. Display.getDefault().asyncExec() is used with SWT objects to run code in the SWT main thread. Display.getDefault().asyncExec(new Runnable() { @Override public void run() { .. code to update the UI } });
score: 11
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21940631

http://stackoverflow.com/q/21848346
score: 4
linked to: http://stackoverflow.com/q/27781285
tagged with: android-contentresolver
has body: I've got a problem with removing contacts I previously created on SIM card. First of all I'm checking what values are stored in DB like this: private static final Uri URI_ICC_ADN = Uri.parse("content://icc/adn/"); private ContentResolver mContentResolver = this.getContentResolver(); Cursor c = mContentResolver.query(URI_ICC_ADN, null, null, null, null); c.moveToFirst(); while(c.moveToNext()) { Log.i(LOG_TAG, "name = " + c.getString(c.getColumnIndex("name"))); } And this provides me with those logs: name = 1 name = 2 name = 3 name = 1 name = 2 name = 5 // etc It means that records with name = 1 exist in DB. Now I'm trying to delete those records with this code: int rowsDeleted = mContentResolver.delete(URI_ICC_ADN, "name=?", new String[] { "1" }); But unfortunately those rows are not removed - rowsDeleted equals 0. I've also tried this: int rowsDeleted = mContentResolver.delete(URI_ICC_ADN, "name=1", null); But the result is the same. What am I doing wrong?
tagged with: android
has title: Can't remove contacts from SIM card
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25599309
tagged with: java
tagged with: sim-card
type: Question
upvote count: 4
tagged with: android-contacts
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/33062049
type: Comment
comment on: http://stackoverflow.com/a/21842157
score: 1
has text: Shouldn't it be `charAt(i)`, not j?
type: AnswerComment

android-intent
tags question: http://stackoverflow.com/q/21957011
tags question: http://stackoverflow.com/q/21948462
tags question: http://stackoverflow.com/q/21953033
tags question: http://stackoverflow.com/q/21858528
tags question: http://stackoverflow.com/q/21914428
tags question: http://stackoverflow.com/q/21863945
tags question: http://stackoverflow.com/q/21954967
tags question: http://stackoverflow.com/q/21928512
tags question: http://stackoverflow.com/q/21941161
tags question: http://stackoverflow.com/q/21925271
tags question: http://stackoverflow.com/q/21974786
tags question: http://stackoverflow.com/q/21955943
tags question: http://stackoverflow.com/q/21887036
tags question: http://stackoverflow.com/q/21941311
type: Tag
tag name: android-intent
tags question: http://stackoverflow.com/q/21917402
tags question: http://stackoverflow.com/q/21862668
tags question: http://stackoverflow.com/q/21888385
tags question: http://stackoverflow.com/q/21938709
tags question: http://stackoverflow.com/q/21937078

http://stackoverflow.com/q/21845969
type: Question
linked to: http://stackoverflow.com/q/21833110
has answer: http://stackoverflow.com/a/21846265
has comment: http://stackoverflow.com/comment/33068448
downvote count: 0
has title: Spring bean configuration to use singleton or prototype?
has answer: http://stackoverflow.com/a/21846166
favorite count: 0
has comment: http://stackoverflow.com/comment/33068523
answer count: 3
has answer: http://stackoverflow.com/a/21846918
has comment: http://stackoverflow.com/comment/33068373
has body: I am using Java7 and Spring3. I have below classes. Request.java public interface Request { public void doProcess(); } RequestImpl.java @Transactional public class RequestImpl implements Request{ private String name; private String age; //setters and getters public void doProcess(){ //use name and age and call third party class which will save data into database } } SpringConfig.xml &lt;bean id="request" class="pkg.RequestImpl.java" /&gt; Now clients will use RequestImpl as below. RequestImplreq = (RequestImpl)applicationContext.getBean("request"); req.setName("someName"); req.setAge("20"); req.doProcess(); Now my question is do i need to declare above RequestImpl.java scope as prototype or singleton? Thanks!
has comment: http://stackoverflow.com/comment/33068460
possible better answer: http://stackoverflow.com/a/21846166
has comment: http://stackoverflow.com/comment/33068509
tagged with: spring-3
has comment: http://stackoverflow.com/comment/33068411
upvote count: 1
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21846918
has comment: http://stackoverflow.com/comment/33068329
score: 1
tagged with: java

http://stackoverflow.com/a/22010329
has comment: http://stackoverflow.com/comment/33363030
answers question: http://stackoverflow.com/q/21951711
score: 4
has comment: http://stackoverflow.com/comment/33363307
downvote count: 1
upvote count: 5
has body: Here is JNI Field Descriptor JavaLanguage Type -------------------------------- Z boolean B byte C char S short I int J long F float D double Ljava/lang/String; string [Ljava/lang/Object; object[] Method descriptors make use of the fields descriptors and describe the structure of a Java method. There are no spaces between the field descriptors in a method descriptor. Apart from the void return type which is denoted by V, all other return types use the field descriptor. The table below describes the Java method declaration and the corresponding JNI descriptor. The JNI method descriptor is used when calling a Java method from C# via JNI. Java Method Declaration JNI Method Descriptor ---------------------------------------------------- String foo(); "()Ljava/lang/String;" Void bar(int I, bool b); (IZ)V The first thing that needs to be done is to create a dictionary object that will contain all of the parameters to pass to the Java Virtual Machine. In the example below, I am doing the minimum of setting the class path that will tell the JVM where to look for the classes and packages. private Dictionary&lt;string, string&gt; jvmParameters = new Dictionary&lt;string, string&gt;(); jvmParameters.Add("-Djava.class.path", Location of the java class); Once the JVM parameters have been assigned to the dictionary object, an instance of JavaNativeInterface can be created. Once created, the method LoadJVM needs to be called with the JVM parameters, and this will then load up the Java Virtual Machine. Once loaded, the user calls the method to instantiate the Java object (note that the use of the method InstantiateJavaObject is optional as the user may just want to call a static method, in which case, this method does not need to be called; however, it will not case any harm). Java = new JavaNativeInterface(); Java.LoadVM(jvmParameters, false); Java.InstantiateJavaObject(Name of the java class excluding the extension); Once the JVM has been loaded and a class instantiated, the user…
has comment: http://stackoverflow.com/comment/33362796
type: Answer

http://stackoverflow.com/a/21961074
has comment: http://stackoverflow.com/comment/33274655
has comment: http://stackoverflow.com/comment/33274439
has body: Your listLayout is inside of other view that is not a RelativeLayout, so the LayoutParams is not a RelativeLayout.LayoutParam... try use the ViewGroup.LayoutParams intead, like below: // Get layout params ViewGroup.LayoutParams layoutParams = listLayout.getLayoutParams();
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33274604
answers question: http://stackoverflow.com/q/21960979

http://stackoverflow.com/a/21990233
has comment: http://stackoverflow.com/comment/33326053
downvote count: 0
score: 1
has body: For starters this doesn't do what you expect: (f-32)*(5/9); 5/9 is performed as an integer division, so it equates to 0. anything multiplied by 0 is also 0. You need to cast the 5 and / or the 9 to float: (f-32)*(5f/9f);
has comment: http://stackoverflow.com/comment/33325804
upvote count: 1
answers question: http://stackoverflow.com/q/21990139
has comment: http://stackoverflow.com/comment/33325962
type: Answer

http://stackoverflow.com/a/21993630
answers question: http://stackoverflow.com/q/21993438
has body: to perform: In the main method declare a variable of type double and initialize it to a value. 3. Add a line in the main that calls the fToC method and passes as its argument the variable declared in step 2. you just have to call the method and assign the result to the variable like you already did in the rest of the main method (for options 1 and 2). Here is how you need to modify the first part of the main method: import java.util.Scanner; public class ExerciseOne { public static void main( String[] args ) { int choice; float initialF = 3; // assign variable to 3 initially float resultC = ftoC(variable); // simply call the method and assign the result to a variable …then the rest of the main method as you have it.
score: 0
type: Answer

http://stackoverflow.com/q/21968230
type: Question
tagged with: wfp
tagged with: java
answer count: 1
tagged with: jpcap
score: 0
has title: capturing network packet and group them according to their process (program) name
type: AnsweredQuestion
has body: I am doing some research and I need to capture every packet leave my computer and determine from which process it come from. in other world, some thing like Microsoft network monitor. please guide me to the right way to start.
has answer: http://stackoverflow.com/a/21968400
accepted answer: http://stackoverflow.com/a/21968400

http://stackoverflow.com/a/21930364
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/21930308
upvote count: 3
has body: It will be the same type as the original object as long as it uses Object.clone() by calling super.clone() and that should be done by convention. Read the doc here. This prints String but it is wrong by convention: public class SomeTest { @Override protected Object clone() { return ""; } public static void main(String[] args) { System.out.println(new SomeTest().clone().getClass().getSimpleName()); } }
type: Answer

http://stackoverflow.com/q/21905494
tagged with: swing
has answer: http://stackoverflow.com/a/21905908
has comment: http://stackoverflow.com/comment/33174701
answer count: 4
tagged with: swingworker
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33174618
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33174751
has body: I have found that in order to keep Java GUIs (using Swing) responsive the only way is to use the SwingWorker class, as opposed to java.lang.Thread. Is SwingWorker truly the only way when it comes multithreaded GUI based desktop apps? Are there any good alternatives? Rarely can I configure the Thread class to do what I want to do, but SwingWorker usually works, if sometimes in a cumbersome way.
favorite count: 0
has comment: http://stackoverflow.com/comment/33175286
type: Question
has title: Is SwingWorker the only way?
has comment: http://stackoverflow.com/comment/33174903
has answer: http://stackoverflow.com/a/21905627
has answer: http://stackoverflow.com/a/21905771
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/21905737
upvote count: 1

http://stackoverflow.com/comment/33351684
type: AnswerComment
comment on: http://stackoverflow.com/a/22004409
type: Comment
has text: @user3349460 Machines tend to not be _that_ wrong in simple cases like this. Try devnull's suggestion of a tiny test scenario to check if `mid` is properly set, but this solves a great issue you had.
score: 0

http://stackoverflow.com/comment/33218247
has text: Note that query.list() is invoked twice. Bit of careless programming done here.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21929604
type: QuestionComment

http://stackoverflow.com/q/21870195
type: UnansweredQuestion
tagged with: unit-testing
tagged with: java
has answer: http://stackoverflow.com/a/21870371
type: Question
score: 0
answer count: 1
has title: How to begin writing tests for Android
tagged with: android
has body: I'd like to write some unit tests for my Android app. But I find Android testing packages a little confusing. To be exact I want to to write a test that 1- mocks an EditText to contain a specific string. 2- unit test a code that does some simple manipulation of the string and returns the processed one. I'm not sure where to start from and which base test class to use. Any ideas to get me started? I'm using Java/Eclipse.

http://stackoverflow.com/comment/33274657
comment on: http://stackoverflow.com/q/21958407
score: 0
type: Comment
type: QuestionComment
has text: Proguard can help somewhat, but its hard to dev if all your builds are obfuscated release builds.

http://stackoverflow.com/q/21958273
type: Question
has answer: http://stackoverflow.com/a/21966943
has body: I am Practicing packages. i have three files in a directory name animals. these files states. /*filename Eat.java*/ package animal; public interface Eat{ public void food(); } 2nd file: /*Animal.java*/ package animal; public interface Animal{ public void move(); } 3rd file which implements the above interface /*Dog.java*/ package animal; public class Dog implements Animal,Eat { int movesteps=2; String food="MEAT"; Dog() { move(); food(); } public void move() { System.out.println("I am a dog i can move just "+this.movesteps+" steps/sec"); } public void food() { System.out.println("I am a dog i only eat "+this.food); } public static void main(String args[]) { Dog myDoggy=new Dog(); System.exit(0); } The problem is that when i compile the Dog.class without packages in all the classes it runs fine but when i include them in package the compiler comes with a lot of errors in notepad++.
has comment: http://stackoverflow.com/comment/33268968
has comment: http://stackoverflow.com/comment/33269381
accepted answer: http://stackoverflow.com/a/21966943
has comment: http://stackoverflow.com/comment/33269231
has comment: http://stackoverflow.com/comment/33269039
has comment: http://stackoverflow.com/comment/33269390
downvote count: 0
has answer: http://stackoverflow.com/a/21958589
has answer: http://stackoverflow.com/a/21958392
favorite count: 0
has title: java packages and interfaces
tagged with: package
tagged with: interface
possible better answer: http://stackoverflow.com/a/21958392
answer count: 4
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/33269421
has comment: http://stackoverflow.com/comment/33269155
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/33269289
has answer: http://stackoverflow.com/a/21972573

http://stackoverflow.com/comment/33229310
type: AnswerComment
comment on: http://stackoverflow.com/a/21936383
score: 0
type: Comment
has text: I used the add method. But it overwrites the old values in the arraylist.

http://stackoverflow.com/comment/33072115
type: Comment
score: 2
has text: +1 for providing a way to a solution without actually providing all the work.
comment on: http://stackoverflow.com/a/21847536
type: AnswerComment

http://stackoverflow.com/q/21865470
type: UnansweredQuestion
has body: I have to code a program to print this output: 1 212 32123 4321234 543212345 I have successfully coded this portion of the pattern: 1 12 123 1234 12345 However, I am not reaching the second portion. Here's my code: for(int i=1; i&lt;=5; i++) { for(int j=1; j&lt;=i; j++) { System.out.print(j); } System.out.println(); }
tagged with: java
has answer: http://stackoverflow.com/a/21865767
has title: A program that prints the following pattern
has answer: http://stackoverflow.com/a/34961693
type: Question
score: 0
has answer: http://stackoverflow.com/a/21865530
has comment: http://stackoverflow.com/comment/33103527
answer count: 9
has answer: http://stackoverflow.com/a/30322723
has answer: http://stackoverflow.com/a/54072089
has comment: http://stackoverflow.com/comment/33103613
has answer: http://stackoverflow.com/a/21865837
has comment: http://stackoverflow.com/comment/33103685
has answer: http://stackoverflow.com/a/51522926
has answer: http://stackoverflow.com/a/21866195
has answer: http://stackoverflow.com/a/21865948

http://stackoverflow.com/a/21999039
upvote count: 2
answers question: http://stackoverflow.com/q/21998306
has body: I think the problem comes from the fact that you're trying to manipulate the local node variable thinking that it will affect the tree. For example take a look at this part of the code: } else { node = null; removeHelper(data, node); } When you say node = null you have to take into account that node does not represent the real node but instead is a copy of the reference that you passed when you called the function. So if you set node = null you are only saying that the local node variable does not point to the node in the tree anymore but to null instead. If you want to delete the node from the tree you will have to reference the parent first and then set the child to null using the parent's reference.
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/21915220
has body: The error message is quite specific: You're apparently trying to assign a variable with a larger range (long) to one with a smaller range (int), and Java requires you to specifically okay the restriction with a cast. If you have int rend; long num; there's a chance that the value in num is too big to fit in rend. You can tell Java that it's okay to possibly lose information by saying this: rend = (int) num; However, this is usually a logical error, and you should address why the two variables are of differing sizes. The cannot find symbol isn't "similar", it's a completely different error, and it's because you're calling sort, but no sort method exists.
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/21915169
downvote count: 0
has comment: http://stackoverflow.com/comment/33192171
score: 3
has comment: http://stackoverflow.com/comment/33192420

http://stackoverflow.com/q/21975124
has comment: http://stackoverflow.com/comment/33299279
has answer: http://stackoverflow.com/a/21976552
tagged with: tablecelleditor
type: AnsweredQuestion
tagged with: java
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/33300530
has title: JTable, Can't retrieve data on spesific cell when cursor is still pointing inside the cell
tagged with: jtable
has answer: http://stackoverflow.com/a/21975888
score: 0
accepted answer: http://stackoverflow.com/a/21975888
answer count: 2
has body: I want to post a picture, but I don't have reputation on this site, but I described my problem below : | Name | Grade | __________________ | Febri | 60| &lt;---- if this is a cell (row0,column1), I can't retrieve data on this cell if cursor is still pointing inside that cell. take a look : System.out.println(mytable.getValueAt(0,0)); --> output : Febri System.out.println(mytable.getValueAt(0,1)); -- > output : that's because my mouse's cursor is still pointing inside that cell .. Any suggestions? Is this problem related to mouse listener? Please help , thx. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class myTable extends JFrame { String heads[] = { "Name", "Grade" }; Object[][] data = { { "Febri", "60" } }; JTable table; JButton button; JScrollPane scroll; public myTable() { setLayout(new FlowLayout()); table = new JTable(data, heads); scroll =new JScrollPane(table); button = new JButton("Retrieve Data"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (e.getSource() == button) { System.out.println(table.getValueAt(0, 0)); System.out.println(table.getValueAt(0, 1)); } } }); add(scroll); } public static void main(String args[]) { myTable tbl = new myTable(); tbl.setVisible(true); tbl.setSize(500, 400); } }
possible better answer: http://stackoverflow.com/a/21976552

http://stackoverflow.com/comment/33289680
score: 0
has text: The error isn't intellij based, I'm using ant to build via commandline
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21969659

http://stackoverflow.com/comment/33336203
type: Comment
comment on: http://stackoverflow.com/a/21979829
has text: Interesting. Then do you know why Amazon has not updated their tutorial? The link in my OP lists no other option besides running `as-cmd` through JRE.
score: 0
type: AnswerComment

http://stackoverflow.com/a/21947428
type: Answer
has body: Here is what you need. System.out.println(tres + " sería el mayor y " + dos + " el menor");
answers question: http://stackoverflow.com/q/21947411
score: 0

http://stackoverflow.com/comment/33281154
comment on: http://stackoverflow.com/q/21964709
has text: Could be you just need to reboot. Have you tried that?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21871592
has comment: http://stackoverflow.com/comment/33115322
has comment: http://stackoverflow.com/comment/33115259
type: Answer
answers question: http://stackoverflow.com/q/21871497
has body: Spring will never leave an injection target like this one @Autowired private UserRepository userRepository; null. If it can't resolve the dependency it will throw all sorts of exceptions. In other words, in your web application, Spring must not be involved in creating your UserServiceImpl object. I'm going to guess you are creating it yourself with new. You should instead be injecting it with @Autowired or at least getting it from the ApplicationContext directly (bad practice). In your test case however, you are clearly getting the instance from the ApplicationContext, so it is a managed bean and its dependencies have been resolved.
has comment: http://stackoverflow.com/comment/53197776
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21871497

http://stackoverflow.com/a/50201663
type: Answer
has body: Answering a very old question here, but just fell down this rabbit hole myself. The long and short of it is: wrapping a texture around an STL file is not feasible with external programs. The reason is because the STL file doesn't provide correct texture coordinate mapping (e.g. for .getTexCoords()). That said, the normal maps are rougly unique, so I did do a bit of hacking with stripping out the normal vector from the facet (e.g. [1]), calculating the number of facets and square rooting that number (assuming we will fill a square image): int facets = (int)Math.sqrt((lines.size() - 2) / 7); Where: lines is a String[] of file length, the header and footer of the STL is 2 lines and there are 7 lines to describe each facet. Then taking the normal vector and abusing it: mesh.getTexCoords().addAll(((Float.parseFloat(n) + 1) / -2)); Where: n is a value in the normal vector and the + 1// -2 is about normalizing the normal vector from -1 -> 0, to 0 -> 1 (the accepted range for .getTexCoords()). It's hacky, but it's a little more workable. You can at least make heads and tails of the texture. The real solution here is to use an object (such as obj's vt export values) that actually outputs the UV mapping from a program such as Blender: https://blender.stackexchange.com/a/18428 [1]: facet normal -0 0 1 outer loop vertex -10 12 9 vertex 10 0 9 vertex 10 12 9 endloop endfacet
answers question: http://stackoverflow.com/q/21997622
score: 0

http://stackoverflow.com/comment/33143270
comment on: http://stackoverflow.com/q/21887204
type: QuestionComment
type: Comment
has text: Are you sure this error was thrown for this input? I highly doubt your code would react this way for this data. `IllegalStateException: No match found` means that regex couldn't match entire string.
score: 0

http://stackoverflow.com/comment/34870018
comment on: http://stackoverflow.com/a/21881622
has text: @Nicholas, could not find any problem, C++ function is taking jdoubleArray, not pointers
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21889334
has comment: http://stackoverflow.com/comment/33147172
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33152180
downvote count: 0
answers question: http://stackoverflow.com/q/21889247
type: Answer
has body: You can do so if you pass the other class a context of your activity. You can also for communication to occur on the UIThread with the setting of text via a runOnUiThread(new Runnable() { @Override public void run() { myTextViewTime.setText("Hello"); } });

http://stackoverflow.com/comment/33276859
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21962372
has text: You're doing this analysis on a key-by-key basis? If only zeros have been entered so far, can't you just postpone this processing until either a non-zero or a decimal is entered?
type: Comment

http://stackoverflow.com/comment/33144718
has text: Added an error i get if i submit the form twice, looking at the error, the value is not getting passes
comment on: http://stackoverflow.com/q/21888001
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21962417
accepted answer: http://stackoverflow.com/a/21963674
score: 0
answer count: 1
has body: So, my problem is that once a shape gets a substantial amount of angular momentum(anything visually noticeable), then the collision no longer works. It collides, slows down, but doesn't rebound as elasticity dictates, nor does it 'impulse' in one pass, instead gradually slowing down until it becomes stagnant. public Vec2 getVelocityAt(Vec2 p) { return getLinearVelocity().add(new Vec2(-getAngularVelocity() * p.getY(), getAngularVelocity() * p.getX())); } I'm fairly certain the issue is directly related to the above code, I'm following the equations here: http://www.myphysicslab.com/collision.html public boolean checkBounds() { if(bX1 == bX2 || bY1 == bY2) { return false; } double xa = 0D; double ya = 0D; int a = 0; boolean hC = false; double xn = 0D; double yn = 0D; for(double[] vertex : this.getShape().getVerticies()) { if(vertex[0] &gt;= bX2) { xa += vertex[0]; ya += vertex[1]; a++; hC = true; xn -= 1D; } if(vertex[0] &lt;= bX1) { xa += vertex[0]; ya += vertex[1]; a++; hC = true; xn += 1D; } if(vertex[1] &gt;= bY2) { xa += vertex[0]; ya += vertex[1]; a++; hC = true; yn -= 1D; } if(vertex[1] &lt;= bY1) { xa += vertex[0]; ya += vertex[1]; a++; hC = true; yn += 1D; } } if(hC) { Vec2 n = new Vec2(xn, yn).uscale(); Vec2 cp = new Vec2(xa / a, ya / a); Vec2 rap = cp.sub(getShape().getCM()); Vec2 va = getVelocityAt(rap); Vec2 rva = va; Vec2 rvb = Vec2.ZERO_VEC.sub(va); double pj = -(1D + getElasticity()) * rva.dot(n); double j = pj / (1 / getShape().getMass() + Math.pow(rap.cross(n), 2D) / getShape().getMass()); applyForce(new AppliedForce(n.scale(j), rap, getShape().getMass())); } return hC; } public void applyForce(AppliedForce... f) { for(AppliedForce vec : f) { Vec2 a = vec.getForce().divide(getShape().getMass()); applyLinearAcceleration(a); double aa = a.relativeCosine(getShape().getTangent(vec.getOffsetCM())) * a.getMagnitude() / getShape().getMass(); applyAngularAcceleration(aa); } } If there is no angular velocity, then no issue occurs, and is pronounced more by hi…
tagged with: java
has title: Angular Velocity and Calculation Issues
tagged with: vector
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21963674
type: Question
tagged with: physics
tagged with: torque
tagged with: simulation

http://stackoverflow.com/q/21988500
type: UnansweredQuestion
score: 2
linked to: http://stackoverflow.com/q/14254083
upvote count: 3
tagged with: mysql
downvote count: 1
type: Question
has body: Possibly I'm understanding the concept wrong, but here is my problem: I want to store two types of data in my database: game positions (uniquely represented by some lengthy string, containing two lists of moves - one for moves possible in this position and one for moves leading to this position) game moves (represented by a smaller string, linking two positions) In classes: @Entity public class Move { @Id @GeneratedValue private long id; private String representation; private Position positionBeforeMove; private Position positionAfterMove; ... } @Entity public class Position { @Id private String representation; private List&lt;Move&gt; movesLeadingToPosition; private List&lt;Move&gt; movesLeadingFromPosition; ... } I want to store a set of games. In this context, the positions are unique, and the moves may occur multiple times in the database. My naieve implementation uses two tables: MOVE number id (PK) varchar2 representation varchar2 positionBeforeMove (FK) varchar2 positionAfterMove (FK) ... POSITION varchar2 representation (PK) ... This works fine; using EntityManager.merge(position) I can grow my POSITION table as I store more and more games, while keeping the positions unique. However, the solution is not optimal: I'd much prefer to have a generated id like I have in the MOVE table! @Entity public class Position { @Id @GeneratedValue private long id; private String representation; private List&lt;Move&gt; movesLeadingToPosition; private List&lt;Move&gt; movesLeadingFromPosition; ... } MOVE number id (PK) varchar2 representation number positionBeforeMove_id (FK) number positionAfterMove_id (FK) ... POSITION number id; (PK) varchar2 representation (Unique) ... But when I implement this, I end up with duplicate representations, because the EntityManager.merge(...) merges based on the specified Id, not the natural key. Is there any way I can let java (JPA / Hibernate / ...) merge the positions based on the natural key, while still allowing me to use an ID as the …
has answer: http://stackoverflow.com/a/21989200
linked to: http://stackoverflow.com/q/6058875
tagged with: java
tagged with: hibernate
tagged with: jpa
answer count: 1
has title: JPA: merging entities based on a 'natural key'
favorite count: 0

http://stackoverflow.com/comment/33291691
comment on: http://stackoverflow.com/a/21970798
has text: I'm using Eclipse. [This](http://www.java.com/en/download/installed.jsp?detect=jre) site says I have Version 7 Update 51.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21910851
score: 2
answers question: http://stackoverflow.com/q/21910707
upvote count: 2
has body: Just use setText(): SharedPreferences prefs = getSharedPreferences("com.example.app", Context.MODE_PRIVATE); String yourText = prefs.getString("your_key", "Empty"); yourEditText.setText(yourText);
downvote count: 0
type: Answer

http://stackoverflow.com/comment/33324202
comment on: http://stackoverflow.com/q/21987702
score: 0
type: QuestionComment
has text: Do you definitely want to do the transfer by FTP rather then HTTP under Apache?
type: Comment

mockito
tags question: http://stackoverflow.com/q/21980728
tags question: http://stackoverflow.com/q/21939246
tags question: http://stackoverflow.com/q/21865584
tags question: http://stackoverflow.com/q/21879804
tags question: http://stackoverflow.com/q/21965857
tags question: http://stackoverflow.com/q/21901368
tag name: mockito
tags question: http://stackoverflow.com/q/21958040
tags question: http://stackoverflow.com/q/21920715
type: Tag
tags question: http://stackoverflow.com/q/21932308
tags question: http://stackoverflow.com/q/21885178
tags question: http://stackoverflow.com/q/21957918

http://stackoverflow.com/comment/52207157
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21900390
has text: possible duplicate of [How does a HashMap work in Java?](http://stackoverflow.com/questions/6493605/how-does-a-hashmap-work-in-java)

http://stackoverflow.com/a/21865767
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33104083
downvote count: 0
has body: Why not recursive? Just because it's fun ;) public static void main(String args[]) { System.out.println(pyramid(5)); } public static String pyramid(int rank) { if (rank == 1) { return "1\n"; } return pyramid(rank - 1) + mirror(rank) + "\n"; } public static String mirror(int rank) { if (rank == 1) { return "1"; } else { return rank + mirror(rank - 1) + rank; } }
answers question: http://stackoverflow.com/q/21865470
type: Answer

http://stackoverflow.com/comment/33149898
comment on: http://stackoverflow.com/q/21891303
score: 0
type: Comment
has text: Or if you want to go overboard, you can look into JodaTime: http://www.joda.org/joda-time/ :)
type: QuestionComment

http://stackoverflow.com/q/21913955
has title: JSON Post request for boolean field sends false by default
has comment: http://stackoverflow.com/comment/33196133
downvote count: 0
has comment: http://stackoverflow.com/comment/33190413
tagged with: jackson
has answer: http://stackoverflow.com/a/59665928
favorite count: 0
has comment: http://stackoverflow.com/comment/33192084
has answer: http://stackoverflow.com/a/21919092
has comment: http://stackoverflow.com/comment/33190800
has comment: http://stackoverflow.com/comment/33189873
possible better answer: http://stackoverflow.com/a/55567974
has comment: http://stackoverflow.com/comment/33196482
answer count: 4
has answer: http://stackoverflow.com/a/55567974
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33196383
has comment: http://stackoverflow.com/comment/33192818
has body: Hi I am sending a JSON Post request using the FireFox RestClient. My JSON Request is as below: { "firstName": "Test", "lastName": "1", "isActive": 1 } My POJO has isActive field as below private boolean isActive; My Controller is define as below @RequestMapping(method = {RequestMethod.POST, RequestMethod.PUT}, value = "/save") public ResponseEntity&lt;RestResponse&gt; save( @RequestBody POJOUserDetails userDetails, WebRequest request){ In my POJO, when I check the value of isActive, it is false no matter what I send. I tried below value in my JSON request "isActive": 1 "isActive": true "isActive": "true" "isActive": "" "isActive": null "isActive": false All of above sends false in my controller. Please help. Thanks Adding POJO details @JsonIgnoreProperties(ignoreUnknown = true) @JsonSerialize(include=Inclusion.NON_EMPTY) public class POJOUserDetails { private String firstName; private String lastName; private boolean isActive; public boolean isActive() { return isActive; } public void setActive(boolean isActive) { this.isActive = isActive; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } }
has comment: http://stackoverflow.com/comment/33189742
type: Question
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/93563176
has comment: http://stackoverflow.com/comment/33192302
accepted answer: http://stackoverflow.com/a/21919092
score: 62
has comment: http://stackoverflow.com/comment/33201304
tagged with: java
has comment: http://stackoverflow.com/comment/33197090
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/75263351
tagged with: pojo
upvote count: 62
has comment: http://stackoverflow.com/comment/33192870

http://stackoverflow.com/q/21935447
answer count: 3
has comment: http://stackoverflow.com/comment/33236822
downvote count: 0
has answer: http://stackoverflow.com/a/30268604
favorite count: 0
has comment: http://stackoverflow.com/comment/33230783
tagged with: web.xml
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33234298
has answer: http://stackoverflow.com/a/36592505
has comment: http://stackoverflow.com/comment/33231160
tagged with: java
tagged with: web-applications
has title: Log4j2.xml configuration in web.xml. IllegalArgumentException - uri is not absolute
has answer: http://stackoverflow.com/a/33555775
tagged with: classpath
tagged with: log4j2
has body: Before adding context-param and Log4jConfigListener for Log4j2, I had all logs listed in catalina.out file. So now, I'm trying to configure log4j for my web application. In web.xml, I've added necessary configuration. <?xml version="1.0" encoding="UTF-8"?> etl-service contextConfigLocation classpath*:applicationContext.xml spring.profiles.active myprofile log4jConfiguration /WEB-INF/classes/log4j2.xml org.springframework.web.context.ContextLoaderListener org.springframework.web.util.Log4jConfigListener log4j2.xml <?xml version="1.0" encoding="UTF-8"?> <RollingRandomAccessFile name="RollingRandomAccessFileDebug" fileName="/local/deploy/logs/debug.log" filePattern="logs/$${date:yyyy-MM}/etl-%d{MM-dd-yyyy}-%i.log.gz" immediateFlush="false" append="false"> %d %p %c{1.} [%t] %m%n <TimeBasedTriggeringPolicy/> <SizeBasedTriggeringPolicy size="250 MB"/> </RollingRandomAccessFile> <RollingRandomAccessFile name="RollingRandomAccessFile" fileName="/local/deploy/logs/info.log" filePattern="logs/$${date:yyyy-MM}/etl-%d{MM-dd-yyyy}-%i.log.gz" immediateFlush="false" append="false"> %d %p %c{1.} [%t] %m%n <TimeBasedTriggeringPolicy/> <SizeBasedTriggeringPolicy size="250 MB"/> </RollingRandomAccessFile> <!--<AppenderRef ref="Console"/>--> <AppenderRef ref="RollingRandomAccessFileDebug" level="DEBUG"/> <AppenderRef ref="RollingRandomAccessFile" level="INFO"/> <AppenderRef ref="Console" level="TRACE"/> But for now I have the following error: ERROR Unable to access WEB-INF/classes/log4j2.xml java.lang.IllegalArgumentException: URI is not absolute Maybe someone already faced with such issue. Also I've tried instead adding /WEB-INF/classes/log4j.xml use classpath*:log4j.xml And had an error java.net.URISyntaxException: Illegal character in schema name at 9 index: classpath*:log4j.xml UPDATE: We need to add just descriptor file name and it works. log4jConfiguration log4j2.xml But issue remineds logs listed in catalina.out file. Not in my log4j files.
type: Question
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/33228811
has comment: http://stackoverflow.com/comment/33313942
has comment: http://stackoverflow.com/comment/33254001

http://stackoverflow.com/comment/33310338
type: Comment
type: QuestionComment
has text: The lock is *not* on the variable, only the object.
comment on: http://stackoverflow.com/q/21981442
score: 0

http://stackoverflow.com/q/21911689
has comment: http://stackoverflow.com/comment/45108227
answer count: 0
type: UnansweredQuestion
score: 1
upvote count: 1
has body: Java code transfers (SFTP) files from local to remote server every 15 mins. Both are linux servers with below configs: user# ssh -V OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010 user# uname -a Linux serverName 2.6.39-400.24.1.el6uek.x86_64 #1 SMP Wed May 15 11:46:52 PDT 2013 x86_64 x86_64 x86_64 GNU/Linux The issue is, for some reason, the ssh sessions on remote server donot seem to close. They just build up until the max. no. of processes breaches and then pipe broken error occurs when trying to login. The sessions and channels have been definitely closed in the Java code using channel.disconnect() and session.disconnect(). There are no errors in the java code. Also, why is that there are three processes running for a single file (sftp transfer). root 63340 2932 0 12:10 ? 00:00:00 sshd: user [priv] user 63346 63340 0 12:10 ? 00:00:00 sshd: user@notty user 63347 63346 0 12:10 ? 00:00:00 /usr/libexec/openssh/sftp-server Can someone please help with any info/tip regarding this issue? Checked a similar thread but not exactly the same - JSch not closing sshd
linked to: http://stackoverflow.com/q/7398634
has comment: http://stackoverflow.com/comment/45106520
tagged with: session
tagged with: java
type: Question
downvote count: 0
favorite count: 0
tagged with: linux
tagged with: ssh
has title: SSH sessions not closing after sftp transfer

http://stackoverflow.com/comment/33269076
has text: @panoptical: nope, not true. As soon as they start typing, they overwrite the previous text. Try it yourself and see.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21958317
score: 1

http://stackoverflow.com/comment/33165755
comment on: http://stackoverflow.com/a/21900241
score: 0
type: Comment
has text: What if the user takes more than 10 seconds to choose a file?
type: AnswerComment

http://stackoverflow.com/a/23260582
downvote count: 0
has body: There are additional patches available for Kepler SR2 officially. In ecliplse, go to "Help" --> "Market Place" --> Search for java 8 kepler. Then choose and install the following. install Java 8 support eclipse kepler sr2, Java 8 Facets for web tools eclipse kepler sr2 Java 8 support for m2e for Eclipse Kepler SR2 (if required) Reference: http://www.eclipse.org/downloads/java8/ After this, my multi-module maven project with java 8 is building fine without any error in eclipse kepler SR2. UPDATE: If you are using Spring Tool Suite (STS), then version 3.5.1 has included these features.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36228402
answers question: http://stackoverflow.com/q/21955207
type: Answer
score: 73
has comment: http://stackoverflow.com/comment/35932903
upvote count: 73
accepted answer of: http://stackoverflow.com/q/21955207

http://stackoverflow.com/comment/33238688
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21941475
has text: What is your question specifically?
score: 0

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

http://stackoverflow.com/q/21859410
tagged with: onitemclick
has answer: http://stackoverflow.com/a/21859574
has answer: http://stackoverflow.com/a/21859599
has body: I created a spinner in my main.xml: <Spinner android:id="@+id/spinner1" android:layout_width="match_parent" android:layout_height="wrap_content" android:entries="@array/categoria_arrays" android:prompt="@string/categoria_prompt" /> And in the strings.xml the values: Choose All One Two Three I can display it normally but actually there are no interactions.. I need that onClick over a item open a new activity for example. So if i click the item at position 2 i need go in the activity One. Is it possible? I tried to create a toast when i click a item but not works: public void onItemSelected(AdapterView<?> parent, View view, int pos,long id) { Toast.makeText(parent.getContext(), "OnItemSelectedListener : " + parent.getItemAtPosition(pos).toString(), Toast.LENGTH_SHORT).show(); //HERE CHANGE ACTIVITY } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } I How could i do?
has answer: http://stackoverflow.com/a/21859543
answer count: 5
tagged with: android
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21859572
type: Question
possible better answer: http://stackoverflow.com/a/21859543
has answer: http://stackoverflow.com/a/21859522
has comment: http://stackoverflow.com/comment/33092504
has title: Click on spinner element android
accepted answer: http://stackoverflow.com/a/21859574
tagged with: android-spinner
score: 0

jsf
tags question: http://stackoverflow.com/q/21881767
type: Tag
tags question: http://stackoverflow.com/q/21882974
tags question: http://stackoverflow.com/q/21904544
tags question: http://stackoverflow.com/q/21889620
tags question: http://stackoverflow.com/q/21890224
tags question: http://stackoverflow.com/q/21901796
tags question: http://stackoverflow.com/q/21923512
tags question: http://stackoverflow.com/q/21881686
tags question: http://stackoverflow.com/q/21982151
tags question: http://stackoverflow.com/q/21923187
tags question: http://stackoverflow.com/q/21894813
tags question: http://stackoverflow.com/q/21883530
tags question: http://stackoverflow.com/q/21889574
tags question: http://stackoverflow.com/q/21847378
tags question: http://stackoverflow.com/q/21888318
tags question: http://stackoverflow.com/q/21851628
tags question: http://stackoverflow.com/q/21904812
tags question: http://stackoverflow.com/q/21966417
tags question: http://stackoverflow.com/q/21913419
tags question: http://stackoverflow.com/q/21906255
tags question: http://stackoverflow.com/q/21970818
tags question: http://stackoverflow.com/q/21878146
tag name: jsf
tags question: http://stackoverflow.com/q/21887122
tags question: http://stackoverflow.com/q/21871174
tags question: http://stackoverflow.com/q/21920337
tags question: http://stackoverflow.com/q/21966945
tags question: http://stackoverflow.com/q/21980309
tags question: http://stackoverflow.com/q/21888001
tags question: http://stackoverflow.com/q/21928134
tags question: http://stackoverflow.com/q/21910503
tags question: http://stackoverflow.com/q/21986326

spring-mvc
tags question: http://stackoverflow.com/q/21870654
tags question: http://stackoverflow.com/q/21923355
tags question: http://stackoverflow.com/q/21907777
tags question: http://stackoverflow.com/q/21866571
tags question: http://stackoverflow.com/q/21935267
tags question: http://stackoverflow.com/q/22003290
tags question: http://stackoverflow.com/q/21952041
tags question: http://stackoverflow.com/q/21931299
tags question: http://stackoverflow.com/q/21980427
tags question: http://stackoverflow.com/q/21847382
tags question: http://stackoverflow.com/q/21933726
tags question: http://stackoverflow.com/q/21974050
tags question: http://stackoverflow.com/q/21926003
tags question: http://stackoverflow.com/q/21942486
tags question: http://stackoverflow.com/q/21913955
tags question: http://stackoverflow.com/q/21989619
tags question: http://stackoverflow.com/q/21982564
tags question: http://stackoverflow.com/q/21843127
tags question: http://stackoverflow.com/q/21879824
tags question: http://stackoverflow.com/q/21993368
tags question: http://stackoverflow.com/q/21953340
tags question: http://stackoverflow.com/q/21932640
tags question: http://stackoverflow.com/q/21979791
tags question: http://stackoverflow.com/q/21925529
tags question: http://stackoverflow.com/q/21878566
tags question: http://stackoverflow.com/q/21935693
tag name: spring-mvc
tags question: http://stackoverflow.com/q/21971343
tags question: http://stackoverflow.com/q/21914730
tags question: http://stackoverflow.com/q/21871656
tags question: http://stackoverflow.com/q/21885568
tags question: http://stackoverflow.com/q/21905124
tags question: http://stackoverflow.com/q/21894600
tags question: http://stackoverflow.com/q/21947300
tags question: http://stackoverflow.com/q/21846731
tags question: http://stackoverflow.com/q/21863473
tags question: http://stackoverflow.com/q/21904873
tags question: http://stackoverflow.com/q/21970717
tags question: http://stackoverflow.com/q/21907848
tags question: http://stackoverflow.com/q/21912156
type: Tag
tags question: http://stackoverflow.com/q/21847301
tags question: http://stackoverflow.com/q/21958931
tags question: http://stackoverflow.com/q/21870726
tags question: http://stackoverflow.com/q/21985805
tags question: http://stackoverflow.com/q/21994444
tags question: http://stackoverflow.com/q/21869416
tags question: http://stackoverflow.com/q/21848357
tags question: http://stackoverflow.com/q/21884803
tags question: http://stackoverflow.com/q/21867545
tags question: http://stackoverflow.com/q/21920293
tags question: http://stackoverflow.com/q/21929790
tags question: http://stackoverflow.com/q/21908259
tags question: http://stackoverflow.com/q/21928960
tags question: http://stackoverflow.com/q/21934989
tags question: http://stackoverflow.com/q/21901267
tags question: http://stackoverflow.com/q/21904308
tags question: http://stackoverflow.com/q/21995563
tags question: http://stackoverflow.com/q/21875920
tags question: http://stackoverflow.com/q/21930216
tags question: http://stackoverflow.com/q/21991293
tags question: http://stackoverflow.com/q/21851333
tags question: http://stackoverflow.com/q/21976897
tags question: http://stackoverflow.com/q/21848126
tags question: http://stackoverflow.com/q/21918197
tags question: http://stackoverflow.com/q/21944059
tags question: http://stackoverflow.com/q/21987675
tags question: http://stackoverflow.com/q/21973087
tags question: http://stackoverflow.com/q/21964959
tags question: http://stackoverflow.com/q/21923058
tags question: http://stackoverflow.com/q/21938092
tags question: http://stackoverflow.com/q/21884737
tags question: http://stackoverflow.com/q/21923857
tags question: http://stackoverflow.com/q/21954679
tags question: http://stackoverflow.com/q/21969277
tags question: http://stackoverflow.com/q/21962228
tags question: http://stackoverflow.com/q/21865179
tags question: http://stackoverflow.com/q/21910374
tags question: http://stackoverflow.com/q/21870802
tags question: http://stackoverflow.com/q/21923663

rest
tags question: http://stackoverflow.com/q/21989440
tags question: http://stackoverflow.com/q/21891127
tags question: http://stackoverflow.com/q/21983048
tags question: http://stackoverflow.com/q/21941698
tags question: http://stackoverflow.com/q/21858934
tags question: http://stackoverflow.com/q/21954850
tags question: http://stackoverflow.com/q/21944462
tags question: http://stackoverflow.com/q/21855259
tags question: http://stackoverflow.com/q/21912161
tags question: http://stackoverflow.com/q/21910823
tags question: http://stackoverflow.com/q/21883042
tags question: http://stackoverflow.com/q/21975504
tags question: http://stackoverflow.com/q/21930643
tags question: http://stackoverflow.com/q/21955621
tags question: http://stackoverflow.com/q/21959667
tags question: http://stackoverflow.com/q/21922547
tags question: http://stackoverflow.com/q/21898902
tags question: http://stackoverflow.com/q/22002691
tags question: http://stackoverflow.com/q/21913662
tags question: http://stackoverflow.com/q/21843127
tags question: http://stackoverflow.com/q/21964721
tags question: http://stackoverflow.com/q/21852177
tags question: http://stackoverflow.com/q/21995818
tags question: http://stackoverflow.com/q/21947300
tags question: http://stackoverflow.com/q/21876286
type: Tag
tags question: http://stackoverflow.com/q/21911302
tags question: http://stackoverflow.com/q/21974038
tags question: http://stackoverflow.com/q/22003327
tags question: http://stackoverflow.com/q/21877409
tags question: http://stackoverflow.com/q/21882548
tags question: http://stackoverflow.com/q/21867120
tags question: http://stackoverflow.com/q/21929790
tag name: rest
tags question: http://stackoverflow.com/q/21934250
tags question: http://stackoverflow.com/q/21886106
tags question: http://stackoverflow.com/q/21961886
tags question: http://stackoverflow.com/q/21998826

http://stackoverflow.com/a/22000682
answers question: http://stackoverflow.com/q/22000507
score: 3
has body: I'm afraid that Java is the way it is. You basically have 3 options: Use explicit single class imports Use explicit "star" imports of a classes in a package Organize the packages so that related classes are in the same package and don't need to be imported. There is no other "auto-import" or import inclusion mechanism. I would just point out that most seasoned Java programmers don't share your annoyance. Indeed, most developers just use the facilities provided by the IDE for adding / removing / organizing the imports ... and fold them away by default. You will get used to it. You have no real alternative. ... it's a lame ghetto solution Yea, well, you are entitled to your opinion. Most people would just say "it works well enough" ... For what it is worth, I'm of the opinion that "star" imports (of classes) are a bad idea. Consider this example: import java.io.*; import com.other.io.*; // Some 3rd-party library public class MyClass { ... private static File = ... ... } Suppose that when I develop this code, there is only one File class ... in java.io. But then suppose that a couple of years down the track, th maintainers of the com.other library bring out a new version that defines a new class called com.other.io.File. If I recompile MyClass against the new version of the library, I will now get compilation errors. If I don't recompile, I can still run my existing MyClass.class (with the updated library), but my source code will no longer reflect the assumed reality. (In theory, I have to know when the code was compiled to understand what File is referring to.) Contrast this with an explicit import of java.io.File. That always means exactly what it says, no matter what the 3rd-party library maintainers do. In short, use of the "star" imports means that someone else can "break" my code by making innocuous and seemingly irrelevant changes to 3rd party libraries. They make my code fragile. So why did I mention this? Because I think that auto-importing and other attempts…
has comment: http://stackoverflow.com/comment/33345925
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22000507
upvote count: 3
type: Answer

http://stackoverflow.com/comment/33113689
type: AnswerComment
has text: Then run that for loop. If you're going to be doing it a lot, you'll want Map<Integer, Integer>. If you need a list of everyone who's 12, you need the second example.
type: Comment
comment on: http://stackoverflow.com/a/21870947
score: 0

http://stackoverflow.com/comment/33346734
comment on: http://stackoverflow.com/a/22000903
type: AnswerComment
score: 0
type: Comment
has text: @HellonCanellaMachado Declaring exceptions to be thrown and caught all over is noisy; it detracts from what the code is trying to actually do. Note that most other languages don't even *have* checked exceptions; some take that as evidence it was an experiment that failed. There are a lot of circumstances where the syntactic overhead of checked exceptions isn't worth it.

http://stackoverflow.com/a/39728659
answers question: http://stackoverflow.com/q/21987589
upvote count: 12
has body: The response by camposer can be improved using the API provided by Spring OAuth. In fact, it's not necessary to access directly to the HTTP headers, but the REST method which removes the access token can be implemented as follows: @Autowired private AuthorizationServerTokenServices authorizationServerTokenServices; @Autowired private ConsumerTokenServices consumerTokenServices; @RequestMapping("/uaa/logout") public void logout(Principal principal, HttpServletRequest request, HttpServletResponse response) throws IOException { OAuth2Authentication oAuth2Authentication = (OAuth2Authentication) principal; OAuth2AccessToken accessToken = authorizationServerTokenServices.getAccessToken(oAuth2Authentication); consumerTokenServices.revokeToken(accessToken.getValue()); String redirectUrl = getLocalContextPathUrl(request)+"/logout?myRedirect="+getRefererUrl(request); log.debug("Redirect URL: {}",redirectUrl); response.sendRedirect(redirectUrl); return; } I also added a redirect to the endpoint of Spring Security logout filter, so the session is invalidated and the client must provide credentials again in order to access to the /oauth/authorize endpoint.
score: 12
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/106733786

http://stackoverflow.com/comment/33192878
has text: @Marco13 On the other hand, my motto is "Each line of code must prove its worth." It seems to result in quite different defaults.
type: Comment
type: AnswerComment
score: 6
comment on: http://stackoverflow.com/a/21910859

http://stackoverflow.com/comment/33229089
type: AnswerComment
score: 0
type: Comment
has text: @user3337385 why not? then extend `PlainDocument` and override `insertString`
comment on: http://stackoverflow.com/a/21935957

sorting
tags question: http://stackoverflow.com/q/21942316
tags question: http://stackoverflow.com/q/21928891
tags question: http://stackoverflow.com/q/21998015
tags question: http://stackoverflow.com/q/21912114
tags question: http://stackoverflow.com/q/21944242
tags question: http://stackoverflow.com/q/21963781
tags question: http://stackoverflow.com/q/21897308
tags question: http://stackoverflow.com/q/21975172
tags question: http://stackoverflow.com/q/21843892
tags question: http://stackoverflow.com/q/21868663
tags question: http://stackoverflow.com/q/21890588
tags question: http://stackoverflow.com/q/21924675
tags question: http://stackoverflow.com/q/22000639
tags question: http://stackoverflow.com/q/21842496
tags question: http://stackoverflow.com/q/21935747
tags question: http://stackoverflow.com/q/21843666
tags question: http://stackoverflow.com/q/21915342
tags question: http://stackoverflow.com/q/21854353
tags question: http://stackoverflow.com/q/22003431
tags question: http://stackoverflow.com/q/21877530
tags question: http://stackoverflow.com/q/21985397
tags question: http://stackoverflow.com/q/21999639
type: Tag
tags question: http://stackoverflow.com/q/21897093
tags question: http://stackoverflow.com/q/21892626
tags question: http://stackoverflow.com/q/21952234
tags question: http://stackoverflow.com/q/21938141
tags question: http://stackoverflow.com/q/21887824
tags question: http://stackoverflow.com/q/21989560
tags question: http://stackoverflow.com/q/21965884
tags question: http://stackoverflow.com/q/21995541
tags question: http://stackoverflow.com/q/21923099
tags question: http://stackoverflow.com/q/21869718
tag name: sorting
tags question: http://stackoverflow.com/q/21870061
tags question: http://stackoverflow.com/q/21884858
tags question: http://stackoverflow.com/q/21966814
tags question: http://stackoverflow.com/q/21955330
tags question: http://stackoverflow.com/q/21903404
tags question: http://stackoverflow.com/q/21944260
tags question: http://stackoverflow.com/q/21961450
tags question: http://stackoverflow.com/q/21970339
tags question: http://stackoverflow.com/q/21937305
tags question: http://stackoverflow.com/q/21970719
tags question: http://stackoverflow.com/q/21843689

http://stackoverflow.com/comment/33092501
score: 0
comment on: http://stackoverflow.com/q/21859020
has text: @JoopEggen Why is filename no longer correct? And DarkDust yes , there is no such space or so... The file filename.txt does not have any other lines or spaces or...
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33212504
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21924171
type: AnswerComment
has text: Thanks MagicMan for the suggestion.. This makes sense to me.. One question I have is, how would I iterate this MultiValueMap to extract fields from it? Can you provide an example on my use case for this as well?

http://stackoverflow.com/q/21857009
has body: I want to create a parameter with multiple possibilities. To be more precise, in the method, I would like to have different levels of warning like 0,1,2 and 3. When you type it gives you have only these 4 possibilities. Eg: setFoobar(1, "Yo");
answer count: 2
accepted answer: http://stackoverflow.com/a/21857056
has title: Java give a possible list for a parameter
score: 0
tagged with: list
tagged with: methods
has answer: http://stackoverflow.com/a/21857056
tagged with: parameters
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21857092
has answer: http://stackoverflow.com/a/21857092
tagged with: java
type: Question

http://stackoverflow.com/q/21958150
type: Question
possible better answer: http://stackoverflow.com/a/21959000
answer count: 2
has answer: http://stackoverflow.com/a/21959000
has title: Gradle: how to test custom task output (println)
tagged with: java
upvote count: 1
tagged with: gradle
has body: How would I go about testing the println output of custom Gradle tasks? This is my code so far: class TaskTest { @Test void testSomething() { Project project = ProjectBuilder.builder().build() def task = project.task('testTask', type: Task) task.execute() &lt;&lt;assert task did println "Hello, world!"&gt;&gt; } }
has answer: http://stackoverflow.com/a/21959054
downvote count: 0
type: AnsweredQuestion
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21959054

http://stackoverflow.com/a/21900950
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33166891
accepted answer of: http://stackoverflow.com/q/21899463
upvote count: 2
answers question: http://stackoverflow.com/q/21899463
has comment: http://stackoverflow.com/comment/33193590
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/45671870
has comment: http://stackoverflow.com/comment/33180872
has body: My answer does not directly answer yours but it covers your desired output - the have a JFreeChart chart within an iText PDF. I saw this amazing, spot-on tutorial on how to make an iText PDF with JFreeChart inside: WireLust's "Creating an iText pdf with embedded JFreeChart". Note that this uses servlets and I modified it to just be a standalone code with the iText and JFreeCharts to work on. import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import java.io.FileOutputStream; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.title.TextTitle; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.PageSize; import com.itextpdf.text.Phrase; import com.itextpdf.text.pdf.DefaultFontMapper; import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfTemplate; import com.itextpdf.text.pdf.PdfWriter; /** * Approaching Pi, Inc. http://www.approachingpi.com * &lt;p/&gt; * User: tcurran Date: Mar 17, 2008 Time: 2:29:43 AM Desc: */ public class PdfChartDemo { public static void main(String[] args) throws DocumentException { try { Document doc = new Document(PageSize.A4); PdfWriter docWriter = PdfWriter.getInstance(doc, new FileOutputStream("D:/helix-fossil.pdf")); doc.open(); doc.addProducer(); doc.addCreator("Jay Leno"); doc.addTitle("jfreechart pdf"); doc.setPageSize(PageSize.LETTER); doc.open(); // add some text to the document doc.add(new Phrase( "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod " + "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, " + "quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. " + "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum d…
has comment: http://stackoverflow.com/comment/33167984
type: Answer
has comment: http://stackoverflow.com/comment/33175241

http://stackoverflow.com/comment/33170044
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21872791
type: AnswerComment
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/47925/discussion-between-arjun-9990-and-droidfan)

http://stackoverflow.com/q/21874557
linked to: http://stackoverflow.com/q/1806198
upvote count: 0
has body: I have a program that converts dates from numerical month/day/year format to normal format (e.g. December 31, 2010). I don't want to import anything, or use a date object to go about what I'm doing. Before moving on to finding the max number of days by year, I'm trying to do it by month. I'm trying to match up the month with the number of days (omitting Feb since it depends on if it's Leap Year). This isn't working for me. I think it's because of the format. try { if (m == 1 &amp;&amp; (d &gt; 31 || d &lt; 1)) { // jan } else if (m == 3 &amp;&amp; (d &gt; 31 || d &lt; 1)) { // mar } else if (m == 4 &amp;&amp; (d &gt; 30 || d &lt; 1)) { // apr } else if (m == 5 &amp;&amp; (d &gt; 31 || d &lt; 1)) { // may } else if (m == 6 &amp;&amp; (d &gt; 30 || d &lt; 1)) { // june } else if (m == 7 &amp;&amp; (d &gt; 31 || d &lt; 1)) { // july } else if (m == 8 &amp;&amp; (d &gt; 31 || d &lt; 1)) { // aug } else if (m == 9 &amp;&amp; (d &gt; 30 || d &lt; 1)) { // sept } else if (m == 10 &amp;&amp; (d &gt; 30 || d &lt; 1)) { // oct } else if (m == 11 &amp;&amp; (d &gt; 30 || d &lt; 1)) { // nov } else if (m == 12 &amp;&amp; (d &gt; 31 || d &lt; 1)) // dec throw new DayException(day); } catch (Exception e) { throw new DayException(day); } Is there an easier way to validate the day?
has comment: http://stackoverflow.com/comment/33120055
favorite count: 0
has title: Find day according to month and year
has comment: http://stackoverflow.com/comment/33120180
has answer: http://stackoverflow.com/a/21874631
has comment: http://stackoverflow.com/comment/33119655
has comment: http://stackoverflow.com/comment/33120294
has comment: http://stackoverflow.com/comment/33120974
has comment: http://stackoverflow.com/comment/33120240
has comment: http://stackoverflow.com/comment/33119605
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33121048
has comment: http://stackoverflow.com/comment/33119500
has comment: http://stackoverflow.com/comment/33120425
has comment: http://stackoverflow.com/comment/33120323
has comment: http://stackoverflow.com/comment/33119499
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33119795
has comment: http://stackoverflow.com/comment/33120005
has comment: http://stackoverflow.com/comment/33119622
tagged with: java
score: -1
tagged with: date
has comment: http://stackoverflow.com/comment/76322813
has answer: http://stackoverflow.com/a/21874627
answer count: 2

http://stackoverflow.com/a/21873677
score: 2
has body: You can use following configuration : <property name="apple" ref="apple">
downvote count: 0
answers question: http://stackoverflow.com/q/21873487
upvote count: 2
type: Answer

http://stackoverflow.com/a/22348264
has comment: http://stackoverflow.com/comment/34071503
has comment: http://stackoverflow.com/comment/34047402
has body: Your analysis is generally ok, though here's a closer look at the times for each message: 23:19:05: Sent test request TEST 23:19:05.909: Sent the 35=1 with 112=TEST 23:19:23.381: Received the 35=0 with 112=TEST 23:19:32: Disco timeout "waiting for heartbeat" 23:19:44: Disco timeout "waiting for logon response" If there's something strange... in your network... call the network team? Something is causing your first disconnect. As the message says it's waiting for a heartbeat that probably doesn't include the 35=0 response to the test request. It's probably waiting for a 35=1 from B. What kind of messages are filling up the FIX.4.2-A-B.messages.log? Can you post some examples?
score: 0
has comment: http://stackoverflow.com/comment/34021525
type: Answer
answers question: http://stackoverflow.com/q/22004162

http://stackoverflow.com/a/21927079
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33213049
accepted answer of: http://stackoverflow.com/q/21927046
has comment: http://stackoverflow.com/comment/33212923
type: Answer
score: 6
has body: You don't have setContentView() in your Activity, hence, there's actually no View referenced to your activity and no views to find using findViewById() method, make sure the setContentView() was actually called... Regards!
downvote count: 1
upvote count: 7
answers question: http://stackoverflow.com/q/21927046

http://stackoverflow.com/q/21960193
score: -1
has comment: http://stackoverflow.com/comment/33272780
has comment: http://stackoverflow.com/comment/33272768
answer count: 1
favorite count: 0
tagged with: android-listview
tagged with: android
tagged with: sqlite
downvote count: 1
upvote count: 0
type: UnansweredQuestion
has body: I have encountered a problem in my Android application. I can only delete an item in my ListView, but not from my database. I need some help here. I need to delete it from my database. Here is my code: final ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(getActivity(), android.R.layout.simple_list_item_1, strlist2); listContent.setAdapter(adapter); listContent.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { listContent.setChoiceMode(ListView.CHOICE_MODE_SINGLE); listContent.setSelector(android.R.color.holo_blue_light); listContent.setItemsCanFocus(false); final int positionToRemove = position; String string = String.valueOf(id); dbAdapter.remove(string); dbAdapter.delete123456(string); adapter.remove(adapter.getItem(positionToRemove)); adapter.notifyDataSetChanged(); } }); Here is my dbAdapter.remove and my dbAdapter.delete123456 code: public boolean delete123456(String rowId) { /* this is what your database delete method should look like this method deletes by id, the first column in your database*/ return mDb.delete(FTS_VIRTUAL_TABLE, KEY_ROWID + "=" + rowId, null) &gt; 0; } public void remove(String id){ mDb.delete(FTS_VIRTUAL_TABLE, KEY_ROWID +"=?", new String [] { id }); } I need help here. I have been banging my head on the wall for the whole day now. Any help regarding this problem would be appreciated.
has answer: http://stackoverflow.com/a/21960448
type: Question
tagged with: java
has title: Delete item from database ListView

http://stackoverflow.com/a/21848730
score: 0
has body: use javap to check how the compiler is trying to optimize the code, i first scenario, a concatenation happen using the StringBuilder and finally toString is called Code: 0: ldc #16 // String , 2: astore_1 3: new #18 // class java/lang/StringBuilder 6: dup 7: ldc #20 // String Hello 9: invokespecial #22 // Method java/lang/StringBuilder."&lt;init&gt;":(Ljava/lang/String;)V 12: aload_1 13: invokevirtual #25 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 16: ldc #29 // String Welcome 18: invokevirtual #25 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 21: aload_1 22: invokevirtual #25 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 25: ldc #31 // String to 27: invokevirtual #25 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 30: aload_1 31: invokevirtual #25 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 34: ldc #33 // String Stack 36: invokevirtual #25 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 39: aload_1 40: invokevirtual #25 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 43: ldc #35 // String overflow 45: invokevirtual #25 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 48: invokevirtual #37 // Method java/lang/StringBuilder.toString:()Ljava/lang/String; 51: astore_2 Scenario 2 52: ldc #41 // String Hello,Welcome,to,Stack,overflow 54: astore_2 55: return
type: Answer
answers question: http://stackoverflow.com/q/21847679

http://stackoverflow.com/comment/33138963
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21882245
has text: @davidrv87 sounds like the code needs to be compiled first

http://stackoverflow.com/comment/33138568
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21884960
type: AnswerComment
has text: what is the benefit of scoping the class to the interface ?

http://stackoverflow.com/comment/33129966
score: 0
type: Comment
type: QuestionComment
has text: Okay.. simply hitting the delete key when highlighting one of the jars works. One gave an error though that the file could not be deleted but the other one could be deleted without problems and now the error seems to be gone..
comment on: http://stackoverflow.com/q/21878949

http://stackoverflow.com/comment/33121598
type: QuestionComment
has text: Also create a trace log using the IEDriver, by using the [builder](http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/ie/InternetExplorerDriverService.Builder.html#withLogLevel(org.openqa.selenium.ie.InternetExplorerDriverLogLevel))
comment on: http://stackoverflow.com/q/21874865
score: 0
type: Comment

http://stackoverflow.com/comment/33110139
type: AnswerComment
score: 0
type: Comment
has text: I run this code on Intellij 13, Output is - `electroencephalograph's`
comment on: http://stackoverflow.com/a/21868782

http://stackoverflow.com/comment/33150683
comment on: http://stackoverflow.com/a/21891577
type: Comment
has text: Yes, perhaps you should omit the hint-text. You didn't print additional text when displaying the array, did you?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33208712
type: QuestionComment
has text: Sometimes your .m2/repository gets messed up and all you can do is clear it out so you have a fresh cache.
score: 0
comment on: http://stackoverflow.com/q/21923945
type: Comment

http://stackoverflow.com/q/21898297
has answer: http://stackoverflow.com/a/31865369
tagged with: selenium-webdriver
type: AnsweredQuestion
has body: import java.util.concurrent.CountDownLatch; import com.performance.script.script1; import com.performance.script.script2; import com.performance.script.script3; import com.support.*; public class ThreadsRunnable{ static GetSessionID gsi = new GetSessionID(); static int threadUsers=30; static Thread thr2; public void testmain() throws InterruptedException{ // final CountDownLatch latch = new CountDownLatch(1); for (int i=1; i&lt;=threadUsers; i++) { Runnable runner = new Runnable() { public void run() { try { Thread.sleep(1000); // latch.await(); script1 s1 = new script1(); s1.setUp(); s1.testscript1(); cnq.tearDown(); } catch (InterruptedException ie) { } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; new Thread(runner, "TestThread"+i).start(); Thread.sleep(5000); } // all threads are waiting on the latch. // latch.countDown();// release the latch // all threads are now running concurrently. } public static void main(String arg[]) throws InterruptedException{ ThreadsRunnable tr = new ThreadsRunnable(); tr.testmain(); } } Below is the code which I run to find if the port 7054 is free and it always display as free on console. However, when i pass this port to run firefox it gives error, port binding can anyone help me on this. Thanks package GroboUtils; import java.io.IOException; import java.net.DatagramSocket; import java.net.InetSocketAddress; import java.net.ServerSocket; /** * * Finds an available port on localhost. */ public class PortFinder { // the ports below 1024 are system ports private final int MIN_PORT_NUMBER = 7054; // the ports above 49151 are dynamic and/or private private final int MAX_PORT_NUMBER = 49151; /** * * Finds a free port between * {@link #MIN_PORT_NUMBER} and * {@link #MAX_PORT_NUMBER}. * * @return a free port * @throw * RuntimeException if a port could not be found */ public int findFreePort() { for (int i = MIN_PORT_NUMBER; i &lt;= MAX_PORT_NUMBER; i++) { if (available(i)) { // System.out.println("Fr…
tagged with: java
upvote count: 1
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/31865369
has title: Selenium::WebDriver::Error::WebDriverError: unable to bind to locking port 7054 within 45 seconds
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33867723
has comment: http://stackoverflow.com/comment/33163552
favorite count: 0

http://stackoverflow.com/a/25582228
has comment: http://stackoverflow.com/comment/131192696
answers question: http://stackoverflow.com/q/21951096
upvote count: 1
has body: Delete the ANT_HOME path variable, the message is ACTUALLY saying it needs to use a project specific path. You are overriding it by setting ANT_HOME.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/33115175
type: Comment
comment on: http://stackoverflow.com/q/21871656
type: QuestionComment
has text: Yes Exexute that query on PL/sql developer out of the java I mean
score: 0

http://stackoverflow.com/q/21969625
linked to: http://stackoverflow.com/q/49002
accepted answer: http://stackoverflow.com/a/21969836
has answer: http://stackoverflow.com/a/21969895
score: 0
tagged with: rtti
has body: how i can dynamic downcast objects, with out instanceof statement? I reading Bruce Eckel's Thinking in Java, and there using Class, and there is such a theme, but I was not approached P.s. Sorry for my English. public class GenericTest { static private interface Base { } static private class A implements Base { } static private class B implements Base { } static private class C extends B { } private List&lt;Class&lt;? extends Base&gt;&gt; types; private List&lt;Base&gt; objects; public GenericTest() { types = new ArrayList&lt;Class&lt;? extends Base&gt;&gt;(); types.add(A.class); types.add(B.class); types.add(C.class); objects = new ArrayList&lt;Base&gt;(Arrays.asList(new A(), new B(), new C())); for (Base base : objects) { if (base instanceof A) test((A) base); else if (base instanceof C) test((C) base); else if (base instanceof B) test((B) base); for (Class&lt;? extends Base&gt; c : types) if (base.getClass().equals(c)) test(c.cast(base)); } } private void test(A a) { System.out.println("A"); } private void test(B b) { System.out.println("B"); } private void test(C c) { System.out.println("C"); } private void test(Base base) { System.out.println("Base"); } public static void main(String[] args) { new GenericTest(); } }
possible better answer: http://stackoverflow.com/a/21969895
tagged with: generics
tagged with: downcast
tagged with: instanceof
has comment: http://stackoverflow.com/comment/33289526
has title: Java dynamic downcasting from generic list
has comment: http://stackoverflow.com/comment/33289725
has answer: http://stackoverflow.com/a/21969836
has comment: http://stackoverflow.com/comment/33291955
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/comment/33112249
comment on: http://stackoverflow.com/q/21870263
score: 0
type: Comment
type: QuestionComment
has text: is `showPopUpButton` really a `TextView` or is it a `Button`?

http://stackoverflow.com/comment/110849419
type: Comment
comment on: http://stackoverflow.com/a/21922637
score: 0
type: AnswerComment
has text: Can you explain what sums array is for?

http://stackoverflow.com/a/21970471
answers question: http://stackoverflow.com/q/21966417
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21966417
has body: The problem is that the attributes of the converter are evaluated when the view is build. This is partially because a converter is not a component itself, but in Facelets implemented by a TagHandler that sets a converter instance in the parent component. See JSTL in JSF2 Facelets... makes sense? for a very thorough background explanation. You can solve this by using the &lt;o:converter&gt; from OmniFaces that was specifically build for this use case. Contrary to the regular converters, this one does evaluate its attributes when its parent component is being rendered. See: http://showcase.omnifaces.org/taghandlers/converter
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/33214353
type: AnswerComment
comment on: http://stackoverflow.com/a/21927337
type: Comment
has text: the arrayList<integer> needs to be in the factorX method or on the main method?
score: 0

http://stackoverflow.com/comment/33277729
type: Comment
comment on: http://stackoverflow.com/a/21962996
has text: Hang on a second. `Fish` is `abstract`. You can't just do `new Fish()`.
score: 1
type: AnswerComment

http://stackoverflow.com/a/21916356
downvote count: 0
has comment: http://stackoverflow.com/comment/33248152
has comment: http://stackoverflow.com/comment/33442748
has comment: http://stackoverflow.com/comment/33447215
answers question: http://stackoverflow.com/q/21912842
has comment: http://stackoverflow.com/comment/33238113
type: Answer
has comment: http://stackoverflow.com/comment/33257303
has comment: http://stackoverflow.com/comment/33213404
has comment: http://stackoverflow.com/comment/33240991
score: 1
upvote count: 1
has body: You should have zkclient.jar in storm lib folder. http://repo1.maven.org/maven2/com/101tec/zkclient/0.1.0/zkclient-0.1.0.jar should work. Else you should install a higher version of the jar. Kafka uses zkclient to communicate with Zookeeper. BTW, you should go for Kafka 0.8.0 as it has replication.

http://stackoverflow.com/comment/33130845
has text: I have used getters and setters in a loginbean class for the fields of the database. In the code I posted above. please advice now
comment on: http://stackoverflow.com/a/21881101
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21842284
type: Answer
upvote count: 0
score: -1
has body: Why dont you try JODconverter https://code.google.com/p/jodconverter/
answers question: http://stackoverflow.com/q/21841814
downvote count: 1

http://stackoverflow.com/comment/33086867
type: QuestionComment
comment on: http://stackoverflow.com/q/21856596
score: 1
has text: is `String.contains()` not good enough for you?
type: Comment

http://stackoverflow.com/q/21891552
tagged with: maven
upvote count: 1
type: Question
score: 1
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
tagged with: apache-fop
has answer: http://stackoverflow.com/a/22220537
has body: I have a conflict using two packages in my java project - apache fop and lesscss. I figured out the reason of the error - less compiler uses context.setLanguageVersion(Context.VERSION_1_7); in it's constructor, where context is an object of class org.mozilla.javascript.Context (rhino package). But apache fop has patched version of this object (http://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-js/1.7), which doesn't support 1.7 language version. So here is extremely simplified set of files, which can demonstrate my issue. All you need is 1) pom.xml with the following content: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 test test war 0.1 org.mozilla rhino 1.7R4 org.apache.xmlgraphics fop 1.0 javax javaee-api 7.0 provided 2) Some test servlet with the following content: package main; import org.mozilla.javascript.Context; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class TestServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Context context = new Context(); context.setLanguageVersion(Context.VERSION_1_7); } } Compiling this using mvn clean package will cause java.lang.IllegalArgumentException: Bad language version: 170 That's because patched (by fop) Context is using, but I want Rhino original Context, which supports 1.7 version. If you remove fop dependency from pom.xml, everything will work just fine. So how can I use both fop and lesscss without any errors?
accepted answer: http://stackoverflow.com/a/22220537
type: AnsweredQuestion
has title: org.apache.xmlgraphics fop + org.lesscss lesscss conflict

http://stackoverflow.com/q/21953331
has comment: http://stackoverflow.com/comment/33260039
possible better answer: http://stackoverflow.com/a/21953767
tagged with: testing
has body: I have a void method and I want to test it. How do I do that? Here's the method: public void updateCustomerTagCount() { List&lt;String&gt; fileList = ImportTagJob.fetchData(); try { for (String tag : fileList) { Long tagNo = Long.parseLong(tag); Customer customer = DatabaseInterface.getCustomer(tagNo); customer.incrementNoOfTimesRecycled(); DatabaseInterface.UpdateCustomer(customer); } } catch(IllegalArgumentException ex) { ex.printStackTrace(); } }
has title: Test method that returns void
score: -3
has comment: http://stackoverflow.com/comment/33260063
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/21953460
favorite count: 0
type: Question
answer count: 2
tagged with: jdbc
has comment: http://stackoverflow.com/comment/33260049
has answer: http://stackoverflow.com/a/21953767
accepted answer: http://stackoverflow.com/a/21953460
tagged with: java
downvote count: 3

http://stackoverflow.com/a/42360860
type: Answer
score: 0
has body: Check echo $JAVA_HOME if it doesn't gives you correct path. follow setting JAVA_HOME path on Ubuntu if it gives you correct path set then you need to update your gradle plugin version (It worked for me) and rebuild project.
answers question: http://stackoverflow.com/q/22001328

http://stackoverflow.com/comment/33076237
has text: Have you used a `WebDriverWait` to "wait" for it? Are you sure you cannot do this using a native API?
comment on: http://stackoverflow.com/q/21850193
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33218477
comment on: http://stackoverflow.com/a/21889571
type: Comment
has text: nope..i am not using dependency(maven) for this..:P..is it not possible to access static resource.i do not think so..u have some idea pls reply...
type: AnswerComment
score: 0

http://stackoverflow.com/a/22004511
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/33352149
has comment: http://stackoverflow.com/comment/33351865
has comment: http://stackoverflow.com/comment/33352050
downvote count: 0
has body: As per the spec you should use and @EmbeddedId or @IdClass when you use composite key. If the dependent entity class has primary key attributes in addition to those corresponding to the parent's primary key or if the parent has a composite primary key, an embedded id or id class must be used to specify the primary key of the dependent entity. It is not necessary that parent entity and dependent entity both use embedded ids or both use id classes to represent composite primary keys when the parent has a composite key. Question was: I am mapping a composite primary key using GROUP_DEPT, DEPTID above and EFFDT below as follows. Does hibernate support this.? Yes hibernate support that, but you should use @EmbeddedId, I know that this need to create a new class to handle the key but that need to be done as far as I know.
answers question: http://stackoverflow.com/q/22004428

http://stackoverflow.com/comment/33297104
type: AnswerComment
score: 0
has text: @VM So you would make the count 5, and the top 5 cards would be random, even if the rest of the cards would not be very random. i.e. this is like a shuffle but stops after the first 5 cards, making it possibly 10x faster.
type: Comment
comment on: http://stackoverflow.com/a/21973933

http://stackoverflow.com/comment/33086831
type: Comment
has text: The path to the file is incorrect. The exception is pretty clear.
score: 0
comment on: http://stackoverflow.com/q/21856648
type: QuestionComment

http://stackoverflow.com/a/21956078
score: 2
has comment: http://stackoverflow.com/comment/33279034
upvote count: 2
answers question: http://stackoverflow.com/q/21955264
has comment: http://stackoverflow.com/comment/33279222
has comment: http://stackoverflow.com/comment/33273727
accepted answer of: http://stackoverflow.com/q/21955264
has body: I had a bit of a dig around ... The javax.script.ScriptEngineManager relies on a SPI mechanism to find and register ScriptEngineFactory classes. Essentially, it trawls the classpath, looking for these classes. Apparently, in in your case, this has resulted in it finding NashornScriptEngineFactory. But why? Well there are only really 3 possibilities: You have a JAR file that includes Nashorn on your application's classpath. You are using a JVM that includes Nashorn in one of its JAR files. Someone has added the Nashorn in the Java installation's extensions directory. To find out which, I suggest that you use find to find all of the JAR files on the client system, then use jar tvf some.jar | grep Nashorn to try to find which JAR is providing the Nashorn classes.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33284726
has comment: http://stackoverflow.com/comment/33280284
has comment: http://stackoverflow.com/comment/33279142
has comment: http://stackoverflow.com/comment/33267801
type: Answer

http://stackoverflow.com/comment/33078249
comment on: http://stackoverflow.com/a/21851687
has text: Are you sure the instance field is autowired? BTW, the `Foo` object must be managed by Spring as well. @Dileep
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33136187
type: Comment
has text: Thanks jmkgreen for the help.
comment on: http://stackoverflow.com/a/21883640
type: AnswerComment
score: 0

http://stackoverflow.com/a/21956732
score: 1
upvote count: 1
has body: Kryonet is a very good Java library which provides a clean and simple API for efficient TCP and UDP client/server network communication using NIO. It will make your network programming work a lot more easier, and you can get a better understanding of how to write client and server side code. I would suggest that you try out your network programming skills using this library. You need not even hard code any IP address of the server while in LAN. The clients can discover the server in just one line of code.
answers question: http://stackoverflow.com/q/21956610
downvote count: 0
type: Answer

http://stackoverflow.com/a/22009899
has body: Just put below line into your class varialble ArrayList&lt;String&gt; wordLineArray = new ArrayList&lt;String&gt;(); Than use add method array list to add each line of word into it. wordLineArray.add(receiveString); Use this line before appending it to previous buffer. Now use this arraylist as per your requirment. If it is helpful to you than don't forget to accept this answer.
accepted answer of: http://stackoverflow.com/q/21999692
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21999692
score: 0

http://stackoverflow.com/q/21845566
has comment: http://stackoverflow.com/comment/33068921
tagged with: java
score: -1
tagged with: servlets
has answer: http://stackoverflow.com/a/21846906
has comment: http://stackoverflow.com/comment/33067964
has title: Make servlet work in background
downvote count: 1
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/33069381
favorite count: 0
type: AnsweredQuestion
upvote count: 0
has body: I have a file uploading sevlet, and the UI on my JSP. &lt;form method="post" action="mygeco" enctype="multipart/form-data" style="position: absolute; left: 30%; bottom: 2%;"&gt; &lt;input type="file" name="dataFile" id="fileChooser" /&gt;&amp;nbsp; &lt;input type="submit" value="Upload" multiple="multiple" /&gt; &lt;/form&gt; The file uploading is done on my dopost method, and I have other code in mind for my doget() method so, when the user presses upload button on my jsp page I want the uploading to happen in background while the user stays on the jsp page and return an alert when the uploading is done, how do I do this? protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub boolean isMultipart = ServletFileUpload.isMultipartContent(request); response.setContentType("text/html"); if (isMultipart) { // Create a factory for disk-based file items FileItemFactory factory = new DiskFileItemFactory(); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); try { // Parse the request List items = upload.parseRequest(request); Iterator iterator = items.iterator(); System.out.println("starting saver"); while (iterator.hasNext()) { FileItem item = (FileItem) iterator.next(); if (!item.isFormField()) { String fileName = item.getName(); String root = getServletContext().getRealPath("/"); File path = new File("/u/poolla/workspace/FirstServlet/"); if (!path.exists()) { boolean status = path.mkdirs(); } File uploadedFile = new File(path + "/" + fileName); System.out.println(uploadedFile.getAbsolutePath()); if(fileName!="") item.write(uploadedFile); else System.out.println("file not found"); System.out.println("&lt;h1&gt;File Uploaded Successfully....:-)&lt;/h1&gt;"); } else { String abc = item.getString(); System.out.println("&lt;br&gt;&lt;br&gt;&lt;h1&gt;"+abc+"&lt;/h1&gt;&lt;br&gt;&lt;br&gt;"); } } } catch (FileUploadException e) { System.ou…
accepted answer: http://stackoverflow.com/a/21846906
type: Question

http://stackoverflow.com/a/21875284
has comment: http://stackoverflow.com/comment/33121364
downvote count: 0
has body: To perform tasks in background and updating UI elements in Swing application you can use SwingWorker class.
answers question: http://stackoverflow.com/q/21875192
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/21996330
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21996986
has answer: http://stackoverflow.com/a/22010457
tagged with: java
tagged with: sonarqube
possible better answer: http://stackoverflow.com/a/22010457
has body: This code: Set&lt;Map.Entry&lt;String, SSGSession&gt;&gt; theSet = new TreeSet&lt;Map.Entry&lt;String, SSGSession&gt;&gt;(new Comparator&lt;Map.Entry&lt;String, SSGSession&gt;&gt;() { @Override public int compare(final Map.Entry&lt;String, SSGSession&gt; e1, final Map.Entry&lt;String, SSGSession&gt; e2) { return e2.getValue().getStartTime().compareTo(e1.getValue().getStartTime()); } })); triggers a violation in Sonar, tripping the findbugs rule "SIC_INNER_SHOULD_BE_STATIC_ANON" which has the description: This class is an inner class, but does not use its embedded reference to the object which created it. This reference makes the instances of the class larger, and may keep the reference to the creator object alive longer than necessary. If possible, the class should be made into a static inner class. Since anonymous inner classes cannot be marked as static, doing this will require refactoring the inner class so that it is a named inner class. Really? Isn't this very nit-picky? Should I really refactor a one line method in an anonymous inner class to save the cost of an extra reference ? In this case, there's no possibility of it holding the reference longer than necessary. I don't mind doing it as our strongly enforced coding standards are "zero sonar violations" but I'm strongly tempted to argue the case for a //NOSONAR here, as imho extracting a one line method to a static inner makes the code slightly harder to grok. What do the java purists think?
upvote count: 12
tagged with: findbugs
has comment: http://stackoverflow.com/comment/33337178
favorite count: 0
has answer: http://stackoverflow.com/a/44431780
has comment: http://stackoverflow.com/comment/33337428
has answer: http://stackoverflow.com/a/21996986
score: 11
answer count: 4
has title: findbugs is objecting to anonymous inner class
has answer: http://stackoverflow.com/a/22004414
has comment: http://stackoverflow.com/comment/33337254
has comment: http://stackoverflow.com/comment/33337426
downvote count: 1
type: Question

http://stackoverflow.com/comment/33066576
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21844826
type: Comment
has text: Interesting. I just tried upgrading my pom to use 3.0.0, and am now getting a different exception. Please see my edit.

http://stackoverflow.com/comment/33269663
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21958592
has text: Don't forget tca, atc and cta.

http://stackoverflow.com/comment/33322478
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21987675
score: 1
has text: All your Spring library versions should be the same. In this case, probably `3.1.0`.

http://stackoverflow.com/a/21882004
has comment: http://stackoverflow.com/comment/33132814
has comment: http://stackoverflow.com/comment/33133131
has comment: http://stackoverflow.com/comment/33133798
downvote count: 1
upvote count: 64
has comment: http://stackoverflow.com/comment/130868537
has comment: http://stackoverflow.com/comment/33134150
has comment: http://stackoverflow.com/comment/33134024
has comment: http://stackoverflow.com/comment/33133316
has comment: http://stackoverflow.com/comment/33133827
has comment: http://stackoverflow.com/comment/33134275
has comment: http://stackoverflow.com/comment/33132421
has comment: http://stackoverflow.com/comment/33134341
has body: slf4j is only an API. You should have a concrete implementation (for example log4j). This concrete implementation has a config file which tells you where to store the logs. When slf4j catches a log messages with a logger, it is given to an appender which decides what to do with the message. By default, the ConsoleAppender displays the message in the console. The default configuration file is : <?xml version="1.0" encoding="UTF-8"?> <!-- By default => console --> <AppenderRef ref="Console"/> If you put a configuration file available in the classpath, then your concrete implementation (in your case, log4j) will find and use it. See Log4J documentation. Example of file appender : %d %p %C{1.} [%t] %m%n ... Complete example with a file appender : <?xml version="1.0" encoding="UTF-8"?> %d %p %C{1.} [%t] %m%n <AppenderRef ref="File"/>
score: 63
has comment: http://stackoverflow.com/comment/33133620
has comment: http://stackoverflow.com/comment/33133533
answers question: http://stackoverflow.com/q/21881846
type: Answer
has comment: http://stackoverflow.com/comment/33133022
has comment: http://stackoverflow.com/comment/33133715
has comment: http://stackoverflow.com/comment/33133946
has comment: http://stackoverflow.com/comment/33133348
has comment: http://stackoverflow.com/comment/33133231
has comment: http://stackoverflow.com/comment/33134366

http://stackoverflow.com/a/21965230
has comment: http://stackoverflow.com/comment/33282144
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21965116
type: Answer
accepted answer of: http://stackoverflow.com/q/21965116
has body: The program doesn't hang but rather it exits because: frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); From the doc: EXIT_ON_CLOSE (defined in JFrame): Exit the application using the System exit method. Use this only in applications. Here, it seems like DISPOSE_ON_CLOSE will result in the behavior you are expecting. I also do not really see a reason to be posting this window closing event when you can call setVisible(false) and dispose. Without making assumptions about what the program is actually intended to do, both of these options will result in all 10 frames being shown/hidden/disposed. I would guess that the reason the program halts after printing the '2' is that calling invokeAndWait causes any previously queued events to be pumped, including the window closing event.
score: 4
upvote count: 4

http://stackoverflow.com/comment/127833824
comment on: http://stackoverflow.com/a/55164077
score: 0
type: Comment
has text: Giving `400 Bad Request: [{"error":"invalid_request"}` error
type: AnswerComment

http://stackoverflow.com/comment/121498194
score: 0
type: Comment
type: QuestionComment
has text: @chillworld that wouldn't be applicable. we're mapping to strings, _from_ ints.
comment on: http://stackoverflow.com/q/21873829

http://stackoverflow.com/a/21849207
has comment: http://stackoverflow.com/comment/33080065
has comment: http://stackoverflow.com/comment/33078336
score: 3
has body: "yes i am using gui builder" Just put setLocationRelativeTo(null) after initComponents(), in the constructor. public class MyFrame extends JFrame { public MyFrame() { initComponents(); setLocationRelativeTo(null); } } JFrame as a subclass of Window inherits Window methods. The API can be seen here The method used above is listed as follows public void setLocationRelativeTo(Component c) - Sets the location of the window relative to the specified component according to the following scenarios. If the component is null, or the GraphicsConfiguration associated with this component is null, the window is placed in the center of the screen.
has comment: http://stackoverflow.com/comment/33075307
type: Answer
has comment: http://stackoverflow.com/comment/33077823
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21848895
answers question: http://stackoverflow.com/q/21848895
has comment: http://stackoverflow.com/comment/33075536
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/77930897
answers question: http://stackoverflow.com/q/21944464
score: 0
type: Answer
has body: You can find it in MainActivity.kt and ManinApplication.kt file at the starting line of the code with other imports.

http://stackoverflow.com/q/21973022
tagged with: java
has body: I am using the AST of the JDT to parse Java files and am currently trying to figure out how to identify the type of the parameters passed to methods during method invocation. Currently I use the VariableDeclarationFragment to store the type of any variable in a method in a HashMap. When a method invocation occurs (identified using MethodInvocation), I search for the variable passed as a parameter in the HashMap so as to determine its type. So for example if I have something like: int x = 7; M1(x); in the HashMap I store x which maps to int. When the method M1 is invoked I check what is the type of x and use it as needed. My problem is that this does not work in invocations like M1(7) Is there a way of determining the type of '7' using the AST?
tagged with: eclipse-jdt
has comment: http://stackoverflow.com/comment/33296563
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/33333120
tagged with: abstract-syntax-tree
has answer: http://stackoverflow.com/a/22389952
has comment: http://stackoverflow.com/comment/33297333
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40218905
has title: Identifying the types of parameters passed to methods using the AST of the JDT
type: UnansweredQuestion
tagged with: visitor-pattern
score: 2
has comment: http://stackoverflow.com/comment/33295845
downvote count: 0

http://stackoverflow.com/a/37173916
score: 0
type: Answer
has body: from what I know, your emailservice has to be inside of your production sphere. you cannot hit prod smtp server from outside of that sphere. at least that was the case with the issue that I encountered.
answers question: http://stackoverflow.com/q/21884126

http://stackoverflow.com/q/21844665
has comment: http://stackoverflow.com/comment/33066912
tagged with: floating-point
has title: Floating point errors
has body: I am having trouble with floating points. A the double . 56 in Java, for example, might actually be stored as .56000...1. I am trying to convert a decimal to a fraction. I tried to do this using continued fractions Continuous Fractions but my answers using that method were inaccurate due to how to computer stored and rounded decimals. I tried an alternative method: public static Rational rationalize(double a){ if(a&gt;= 1){ //throw some exception } String copOut = Double.toString(a); int counter = 0; System.out.println(a); while(a%1 != 0 &amp;&amp; counter &lt; copOut.length() - 2){ a *= 10; counter++; } long deno = (long)Math.pow(10,counter);//sets the denominator Rational frac = new Rational((long)a,deno)//the unsimplified rational number long gcd = frac.gcd(); long fnum = frac.getNumer();//gets the numerator long fden = frac.getDenom();//gets the denominator frac = new Rational(fnum/gcd, fden/gcd); return frac; } I am using the string to find the length of the decimal to determine how many time I should multiply by 10. I later truncate the decimal. This gets me the right answer, but it does not feel like the right approach? Can someone suggest the 'correct' way to do this?
type: Question
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/21843649
type: UnansweredQuestion
tagged with: rational-numbers
has answer: http://stackoverflow.com/a/21845036
tagged with: java

http://stackoverflow.com/a/21949686
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/33254002
downvote count: 0
answers question: http://stackoverflow.com/q/21949591
has body: Declare Variable i as static public class Ybus_Activity extends Activity { //Here Declare the vaiable static int i=0; @Override public void onCreate(Bundle savedInstanceState) { } }
has comment: http://stackoverflow.com/comment/33253834
upvote count: 2
has comment: http://stackoverflow.com/comment/33253892

http://stackoverflow.com/q/21884247
score: 0
has answer: http://stackoverflow.com/a/21901483
tagged with: java
tagged with: hibernate
type: Question
accepted answer: http://stackoverflow.com/a/21901483
tagged with: bonecp
answer count: 1
has title: BoneCP with Hibernate 4.3.x
tagged with: maven
tagged with: build
type: AnsweredQuestion
has body: I've updated hibernate to a new version in one of my projects, and now i have to update BoneCP too because the ConnectionProvider - Package Declaration changed in Hibernate 4.3.x. The change is already on BoneCP's git but i can't find an updated .jar on their maven repo. So i tried to build it on my own with maven, but i always run in some errors. Can someone hint me how to build boneCP successfully or where to find an updated version for the new hibernate? Thanks! JFYI when i try to build it myself with maven (mvn clean install) i get following error output: [INFO] 16 errors [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] BoneCP ............................................ SUCCESS [0.554s] [INFO] BoneCP :: JDK567 compatibility .................... SUCCESS [1.336s] [INFO] BoneCP :: Test Commons ............................ SUCCESS [0.422s] [INFO] BoneCP :: Core Library ............................ FAILURE [2.326s] [INFO] BoneCP :: Spring support .......................... SKIPPED [INFO] BoneCP :: Hibernate provider ...................... SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.520s [INFO] Finished at: Wed Feb 19 16:01:18 CET 2014 [INFO] Final Memory: 18M/81M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:testCompile (default-testCompile) on project bonecp: Compilation failure: Compilation failure: [ERROR] /Users/mike.penz/Downloads/bonecp-master/bonecp/src/test/java/com/jolbox/bonecp/TestConnectionMaxAgeTester.java:[73,29] cannot find symbol [ERROR] symbol : constructor ConnectionMaxAgeThread(com.jolbox.bonecp.ConnectionPartition,java.util.concurrent…

http://stackoverflow.com/q/21867935
has comment: http://stackoverflow.com/comment/33108164
has answer: http://stackoverflow.com/a/21868033
accepted answer: http://stackoverflow.com/a/21868033
has title: use function from main activity in another java file
has answer: http://stackoverflow.com/a/21867990
score: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/21867990
type: AnsweredQuestion
has body: I’m trying to call a method in my main Activity from another file, but it crashes. I can easily do this the other way. Can you not invoke methods of the main Activity from another Activity? public class MainActivity extends Activity { …. …….. …… public void my_function(String a){ //do some stuff } } package main; public class stuff extends Activity { …. …. … MainActivity run = new MainActivity(); run.my_function(String a); } }
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/comment/33095172
comment on: http://stackoverflow.com/a/21860477
type: Comment
has text: I've edited the code so that the getExternalStorageDirectory() goes toString() before being saved as SD, but I have the same result.
type: AnswerComment
score: 0

http://stackoverflow.com/a/21863833
type: Answer
answers question: http://stackoverflow.com/q/21863685
has body: for (int red=0; red&lt;256; red++) for (int green=0; green&lt;256; green++) for (int red=0; red&lt;256; red++) { // output of every combination of all red, green and blue } Or if you just wanted values of 0 and 255, just make them count to 1 then multiply by 255 into another variable.
has comment: http://stackoverflow.com/comment/33100340
score: 0

http://stackoverflow.com/comment/33254947
type: QuestionComment
has text: yw. what's the question? And where is your closing parentheses?
comment on: http://stackoverflow.com/q/21950320
score: 0
type: Comment

jboss6.x
tag name: jboss6.x
type: Tag
tags question: http://stackoverflow.com/q/21872069
tags question: http://stackoverflow.com/q/21901912

http://stackoverflow.com/a/21988291
score: 4
type: Answer
answers question: http://stackoverflow.com/q/21987948
has body: It's not really comparable. A Future represents the result of an asynchronous computation and enables you to access the result of that computation when it's done (possibly in the future if the computation takes some time, hence the name). A Fork/Join pool is a form of ExecutorService (task execution system) that executes its tasks using multiple threads and uses a work stealing algorithm. The result of a fork/join task is a Future.
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/33290812
comment on: http://stackoverflow.com/q/21948904
type: Comment
has text: There's probably a problem with the way you're storing the characters on the stack. I'm not going to give you the answer.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33163833
comment on: http://stackoverflow.com/a/21875456
score: 0
type: AnswerComment
has text: Oh, i was a bit too quick. I thought the iText file was your new file and tested it. The above is true for that file, not your new attempt.
type: Comment

http://stackoverflow.com/comment/33215087
type: QuestionComment
has text: If it needs that many privileges, why is it an applet to start with? This is like asking a word processor to run as root.
type: Comment
comment on: http://stackoverflow.com/q/21928342
score: 0

http://stackoverflow.com/comment/33158794
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/21895966
has text: if your splitting code is fast and it's slow after adding the GUI, why are you posting the splitting code instead of your GUI code? :-)
type: Comment

http://stackoverflow.com/a/21885044
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21870454
has body: As far as i know java is not build into Maverick ;) Maybe I'm wrong but every time after fresh install when I want to run Java program Java starts the installation itself. It seems that Maverick will call needed installation process when needed on demand. Try installing JDownloader. That usually triggers Java installation for me.
has comment: http://stackoverflow.com/comment/33148728

http://stackoverflow.com/a/21857066
answers question: http://stackoverflow.com/q/21856431
downvote count: 0
has body: What was mentioned in question you pointed out in your comment was something like this: Map&lt;Integer, Callable&gt; map = new HashMap&lt;&gt;(); map.put(1, new Callable() { public Object call() throws Exception { //code for argument 1 return null; } }); map.put(2, new Callable() { public Object call() throws Exception { //code for argument 2 return null; } }); map.put(3, new Callable() { public Object call() throws Exception { //code for argument 3 return null; } }); Now you can use it as map.get(count).call();
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/a/21983451
has body: I used readonly=true attribute, but it didn't worked for me. One more attribute is readonlyInput=true but this is for not Inline calendar. So Finally I ended up unbinding all the events attached to &lt;TD&gt; of p:calendar component through JQuery. I don't know if its a feasible solution(there may be other alternatives) but this script works just fine. $(document).ready( function makeCalendarReadOnly(){ $(".ui-datepicker-inline td").unbind(); } );
upvote count: 1
answers question: http://stackoverflow.com/q/21970818
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/21998435
has comment: http://stackoverflow.com/comment/33342643
has body: I pretty much have no idea how I would go about doing this- I need to find the frequency of a played sine wave at a specific point in time. I've been doing some research and see that it involves a Fourier transform. I've found a DFT class but am not really sure how to use it. My questions are these: How do I save a sound file from a mic at a specific point in time? What format will this be saved in? From this, how would I go about using an FFT/DFT to find the frequencies in that sample? I don't really have a clear understanding of the mathematics behind the FFT (and yes, I've tried to understand it), so am not really sure what outputs/inputs represent. Alternatively if there are any libraries that support this type of thing, a link would be much appreciated. Thanks in advance
tagged with: fft
has comment: http://stackoverflow.com/comment/33350082
has comment: http://stackoverflow.com/comment/33349503
score: 0
has comment: http://stackoverflow.com/comment/33344138
tagged with: microphone
has comment: http://stackoverflow.com/comment/33344116
has comment: http://stackoverflow.com/comment/33344082
linked to: http://stackoverflow.com/q/17476686
has title: How would I go about getting frequency of a sound source in Java?
tagged with: frequency
has comment: http://stackoverflow.com/comment/33344158
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33343431
has comment: http://stackoverflow.com/comment/33344132
has comment: http://stackoverflow.com/comment/33358627
has comment: http://stackoverflow.com/comment/33345785
tagged with: audio
answer count: 0
tagged with: java
type: Question

http://stackoverflow.com/comment/33323008
has text: Nothings actually being printed, maybe it's a case that they're not even being set as anything? Hmm..
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21973396

http://stackoverflow.com/comment/33187939
type: Comment
score: 2
has text: `"a.a..a".matches("^(?![^.]*\\.{2})[.a-z0-9_-]{5,32}$")` returns `true` :/ Change `(?![^.]*\\.{2})` to `(?!.*\\.{2})` to let negative-look-ahead match also `a.a` before `..`
type: AnswerComment
comment on: http://stackoverflow.com/a/21912723

http://stackoverflow.com/a/21916459
downvote count: 0
has comment: http://stackoverflow.com/comment/33195921
has comment: http://stackoverflow.com/comment/33195528
type: Answer
has comment: http://stackoverflow.com/comment/33195400
has comment: http://stackoverflow.com/comment/33195303
has comment: http://stackoverflow.com/comment/33195315
upvote count: 1
has comment: http://stackoverflow.com/comment/33217033
answers question: http://stackoverflow.com/q/21916191
has body: When the screen is off, if no other applications are holding WakeLock, the CPU suspends. You should use a PARTIAL WakeLock whenever you need something done while screen is off. And make sure you release it as soon as you've done all the ackground job.
has comment: http://stackoverflow.com/comment/33235290
score: 1
has comment: http://stackoverflow.com/comment/33195181
has comment: http://stackoverflow.com/comment/33195567

http://stackoverflow.com/comment/33220171
type: Comment
has text: BTW try this in mean time `createCriteria("accAttrAlias.attribut", "attrAlias"). add(Restrictions.isNotNull("attrAlias.name"))` as I will be able take detail look on day end.
type: QuestionComment
comment on: http://stackoverflow.com/q/21906744
score: 0

http://stackoverflow.com/q/21873258
has comment: http://stackoverflow.com/comment/33117607
type: Question
has title: XML serialization of nested objects in JAVA
linked to: http://stackoverflow.com/q/7534500
score: 0
tagged with: java
tagged with: jaxb
answer count: 1
has body: I am using JAXB to serialize and deserialize java objects. Classes are as: public class Level1Class { String Id; HashMap&lt;String,Level2Class&gt; level2Map = new HashMap&lt;String,Level2Class&gt;(); } public class Level2Class { String Id; } I want to serialize and deserialize object of Level1Class. Please suggest annotation for classes and fields. What else do I need to include 1. default constructor 2. getter setter of fields
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21873471
tagged with: xml-serialization

http://stackoverflow.com/comment/33090197
score: 0
type: QuestionComment
type: Comment
has text: What is the output (key, value) pairs of the mapper? Any code that would help us better understand?
comment on: http://stackoverflow.com/q/21857814

http://stackoverflow.com/comment/33301476
score: 0
has text: Yes this worked like a charm. problem fixed, thank you. Quickest fix ever, so fast in fact i still have to wait 7 minutes before i can click accept answer lol.
type: Comment
comment on: http://stackoverflow.com/a/21976292
type: AnswerComment

http://stackoverflow.com/comment/33173455
has text: @ClickUpvote yes , I absolutely know what you mean . :) If you show with english first , user will show english first and their prefer language is next. If you have as **Interceptors** for it , for example checking with URL mapper, you wouldn't need to show with English first. You can used it with some utilities such as Spring MVC or others... Or open another topic. My answer is for internationalization with messages or constants.
comment on: http://stackoverflow.com/a/21899705
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33206538
has text: Do they have the same lengths? And are they always direct (i.e. "ab" and "bc" and not "ab" and "cb")?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21923138
type: QuestionComment

http://stackoverflow.com/comment/33208340
type: AnswerComment
has text: I have updated the post with pastebin links to almost all of the source code. Your answer did not work for me.
type: Comment
comment on: http://stackoverflow.com/a/21924112
score: 0

http://stackoverflow.com/q/21969231
tagged with: java
tagged with: memory
tagged with: heap-dump
has comment: http://stackoverflow.com/comment/33290620
type: Question
tagged with: windbg
has comment: http://stackoverflow.com/comment/33294715
has body: I do work on some memory leak and I have really confused about how can I found name of the objects and them actual size from attached process to windbg(This java process). I have like peace of this from memory tab(Real-16 Byte): 77be4109 0.24824256118801986987e+1583 77be4119 -2.5614129038254496960e-4692 77be4129 0.00035486639300841043e-4512 77be4139 1.01282186869268740952e-4257 77be4149 0.00001113192301372295e-4933 77be4159 -7.4761787341726152931e+1384 77be4169 1.20314665648499437676e+0812 77be4179 0.24824256118533248913e+1583 77be4189 -4.0982606461207195136e-4691 77be4199 1.93872828151051165909e-4855 77be41a9 -1.82623583419004015246e-4208 77be41b9 -6.5104196508680929063e-4078 77be41c9 3.65267555224407110105e-4933 77be41d9 -0.00015215514283814482e-2827 77be41e9 -7.23917258927010071181e+2171 77be41f9 -1.91695563942559237891e+0682 77be4209 1.88491305327009472803e+1237 77be4219 -1.47471100734719497676e+0759 77be4229 5.12498463030795446119e-0701 77be4239 3.63165983722201482762e-4305 77be4249 0.00176536862792912144e-4933 77be4259 2.62291322678419124421e-4923 77be4269 -6.19904883189621925339e-3641 77be4279 1.10850108613423590267e-3936 And I got peace of this from Dessambely tab: 77c1397e 8b1e mov ebx,dword ptr [esi] 77c13980 68aa000000 push 0AAh 77c13985 6a08 push 8 77c13987 ff7018 push dword ptr [eax+18h] 77c1398a e847f4feff call ntdll!RtlAllocateHeap (77c02dd6) 77c1398f 89450c mov dword ptr [ebp+0Ch],eax 77c13992 85c0 test eax,eax 77c13994 0f84a3d30200 je ntdll!EtwSetMark+0x1537e (77c40d3d) 77c1399a 0fb74f06 movzx ecx,word ptr [edi+6] 77c1399e 6685c9 test cx,cx 77c139a1 0f8e4a010000 jle ntdll!RtlFreeSid+0x1ef (77c13af1) 77c139a7 8b4508 mov eax,dword ptr [ebp+8] 77c139aa 8b4018 mov eax,dword ptr [eax+18h] 77c139ad 8b500c mov edx,dword ptr [eax+0Ch] 77c139b0 8b4010 mov eax,dword ptr [eax+10h] 77c139b3 0fbfc9 movsx ecx,cx 77c139b6 0fbf0c4a movsx ecx,word ptr [edx+ecx*2] 77c139ba 8d0448 lea eax,[eax+ecx*2] 77c139bd 50 push eax 77c139be 8d45f4 lea eax,[ebp-0Ch] 77c139c1 50 p…
answer count: 0
has title: Windbg how to find size of objects and name of the objects during debug or from dump?
type: UnansweredQuestion
score: 0
tagged with: debugging
has comment: http://stackoverflow.com/comment/33289777

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/21935852
tags question: http://stackoverflow.com/q/22003338
type: Tag
tags question: http://stackoverflow.com/q/21915595
tags question: http://stackoverflow.com/q/21925062

http://stackoverflow.com/comment/33237406
type: Comment
has text: @user3310091 try logging something in both the if block and check the logcat
type: AnswerComment
comment on: http://stackoverflow.com/a/21940616
score: 0

http://stackoverflow.com/q/21927973
answer count: 2
accepted answer: http://stackoverflow.com/a/22002563
tagged with: jms
has body: In message queue, I have added Unit of order for messages. And it got processed in order. But in cluster environment, messages went to different nodes. Is it expected? Please help. Thanks in advance. Edit: How to use Message.acknowledge() to find execution order, please give me any tutorial or links. I tried to find, but couldn't get useful info.
possible better answer: http://stackoverflow.com/a/21928992
has answer: http://stackoverflow.com/a/21928992
type: AnsweredQuestion
has title: Unit Of Order - messages are expected to go to same node?
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22002563
type: Question
has comment: http://stackoverflow.com/comment/33214885
has comment: http://stackoverflow.com/comment/33214452
has comment: http://stackoverflow.com/comment/33214802
tagged with: message-queue

state
tag name: state
tags question: http://stackoverflow.com/q/21896919
type: Tag

http://stackoverflow.com/comment/33352517
type: Comment
has text: @ajb You're totally right. I tested the new code and it should be fixed.
type: AnswerComment
comment on: http://stackoverflow.com/a/22002215
score: 0

http://stackoverflow.com/comment/33095291
has text: @BartlomiejLewandowski 'design flaw' or knot in the brain, you are right with "there is a need to go some steps back", i think
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21860894
type: QuestionComment

http://stackoverflow.com/comment/33310590
score: 0
has text: @user3291928 There is no need to make isPrime = true in else block, it is true anyways
type: Comment
comment on: http://stackoverflow.com/a/21981097
type: AnswerComment

http://stackoverflow.com/q/21900995
answer count: 1
tagged with: macos
favorite count: 0
tagged with: bouncycastle
has body: I am trying to generate keys using byte[] i.e. from a string. My class is final and I have the methods static. Class: public final class Operation { public static Key getKey(byte[] arr) { Key key = null; KeyGenerator keyGen; Security.addProvider(new BouncyCastleProvider()); try { keyGen = KeyGenerator.getInstance("AES", "BC"); if(arr == null) keyGen.init(192); else keyGen.init(new SecureRandom(arr)); key = keyGen.generateKey(); } catch (NoSuchAlgorithmException e) { System.err.println(e); } catch (NoSuchProviderException e) { System.err.println(e); } return key; } public static String getKeyAsString(Key key) { return new String(Base64.encode(key.getEncoded())); } public static Key getKeyFromString(String string) { return new SecretKeySpec(Base64.decode(string.getBytes()), "AES"); } } The main function has these lines : Key key1 = Operation.getKey("admin".getBytes()); Key key2 = Operation.getKey("admin".getBytes()); System.out.println(new String(Base64.encode(key1.getEncoded()))); System.out.println(new String(Base64.encode(key2.getEncoded()))); I am getting the same output of keys on windows like: 4BjJkLCJ3LyPluKkd2DBgqghhNfSgzKD 4BjJkLCJ3LyPluKkd2DBgqghhNfSgzKD but this is not the case with Mac OS. Dependancy I am using is: org.bouncycastle bcprov-jdk16 1.46 Now I came to the point that the JDK version is the sole problem here. On windows I have JDK 1.7 whereas I have JDK 1.6 on MAC. Is this really a JDK issue coz I am really stuck here. Please help.
type: UnansweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/33167108
upvote count: 1
has title: Key generation using byte[] generates different results for MAC and Windows
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21902311
type: Question
tagged with: windows
downvote count: 0

http://stackoverflow.com/q/21995651
answer count: 1
has answer: http://stackoverflow.com/a/21995938
score: 0
type: UnansweredQuestion
has body: I'm trying to write a program that will return the number of solutions to the N-Queens problem. The code uses a stack to keep track of the valid queen position, popping and pushing appropriately. But there are certain parts in the code that are never reached. I believe they are the cause of the program's not working. They have been marked with exclamation points. Can anyone explain why these portions are never reached? import java.util.Stack; public class nQ { public static Stack&lt;Integer&gt; s = new Stack&lt;Integer&gt;(); public static int n; public static int total; public static int i; //finds and prints out all solutions to the n-queens problem public static int solve(int n) { // i goes through each row to place a queen // x goes through the columns within each row System.out.println("1"); for(int i = 0; i &lt; n; i++) { System.out.println("2"); for(int x = 0; x&lt;n; x++){ System.out.println("3"); if(conflict(x) == false){ // loop through each column and checks whether it conflicts with current position of queen System.out.println("4"); s.push(x); // no conflict, push x //Q = s.get(x); // set current position of queen break; //break out of loop to move on to next row, i++ } else if (conflict(x)==true){ System.out.println("5"); if(s.isEmpty() == true){ System.out.println("!!!!6"); break; } if(x==n-1){ // if its looped through all columns, and there's no valid position s.pop(); //pop last entry i= i-1; // and backtrack to previous row, to find another valid position for q in previous row System.out.println("7"); } } if (s.size()==n){ // if stack size is n, then stack is full and a solution has been found total++; System.out.print(s);// print solution s.pop(); i= i-1; //backtrack to find next solution System.out.println("!!!!!!!8"); } System.out.println("9"); } System.out.println("10"); } System.out.println("11"); System.out.print(s); return total; } public static boolean conflict(int x) { for (int j = 0; j&lt;s.size(); j++) { if ((s.get(j)==x) || ((x-s.get(j))…
tagged with: n-queens
tagged with: stack
tagged with: java
has title: N-Queens program, with stacks
type: Question

http://stackoverflow.com/comment/139379879
has text: @Emma I checked it and yes, you're right. However, I used it in a particular context where it allowed me to overcome a particular situation : System.setProperty("prop", "" + gearBox) does not produce an error if gearBox was null, whereas System.setProperty("prop", gearBox) would raise NullPointerException. I thought it would work in other scenarios too, but apparently it's not the case. I will delete my answer.
type: Comment
comment on: http://stackoverflow.com/a/76953746
score: 1
type: AnswerComment

http://stackoverflow.com/q/21842678
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21866514
possible better answer: http://stackoverflow.com/a/21866506
answer count: 2
score: 0
has body: I need to load "configuration" type files for my program in Android, they are both .bin files containing dictionary data for the NLP library. I'm a bit new to Android still, and I'm having trouble finding a folder to place the files in so I can access them when the activity starts. I also need to create/save/load a filetype specific to my program, and I don't know where to put it either. All I've been able to find on here is people using the getAssetManager() function to fetch input streams, but I explicitly need File objects for me to be able to load them into my pre-existing desktop software code I'd like to reuse (plus the libraries require them anyway) I've also seen people using a "res/raw" folder, however the ADT did not generate this "raw" file when I made the project - so I'm not sure what to do there either. Here is how I usually start the software in the desktop version, but I need to fetch these files in an Android environment: brain.start(new File("memboric.core"), new File("en_pos_maxent.bin"), new File("en_sent.bin")); core = brain.getInterpreter().getCore(); The memboric.core file can be generated, but I need to know WHERE and HOW to do so. Thank you very much for your time, feel free to direct me to other resources if you feel this question is inadequate. TLDR; how do I load "static" files for the software to function (needs to be included with software), and how to create/load/save "personal" files into an appropriate area of the device?
tagged with: android
tagged with: io
has title: How to load and save files in Android?
has answer: http://stackoverflow.com/a/21866506
tagged with: file
accepted answer: http://stackoverflow.com/a/21866514

http://stackoverflow.com/a/21960166
score: 2
upvote count: 2
downvote count: 0
has body: It's better to use switch if you have a set of possible values: switch (student) { case 0: //do stuff break; case 1: //do stuff break; ... default: //it's analog of else //do stuff break; } http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html
answers question: http://stackoverflow.com/q/21960122
has comment: http://stackoverflow.com/comment/33274336
type: Answer

http://stackoverflow.com/q/21875175
possible better answer: http://stackoverflow.com/a/21885037
answer count: 2
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21875531
accepted answer: http://stackoverflow.com/a/21875531
tagged with: android
has body: I'm trying to begin programming with libgdx (in Windows XP with Eclipse for JAVA - Android) but, as every begining, nothing is clear and every doubt is a big problem. I have found some tutorials about how to begin to programming with libgdx, but every tutorial found says the same: you must create a PC project for compile the native JAVA code and then create another project for Android who needs the PC project. It's possible to do it in a easier way (all in only one Android project)? If it's possible, how? It would be really slower? I run my Android projects in my device (a Motorola G) and it seems pretty fast. All (kind) responses will be appreciated. Thank you.
has title: Do you know if it's possible to compile a libgdx in Android (in an Android phone) without compiling it in native JAVA?
type: AnsweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/21885037
type: Question
tagged with: libgdx
tagged with: java
tagged with: compilation

http://stackoverflow.com/comment/33111094
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21867451
has text: Is there any code you aren't showing us?
type: Comment

http://stackoverflow.com/q/21963815
linked to: http://stackoverflow.com/q/9864267
has title: Setting a background image in JTabbedPane
tagged with: java
has comment: http://stackoverflow.com/comment/33279639
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33279285
has answer: http://stackoverflow.com/a/21964064
tagged with: image
has answer: http://stackoverflow.com/a/21964146
score: 0
has comment: http://stackoverflow.com/comment/33280411
answer count: 2
has comment: http://stackoverflow.com/comment/33279126
favorite count: 0
has body: I want to set a background image in a simple JTabbedPane. I used a Jlabel to set my background image. But i haven't been able to do so as i get a null pointer exception upon running. Can anyone help with some more ideas? Here is my code: import javax.swing.ImageIcon; import javax.swing.JTabbedPane; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.UIManager; import javax.swing.UIManager.LookAndFeelInfo; import java.awt.*; import java.awt.event.*; class ImageTest { JTabbedPane tp; JLabel lab1 JPanel welcome; JFrame frame; ImageIcon image2; public void createUI() { frame=new JFrame("JTabbedPane"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); welcome= new JPanel(null); welcome.setPreferredSize(new Dimension(1366,786)); image2 = new ImageIcon("icloud.jpg"); tp=new JTabbedPane(); Container pane = frame.getContentPane(); pane.add(tp); tp.addTab("Welcome", welcome); lab1.setIcon(image2); lab1.setBounds(0,0,1500,700); frame.setSize(500,500); frame.setVisible(true); frame.setTitle("I-Cloud"); } public static void main(String[] args) { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { } ImageTest tbp = new ImageTest (); tbp.createUI(); } } EDIT: import javax.swing.ImageIcon; import javax.swing.JTabbedPane; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.UIManager.LookAndFeelInfo; import java.awt.*; import java.awt.event.*; class ImageTest { JTabbedPane tp; JLabel lab1; JPanel welcome,w; JFrame frame; ImageIcon image2; JButton b1; public void createUI() { frame=new JFrame("JTabbedPane Example");…
has comment: http://stackoverflow.com/comment/33279671
tagged with: jtabbedpane
tagged with: jframe
type: UnansweredQuestion

http://stackoverflow.com/q/21915853
score: 1
tagged with: java
tagged with: multithreading
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33193699
has title: scjp: threads related issue
tagged with: wait
has answer: http://stackoverflow.com/a/21916997
tagged with: notify
answer count: 2
has body: below is the question... void waitForSignal() { Object obj = new Object(); synchronized (Thread.currentThread()) { obj.wait(); obj.notify(); } } Which statement is true? A. This code can throw an InterruptedException. B. This code can throw an IllegalMonitorStateException. C. This code can throw a TimeoutException after ten minutes. D. Reversing the order of obj.wait() and obj.notify() might cause this method to complete normally. E. A call to notify() or notifyAll() from another thread might cause this method to complete normally. F. This code does NOT compile unless obj.wait() is replaced with ((Thread) obj).wait(). Answer is B . But when i have executed in below manner getting A. Please help. public class ThreadStateProblem extends Thread { public void run() { } void waitForSignal() { Object obj = new Object(); synchronized (Thread.currentThread()) { obj.wait(); obj.notify(); } } public static void main(String []s) { new ThreadStateProblem().start(); new ThreadStateProblem().waitForSignal(); } } And also tried below : public class ThreadStateProblem extends Thread { public void run() { } void waitForSignal() { Object obj = new Object(); synchronized (Thread.currentThread()) { obj.wait(); obj.notify(); } } public static void main(String []s) { ThreadStateProblem sd =new ThreadStateProblem(); sd.start(); sd.waitForSignal(); } }
has answer: http://stackoverflow.com/a/29197072
downvote count: 0
has comment: http://stackoverflow.com/comment/33193639
has comment: http://stackoverflow.com/comment/33193771
favorite count: 0
tagged with: scjp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33195215

http://stackoverflow.com/a/21953273
downvote count: 0
has body: It doesnt work because a is just a copied reference to the array, alterations to a, like a[0] = 1; is reflected in the calling method, because you are changing the target of the reference (i.e the array) not the reference itself. a = c, does not work because it only changes the local reference to the array not the refernce in the calling method. See a more in depth explanation here: Is Java "pass-by-reference" or "pass-by-value"? To exchange the first to values simply do: int temp = a[0]; a[0] = a[1]; a[1] = temp;
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21953173
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21953173
type: Answer
score: 2

http://stackoverflow.com/comment/33226080
type: QuestionComment
type: Comment
has text: Eh, I see... Good luck ;)
comment on: http://stackoverflow.com/q/21933484
score: 0

http://stackoverflow.com/comment/33233478
comment on: http://stackoverflow.com/a/21937900
score: 0
type: Comment
has text: invoking the fireTableStructureChanged() method will cause all custom renderers/editors to be lost.
type: AnswerComment

http://stackoverflow.com/a/21888532
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33148096
has comment: http://stackoverflow.com/comment/33148107
answers question: http://stackoverflow.com/q/21888210
has body: If you work on eclipse, check "Problems" view for errors. Sometimes eclipse cannot compile code when your workspace has errors. If you work on a running server, may be server do not recognize your changes. Restart it, may be this helps. If double of above do not help you please explain exactly what you want and specify your development environment how it is.

http://stackoverflow.com/a/22011185
type: Answer
downvote count: 0
upvote count: 104
has comment: http://stackoverflow.com/comment/56107167
accepted answer of: http://stackoverflow.com/q/22000423
has body: Make sure that your sample.fxml is in the src/main/resources/ directory (or a subdirectory). Then you can access the file like this: Parent root = FXMLLoader.load(getClass().getClassLoader().getResource("sample.fxml")); Explanation: During the compile phase all resources and classes get copied to target/classes/. So your fxml file resides in this directory and your class in a subdirectory regarding its package name. If you call getClass().getResource("sample.fxml"); the file will be searched relative to the class file which will be this directory: target/classes/sample/. Calling .getResource() on the classloader sets the relative search path to target/classes/ and therefore your file gets found. P.S. You could also write: Parent root = FXMLLoader.load(getClass().getResource("/sample.fxml"));
answers question: http://stackoverflow.com/q/22000423
score: 104
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33363751

http://stackoverflow.com/comment/33243665
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21944136
type: Comment
has text: what are the different types of Propagations ? other than SUPPORTS,REQUIRED,NEVER,REQUIRES_NEW

http://stackoverflow.com/q/21862337
tagged with: jvm
linked to: http://stackoverflow.com/q/14004851
has comment: http://stackoverflow.com/comment/33100159
has comment: http://stackoverflow.com/comment/33101002
duplicate of: http://stackoverflow.com/q/2162121
has comment: http://stackoverflow.com/comment/33097365
tagged with: android
has comment: http://stackoverflow.com/comment/33097464
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33100982
has comment: http://stackoverflow.com/comment/33097396
type: Question
has comment: http://stackoverflow.com/comment/33099626
has title: Installing Android SDK and Eclipse
tagged with: eclipse
score: 0
has body: I am beginner level. I am trying to install the Android Bundle and Eclipse is giving me the error that it cannot find the JVM: C:\Program Files\eclipse\jre\bin\javaw.exe javaw.exe in your current PATH" I know there are some other threads discussing how to fix this including editing the eclipse.ini file, restarting, and making sure the architecture are the same for Android and Eclipse (x86, etc.). But I have spent over a day trying to figure this out and have been unsuccessful. I wanted to see if the community could assist.
answer count: 1
linked to: http://stackoverflow.com/q/2162121
has answer: http://stackoverflow.com/a/21862585
accepted answer: http://stackoverflow.com/a/21862585
has comment: http://stackoverflow.com/comment/33098157

http://stackoverflow.com/q/21894943
tagged with: jbutton
linked to: http://stackoverflow.com/q/9554636
score: -1
has body: So far all i have managed to get is the JButton to close the first JFrame (frame) but the other will not open. Frame class code import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class Frame { public static void main(String[] args) { // Frame - Labelled BrickFall final JFrame frame = new JFrame(); frame.setSize(1290, 730); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("BrickFall"); frame.setLayout(null); frame.setLocationRelativeTo(null); // Start Button JButton Start = new JButton("Start"); Start.setBounds(100, 300, 1080, 50); frame.add(Start); // Exit Button JButton Exit = new JButton("Exit"); Exit.setBounds(369, 375, 540, 50); frame.add(Exit); // Closes when Exit Clicked Exit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.exit(0); } }); //New Frame opens when Start Clicked Start.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { frame.setVisible(false); } }); // Background Image JLabel background = new JLabel(""); background.setBounds(0, 0, 1280, 720); background.setIcon(new ImageIcon(Frame.class.getResource("/resources/images/Title.png"))); frame.getContentPane().setLayout(null); frame.getContentPane().add(background); frame.setVisible(true); } protected static void dispose() { // TODO Auto-generated method stub } } On the (frame) action listener i have left out the second line to open the other JFrame as my attempts wont work Game class code import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; public class game { public static void main(String[] args) { // Frame - Labelled BrickFall JFrame game = new JFrame(); game.setSize(1290, 730); game.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); game.setTitle("BrickFall"); game.setLayout(null); game.setLocationRelativeTo(null); // Background Image JLabel GameBackground = new JLabel(""); GameBackground.setBounds(0, 0, 1280, 720)…
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/21894997
has comment: http://stackoverflow.com/comment/33158131
favorite count: 0
tagged with: jframe
has answer: http://stackoverflow.com/a/21894997
has title: I cant get a JFrame to close and another open (in a different class) with a click off a JButton
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: swing
type: Question

http://stackoverflow.com/q/21954137
type: Question
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/21954159
answer count: 3
has body: Does the javac or JIT optimize unnecessary autoboxing? Let's say we have a this fragment of code. for(int i=0; i&lt;100000; i++) { f(i); } void f(Integer i) { System.out.println(i); } How this fragment of code gets optimized? I guess f will be inlined, but what about unnecessary boxing of int (it's not being modified and never is null). Let's assume the method is not called from any other fragment of code. Will there be any difference if the method signature was void f(final Integer i)?
has answer: http://stackoverflow.com/a/21954389
downvote count: 0
has title: Does the JVM optimize unnecessary autoboxing?
tagged with: jvm
favorite count: 0
tagged with: optimization
tagged with: autoboxing
has answer: http://stackoverflow.com/a/21954236
tagged with: boxing
type: UnansweredQuestion
score: 5

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/21995744
tags question: http://stackoverflow.com/q/21943243
tags question: http://stackoverflow.com/q/21899489
type: Tag
tags question: http://stackoverflow.com/q/21924294

http://stackoverflow.com/a/21846071
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21845916
downvote count: 0
has body: The code: myList.get(position) is implicitly casting the element of myList to a String, since myList is a List&lt;String&gt;. This is failing because you managed to insert a URL object into myList. Enable "unchecked cast" warnings, and you should see a warning where you are inserting into myList. Two possible fixes: Eliminate the unchecked cast. Part of that will probably involve calling .toString() on your URL before adding it to myList. Or, change the type of myList to List&lt;URL&gt;, and then do the .toString() call inside onItemClick. Which one you go with depends on the type you'd like myList to have.
type: Answer

http://stackoverflow.com/a/21910930
has comment: http://stackoverflow.com/comment/33271306
has comment: http://stackoverflow.com/comment/33184374
has comment: http://stackoverflow.com/comment/33271284
has comment: http://stackoverflow.com/comment/33186150
answers question: http://stackoverflow.com/q/21910789
has comment: http://stackoverflow.com/comment/33184436
score: 0
has body: The dependencies specify in the POM org.jboss.arquillian.extension arquillian-drone-webdriver-depchain 1.2.0.Final have dependency on groupId com.opera and artifact operadriver Plz see the maven link http://mvnrepository.com/artifact/org.jboss.arquillian.extension/arquillian-drone-webdriver-depchain/1.2.0.Final
type: Answer
has comment: http://stackoverflow.com/comment/33185723

http://stackoverflow.com/q/21856131
tagged with: eclipse
downvote count: 1
has comment: http://stackoverflow.com/comment/33085964
type: Question
answer count: 2
upvote count: 0
score: -1
has answer: http://stackoverflow.com/a/21856666
has title: Maven Projects not being recognized as a java project in eclipse
favorite count: 0
has comment: http://stackoverflow.com/comment/33086026
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/21856209
tagged with: java
has body: I am working on maven projects in eclipse but i am unable to refactor &amp; do changes because i think it doesnot recognize as a java project because i keep getting error like "resource is not in the java build path of a java project" I have tried all the things like searching for java build path by right clicking the project->properties. but there was no option for java build path i tried changing the installed jre(in windows->preference->java->build path->installed jre) &amp; put the correct jdk but it doesnot work Also all the maven projects are building successfully in terminal. so there is some problem with eclipse also all the pom.xml have some warning "Cannot read lifecycle mapping" &amp; "Plugin Execution not covered by lifecycle configuration" I looked into their solution but it was of no help i have also tried changing my pom.xml according to the solutions for this lifecycle mapping problem but it didn't help initially i thought there is some issue with m2 eclipse but i also tried changing pom.xml acccordingly as well as going to windows-preferences-maven-discoveries-open catalog &amp; installing m2e connector but there was some problem with the installation

http://stackoverflow.com/q/21847540
has answer: http://stackoverflow.com/a/23336720
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21847725
tagged with: java
downvote count: 1
type: Question
tagged with: nonblocking
has body: I am creating a server that will handle >1000 connections. I decided to go with non-blocking IO in my server. I found some code on the internet, which is basically an echo server. I think everything is fine, but I don't understand a few of the concepts in the server. import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketAddress; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import java.util.*; public class EchoServer { private InetAddress addr; private int port; private Selector selector; private Map&lt;SocketChannel,List&lt;byte[]&gt;&gt; dataMap; public EchoServer(InetAddress addr, int port) throws IOException { this.addr = addr; this.port = port; dataMap = new HashMap&lt;SocketChannel,List&lt;byte[]&gt;&gt;(); startServer(); } private void startServer() throws IOException { // create selector and channel this.selector = Selector.open(); ServerSocketChannel serverChannel = ServerSocketChannel.open(); serverChannel.configureBlocking(false); // bind to port InetSocketAddress listenAddr = new InetSocketAddress(this.addr, this.port); serverChannel.socket().bind(listenAddr); serverChannel.register(this.selector, SelectionKey.OP_ACCEPT); log("Echo server ready. Ctrl-C to stop."); // processing while (true) { // wait for events this.selector.select(); // wakeup to work on selected keys Iterator keys = this.selector.selectedKeys().iterator(); while (keys.hasNext()) { SelectionKey key = (SelectionKey) keys.next(); // this is necessary to prevent the same key from coming up // again the next time around. keys.remove(); if (! key.isValid()) { continue; } if (key.isAcceptable()) { this.accept(key); } else if (key.isReadable()) { this.read(key); } else if (key.isWritable()) { this.write(key); } } } } private void accept(SelectionKey key) throws IOExceptio…
score: -1
tagged with: nio
has title: Non-Blocking IO in java with logic
answer count: 2
upvote count: 0

http://stackoverflow.com/a/21894455
accepted answer of: http://stackoverflow.com/q/21893956
upvote count: 2
score: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33156083
downvote count: 0
has body: Another one: enum Action { SPEED { public void doSomething() { // code } }, TIME { public void doSomething() { // code } }; public abstract void doSomething(); } public void analyzeWithAnalytics(Action data) { for (int i = 0; i &lt; VALUE; i++) { data.doSomething(); } }
answers question: http://stackoverflow.com/q/21893956
type: Answer

http://stackoverflow.com/comment/33183860
score: 0
comment on: http://stackoverflow.com/q/21909632
type: Comment
type: QuestionComment
has text: the profiler is a good idea; on the application logs: set all log levels to debug, but nothing to see there :(

http://stackoverflow.com/a/21949409
type: Answer
has comment: http://stackoverflow.com/comment/33254421
answers question: http://stackoverflow.com/q/21949079
has body: I would recommend you to go through http://developer.android.com/guide/components/fragments.html and http://developer.android.com/training/basics/fragments/creating.html I found many structural and Design problem in your Code , once you go through the above link you will understand it , also download the sample app available on above link page , if still you are not able to do I will surely try to give explanation with sample code. Good luck Make the following changes in your code 1.add the fragment in activity layout like below and don't forget to replace YOUR PACKAGE NAME specified in class attribute &lt;fragment android:id="@+id/article_fragment" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="2" class="YOUR PACKAGE NAME.MyFragment" /&gt; 2. Create MyFragment as a separate Class (Should not be inside the Main Activity): 3. Main Activity must extends FragmentAcivity instead of Actvity 4. if you need Listview and fragment side by side change LinearLayout Orientation to android:orientation="horizontal" It will work
accepted answer of: http://stackoverflow.com/q/21949079
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/122009632
has text: Mind making a minor edit @hermeslm? Seeing this: ```brew tap caskroom/cask Error: caskroom/cask was moved. Tap homebrew/cask instead.```
comment on: http://stackoverflow.com/a/68105964
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21956195
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33266583
downvote count: 0
has comment: http://stackoverflow.com/comment/33266614
has comment: http://stackoverflow.com/comment/33321850
type: Answer
answers question: http://stackoverflow.com/q/21955768
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21955768
has comment: http://stackoverflow.com/comment/33415469
score: 2
has body: I will try to explain shortly but to fully understand those terms I'll have to practice developing android applications. handler: an object attached to a thread (any thread) that both processes messages and executes runnables in its thread. That is important sometimes because i.e. only the UI thread can do operations on views, and sometimes a background thread must use an UI thread handler to do action in the views looper is an object that iterates through a thread message queue, popping runnables and messages and giving them to the thread handlers. The UI thread comes already with a Looper running looper thread is the thread of a given looper, nothing special here post, task and executor ou answered yourself already timer and class to manage small amounts of time. Like measuring some seconds or milliseconds, wainting some amount of time and so on. runnable vs message the main difference is: when you use runnables, the poster thread mus specify the implementation of something, ehile when you use messages, the handlers specifies the implementation of some action. When your working with only one poster and one handles you can use both almost interchangeably. When you have many different threads posting the same thing to a same handler, I would use messages and vice-versa.
has comment: http://stackoverflow.com/comment/33265769
has comment: http://stackoverflow.com/comment/33265753

embedded-tomcat-7
type: Tag
tag name: embedded-tomcat-7
tags question: http://stackoverflow.com/q/21866279

http://stackoverflow.com/comment/33210474
score: 0
type: Comment
has text: Thanks dude! Worked like a charm, that was a foolish mistake :P
comment on: http://stackoverflow.com/a/21925495
type: AnswerComment

http://stackoverflow.com/comment/33224230
type: Comment
comment on: http://stackoverflow.com/a/21871270
has text: @cpburnz got it... :) i will update the answer properly on getting some free minutes, and will remeber this point in future...
score: 0
type: AnswerComment

http://stackoverflow.com/a/21952346
type: Answer
answers question: http://stackoverflow.com/q/21951669
has comment: http://stackoverflow.com/comment/33258691
has comment: http://stackoverflow.com/comment/33259019
has comment: http://stackoverflow.com/comment/33259230
has comment: http://stackoverflow.com/comment/33259995
has comment: http://stackoverflow.com/comment/33258723
score: 4
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/33258942
has comment: http://stackoverflow.com/comment/33259678
has comment: http://stackoverflow.com/comment/33258927
has comment: http://stackoverflow.com/comment/33260234
has comment: http://stackoverflow.com/comment/33259133
has body: Here's a working example: public class Xml { private static final String XML = " \n" + " content \n" + "\n" + "\n" + "\n" + " "; public static void main(String[] args) throws ParserConfigurationException, IOException, SAXException, InstantiationException, IllegalAccessException, ClassNotFoundException { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setValidating(false); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.parse(new InputSource(new StringReader(XML))); NodeList childNodes = document.getDocumentElement().getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { System.out.println(childNodes.item(i)); } final DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); final DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS"); final LSSerializer writer = impl.createLSSerializer(); writer.getDomConfig().setParameter("xml-declaration", false); writer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE); System.out.println(writer.writeToString(document)); } } Output: [#text: ] [anothertag: null] [#text: ] content So, the parser doesn't validate, it preserves the text nodes, and the output produced by the serializer is as you expect it.

http://stackoverflow.com/comment/33345183
has text: @hyde Aren't my buckets the 10 arrays that are based on years?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22000639
type: Comment

http://stackoverflow.com/comment/33135625
score: 3
comment on: http://stackoverflow.com/a/21883666
type: AnswerComment
type: Comment
has text: In Java it needs to be done like this: `Pattern.matches(".*?q.*", "Iraq");` OR better to use `Pattern#find()` method which is there for partial matches.

http://stackoverflow.com/q/21946934
linked to: http://stackoverflow.com/q/4334970
score: 0
has comment: http://stackoverflow.com/comment/33248947
has answer: http://stackoverflow.com/a/21948680
type: AnsweredQuestion
has title: PersistenceException when setting FetchType
has comment: http://stackoverflow.com/comment/33249318
tagged with: java
tagged with: hibernate
type: Question
has body: I have a one-to-many relationship between two entities, the relevant parts look like this: The "one-part" (Cart): @OneToMany(mappedBy="cart", cascade = CascadeType.ALL, fetch = FetchType.EAGER) private List&lt;Item&gt; items; The "many-part" (Item): @ManyToOne private Cart cart; This works as long as I avoid to pass a FetchType to @OneToMany. When adding a FetchType (as shown above) I get a PersistenceException (not very helpful): [PersistenceUnit: defaultPersistenceUnit] Unable to build EntityManagerFactory There are some other entities in my code having one-to-many-relationships that look exactly like the one above and do not procuce this exception when passing the FetchType. Why is that? I'm using Hibernate. edit: In case it is important: the Cart-Entity is the many-part whereas the Item-Entity is the one-part of other relationships not shown above. edit2: Stacktrace: PersistenceException: [PersistenceUnit: defaultPersistenceUnit] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915) ~[hibernate-entitymanager-3.6.9.Final.jar:3.6.9.Final] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57) ~[hibernate-entitymanager-.6.9.Final.jar:3.6.9.Final] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63) ~[hibernate-jpa-2.0-api.jar:1.0.1.Final] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) ~[hibernate-jpa-2.0-api.jar:1.0.1.Final] at play.db.jpa.JPAPlugin.onStart(JPAPlugin.java:35) ~[play-java-jpa_2.10.jar:2.2.1] at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:88) ~[play_2.10.jar:2.2.1] Caused by: org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags at org.hibernate.loader.BasicLoader.postInstantiate(BasicLoader.java:94) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final] at org.hibernate.loader.entity.EntityLoader.&lt;init&gt;(EntityL…
tagged with: jpa
answer count: 1
accepted answer: http://stackoverflow.com/a/21948680
has comment: http://stackoverflow.com/comment/33249248

http://stackoverflow.com/q/21974758
type: Question
has comment: http://stackoverflow.com/comment/33304696
accepted answer: http://stackoverflow.com/a/21983492
tagged with: iso-8859-1
upvote count: 2
tagged with: html-parsing
has title: Jsoup - Parsing a HTML file with charset iso-8859-1
has body: I am having trouble with special characters and charset = iso-8859-1. The same code that I use here works fine with UTF-8, so I do not understand what I am doing wrong. Here is the code: File input = new File("/users/marcioapf/example.html"); Document doc = Jsoup.parse(input, "iso-8859-1", ""); Elements elements = doc.select("span.DEPUTADO") ; System.out.println(elements.toString()); Here is the output: Joãozinho Pereira Isnaldo Bulhões Antonio Albuquerque Jeferson Morais Inácio Loiola Here is how it should be: Joãozinho Pereira Isnaldo Bulhões Antonio Albuquerque Jeferson Morais Inácio Loiola How I can I fix it?
tagged with: java
tagged with: character-encoding
has answer: http://stackoverflow.com/a/21983492
tagged with: jsoup
score: 2
type: AnsweredQuestion
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/33168999
comment on: http://stackoverflow.com/a/21872791
score: 0
type: AnswerComment
type: Comment
has text: Can you please help me? There is a slight error in your code. When I move my finger from the white space into the button, it recognizes the button perfectly. But when i put my finger on the button, and then move it to another button, it doesn't work. Please please help me! I am really almost done completing my application!

http://stackoverflow.com/a/21990747
has body: It is failing exactly on part else { internalPaths.add(new File(path)); } InternalPaths is an ArrayList which is initialized (not a NullPointerException) and its add method is supposed to append an item at the end of the array and not put it in a specific place (indexed position). Therefore, the problem should be in the File's constructor. Debug and check the value of the path. I bet it is an empty string. Figure out how it can be initialized to such value.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21934994
upvote count: 1

sql-server
tags question: http://stackoverflow.com/q/21944100
type: Tag
tags question: http://stackoverflow.com/q/21912293
tag name: sql-server
tags question: http://stackoverflow.com/q/21986711
tags question: http://stackoverflow.com/q/21859305
tags question: http://stackoverflow.com/q/21968091

http://stackoverflow.com/comment/33123643
type: Comment
has text: ya i did thank u ... I have editted the question please have a look i deleted the space as well as where clause in my insert query... But not getting the desired output yet
score: 0
comment on: http://stackoverflow.com/a/21876873
type: AnswerComment

http://stackoverflow.com/a/21954018
answers question: http://stackoverflow.com/q/21953771
score: 1
upvote count: 1
has body: You've a few mistakes in your code: You're calling a function before it is defined. Calling counterA before it's defined. You've to reset the counter num1 in the for loop Possible option to make your code to work: Remove var num1 ; counterA(num1); var total=0; Replace for (num1 = num11; ... with for(var num1 = num11; ...
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21953771

http://stackoverflow.com/q/21972108
has comment: http://stackoverflow.com/comment/33294080
score: 0
tagged with: iterator
has answer: http://stackoverflow.com/a/22434243
has body: I am trying to learn Generics and Iterators in java and have created following code -> import java.util.Iterator; import java.util.NoSuchElementException; public class Deque&lt;Item&gt; implements Iterable&lt;Item&gt; { private int N; // number of elements on list private Node&lt;Item&gt; pre; // sentinel before first item private Node&lt;Item&gt; post; // sentinel after last item /* * linked list node helper data type */ private static class Node&lt;Item&gt; { private Item item; private Node&lt;Item&gt; next; private Node&lt;Item&gt; prev; }//class Node&lt;Item&gt; ends /* *construct an empty deque */ public Deque() { pre = new Node&lt;Item&gt;(); post = new Node&lt;Item&gt;(); pre.item = null; post.item = null; pre.prev = null; post.next = null; pre.next = post; post.prev = pre; N = 0; }//Deque ends /* * is the deque empty? */ public boolean isEmpty() { //if( ((pre.next == post)&amp;&amp;(post.prev == pre)) || ( N == 0 ) ) return true; if( N == 0 ) return true; else return false; }//isEmpty ends /* * return the number of items on the deque */ public int size() { return N; }//size ends /* * insert the item at the front * This is extension of Queue, so First is the location near Post Node * pre-&gt; &lt;-post, pre-&gt;1&lt;-post, pre-&gt;1,2&lt;-post, pre-&gt;1,2,3&lt;-post ... * ^ ^ ^ ^ ^ ^ ^ * | | | | | | | * initial these all are the effects of addFirst() * condition */ public void addFirst(Item item) { //System.out.println("We are outside ListIterator - addFirst"); if( isEmpty() ) //here pre.next == post.prev { //System.out.println("We are inside isEmpty"); Node&lt;Item&gt; NewNode = new Node&lt;Item&gt;(); NewNode.item = item; NewNode.next = post; post.prev = NewNode; NewNode.prev = pre; pre.next = NewNode; N++; //System.out.println(NewNode.item); }//if ends else //here pre.next-&gt;1.prev &amp; X.next-&gt;post { //System.out.println("We are inside !isEmpty"); Node&lt;Item&gt; NewNode = new Node&lt;Item&gt;(); Node&lt;Item&gt; last = post.prev; NewNode.item = i…
has comment: http://stackoverflow.com/comment/33293825
answer count: 1
has comment: http://stackoverflow.com/comment/33294510
has comment: http://stackoverflow.com/comment/33294135
has comment: http://stackoverflow.com/comment/33293873
has comment: http://stackoverflow.com/comment/33294196
has comment: http://stackoverflow.com/comment/33294377
has comment: http://stackoverflow.com/comment/33293834
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33294032
has comment: http://stackoverflow.com/comment/33294015
has comment: http://stackoverflow.com/comment/33293851
has comment: http://stackoverflow.com/comment/33293927
type: Question
has comment: http://stackoverflow.com/comment/33296763
tagged with: java
has title: Generics, Iterator -> cannot access the inner class function
tagged with: eclipse

http://stackoverflow.com/comment/33150289
comment on: http://stackoverflow.com/a/21890232
type: Comment
type: AnswerComment
score: 0
has text: @user2966511 A better solution would be to use some kind file based logger. Generally when running a UI, you don't want to display the console window. You could run the command from the command line yourself instead

http://stackoverflow.com/q/21993368
score: 0
answer count: 0
type: UnansweredQuestion
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/33357249
has title: Using a custom request in @Controller
tagged with: java
type: Question
has body: I have a controller which look like this @RequestMapping(value = "export") public Object exportUsers( @Context HttpServletRequest request, HttpServletResponse response, ModelMap model ) throws IOException { String target = request.getParameter( RequestParametersConstantsCommons.TARGET ); String entityName = request.getParameter( RequestParametersConstantsCommons.ENTITY_NAME ); return new SCSuccessResponse(); } Problem is, i need a custom HttpServletRequest (for some operation). Is there a way to do it except extends the DispatcherServlet and transform my request in the new servlet ? Thx !
has comment: http://stackoverflow.com/comment/33331748
tagged with: controller

http://stackoverflow.com/q/21997353
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33341397
type: Question
has body: I'm currently creating a game in java and I have reached a dead end. My game is a simple 2d shooting game with help of a TileMap (.txt) to create the "play-field" or "maze". Where I'm currently at is as you win (eliminating the enemies) the current TileMap should change to the next. The system I currently have works, but only from map 1 to 2 not 2 to 3. This is what I got so far. public class Frame extends JFrame implements KeyListener { Hero hero; int lvl = 0; [...] won = false; String[] Maze = {"maze1", "maze2", "maze3", "maze4"}; [...] public Frame(){ Frame options [...] addKeyListener(this); gameLoop(); if(won){ if(GameState.ENEMIE_LIFE &lt; 1) GameState.ENEMIE_LIFE = 1; gameLoop(); won = false; } } public void gameLoop(){ map = new Maze(Maze[lvl]); try { map.createMaze(); } catch (IOException e1) { e1.printStackTrace(); } bullets = map.getBullets(); hero = map.getPlayer(); enemy = map.getGhosts(); while(GameState.going()){ updateScreen(); map.isCollision(); collision(); [...] try { Thread.sleep(20); } catch (InterruptedException e) { e.printStackTrace(); } } public class GameState { static int ENEMIE_LIFE = 1; static int HERO_LIFES = 1; static int HERO_AMMO = 20; public static boolean going(){ if(HERO_LIFES &gt; 0 &amp;&amp; ENEMIE_LIFE &gt; 0) return true; else return false; } } As you can see, the textFiles are in a String Array, and in the Frame constructor the gameLoop is created. And I have my if/else statement. if(enemy.isEmpty()){ won = true; GameState.ENEMIE_LIFE--; lvl++; } This if statement is to controle when the enemies are destroyed. The GameState.ENEMIE_LIFE is a static int variable in a separete class. The problem I seem to have is that specific variable doesn't want to increase after the first time. When the enemies are gone the boolean won = true, GameState.ENEMIE_LIFE = 0 and lvl++ (to increase the int that determines the Maze array index. As you could se, when won = true GameState.ENEMIE_LIFES = 1 and gameLoop is set to start again. But if Ga…
score: 0
has comment: http://stackoverflow.com/comment/33341888
tagged with: tile
tagged with: java
has title: Change TileMap during gameLoop in Java
has comment: http://stackoverflow.com/comment/33339831

http://stackoverflow.com/comment/33298893
type: QuestionComment
comment on: http://stackoverflow.com/q/21974920
score: 0
has text: Can a group of these parameters be described as a single entity? This will allow you to create a class (or subclass) for them and pass them as a single argument. For instance `perturbation`.
type: Comment

http://stackoverflow.com/comment/33168496
type: Comment
comment on: http://stackoverflow.com/a/21898973
has text: It could be due to empty lines at end of file.
type: AnswerComment
score: 0

http://stackoverflow.com/a/21964410
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/33282429
has comment: http://stackoverflow.com/comment/33281696
has body: After putting stuff into a Buffer, or reading stuff into it you have to flip the buffer to write or get the data from it. Check the flip() method in the Buffer class. The docs say Flips this buffer. The limit is set to the current position and then the position is set to zero. If the mark is defined then it is discarded. After a sequence of channel-read or put operations, invoke this method to prepare for a sequence of channel-write or relative get operations. So adding a buffer.flip() after the put should do the trick :)
has comment: http://stackoverflow.com/comment/33281264
downvote count: 0
answers question: http://stackoverflow.com/q/21964363
has comment: http://stackoverflow.com/comment/33282249
upvote count: 6
accepted answer of: http://stackoverflow.com/q/21964363
has comment: http://stackoverflow.com/comment/33281540
type: AcceptedAnswer

http://stackoverflow.com/comment/33244852
type: Comment
has text: What are you trying to do with the information from the file?
type: AnswerComment
comment on: http://stackoverflow.com/a/21944531
score: 0

http://stackoverflow.com/q/21870630
possible better answer: http://stackoverflow.com/a/21898950
answer count: 2
has answer: http://stackoverflow.com/a/21898950
has answer: http://stackoverflow.com/a/21959587
has title: Property sessionFactory is required using Spring Java config inner classes
tagged with: config
accepted answer: http://stackoverflow.com/a/21959587
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: hibernate
has body: I am using Spring 4's pure Java config (no web.xml) but having some issues with inner configuration classes. I have multiple Spring profiles like this one @Profile("dev") public @interface Dev {} So within my DataSourceConfig I'd like to have multiple @Configuration for each spring profile. Something like (assume the interface DataSourceSetup is annotated with @Configuration) @Configuration public class DataSourceConfig { ... // some common methods to both @Dev &amp; @Prod @Dev public static class DataSourceDev implements DataSourceSetup { @Bean @Override public DataSource dataSource { ... } @Bean @Override public LocalSessionFactoryBean sessionFactory() { ... } ... } @Prod public static classs DataSourceProd implements ... { ... } ... } With this, I can just reference one DataSourceConfig.class in my unit testing and change the @ActiveProfiles({"dev"}). Yet when I run the test I get an IllegalArgumentException: Property 'sessionFactory' is required. Full trace: java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.DefaultTestContext.getApplicationContext(DefaultTestContext.java:101) at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:155) at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:100) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:319) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:212) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.ju…
has comment: http://stackoverflow.com/comment/33112711
type: Question

http://stackoverflow.com/a/21849417
answers question: http://stackoverflow.com/q/21849021
score: 0
type: Answer
has body: You could use a Dynamic Proxy to wrap your methods invocation, here an example: First you need to create InvocationHandler class: public class MyInvocationHandler implements InvocationHandler { private Object target; public MyInvocationHandler(Object target) { this.target = target; } @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { System.out.println("About to invoke " + method + "\n with argument " + args); Object rv = method.invoke(target, args); System.out.println(" Call returned " + rv);// here you could print the time instead return rv; } } Then Create a factory to get you object and Wrap it with the previous created proxy. public class MyFactory { public static MyInterface getMyInterface() { MyInterface mc = new MyClass(); InvocationHandler h = new MyInvocationHandler(mc); MyInterface mi = (MyInterface) Proxy.newProxyInstance(MyInterface.class.getClassLoader(), new Class[] { MyInterface.class }, h); return mi; } } Hope that help you.

http://stackoverflow.com/comment/33286081
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21967431
has text: Credit for "your" "answer" (not an answer and not yours) goes to [Lars Vogel](http://www.vogella.com/tutorials/JavaAlgorithmsQuicksort/article.html). I am usually not that rude, but this is the least amount of effort I have seen put into an "answer" for ages.

http://stackoverflow.com/a/22000138
answers question: http://stackoverflow.com/q/21999590
type: Answer
has comment: http://stackoverflow.com/comment/33344124
has comment: http://stackoverflow.com/comment/33344339
has body: You must have a JRE or JDK on your PATH in order to run Eclipse. If you are on Windows 7, go to Control Panel > System > Advanced System Settings > Advanced > Environment Variables. Find the Path system variable. Edit it and append the location of your JRE's bin folder to the end of it. Note that the JRE will be enough to run Eclipse, but to actually compile any code you will need a JDK.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21999590

selenium-webdriver
tags question: http://stackoverflow.com/q/21868197
tags question: http://stackoverflow.com/q/21993940
tags question: http://stackoverflow.com/q/21918741
tags question: http://stackoverflow.com/q/21898297
tags question: http://stackoverflow.com/q/21871568
tags question: http://stackoverflow.com/q/21852503
tags question: http://stackoverflow.com/q/21892347
tags question: http://stackoverflow.com/q/21901765
tags question: http://stackoverflow.com/q/21866395
tags question: http://stackoverflow.com/q/21946516
tags question: http://stackoverflow.com/q/21849063
tags question: http://stackoverflow.com/q/21936310
tags question: http://stackoverflow.com/q/21987780
tags question: http://stackoverflow.com/q/21987930
tags question: http://stackoverflow.com/q/21908112
tags question: http://stackoverflow.com/q/21877839
tags question: http://stackoverflow.com/q/21910789
tags question: http://stackoverflow.com/q/21907230
tags question: http://stackoverflow.com/q/21967914
tags question: http://stackoverflow.com/q/21885075
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/21932624
tags question: http://stackoverflow.com/q/21985993
tags question: http://stackoverflow.com/q/21848627
tags question: http://stackoverflow.com/q/21892880
tags question: http://stackoverflow.com/q/21994459
tags question: http://stackoverflow.com/q/21871000
tags question: http://stackoverflow.com/q/21984593
tags question: http://stackoverflow.com/q/21907007
tags question: http://stackoverflow.com/q/21955059
type: Tag
tags question: http://stackoverflow.com/q/21874865
tags question: http://stackoverflow.com/q/21930969
tags question: http://stackoverflow.com/q/21959564
tags question: http://stackoverflow.com/q/21933384
tags question: http://stackoverflow.com/q/21879991
tags question: http://stackoverflow.com/q/21865501
tags question: http://stackoverflow.com/q/21889531
tags question: http://stackoverflow.com/q/21945377
tags question: http://stackoverflow.com/q/21851794
tags question: http://stackoverflow.com/q/21899641
tags question: http://stackoverflow.com/q/21905377

http://stackoverflow.com/a/21974608
answers question: http://stackoverflow.com/q/21974369
has comment: http://stackoverflow.com/comment/33298215
has body: If you want to group the elements, you have to use groupingBy: import static java.util.stream.Collectors.*; Map&lt;Long, Long&gt; primeFactorCount = primeFactors.stream() .collect(groupingBy(p -&gt; p, counting()));
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 14
accepted answer of: http://stackoverflow.com/q/21974369
upvote count: 14

http://stackoverflow.com/a/21868432
answers question: http://stackoverflow.com/q/21868332
type: Answer
has body: It sounds like you didn't have enough text to make it scroll. Your solution seems correct. Maybe you want the scrollbar to be always there, use the other constructor: JScrollPane(Component, int, int) with constants from ScrollPaneConstants.
upvote count: 3
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/33109110

http://stackoverflow.com/q/21866830
type: UnansweredQuestion
has body: I keep getting a java.util.zip.ZipException when I try to open a jar file. I was able to reproduce the issue with the following stripped-down bit of code (ignore the weird populateSamples() method name): import java.io.File; import java.util.jar.JarFile; public class Test { public static void main(String[] args) { Test test = new Test(); test.populateSamples(); } private void populateSamples() { JarFile jf = null; try { String s = new File(this.getClass().getResource("Test.class").getPath()).getParent().replaceAll("(!|file:\\\\)", ""); jf = new JarFile(s); } catch(IOException e) { e.printStackTrace(); } finally { try { jf.close(); } catch(Exception e) { e.printStackTrace(); } } } } Here is the exception I get: $ java -jar EclipseTest.jar java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.&lt;init&gt;(ZipFile.java:128) at java.util.jar.JarFile.&lt;init&gt;(JarFile.java:136) at java.util.jar.JarFile.&lt;init&gt;(JarFile.java:73) at Test.populateSamples(Test.java:40) at Test.main(Test.java:17) java.lang.NullPointerException at Test.populateSamples(Test.java:54) at Test.main(Test.java:17) I can list the contents of the jar file with jar tf just fine. Any ideas?
tagged with: java
has comment: http://stackoverflow.com/comment/33106739
type: Question
has answer: http://stackoverflow.com/a/21867175
has comment: http://stackoverflow.com/comment/33106307
has title: ZipException when attempting to open jar file
score: 0
answer count: 1
tagged with: jar

http://stackoverflow.com/q/21962493
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/21962549
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
upvote count: 1
answer count: 1
has body: So here's my code for my main.xml, which is in the menu folder. &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_new" android:icon="@drawable/ic_action_new" android:title="@null" android:showAsAction="always" /&gt; &lt;/menu&gt; And when I launch my app and hold down on the button, I get a toast, off the button. When I do android:title="@null", I still get a toast but it's empty. How can I complete get rid of it?
has title: Remove android:title, for action bar button?
type: UnansweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/comment/33280831
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21964541
has text: Have you tried instead of multiplying 1 by 1, do something like find the solution for n = 500 and then multiply that solution with itself to get the solution for n = 1000? You could obviously find the solution for n = 500 using 2 solutions for n = 250, etc...
score: 0

http://stackoverflow.com/comment/33297149
comment on: http://stackoverflow.com/q/21974028
score: 1
has text: Test each method separately, try using a debugger or try using print statements.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33333730
score: 2
comment on: http://stackoverflow.com/q/21994493
has text: Neither Swing nor Applets are not actually "outdated" - at least not in the sense that there is a "replacement". Modern applets are really just Java Web Start (JWS) environments hosted inside browsers. If you need Java *in* a browser, use an Applet (which is "JWS" in anything from the last decade or so). Otherwise, don't.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/51061697
score: 0
has text: As config file, you are using log4j1, but these listed date patterns mostly log4j2 patterns that not working for log4j1. this works, you can test it here: http://log4jtester.com/?p=%25d%7Byyyy-MM-dd+HH%3Amm%3Ass%7D+%25-5p+%5B%25c%7B1%7D%5D+(%25t)+%5B%25X%5D+%25m%25n
comment on: http://stackoverflow.com/a/21979657
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33215759
score: 0
type: Comment
type: QuestionComment
has text: And, the answer there tells the op *exactly* how to parse it.
comment on: http://stackoverflow.com/q/21928512

http://stackoverflow.com/a/66579794
type: Answer
has body: For Kotlin users, you can go this way: class MyTrackerTest { private val trackEventUseCase: TrackEventUseCase = mock() private val sut = MyTracker(trackEventUseCase) @Test fun `trackSomething SHOULD invoke tracker use case twice with correct event names WHEN called`() { sut.trackSomething() trackEventUseCase.inOrder { verify().invoke("Is it August?") verify().invoke("No!") } } }
upvote count: 8
answers question: http://stackoverflow.com/q/21901368
downvote count: 0
score: 8

http://stackoverflow.com/q/21902415
accepted answer: http://stackoverflow.com/a/21902442
score: 0
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/21902442
favorite count: 0
possible better answer: http://stackoverflow.com/a/21902575
has title: Java error : unexpected type error
has comment: http://stackoverflow.com/comment/33169441
type: AnsweredQuestion
tagged with: java
has body: Object[] data=getSelectedRowData(i); updateStock((String)data[0], int data[4]);//error line &lt;&lt; says : unexpectd type required: value '.class' expected not a statement ';' expected Here is the full code: private void saveOrderDiscription() throws SQLException { int rows=rdrtbl.getRowCount(); for(int i=0; i&lt;rows; i++) { Object[] data=getSelectedRowData(i); updateStock((String)data[0], int data[4]);//error line String query="INSERT INTO orderdiscription VALUES('"+ codeFld.getText()+"', '"+data[0]+"', "+data[5]+")"; dbs.action(query); } } What can I do ???
has answer: http://stackoverflow.com/a/21902575
type: Question
answer count: 2

http://stackoverflow.com/a/21945541
upvote count: 2
has body: @Bean public User user() { return new User("first", "second", "third"); } @Bean public Department department() { return new Department("fourth", "fifth", user()); } Now you can user @Autowired in other classes that are in the container and inject your user or department (e.g. in a controller) @Autowired private User user; // will return the user from the user() java config defined bean
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21945271
downvote count: 0

http://stackoverflow.com/q/21856648
has answer: http://stackoverflow.com/a/21856719
tagged with: eclipse
answer count: 3
has body: I try to display an image using a JLabel. This is my project navigator: From SettingsDialog.java I want to display an image using following code: String path = "/images/sidebar-icon-48.png"; File file = new File(path); Image image; try { image = ImageIO.read(file); JLabel label = new JLabel(new ImageIcon(image)); header.add(label); // header is a JPanel } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } The code throws an exception: Can't read input file! Is the path of the image is wrong?
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33087171
tagged with: jlabel
has answer: http://stackoverflow.com/a/21857674
has comment: http://stackoverflow.com/comment/33086831
linked to: http://stackoverflow.com/q/1062941
linked to: http://stackoverflow.com/q/9864267
has answer: http://stackoverflow.com/a/21858382
has title: Load Image into JLabel not working
tagged with: javax.imageio
type: AnsweredQuestion
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/21856719
tagged with: swing
type: Question
score: 3
possible better answer: http://stackoverflow.com/a/21857674

http://stackoverflow.com/comment/33073572
type: Comment
has text: Your array may be to long, since not all characters of the input have a mapping. So there is empty space at the end of the array. This may lead to later problems, and I think it is against the OP's "specification".
score: 0
comment on: http://stackoverflow.com/a/21847520
type: AnswerComment

http://stackoverflow.com/comment/33301585
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21976366
has text: Yes UserPermission:
score: 0

http://stackoverflow.com/q/21879426
favorite count: 0
has answer: http://stackoverflow.com/a/21879584
tagged with: integer
upvote count: 2
answer count: 5
has answer: http://stackoverflow.com/a/21879447
accepted answer: http://stackoverflow.com/a/21879536
score: 2
type: AnsweredQuestion
has title: Why int primitive type not deprectaed in Java
tagged with: java
possible better answer: http://stackoverflow.com/a/21879447
has body: In java if Integer can be used instead of int and Integer providing extra features then my question is why is int not being deprecated, and why int primitive type so extensively used?
type: Question
has answer: http://stackoverflow.com/a/21879588
tagged with: int
has answer: http://stackoverflow.com/a/21879536
downvote count: 0
has answer: http://stackoverflow.com/a/21879576

http://stackoverflow.com/comment/131369544
comment on: http://stackoverflow.com/a/39999122
type: AnswerComment
score: 0
has text: This won't be exclusive lock as other threads (from different parts of application) will be able to enter ConcurrentHashMap#get or ConcurrentHashMap#put methods as they are not synchronized. This will be illusion of exclusive lock.
type: Comment

http://stackoverflow.com/comment/33237150
has text: @LaabidiRaissi Can you elaborate how to use the Property in my DAO class using `<context:property-placeholder />`?
comment on: http://stackoverflow.com/q/21939804
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21971577
type: Question
has answer: http://stackoverflow.com/a/21971704
has answer: http://stackoverflow.com/a/21971639
has body: I'm trying to code a text analysis program, and one of the methods is supposed to write a file containing every word started by a certain letter and the number of occurences of that word, using a text file as input (BufferedReader and whatnot). If input is: "O Pai Natal nao existe. Mas o coelho da Pascoa existe (e a Fada dos Dentes tambem)." Output for e should be: EXISTE 2E 1 My code so far is as follows – I know I could have used a HashMap, but this is school work and we haven't learned that yet, so I'm trying to keep it within what was lectured –: void WordList(char c, String file) throws IOException { BufferedWriter out = new BufferedWriter(new FileWriter(ficheiro+".txt")); String[] words = null; int indexVector = 0; String[] wordAlreadyWritten = null; int indexVector2 = 0; for (int i = 0; i &lt; text.length; i++) { if (text[i].charAt(0) == c) { words[indexVector] = texto[i]; /*error here */ indexVector++; } } for (int i = 0; i &lt; words.length; i++) { /*error here*/ if (!wordWasAlreadyWritten(words[i], wordAlreadyWritten)) { out.write(words[i] + ": " + countNumberRepetitions(words[i], words)); wordAlreadyWritten[indexVector2] = words[i]; /* error here*/ indexVector2++; } } out.close(); } I am also using some auxiliary methods as some may have noticed: static boolean wordWasAlreadyWritten(String original, String[] array) { boolean was = false; for (int j = 0; j &lt; array.length; j++) { if (original.equals(array[j])) { was = true; } } return was; } static int countNumberRepetitions(String word, String[] array) { int counter = 1; for (int i = 0; i &lt; array.length; i++) { if (word.equals(array[i])) { contador++; } } return counter; } If someone can explain the java.lang.NullPointerException I'm getting and how to fix it, I would be very thankful. Also if someone has any idea on how to make my code better, it would also be greatly appreciated.
score: 0
answer count: 2
has title: Error: java.lang.NullPointerException
type: UnansweredQuestion
tagged with: count
tagged with: java

http://stackoverflow.com/a/64716198
type: Answer
has body: In this case the trick is basically understanding the type of variables we have in Java : Instance Variable ( non-static fields, declared inside a class and not methods(depending on what your aim is), They cannot be reinitialized,automatically initialized) e.g int x; int y; double number; Static Variables (only one copy is created per class ) Local Variables ( only accessed within the method or class it has been declared - within its scope, common withing methods) In this case what you will do is define an instance variable at the beginning of your class, then access it wherever within your system. here is my example : i have a simple POJO `class BMI{ public double weight; public double getWeight() { return weight; } public void setWeight(double weight) { this.weight = weight; } public double getHeight() { return height; } public void setHeight(double height) { this.height = height; } public double height; public BMI() { } My main Java Class ... public class MainActivity { double weight; double height; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void calculateBMI(double mWeight, double mHeight){ BMI myWeight = new BMI(); BMI myHeight = new BMI(); weight = mWeight.setWeight(); height = mHeight.setHeight(); Height = height; weight = weight; //calculate your bmi } `
answers question: http://stackoverflow.com/q/21883601
score: 0

http://stackoverflow.com/comment/33110618
type: QuestionComment
comment on: http://stackoverflow.com/q/21869190
type: Comment
has text: Is the complexity algorithm given, or are we supposed to just guess?
score: 0

http://stackoverflow.com/a/21913583
answers question: http://stackoverflow.com/q/21913471
has comment: http://stackoverflow.com/comment/33190906
score: 1
has comment: http://stackoverflow.com/comment/33193677
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/33193528
type: AcceptedAnswer
downvote count: 0
has body: Much the same way as PHP: String dbCall = "{ ? = call pa_internal_admin.fn_search_level_1(?) }"; proc = dbConn.connection().prepareCall( dbCall ); proc.registerOutParameter(1, OracleTypes.CURSOR); proc.setString(2, searchText); Or if you prefer, to be even more similar: String dbCall = "BEGIN ? := pa_internal_admin.fn_search_level_1(?); END;"; You tried to call it as a procedure with two parameters, rather than a function with one; you can't arbitrarily change that in your call. You can get the cursor back with: OracleResultSet rSet = (OracleResultSet) proc.getCursor(1); ... and then treat it like any other result set.
accepted answer of: http://stackoverflow.com/q/21913471

http://stackoverflow.com/comment/33322365
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21988444
has text: I am using Tomcat server 7.0
score: 0

http://stackoverflow.com/a/36323333
type: Answer
has body: I also hit the problem of no console output while 404 error. As in The Saint's answer, one of the causes of no console log: the issue here is that certain errors (like the 404 exception) get intercepted by the Servlet container "spring-framework-reference-3.2.3.pdf" --> 1.3 --> Logging --> Using Log4J, solved the problem in my environment.
answers question: http://stackoverflow.com/q/21870726
score: 0

http://stackoverflow.com/q/21917705
tagged with: fibonacci
tagged with: java
has answer: http://stackoverflow.com/a/21917858
answer count: 2
has body: I have the task of writing a program using the fibonacci sequence and putting them into arrays. It works by getting user input ( how many numbers in the sequence the user wants to print out) and then it implements that into an array and prints out the sequence with the number of 'numbers' the user inputed. As I missed out on 2 weeks of class I looked online on how to write this program and found a video which the following code was written. So I do not take credit for the following code, I'm merely using it as an example. Anyway here's the code: public class Fibonacci { public static void main(String[] args) { int numToPrint; //how many numbers to print out Scanner scan = new Scanner(System.in); System.out.println("Hvað viltu prenta út margar tölur úr Fibonacci röðinni?"); numToPrint = scan.nextInt(); scan.close(); //prints out the first 2 numbers int nuverandiT = 1; int lokaT = 0; System.out.println(lokaT); System.out.println(nuverandiT); //prints out the rest of the sequence int lokaLokaT; for(int i = 2; i &lt; numToPrint; i++) { lokaLokaT = lokaT; lokaT = nuverandiT; nuverandiT = lokaLokaT + lokaT; System.out.println(nuverandiT); } } } Now this prints out the fibonacci sequence with input from the user, but I'm not quite sure how to make it print out into an array. Do any of you guys know how to do this?
tagged with: arrays
possible better answer: http://stackoverflow.com/a/21917825
score: 0
has answer: http://stackoverflow.com/a/21917825
has title: Fibonacci sequence with arrays
tagged with: input
accepted answer: http://stackoverflow.com/a/21917858
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/33197160

http://stackoverflow.com/comment/33255690
type: Comment
comment on: http://stackoverflow.com/a/21950733
score: 0
type: AnswerComment
has text: You are guessing ... aren't you :-)

http://stackoverflow.com/q/21968342
has comment: http://stackoverflow.com/comment/33287698
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/33287655
has comment: http://stackoverflow.com/comment/33287783
downvote count: 0
has comment: http://stackoverflow.com/comment/33287516
tagged with: image
accepted answer: http://stackoverflow.com/a/21969210
has title: Efficient way to send an image over socket in Java
has comment: http://stackoverflow.com/comment/33287778
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/33287894
has comment: http://stackoverflow.com/comment/33288056
favorite count: 0
has comment: http://stackoverflow.com/comment/33287830
type: Question
tagged with: sockets
has comment: http://stackoverflow.com/comment/33287539
answer count: 1
has comment: http://stackoverflow.com/comment/33288114
tagged with: javax.imageio
has body: I'm a bit of a Java noob, and I have read some basics about sockets and I can successfully send images over socket using ImageIO, but I want to reduce the amount of data that is sent. Ultimately I want the image (screen capture) to be send as fast as possible with the smallest possible file size. Right now, I have imageIO set up as such; DataInputStream in=new DataInputStream(client.getInputStream()); DataOutputStream out = new DataOutputStream(client.getOutputStream()); ImageIO.write(captureImg(),"JPG",client.getOutputStream()); And the receiver: BufferedImage img=ImageIO.read(ImageIO.createImageInputStream(server.getInputStream())); File outputfile = new File("Screen"+(date.toString())+".jpg"); ImageIO.write(img, "jpg", outputfile); In case you're wondering, this is my method that is used to take the image. Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); BufferedImage capture = new Robot().createScreenCapture(screenRect); I have heard about Byte arrays, where you can send the bytes then draw the image at the other end. However I'm not sure if this is more efficient. Any help would be greatly appreciated, please ask if you would like me to add any extra info or code for the byte array! Thanks. EDIT: Patrick: ByteArrayOutputStream bScrn = new ByteArrayOutputStream(); ImageIO.write(captureImg(), "JPG", bScrn); byte imgBytes[] = bScrn.toByteArray(); out.write((Integer.toString(imgBytes.length)).getBytes()); out.write(imgBytes,0,imgBytes.length);
has comment: http://stackoverflow.com/comment/33287641
has comment: http://stackoverflow.com/comment/33287626
has answer: http://stackoverflow.com/a/21969210

http://stackoverflow.com/comment/33088440
type: AnswerComment
score: 0
type: Comment
has text: According to OOPS principles what's wrong? How to code it alternatively?
comment on: http://stackoverflow.com/a/21857143

http://stackoverflow.com/a/21847590
type: Answer
answers question: http://stackoverflow.com/q/21847373
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33070885
has body: Change your Coin class public class Coin { private String sideUp; public void toss() { Random flip = new Random(); if (flip.nextInt(2) == 0) { sideUp = "Tails"; } else { sideUp = "Heads"; } } public String getSideUp() { return sideUp; } } That works!! As suggested above, Compare Strings with .equals(), or .equalsIgnoreCase() methods...
accepted answer of: http://stackoverflow.com/q/21847373

http://stackoverflow.com/a/21926310
score: 5
has body: Well I can think of a couple ways but it depends on the functionality you need. One way is to "cheat" and use an AtomicMarkableReference&lt;Boolean&gt;: final AtomicMarkableReference&lt;Boolean&gt; twoBooleans = ( new AtomicMarkableReference&lt;Boolean&gt;(true, false) ); void somewhere() { boolean b0; boolean[] b1 = new boolean[1]; b0 = twoBooleans.get(b1); b0 = false; b1[0] = true; twoBooleans.set(b0, b1); } But that's kind of a pain and only gets you two values. So then you can use AtomicInteger with bit flags: static final int FLAG0 = 1; static final int FLAG1 = 1 &lt;&lt; 1; final AtomicInteger intFlags = new AtomicInteger(FLAG0); void somewhere() { int flags = intFlags.get(); int both = FLAG0 | FLAG1; if((flags &amp; both) == FLAG0) { // if FLAG0 has a 1 and FLAG1 has a 0 something(); } flags &amp;= ~FLAG0; // set FLAG0 to 0 (false) flags |= FLAG1; // set FLAG1 to 1 (true) intFlags.set(flags); } Also kind of a pain but it gets you 32 values. You could probably create a wrapper class around this if you really wanted. For example: public class AtomicBooleanArray { private final AtomicInteger intFlags = new AtomicInteger(); public void get(boolean[] arr) { int flags = intFlags.get(); int f = 1; for(int i = 0; i &lt; 32; i++) { arr[i] = (flags &amp; f) != 0; f &lt;&lt;= 1; } } public void set(boolean[] arr) { int flags = 0; int f = 1; for(int i = 0; i &lt; 32; i++) { if(arr[i]) { flags |= f; } f &lt;&lt;= 1; } intFlags.set(flags); } public boolean get(int index) { return (intFlags.get() &amp; (1 &lt;&lt; index)) != 0; } public void set(int index, boolean b) { int f = 1 &lt;&lt; index; int current, updated; do { current = intFlags.get(); updated = b ? (current | f) : (current &amp; ~f); } while(!intFlags.compareAndSet(current, updated)); } } That's pretty good. Maybe a set is performed while the array is being copied in get but the point is you can get or set all 32 atomically. (The compare and set do-while loop is major ugly but it's how the atomic classes themsel…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33242219
has comment: http://stackoverflow.com/comment/59695658
accepted answer of: http://stackoverflow.com/q/21925546
type: Answer
answers question: http://stackoverflow.com/q/21925546
has comment: http://stackoverflow.com/comment/33248377
has comment: http://stackoverflow.com/comment/59697602
has comment: http://stackoverflow.com/comment/33241346
has comment: http://stackoverflow.com/comment/33248922
has comment: http://stackoverflow.com/comment/33243656
upvote count: 5
has comment: http://stackoverflow.com/comment/33240391

http://stackoverflow.com/comment/33196959
has text: Instead of `\n` it is better to use `%n` to make line separator OS dependant.
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/21917793

http://stackoverflow.com/comment/33274383
type: Comment
has text: @AliAnsari: Well that's *still* not going to work if the array is empty, but other than that it's okay. It's not how I would write the code, mind you - I'd use iteration rather than recursion.
type: AnswerComment
comment on: http://stackoverflow.com/a/21960890
score: 0

http://stackoverflow.com/comment/33207646
comment on: http://stackoverflow.com/a/21922473
score: 0
type: AnswerComment
type: Comment
has text: Thanks loads. This makes it to where I can maintain control of my program using pure java.

http://stackoverflow.com/comment/33226989
comment on: http://stackoverflow.com/q/21934994
score: 0
type: Comment
type: QuestionComment
has text: Did you debug with breakpoints?

hadoop
tags question: http://stackoverflow.com/q/21991441
tags question: http://stackoverflow.com/q/21853672
tags question: http://stackoverflow.com/q/21884834
tags question: http://stackoverflow.com/q/21850298
tags question: http://stackoverflow.com/q/21846921
tags question: http://stackoverflow.com/q/21915054
tag name: hadoop
tags question: http://stackoverflow.com/q/21967190
tags question: http://stackoverflow.com/q/21987144
tags question: http://stackoverflow.com/q/21995069
tags question: http://stackoverflow.com/q/21924330
tags question: http://stackoverflow.com/q/21876062
type: Tag
tags question: http://stackoverflow.com/q/21901035
tags question: http://stackoverflow.com/q/21873050
tags question: http://stackoverflow.com/q/21857814
tags question: http://stackoverflow.com/q/21985505
tags question: http://stackoverflow.com/q/21929305
tags question: http://stackoverflow.com/q/21875264
tags question: http://stackoverflow.com/q/21955704
tags question: http://stackoverflow.com/q/21968435
tags question: http://stackoverflow.com/q/21857655
tags question: http://stackoverflow.com/q/21866728
tags question: http://stackoverflow.com/q/21864870
tags question: http://stackoverflow.com/q/21868380
tags question: http://stackoverflow.com/q/21886981
tags question: http://stackoverflow.com/q/21897568
tags question: http://stackoverflow.com/q/21862710
tags question: http://stackoverflow.com/q/21855690
tags question: http://stackoverflow.com/q/21997831

http://stackoverflow.com/q/21910145
score: 0
has body: I am trying to pass a vector from one activity to another as: Vector&lt;Vector&lt;MovieAndTimesEntry&gt;&gt; vector=MovieAndTimesEntry.getLineup(mvs); Intent intent = new Intent(getBaseContext(), ExpandableListViewActitivy.class); intent.putExtra("lineups", vector); startActivity(intent); In ExpandableListViewActivity I try to get this value as: Vector&lt;Vector&lt;MovieAndTimesEntry&gt;&gt; vector; vector=((Vector&lt;Vector&lt;MovieAndTimesEntry&gt;&gt;) extras.get("lineups"));//ExpandableListViewActitivy.java:33 But I get this exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.MovieHop/com.example.MovieHop.ExpandableListViewActitivy}: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Vector at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211) at android.app.ActivityThread.access$600(ActivityThread.java:149) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:153) at android.app.ActivityThread.main(ActivityThread.java:5086) 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:821) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Vector at com.example.MovieHop.ExpandableListViewActitivy.onCreate(ExpandableListViewActitivy.java:33) So what's wrong here?
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21910329
tagged with: android
duplicate of: http://stackoverflow.com/q/3530421
tagged with: java
has comment: http://stackoverflow.com/comment/33182815
has title: Passing vector, getting ArrayList in Android
type: Question
tagged with: vector
linked to: http://stackoverflow.com/q/3530421
has comment: http://stackoverflow.com/comment/33182907
has comment: http://stackoverflow.com/comment/33182836
tagged with: arraylist

http://stackoverflow.com/comment/33293053
comment on: http://stackoverflow.com/a/21954460
has text: Yes, "native code" is usually written in C or C++, and the JVM itself is native code (and you can also execute user-provided native code via the JNI). It's needed because the JVM is just a *virtual* machine, so it needs to be implemented somewhere!
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33291592
score: 0
type: Comment
type: QuestionComment
has text: Great resource here http://www.regular-expressions.info/
comment on: http://stackoverflow.com/q/21970766

http://stackoverflow.com/a/21975626
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/33300455
score: 3
has body: try { new SimpleDateFormat("yyyyDDmm").parse(input); // good format } catch (ParseException e) { // bad format }
downvote count: 0
answers question: http://stackoverflow.com/q/21975567

http://stackoverflow.com/comment/33166279
has text: @peeskillet already it is fixed as AS_NEEDED but it is visible still i deleted all the records too but its visible only
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21900222

http://stackoverflow.com/comment/55021313
score: 0
comment on: http://stackoverflow.com/a/21968400
type: Comment
has text: But this will only work for TCP & UDP how about other packets.
type: AnswerComment

http://stackoverflow.com/comment/33164488
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21872069
has text: @JamesR.Perkins It was log of jboss-6.1.0.Final version of Jboss

http://stackoverflow.com/comment/33114208
comment on: http://stackoverflow.com/q/21871118
type: Comment
has text: I used tinyint because i am going to set value, only Zero(0) OR one(1)
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33184186
type: QuestionComment
has text: A String is immutable. `s1` and `s2` are not String objects, they are *references* to String objects and these references can be changed.
score: 0
comment on: http://stackoverflow.com/q/21910760
type: Comment

http://stackoverflow.com/a/21937401
score: 0
answers question: http://stackoverflow.com/q/21937091
has body: String input = "abc12xx3"; Pattern pattern = Pattern.compile("[\\d]"); Matcher matcher = pattern.matcher(input); int sum = 0; while(matcher.find()) { sum += Integer.parseInt(matcher.group()); } return sum;
type: Answer

http://stackoverflow.com/q/21916405
accepted answer: http://stackoverflow.com/a/21916844
score: 0
has comment: http://stackoverflow.com/comment/33194765
tagged with: android
has answer: http://stackoverflow.com/a/21916540
has comment: http://stackoverflow.com/comment/33194451
has comment: http://stackoverflow.com/comment/33194492
possible better answer: http://stackoverflow.com/a/21916540
has comment: http://stackoverflow.com/comment/33194547
has comment: http://stackoverflow.com/comment/33195047
has answer: http://stackoverflow.com/a/21916844
type: AnsweredQuestion
tagged with: java
has title: Image is not changing in ImageView
has body: I want to change image after some animation to first image. I am trying with this code but only the second image is getting animated. First image is not displaying. public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); anim(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } public void anim() { Animation animfadein =AnimationUtils.loadAnimation(this,R.anim.fadein); Animation animfadeout =AnimationUtils.loadAnimation(this,R.anim.fadeout); findViewById(R.id.imageView1).startAnimation(animfadein); findViewById(R.id.imageView1).startAnimation(animfadeout); Context myActivity =getApplicationContext(); Toast.makeText(myActivity, "Please wait", Toast.LENGTH_SHORT).show(); button(); } public void button() { ImageView imgView1 = (ImageView)findViewById(R.id.imageView1); Drawable myDrawable = getResources().getDrawable(R.drawable.start); imgView1.setImageDrawable(myDrawable); } } My xml file is like this &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" 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;ImageView android:id="@+id/imageView1" android:contentDescription="@string/description" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_logo"/&gt; &lt;/LinearLayout&gt; I tried using setImageresource still same first image is not displaying. Please let me know what …
type: Question
answer count: 2

http://stackoverflow.com/q/21947521
has comment: http://stackoverflow.com/comment/33250041
has comment: http://stackoverflow.com/comment/33251443
has comment: http://stackoverflow.com/comment/33250054
answer count: 1
tagged with: jackson
favorite count: 0
has answer: http://stackoverflow.com/a/21947565
score: 0
has body: I am trying to create a jNODE object by parsing a JSON file which is in following format: {"delete":{"status":{"id":222318827684372480,"user_id":372364809,"id_str":"222318827684372480","user_id_str":"372364809"}}} {"delete":{"status":{"id":430870775227117568,"user_id":582666020,"id_str":"430870775227117568","user_id_str":"582666020"}}} {"delete":{"status":{"id":217335495406010368,"user_id":418026096,"id_str":"217335495406010368","user_id_str":"418026096"}}} While creating jNODE object I am getting an object corresponding to: {"delete":{"status":{"id":222318827684372480,"user_id":372364809,"id_str":"222318827684372480","user_id_str":"372364809"}}} and not rest of the two blocks in the JSON file. Can anyone please help with this? We have tried to use an iterator to travel but it didnt work. Thanks.
has title: How to read twitter feed in json using jackson library
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/33249978
downvote count: 1
has comment: http://stackoverflow.com/comment/33250071
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/33222578
has text: hey @user3329098, how did you say this answer for that query.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21930719
type: Comment

http://stackoverflow.com/comment/33332537
type: Comment
has text: As far as `setText` it would normally be `button[0].setText("0")` and that only changes the text that the users sees on the button, not the the reference name you use in java. `setName` also doesn't change the reference name you use in java, in fact, you may never need to use `setName` most of the time.
comment on: http://stackoverflow.com/a/21993570
score: 0
type: AnswerComment

http://stackoverflow.com/a/21970705
downvote count: 0
score: 1
has body: Create a simple loop based on the user input, like: if the user input was 7, then: for(int i = 1; i &lt;= userInput; i++) { // then pass the i value to your method, it will go through &gt;&gt; 1 2 3 4 5 6 7. }
upvote count: 1
answers question: http://stackoverflow.com/q/21970662
type: Answer
has comment: http://stackoverflow.com/comment/33291598

http://stackoverflow.com/q/21940004
has comment: http://stackoverflow.com/comment/33235988
has body: How can I get all the occurrences of a provided expression from a text? Basically I want to fetch all the DB names from the query below that are matching the expression: ^.*ALTER TABLE \`(?:([a-zA-Z0-9_]+))` DROP PRIMARY KEY, ADD PRIMARY KEY.* The text that I'm trying to match is: ..... ALTER TABLE \`table1\` DROP PRIMARY KEY, ADD PRIMARY KEY(`column1`,`column2`); .... ALTER TABLE \`table2\` DROP PRIMARY KEY, ADD PRIMARY KEY(`column1`,`column2`); ... ALTER TABLE \`table3\` DROP PRIMARY KEY, ADD PRIMARY KEY(`column1`,`column2`); .. The output of the match should return: table1, table2, table3. Currently the expression provided above will only return the last matching value: table3
tagged with: regex
has comment: http://stackoverflow.com/comment/33236202
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21940133
tagged with: java
type: Question
has title: How can I get all the occurrences of a provided expression from a text?
score: 0
has answer: http://stackoverflow.com/a/21940133
answer count: 1

http://stackoverflow.com/a/21868885
type: Answer
has comment: http://stackoverflow.com/comment/33110299
has comment: http://stackoverflow.com/comment/33132040
has body: I would recommend this method : for(char letter = 'A'; letter &lt;= 'Z';letter ++){ int letterID = getResources().getIdentifier(""+letter, "id", getPackageName()); TextView txtview = (TextView) getView().findViewById(letterID); txtview .setTextSize(20 * getResources().getDisplayMetrics().density); txtview .setText(letter); txtview .setOnClickListener(new View.OnClickListener() { public void onClick(View v) { checkGuess(letter); txtview.setClickable(false); txtview.setAlpha((float) .1); } }); }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21868753
score: 0
answers question: http://stackoverflow.com/q/21868753

http://stackoverflow.com/comment/33352431
type: Comment
comment on: http://stackoverflow.com/a/22004264
has text: Then your `String` doesn't contain a `.`...you can use `String#contains` to check this...
score: 0
type: AnswerComment

http://stackoverflow.com/a/21945630
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/21945598
type: Answer
answers question: http://stackoverflow.com/q/21945598
has body: The args parameter is passed to the main method when the application is run. If no arguments are passed to the application accessing the first index of the args array will throw an ArrayIndexOutOfBoundsException. Try running your application from the command line as follows: cd /Whatever/directory/contains/the/class javac Test.java java Test a b c If you are using the Eclipse IDE program arguments can be set by Run > Run Configurations and then selecting your program and supplying arguments.

http://stackoverflow.com/comment/33344286
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22000275
score: 0
has text: Maybe you should look into using packages instead of classes to hold a group of related classes.

http://stackoverflow.com/q/21971133
type: Question
has answer: http://stackoverflow.com/a/21971295
has comment: http://stackoverflow.com/comment/33292480
answer count: 3
has title: How to organize my classes/inheritance/implementation correctly?
downvote count: 0
has body: I am currently working on a school project. In this project, we are supposed to first model the world seen from a doctor's perspective, including his patients, different pharmaceutical drugs (with interfaces such as liniment, pills and injections), prescriptions for drugs and containers for prescriptions and persons. This is what the first part of the assignment says: A pharmaceutical drug has a name, unique number and a price. A pharmaceutical drug is of type A (narcotic with an associated int representing how narcotic/potent the drug is), type B (strongly addictive with an associated int representing how addictive the drug is) or type C ("normal" without the associative int that the two other types have). Types A, B and C are supposed to be implemented as interfaces. My problem is the way that I'm supposed to structure the classes; I strongly disagree that this is the best way to organize the classes, but upon researching different approaches, I find myself puzzled as to what is the best implementation. I want to do something like this. Pharmaceutical drug could be an abstract class with 3 concrete subclasses: PharmaceuticalDrug / | \ Liniment Pill Injection My problem is how do I implement type A, type B and type C because of the instance variables associated with those types. Types A and B require an extra instance variable to represent their "potency", whereas C does not. I could simply include the instance variable and set type C's instance variable to a non-functional value (like -1) to indicate that that value is not to be used, but this approach does not seem like a pretty solution to me, as I am to write prescriptions with all info to files later on and would like an easy way to loop through and do this without unnecessary tests and special cases for type C. I've tried to think out several ways to solve this. The instructors have stated that we could use Type A, B and C as interfaces and implement them accordingly, but to my knowledge I cannot implement an…
favorite count: 0
tagged with: implements
type: UnansweredQuestion
tagged with: interface
has answer: http://stackoverflow.com/a/21971376
score: 3
upvote count: 3
has answer: http://stackoverflow.com/a/21971379
tagged with: java

http://stackoverflow.com/a/21894103
score: 0
has body: If readLine() is blocking and you are sending data, you aren't sending a newline.
answers question: http://stackoverflow.com/q/21887482
type: Answer

http://stackoverflow.com/comment/33212676
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21926003
has text: @SantoshJoshi Yes that lib folder have all jars what even i added in pom file

http://stackoverflow.com/a/21966846
has comment: http://stackoverflow.com/comment/33285210
accepted answer of: http://stackoverflow.com/q/21966794
has comment: http://stackoverflow.com/comment/33284983
has body: Short answer HEAD only sends back the same header information that the corresponding GET request would do, but with no entity body. And GET would send those same headers and the entity body. Of course in the rare/ arguable cases in which GET would send back nothing in its body, then GET and HEAD would behave similarly. The book HTTP The Definitive Guide adds: This allows a client to inspect the headers for a resource without having to actually get the resource. Using HEAD, you can: Find out about a resource (e.g., determine its type) without getting it. See if an object exists, by looking at the status code of the response. Test if the resource has been modified, by looking at the headers. Server developers must ensure that the headers returned are exactly those that a GET request would return. The HEAD method also is required for HTTP/1.1 compliance. So, whether doHead invokes doGet may just be an implementation detail, but if so, the doHead would need to strip the body of doGet before sending the response. This implementation would be inefficient, though, since ideally doHead should not incur in the difficulties of performing the entire doGet request to determine which headers to send back. The calculation of some headers may pose difficulties though. For instance, the "Content-Length" header implies we need to know the size of the actual resource and so HEAD may require to "GET" the resource to determine the actual size in bytes of the corresponding GET request, but it will not burden the network with actually sending the resource back, although it may have burdened the server with the retrieval of the resource in order to determine which headers to send back (i.e. Content-Length, Content-Type, Content-Language, etc.) Long answer The HTTP specification says 9.4 HEAD The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be ide…
has comment: http://stackoverflow.com/comment/33285037
type: AcceptedAnswer
downvote count: 0
upvote count: 8
answers question: http://stackoverflow.com/q/21966794
has comment: http://stackoverflow.com/comment/33285642
type: Answer
has comment: http://stackoverflow.com/comment/33285552
score: 8
has comment: http://stackoverflow.com/comment/33285055

http://stackoverflow.com/a/21944974
type: Answer
answers question: http://stackoverflow.com/q/21944450
has comment: http://stackoverflow.com/comment/33247817
score: 0
has body: Here is what I would do.... public class TrafficSim { private String input; private String content; public TrafficSim(String input) { this.setInput(input); this.setContent(readFromFile()); } private String readFromFile() { File inputText = new File(input); StringBuilder sb = new StringBuilder(); try { Scanner scan = new Scanner(inputText); while (scan.hasNextLine()) { sb.append(scan.nextLine()); } scan.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } return sb.toString(); } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getInput() { return input; } public void setInput(String input) { this.input = input; } public static void main(String[] args) { TrafficSim sim = new TrafficSim("input1.txt"); System.out.println(sim.getContent()); } } The issue I see though is that you're not following the comments and suggestions already made. ktm5124 was pretty clear on what the problem is. At some point you're going to have to understand what is going on here and how to fix it.

http://stackoverflow.com/comment/33168837
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21900125
type: AnswerComment
has text: @MadProgrammer: The fastest (at least easiest) way to creating a sepia tone effect, is to first convert to grey, then use `RescaleOp` to scale/offset the reds, blues and greens (in effect very similar to what you have implemented above). +1 for the effort and good example though! :-)

http://stackoverflow.com/comment/33067459
score: 0
comment on: http://stackoverflow.com/q/21844988
has text: Let me check Siddharth.. Thanks for your help
type: Comment
type: QuestionComment

event-handling
tag name: event-handling
type: Tag
tags question: http://stackoverflow.com/q/21961778
tags question: http://stackoverflow.com/q/21908768

http://stackoverflow.com/comment/33264194
has text: But that's the whole point.. I need to remove them from the arraylist.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21955601
score: 0

http://stackoverflow.com/q/21976953
has comment: http://stackoverflow.com/comment/33302684
linked to: http://stackoverflow.com/q/1036754
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21977010
has title: wait is called on Object while sleep is called on Thread
has comment: http://stackoverflow.com/comment/33302701
has answer: http://stackoverflow.com/a/50563122
has comment: http://stackoverflow.com/comment/33302761
accepted answer: http://stackoverflow.com/a/21977010
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/21993314
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21993314
tagged with: java
type: Question
has body: I am trying to understand the below line of difference between java wait() and sleep() methods. I understand basic of what each does but confused with the below statement frequently. wait is called on Object while sleep is called on Thread. what is object in above statement with respect to below code, because even thread object t is created like a any other object in java. public class MyRunnableThreadClass implements Runnable{ public void run(){ try{ Thread.sleep } catch(Exception e){} } public class ThreadDemo { Thread t = new Thread ( new MyRunnableThreadClass()); } Could you please help which is Object and thread in this cases

http://stackoverflow.com/comment/33159975
score: 2
comment on: http://stackoverflow.com/q/21896711
has text: `if (feeble == 0){break outer;}` How could this possibly be true? Your `while` loop only executes on the condition that `feeble != 0` and I don't see you changing the value of `feeble` before that `if` statement. So, pretty sure that condition will always be `false`.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33071980
type: Comment
score: 2
has text: I think creating files in external directory directly is bad practice. When you do that, you mass up users file system and sd card. I have tens of folders from various applications. I use the provided place in external file system. And it is also deleted when user select clear data.
type: AnswerComment
comment on: http://stackoverflow.com/a/21848191

http://stackoverflow.com/comment/33131141
has text: @mKorbel OP doesn't really need the SwingWorker since he's not modelling a task which takes some time and then *completes, updating the GUI*. He only wants a background task.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21880467

subclass
tags question: http://stackoverflow.com/q/21948738
type: Tag
tags question: http://stackoverflow.com/q/22004125
tags question: http://stackoverflow.com/q/21943856
tags question: http://stackoverflow.com/q/21933095
tag name: subclass
tags question: http://stackoverflow.com/q/21950925

http://stackoverflow.com/q/22003802
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22004109
has answer: http://stackoverflow.com/a/22003902
score: 32
linked to: http://stackoverflow.com/q/39437481
has answer: http://stackoverflow.com/a/22003898
has answer: http://stackoverflow.com/a/22003885
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22003885
tagged with: oop
tagged with: java
tagged with: swing
type: Question
has body: When making an application using Swing, I've seen people do one of the two things to create a JFrame. Which is a better approach and why? I'm a beginner at Java and programming. My only source of learning is books, YouTube and Stack&nbsp;Overflow. import {imports}; public class GuiApp1 { public static void main(String[] args) { new GuiApp1(); } public GuiApp1() { JFrame guiFrame = new JFrame(); guiFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); guiFrame.setTitle("Example GUI"); guiFrame.setSize(300,250); ................ } AND import {imports}; public class GuiApp1 extends JFrame { public Execute() { getContentPane().setBackground(Color.WHITE); getContentPane().setLayout(null); setSize(800, 600); ............. } public static void main(String[] args) { Execute frame1 = new Execute(); frame1.setVisible(true); } }
has title: Extends JFrame vs. creating it inside the program
upvote count: 32
has answer: http://stackoverflow.com/a/22003875
answer count: 6
tagged with: inheritance
possible better answer: http://stackoverflow.com/a/22003898
has answer: http://stackoverflow.com/a/22003858
has comment: http://stackoverflow.com/comment/33350699
tagged with: composition
has comment: http://stackoverflow.com/comment/135630692

http://stackoverflow.com/comment/33097927
comment on: http://stackoverflow.com/q/21862639
has text: You should be able to accomplish this fairly simply with an array of urls, a current index, and an ajax call in a recursively-called setTimeout.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21946101
type: AcceptedAnswer
has body: You need to have @JoinColumn(name = "id") along with your @ManyToOne in Address. By adding the mappedBy to addresses you are letting the child to own the relation ship. When you mention the JoinColumn you are telling that what is the columns that hold the actual relationship in DB. Also, you were talking about contact_id but I couldn't see that in your mapping.
accepted answer of: http://stackoverflow.com/q/21945477
type: Answer
answers question: http://stackoverflow.com/q/21945477
has comment: http://stackoverflow.com/comment/33260565
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/21900390
tagged with: java
has answer: http://stackoverflow.com/a/21900762
type: Question
answer count: 3
has body: If object1 and object2 are two different types of objects but implement the same interface I, and we assume object1 and object2 have same hash code. There is a HashMap&lt;I, String&gt;. So we can call put(object1, "some string") and put(object2, "some string") by that hash map. My understanding is: For put() function, the position of the object in hash map depends on the hash code of the key object. After the object1 put into the map first, then we try to put object2. It will find the position has been occupied by object1 already. So the object2 will be put into object1's next position. For get() function, if we call get(object2), it will find object1 first, and find object1 != object2, then it will continue to compare the next element of object1 until find the same object with object2 Just want to know if I am correct? Or any supplement information within this mechanism.
favorite count: 0
has comment: http://stackoverflow.com/comment/33166067
has answer: http://stackoverflow.com/a/21900552
has answer: http://stackoverflow.com/a/21900878
has comment: http://stackoverflow.com/comment/52207157
upvote count: 3
has comment: http://stackoverflow.com/comment/33166164
type: UnansweredQuestion
downvote count: 2
has title: How does HashMap work with two objects with same hash code
linked to: http://stackoverflow.com/q/6493605
score: 1

http://stackoverflow.com/q/21913352
has body: I have shapes that use the Area class to represent its structure. I want to check whether a segement determined by two Points (start point and end point) intersects with Area. Such that segments start and end point are outside the Area (not considering partial line through the area). The Area class has methods that check is Rectangle2D intersects the area but not a line http://docs.oracle.com/javase/7/docs/api/java/awt/geom/Area.html Any suggestions or should I try a diffrent approach?
score: 0
has answer: http://stackoverflow.com/a/21919994
has answer: http://stackoverflow.com/a/21926419
type: UnansweredQuestion
tagged with: shapes
tagged with: java
has title: Shape Intersection
type: Question
answer count: 2

http://stackoverflow.com/comment/33344061
type: Comment
has text: Was he attempting to "catch" JavaScript exceptions or are there JSP evaluations within the try/catch block that could throw exceptions?
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21999970

http://stackoverflow.com/q/21888202
has title: how java application can communicate with android application?
downvote count: 2
has body: how java application can communicate with android application(ex.sending file between two app) by WiFi i try to develop a java application that can send types of files to android application
tagged with: java
has answer: http://stackoverflow.com/a/21888245
type: Question
upvote count: 0
score: -2
answer count: 1
favorite count: 0
tagged with: android
type: UnansweredQuestion

http://stackoverflow.com/comment/33075999
has text: I ve got temp which is List<Feature> type and I wanto to add all these temp Lists into a 2s List.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21850539

http://stackoverflow.com/comment/33274010
has text: so do i change the php file?
comment on: http://stackoverflow.com/q/21960522
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21979662
accepted answer: http://stackoverflow.com/a/21979787
type: Question
tagged with: arrays
tagged with: optimization
tagged with: arraylist
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21979787
has title: How to organize data for usage by another object?
has body: I have a file that contains sales data like this: 2554.22,5321.12,323.29,8283.11,1923.26,6632.46,1104.42 . . . n So the file could contain n number of lines. I need to read the file using a Scanner object and calculate daily, weekly, and the average sales for a given day or week. So far I've designed it like this: Data class: public class SalesData { private float[] sales; public SalesData(float[] sales) { this.sales = sales; } public float getTotalSales() { float totalSales = 0.0; for(float sale : sales) { totalSales += sale; } return totalSales; } public float getAverageSales() { return getTotalSales / salesData.length; } } I'm having trouble with my SalesUtil class. I'm not sure how to get the data from each line and store it in an array so that I can instantiate my SalesData class. I'm trying to use ArrayList, but I got lost. I'm not sure if I'm even going down the right path. Any tips are greatly appreciated. public class SalesUtil { public List&lt;String&gt; readSalesFile() { List&lt;String&gt; salesAsString = new ArrayList&lt;String&gt;(); Scanner keyboard = new Scanner(System.in); System.out.println("Enter sales file name: "); String salesFile = keyboard.nextLine(); try { Scanner scanFile = new Scanner(new File(salesFile)); while(scanFile.hasNext()) { salesAsString.add(scanFile.nextLine()); } catch(FileNotFoundException fnfe) { System.out.println("Invalid file name supplied, please try again."); readSalesFile(); } return salesAsString; } public List&lt;Float&gt; parseSalesFile(List&lt;String&gt; salesFile) { List&lt;Float&gt; salesAsFloat = new ArrayList&lt;Float&gt;(); } }
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/33074525
score: 0
comment on: http://stackoverflow.com/a/21849407
type: Comment
has text: Can you provide the fully qualified class name for `JSONObject`. I assumed you are using [org.json](http://www.json.org/javadoc/org/json/JSONObject.html#get%28java.lang.String%29) library.
type: AnswerComment

http://stackoverflow.com/a/21925506
upvote count: 17
answers question: http://stackoverflow.com/q/21924918
type: AcceptedAnswer
downvote count: 0
has body: From spec Enum literals support the use of Java enum literal syntax. The fully qualified enum class name must be specified. select u from User u where u.Permission = XX.XX.Permission.APPROVE Try this one. String jpql = "select u from User u join u.permission p" + " where p = :enumeration"; Query query = em.createQuery(jpql); query.setParameter("enumeration", XX.XX.Permission.APPROVE);
type: Answer
score: 17
accepted answer of: http://stackoverflow.com/q/21924918

http://stackoverflow.com/comment/33219043
type: AnswerComment
type: Comment
has text: first call: s2 is ELIVE then the next call happens with s2=ELIVE as given parameter. then while 2nd call s2 is created als LIV but it didnt go into the if block because it checks if the given string(ELIVE) is <= 3 and not the substring s2. Then the method is called once again with s2=LIV as parameter. now while the 3rd call it will go into the if block because LIV <= 3 and the it will return VIL the secound call will return E+VIL+E then third call will return D+EVILE+R and then the sentence i am callerDEVILER is printed.
comment on: http://stackoverflow.com/a/21930076
score: 0

memoization
type: Tag
tags question: http://stackoverflow.com/q/21951612
tag name: memoization

http://stackoverflow.com/a/21845781
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/21845189
accepted answer of: http://stackoverflow.com/q/21845189
has body: I set the [xyz] and all other JSF Managed Bean and their contained variables to Serializable. The error went away. I'm left puzzled as to why the application worked with out the Serializable JSF Managed Bean on someone else's computer but not mine. After further research, I found my JBoss EAP 6.1 has been configured for Infinispan (http://infinispan.org/), and it was caching the session objects. Because these objects were not Serializable, it couldn't store them and hence throwing the error. With the old cold, the errors went away as soon as I removed the Inifispan configuration in jboss.
upvote count: 3
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/33142013
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21885622
score: 2
has text: It is absolutely not clear why you can't use binding annotations. Please expand on that part. And BTW your annotations example is wrong. Annotating local variables and assigning them with `Injector.getInstance()` call will do nothing. You'll have to use `Key` class for that.

http://stackoverflow.com/a/21969608
downvote count: 0
answers question: http://stackoverflow.com/q/21969573
type: AcceptedAnswer
upvote count: 2
type: Answer
has body: You can just do: textView.setTextColor(Color.RED);
score: 2
has comment: http://stackoverflow.com/comment/33289647
accepted answer of: http://stackoverflow.com/q/21969573

http://stackoverflow.com/comment/33322554
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21987675
score: 1
has text: thats correct; in spring 3.1.0 spring-test-mvc wasn't implemented like in 3.2 and therefor I used the stand alone project (https://github.com/spring-projects/spring-test-mvc)

http://stackoverflow.com/a/21904613
accepted answer of: http://stackoverflow.com/q/21895605
score: 1
answers question: http://stackoverflow.com/q/21895605
has body: This should be a suitable model for your entities: @NodeEntity class Point { @GraphId protected Long id; @RelatedToVia(type="NEXT") Set&lt;Edge&gt; edges; } @NodeEntity class Line { @GraphId protected Long id; @RelatedTo(type="ROOT") Point root; } @RelationshipEntity public class Edge { @GraphId protected Long id; @StartNode private Point from; @EndNode private Point to; @RelatedTo(type="LINE") Line line; } It easily allows both programmatic navigation in Java as in: Set edges = line.getPoint().getEdges(); for (Edge edge: edges) { if (edge.getLine().getId() == id) { ... } } or Cypher queries like the one you listed.
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/33205079
downvote count: 0

http://stackoverflow.com/a/21972107
accepted answer of: http://stackoverflow.com/q/21971218
has body: When using sigar's API you must add the log4j.jar and sigar.jar to your class-path. But also you need to add sigar-amd64-winnt.dll, sigar-x86-winnt.dll, and sigar-x86-winnt.lib to the final folder with the final build otherwise Sigar will not work properly.
answers question: http://stackoverflow.com/q/21971218
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/21967512
has comment: http://stackoverflow.com/comment/33286224
has comment: http://stackoverflow.com/comment/33437748
has comment: http://stackoverflow.com/comment/33455445
has body: I think that the way to go here from a code-compileability and readability perspective is to use a simple data-wrapper class holding a one-dimensional array, and then let your main-code use a one-dimensional array of instances of said data-wrapper class. public class MyBytePacket { private byte [] data; //Constructors and getters as needed } And then from main code; MyBytePacket [] packets = new MyBytePacket[10]; That way, you can see how many packets you have, as well as how many bytes each packet has, keeping your desired 2D-aspect, but in a more Java-friendly manner.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21967181
has comment: http://stackoverflow.com/comment/33457195
has comment: http://stackoverflow.com/comment/33311810

http://stackoverflow.com/comment/33093111
has text: Where the web app *lives* isn't relevant; the server will behave the same way. There is no direct access to your app's classes from the outside world, where "outside" means "not your web app". That would be disastrous. You could *expose* classes through your webapp itself.
comment on: http://stackoverflow.com/q/21859378
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33279686
type: Comment
comment on: http://stackoverflow.com/a/21964082
has text: yes in the context of your question that what you need to do. Say we have 3 functions :func1 , func2, func3 & if I want to use func1 & func2 in the function func3 , then order of declaration should be as follows : void func1(){} void func2(){} void func3(){ func1(); func2(); }
score: 0
type: AnswerComment

http://stackoverflow.com/a/21985427
has comment: http://stackoverflow.com/comment/33316978
has comment: http://stackoverflow.com/comment/33317026
has body: A priority queue is already a heap, so it does not need a heapify method. This method is usually implemented on structures which are not heaps. So just add/remove elements to/from your queue and just assume you have the max elements at position 0 (at the root).
downvote count: 1
has comment: http://stackoverflow.com/comment/33317229
type: Answer
answers question: http://stackoverflow.com/q/21985370
upvote count: 4
has comment: http://stackoverflow.com/comment/112649864
score: 3
has comment: http://stackoverflow.com/comment/46291279

http://stackoverflow.com/a/21972893
answers question: http://stackoverflow.com/q/21972572
type: Answer
score: 1
upvote count: 2
has body: I'll give it a go. Version with a loop then with a stream. Although I start from the other end so it's easier because I can limit(1). public class Problem0004 { public static void main(String[] args) { int maxNumber = 999 * 999; //with a loop for (int i = maxNumber; i &gt; 0; i--) { if (isPalindrome(i) &amp;&amp; has3DigitsFactors(i)) { System.out.println(i); break; } } //with a stream IntStream.iterate(maxNumber, i -&gt; i - 1) .parallel() .filter(i -&gt; isPalindrome(i) &amp;&amp; has3DigitsFactors(i)) .limit(1) .forEach(System.out::println); } private static boolean isPalindrome(int n) { StringBuilder numbers = new StringBuilder(String.valueOf(n)); return numbers.toString().equals(numbers.reverse().toString()); } private static boolean has3DigitsFactors(int n) { for (int i = 999; i &gt; 0; i--) { if (n % i == 0 &amp;&amp; n / i &lt; 1000) { return true; } } return false; } }
downvote count: 1

http://stackoverflow.com/a/21989111
accepted answer of: http://stackoverflow.com/q/21988660
answers question: http://stackoverflow.com/q/21988660
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33325327
upvote count: 3
has body: Begin with an empty field. Bisect the field with a wall, either horizontally or vertically. Add a single passage through the wall. Repeat step #2 with the areas on either side of the wall. Continue, recursively, until the maze reaches the desired resolution. Jamis Buck on Maze Generation: Recursive Backtracking
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/33323640
score: 3

http://stackoverflow.com/comment/33150612
score: 0
comment on: http://stackoverflow.com/a/21886459
has text: No wait, I made som tweeks it works perfectly now! Thanks alot! <3
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33199885
comment on: http://stackoverflow.com/a/21918358
type: Comment
has text: Try `if(wsp==null) { System.out.println("wsp is null"); }` If wsp isn't null, either the parameters you are feeding to wsp.getAttributeValue are null, or the null exception is being thrown from within the function wsp.getAttributeValue, in which case you'll have to find a different library to use unless you have the code for that.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33258347
type: AnswerComment
comment on: http://stackoverflow.com/a/21922297
score: 0
type: Comment
has text: Heh- not sure how anyone used to code before the internet! ;)

http://stackoverflow.com/comment/33137123
has text: Thank you, your suggestion worked
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21870869

http://stackoverflow.com/q/21872098
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21872638
has answer: http://stackoverflow.com/a/21872450
answer count: 4
score: -1
has answer: http://stackoverflow.com/a/21872446
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21872437
tagged with: java
has comment: http://stackoverflow.com/comment/33115144
upvote count: 0
linked to: http://stackoverflow.com/q/12086115
favorite count: 0
has title: can variables call methods in java language
has body: my question is: Can variables in java call method like this example: private void test(Rabbit rabbit, byte[] key, byte[] iv, byte[] data) { byte[] crypt = rabbit.crypt(data.clone());} as i know, data is a variable and it calls clone() method. does data variable or no.

http://stackoverflow.com/a/21974490
has body: You can use System.exit(...) to exit and a plain old Java Timer to schedule it for 10 seconds in the future. The code is pretty minimal: new Timer().schedule(new TimerTask() { public void run () { System.exit(0); } }, 10000); // now show message.
has comment: http://stackoverflow.com/comment/33298058
has comment: http://stackoverflow.com/comment/33335115
downvote count: 0
answers question: http://stackoverflow.com/q/21974415
has comment: http://stackoverflow.com/comment/33336076
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/q/21986089
has comment: http://stackoverflow.com/comment/33318871
has title: Neo4j allPaths giving performance issue
answer count: 0
downvote count: 0
tagged with: neo4j
score: 1
has body: I have used following code to get all paths between source and sink node final PathFinder&lt;Path&gt; paths = GraphAlgoFactory.allPaths(expander, 20); for (Path allPaths : paths.findAllPaths(source, target)) { list.add(allPaths); } return list; But it is not returning response and it consuming huge memory and after some time servers is not responding to other threads. Please suggest batter cost effect query for these type graph traversal.
has comment: http://stackoverflow.com/comment/33322042
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/33324713
has comment: http://stackoverflow.com/comment/33493359
has comment: http://stackoverflow.com/comment/33325260
upvote count: 1
has comment: http://stackoverflow.com/comment/33324906
tagged with: java
tagged with: traversal
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33319515

http://stackoverflow.com/q/21998027
answer count: 2
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33340232
has body: String prompt; boolean promptB; runLoop: do{ Scanner input = new Scanner (System.in); System.out.println("Enter a number, a space and F to convert from degF to degC and C to convert to degC to degF"); if(input.hasNextDouble()){ double deg = input.nextDouble(); String letter = input.next().toUpperCase(); char dg = letter.charAt(0); tempLoop: if( dg == 'C' || dg == 'c'){ double cTemp= (double)(deg-32)*(5.0/9.0); System.out.printf("%f degC converted to degF is %.2f%n ", deg, cTemp ); } else if(dg == 'F' || dg == 'f'){ double fTemp = (double) (deg*9/5) + 32; System.out.printf("%f degF converted to degC is %.2f%n ", deg, fTemp ); } else{ System.out.println("That character does not correspond to a valid unit of measure "); break tempLoop; } do{ System.out.println("Would you like to continue?(yes/no)"); prompt = input.next().toLowerCase(); if(prompt.equals("yes")){ promptB = false; } else if (prompt.equals("no")){ promptB = false; break; }else{ promptB = true; System.out.println("Would you like to continue? yes or no"); prompt = input.next(); } }while(promptB); } else{ System.out.println("must enter in a valid number for degrees"); break runLoop; } }while(prompt.equalsIgnoreCase("yes")); } } Here is the code I currently have. I cannot figure out how to re execute the runLoop: if the input.hasNextDouble() is not true or the user has input letters instead of a double. any info ideas are greatly welcomed
has answer: http://stackoverflow.com/a/21998245
has comment: http://stackoverflow.com/comment/33438446
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/33340347
upvote count: 1
has answer: http://stackoverflow.com/a/21998324
type: Question
score: -2
has title: Why won't my break work in my java loop

http://stackoverflow.com/q/21962886
possible better answer: http://stackoverflow.com/a/21963184
type: Question
linked to: http://stackoverflow.com/q/8701716
duplicate of: http://stackoverflow.com/q/16046544
has answer: http://stackoverflow.com/a/21963043
accepted answer: http://stackoverflow.com/a/21963043
score: 0
has body: Here is my code import java.awt.*; import javax.swing.*; import java.awt.Color; import javax.swing.JPanel; public class FirstFrame extends JFrame { //FirstFrame properties public FirstFrame(){ setTitle ("Stacker"); setSize (380,650); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible (true); setUndecorated (true); setResizable(false); } public static void main (String[] args){ new FirstFrame(); } } I'm trying to remove the toolbar above because I want to put buttons in the frame that will contain exit, and play button. Hope you can help me!
has title: how to remove the title bar in jframe?
linked to: http://stackoverflow.com/q/16046544
has answer: http://stackoverflow.com/a/21962894
has answer: http://stackoverflow.com/a/21963184
favorite count: 0
tagged with: jframe
answer count: 5
has answer: http://stackoverflow.com/a/21962947
has answer: http://stackoverflow.com/a/21962899
duplicate of: http://stackoverflow.com/q/8701716
type: AnsweredQuestion
upvote count: 3
tagged with: java
downvote count: 3
tagged with: swing

http://stackoverflow.com/q/21868380
answer count: 0
score: 1
tagged with: java
upvote count: 1
has body: I have a class variable in the Reducer class: public static class ReduceClass extends Reducer&lt;Text, IntWritable, Text, IntWritable&gt; { int N = 0; @Override public void reduce(Text key, Iterable&lt;IntWritable&gt; values, Context context) throws IOException, InterruptedException { int sum = 0; for (IntWritable value : values) { sum += value.get(); } if (key.equals(something)) { N += sum; } else { if(N &gt; 0) context.write(key, new IntWritable(N)); else //write something else } } } However, even thought the 'key.equals(something)' satisfies (it does at least once, definitely), N is always 0 between reduce function calls. Interesting thing is, that if I add 'N++' to the beginning of the function, the value of N does increment between reduce calls - but 'N+=sum' doesn't affect at all! Like it never executes. What am I doing wrong? I just need N to keep it's value between reduce calls. Per-Reducer, of course. TIA.
type: Question
tagged with: hadoop
tagged with: local
has comment: http://stackoverflow.com/comment/33109232
downvote count: 0
tagged with: variables
favorite count: 0
has comment: http://stackoverflow.com/comment/33109035
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33125200
has title: hadoop reducer local variable always initialize

http://stackoverflow.com/comment/33275638
has text: Thanks for the answer. To add more detail to my question... We get suggestions like 'why don't we have one DAO per module' and 'lets make do with hashmaps instead of DTOs for some less important tables'. I would think I shouldn't have to mess up my domain model but I need some good justification either way. Also, there is a philosophy of making every concept a class... For example account no can be a class with a single member String.
type: Comment
comment on: http://stackoverflow.com/a/21961452
score: 0
type: AnswerComment

http://stackoverflow.com/q/21905747
has answer: http://stackoverflow.com/a/21905807
has answer: http://stackoverflow.com/a/21905814
has answer: http://stackoverflow.com/a/21905915
has answer: http://stackoverflow.com/a/21905853
tagged with: increment
has comment: http://stackoverflow.com/comment/33175032
has answer: http://stackoverflow.com/a/21905818
has comment: http://stackoverflow.com/comment/33175305
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21905818
tagged with: java
has title: Increment and Decrement operators in java
type: Question
accepted answer: http://stackoverflow.com/a/21905853
answer count: 8
has answer: http://stackoverflow.com/a/21905855
has answer: http://stackoverflow.com/a/21906299
has answer: http://stackoverflow.com/a/21905835
has body: I had questions about incremental and decremental operators.I couldn't understand why java gave these outputs. x = 5; y = 10; System.out.println(z = y *= x++); // output is 50 x = 2; y = 3; z = 4; System.out.println("Result = "+ z + y++ * x); // output is Result = 46 x = 5; System.out.println( x++*x); // output is 30 x = 5; System.out.println( x*x++); // output is 25 For example, in 2nd println function y is multiplicated without increasing 1 and in 3rd function x is multiplicated with x+1. As I know unary increment and unary decrement operators have higher precedence than arithmetic operators so why second one calculated without increasing 1( y++ * x = 3*2 = 6 there and why not (y+1) * x = 8 ?
score: 0
tagged with: operator-keyword
has comment: http://stackoverflow.com/comment/33175068
tagged with: decrement

http://stackoverflow.com/a/21956634
score: 8
upvote count: 8
accepted answer of: http://stackoverflow.com/q/21956608
answers question: http://stackoverflow.com/q/21956608
has body: No, if you want to have both a parameterless constructor and a constructor with parameters, you need to declare them both. It's very easy to declare the parameterless constructor though: public YourClassName() { } The super(); is implicit. That will behave exactly the same way as the default constructor would, although it won't necessarily have the same access as the default constructor. (You can change it from being public if you want, of course.) From the JLS section 8.8.9: If a class contains no constructor declarations, then a default constructor with no formal parameters and no throws clause is implicitly declared. If the class being declared is the primordial class Object, then the default constructor has an empty body. Otherwise, the default constructor simply invokes the superclass constructor with no arguments. It is a compile-time error if a default constructor is implicitly declared but the superclass does not have an accessible constructor (§6.6) that takes no arguments and has no throws clause. In a class type, if the class is declared public, then the default constructor is implicitly given the access modifier public (§6.6); if the class is declared protected, then the default constructor is implicitly given the access modifier protected (§6.6); if the class is declared private, then the default constructor is implicitly given the access modifier private (§6.6); otherwise, the default constructor has the default access implied by no access modifier.
has comment: http://stackoverflow.com/comment/33265987
has comment: http://stackoverflow.com/comment/33265961
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/21845383
favorite count: 0
upvote count: 2
downvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has body: I want to remove the substring between \n from a string if it contains "FALSE" keyword.. mainString = "hi my name is john \n I am a architect \n hello FALSE \n have a nice day \n" I want to remove "\n hello FALSE \n". I tried string.replace but no success..
tagged with: substring
has answer: http://stackoverflow.com/a/21845439
type: Question
has answer: http://stackoverflow.com/a/21845539
has title: How to remove substring between \n from a string in java
has answer: http://stackoverflow.com/a/21845517
has comment: http://stackoverflow.com/comment/33067369
answer count: 3
possible better answer: http://stackoverflow.com/a/21845539
accepted answer: http://stackoverflow.com/a/21845439

http://stackoverflow.com/comment/33332542
type: Comment
comment on: http://stackoverflow.com/q/21992985
score: 0
has text: @PeterRader i tried both - win desktop and linux server. Both 64b
type: QuestionComment

http://stackoverflow.com/q/21870263
possible better answer: http://stackoverflow.com/a/21870444
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33112424
has comment: http://stackoverflow.com/comment/33112249
has answer: http://stackoverflow.com/a/21870444
tagged with: android
has comment: http://stackoverflow.com/comment/33112132
type: AnsweredQuestion
tagged with: java
has title: Android Java: Diaglog setText & getText issue
has answer: http://stackoverflow.com/a/21870504
accepted answer: http://stackoverflow.com/a/21870504
tagged with: eclipse
has body: I have a dialog bux which opens when an textView is selected. The dialog box contains an editText. What i want to do is be able to type a sting into the editText, and when the 'Done' button is pressed it will store the string from the editText to a variable in which it can be viewed via the original textView. My souce code is correct according to eclipse. however when i run it on my android phone, it crashes. I know that the reason for this is the OnClick Listner. Below is my souce code: public class MainActivity extends Activity { /** Called when the activity is first created. */ TextView showPopUpButton;//NEW EditText getInput;//NEW @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); showPopUpButton = (TextView) findViewById(R.id.buttonShowPopUp);//NEW getInput = (EditText) findViewById(R.id.editText1);//NEW showPopUpButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showPopUp3(); } }); } private void showPopUp3() { AlertDialog.Builder helpBuilder = new AlertDialog.Builder(this); helpBuilder.setTitle("Enter your string"); LayoutInflater inflater = getLayoutInflater(); View checkboxLayout = inflater.inflate(R.layout.popuplayout, null); helpBuilder.setView(checkboxLayout); helpBuilder.setPositiveButton("Done", new DialogInterface.OnClickListener() { TextView showPopUpButton;//NEW EditText getInput;//NEW public void onClick(DialogInterface dialog, int which) { // THIS IS SUPPOSED TO STORE THE VALUE OF THE EDIT-TEXT AND OUTPUT IT IN THE TEXTVIEW showPopUpButton = (TextView) findViewById(R.id.buttonShowPopUp);//NEW showPopUpButton.setText(getInput.getText());//NEW** } }); AlertDialog helpDialog = helpBuilder.create(); helpDialog.show(); } } Thanks guys, i know this solution is possible easy, im just missing something small. Thanks

http://stackoverflow.com/a/21888037
type: Answer
accepted answer of: http://stackoverflow.com/q/21887756
has body: By looking over HERE in Documention, the LineUnavailableException arises when the line is not Available, or the requested resource is in use by Another Application, Make Sure that your audio file is not open in any other application. EDIT As the error message says :line with format PCM_SIGNED 48000.0 Hz, 24 bit, mono, 3 bytes/frame the file format you are providing is not supported. and as you said I tried to play a file by passing a URL and it works fine, put the Old file back and check the file format by using System.out.println(audio.getFormat()); and check what was the file format of that file , whether that was same to the above _line with format PCM_SIGNED 48000.0 Hz, 24 bit, mono, 3 _ or not,
answers question: http://stackoverflow.com/q/21887756
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33156539
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/33146324
comment on: http://stackoverflow.com/q/21889247
score: 0
has text: that's because findViewById is a method from Activity.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23563523
score: 0
type: Answer
has body: &lt;jx:forEach items="${data.subjects}" var="subject"&gt; ${subject.name} &lt;jx:forEach items="${subject}" var="group"&gt; ${group.name} &lt;jx:forEach items="${group}" var="student"&gt; ${student.name} &lt;/jx:forEach&gt; &lt;/jx:forEach&gt; &lt;/jx:forEach&gt; each in different cells
answers question: http://stackoverflow.com/q/21947180

http://stackoverflow.com/comment/33316209
type: QuestionComment
comment on: http://stackoverflow.com/q/21984963
has text: There are various problems here: 1) You're not closing your stream if an exception is thrown; 2) You're using the default character encoding, which is usually the wrong choice; 3) You're *assuming* that `InputStream.read` will read the whole of your file in one go; 4) We have no idea how big your file is.
score: 4
type: Comment

http://stackoverflow.com/comment/33158695
has text: Please ignore the T3, I renamed the file to Test makes it easier to understand
comment on: http://stackoverflow.com/q/21893223
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/27415787
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/98891917
has body: It took me couple of hours to fix the problem. I was using the wrong BindingProviderProperties interface. The BindingProviderProperties interface exists in two different packages. (for different Java/JAX-WS versions) If you are getting ClassCastException most probably you need import different package in your soap service class. change import com.sun.xml.ws.client.BindingProviderProperties; to import com.sun.xml.internal.ws.client.BindingProviderProperties;
has comment: http://stackoverflow.com/comment/68954235
has comment: http://stackoverflow.com/comment/75875855
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21887979

http://stackoverflow.com/a/21871122
has comment: http://stackoverflow.com/comment/33113606
score: 0
type: Answer
has body: Gender can't be both m and f.. use || in your while. .. And change your while to an if! if ((gender == 'm') || (gender == 'f')) You'll need to loop at a higher level if you dont want the program to exit.
has comment: http://stackoverflow.com/comment/33113540
has comment: http://stackoverflow.com/comment/33113861
has comment: http://stackoverflow.com/comment/33113691
answers question: http://stackoverflow.com/q/21871087
has comment: http://stackoverflow.com/comment/33114024
has comment: http://stackoverflow.com/comment/33113805
has comment: http://stackoverflow.com/comment/33114494

runnable
tags question: http://stackoverflow.com/q/21934649
type: Tag
tags question: http://stackoverflow.com/q/21979639
tags question: http://stackoverflow.com/q/21929529
tags question: http://stackoverflow.com/q/21960407
tags question: http://stackoverflow.com/q/21981817
tags question: http://stackoverflow.com/q/21907651
tag name: runnable

http://stackoverflow.com/q/21862588
has answer: http://stackoverflow.com/a/21863060
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21863060
type: Question
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/8061314
has comment: http://stackoverflow.com/comment/33097985
has comment: http://stackoverflow.com/comment/33098298
has title: How to set checkbox in arrayList checked with certain condition?
has comment: http://stackoverflow.com/comment/33097839
tagged with: arraylist
has comment: http://stackoverflow.com/comment/33097891
tagged with: android
tagged with: checkbox
has comment: http://stackoverflow.com/comment/33097981
has body: I have an arrayList in Custom Adapter, consisting of some strings and checkbox. and i want to set checkbox checked automatically with certain condition, but how to set the code so the checkbox checked automatically. public LazyAdapter(Activity a, ArrayList&lt;HashMap&lt;String, String&gt;&gt; d) { activity = a; data = d; inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public View getView(int position, View convertView, ViewGroup parent) { View vi = convertView; if(convertView == null) vi = inflater.inflate(R.layout.list_row, null); TextView no = (TextView)vi.findViewById(R.id.txt_no); TextView code = (TextView)vi.findViewById(R.id.txt_code); TextView name = (TextView)vi.findViewById(R.id.txt_asset); TextView dept = (TextView)vi.findViewById(R.id.txt_dept); CheckBox status = (CheckBox)vi.findViewById(R.id.cb_stat); HashMap&lt;String, String&gt; asset = new HashMap&lt;String, String&gt;(); asset = data.get(position); //Setting all values in listview no.setText(asset.get(ListLocationActivity.KEY_NO)); code.setText(asset.get(ListLocationActivity.KEY_CODE)); name.setText(asset.get(ListLocationActivity.KEY_NAME)); dept.setText(asset.get(ListLocationActivity.KEY_DEPT)); return vi; } This is my condition when i get the result, i want set checked the checkbox which the result suitable with the code in arraylist for (int i = 0; i &lt; assetList.size(); i++) { if (assetList.get(i).get(KEY_CODE).equals(scanAsset)){ //set checked in certain list asset //(Here i confused how i can set the checkbox in list suitable with the code asset) Log.i("Asset code is ", scanAsset); } } this code is work fine without set value in checkbox, Anyone can help me to solve this case, please . . . . Thank you before
has answer: http://stackoverflow.com/a/21863084
accepted answer: http://stackoverflow.com/a/21863084

http://stackoverflow.com/q/21919005
linked to: http://stackoverflow.com/q/5245840
has title: Convert a string to JSON array JAVA
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/9605913
accepted answer: http://stackoverflow.com/a/21919566
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 3
has comment: http://stackoverflow.com/comment/33199072
has comment: http://stackoverflow.com/comment/33199205
type: Question
has body: I have this string which ive validated as JSON: {"listings":[{"Listing_ID":"1","Event_ID":"1","Venue_ID":"1","Start_Date":"19\/11\/2013","End_Date":"04\/01\/2014","Frequency":"Every Day"},{"Listing_ID":"2","Event_ID":"1","Venue_ID":"4","Start_Date":"20\/01\/2014","End_Date":"21\/01\/2014","Frequency":"Every 2 Da"},{"Listing_ID":"3","Event_ID":"3","Venue_ID":"4","Start_Date":"22\/01\/2014","End_Date":"23\/01\/2014","Frequency":"Every Day"}]} And i wish to convert it into a JSON array. Ive read around and believe i first have to turn it into an object but im struggling to find a solution. Any help would be much appreciated.
tagged with: arrays
score: -1
tagged with: android
answer count: 1
favorite count: 0
upvote count: 2
linked to: http://stackoverflow.com/q/9605913
has answer: http://stackoverflow.com/a/21919566

http://stackoverflow.com/comment/33278822
type: QuestionComment
has text: Hey paul, I'm checking it will let you know!
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21951094

netbeans
tags question: http://stackoverflow.com/q/21875238
tags question: http://stackoverflow.com/q/21871524
tags question: http://stackoverflow.com/q/21950077
tags question: http://stackoverflow.com/q/21984878
tags question: http://stackoverflow.com/q/21954118
tags question: http://stackoverflow.com/q/21991575
tags question: http://stackoverflow.com/q/21914871
tags question: http://stackoverflow.com/q/21955816
tags question: http://stackoverflow.com/q/21940067
tags question: http://stackoverflow.com/q/21953532
tags question: http://stackoverflow.com/q/21933106
tags question: http://stackoverflow.com/q/21873275
tags question: http://stackoverflow.com/q/21872461
tags question: http://stackoverflow.com/q/21945368
tags question: http://stackoverflow.com/q/21966357
tags question: http://stackoverflow.com/q/21909656
tags question: http://stackoverflow.com/q/21964302
tags question: http://stackoverflow.com/q/21904443
tags question: http://stackoverflow.com/q/21883004
tags question: http://stackoverflow.com/q/21956374
tags question: http://stackoverflow.com/q/21873832
tags question: http://stackoverflow.com/q/21852382
tags question: http://stackoverflow.com/q/21895560
tags question: http://stackoverflow.com/q/21890754
tags question: http://stackoverflow.com/q/21885526
type: Tag
tags question: http://stackoverflow.com/q/21848744
tags question: http://stackoverflow.com/q/21890101
tags question: http://stackoverflow.com/q/21875171
tags question: http://stackoverflow.com/q/21852450
tags question: http://stackoverflow.com/q/21894728
tags question: http://stackoverflow.com/q/21956330
tags question: http://stackoverflow.com/q/21956260
tags question: http://stackoverflow.com/q/21932200
tags question: http://stackoverflow.com/q/21886421
tags question: http://stackoverflow.com/q/21971528
tags question: http://stackoverflow.com/q/21979140
tags question: http://stackoverflow.com/q/21972355
tags question: http://stackoverflow.com/q/21973533
tags question: http://stackoverflow.com/q/22001966
tags question: http://stackoverflow.com/q/21844669
tags question: http://stackoverflow.com/q/21873935
tags question: http://stackoverflow.com/q/21974366
tags question: http://stackoverflow.com/q/21960486
tags question: http://stackoverflow.com/q/21900222
tags question: http://stackoverflow.com/q/21919837
tags question: http://stackoverflow.com/q/21988426
tags question: http://stackoverflow.com/q/21898425
tags question: http://stackoverflow.com/q/21885196
tags question: http://stackoverflow.com/q/21865266
tags question: http://stackoverflow.com/q/21879764
tags question: http://stackoverflow.com/q/21912699
tags question: http://stackoverflow.com/q/21988039
tag name: netbeans
tags question: http://stackoverflow.com/q/21914135
tags question: http://stackoverflow.com/q/21907659
tags question: http://stackoverflow.com/q/21898053
tags question: http://stackoverflow.com/q/21978404
tags question: http://stackoverflow.com/q/21928972
tags question: http://stackoverflow.com/q/21931880
tags question: http://stackoverflow.com/q/21947803

http://stackoverflow.com/comment/33217414
type: Comment
has text: i have main method in different class, and progress bar code is also there only.. that is, i am creating an object of PropertyFilesReader class and invoking the method AutoTPparam() with this object in different class file,where main method lies...and i want to use progress bar there...so, how can i use above cited technique of urs...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21928312

http://stackoverflow.com/a/21977272
upvote count: 4
accepted answer of: http://stackoverflow.com/q/21977252
answers question: http://stackoverflow.com/q/21977252
has body: You don't set the screen variable to anything, so it is initialized to null and you get an exception when you try to call a null's method. You should add screen = (TextView) findViewById(R.id.textView); before this statement.
downvote count: 0
type: AcceptedAnswer
score: 4
type: Answer

http://stackoverflow.com/a/21922865
has comment: http://stackoverflow.com/comment/33235651
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33329080
has body: In String[] doInBackground(Void... params) { you are supposed to return a String array. So create one String arr [] = new String [2]; and then add the result of getValuesGraph() to it. arr[0] = getValuesGraph(doc); arr[1] = getValuesFooter(doc); then return then arr
type: Answer
accepted answer of: http://stackoverflow.com/q/21922766
has comment: http://stackoverflow.com/comment/33302112
answers question: http://stackoverflow.com/q/21922766

http://stackoverflow.com/a/21950733
has body: It probably throw for your a variable because you want to get its class function which is not defined.
type: Answer
has comment: http://stackoverflow.com/comment/33255720
answers question: http://stackoverflow.com/q/21950684
has comment: http://stackoverflow.com/comment/33255690
score: 0

http://stackoverflow.com/q/21958377
type: AnsweredQuestion
score: 1
tagged with: java
has body: I am new to android and developing a test application to hit the server and get the json response. Here is my main activity- public class MainPageActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.welcome_layout); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.options_menu, menu); MenuItem searchItem = menu.findItem(R.id.search); SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { return false; } @Override public boolean onQueryTextSubmit(String query) { new DownloadWebpageTask().doInBackground("http://49.139.144.194:8080/ServerForMyAndroid/MusicServlet"); return false; } }; searchView.setOnQueryTextListener(queryTextListener); return super.onCreateOptionsMenu(menu); } } And AsyncTask class is- public class DownloadWebpageTask extends AsyncTask&lt;String, Void, String&gt; { @Override protected void onPostExecute(String result) { ResultMainVO resultVO = new Gson().fromJson(result, ResultMainVO.class); System.out.println("test" + resultVO); } @Override protected String doInBackground(String... urls) { InputStream is = null; StringBuilder builder = new StringBuilder(); try { URL url = new URL(urls[0]); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(10000 /* milliseconds */); conn.setConnectTimeout(15000 /* milliseconds */); conn.setRequestProperty("Accept", "*/*"); conn.setDoInput(true); conn.connect(); is = conn.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); String line; while ((line = reader.readLine()) != null) { builder.append(line); } } catch (IOException e) { e.printStackTrace(); } finally { if (is != null…
accepted answer: http://stackoverflow.com/a/21958415
upvote count: 1
type: Question
downvote count: 0
answer count: 1
has title: NetworkOnMainThreadException inspite of AsyncTask
favorite count: 0
tagged with: android-asynctask
tagged with: android
has answer: http://stackoverflow.com/a/21958415

http://stackoverflow.com/q/21930921
answer count: 1
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/21931073
tagged with: mysql
type: Question
tagged with: java
tagged with: javascript
has title: remove the record from mysql based on time
has body: I am working with google maps. When i select any location on the map, it gives lat, long values. Additionally I am adding two more columns time( 2014-02-21 12:36:08),and expected time(10 minutes). I am inserted all these values into mysql database. I am trying to delete the records which matches condition ( (record insert time + expected time) > current time ), which means the sum is greater than current system time the record has to delete automatically, it is not endless if expected time may be change in feature. Please give me any ideas.
accepted answer: http://stackoverflow.com/a/21931073

http://stackoverflow.com/q/21893325
favorite count: 0
tagged with: deadlock
has comment: http://stackoverflow.com/comment/33153855
possible better answer: http://stackoverflow.com/a/21893652
has answer: http://stackoverflow.com/a/21893496
tagged with: sockets
has answer: http://stackoverflow.com/a/21893652
has answer: http://stackoverflow.com/a/21893816
answer count: 4
type: AnsweredQuestion
has title: Multithreading deadlocks in Java
has comment: http://stackoverflow.com/comment/33154139
tagged with: multithreading
upvote count: 1
has body: I am writing a bot in Java for a game. One thread manages time for the Manager and Worker threads and sends heartbeats for them. Manager collects and interprets messages from the server, and the Worker threads receive commands from the Manager (with detailed information in classes) and acts on this information. Right now, I'm having trouble with multithreading deadlocks and I'm not sure if there is an alternative. Here are some methods in my manager class: I call getMessageFromUsername from the GUI thread when the user clicks a button. The following method is called from another thread. private ArrayList&lt;Message&gt; MessageList = new ArrayList&lt;&gt;(); public synchronized Message getMessageFromUsername(String username) { for( Message msg : MessageList ) { if( msg.username.equalsIgnoreCase(username) ) { Message m = new Message(msg.num, msg.username, msg.id); return m; } } return null; } My manager thread reads information from the socket and adds information to MessageList in a continuous loop. (Another one, i.e.) private synchronized void parseMessage() {} private void main() { while(1) { parseMessage(/*Adds message to MessageList*/); Sleep(); } } Now, my problem is a pretty noobie issue- because if I want to write to MessageList I have to use synchronized to access it. However, since this happens in a loop and the messages are constantly coming in through the socket it causes a deadlock because it keeps locking my object and this occurs in a loop. What can I do to solve my problem with deadlocking?
has comment: http://stackoverflow.com/comment/33154062
type: Question
accepted answer: http://stackoverflow.com/a/21893496
linked to: http://stackoverflow.com/q/616484
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33153943
has comment: http://stackoverflow.com/comment/33153883
has comment: http://stackoverflow.com/comment/33154056
has answer: http://stackoverflow.com/a/22146213
downvote count: 0
has comment: http://stackoverflow.com/comment/33154768
tagged with: synchronized

http://stackoverflow.com/comment/33084468
comment on: http://stackoverflow.com/a/21853956
type: AnswerComment
score: 0
has text: my stack trace is the log cat it is after the php error
type: Comment

http://stackoverflow.com/q/21873678
upvote count: 1
tagged with: swtbot
answer count: 1
favorite count: 0
tagged with: linux
has title: Cant right click be performed in linux using swtbot?
downvote count: 0
score: 1
has body: I want to right click a context menu using swtbot, I am using the following code: treeitem.setFocus(); treeitem.contextMenu("context_menu_text").click(); The above code works fine in windows, but in Linux it throws a widget not found error. treeitem is the project in Project explorer. Here is the full code: SWTBotView view_project_explorer = bot.viewByTitle("Project Explorer"); List&lt;Tree&gt; controls = new ChildrenControlFinder(view_project_explorer.getWidget()).findControls(WidgetOfType.widgetOfType(Tree.class)); SWTBotTree tree = new SWTBotTree((Tree) controls.get(0)); SWTBotTreeItem treeitem = tree.getTreeItem("myProject"); To get the tree I have also tried the bot.tree() method directly, still it works only on windows not on Linux. Also, I don't have a shortcut for the context menu option that I want to access.
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21986937
accepted answer: http://stackoverflow.com/a/21986937
tagged with: eclipse

http://stackoverflow.com/comment/33172054
type: QuestionComment
comment on: http://stackoverflow.com/q/21882405
score: 0
has text: After debugging the tika code I realized that I had set maxStringLength on WriteOutContentHandler and the code was throwing zip bomb error after the limit is reached. Correct error message might have helped sooner. Anyway, thanks all for the input. We will definitely plan to move to latest release.
type: Comment

http://stackoverflow.com/a/21975519
answers question: http://stackoverflow.com/q/21975471
type: Answer
score: 3
upvote count: 3
has body: Just to say the same thing in yet another way: new Stock_Image_Scanner().main(null); Does the same thing as: new Stock_Image_Scanner(); Stock_Image_Scanner.main(null);
downvote count: 0

http://stackoverflow.com/comment/33214136
comment on: http://stackoverflow.com/a/21927183
has text: @bhanukaushik first check your query successfully insert data or not?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21907697
has comment: http://stackoverflow.com/comment/33178463
has comment: http://stackoverflow.com/comment/33178367
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33178534
accepted answer: http://stackoverflow.com/a/21907767
upvote count: 14
has body: I encountered the following method, which to my surprise compiled just fine: private String getControlMessageBlocking() throws ProtocolException, InterruptedException, IOException { try { // &lt;Code that may throw any of the three listed exceptions&gt; return controlMessage; } catch (Exception e) { throw e; } } Why isn't it necessary for the Exception to be caught?
tagged with: java
has comment: http://stackoverflow.com/comment/33178318
type: Question
has title: Unexpected exception handling during compilation
linked to: http://stackoverflow.com/q/19913834
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33178427
has comment: http://stackoverflow.com/comment/33178619
favorite count: 0
has comment: http://stackoverflow.com/comment/33178431
score: 14
tagged with: exception
has answer: http://stackoverflow.com/a/21907767
has comment: http://stackoverflow.com/comment/33178408
has comment: http://stackoverflow.com/comment/33190777
has comment: http://stackoverflow.com/comment/33178407

http://stackoverflow.com/comment/33236475
score: 0
type: Comment
has text: *Removing an element* is optional, but *implementing the `remove` function* is still required. Implement it to throw an `UnsupportedOperationException` (and document it as such).
type: QuestionComment
comment on: http://stackoverflow.com/q/21939807

http://stackoverflow.com/comment/33249749
comment on: http://stackoverflow.com/q/21947160
type: QuestionComment
has text: my answer does in fact make a transition between the colors, so simply adding more color steps if needed would make the visuals you seek. A change for every 5% change in health I would think to be enough to be visually pleasant.
score: 0
type: Comment

http://stackoverflow.com/q/21975808
type: Question
has body: Does anyone know if it is possible to call a shell script from within Java program and also pass an argument to that shell script from the for loop of that java class? In my shell script I am setting MySQL system variables to different values to see if those values affect the performance of the database application. I could have set those values through JDBC, but as I am working with MySQL, it is not possible to restart the database from JDBC, after each query execution.
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21975943
tagged with: shell
has title: Calling shell script from java program and passing arguments to a shell script from java for loop
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21975900
linked to: http://stackoverflow.com/q/525212
tagged with: java
tagged with: mysql

android-listview
tags question: http://stackoverflow.com/q/21858095
tags question: http://stackoverflow.com/q/21960979
tags question: http://stackoverflow.com/q/21999151
tags question: http://stackoverflow.com/q/21870295
tags question: http://stackoverflow.com/q/21846806
tags question: http://stackoverflow.com/q/22000208
tags question: http://stackoverflow.com/q/21909333
tags question: http://stackoverflow.com/q/21960193
tags question: http://stackoverflow.com/q/21872018
tags question: http://stackoverflow.com/q/21895458
tags question: http://stackoverflow.com/q/21919841
tags question: http://stackoverflow.com/q/21846536
tags question: http://stackoverflow.com/q/21949079
tags question: http://stackoverflow.com/q/21922016
tags question: http://stackoverflow.com/q/21988625
tags question: http://stackoverflow.com/q/21931146
tags question: http://stackoverflow.com/q/21999170
tags question: http://stackoverflow.com/q/21904938
tag name: android-listview
tags question: http://stackoverflow.com/q/21896357
type: Tag
tags question: http://stackoverflow.com/q/21953655
tags question: http://stackoverflow.com/q/21881378
tags question: http://stackoverflow.com/q/21845916
tags question: http://stackoverflow.com/q/21937327
tags question: http://stackoverflow.com/q/21887948
tags question: http://stackoverflow.com/q/21853826
tags question: http://stackoverflow.com/q/21995125

http://stackoverflow.com/q/21910769
has answer: http://stackoverflow.com/a/21911164
possible better answer: http://stackoverflow.com/a/21911416
tagged with: immutability
type: AnsweredQuestion
score: 64
downvote count: 0
has answer: http://stackoverflow.com/a/21929227
has answer: http://stackoverflow.com/a/22029865
has answer: http://stackoverflow.com/a/21910916
type: Question
has answer: http://stackoverflow.com/a/21910881
has title: Is it okay to expose the state of an Immutable object?
upvote count: 64
has answer: http://stackoverflow.com/a/21910959
tagged with: java
tagged with: value-objects
answer count: 13
has answer: http://stackoverflow.com/a/21911416
has answer: http://stackoverflow.com/a/21946098
has answer: http://stackoverflow.com/a/21910859
accepted answer: http://stackoverflow.com/a/21910859
favorite count: 0
has body: Having come across the concept of immutable objects recently, I would like to know the best practices for controlling access to the state. Even though the object oriented part of my brain makes me want to cower in fear at the sight of public members, I see no technical issues with something like this: public class Foo { public final int x; public final int y; public Foo( int x, int y) { this.x = x; this.y = y; } } I would feel more comfortable declaring the fields as private and providing getter methods for each but this seems overly complex when the state is explicitly read only. What is the best practice for providing access to the state of an immutable object?
has answer: http://stackoverflow.com/a/21919682
has answer: http://stackoverflow.com/a/21911084
has answer: http://stackoverflow.com/a/21942405
has answer: http://stackoverflow.com/a/21916263

http://stackoverflow.com/q/21864357
accepted answer: http://stackoverflow.com/a/21864738
answer count: 3
has comment: http://stackoverflow.com/comment/33101698
possible better answer: http://stackoverflow.com/a/21864714
favorite count: 0
has title: Adding a mouse listener to image or image Icon in java
has answer: http://stackoverflow.com/a/21864714
has comment: http://stackoverflow.com/comment/33101368
upvote count: 1
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21864738
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/523767
type: Question
has answer: http://stackoverflow.com/a/21865187
has body: How can I to add mouse listener to image or imageIcon in Java? Here is my code. I want to do anything with imageIcon after mouse click on it. public class Bubbles extends JPanel { public static final int LINE_OUT = 440; int x = 20; int y = 50; int v = 4; Image img = new ImageIcon("res/lop.png").getImage(); BackSide back; public Bubbles(int x, int y, int v, BackSide back) { this.x = x; this.y = y; this.v = v; this.back = back; setFocusable(true); } public void move() { if (y >= 440) { y = 0; } else { y += v; } } }
downvote count: 0

http://stackoverflow.com/a/36929019
type: Answer
has body: In your Eclipse click on Run -> External Tools -> External Tools Configurations... In JRE tab Choose the option Run in the same JRE as workspace. This fixed the issue for me.
score: 0
answers question: http://stackoverflow.com/q/21976939

http://stackoverflow.com/q/21985115
tagged with: security
tagged with: ldap
has title: Applet Certificate CRL Distribution Point LDAP URL with no host
type: UnansweredQuestion
has body: I'm developing a web application that uses applets signed with a certificate issued by the customer CA. That certificate contains an URL to a CRL Distribution Point that does not define the host and port. The certificate attributes "CRL Distribution Points" and "Authority Information Access" contain an URL similar to "ldap:///CN=my-cn...". The log files generated by the Certificate Revocation-Checking API (C:\Users[my_user]\AppData\LocalLow\Sun\Java\Deployment\log) indicate that the values "localhost" and "389" are being used for host and port. This is a snippet of the log file: ... certpath: DistributionPointFetcher.getCRLs: Checking CRLDPs for CN=xxx, O=yyy, L=zzz, C=PT certpath: Trying to fetch CRL from DP ldap:///CN=_my-cn_?certificateRevocationList?base?objectClass=cRLDistributionPoint certpath: CertStore URI:ldap:///CN=_my-cn_?certificateRevocationList?base?objectClass=cRLDistributionPoint ... network: Connecting http://localhost:389/ with proxy=DIRECT ... certpath: LDAPCertStore.engineInit about to throw InvalidAlgorithmParameterException javax.naming.CommunicationException: localhost:389 [Root exception is java.net.ConnectException: Connection refused: connect] at com.sun.jndi.ldap.Connection.&lt;init&gt;(Unknown Source) ... Can anyone confirm that the host is mandatory, otherwise the default value "localhost" is used? I read in the LDAP RFC (http://www.ietf.org/rfc/rfc4516.txt) that if the "host" field is not present, the client must have some a priori knowledge of an appropriate LDAP server to contact. Is it possible to configure the "host" attribute? I'm using the JRE version 1.7.0_45 (build 1.7.0_45-b18). Thank you, Telmo Simões
tagged with: java
type: Question
score: 0
tagged with: certificate-revocation
answer count: 1
tagged with: applet
has answer: http://stackoverflow.com/a/22143722

http://stackoverflow.com/q/21865147
score: 6
has body: I would like to create sample web application with JBPM6. But i am struggling lot to explore the JBPM6. I tried to run sample application , but it is giving an error.There are no steps to Start the project from Eclipse to JBOSS deploy. If creating JBPM project , then its not supporting front layer and if select JBPM with maven, then web resources not adding to the project. Please advise on how to create web application with jbpm6 process in Eclipse ?
type: Question
has answer: http://stackoverflow.com/a/22040741
has title: How to create jbpm6 web application in Eclipse?
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/21865371
answer count: 2
tagged with: jbpm
has answer: http://stackoverflow.com/a/21865371
downvote count: 0
accepted answer: http://stackoverflow.com/a/22040741
favorite count: 0
upvote count: 6
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/33066103
type: Comment
type: AnswerComment
has text: That's where i get confused actually. I tried flush()ing after writing to output stream, but then the server doesn't read the data. It just waits. :( Am I making any sense? :(
comment on: http://stackoverflow.com/a/21844548
score: 0

http://stackoverflow.com/a/21927936
upvote count: 2
downvote count: 1
answers question: http://stackoverflow.com/q/21927779
has comment: http://stackoverflow.com/comment/33214514
has comment: http://stackoverflow.com/comment/33216410
has comment: http://stackoverflow.com/comment/33214585
type: Answer
has body: try this... An easy way to get common elements in two ArrayLists ArrayList&lt;String&gt; list2 = new ArrayList&lt;String&gt;(); // add the elements into list2 ArrayList&lt;String&gt; list1 = new ArrayList&lt;String&gt;(); // add the elements into list1 ArrayList&lt;String&gt; newList = new ArrayList&lt;String&gt;(list1); newList.retainAll(list2); // Now newList will contain common elements
has comment: http://stackoverflow.com/comment/33214375
score: 1
has comment: http://stackoverflow.com/comment/33214478

http://stackoverflow.com/q/21915456
answer count: 1
favorite count: 0
tagged with: android
has body: I am a beginner in creating Android apps. If this question is silly I am so sorry. Is it possible to create an array of tablerow objects? If this is possible, how is it done?
has title: is it possible to create array of TableRow objects?
has answer: http://stackoverflow.com/a/21915629
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
upvote count: 0
score: -1
accepted answer: http://stackoverflow.com/a/21915629

http://stackoverflow.com/q/21975560
has answer: http://stackoverflow.com/a/21975679
has comment: http://stackoverflow.com/comment/33301164
type: UnansweredQuestion
has title: No main() even if main() is there
tagged with: swing
answer count: 4
has answer: http://stackoverflow.com/a/21975588
has body: I added this code to Netbeans and I am getting that file test1 doesn't contain main() function. I have added main() function but still getting this error: import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JToolBar; import javax.swing.KeyStroke; import net.miginfocom.swing.MigLayout; public class test1 extends JFrame { // Window Vars // String title; int width; int height; // Mid Level componets // JMenuBar menuBar; JMenu file; JToolBar toolBar; JPanel map; JPanel sideBar; // Low Level componets // JMenuItem exit; JButton select; public test1(String title, int width, int height) { this.title = title; this.width = width; this.height = height; this.makeInterface(); } public void makeInterface() { // Setup JFrame this.setTitle(title); this.setSize(width, height); this.setLocationRelativeTo(null); this.setMinimumSize(new Dimension(700, 500)); this.setVisible(true); this.setLayout(new MigLayout( "debug, fillx, gap unrel rel", // Layout "[grow, fill][fill]", // Column "[fill][fill]")); // Row this.makeMenu(); this.addToolBars(); this.makePanels(); this.setupActionListeners(); } public void makeMenu() { this.menuBar = new JMenuBar(); this.file = new JMenu("File"); this.file.setMnemonic(KeyEvent.VK_F); this.menuBar.add(file); this.exit = new JMenuItem("Exit", KeyEvent.VK_E); this.exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.ALT_MASK)); this.file.add(exit); this.setJMenuBar(this.menuBar); } public void addToolBars() { this.toolBar = new JToolBar("Draggable"); this.addToolBarButtons(); this.add(toolBar, "span, height 20:35:50, wrap"); } public void addToolBarButtons() { this.select = new JButton("Select"); this.toolBar.add(select); } public void makePanels() { this.map = new JPanel(); this…
tagged with: java
has answer: http://stackoverflow.com/a/21975582
type: Question
has comment: http://stackoverflow.com/comment/33300122
tagged with: awt
score: 0
has answer: http://stackoverflow.com/a/21975694

http://stackoverflow.com/a/21983231
has comment: http://stackoverflow.com/comment/33744392
upvote count: 1
has comment: http://stackoverflow.com/comment/33317499
answers question: http://stackoverflow.com/q/21983001
has comment: http://stackoverflow.com/comment/33318266
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33313892
has comment: http://stackoverflow.com/comment/33315173
type: Answer
has body: Are you talking of a salt or something ? I think you'd like to use an encryption you can resverse such as AES. public static byte[] encrypt(String plainText, String encryptionKey) throws Exception { Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding", "SunJCE"); SecretKeySpec key = new SecretKeySpec(encryptionKey.getBytes("UTF-8"), "AES"); cipher.init(Cipher.ENCRYPT_MODE, key,new IvParameterSpec(new byte[cipher.getBlockSize()])); return cipher.doFinal(plainText.getBytes("UTF-8")); } public static String decrypt(byte[] cipherText, String encryptionKey) throws Exception { Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding", "SunJCE"); SecretKeySpec key = new SecretKeySpec(encryptionKey.getBytes("UTF-8"), "AES"); cipher.init(Cipher.DECRYPT_MODE, key,new IvParameterSpec(new byte[cipher.getBlockSize()])); return new String(cipher.doFinal(cipherText),"UTF-8"); } A simple way to use it would be String plaintext = "My plain text."; String encryptionKey = "Super secret encryption key"; Log.d("AES", "Plain text is : " + plaintext ); byte[] cipher = encrypt(plaintext, encryptionKey); Log.d("AES", "Encrypted string is : " + new String(cipher)); String decrypted = decrypt(cipher, encryptionKey); Log.d("AES", "Decrypted string is : " + decrypted); if (plaintext.equals(decrypted)) Log.d("AES", "Strings match !");
has comment: http://stackoverflow.com/comment/33320350
has comment: http://stackoverflow.com/comment/33314146

http://stackoverflow.com/comment/75550881
score: 0
type: AnswerComment
has text: @Wrap2Win No, you are correct, reusing `Collections.binarySearch` is better than rolling your own implementation.
type: Comment
comment on: http://stackoverflow.com/a/21946772

http://stackoverflow.com/q/21998553
tagged with: java
has comment: http://stackoverflow.com/comment/33344802
has answer: http://stackoverflow.com/a/21998662
has comment: http://stackoverflow.com/comment/33343901
type: Question
has title: Why is the Reflection showing this Main class as an Object and not an Applet?
has comment: http://stackoverflow.com/comment/33343540
tagged with: inheritance
has body: I have two java files that I've compiled and packaged into a jar file. // Main.java public class Main extends GameWindow { public static void main(String[] args) { System.out.println("hello reflection!"); } } // GameWindow.java import java.applet.Applet; public abstract class GameWindow extends Applet { } I'm using the Java Reflection library to print out the parent class of Main and GameWindow. Class&lt;?&gt; main = Class.forName("Main"); System.out.println(main.getSuperclass() ); Class&lt;?&gt; gamewindow = Class.forName("GameWindow"); System.out.println(gamewindow.getSuperclass() ); I would expect Main's super class to be GameWindow and GameWindow's super class to be Applet, but when I run the above code, the output I'm receiving is class java.lang.Object class java.applet.Applet What is causing these results?
score: 0
tagged with: japplet
answer count: 1
has comment: http://stackoverflow.com/comment/33344734
tagged with: applet
has comment: http://stackoverflow.com/comment/33343792
type: UnansweredQuestion
tagged with: reflection

http://stackoverflow.com/comment/33296669
has text: use <? extends AbstractTest>
comment on: http://stackoverflow.com/q/21973757
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22005007
favorite count: 0
has comment: http://stackoverflow.com/comment/33352456
tagged with: multidimensional-array
answer count: 5
has body: I have been studying Java and C++ this year, and I am wondering; what practical uses are there for a 4 or even 5 dimensional array? My teacher basically says that you are using the wrong datatype if you want to use a 4 dimensional array. Have you ever used a 4 of 5 (or more) dimensional array? What did you use it for? What practical uses can you think of for them? Thanks!
has answer: http://stackoverflow.com/a/22005953
accepted answer: http://stackoverflow.com/a/22005528
has answer: http://stackoverflow.com/a/22005239
possible better answer: http://stackoverflow.com/a/22005075
has answer: http://stackoverflow.com/a/22005075
type: AnsweredQuestion
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/33352494
type: Question
linked to: http://stackoverflow.com/q/5540024
upvote count: 9
has comment: http://stackoverflow.com/comment/33352443
has answer: http://stackoverflow.com/a/22005196
has answer: http://stackoverflow.com/a/22005528
duplicate of: http://stackoverflow.com/q/5540024
has comment: http://stackoverflow.com/comment/33352571
has title: Practical Use for 4D+ Arrays
has comment: http://stackoverflow.com/comment/33352469
score: 8

http://stackoverflow.com/q/21844708
type: Question
has comment: http://stackoverflow.com/comment/33066775
has answer: http://stackoverflow.com/a/21844863
has title: Inner Hashtable Overwriting
score: 0
answer count: 2
tagged with: hashmap
tagged with: java
has comment: http://stackoverflow.com/comment/33067088
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21845481
tagged with: string
has body: I'm working on the hashtable.In which i wanna form hashtable but my values of the outer hashtable getting replaced. Hashtable1[key,Hashtable[key,value]] Im able to get the outerhashtable key without overwriting but the inner hashtable values getting replaced . import java.io.*; import java.util.*; import com.sridhar.util.*; public class MyTokenizerDemo { public static void main(String[] args) throws IOException { Hashtable ht=new Hashtable(); Hashtable ht1=new Hashtable(); Hashtable ht2=new Hashtable(); File f = new File("E:/rum/format.txt"); FileReader fr = new FileReader(f); BufferedReader br = new BufferedReader(fr); String s; while((s=br.readLine())!=null) { ArrayList aList = (ArrayList)StringUtils.myTokenizer(s,"~!~"); for(int i=0;i&lt;aList.size();i++) { ArrayList aList1 = (ArrayList)StringUtils.myTokenizer((String)aList.get(i),"$#$"); //System.out.println("==&gt;"+aList1.get(0)+"&lt;=="); ArrayList aList2 = (ArrayList)StringUtils.myTokenizer((String)aList1.get(1),"~$~"); //System.out.println("====&gt;"+aList2+"&lt;====="); for(int j=0;j&lt;aList2.size();j++) { ArrayList as = (ArrayList)StringUtils.MyTokenizer((String)aList2.get(j),"#$#"); if(as!=null) { String innerkey = (String)as.get(0); String innervalue = (String)as.get(1); ht2.put(innerkey,innervalue); } } ht1.put(aList1.get(0),ht2); } } System.out.println(ht1); } } Kindly make an assumption on my own string tokenizing utility class. My outer Hashtable values are overwriting. Help me out in this issue.

http://stackoverflow.com/comment/46291279
type: Comment
score: 1
has text: That's great, except when the priority of an item changes and it has to be resorted. As of right now, you have to remove and then add it back into the queue. This is much more expensive.
comment on: http://stackoverflow.com/a/21985427
type: AnswerComment

http://stackoverflow.com/q/21863363
tagged with: exec-maven-plugin
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3080437
downvote count: 0
score: 1
has title: Problems with classpath with JSP using maven exec:java plugin under Windows
has body: I'm trying to run a Jetty web framework from main(...) that loads a spring web context which loads JSPs at runtime. This works great from the command line using mvn exec:java on OSX and Linux. However on Windows, running Cygwin, I cannot get it to fully work. The application loads and the web-context seems to build fine. However when the first JSP page is rendered the JVM goes to compile it on the fly and throws the following error/exception: org.apache.tools.ant.BuildException: Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:105) ~[gwt-dev-2.5.1.jar:na] at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:924) ~[gwt-dev-2.5.1.jar:na] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757) ~[gwt-dev-2.5.1.jar:na] at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382) [gwt-dev-2.5.1.jar:na] at org.apache.jasper.compiler.Compiler.compile(Compiler.java:472) [gwt-dev-2.5.1.jar:na] ... I've done a ton of web searches and tried a number of things before posting. The JAVA_HOME variable is set correctly. I've made sure that it is pointing at the JDK and not the JRE. The tools.jar file does exist under %JAVA_HOME%/lib/tools.jar. The JAVA_HOME path is in Program Files and I was worried about the space but replacing it with Progra~1 does not seem to work either. We've tried both the mvn shell script under Cygwin as well as the mvn.bat script under DOS but both fail similarly. Anyone else had this problem? Do I need to change the classpath to specifically add a dependency to the tools.jar somehow? Maybe something added to the pom.xml? Thanks in advance.
tagged with: classpath
linked to: http://stackoverflow.com/q/11289700
type: Question
has comment: http://stackoverflow.com/comment/33107008
tagged with: java
has answer: http://stackoverflow.com/a/21884451
accepted answer: http://stackoverflow.com/a/21884451
upvote count: 1
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/33107588
has comment: http://stackoverflow.com/comment/33106767
favorite count: 0
tagged with: jetty
has comment: http://stackoverflow.com/comment/33099951

multimap
tags question: http://stackoverflow.com/q/21914705
type: Tag
tag name: multimap
tags question: http://stackoverflow.com/q/21949631

http://stackoverflow.com/comment/33163848
comment on: http://stackoverflow.com/q/21874865
score: 0
type: Comment
type: QuestionComment
has text: just for an easy way, copy and paste your IEDriverServer.exe in C folder and specify like this in the script C:\\IEDriverServer.exe

http://stackoverflow.com/comment/33292938
type: AnswerComment
comment on: http://stackoverflow.com/a/21971390
score: 0
type: Comment
has text: No errors what-so-ever. I cd to the folder that has the jar then : java -jar GuiCpu.jar

http://stackoverflow.com/comment/33322503
score: 0
comment on: http://stackoverflow.com/q/21988532
type: Comment
type: QuestionComment
has text: why are you using a release candidate for logging? "log4j-core-2.0-rc1"

http://stackoverflow.com/q/22003650
answer count: 1
accepted answer: http://stackoverflow.com/a/22003797
has body: I have a file server and two integration servers. Each integration server has the same task. It will pick up file from "incoming" folder of the file server, and then will process it. This service use Spring Integration. Two servers' services work at the same time, which would ensure that even one integration server fails, the other will keep working. Because these two are independent from each other, my question is how can I make sure that both services don't pick up the same file from file server Also master-slave approach is not what I am looking for.
has title: Avoid same file of File server been picked up from different services
tagged with: spring
type: AnsweredQuestion
tagged with: fileserver
tagged with: spring-integration
has comment: http://stackoverflow.com/comment/33350372
tagged with: java
has comment: http://stackoverflow.com/comment/33350289
tagged with: integration
type: Question
has comment: http://stackoverflow.com/comment/33351432
has answer: http://stackoverflow.com/a/22003797
score: 0

http://stackoverflow.com/comment/33300421
has text: Well, there's a ton of stuff that can go wrong. Check your LogCat for the source.
type: Comment
comment on: http://stackoverflow.com/a/21974379
score: 0
type: AnswerComment

http://stackoverflow.com/comment/51482936
score: 0
type: Comment
has text: Correct - casting the parameter still doesn't cause the function to become part of a compiled type, so it is still erased. You have to make the function some sort of class such as the anonymous and inner classes illustrated as f0 and f1.
type: AnswerComment
comment on: http://stackoverflow.com/a/22153029

http://stackoverflow.com/q/21954801
has answer: http://stackoverflow.com/a/47634639
linked to: http://stackoverflow.com/q/7608173
has answer: http://stackoverflow.com/a/21954919
has comment: http://stackoverflow.com/comment/33263146
favorite count: 0
has comment: http://stackoverflow.com/comment/33263995
upvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33262769
tagged with: android
linked to: http://stackoverflow.com/q/13469147
has comment: http://stackoverflow.com/comment/33262932
has comment: http://stackoverflow.com/comment/33262812
tagged with: apk
downvote count: 0
tagged with: java
type: Question
score: 5
tagged with: dex
has body: I need read the content of apk file (including AndroidManifest.xml) programmatically. I know there are some tools like apktool, dex2jar, aapt to extract apk content but, I need to do the same through an Android application. By the way my start point is a valid apk file path.
has title: How to read content of apk file programmatically?
tagged with: android-sdk-tools
answer count: 2
linked to: http://stackoverflow.com/q/2097813

http://stackoverflow.com/a/22001619
score: 0
has body: A HashMap "bucket" is a linked list. Each element of the list contains the key, the value, the hash of the key and a pointer to the next element in the list. So, when a hash collision occurs, the hash table iterates over each entry in the bucket. It compares entry hash to the insertion key hash, and the entry key to the insertion key. If they are both equal, it replaces the value. If it gets through the whole bucket without a match, it adds an entry to the bucket.
type: Answer
answers question: http://stackoverflow.com/q/22001509

http://stackoverflow.com/q/21909679
type: Question
has answer: http://stackoverflow.com/a/21909767
accepted answer: http://stackoverflow.com/a/21909767
has comment: http://stackoverflow.com/comment/33181975
upvote count: 1
answer count: 1
has title: Injecting a class compiled with a different Java version
favorite count: 0
downvote count: 0
has body: My bean gets a class injected which will be used in the (Java 6) owner class. However, the injected class is compiled in Java 7. I currently get a Unsupported major.minor version 51.0 error, indicating this isn't possible. However, I've been wrong before. Any insight/sources on this subject?
tagged with: spring
tagged with: inject
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33181844

http://stackoverflow.com/q/21851511
downvote count: 1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33083286
upvote count: 0
has answer: http://stackoverflow.com/a/21851920
tagged with: data-structures
has comment: http://stackoverflow.com/comment/33078182
has comment: http://stackoverflow.com/comment/33077579
has comment: http://stackoverflow.com/comment/33080570
tagged with: binary-tree
has answer: http://stackoverflow.com/a/21855182
has comment: http://stackoverflow.com/comment/33077766
has comment: http://stackoverflow.com/comment/33085173
has comment: http://stackoverflow.com/comment/33083766
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/33083888
has comment: http://stackoverflow.com/comment/33077834
type: UnansweredQuestion
has body: I have this code where I am trying to print the greater numbers of a binary search tree. For example when I call the greater method greater(5) and my binary search tree has values 1,2,3,4,5,6,7,8,9,10 I want to return the greater values from 5, so the outcome it will be 6,7,8,9,10. But my code has a problem and I don't know where is the problem. The system out should be return. It work with system out. private int greater(BTNode&lt;Integer&gt; n,int nu) { int o=0; int leftAns = 0; if (n.left != null) leftAns = greaterInt(n.left, nu); int rightAns = 0; if (n.right != null) rightAns = greaterInt(n.right, nu); int answer = leftAns + rightAns; if (n.data.intValue() &gt; nu){ o+=n.data; System.out.println(n.data); //System.out.println(answer); } return o; } public int greater(int n) { if (root == null) return 0; else return greaterInt(root,n); }
has comment: http://stackoverflow.com/comment/33083094
tagged with: java
has comment: http://stackoverflow.com/comment/33078050
has title: Return the greater numbers in a binary search tree in java

jspinner
tags question: http://stackoverflow.com/q/21887337
type: Tag
tag name: jspinner
tags question: http://stackoverflow.com/q/21960236

http://stackoverflow.com/comment/33294517
comment on: http://stackoverflow.com/a/21972226
has text: sorry just get it, you are in a fragment not activity, you must get parent activity "getActivity()" and pass it in intent constructor :) , check my edit it must work fine, Login must be an activity too
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33240041
score: 0
has text: @tom, in all the research papers I read about the thing I wish to accomplish, they suggest the same thing. They simply remove words that occur less than a particular treshold. This does not affect the results what so ever.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21941948

http://stackoverflow.com/comment/69066005
comment on: http://stackoverflow.com/a/29575215
has text: Jitendra, is it possible to apply this workaround and achieve 4 fading edges?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33260085
type: QuestionComment
comment on: http://stackoverflow.com/q/21953340
score: 0
has text: what do you mean by page does not see the css codes?
type: Comment

http://stackoverflow.com/q/21942637
possible better answer: http://stackoverflow.com/a/21942795
has comment: http://stackoverflow.com/comment/33241047
has answer: http://stackoverflow.com/a/21942795
favorite count: 0
has comment: http://stackoverflow.com/comment/33241576
tagged with: arraylist
has title: How are List and List<String> different?
accepted answer: http://stackoverflow.com/a/21942667
tagged with: generics
type: AnsweredQuestion
tagged with: linked-list
has body: I'd just started working with lists and wanted to know how both of these are different? Im guessing the second one specifically points out that it contains only string type stuff, while the first one is more flexible. But then if the first is more flexible, why do people use the second one ever?
downvote count: 1
type: Question
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/21942667
answer count: 2
upvote count: 0

http://stackoverflow.com/comment/33153335
comment on: http://stackoverflow.com/q/21893090
has text: I think none of us can answer this since it depends on your business requirement
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33345128
score: 0
comment on: http://stackoverflow.com/q/22000639
type: Comment
type: QuestionComment
has text: There is no way to have O(1) for all of these. For example, #4 **requires** a linear search.

http://stackoverflow.com/q/21890224
tagged with: jsf
score: 0
has title: JSF p:password validation and feedback only works after page is reloaded
answer count: 1
tagged with: passwords
accepted answer: http://stackoverflow.com/a/23070523
tagged with: primefaces
has body: I am writing a page where a user can change his password. First he needs to entry his old password and a validator is called .When the password is correct two password fields get enabled and he can type in a new password and needs to repeat it. I am using the p:password component from primefaces 4.0 for this. In the first password field where he can entry his new password i have a attribute feedback="true". The problem here is that when i call the site for the first time there is no feedback output. It only appears when i reload the page and type in the password field again. Also the validator validatePwd1 of the password field is not called. In the repeat password field i have the same problem with the validator. Is it possible to reload only this two components after the page is loaded with ajax or something? Or is there a better way to fix this error? Here is my page: &lt;p:row id="RowConfirmOldPw" rendered="#{userSettingBean.showPasswordFields}"&gt; &lt;p:column&gt; &lt;p:outputLabel value="#{msg['usersett_account_oldPwd']}"/&gt; &lt;/p:column&gt; &lt;p:column&gt; &lt;p:password id="oldPwd" value="#{userSettingBean.oldPassword}" &gt; &lt;f:validator validatorId="passwordEqualValidator"/&gt; &lt;f:ajax event="keyup" render="oldPwdMessage pwd1 pwd2"/&gt; &lt;/p:password&gt; &lt;p:watermark for="oldPwd" value="#{msg['usersett_account_oldPwd']}"/&gt; &lt;/p:column&gt; &lt;p:column&gt; &lt;p:message id="oldPwdMessage" for="oldPwd"/&gt; &lt;/p:column&gt; &lt;/p:row&gt; &lt;p:row id="RowTypeNewPassword"&gt; &lt;p:column&gt; &lt;p:outputLabel value="#{msg['usersett_account_newPwd']}"/&gt; &lt;/p:column&gt; &lt;p:column&gt; &lt;p:password id="pwd1" value="#{userSettingBean.password1}" disabled="#{userSettingBean.disableNewPassword}" feedback="true" validator="#{userSettingBean.validatePwd1}"&gt; &lt;f:ajax event="keyup" render="pwdMatchMessage"/&gt; &lt;/p:password&gt; &lt;/p:column&gt; &lt;/p:row&gt; &lt;p:row&gt; &lt;p:column&gt; &lt;h:outputLabel value="#{msg['userset…
tagged with: java
type: AnsweredQuestion
tagged with: ajax
type: Question
has answer: http://stackoverflow.com/a/23070523

http://stackoverflow.com/a/21897647
has comment: http://stackoverflow.com/comment/33164600
has body: You havnt initialize batch. insert batch = new SpriteBatch(); in your create() method. Apart form this , your code float dt = Gdx.graphics.getDeltaTime(); animationElapsed += dt; while(animationElapsed &gt; frameLength){ animationElapsed -= frameLength; currentFrame = (currentFrame == test.size - 1) ? 0 : ++currentFrame; } should be placed inside render() .
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/33162629
score: 1
accepted answer of: http://stackoverflow.com/q/21897064
answers question: http://stackoverflow.com/q/21897064
has comment: http://stackoverflow.com/comment/33161707

http://stackoverflow.com/comment/33167933
comment on: http://stackoverflow.com/a/21901206
score: 0
type: AnswerComment
type: Comment
has text: That seems to be saying that you've changed your function call to pass in a String but haven't changed the function itself to accept a String instead of a char, check the input parameters of the adjustScore function.

http://stackoverflow.com/comment/33150453
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21890035
has text: If you used a URL string as your action parameter you would not get that error. Please try again.
score: 0

http://stackoverflow.com/q/21924478
has comment: http://stackoverflow.com/comment/33208826
has title: Regular expression to match all numeric characters except 5
favorite count: 0
linked to: http://stackoverflow.com/q/21928277
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33208783
linked to: http://stackoverflow.com/q/6082129
tagged with: regex
has answer: http://stackoverflow.com/a/21924598
has answer: http://stackoverflow.com/a/21924592
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33208731
type: Question
has body: When I want to match all numeric characters except 5 I use: [^\D|5] or [^\D5] or [0-46-9] or [012346789] When I want to match no numeric characters I can use: [^\d] or [\D] All of them work well. But when I use [^^\d5] or [^^\d|5] to match all numeric characters except 5, it doesn't work. I want to use it in a lot of cases. For example, I want to match all \p{P} but not \:. Is there any way to use ^\d to match all numeric character except 5?
tagged with: c#
tagged with: java
has comment: http://stackoverflow.com/comment/33208707
upvote count: 2
answer count: 2

http://stackoverflow.com/a/21996548
answers question: http://stackoverflow.com/q/21996396
has comment: http://stackoverflow.com/comment/33337807
has comment: http://stackoverflow.com/comment/33339014
has body: If position contains the children and you save only the child (which contains no children by itself), how should it be filled? Save the parent menu item afterwards too!
has comment: http://stackoverflow.com/comment/33337403
has comment: http://stackoverflow.com/comment/33338420
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33337553

http://stackoverflow.com/q/21989714
possible better answer: http://stackoverflow.com/a/21989863
tagged with: string
has answer: http://stackoverflow.com/a/21990091
has comment: http://stackoverflow.com/comment/33324487
has comment: http://stackoverflow.com/comment/33325254
has answer: http://stackoverflow.com/a/52982245
favorite count: 0
has comment: http://stackoverflow.com/comment/33324517
answer count: 5
has comment: http://stackoverflow.com/comment/33324443
has answer: http://stackoverflow.com/a/30239298
has title: Java program on name Initials
accepted answer: http://stackoverflow.com/a/21990091
downvote count: 1
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/47317358
has answer: http://stackoverflow.com/a/21989863
has comment: http://stackoverflow.com/comment/33325094
tagged with: java
has body: I am writing a program that will give the Initials of the name(String) user gives as input. I want to use the Space function while writing the name as the basis of the algorithm. For eg: &lt;Firstname&gt;&lt;space&gt;&lt;Lastname&gt; taking the char once in a for loop and checking if there is a space in between, if there is it will print the charecter that was just before. Can someone tell me how to implement this? I'm trying this but getting one error. Any help is dearly appreaciated.. P.S- i am new to java and finding it a lot intresting. Sorry if there is a big blunder in the coding public class Initials { public static void main(String[] args) { String name = new String(); System.out.println("Enter your name: "); Scanner input = new Scanner(System.in); name = input.nextLine(); System.out.println("You entered : " + name); String temp = new String(name.toUpperCase()); System.out.println(temp); char c = name.charAt(0); System.out.println(c); for (int i = 1; i &lt; name.length(); i++) { char c = name.charAt(i); if (c == '') { System.out.println(name.charAt(i - 1)); } } } } EDIT: Ok Finally got it. The algorithm is a lot fuzzy but its working and will try to do it next time with Substring.. for (int i = 1; i &lt; temp.length(); i++) { char c1 = temp.charAt(i); if (c1 == ' ') { System.out.print(temp.charAt(i + 1)); System.out.print("."); } } Thanks a lot guys :)
type: Question
upvote count: 4

http://stackoverflow.com/q/21934149
has comment: http://stackoverflow.com/comment/33225144
has comment: http://stackoverflow.com/comment/33225402
tagged with: java
has comment: http://stackoverflow.com/comment/33225241
upvote count: 2
score: 0
has answer: http://stackoverflow.com/a/21934423
downvote count: 2
has comment: http://stackoverflow.com/comment/33225249
has comment: http://stackoverflow.com/comment/33225205
answer count: 7
has answer: http://stackoverflow.com/a/21934385
favorite count: 0
has comment: http://stackoverflow.com/comment/33225233
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33225300
has answer: http://stackoverflow.com/a/21934284
has body: I can enter 2 numbers but when I enter an integer for "wahl" (the switch) the result is wrong. import java.util.Scanner; public class taschenrechner { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println("Bitte erste Zahl eingeben:"); int a = s.nextInt(); System.out.println("Bitte zweite Zahl eingeben:"); int b = s.nextInt(); System.out.println("1.+ \n 2.- \n 3.* \n 4. /"); int wahl = s.nextInt(); switch(wahl){ case 1: addieren(a,b); break; case 2: subtrahieren(a,b); break; case 3: multiplizieren(a,b); break; case 4: dividieren(a,b); break; } System.out.println("Bye Bye World"); } private static int addieren(int a, int b){ int c = a + b; return c; } private static int subtrahieren(int a, int b){ int c = a - b; return c; } private static int multiplizieren(int a, int b){ int c = a * b; return c; } private static int dividieren(int a , int b){ int c = a / b; return c; } } Maybe some method leaks? I wanted to do this with methods and the return function to practice a bit java.
has answer: http://stackoverflow.com/a/21934251
has comment: http://stackoverflow.com/comment/33225327
has answer: http://stackoverflow.com/a/21934337
has title: Java calculator switch dont work
has answer: http://stackoverflow.com/a/38734595
has answer: http://stackoverflow.com/a/21934228
type: Question

http://stackoverflow.com/comment/33298348
type: Comment
has text: If I understood you right, you are reading the first value and use it as size for the arrays `m` and `n`. The values read afterwards are stored (alternating) in both arrays. As Kakarot mentioned, you should make use of `scanner.hasNextInt()` to ensure that input is available. Be sure to think of all possible cases, like i) no input avail at all, ii) input for both arrays avail and iii) input for `n` avail, but not for `m`. You could also try to catch the NoSuchElementException and interpret its occurrence as a criteria for malformed input data.
type: AnswerComment
comment on: http://stackoverflow.com/a/21974527
score: 0

debugging
tags question: http://stackoverflow.com/q/21863364
tags question: http://stackoverflow.com/q/21940873
tags question: http://stackoverflow.com/q/21843666
tag name: debugging
tags question: http://stackoverflow.com/q/21876068
tags question: http://stackoverflow.com/q/21968763
tags question: http://stackoverflow.com/q/21860875
tags question: http://stackoverflow.com/q/21942802
tags question: http://stackoverflow.com/q/21893892
type: Tag
tags question: http://stackoverflow.com/q/21946454
tags question: http://stackoverflow.com/q/21937642
tags question: http://stackoverflow.com/q/21986063
tags question: http://stackoverflow.com/q/21969231
tags question: http://stackoverflow.com/q/21922759
tags question: http://stackoverflow.com/q/21863368
tags question: http://stackoverflow.com/q/21869288
tags question: http://stackoverflow.com/q/21917947
tags question: http://stackoverflow.com/q/21862970
tags question: http://stackoverflow.com/q/21912348

http://stackoverflow.com/q/21959686
answer count: 4
has comment: http://stackoverflow.com/comment/33271782
type: UnansweredQuestion
tagged with: http-status-code-404
has answer: http://stackoverflow.com/a/21960030
has title: 404 error while running web-app using Struts on tomcat in Eclipse
tagged with: java
has comment: http://stackoverflow.com/comment/33271937
tagged with: struts
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/33272054
has comment: http://stackoverflow.com/comment/33272019
has answer: http://stackoverflow.com/a/21959805
has comment: http://stackoverflow.com/comment/33271856
has body: I am a beginner to web development using struts. I have followed an online tutorial into making a web-app using Struts in Eclipse. The link of the tutorial is http://www.dzone.com/tutorials/java/struts/struts-tutorial/struts-tutorial-using-eclipse-1.html where the source code is available. When i start the server and run the application , i get 404 page not found error despite i feel like i have done things properly. I have attached the error page i get. Also I have checked logs for errors, but it doesn't give me any information apart from this So can anyone please help me find out why isn't the app working? struts-config file
tagged with: tomcat
has answer: http://stackoverflow.com/a/21961289
score: 0
has answer: http://stackoverflow.com/a/40845240

http://stackoverflow.com/q/21877373
has answer: http://stackoverflow.com/a/32722488
downvote count: 0
tagged with: websocket
score: 21
favorite count: 0
has comment: http://stackoverflow.com/comment/33728396
type: Question
tagged with: spring
has comment: http://stackoverflow.com/comment/33163974
tagged with: java
has comment: http://stackoverflow.com/comment/33130931
has comment: http://stackoverflow.com/comment/33685593
upvote count: 21
answer count: 7
has answer: http://stackoverflow.com/a/22049519
has comment: http://stackoverflow.com/comment/33688999
has answer: http://stackoverflow.com/a/22053461
has body: I am trying to run a demo of spring web socket but not able to test it completely. I am using java 7 and tomcat 7.0.50. I don't get any error while server startup, but when I open the web page with js making the connection to it I got 404 page not found. I am not sure if I am missing anything in configuration to make it run and how can I be able to connect it from js side. I have following xml file: &lt;beans ....&gt; &lt;context:annotation-config /&gt; &lt;websocket:message-broker application-destination-prefix="/app"&gt; &lt;websocket:stomp-endpoint path="/hello"&gt; &lt;websocket:sockjs /&gt; &lt;/websocket:stomp-endpoint&gt; &lt;websocket:simple-broker prefix="/topic" /&gt; &lt;/websocket:message-broker&gt; &lt;/beans&gt; My controller class is: @Controller public class SwsService { @MessageMapping("/hello") @SendTo("/topic/greetings") public Greeting greeting(HelloMessage message) throws Exception { return new Greeting("Hello, " + message.getName() + "!"); } public String getGreeting() { return "Hello, you are in!"; } } The js from which I am calling this is: var sock = new SockJS("/hello"); sock.onopen = function () { console.log("open"); }; sock.onclose = function () { console.log("closed"); }; sock.onmessage = function (message) { console.log("msg", message); }; The console output when I run the tomcat: Feb 19, 2014 3:28:47 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files\TortoiseGit\bin;C:\Python24;C:\Program Files\TortoiseSVN\bin;C:\Program Files\nodejs\;C:\…
linked to: http://stackoverflow.com/q/21883033
has comment: http://stackoverflow.com/comment/33691035
has answer: http://stackoverflow.com/a/25090961
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/58003087
has title: Not able to run spring web socket demo
has answer: http://stackoverflow.com/a/22194145
has answer: http://stackoverflow.com/a/57051467

http://stackoverflow.com/comment/33313980
type: QuestionComment
has text: I want to do search in my own code @greg-449.
score: 0
comment on: http://stackoverflow.com/q/21978937
type: Comment

http://stackoverflow.com/comment/65023058
has text: Others did not work, so I have shared mine. Let me know reason for -1 please.
type: Comment
comment on: http://stackoverflow.com/a/38814282
type: AnswerComment
score: 0

http://stackoverflow.com/q/21989782
favorite count: 0
has comment: http://stackoverflow.com/comment/33324737
has comment: http://stackoverflow.com/comment/33324682
has answer: http://stackoverflow.com/a/21990181
accepted answer: http://stackoverflow.com/a/21990181
has title: Can't connect to Access database ("architecture mismatch" error)
tagged with: jdbc
possible better answer: http://stackoverflow.com/a/21989843
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21989843
downvote count: 0
has body: A program to retrive records from database import java.sql.*; import javax.sql.*; public class Database { public static void main(String a\[\]) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn =DriverManager.getConnection("jdbc:odbc:data"); Statement st=cn.createStatement(); ResultSet rs= st.executeQuery("select * from student "); while(rs.next()) { int r=rs.getInt(1); String n= rs.getString(2); int m=rs.getInt(3); System.out.println("Roll Name Marks"); System.out.println(r+" "+n+" "+m); } cn.close(); } catch(Exception e) { } } }][1] I am running 64 bit Windows 7 Created the DSN from sysWOW64 folder Have a database consisting of 3 fields Roll Name Mark After Compiling no errors are found Executing the program results in no Output Why I am not able to Execute the program ![At command line no output][1] Edit from comments The exception I am getting is SQLException: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
tagged with: java
duplicate of: http://stackoverflow.com/q/20008501
type: Question
linked to: http://stackoverflow.com/q/20008501
has comment: http://stackoverflow.com/comment/33324913
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/33324802
has comment: http://stackoverflow.com/comment/33324973
tagged with: ms-access

http://stackoverflow.com/q/21940873
tagged with: java
tagged with: loops
tagged with: eclipse
type: Question
tagged with: debugging
tagged with: for-loop
has body: How can I debug complicated for-loops in eclipse like in this code? import java.util.Arrays; import java.util.List; public class ListTraining { public void countOccurence() { List&lt;Integer&gt; numbers = Arrays.asList(3, 4, 3, 5, 2, 3); Integer number = 3; for (int i = numbers.indexOf(number), j = -1; i &gt; j; j = i, i += numbers.subList(i + 1, numbers.size()).indexOf(number) + 1) { System.out.println("found number: " + number + " at position: " + i); } } } If I use "Step Over" I'm in the instruction block. If I use "Step Into" I'm inside methods like indexOf. How can I investigate the variables and calls in the loop header in a comfortable way? Is it possible to jump in the single instructions of the loop like in the condition check or in the variable assignment?
has title: Comfortable way for debugging for-loops in eclipse
has answer: http://stackoverflow.com/a/21941124
has answer: http://stackoverflow.com/a/73789023
upvote count: 1
has answer: http://stackoverflow.com/a/21940913
has answer: http://stackoverflow.com/a/21941111
favorite count: 0
type: UnansweredQuestion
answer count: 4
downvote count: 0
score: 1

http://stackoverflow.com/q/21859815
tagged with: java
has comment: http://stackoverflow.com/comment/33093913
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/21871277
score: 0
answer count: 3
has body: I am trying to add a JFileChooser to JPanel. Sometimes it works properly and sometimes it shows just the JPanel without the JFileChooser dialogue box. Now i actually don't know what to do . Can anyone help me please? Here is my code(It is a method): public File chooseFileFromComputer(){ methodPanel = new JPanel(); methodPanel.setLayout(null); methodFrame = new JFrame(); methodFrame.setTitle("File Chooser"); methodFrame.setVisible(true); BufferedImage removeJavaImage = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); methodFrame.setIconImage(removeJavaImage); methodLabel = new JLabel("Choose a file: "); methodLabel.setBounds(10, 10, 80, 20); methodPanel.add(methodLabel); fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(false); fileChooser.setBounds(10, 35, 550, 500 ); fileChooser.setVisible(true); add(fileChooser); /** * Action Events #********AE*******# **/ fileChooser.addActionListener( new ActionListener(){ public void actionPerformed(ActionEvent actionEvent) { String command = actionEvent.getActionCommand(); if (command.equals(JFileChooser.APPROVE_SELECTION)) { selectedFile = fileChooser.getSelectedFile(); methodFrame.setVisible(false); } else if (command.equals(JFileChooser.CANCEL_SELECTION)) { methodFrame.setVisible(false); } } }); //End of Action Events #________AE_______# methodPanel.add(fileChooser); methodFrame.setContentPane(methodPanel); methodFrame.setResizable(false); methodFrame.setSize(600, 600); methodFrame.setDefaultCloseOperation(EXIT_ON_CLOSE); return selectedFile; }
has answer: http://stackoverflow.com/a/21859932
has title: Problems with JFileChooser in java GUI
has answer: http://stackoverflow.com/a/21859913
type: UnansweredQuestion

http://stackoverflow.com/comment/33088871
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21857474
type: Comment
has text: Hi Batty, as I said, the code snippets I provided work fine. It's when I run my experiment that I encounter the problem. I provided the snippets as a means to demonstrate the means I am using to kick off the threads without having to publish thousands of lines of code.

http://stackoverflow.com/comment/33260353
score: 0
type: QuestionComment
type: Comment
has text: possible duplicate of [System.getProperty("java.class.path") does not show "WEB-INF/lib" and the including jars](http://stackoverflow.com/questions/4273039/system-getpropertyjava-class-path-does-not-show-web-inf-lib-and-the-includ)
comment on: http://stackoverflow.com/q/21953424

http://stackoverflow.com/comment/33341552
has text: Better to improve your algorithm if possible.
comment on: http://stackoverflow.com/q/21998591
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33081252
type: AnswerComment
comment on: http://stackoverflow.com/a/21853615
type: Comment
has text: Hibernate normally autodetects the dialect, that is why OP reports not observing any effect of the setting.
score: 1

http://stackoverflow.com/q/21999493
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33343072
answer count: 0
has comment: http://stackoverflow.com/comment/33343030
has comment: http://stackoverflow.com/comment/73508457
tagged with: java
has comment: http://stackoverflow.com/comment/33342921
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33342910
score: 0
has body: I wanted to know if canWrite() method of File class can be used to test directory path like below? String filePath = "\\folder1\\folder2\\subfolder1\\actualfolder\\"; File f = new File(filePath); if(f.exists()){ boolean wStatus = f.canWrite(); boolean rStatus = f.canRead(); } here I wanted to check if the folder "actualfolder" is writable or not. Do I need to go back to a folder back and test it or simply can I check using method canWrite()? I am supposed to use currently Jdk1.6 and not supposed to create a file and then delete under that folder to verify if the directory is writable
has comment: http://stackoverflow.com/comment/33342881
has title: canWrite method on file
has comment: http://stackoverflow.com/comment/33342958
favorite count: 0

http://stackoverflow.com/comment/33077941
type: Comment
has text: using another option will be considered later, but right now i need a fix not an alternative.
comment on: http://stackoverflow.com/a/21851653
score: 0
type: AnswerComment

http://stackoverflow.com/a/22020285
score: -1
has comment: http://stackoverflow.com/comment/33390913
upvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33455464
type: Answer
has comment: http://stackoverflow.com/comment/33407042
downvote count: 1
has comment: http://stackoverflow.com/comment/33391559
accepted answer of: http://stackoverflow.com/q/22001055
has body: Thanks to a happy accident of failing to fully clean up my pom file after a test, I discovered how to do this. In the tag, add /lib . This will put all modules by default in a lib folder in a root of a directory. No wildcards are needed; in fact, Maven doesn't support wild cards in this part, probably because there are no clear bounds (it could be interpreted as "move all artifacts ever"). Wild cards only work for exclusions because there are clear bounds; it's a subset of a clearly defined set of artifacts. If you'd like to make an exception, then you specify the module and type in / , which will place it back in the root. The full XML looks like this: <build> [...] maven-ear-plugin 2.9 /lib MainProject MainProject / This results in the original goal of putting all dependencies in a lib folder except for MainProject.jar: -target/ -MyProject.ear -MyProject/ -MainProject.jar -lib/ -Dependency.jar
answers question: http://stackoverflow.com/q/22001055

http://stackoverflow.com/comment/33167432
type: QuestionComment
type: Comment
has text: Please explain with more words? what u would say here.
comment on: http://stackoverflow.com/q/21901118
score: 0

http://stackoverflow.com/comment/33109167
has text: I am disappointed you deleted your comment as it was a relevant link, especially for anyone who decides to use the oracle tutorials.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21868425
type: AnswerComment

http://stackoverflow.com/a/25136404
type: Answer
has body: The value of hibernate.hbm2ddl.auto should be none. If you are using maven then do a clean and package and then run tomcat (mvn tomcat:run). The issue is most likely because tomcat is picking up an older version of war.
accepted answer of: http://stackoverflow.com/q/21930120
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21930120
score: 0

http://stackoverflow.com/comment/33263241
has text: @GeorgiGeorgiev - The following will help: http://blog.bdoughan.com/2012/07/jaxb-and-root-elements.html
type: Comment
score: 2
comment on: http://stackoverflow.com/a/21954753
type: AnswerComment

http://stackoverflow.com/q/21994850
has answer: http://stackoverflow.com/a/22005853
tagged with: jogl
tagged with: java
type: Question
has body: I have a project using Jogl 1.0 library http://easystoneshop.com/applets/CountertopQuote/index.html. My application start as Java Web Start. All work allright, but on Mac Os X 10.7.5 whith update JDK 1.7.0.51 my project don't work. Exeption: JNLPClassLoader: Finding library libjogl.dylib exception in QueueFlusher: javax.media.opengl.GLException: java.lang.UnsatisfiedLinkError: sun.java2d.opengl.CGLSurfaceData.createCGLContextOnSurface(Lsun/java2d/opengl/CGLSurfaceData;J)J at com.sun.opengl.impl.Java2D.createOGLContextOnSurface(Java2D.java:470) at com.sun.opengl.impl.macosx.MacOSXJava2DGLContext.create(MacOSXJava2DGLContext.java:116) at com.sun.opengl.impl.macosx.MacOSXJava2DGLContext.makeCurrentImpl(MacOSXJava2DGLContext.java:72) at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134) at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182) at javax.media.opengl.GLJPanel$2.run(GLJPanel.java:650) at sun.java2d.opengl.OGLRenderQueue$QueueFlusher.run(OGLRenderQueue.java:234) Caused by: java.lang.UnsatisfiedLinkError: sun.java2d.opengl.CGLSurfaceData.createCGLContextOnSurface(Lsun/java2d/opengl/CGLSurfaceData;J)J at sun.java2d.opengl.CGLSurfaceData.createCGLContextOnSurface(Native Method) at sun.java2d.opengl.CGLSurfaceData.createOGLContextOnSurface(CGLSurfaceData.java:378) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.sun.opengl.impl.Java2D.createOGLContextOnSurface(Java2D.java:468) ... 6 more I try run project on Mac Os X 10.7.5 whith JDK 1.6.0.37 and all worked. I add native library file libjogl.jnilib on JRE Library and as Application all worked on Mac whith JDK 1.7. I try update Jogl to version 2.2 but have many Exeption: Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLExcepti…
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21998580
tagged with: macos
has title: Java Web Start + Jogl + MacOSX + JDK1.7
type: UnansweredQuestion

http://stackoverflow.com/comment/33141041
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21885975
type: AnswerComment
has text: @Sunrise `sleep2()` was already `synchronized`. I don't understand your confusion.

http://stackoverflow.com/a/21954539
score: 2
has comment: http://stackoverflow.com/comment/33269066
upvote count: 2
has comment: http://stackoverflow.com/comment/33266842
answers question: http://stackoverflow.com/q/21954501
has comment: http://stackoverflow.com/comment/33286472
downvote count: 0
has comment: http://stackoverflow.com/comment/33286571
has body: You should not be nesting AlertDialogs inside other AlertDialogs. So this: new AlertDialog.Builder(this) .setMessage(s) .show(); Will use the wrong context, but you will have to pass an activity as the context Try using YourActivity.this or view.getContext() as param instead Update: about your NumberFormatException you should try this: try { aa = Integer.parseInt(inputa.getText().toString()); } catch (NumberFormatException e) { System.out.println("not a number: " + inputa.getText().toString()); e.printStackTrace(); } But you need to be sure that your editText only allows numbers!!
type: Answer

http://stackoverflow.com/q/21980158
has title: how to resolve syntax error after decompiling the .class file
favorite count: 0
tagged with: exception
type: UnansweredQuestion
tagged with: decompiler
tagged with: android
has body: My Problem is that when i decompiled my .class file it show error in catch block and reflecting weird end result here is my code . public void f() { try { if (this.u == 0) { this.h(); } else { this.i(); } } catch (Exception var2) { throw var2; // exception occur here } }
has comment: http://stackoverflow.com/comment/33308918
has comment: http://stackoverflow.com/comment/33352696
has comment: http://stackoverflow.com/comment/33308334
has comment: http://stackoverflow.com/comment/33308349
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33308366
type: Question
has comment: http://stackoverflow.com/comment/33309178
tagged with: decompiling
has answer: http://stackoverflow.com/a/22042589
has comment: http://stackoverflow.com/comment/33308265
has comment: http://stackoverflow.com/comment/33326346
has comment: http://stackoverflow.com/comment/33308544
has comment: http://stackoverflow.com/comment/33308318
has answer: http://stackoverflow.com/a/21981235
has comment: http://stackoverflow.com/comment/33371152
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/33308490
has answer: http://stackoverflow.com/a/21980215

http://stackoverflow.com/comment/33342426
type: QuestionComment
comment on: http://stackoverflow.com/q/21999061
type: Comment
has text: What line is line 28? That's where you NullPointerException is.
score: 0

http://stackoverflow.com/a/21950293
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21948804
has comment: http://stackoverflow.com/comment/33277935
has comment: http://stackoverflow.com/comment/33272447
has comment: http://stackoverflow.com/comment/33277494
has body: You never actually write something into your BufferedImage. Read the Buffer You can use glReadPixels to access the selected buffer. (I assume WIDTH and HEIGHT as your OpenGLContext dimensions.) FloatBuffer imageData = BufferUtils.createFloatBuffer(WIDTH * HEIGHT * 3); GL11.glReadPixels(0, 0, WIDTH, HEIGHT, GL11.GL_RGB, GL11.GL_FLOAT, imageData); imageData.rewind(); Use whatever parameters suit your needs best, I just picked floats randomly. Set the Image Data You already figured out how to create and save your image, but in between you should also set some content to the image. You can do this with BufferedImage().setRGB() (Note that I don't use a good naming as you do, to keep this example concise.) // create image BufferedImage image = new BufferedImage( WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB ); // set content image.setRGB(0, 0, WIDTH, HEIGHT, rgbArray, 0, WIDTH); // save it File outputfile = new File("Screenshot.png"); try { ImageIO.write(image, "png", outputfile); } catch (IOException e) { e.printStackTrace(); } The most tricky part is now getting the rgbArray. The problems are that OpenGL gives you three values (in this case, i.e. using GL11.GL_RGB), while the BufferedImage expects one value. OpenGL counts the rows from bottom to top while BufferedImage counts from top to bottom. Calculate one Integer from three Floats To get rid of problem one you have to calculate the integer value which fits the three number you get. I will show this with a simple example, the color red which is (1.0f, 0.0f, 0.0f) in your FloatBuffer. For the integer value it might be easy to think of numbers in hex values, as you might know from CSS where it's very common to name colors with those. Red would be #ff0000 in CSS or in Java of course 0xff0000. Colors in RGB with integers are usually represented from 0 to 255 (or 00 to ff in hex), while you use 0 to 1 with floats or doubles. So first you have to map them to the correct range by simply multiplying the values by 255 and casting…
upvote count: 5
has comment: http://stackoverflow.com/comment/33272669
accepted answer of: http://stackoverflow.com/q/21948804
score: 5

http://stackoverflow.com/comment/33345286
type: AnswerComment
comment on: http://stackoverflow.com/a/22000203
type: Comment
has text: How do I parameterize? `return fishArr<Fish>;` ? I changed fishArr to an ArrayList `ArrayList<Fish> fishArr = new ArrayList<Fish>();` but isn't that the paramter of fishArr?
score: 0

http://stackoverflow.com/comment/33219372
type: QuestionComment
has text: Firstly, you're always skipping an element after you remove one. Either work from back to front, or decrement `i` after a `remove` operation, or use an iterator.
type: Comment
score: 3
comment on: http://stackoverflow.com/q/21930817

http://stackoverflow.com/comment/33224512
score: 0
has text: Saw your edits this morning as I was thinking about how I skirted the issue with my answer. :-) It's a good question, so added my upvote for you.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21914871

http://stackoverflow.com/comment/33292439
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21971289
has text: And @Raghunandan is right, you need to set the View for your Activity

http://stackoverflow.com/q/21893910
upvote count: 0
has comment: http://stackoverflow.com/comment/33155768
possible better answer: http://stackoverflow.com/a/21894339
favorite count: 0
has comment: http://stackoverflow.com/comment/33155227
has answer: http://stackoverflow.com/a/21894339
has title: Storing editText to variables, Android Java
tagged with: android
score: -3
has comment: http://stackoverflow.com/comment/33155378
tagged with: gettext
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21894561
tagged with: java
has comment: http://stackoverflow.com/comment/33155532
downvote count: 3
has comment: http://stackoverflow.com/comment/33157811
type: Question
has comment: http://stackoverflow.com/comment/33155870
has comment: http://stackoverflow.com/comment/33155197
has comment: http://stackoverflow.com/comment/33155103
has comment: http://stackoverflow.com/comment/33158315
has body: I posted this question before, however i didnt explain myself good. I will have the other question removed. Here is my current situation: I have a regular xml page with a textView which when clicked opens a popup dialog. This dialog contains 2 editText. Currently my code (OnClick – Done button) gets the value of both edit texts and puts them into the single TextView. However when i open the pop-up again, instead of the two strings being listed in its own editText (Where each string was originally inputted) the combined string which was stored in the text view appears in one edit text. The issue is that although i’m getting the strings from 2 different editText’s and storing them into one textView. I cannot get each string back individually. I understand that i may have to store the string from each editText into variables and then i can use the variables to show the strings combined in the textView (and the editText – when i open the popup dialog again) How would i go about this? Thank for your help The code: public class MainActivity extends Activity { /** Called when the activity is first created. */ TextView showPopUpButton; EditText getInput; EditText getInput2; String myvalue = ""; String myvalue2 = ""; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); showPopUpButton = (TextView) findViewById(R.id.buttonShowPopUp); showPopUpButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showPopUp3(); } }); } private void showPopUp3() { AlertDialog.Builder helpBuilder = new AlertDialog.Builder(this); helpBuilder.setTitle("Enter PU Builder"); LayoutInflater inflater = getLayoutInflater(); View checkboxLayout = inflater.inflate(R.layout.popuplayout, null); helpBuilder.setView(checkboxLayout); getInput = (EditText) checkboxLayout.findViewById(R.id.editText1); getInput2 = (EditText) checkboxLayout.findViewById(R.id.editText2); getInput.setText(myvalue); g…
tagged with: variables
has comment: http://stackoverflow.com/comment/33155431
tagged with: settext
answer count: 2
has answer: http://stackoverflow.com/a/21894561

http://stackoverflow.com/comment/33264392
score: 0
has text: You can read a lot, probably 100 megabytes at least with your jvm settings. If you run out of memory look at how to increase the JVM memory size.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21955646

http://stackoverflow.com/comment/33144048
type: QuestionComment
comment on: http://stackoverflow.com/q/21887756
has text: The error message is pretty clear here.
score: 0
type: Comment

http://stackoverflow.com/a/21877404
has comment: http://stackoverflow.com/comment/33125418
answers question: http://stackoverflow.com/q/21876536
has comment: http://stackoverflow.com/comment/33125054
type: Answer
has comment: http://stackoverflow.com/comment/33124683
has comment: http://stackoverflow.com/comment/33124799
has comment: http://stackoverflow.com/comment/33125362
has comment: http://stackoverflow.com/comment/33124712
has comment: http://stackoverflow.com/comment/33125341
has body: you must change insert code following as: insert into login (FirstName,LastName,Gender,Category, Dateofbirth,Age,Address,Country,State,city,PinCode, EmailId,ContactNo,MobileNo)values(?,?,?,?,?,?,?,?,?,?); you should check this user model like as: private int userid; public int getUserid() { return userid; } public void setUserid(int userid) { this.userid=userid; } you should change this type for your insert type: public void addUser(User user) { try { PreparedStatement preparedStatement=connection.prepareStatement("insert into users (firstname,lastname,dob,email)values(?,?,?,?)"); preparedStatement.setString(1, user.getFirstName()); preparedStatement.setString(2, user.getLastName()); preparedStatement.setDate(3, new java.sql.Date(user.getDob().getTime())); preparedStatement.setString(4, user.getEmail()); preparedStatement.executeUpdate(); } catch(SQLException e) { e.printStackTrace(); } }
has comment: http://stackoverflow.com/comment/33124844
has comment: http://stackoverflow.com/comment/33124995
has comment: http://stackoverflow.com/comment/33124911
has comment: http://stackoverflow.com/comment/33125060
has comment: http://stackoverflow.com/comment/33128038
has comment: http://stackoverflow.com/comment/33127757
score: 0

http://stackoverflow.com/q/21906566
has comment: http://stackoverflow.com/comment/33182281
has answer: http://stackoverflow.com/a/21927177
score: 0
has title: How Smart-gwt SC.askforValue() cancel can be handled?
answer count: 1
accepted answer: http://stackoverflow.com/a/21927177
tagged with: smartgwt
has body: My Question: In the code below I try to ask user a value. SC.askforValue() is called with all possible variables, a Dialog is given as parameter to adjust the dialog. My problem is what happens, when user presses cancel? On my current smartGwt version (2.1), is it possible to see the cancel alone? Now empty value and cancel get both handled in the same way. My Code: Dialog dialog = new Dialog(); dialog.setWidth(200); SC.askforValue("myTitle", "myQuestion", "defaultValue", new ValueCallback() { @Override public void execute(String value) { if (value != null) { // do sth. } else { /* cancel pressed / empty value. */ } } }, dialog);
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33176568
tagged with: java
type: Question
tagged with: gwt

http://stackoverflow.com/a/21844247
type: Answer
answers question: http://stackoverflow.com/q/21843865
accepted answer of: http://stackoverflow.com/q/21843865
type: AcceptedAnswer
score: 0
has body: The sdk generate an id for you, and that id is a way to access the resource, so it doesn't make sense to edit it and you shouldn't. Rebuild your project and then the SDK will generate the id. Just specify and id name in the android:id="@+id/&lt;idName&gt;" and the sdk will do its work, if you want to specify an image in the ImageView use the src property, like this: &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/image" /&gt;

http://stackoverflow.com/q/21886836
accepted answer: http://stackoverflow.com/a/21886902
tagged with: arrays
has comment: http://stackoverflow.com/comment/33141658
has comment: http://stackoverflow.com/comment/33141888
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/33142232
has comment: http://stackoverflow.com/comment/33141851
favorite count: 0
has answer: http://stackoverflow.com/a/21886902
downvote count: 1
possible better answer: http://stackoverflow.com/a/21887207
type: AnsweredQuestion
has title: 4 Key Value HashMap? Array? Best Approach?
has answer: http://stackoverflow.com/a/21887207
has comment: http://stackoverflow.com/comment/33141587
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33141649
type: Question
has answer: http://stackoverflow.com/a/21887359
tagged with: hashmap
has body: I've got loads of the following to implement. validateParameter(field_name, field_type, field_validationMessage, visibleBoolean); Instead of having 50-60 of these in a row, is there some form of nested hashmap/4d array I can use to build it up and loop through them? Whats the best approach for doing something like that? Thanks! EDIT: Was 4 items.

http://stackoverflow.com/a/21876380
accepted answer of: http://stackoverflow.com/q/21864521
has comment: http://stackoverflow.com/comment/42616464
score: 101
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33138474
has comment: http://stackoverflow.com/comment/78038002
type: Answer
has comment: http://stackoverflow.com/comment/55272728
has comment: http://stackoverflow.com/comment/47626830
has comment: http://stackoverflow.com/comment/101022830
has body: The only plausible explanation to this problem is there is an older version of HttpCore on the classpath (unless you also want to consider a possibility of green men from Mars messing with your computer remotely from a flying saucer). You can add this snippet to your code to find out what jar the class gets picked up from. This might help find out why that jar is on your classpath in the first place. ClassLoader classLoader = MyClass.class.getClassLoader(); URL resource = classLoader.getResource("org/apache/http/message/BasicLineFormatter.class"); System.out.println(resource); This basically tells me that in my case the jar resides in the local maven repository and likely to have been added to the classpath by Maven jar:file:/home/oleg/.m2/repository/org/apache/httpcomponents/httpcore/4.3.1/httpcore-4.3.1.jar!/org/apache/http/message/BasicLineFormatter.class
has comment: http://stackoverflow.com/comment/81878668
upvote count: 101
answers question: http://stackoverflow.com/q/21864521

http://stackoverflow.com/q/21958662
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/33309913
has comment: http://stackoverflow.com/comment/33309803
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/33270474
has title: Spring - referencing children contexts from parent context
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33309790
tagged with: spring
has body: I have an interesting use case where I'm considering writing a generic FactoryBean to choose an instance from one of two contexts. Details: My parent context is called root and has two children: legacy and newShiny. The two children contexts are registered as regular beans on the root context. Now my FactoryBean looks like: class MyServiceFactoryBean extends AbstractFactoryBean&lt;MyService&gt; { @Inject @Qualifier("legacy") ApplicationContext legacy; @Inject @Qualifier("newShiny") ApplicationContext newShiny; @Override protected MyService createInstance() throws Exception { if (tossCoin() == HEADS) { return legacy.getBean(MyService.class); } else { return newShiny.getBean(MyService.class); } } @Override public java.lang.Class&lt;?&gt; getObjectType() { return MyService.class; } } It really seems like the solution to my problem, but making the parent aware of its children feels dirty and illegal (what world do we live in?). So, is this a bad idea? Why? What problems can it cause? What are the alternatives? Or maybe it's an almost normal thing to do? For a bit of background, I need to support two very different models that I want to hide behind interfaces and choose the implementation at runtime (yes, it has to be dynamic at runtime). I'm considering using different contexts for them to keep things cleaner and avoid interference.
has comment: http://stackoverflow.com/comment/33287942

http://stackoverflow.com/comment/33310010
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21981234
has text: try this , `int result = db.delete(TABLE_READINGS, COLUMN_COMPLAINT_NO +"="+ id, null);` and print the value of `result`. If it is `0` that means your row is not getting deleted. First check this part.

http://stackoverflow.com/comment/33296882
type: Comment
type: QuestionComment
has text: In the 1st example it's not necesssary, I can reshuffle the same deck, in the second example I need to, becuase I remove cards. But that really is not the issue, as the cloning takes a meager amount of time compared to the shuffling.
comment on: http://stackoverflow.com/q/21973874
score: 0

http://stackoverflow.com/comment/33191082
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21914619
has text: Also there is a colon instead of a semi-colon at system.out.println("enter your studentID here"):

http://stackoverflow.com/comment/33282972
type: QuestionComment
comment on: http://stackoverflow.com/q/21961762
has text: ok so it should be fine then, do you have the v13 library attached to your project? android-support-v13.jar?
score: 0
type: Comment

http://stackoverflow.com/comment/33073682
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21848746
has text: yeah, that's correct, but which class in JUnit framework is doing that?

http://stackoverflow.com/comment/33855735
has text: Thanks to @stephenc for the PMD explanations, they are part of the right answer.
type: Comment
comment on: http://stackoverflow.com/a/22285263
score: 0
type: AnswerComment

http://stackoverflow.com/q/21990034
answer count: 1
has comment: http://stackoverflow.com/comment/33328034
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21990183
tagged with: java
has title: filter for null value not working for DB2 and Sybase
type: Question
has body: The Java based Application is using common select query to extract records from all databases. The records with null values for a particular column(here 'id') should get dropped. This is the query: SELECT * from Employee WHERE 1=1 AND id IS NOT NULL AND cast(id as varchar) !='' It works fine for all databases but gives SQLException for DB2. The goal is : Check if null and blank value is considered same in DB2/Sybase. Modify the SQL query to make it work for DB2/Sybase
tagged with: db2
score: 0
tagged with: sql
has comment: http://stackoverflow.com/comment/33360607

http://stackoverflow.com/comment/33212407
comment on: http://stackoverflow.com/a/21926331
type: AnswerComment
type: Comment
score: 0
has text: With atomic integer you'd then have the same problem with atomically updating individual bits.

http://stackoverflow.com/comment/33098685
has text: Do i put this in my some other class or database class?
type: Comment
comment on: http://stackoverflow.com/a/21862915
type: AnswerComment
score: 0

http://stackoverflow.com/a/21904671
type: Answer
answers question: http://stackoverflow.com/q/21904593
score: 0
has body: String[] array = givenString.split("-"); and to check it, if(givenString.contains("-")) return true;

http://stackoverflow.com/a/22013603
has body: Jackson has to know in what order to pass fields from a JSON object to the constructor. It is not possible to access parameter names in Java using reflection - that's why you have to repeat this information in annotations.
has comment: http://stackoverflow.com/comment/52716967
upvote count: 154
accepted answer of: http://stackoverflow.com/q/21920367
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21920367
has comment: http://stackoverflow.com/comment/53245983
score: 151
type: Answer
has comment: http://stackoverflow.com/comment/53246630
downvote count: 3

http://stackoverflow.com/comment/33301632
comment on: http://stackoverflow.com/a/21976339
type: AnswerComment
score: 0
type: Comment
has text: I clarified my answer.

http://stackoverflow.com/q/21967386
has comment: http://stackoverflow.com/comment/33285950
favorite count: 0
has comment: http://stackoverflow.com/comment/33285753
type: Question
has comment: http://stackoverflow.com/comment/33285757
has comment: http://stackoverflow.com/comment/33285802
accepted answer: http://stackoverflow.com/a/21967418
has answer: http://stackoverflow.com/a/21967731
possible better answer: http://stackoverflow.com/a/21967424
score: 0
tagged with: multithreading
answer count: 3
has answer: http://stackoverflow.com/a/21967424
upvote count: 1
downvote count: 1
tagged with: java
has title: Protection for thread safety
has answer: http://stackoverflow.com/a/21967418
has body: I understand the very basics of the public and private keywords (I'm still not sure what protected does) I have a question regarding "protection of data members for thread safety." For example, say I have a class MyClass that extends Thread and belonging to this class is a private data member called MyDataMember. Suppose there are public accessor and setter functions for this data member which make sure to synchronize the data member. Now this is all fine from an "external" point of view in that other threads can only set and retrieve the data member when synchronized properly. However, what about other functions within MyClass ? Say I have another function within MyClass called DoSomething. I know I should not attempt to access MyDataMember directly, but I might forget from time to time to call the accessor/setter methods and access/set the data member directly. My question is: Is there a keyword I can use to declare function members exclusive access to certain data members? This way, if I "accidentally" directly access a data member from a method that does not have exclusive access, then an error would occur. I just think this would make things a bit safer during development (at least for me!)
has comment: http://stackoverflow.com/comment/33285759
linked to: http://stackoverflow.com/q/215497
linked to: http://stackoverflow.com/q/3488703
type: AnsweredQuestion

http://stackoverflow.com/comment/33153782
comment on: http://stackoverflow.com/q/21893145
has text: So, how can I do that using Maven?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21895587
has body: OK, I'll take a crack at it. You asked for design help, but it's hard to without knowing your requirements. The createApp() method doesn't have a throws clause in the signature, so you're either going to have to catch every checked exception inside that method OR allow unchecked exceptions to bubble out. Which is closer to meeting your requirement? What should users expect to happen if there's a problem when createApp() is executed? Feels pretty fundamental. Should the app shut down with a graceful message? Is there a way forward if this fails? What does an ErrorCode, which can be ignored, provide that a checked, custom exception does not? Exceptions are a response to the C return code, which can be ignored. It feels like you're taking a step back. I'd prefer custom exceptions with meaningful messages. Since you've said that it's a web service, I'll offer two other thoughts: You should start with an interface. Worry more about that and less about how you'll expose it to clients. It'll be easily testable that way, because it's a POJO. Forget about the fact that it's a web service. Get the POJO interface based behavior right and then expose it to clients. You can change from SOAP to REST to EJB or anything else that way.
has comment: http://stackoverflow.com/comment/33159432
has comment: http://stackoverflow.com/comment/33158100
answers question: http://stackoverflow.com/q/21895425
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21895425
score: 0
type: Answer

http://stackoverflow.com/comment/33229112
score: 0
type: Comment
has text: This code even compile.. use FocusAdapter then, but i don't recommend to use this solution..
comment on: http://stackoverflow.com/a/21936222
type: AnswerComment

http://stackoverflow.com/q/21903583
has comment: http://stackoverflow.com/comment/33171365
has title: Exception error in java when moving from ubuntu 12.04 to 10.04
has answer: http://stackoverflow.com/a/21903716
favorite count: 0
has comment: http://stackoverflow.com/comment/33172709
tagged with: exception
has comment: http://stackoverflow.com/comment/33172873
possible better answer: http://stackoverflow.com/a/21903716
has comment: http://stackoverflow.com/comment/33173373
has answer: http://stackoverflow.com/a/21903700
type: AnsweredQuestion
tagged with: compiler-errors
downvote count: 1
has comment: http://stackoverflow.com/comment/33175365
type: Question
has comment: http://stackoverflow.com/comment/33171700
has body: I am making a data acquisition software using Sparrow's Kmax. I am writing the code on my ubuntu 12.04 laptop. One of the methods I have created is the following public double getValueFrom(String widgName) {//Read data from user input text fields KmaxWidget widg = tlsh.getKmaxWidget(widgName); String str = widg.getProperty("TEXT"); double num = 0; try { num = Double.parseDouble(str); } catch (Exception e) { tlsh.setProperty("STATUSSTR", "Attention! Channel and Energy must be double precision number. i.e. 10, 3.14 etc."); tlsh.showWarning("Choose a double precision number."); throw e; } return num; } // getValueFrom When I compile the code on my laptop it goes without any error. When I copy my code to the ubuntu 10.04 desktop I get an exception code unreported exception java.lang Exception: must be caught or declared to be thrown throw e; ^ The first thing that crossed my mind was that they have different versions of java. Indeed that was true, so I updated 10.04's java, but again the same error occurs. Any idea on what might be wrong? EDIT I also added throws Exception after method's arguments but whenever this method is called I get the error(on both systems) unreported exception Exception; must be caught or declared to be thrown
has comment: http://stackoverflow.com/comment/33174055
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/33172083
accepted answer: http://stackoverflow.com/a/21903700
has comment: http://stackoverflow.com/comment/33171539
has comment: http://stackoverflow.com/comment/33171279
answer count: 2
upvote count: 0

http://stackoverflow.com/comment/33189548
type: QuestionComment
has text: Press the BACK button. There is no requirement for a camera application to immediately return control to your app.
score: 0
comment on: http://stackoverflow.com/q/21913795
type: Comment

http://stackoverflow.com/q/21869896
type: UnansweredQuestion
tagged with: android
has title: Trouble getting the location in android
tagged with: java
has body: I am trying to get the zipcode for the users current location for later use in the program. I've narrowed down the issue to the .getLatitude() and .getLongitude(). For some reason, the latitude and longitude is never set with the methods. Does anyone know why this is and how I can fix it? (I did set the permissions for the fine and coarse locations.) My code is below: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView t = (TextView)findViewById(R.id.TextView01); LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3600, 1000, new LocationListener() { public void onProviderDisabled(String provider) {} public void onProviderEnabled(String provider) {} public void onStatusChanged(String provider, int status, Bundle extras) {} public void onLocationChanged(Location loc) { if(loc != null) { lat = (int)(loc.getLatitude()); lon = (int)(loc.getLongitude()); } } }); t.setText("Lat: " + lat + " and long: " + lon); Geocoder geo = new Geocoder(this, Locale.getDefault()); List&lt;Address&gt; addresses = null; try { addresses = geo.getFromLocation(lat, lon, 1); } catch (IOException e) { t.setText("Could not find the Zip Code"); } if(addresses.equals(null)) t.setText("Couldn't find the zip code"); else { zipcode = addresses.get(0).getPostalCode(); t.setText("Zip Code: " + zipcode); } }
has answer: http://stackoverflow.com/a/21870227
type: Question
has comment: http://stackoverflow.com/comment/33112052
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/45824625
type: Comment
has text: @green: Just pulled your changes, **added exclusion** and `mvn clean package -Pdist` resulted in build success.
score: 0
comment on: http://stackoverflow.com/a/28764207
type: AnswerComment

http://stackoverflow.com/comment/33106355
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21866817
type: Comment
has text: @DavidWallace I find that very hard to swallow. I can't remember the last time I had to deal with something that big. If it really is that big, it shouldn't be in a file, it should be in a database.

http://stackoverflow.com/a/22005331
downvote count: 0
has body: To complete P.T.'s answer I would like to add the following trick. It is really not intuitive that LibGDX doesn't call resume in the first start. But you can easily simulate that yourself. public void create() { resume(); } public void resume() { // this is the only place where you will initialize all assets and your screen/game } Don't do anything in create() and just forward the work to resume(). That way you won't have any code duplication and your initcode will always run on.
answers question: http://stackoverflow.com/q/22003402
has comment: http://stackoverflow.com/comment/33376585
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/22001964
tagged with: concurrency
has title: Simple use of semaphore
type: Question
score: -2
has comment: http://stackoverflow.com/comment/33347450
answer count: 1
has comment: http://stackoverflow.com/comment/33347330
has body: It might be a stupid question to ask but I wanted to know that how semaphores work in Java. I have read many articles regarding it (on stackoverflow also) but could not get the idea of it. Does not the predefined class Semaphore have any methods? Is it like we have to declare the object of it and write our own methods for the synchronization. Thanks.
favorite count: 0
has comment: http://stackoverflow.com/comment/33351516
type: UnansweredQuestion
tagged with: semaphore
has answer: http://stackoverflow.com/a/22002034
tagged with: java
downvote count: 3
upvote count: 1

http://stackoverflow.com/a/21965176
type: Answer
answers question: http://stackoverflow.com/q/21965087
has comment: http://stackoverflow.com/comment/33282170
accepted answer of: http://stackoverflow.com/q/21965087
has body: Usually in a function memory is allocated in the stack for non-object variables and when a function completes its execution, the stack is cleared and memory is freed. For objects, memory is allocated in the heap (You will remember malloc() and free() in C). But in Java and C# , the free() function is what the garbage collector does for you instead of you worrying about it. So even in functions, the objects are local variables but not stored in stack but on heap. So they are not the same as int i. But when the function is completed, those objects are out of scope. So you will no longer have access to them but their memory is not freed until garbage collector runs and clears them. But how a garbage collector runs, when it runs is all based on different algorithm. They may not be the same for even different implementations of Java (e.g sun java may have different algorithm than another Java implementation)
has comment: http://stackoverflow.com/comment/33282227
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/33282441
has comment: http://stackoverflow.com/comment/33282419
has comment: http://stackoverflow.com/comment/33282137
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21993512
has body: Hi I was just working with arrays and I had few problems with creating a 2D array in a 3 by 3 grid. Below is an example of 1D arrray that I created with 9 buttons which is working fine atm, as it displays all 9 of the buttons. frame.setLayout(new GridLayout(3,3)); JButton[] buttons = new JButton[9]; for (int i = 0; i &lt; buttons.length; i++){ buttons[i] = new JButton(); frame.add(buttons[i]); buttons[i].setText("."); However, when I try doing this with 2D array only 6 out of 12 buttons show up. frame.setLayout(new GridLayout(3,3)); JButton[][] buttons = new JButton[3][3]; for (int i = 0; i &lt; buttons.length; i++){ for (int j = 0; j &lt; buttons.length; j++){ buttons[i][j] = new JButton(); frame.add(buttons[i][j]); buttons[i][j].setText("."); } } Also, I have one more question, to call each individual button do I need to do it like this? button[0].setText("button 1"); and also would it be possible to give each button a name, for example instead of button[0], would it be possible to have button1, and so on. Thanks.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33331973
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33331913
has comment: http://stackoverflow.com/comment/33332511
upvote count: 1
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/33332116
possible better answer: http://stackoverflow.com/a/21993561
has comment: http://stackoverflow.com/comment/33332536
has answer: http://stackoverflow.com/a/21993561
has answer: http://stackoverflow.com/a/21993570
has comment: http://stackoverflow.com/comment/33331757
has comment: http://stackoverflow.com/comment/33331683
answer count: 2
has comment: http://stackoverflow.com/comment/33332219
has comment: http://stackoverflow.com/comment/33331664
has comment: http://stackoverflow.com/comment/33332830
tagged with: arrays
downvote count: 0
favorite count: 0
has title: making 3 by 3, 2d array in java
has comment: http://stackoverflow.com/comment/33332504
accepted answer: http://stackoverflow.com/a/21993570
has comment: http://stackoverflow.com/comment/33332166

http://stackoverflow.com/q/21964375
answer count: 6
has comment: http://stackoverflow.com/comment/33280342
upvote count: 28
has comment: http://stackoverflow.com/comment/33288422
has comment: http://stackoverflow.com/comment/33280267
has answer: http://stackoverflow.com/a/38731679
tagged with: android
possible better answer: http://stackoverflow.com/a/28745935
tagged with: asynchronous
linked to: http://stackoverflow.com/q/11700288
favorite count: 0
score: 28
has comment: http://stackoverflow.com/comment/48980222
accepted answer: http://stackoverflow.com/a/21964976
has answer: http://stackoverflow.com/a/28745935
linked to: http://stackoverflow.com/q/36501842
has answer: http://stackoverflow.com/a/27552751
has body: I have an IntentService that starts an asynchronous task in another class and should then be waiting for the result. The problem is that the IntentService will finish as soon as the onHandleIntent(...) method has finished running, right? That means, normally, the IntentService will immediately shut down after starting the asynchronous task and will not be there anymore to receive the results. public class MyIntentService extends IntentService implements MyCallback { public MyIntentService() { super("MyIntentService"); } @Override protected final void onHandleIntent(Intent intent) { MyOtherClass.runAsynchronousTask(this); } } public interface MyCallback { public void onReceiveResults(Object object); } public class MyOtherClass { public void runAsynchronousTask(MyCallback callback) { new Thread() { public void run() { // do some long-running work callback.onReceiveResults(...); } }.start(); } } How can I make the snippet above work? I've already tried putting Thread.sleep(15000) (arbitrary duration) in onHandleIntent(...) after starting the task. Itseems to work. But it definitely doesn't seem to be clean solution. Maybe there are even some serious problems with that. Any better solution?
tagged with: intentservice
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23002542
tagged with: java
has answer: http://stackoverflow.com/a/21964928
type: Question
has answer: http://stackoverflow.com/a/21964976
has comment: http://stackoverflow.com/comment/33280602
downvote count: 0
has comment: http://stackoverflow.com/comment/33280928
has title: Waiting for asynchronous callback in Android's IntentService

http://stackoverflow.com/q/21996056
type: Question
tagged with: edit
has answer: http://stackoverflow.com/a/21996187
accepted answer: http://stackoverflow.com/a/21996187
possible better answer: http://stackoverflow.com/a/21996470
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21996470
has body: new day - new problem : i want to have a button, which starts an AlertDialog, in which the user can change the range for a random number my problem is : it only shows one edit, and i don't know why (btw : the app doesn't crash : i get a random number, i just don't know where it comes from ) below is my code : String s; public void btn_own(View view) { int a, b, c; // a : untere Grenze , b : obere Grenze AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Enter range"); final EditText inputa = new EditText(this); final EditText inputb = new EditText(this); alert.setView(inputa); alert.setView(inputb); alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { int aa = 0; int bb = 0; int cc = 0; int e = 0; try { aa = Integer.parseInt(inputa.getText().toString()); } catch (NumberFormatException f) { System.out.println("not a number: " + inputa.getText().toString()); f.printStackTrace(); } try { bb = Integer.parseInt(inputb.getText().toString()); } catch (NumberFormatException g) { System.out.println("not a number: " + inputb.getText().toString()); g.printStackTrace(); } cc = bb - aa; Random rand = new Random(); int d = rand.nextInt(cc); e = d + bb; Integer out = new Integer(e); s = out.toString(); new AlertDialog.Builder(Decider.this) .setMessage(s) .show(); } }); alert.show(); } hope you can help me .. i am new in development and that's my first real project
has title: just one Edit instead of two ( AlertDialog )
tagged with: android
tagged with: android-alertdialog
type: AnsweredQuestion
tagged with: alert
tagged with: java

http://stackoverflow.com/q/21997215
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33339068
has comment: http://stackoverflow.com/comment/33338897
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: What's proxies for in Java?
has comment: http://stackoverflow.com/comment/33338692
linked to: http://stackoverflow.com/q/2993464
type: Question
has comment: http://stackoverflow.com/comment/33339021
score: 3
has answer: http://stackoverflow.com/a/21997573
has comment: http://stackoverflow.com/comment/33339742
accepted answer: http://stackoverflow.com/a/21997573
has comment: http://stackoverflow.com/comment/33339530
tagged with: proxy-classes
has body: I am reading the Proxies section in Horstmann's renowned book Core Java. I am new to this concept though. As written in the book, proxies are only necessary when you don't yet know at compile time which interfaces you need to implement. However, when you construct a proxy object, you need to supply an array of class objects which are just the interfaces to be implemented. Doesn't it sound like a self-contradiction? Please illuminate me. Thanks!
upvote count: 3
has comment: http://stackoverflow.com/comment/33338989

http://stackoverflow.com/a/21907696
has comment: http://stackoverflow.com/comment/33208466
upvote count: 2
has body: On possible route is to use the PMD code checker. You can add your own custom rules to PMD, and there is a PMD plugin for Sonar. But in that case, Sonar can calculate the debt (through SQALE or another plugin) for me? In another case, how i can calculate the debt? I think you misunderstand the "technical debt" term. Here is how Wikipedia describes it: Technical debt (also known as design debt[citation needed] or code debt) is a neologistic metaphor referring to the eventual consequences of poor software architecture and software development within a codebase. The debt can be thought of as work that needs to be done before a particular job can be considered complete. If the debt is not repaid, then it will keep on accumulating interest, making it hard to implement changes later on. Unaddressed technical debt increases software entropy. The key thing to note is that technical debt is a metaphor. So, for example, PMD could tell you how many times your code violates certain rules, but it cannot tell you how much work it would be to fix them, or how much extra work in the future would be incurred because you didn't fix it now. Basically, you cannot measure technical debt because a true measure of technical debt requires knowing what is going to happen in the future. Also read this: https://softwareengineering.stackexchange.com/questions/167080/how-is-technical-debt-best-measured-what-metrics-are-most-useful
has comment: http://stackoverflow.com/comment/33225047
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/33179319
has comment: http://stackoverflow.com/comment/33211045
answers question: http://stackoverflow.com/q/21906671
score: 2

http://stackoverflow.com/q/21956042
accepted answer: http://stackoverflow.com/a/21956081
favorite count: 0
has answer: http://stackoverflow.com/a/21956222
has answer: http://stackoverflow.com/a/55963996
has answer: http://stackoverflow.com/a/75701897
tagged with: resultset
has comment: http://stackoverflow.com/comment/33354156
tagged with: jdbc
possible better answer: http://stackoverflow.com/a/21956222
linked to: http://stackoverflow.com/q/78092897
has answer: http://stackoverflow.com/a/54988302
has answer: http://stackoverflow.com/a/55351533
has comment: http://stackoverflow.com/comment/33265014
has answer: http://stackoverflow.com/a/21956081
tagged with: object
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/74214193
linked to: http://stackoverflow.com/q/14524751
tagged with: java
has comment: http://stackoverflow.com/comment/33265136
tagged with: mysql
has comment: http://stackoverflow.com/comment/33285453
answer count: 11
has title: Mapping a JDBC ResultSet to an object
type: Question
has body: I have a user class that has 16 attributes, things such as firstname, lastname, dob, username, password etc... These are all stored in a MySQL database and when I want to retrieve users I use a ResultSet. I want to map each of the columns back to the user attributes but the way I am doing it seems terribly inefficient. For example I am doing: //ResultSet rs; while(rs.next()) { String uid = rs.getString("UserId"); String fname = rs.getString("FirstName"); ... ... ... User u = new User(uid,fname,...); //ArrayList&lt;User&gt; users users.add(u); } i.e I retrieve all the columns and then create user objects by inserting all the column values into the User constructor. Does anyone know of a faster, neater, way of doing this?
has answer: http://stackoverflow.com/a/48044240
score: 65
has answer: http://stackoverflow.com/a/46359673
has answer: http://stackoverflow.com/a/70039312
upvote count: 65
downvote count: 0
has answer: http://stackoverflow.com/a/21956154

http://stackoverflow.com/q/21931091
has body: I'm new to EJB JPA. I'm confused in @Inheritance with parent and child. @Entity @Table(name = "owner", catalog = "estate") @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="ownerType",discriminatorType=DiscriminatorType.STRING) @DiscriminatorValue("owner") public class Owner extends UUIDSupport implements UserDetails,java.io.Serializable{ .... } @Entity @DiscriminatorValue("ownerInCommittee") public class OwnerInCommittee extends Owner { .... } CREATE TABLE `owner` ( `id` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `password` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL, `username` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `idCard` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `phone` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `email` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `duty` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, // OwnerInCommittee `ownerType` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; Now I want to find 'owner' in the DB,than change it to 'OwnerInCommittee'. Because java can't force change a parent to child. Should I find 'owner' in DB , copy properties into a new 'OwnerInCommittee',than delete owner in DB . after that PERSIST the new 'OwnerInCommittee'. Is there a better way?
type: AnsweredQuestion
tagged with: ejb
tagged with: java
tagged with: hibernate
has title: JPA @Inheritance with parent and child
linked to: http://stackoverflow.com/q/744520
type: Question
score: 0
answer count: 1
tagged with: jpa
has answer: http://stackoverflow.com/a/21931414
accepted answer: http://stackoverflow.com/a/21931414
has comment: http://stackoverflow.com/comment/33219995

http://stackoverflow.com/comment/33289516
comment on: http://stackoverflow.com/a/21965677
type: Comment
has text: bro now its not showing any error..For that I thank you very much..Answer is accepted...But i didnt get any output...I need "n" number of rows and 4 number of columns of edittext view...But i am not getting anything... "main.addView(createTL(i,getBaseContext()));" I think this line gives this problem...Please help me bro
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33171435
type: Comment
has text: I also tried ProcessBuilder, but it didn't really change anything.
comment on: http://stackoverflow.com/q/21903326
score: 0
type: QuestionComment

http://stackoverflow.com/a/21875657
has comment: http://stackoverflow.com/comment/33203201
has comment: http://stackoverflow.com/comment/33121869
has body: You can override jOOQ's default code generator with your own extensions. This is documented here, in the manual: http://www.jooq.org/doc/latest/manual/code-generation/codegen-custom-code/ The example shows how it works: public class MyGenerator extends JavaGenerator { @Override protected void generateRecordClassFooter( TableDefinition table, JavaWriter out ) { super.generateRecordClassFooter(table, out); if ("SOME_TABLE".equals(table.getName())) { out.println(); out.tab(1).println("public void isABlueCompany() {"); out.tab(2).println("// Your logic here"); out.tab(1).println("}"); } else if ("SOME_OTHER_TABLE".equals(table.getName())) { // [...] } } }
has comment: http://stackoverflow.com/comment/33169950
has comment: http://stackoverflow.com/comment/33142199
has comment: http://stackoverflow.com/comment/33121963
answers question: http://stackoverflow.com/q/21873906
upvote count: 3
type: Answer
downvote count: 0
score: 3

http://stackoverflow.com/q/21991429
favorite count: 0
has comment: http://stackoverflow.com/comment/33441359
type: UnansweredQuestion
tagged with: pom.xml
tagged with: crystal-reports
downvote count: 0
tagged with: maven
has comment: http://stackoverflow.com/comment/33448034
type: Question
score: 3
has answer: http://stackoverflow.com/a/21991949
linked to: http://stackoverflow.com/q/9386589
tagged with: java
has answer: http://stackoverflow.com/a/21997626
has comment: http://stackoverflow.com/comment/33348717
upvote count: 3
has comment: http://stackoverflow.com/comment/33427043
answer count: 2
has title: crystal report jars for maven
tagged with: jar
has comment: http://stackoverflow.com/comment/33433715
has body: I have built a non-maven project to display crystal reports with all necessary jars imported to the lib folder. But, when I try to find the dependencies to add the same jars into my pom.xml for a maven project, I was not able to look it up online. How can I find the crystal report dependencies for a maven project ? How to determine groupId and artifact for the crystal jar? Below is the snapshot of jars I am looking for. Please suggest. I tried looking into this link in the SCN but couldn't find much details.

thread-safety
tags question: http://stackoverflow.com/q/21857424
tags question: http://stackoverflow.com/q/21905931
tags question: http://stackoverflow.com/q/21965671
tag name: thread-safety
tags question: http://stackoverflow.com/q/21885268
tags question: http://stackoverflow.com/q/21849703
tags question: http://stackoverflow.com/q/21952319
tags question: http://stackoverflow.com/q/21922386
tags question: http://stackoverflow.com/q/21974093
tags question: http://stackoverflow.com/q/21984880
type: Tag

http://stackoverflow.com/a/21861490
has comment: http://stackoverflow.com/comment/33095891
type: Answer
has comment: http://stackoverflow.com/comment/33096273
upvote count: 7
has body: Calendar.WEEK_OF_YEAR is a constant. You wanted cal.get(Calendar.WEEK_OF_YEAR). However, you should note that "week of year" is not as simple as you might expect, as a concept. For example, it can be 53 on January 1st, which belongs to the previous week-year in some years. Are you happy for the first quarter of a year to start later than January 1st? (Unless you really need to use a week-year/week-of-week-year/day-of-week representation for business purposes, year/month/day is much easier to get your head around.) If you do need to translate the week-of-year into a quarter after reading those caveats, you can just use: public static int getQuarter(Calendar calendar) { int weekOfYear = calendar.get(Calendar.WEEK_OF_YEAR); return weekOfYear &lt; 13 ? 1 : weekOfYear &lt; 25 ? 2 : weekOfYear &lt; 38 ? 3 : 4; }
answers question: http://stackoverflow.com/q/21861418
has comment: http://stackoverflow.com/comment/33154391
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/33154734

http://stackoverflow.com/comment/33112735
type: QuestionComment
comment on: http://stackoverflow.com/q/21870654
has text: Look into redirect attributes.
score: 0
type: Comment

http://stackoverflow.com/q/21976325
answer count: 1
has title: Rally Java Lookback API
tagged with: lookbackapi
tagged with: rally
has answer: http://stackoverflow.com/a/21976844
score: 0
accepted answer: http://stackoverflow.com/a/21976844
has body: Here's my code: import com.google.gson.JsonElement; import com.rallydev.lookback.LookbackApi; import com.rallydev.lookback.LookbackQuery; import com.rallydev.lookback.LookbackResult; import java.math.BigInteger; import com.rallydev.rest.RallyRestApi; import com.rallydev.rest.request.QueryRequest; import com.rallydev.rest.response.QueryResponse; import com.rallydev.rest.util.Fetch; import com.rallydev.rest.util.QueryFilter; import java.io.*; import java.net.URI; import javax.management.Query; import com.google.gson.JsonObject; public class dIterationPsiAutomation { public String rallyURI; public String appName; public String username; public String password; public RallyRestApi restApi; public LookbackApi lookback; public dIterationPsiAutomation(String rallyURL,String username,String password, String applicationName) { // TODO Auto-generated constructor stub this.rallyURI = rallyURL; this.appName = applicationName; this.username = username; this.password = password; this.connect(this.rallyURI, this.appName, this.username, this.password); } public void connect(String uri,String app,String username,String password){ try //Unhandled URI Exception occurs here { this.restApi = new RallyRestApi(new URI(uri),username,password); this.restApi.setApplicationName("v2.0"); this.restApi.setApplicationName(app); this.lookback = new LookbackApi(); this.lookback.setCredentials(username, password); this.lookback.setWorkspace("Workspace 1"); } catch(Exception e){ System.out.println("Exception occured "+e); } } public void getFeatureInfo(String featureName) throws IOException { QueryRequest feature = new QueryRequest("portfolioitem/feature"); feature.setFetch(new Fetch("FormattedID","ObjectID","Name")); feature.setQueryFilter(new QueryFilter("Name","=",featureName)); QueryResponse queryResponse = this.restApi.query(feature); } public void get_formattedID(JsonElement ObjectID){ } public void get_prefixed_stories(String prefix){ try{ QueryRequest stories = new QueryRequest("hierarchicalr…
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/15507997
type: Question

http://stackoverflow.com/q/22001108
type: Question
has comment: http://stackoverflow.com/comment/33442336
has comment: http://stackoverflow.com/comment/33430633
has answer: http://stackoverflow.com/a/22041252
has title: Ivy.xml file appears to be missing in imported project?
score: 0
has body: I'm trying to use the vaadin tutorial. I imported their addressbook project in their tutorial into eclipse as an existing project. However, when I import the project is there a way to change it into a vaadin project? The ivy.xml file is missing and I do not know how to get it. How would I go about doing this? Thank you.
answer count: 1
has comment: http://stackoverflow.com/comment/33362873
type: UnansweredQuestion
tagged with: java
tagged with: ivy
tagged with: vaadin
tagged with: eclipse

http://stackoverflow.com/a/21871960
accepted answer of: http://stackoverflow.com/q/21870654
answers question: http://stackoverflow.com/q/21870654
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33115533
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: Why you dont try something like this. @RequestMapping(value = "/records", method = "RequestMethod.POST") public void inRecords(@Valid User user, HttpServletResponse response) { if(result.hasErrors()) { response.sendRedirect("/YourApp/profile/system") } I think ModelAndView is taking the returned String and try to run ViewResolver that try to get the jso, avoid that calling or redirecting the request directly to the needed endpoint. Or If you want to keep modelAndView use this return new ModelAndView("redirect:/profile/system");

http://stackoverflow.com/comment/33302806
type: Comment
has text: I remember those days. My best advice is to just work it our for yourself. Getting SO advice for your homework or your own personal challenges robs you of a very rewarding experience when you figure it out for yourself.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21976850

http://stackoverflow.com/comment/33099093
score: 0
type: AnswerComment
type: Comment
has text: Comparator<String>? public int compare()? a comparator which returns 0 or 1? Your pseudo code is more confusing than helpful.
comment on: http://stackoverflow.com/a/21861986

http://stackoverflow.com/q/21862725
score: 0
possible better answer: http://stackoverflow.com/a/21864410
has answer: http://stackoverflow.com/a/21864949
has comment: http://stackoverflow.com/comment/33114738
has answer: http://stackoverflow.com/a/21864772
has comment: http://stackoverflow.com/comment/33098222
tagged with: android
has title: Waiting for threadpool to complete execution
answer count: 4
has answer: http://stackoverflow.com/a/21864410
tagged with: multithreading
has body: I am new to threading . I have searched many questions related to my problem but I am not able to find the right solution for me. What I am doing is I am using four async tasks to fetch data from four different social media using the THREAD_POOL_EXECUTOR. code is as follows. new Fb().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new Twitter().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); ... mAdapter = new MyAdapter(getActivity(), (ArrayList&lt;Model&gt;) showList); mListView.setAdapter(mAdapter); I want the calls to be in parallel to save the time of fetching data. Now the idea is that i want all the four threads to complete the work and after that I want to display the sorted data as per timestamp. Right now the problem is that my setAdapter get called before the four threads complete fetching data as adapter is set on the UI thread. I want a mechanism to block the UI thread until all four threads complete fetching the data. I have found that maybe I can use the shutDown() and awaitTermination() methods of ExecutorService . It would be great if anyone can help me in anyway. Thanks a lot
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21871840
accepted answer: http://stackoverflow.com/a/21864949
has comment: http://stackoverflow.com/comment/33099096
tagged with: threadpool
tagged with: java
type: Question

overwrite
tags question: http://stackoverflow.com/q/21906002
tag name: overwrite
tags question: http://stackoverflow.com/q/21911548
type: Tag
tags question: http://stackoverflow.com/q/21992782

http://stackoverflow.com/comment/33154053
score: 0
has text: @Gus That won't cause a compilation error as you are not trying to use `Boolean` as a type anywhere in the code. Its use as a type variable is simply obscuring the type.
comment on: http://stackoverflow.com/q/21893223
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22083003
answers question: http://stackoverflow.com/q/21877532
has comment: http://stackoverflow.com/comment/86403550
score: 3
downvote count: 0
has body: You can use docx4j to create .docx files. docx4j is an open source (Apache v2) library for creating, editing, and saving OpenXML "packages", including docx, pptx, and xslx. So you need to use JAXB-based Java library for Word docx. This is a helpful tutorial for that: http://www.javacodegeeks.com/2012/07/java-word-docx-documents-with-docx4j.html Then your next question "is that compatible with the android ? " Look at this: JAXB can be made to run on Android I think this will help you.
type: Answer
upvote count: 3

multithreading
tags question: http://stackoverflow.com/q/21947294
tags question: http://stackoverflow.com/q/21886857
tags question: http://stackoverflow.com/q/21905931
tags question: http://stackoverflow.com/q/21918463
tags question: http://stackoverflow.com/q/21896857
type: Tag
tags question: http://stackoverflow.com/q/21958889
tags question: http://stackoverflow.com/q/21979639
tags question: http://stackoverflow.com/q/21976953
tags question: http://stackoverflow.com/q/21915853
tags question: http://stackoverflow.com/q/21849759
tags question: http://stackoverflow.com/q/21973719
tags question: http://stackoverflow.com/q/21880467
tags question: http://stackoverflow.com/q/21960407
tags question: http://stackoverflow.com/q/21917461
tags question: http://stackoverflow.com/q/21882285
tags question: http://stackoverflow.com/q/21972183
tags question: http://stackoverflow.com/q/21977263
tags question: http://stackoverflow.com/q/21981442
tags question: http://stackoverflow.com/q/21906222
tags question: http://stackoverflow.com/q/22001206
tags question: http://stackoverflow.com/q/21943509
tags question: http://stackoverflow.com/q/21865095
tags question: http://stackoverflow.com/q/21883236
tags question: http://stackoverflow.com/q/21925546
tags question: http://stackoverflow.com/q/21883014
tags question: http://stackoverflow.com/q/21857029
tags question: http://stackoverflow.com/q/21906794
tags question: http://stackoverflow.com/q/21943269
tags question: http://stackoverflow.com/q/21843599
tags question: http://stackoverflow.com/q/21893325
tags question: http://stackoverflow.com/q/21986575
tags question: http://stackoverflow.com/q/21854685
tags question: http://stackoverflow.com/q/21949816
tags question: http://stackoverflow.com/q/21945226
tags question: http://stackoverflow.com/q/21941971
tags question: http://stackoverflow.com/q/21864807
tags question: http://stackoverflow.com/q/21954808
tags question: http://stackoverflow.com/q/21965856
tags question: http://stackoverflow.com/q/21958601
tags question: http://stackoverflow.com/q/21957095
tags question: http://stackoverflow.com/q/21864252
tags question: http://stackoverflow.com/q/21950867
tags question: http://stackoverflow.com/q/21965293
tags question: http://stackoverflow.com/q/21882403
tags question: http://stackoverflow.com/q/21990968
tags question: http://stackoverflow.com/q/21976208
tags question: http://stackoverflow.com/q/21905494
tags question: http://stackoverflow.com/q/21948528
tags question: http://stackoverflow.com/q/21943882
tags question: http://stackoverflow.com/q/21996743
tags question: http://stackoverflow.com/q/21949217
tags question: http://stackoverflow.com/q/21877652
tags question: http://stackoverflow.com/q/21973917
tags question: http://stackoverflow.com/q/21885869
tags question: http://stackoverflow.com/q/21997264
tags question: http://stackoverflow.com/q/21905156
tags question: http://stackoverflow.com/q/21962154
tags question: http://stackoverflow.com/q/21888226
tags question: http://stackoverflow.com/q/21855589
tags question: http://stackoverflow.com/q/21906045
tags question: http://stackoverflow.com/q/21885268
tags question: http://stackoverflow.com/q/21939032
tags question: http://stackoverflow.com/q/21907651
tags question: http://stackoverflow.com/q/21844069
tags question: http://stackoverflow.com/q/21862725
tags question: http://stackoverflow.com/q/21857506
tags question: http://stackoverflow.com/q/21952319
tags question: http://stackoverflow.com/q/21918570
tags question: http://stackoverflow.com/q/21912629
tags question: http://stackoverflow.com/q/21843184
tags question: http://stackoverflow.com/q/21967386
tags question: http://stackoverflow.com/q/21919016
tags question: http://stackoverflow.com/q/21992880
tags question: http://stackoverflow.com/q/21913510
tags question: http://stackoverflow.com/q/21852814
tags question: http://stackoverflow.com/q/21890141
tags question: http://stackoverflow.com/q/21894020
tags question: http://stackoverflow.com/q/21944222
tags question: http://stackoverflow.com/q/21907831

http://stackoverflow.com/comment/33193227
comment on: http://stackoverflow.com/q/21909285
score: 0
type: Comment
type: QuestionComment
has text: Thanks i added the entity class that creates the table, what i am trying to is submit the student number from the u.i. to the table column studentNumber in the same transaction as the spinner value

http://stackoverflow.com/q/21881657
has title: How to add multiple JMS MessageListners in a single MessageListenerContainer for Spring Java Config
type: Question
possible better answer: http://stackoverflow.com/a/45460138
has answer: http://stackoverflow.com/a/21883215
answer count: 3
tagged with: spring-jms
has answer: http://stackoverflow.com/a/63819069
downvote count: 0
tagged with: jms
has body: I had the following xml code in my spring-config.xml &lt;jms:listener-container acknowledge="auto" connection-factory="cachedConnectionFactory" container-type="default" error-handler="consumerErrorHandler" concurrency="20-25"&gt; &lt;jms:listener destination="#{TaskFinished.destination}" method="onMessage" ref="taskFinished" /&gt; &lt;/jms:listener-container&gt; Now, I was converting my spring xml configuration file to Java configuration. I translated it like @Bean(name = "consumerJmsListenerContainer") public DefaultMessageListenerContainer consumerJmsListenerContainer() { DefaultMessageListenerContainer messageListenerContainer = new DefaultMessageListenerContainer(); messageListenerContainer .setConnectionFactory(cachingConnectionFactory()); messageListenerContainer.setConcurrency("20-25"); messageListenerContainer.setErrorHandler(new ConsumerErrorHandler()); messageListenerContainer .setSessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE); messageListenerContainer.setMessageListener(new TaskFinished()); return messageListenerContainer; } What I need to know is, if there were more than one MessageListner in the Message Container like &lt;jms:listener-container acknowledge="auto" connection-factory="cachedConnectionFactory" container-type="default" error-handler="consumerErrorHandler" concurrency="20-25"&gt; &lt;jms:listener destination="#{questionGeneration.destination}" method="onMessage" ref="questionGeneration" /&gt; &lt;jms:listener destination="#{friendShipLogic.destination}" method="onMessage" ref="friendShipLogic" /&gt; &lt;jms:listener destination="#{postAvailabilityChecker.destination}" method="onMessage" ref="postAvailabilityChecker" /&gt; &lt;jms:listener destination="#{playOn.destination}" method="onMessage" ref="playOn" /&gt; &lt;/jms:listener-container&gt; How could I supposed to convert this xml code into Java config?
favorite count: 0
accepted answer: http://stackoverflow.com/a/21883215
upvote count: 8
tagged with: spring
score: 8
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/45460138

http://stackoverflow.com/q/21872713
tagged with: java
has body: Here I'm trying to connect oracle which is installed in local machine with DSN bam. I'm getting java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver Exception. Anybody please help me to fix this issue. public class JdbcConnectionExample { public static void main(String[] args) { // TODO Auto-generated method stub try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con = DriverManager .getConnection("jdbc:oracle:thin:@localhost:1521:bam" ,"system","tiger"); Statement stmt = con.createStatement(); System.out.println("Created DB Connection...."); ResultSet rs = stmt.executeQuery("select * from tt"); while(rs.next()){ System.out.println(rs.getString("ename")); System.out.println(rs.getInt("age")); } rs.close(); con.close(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } The Log is here java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver 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.bam.sqlex.JdbcConnectionExample.main(JdbcConnectionExample.java:14)
answer count: 3
linked to: http://stackoverflow.com/q/14451121
has answer: http://stackoverflow.com/a/21874316
score: 0
has answer: http://stackoverflow.com/a/21875118
tagged with: jdbc
has title: How to connect ORACLE DB
has comment: http://stackoverflow.com/comment/33116195
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/14451121
type: Question
has answer: http://stackoverflow.com/a/21872883

http://stackoverflow.com/a/21976415
answers question: http://stackoverflow.com/q/21976389
score: 1
has body: stockUp() is an instance method of the Habitat class, so you need to create an instance of Habitat in your GoFishEdited class's main method in order to call it from GoFishEdited. You could call it on either instance of Habitat created, h1 or h2 Like this: h1.stockUp(); Note that in the code you posted, you need to pass an array of integers as an argument to stockUp(), but it looks like in your code you are expecting stockUp() to return an int[]. If stockUp() is supposed to return an array of integers, then you need to change the method signature to look something like: public int[] stockUp() { //do whatever you want this method to do return arrayOfInts; }
downvote count: 0
upvote count: 1
type: Answer

http://stackoverflow.com/a/21986759
upvote count: 6
answers question: http://stackoverflow.com/q/21939967
has body: Avoid java.util.Date &amp; Calendar You’ve found one of the many reasons to avoid using java.util.Date &amp; .Calendar. They are notoriously troublesome. Either use Joda-Time or, in Java 8, the new java.time package which is inspired by Joda-Time and defined by JSR 310. Search StackOverflow for "joda date" to find many examples. Time Zone You said: my timezone is GMT+1. Incorrect, your local offset from UTC/GMT is +01. That is not your time zone. A time zone is an offset plus rules about Daylight Saving Time (DST) and other anomalies. And that offset should have two digits: +01 (or +01:00) rather than +1, according to the ISO 8601 standard. Avoid the 3 or 4 letter codes such as CET. They are neither standardized nor unique. Use proper time zone names. Generally speaking, you should specify a time zone in all your date-time work rather than rely on the current JVM's default. In both Joda-Time and java.time, a date-time object truly knows its assigned time zone. A java.util.Date has no time zone, but seems to because its toString applies the default time zone when creating a String representation, as you sadly learned the hard way. Example Code Some code using Joda-Time 2.3. String input = "22/09/1985"; DateTimeZone timeZone = DateTimeZone.forID( "Europe/Amsterdam" ); DateTimeFormatter formatter = DateTimeFormat.forPattern( "dd/MM/yyyy" ); DateTime dateTime = formatter.withZone( timeZone ).parseDateTime( input ); DateTime dateTimeUtcGmt = dateTime.withZone( DateTimeZone.UTC ); DateTime dateTimeIndia = dateTime.withZone( DateTimeZone.forID( "Asia/Kolkata" ) ); String outputMontreal = DateTimeFormat.forStyle( "FF" ).withZone( DateTimeZone.forID( "America/Montreal" ) ).withLocale( Locale.CANADA_FRENCH ).print( dateTime ); // All of the above date-time represent the very same moment in the timeline of the Universe. Dump to console… System.out.println( "dateTime: " + dateTime ); System.out.println( "dateTimeUtcGmt: " + dateTimeUtcGmt ); System.out.println( "dateTimeIndia: …
score: 6
downvote count: 0
type: Answer

microsoft-dynamics
tag name: microsoft-dynamics
type: Tag
tags question: http://stackoverflow.com/q/21940410

http://stackoverflow.com/a/21846865
answers question: http://stackoverflow.com/q/21846806
has comment: http://stackoverflow.com/comment/33069764
has comment: http://stackoverflow.com/comment/33069757
has body: Checkout this cool libray for parsing JSOn in Android its called GSON https://code.google.com/p/google-gson/ . Via this parsing this very simple.
has comment: http://stackoverflow.com/comment/33069846
score: 0
type: Answer

http://stackoverflow.com/a/21850925
type: Answer
accepted answer of: http://stackoverflow.com/q/21850874
score: 1
answers question: http://stackoverflow.com/q/21850874
has body: Move these lines Button conv = (Button)findViewById(R.id.btn_conv); Button inst = (Button)findViewById(R.id.btn_ins); Button view = (Button)findViewById(R.id.btn_view); Button ext = (Button)findViewById(R.id.btn_ex); to onCreate() of Activity after setContentView() call...
upvote count: 1
has comment: http://stackoverflow.com/comment/33078549
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21952691
downvote count: 0
has body: Since you are interested in the maximum sequence size and not necessarily the sequence itself, it is better to have collatz return the size of the sequence. private static final Map&lt;Integer,Integer&gt; previousResults = new HashMap&lt;&gt;(); private static int collatz(int n) { int result = 1; if(previousResults.containsKey(n)) { return previousResults.get(n); } else { if(n==1) result = 1; else if(n%2==0) result += collatz(n/2); else result += collatz(3*n + 1); previousResults.put(n, result); return result; } } The memoization is implemented by storing sequence sizes for previous values of n in Map previousResults. You can look for the maximum in the main function: public static void main(String[] args) { int N = Integer.parseInt(args[0]); int maxn=0, maxSize=0; for(int n=N; n&gt;0; n--) { int size = collatz(n); if(size&gt;maxSize) { maxn = n; maxSize = size; } } System.out.println(maxn + " - " + maxSize); }
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/33259028
accepted answer of: http://stackoverflow.com/q/21951612
answers question: http://stackoverflow.com/q/21951612
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/a/21925646
score: 1
has body: When I timed it a few years ago, (Java 6) String.split() was significantly slower than searching for individual space characters with indexOf(), cause the former has a lot of regex baggage. If your sentences always split on a space, (somewhat dubious?) and that performance is truly an issue (do some real tests), custom code would be faster. Following the link provided in David Ehrmann's comment, looks like Java 7 made some speedups. My tests were with Java 6.
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21924826

http://stackoverflow.com/comment/114750830
comment on: http://stackoverflow.com/a/21978955
type: Comment
has text: @JCH77, I don't get it. Could you post a separated question with concrete example so others can answer you?
score: 0
type: AnswerComment

http://stackoverflow.com/q/21898815
has comment: http://stackoverflow.com/comment/33163627
has comment: http://stackoverflow.com/comment/33163684
type: Question
has answer: http://stackoverflow.com/a/21898904
score: 0
answer count: 1
has title: Getting arrayoutofbond error while running java code
accepted answer: http://stackoverflow.com/a/21898904
has comment: http://stackoverflow.com/comment/33163590
has body: I am getting arrayoutofbond error while running below given code, sometime it is running as expected and sometime it is giving error. Could anyone help me where I am wrong. import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; public class getFileContent{ public void listFiles() throws IOException, InterruptedException{ File directory = new File("C:\\ScriptLogFile\\"); File[] myarray; myarray=directory.listFiles(); int i=0; ArrayList&lt;String&gt; arrayList = new ArrayList&lt;String&gt;(); SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyy_hhmmss"); Date curDate = new Date(); String strDate = sdf.format(curDate); String fileName = strDate; File file = new File("C:\\ExcelReport_"+fileName+".csv"); FileWriter fileWritter = new FileWriter(file, true); BufferedWriter bwr = new BufferedWriter(fileWritter); String filename = null; try { for (int j = 0; j &lt; myarray.length; j++) { File path=myarray[j]; FileInputStream fis = new FileInputStream (path); BufferedReader br = new BufferedReader(new InputStreamReader(fis)); if(path.isFile()){ if(path.getName().endsWith(".csv")){ filename = path.getName(); String line; bwr.write(filename+","); while ((line = br.readLine()) != null) { if(line.contains("-")){ String[] part = line.split("-"); arrayList.add(part[1]); bwr.write(arrayList.get(i)+","); i++; } else{ } } bwr.write("\r\n"); } } } }catch (FileNotFoundException e) { e.printStackTrace(); } bwr.close(); } public static void main(String[] args) throws IOException, InterruptedException { getFileContent gfc = new getFileContent(); gfc.listFiles(); } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33163506
tagged with: java

http://stackoverflow.com/comment/33205307
type: AnswerComment
comment on: http://stackoverflow.com/a/21922123
score: 0
type: Comment
has text: Why does yours have such a high reported frame rate?? It could be the way you are calculating the reporting time, as I said, your game loop confused me so I dumped it. Most screens only refresh at about 25mhz any way, so anything over that is probably getting lost or discarded within the buffer. Human eyes are also a factor, at above 60fps, most people won't really see a difference...personally, I average most of my animations around the 25fps range, but then I'm only doing simple animations ;)

http://stackoverflow.com/q/21936114
favorite count: 0
has comment: http://stackoverflow.com/comment/33326720
tagged with: oracle-database
has title: Save NUMBER as TIMESTAMP in Oracle
has comment: http://stackoverflow.com/comment/33329440
tagged with: logging
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: java
type: Question
has body: Hi dear Java and Oracle folks. I am using DBAppender apprender from Logback to Oracle. For Oracle, DBAppender comes with script for creating table. It logs Timestamps to Number(20), because normally timespamps are 13 long digits(miliseconds) and Oracles digits accepts only 9 digits(up to seconds). So in SQL Developer on outup i see 13 long digits and it is very impractical. I do not have calculator in my head to translate digits to Date. My question: Is there other solution for storing timestamp in Oracle as Timestamp instead of NUMBER, so i can see it? OR Is there a way in SQL Developer to read this NUMBER(20) ad Date? Thank you very much. Petr
has answer: http://stackoverflow.com/a/30389837
tagged with: logback
tagged with: slf4j
answer count: 1
downvote count: 0

http://stackoverflow.com/q/21978937
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/33308234
has comment: http://stackoverflow.com/comment/33311618
linked to: http://stackoverflow.com/q/3154488
has answer: http://stackoverflow.com/a/21986276
score: 0
has answer: http://stackoverflow.com/a/22307618
has title: Search a string in entire workspace using eclipse plugin
has comment: http://stackoverflow.com/comment/33325484
has comment: http://stackoverflow.com/comment/33313980
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33310913
has answer: http://stackoverflow.com/a/22153999
answer count: 4
has body: I want to write a program in java to search a string in entire workspace using eclipse search plugin in my code. I have searched for this problem but couldnt find the result. Kindly help. Every suggestion is appreciated. Thanks in advance.
has answer: http://stackoverflow.com/a/21986358
tagged with: java

http://stackoverflow.com/comment/33063518
comment on: http://stackoverflow.com/a/21842858
has text: After moving the two `<context... />` lines to dispatcher-servlet, it worked! In the interest of helping me wrap my head around what's going on here, can you explain what exactly I did by moving those two lines, and why it worked?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21969044
type: AnsweredQuestion
tagged with: java
tagged with: prototype-scope
linked to: http://stackoverflow.com/q/39400697
type: Question
has body: I want to know when should I exactly use the prototype scope in Spring? I have understood that singleton returns the same object instance if the bean is requested for. Then why should we consider prototype? Explanations with examples would help a lot to understand the need for it.
downvote count: 0
has answer: http://stackoverflow.com/a/57541105
has answer: http://stackoverflow.com/a/46496785
tagged with: scope
score: 55
has title: When to use Spring prototype scope?
tagged with: singleton
upvote count: 55
has answer: http://stackoverflow.com/a/75724248
has answer: http://stackoverflow.com/a/21969071
accepted answer: http://stackoverflow.com/a/21969071
answer count: 4
favorite count: 0
tagged with: spring
possible better answer: http://stackoverflow.com/a/46496785

http://stackoverflow.com/q/21862399
has title: Baksmali error for android odex file
tagged with: android
has comment: http://stackoverflow.com/comment/33109362
has comment: http://stackoverflow.com/comment/33101142
answer count: 0
score: 0
type: UnansweredQuestion
tagged with: smali
type: Question
has body: I downloaded core.odex and framework.odex from my Samsung Galaxy Player, in order to make some changes for the hidden apis, following this webpage: https://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-2-hacking-around/ Also, I got baksmali and smali from here: http://forum.xda-developers.com/showthread.php?t=1650243 Now, when I run the command: java -jar baksmali-1.3.3.jar -c :core.odex -x framework.odex, the following error appears: UNEXPECTED TOP-LEVEL EXCEPTION: org.jf.dexlib.Util.ExceptionWithContext: regCount does not match the number of arguments of the method at org.jf.dexlib.Util.ExceptionWithContext.withContext(ExceptionWithContext.java:54) at org.jf.dexlib.Code.InstructionIterator.IterateInstructions(InstructionIterator.java:92) at org.jf.dexlib.CodeItem.readItem(CodeItem.java:154) at org.jf.dexlib.Item.readFrom(Item.java:76) at org.jf.dexlib.OffsettedSection.readItems(OffsettedSection.java:48) at org.jf.dexlib.Section.readFrom(Section.java:143) at org.jf.dexlib.DexFile.&lt;init&gt;(DexFile.java:431) at org.jf.baksmali.main.main(main.java:265) Caused by: java.lang.RuntimeException: regCount does not match the number of arguments of the method at org.jf.dexlib.Code.Format.Instruction3rc.checkItem(Instruction3rc.java:129) at org.jf.dexlib.Code.Format.Instruction3rc.&lt;init&gt;(Instruction3rc.java:79) at org.jf.dexlib.Code.Format.Instruction3rc.&lt;init&gt;(Instruction3rc.java:44) at org.jf.dexlib.Code.Format.Instruction3rc$Factory.makeInstruction(Instruction3rc.java:145) at org.jf.dexlib.Code.InstructionIterator.IterateInstructions(InstructionIterator.java:84) ... 6 more Error occured at code address 0 code_item @0x159a90 What am I missing or doing wrong? Appreciate in advance any help you can provide.
has comment: http://stackoverflow.com/comment/33108941
tagged with: java

http://stackoverflow.com/q/21864259
answer count: 1
has comment: http://stackoverflow.com/comment/33101835
tagged with: timer
has body: ok, I finally got my code to the date that keeps refreshing but unfortunately the jlabel keeps repeating itself over and over. Here is the picture: i.imgur.com/TxrTidC.png I want it to be only one sentence but this sentence change. Here is the code: package pro; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.Timer; public class pro6 extends JPanel { Timer t; JLabel l; static JFrame f; public pro6(final String sen){ t = new Timer(1000, new ActionListener(){ @SuppressWarnings("deprecation") @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub l = new JLabel(sen + new java.util.Date().toGMTString()); add(l); revalidate(); } }); t.start(); } public static void main(String [] args){ f = new JFrame("Date"); f.setVisible(true); f.setSize(350, 150); f.getContentPane().setBackground(Color.CYAN); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pro6 obj = new pro6("The Date is: "); f.add(obj); f.revalidate(); } }
has comment: http://stackoverflow.com/comment/33101827
has answer: http://stackoverflow.com/a/21864342
has title: Date with Timer keeps repeating
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33101113
type: Question
tagged with: java
tagged with: date
has comment: http://stackoverflow.com/comment/33101165
score: 0

http://stackoverflow.com/comment/33290229
has text: I've found the problem : I have to put "," and not "." for the number.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21969684
score: 0

http://stackoverflow.com/q/21986649
accepted answer: http://stackoverflow.com/a/22006240
has title: java.nio.Files, java.nio.Paths on java 6
has body: I need to rewrite some java 7 file IO code that should run on a Java 6 VM too. The implementation uses handy Java 7 features like autoclosing, Paths and Files. To be more specific, I need to handle expressions like /tmp/foo/*.bar to return all .bar files (currently implemented with Files.newDirectoryStream(dir, glob)). Does anyone know a handy library for this?
downvote count: 0
favorite count: 0
answer count: 3
tagged with: glob
tagged with: io
upvote count: 3
has answer: http://stackoverflow.com/a/22006240
tagged with: file
has answer: http://stackoverflow.com/a/36642083
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/33807159
score: 3
possible better answer: http://stackoverflow.com/a/36642083
tagged with: java
tagged with: nio
type: Question

http://stackoverflow.com/q/21845261
has comment: http://stackoverflow.com/comment/33072088
has comment: http://stackoverflow.com/comment/33100792
upvote count: 0
has comment: http://stackoverflow.com/comment/33068865
has body: public class Driver { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); double circumference; double radius = 5.5; double pi = 3.1415926; double area = 0; Circle circleobject = new Circle(); //Get Radius System.out.println("Circle's Radius"); radius = keyboard.nextDouble(); System.out.println("New Circle Object"); Circle circle = new Circle(); System.out.println("Area of Circle: " + Circle.getArea()); System.out.println("Circumference of Circle: " + Circle.getCircumference()); } } I do not understand how to make the circle a colored one. Whether it be red, green or blue. what do i have to add in order to make the circle any color? Also, it seems that i cannot create a circle object with the line Circle circleobject = new Circle(); what am i doing wrong? This is my circle class. import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; /** * A Circle is a figure that has a radius, a circumference, * and an area. * @author Kelvynn Cayanan * @version 02/09/2014 */ public class Circle { // Constants public static final double pi = 3.1415926; // instance variables private double circumference; private double area; private double radius; private Color color; /** * Constructs a circle of radius aRadius * @param aRadius is the radius of the circle */ public Circle(double aRadius, Color type) { radius = aRadius; // assigns value to radius circumference = ( 2 * pi * radius); // arithmetic for circumference area = ( pi * radius * radius); // arithmetic for area color = type; // displays type of color } public void draw (Graphics circle) { circle.setColor (color); } /** */ public double getRadius() { return radius; } public double getCircumference() { return circumference; } public double getArea() { return area; } public Color getColor() { return color; } }
type: UnansweredQuestion
favorite count: 0
has title: how to add color to circle in driver class (java)
type: Question
tagged with: colors
score: -2
has answer: http://stackoverflow.com/a/21870511
downvote count: 2
answer count: 1
tagged with: java

http://stackoverflow.com/q/21955504
accepted answer: http://stackoverflow.com/a/21955646
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33264065
type: AnsweredQuestion
has title: How to split the large size .txt file data into small portion and insert into database?
upvote count: 1
has answer: http://stackoverflow.com/a/21955646
has comment: http://stackoverflow.com/comment/33264079
has body: Below is my code to read and split the text file content. try { br = new BufferedReader(new FileReader("F:\\Test.txt")); final char[] cbuf = new char[2048]; final int length = br.read(cbuf); cbuf[length] = '@'; String packet = new String(cbuf, 0, length + 1); final String[] splitedPacket=packet.split("@"); for(int i=0;i&lt;splitedPacket.length;i++) { if(splitedPacket[i].contains("POS")) { System.out.println(splitedPacket[i]+"@"); preparedstatement=connection.prepareStatement("insert into inserttextfile([file]) values(?)"); preparedstatement.setString(1, splitedPacket[i]+"@"); preparedstatement.executeUpdate(); } } } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null)br.close(); } catch (IOException ex) { ex.printStackTrace(); } } It was working fine in my small size .txt file, but if I use more than 30 MB text file I get array index out of bound exception. So how to split and read this kind of .txt file and insert into database? (particularly expecting for split the large size file(ex. like 5 MB from 30 MB) and insert into database) Please guide me in this issue.
type: Question
has comment: http://stackoverflow.com/comment/33264097
has answer: http://stackoverflow.com/a/21955709
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/21955709
has comment: http://stackoverflow.com/comment/33264502
answer count: 2

http://stackoverflow.com/comment/86403550
has text: Not compatible with gradle
score: 1
comment on: http://stackoverflow.com/a/22083003
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33284983
type: AnswerComment
comment on: http://stackoverflow.com/a/21966846
score: 0
has text: I read somewhere that doHead calls doGet, so that may have confounded me. However got it thanks
type: Comment

http://stackoverflow.com/comment/33309225
comment on: http://stackoverflow.com/a/21971381
score: 0
type: AnswerComment
has text: Your code still is dependent on posX and posY. Take this for an example: posX = 0 and posY = 0. In this case, during your first iteration, you will pas your if statement and try to access show[-2][-2] which, obviously, is not allowed and out-of-bounds.
type: Comment

http://stackoverflow.com/q/21870679
has comment: http://stackoverflow.com/comment/33113314
tagged with: user-input
has comment: http://stackoverflow.com/comment/33114503
has comment: http://stackoverflow.com/comment/33113744
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33112806
tagged with: java
tagged with: loops
tagged with: options-menu
type: Question
has comment: http://stackoverflow.com/comment/33112959
has answer: http://stackoverflow.com/a/21871259
has comment: http://stackoverflow.com/comment/33112892
score: 0
has comment: http://stackoverflow.com/comment/33114770
answer count: 1
has comment: http://stackoverflow.com/comment/33113434
has comment: http://stackoverflow.com/comment/33112987
has title: how can I make these loops continue based on users input? In java eclipse
has body: When I run this code, which is a menu with many different options. it consists of many loops. Some of which I have yet to make. I am having trouble with my coin toss simulator. Although I have a for loop, the loop only cycles through once instead of until the user selects "0" to exit the program and return to the main menu but also my other problem is that the simulator wont return to the main menu if 0 is selected. What is going on??? here is an example of my troubles. Enter seed value: 3 ===== CS302 TOOL BOX ===== T > COIN TOSS SIMULATOR G > GRADE ESTIMATOR C > COLOR CHALLENGE Q > QUIT Type code letter for your choice: t COIN TOSS SIMULATOR Enter 0 to quit. How many tosses? 4 3.0 heads and 1.0 tails means 75.0% were heads Then the simulator doesn't ask "enter 0 to quit. How many tosses?" again. in fact if I press another number, say 3 I'd get this. Also zero doesn't end the simulator and prompt the main menu again. 3 is not a valid choice. ===== CS302 TOOL BOX ===== T > COIN TOSS SIMULATOR G > GRADE ESTIMATOR C > COLOR CHALLENGE Q > QUIT System.out.println(""); System.out.println( "===== CS302 TOOL BOX =====\nT &gt; COIN TOSS SIMULATOR\nG &gt; GRADE ESTIMATOR\nC &gt; COLOR CHALLENGE\nQ &gt; QUIT"); { Scanner anotherScanner = new Scanner(System.in); boolean usersSelection = false; String c; while (!usersSelection) { { System.out.print(""+ "Type code letter for your choice: "); } if (anotherScanner.hasNext("q|Q")) { c = anotherScanner.next(); usersSelection = true; System.out.println("" + "" + "Good-Bye"); break; } if (anotherScanner.hasNext("t|T")){ c = anotherScanner.next(); usersSelection = true; System.out.println(""); System.out.println("COIN TOSS SIMULATOR"); System.out.println(""); System.out.println("Enter 0 to quit. How many tosses?"); Random rand = new Random(); Scanner insideScanner = new Scanner(System.in); int feeble = insideScanner.nextInt(); double heads = 0; double tails = 0; boolean headsvsTails; headsvsTails = rand.nextBoolean(); for (int i =0; i &…
has comment: http://stackoverflow.com/comment/33114270
tagged with: menu

gmail
type: Tag
tag name: gmail
tags question: http://stackoverflow.com/q/21989158

http://stackoverflow.com/q/21899641
has comment: http://stackoverflow.com/comment/33165226
type: Question
has comment: http://stackoverflow.com/comment/33173780
has body: I need to access headers and subheaders of HTML using Java selenium webdriver . Could you please say what will be the java code to access the headers and sub headers of HTML. Admin
has comment: http://stackoverflow.com/comment/33166665
upvote count: 0
has comment: http://stackoverflow.com/comment/33165069
has comment: http://stackoverflow.com/comment/33167495
has comment: http://stackoverflow.com/comment/33164897
answer count: 1
has answer: http://stackoverflow.com/a/21901353
favorite count: 0
score: -1
accepted answer: http://stackoverflow.com/a/21901353
has comment: http://stackoverflow.com/comment/33165428
has comment: http://stackoverflow.com/comment/33166750
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java
tagged with: selenium
has title: Selenium webdriver Java code to access headers and sub headers in HTML
has comment: http://stackoverflow.com/comment/33166377
downvote count: 1

http://stackoverflow.com/a/21985357
type: Answer
has body: Your JSON is invalid, but assuming you fix that then you are looking for a library in Java which will serialize an annotated Java class to JSON, or deserialize JSON data to an annotated Java class. There is a whole list of suitable libraries here: http://json.org/java/
score: 0
answers question: http://stackoverflow.com/q/21985068

http://stackoverflow.com/q/21920433
has answer: http://stackoverflow.com/a/21920493
linked to: http://stackoverflow.com/q/4051887
linked to: http://stackoverflow.com/q/21720130
linked to: http://stackoverflow.com/q/473282
type: UnansweredQuestion
score: -3
duplicate of: http://stackoverflow.com/q/4051887
has comment: http://stackoverflow.com/comment/33202537
upvote count: 0
has comment: http://stackoverflow.com/comment/33201912
has body: The issue is that I do not understand how to make two 0's appear before the 7, after the print. the print keeps coming up with just the 7 after the + bond is used in the print line. int bond = 007; System.out.println("insert what ever you want " + bond); insert what ever you want 7 What i want it so say is insert what ever you want 007
tagged with: variables
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/275711
has answer: http://stackoverflow.com/a/21920470
tagged with: integer
tagged with: java
duplicate of: http://stackoverflow.com/q/275711
downvote count: 3
answer count: 3
has title: Printing integers starting with 0's - java
has answer: http://stackoverflow.com/a/21920935

http://stackoverflow.com/a/21912860
type: AcceptedAnswer
downvote count: 0
has body: minus does not change the given Period object, it creates a new object that's the difference between the two Periods: Period p = new Period(/*something*/); Period minusD = new Period(/*period to subtract*/); Period result = p.minus(minusD); System.out.println (result.getDays());
accepted answer of: http://stackoverflow.com/q/21912769
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/21912769
score: 3

http://stackoverflow.com/comment/33260294
has text: You are getting compiler errors on an xml file? Could you post them?
comment on: http://stackoverflow.com/q/21953408
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21884053
has body: I have decided to do it this way: private static final Map&lt;Integer, Character&gt; iMap = new HashMap&lt;&gt;(); static {//Code, like &amp;#32; or &amp;#032; iMap.put(32, ' '); iMap.put(33, '!'); iMap.put(34, '\"'); iMap.put(35, '#'); iMap.put(36, '$'); iMap.put(37, '%'); iMap.put(38, '&amp;'); //... } private static final Map&lt;String, Character&gt; sMap = new HashMap&lt;&gt;(); static {//Entity Name sMap.put("&amp;larr;", '←'); sMap.put("&amp;uarr;", '↑'); sMap.put("&amp;rarr;", '→'); sMap.put("&amp;darr;", '↓'); sMap.put("&amp;harr;", '↔'); sMap.put("&amp;spades;", '♠'); sMap.put("&amp;clubs;", '♣'); sMap.put("&amp;hearts;", '♥'); //... } public static String unescapeHTML(String str) { StringBuilder sb = new StringBuilder(), tmp = new StringBuilder(); StringReader sr = new StringReader(str); boolean esc = false; try { int i; while ((i = sr.read()) != -1) { char c = (char) i; if (c == '&amp;') { tmp.append(c); esc = true; } else if (esc) { tmp.append(c); if (c == ';') { esc = false; if (tmp.charAt(1) == '#') { try { sb.append(iMap.get(Integer.parseInt(tmp.substring(2, tmp.capacity() - 1)))); } catch (NumberFormatException ex) { sb.append(tmp.toString());//Ignore and leave unchanged } } else { sb.append(sMap.get(tmp.toString())); } tmp.setLength(0); } } else { sb.append(c); } } sr.close(); } catch (IOException ex) { Logger.getLogger(UnescapeHTML.class.getName()).log(Level.SEVERE, null, ex); } return sb.toString(); } Works perfectly and the code is simple. Still testing. It would be nice to hear your comments.
answers question: http://stackoverflow.com/q/21865370
score: 0
type: Answer

http://stackoverflow.com/a/21856427
has comment: http://stackoverflow.com/comment/33298471
has comment: http://stackoverflow.com/comment/33119967
has comment: http://stackoverflow.com/comment/33086640
score: 0
answers question: http://stackoverflow.com/q/21855818
type: Answer
has body: 2 - Should I use Transaction or Scripting for this? Since you to use the results of some commands in subsequent commands, a script is the way to go. Lua scripts are generally fast. A script in Redis is also transactional by definition. 3 - Is it feasible to run all these lines under high traffic without scripting or transaction features of Redis ? It depends on what you consider as "high traffic". Anyway, you should test and see if your approach is feasible. A simple Lua script will also be fast in most cases. Most importantly you should consider the time complexity of each command you are going to use. These can be found in the documentation of each command.
has comment: http://stackoverflow.com/comment/33297264

http://stackoverflow.com/comment/33147694
score: 2
has text: Why use `String.intern()` at all? Why synchronize on a `String` at all for that matter?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21890141

http://stackoverflow.com/a/21881789
type: Answer
has body: JSF does not really work like that. The form fields in the view (.jsf or whatever) are mirrored by fields and properties in the bean. They are automatically populated by JSF when the servlet is invoked further up the stack. This makes the need to read HTTP parameters redundant except when the browser lands on a JSF page from a non-JSF based form. For that something like Spring-MVC can accept the URI being targetted and make a connection to the ManagedBean instance before redirecting the browser to a JSF powered URL.
accepted answer of: http://stackoverflow.com/q/21881686
answers question: http://stackoverflow.com/q/21881686
has comment: http://stackoverflow.com/comment/33132656
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/33265877
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21956374
has text: Is the right <path> for student.db ??

http://stackoverflow.com/comment/33160407
score: 0
comment on: http://stackoverflow.com/q/21895932
type: Comment
has text: The problem is in you provider_titles table (ProviderTitle class presumably).
type: QuestionComment

http://stackoverflow.com/q/21922016
has answer: http://stackoverflow.com/a/21922066
answer count: 1
accepted answer: http://stackoverflow.com/a/21922066
has comment: http://stackoverflow.com/comment/33205098
has title: How can I append to file in a listview?
tagged with: android
tagged with: android-adapter
type: AnsweredQuestion
has body: I am trying to write data to a file each time getView() is called in a adapter. I append to the file every time the call is made with a string value (the row data of the listview). I do not open the file every single time because the performance is affected severely if I do so. Hence, I keep the stream open and only append and write new line every time getView() is called. When I open the file later after my operations are complete, I see each row duplicated in my file at least 5-6 times! The file is much larger than it should be. I see the correct values on my ListView though. I perform appends in a new thread within the getView() method (I do not use a AsyncTask. I just say new Thread() { run() {//My operation}}.start(). I am using Android 4.0. I think the issue with getView() getting called more than once for every row has been fixed. Or has it? Any ideas??
tagged with: java
type: Question
tagged with: performance
linked to: http://stackoverflow.com/q/2618272
score: 0
tagged with: android-listview

http://stackoverflow.com/a/21977721
upvote count: 2
answers question: http://stackoverflow.com/q/21977591
score: 2
accepted answer of: http://stackoverflow.com/q/21977591
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33304042
has body: Painting is destructive, that is, each time paint is called, it will clear/remove what ever was painted before it. This is very important, as the Graphics context is shared by all the components that are painted during the paint cycle, meaning, when it gets to you, it might already have something painted on it. You need to do two things. First, you need to create something that is paintable, that is, some kind of object which provides a simple paint or draw method which you can pass the Graphics context to. This object should know what it's painting and in what color Second, you need to add each of these "paintable" objects to a List of some kind as they are created. This will allow you to loop through the List and repaint them when you need to. You should avoid overriding paint of top level containers like JFrame, apart from the fact that they aren't double buffered and can produce flickering when updated, you could end up painting under the borders of the frame's decorations (0x0 is actually the top left of the window/frame, not the viewable area under the frame's title bar). Instead, use a JPanel and override it's paintComponent method Take a look at Performing Custom Painting and Painting in AWT and Swing for more details Updated... You color list is out of sync with your mouse points because you did... colors.add(Color.black); In the constructor. This means that the first circle will be painted in black and the next in the selected color. When you change colors, it is still out of sync

http://stackoverflow.com/a/21963829
answers question: http://stackoverflow.com/q/21963686
has body: Perhaps inFromClient.readLine() is reading more (or less) than you expect the first time around. Are you sure it is returning what you expect? I haven't used PuTTY in a while, perhaps it is sending some terminal control characters on initial connect that are getting picked up by your first read? You also don't show us the connection code, are you sending data back and forth prior to this point that is not being fully processed?
has comment: http://stackoverflow.com/comment/33289580
score: 0
type: Answer

http://stackoverflow.com/a/63738973
type: Answer
has body: Another option is to extend MultiResourceItemReader and override open() method and call setResources() just before calling super.open() method. public class CustomMultiItemReader<T> extends MultiResourceItemReader<T> { private static final Log logger = LogFactory.getLog(PrestoMultiItemReader.class); private String filePattern; public CustomMultiItemReader() { super(); } @Override public void open(ExecutionContext executionContext) { Assert.notNull(filePattern, "filePattern must be set"); try { ResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver(); Resource[] resources = patternResolver.getResources(filePattern); super.setResources(resources); } catch (IOException e) { logger.error("No resources to read.", e); } super.open(executionContext); } public void setFilePattern(String filePattern) { this.filePattern = filePattern; } } You can call CustomMultiItemReader as below. You don't need to call setResources(). public CustomMultiItemReader<T> customMultiItemReader() { String filePattern = "file:/..."; CustomMultiItemReader<T> reader = new CustomMultiItemReader<T>(); reader.setDelegate(reader()); //reader to delegate here reader.setFilePattern(filePattern); reader.setStrict(true); return reader; }
answers question: http://stackoverflow.com/q/21880300
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/q/21960480
upvote count: 0
answer count: 1
score: -1
has title: checking equality of string containing characters such as "-","+","/" fails
tagged with: junit
has comment: http://stackoverflow.com/comment/33273537
has answer: http://stackoverflow.com/a/21960532
favorite count: 0
has body: I'm trying to check console output by redirecting the standard output to a ByteArrayOutputStream object. I found this little code snipped that lets me do just that. However, usage of characters such as "-","+" etc. fail the tests. I was wondering why: Here's the jUnit Test: import static org.junit.Assert.*; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import org.junit.After; import org.junit.Before; import org.junit.Test; //This test is try and test output against the console output, //but the inclusion of characters '-', '*', '+', and '/' makes //it especially hard to implement correctly. So abandoning public class ApplicationTest { private final ByteArrayOutputStream outContent=new ByteArrayOutputStream(); @Before public void setUpStreams(){ System.setOut(new PrintStream(outContent)); } @After public void cleanUpStream(){ System.setOut(null); } @Test public void test_Test1() { //Lexer lex=new Lexer("a+b*c"); //System.out.print("a b c * + "); System.out.format("%s ", "a"); System.out.format("%s ", "- "); String str="a - "; //Test Fails. assertEquals(outContent.toString(),str); } }
has comment: http://stackoverflow.com/comment/33273247
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21960532
downvote count: 1
type: Question
tagged with: bytearrayoutputstream

http://stackoverflow.com/comment/33146494
type: AnswerComment
type: Comment
has text: you mean each object should have another object to Serialize/Deserialize it?
comment on: http://stackoverflow.com/a/21889403
score: 0

http://stackoverflow.com/comment/33244483
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21944625
has text: Show us your actual code, please. We can't tell you what you're doing wrong without knowing exactly what you're doing.

http://stackoverflow.com/a/21975910
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21975607
type: Answer
has body: When you call setBackgroundColor internally it is calling setBackgroundDrawable with a ColorDrawable, so you're replacing the original background, the one that displays the line inside EditText. Setting a white background color to begin with would equally remove this line. It should work if you save the original background drawable via getBackground and later restore it via setBackgroundDrawable.
score: 0
accepted answer of: http://stackoverflow.com/q/21975607

http://stackoverflow.com/q/21844188
has answer: http://stackoverflow.com/a/21844803
has answer: http://stackoverflow.com/a/21844545
has answer: http://stackoverflow.com/a/21844946
downvote count: 0
tagged with: directory
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21844365
has comment: http://stackoverflow.com/comment/33065526
has body: I do not want to specify a directory. I just want it to automatically "know" and open in the directory the user is working in. How do I do this?
accepted answer: http://stackoverflow.com/a/21844803
answer count: 4
type: AnsweredQuestion
tagged with: working-directory
tagged with: java
upvote count: 1
tagged with: swing
tagged with: jfilechooser
type: Question
has title: How do I make JFileChooser open in the current directory the user is in?
linked to: http://stackoverflow.com/q/7143287
possible better answer: http://stackoverflow.com/a/21844545

http://stackoverflow.com/a/21886481
answers question: http://stackoverflow.com/q/21885764
has body: When resources are packed into jar files they are not available as file on HDD but only as resources; follow Java Images not drawn when running java -jar as well as How do I convert a "jar:file" URI to the path of Jar file?
score: 0
type: Answer

http://stackoverflow.com/comment/33126865
comment on: http://stackoverflow.com/q/21857257
score: 0
has text: I perform my GAE routing using RESTlet and achieve something similar. It's an extra framework that you might not want/need though.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33288234
comment on: http://stackoverflow.com/q/21968851
has text: It also says what source cannot be found. Please post the stack trace containing this information.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21890409
has comment: http://stackoverflow.com/comment/33148663
score: 0
has comment: http://stackoverflow.com/comment/33155362
answer count: 1
has body: would it be possible to organise the text I have on my JTextArea for example. JTextArea information = new JTextArea("User1Click: \nUser2Click"); JButton button = new JButton(); JButton button1 = new JButton(); JButton button2 = new JButton(); JButton button3 = new JButton(); button.setText(button); button.setText(button1); button.setText(button2); button.setText(button3); button.setText(button4); right now, the JTextArea appears on the JFrame like this; User1Click: User2Click: What I want to do is, basically right now the user 1 goes first then user 2 and it repeats until the user/s quit the program. So what I want to do is, everytime a user clicks a button ,depending on which user click it, I want the name of the button to appear after they specified field. for example. User1Click: button1 button3 button1 button2 User2Click: button4 button2 button1 button2 button3 the example above shows that user 1 has clicked button1, 3 1 ad 2 and user2 has clicked button4, 2, 1, 2 and 3. edited: sorry about the late reply. both users are on the same computer and user turn is counted by clicks, if for example click == 1 then its user 1 turn and if click == 2 then its user 2 turn, if click == 3 then its user 1 turn and if click == 4 then its user 2 turn and so on.
has comment: http://stackoverflow.com/comment/33173710
has title: How to organise text on JTextArea or other good text fields in java?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21890852
accepted answer: http://stackoverflow.com/a/21890852
tagged with: java
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/3066590

http://stackoverflow.com/comment/33238311
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21941319
score: 9
has text: Do you type something and press Enter?

http://stackoverflow.com/comment/33337905
type: QuestionComment
has text: There are other [ways to debug](http://developer.android.com/tools/debugging/index.html#tips) than simply watching the screen.
comment on: http://stackoverflow.com/q/21996679
score: 0
type: Comment

http://stackoverflow.com/q/21938278
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21938829
tagged with: soap-client
tagged with: cxf
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: jax-ws
upvote count: 1
tagged with: web-services
has body: I build my java classes with wsimport. On first soap request I get a SecurityToken. In other Request I must put this Token to header. How can I do this? I nothig found in web. &lt;wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss wssecurity-secext-1.0.xsd" xmlns:wsc="http://schemas.xmlsoap.org/ws/2005/02/sc"&gt; &lt;wsc:SecurityContextToken&gt; &lt;wsc:Identifier&gt;__TOKEN__&lt;/wsc:Identifier&gt; &lt;/wsc:SecurityContextToken&gt; &lt;/wsse:Security&gt; If I set the Header by Example. I get following Exception. Any Idea? SCHWERWIEGEND: SAAJ0120: Can't add a header when one is already present com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Can't add a header when one is already present. at com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl.addHeader(EnvelopeImpl.java:114) at com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl.addHeader(EnvelopeImpl.java:94) at client.header.WSSUsernameTokenSecurityHandler.handleMessage(WSSUsernameTokenSecurityHandler.java:47) at client.header.WSSUsernameTokenSecurityHandler.handleMessage(WSSUsernameTokenSecurityHandler.java:15) at org.apache.cxf.jaxws.handler.HandlerChainInvoker.invokeHandleMessage(HandlerChainInvoker.java:347) at org.apache.cxf.jaxws.handler.HandlerChainInvoker.invokeHandlerChain(HandlerChainInvoker.java:254) at org.apache.cxf.jaxws.handler.HandlerChainInvoker.invokeProtocolHandlers(HandlerChainInvoker.java:132) at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessageInternal(SOAPHandlerInterceptor.java:169) at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.access$000(SOAPHandlerInterceptor.java:71) at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor$1.handleMessage(SOAPHandlerInterceptor.java:81) at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor$1.handleMessage(SOAPHandlerInterceptor.java:78) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271) at org.apache.cxf.endpoint.ClientImp…
type: Question
has title: Set SecurityContextToken to SOAP Header
answer count: 1

http://stackoverflow.com/comment/33103650
comment on: http://stackoverflow.com/a/21865184
type: Comment
score: 0
has text: Well, BorderLayout is not perhaps the best choice here, since it will only show the components that are actually added. And, the different places (NORTH, CENTER, SOUTH, etc) all treat their components differently; CENTER components are stretched horizontally and vertically, whereas NORTH and SOUTH are stretched horizontally only. In your case, you have your labels in *two*, and you've tried to set it's size to (50,50), and placed *two* in the *something's* SOUTH. To force the labels to EAST and WEST, you need to add a dummy-component to the CENTER in *two*, and play with two's setSize
type: AnswerComment

http://stackoverflow.com/q/21941750
type: Question
tagged with: jodatime
linked to: http://stackoverflow.com/q/38922754
possible better answer: http://stackoverflow.com/a/21996298
downvote count: 0
accepted answer: http://stackoverflow.com/a/49993756
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/24330032
has body: I understand that the main concepts in Joda time are: instant in time with millisecond granularity (represented by DateTime) Interval representing the span of two instances duration which is really only an long number of milliseconds a Period which is like an un-anchored length of time defined not in terms of a precise number of milliseconds but according to common civil usage of concepts like "month", "day", etc. How should I then represent, e.g. "February 2014". Is there a type for that? I understand I can represent it as a tuple of an instant in time (at the beginning or end of that month) and a Period of one month. But this means that I define my own types on top of Joda and I have to decide on a convention on whether the instant should be at the beginning or the end of the period I wish to define (since both options are clearly viable). The use case I am having is that I need to produce reports and it does make a difference (on the report header / description) if the user: simply happened to select two instances in time which were exactly at the start and end of February 2014 selected to produce a monthly report for February 2014. So, is there a single type for that? and, failing, that, what would be the best approach to represent that.
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/87003531
has answer: http://stackoverflow.com/a/49993756
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21996298
has comment: http://stackoverflow.com/comment/33239275
has title: how to represent a specific calendar period (month, week, etc.)

http://stackoverflow.com/a/21921263
has comment: http://stackoverflow.com/comment/33297702
has comment: http://stackoverflow.com/comment/33353467
has comment: http://stackoverflow.com/comment/33359586
score: 1
accepted answer of: http://stackoverflow.com/q/21910048
has comment: http://stackoverflow.com/comment/33220315
has comment: http://stackoverflow.com/comment/33451400
has body: Please begin by reading the documentation, AppWidget Guide and AppWidgetProvider. That explains: Your onUpdate() method needs to send a RemoteViews to the widget via updateAppWidget(). Waking up once per second would drain your battery. You certainly don't want to update the widget while the phone is sleeping. Each call to remoteViews.setTextViewText() appends more data to the RemoteViews object. That'll accumulate excess data in memory and make the widget slow. Instead, get a new RemoteViews instance each time. My hypothesis about your updates not happening is the OS stopping your widget provider's component when the provider finishes responding to an Intent. You can test that hypothesis via Log.d(). You can register for an ACTION_TIME_TICK broadcast that tells you when the time changes, once per minute. Do test that it doesn't run when the phone sleeps (e.g. keep a count of calls) and feel free to report back here. [Added] It's much easier in practice to display the date (and update it once per day) than the date + time (and update it once per minute; your question code tried to update it once per second), and to do this without using much battery power. Set updatePeriodMillis="0". Add &lt;action android:name="android.intent.action.DATE_CHANGED"/&gt; to the &lt;intent-filter&gt; for the widget provider in AndroidManifest.xml. In the AppWidgetProvider, override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if (Intent.ACTION_DATE_CHANGED.equals(intent.getAction())) { updateAllMyWidgets(context); } } Use DateUtils.formatDateTime() to format the date. Yes, the bug code.google.com/p/android/issues/detail?id=2880 will happen if the clock is adjusted backwards.
has comment: http://stackoverflow.com/comment/33264410
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33342494
answers question: http://stackoverflow.com/q/21910048
type: Answer
has comment: http://stackoverflow.com/comment/33281524
has comment: http://stackoverflow.com/comment/33297462
has comment: http://stackoverflow.com/comment/33264579
has comment: http://stackoverflow.com/comment/33271626
upvote count: 1

http://stackoverflow.com/comment/33209207
comment on: http://stackoverflow.com/q/21924802
type: QuestionComment
type: Comment
score: 2
has text: This question appears to be off-topic because it depends. You left off *object pooling* and many *creational* design patterns there. What have you tried and where are you stuck? Because this is a *very* broad question as worded.

http://stackoverflow.com/comment/33194994
type: QuestionComment
score: 1
has text: (And, as others have pointed out, you probably should have `||`, not `&`.)
comment on: http://stackoverflow.com/q/21916696
type: Comment

http://stackoverflow.com/q/21892526
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21925159
tagged with: program-entry-point
tagged with: user-interface
has body: public class StatsGUI extends JFrame implements ActionListener { JLabel label; JLabel label2; JTextField input; JTextField output; JButton getButton; JButton exitButton; public StatsGUI() { JPanel panel = new JPanel(); label = new JLabel("Enter number"); panel.add(label); input = new JTextField(10); input.addActionListener(this); panel.add(input); label2 = new JLabel("Statistics"); output = new JTextField(10); output.setEditable(false); panel.add(output); getButton = new JButton("Go"); getButton.addActionListener(this); panel.add(getButton); exitButton = new JButton("Exit"); exitButton.addActionListener(this); panel.add(exitButton); } public void actionPerformed(ActionEvent e) { if(e.getSource() == exitButton) { System.exit(0); } else { String text = input.getText(); output.setText(text + "COUNTER"); } } public static void main(String[] args) { } This is my simple GUI program. I have placed all buttons and other gadgets within the constructor. However, I am not sure what I should be putting inside my main in order to get my GUI to actually show up. I am sure I am missing something incredibly simple here however I am not sure what. Help would be much appreciated.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21894236
has title: How am I to run my GUI? Or to be more exact, what do I put in my main?
has comment: http://stackoverflow.com/comment/33158120
tagged with: swing
type: Question
tagged with: actionlistener

http://stackoverflow.com/q/21966703
has title: Apache Shiro: authenticate with username/password but store user id as the principal
has body: I'm getting started with Apache Shiro. I've started with simple examples and have been building up complexity as I go. Currently I'm collecting the email address and password from the login form with JSF and using a UsernamePasswordToken to authenticate the user with Shiro. UsernamePasswordToken token = new UsernamePasswordToken(email, password); SecurityUtils.getSubject().login(token); The is backed by the out of the box JDBC realm with a simple query jdbcRealm.authenticationQuery = SELECT password FROM user WHERE email = ? To get further details about the user, such as their name I'm looking up the user in the database by the principal - which is their email address. currentUser = userDAO.findByEmail((String) SecurityUtils.getSubject().getPrincipal()); This works well, but the user is allowed to change their email address, which will break the lookup. My goal is to store the unique user id as the principal rather than the email address as this can never change. How would I go about achieving this?
has answer: http://stackoverflow.com/a/21998754
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: authentication
type: Question
score: 3
tagged with: shiro
accepted answer: http://stackoverflow.com/a/21998754
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/33065789
score: 0
type: Comment
type: QuestionComment
has text: Can you be more specific what do you mean by text to be displayed. What text you want to retrieve from that.
comment on: http://stackoverflow.com/q/21844405

http://stackoverflow.com/comment/33129377
comment on: http://stackoverflow.com/a/21879031
score: 0
type: AnswerComment
has text: I am compiling with eclipse.
type: Comment

http://stackoverflow.com/q/21901186
score: 0
has comment: http://stackoverflow.com/comment/33167354
answer count: 1
has body: I'm trying to run servlet using Tomcat. My Tomcat works well (I tested it on dummy Hello World project). My parent directory is C:\Users\dolgopolov.a\Desktop\tattelecom\amsc\amsc. This is how I do: Run cmd.exe &gt;cd C:\Users\dolgopolov.a\Desktop\tattelecom\amsc\amsc &gt;jar -cvf tattelecom.war * Add tattelecom.war to C:\tomcat\tomcat7\webapps Run startup.bat This is what I've got: SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngin e[Catalina].StandardHost[localhost].StandardContext[/tattelecom]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase .java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:87 7) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073 ) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java: 1857) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47 1) 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: java.lang.NoClassDefFoundError: javax/ejb/EJBObject at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14 2) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(Webapp ClassLoader.java:2944) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoa der.java:1208) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa der.java:1688) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa der.java:1569) at java.lang.C…
tagged with: tomcat
has comment: http://stackoverflow.com/comment/33167478
has comment: http://stackoverflow.com/comment/33167397
has answer: http://stackoverflow.com/a/21901240
has comment: http://stackoverflow.com/comment/33167332
type: AnsweredQuestion
has title: Tomcat deploying troubles
accepted answer: http://stackoverflow.com/a/21901240
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/33167292
tagged with: servlets

http://stackoverflow.com/comment/33333142
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21985123
has text: Thanks for the reply. Added output.flush() every percent and it solved the hanging up. however it still seems just as slow if not slower. In fact on both attempts it didn't finish as the serial read while loop timed out, meaning a whole second went without receiving data. Where is the holdup here? This is running off a macbook pro, is it possible it is buffering packets to send to the BT module? Am going to see if it transfers any differently in windows VM, but this seems to be an issue/restriction outside of my code.

http://stackoverflow.com/q/21850865
tagged with: jdbc
tagged with: postgresql-9.3
has comment: http://stackoverflow.com/comment/33081223
type: UnansweredQuestion
tagged with: java
has title: Postgres jdbc driver problems with encoding
has comment: http://stackoverflow.com/comment/33081034
type: Question
has body: I use 9.3-1100-jdbc4 driver and I have UTF-8 as default encoding in Eclipse. When I run my application I get stack trace but I can't read it Error opening session. Cause: org.postgresql.util.PSQLException: �����: ������������ "root" �� ������ �������� ����������� (�� ������) I see smth like this. Is it possible to resolve this problem?
has comment: http://stackoverflow.com/comment/33081713
has comment: http://stackoverflow.com/comment/33080975
has comment: http://stackoverflow.com/comment/33080911
score: 0
answer count: 1
tagged with: driver
tagged with: postgresql
has answer: http://stackoverflow.com/a/21853082

http://stackoverflow.com/a/21857869
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21857777
has body: There are some resources in your project that is not compatible with 2.3.3. Fix them and it will be fine.

http://stackoverflow.com/q/21970597
possible better answer: http://stackoverflow.com/a/21970624
tagged with: sql
upvote count: 1
has answer: http://stackoverflow.com/a/21970624
favorite count: 0
has body: I got this property in my spring configuration of my dao project: &lt;property name="LBQC"&gt; &lt;value&gt; SELECT u.name, u.cq FROM user u WHERE u.cq &lt;&gt; 0 ORDER BY u.cq DESC; &lt;/value&gt; &lt;/property&gt; Unfortunality I have a problem with that &lt;&gt; notation. It leads to The content of elements must consist of well-formed character data or markup. I am not familiar with xml. How can I escape those kind of characters? Thanks for your help. Stefan
has title: spring property howto escape special characters in sql?
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21970626
accepted answer: http://stackoverflow.com/a/21970626
answer count: 2

http://stackoverflow.com/comment/33135146
type: Comment
type: QuestionComment
score: 1
has text: How come a teacher be confused about stuff like this ?
comment on: http://stackoverflow.com/q/21883523

http://stackoverflow.com/a/21964786
upvote count: 23
type: AcceptedAnswer
downvote count: 0
has body: To draw a rectangle in Swing you should: First of all, never draw directly in the JFrame or other top-level window. Instead draw in a JPanel, JComponent or other class that eventually extends from JComponent. You should override the paintComponent(Graphics g) method. You should be sure to call the super method You should draw your rectangle with the Graphics object provided to the method by the JVM. You should read the painting in Swing tutorial. Clear? e.g., import java.awt.Dimension; import java.awt.Graphics; import javax.swing.*; public class DrawRect extends JPanel { private static final int RECT_X = 20; private static final int RECT_Y = RECT_X; private static final int RECT_WIDTH = 100; private static final int RECT_HEIGHT = RECT_WIDTH; @Override protected void paintComponent(Graphics g) { super.paintComponent(g); // draw the rectangle here g.drawRect(RECT_X, RECT_Y, RECT_WIDTH, RECT_HEIGHT); } @Override public Dimension getPreferredSize() { // so that our GUI is big enough return new Dimension(RECT_WIDTH + 2 * RECT_X, RECT_HEIGHT + 2 * RECT_Y); } // create the GUI explicitly on the Swing event thread private static void createAndShowGui() { DrawRect mainPanel = new DrawRect(); JFrame frame = new JFrame("DrawRect"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(mainPanel); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGui(); } }); } }
score: 23
has comment: http://stackoverflow.com/comment/36051805
type: Answer
has comment: http://stackoverflow.com/comment/89384116
accepted answer of: http://stackoverflow.com/q/21964768
has comment: http://stackoverflow.com/comment/89384203
answers question: http://stackoverflow.com/q/21964768

http://stackoverflow.com/comment/33350016
comment on: http://stackoverflow.com/q/22003487
type: Comment
type: QuestionComment
score: 1
has text: If you make the code cleaner, you'll get it working more quickly.

http://stackoverflow.com/q/21857474
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33089137
has comment: http://stackoverflow.com/comment/33089179
has comment: http://stackoverflow.com/comment/33088472
has comment: http://stackoverflow.com/comment/33088988
possible better answer: http://stackoverflow.com/a/21857769
has comment: http://stackoverflow.com/comment/33088707
has comment: http://stackoverflow.com/comment/33089492
has comment: http://stackoverflow.com/comment/33088957
score: 0
has comment: http://stackoverflow.com/comment/33089756
answer count: 3
has answer: http://stackoverflow.com/a/21857947
accepted answer: http://stackoverflow.com/a/21857947
has title: Java Threads Not Running Asynchronously - Some not completing at all
has body: I am attempting to complete an experiment for a university project. I want to run it in parallel, utilising multiple cores, so that I can increase the sample size. To achieve this I am creating multiple (up to 7, but I have tried using as few as 2) java threads and executing my class in all of those threads at once. My PC has 8 cores. The problem I am having is that Java seems to be haphazard in how those threads are executed. All 7 threads start fine. They run asynchronously for a while. In a typical run maybe 3 of them will finish in the expected time, a fourth might finish a few minutes later and the final 3 don't finish at all. The experimental class is designed to run for a certain amount of wall-clock time (not cpu-clock time). This factor is outside of my control. So I need my threads to be running simultaneously on separate cores at all times. The following code snippet exhibits the method I am using to create the threads and kick them off. It is obviously not calling the class I am using for my experiment and if you copy it and run it yourself, you will see that it works fine. I have provided it here simply to demonstrate that I am creating and using the threads correctly. I have been searching for an answer to this for days and can't see that I am doing anything wrong. This is a test class demonstrating the means used by my experimental class. It just concatenates some string data to ensure a long enough running process. public class ThreadTestClass implements Runnable { @Override public void run() { Thread.currentThread().setPriority(Thread.MAX_PRIORITY); System.out.println("This thread is underway"); int i=0; String a="a"; while(i&lt;25){ a=a+a; i++; } System.out.println("This thread ran fine"); } } This is how it is called: private static void ThreatTestMethod(){ Thread[] threads = new Thread[7]; int i=0; while(i&lt;threads.length){ threads[i] = new Thread(new ThreadTestClass()); threads[i].start(); i++; } while(threads[0].isAlive() || threads[1].isAliv…
has comment: http://stackoverflow.com/comment/33088643
has comment: http://stackoverflow.com/comment/33088871
tagged with: multithreading
has answer: http://stackoverflow.com/a/21857769
has comment: http://stackoverflow.com/comment/33089772
has comment: http://stackoverflow.com/comment/33089065
has comment: http://stackoverflow.com/comment/33089395
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33089813
has answer: http://stackoverflow.com/a/21858931
has comment: http://stackoverflow.com/comment/33089650
has comment: http://stackoverflow.com/comment/33088407

http://stackoverflow.com/a/22183095
downvote count: 0
has comment: http://stackoverflow.com/comment/33889626
has body: This is a known bug HHH-5732 that will be fixed in 4.3. In general there have been a few problems with this functionality, have a look at these recent bug reports: HHH-8580 - NPE while deleting items from collection HHH-5378 - @OrderColumn not updated when inserting HHH-5390 - Index column on inverse List should throw a warning Initially there where discussions saying that the scenario of usage that you mention is considered not valid from a conceptual point of view, as it meant that the information about the MenuItem position is available only on the parent but not on the child. Later it was mentioned that a better error message would be shown explaining the problem, instead of silently filling position with null. It was also mentioned that the Hibernate documentation itself gave examples similar to the one you presented, and JPA mentioned nothing against it so it should be a valid use case. The bug fix on HHH-5732 seems to address this. However if you want to apply the fix on your current version, there is one way that will work. I had the same problem last week with Hibernate 4.1 and could not upgrade, so I applied the following solution: Add position as a private property field in MenuItem, without necessarily giving it getters and setters. Fill in this property yourself and let Hibernate persist it: public class MenuItem { public MenuItem(... other parameters ..., int position) { } @Column("position") private int position; .... no getters or setters ... } And in the code that adds submenus: int counter = 0; // some counter keeping the current position being added MenuItem newItem = service.persist(.., counter); parent.getChildren().add(newItem); This also makes the information about what is the position of the element available at both sides of the relation. EDIT: see here the Hibernate documentation for this solution
has comment: http://stackoverflow.com/comment/33688768
type: Answer
accepted answer of: http://stackoverflow.com/q/21996396
has comment: http://stackoverflow.com/comment/33688533
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/21996396
type: AcceptedAnswer

http://stackoverflow.com/a/21873818
has body: Load jquery and pass data to you action through a POST request on click of your button like this , hope this helps HTML : &lt;input type="button" id="button" value="Say Hello"&gt; JS: $(document).ready(function(){ $("#button").click(function (){ var name = $('#name').val(); //your code has $(#name) which is not selecting required input element! $.post("/cardselector/mailAction.do",{"name" : name},function(response) { alert("done"); console.log(response); //see what response you are getting }); }) ; });
has comment: http://stackoverflow.com/comment/33118926
score: 1
accepted answer of: http://stackoverflow.com/q/21873660
has comment: http://stackoverflow.com/comment/33118623
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33118288
has comment: http://stackoverflow.com/comment/33118634
type: Answer
has comment: http://stackoverflow.com/comment/33118234
upvote count: 1
answers question: http://stackoverflow.com/q/21873660

http://stackoverflow.com/comment/33236235
has text: What did you try and what problem do you encounter?
comment on: http://stackoverflow.com/q/21940101
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/48984485
type: Answer
answers question: http://stackoverflow.com/q/21871568
has body: create a bash script file and put the following code. Run this file before running test. #!/usr/bin/env bash ##script to install the necessary dependency for headless firefox browser remove_Xvfb (){ kill -9 $(ps -ef | grep [X]vfb | awk '{print $2}') } remove_screenLock (){ Xvfb :3000 -screen 0 1024x768x16 &amp; file="/tmp/.X3000-lock" if [ -f "$file" ]; then echo "Screen Exits..removing it and installing it again" sudo rm -rf "$file" export DISPLAY=:3000 else echo "Screen Does not Exists....Creating one" export DISPLAY=:3000 fi } yum install -y xdg-utils xorg-x11-server-Xvfb fontconfig freetype freetype-devel fontconfig-devel libstdc++ Xvfb firefox sudo ln -s /usr/lib64/firefox/firefox /usr/bin/firefox running=`ps ax | grep -v grep | grep Xvfb | wc -l` if [ $running -gt 0 ]; then echo " Xvfb is running, removing it" remove_Xvfb remove_screenLock else remove_screenLock fi This will create a virtual display for your UI bases test cases with firefox browser.
score: 0

http://stackoverflow.com/q/21942213
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21943545
favorite count: 0
has comment: http://stackoverflow.com/comment/33240059
linked to: http://stackoverflow.com/q/13213645
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/21943545
linked to: http://stackoverflow.com/q/6234530
has title: how can i resize a jscrollpane
upvote count: 1
tagged with: swing
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/33240321
has body: Ok so I have this code: //adding the panel which will hold the order table JPanel orderPanel = new JPanel(); right.add(orderPanel); JTable order = new JTable(orderData, orderColumnNames); JScrollPane orderPane = new JScrollPane(order); orderPanel.add(orderPane); And I want to be able to remove this space : I guess the space is made by the JScrollPane but i can't find any method to resize the JScrollPane to the JTable's size
tagged with: jtable
linked to: http://stackoverflow.com/q/7229226
tagged with: jscrollpane

http://stackoverflow.com/comment/33269158
type: QuestionComment
comment on: http://stackoverflow.com/q/21956957
score: 0
has text: The loop is not the issue; a `while` loop works just fine for what you're trying to do. Remember what it does: executes the loop as long as the condition is `true` or until you `break` out of it. You're predicating your `while` loop on `findName` not being found. When you reach the end of the list of names, your condition is still `true`, i.e. `findName` hasn't been found, so the `while` loop executes again, calling `reader.nextLine()` and so forth, even though you're out of lines. @Belgian pointed out the right answer: condition the while loop on `reader.nextLine() != null`
type: Comment

struts2
tags question: http://stackoverflow.com/q/21979741
tags question: http://stackoverflow.com/q/21903098
tags question: http://stackoverflow.com/q/21872959
tags question: http://stackoverflow.com/q/21856896
tags question: http://stackoverflow.com/q/21925210
tags question: http://stackoverflow.com/q/21856774
tags question: http://stackoverflow.com/q/21935256
tag name: struts2
tags question: http://stackoverflow.com/q/21862524
tags question: http://stackoverflow.com/q/21927220
tags question: http://stackoverflow.com/q/21894429
tags question: http://stackoverflow.com/q/21934450
tags question: http://stackoverflow.com/q/21862040
tags question: http://stackoverflow.com/q/21961115
tags question: http://stackoverflow.com/q/21987383
tags question: http://stackoverflow.com/q/22004006
tags question: http://stackoverflow.com/q/21855868
type: Tag

http://stackoverflow.com/a/49013822
upvote count: 4
answers question: http://stackoverflow.com/q/21894128
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/100838886
has body: To install sigar on Linux, here is a copy/paste option: wget https://netcologne.dl.sourceforge.net/project/sigar/sigar/1.6/hyperic-sigar-1.6.4.tar.gz tar xvf hyperic-sigar-1.6.4.tar.gz cd hyperic-sigar-1.6.4 # INSTALL sudo cp sigar-bin/lib/libsigar-`dpkg --print-architecture`-`uname -s | tr '[:upper]' '[:lower]'`.so /usr/lib

http://stackoverflow.com/comment/33348462
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22002653
type: Comment
has text: It worked!!! Thanks!!! Sorry, I'm a beginner at Java, my source of learning is books, youtube and stackoverflow only

http://stackoverflow.com/a/21965106
type: AcceptedAnswer
score: 0
type: Answer
has body: If you want to find out how BigInteger works under the covers ... read the source code. (It is easy to find the Java source code on the web with Google.) If you are looking for fast algorithms that you can use (with BigInteger) to "find factorials" or "find exponents", I suggest that you start by looking on Wikipedia ... which often has information on computational algorithms of that nature. If that fails, try Google. Why are BigInteger calculations faster than any other primitive used calculations in JAVA They are not faster. In fact BigInteger are typically orders of magnitude slower than analogous calculations done using the primitive integer types; i.e. byte, short, char, int and long. (Of course the calculations are typically not equivalent ... because of the representation limitations of the primitive types, compared to BigInteger.)
accepted answer of: http://stackoverflow.com/q/21964937
answers question: http://stackoverflow.com/q/21964937

http://stackoverflow.com/a/21907491
answers question: http://stackoverflow.com/q/21907139
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21907139
type: Answer
has comment: http://stackoverflow.com/comment/33178921
has body: Assuming you have already compiled the class, the path where the class file is should be present in the class path. No package provided: Here if your current directory is D:\Documents\CodeAnalysis\project_analysis_RG\CodeAnalysis\ and the class file is present in D:\Documents\CodeAnalysis\project_analysis_RG\CodeAnalysis\input\master\Kajari_G, this should work - java -cp input\master\Kajari_G MemoryComparison Package provided (say input.master.Kajari_G): Here if your current directory is D:\Documents\CodeAnalysis\project_analysis_RG\CodeAnalysis\ and the class file is present in D:\Documents\CodeAnalysis\project_analysis_RG\CodeAnalysis\input\master\Kajari_G, this should work - java input.master.Kajari_G.MemoryComparison
score: 0

http://stackoverflow.com/comment/33290769
type: QuestionComment
comment on: http://stackoverflow.com/q/21970390
has text: post the full code to get help.
score: 0
type: Comment

http://stackoverflow.com/a/21974136
has comment: http://stackoverflow.com/comment/33298488
has comment: http://stackoverflow.com/comment/33297504
has comment: http://stackoverflow.com/comment/33297650
answers question: http://stackoverflow.com/q/21974083
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21974083
has body: Analogously to how you sent that image. Simply use an InputStream object like this: InputStream stream = socket.getInputStream(); byte[] data = new byte[MAX_SIZE]; int count = stream.read(data); Both objects (sending and receiving) are compatible this way, you just have to know the byte array size, it has to be the same on both places.
has comment: http://stackoverflow.com/comment/33297458
type: Answer
upvote count: 1

http://stackoverflow.com/q/21846731
tagged with: sql
favorite count: 0
has title: java.lang.RuntimeException: java.sql.SQLException: Field 'UserName' doesn't have a default value
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I am developing a web app.... in which there will be a list of users requesting registration ...Wen ever we click on accept all the details must be moved from register table to login table... This is my servlet: ClientApproveService approve=new ClientApproveService(); approve.clientApprove(); this is my service: public class ClientApproveService { public void clientApprove() { ClientApproveDAO cad=new ClientApproveDAO(); DataSource dataSource=new DataSource(); cad.setDataSource(dataSource); cad.insertClient(); } } And this is my DAO: public class ClientApproveDAO { private DataSource dataSource; public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } Connection conn=null; PreparedStatement statement=null; ResultSet rs=null; public void insertClient() { try{ conn=dataSource.createConnection(); PreparedStatement ps=conn.prepareStatement("insert into login(id,FirstName,LastName,Gender,Category,Dateofbirth,Age,Address,Country,State,city,PinCode,EmailId,ContactNo,MobileNo)select * from register "); ps.executeUpdate(); } catch (SQLException e) { throw new RuntimeException(e); } finally { if (rs != null) try { rs.close(); } catch (SQLException ignore) {} if (statement != null) try { statement.close(); } catch (SQLException ignore) {} if (conn != null) try { conn.close(); } catch (SQLException ignore) {} } } } This is my register table : create table register( id int(100) not null AUTO_INCREMENT primary key, FirstName varchar(300) default null, LastName varchar(300) default null, Gender varchar(200) default null, Category varchar(200) default null, DateOfBirth varchar(200) default null, Age int(3)default null, Address varchar(1000) default null, Country varchar(500) default null, State varchar (500) default null, city varchar(500)default null, PinCode int(10)default null, EmailId varchar(500)default null, ContactNo varchar(20) default null, MobileNo varchar(20) default null ); And this is my login table: create table login( UserName varchar(100)no…
accepted answer: http://stackoverflow.com/a/21846812
tagged with: mysql
type: Question
tagged with: jakarta-ee
possible better answer: http://stackoverflow.com/a/21846826
has answer: http://stackoverflow.com/a/21846793
has answer: http://stackoverflow.com/a/21846812
has answer: http://stackoverflow.com/a/21846826
answer count: 3
upvote count: 1

http://stackoverflow.com/comment/33340161
has text: Thx for info about public private and void!
type: Comment
comment on: http://stackoverflow.com/a/21970295
type: AnswerComment
score: 0

http://stackoverflow.com/a/21949891
type: Answer
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/21949110
answers question: http://stackoverflow.com/q/21949110
type: AcceptedAnswer
downvote count: 0
has body: Here is what I would do: I would skip to the 3rd line and then use the split function to split line at each "|" and store the second and third values as name and email. Then we take the name, split it every time there are any amount of spaces, and rearrange it based on how many parts there are, either First Middle Last or First Last. Then we print it side by side with the email. Soooooooo here's what that looks like: import java.io.*; public class temp { public static void main(String[] args) { // define the path to your text file String myFilePath = "temp.txt"; // read and parse the file try { BufferedReader br = new BufferedReader(new FileReader(new File(myFilePath))); String line, name, email; // read through the first two lines to get to the data line = br.readLine(); line = br.readLine(); while ((line = br.readLine()) != null) { if (line.contains("|")) { // do line by line parsing here line = line.trim(); // split the line String[] parts = line.split("[|]"); // parse out the name and email name = parts[1].trim(); email = parts[2].trim(); // rearrange the name String[] nParts = name.split(" *"); if (nParts.length == 3) { name = nParts[1] + " " + nParts[2] + " " + nParts[0]; } else { name = nParts[1] + " " + nParts[0]; } // all done now, let's print the name and email System.out.println(email + " " + name); } } br.close(); } catch (Exception e) { System.out.println("There was an issue parsing the file."); } } } And if we go ahead and run this with the sample file you provided here's what we get: bi@tmich.edu Bushra Malapa bm@tmich.edu Benjamin T Peter dg@tmich.edu Priya Goday Hope this was helpful to you! I definitely encourage you to find your own way to do this too, because there are plenty of different ways to solve problems and it's good to find a way that makes sense for you. Also as was pointed out you definitely shouldn't store passwords in plain text.

http://stackoverflow.com/q/21999639
answer count: 1
tagged with: algorithm
has title: Getting wrong output for quicksort algorithm
tagged with: sorting
accepted answer: http://stackoverflow.com/a/21999803
has comment: http://stackoverflow.com/comment/33343197
type: AnsweredQuestion
has body: I'm trying to implement quicksort and the output isn't correct. I know ArrayLists are referenced by value, yet I don't understand why it's not giving me the correct output. Can anyone tell me what I'm doing wrong? import java.util.ArrayList; public class Quicksort { static ArrayList&lt;Integer&gt; quicksort(ArrayList&lt;Integer&gt; place){ if(place.size()&lt;=1) return place; int median=place.size()/2; int pivot=place.get(median); place.remove(median); ArrayList&lt;Integer&gt; place2=new ArrayList&lt;&gt;(); ArrayList&lt;Integer&gt; place3=new ArrayList&lt;&gt;(); for(int i=0;i&lt;place.size();i++){ if(place.get(i)&lt;pivot){ place2.add(place.get(i)); }else if(place.get(i)&gt;pivot){ place3.add(place.get(i)); }else if(place.get(i)==pivot){ place3.add(place.get(i)); } } return concatenate(quicksort(place2),pivot,quicksort(place3)); } static ArrayList&lt;Integer&gt; concatenate( ArrayList&lt;Integer&gt; first, int pivot, ArrayList&lt;Integer&gt; second){ ArrayList&lt;Integer&gt; third=new ArrayList&lt;&gt;(); for(int i=0;i&lt;first.size();i++){ third.add(first.get(i)); } third.add(pivot); for(int i=0;i&lt;second.size();i++){ third.add(second.get(i)); } return third; } public static void main(String[] args) { ArrayList&lt;Integer&gt; arraylist=new ArrayList&lt;&gt;(); arraylist.add(20); arraylist.add(3); arraylist.add(8); arraylist.add(4); arraylist.add(7); arraylist.add(1); arraylist.add(9); arraylist.add(13); quicksort(arraylist); for(int n:arraylist){ System.out.println(n); } } }
type: Question
has comment: http://stackoverflow.com/comment/33344340
has comment: http://stackoverflow.com/comment/33343270
has comment: http://stackoverflow.com/comment/33343344
tagged with: quicksort
has answer: http://stackoverflow.com/a/21999803
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33343138

http://stackoverflow.com/comment/33205524
type: Comment
type: QuestionComment
has text: no, I use Andorid studio
comment on: http://stackoverflow.com/q/21922209
score: 0

http://stackoverflow.com/comment/33312683
comment on: http://stackoverflow.com/a/21982010
has text: no nothing............i think
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33250622
score: 1
has text: C-based compiled languages generally don't allow you to nest methods like that. Algol-based languages (Pascal, Ada) do allow this. Just the language designers' choice.
type: Comment
comment on: http://stackoverflow.com/q/21947898
type: QuestionComment

http://stackoverflow.com/q/21925726
score: 0
answer count: 3
type: UnansweredQuestion
tagged with: sockets
has answer: http://stackoverflow.com/a/21926222
tagged with: java
has answer: http://stackoverflow.com/a/21926638
has body: I am able to upload any type of file to the server using the code below. However, right after uploading finishes, I get an error message on the server that says java.net.SocketException: Socket is closed Exception in thread "Thread-0" java.lang.NullPointerException at Server2Connection.run(server1.java:407) at java.lang.Thread.run(Unknown Source) The server1.java: 407 refers to the line switch (clientMsg) in the server code. The file does get uploaded correctly. But it seems I am not doing something right with the .close instructions. The server does not disconnect after this but the client loops back one more time only to disconnect. Can anyone please tell me where I am messing up? Thanks. Server Side: public BufferedReader msgFromClient() throws IOException { BufferedReader receiveClientmsg = null; try { receiveClientmsg = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); } catch (IOException e) { System.out.println(e); } return receiveClientmsg; } public DataOutputStream outToClient() throws IOException { DataOutputStream sendClientmsg = null; try { sendClientmsg = new DataOutputStream(clientSocket.getOutputStream()); } catch (IOException e) { System.out.println(e); } return sendClientmsg; } public void upload() throws IOException { byte[] mybytearray = new byte[8192]; InputStream is = clientSocket.getInputStream(); String file_name = msgFromClient().readLine(); File rqstd_upld_file = new File(SERVER_FILE_LOCATION + file_name); if (rqstd_upld_file.exists()){ outToClient().writeBytes("yes\n"); outToClient().writeBytes("A file with the name " + file_name + " already exists on server\n"); System.out.println("A file with the name " + file_name + " already exists"); } else { outToClient().writeBytes("no\n"); FileOutputStream fos = new FileOutputStream(SERVER_FILE_LOCATION +"\\"+ file_name); BufferedOutputStream bos = new BufferedOutputStream(fos); int count; System.out.println("Downloading " + file_name + " ..."); outToClient().writeBytes("Uplo…
type: Question
has answer: http://stackoverflow.com/a/21926519
has title: Uploading a file using sockets

http://stackoverflow.com/a/69145500
has comment: http://stackoverflow.com/comment/122209462
has comment: http://stackoverflow.com/comment/122212518
has comment: http://stackoverflow.com/comment/122218577
answers question: http://stackoverflow.com/q/21885635
downvote count: 0
type: Answer
upvote count: 1
has body: enter code here public class UniformRandomNumbers1 { public static void main(String[] args) { int n = Integer.parseInt(args[0]); int i; double total = 0.0; //(The sum of n, numbers) for (i = 1; i <= n; i++) { double rand = Math.random(); //(Random number between 0 & 1) total += rand; // Increment total by rand System.out.println(i + " = " + rand); // Prints value of n & corresponding double value } double average = total / n; // Calculates average of n numbers System.out.println("Average = " + average); // Prints average of n numbers, Can i get an up vote? :) plz } }
has comment: http://stackoverflow.com/comment/122211159
has comment: http://stackoverflow.com/comment/122218561
score: 1
has comment: http://stackoverflow.com/comment/122209228

http://stackoverflow.com/comment/33133020
type: QuestionComment
comment on: http://stackoverflow.com/q/21879672
type: Comment
has text: @Amrola - yes. Is it possible to do from client side? If yes then how?
score: 0

http://stackoverflow.com/q/21905124
has title: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
score: 1
tagged with: java
tagged with: hibernate
has body: I want to access my resources(css,js...) folder from my jsp..I am using spring security with hibernate integration....Inorder to access these files i used mvc:resources ..> tag in my dispatcher-servlet...but it is throwing org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 17 in XML document from ServletContext resource [/WEB-INF/sdnext-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:resources'. the following is my dispatcher-servlet <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-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/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> <mvc:resources mapping="/css/**" location="/css/" /> <mvc:annotation-driven /> <context:property-placeholder location="classpath:resources/database.properties" /> <context:component-scan base-package="com.nufame" /> <tx:annotation-driven transaction-manager="hibernateTransactionManager"/> ${hibernate.dialect} ${hibernate.show_sql} ${hibernate.hbm2ddl.auto} the following is my stacktrace SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 17 in XML document from Servlet…
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21905297
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: spring
tagged with: spring-mvc

javaw
tags question: http://stackoverflow.com/q/21858301
type: Tag
tag name: javaw

http://stackoverflow.com/a/21966848
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21966794
type: Answer
has body: doGet() is used when you want to intercept on HTTP GET requests. whereas From the docs of DoHead: Receives an HTTP HEAD request from the protected service method and handles the request. The client sends a HEAD request when it wants to see only the headers of a response, such as Content-Type or Content-Length. The HTTP HEAD method counts the output bytes in the response to set the Content-Length header accurately. If you override this method, you can avoid computing the response body and just set the response headers directly to improve performance. Make sure that the doHead method you write is both safe and idempotent (that is, protects itself from being called multiple times for one HTTP HEAD request). If the HTTP HEAD request is incorrectly formatted, doHead returns an HTTP "Bad Request" message.

http://stackoverflow.com/q/21922547
tagged with: spring
has comment: http://stackoverflow.com/comment/33666137
downvote count: 1
has comment: http://stackoverflow.com/comment/34860050
tagged with: java
has title: RESTEasy + spring, notfound exception not being caught in mapper
has comment: http://stackoverflow.com/comment/33629819
type: Question
has body: I have a few resources on rest which works perfectly fine but when I make a REST call to an invalid URL the JBoss returns a 404 html exception. I want to change it to JSON exception response. I have tried creating mapper but the control does not reach there. I am adding my mapper code for ref. @Provider @Produces(MediaType.APPLICATION_JSON) public class NotFoundExceptionMapper implements ExceptionMapper&lt;NotFoundException&gt; { /** * Map an exception to a {@link javax.ws.rs.core.Response}. * * @param exception the exception to map to a response. * @return a response mapped from the supplied exception. */ @Override public Response toResponse(final NotFoundException exception) { Map&lt;String, Object&gt; info = new HashMap&lt;&gt;(); info.put("msg", exception.getMessage()); info.put("date", new Date()); info.put("details", "The requested resource hasn't been found"); return Response .status(Response.Status.INTERNAL_SERVER_ERROR) .entity(info) .type(MediaType.APPLICATION_JSON) .build(); }
upvote count: 0
has comment: http://stackoverflow.com/comment/33534405
answer count: 1
has answer: http://stackoverflow.com/a/22181234
favorite count: 0
tagged with: resteasy
tagged with: rest
tagged with: exception
has comment: http://stackoverflow.com/comment/34888347
score: -1
has comment: http://stackoverflow.com/comment/33358695
type: UnansweredQuestion

http://stackoverflow.com/comment/33424595
has text: Sorry it was copy mistake.. It was pink.. May be I missed it, what is the purpose of `isNotYetGenerated()` method in general? Just updated question with the rules..
comment on: http://stackoverflow.com/q/21971988
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21965658
type: Answer
score: 2
downvote count: 0
has body: This can be done using JsonPrimitive as follows: JsonObject request = new JsonObject(); request.addProperty("requestid", UUID.randomUUID().toString()); request.addProperty("type", "hotel"); JsonArray jpArray = new JsonArray(); jpArray.add(new JsonPrimitive(1.0)); jpArray.add(new JsonPrimitive(2.0)); jpArray.add(new JsonPrimitive(3.0)); request.add("markups", jpArray); OutPut : { "requestid": "6259f169-3a55-4a2e-b03c-5931d4daf2fd", "type": "hotel", "markups": [ 1.0, 2.0, 3.0 ] }
accepted answer of: http://stackoverflow.com/q/21965469
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21965469
upvote count: 2

http://stackoverflow.com/q/21974719
tagged with: facebook-graph-api
has title: me/friends?fields=checkins.limit(5) gives error code 613 (exceeded 600 calls in 600 seconds)
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: restfb
type: Question
has body: I am working with rest fb for the first time and am not able to fetch my friends checkins using the above fql query. The query - me/friends?fields=checkins.limit(5) gives me an exception saying { "error": { "message": "(#613) Calls to checkin_fql have exceeded the rate of 600 calls per 600 seconds.", "type": "OAuthException", "code": 613 } } Any suggestions will be helpful. Thanks !
has answer: http://stackoverflow.com/a/23693757
linked to: http://stackoverflow.com/q/14626689
answer count: 1

http://stackoverflow.com/a/21905036
has comment: http://stackoverflow.com/comment/33174196
has comment: http://stackoverflow.com/comment/33181617
has comment: http://stackoverflow.com/comment/102145435
has comment: http://stackoverflow.com/comment/33174846
has comment: http://stackoverflow.com/comment/33177478
has comment: http://stackoverflow.com/comment/33181870
type: Answer
has comment: http://stackoverflow.com/comment/33174235
has body: What do you expect by testing the private constructor? E.g. you're trying to test a singleton you should have a method returning the instance. So you could test the constructor implicit.
answers question: http://stackoverflow.com/q/21904890
has comment: http://stackoverflow.com/comment/33176374
has comment: http://stackoverflow.com/comment/33173887
score: 0
has comment: http://stackoverflow.com/comment/33176553
has comment: http://stackoverflow.com/comment/33173778

http://stackoverflow.com/q/21950670
downvote count: 0
accepted answer: http://stackoverflow.com/a/21992010
favorite count: 0
has body: I am using resteasy in my project. I am returning an Response object from my rest webfunction. @Override public Response getData(@QueryParam(value = "test") String test) { GenericEntity&lt;List&lt;UserEntity&gt;&gt; customerentities = new GenericEntity&lt;List&lt;UserEntity&gt;&gt;(result){};// result is the List&lt;UserEntity&gt; return Response.ok(customerentities).build(); } Now in my junit test case I am doing Response response = testService.getData("testD"); response.getEntity() // doing this to retrive the List&lt;UserEntity&gt; But getting the below error java.lang.RuntimeException: No type information to extract entity with, use other getEntity() methods at org.jboss.resteasy.client.core.BaseClientResponse.getEntity(BaseClientResponse.java:334) any idea ?
has title: Rersteasy exception "No type information to extract entity with, use other getEntity() methods"
tagged with: resteasy
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/21992010
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
tagged with: junit

http://stackoverflow.com/comment/33316573
type: QuestionComment
score: 3
has text: .. 3) For many components in one space, use a [`CardLayout`](http://docs.oracle.com/javase/7/docs/api/java/awt/CardLayout.html) as seen in this [short example](http://stackoverflow.com/a/5786005/418556).
comment on: http://stackoverflow.com/q/21985192
type: Comment

http://stackoverflow.com/comment/33221294
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21931700
has text: Hey JB Nizet, dont try to be oversmart... If you dont want to answer, then please dont waste your time here... better to do some good stuffs...
score: 0

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/21954760

http://stackoverflow.com/q/21982564
tagged with: applicationcontext
accepted answer: http://stackoverflow.com/a/21986107
has comment: http://stackoverflow.com/comment/33313455
tagged with: spring
has comment: http://stackoverflow.com/comment/33313368
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33314892
tagged with: java
tagged with: classpath
type: Question
has title: FileNotFound exception while reading file from classpath in constructor argument in Spring
has body: I have a file mydoc.txt at the following location C:/Tomcat6.0/webapps/myapp/WEB-INF/classes/document/mydoc.txt I have to get this file location through constructor injection and read the file. public DocumentReader(String path) throws IOException, FileNotFoundException { BufferedReader reader = new BufferedReader(new FileReader(path)); String line = null; StringBuilder stringBuilder = new StringBuilder(); while ((line = reader.readLine()) != null) { stringBuilder.append(line); } String doc = stringBuilder.toString(); } I have configured the file location in applicationContext.xml as shown below. &lt;bean id="DocumentReader" class="com.myapp.DocumentReader" &gt; &lt;constructor-arg value="classpath:document/mydoc.txt"&gt;&lt;/constructor-arg&gt; &lt;/bean&gt; But, I am getting FileNotFound Exception while running the application. Is there any other way to read the file from this location ? Exception java.io.FileNotFoundException: classpath:document\mydoc.txt(The filename, directory name, or volume label syntax is incorrect)
has comment: http://stackoverflow.com/comment/33313148
has comment: http://stackoverflow.com/comment/33313792
score: 0
has comment: http://stackoverflow.com/comment/33318067
has comment: http://stackoverflow.com/comment/33314678
answer count: 1
has answer: http://stackoverflow.com/a/21986107

http://stackoverflow.com/comment/33237093
comment on: http://stackoverflow.com/a/21940179
has text: post your entire LinkedList class in the OP
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/33275546
score: 0
type: Comment
type: QuestionComment
has text: `AABB`. The repeat has to go all the way from the start to end, otherwise, return the whole string.
comment on: http://stackoverflow.com/q/21961729

http://stackoverflow.com/q/21873234
answer count: 1
accepted answer: http://stackoverflow.com/a/21873283
score: 0
linked to: http://stackoverflow.com/q/21478193
tagged with: time
tagged with: calendar
has answer: http://stackoverflow.com/a/21873283
type: Question
type: AnsweredQuestion
tagged with: java
has title: why java program is outputting the following
has comment: http://stackoverflow.com/comment/33118509
has body: Below is the code for implementing time server Server class public static void main(String args[]) { try{ ServerSocket ss=new ServerSocket(990); Socket s=ss.accept(); while(true) { Calendar c=Calendar.getInstance(); BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream())); PrintWriter out =new PrintWriter(new OutputStreamWriter(s.getOutputStream())); out.println("Hello This is server &amp; My Time is :"); out.println("Time ::: Hour="+c.HOUR +" Min="+c.MINUTE +" sec="+c.SECOND); out.flush(); s.close(); } } catch(Exception e) { } } Client class public static void main(String args[]) { try{ ServerSocket ss=new ServerSocket(990); Socket s=ss.accept(); while(true) { Calendar c=Calendar.getInstance(); BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream())); PrintWriter out =new PrintWriter(new OutputStreamWriter(s.getOutputStream())); out.println("Hello This is server &amp; My Time is :"); out.println("Time ::: Hour="+c.HOUR +" Min="+c.MINUTE +" sec="+c.SECOND); out.flush(); s.close(); } } catch(Exception e) { } } the program is working but the output is always time:: hour=10 min=12 sec=13 why it is outputting the above values

http://stackoverflow.com/q/21914583
tagged with: spring
tagged with: java
tagged with: itext
upvote count: 1
tagged with: jfreechart
downvote count: 1
type: Question
has body: I asked before the question "Append PDF at the available space of another PDF file" and I have successfully made a PDF with both native iText and JFreeChart combined in one page. I merged this setup to my Spring MVC application using the tutorial "Spring Web MVC with PDF View Example (using iText 5.x)". I understand that using Spring's AbstractView and in turn implemented as @Override protected void buildPdfDocument(Map&lt;String, Object&gt; map, Document document, PdfWriter pdfWriter, HttpServletRequest request, HttpServletResponse response) throws Exception { // do iText and JFreeCharts } and that a JFreeChart instance needs an existing PDF file to be inserted into it as demonstrated in "Creating an iText pdf with embedded JFreeChart": // get the direct pdf content PdfContentByte dc = docWriter.getDirectContent(); // get a pdf template from the direct content PdfTemplate tp = dc.createTemplate(width, height); // create an AWT renderer from the pdf template Graphics2D g2 = tp.createGraphics(width, height, new DefaultFontMapper() ); Rectangle2D r2D = new Rectangle2D.Double(0,0, width,height); chart.draw(g2,r2D,null); g2.dispose(); // add the rendered pdf template to the direct content // you will have to play around with this because the chart is absolutely positioned. // 38 is just a typical left margin // docWriter.getVerticalPosition(true) will approximate the position that the content above the chart ended dc.addTemplate(tp, 38, docWriter.getVerticalPosition(true)-height); My problem now is that whenever I call the method that extends AbstractView (refer to the second link), it shows the PDF before inserting the JFreeChart and not the one with the generated chart. I haven't encountered any errors for this one but I would like to know if there is a solution for this behavior. I just want the user to see the PDF with JFreeChart, just like a normal PDF implementation in Spring MVC. As you can see I just followed the tutorials above and combined them. They worked pe…
score: 0
has title: JFreeChart not showing in generated Spring MVC and iText PDF
tagged with: http://stackoverflow.com/tag/pdf
has answer: http://stackoverflow.com/a/27732906
answer count: 1
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/21899463

http://stackoverflow.com/q/21963881
tagged with: double-hashing
tagged with: hashtable
has body: public class HashTable &lt;K, V&gt; implements Table&lt;K, V&gt;{ int idx; PairHolder table[]; public HashTable(int size){ table=new PairHolder[size]; } public void put(K key, V value) { int hVal = key.hashCode(); int hashVal = hashFunc1(hVal); int stepSize = hashFunc2(hVal); while(table[index]!=null&amp;&amp;table[index].getFirst() != null){ index += temp; index %=table.length; } table[index].value=value; } public int hashFunc1(int key){ int abs = Math.abs(key%table.length); return abs; } public int hashFunc2(int key){ int abs = Math.abs(5-key%5); return abs; } I am having a really hard time with double hashing. Any help to complete this code to double hash would be great.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33279288
has title: Double Hashing java
tagged with: hashmap
has answer: http://stackoverflow.com/a/21964005
has answer: http://stackoverflow.com/a/21963914
tagged with: java
type: Question
score: 0
answer count: 2
tagged with: hash

sensors
type: Tag
tag name: sensors
tags question: http://stackoverflow.com/q/21845798

http://stackoverflow.com/q/21921382
tagged with: java
has title: java lang nullpointerexception but only on samsung GT-N5110 Note 8
type: Question
answer count: 2
tagged with: adt
score: 0
linked to: http://stackoverflow.com/q/8224097
accepted answer: http://stackoverflow.com/a/21924175
has answer: http://stackoverflow.com/a/21922297
tagged with: android
has answer: http://stackoverflow.com/a/21924175
has comment: http://stackoverflow.com/comment/33203641
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33208078
possible better answer: http://stackoverflow.com/a/21922297
has body: I have an issue where I can not get my app to work on the note 8. Works perfectly on a Galaxy S4 without any error at all as well as an old HTC mobile. The error I am getting is as follows 02-21 09:21:28.352: W/dalvikvm(6130): threadid=1: thread exiting with uncaught exception (group=0x41bab930) 02-21 09:21:28.357: E/AndroidRuntime(6130): FATAL EXCEPTION: main 02-21 09:21:28.357: E/AndroidRuntime(6130): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.taskey.me2team/com.taskey.me2team.StartHere}: java.lang.NullPointerException 02-21 09:21:28.357: E/AndroidRuntime(6130): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245) 02-21 09:21:28.357: E/AndroidRuntime(6130): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2295) 02-21 09:21:28.357: E/AndroidRuntime(6130): at android.app.ActivityThread.access$700(ActivityThread.java:150) 02-21 09:21:28.357: E/AndroidRuntime(6130): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280) 02-21 09:21:28.357: E/AndroidRuntime(6130): at android.os.Handler.dispatchMessage(Handler.java:99) 02-21 09:21:28.357: E/AndroidRuntime(6130): at android.os.Looper.loop(Looper.java:137) 02-21 09:21:28.357: E/AndroidRuntime(6130): at android.app.ActivityThread.main(ActivityThread.java:5279) 02-21 09:21:28.357: E/AndroidRuntime(6130): at java.lang.reflect.Method.invokeNative(Native Method) 02-21 09:21:28.357: E/AndroidRuntime(6130): at java.lang.reflect.Method.invoke(Method.java:511) 02-21 09:21:28.357: E/AndroidRuntime(6130): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) 02-21 09:21:28.357: E/AndroidRuntime(6130): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) 02-21 09:21:28.357: E/AndroidRuntime(6130): at dalvik.system.NativeStart.main(Native Method) 02-21 09:21:28.357: E/AndroidRuntime(6130): Caused by: java.lang.NullPointerException 02-21 09:21:28.357: E/AndroidRuntime(6130): at com.taskey.me2team.StartHer…

pivot-table
tag name: pivot-table
tags question: http://stackoverflow.com/q/21912834
type: Tag

http://stackoverflow.com/comment/33267344
type: Comment
has text: Thanks for great answer, got it, but question about files actually not solved yet
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21957284

http://stackoverflow.com/q/21933924
tagged with: swing
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21934306
tagged with: awt
score: 0
has title: Robot to hold multiple key down using Java
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/33224870
tagged with: awtrobot
tagged with: keyboard
favorite count: 0
type: UnansweredQuestion
has body: I'm trying to build some robot class in JAVA. I need to robot hold 3 keys at the same time -> (CTRL + SHIFT + DELETE) I have to achieve this beacuse this accelerator opens a new windows and saves a lot of time. Here is my code below: Robot robot = new Robot(); robot.keyPress(InputEvent.CTRL_MASK); robot.delay(100); robot.keyPress(InputEvent.SHIFT_MASK); robot.delay(150); robot.keyPress(KeyEvent.VK_DELETE); robot.keyRelease(KeyEvent.VK_DELETE); robot.keyRelease(InputEvent.SHIFT_MASK); robot.keyRelease(InputEvent.CTRL_MASK);
has comment: http://stackoverflow.com/comment/33225273

http://stackoverflow.com/comment/33118131
type: Comment
comment on: http://stackoverflow.com/a/21859390
type: AnswerComment
has text: Try debugging it. Access the file normally using a simple java program and see it you hit the same roadblock. If so there can be a problem with privileges of the system as @Joop mentioned.
score: 0

http://stackoverflow.com/comment/33226335
score: 0
type: QuestionComment
has text: how you want the items to be aligned ?
comment on: http://stackoverflow.com/q/21934755
type: Comment

http://stackoverflow.com/a/21890734
score: 2
upvote count: 2
has body: Your design is fine. If you want to group your classes together use packages. For example create packages: com.mycompany.xml and com.mycompany.csv. Then put CsvReader and CsvWriter to com.mycompany.csv and XmlReader and XmlWriter to com.mycompany.xml.
answers question: http://stackoverflow.com/q/21890611
downvote count: 0
type: Answer

http://stackoverflow.com/comment/33251376
type: QuestionComment
has text: It seems that the header was already consumed by the browser. You could try `telnet localhost 8080` and then sending `GET HTTP/1.0` followed by two carriage returns, and you will have a server response printed where you can check that. After the second newline, no more headers are allowed.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21948377

http://stackoverflow.com/comment/33293779
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21970898
has text: I guess a smaller cbuf is better, b/c currently it will read in double the amount before it exists b/c of it exceeding the limit. Is it slower if you make the cbuf 1024?
score: 0

3d
tags question: http://stackoverflow.com/q/21990557
tags question: http://stackoverflow.com/q/21955443
type: Tag
tags question: http://stackoverflow.com/q/21885614
tag name: 3d
tags question: http://stackoverflow.com/q/21993572
tags question: http://stackoverflow.com/q/21908241
tags question: http://stackoverflow.com/q/21987408
tags question: http://stackoverflow.com/q/21997622

http://stackoverflow.com/q/22003328
has comment: http://stackoverflow.com/comment/33349881
tagged with: mouselistener
tagged with: swing
has comment: http://stackoverflow.com/comment/33349722
type: AnsweredQuestion
has title: get JList contained in a JScrollPane
has body: I have a big panel with 6 JScrollPane inside, each JScrollPane contain a JList. I am trying to add a MouseListener event to every single JList on the panel, how can i get access to it? to better understand, this is my code: private void agregarDobleClick() { for (Component c : jPanel1.getComponents()) { c.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { JList list = (JList) evt.getSource(); if (evt.getClickCount() == 2) { Rectangle r = list.getCellBounds(0, list.getLastVisibleIndex()); if (r != null &amp;&amp; r.contains(evt.getPoint())) { modCitaPOPUP modcita = new modCitaPOPUP((Cita) list.getSelectedValue()); modcita.setVisible(true); } } } }); } } when i run this, it add the mouseListener to the JScrollPane, and when i double-click on a JList item, nothing happen because the mouseListener event isnt there. thanks.
has answer: http://stackoverflow.com/a/22003359
accepted answer: http://stackoverflow.com/a/22003359
tagged with: java
type: Question
tagged with: jscrollpane
has comment: http://stackoverflow.com/comment/33349730
answer count: 1
has comment: http://stackoverflow.com/comment/33349653
has comment: http://stackoverflow.com/comment/33349626
score: 0
tagged with: jlist

http://stackoverflow.com/q/21893980
tagged with: java
has title: Why is the order of initialization of object streams important in java network programming?
type: Question
has answer: http://stackoverflow.com/a/21894117
answer count: 1
has comment: http://stackoverflow.com/comment/33155128
accepted answer: http://stackoverflow.com/a/21894117
tagged with: serialization
score: 0
has body: Based on the following information from my prof: The client creates ObjectOutputStream and ObjectInputStream objects to send the request, and to receive the reply. The CalculateClient constructor is: public CalculateClient( String host, int port ) throws IOException { /* determine the address of the server and connect to it */ serverHost = InetAddress.getByName( host ); serverPort = port; calculate = new Socket( serverHost, serverPort ); OutputStream out = calculate.getOutputStream(); request = new ObjectOutputStream( new BufferedOutputStream( out )); request.flush(); // ObjectInputStream blocks until // the connected side flushes its ObjectOutputStream InputStream in = calculate.getInputStream(); reply = new ObjectInputStream( in ); } In network applications, the construction order of the input and output socket streams when using object streams is important. The ObjectOutputStream must be created first. It then should be flushed. The ObjectInputStream can then be created. He doesn't elaborate as to why. Why is this true?
type: AnsweredQuestion
tagged with: network-programming

http://stackoverflow.com/a/21971289
score: 0
has comment: http://stackoverflow.com/comment/33292439
has comment: http://stackoverflow.com/comment/33292462
answers question: http://stackoverflow.com/q/21971261
type: Answer
has comment: http://stackoverflow.com/comment/128056225
has comment: http://stackoverflow.com/comment/128110033
has body: Instead of creating a local variable to get the Context of the Activity just use getBaseContext(); each time you want to get the reference to the Context. So something like this instead: AssetManager assMan = getBaseContext().getAssets();

http://stackoverflow.com/comment/33135262
comment on: http://stackoverflow.com/a/21877471
score: 0
type: AnswerComment
type: Comment
has text: Why can't you do it in JUnit? I'm suggesting running against a development database, not your production one. It might help to explain what it is you're trying to test

http://stackoverflow.com/comment/33149074
score: 0
comment on: http://stackoverflow.com/q/21890141
type: Comment
has text: @LouisWasserman Merely in defence of my solution, I would note that these particular strings will not be used elsewhere (they are unique path identifiers for locks for leadership election). However, your point stands and so as a mater of general good practice I will avoid such locking (thanks!).
type: QuestionComment

http://stackoverflow.com/comment/33227822
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21932429
has text: cannot conform to this limit, since that will break client's automatic process
score: 0

http://stackoverflow.com/comment/33306488
score: 2
has text: What do you think `("%f + %fi",this.real,this.imaginary)` is supposed to do?
comment on: http://stackoverflow.com/q/21979151
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/90521384
comment on: http://stackoverflow.com/a/47317358
has text: this slight maj works when punct between names :"John-Doe".replaceAll("([^\\s|^\\p{Punct}])[^\\s|\\p{Punct}]+", "$1").replaceAll("\\s|\\p{Punct}", "").toUpperCase(); res59: String = JD
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21864402
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/65251164
type: Question
has comment: http://stackoverflow.com/comment/33101651
tagged with: casting
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/74355369
favorite count: 0
tagged with: compiler-errors
type: UnansweredQuestion
has body: So I wanted to know on what situations Java throws ClassCastException and when it's "inconvertible types" compilation error. I guess it's something about interfaces. I mean with interfaces there is more difficult situation. For example: interface SomeInterface {} class SomeClass {} SomeClass someObject = new SomeClass(); SomeInterface someInterface = (SomeInterface)someObject; throws ClassCastException thought It's clear at compile time, that SomeClass object cannot be casted to SomeInterface.
tagged with: classcastexception
has comment: http://stackoverflow.com/comment/33101341
has answer: http://stackoverflow.com/a/21864513
has title: ClassCastException vs. "inconvertible types" compilation error
downvote count: 0

http://stackoverflow.com/q/21982367
has answer: http://stackoverflow.com/a/47155403
has answer: http://stackoverflow.com/a/44100786
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/30696806
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/21983132
upvote count: 4
has comment: http://stackoverflow.com/comment/33312388
type: AnsweredQuestion
tagged with: java
has body: This question has already been asked by the people but going through the steps from many of them I am still unable to fix the problem at my end, My app is working fine on emulator but not on the real device and gives the following 2 exceptions, the first exception is the major source of second exception and i guess there is some permission issue. I have added the &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt; to the manifest file but i got the same result. My database is very simple with one table. ALso i have added "android_metadata" table and edit my other table's id field to "_id". and I am sure my database is present in the assets folder. Any help would be appreciated. first exception 02-24 12:58:10.067: E/SQLiteAssetHelper(7107): Couldn't open Shajra for writing (will try read-only): 02-24 12:58:10.067: E/SQLiteAssetHelper(7107): com.readystatesoftware.sqliteasset.SQLiteAssetHelper$SQLiteAssetException: Missing databases/Shajra file (or .zip, .gz archive) in assets, or target folder not writable 02-24 12:58:10.067: E/SQLiteAssetHelper(7107): at android.content.res.AssetManager.openAsset(Native Method) 02-24 12:58:10.067: E/SQLiteAssetHelper(7107): at android.content.res.AssetManager.open(AssetManager.java:325) 02-24 12:58:10.067: E/SQLiteAssetHelper(7107): at android.content.res.AssetManager.open(AssetManager.java:299) 02-24 12:58:10.067: E/SQLiteAssetHelper(7107): at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.copyDatabaseFromAssets(SQLiteAssetHelper.java:436) 02-24 12:58:10.067: E/SQLiteAssetHelper(7107): at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.createOrOpenDatabase(SQLiteAssetHelper.java:400) 02-24 12:58:10.067: E/SQLiteAssetHelper(7107): at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.getWritableDatabase(SQLiteAssetHelper.java:176) 02-24 12:58:10.067: E/SQLiteAssetHelper(7107): at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.getReadableDatabase(SQLiteAssetHelper.java:254) 02-24 12:58…
tagged with: android-sqlite
type: Question
has title: SQLiteAssetHelper:Couldn't open database for writing (will try read-only)
has answer: http://stackoverflow.com/a/21982781
possible better answer: http://stackoverflow.com/a/30696806
score: 4
has comment: http://stackoverflow.com/comment/33311878
has answer: http://stackoverflow.com/a/39195137
has answer: http://stackoverflow.com/a/21982759
accepted answer: http://stackoverflow.com/a/21982759

http://stackoverflow.com/comment/33169567
type: AnswerComment
comment on: http://stackoverflow.com/a/21902311
score: 0
type: Comment
has text: I tried that, its giving me different results. So does it mean I should stick to Windows with JDK 1.7 coz its serving my purpose?? :)

http://stackoverflow.com/a/24890472
type: Answer
answers question: http://stackoverflow.com/q/21939747
has body: I've solved this in a very similar way using a DefaultExecutor to keep track of the Appium process so it can be destroyed at the end of the tests. This also allows the Appium output to be logged out during the tests using a DefaultExecuteResultHandler. To avoid using a sleep to wait for Appium to start, you could create your WebDriver instance inside a try-catch for (int i = 10; i &gt; 0; i--) { try { driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); // If we successfully attach to appium, exit the loop. i = 0; } catch (UnreachableBrowserException e) { LOGGER.info("Waiting for Appium to start"); } } You could add a sleep in the catch block if you wanted to poll less frequently.
accepted answer of: http://stackoverflow.com/q/21939747
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/113910367
comment on: http://stackoverflow.com/a/22001294
has text: Also, the 'settings' cog icon is now 3 vertical dots :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21919195
type: Answer
answers question: http://stackoverflow.com/q/21919151
has body: To make it work, you should not use a temp variable, but reference directly the list parameter. Also, you should modify the list referenced by the parameter, but not assign any value to the parameter because that shall make no effect on the variable named "list".
score: 0

http://stackoverflow.com/q/21951123
accepted answer: http://stackoverflow.com/a/21951155
possible better answer: http://stackoverflow.com/a/21951178
linked to: http://stackoverflow.com/q/407929
has answer: http://stackoverflow.com/a/21951178
tagged with: bitbucket
has comment: http://stackoverflow.com/comment/33256786
favorite count: 0
has comment: http://stackoverflow.com/comment/102187103
has body: I write code in eclipse and indent it properly there. It also looks fine in Eclipse. But when I push that code in github(I am using bitbucket) and then go to git. I see that in github(I am using bitbucket) the indentation is totally messed up. Any solution for this.
has answer: http://stackoverflow.com/a/21951155
tagged with: git
type: AnsweredQuestion
score: 3
upvote count: 3
has title: Eclipse code not indent properly in git
tagged with: java
has comment: http://stackoverflow.com/comment/33256260
has comment: http://stackoverflow.com/comment/33256937
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/44785702
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27625026
has text: I already figured it out from the source :) however I'm have a small issue with downloading the map. I think there is a bug in the SDK when converting the lat/lng numbers. I posted the issue on github [isssue #607](https://github.com/mapbox/mapbox-android-sdk/issues/607)
type: AnswerComment

http://stackoverflow.com/q/21958321
favorite count: 0
type: UnansweredQuestion
has title: Spring WebApp Maven - Source folder is not on the Java build class path
has comment: http://stackoverflow.com/comment/33270959
has comment: http://stackoverflow.com/comment/33269473
has comment: http://stackoverflow.com/comment/33281950
tagged with: java
downvote count: 1
type: Question
has body: I am following this article to understand how to create a Java web application with Spring MVC.I created the web app project CounterWebApp at a separate location first (mvn eclipse:eclipse -Dwtpversion=2.0) and then imported the whole project in Eclipse. I am having difficulty to put the BaseController.java in the correct package as stated in the article.It's either "Source folder is not on the Java build class path",OR BaseController.java is not getting created at the location (/src/main/java/com/mkyong/controller/BaseController.java) Please help me understand how to do it correctly ? Following are the contents of my .classpath file and pom.xml just after importing the project in eclipse. .classpath: <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/> <classpathentry kind="output" path="target/classes"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="var" path="M2_REPO/org/springframework/spring-core/3.2.0.RELEASE/spring-core-3.2.0.RELEASE.jar"/> <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar"/> <classpathentry kind="var" path="M2_REPO/org/springframework/spring-web/3.2.0.RELEASE/spring-web-3.2.0.RELEASE.jar"/> <classpathentry kind="var" path="M2_REPO/org/springframework/spring-context/3.2.0.RELEASE/spring-context-3.2.0.RELEASE.jar"/> <classpathentry kind="var" path="M2_REPO/org/springframework/spring-aop/3.2.0.RELEASE/spring-aop-3.2.0.RELEASE.jar"/> <classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar"/> <classpathentry kind="var" path="M2_REPO/org/springframework/spring-beans/3.2.0.RELEASE/spring-beans-3.2.0.RELEASE.jar"/> <classpathentry kind="var" path="M2_REPO/org/springframework/spring-expression/3.2.0.RELEASE/spring-expression-3.2.0.RELEASE.jar"/> <classpathentry kind="var" path="M2_REPO/org/springframework/spring-webmvc/3.2.0.RELEASE/spring-webmvc-3.2.0.RELEASE.jar"/> <classpathentry kind="…
has comment: http://stackoverflow.com/comment/33269125
score: -1
upvote count: 0
answer count: 1
tagged with: eclipse-classpath
tagged with: maven-3
has answer: http://stackoverflow.com/a/21965202

http://stackoverflow.com/a/22017053
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33712985
accepted answer of: http://stackoverflow.com/q/21970388
has comment: http://stackoverflow.com/comment/33386695
type: Answer
answers question: http://stackoverflow.com/q/21970388
has comment: http://stackoverflow.com/comment/33478829
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33458877
has comment: http://stackoverflow.com/comment/33457702
has comment: http://stackoverflow.com/comment/33661555
has body: First of all see this @AndrewThompson's wise advice: Java GUIs might have to work on a number of platforms, on different screen resolutions &amp; 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, along with layout padding &amp; borders for white space. There are some helpful topics to understand what it means here: Non resizable window border and positioning Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing? Nested Layout Example Providing white space in a Swing GUI You'll see the use of methods like setLocation(), setBounds() or setSize() is highly discouraged. However I've seen this approach before applied to allow customizing forms. But instead of specific (x,y) coordinates and fixed (width,height) you can store constraints for GridBagLayout. Let's say you have a table like this: I'd start first with a class to wrap data from the DB: public class Data { private String componentType, text; private int column, row, width, height, weightX, weightY; public Data(String componentType, int column, int row, int width, int height ,int weightX, int weightY, String text) { this.componentType = componentType; this.column = column; this.row = row; this.width = width; this.height = height; this.weightX = weightX; this.weightY = weightY; this.text = text; } // getters and setters here } As database calls are time consuming task you have to consider use a SwingWorker to do the database call (time consuming task) in a background thread and create/update your GUI in the Event Dispatch Thread. Having said this you may have something like this: public class Demo { private JPanel content; private JFrame frame; private void createAndShowGUI() { content = new JPanel(new GridBagLayout()); SwingWorker&lt;Void, Data&gt; worker = new SwingWorker&lt;Void, Data&gt;() { @Override protected Void doInBackground() { try{ Connect…
has comment: http://stackoverflow.com/comment/33383458

http://stackoverflow.com/a/21991118
has comment: http://stackoverflow.com/comment/124970431
upvote count: 20
score: 20
has body: How is it determined that TEAM is the owning side? In the case of ManytoMany relationships in bidirectional scenario the Owner of the relationship can be selected arbitrarily, but having in mind the purpose you should select the entity that makes more sense to retrieve first or the one that is more used according to your purpose. You only need to remember that Many always need to be the owning side in ManyToOne scenarios. Would it make any difference if PLAYER was made the owning side instead, in this scenario? No, it wouldn´t as the relationship is bidirectional. Would the above statement make my second question true? Meaning that there is no determining factor besides which one you decide to make the owning side, with the @JoinTable annotation? Yes, @JoinTable must to be in the owner in the relationship as some other annotations. Once you select the owner you should add the annotation in that class. Consider also the Cascade operation you need to have if apply, and if there are need to be in both side of the relationship.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21985308
answers question: http://stackoverflow.com/q/21985308
type: Answer

http://stackoverflow.com/a/21918083
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33216178
has body: You may also need to include gluegen-rt.jar in your build path. You should be able to obtain this from the same place where you found jogl-all.jar (JOGL 2). Regarding your edit, for simplicity, you can use: GLCanvas canvas = new GLCanvas(new GLCapabilities(null)); This will allow you to use the default GLProfile.
has comment: http://stackoverflow.com/comment/33226894
accepted answer of: http://stackoverflow.com/q/21916547
type: Answer
answers question: http://stackoverflow.com/q/21916547
has comment: http://stackoverflow.com/comment/33267520
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33219668
has comment: http://stackoverflow.com/comment/33228323
downvote count: 0

http://stackoverflow.com/q/21885450
tagged with: intellij-idea
tagged with: jar
upvote count: 2
has body: I am developing in Java an Leap Motion Application with IntelliJ. My developing finished and it works to compile in my IDE. After I found out, how to create an JAR with all my dependencies. (LeapMotion.jar, processing/core.jar), I don't know how to use Native Libs, like C++, in my Jar. The Leap Motion SDK is written in C++. IntelliJ is linked via -Djava.library.path to use the C++ files. For my System (Ubuntu 13.10) I need the .so files to run my program. How can I compile a Jar by including the C++ file, to run the application without IntelliJ?
downvote count: 1
favorite count: 0
duplicate of: http://stackoverflow.com/q/2937406
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/2937406
tagged with: leap-motion
type: Question
has title: Create Leap Motion Java Application (including -Djava.library.path inside jar)

http://stackoverflow.com/comment/33122951
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21874393
score: 0
has text: please see first comment on @wds' answer

http://stackoverflow.com/q/21964606
has answer: http://stackoverflow.com/a/21964619
has answer: http://stackoverflow.com/a/21964647
type: UnansweredQuestion
downvote count: 2
linked to: http://stackoverflow.com/q/1465621
type: Question
has answer: http://stackoverflow.com/a/21964621
tagged with: hashcode
score: -2
tagged with: java
duplicate of: http://stackoverflow.com/q/1465621
has title: Java String pool Storage doubts
has body: why hashcode are same of string object ??? I'm trying to understand how string pool works.I have gone through many sites and finally i'm more confused now. Let me put down my doubts here. Someone help me in understanding them. class cov { public static void main(String[] args) { String s = "abc"; //Object on string pool System.out.println(s.hashCode()); String str = new String("abc"); //This statement does two things System.out.println(str.hashCode()); } }
upvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/33283837
tagged with: jvm
favorite count: 0
answer count: 3

http://stackoverflow.com/a/21963345
has comment: http://stackoverflow.com/comment/33282068
answers question: http://stackoverflow.com/q/21963228
upvote count: 1
has comment: http://stackoverflow.com/comment/33282775
type: Answer
has body: how would I stop music playing so call the OnPause onPause() and onStop() are lifecycle methods that will be called automatically; you do not call them manually. You should override them and add your code that would stop the music.
downvote count: 0
score: 1

http://stackoverflow.com/a/21906093
has comment: http://stackoverflow.com/comment/33188913
has comment: http://stackoverflow.com/comment/33177149
has comment: http://stackoverflow.com/comment/33231300
accepted answer of: http://stackoverflow.com/q/21906002
has comment: http://stackoverflow.com/comment/33177008
answers question: http://stackoverflow.com/q/21906002
type: AcceptedAnswer
has body: The easiest way is to use a ByteBuffer to wrap your original array: final ByteBuffer buf = ByteBuffer.wrap(theOriginalArray); buf.position(whereYouWant); buf.put(theNewArray); Note: above code does not check for overflows etc. If an overflow is possible, the code will have to change for something like this and the method should return the array: final int targetLength = theNewArray.length + offset; final boolean overflow = targetLength &gt; theOriginalArray.length; final ByteBuffer buf; if (overflow) { buf = ByteBuffer.allocate(targetLength); buf.put(theOriginalArray); buf.rewind(); } else buf = ByteBuffer.wrap(theOriginalArray); buf.position(offset); buf.put(theNewArray); return buf.array(); // IMPORTANT
has comment: http://stackoverflow.com/comment/33177258
score: 8
has comment: http://stackoverflow.com/comment/33191470
type: Answer
has comment: http://stackoverflow.com/comment/33175968
has comment: http://stackoverflow.com/comment/33188516
has comment: http://stackoverflow.com/comment/33177900
downvote count: 0
has comment: http://stackoverflow.com/comment/33175910
has comment: http://stackoverflow.com/comment/33177600
upvote count: 8

http://stackoverflow.com/comment/33184340
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21909555
has text: Versions are the same, this is not it.
score: 0

http://stackoverflow.com/q/21891578
has body: What needs to happen to a string using Java to be an equivalent of vis :set nobomb Assume that BOM comes from the file I am reading.
favorite count: 0
has comment: http://stackoverflow.com/comment/33150406
score: 28
has answer: http://stackoverflow.com/a/21891671
upvote count: 29
tagged with: vi
possible better answer: http://stackoverflow.com/a/25900619
has answer: http://stackoverflow.com/a/25900619
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33150354
tagged with: java
accepted answer: http://stackoverflow.com/a/21891671
has title: Removing BOM characters using Java
type: Question
linked to: http://stackoverflow.com/q/1835430
answer count: 2
tagged with: byte-order-mark
has comment: http://stackoverflow.com/comment/33150452
has comment: http://stackoverflow.com/comment/33150488
duplicate of: http://stackoverflow.com/q/1835430

http://stackoverflow.com/a/21959710
downvote count: 0
answers question: http://stackoverflow.com/q/21958147
type: Answer
has body: new JTextField("Click &amp; Type Web Address e.g. http://www.google.com"); Maybe you want the Text Prompt, which doesn't actually store any text in the text field. It just gives the user a hint what the text field is for. This is beneficial so that you don't generate DocumentEvents etc., since you are not actually changing the Document.
score: 1
upvote count: 1

http://stackoverflow.com/comment/33322174
type: QuestionComment
has text: The root cause is a spring version issue. Post the version of each spring jar you are using.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21987675

http://stackoverflow.com/a/21900029
score: 1
has body: The problem you are facing could be solved by using Java's Fork/Join Framework. Here is an example. ForkJoinPool would not produce many threads, but rather reuse them while some are waiting. FJP was created exactly for solving devide and conquere problems.
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21896857

http://stackoverflow.com/comment/33419208
score: 0
type: AnswerComment
has text: Excellent response. Although these suggestions didn't resolve my issue it helped me to understand how Eclipse works in this regard.
type: Comment
comment on: http://stackoverflow.com/a/21960252

http://stackoverflow.com/comment/33164706
has text: I also added the complete code I used for testing - have a look if the lag also occurs with this simplified code.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21877019

http://stackoverflow.com/comment/33245581
score: 0
type: AnswerComment
has text: Well I'm using CardLayout but what is the best layout to use for each panel, grid? I tried grid but I don't like the idea of nopt being able to choose where the components go.
type: Comment
comment on: http://stackoverflow.com/a/21945205

http://stackoverflow.com/comment/33307170
type: QuestionComment
comment on: http://stackoverflow.com/q/21979228
has text: @DavidWallace I mean, by run unit test together with integrited data, we can locate the bug, because the unit test will fall. If we cannot run unit test within integrited phase, How can we say that we can locate bug by using unit testing?
type: Comment
score: 0

http://stackoverflow.com/q/21974228
has title: Add a new entry with link in a table
type: Question
has answer: http://stackoverflow.com/a/21977049
tagged with: java
score: 0
tagged with: sql
answer count: 1
has body: I bought the deitel java how to program book. I am following one of their exercises. In my program I am connected to a mysql books database. I was able to add a new author, edit author, new title. However, part d) is confusing to me. Am I suppose to alter the table and add a foreign key? Here are the exercises from the book so you can see part d) a) Add a new Author b) Edit the existing information for an author c) Add a new title for an author (Remember that the book must have entry in the AuthorISBN table.) d) Add a new entry in the authorISBN table to link authors with titles. Here is a screen shot of the database open in "toad" If they mean to write a sql statement would I add a new AuthorID with a reference to title? ALTER TABLE AuthorISBN ADD FOREIGN KEY (AuthorID) REFERENCES title (AuthorID);
type: UnansweredQuestion
tagged with: mysql

http://stackoverflow.com/comment/33305603
has text: Sure that works too. Breaking out of the loop as soon as it becomes true will save you from continuing the tests after you already know what the result will be, but it's not necessary - it's a common simple performance optimization that I just sort of instinctively do at this point.
type: Comment
comment on: http://stackoverflow.com/a/21978459
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33248418
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21946520
has text: Your `ExportResource` is not a Servlet.
score: 0

http://stackoverflow.com/comment/33428378
type: QuestionComment
has text: Thanks for the article, but I am still having exceptions connected with finding JTA UserTransaction via JDNI lookup.
score: 0
comment on: http://stackoverflow.com/q/21968661
type: Comment

http://stackoverflow.com/comment/33156512
has text: Sorry you have confused me. Whats going to be in the "" ? All i want is the user to be able to enter a string in a editText, when they select the Done button, it stores the string in a variable. They variable can then be used to show in the editText and the TextView. Thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21894561
type: Comment

http://stackoverflow.com/a/21974163
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21973917
answers question: http://stackoverflow.com/q/21973917
has body: You must define a separate seda route that is distributing your message to the esper engine such as (using the fluent style): public final void configure() throws OperationNotSupportedException{ from("xmpp://localhost:5222/?blablabla...") .filter().method(...) .process(...) .to("seda:sub"); from("seda:sub?concurrentConsumers=10) .to("esper://session_X"); } That said, seda should only be used if loosing messages is not a problem. Otherwise you should use a more robust protocol such as jms that allows to persist messages. EDIT: Beside seda, you could use threads(), where you could customize the threading behaviour by defining an ExecutorService: public final void configure() throws OperationNotSupportedException{ from("xmpp://localhost:5222/?blablabla...") .filter().method(...) .process(...) .threads() .executorService(Executors.newFixedThreadPool(2)) .to("esper://session_X"); } If you using seda or threads(), you may loose transaction safety in case of failures. For this case or if you need to balance the workload to several remote hosts, you may use jms. More information about this solution is found here.
type: Answer
has comment: http://stackoverflow.com/comment/33298732
upvote count: 2

http://stackoverflow.com/comment/33178704
comment on: http://stackoverflow.com/q/21907695
type: QuestionComment
type: Comment
has text: Has Hello.java a `package` statement ?
score: 0

http://stackoverflow.com/q/21923423
has comment: http://stackoverflow.com/comment/33207013
score: 0
has title: How can I have a switch and after getting out of a case return to the switch being able to choose a different case?
has comment: http://stackoverflow.com/comment/33207069
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33207591
has comment: http://stackoverflow.com/comment/33207183
answer count: 0
tagged with: java
has body: How can I have a switch and after getting out of a case return to the switch being able to choose a different case? I am new to java and would like to know if someone could help me out with this. It's a project I'm working on and have to insert data in a case and output in others. It's like a program to keep track of incomes and earnings of a company. this is my code so far: import java.util.Scanner; class lab { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Character letra; char subswitch; int num; String[] productos = new String[10]; int[] codprod = new int[10]; int[] cant = new int[10]; int[] precioc [] = new int[10]; int m=0; int isv; char pregunta; System.out.println("Ingrese su opcion (a/b/c/d/e): "); letra=sc.next().charAt(0); boolean loop = true; do{ switch(letra){ case 'a': System.out.println("Bienvenido a configuracion"); System.out.println("Seleccione lo que desea configurar ISV:'e'/Precio de venta:'d'/Descuentos:'f'/Salir:'g'"); subswitch=sc.next().charAt(0); switch(subswitch) { case 'e': System.out.println("Desea asignar un nuevo valor al isv? Y/N"); pregunta=sc.next().charAt(0); if(pregunta=='y'|| pregunta=='Y') { System.out.println("ingrese la cantidad que desea asignar al isv"); num=sc.nextInt(); isv=num/100; } else { isv=15/100; } break; case'd': break; case 'f': break; case 'g': System.out.println("Adios"); break; } break; case 'b': System.out.println("Bienvenido a compras"); for(int n=0;n&lt;productos.length;n++){ System.out.println("Ingrese el nombre del proveedor: "); productos[n]=sc.next(); System.out.println("Ingrese el codigo del producto: "); codprod[n]=sc.nextInt(); System.out.println("Ingrese la cantidad del producto: "); cant[n]=sc.nextInt(); System.out.println("Ingrese el precio del producto: "); precioc[n]=sc.nextInt(); } break; case 'c': break; case 'd': break; case 'e': loop=false; System.out.println("Adios"); break; } } while (loop==true); } }
tagged with: loops
has comment: http://stackoverflow.com/comment/33207004
tagged with: switch-statement
type: Question

http://stackoverflow.com/q/21963797
upvote count: 1
has comment: http://stackoverflow.com/comment/33279121
has answer: http://stackoverflow.com/a/21963800
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/33279098
accepted answer: http://stackoverflow.com/a/21963800
has answer: http://stackoverflow.com/a/21963908
favorite count: 0
answer count: 3
has title: How to make constructor initialize to all 0's?
has body: I am new to Java and trying to figure this out. My NVector class is supposed to store numbers in an array double v[n]. The constructor, takes dimension n and sets all elements to 0: NVector(int n) Below is what I have, and I am getting an error public class NVector { double[] v; NVector(int n) { this = new double[n];//Error: double cannot be converted to NVector for(int i = 0; i&lt;n; i++) { v[i] = 0; } } I tried: v = new double[n]; But that dosent work either. Can anyone help me figure this out?
tagged with: constructor
possible better answer: http://stackoverflow.com/a/21963807
downvote count: 2
has answer: http://stackoverflow.com/a/21963807

http://stackoverflow.com/q/21967544
has body: I am running a Java program with Hibernate. Hibernate generates queries, but we also have some custom DAO queries. Static code analysis/reviews for poorly designed SQL queries is quite hard and resource intensive to do, but they cause real trouble. Is there some JDBC interceptor available, that can warn about sub-par or poorly written SQL queries? I know there are sql monitors such has log4-jdbc, but to my knowledge they do not trace this kind of information at runtime. By heuristic I mean, that executing a 5s lasting query once a day is ok, but executing 100 of these 5s lasting queries every minute is not ok. Or it could warn about sql queries not containing WHERE statement, which pulls out a large number of rows every time.
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/33286157
score: 2
tagged with: performance
has answer: http://stackoverflow.com/a/25758714
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33286159
type: Question
has comment: http://stackoverflow.com/comment/33288841
downvote count: 0
has comment: http://stackoverflow.com/comment/33286795
tagged with: sql
has comment: http://stackoverflow.com/comment/33286016
answer count: 1
has title: SQL JDBC interceptor for Java that can trace suspicious SQL queries
favorite count: 0
upvote count: 2

http://stackoverflow.com/a/21940933
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21940909
has body: You skipped questionArray.get(2). The index will only go up to 4.
type: Answer

http://stackoverflow.com/q/21934250
answer count: 1
has answer: http://stackoverflow.com/a/21934351
type: AnsweredQuestion
has body: I am using Resteasy. If I declare a method and use @Path(value = "/") or @Path(value = "") on that method. Is both of them are same? I mean http://localhost:8080/test and http://localhost:8080/test/ will hit same method. If yes (which is what my finding is). Then how can I identify the requests http://localhost:8080/test and http://localhost:8080/test/ and map them to separate functions, I have separate number of get parameters in both the requests.
downvote count: 0
score: 1
favorite count: 0
tagged with: resteasy
tagged with: rest
type: Question
has title: Resteasy @Path(value = "/") vs @Path(value = "") are they same
has comment: http://stackoverflow.com/comment/33225427
accepted answer: http://stackoverflow.com/a/21934351
tagged with: java
upvote count: 1
tagged with: web-services

http://stackoverflow.com/q/21846618
type: Question
has title: using multiple class for triangle program
score: -1
tagged with: class
answer count: 1
has body: import java.util.Scanner; public class Triangle { // inputing the intgers of the triangle public void inputTriangleSides() { System.out.println("Enter your triangle side lengths"); Scanner keyboard = new Scanner(System.in); int side1; int side2; int side3; System.out.println("Enter three integers to form a triangle:"); side1 = keyboard.nextInt(); side2 = keyboard.nextInt(); side3 = keyboard.nextInt(); } // determines if the three number make a triangle public void ifTriangle (int side1, int side2, int side3) { if (side1+side2&gt; side3 &amp;&amp; side1+side3&gt;side2 &amp;&amp; side2+side3&gt;side1) { System.out.println("it a triangle"); } else { System.out.println ("Not a Triangle"); } } // sorts the numbers from lowest to highest public static void displaySortedNumbers(int side1, int side2, int side3 ){ if ((side1 &lt; side2) &amp;&amp; (side2 &lt; side3) &amp;&amp;(side1 &lt;side3)){ System.out.println("The sorted numbers are " + side1 + " " + side2 + " " + side3); } if ((side1 &lt; side2) &amp;&amp; (side2 &gt; side3)){ System.out.println("The sorted numbers are " + side1 + " " + side3 + " " + side2); } if ((side1 &gt; side2) &amp;&amp; (side2 &gt; side3)){ System.out.println("The sorted numbers are " + side3 + " " + side2 + " " + side1); } if ((side1 &lt; side2) &amp;&amp; (side2 &gt; side3)){ System.out.println("The sorted numbers are " + side3 + " " + side1 + " " + side2); } if ((side1 &gt; side2) &amp;&amp; (side2 &gt; side3) &amp;&amp; (side1&gt;side3)){ System.out.println("The sorted numbers are " + side2 + " " + side3 + " " + side1); } if ((side1 &gt; side2) &amp;&amp; (side2 &lt; side3)){ System.out.println("The sorted numbers are " + side2 + " " + side1 + " " + side3); } } //determines the type of triangle the three intgers form public void displayType(int side1, int side2,int side3) { if(( side1+side2 &gt; side3)) if(( side1==side2) &amp;&amp; (side2==side3))//tell if equalateral { System.out.println("Equalateral Triangle."); } else if (( side1==side2)…
favorite count: 0
tagged with: geometry
has comment: http://stackoverflow.com/comment/33069451
type: UnansweredQuestion
upvote count: 0
tagged with: java
tagged with: methods
has answer: http://stackoverflow.com/a/21846742
downvote count: 1

http://stackoverflow.com/comment/33274975
has text: The answer is: it depends. Delegating to another List implementation is perfectly fine, and is done by several classes in the JDK: Collections.unmodifiableList(), Collections.synchronizedList() for example are simple proxies to another List. It all depends on what your List should do.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21961379
score: 1

http://stackoverflow.com/a/21995723
has body: Create ByteArrayOutputStream - it's an output stream in which the data is written into a byte array. Then use copy() method (taken from the Commons IO) to copy input stream to the output stream: InputStream stream = mySocket.getInputStream(); ByteArrayOutputStream output = new ByteArrayOutputStream(); copy(stream, output); byte[] data = output.toByteArray(); Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length); ... Length of the data array will be the same as length of the data read from the input stream. Please find copy() method below: public static int copy(InputStream input, OutputStream output) throws IOException { int n, count = 0; byte[] buffer = new byte[4 * 1024]; while (-1 != (n = input.read(buffer))) { output.write(buffer, 0, n); count += n; } return count; }
answers question: http://stackoverflow.com/q/21992712
has comment: http://stackoverflow.com/comment/33341300
score: 0
has comment: http://stackoverflow.com/comment/33341993
upvote count: 1
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/33337627

http://stackoverflow.com/comment/33156574
type: AnswerComment
comment on: http://stackoverflow.com/a/21894339
type: Comment
has text: I apologize, my code was slightly confusing, but I fixed it up. Create the variable to place hold your text `line 1`. In the done button, assign the value `line 2`, and set it to the other text view `line 3`. You will now have the variable `inputText` with the assigned value, to use wherever else needed.
score: 0

http://stackoverflow.com/q/21957340
tagged with: reflection
downvote count: 0
has comment: http://stackoverflow.com/comment/33267266
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33267814
has comment: http://stackoverflow.com/comment/33267476
has comment: http://stackoverflow.com/comment/33314213
has comment: http://stackoverflow.com/comment/33272601
type: Question
has answer: http://stackoverflow.com/a/22052231
tagged with: dependency-injection
has title: Google Guice + strategy pattern + reflection
has body: I am familiar with Google Guice, at least with basics. I now use strategy pattern with annotations (answered here) to format messages based on target device. I have an interface called MessageFormatter. public interface MessageFormatter{ public String format(String input); } I have many implementations of this interface. Basically those implementations format short messages based on target display - big screen, cell phone etc. A message is obtained from another server. What I'd like to do is to SEND FORMATTERS FROM ONE SERVER TO ANOTHER. By sending formatters I mean sending implementations of MessageFormatter interface. I already know how to use reflection to load a class at runtime and use it. What I need to do is to plug those implementations in at runtime, making the container aware of those new classes, injecting them instead of older ones. Is this possible with Google Guice ?
upvote count: 1
linked to: http://stackoverflow.com/q/11667134
tagged with: guice
answer count: 1
has comment: http://stackoverflow.com/comment/33284808
favorite count: 0
accepted answer: http://stackoverflow.com/a/22052231
type: AnsweredQuestion

http://stackoverflow.com/q/21854052
tagged with: atmosphere
has body: I have some errors with my Prime Push / atmosphere configuration, but in general application works. PrimePUSH examples also work. I'm not sure what my errors mean and how to fix it. On deploy I have error 'URI scheme is not "file"': 12:07:08,102 INFO [org.atmosphere.cpr.AtmosphereFramework] (ServerService Thread Pool -- 213) Atmosphere is using org.atmosphere.cpr.DefaultAnnotationProcessor for processing annotation 12:07:08,103 INFO [org.atmosphere.cpr.DefaultAnnotationProcessor] (ServerService Thread Pool -- 213) AnnotationProcessor class org.atmosphere.cpr.DefaultAnnotationProcessor$BytecodeBasedAnnotationProcessor being used 12:07:08,106 ERROR [org.atmosphere.cpr.AtmosphereFramework] (ServerService Thread Pool -- 213) : java.lang.IllegalArgumentException: URI scheme is not "file" at java.io.File.<init>(File.java:366) [rt.jar:1.6.0_32] at org.atmosphere.util.annotation.AnnotationDetector.toFile(AnnotationDetector.java:420) [atmosphere-runtime-native-2.1.0.jar:2.1.0] at org.atmosphere.util.annotation.AnnotationDetector.detect(AnnotationDetector.java:297) [atmosphere-runtime-native-2.1.0.jar:2.1.0] at org.atmosphere.cpr.DefaultAnnotationProcessor.scanForAnnotation(DefaultAnnotationProcessor.java:147) [atmosphere-runtime-native-2.1.0.jar:2.1.0] at org.atmosphere.cpr.DefaultAnnotationProcessor.configure(DefaultAnnotationProcessor.java:133) [atmosphere-runtime-native-2.1.0.jar:2.1.0] at org.atmosphere.cpr.AtmosphereFramework.autoConfigureService(AtmosphereFramework.java:2260) [atmosphere-runtime-native-2.1.0.jar:2.1.0] at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:707) [atmosphere-runtime-native-2.1.0.jar:2.1.0] at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:614) [atmosphere-runtime-native-2.1.0.jar:2.1.0] at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:86) [atmosphere-runtime-native-2.1.0.jar:2.1.0] at org.primefaces.push.PushServlet.init(PushServlet.java:43) [primefaces-4.0.jar:4.0] at org.apache.…
type: Question
has answer: http://stackoverflow.com/a/21857240
tagged with: primefaces
tagged with: java
tagged with: jboss
score: 0
answer count: 1
has title: Primefaces Push: Error on deploy in JBoss 7.2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21857240

http://stackoverflow.com/comment/33184374
comment on: http://stackoverflow.com/a/21910930
type: AnswerComment
score: 0
type: Comment
has text: I added this dependency, But I still got the same error.

http://stackoverflow.com/a/21869286
has body: If you're writing a Web application with a war, start with your web.xml; if you're using traditional configuration, that's where Jetty starts loading your app. Since you're using Spring, I recommend writing an @Component that logs on startup, or adding such logging to an existing component or @Configuration.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21869225
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21869225
type: Answer

http://stackoverflow.com/q/21879304
has title: How to fix "com.hazelcast.core.OperationTimeoutException: No response for 120000 ms" exceptions in hazelcast?
upvote count: 1
has comment: http://stackoverflow.com/comment/33322898
has comment: http://stackoverflow.com/comment/33259080
answer count: 0
downvote count: 0
tagged with: hazelcast
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33127826
has comment: http://stackoverflow.com/comment/33128062
score: 1
has comment: http://stackoverflow.com/comment/33237563
favorite count: 0
type: Question
has body: I wrote a hazelcast that reads 100M datasets from a file and writes them into a MultiMap. I have 10 (locally running) members. After 70 mio nodes, I see this in my application log: ERROR 2014-02-19 03:03:56,168 [pool-1-thread-1] HazelcastMaster:190 - Could not finish calculations No response for 120000 ms. Aborting invocation! InvocationFuture{invocation=Invoc ationImpl{ serviceName='hz:impl:multiMapService', op=com.hazelcast.multimap.operations.PutOperation@d8b737, partitionId=179, replicaIndex=0, tryCount=250, tryPauseMillis=500, invoke Count=1, callTimeout=60000, target=Address[144.76.62.99]:5704}, done=false} com.hazelcast.core.OperationTimeoutException: No response for 120000 ms. Aborting invocation! InvocationFuture{invocation=InvocationImpl{ serviceName='hz:impl:multiMapService', op=c om.hazelcast.multimap.operations.PutOperation@d8b737, partitionId=179, replicaIndex=0, tryCount=250, tryPauseMillis=500, invokeCount=1, callTimeout=60000, target=Address[144.76.62.9 9]:5704}, done=false} at com.hazelcast.spi.impl.InvocationImpl$InvocationFuture.waitForResponse(InvocationImpl.java:382) at com.hazelcast.spi.impl.InvocationImpl$InvocationFuture.get(InvocationImpl.java:294) at com.hazelcast.spi.impl.InvocationImpl$InvocationFuture.get(InvocationImpl.java:286) at com.hazelcast.multimap.MultiMapProxySupport.invoke(MultiMapProxySupport.java:276) at com.hazelcast.multimap.MultiMapProxySupport.putInternal(MultiMapProxySupport.java:52) at com.hazelcast.multimap.ObjectMultiMapProxy.put(ObjectMultiMapProxy.java:81) at de.komoot.spock.executor.HazelcastMultiMapStorage.add(HazelcastMultiMapStorage.java:31) at de.komoot.spock.impl.OsmNodesRepositoryImpl.add(OsmNodesRepositoryImpl.java:22) at de.komoot.spock.executor.HazelcastMaster$1.process(HazelcastMaster.java:96) at org.openstreetmap.osmosis.pbf2.v0_6.impl.PbfDecoder.sendResultsToSink(PbfDecoder.java:106) at org.openstreetmap.osmosis.pbf2.v0_6.impl.PbfDecoder.processBlobs(PbfDecoder.java:163) at org.openstreetmap.osmosis.pb…
has comment: http://stackoverflow.com/comment/33144656
has comment: http://stackoverflow.com/comment/33164730
has comment: http://stackoverflow.com/comment/33128797
has comment: http://stackoverflow.com/comment/33164793
tagged with: java
tagged with: timeout

http://stackoverflow.com/comment/33209865
has text: Where does `studyImages` come from? `StudyImages`, with a capital s, is not the same. `studyImages` is null, which is why you are getting the NPX. We need more information (like the code where `studyImages` comes from) before we can actually help you.
score: 3
comment on: http://stackoverflow.com/q/21925178
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21902844
upvote count: 5
tagged with: java
type: Question
score: 5
has comment: http://stackoverflow.com/comment/33183385
downvote count: 0
has comment: http://stackoverflow.com/comment/33176043
has comment: http://stackoverflow.com/comment/33181908
favorite count: 0
has body: I have been searching for a while now, so I am going to ask. I created a new android project in Android Studio. It automatticaly generates a activity_main.xml &amp; fragment_main.xml . There is also a MainActivity.java generated containing a public static class for the fragment. Because I'm new and wan't to see the bigger picture I wanted to seperate the two files but ever since that moment I am getting this error : java.lang.RuntimeException: Unable to start activity ComponentInfo{...}: android.view.InflateException: Binary XML file line #9: Error inflating class fragment This is my activity_main.xml &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="genius.ds.config.app.MainActivity" tools:ignore="MergeRootFrame" &gt; &lt;fragment android:layout_width="match_parent" android:layout_height="wrap_content" android:name="genius.ds.config.app.PlaceholderFragment" android:id="@+id/fragment" android:layout_gravity="center_horizontal|top" /&gt; This is my fragment_main.xml (I believe the error is on line tools:context="..." ) &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context="genius.ds.config.app.PlaceholderFragment"&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/tvDeviceId" android:id="@+id/tvDeviceId" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentRight="t…
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/33175584
answer count: 0
type: UnansweredQuestion
has title: Placeholder Fragment / Main Activity android.view.InflateException
tagged with: android-layout
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/33170202

http://stackoverflow.com/a/21982689
score: 0
has comment: http://stackoverflow.com/comment/33313379
has comment: http://stackoverflow.com/comment/33316010
has comment: http://stackoverflow.com/comment/33317491
type: Answer
has body: Since the TaskInfoDaoImpl bean is contained in a different module than the one containing the client class, try using the portable JNDI name in the @EJB annotation as follows: @EJB(name="java:app/PersistenceEJB/TaskInfoDaoImpl") private TaskInfoDao taskInfoDao; More information here.
has comment: http://stackoverflow.com/comment/33313272
answers question: http://stackoverflow.com/q/21934427

http://stackoverflow.com/q/21999590
tagged with: java
has comment: http://stackoverflow.com/comment/33343288
has answer: http://stackoverflow.com/a/21999693
has comment: http://stackoverflow.com/comment/33343220
accepted answer: http://stackoverflow.com/a/22000138
has body: I have the Java Android SDK package downloaded and I also have a jre downloaded and put in the same folder as eclipse, but when I go to run eclipse it is not starting and is giving me an error message saying that it cannot find a jre. Wondering what is going on here. Thanks, Brett
linked to: http://stackoverflow.com/q/16394822
tagged with: android-sdk-tools
has comment: http://stackoverflow.com/comment/33343514
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33343419
has comment: http://stackoverflow.com/comment/33343362
has comment: http://stackoverflow.com/comment/33343317
tagged with: sdk
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22000138
has title: Downloading and using Android SDK
possible better answer: http://stackoverflow.com/a/21999693
score: 0

http://stackoverflow.com/comment/33096967
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21860731
type: Comment
has text: Sorry, I totally forgot to add my code :(

http://stackoverflow.com/q/21907642
accepted answer: http://stackoverflow.com/a/21908007
has body: This is my date Thu Feb 20 18:34:00 GMT+5:30 2014 When I use getTimeInMillis() I'm geting a negative value(-5856679776000). It should be something positive. Can anyone tell me why? The stored date i.e cal1 is giving a negative value while the second date i.e current date is a positive one. SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",java.util.Locale.getDefault()); try { java.util.Date d = format.parse(date+" "+time); GregorianCalendar cal1 = new GregorianCalendar(d.getYear(), d.getMonth(), d.getDay(), d.getHours(), d.getMinutes()); Calendar cal = Calendar.getInstance(); GregorianCalendar cal2 = new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE)); Toast.makeText(getApplicationContext(), "Stored date " + d + "\nCurrent date " + cal.getTime() + "\nStored date in ms :" + cal1.getTimeInMillis() + "\nCurrent time in ms :" + cal2.getTimeInMillis()+ "\nDifference " + ((cal1.getTimeInMillis()-cal2.getTimeInMillis())/1000), Toast.LENGTH_LONG).show(); } catch(Exception e) { Toast.makeText(getApplicationContext(),"Date parsing error", Toast.LENGTH_LONG).show(); e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/33178321
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21907877
type: Question
upvote count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/21908007
score: 4
possible better answer: http://stackoverflow.com/a/21907723
has answer: http://stackoverflow.com/a/21907723
has title: getTimeinMillis giving a negative value
has comment: http://stackoverflow.com/comment/33178476
answer count: 3
tagged with: android
favorite count: 0

http://stackoverflow.com/a/21842154
upvote count: 3
has body: Few years ago I have successfully used JODConverter with Open Office running in the headless mode to convert all sorts of files. To be honest I cannot remember the exact limitations of the software, but there is a version of what I did still running as a webservice here: http://oxgarage.oucs.ox.ac.uk:8080/ege-webclient/ and here: http://www.tei-c.org/oxgarage/. No idea about what is the current version of the converter they are using and it is possible that it is a bit outdated and at the moment it works a lot better, but you can try to convert your files and see how well they come up before you go head first into coding. I also found this article and it looks like it might be quite helpful for you, have a look at it: http://angelozerr.wordpress.com/2012/12/06/how-to-convert-docxodt-to-pdfhtml-with-java/. Oh and by the way, that webservice is opensource: https://github.com/sebastianrahtz/oxgarage , so you can have a look at how it is implemented as well.
accepted answer of: http://stackoverflow.com/q/21841814
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21841814
score: 3

http://stackoverflow.com/q/21906376
type: Question
tagged with: java
has body: I would like to get a few hints on how to do something like a brush of the paint windows application. There will be a image that has touchable areas (how to define touchable areas on a image?), when the user touch those touchable areas I want to draw like a brush with a different color (how to draw on android? which widget should I use? imageview?) Here are some images to help. Before Touching: After Touching: I am not looking for the entire solution, I am looking for some hints and maybe a few snippets. Thanks alot in advance ;) EDIT: Advanced question: I would also like to measure how good was the touching above the letter, if was not good enough I would like to know, maybe doing touchable areas and not touchable areas, and counting which one and making a percentage? Thanks
tagged with: image
tagged with: draw
tagged with: touch
accepted answer: http://stackoverflow.com/a/21910178
linked to: http://stackoverflow.com/q/16650419
answer count: 1
score: 0
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21910178
has title: Android Draw at Touchable Areas

http://stackoverflow.com/comment/33092897
score: 0
type: QuestionComment
type: Comment
has text: I tried your code and it worked, it returned html.. so the connection was successful. but why in my program it does not work?:(
comment on: http://stackoverflow.com/q/21858701

jython
tags question: http://stackoverflow.com/q/21930927
tag name: jython
type: Tag

http://stackoverflow.com/a/21869136
accepted answer of: http://stackoverflow.com/q/21869045
score: 1
answers question: http://stackoverflow.com/q/21869045
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: Often Libraries provide interfaces so you can extend the interface rather than changing internal code. this will keep the compatibility of code which is using the library. Providing empty implementation is up to developer , but in the interface documentation they provide what should be the actual implementation of the concrete class which implements the interface.
type: Answer

http://stackoverflow.com/a/22092810
score: 1
has body: Try this-one org.codehaus.mojo properties-maven-plugin 1.0-alpha-2 read validate read-project-properties src/main/resources/Application_${env}.properties
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21906010
type: Answer
accepted answer of: http://stackoverflow.com/q/21906010
upvote count: 1

http://stackoverflow.com/comment/33093164
type: Comment
comment on: http://stackoverflow.com/a/21854324
has text: this means that your `opp` is not initialized too.
score: 0
type: AnswerComment

http://stackoverflow.com/a/21887740
type: Answer
upvote count: 1
downvote count: 1
score: 0
has body: You missed the first parentheses, so it need to look like this: com/products/[A-Za-z0-9]+/response[.]html
answers question: http://stackoverflow.com/q/21887690

http://stackoverflow.com/q/21927685
has comment: http://stackoverflow.com/comment/33217229
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/33214111
has answer: http://stackoverflow.com/a/21932141
has comment: http://stackoverflow.com/comment/33221580
answer count: 1
has comment: http://stackoverflow.com/comment/33213988
has comment: http://stackoverflow.com/comment/33213989
linked to: http://stackoverflow.com/q/19633398
has comment: http://stackoverflow.com/comment/33214110
tagged with: interceptor
accepted answer: http://stackoverflow.com/a/21932141
has comment: http://stackoverflow.com/comment/33214602
has comment: http://stackoverflow.com/comment/33214501
tagged with: spring
type: AnsweredQuestion
has body: I have spring with hibernate project. Everytime i run my project it show the below error on console and in browser it shows HTTP Status 404 - Can anybody tell me why i am getting this error? 2014-02-21 12:21:10,678 ERROR ContextLoader:220 - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'interceptor' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut inWebLayer at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) 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.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) at org.apache.…
has title: Error creating bean with name 'interceptor' defined in ServletContext resource
has comment: http://stackoverflow.com/comment/33214015
score: 0
tagged with: java

http://stackoverflow.com/a/21894223
answers question: http://stackoverflow.com/q/21893892
type: Answer
has body: I think you were checking the wrong things. It looks like in the while look you wanted the amount of items in the first part of the d2array and the if statement you wanted the amount of items in the second part of the 2darray. This might work: int columnincrement = 0; String spacing = "\t"; int diagcol=0; int diagrow=0; while(diagcol&lt;themainarray.length) { System.out.println(spacing+themainarray[diagcol][diagrow]); spacing+= "\t"; System.out.print("\n"); if (diagrow&lt;=themainarray[columnincrement].length) { columnincrement++; diagcol++; diagrow++; } }
score: 0

http://stackoverflow.com/comment/33221975
comment on: http://stackoverflow.com/q/21932053
has text: Sorry to confuse everyone, but just to confirm...this is NOT homework :) I will edit my post with a better explanation shortly
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21978514
possible better answer: http://stackoverflow.com/a/21978624
has answer: http://stackoverflow.com/a/21978530
accepted answer: http://stackoverflow.com/a/21978530
favorite count: 0
has title: Spring autowried in Abstract class construtor
tagged with: constructor
upvote count: 2
tagged with: spring
tagged with: autowired
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21978624
type: Question
answer count: 2
has body: I have a scenario where autowired is null when called in the constructor of an abstract class like this : public abstract class AbstractClass{ @Autowired @Qualifier("proId") protected Prop prop; public AbstractClass(){ prop.getName(); The above throws NullException on deployment. But the following works when the autowired property called after instantiating public abstract class AbstractClass{ @Autowired @Qualifier("proId") protected Prop prop; public void Init(){ prop.getName(); } } public class DefaultClass extends AbstractClass(){ ... @autowired DefaultClass dc ; ... dc.Init(); How can I get the first case to work ?
downvote count: 0

http://stackoverflow.com/a/21842512
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21842492
type: Answer
has body: Welcome to the wonderful world of broken paint chain. Without further evidence, you've overridden some paintXxx method and failed to call super.paintXxx meaning that what ever was previously painted to the Graphics context still remains... Take a look at Performing Custom Painting and Painting in AWT and Swing for more details
answers question: http://stackoverflow.com/q/21842492
score: 3

http://stackoverflow.com/comment/33197090
score: 0
type: Comment
type: QuestionComment
has text: Noticed something weird. I added a contructor in which i initialized this.isActive to true. This time i passed false from the JSON. And when I read the Object, it shows the value as true. I think that isActive value is just not sent across.
comment on: http://stackoverflow.com/q/21913955

http://stackoverflow.com/q/21904761
answer count: 1
favorite count: 0
upvote count: 3
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33173473
downvote count: 0
has answer: http://stackoverflow.com/a/21907525
accepted answer: http://stackoverflow.com/a/21907525
type: Question
tagged with: url-encoding
score: 3
tagged with: java
has body: I'm trying in Java to decode URL containing % encoded characters I've tried using java.net.URI class to do the job, but it's not always working correctly. String test = "https://fr.wikipedia.org/wiki/Fondation_Alliance_fran%C3%A7aise"; URI uri = new URI(test); System.out.println(uri.getPath()); For the test String "https://fr.wikipedia.org/wiki/Fondation_Alliance_fran%C3%A7aise", the result is correct "/wiki/Fondation_Alliance_française" (%C3%A7 is correctly replaced by ç). But for some other test strings, like "http://sv.wikipedia.org/wiki/Anv%E4ndare:Lsjbot/Statistik#Drosophilidae", it gives an incorrect result "/wiki/Anv�ndare:Lsjbot/Statistik" (%E4 is replaced by � instead of ä). I did some testing with getRawPath() and URLDecoder class. System.out.println(URLDecoder.decode(uri.getRawPath(), "UTF8")); System.out.println(URLDecoder.decode(uri.getRawPath(), "ISO-8859-1")); System.out.println(URLDecoder.decode(uri.getRawPath(), "WINDOWS-1252")); Depending on the test String, I get correct results with different encodings: For %C3%A7, I get a correct result with "UTF-8" encoding as expected, and incorrect results with "ISO-8859-1" or "WINDOWS-1252" encoding For %E4, it's the opposite. For both test URL, I get the correct page if I put them in Chrome address bar. How can I correctly decode the URL in all situations ? Thanks for any help ==== Answer ==== Thanks to the suggestions in McDowell answer below, it now seems to work. Here's what I now have as code: private static void appendBytes(ByteArrayOutputStream buf, String data) throws UnsupportedEncodingException { byte[] b = data.getBytes("UTF8"); buf.write(b, 0, b.length); } private static byte[] parseEncodedString(String segment) throws UnsupportedEncodingException { ByteArrayOutputStream buf = new ByteArrayOutputStream(segment.length()); int last = 0; int index = 0; while (index &lt; segment.length()) { if (segment.charAt(index) == '%') { appendBytes(buf, segment.substring(last, index)); if ((index &lt; segment.l…
has comment: http://stackoverflow.com/comment/33173391
has title: URL decoding in Java for non-ASCII characters
tagged with: encoding

http://stackoverflow.com/a/21973085
downvote count: 0
score: 1
has body: Solution: The base-package value in mvc-dispatcher-servlet.xml was incorrect. I had to correct it and then - build,deploy and run. :) mvc-dispatcher-servlet.xml(final) <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.sandeep.controller" /> /WEB-INF/pages/ .jsp </beans> Here is the entire documentation :)
has comment: http://stackoverflow.com/comment/40926292
has comment: http://stackoverflow.com/comment/40948249
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21966070
answers question: http://stackoverflow.com/q/21966070
type: AcceptedAnswer

http://stackoverflow.com/comment/33107219
type: Comment
comment on: http://stackoverflow.com/a/21867235
score: 0
type: AnswerComment
has text: This does not answer my question because as user2357112 said, I do not know the start and end of the substring for each letter I want to delete. I want to delete all occurrences of the character in the string.

http://stackoverflow.com/comment/33209700
type: QuestionComment
has text: Farming work out to threads will not always speed it up, unless the work involves wait states. You can try it, but naive attempts often run slower rather than faster.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/21924826

http://stackoverflow.com/comment/33092885
comment on: http://stackoverflow.com/q/21859893
score: 2
type: Comment
type: QuestionComment
has text: 32 bit libraries run flawlessly on 64 Bit jvm, so I think another installation is not necessary.

http://stackoverflow.com/comment/33294147
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21972212
has text: You have to introduce any flag to take the decision.
score: 0

http://stackoverflow.com/q/21912314
favorite count: 0
has answer: http://stackoverflow.com/a/21913148
upvote count: 97
score: 96
has answer: http://stackoverflow.com/a/21912490
has title: What kind of List<E> does Collectors.toList() return?
has answer: http://stackoverflow.com/a/21912605
accepted answer: http://stackoverflow.com/a/21912605
tagged with: lambda
type: AnsweredQuestion
tagged with: list
linked to: http://stackoverflow.com/q/21751830
has comment: http://stackoverflow.com/comment/107749641
tagged with: java-8
type: Question
possible better answer: http://stackoverflow.com/a/21913148
has body: I am reading State of the Lambda: Libraries Edition, and am being surprised by one statement: Under the section Streams, there is the following: List&lt;Shape&gt; blue = shapes.stream() .filter(s -&gt; s.getColor() == BLUE) .collect(Collectors.toList()); The document does not state what shapes actually is, and I do not know if it even matters. What confuses me is the following: What kind of concrete List does this block of code return? It assigns the variable to a List&lt;Shape&gt;, which is completely fine. stream() nor filter() decide what kind of list to use. Collectors.toList() neither specifies the concrete type of List. So, what concrete type (subclass) of List is being used here? Are there any guarantees?
tagged with: collectors
tagged with: java
answer count: 3
downvote count: 1

http://stackoverflow.com/a/22004264
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33352424
has comment: http://stackoverflow.com/comment/33352431
upvote count: 2
has comment: http://stackoverflow.com/comment/33351388
accepted answer of: http://stackoverflow.com/q/22004233
type: Answer
has comment: http://stackoverflow.com/comment/33351406
answers question: http://stackoverflow.com/q/22004233
score: 2
has body: You're getting the name property of the JFileChooser instead of the file that was selected... Instead of... fileLocn=FilePicker.getCurrentDirectory().toString()+"\\"+FilePicker.getName() You'll find... fileLocn=file.getPath(); Will do what you want - in a platform neutral way...remember, only Windows uses \ as the separator, doing this on Mac or Unix based systems will cause not end of issues. If you really must supply the separator, you can use / on Windows, but it's normally better to use File.separator Updated based on comments Basically, you need to extract the name from the extension, you can do something like.. String fileWithoutExt = fileLocn.substring(0, fileLocn.indexOf(".")); While will strip off everything after the last . including the last . So, if you have a String with the value of FQSEMI.mp4, it will return FQSEMI
has comment: http://stackoverflow.com/comment/33352771
has comment: http://stackoverflow.com/comment/33351473
has comment: http://stackoverflow.com/comment/33352498
has comment: http://stackoverflow.com/comment/33352596
has comment: http://stackoverflow.com/comment/33352369

http://stackoverflow.com/comment/33159698
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21896574
has text: This did the trick but is there any better way without looping, like regular expression sort?
score: 0

http://stackoverflow.com/comment/33085364
comment on: http://stackoverflow.com/q/21855291
score: 0
has text: The output "Could not restore the backup"
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33167838
type: QuestionComment
has text: Unfortunately, for now we're stuck using Weld 1.9. I'll have to look into the possibility of upgrading...
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21885178

http://stackoverflow.com/a/22003377
upvote count: 10
score: 10
has comment: http://stackoverflow.com/comment/70309867
downvote count: 0
answers question: http://stackoverflow.com/q/22003104
type: Answer
has body: How does this strike you? Fun with tail recursion. public class Demo { public static void main(String[] args) { String words = "hello world, i am a java program, how are you today?"; char from = 'a'; char to = '/'; System.out.println(replace(words, from, to)); } public static String replace(String s, char from, char to){ if (s.length() &lt; 1) { return s; } else { char first = from == s.charAt(0) ? to : s.charAt(0); return first + replace(s.substring(1), from, to); } } } Output: C:\&gt;java Demo hello world, i /m / j/v/ progr/m, how /re you tod/y?

http://stackoverflow.com/a/22000024
answers question: http://stackoverflow.com/q/21999963
has body: Use a static String resumeTableName; declared in your class and in your onItemSelected write @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) { // On selecting a spinner item resumeTableName = parent.getItemAtPosition(position).toString(); // Showing selected spinner item Toast.makeText(parent.getContext(), resumeTableName, Toast.LENGTH_LONG).show(); } In this way the value of resumeTableName updated by the method will be the same for the whole class.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33343929
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21999963

http://stackoverflow.com/comment/33153552
type: QuestionComment
comment on: http://stackoverflow.com/q/21893128
score: 2
has text: @RyanS that is a decision tree, isn't it?
type: Comment

http://stackoverflow.com/a/21939337
accepted answer of: http://stackoverflow.com/q/21907317
has comment: http://stackoverflow.com/comment/39016550
has comment: http://stackoverflow.com/comment/42157451
has body: CircleOptions circleOptions = new CircleOptions() .center(latlng) .radius(500) .strokeWidth(2) .strokeColor(Color.BLUE) .fillColor(Color.parseColor("#500084d3")); // Supported formats are: #RRGGBB #AARRGGBB // #AA is the alpha, or amount of transparency mMap.addCircle(circleOptions);
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21907317
downvote count: 0
upvote count: 10
type: Answer
score: 10

http://stackoverflow.com/comment/33119649
has text: Can you please add a screenshot with your top-level project structure?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21874581
type: Comment

http://stackoverflow.com/comment/33336646
type: QuestionComment
has text: @Charles Will do. Usually I use `java-util-scanner` anyways.
comment on: http://stackoverflow.com/q/21924548
score: 0
type: Comment

http://stackoverflow.com/q/21863927
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22148214
tagged with: string
has comment: http://stackoverflow.com/comment/33100534
has comment: http://stackoverflow.com/comment/33100527
type: AnsweredQuestion
tagged with: reflection
tagged with: compareto
tagged with: java
has title: Java, reflectionCompare, and String
has answer: http://stackoverflow.com/a/22148214
type: Question
has body: I have written a Java class to practice reflection. This is a shorten version that gets right to the problem: import org.apache.commons.lang3.builder.CompareToBuilder; public class StringExample { public StringExample(){ String[] persons = {"John","Paul","George","Ringo"}; System.out.println("Person 1\tPerson2\t->\tString.compareTo\tReflection\t\tDifferent?\n"); for (int i=0;i<persons.length;i++) for (int j=0;j<persons.length;j++) { // Here the problem arises int sct = signum(persons[i].compareTo(persons[j])), rct = signum(CompareToBuilder.reflectionCompare(persons[i], persons[j])); System.out.println(persons[i]+"\t:\t"+persons[j]+"\t->\t"+sct+"\t\t|\t"+rct+"\t\t->\t"+(sct==rct?"ok":"fault")); } } private int signum(int x) { if (x<0) return -1; if (x>0) return 1; return 0; } public static void main(String[] a){ new StringExample(); } } Output: Person 1 Person2 -> String.compareTo Reflection Different? John : John -> 0 | 0 -> ok John : Paul -> -1 | -1 -> ok John : George -> 1 | -1 -> fault John : Ringo -> -1 | -1 -> ok Paul : John -> 1 | 1 -> ok Paul : Paul -> 0 | 0 -> ok Paul : George -> 1 | -1 -> fault Paul : Ringo -> -1 | -1 -> ok George : John -> -1 | 1 -> fault George : Paul -> -1 | 1 -> fault George : George -> 0 | 0 -> ok George : Ringo -> -1 | 1 -> fault Ringo : John -> 1 | 1 -> ok Ringo : Paul -> 1 | 1 -> ok Ringo : George -> 1 | -1 -> fault Ringo : Ringo -> 0 | 0 -> ok "fault" indicates where CompareToBuilder.reflectionCompare returns a signum different from String's own compareTo method. I found this only with String (neither Integer, nor int, nor Double, nor double, nor own classes implementing Comparable). Please help me: Why is this happening?

http://stackoverflow.com/a/21854060
has body: The ToString() method is a method which each and every object has. Therefore when you dont know what your object is, you can always call ToString() on it. Also, a lot of methods use the ToString() method, such as Console.WriteLine(C#) and System.out.println(Java)
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21853922

http://stackoverflow.com/comment/96748752
type: AnswerComment
type: Comment
has text: I think you mean ResolvableType.forClassWithGenerics(ResponseWrapper.class, clazz).getType() , right? Your post is working in my project, and I think it's the shortest and most simple one. Thanks Justin!
score: 9
comment on: http://stackoverflow.com/a/54804877

http://stackoverflow.com/comment/33290847
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21970441
has text: Oh right sorry can I ask which return type I need? Sorry I'm quite new.

http://stackoverflow.com/a/21870595
has body: All the default folders have a DistinguishedFolderId in EWS or WellKnownFolderName in the EWS Managed API - not sure how it's surfaced in Java though. So you could let users delete folders so long as the folder was not a distinguished/well known folder.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21845826
answers question: http://stackoverflow.com/q/21845826
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/33344454
score: 2
type: AnswerComment
type: Comment
has text: One of the reasons for including the contents in your answer is that it will always remain here even if the original page goes offline.
comment on: http://stackoverflow.com/a/22000388

http://stackoverflow.com/q/21965869
has comment: http://stackoverflow.com/comment/33283397
tagged with: git
type: Question
has body: I share my Java project on GitHub (because I believe in open-source code and no hidden tricks). Anyways, I have a unique UserAgent I got from a website for API usages... I want to know how I can hide that from GitHub without making my project private... What can I do? I tried searching Google, but no one seems to have the same problem. I can't use a separate file and then add it to .gitignore because it won't work when I deploy the project. Please help!
linked to: http://stackoverflow.com/q/11956462
score: 4
has answer: http://stackoverflow.com/a/21966343
has comment: http://stackoverflow.com/comment/33283839
has comment: http://stackoverflow.com/comment/33283486
answer count: 3
downvote count: 0
tagged with: github
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33283662
upvote count: 4
has answer: http://stackoverflow.com/a/21968184
has answer: http://stackoverflow.com/a/21966363
tagged with: java
has title: How to hide personal info from a publicly shared GitHub?

http://stackoverflow.com/q/21974838
accepted answer: http://stackoverflow.com/a/21979477
has comment: http://stackoverflow.com/comment/33298816
type: Question
tagged with: ejb
tagged with: session
has title: Calling EJB Session outside of doGet or doPost
score: 0
answer count: 2
has body: I am having a bit of problem figuring out whether I can actually call methods of the session bean in a method that doesn't take the HttpServletRequest and HttpServletResponse parameters ? Having realized that the code works in doGet and doPost methods I have modified a custom made method to take the parameters of request and response, and suddenly it has started working. My goal is to have the method working (calling session bean methods) without having a request and response in the method parameters. However here is the code of the problematic version which grants NullPointerException on itemRegistrationSession.openConnection(); package web; import java.io.IOException; import java.util.ArrayList; import javax.ejb.EJB; 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 auction.itemRegistrationRemote; import auction.userRegistrationRemote; /** * Servlet implementation class processItem */ @WebServlet("/processItem") public class processItem extends HttpServlet { private static final long serialVersionUID = 1L; @EJB itemRegistrationRemote itemRegistrationSession; @EJB userRegistrationRemote processRegistrationSession; /** * @see HttpServlet#HttpServlet() */ public processItem() { super(); getCategories(); } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //ArrayList&lt;String&gt; categories = getCategories(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } protected ArrayList&lt;String&gt; getCategories() { System.out.println("Hello from getCategories()"); itemReg…
has answer: http://stackoverflow.com/a/21979477
has comment: http://stackoverflow.com/comment/33298972
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21977828
has answer: http://stackoverflow.com/a/21977828
tagged with: java

http://stackoverflow.com/comment/33142117
type: QuestionComment
comment on: http://stackoverflow.com/q/21886132
score: 0
has text: Java code is not compiled as 32bit/64bit so why is this a problem?
type: Comment

http://stackoverflow.com/a/21896838
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/21896824
score: 4
has body: Start by taking a look at Creating a GUI With JFC/Swing, this will give you a basic grounding in how to use Swing. Take a closer look at How to Use Text Areas for specific details about how to use JTextArea
type: Answer

http://stackoverflow.com/q/21924548
accepted answer: http://stackoverflow.com/a/21924586
tagged with: loops
has body: I am trying to limit the input number to be greater than 0 and an integer. Code Here: import java.util.Scanner; public class PROB4_CHAL1 // Sum of Numbers { public static void main(String[] args) { int sum = 0; int count = 1; int number = 1; Scanner input = new Scanner(System.in); System.out.println("Enter an integer " + "greater than 0."); number = input.nextInt(); while (number &gt;= count) { sum += count; count ++; } System.out.println("Sum equals " + sum); } } New to Java so anything will help!
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33208749
downvote count: 0
has comment: http://stackoverflow.com/comment/33336646
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/33239856
has comment: http://stackoverflow.com/comment/33307007
has answer: http://stackoverflow.com/a/21924586
has title: Adding constraints to integers
tagged with: java.util.scanner
upvote count: 1
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33208741

http://stackoverflow.com/a/21892778
upvote count: 1
has body: You obviously do not need the second @DiscriminatorColumn on the subclass. TVElement is not abstract, so something like this in hql should be fine from TVElement tvElement where ... it should fetch the sub-type as well. Your classes should something similar to this: @Entity @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="type") @Polymorphism(type = PolymorphismType.IMPLICIT) @MappedSuperClass public abstract class Element{ ... } @Entity @DiscriminatorValue("tv") public class TVElement extends Element{ ... } @Entity @DiscriminatorValue("episode") public class TVEpisode extends TVElement{ ... }
has comment: http://stackoverflow.com/comment/33154788
accepted answer of: http://stackoverflow.com/q/21892690
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33153280
answers question: http://stackoverflow.com/q/21892690
type: Answer
has comment: http://stackoverflow.com/comment/33154647
has comment: http://stackoverflow.com/comment/33153465
score: 1

http://stackoverflow.com/comment/33277742
has text: so can you just move the size attribute into Catchable?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21962965

http://stackoverflow.com/q/21940805
score: 0
has title: What is the simplest way to provide injection for use with @Inject annotation?
has comment: http://stackoverflow.com/comment/33247155
has body: Recently I found that there are @Inject annotation somewhere. It can injects classes. How can I use it from provider-side? Suppose I want to be able to write class MyClass1 { @Inject MyType2 variable; } How to make it work? What is absolutely required? What if MyType2 is an interface of abstract class?
type: UnansweredQuestion
type: Question
tagged with: inject
tagged with: dependency-injection
tagged with: java
has comment: http://stackoverflow.com/comment/33272672
has comment: http://stackoverflow.com/comment/33237575
answer count: 1
has comment: http://stackoverflow.com/comment/33240153
has answer: http://stackoverflow.com/a/21941289

deserialization
type: Tag
tags question: http://stackoverflow.com/q/21851958
tag name: deserialization
tags question: http://stackoverflow.com/q/21935830
tags question: http://stackoverflow.com/q/21870505

http://stackoverflow.com/comment/33290912
comment on: http://stackoverflow.com/a/21970136
type: AnswerComment
has text: @Katona, I haven't used JNA, nor even heard of it before now. It looks like it does some mapping of Java types to native types, which would help with calling native functions that weren't specifically written to be called from Java. That comes at the cost of efficiency, though: for example, passing a string to a native function probably involves copying it to the native heap and converting it in the process to a C-style string, rather than the native code calling JNI functions to directly access the character data on the Java heap.
score: 0
type: Comment

http://stackoverflow.com/comment/33329019
has text: if this is done in a single session/cmd prompt, it will ONLY impact that session. obviously (or perhaps it isn't obvious) your path would also contain whatever else you need. But the java path has to be on the PATH in order for it to work correctly. I found that setting JAVA_HOME to both bin and path to get java and javac commands to work is necessary, and you can toggle versions of java if you have older code (compiled under different versions) more easily by setting JAVA_HOME then.
type: Comment
comment on: http://stackoverflow.com/a/21991713
score: 0
type: AnswerComment

http://stackoverflow.com/q/21960074
type: Question
has answer: http://stackoverflow.com/a/21960727
has body: I'm trying to tokenize lines of numeric expressions into a linked list for a CS Project. I have to use my own Linked List that I created in a previous lab. I tokenize each number and operator of a line, and insert each token into a node in my linked list as they are tokenized. When I code the program to print out each token as it's tokenized, each token is printed. But when I tell it to print out the linked list that contains each token as a node, some operators are missing. I don't know what is the cause for this behavior. Below is the method that creates the Linked List containing each token: public static LinkedListTest ReadInFile(String path){ File file = new File(path); LinkedListTest list = new LinkedListTest(); try { Scanner scanner = new Scanner(file); int count = 0; while (scanner.hasNextLine()) { String line = scanner.nextLine(); StringTokenizer st = new StringTokenizer(line); while (st.hasMoreTokens()){ list.insert(st.nextToken()); } } scanner.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } return list; } Below are the methods for inserting into a linked list and printing one: public class LinkedListTest implements LinkedList { private Node head; public LinkedListTest(){ head = new Node(); } public void insert(Object x){ if (lookup(x) == false){ if (head.data == null) head.data = x; else{ /* Node NewNode = new Node(); NewNode.data = x; NewNode.next = head; head = NewNode; */ //InsertLast Node temp = head; while (temp.next != null){ temp = temp.next; } Node NewNode = new Node(); NewNode.data = x; NewNode.next = null; temp.next = NewNode; } } } public void printList(){ Node temp = head; while (temp.next != null){ System.out.print(temp.data + " "); temp = temp.next; } System.out.print(temp.data + " "); } }
has title: Putting text from txt file into linked list
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: linked-list
tagged with: java
tagged with: stringtokenizer

http://stackoverflow.com/comment/33116288
score: 0
type: Comment
has text: Thanks! But whats simple math? Can u please provide the code for me to better understand?
comment on: http://stackoverflow.com/a/21872791
type: AnswerComment

http://stackoverflow.com/comment/33328882
has text: You're importing the wrong `Collection` type. It should be `java.util.Collection`. Or maybe java 6 is messed up. It works on 7. Or what @Marco13 below said.
score: 3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21992030

http://stackoverflow.com/q/21853269
type: Question
has answer: http://stackoverflow.com/a/21853301
linked to: http://stackoverflow.com/q/999172
score: -2
has answer: http://stackoverflow.com/a/21853365
downvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/21853315
duplicate of: http://stackoverflow.com/q/999172
favorite count: 0
upvote count: 0
type: UnansweredQuestion
tagged with: date-format
has title: How to convert date string to Date data type
has body: I have a String dateString = "Fri Feb 14 00:00:00 IST 2014"; I need output in Date datatype like 2014-02-14. Here is the code which is throwing Parse exception. Need help in this. public static void main(String args[]){ DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); String dateString = "Fri Feb 14 00:00:00 IST 2014"; Date convertedDate = null; try { convertedDate = df.parse(dateString); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println(convertedDate); }
has comment: http://stackoverflow.com/comment/33080700
tagged with: simpledateformat
tagged with: java
tagged with: date

http://stackoverflow.com/comment/33291082
has text: Take a look at http://cs.stackexchange.com/questions/1540/finding-a-worst-case-of-heap-sort. It describes how to find the worst case combination.
comment on: http://stackoverflow.com/q/21970339
score: 0
type: Comment
type: QuestionComment

search-engine
type: Tag
tag name: search-engine
tags question: http://stackoverflow.com/q/21851469

http://stackoverflow.com/q/21932624
tagged with: java
downvote count: 0
favorite count: 0
has title: Set IE Driver Log level as TRACE which opens through RemoteWebDriver
has body: I want to set log level as TRACE to IE Driver which opens through RemoteWebDriver. Using following code snippet to open IE through RemoteWebDriver: String remote_address = "http://&lt;ip address of Remote m/c&gt;:4444/wd/hub"; URL remote_url = new URL(remote_address); dc = DesiredCapabilities.internetExplorer(); wbdv = new RemoteWebDriver(remote_url, dc); Please help if anyone knows how to add log level as TRACE to IE runs through RemoteWebDriver.
tagged with: selenium-webdriver
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
type: Question
tagged with: internet-explorer

http://stackoverflow.com/comment/33198987
type: QuestionComment
has text: I would probably have a constructor in the super class that takes that kind of parameter, so the subclass must explicitely call it with a value
score: 5
comment on: http://stackoverflow.com/q/21918970
type: Comment

http://stackoverflow.com/a/21949271
upvote count: 2
has body: Until you are practised in "visualizing" data structures in your head, a good way to understand what is going on is to get a piece of paper and draw a "boxes and pointers" diagram representing the nodes in your data structure (and the relevant fields) ... the local variables in your diagram. Then "hand execute" using a pencil and eraser1. Don't worry. Linked list insertion and deletion is notoriously tricky for beginners. (That's why it is commonly set as a class exercise in introductory Java and algorithms classes.) 1 - Note careful avoidance of International English faux-pas :-)
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21949185
score: 2
has comment: http://stackoverflow.com/comment/85839235
has comment: http://stackoverflow.com/comment/33253134

http://stackoverflow.com/a/33774891
has body: Below line will do the trick. Last parameter is boolean reverse if you set it to true it will sort in reverse order i.e. descending in your case. SortField longSort = new SortedNumericSortField(FIELD_NAME_LONG, SortField.Type.LONG, true); Sample code: IndexSearcher searcher = new IndexSearcher(reader); Query q = new MultiFieldQueryParser(new String[] { FIELD_NAME_NAME}, analyzer).parse("YOUR_QUERY") ); SortField longSort = new SortedNumericSortField(FIELD_NAME_LONG, SortField.Type.LONG, true); Sort sort = new Sort(longSort); ScoreDoc[] hits = searcher.search(q, 10 , sort).scoreDocs; Also it's necessary that you add you sort enabled field as a NumericDocValuesField when you create your index. doc.add(new NumericDocValuesField(FIELD_NAME_LONG, longValue));//sort enabled field Code is as per lucene-core-5.0.0
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21965778
score: 5
upvote count: 5

http://stackoverflow.com/comment/33171560
score: 1
comment on: http://stackoverflow.com/a/21902324
type: AnswerComment
has text: Which is why one should avoid the 3-letter time zone codes and instead use [proper time zone names](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). Example: `America/Chicago` or `Asia/Taipei` instead of "CST".
type: Comment

http://stackoverflow.com/comment/33103467
has text: OP - I recommend you think more about what you're asking with the second part of your question. It's currently far too vague. When you're clear in your own mind about what you want to search for and how the search should work, then post a new question. Meanwhile, you could accept anycard's (truly inspired :-)) answer.
score: 0
comment on: http://stackoverflow.com/q/21865274
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33314910
score: 0
type: AnswerComment
has text: I have a web application to upload zip file which consists of 1000 files and generates a downloadable excel file. when i am reading the zip file which contains more than 1000 files getting "out of memory error".How to get out of it.
type: Comment
comment on: http://stackoverflow.com/a/21980410

http://stackoverflow.com/a/54804877
has comment: http://stackoverflow.com/comment/110431953
answers question: http://stackoverflow.com/q/21987295
upvote count: 38
has comment: http://stackoverflow.com/comment/133055995
downvote count: 0
has body: I am using org.springframework.core.ResolvableType for a ListResultEntity : ResolvableType resolvableType = ResolvableType.forClassWithGenerics(ListResultEntity.class, itemClass); ParameterizedTypeReference&lt;ListResultEntity&lt;T&gt;&gt; typeRef = ParameterizedTypeReference.forType(resolvableType.getType()); So in your case: public &lt;T&gt; ResponseWrapper&lt;T&gt; makeRequest(URI uri, Class&lt;T&gt; clazz) { ResponseEntity&lt;ResponseWrapper&lt;T&gt;&gt; response = template.exchange( uri, HttpMethod.POST, null, ParameterizedTypeReference.forType(ResolvableType.forClassWithGenerics(ResponseWrapper.class, clazz))); return response; } This only makes use of spring and of course requires some knowledge about the returned types (but should even work for things like Wrapper>> as long as you provide the classes as varargs )
score: 38
type: Answer
has comment: http://stackoverflow.com/comment/96748752

http://stackoverflow.com/a/21965677
answers question: http://stackoverflow.com/q/21965501
type: AcceptedAnswer
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/33289600
has comment: http://stackoverflow.com/comment/33289516
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/33282926
has body: This line of code is causing the error. This is what I understood after referring to this link int c=4; LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT); //this is causing the error tl.setStretchAllColumns(true); You need to change it to TableRow.LayoutParams params = new TableRow.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);
accepted answer of: http://stackoverflow.com/q/21965501

http://stackoverflow.com/comment/33163907
has text: I have added a working example in the original question. I hope it effectively gets the point across. Thanks again!
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21889297
score: 0

http://stackoverflow.com/comment/33098932
score: 2
comment on: http://stackoverflow.com/q/21863058
type: Comment
type: QuestionComment
has text: @user3324895: When did I say you didn't need to call close? I said you didn't need to call *flush* if you're calling close.

http://stackoverflow.com/comment/33332652
type: Comment
has text: You need to create a new ArrayList.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21994005

http://stackoverflow.com/comment/33074211
score: 0
type: AnswerComment
type: Comment
has text: The accuracy of the n-th contiued fraction convergent is bounded by 1/F_n^2, where F_n is the n-th Fibonacci number. After 1000s of iterations, you have long exceeded the machine precision of the original number, garbage production is to be expected.
comment on: http://stackoverflow.com/a/21843876

http://stackoverflow.com/comment/33185608
has text: At this point you should exit eclipse, and focus on getting the command line compilation of maven to work. Enable all warnings to help.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21903881
score: 0

http://stackoverflow.com/q/21900568
linked to: http://stackoverflow.com/q/7210171
has title: Easymock andReturn(a mock) returns null
accepted answer: http://stackoverflow.com/a/21900660
favorite count: 0
has body: Using EasyMock 3.2, I have a test that is essentially the same as the one I have below. When I run this test there is a null pointer exception when the SUT tries to do daoSupport.getHibernateTemplate().loadAll(); When the mocked daoSupport is supposed to return the mocked template, it returns null. @RunWith(EasyMockRunner.class) public class DAOImplTest extends EasyMockSupport { @Mock private HibernateDaoSupport daoSupport; @Mock private HibernateTemplate template; @Test public void test() { expect(daoSupport.getHibernateTemplate()).andReturn(template).once(); //1 expect(template.loadAll()).andReturn(Collections.emptyList()).once(); //2 replayAll(); SUT mySUT = new SUT(daoSupport); mySUT.exercise(); verifyAll(); } } I can get the test to work by replacing //1 in the snippet above here with daoSupport.setHibernateTemplate(template); Obviously this is not what I want to do. I want the mocked daoSupport to return the mocked template. What is wrong here?
type: Question
upvote count: 1
answer count: 1
tagged with: unit-testing
tagged with: java
tagged with: easymock
has answer: http://stackoverflow.com/a/21900660
downvote count: 0
score: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/33110079
score: 0
comment on: http://stackoverflow.com/a/21866903
type: Comment
has text: shot another subsequent question: http://stackoverflow.com/questions/21868956/how-to-obtain-the-actual-packet-size-byte-array-in-java-udp
type: AnswerComment

http://stackoverflow.com/comment/33335188
type: AnswerComment
score: 0
type: Comment
has text: No size is always 30. But only copy OPERATIVO while completely into the array.
comment on: http://stackoverflow.com/a/21995312

http://stackoverflow.com/comment/33061937
comment on: http://stackoverflow.com/q/21842105
type: Comment
score: 0
has text: You are appending a whole word each time, not chars. Also, as mdewitt says, you are printing your original text, not your built one.
type: QuestionComment

http://stackoverflow.com/q/21896538
tagged with: java
has title: Syntax error, insert "EnumBody" to complete BlockStatement
has body: public class SumLineTester { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub SumLine test = new SumLine("5 8 3 2 1"); System.out.println(test.getSum()); } } import java.util.Scanner; public class SumLine { private String line; public SumLine(String s) { line = s; } public int getSum(){ int sum = 0; Scanner chop = new Scanner(line); while(chop.hasNextInt()){ sum= sum + chop.nextInt(); } return sum; public String getLine(){ return s; } public String toString(){ return line; } } } The first portion of code above import is my tester class that contains my main method. The rest is the code that I am trying to run off of tester and I keep getting this error: Syntax error, insert "EnumBody" to complete BlockStatement at SumLine.getSum(SumLine.java:17) at SumLineTester.main(SumLineTester.java:10) How do I fix the bug?
upvote count: 4
has comment: http://stackoverflow.com/comment/33159633
answer count: 3
has answer: http://stackoverflow.com/a/64785340
score: 1
has answer: http://stackoverflow.com/a/32637569
has answer: http://stackoverflow.com/a/21896621
favorite count: 0
type: UnansweredQuestion
downvote count: 3
type: Question

http://stackoverflow.com/q/21844255
tagged with: x11
has answer: http://stackoverflow.com/a/54530538
score: 4
has comment: http://stackoverflow.com/comment/48192778
favorite count: 0
has comment: http://stackoverflow.com/comment/33065996
has comment: http://stackoverflow.com/comment/33065681
has title: How can I read the X11 clipboard from a JavaFX application?
has comment: http://stackoverflow.com/comment/78187723
has comment: http://stackoverflow.com/comment/33065622
tagged with: clipboard
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/45939280
has body: I'm working on a JavaFX application and I would like to support pasting text via middle mouse button in an X11 environment. Is there a way to access the content of the X11 clipboard in Java/JavaFX?
tagged with: java
tagged with: javafx
linked to: http://stackoverflow.com/q/30032290
type: Question
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/33244502
downvote count: 0

http://stackoverflow.com/q/21954475
has comment: http://stackoverflow.com/comment/33262140
has comment: http://stackoverflow.com/comment/33262018
linked to: http://stackoverflow.com/q/1172424
has comment: http://stackoverflow.com/comment/33261961
upvote count: 1
has body: Earlier I put my properties file within my classpath src/. Now I would like to put it within a folder called config/. This way the end users can actually modify the file by themselves. However now my code below does not work anymore ResourceBundle.getBundle("Messages", Locale.getDefault()); What I meant by the code doesn't work anymore is, after I deploy the application and I modify the Messages_en_US.properties the changes do not take place. How can I achieve what I want ? Should I use getBundle at all ? EDIT I have added config folder into the classpath as well, but I am not sure if this is relevant. This is a plain Java application where I am not using Maven or any building tools.
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33262626
has comment: http://stackoverflow.com/comment/33261994
favorite count: 0
has title: Maintain Java Resource properties file Externally
has answer: http://stackoverflow.com/a/21955223
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33262392
has comment: http://stackoverflow.com/comment/33262571
has comment: http://stackoverflow.com/comment/33262115
has comment: http://stackoverflow.com/comment/33262604
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33263251
type: Question
tagged with: resourcebundle

http://stackoverflow.com/q/21992400
tagged with: cxf
upvote count: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33346627
downvote count: 0
tagged with: osgi
has body: I'm trying to implement Apache CXF in CQ. I've generated proxy classes from WSDL using cxf-codegen-plugin. Now my CxfServiceImpl.java looks like below - import net.webservicex.ConvertTemperatureSoap; import net.webservicex.TemperatureUnit; import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Service; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; @Component(label = "CXF Service", immediate = true, metatype = true) @Service(CxfService.class) public class CxfServiceImpl implements CxfService { private ConvertTemperatureSoap convertTemperatureSoap; @Override public double convertCelsiusToFahrenheit(double valueToConvert) { return convertTemperatureSoap.convertTemp( valueToConvert, TemperatureUnit.DEGREE_CELSIUS, TemperatureUnit.DEGREE_FAHRENHEIT); } @Activate protected final void activate(final ComponentContext context) { convertTemperatureSoap = JaxWsClientFactory.create( ConvertTemperatureSoap.class, "http://www.w3schools.com/webservices/tempconvert.asmx"); } } JaxWsClientFactory.java looks like - import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; import org.apache.cxf.BusFactory; public class JaxWsClientFactory { public static <T> T create(Class<T> clazz, String portUrl) { ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(BusFactory.class.getClassLoader()); JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(clazz); factory.setAddress(portUrl); return (T) factory.create(); } finally { Thread.currentThread().setContextClassLoader(oldClassLoader); } } } I am able to create OSGI bundle and uploaded in Felix console. But when I try to activate bundle then I get error as below and bundle status is showing as Active. 24.02.2014 20:38:41.104 *ERROR* [127.0.0.1 [1393254521079] POST /system/console/bundles/300 HTTP/1.1] com.adobe.cq.c…
has title: CXF: java.lang.NoClassDefFoundError: javax/xml/ws/BindingProvider
has answer: http://stackoverflow.com/a/60659320
has answer: http://stackoverflow.com/a/21992556
favorite count: 0
has answer: http://stackoverflow.com/a/21997800
tagged with: apache-felix
answer count: 5
type: UnansweredQuestion
tagged with: aem
has answer: http://stackoverflow.com/a/28876193
score: 3
has answer: http://stackoverflow.com/a/22008107

http://stackoverflow.com/q/22001509
answer count: 4
has answer: http://stackoverflow.com/a/22001576
has answer: http://stackoverflow.com/a/22001590
tagged with: java
tagged with: collections
type: Question
has answer: http://stackoverflow.com/a/22001619
has answer: http://stackoverflow.com/a/22001612
score: 0
has title: How map enters the duplicate key internally?
type: UnansweredQuestion
has body: I am quite confused , when map encounters duplicate key - it enters the same bucket so do it check for the same key and replace with new value . And what happens when different key with same bucket is inserted. Does it checks for key and where does it store its key?

http://stackoverflow.com/comment/33179182
type: Comment
type: QuestionComment
has text: Because java ain't javascript
score: 1
comment on: http://stackoverflow.com/q/21908158

http://stackoverflow.com/a/21978681
has body: I think the point that you're missing is that in an array of length 3, the entries are numbered 0, 1 and 2. If you try to use entry number 3, you'll get that exception. But that's exactly what you're doing - all of your loops continue until i = 2 (including that case), but then you go ahead and try to use entry i + 1 of the array.
type: Answer
answers question: http://stackoverflow.com/q/21978553
score: 0

sonarqube
tags question: http://stackoverflow.com/q/21906671
type: Tag
tag name: sonarqube
tags question: http://stackoverflow.com/q/21996330
tags question: http://stackoverflow.com/q/21929107
tags question: http://stackoverflow.com/q/21934591

http://stackoverflow.com/a/21890130
has comment: http://stackoverflow.com/comment/33148241
type: Answer
has body: The out-of-bounds exception is because you're attempting to access an index of the string outside of its range (since String is essentially a character array). On another note, might I recommend: String orig = "Some string with spaces"; String[] split = orig.split(" ");
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21889999
upvote count: 1

http://stackoverflow.com/q/21945358
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 3
score: 3
has title: SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
tagged with: java
type: Question
downvote count: 0
tagged with: android
has body: Getting this error code at my Crashes&amp;ANR's tab at my developer console. Here is the full StackTrace: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method) at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209) at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193) at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463) at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185) at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177) at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804) at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789) at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694) at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:983) at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:256) at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224) at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164) at com.xxxx.xxx.Database.open(Database.java:239) at com.xxxx.xxx.Infodata.isItemFavorite(Infodata.java:1051) at com.xxxx.xxx.Infodata.onCreateOptionsMenu(Infodata.java:602) at android.support.v4.app.Fragment.performCreateOptionsMenu(Fragment.java:1582) at android.support.v4.app.FragmentManagerImpl.dispatchCreateOptionsMenu(FragmentManager.java:1956) at android.support.v4.app.FragmentActivity.onCreatePanelMenu(FragmentActivity.java:225) at android.support.v7.app.ActionBarActivity.superOnCreatePanelMenu(ActionBarActivity.java:232) at android.support.v7.app.ActionBarActivityDelegateICS.onCreatePanelMenu(ActionBarActivityDelegateICS.java:147) at android.support.v7.app.ActionBarActivity.onCreatePanelMenu(ActionBarActivity.java:199) at…

http://stackoverflow.com/q/21882693
answer count: 1
downvote count: 0
tagged with: wizard
favorite count: 0
has body: I use Play Framework 2.2.1 and I implemeted my own wizard from this sample. But I have a problem with validation because user defines more "Address"-es and in different steps in my wizard. Here is my Person class: import javax.validation.Valid; public class Person { @Valid private Address permanentAddress; // restrict the validation to the Step1 @Valid private Address invoiceAddress; // restrict the validation to the Step2 // ... } Here is my Address class: import play.data.validation.Constraints.Required; public class Address { @Required(groups = { Step1.class, Step2.class }) private String street; @Required(groups = { Step1.class, Step2.class }) private String number; // ... } The validation in Step1 fails now, because attributes "street" and "number" are null/empty in "invoiceAddress". Here is snippet from my Controller: private static Result handleStep1Submission() { Form&lt;Person&gt; filledForm = form(Person.class, Step1.class).bindFromRequest(); if (filledForm.hasErrors()) { // this now fails because "invoiceAddress.street" and // "invoiceAddress.number" are null/empty } else { // ... } How to restrict the validation to the Step1 or Step2 in this case?
has title: How to restrict the validation in Play wizard?
type: UnansweredQuestion
tagged with: playframework-2.0
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21885295
tagged with: validation

android-gridview
type: Tag
tags question: http://stackoverflow.com/q/21931146
tag name: android-gridview

http://stackoverflow.com/comment/33267940
score: 0
type: Comment
has text: In standalone.xml so many subsystems, create new, or add this code in specific place?
comment on: http://stackoverflow.com/a/21957225
type: AnswerComment

http://stackoverflow.com/comment/33134621
score: 0
type: Comment
type: QuestionComment
has text: There is nothing wrong with it. Any thread can start a new thread.
comment on: http://stackoverflow.com/q/21883236

http://stackoverflow.com/comment/134077881
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/58845587
has text: It should be the accepted answer as it's the most reliable and most straightforward solution. I confirm that it works with Gradle 8.1.
score: 0

http://stackoverflow.com/q/21906744
has comment: http://stackoverflow.com/comment/33220171
type: UnansweredQuestion
score: 3
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/21907401
downvote count: 0
has title: Issues while trying to build a hibernate Criteria query that navigates through a many-to-many association with a join table entity and composite key
upvote count: 3
has comment: http://stackoverflow.com/comment/33211268
has comment: http://stackoverflow.com/comment/33216907
answer count: 1
has comment: http://stackoverflow.com/comment/33179381
favorite count: 0
has comment: http://stackoverflow.com/comment/33221036
has body: I have three entities: Account, AccountAttribut and Attribut. Account and Attribut are associated via AccountAttribut in a many-to-many relationship like it is described here. The question is: Why can't I use: "aa_pk.attribut" as a property name to navigate through the association tree? Because this is the property name, I defined in my AccountAttribut entity, isn't it? Can you help me with this issue? These are relevant code extracts: Account: @Entity @Table(name = "account") public class Account { private Long accountId; private List&lt;AccountAttribut&gt; accountAttributes = new LinkedList&lt;AccountAttribut&gt;(); private Person person; private Zielsystem zielsystem; public Account() { } // ... } AccountAttribut: @Entity @Table(name="account_attribut") @AssociationOverrides({ @AssociationOverride(name="aa_pk.account", joinColumns = @JoinColumn(name="account_id")), @AssociationOverride(name="aa_pk.attribut", joinColumns = @JoinColumn(name="attribut_id")) }) public class AccountAttribut {} private AccountAttributPk aa_pk = new AccountAttributPk(); @Column(name="wert") private String wert; @EmbeddedId public AccountAttributPk getAa_pk() { return aa_pk; } public void setAa_pk(AccountAttributPk aa_pk) { this.aa_pk = aa_pk; } @Transient public Account getAccount() { return getAa_pk().getAccount(); } public void setAccount(Account account) { getAa_pk().setAccount(account); } @Transient public Attribut getAttribut() { return getAa_pk().getAttribut(); } public void setAttribut(Attribut attribut) { getAa_pk().setAttribut(attribut); } public String getWert() { return wert; } public void setWert(String wert) { this.wert = wert; } public boolean equals(Object o) { if (this== o) return true; if (o ==null|| getClass() != o.getClass()) return false; AccountAttribut that = (AccountAttribut) o; if (getAa_pk() !=null?!getAa_pk().equals(that.getAa_pk()) : that.getAa_pk() !=null) return false; return true; } public int hashCode() { return (getAa_pk() !=null? getAa_pk().hashCode() : …

http://stackoverflow.com/comment/33100415
has text: Ah I saw an edit where it looked like you were trying to unsucessfully, so thought I'd just mention it!
comment on: http://stackoverflow.com/a/21863601
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21964654
has body: I want to convert an integer and a double to a node how do you do that? My objective here is to convert the integer and the double variables the user has entered to a node and add them in a doubly linked list. Not sure how to go about this, I was scowering the net and nothing came up... Code (just for fun) public static void addToDBLList(int shares, double price) { Node shrNode = shares; Node prcNode = price; DoublyLinkedList list = new DoublyLinkedList(); list.addToFront(prcNode); }
favorite count: 0
has answer: http://stackoverflow.com/a/21964685
has comment: http://stackoverflow.com/comment/33280847
has comment: http://stackoverflow.com/comment/33280849
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/33280843
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/21964682
answer count: 2
upvote count: 0
has title: How to convert an integer and double to a node?

http://stackoverflow.com/a/21973746
has comment: http://stackoverflow.com/comment/33297048
has comment: http://stackoverflow.com/comment/33296656
score: 0
has body: You can use Thread.join() on the first thread so that second thread will wait till the execution of this instance is not completed.
has comment: http://stackoverflow.com/comment/33296716
type: Answer
answers question: http://stackoverflow.com/q/21973719
has comment: http://stackoverflow.com/comment/33296813

http://stackoverflow.com/comment/33133101
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21881728
has text: is this the only format you want?

http://stackoverflow.com/q/21900746
has answer: http://stackoverflow.com/a/21900934
has body: I am trying to create 2 tables in MySql using Java JDBC,the first one runs fine but I get an error when I execute the second create table command. The problem looks like in the Foreign key definition not sure what's missing ? 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 'FOREIGN KEY(UniqueBusID) REFERENCES BUS_3_CLEARBROOK_UFV_GOLINE_TO_UFV_BusDetai' at line 1 Code String table_UniqueBusNameTimings = BusDetails+"_BusTimings"; String timings= "Timings"; String dayofweek = "DayOfWeek"; String FuniqueBusID = "UniqueBusID"; String table_UniqueBusNameDetails = BusDetails+"_BusDetails"; String PuniqueBusID = "UniqueBusID"; String StopNames = "StopNames" ; String sql1 = "CREATE TABLE "+table_UniqueBusNameDetails+ "(UniqueBusID VARCHAR(255) not NULL, " + " StopNames VARCHAR(1000), " + " PRIMARY KEY ( UniqueBusID ))"; String sql2 = "CREATE TABLE "+table_UniqueBusNameTimings+ "(Timings VARCHAR(255) , " + " DayOfWeek VARCHAR(25), " + " UniqueBusID VARCHAR(255) "+ " FOREIGN KEY(UniqueBusID) REFERENCES "+table_UniqueBusNameDetails+"(UniqueBusID))"; stmt.executeUpdate(sql1); stmt.executeUpdate(sql2);
tagged with: java
has answer: http://stackoverflow.com/a/21901226
tagged with: mysql
type: Question
has title: Error executing Create table statement in Java?
has answer: http://stackoverflow.com/a/21900808
score: 0
answer count: 3
tagged with: sql
tagged with: jdbc
has comment: http://stackoverflow.com/comment/33166680
accepted answer: http://stackoverflow.com/a/21900808
possible better answer: http://stackoverflow.com/a/21900934
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33166632

http://stackoverflow.com/q/21940733
has title: Getting java.lang.NumberFormatException in the code
has answer: http://stackoverflow.com/a/21940755
has body: Code : I have TriangleSummer class which has class variable static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); My main function is public static void main(String args[]) throws IOException { int noOfTestCases = Integer.parseInt(reader.readLine()); for(int i=0;i&lt;noOfTestCases;i++){ int noOfEntries = Integer.parseInt(reader.readLine()); System.out.println(computeMaxSum(noOfEntries)); } } Relevant part of my computeMaxSum() method is public static int computeMaxSum(int noOfEntries) throws IOException { int[][] triangle = new int[noOfEntries][noOfEntries]; for(int j=0;j&lt;noOfEntries;j++){ int k=0; for(String str : reader.readLine().split(" ")){ triangle[j][k] = Integer.parseInt(str); k++; } } //further logic nothing to do with I/O } and finally stack trace is Exception in thread "main" java.lang.NumberFormatException: For input string: "4 " at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:492) at java.lang.Integer.parseInt(Integer.java:527) at Matrices.TriangleSummer.main(TriangleSummer.java:17) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) for the input 2 3 1 2 1 1 2 3 4 1 1 2 4 1 2 2 3 1 1 So I am getting NumberFormatException while reading line number 6 i.e value 4 at line int noOfEntries = Integer.parseInt(reader.readLine()); . And I am completely clueless so as to why?
has answer: http://stackoverflow.com/a/61789286
tagged with: bufferedreader
possible better answer: http://stackoverflow.com/a/21940755
tagged with: numberformatexception
answer count: 3
has comment: http://stackoverflow.com/comment/33237312
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21940757
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21940757
type: Question

http://stackoverflow.com/a/21913260
has body: I have done a similar set of code under R4. String openDocumentToken() throws SDKException, UnsupportedEncodingException { IEnterpriseSession sess = CrystalEnterprise.getSessionMgr().logon(USER, PASS, CMS, AUTH); String activeToken = sess.getLogonTokenMgr().createLogonToken(machinesLoginValidFrom, minutesValid, numberOfLogins); sess.logoff(); String tokenEncode = URLEncoder.encode(activeToken, "UTF-8"); return tokenEncode; } In my JSP: // redirect String token = openDocumentToken(); String redirectLocation = "http://" + OPEN_DOC_SERVER_PORT + "/BOE/OpenDocument/opendoc/openDocument.jsp?token="+token; Enumeration paramNames = request.getParameterNames(); while(paramNames.hasMoreElements()) { String paramName = paramNames.nextElement().toString(); String[] values = request.getParameterValues(paramName); for(String val: values) { redirectLocation += ("&amp;" + paramName + "=" + URLEncoder.encode(val, "UTF-8")); } } System.out.println("Redirect: " + redirectLocation); response.sendRedirect(redirectLocation);
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21858863

http://stackoverflow.com/comment/33237079
has text: Maybe 2 ` `s and `td valign=middle` look better.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21939772

dynamics-nav
type: Tag
tags question: http://stackoverflow.com/q/21940410
tag name: dynamics-nav

http://stackoverflow.com/q/21965526
type: AnsweredQuestion
tagged with: apache-commons-pool
type: Question
has comment: http://stackoverflow.com/comment/33282745
tagged with: apache-commons
tagged with: java
has comment: http://stackoverflow.com/comment/33282767
has body: I am trying to add objects to object pool. I am using apache commons pool for this. My code as is as follows: public ObjectPool&lt;OAuthConsumer&gt; consumerPool; public ObjectPool&lt;OAuthConsumer&gt; consumerPool; public void buildConsumerPool(){ //setting the config path PropertyHandler.setConfigPath("/twitter.properties"); //fetching required tokens for all apps String consumerKeySet = PropertyHandler.getProperty("consumerKey"); String consumerSecretSet = PropertyHandler.getProperty("consumerSecret"); String accessTokenSet = PropertyHandler.getProperty("accessToken"); String tokenSecretSet = PropertyHandler.getProperty("tokenSecret"); String[] splitconsumerKeys = consumerKeySet.split(","); String[] splitconsumerSecret = consumerSecretSet.split("."); String[] splitaccessToken = accessTokenSet.split(","); String[] splittokenSecret = tokenSecretSet.split("."); //creating consumer objects for each app for (int numberOfAccounts = 0; numberOfAccounts &lt; splitconsumerKeys.length; numberOfAccounts++) { String consumerKey = splitconsumerKeys[numberOfAccounts]; String consumerSecret = splitconsumerSecret[numberOfAccounts]; String accessToken = splitaccessToken[numberOfAccounts]; String tokenSecret = splittokenSecret[numberOfAccounts]; OAuthConsumer consumer = new CommonsHttpOAuthConsumer(consumerKey, consumerSecret); consumer.setTokenWithSecret(accessToken, tokenSecret); } Now i want to add consumer objects to the pool i created before. How do i do that?
has title: Add objects to object pool
score: 0
tagged with: apache
answer count: 1
has answer: http://stackoverflow.com/a/21965737
linked to: http://stackoverflow.com/q/8924086
accepted answer: http://stackoverflow.com/a/21965737

http://stackoverflow.com/q/21842934
has comment: http://stackoverflow.com/comment/33063415
tagged with: java
tagged with: calendar
has answer: http://stackoverflow.com/a/21843021
type: Question
tagged with: simpledateformat
tagged with: date
score: 4
upvote count: 4
answer count: 2
downvote count: 0
has title: how to add days to java simple date format
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33063473
has body: How should I add 120 days to my current date which I got using simple date format? I have seen few posts about it but couldn't get it to work, My code is below: SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); //get current date time with Date() Date date = new Date(); Do I need to use the Calendar library or can I just do it with simple date format?
has answer: http://stackoverflow.com/a/21842959

http://stackoverflow.com/q/21885268
downvote count: 3
score: -3
has answer: http://stackoverflow.com/a/21885721
has comment: http://stackoverflow.com/comment/33138529
type: Question
tagged with: java
tagged with: thread-safety
tagged with: servlets
answer count: 2
has title: How to have network capabilities for a Java application?
has body: I have a Java application that inputs images, gives a number of options to edit them (crop, resize) and then exports them to local storage. I currently trying to attach a server to this application using java.net but running to several issues as I have never done this before. I have a button on the GUI that activates the Server, so the app can receive commands - The issue is the server uses a while loop that doesn't stop until it disconnects with the client, this means the program can't run until then. I am assuming that it requires creating a new thread but how do I send commands to the app without creating a new instance? I would like to send images from the client to the application through the server. The client currently using JFileChooser to pick an image but how do I send it down the stream and recreate it at the other end? My code is just a modified version of this client and server. It just removes the echo feature and runs a method based on the string sent by the client. (e.g. Client sends "open" to server - the server runs open(){} method. Edit: Code: This is the server code. The ImageGUI is the GUI with all the commands and holds the openImage method. private int portNumber = 8888; public Server() { try ( // Create Server socket ServerSocket theServer = new ServerSocket(portNumber); // Create socket for client Socket clientSocket = theServer.accept(); // Use to write to client PrintWriter out = new PrintWriter( clientSocket.getOutputStream(), true); // Used to read from client BufferedReader in = new BufferedReader(new InputStreamReader( clientSocket.getInputStream()));) { // Waits for Client commands String clientCommand; while ((clientCommand = in.readLine()) != null) { if (clientCommand.contains("open")) { // Runs open method in ImageGUI new ImageGUI().openImage(); // I don't want this because it // will create another GUI // I want to run the openImage() // in the GUI already open } } } catch (IOException e) { e.printStackTrace(); } }
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33139034
has answer: http://stackoverflow.com/a/21885469
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/comment/33226805
type: Comment
has text: Hi Rocky. Do we want to create any River for this to do the sync?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21929654

http://stackoverflow.com/comment/33310685
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21981500
type: AnswerComment
has text: Your scenario is not really problematic. What is problematic is if a first thread acquires the lock, enters the synchronized section, reassigns the variable, and then another thread is able to enter the synchronized section, even though the first one hasn't left it yet, because the threads are now synchronized on two different objects.

http://stackoverflow.com/comment/33338366
type: Comment
has text: Hi. Where can I find these jars you mention?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21979928

http://stackoverflow.com/comment/33227140
comment on: http://stackoverflow.com/a/21930719
has text: @jmail: by switching to NIO.2 the exception is thrown, so you will get real problem description.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/87456881
comment on: http://stackoverflow.com/a/21984264
type: Comment
has text: @BenManes The question is about iterating over all current elements according to insertion order. How is that achievable through the eviction/expiration tuning exposed by the policy api? I feel like I'm missing something. Would you like me to open a separate question about that?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33167868
type: AnswerComment
comment on: http://stackoverflow.com/a/21901206
type: Comment
has text: Error: method adjustScore in class GameItems cannot be applied to given types; required: char found: java.lang.String reason: actual argument java.lang.String cannot be converted to char by method invocation conversion
score: 0

http://stackoverflow.com/comment/33291371
comment on: http://stackoverflow.com/a/21963819
has text: Alright I put up the entire activity class. Also, the layout is activity_main, which is also included above. Thank You.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33304347
comment on: http://stackoverflow.com/a/21977941
has text: Note that you cannot actually drop elements form an array in Java, as an Array is fixed length. YOu can copy all other values to another Array, or use a `List` instead (but tha'Ts a little far-fetched for a java beginner I guess).
score: 6
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/33305816
comment on: http://stackoverflow.com/a/21978554
has text: sorry, made a correction. statJCBaccountname is name of my statement.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33201975
has text: How could the OP create a file containing a serialized List<Block> if Block wasn't serializable?
type: Comment
comment on: http://stackoverflow.com/a/21920409
score: 0
type: AnswerComment

http://stackoverflow.com/q/21844062
answer count: 1
has title: How to make Hibernate convert CLOB to a MySQL type
has body: In my code, a field of an entity class has a CLOB column. This works fine with Oracle but when I try to use MySQL as the database, it looks the CLOB type causes a problem because MySQL doesn't support CLOB. the console error is 13:35:27 ERROR [main] org.hibernate.tool.hbm2ddl.SchemaUpdate 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 'CLOB, messageSubject longtext, senderEmailAddress varchar(255), ' at line 7 [main] the java code snippet is: @Column(length = 4000) private String messageSubject; @Column(columnDefinition = "CLOB") private String messageBody; and here is my entityfactory update false true 10 class false false my question is that is there any way to configure hibernate so that CLOB can be automatically converted to other data types that MySQL supports (like Text)? thanks
type: UnansweredQuestion
tagged with: clob
has answer: http://stackoverflow.com/a/21846503
tagged with: mysql
type: Question
tagged with: java
tagged with: hibernate
score: 0

http://stackoverflow.com/a/21940257
accepted answer of: http://stackoverflow.com/q/21907329
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21907329
score: 0
has body: Discovered how to resolve this. Firstly, obviously I was attempting to get the instances working on my desktop PC, but this had my Eclipse development environment on it also, and I realised there may be additional context.xml files with the Eclipse workspace. I amended these to match my Tomcat's context.xml file and this processed the issue a little further. Secondly, I had two isntances of the same servlet, i.e. Test and Live (Web service end point URL's slightly different) running within the same Tomcat and so obviosuly the same machine. I found this works okay when SSL is NOT implemented but when SSL is implemented only ONE instance of the servlet can be running. Perhaps someone knows a way around this. If so let me know. Thanks to all who viewed Regards AJF

http://stackoverflow.com/comment/33195900
comment on: http://stackoverflow.com/a/21916850
has text: I think he meant the value of the field, not just the name of the field. For that, you would have to have `Object value = fields[i].get(cart)`
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21855407
has body: I am stuck on a problem that I cannot find answer, no matter how hard I google it. I am trying to create a WS consumer on Lotus Domino Designer. The version is 8.5.3. I have already tried with three different WS and answer was always the same. Here it is : WebServiceEngineFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException faultSubcode: faultString: Error connecting to &amp;apos;www.webservicex.net&amp;apos; on port &amp;apos;80&amp;apos;, You must enable the Notes TCPIP port. faultActor: faultNode: faultDetail: Error connecting to 'www.webservicex.net' on port '80', You must enable the Notes TCPIP port. at lotus.domino.axis.InternalFault.makeFault(Unknown Source) at lotus.domino.axis.transport.http.HTTPSender.invoke(Unknown Source) at lotus.domino.axis.strategies.InvocationStrategy.visit(Unknown Source) at lotus.domino.axis.SimpleChain.doVisiting(Unknown Source) at lotus.domino.axis.SimpleChain.invoke(Unknown Source) at lotus.domino.axis.client.AxisClient.invoke(Unknown Source) at lotus.domino.axis.client.Call.invokeEngine(Unknown Source) at lotus.domino.axis.client.Call.invoke(Unknown Source) at lotus.domino.axis.client.Call.invoke(Unknown Source) at lotus.domino.axis.client.Call.invoke(Unknown Source) at lotus.domino.axis.client.Call.invoke(Unknown Source) at lotus.domino.websvc.client.Call.invoke(Unknown Source) at NET.webserviceX.www.AngleUnitSoapStub.changeAngleUnit(AngleUnitSoapStub.java:11) at JavaAgent.NotesMain(Unknown Source) at lotus.domino.AgentBase.runNotes(Unknown Source) at lotus.domino.NotesThread.run(Unknown Source) Caused by: Error connecting to 'www.webservicex.net' on port '80', You must enable the Notes TCPIP port. at lotus.domino.axis.transport.http.NotesSocket.openConnection(Native Method) at lotus.domino.axis.transport.http.NotesSocket.&lt;init&gt;(Unknown Source) at lotus.domino.axis.transport.http.HTTPSender.getSocket(Unknown Source) ... 15 more What I did was importing the wsdl from a very simple web servic…
has title: Strange error while trying to create a Web Service consumer on Lotus Domino Designer (8.5.3)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33085220
upvote count: 1
tagged with: web-services
has answer: http://stackoverflow.com/a/21856721
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33085761
type: Question
downvote count: 0
favorite count: 0
answer count: 1
tagged with: lotus-notes

http://stackoverflow.com/q/21873517
tagged with: jax-rs
tagged with: curl
has answer: http://stackoverflow.com/a/21876379
accepted answer: http://stackoverflow.com/a/21876379
has title: Receive params in jax-rs post method
type: AnsweredQuestion
tagged with: java
has body: I know ques about jaxrs params has been asked multiple times and have very good explanation of most things.But I could not find answer to a very simple question. How can i receive params in post request? My Jax-RS method @POST @Path("data") //@Consumes("application/json") @Produces("application/json") String getMobileServiceRepresentation(@PathParam("username") String username,@PathParam("password") String password) { println username+":"+password JSONObject obj=new JSONObject('{"dashboards": ["Dashbaord1","Dashboard2"]}') obj } It prints null:null My request is via curl ie curl -X POST --data "username=username&amp;password=pass" http://localhost:8080/blablaApp/api/mobileService/data Also I have already used @Context UriInfo abc to get all context params. But no luck found
tagged with: post
type: Question
answer count: 1
score: 0

http://stackoverflow.com/comment/33369972
has text: @MichałPolitowski maybe the example I gave is not exactly like my code, but my issue is related to the method signature... not the mock itself.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21939246

http://stackoverflow.com/comment/33073491
type: QuestionComment
comment on: http://stackoverflow.com/q/21848895
has text: actually i cant able to edit the generated code confused to insert this code
score: 0
type: Comment

http://stackoverflow.com/a/28764207
has comment: http://stackoverflow.com/comment/45824353
type: Answer
has comment: http://stackoverflow.com/comment/45824759
score: 2
has comment: http://stackoverflow.com/comment/45824508
upvote count: 2
has body: Your problem is in your pom.xml file. You are declaring the org.osgl:osgl-storage dependency which has dependency on org.osgl:osgl-tool - the same project that you are trying to build, but with different version. Exclude this transitive dependency and it is should work. org.osgl osgl-storage 0.3-SNAPSHOT provided org.osgl osgl-tool
has comment: http://stackoverflow.com/comment/45825194
answers question: http://stackoverflow.com/q/21850359
has comment: http://stackoverflow.com/comment/45824540
has comment: http://stackoverflow.com/comment/45825486
accepted answer of: http://stackoverflow.com/q/21850359
has comment: http://stackoverflow.com/comment/45824840
has comment: http://stackoverflow.com/comment/45824031
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/45825283
has comment: http://stackoverflow.com/comment/45825588
has comment: http://stackoverflow.com/comment/45824625
has comment: http://stackoverflow.com/comment/45825681

http://stackoverflow.com/q/22000848
has answer: http://stackoverflow.com/a/22000984
has title: Explain this while loop to me (basic java)?
score: 0
has comment: http://stackoverflow.com/comment/33345305
answer count: 7
has comment: http://stackoverflow.com/comment/33345556
has comment: http://stackoverflow.com/comment/33345373
favorite count: 0
has answer: http://stackoverflow.com/a/22000998
tagged with: while-loop
has body: What is the value of z when the following code finishes executing? int x; int y; int z; x = 1; z = 1; while (x &lt;= 5) { z = z + x; x = x + 1; } I know the answer is 16 but I keep running into errors when trying to compute it. I feel like I'm messing up a step in the loop in the beginning. I know I can just plug this into a java client and get the answer but I'm really trying to understand the loop sequence so as to be able to do it by hand.
has answer: http://stackoverflow.com/a/22000956
accepted answer: http://stackoverflow.com/a/22000984
has answer: http://stackoverflow.com/a/22001062
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22000974
upvote count: 2
tagged with: java
downvote count: 2
possible better answer: http://stackoverflow.com/a/22000951
type: Question
has answer: http://stackoverflow.com/a/22000951
has answer: http://stackoverflow.com/a/22000976

http://stackoverflow.com/a/21899115
score: 0
type: Answer
has body: public static void main(String[] args) { Map&lt;Integer,String&gt; map1 = new HashMap&lt;Integer,String&gt;(); Map&lt;Integer,String&gt; map2 = new HashMap&lt;Integer,String&gt;(); map1.put(1, "ABC"); map1.put(2, "1123"); map2.put(1, "XYZ"); boolean val = map1.keySet().containsAll(map2.keySet()); for (Entry&lt;Integer, String&gt; str : map1.entrySet()) { System.out.println("================="+str.getKey()); if(map2.containsKey(str.getKey())){ System.out.println("Map2 Contains Map 1 Key"); } } System.out.println("================="+val); }
answers question: http://stackoverflow.com/q/21898951

http://stackoverflow.com/q/21945638
tagged with: java
tagged with: error-handling
has comment: http://stackoverflow.com/comment/33246570
has comment: http://stackoverflow.com/comment/33246313
type: Question
has comment: http://stackoverflow.com/comment/33246518
has title: Error in Java, but not showing where, what can I do?
has comment: http://stackoverflow.com/comment/33246377
downvote count: 0
answer count: 1
has body: Sometimes, when my Java app runs in Netbeans7.4 it generates some error messages like the following : Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 7 &gt;= 7 at java.util.Vector.elementAt(Vector.java:470) at javax.swing.plaf.basic.BasicTabbedPaneUI.getTextViewForTab(BasicTabbedPaneUI.java:1706) at javax.swing.plaf.basic.BasicTabbedPaneUI.calculateTabHeight(BasicTabbedPaneUI.java:1717) at javax.swing.plaf.basic.BasicTabbedPaneUI.calculateMaxTabHeight(BasicTabbedPaneUI.java:1742) at javax.swing.plaf.metal.MetalTabbedPaneUI.calculateMaxTabHeight(MetalTabbedPaneUI.java:1147) at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateTabRects(BasicTabbedPaneUI.java:2586) at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateLayoutInfo(BasicTabbedPaneUI.java:2512) at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.layoutContainer(BasicTabbedPaneUI.java:2407) at java.awt.Container.layout(Container.java:1503) at java.awt.Container.doLayout(Container.java:1492) at java.awt.Container.validateTree(Container.java:1688) at java.awt.Container.validateTree(Container.java:1697) at java.awt.Container.validateTree(Container.java:1697) at java.awt.Container.validateTree(Container.java:1697) at java.awt.Container.validateTree(Container.java:1697) at java.awt.Container.validateTree(Container.java:1697) at java.awt.Container.validateTree(Container.java:1697) at java.awt.Container.validateTree(Container.java:1697) at java.awt.Container.validate(Container.java:1623) at javax.swing.RepaintManager$2.run(RepaintManager.java:691) at javax.swing.RepaintManager$2.run(RepaintManager.java:689) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:688) at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1676) at java.awt.event.InvocationEve…
has comment: http://stackoverflow.com/comment/33247283
favorite count: 0
has answer: http://stackoverflow.com/a/21946108
accepted answer: http://stackoverflow.com/a/21946108
has comment: http://stackoverflow.com/comment/33246701
upvote count: 1
has comment: http://stackoverflow.com/comment/33246694
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33246648
score: 1

http://stackoverflow.com/a/21939875
type: Answer
answers question: http://stackoverflow.com/q/21873167
has body: To get the complete details of each event, you will have to parse this link to get each event. From each such node, you will need to find the link with class more and follow that link. From the new page you get, you will need to parse the html to get the event details text. (You can get these class names, etc. by viewing the html of the page or using the web inspector in your browser) The basic logic will be something like: root = fetch page with url given above L = list of nodes with class newsbrdr on root for each node N in L: a_node = child of N with class 'more' p = fetch page at a_node's href extract the paragraph text from element on p with class 'newsdesc'
score: 0

http://stackoverflow.com/a/21951994
type: Answer
has body: The hibernate dependency even requires slf4j dependency. Try adding slf4j dependency in pom.xml
answers question: http://stackoverflow.com/q/21951895
score: 0

http://stackoverflow.com/comment/33181640
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21908599
type: Comment
has text: org.jdom2.Element typeContent = root.getChildren().get(objTypeIndex); This one is working but edit on wrong place atm. but when I add "type" in my getchildren it gives exception. So nothing wrong with the index I think right? the index is 19. And I have 19 <type>

http://stackoverflow.com/comment/55281085
score: 0
has text: This is not for for me.
type: Comment
comment on: http://stackoverflow.com/a/21932345
type: AnswerComment

http://stackoverflow.com/comment/33080436
has text: ... which internally does the same calculation... ;)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21852754
score: 1

http://stackoverflow.com/q/21945184
has body: I have a list of which contains 15 strings. Each of these strings ends with either .xls or .csv. These are files names in a directory. But before .xls or .csv or .xlsx, there can be any name but I need to pick only some of them. for example: CVAFreak_.xls (anything starts with CVAFreak_ and ends with .xls) DSSTregk_.xlsx (anything starts with DSSTregk_ and ends with .xlsx) _EOD_PNL.xls (anything starts with anything but ends with _EOD_PNL.xls only) _LEK_KIO.xlsx (anything starts with anything but ends with _LEK_KIO.xlsx only) ABI_INO_.csv (anything starts with ABI_INO_ &amp; ends with .csv only) _UIO_TYU.csv (anything starts with anything but ends with _UIO_TYU.csv only) ABC*XYZ.xls (anything starts with ABC only and ends with XYZ only (i.e. in between ABC &amp; XYZ anythng can come) but extension is .xls) And three hard coded files are also in this list like abc.xls, xyz.csv, hyg.xlsx. My requirement is this that I have another second list which contains hundreds of files with lots of different extensions and names but I have to choose only those file names which satisfy above criteria. Can anyone help me in writing a Java program for this kind of requirement using regex or any other thing.
upvote count: 0
has title: Issue in regex expression
favorite count: 0
has answer: http://stackoverflow.com/a/21945265
accepted answer: http://stackoverflow.com/a/21970909
tagged with: regex
has comment: http://stackoverflow.com/comment/33245494
possible better answer: http://stackoverflow.com/a/21945440
has comment: http://stackoverflow.com/comment/33245508
downvote count: 2
has answer: http://stackoverflow.com/a/21945440
has comment: http://stackoverflow.com/comment/33245537
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33291886
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/21970909
type: Question
answer count: 3

http://stackoverflow.com/q/21910374
has body: So a problem should be really simple. I have a form, GET and POST controller methods and one form backing bean. Relevant part of the form: <form:form modelAttribute="newUser" method="post" action="${signUpUrl}"> Username: <c:out value="${userForEditBean.username}"/> Password <form:password path="password" size="20"/> <form:errors path="password" cssClass="error"/> </form:form> GET method ... model.addAttribute("newUser", new SignUpBean()); model.addAttribute("test", new InjectTest()); ... POST method @RequestMapping(value = "/signup", method = RequestMethod.POST) public String registerUser(@ModelAttribute("test") InjectTest injTest, @ModelAttribute("newUser") SignUpBean signUpBean, BindingResult bindingResult, Model model) ... So, when I click submit ALL of the beans which I retrieve from the model using @ModelAttribute in the POST method having a String property password (which are signUpBean and injTest) have the same contents in the password field, which is the password I entered into the form. I don't want that, I want only the bean marked with the modelAttribute newUser to be populated. I am using Spring 3.2.6
downvote count: 0
answer count: 1
favorite count: 0
score: 4
has answer: http://stackoverflow.com/a/21919940
tagged with: spring
type: Question
tagged with: spring-mvc
type: AnsweredQuestion
has title: Form fields injected into multiple beans with same property names
tagged with: java
tagged with: forms
upvote count: 4
accepted answer: http://stackoverflow.com/a/21919940

dojo
tags question: http://stackoverflow.com/q/21851109
tags question: http://stackoverflow.com/q/21985600
type: Tag
tag name: dojo

http://stackoverflow.com/comment/94566196
type: QuestionComment
comment on: http://stackoverflow.com/q/21917034
score: 0
has text: Check out https://github.com/sensepost/apostille - a tool to clone one or more X509 certificate (chain)s. It can get you started with cloning the certificate and selectively modifying the contents.
type: Comment

http://stackoverflow.com/a/21892573
has comment: http://stackoverflow.com/comment/33185265
has body: Please make sure that your zookeeper is running fine and you don't have any name resolution related issue. Also, make sure that you have added the hbase.zookeeper.quorum property in your hbase-site.xml. If the problem still persists please show us your hbase-site.xml file.
score: 0
answers question: http://stackoverflow.com/q/21886981
has comment: http://stackoverflow.com/comment/33188688
has comment: http://stackoverflow.com/comment/33194866
has comment: http://stackoverflow.com/comment/33190347
type: Answer

http://stackoverflow.com/comment/33750845
comment on: http://stackoverflow.com/a/22214294
score: 0
type: AnswerComment
type: Comment
has text: Ah. Sorry. Yes, it's on the machine on which the job configuration class runs which is usually the client. You are correct

http://stackoverflow.com/comment/63702684
score: 0
type: Comment
has text: @lanoxx: thanks again. I will look for it and will give a try.
comment on: http://stackoverflow.com/a/21951917
type: AnswerComment

http://stackoverflow.com/comment/50110963
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21892406
type: Comment
has text: Thanks, I am with TestNG. But this is really helpful

http://stackoverflow.com/q/21880728
has answer: http://stackoverflow.com/a/21881101
has title: How to validate my password with the value in the oracle database and also what is the difference between return 0 and return 1 in java
tagged with: return-value
downvote count: 0
possible better answer: http://stackoverflow.com/a/21880814
has answer: http://stackoverflow.com/a/21880814
type: AnsweredQuestion
has body: I am not so good in Java. I am doing an an application and I want to validate the value entered as password in a text box with the value stored in the database for the password. If both the values do not match, I want to show an error message. I am creating a web service of this Java code that I will be using. What is the difference between return 0, return 1, return (value)?? How can I do this? Can someone give me a sample code example? I have created the connection in a separate class and created an object for it called- dbsource. package com.daoImpl; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import com.dto.LoginBean; public class ApplicationStatusDAO { DBSource dbsouce = new DBSource(); public List&lt;LoginBean&gt; userLogin() { List&lt;LoginBean&gt; listloginBean=new ArrayList&lt;LoginBean&gt;(); LoginBean loginbean=null; Statement stmt= null; try { String query = "select * from user_self"; try { stmt = dbsouce.getConnection().createStatement(); ResultSet rs = stmt.executeQuery(query); while(rs.next()) { loginbean=new LoginBean(); System.out.println("results: " + rs.getString("uname")+" "+ rs.getString("s_gender")+" "+ rs.getString("s_lname")); loginbean.setUname(rs.getString("uname")); loginbean.setPass(rs.getString("pass")); loginbean.setGender(rs.getString("s_gender")); loginbean.setLname(rs.getString("s_lname")); listloginBean.add(loginbean); } System.out.println("size of list"+ listloginBean.size()); } catch (SQLException e ) { System.out.println("result set Error: " + e); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return listloginBean; } The second class used: import java.util.List; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import com.daoImpl.ApplicationStatusDAO; import com.dto.LoginBean; @Path("/selfservice") public class ServiceDispatcher { @GET @Produces(…
score: 1
tagged with: java
type: Question
answer count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/21881101
has comment: http://stackoverflow.com/comment/33130172
favorite count: 0
has comment: http://stackoverflow.com/comment/33130169

http://stackoverflow.com/a/21858372
answers question: http://stackoverflow.com/q/21857829
has comment: http://stackoverflow.com/comment/33120289
type: Answer
has comment: http://stackoverflow.com/comment/33098161
score: 0
has body: onStart() is called at the beginning of the Activity's visible lifetime. So when you go to the Home screen and return, it is the first lifecyle event that runs. Since you set the renderer in that method, if fails because it was previously set when the Activity was created. You should ideally set the renderer as part of onCreate() since that won't run again when the Activity resumes. I assume you have a class, that subclasses GLSurfaceView, which you instantiate in onCreate(). You can set the renderer in that class's constructor. Or if your code already does that but instantiates the GlSurfaceView in onStart(), it should hopefully just be a case of moving it to onCreate().
accepted answer of: http://stackoverflow.com/q/21857829
type: AcceptedAnswer

http://stackoverflow.com/q/21928495
possible better answer: http://stackoverflow.com/a/21928565
has comment: http://stackoverflow.com/comment/33215259
has comment: http://stackoverflow.com/comment/33215406
has answer: http://stackoverflow.com/a/21928549
upvote count: 3
tagged with: java
tagged with: date
downvote count: 1
has comment: http://stackoverflow.com/comment/33215806
type: Question
has answer: http://stackoverflow.com/a/21928520
linked to: http://stackoverflow.com/q/38922754
has answer: http://stackoverflow.com/a/48654442
has comment: http://stackoverflow.com/comment/33215372
has body: So, I'm typing a very simple program to accept the date from the user and print it back to them. On my first attempt, i saw that the year gets incremented by 1900. What exactly is the reason? I also see that the month value is being incremented by one. Here is the program block Date dateInput = new Date(114,2,20,13,18,48); //2014-1900 = 114 System.out.println("Date Entered by You : "); System.out.println(dateInput); The output for this is Date Entered by You : Thu Mar 20 13:18:48 IST 2014 I entered the month value as 2, but it it printing at as March. What could be the problem? And why is the Date class preprogrammed to add a 1900 to the entered year?
favorite count: 0
accepted answer: http://stackoverflow.com/a/21928520
has answer: http://stackoverflow.com/a/21928565
has comment: http://stackoverflow.com/comment/84307042
answer count: 4
has title: Increment in month value in Date class in Java
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/21855658
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/21855692
favorite count: 0
has answer: http://stackoverflow.com/a/21855692
has body: I am new to java, and want to use the jsoup java library. I downloaded the jar file, and included it in my project. Next, I want to run a simple example, on their page String html = " First parse " + " Parsed HTML into a doc. "; Document doc = Jsoup.parse(html); On second line I get error: Type mismatch: cannot convert from org.jsoup.nodes.Document to javax.swing.text.Document And offers: Add 'cast' to document or change type (org.jsoup.nodes.Document doc = Jsoup.parse(html);) What is the problem? Have I forgotten to do something?
has title: Type mismatch Eclipse for jsoup
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21855707
downvote count: 0
score: 1
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/21855707

http://stackoverflow.com/comment/58590067
comment on: http://stackoverflow.com/q/21858415
has text: I am seeing temporary files under standalone/tmp/work/jboss.web/default-host/<war name>
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33368981
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21979928
has text: If all the libraries you want to use are available in source code form, import all those folders and files into your project. Your application should be able to link to them and their compiled class files will be bundled into your deployment.

http://stackoverflow.com/q/21971272
has answer: http://stackoverflow.com/a/21971303
type: AnsweredQuestion
tagged with: enums
linked to: http://stackoverflow.com/q/417062
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/70889334
tagged with: mysql
has answer: http://stackoverflow.com/a/59224145
type: Question
score: 20
upvote count: 20
tagged with: database
downvote count: 0
possible better answer: http://stackoverflow.com/a/21971303
has answer: http://stackoverflow.com/a/21971309
accepted answer: http://stackoverflow.com/a/21971309
has body: I tried to fill DB tables with random data and through Hibernate. But my code fill incompatible data into tables (not exactly incompatible it is index of this element declared at enum, for ex: at ApartmentState - FREE is first element it set to appropriate column it index - 0. But I want to put or FREE as enum or as string). I couldn't figure out why exactly this happen. Here is code snippet: private List&lt;Apartment&gt; generateApartments() { for (int i = 1; i &lt;= 3; i++) { for (int j = 2; j &lt;= 5; j++) { Apartment apartment = new Apartment(); // fill apartment apartment.setRoomName(generateRoomName()); apartment.setPricePerHour(generatePrice()); apartment.setApartmentState(FREE); apartment.setRating(getDesiredRating(j)); apartment.setSleepPlaces(getDesiredPlaces(i)); apartment.setActive(true); // save apartment apartments.add(apartment); } } return apartments; } private Apartment.SleepPlaces getDesiredPlaces(int i) { switch (i) { case 1: return ONE_PLACE; case 2: return TWO_PLACES; case 3: return THREE_PLACES; } return ONE_PLACE; } private Apartment.StarRating getDesiredRating(int j) { switch (j) { case 2: return TWO_STARS; case 3: return THREE_STARS; case 4: return FOUR_STARS; case 5: return FIVE_STARS; } return TWO_STARS; } I need to fill at table some enum values, as rating (2, 3, 4) and sleep places (1, 2..). But this puts some wrong data into table. Here is content at workbench: Why it puts only index, not as string or as enum. How can I recovering this at desired value, in the future. Here is snippet from Apartment class: @Entity @Table(name = "Apartments") public class Apartment extends AbstractEntity implements Comparable&lt;Apartment&gt; { private Integer id; private String roomName; private Double pricePerHour; private ApartmentState apartmentState; private StarRating rating; private SleepPlaces sleepPlaces; private Boolean active; public enum ApartmentState { FREE, REQUESTED, BOOKED, LIVED, CLEANING, PROCESSING } public enum StarRating { TWO_STARS(…
answer count: 3
has comment: http://stackoverflow.com/comment/33292526
favorite count: 0
has title: how to save enum value to DB with Hibernate?

http://stackoverflow.com/a/21944103
type: Answer
has body: The value which is passed as argument in the method will be set to the instance variable CurrModValue. public MyStuffReader(int CurrModValue) { this.CurrModValue = CurrModValue; Instance Variable(global)---^ ^----Parameter variable(local) }
score: 0
answers question: http://stackoverflow.com/q/21944070

long-integer
tags question: http://stackoverflow.com/q/21926274
tag name: long-integer
type: Tag

http://stackoverflow.com/a/21921520
type: Answer
has body: Your main problem is that CUPS/IPP is one of the rare protocols that use an HTTP to TLS upgrade, as described in RFC 2817. (https:// doesn't use that at all, see RFC 2818.) A consequence of that is that you'll find far less support in existing libraries for this upgrade. In principle, upgrading a plain Socket into an SSLSocket isn't too difficult. However, since IPP relies on HTTP, it's likely that the libraries your library uses doesn't support this, since few HTTP libraries support RFC 2817. I haven't looked at Cups4J, but Jspi clearly relies on Apache HTTP Client (probably version 3.x). Support for RFC 2817 was discussed in 2011 on Apache HTTP Client mailing list, but it's not clear whether any of this made its way into the library. Anyway, the Jspi code is older than that, so it's fair to assume that it's not going to work. A possible workaround: Some IPP servers seem to support both TLS via an upgrade (RFC 2817) or via an initial connection (RFC 2818, the traditional https:// way). Perhaps yours does too. Check whether it listens to another port for TLS connections (e.g. by pointing an HTTPS client to it). (This could also be the same port if the server uses port unification.) If this works, a quick patch to IppHttpConnection.java in Jspi should enable you to make it use https:// connections instead of http:// connections: private static URI toHttpURI(URI uri) { if (uri.getScheme().equals("ipp")) { String uriString = uri.toString().replaceFirst("ipp", "http"); I'm not sure if ipps:// is standard, but you could use the same trick and replace ipps:// with https:// in the scheme. The rest should automatically be handled by the underlying HTTP library. (You might have to make sure your certificate is trusted too, but that's a different problem.)
answers question: http://stackoverflow.com/q/21920750
score: 0

http://stackoverflow.com/q/21977551
has answer: http://stackoverflow.com/a/21996426
accepted answer: http://stackoverflow.com/a/21996426
score: 0
answer count: 1
tagged with: hsqldb
has body: I need to explicitly lock a row in table for a Connection, which: reads in data; (some logic will be run in between) updates the corresponding row in the db; While other connections wouldn't be able to read the data, disabling the dirty read (so ISOLATION level is out of question). Read the documentation, but don't fully comprehend it. Is my current understanding correct: set the concurrency control model to MVCC; set the transaction isolation level to READ COMMITTED (already default actually); set the autocommit value to false for Connection object in hand; create Statement/PreparedStatement; run the 'SELECT /--/ FOR UPDATE' query on the statement or PreparedStatement object and receive the ResultSet; -execute some logic- update the row with either ResultSet updateX() method or new UPDATE sql (executeUpdate()). commit the changes. Are any steps superfluous, missing or have I completely misunderstood the whole concept?
type: AnsweredQuestion
tagged with: java
has title: Pessimistic row locking with HSQLDB
type: Question
tagged with: locking
tagged with: database

http://stackoverflow.com/a/21849011
answers question: http://stackoverflow.com/q/21848475
type: Answer
has body: Your code is OK, the only problem is the first line new TextView(this) is not the best way to create a TextView, first create it in an xml and from your java code call it like this: EditText tv1 = (EditText) findViewById(R.id.my_textViewId); The rest of your code works great. Hope it helps.
score: 0

http://stackoverflow.com/a/32320860
has comment: http://stackoverflow.com/comment/84043878
has comment: http://stackoverflow.com/comment/60957255
answers question: http://stackoverflow.com/q/21987589
has comment: http://stackoverflow.com/comment/52516866
upvote count: 43
has comment: http://stackoverflow.com/comment/92953307
downvote count: 0
score: 43
has comment: http://stackoverflow.com/comment/106758620
type: Answer
has body: Here's my implementation (Spring OAuth2): @Controller public class OAuthController { @Autowired private TokenStore tokenStore; @RequestMapping(value = "/oauth/revoke-token", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public void logout(HttpServletRequest request) { String authHeader = request.getHeader("Authorization"); if (authHeader != null) { String tokenValue = authHeader.replace("Bearer", "").trim(); OAuth2AccessToken accessToken = tokenStore.readAccessToken(tokenValue); tokenStore.removeAccessToken(accessToken); } } } For testing: curl -X GET -H "Authorization: Bearer $TOKEN" http://localhost:8080/backend/oauth/revoke-token
has comment: http://stackoverflow.com/comment/115220684
has comment: http://stackoverflow.com/comment/85153012
has comment: http://stackoverflow.com/comment/54880236

http://stackoverflow.com/comment/33194657
score: 1
has text: But the permutation count explodes with string length. That doesn't at all seem like a good recourse. Sorting the chars in the string, which will eliminate the excess degree of freedom, seems the best way.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21916554

http://stackoverflow.com/comment/33331160
comment on: http://stackoverflow.com/q/21992782
score: 0
type: Comment
type: QuestionComment
has text: pos is correct becuz the noise starts on the given pos and finishes on newwavdata.length, and int sampleSizeInBits = 16; in the wav audio format.

http://stackoverflow.com/comment/33294894
comment on: http://stackoverflow.com/a/21972347
has text: BTW, this is probably elsewhere in the code, but I don't see where your file is deleted. With such large throughput, you probably want to delete some lines or the entire file at some point. Also, what happens when the program crashes and then restarts? By then, some files are uploaded, and some are not.. how do you know which is which? Also, I wonder why the threads communicate via a file, and not directly by sending each other messages through a queue or some other mechanism.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21999145
has answer: http://stackoverflow.com/a/21999207
tagged with: paintcomponent
type: AnsweredQuestion
tagged with: swing
has body: So I have this little project where I make the mario jump. But I can't figure out how to repaint it. If I do it in the Main class after a click, then the whole jumping will be very jerky. I tried to do it at the end of my jump function but that did not work too. Here is my code: Main: package klassid; import java.awt.Color; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.Timer; public class Main extends JComponent implements KeyListener, ActionListener{ static Hero hero; Timer t = new Timer(500,this); public static void main(String[] args) { JFrame aken = new JFrame("Simple jumping simulator"); aken.setSize(600, 600); aken.getContentPane().setBackground(new Color(255,255,255)); aken.getContentPane().add(new Main()); aken.setVisible(true); aken.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); hero.the_jump(); } public Main(){ addKeyListener(this); setFocusable(true); t.start(); hero = new Hero(0, 320); } public void paintComponent(Graphics g){ hero.render(g, this); g.setColor(Color.GREEN); g.fillRect(0, 550, 600, 2); } @Override public void keyPressed(KeyEvent e) { hero.move(e.getKeyCode()); } public void keyReleased(KeyEvent e) { hero.move2(e.getKeyCode()); } public void keyTyped(KeyEvent e) {} public void actionPerformed(ActionEvent e) {} } And my Hero class: package klassid; import java.awt.Toolkit; import java.awt.Image; import java.awt.Graphics; public class Hero { static Main main; int y; Image pilt = Toolkit.getDefaultToolkit().getImage("../mario.png"); private double height = 0, speed = 4; public static final double gravity = 9.81; private double x = 25; private boolean left = false, right = false, up = false; public Hero(int x, int y){ this.x = x; this.y = y; } public void render(Graphics g, Main pohiKlass){ g.drawImage(pilt, (int) (x), (int) (500-(height*100)), 50, 5…
accepted answer: http://stackoverflow.com/a/21999207
type: Question
has title: Can't figure out how to repaint
tagged with: java
tagged with: keylistener
score: 0
answer count: 1

http://stackoverflow.com/comment/33289043
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21969302
score: 0
has text: no i tell you to modify the bat (if you can) file to add the line. Any .bat file should use `%~dp0` to handle path, this allows the batch file to always work would it be launched from inside it's path, by double click...

http://stackoverflow.com/comment/33315235
type: AnswerComment
comment on: http://stackoverflow.com/a/21983842
has text: eclipse says there is nothing called as getResourceAsStream!! Checking google
type: Comment
score: 0

http://stackoverflow.com/q/21902770
has comment: http://stackoverflow.com/comment/33170379
has body: I am triying to acess to a shared preferences file wich was created in a different applicaction. I followed some tutorials but not works. This is my case: App1 (com.example.remoteservice) SharedPreferences configuracion2; configuracion2 = getSharedPreferences("telo", Context.MODE_WORLD_READABLE); Editor editor = configuracion2.edit(); editor.putFloat("x21", Float.parseFloat(x21.getText().toString())); editor.commit(); App2 (com.example.grafica) Context con = createPackageContext("com.example.remoteservice", MODE_WORLD_WRITEABLE); SharedPreferences pref = con.getSharedPreferences( "telo",MODE_WORLD_READABLE); ancho = pref.getFloat("x21", 0); Log.i("smash", "ancho" + String.valueOf(ancho)); And returns 0 because not exists "telo". why?? thanks
tagged with: android
has comment: http://stackoverflow.com/comment/33170539
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21903115
duplicate of: http://stackoverflow.com/q/6030321
tagged with: java
has title: Acess a sharedpreference file from different app
type: Question
linked to: http://stackoverflow.com/q/6030321
score: 0
has answer: http://stackoverflow.com/a/21903115
answer count: 1
tagged with: preferences

http://stackoverflow.com/comment/33301665
has text: Put in the full exception including stack trace and say which line in your code corresponds to what line in the stack trace.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21976405

http://stackoverflow.com/q/21950867
tagged with: while-loop
upvote count: 0
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/33256102
has title: Printing from a thread in another class with a while loop? ( time inconsistency )
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/33264672
has comment: http://stackoverflow.com/comment/33259371
has answer: http://stackoverflow.com/a/21952641
answer count: 1
downvote count: 1
favorite count: 0
has body: Hi I'm trying to code a clock that alternates between 1 and 0 every 500 milliseconds with a thread and print that same thread in another class at it's 500 millisecond sleep rate. I'm a 'thread newbie' and am in need of some help. Thread public class clockThread extends Thread { public void run(){ chipClass3 chip = new chipClass3(); int clock = 0; while(clock&lt;3){ try { Thread.sleep(500); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } clock++; clock = clock % 2; chip.setClock(clock); } } } Other Class public class chipClass3 { private clockThread clck; private int clock = 0 ; public chipClass3(){ clck = new clockThread(); } public static void main(String[]args ){ chipClass3 chip = new chipClass3(); new Thread(chip.clck).start(); chip.printClock(); } private void printClock() { while(true){ System.out.println(getClock()); } } public int getClock() { return clock; } public void setClock(int clock) { this.clock = clock; } }

http://stackoverflow.com/comment/33309790
comment on: http://stackoverflow.com/q/21958662
score: 0
type: Comment
type: QuestionComment
has text: @M.Deinum Separate contexts keep things cleaner, more obviously independent and not interfering.

http://stackoverflow.com/q/21979151
has comment: http://stackoverflow.com/comment/33306525
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21979171
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/33306646
has comment: http://stackoverflow.com/comment/33306581
type: AnsweredQuestion
upvote count: 3
accepted answer: http://stackoverflow.com/a/21979171
downvote count: 3
has comment: http://stackoverflow.com/comment/33306533
has body: I need to make a toString() function that returns the string "3 + 2i" for a Complex object Complex(3,2). This is what Iv done, but I am getting the below error, which I don't know what it means. As of release 8, 'this' is allowed as a parameter name for the reciever type only, which has to be the first parameter. public String toString() { String s = ("%f + %fi",this.real,this.imaginary); return s; } Can anyone help me out on what I am doing wrong?
type: Question
tagged with: tostring
possible better answer: http://stackoverflow.com/a/21979182
has comment: http://stackoverflow.com/comment/33306623
has comment: http://stackoverflow.com/comment/33306488
tagged with: java
has answer: http://stackoverflow.com/a/21979182
has title: How to make toString() return a complex object?

http://stackoverflow.com/comment/33339782
type: Comment
type: QuestionComment
has text: @davidhood2 to answer you, I don't understand why you take an int as an input and not a String? It would be easier to take a String and validate it with a regex.
score: 0
comment on: http://stackoverflow.com/q/21997704

http://stackoverflow.com/q/21974369
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21974608
possible better answer: http://stackoverflow.com/a/22027650
has answer: http://stackoverflow.com/a/22027650
tagged with: dictionary
has title: Convert List<Long> to Map<Long, Long> that counts occurrences
tagged with: java-8
type: AnsweredQuestion
tagged with: java-stream
tagged with: java
accepted answer: http://stackoverflow.com/a/21974608
type: Question
has body: I'm playing around with Java 8 and I know that this must be possible by reading the documentation, I just cannot find out how to do it. I have the following working code: long factorProduct = LongStream.rangeClosed(1, maxFactor) .filter(this::isOptimalFactor) .reduce((i, j) -&gt; i * j) .getAsLong(); List&lt;Long&gt; primeFactors = primeFactors(factorProduct); Important part is that I have a List&lt;Long&gt; that may have duplicates on some Long numbers. Now I want to convert it to a Map&lt;Long, Long&gt; with as key the element and as value the occurences. I thought that: Map&lt;Long, Long&gt; primeFactorCount = primeFactors.stream() .collect(Collectors.counting()); would work, but it doesn't. I looked up the examples in the java.util.stream.Collectors documentation. How do I need to use these features?
upvote count: 9
tagged with: collectors
score: 9
answer count: 2

http://stackoverflow.com/comment/33346049
type: AnswerComment
comment on: http://stackoverflow.com/a/22001217
type: Comment
has text: then if the count is always zero?, why i can see an incrementing numbers when i run these codes?
score: 0

javascript
tags question: http://stackoverflow.com/q/21858053
tags question: http://stackoverflow.com/q/21878526
tags question: http://stackoverflow.com/q/21955593
tags question: http://stackoverflow.com/q/21999970
tags question: http://stackoverflow.com/q/21846530
tags question: http://stackoverflow.com/q/21854688
tags question: http://stackoverflow.com/q/21871731
tags question: http://stackoverflow.com/q/21861657
tags question: http://stackoverflow.com/q/21845979
tags question: http://stackoverflow.com/q/21929436
tags question: http://stackoverflow.com/q/21852293
tags question: http://stackoverflow.com/q/21982366
tags question: http://stackoverflow.com/q/21900530
tags question: http://stackoverflow.com/q/22003764
tags question: http://stackoverflow.com/q/21851251
tags question: http://stackoverflow.com/q/21883629
tags question: http://stackoverflow.com/q/21970880
tag name: javascript
tags question: http://stackoverflow.com/q/21855210
tags question: http://stackoverflow.com/q/21977314
tags question: http://stackoverflow.com/q/21867274
tags question: http://stackoverflow.com/q/21967984
tags question: http://stackoverflow.com/q/21910865
tags question: http://stackoverflow.com/q/21975710
tags question: http://stackoverflow.com/q/21852459
tags question: http://stackoverflow.com/q/22001482
tags question: http://stackoverflow.com/q/21993403
tags question: http://stackoverflow.com/q/21966819
tags question: http://stackoverflow.com/q/21944527
tags question: http://stackoverflow.com/q/21930921
tags question: http://stackoverflow.com/q/21888605
type: Tag
tags question: http://stackoverflow.com/q/21874783
tags question: http://stackoverflow.com/q/21891255
tags question: http://stackoverflow.com/q/21866690
tags question: http://stackoverflow.com/q/21862639
tags question: http://stackoverflow.com/q/21867120
tags question: http://stackoverflow.com/q/21905386
tags question: http://stackoverflow.com/q/21985068
tags question: http://stackoverflow.com/q/22000241
tags question: http://stackoverflow.com/q/21873315
tags question: http://stackoverflow.com/q/21872968
tags question: http://stackoverflow.com/q/21842762
tags question: http://stackoverflow.com/q/21923158
tags question: http://stackoverflow.com/q/21981902
tags question: http://stackoverflow.com/q/21856896
tags question: http://stackoverflow.com/q/21922362
tags question: http://stackoverflow.com/q/21953736
tags question: http://stackoverflow.com/q/21856774
tags question: http://stackoverflow.com/q/21894828
tags question: http://stackoverflow.com/q/21973677
tags question: http://stackoverflow.com/q/21874510
tags question: http://stackoverflow.com/q/21955264
tags question: http://stackoverflow.com/q/21947753
tags question: http://stackoverflow.com/q/21886541
tags question: http://stackoverflow.com/q/21985856
tags question: http://stackoverflow.com/q/21953771
tags question: http://stackoverflow.com/q/21942116
tags question: http://stackoverflow.com/q/21984604
tags question: http://stackoverflow.com/q/21861136
tags question: http://stackoverflow.com/q/21979696
tags question: http://stackoverflow.com/q/21968162
tags question: http://stackoverflow.com/q/21939359
tags question: http://stackoverflow.com/q/21908112
tags question: http://stackoverflow.com/q/21975368

http://stackoverflow.com/q/21972561
has comment: http://stackoverflow.com/comment/33294634
tagged with: java
tagged with: stringtokenizer
type: Question
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/21972692
answer count: 3
has comment: http://stackoverflow.com/comment/33294649
has title: StringTokenizer not Working with BufferedReader
has comment: http://stackoverflow.com/comment/33294718
has comment: http://stackoverflow.com/comment/33294937
has comment: http://stackoverflow.com/comment/33294951
has answer: http://stackoverflow.com/a/21972669
has body: I am trying to use StringTokenizer with BufferedReader but I am getting an error. It works when I use Scanner but when I change to BufferedReader I can't make it work. I need your input as to what is wrong with my code. This is how my source file looks like: Stud Qu1 Qu2 Qu3 Qu4 Qu5 1234 052 007 100 078 034 2134 090 036 090 077 030 3124 100 045 020 090 070 4532 011 017 081 032 077 5678 020 012 045 078 034 6134 034 080 055 078 045 7874 060 100 056 078 078 8026 070 010 066 078 056 9893 034 009 077 078 020 1947 045 040 088 078 055 2877 055 050 099 078 080 3189 022 070 100 078 077 4602 089 050 091 078 060 5405 011 011 000 078 010 6999 000 098 089 078 020 And this is the error I am getting: Exception in thread "main" java.lang.NullPointerException at lab4.Student.&lt;init&gt;(Student.java:26) at StudentReportApp.main(StudentReportApp.java:6) import lab4.*; public class StudentReportApp { public static void main (String [] args){ String fileName = "input.txt"; Student studentData = new Student(fileName); //studentData.findReport (); //studentData.printReport (); } } public Student (String FileName){ File file = new File(FileName); try (BufferedReader br = new BufferedReader(new FileReader(file))){ String line; br.readLine(); //skips first line int r = 0; while ((line = br.readLine())!= null){ StringTokenizer stToken = new StringTokenizer(line, " "); while(stToken.hasMoreTokens()){ student[r] = Integer.parseInt(stToken.nextToken()); for (int c = 1; c &lt; 6; c++) grade [r][c-1] = Integer.parseInt(stToken.nextToken()); r++; } arrayStudents++; } student = new int [arrayStudents]; grade = new int[arrayStudents][5]; } catch (FileNotFoundException e) { System.out.println("Can't find file " + file.toString()); e.printStackTrace(); } catch (IOException e) { System.out.println("Unable to read file " + file.toString()); e.printStackTrace(); } }
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21972754
has comment: http://stackoverflow.com/comment/33294644
has comment: http://stackoverflow.com/comment/33294657

http://stackoverflow.com/q/21846567
answer count: 3
has answer: http://stackoverflow.com/a/21846643
has answer: http://stackoverflow.com/a/21846687
has body: I tried the following and it fails to output anything. I would ideally like to have the String text repeated n number of time by int multiplier. What am I doing wrong? String text and int multiplier are passed as arguments from another method. public static String repeatText(String text, int multiplier) { String value = ""; StringBuilder repeat = new StringBuilder(text.length() * multiplier); repeat(repeat, text, multiplier); value.equals(repeat); System.out.println("Text Repeated:"); System.out.println("-----------"); System.out.println(repeat); System.out.println("--------------"); return value; }
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33069318
linked to: http://stackoverflow.com/q/1235179
downvote count: 1
has comment: http://stackoverflow.com/comment/33069254
has comment: http://stackoverflow.com/comment/33069273
has answer: http://stackoverflow.com/a/21846624
tagged with: java
score: -1
type: Question
upvote count: 0
has title: How to repeat a String n number of times?
duplicate of: http://stackoverflow.com/q/1235179

http://stackoverflow.com/comment/35874745
type: AnswerComment
score: 0
has text: Hi, thanks for the answer, how would you show the inverse sphere in libgdx? I rendered it as a model instance, with an environment with an ambient light, but the sphere does not appear. It works fine in Blender though, when the camera is inside the sphere, the texture appears well. I also added the texture in the `data` folder to be sure. Any idea?
type: Comment
comment on: http://stackoverflow.com/a/22976715

http://stackoverflow.com/q/21918402
has comment: http://stackoverflow.com/comment/49413857
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I'm dynamically populating a multiline TextView with elements. The line of entered elements is wrappable. Each element consists of two parts: a text followed by an image. The length of the image is 2 characters. Elements are separated by a space. For adding elements I'm using SpannableStringBuilder. Everything works fine except for one thing. While adding a new element that goes to the next line (TextView wraps the line), the image of the previous element, that is the last one on the line above, disappears regardless of how much space is still available on that line. And if I remove the newly added element on the new line, that image reappears again. So the image part of every element that is last on every line doesn't show up. I'm using Android 4.0.3. Here is my code: TextView textView = (TextView) findViewById(R.id.textview); textView.setMovementMethod(new ScrollingMovementMethod()); SpannableStringBuilder ssb = new SpannableStringBuilder(); //then for each new element I do the following ssb.append(" "); //space separating elements (skip for the first element) ssb.append("text"); Bitmap image = BitmapFactory.decodeResource( getResources(), imageId ); ssb.append(" "); //prepare 2-character space for the image ssb.setSpan( new ImageSpan(image), ssb.length() - 2, ssb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE ); //put the image to the prepared space textView.setText( ssb, BufferType.SPANNABLE ); I know that there is a solution with TextWatcher. At the same time, I don't see any flows in my code and can't understand why the last image on every line gets hidden. Any suggestions will be highly appreciated. Thanks.
has comment: http://stackoverflow.com/comment/54365396
upvote count: 4
has answer: http://stackoverflow.com/a/33282500
downvote count: 0
tagged with: java
type: Question
score: 4
answer count: 1
has title: Wrappable TextView with SpannableStringBuilder and ImageSpan hides the last image on every line
tagged with: textview
has comment: http://stackoverflow.com/comment/44311028

http://stackoverflow.com/q/21847411
score: 25
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21851201
tagged with: java
possible better answer: http://stackoverflow.com/a/35247072
has answer: http://stackoverflow.com/a/35247072
type: Question
tagged with: jtree
tagged with: jcheckbox
has body: I was looking for a a JTree implementation, that contains checkboxes and which: When you select one node, all its successors in the tree are automatically selected When you unselect one node, all its successors in the tree are automatically unselected When a parent node is already selected, and the selection was removed from one of its successors, the node color will be changed, to make it intuitive that although this parent node is selected, not all of its successors are selected (Like when you select components to install in common installers) A click on a node leads to (No need to hold 'Ctrl' key!): If the node is already selected, it becomes unselected, with all its successors If the node is not selected, it becomes selected, with all its successors I searched the net for something simple, but could not find something as simple as I wanted. Does anyone know a good implementation of such tree?
has comment: http://stackoverflow.com/comment/33076882
has title: Java Swing: Need a good quality developed JTree with checkboxes
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/27299277
has comment: http://stackoverflow.com/comment/33076394
favorite count: 0
upvote count: 25
has comment: http://stackoverflow.com/comment/33072376
has comment: http://stackoverflow.com/comment/33070750
has comment: http://stackoverflow.com/comment/43063252
has answer: http://stackoverflow.com/a/21851201
tagged with: swing
tagged with: checkbox
has comment: http://stackoverflow.com/comment/33071537

http://stackoverflow.com/q/21908799
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33180216
has title: How to retrieve an item from a List in android?
has answer: http://stackoverflow.com/a/21908847
has answer: http://stackoverflow.com/a/21909016
has comment: http://stackoverflow.com/comment/33180243
tagged with: list
has comment: http://stackoverflow.com/comment/33180238
tagged with: java
has answer: http://stackoverflow.com/a/21908914
has answer: http://stackoverflow.com/a/21909071
type: Question
has comment: http://stackoverflow.com/comment/33180579
has body: How to retrieve items from a List? List&lt;String&gt; strings; Using Java (in an Android App) I have tried using strings.get(0) but this crashes the app. It launches a NullPointerException.
score: 0
has comment: http://stackoverflow.com/comment/33180562
tagged with: android
answer count: 4

http://stackoverflow.com/q/21897093
has comment: http://stackoverflow.com/comment/33160589
has comment: http://stackoverflow.com/comment/33161068
answer count: 1
has body: Seems like it should be pretty straightforward, I've done quick sort before, but I've got some bug in my code, and I can't quite find it. Here's my code: public static void quickSortInPlace(ArrayList&lt;Integer&gt; numbers, int left, int right) { if(left &lt; right) { int index = generatePivot(numbers); index = partition(numbers, left, right, index); quickSortInPlace(numbers, left, index - 1); quickSortInPlace(numbers, index + 1, right); } } public static int partition(ArrayList&lt;Integer&gt; numbers, int left, int right, int index) { int pivot = numbers.get(index); int tmp = numbers.get(right); numbers.set(right, numbers.get(index)); numbers.set(index, tmp); int newIndex = left; for(int i = left; i &lt; right; i++) { if(numbers.get(i) &lt;= pivot) { tmp = numbers.get(i); numbers.set(i, numbers.get(newIndex)); numbers.set(newIndex, tmp); newIndex++; } } tmp = numbers.get(newIndex); numbers.set(newIndex, numbers.get(right)); numbers.set(right, tmp); return newIndex; } //Chooses an index in the array for the pivot value. Randomly picks 3 values from the array, and chooses the intermediate value. This is simply an optimization. public static int generatePivot(ArrayList&lt;Integer&gt; numbers) { Random rand = new Random(); int rand1 = rand.nextInt(numbers.size()), rand2 = rand.nextInt(numbers.size()), rand3 = rand.nextInt(numbers.size()); int pivot1 = numbers.get(rand1), pivot2 = numbers.get(rand2), pivot3 = numbers.get(rand3); int max = Math.max(Math.max(pivot1, pivot2), pivot3); int min = Math.min(Math.min(pivot1, pivot2), pivot3); int pivot = pivot1 ^ pivot2 ^ pivot3 ^ max ^ min; int index = 0; if(pivot == pivot1) { index = rand1; } else if(pivot == pivot2) { index = rand2; } else if(pivot == pivot3) { index = rand3; } return index; } I'm giving the method quickSortInPlace an ArrayList filled with 10,000 randomly generated integers simply for the purpose of checking the correctness of the code. I would expect it to spit out an ordered ArrayList of 10,000 integers. I…
tagged with: sorting
has comment: http://stackoverflow.com/comment/33161896
has comment: http://stackoverflow.com/comment/33161207
score: 0
has comment: http://stackoverflow.com/comment/33161929
tagged with: in-place
has comment: http://stackoverflow.com/comment/33163770
tagged with: quicksort
has comment: http://stackoverflow.com/comment/33166643
type: UnansweredQuestion
has title: Trying to Do Quicksort in Place
type: Question
has answer: http://stackoverflow.com/a/21898898
tagged with: recursion
has comment: http://stackoverflow.com/comment/33162072
tagged with: java

http://stackoverflow.com/comment/33269446
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21958307
type: AnswerComment
has text: Thanks, Hovercraft Full OF Eels (great tag) your help is invaluable.

http://stackoverflow.com/comment/33171892
has text: Can you just force update maven from project properties?
comment on: http://stackoverflow.com/q/21903881
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21852274
has body: Full answer: import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; public class Test extends Activity { private LinearLayout LL; private RelativeLayout RL; private Button btn; int click_counter = 0; public void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.activity_test); RL = (RelativeLayout)findViewById(R.id.relative_layout); btn = (Button)findViewById(R.id.btn); LL = new LinearLayout(this); LL.setOrientation(LinearLayout.VERTICAL); RL.addView(LL); // Listener btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { TextView tv = new TextView(getApplicationContext()); tv.setText("Click: " + ++click_counter); LL.addView(tv); } }); } // onCreate() } and layout: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relative_layout" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;Button android:id="@+id/btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:text="Button" /&gt; &lt;/RelativeLayout&gt;
answers question: http://stackoverflow.com/q/21851967
has comment: http://stackoverflow.com/comment/33079161
has comment: http://stackoverflow.com/comment/33079420
has comment: http://stackoverflow.com/comment/33079822
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33079243

http://stackoverflow.com/comment/33312179
score: 0
has text: No notification. Only ": E/(): Device disconnected: 1"
type: AnswerComment
comment on: http://stackoverflow.com/a/21982119
type: Comment

http://stackoverflow.com/a/21885799
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21885092
type: Answer
has body: It seems to me that your two classes FacadeDataFromDB GetDataFromDB should not inherit Activity Activities are made for GUI and user-interaction (I don't see any in your example) and their life-cycle is managed by the framework : you never create them manually with new. See the android tutorial : https://developer.android.com/guide/components/activities.html and Activity javadoc : https://developer.android.com/reference/android/app/Activity.html.
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/21885092

http://stackoverflow.com/comment/33264079
score: 0
type: Comment
type: QuestionComment
has text: Notepad file? You mean text file?
comment on: http://stackoverflow.com/q/21955504

http://stackoverflow.com/comment/33084109
type: Comment
type: QuestionComment
has text: [Possible duplicate](http://stackoverflow.com/questions/18973185/minimize-all-other-applications-excluding-my-own-program)
comment on: http://stackoverflow.com/q/21855082
score: 0

http://stackoverflow.com/comment/33207396
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21923457
score: 0
has text: @chrylis, the Set is to store knowledge that "I've seen this number" not for result. But I just realized he wanted first occurrence of duplicate to be removed and not all duplicates.

http://stackoverflow.com/a/21968770
answers question: http://stackoverflow.com/q/21968185
score: 0
type: AcceptedAnswer
has body: When you detect contours in openCV, they are stored as a sequence of Points where each point has its x and y coordinate. so, your contour for one object will be something like this {Point1, Point2, Point3...so on}. Where x1 = Point1.x; y1 = Point1.y and so on. So, for each contour, try to find the minimum value of x, maximum value of x, minimum value of y and maximum value of y. So, by using this values, you get the maximum coverage of the given contour (create a Bounding Rect using this information). After doing that, just try to find the color of the Bouding Rect for each contour.
type: Answer
accepted answer of: http://stackoverflow.com/q/21968185

http://stackoverflow.com/q/21946851
answer count: 3
tagged with: junit
downvote count: 0
has body: I'm currently unit testing my asynchronous methods using thread locking, usually I inject a CountDownLatch into my asynchronous component and let the main thread wait for it to reach 0. However, this approach just looks plain ugly, and it doesn't scale well, consider what happens when I write 100+ tests for a component and they all sequentially have to wait for a worker thread to do some fake asynchronous job. So is there another approach? Consider the following example for a simple search mechanism: Searcher.java public class Searcher { private SearcherListener listener; public void search(String input) { // Dispatch request to queue and notify listener when finished } } SearcherListener.java public interface SearcherListener { public void searchFinished(String[] results); } How would you unit test the search method without using multiple threads and blocking one to wait for another? I've drawn inspiration from How to use Junit to test asynchronous processes but the top answer provides no concrete solution to how this would work.
tagged with: asynchronous
favorite count: 0
has comment: http://stackoverflow.com/comment/33248868
has comment: http://stackoverflow.com/comment/33249731
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21948444
has comment: http://stackoverflow.com/comment/33251469
tagged with: java
has answer: http://stackoverflow.com/a/21948728
has answer: http://stackoverflow.com/a/22012063
tagged with: unit-testing
type: Question
upvote count: 5
has comment: http://stackoverflow.com/comment/33249587
has comment: http://stackoverflow.com/comment/33248981
has title: How do I unit test asynchronous methods nicely?
score: 5

http://stackoverflow.com/comment/33079087
type: QuestionComment
comment on: http://stackoverflow.com/q/21852048
has text: Is your DashboardLayout or child views contains big image?
score: 0
type: Comment

http://stackoverflow.com/q/21960076
tagged with: java
tagged with: eclipse
tagged with: gradle
accepted answer: http://stackoverflow.com/a/21969437
score: 1
has body: I am devolping a parent java project with 3 subprojects. I am using gradle as its build tool. I am new to using gradle for my build tool. I am trying to get it to when I run the parent project, the parent project and possibly two of the subprojects automatically run on a web application (Tomcat web container). I found a helpful website https://github.com/bmuschko/gradle-tomcat-plugin/blob/master/README.md I see that I have to add a few things to the parent projects build.gradle. For instance: apply plugin: 'tomcat' which defines the following tasks: tomcatRun: Starts a Tomcat instance and deploys the exploded web application to it. tomcatRunWar: Starts a Tomcat instance and deploys the WAR to it. tomcatStop: Stops the Tomcat instance. tomcatJasper: Runs the JSP compiler (Jasper) and turns JSP pages into Java source using. I would need to run the "tomcatRun" and the "tomcatStop" task. Where should I declare each task? I think I should declare it under repositories { } tomcatRun { ...., but I am not sure. Is that where I would declare it? Do I have to declare the httpPort if my port is 8080? I ask, because 8080 is the default value and I am using the default value? I have to declare the classpath for tomcat (classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:0.9.7') inside the dependencies. Right? For each of the subprojects that I want to add to tomcat, do I have to delare the classpath in their dependencies in their 'project' section (project (':subproject-a') { dependences { classpath ... ? I added aplly plugin:'tomcat', but when I run it I get "Plugin with id 'tomcat' not found. What am I missing? Where do I define the tomcat options? [tomcatRun, tomcatRunWar]*.contextPath = 'stock-webservice' [tomcatRun, tomcatRunWar, tomcatStop]*.stopPort = 8081 [tomcatRun, tomcatRunWar, tomcatStop]*.stopKey = 'stopKey'
type: AnsweredQuestion
favorite count: 0
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/21969437
answer count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/21087330
has title: Does anyone know how to build a gradle parent project with subprojects that uses the tomcat plugin

http://stackoverflow.com/comment/33261404
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21954071
has text: but if they want to then click on the edittext again, I'll need to reopen the dialgoue box and doing that would restrict them from doing so
score: 0

http://stackoverflow.com/comment/33290315
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21956950
score: 0
has text: Ok, will do, thanks. I haven't actually changed anything else yet - only added the new BeanMutatorAccessorResolver. As soon as I remove that it seems to work again (with void methods). I have debugged to see whether it goes into the correct if-block and that part seems to be ok.

http://stackoverflow.com/a/21977587
downvote count: 0
has body: Once you've added the button, try calling revalidate on the container to update the container hierarchy. You may also find that the use of setPreferredSize may not be leaving enough room for the new button to appear
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21977502
score: 1
answers question: http://stackoverflow.com/q/21977502
type: Answer
upvote count: 1

http://stackoverflow.com/comment/33124849
has text: Yup. Just write it to a string not the file. Return a Response not an Object. Try it out.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21876743
type: AnswerComment

http://stackoverflow.com/q/22004470
tagged with: processing
has comment: http://stackoverflow.com/comment/33351828
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33351838
has comment: http://stackoverflow.com/comment/33351803
has comment: http://stackoverflow.com/comment/33351693
has answer: http://stackoverflow.com/a/22004733
favorite count: 0
has comment: http://stackoverflow.com/comment/33351941
has comment: http://stackoverflow.com/comment/33351755
has body: I am reading in serial values in Processing. An example: ... 297.5 297.1 297.1 ... These numbers do not vary by much more than shown here. Then, I run the following code: if (val &gt; 100) { println(val); } It prints exactly what I have written above. Then I run this code: if (val &gt; 100) { val -= 230; val *= 2; println(val); } It prints out wildly differing numbers: ... -189.59998 136.0 -188.0 135.0 -190.0 ... Thinking that something was screwy with my math (but how?!), I reduced my code to this: if (val &gt; 100) { val -= 230; println(val); } It prints, as expected, 67ish. What is wrong with val *= 2?! The only thing I can think of is that I'm 'overflowing' the memory allocated for the float datatype and so it's 'rolling over' to be negative... But how is that possible? I thought Processing was just a thin skin over Java. Full Code import processing.serial.*; Serial s; float val; void setup() { size(600, 400); String portName = Serial.list()[1]; s = new Serial(this, portName, 9600); s.bufferUntil('\n'); } void draw() { if ( s.available() &gt; 0) { try { val = Float.parseFloat(s.readStringUntil('\n').trim()); } catch (Exception e) { } if (val &gt; 100) { val -= 230; val = val * 2.0; println(val); } } } Pasted Input &amp; Output I have pasted the unabridged version of the outputs at the following site. The first is the output without the arithmetic; then there is a line of ###, and then the values after arithmetic is performed. http://pastebin.com/raw.php?i=Du7TmZFv
upvote count: 1
has comment: http://stackoverflow.com/comment/33351676
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33351925
accepted answer: http://stackoverflow.com/a/22004733
score: 1
tagged with: math
tagged with: java
type: Question
has title: What is making this simple Processing arithmetic fail?

http://stackoverflow.com/a/21868495
answers question: http://stackoverflow.com/q/21867359
has body: It's a classical problem you can solve with a stack: import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.Scanner; import java.util.Stack; public class LineReverserMain { public static void main(String[] args) throws IOException { // Linecounter and stack initialization int lineCount = 0; Stack&lt;String&gt; stack = new Stack&lt;String&gt;(); // Scaner and Filereader initialization Scanner s = new Scanner(System.in); System.out.print("Please enter the file name: "); String filename = s.next(); File file = new File(filename); // Push every read line onto the stack BufferedReader in = new BufferedReader(new FileReader(file)); while (in.ready()) { stack.push(in.readLine()); lineCount++; } // While the stack isn't empty get the top most element while (!stack.isEmpty()) System.out.println(stack.pop()); System.out.println(lineCount); // Close the Scanner and FileReader s.close(); in.close(); } } The stack hast a FILO structure, so you can just save String on it and pop them afterwards and get the correct order. Maybe you are interested in this shorter solution.
score: 0
type: Answer

http://stackoverflow.com/q/21905377
type: Question
has body: I'm trying to launch chrome with Selenium Webdriver and used the following code: System.setProperty("webdriver.chrome.driver", "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"); WebDriver driver = new ChromeDriver(); driver.get("http://www.yahoo.com"); Chrome browser opens but is not proceeding further. What could be the reason for the following error: Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
has answer: http://stackoverflow.com/a/21906400
accepted answer: http://stackoverflow.com/a/21905509
has answer: http://stackoverflow.com/a/67783167
possible better answer: http://stackoverflow.com/a/21906400
has answer: http://stackoverflow.com/a/21906927
score: 0
favorite count: 0
answer count: 5
tagged with: selenium-webdriver
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21905509
has title: How to open chrome in Selenium webdriver?
tagged with: java
has answer: http://stackoverflow.com/a/46297597
upvote count: 1
tagged with: google-chrome
downvote count: 1

http://stackoverflow.com/comment/33269854
type: QuestionComment
score: 1
has text: Why not use single table ??
comment on: http://stackoverflow.com/q/21958640
type: Comment

http://stackoverflow.com/comment/33083557
comment on: http://stackoverflow.com/q/21854776
score: 0
type: Comment
type: QuestionComment
has text: The error seems self-explanatory. What's your question?

http://stackoverflow.com/a/21950844
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21950820
has body: if you create an instance variable in a class, is the default value true or false until otherwise changed? If the variable is type of boolean, then default value is false, primitives variables default value id 0, object variable/reference variable default value is null Is it good practice to have an instance variable as ex. true then change the value to false and use that variable throughout your class? You can do this, it's depends on your requirement.
score: 3
upvote count: 3

http://stackoverflow.com/q/21909428
linked to: http://stackoverflow.com/q/122160
has title: Adding the source code to eclipse does not showing .java files
tagged with: java
has answer: http://stackoverflow.com/a/21910989
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33181622
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21909602
duplicate of: http://stackoverflow.com/q/122160
has body: I have attached the source code of rt.jar file ie src.zip to my Eclipse. My problem is that, After adding the source code of rt.jar to eclipse, when I open any class,for Example "String" class, The eclipse itself showing ".class" file for "String" only,It does nopt showing ".java" file for "String". How can I see the ".java" file?
type: UnansweredQuestion

http://stackoverflow.com/comment/33317984
score: 1
comment on: http://stackoverflow.com/q/21985674
has text: You can delete all the auto generated once except the once you really going to override. You need to implement all only if it is a Interface and if your calss is not abstract. But extending allow you to extend any number of methods as you want
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21992659
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21992709
has body: Can we call main method inside main? public static void main(String[] args) { main({"a","b","c"}); } Tried to google.Can't find the link. Sorry if the question is trivial
tagged with: methods
upvote count: 10
has comment: http://stackoverflow.com/comment/33330110
type: Question
has comment: http://stackoverflow.com/comment/33330141
possible better answer: http://stackoverflow.com/a/27402501
has comment: http://stackoverflow.com/comment/33330006
has answer: http://stackoverflow.com/a/27402501
tagged with: program-entry-point
score: 4
has comment: http://stackoverflow.com/comment/33330047
accepted answer: http://stackoverflow.com/a/21992709
has answer: http://stackoverflow.com/a/21992700
favorite count: 0
has comment: http://stackoverflow.com/comment/33330029
answer count: 5
has answer: http://stackoverflow.com/a/21993061
has title: calling main method inside main in java
has answer: http://stackoverflow.com/a/43093715
downvote count: 6

gwt
tags question: http://stackoverflow.com/q/21968857
tags question: http://stackoverflow.com/q/21964147
tags question: http://stackoverflow.com/q/21887168
tags question: http://stackoverflow.com/q/21906566
tags question: http://stackoverflow.com/q/21994461
tag name: gwt
tags question: http://stackoverflow.com/q/21875500
tags question: http://stackoverflow.com/q/21879568
tags question: http://stackoverflow.com/q/21917527
tags question: http://stackoverflow.com/q/21977212
tags question: http://stackoverflow.com/q/21943263
type: Tag
tags question: http://stackoverflow.com/q/21961239
tags question: http://stackoverflow.com/q/21937576
tags question: http://stackoverflow.com/q/21858954
tags question: http://stackoverflow.com/q/21849685
tags question: http://stackoverflow.com/q/21874544
tags question: http://stackoverflow.com/q/21887657
tags question: http://stackoverflow.com/q/21850025
tags question: http://stackoverflow.com/q/21874349
tags question: http://stackoverflow.com/q/21932815
tags question: http://stackoverflow.com/q/21927824
tags question: http://stackoverflow.com/q/21959965
tags question: http://stackoverflow.com/q/22003764
tags question: http://stackoverflow.com/q/21883949
tags question: http://stackoverflow.com/q/21977314
tags question: http://stackoverflow.com/q/21939403
tags question: http://stackoverflow.com/q/21910865
tags question: http://stackoverflow.com/q/21866881
tags question: http://stackoverflow.com/q/21969988
tags question: http://stackoverflow.com/q/21876765
tags question: http://stackoverflow.com/q/21989283
tags question: http://stackoverflow.com/q/21887096
tags question: http://stackoverflow.com/q/21902110
tags question: http://stackoverflow.com/q/21913859
tags question: http://stackoverflow.com/q/21898620
tags question: http://stackoverflow.com/q/21933978
tags question: http://stackoverflow.com/q/21846936

http://stackoverflow.com/comment/33219224
type: QuestionComment
has text: i know its quite erroneous, but I'm a newbie and wish to learn java as much as possible
score: 0
comment on: http://stackoverflow.com/q/21930040
type: Comment

http://stackoverflow.com/comment/33303670
type: Comment
has text: That answered my question. Thanks! I was getting confused on my assignment the integration of Jlist and vectors instead of arraylists, but I read through the API and got it figured out now. Thanks for the help.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21977553

http://stackoverflow.com/comment/33089123
comment on: http://stackoverflow.com/a/21857513
score: 0
type: Comment
type: AnswerComment
has text: i kept a, b, c as static and now its working fine... :)

http://stackoverflow.com/q/21877539
tagged with: shiro
downvote count: 0
favorite count: 0
has title: Shiro session timeout shows an error: There is no session with id using Struts2
type: UnansweredQuestion
score: 2
has body: I have this codes using Shiro: LoginAction.java: @Action(value = "loginUser", results = { @Result(name = "error", type = "tiles", location = "error") }) public String loginRegisterUser() { String retStr = null; Subject currentUser = SecurityUtils.getSubject(); UsernamePasswordToken token = new UsernamePasswordToken(loginUser.getUserName(),loginUser.getUserPassword()); token.setRememberMe(true); try { Session session = currentUser.getSession(); session.setAttribute("USERID", loginUser.getUserName()); session.setAttribute("SESSIONID", session.getId()); System.out.println("USERID: " + session.getAttribute("USERID")); System.out.println("SESSIONID: " + session.getAttribute("SESSIONID")); // session.setAttribute("LOGINUSER", loginUser); //TODO by Carmela: Add Resource Details sessionAttributes.put("USERID", session.getAttribute("USERID")); sessionAttributes.put("SESSIONID", session.getAttribute("SESSIONID")); currentUser.login(token); session.stop(); currentUser.getSession(true); if (currentUser.isAuthenticated()) { session = currentUser.getSession(false); session.touch(); session.setAttribute("USERID", sessionAttributes.get("USERID")); session.setAttribute("SESSIONID", sessionAttributes.get("SESSIONID")); System.out.println("user is authenticated!!!!!"); System.out.println("isAuthenticated USERID: " + session.getAttribute("USERID")); System.out.println("isAuthenticated SESSIONID: " + session.getAttribute("SESSIONID")); session.setTimeout(30000); retStr = "loginUserSuccess"; } } catch (ExpiredSessionException e) { System.out.println("LoginAction ExpiredSessionException"); } catch (UnknownAccountException uae) { addActionError("Unknown account."); retStr = "loginUserLogin"; uae.printStackTrace(); } catch (IncorrectCredentialsException iae) { addActionError("Incorrect Username and Password."); retStr = "loginUserLogin"; iae.printStackTrace(); } catch (LockedAccountException lae) { addActionError("Your account has been locked."); retStr = "loginUserLogin"; lae.printStackTra…
answer count: 0
upvote count: 2
tagged with: java
type: Question
tagged with: session

http://stackoverflow.com/comment/33297722
comment on: http://stackoverflow.com/a/21970904
type: Comment
has text: Thanks for your answer, but I wanted to insert an image into the jPanel, not into a label
score: 0
type: AnswerComment

http://stackoverflow.com/q/21974920
has comment: http://stackoverflow.com/comment/33298894
has title: Most maintainable and readable way to create objects with many fields
linked to: http://stackoverflow.com/q/439574
answer count: 4
type: AnsweredQuestion
has body: I'm creating a Java class that should encapsulate the six orbital elements of a celestial object, the six osculating elements of the same celestial object, the mass of the body and the name of the body. This means that my Java object must be created with no less than fourteen parameters, and I am now thinking about including another four constants of perturbation as parameters, which will bring that number up to eighteen. This is how it looks with fourteen parameters: new Planet("Mercury", 3.3022E23,0.387098, 0., 0.205637, 0.00002123, 7.00559, -0.00590158, 252.252, 149473., 77.4577, 0.1594, 48.3396, -0.122142) I've looked around people say that a class that takes in more than ten parameters is probably poorly designed. They also say that a class should do one thing and one thing only. Well, I'm just doing one thing literally, the only thing the class does so far is calculating the position of the celestial object with those parameters as a function of time. What is best practice for dealing with this situation?
upvote count: 3
has comment: http://stackoverflow.com/comment/33299122
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/21975130
has answer: http://stackoverflow.com/a/21975128
tagged with: oop
possible better answer: http://stackoverflow.com/a/21975089
tagged with: java
has comment: http://stackoverflow.com/comment/33298893
has answer: http://stackoverflow.com/a/21975089
has comment: http://stackoverflow.com/comment/33298867
downvote count: 0
has answer: http://stackoverflow.com/a/56805791
has comment: http://stackoverflow.com/comment/33299313
favorite count: 0
has comment: http://stackoverflow.com/comment/33298988
has answer: http://stackoverflow.com/a/21975130

http://stackoverflow.com/comment/33161789
score: 0
type: AnswerComment
has text: Okay - I can see your point. I will put my 'version' in the response.
type: Comment
comment on: http://stackoverflow.com/a/21897785

http://stackoverflow.com/q/21974786
has comment: http://stackoverflow.com/comment/33298784
type: Question
tagged with: function
answer count: 1
has title: function not working properly on android
accepted answer: http://stackoverflow.com/a/21974900
score: 0
linked to: http://stackoverflow.com/q/513832
tagged with: android
has comment: http://stackoverflow.com/comment/33298570
has comment: http://stackoverflow.com/comment/33298624
tagged with: return
linked to: http://stackoverflow.com/q/13899537
tagged with: android-intent
has comment: http://stackoverflow.com/comment/33298676
has answer: http://stackoverflow.com/a/21974900
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33298571
has comment: http://stackoverflow.com/comment/33298643
has body: I have a little problem with a function I'm using on an android app. Ihe function is not too hard, it's just a simple calculation with two random integers. The problem is that I have a label that I want to change the text of into the "problem" so that the user can solve it. I know something is wrong with the function but I can't quite figure out what. My closest guess is that the return part is wrong (since it's null), but I couldn't fix it in anyway so far. This is my code: import java.util.Random; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.TextView; public class Game extends Activity implements OnClickListener { private static final String TAG = "Game"; int game[]; public static final String KEY_DIFFICULTY = "com.example.coursework1.dificulty"; public static final int DIFFICULTY_NOVICE = 0; public static final int DIFFICULTY_EASY = 1; public static final int DIFFICULTY_MEDIUM = 2; public static final int DIFFICULTY_GURU = 3; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.game); int diff = getIntent().getIntExtra(KEY_DIFFICULTY, DIFFICULTY_NOVICE); game = getGame(diff); } public int[] getGame(int diff) { // TODO Auto-generated method stub String operators [] = {"+","-","*","/"}; Random op1, op2, op3, op4, op5, op6; if(diff == getIntent().getIntExtra(KEY_DIFFICULTY, DIFFICULTY_NOVICE)){ op1 = new Random(); op2 = new Random(); int operator = new Random().nextInt(operators.length); String random = (operators[operator]); int generate1 = op1.nextInt(10); int generate2 = op2.nextInt(10); int operation; if(random == "+"){ operation = generate1 + generate2; TextView setProblemToView = (TextView) findViewById(R.id.problem); setProblemToView.setText("generate1" + random + "generate2"); } } return null; } @Override public void onClick(View arg0) { // TODO Auto-generated method stub } }

http://stackoverflow.com/a/21914540
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: The error message tells you exactly what the problem is: ";"expected Means that you are missing a semicolon in your code. answer = studentgrade + studentid + student name should be answer = studentgrade + studentid + studentname;
answers question: http://stackoverflow.com/q/21914503

http://stackoverflow.com/a/21955009
answers question: http://stackoverflow.com/q/21954981
score: 3
has body: You're code is trying to work under the beginner's fallacy, that if you assign an object to two variables, and then change the assignment of one of the variables, the 2nd variable will magically change assignments, and it doesn't work that way. Your B class changes the values held by A's Strings, but after A has already used the original Strings to set the A text fields. The solution: give A public setter methods that allow other classes the ability to set the text in its text fields. i.e., public class A extends JFrame { JTextField pA, pB; public String a1, b2; public A() { pA = new JTextField (10); pA.setEditable(false); pA.setText(a1); pB = new JTextField (10); pB.setText(b2); pB.setEditable(false); setLayout(new FlowLayout); add(pA); add(pB); } public void setPaText(String text) { pA.setText(text); } public void setPbText(String text) { pB.setText(text); } } Or give A a constructor that allows outside classes the ability to set the fields on object creation. Or do both!
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21954981
type: Answer
upvote count: 3

http://stackoverflow.com/comment/95673832
has text: using maven for tests, CALLBACK allowed me to find every place where I forgot to add a test dependency on EL implementation, thank you @secure_paul
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21888907
type: AnswerComment

http://stackoverflow.com/comment/33164547
has text: Hard to tell without having a look at the file and the rest of your code. What are your computer specifications? I tested it on a rather old computer with Windows XP, 2.7 GHz, 2 GB ram, and JRE 7 from within Eclipse. Do other audio files of the same size also cause the lag or is it just this file?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21877019
type: Comment

http://stackoverflow.com/comment/33068984
has text: Thanks for the quick reply. But can you please tell me exactly like what you mean by instrumentation is not free.
comment on: http://stackoverflow.com/q/21846183
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21905802
has comment: http://stackoverflow.com/comment/33175119
type: Question
has body: I am taking a Java course for beginners at university and I am confused how does it compile/execute following is code: public class Counter { private int counter; private int end; public Counter(int start, int end) { this.counter = start; this.end = end; } public String toString() { return "[Counter counter=" + counter + " end=" + end + "]"; } public int getCounter() { return counter; } public void count(int increment) { if (counter &lt; end) { counter += increment; } } public void count() { count(1); } } Other class public class CounterProgram { private Counter counter; public void init() { counter = new Counter(1, 3); } public void run() { System.out.println(counter); counter.count(); System.out.println(counter); counter.count(); System.out.println(counter); counter.count(); System.out.println(counter); } public static void main(String[] args) { CounterProgram counterProgram = new CounterProgram(); counterProgram.init(); counterProgram.run(); } } I am not sure what count(1) means in the method public void count can anyone explain? Thank you for your time!
has answer: http://stackoverflow.com/a/21905854
has title: Understanding simple Counter code
tagged with: counter
score: 0
has answer: http://stackoverflow.com/a/21905939
has answer: http://stackoverflow.com/a/21906224
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/21905961
tagged with: java

http://stackoverflow.com/comment/33106000
type: AnswerComment
has text: Thanks for the heads up, is there a way to force all the content to live in the DBMS? I have not done integrity check with toromiro, i just used it a little bit with the hope that I will help. Please see my updated question and help me with your knowledge, much appreciated.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21860331

http://stackoverflow.com/comment/33311695
type: Comment
type: QuestionComment
has text: Just check whether your sqlite database object is null or not ?
comment on: http://stackoverflow.com/q/21982209
score: 0

http://stackoverflow.com/q/21964819
has body: is it possible to support this solution using cglib? interface I { void foo(); void boo(); } abstract class B implements I { foo(); } abstract class C implements I { boo(); } abstract class D extends B { } The code D d = new D(); d.foo(); d.boo();
type: AnsweredQuestion
tagged with: java
tagged with: cglib
score: -1
type: Question
downvote count: 2
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21964972
accepted answer: http://stackoverflow.com/a/21964972
has title: How to add multiple implementations to java class using cglib?
has comment: http://stackoverflow.com/comment/33283562
has comment: http://stackoverflow.com/comment/33281814

http://stackoverflow.com/comment/33065688
comment on: http://stackoverflow.com/q/21844307
score: 0
type: Comment
type: QuestionComment
has text: in... don't forget to use the in...

http://stackoverflow.com/comment/33207723
type: Comment
type: QuestionComment
has text: you should probably have an else statement for the switch..just do else { switch() {} }
comment on: http://stackoverflow.com/q/21923836
score: 0

http://stackoverflow.com/comment/33093608
has text: What about removing the answer? :) I mean, this is not a solution to the issue, is it?
comment on: http://stackoverflow.com/a/21859171
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21894201
score: 1
has body: You can have a Map which maps the names (action1, action2, ...) to classes which common parent and one method. And make call as following: map.getClass("action1").executeMethod(); Map&lt;String, MethodClass&gt; theMap = new Map&lt;&gt;(); interface MethodClass { executeMethod(); } and children: class MethodClass1 implements MethodClass{...} class MethodClass2 implements MethodClass{...}
upvote count: 1
answers question: http://stackoverflow.com/q/21893956
downvote count: 0
has comment: http://stackoverflow.com/comment/33155806
type: Answer
has comment: http://stackoverflow.com/comment/33155724

relative-path
type: Tag
tags question: http://stackoverflow.com/q/21914628
tag name: relative-path

http://stackoverflow.com/comment/33242432
type: Comment
has text: Alright i got the count to the right area but now to implement it is the problem. I have no idea where to start.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21942786

http://stackoverflow.com/comment/33356636
has text: I am just confused about the arguments in `for (char c : str.replaceAll("[^-+\\[\\]]", "")`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22005653
type: Comment

http://stackoverflow.com/comment/33258161
type: Comment
comment on: http://stackoverflow.com/a/21952167
type: AnswerComment
has text: Yes, and open up as another token, and a new notepad as a 3rd. basically splitting it into 3 parts.
score: 0

http://stackoverflow.com/a/21860790
type: Answer
downvote count: 0
has body: Probably not an acceptable answer, but too long for a comment: There are several options, depending on the actual intention. The pattern that you described is not uncommon for a "simple game loop". In this case, a code that is similar to the one that you posted is run in an own thread, and regularly triggers a repaint() in order to paint the updated game state. In your case, it seems that only the animationFrame variable is increased. For such a simple action, the alternatives that have already been mentioned may be sufficient: As suggested by whiskeyspider in https://stackoverflow.com/a/21860250/ : You could use a java.util.Timer with a TimerTask that only updated the animationFrame Alternatively, you could use a javax.swing.Timer whose ActionListener updates the animationFrame. This might be advantageous here, because you can be sure that the update of the animationFrame happens on the event dispatch thread. Thus, the update of this variable can not interfere with its usage in the painting method, for example But as mentioned in the comments: An own thread that executed the code that you already posted (with the minor adaptions) is also feasible and not "wrong" per se - but note that in this case (similar to when using a java.util.Timer) you might have to take care of the synchronization on your own EDIT: Based on the edited question: Similar to what I expected, you are using the animationFrame in your painting method. The crucial point here are the details about how the animationFrame variable is used. For example, if your paintComponent method looks like this class MyJPanel extends JPanel { private int animationFrame = 0; @Override protected void paintComponent(Graphics g) { super.paintComponent(g); drawChanges(g, getDelta(), animationFrame, FJPanle.FRAMES); drawSomethingElse(g, animationFrame, ...); drawEvenMore(g, animationFrame, ...); } ... } then it may happen that the value of animationFrame is changed (by another thread, possibly the java.util.Timer thread…
score: 1
answers question: http://stackoverflow.com/q/21860153
has comment: http://stackoverflow.com/comment/33094691
has comment: http://stackoverflow.com/comment/33094945
has comment: http://stackoverflow.com/comment/33096985
accepted answer of: http://stackoverflow.com/q/21860153
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/21867339
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 6
accepted answer of: http://stackoverflow.com/q/21867283
upvote count: 6
has body: You're calling Thread.sleep(...) on the Swing event thread which will sleep or lock the entire GUI. Don't do this. Use a Swing Timer instead. Swing Timer Tutorial. Also: You should avoid use of KeyListeners with Swing applications but instead should favor Key Bindings. You should paint in the override of a JPanel's paintComponent(Graphics g) method and not directly in the JFrame or in an override of its paint(Graphics g) method. This will help prevent your colors from flickering as they're doing. Always be sure to call the super paint method in your paint override. For example when overriding the JPanel's paintComponent(Graphics g) method, be sure to call the super.paintComponent(g) method at the start, so your component can do its graphic house keeping first. You will want to set your Graphics2D's RenderingHints to allow for anti-aliasing to smooth out your graphics. For Example: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.geom.Arc2D; import java.util.ArrayList; import java.util.EnumMap; import java.util.List; import java.util.Map; import java.util.Random; import javax.swing.*; /** * link: http://stackoverflow.com/questions/21867283/method-keeps-window-from- * closing * * @author Pete * */ @SuppressWarnings("serial") public class SimonPanelTest extends JPanel { private static final String PRESSED = "pressed"; private static final String RELEASED = "released"; private static final int TIMER_DELAY = 1000; private static final int TIME_SLICES = 8; private Random random = new Random(); private SimonPanel simonPanel = new SimonPanel(); public SimonPanelTest() { JPanel buttonPanel = new JPanel(); buttonPanel.add(new JButton(new ShowRandomPat…
answers question: http://stackoverflow.com/q/21867283

http://stackoverflow.com/q/21909374
score: 0
has answer: http://stackoverflow.com/a/21909545
accepted answer: http://stackoverflow.com/a/21909545
tagged with: regex
has comment: http://stackoverflow.com/comment/33184507
has comment: http://stackoverflow.com/comment/33184920
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21909436
tagged with: java
has title: regular expression for matching "|>" symbols in java
has body: I have following lines of string in a file. |&gt;XYZ|8489&lt;| |&gt;Abc|673&lt;| |&gt;tzu|2873&lt;| I need to filter the lines which matches with the pattern like it should starts with |&gt;XYZ or |&gt;tzu and ends with &lt;|. In other words it should return the first and the third line. Can anyone please suggest me how to do it with regex in Java?
has comment: http://stackoverflow.com/comment/33181227
has answer: http://stackoverflow.com/a/21909436
answer count: 2

http://stackoverflow.com/a/21933028
type: Answer
answers question: http://stackoverflow.com/q/21932974
upvote count: 3
score: 3
has body: Put an else in before the second if, so it is only done if the first one was not: if (inputNumber&lt;4 || inputNumber&gt;10) { System.out.println("Invalid grade!"); } else if (count==0) { System.out.print("You didn't enter any data!"); }
downvote count: 0

http://stackoverflow.com/a/21978836
has body: Add (optional=false) @JoinColumn(name="userID", unique=true, nullable=false, updatable=false) What is the primary key of the second table ProteinData
type: Answer
answers question: http://stackoverflow.com/q/21976159
score: 0

http://stackoverflow.com/comment/33324656
has text: The loop doesn't exit anyway. But the simpler the logic, the easier it is to see that :)
type: AnswerComment
comment on: http://stackoverflow.com/a/21989803
score: 0
type: Comment

http://stackoverflow.com/a/21918358
has comment: http://stackoverflow.com/comment/33199885
upvote count: 1
has comment: http://stackoverflow.com/comment/33198927
has comment: http://stackoverflow.com/comment/33198565
type: Answer
has body: Before using values you pull from request.getParameter() you should check them to see if they are null and do something if they are. String entityID = request.getParameter("entity_id"); if(entityID==null) { entityID = ""; //or maybe print a message to user "Entity ID is required field" and return; } Or you can make sure they're not null like this: String entityID = "" + request.getParameter("entity_id"); This would mean if what comes out of request.getParameter() was null, now it will be the String value "null" rather than null.
has comment: http://stackoverflow.com/comment/33198769
has comment: http://stackoverflow.com/comment/33199229
downvote count: 0
has comment: http://stackoverflow.com/comment/33198334
has comment: http://stackoverflow.com/comment/33199107
score: 1
has comment: http://stackoverflow.com/comment/33198124
answers question: http://stackoverflow.com/q/21909941
has comment: http://stackoverflow.com/comment/33198214
has comment: http://stackoverflow.com/comment/33198415

http://stackoverflow.com/q/21910803
tagged with: android
has answer: http://stackoverflow.com/a/22193120
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has title: Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED how to fix?
type: Question
has comment: http://stackoverflow.com/comment/33184075
accepted answer: http://stackoverflow.com/a/22193120
tagged with: java
tagged with: manifest
tagged with: eclipse
score: 0
answer count: 1
has body: Today, I was working on an app. Testing testing testing.. and out of the blue, the app says Manifest Malformed. What is did first was undo what I changed, but that didn't help. I then copied a copy from this morning, but that was no good either.. Hope you guys can help, my manifest is below! <?xml version="1.0" encoding="utf-8"?> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="18" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.intent.action.MAIN" /> Because requested, the LogCat

http://stackoverflow.com/q/21907007
has answer: http://stackoverflow.com/a/41707137
has answer: http://stackoverflow.com/a/39024011
has body: How to write selenium java code for doubleClick() on a record using web driver? I have displayed some records in the body part. Once I clicked on a record we should get a popup window to update it. Please suggest how to write Selenium Java code using web driver. I have tried following code: Actions action = new Actions(driver); action.moveToElement(driver.findElement(By.xpath("//table/tbody/tr[2]/td/div/div/table/tbody/tr[10]/td[1]"))).doubleClick().build().perform();
has answer: http://stackoverflow.com/a/36196346
has answer: http://stackoverflow.com/a/41570143
has comment: http://stackoverflow.com/comment/33213875
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22004991
tagged with: selenium
possible better answer: http://stackoverflow.com/a/21911758
type: Question
score: 9
answer count: 8
has answer: http://stackoverflow.com/a/21911758
upvote count: 9
has comment: http://stackoverflow.com/comment/33180739
has comment: http://stackoverflow.com/comment/33177184
has answer: http://stackoverflow.com/a/21907371
has title: Selenium webdriver Java code using web driver for double click a record in a grid
has answer: http://stackoverflow.com/a/45958032
downvote count: 0
has comment: http://stackoverflow.com/comment/33209585
has answer: http://stackoverflow.com/a/22004991
has comment: http://stackoverflow.com/comment/33177362
favorite count: 0

http://stackoverflow.com/q/22000167
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22000203
has title: Unchecked or unsafe operations when compiled, exception when atempted to run
linked to: http://stackoverflow.com/q/1200621
tagged with: java
tagged with: methods
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/33344020
tagged with: class
tagged with: arraylist
has body: When I attempt to compile my code, this error occurs: Note: GoFishEdited.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. When I tried to run it, this error message occurs: Exception in thread "main" java.lang.NullPointerException at Habitat.stockUp(Habitat.java:20) at GoFishEdited.main(GoFishEdited.java:14) I'm pretty sure the error is in the stoockUp method, but I don't understand what could be wrong with it. Here is my code: public class GoFishEdited { public static void main(String[] args) { System.out.println("\nProject 1, Stage 3\n"); int[] fishArray; ArrayList&lt;Fish&gt; catchF = new ArrayList&lt;Fish&gt;(); Habitat h1 = new Habitat(); Habitat h2 = new Habitat(); fishArray = h1.stockUp(); System.out.println("Start with some weights:"); for (int i : fishArray) { System.out.print(i + " "); } System.out.println("\n\nMake fish of those weights.\n"); Fish[] fishGroup = new Fish[fishArray.length]; // array of Fish for (int i=0; i &lt; fishArray.length; i++) { fishGroup[i] = new Fish(fishArray[i]); // make fish } System.out.println("Fish are made. Now put them in a habitat:\n"); for (Fish f : fishGroup) { h1.addFish(f); } System.out.println("\nAll in. The habitat displays them:\n"); h1.printFish(); System.out.println("\nMove some fish to the second habitat.\n"); for(Fish f : fishGroup){ h2.addFish(f); } System.out.println("\nPrint both habitats:\n"); h1.printFish(); h2.printFish(); System.out.println("\nCatch some fish.\n"); for(Fish f : fishGroup){ catchF = h1.catchFish(f); } } } And: public class Habitat { ArrayList&lt;Fish&gt; stringer = new ArrayList&lt;Fish&gt;(); int[] fishArr; public int maxCount=25; public int minCount=9; public int maxWeight=10; public int minWeight=1; public int catchProbability=30; //0.3 public ArrayList&lt;Fish&gt; catches = new ArrayList&lt;Fish&gt;(); public int[] stockUp(){ int numofF = minCount + (int)(Math.random() * ((maxCount - minCount) + 1)); for(int i = 0; i&lt;numofF; i++){ fishArr[…
score: 0
answer count: 1

http://stackoverflow.com/comment/33216356
comment on: http://stackoverflow.com/a/21888907
score: 0
type: AnswerComment
has text: This worked. Thank you very much. I did not have to set the validation property to AUTO.
type: Comment

http://stackoverflow.com/q/21867444
upvote count: 5
has answer: http://stackoverflow.com/a/50235767
has body: How do you stop and shutdown a hazelcast cluster? My observation from testing is that whenever a node ist stopped by HazelcastInstance#shutdown() the cluster tries to re-balance or backup the data. How can I first "stop" the cluster and then shut it down? (Or is my observation wrong?)
downvote count: 0
tagged with: hazelcast
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/35311839
score: 5
has answer: http://stackoverflow.com/a/35340118
answer count: 4
has answer: http://stackoverflow.com/a/21876695
tagged with: java
type: Question
has title: How to stop and shutdown an entire hazelcast cluster?
has comment: http://stackoverflow.com/comment/65724418

http://stackoverflow.com/a/21940312
downvote count: 0
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21940174
upvote count: 2
answers question: http://stackoverflow.com/q/21940174
has comment: http://stackoverflow.com/comment/33236846
has body: To do this generically, be generic about it. Instead of having subclasses of MenuItem just use a single class MenuItem and have a HashMap within it. The HashMap then maps from keys to values for all the properties of that MenuItem. You can then store them in the database using a one-to-many relationship linking the MenuItem table with a MenuItemProperties table. Trying to do it the way you were doing falls down quickly, because you can't actually usefully do anything with MenuItem without knowing what type it is. Note also that you are directly inserting values into your query string. While that's safe enough for integer values it's still bad practice and it is very dangerous is you ever have String values.
has comment: http://stackoverflow.com/comment/33236682
type: AcceptedAnswer

http://stackoverflow.com/comment/33279777
type: AnswerComment
comment on: http://stackoverflow.com/a/21963914
type: Comment
score: 0
has text: so I would change my two hash methods to what you have there?

http://stackoverflow.com/comment/33282254
has text: @Adam I'm really not interested in your rationalizations for violating this site's rules and guidelines.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21965146

http://stackoverflow.com/q/21901875
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21901920
tagged with: java
has comment: http://stackoverflow.com/comment/33168564
type: Question
has comment: http://stackoverflow.com/comment/33168681
score: 4
has answer: http://stackoverflow.com/a/21902069
has comment: http://stackoverflow.com/comment/33168715
answer count: 3
has comment: http://stackoverflow.com/comment/33168596
favorite count: 0
possible better answer: http://stackoverflow.com/a/21901918
has title: Java dealing with exceptions appropriately
has comment: http://stackoverflow.com/comment/33168631
has answer: http://stackoverflow.com/a/21901918
tagged with: exception
accepted answer: http://stackoverflow.com/a/21901920
has comment: http://stackoverflow.com/comment/33168626
upvote count: 4
has comment: http://stackoverflow.com/comment/33168534
has body: not that familiar with JAVA or exception handling. Looking for some advice on what is acceptable and what is frowned upon. The scenario, i'm building a game of life program, I have conditionals set up to check if a cell will be out of bounds and not try to access that 'cell'. My question is, is it acceptable to use a try catch block instead of 8 conditionals, and just do nothing if the arrayOutOfBounds exception is thrown. ie ignore the cells out of bounds, or is this bad practice? for instance... try{ neighbors += cellIsAlive(row, col); }catch(ArrayIndexOutofBoundsException e) { //dont do anything and continue counting neighbors } In this scenario cellIsAlive method checks a location in a multi dimensional array and returns 1 if it's alive 0 otherwise and throws ArrayIndexOutofBoundsException. Is this a good idea or is it bad practice to use exceptions this way? Thanks ahead of time for any input.

http://stackoverflow.com/comment/33236683
score: 0
type: Comment
type: QuestionComment
has text: did you recompile MyClass? are you using the latest compiled version?
comment on: http://stackoverflow.com/q/21940162

http://stackoverflow.com/a/21852898
type: Answer
has comment: http://stackoverflow.com/comment/33085956
upvote count: 2
has comment: http://stackoverflow.com/comment/33085139
has comment: http://stackoverflow.com/comment/33080289
has body: I guess the issue lies in this line, loginListener = (LoginListener) params[0]; as your params[0] is this which I refers to Home. However, in the doInBackground() method you have casted it to LoginListener. So as @Blackbelt said, could you check if your Home implements LoginListener.
has comment: http://stackoverflow.com/comment/33085332
score: 2
has comment: http://stackoverflow.com/comment/33085768
answers question: http://stackoverflow.com/q/21852759
has comment: http://stackoverflow.com/comment/33080114
downvote count: 0
has comment: http://stackoverflow.com/comment/33080053

http://stackoverflow.com/comment/33228443
type: Comment
type: QuestionComment
has text: You can use [Aspose For Java](http://www.aspose.com/java/excel-component.aspx) for creating .xlsx files.
score: 0
comment on: http://stackoverflow.com/q/21935922

http://stackoverflow.com/q/21961529
tagged with: android
has answer: http://stackoverflow.com/a/21961758
tagged with: aapt
has answer: http://stackoverflow.com/a/21961599
tagged with: java
has comment: http://stackoverflow.com/comment/33275763
type: Question
has comment: http://stackoverflow.com/comment/33280882
has title: Error with android app, eclipse, R class and aapt
tagged with: eclipse
score: 0
answer count: 2
has body: I'm working on an Android app in Eclipse. After making certain changes to one of my Activity classes layouts and cleaning/rebuilding the code at first I get an "error executing aapt return code 1" error, after which the R class does not get generated in the gen/ folder. While searching for answers online I found out that some users experienced xml errors resulting in project corruption and inability of generating the R class. I compared my project folder before and after the modification, using an autocompare tool, and all of the xml files (and all the other files) are identical. The only difference is that there are some files generated in the bin/ folder in the 'before' instance that don't exist in the 'after' instance. Anyone know how to fix this?
type: UnansweredQuestion

http://stackoverflow.com/comment/33344555
comment on: http://stackoverflow.com/a/22000340
type: Comment
has text: Actually, though crudely stated there is a fair amount of truth to what you say. First off, inner classes are crudely implemented (no real JVM support, eg) and hence have significant restrictions and oddities about them. And they do, as often as not, make the code less clear.
score: 2
type: AnswerComment

http://stackoverflow.com/q/21972375
tagged with: javafx-8
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33317329
has answer: http://stackoverflow.com/a/22004877
favorite count: 0
has body: I'm trying to implement JavaFX Task with setOnSucceeded listener. class GetDailySalesTask extends Task&lt;ObservableList&lt;VBox&gt;&gt; { @Override protected ObservableList&lt;VBox&gt; call() throws Exception { TabContentInfrastructure content = new TabContentInfrastructure(); return FXCollections.observableArrayList(content.initTestTabContentData()); } } And I call the Java Class here: VBox vb = new VBox(); Task&lt;ObservableList&lt;VBox&gt;&gt; task = new GetDailySalesTask(); Region veil = new Region(); veil.setStyle("-fx-background-color: rgba(0, 0, 0, 0.4)"); veil.setPrefSize(240, 160); ProgressIndicator p = new ProgressIndicator(); p.setMaxSize(140, 140); //p.progressProperty().bind(service.progressProperty()); veil.visibleProperty().bind(task.runningProperty()); p.visibleProperty().bind(task.runningProperty()); //vb.visibleProperty().bind(service.runningProperty().not()); //tableView.itemsProperty().bind(service.valueProperty()); StackPane stack = new StackPane(); System.out.println("service.valueProperty() = " + task.valueProperty()); task.setOnSucceeded(new EventHandler&lt;WorkerStateEvent&gt;() { @Override public void handle(WorkerStateEvent t){ System.out.print("Yes**********" + t.getSource().getValue()); stack.getChildren().clear(); t.getSource().getValue(); stack.getChildren().addAll(task.getValue().get(0)); } }); task.setOnFailed(new EventHandler&lt;WorkerStateEvent&gt;() { @Override public void handle(WorkerStateEvent t){ System.out.print("Entered setOnFailed**********" + t.getSource().getValue()); } }); stack.getChildren().addAll(vb, veil, p); tabdata.setContent(stack); new Thread(task).start(); And for some reason setOnSucceeded is not called. Can you help me to fix this issue? P.S public class TabContentInfrastructure { public VBox initTestTabContentData() throws InterruptedException { Thread.sleep(5000); final VBox vbox = new VBox(0); FlowPane flow = new FlowPane(); ........................ vbox.getChildren().addAll(flow, screenController); return…
has comment: http://stackoverflow.com/comment/33300409
tagged with: javafx-2
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/22004877
has title: setOnSucceeded is not called
upvote count: 1
has comment: http://stackoverflow.com/comment/33316880
type: Question
has comment: http://stackoverflow.com/comment/33317522
has comment: http://stackoverflow.com/comment/33316561

http://stackoverflow.com/comment/33333028
type: Comment
has text: @Fazovsky, say for example I have a method that I want to use on each of the button with in the for loop, how would I do that?
comment on: http://stackoverflow.com/a/21993570
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33089511
type: AnswerComment
has text: I'don't have a bin class in the export file.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21856719

hibernate
tags question: http://stackoverflow.com/q/21962874
tags question: http://stackoverflow.com/q/21925091
tags question: http://stackoverflow.com/q/21942646
tags question: http://stackoverflow.com/q/21871118
tags question: http://stackoverflow.com/q/21903098
tags question: http://stackoverflow.com/q/21947873
tags question: http://stackoverflow.com/q/21882192
tags question: http://stackoverflow.com/q/21884701
tags question: http://stackoverflow.com/q/21991456
tags question: http://stackoverflow.com/q/21971570
tags question: http://stackoverflow.com/q/21934268
tags question: http://stackoverflow.com/q/21904041
tags question: http://stackoverflow.com/q/21931882
tags question: http://stackoverflow.com/q/21846024
tags question: http://stackoverflow.com/q/21925078
tags question: http://stackoverflow.com/q/21855065
tags question: http://stackoverflow.com/q/21874940
tags question: http://stackoverflow.com/q/21976159
tags question: http://stackoverflow.com/q/21905124
tags question: http://stackoverflow.com/q/21943459
tags question: http://stackoverflow.com/q/21940600
tags question: http://stackoverflow.com/q/21912156
tags question: http://stackoverflow.com/q/21949433
tags question: http://stackoverflow.com/q/21963582
tags question: http://stackoverflow.com/q/21971428
tags question: http://stackoverflow.com/q/21948220
tags question: http://stackoverflow.com/q/21844062
tags question: http://stackoverflow.com/q/21869225
tags question: http://stackoverflow.com/q/21941848
tags question: http://stackoverflow.com/q/21963919
tags question: http://stackoverflow.com/q/21954314
tags question: http://stackoverflow.com/q/21931447
tags question: http://stackoverflow.com/q/21966383
tags question: http://stackoverflow.com/q/21926906
tags question: http://stackoverflow.com/q/22002272
tags question: http://stackoverflow.com/q/21983230
tags question: http://stackoverflow.com/q/21976186
tags question: http://stackoverflow.com/q/21853994
tags question: http://stackoverflow.com/q/21862117
tags question: http://stackoverflow.com/q/21909090
tags question: http://stackoverflow.com/q/21853439
tags question: http://stackoverflow.com/q/21994771
tags question: http://stackoverflow.com/q/21906723
tags question: http://stackoverflow.com/q/21934310
tag name: hibernate
tags question: http://stackoverflow.com/q/21952991
tags question: http://stackoverflow.com/q/21998950
tags question: http://stackoverflow.com/q/21863856
tags question: http://stackoverflow.com/q/22002739
tags question: http://stackoverflow.com/q/21847525
tags question: http://stackoverflow.com/q/21930120
tags question: http://stackoverflow.com/q/21851810
tags question: http://stackoverflow.com/q/21980309
tags question: http://stackoverflow.com/q/21971272
tags question: http://stackoverflow.com/q/21917720
tags question: http://stackoverflow.com/q/21904037
tags question: http://stackoverflow.com/q/21980037
tags question: http://stackoverflow.com/q/21908639
tags question: http://stackoverflow.com/q/21988039
tags question: http://stackoverflow.com/q/21970472
tags question: http://stackoverflow.com/q/22001492
tags question: http://stackoverflow.com/q/21996396
tags question: http://stackoverflow.com/q/21849405
tags question: http://stackoverflow.com/q/21884247
tags question: http://stackoverflow.com/q/21883050
tags question: http://stackoverflow.com/q/21931327
tags question: http://stackoverflow.com/q/21910117
tags question: http://stackoverflow.com/q/21988500
tags question: http://stackoverflow.com/q/22002254
tags question: http://stackoverflow.com/q/21986711
tags question: http://stackoverflow.com/q/21992985
tags question: http://stackoverflow.com/q/21860436
tags question: http://stackoverflow.com/q/21864762
tags question: http://stackoverflow.com/q/21911943
tags question: http://stackoverflow.com/q/21987200
tags question: http://stackoverflow.com/q/21901880
tags question: http://stackoverflow.com/q/21900294
tags question: http://stackoverflow.com/q/21859305
tags question: http://stackoverflow.com/q/21931299
tags question: http://stackoverflow.com/q/21996061

http://stackoverflow.com/q/21906194
tagged with: permgen
has comment: http://stackoverflow.com/comment/33175806
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33176052
favorite count: 0
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/33176100
has answer: http://stackoverflow.com/a/21906777
has body: When executing a java desktop application I get a java.lang.OutOfMemoryError: PermGen space. I have tried increasing java heap size, passing this argument to the VM: -Xmx1g But it keeps failing. It doesn't fail if any other colleague runs it in their computers... What could be causing this? Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: PermGen space at org.eclipse.jdt.internal.compiler.Compiler.initializeParser(Compiler.java:485) at org.eclipse.jdt.internal.compiler.Compiler.&lt;init&gt;(Compiler.java:112) at net.sf.jasperreports.engine.design.JRJdtCompiler.compileUnits(JRJdtCompiler.java:200) at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:201) at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:240) at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:173) at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:448) at de.mycompany.jasperReportgenerator.JasperReportDatenGenerator.generateReport(JasperReportDatenGenerator.java:567) at de.mycompany.myapp.admintool.gui.reports.controller.IFrmReportsController.generiereReport(IFrmReportsController.java:92) at de.mycompany.myapp.admintool.gui.reports.controller.IFrmReportsController.handleAction(IFrmReportsController.java:43) at de.mycompany.myapp.admintool.util.AdminkonsoleIFrameController.handleActionWithExceptionHandling(AdminkonsoleIFrameController.java:107) at de.mycompany.myapp.admintool.gui.reports.controller.IFrmReportsController.mouseClicked(IFrmReportsController.java:62) at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253) at java.awt.Component.processMouseEvent(Component.java:6300) at javax.swing.JComponent.processMouseEvent(JComponent.java:3275) at java.awt.Component.processEvent(Component.java:6062) at java.awt.Container.processEvent(Container.java:2039) at java.awt.Component.dispatchEventImpl(Component.java:4660) at…
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has title: xception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: PermGen space
accepted answer: http://stackoverflow.com/a/21906777
has comment: http://stackoverflow.com/comment/33175941
has comment: http://stackoverflow.com/comment/33175976

http://stackoverflow.com/comment/38350989
has text: @Jay Soyer you can add a -dontobfuscate option to it won't do that. That allows you to use it as a purely optimizing tool.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21958407
score: 0

http://stackoverflow.com/q/21960328
has comment: http://stackoverflow.com/comment/33273105
has answer: http://stackoverflow.com/a/26892993
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: android
tagged with: fragment
has comment: http://stackoverflow.com/comment/33273074
tagged with: java
downvote count: 2
has title: Error inflating class fragment: Line 10 xml
type: Question
has body: I'm building an app with a sliding pane and im having trouble running it. I am keep having FCs. I am fairly new to android development. package com.anshikka.datagushalpha; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.widget.SlidingPaneLayout; import android.view.View; public class MainActivity extends FragmentActivity { SlidingPaneLayout pane; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pane = (SlidingPaneLayout) findViewById(R.id.sp); pane.setPanelSlideListener(new PaneListener()); if (!pane.isSlideable()) { getSupportFragmentManager().findFragmentById(R.id.leftpane).setHasOptionsMenu(false); getSupportFragmentManager().findFragmentById(R.id.rightpane).setHasOptionsMenu(true); } } public class PaneListener extends FragmentActivity implements SlidingPaneLayout.PanelSlideListener { public PaneListener() {} @Override public void onPanelClosed(View view) { System.out.println("Panel closed"); getSupportFragmentManager().findFragmentById(R.id.leftpane); getSupportFragmentManager().findFragmentById(R.id.rightpane); } @Override public void onPanelOpened(View view) { System.out.println("Panel opened"); getSupportFragmentManager().findFragmentById(R.id.leftpane).setHasOptionsMenu(true); getSupportFragmentManager().findFragmentById(R.id.rightpane).setHasOptionsMenu(false); } @Override public void onPanelSlide(View view, float arg1) { System.out.println("Panel sliding"); } } } Here's my XML File &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;android.support.v4.widget.SlidingPaneLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/sp"&gt; &lt;!-- Left side pane. (Master) --&gt; &lt;fragment android:id="@+id/leftpane" android:name="com.anshikka.datagushalpha.MainActivity" android:layout_width="190dp" android:layout_height="match_parent" c…
upvote count: 0
score: -2
tagged with: slidingpanelayout
has answer: http://stackoverflow.com/a/21960405
answer count: 2

http://stackoverflow.com/a/41010747
answers question: http://stackoverflow.com/q/21923361
score: 0
has body: I create myself to solve exactly question's problem. I'll share you guys the regex: ^(\d)*(\.)?([0-9]{1})?$ Take a look at this Online Regex to see work properly Refer documentation if you wish continue to custom the regex Documentation
type: Answer

http://stackoverflow.com/q/21933094
has answer: http://stackoverflow.com/a/21933215
has title: java program to find m%n without using % operator and without using for loop
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21933267
tagged with: operators
answer count: 6
type: Question
has comment: http://stackoverflow.com/comment/33223507
accepted answer: http://stackoverflow.com/a/21933215
possible better answer: http://stackoverflow.com/a/21933210
has answer: http://stackoverflow.com/a/21933140
has answer: http://stackoverflow.com/a/21933210
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21933205
tagged with: modulo
has answer: http://stackoverflow.com/a/21933288
has body: java program to find m%n without using % operator, i got only using %, can some one help me without % operator? public class mod{ public static void main(String[] args){ int m=3, n=2; System.out.print("m%n is"+m%n); }} I want to find m%n without % operator

http://stackoverflow.com/q/21936465
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33230712
has comment: http://stackoverflow.com/comment/33229897
has body: I have a cacerts file at the location (/usr/java/jdk1.6.0_29/jre/lib/security/cacerts) and hence my java app searches for the keystore file at this location. However considering that my java version is very old and that the cacerts file gets updated with CA root certificates only when the JRE is upgraded which is quite rare (depending on the dev priorities) what I understand is that my java app would be affected when some external 3rd party introduces new 3rd party certificates which are not present in my cacerts file. So upon looking at the several options I found that I need to use the property -Djavax.net.ssl.trustStore and set its value to the location of my cacerts file outside the JRE . So that the application would search for the cacerts file outside the JRE and then reference it to my default cacerts file. So my question is to why do that? what is the advantage of keeping it outside JRE (to make it independent of JRE ?) As it becomes independent of JRE will it not look for new 3rd party root certificates and hence my JAVA application would not be affected? Or it has to do something with the property 'javax.net.ssl.trustStore'. I have already referred to this . But could someone please make me understand this as I am not getting a clear picture of this.
has comment: http://stackoverflow.com/comment/33230595
has answer: http://stackoverflow.com/a/21940812
type: Question
tagged with: java
tagged with: ssl
has comment: http://stackoverflow.com/comment/33230979
answer count: 1
downvote count: 0
score: 3
has title: What are the advantages of keeping the cacerts file at a location outside JRE?
has comment: http://stackoverflow.com/comment/33230815
favorite count: 0
has comment: http://stackoverflow.com/comment/33231228
upvote count: 3

http://stackoverflow.com/comment/33321636
comment on: http://stackoverflow.com/a/21977627
type: Comment
score: 0
type: AnswerComment
has text: DoublyLinkedList<Item> implements Iterable<Item> - see the link in my answer

http://stackoverflow.com/a/21844129
has body: You can use the following way also System.out.print('"'); System.out.print(234);// you can have for loop here System.out.print('"');
answers question: http://stackoverflow.com/q/21843464
type: Answer
score: 0

http://stackoverflow.com/comment/33068316
type: Comment
has text: You can apply (and pay for) the twitter firehose to get access to everything in a streaming manner. They're fairly easy about granting access.
comment on: http://stackoverflow.com/a/21845893
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33273484
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21960236
has text: Can you explain why the first problem is an issue? The second problem can be fixed by using something like `Calendar` and setting the hour, minute and seconds fields to 0 and setting the spinners value to the result `Date` returned by `Calendar#getTime`
type: Comment

http://stackoverflow.com/a/21946234
type: Answer
answers question: http://stackoverflow.com/q/21946162
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33247577
downvote count: 0
has body: You are raising something to the power of 12^5, with is absurdly huge and should result in infinity. Try five = a * Math.pow((1 + b/12), 12*5); instead.

http://stackoverflow.com/q/21939760
has answer: http://stackoverflow.com/a/21940042
has title: foward referencing types in java
has comment: http://stackoverflow.com/comment/33235773
answer count: 2
upvote count: 1
favorite count: 0
tagged with: typechecking
type: UnansweredQuestion
downvote count: 0
has body: In java, you can't do this Object x = y; Object y = null; But you can do this: class A { B bref = null; } class B {} Why is this the case? Can anyone explain how, in the second case, the compiler know about B?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21939812
type: Question

exception
tags question: http://stackoverflow.com/q/21850359
tags question: http://stackoverflow.com/q/21922547
tags question: http://stackoverflow.com/q/21859020
tags question: http://stackoverflow.com/q/21986071
tags question: http://stackoverflow.com/q/21930323
tags question: http://stackoverflow.com/q/21962227
tags question: http://stackoverflow.com/q/21896346
tags question: http://stackoverflow.com/q/21956171
tags question: http://stackoverflow.com/q/21920082
tags question: http://stackoverflow.com/q/21978553
tags question: http://stackoverflow.com/q/21904707
tags question: http://stackoverflow.com/q/21889999
tags question: http://stackoverflow.com/q/21868601
tags question: http://stackoverflow.com/q/21903583
tags question: http://stackoverflow.com/q/22004921
tags question: http://stackoverflow.com/q/21872895
tags question: http://stackoverflow.com/q/21976317
tags question: http://stackoverflow.com/q/21895425
tags question: http://stackoverflow.com/q/21907139
tags question: http://stackoverflow.com/q/21890899
type: Tag
tags question: http://stackoverflow.com/q/21907697
tags question: http://stackoverflow.com/q/21974928
tags question: http://stackoverflow.com/q/21875715
tags question: http://stackoverflow.com/q/21884737
tags question: http://stackoverflow.com/q/21989842
tags question: http://stackoverflow.com/q/21853856
tags question: http://stackoverflow.com/q/21882172
tags question: http://stackoverflow.com/q/21960861
tags question: http://stackoverflow.com/q/21980158
tags question: http://stackoverflow.com/q/21955951
tags question: http://stackoverflow.com/q/21891246
tags question: http://stackoverflow.com/q/21995041
tags question: http://stackoverflow.com/q/21987322
tags question: http://stackoverflow.com/q/21981321
tags question: http://stackoverflow.com/q/21869554
tags question: http://stackoverflow.com/q/21974806
tags question: http://stackoverflow.com/q/21901875
tags question: http://stackoverflow.com/q/21856531
tags question: http://stackoverflow.com/q/21968077
tags question: http://stackoverflow.com/q/21912891
tags question: http://stackoverflow.com/q/21873626
tag name: exception
tags question: http://stackoverflow.com/q/21987571
tags question: http://stackoverflow.com/q/21917193
tags question: http://stackoverflow.com/q/21924955
tags question: http://stackoverflow.com/q/22000764
tags question: http://stackoverflow.com/q/21985168
tags question: http://stackoverflow.com/q/21956589
tags question: http://stackoverflow.com/q/21889478
tags question: http://stackoverflow.com/q/21898116
tags question: http://stackoverflow.com/q/22002616
tags question: http://stackoverflow.com/q/21854046
tags question: http://stackoverflow.com/q/21978404
tags question: http://stackoverflow.com/q/21909948
tags question: http://stackoverflow.com/q/21962529
tags question: http://stackoverflow.com/q/21922759
tags question: http://stackoverflow.com/q/21961975
tags question: http://stackoverflow.com/q/21888354
tags question: http://stackoverflow.com/q/21929782
tags question: http://stackoverflow.com/q/21927099
tags question: http://stackoverflow.com/q/21978089

http://stackoverflow.com/q/21844022
has answer: http://stackoverflow.com/a/21846670
has comment: http://stackoverflow.com/comment/33069614
has body: I tried to create one-to-one mapping using Hibernate. And when I am implementing the DAO method, I am getting the following error: org.hibernate.AnnotationException: Unknown mappedBy in: com.User.userData, referenced property unknown: com.UserData.user java.lang.NullPointerException Why I am getting this error? My codes are like the following: For User entity code: @Entity @Table(name = "user") public class User implements Serializable { @Id @GeneratedValue @Column(name = "userid") int userID; @OneToOne(fetch = FetchType.LAZY, mappedBy = "user", cascade = CascadeType.ALL) UserData userData; ... } For UserData entity code: @Entity @Table(name = "UserData") public class UserData { @Id @GeneratedValue(generator = "generator") @GenericGenerator(name = "generator", strategy = "foreign", parameters = @Parameter(name = "property", value = "user")) int userID; @OneToOne(fetch = FetchType.LAZY) @PrimaryKeyJoinColumn User user;
tagged with: java
tagged with: hibernate
type: Question
score: 0
answer count: 1
has title: Unknown mappedBy in ... referenced property unknown error
type: UnansweredQuestion

http://stackoverflow.com/a/21852009
has comment: http://stackoverflow.com/comment/33079757
has comment: http://stackoverflow.com/comment/33083577
has comment: http://stackoverflow.com/comment/33114232
type: AcceptedAnswer
has body: Create a custom Dialect (extending MySQLDialect) and in your constructor add registerHibernateType(Types.LONGVARCHAR, TextType.INSTANCE.getName()); public class MySQLDialect extends MySQLDialect { public AGOSQLServerDialect() { super(); registerHibernateType(Types.LONGVARCHAR, TextType.INSTANCE.getName()); } } Remember to change dialect class into Hibernate config file path.to.YourDialect
score: 0
accepted answer of: http://stackoverflow.com/q/21849405
answers question: http://stackoverflow.com/q/21849405
type: Answer
has comment: http://stackoverflow.com/comment/33091379

http://stackoverflow.com/a/21856856
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/33087129
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Use BufferedReader to read the file line by line using the BufferedReader.readLine() method. For each line, check if the word is in it using a regular expression, or by splitting the line into a String[] (using String.split()), and iterating the entries in the resulting array to check if any of them is the desired word. If the desired word is there - print the entire line. If you chose the 2nd suggestion, don't forget to check equality of two strings by using equals() and NOT by using ==
accepted answer of: http://stackoverflow.com/q/21856700
has comment: http://stackoverflow.com/comment/33087643
answers question: http://stackoverflow.com/q/21856700

http://stackoverflow.com/comment/33345294
score: 0
type: Comment
has text: @AdnanAhmadKhan but it is occurring in java.util.Vector, not OP's code.
type: QuestionComment
comment on: http://stackoverflow.com/q/22000764

http://stackoverflow.com/comment/33063991
comment on: http://stackoverflow.com/q/21843250
score: 0
has text: I can do it without a loop. But best to let him learn to walk before we show him how to fly.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21961994
score: 25
has comment: http://stackoverflow.com/comment/33276587
accepted answer of: http://stackoverflow.com/q/21961393
has body: First of all, JPA queries always use class and field names. Never column names. So trying to use trainer_id won't work. builder.equal(root.get(Hours_.trainer), "foobar"); You're trying to compare the trainer field of the Hours entity with the String "foobar". trainer is of type Trainer. A Trainer can't be equal to a String. Its ID, it firstName, or its lastName, all of type String, can be compared to a String. SO you probably want builder.equal(root.get(Hours_.trainer).get(Trainer_.id), "foobar"); That said, as you noticed, the Criteria API is extremely complex and leads to unreadable, hard to maintain code. It's useful when you have to dynamically compose a query from several optional criteria (hence the name), but for static queries, you should definitely go with JPQL, which is even easier and shorter than SQL: select h from Hours h where h.trainer.id = :trainerId and h.hoursPK.dateHeld &gt;= :from and h.hoursPK.dateHeld &lt; :to order by h.hoursPK.dateHeld I would strongly advise against using composite keys, especially when one of its components is a functional data (dateHeld) that could have to change. Use numeric, single-column, autogenerated primary keys, and everything will be much simpler, and more efficient.
has comment: http://stackoverflow.com/comment/63550183
has comment: http://stackoverflow.com/comment/33276301
has comment: http://stackoverflow.com/comment/33276591
has comment: http://stackoverflow.com/comment/33276483
has comment: http://stackoverflow.com/comment/33276351
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21961393
upvote count: 25
type: Answer

http://stackoverflow.com/a/21886861
score: 2
upvote count: 3
downvote count: 1
answers question: http://stackoverflow.com/q/21886787
has comment: http://stackoverflow.com/comment/33154695
has body: Assuming you are storing the matrix in an 2D Array like this: int[][] matrix = int[n][m]; //where n is the number of rows and m is the number of columns You could just create an array of size m to store all the values in: double[] avg = double[m]; (Note: this Array is of type double but you can change it to float or whatever type you use when you calculate your average. double is better than int though as it will help you keep precision): It really depends on what you are going to do with the output, but a simple array like that is probably enough for most situations. It will be very easy to store the values because as you are adding the values from column i in matrix, you can add that avg to index i in your avg array. Like this: for (int i = 0; i &lt; m; i++) { avg[i] = averageForColumn(i); } In the above situation, averageForCoumn(int) returns the average value for the column at the given index. You don't actually need to create a method to do this though, you could just have another for loop.
type: Answer
has comment: http://stackoverflow.com/comment/33154529

http://stackoverflow.com/a/40699267
score: 0
has body: Right-click on Project libraries --> properties --> select a platform even if a platform is selected, reselect it.
type: Answer
answers question: http://stackoverflow.com/q/21947803

http://stackoverflow.com/comment/33177557
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21907123
type: AnswerComment
has text: And a source of lot of classloader leak pain ... from what I've heard. And it is one thing to use a framework that does this, and completely another to do it yourself, by hand.

http://stackoverflow.com/q/21856476
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/33086546
has title: What will happen to variable Declared in Interface ? if the implemented class has the same variable?
answer count: 4
has answer: http://stackoverflow.com/a/21856634
has comment: http://stackoverflow.com/comment/33086572
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21856589
has comment: http://stackoverflow.com/comment/33086551
has body: The code is below. public interface DesignPatternInterface { int CUSTOMERAGE = 45; } public class ImplementInterface extends AbstaractDemo implements DesignPatternInterface { private static final int CUSTOMERAGE =20; } My question is interface variable is static final and memory will be assigned
type: Question
has answer: http://stackoverflow.com/a/21856581
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21856548

http://stackoverflow.com/comment/33280011
type: QuestionComment
comment on: http://stackoverflow.com/q/21963582
has text: On that 2nd link they show you how to make cusom validators. http://java.dzone.com/articles/using-hibernate-validator#highlighter_957126
score: 0
type: Comment

http://stackoverflow.com/comment/33114594
has text: I'll take your word for it, but when I experimented no wordwrap happened. I'm guessing it doesn't by default, and the 2 lines the OP gave us had no mention of turning them on. I'm still betting his scroll pane shows 1 really long line because it doesn't have any new line characters in it.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21868589
type: AnswerComment

http://stackoverflow.com/comment/33209570
comment on: http://stackoverflow.com/q/21924999
has text: I'm using a turtle to call the method. It's currently creating a square and I'm just trying to modify the square method to create a rectangle
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39673824
type: AnswerComment
comment on: http://stackoverflow.com/a/22004706
type: Comment
has text: Any update on this issue . I m using 3.10 but it didn't work.
score: 0

http://stackoverflow.com/q/21904938
has comment: http://stackoverflow.com/comment/33173749
tagged with: java
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/28611628
type: UnansweredQuestion
tagged with: nullpointerexception
tagged with: android-listview
has body: I have problem with NullPointerException in AbsListView java.lang.NullPointerException at android.widget.AbsListView.obtainView(AbsListView.java:2161) at android.widget.ListView.makeAndAddView(ListView.java:1831) at android.widget.ListView.fillDown(ListView.java:674) at android.widget.ListView.fillFromTop(ListView.java:735) at android.widget.ListView.layoutChildren(ListView.java:1638) at android.widget.AbsListView.onLayout(AbsListView.java:1994) at android.view.View.layout(View.java:14008) at android.view.ViewGroup.layout(ViewGroup.java:4373) at android.widget.FrameLayout.onLayout(FrameLayout.java:448) at android.view.View.layout(View.java:14008) at android.view.ViewGroup.layout(ViewGroup.java:4373) at android.widget.FrameLayout.onLayout(FrameLayout.java:448) at android.view.View.layout(View.java:14008) at android.view.ViewGroup.layout(ViewGroup.java:4373) at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1585) at android.view.View.layout(View.java:14008) at android.view.ViewGroup.layout(ViewGroup.java:4373) at android.widget.FrameLayout.onLayout(FrameLayout.java:448) at android.view.View.layout(View.java:14008) at android.view.ViewGroup.layout(ViewGroup.java:4373) at android.widget.FrameLayout.onLayout(FrameLayout.java:448) at android.view.View.layout(View.java:14008) at android.view.ViewGroup.layout(ViewGroup.java:4373) at android.support.v4.widget.SlidingPaneLayout.onLayout(SlidingPaneLayout.java:651) at android.view.View.layout(View.java:14008) at android.view.ViewGroup.layout(ViewGroup.java:4373) at android.widget.FrameLayout.onLayout(FrameLayout.java:448) at android.view.View.layout(View.java:14008) at android.view.ViewGroup.layout(ViewGroup.java:4373) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1663) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1521) at android.widget.LinearLayout.onLayout(LinearLayout.java:1434) at android.view.View.layout(View.java:14008) at android.view.ViewGroup.layout(ViewGroup.java:4373) …
downvote count: 0
score: 1
favorite count: 0
has title: android AbsListView NullPointerException
type: Question
tagged with: android

http://stackoverflow.com/q/21934427
answer count: 1
has comment: http://stackoverflow.com/comment/65359897
has answer: http://stackoverflow.com/a/21982689
has comment: http://stackoverflow.com/comment/33226719
has comment: http://stackoverflow.com/comment/33228691
has comment: http://stackoverflow.com/comment/33228577
favorite count: 0
score: 8
has comment: http://stackoverflow.com/comment/33226599
has title: EJB 3.1 Binding does not work on Websphere Application Server
downvote count: 0
has comment: http://stackoverflow.com/comment/33226118
has comment: http://stackoverflow.com/comment/33258038
type: UnansweredQuestion
tagged with: ejb-3.1
type: Question
tagged with: jakarta-ee
has body: I want to call a local Stateless-EJB from on ejb project from another singleton-EJB in another ejb-project. Both EJB-Projects are in the same ear file. The Application Server is a WebSphere Application Server 8.0.0.1. First EJB 3.1-Project (PersistenceEJB.jar): Interface @Local public interface TaskInfoDao extends DaoTemplate<TaskInfo> { public int deleteAll(); } The Stateless Bean: @Stateless @TransactionAttribute(TransactionAttributeType.REQUIRED) public class TaskInfoDaoImpl implements TaskInfoDao { private static final long serialVersionUID = 1L; @PersistenceContext(unitName = "MyDatasource") private EntityManager em; @Override public int deleteAll() { Query query = em.createQuery("DELETE FROM TaskInfo t"); int count = query.executeUpdate(); return count; } } The ejb-jar.xml and ibm-ejb-jar-bnd.xml are empty. Second EJB 3.1-Project (SchedulerEJB.jar): Singleton: @Startup @Singleton public class StartUpBean { private final static Logger LOGGER = Logger.getLogger(StartUpBean.class .getName()); @EJB private TaskInfoDao taskInfoDao; @PostConstruct public void onStart() { LOGGER.info("DELETED: " + taskInfoDao.deleteAll()); } } META-INF Manifest-Version: 1.0 Class-Path: PersistenceEJB.jar My "ejb-jar.xml" and "ibm-ejb-jar-bnd.xml" are empty (in both projects). ear-File: -META-INF |-application.xml |-ibm-application-ext.xml |-ibm-applcaiton-bnd.xml |-MANIFEST.MF -PersistenceEJB.jar -SchedulerEJB.jar application.xml: <?xml version="1.0" encoding="UTF-8"?> ... SchedulerAppEAR SchedulerEJB.jar PersistenceEJB.jar The other files in ear META-INF are empty. On JVM-Startup I get the following Exception: [21.02.14 13:15:16:760 CET] 0000003a EJBApplicatio E CNTR0190E: The StartUpBean startup singleton session bean in the SchedulerEJB.jar module failed initialization with exception: javax.ejb.NoSuchEJBException: An error occurred during initialization of singleton session bean SchedulerAppEAR#SchedulerEJB.jar#StartUpBean, resulting in the discarding of the singleton instance.; n…
tagged with: java
has comment: http://stackoverflow.com/comment/33227117
tagged with: websphere-8
has comment: http://stackoverflow.com/comment/33228652
upvote count: 8
has comment: http://stackoverflow.com/comment/33309275
has comment: http://stackoverflow.com/comment/33228709

http://stackoverflow.com/comment/33095668
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21860573
has text: @HotLicks Yes, so assuming that `a` will never be used outside loop, both loops will most likely (after JIT kicks in) be optimized to behave the same, so it doesn't matter which version we will chose, so this question is kind of pointless (again, in situation where `a` is used only inside loops). Correct me if I am wrong.
score: 0

http://stackoverflow.com/comment/33248128
type: AnswerComment
has text: That's it! Thank you so much. I could not figure out how i was supposed to initialize it.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21941920

http://stackoverflow.com/a/21963250
type: Answer
answers question: http://stackoverflow.com/q/21963147
score: 1
upvote count: 1
has body: Breadth first search is performed on a tree, graph, or similarly structured data. The idea of implementing breadth first search is to explore one layer of nodes and at the same time store references to nodes in the next layer, so that you can return to them, after you finish the current layer. In order to accomplish this, you can use some kind of a queue. You start at the first node and put all the connected nodes into the back of a queue. Then pick the first node from the queue and repeat. If you're doing this over a tree structure, that's all there's to it, if you're searching a graph, you need to make sure, that you don't revisit nodes, otherwise you might end up running in circles. Hope this clears up the topic a bit.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21963147

http://stackoverflow.com/comment/33103800
score: 0
type: Comment
has text: I think just a maven project."File" menu select "New" and then "Project ..." and under the jBPM category, select "jBPM Project (Maven)".
comment on: http://stackoverflow.com/a/21865371
type: AnswerComment

http://stackoverflow.com/a/21910859
answers question: http://stackoverflow.com/q/21910769
has comment: http://stackoverflow.com/comment/33359993
has body: It depends entirely on how you're going to use the object. Public fields aren't inherently evil, it's just bad to default everything to being public. For example the java.awt.Point class makes its x and y fields public, and they aren't even final. Your example seems like a fine use of public fields, but then again you might not want to expose all of the internal fields of another immutable object. There is no catch-all rule.
score: 62
has comment: http://stackoverflow.com/comment/33250302
has comment: http://stackoverflow.com/comment/33184123
has comment: http://stackoverflow.com/comment/33235024
has comment: http://stackoverflow.com/comment/33263489
has comment: http://stackoverflow.com/comment/33184066
has comment: http://stackoverflow.com/comment/33192878
upvote count: 63
has comment: http://stackoverflow.com/comment/33186122
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33210173
has comment: http://stackoverflow.com/comment/33203355
has comment: http://stackoverflow.com/comment/33184535
has comment: http://stackoverflow.com/comment/33257447
has comment: http://stackoverflow.com/comment/33184168
has comment: http://stackoverflow.com/comment/33257417
has comment: http://stackoverflow.com/comment/33184050
has comment: http://stackoverflow.com/comment/33344536
type: Answer
has comment: http://stackoverflow.com/comment/33184650
has comment: http://stackoverflow.com/comment/33184462
has comment: http://stackoverflow.com/comment/33209408
has comment: http://stackoverflow.com/comment/33188029
has comment: http://stackoverflow.com/comment/33184749
has comment: http://stackoverflow.com/comment/33219155
accepted answer of: http://stackoverflow.com/q/21910769
has comment: http://stackoverflow.com/comment/33184021
downvote count: 1

http://stackoverflow.com/a/21927159
has body: There shouldn't be a backtrack there. I would expect (and RegexBuddy shows) backtracks at the \" and at the final ", but not in these positions. Perhaps regex101.com displays a BACKTRACK message also when the regex engine explicitly discards a potential backtracking position, but that's only speculation on my part.
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/21926970
answers question: http://stackoverflow.com/q/21926970
upvote count: 3
type: AcceptedAnswer
type: Answer

eclipse-plugin
tags question: http://stackoverflow.com/q/21950055
tags question: http://stackoverflow.com/q/21904219
tags question: http://stackoverflow.com/q/21898123
type: Tag
tags question: http://stackoverflow.com/q/21940631
tags question: http://stackoverflow.com/q/21984562
tags question: http://stackoverflow.com/q/21987420
tags question: http://stackoverflow.com/q/21996940
tags question: http://stackoverflow.com/q/21845914
tags question: http://stackoverflow.com/q/21932815
tags question: http://stackoverflow.com/q/21975415
tags question: http://stackoverflow.com/q/22004361
tags question: http://stackoverflow.com/q/21989687
tags question: http://stackoverflow.com/q/21963068
tags question: http://stackoverflow.com/q/21902026
tag name: eclipse-plugin

http://stackoverflow.com/a/21891737
has comment: http://stackoverflow.com/comment/33152779
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33152347
accepted answer of: http://stackoverflow.com/q/21891403
has comment: http://stackoverflow.com/comment/33152047
has comment: http://stackoverflow.com/comment/33151258
answers question: http://stackoverflow.com/q/21891403
type: Answer
has comment: http://stackoverflow.com/comment/33152380
score: 2
has body: This is the array 1 2 3 2 3 4 3 5 7 apply just one more for loop after printing the matrix. System.out.println("This is the sum of the columns"); int temp[]=columnSum(firstarray); for(int i=0;i&lt;columns;i++) { System.out.print(temp[i]+"\t"); } System.out.println(); replace with System.out.println("This is the sum of the columns"); columnSum(firstarray);
downvote count: 0
has comment: http://stackoverflow.com/comment/33155475
has comment: http://stackoverflow.com/comment/33150998
has comment: http://stackoverflow.com/comment/33151447
has comment: http://stackoverflow.com/comment/33152636
has comment: http://stackoverflow.com/comment/33152199

encode
tags question: http://stackoverflow.com/q/21929263
type: Tag
tag name: encode

http://stackoverflow.com/q/21890754
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/33148925
has title: Label and comment make a web address. An Easter egg in Netbeans?
upvote count: 2
has comment: http://stackoverflow.com/comment/33149737
has comment: http://stackoverflow.com/comment/33148978
has comment: http://stackoverflow.com/comment/33149057
has body: It is well known, that if we'll put a web address as a line in a Java method, it should and would be interpreted as a label with // comment after it. public static void setUpClass() throws Exception { https://www.google.cz/ &lt;------------------------------- This one FailOnThreadViolationRepaintManager.install(); } It seems, that NetBeans has one more interpretation for that: It really interprets the whole line as a web address. It works as web address! When mouse-hovering over it with pressed Ctrl you see the name of the site, and if you click, the page appears in the default browser. Is it a bug? A feature? Or an Easter egg? Edit. Eclipse works almost the same way. But it shows the line as a link only with pressed CTRL + hovering. Whereas Netbeans shows it as a link constantly.
downvote count: 1
tagged with: web
favorite count: 0
has comment: http://stackoverflow.com/comment/33148956
has comment: http://stackoverflow.com/comment/33170973
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33149639
has comment: http://stackoverflow.com/comment/33149008
has comment: http://stackoverflow.com/comment/33148982
tagged with: editor
tagged with: netbeans
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33157702

http://stackoverflow.com/a/21923396
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21923058
has body: I believe you just need to remove this line: &lt;bean id="userRepository" class="com.planit.persistence.registration.UserRepository"/&gt; See the SpringData docs here.

http://stackoverflow.com/comment/33212793
score: 0
type: QuestionComment
has text: @rajshree sorry i didn't get you ?
type: Comment
comment on: http://stackoverflow.com/q/21926962

intellij-idea
tags question: http://stackoverflow.com/q/21843149
tags question: http://stackoverflow.com/q/21905287
tags question: http://stackoverflow.com/q/21978569
tags question: http://stackoverflow.com/q/21936175
tags question: http://stackoverflow.com/q/21875627
tags question: http://stackoverflow.com/q/21983038
tags question: http://stackoverflow.com/q/21985118
tags question: http://stackoverflow.com/q/21852382
tags question: http://stackoverflow.com/q/21929032
tags question: http://stackoverflow.com/q/21864763
tags question: http://stackoverflow.com/q/21874581
type: Tag
tags question: http://stackoverflow.com/q/21852450
tags question: http://stackoverflow.com/q/21844045
tags question: http://stackoverflow.com/q/21923058
tag name: intellij-idea
tags question: http://stackoverflow.com/q/21908785
tags question: http://stackoverflow.com/q/21868863
tags question: http://stackoverflow.com/q/21957465
tags question: http://stackoverflow.com/q/21989960
tags question: http://stackoverflow.com/q/21919276
tags question: http://stackoverflow.com/q/21960722
tags question: http://stackoverflow.com/q/21885450
tags question: http://stackoverflow.com/q/21983022
tags question: http://stackoverflow.com/q/21962429
tags question: http://stackoverflow.com/q/21886235
tags question: http://stackoverflow.com/q/21846626
tags question: http://stackoverflow.com/q/21969659
tags question: http://stackoverflow.com/q/21975254
tags question: http://stackoverflow.com/q/21971261
tags question: http://stackoverflow.com/q/21863134
tags question: http://stackoverflow.com/q/21888617
tags question: http://stackoverflow.com/q/21878949
tags question: http://stackoverflow.com/q/22002667
tags question: http://stackoverflow.com/q/22001171
tags question: http://stackoverflow.com/q/21884217
tags question: http://stackoverflow.com/q/21951049
tags question: http://stackoverflow.com/q/21882198
tags question: http://stackoverflow.com/q/21924174

http://stackoverflow.com/q/21905912
type: AnsweredQuestion
tagged with: java
type: Question
has body: I've been trying to figure out a regex statement for this hello_123.123.123.anything123_- Rules: hello_123.123.123 (This part is mandatory, there must be a-z and underscore and three sets of numbers, seperated by dots) .anything123_- (That is freeform, it must start with a dot, then any number, any letter and as many dashes or underscores are allowed.) So far I have [a-zA-Z]+_(\d+\.*){3} But the issue is that the dot recurs a third time when its not needed and am unsure how to force the last dot to only be valid if there is trailing values Now I have ([a-zA-Z]+_)(\d+\.+){2}(\d+) It's messy and forced but works partially
score: 0
has comment: http://stackoverflow.com/comment/33176841
has title: Regex used to check if naming convention is valid
answer count: 1
tagged with: regex
has answer: http://stackoverflow.com/a/21907037
accepted answer: http://stackoverflow.com/a/21907037
has comment: http://stackoverflow.com/comment/33176645

http://stackoverflow.com/comment/33447514
type: Comment
comment on: http://stackoverflow.com/a/22041503
score: 0
has text: yes jexcel is restricted to .xls, offers no support for .xlsx
type: AnswerComment

http://stackoverflow.com/comment/33323146
type: QuestionComment
comment on: http://stackoverflow.com/q/21988922
has text: Caused by: java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlException
score: 0
type: Comment

http://stackoverflow.com/comment/33263986
score: 0
has text: I think this would be better on code review
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21955459

http://stackoverflow.com/q/21927774
tagged with: google-app-engine
tagged with: eclipse-classpath
has body: I have imported a google web app project and added the servlet.jar file but I don not know how to set the servlet.jar file in my classpath. How do I go about doing that. Am new to eclipse and this is a project am collaborating with somebody. I am using a macbook.
score: 0
type: UnansweredQuestion
type: Question
has title: Add servlet.jar in my classpath
tagged with: java
has answer: http://stackoverflow.com/a/21931078
tagged with: eclipse
tagged with: classpath
answer count: 1

heap-memory
tag name: heap-memory
type: Tag
tags question: http://stackoverflow.com/q/21995185

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/21870454
tags question: http://stackoverflow.com/q/21894964
tags question: http://stackoverflow.com/q/21886132
tags question: http://stackoverflow.com/q/21865512
tag name: osx-mavericks
tags question: http://stackoverflow.com/q/21957282

http://stackoverflow.com/comment/33341782
comment on: http://stackoverflow.com/q/21998591
score: 0
has text: Swich jvm. Recompile kernel. Pray. :-D
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33259688
score: 0
type: AnswerComment
has text: Thanks a lot.. i will implement this as per you suggestion.. if i get stuck any where will reach experts like you.. thanks again
type: Comment
comment on: http://stackoverflow.com/a/21951356

http://stackoverflow.com/q/21896764
favorite count: 0
type: UnansweredQuestion
tagged with: excel
has answer: http://stackoverflow.com/a/35336571
tagged with: apache-poi
tagged with: java
has answer: http://stackoverflow.com/a/44514926
has answer: http://stackoverflow.com/a/21903240
tagged with: coordinates
type: Question
tagged with: cell
score: 5
has body: I try to get a cell's coordinates, right now I write next code: for (Row row : sheet) { for(Cell cell : row){ // how to get a cell coordinates? } } How can I get a cell's coordinates (dx1, dx2, dy1, dy2) ?
upvote count: 5
has title: Apache poi how to get cell coordinates
answer count: 3
downvote count: 0

http://stackoverflow.com/comment/33176455
type: Comment
has text: @mabi Interesting! Thank you. I didn't know.
comment on: http://stackoverflow.com/a/21905648
type: AnswerComment
score: 0

http://stackoverflow.com/q/21924955
has answer: http://stackoverflow.com/a/21925004
answer count: 3
tagged with: throw
possible better answer: http://stackoverflow.com/a/21925004
tagged with: exception
has comment: http://stackoverflow.com/comment/33209490
has comment: http://stackoverflow.com/comment/33209597
has comment: http://stackoverflow.com/comment/33209441
has answer: http://stackoverflow.com/a/21925028
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21925028
tagged with: java
has title: Unable to Throw an IllegalArgumentException
tagged with: throws
type: Question
has body: I need the program to accept 3 test scores and then print their average, but if a score is less than -1 or greater than 100, it should throw an IllegalArgumentException. I can get the average to print out, but when testing -1 or 101, it doesn't throw the exception. What am I doing wrong? I'm very new to learning exceptions, so any help is appreciated. Here's my code: import java.util.Scanner; import java.io.*; public class TestScores { public static void main(String[]args) { Scanner keyboard = new Scanner(System.in); int[]scores = new int [3]; System.out.println("Score 1:"); scores[0] = keyboard.nextInt(); System.out.println("Score 2:"); scores[1] = keyboard.nextInt(); System.out.println("Score 3:"); scores[2] = keyboard.nextInt(); int totalScores = scores[0] + scores[1] + scores[2]; int average = 0; if (scores[0] &gt;= 0 &amp;&amp; scores[0] &lt;= 100 || scores[1] &gt;= 0 &amp;&amp; scores[1] &lt;= 100 || scores[2] &gt;= 0 &amp;&amp; scores[2] &lt;= 100) { try { average = totalScores / 3; } catch(IllegalArgumentException e) { System.out.println("Numbers were too low or high."); } System.out.println("Average Score: " + average); } } //end of public static void } //end of TestScores
has answer: http://stackoverflow.com/a/21925160
score: 0

http://stackoverflow.com/q/21963961
has comment: http://stackoverflow.com/comment/33341824
answer count: 0
type: UnansweredQuestion
tagged with: jetty
has body: How can we handle the number of count for Transaction Per Seconds of Single HTTP keep-Alive request using org.eclipse.jetty.continuation.Continuation Class. I have extended the org.apache.camel.component.http.CamelServlet and override its service method and with Help of HTTPConsumer I get camel Exchange. I am unable to figure out how to get number of transaction happen inside this single HttpRequest Object. Here Is the Code:- protected void service(HttpServletRequest request, HttpServletResponse response) { HttpConsumer consumer = resolve(request); if (consumer == null) { response.sendError(404); return; } if ((consumer.getEndpoint().getHttpMethodRestrict() != null) &amp;&amp; (!consumer.getEndpoint().getHttpMethodRestrict().equals(request.getMethod()))) { response.sendError(405); return; } if (("TRACE".equals(request.getMethod())) &amp;&amp; (!consumer.isTraceEnabled())) { response.sendError(405); return; } Exchange result = (Exchange)request.getAttribute("CamelExchange"); if (result == null) { final Continuation continuation = ContinuationSupport.getContinuation(request); //After getting continuation, //How to get the count for Number of Transaction Happen Inside this Single HTTPRequest (in this case request object)
has comment: http://stackoverflow.com/comment/33337100
tagged with: java
tagged with: apache-camel
tagged with: jetty-9
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/33305961
has title: Control The Count of Number of Transaction Per Seconds on Single HTTP Keep-Alive Request using org.eclipse.jetty.continuation.Continuation
has comment: http://stackoverflow.com/comment/33291837
score: 0
has comment: http://stackoverflow.com/comment/33431923

http://stackoverflow.com/q/21875412
type: AnsweredQuestion
has title: Java: How do I change the order of my JLabels in a 2x2 GridLayout?
has comment: http://stackoverflow.com/comment/33122406
upvote count: 2
has comment: http://stackoverflow.com/comment/33122539
tagged with: swing
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21875982
score: 1
tagged with: java
has body: I have a problem in that I'm trying to get my program to print out one particular JPanel as a 2x2 GridLayout with Icons of playing cards on top, and text indicating which player's card is it on bottom, but no matter what I do, the result is reverse, like so. I have tried changing the order in which I add the elements to no avail. CardTable myCardTable = new CardTable("CS 1B CardTable", NUM_CARDS_PER_HAND, NUM_PLAYERS); myCardTable.setSize(800, 600); myCardTable.setLocationRelativeTo(null); myCardTable.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // show everything to the user myCardTable.setVisible(true); myCardTable.getGamePanel().setBorder(new TitledBorder("Playing Area")); myCardTable.getGamePanel().add(playerCard, JLabel.CENTER); myCardTable.getGamePanel().add(computerCard, JLabel.CENTER); for(int i = 0; i &lt; NUM_PLAYERS; i++) { JLabel temp = new JLabel(GUICard.getIcon(generateRandomCard())); myCardTable.getGamePanel().add(temp); } Below is the constructor of the class that I made, CardTable, that extends JFrame. static int MAX_CARDS_PER_HAND = 57; static int MAX_PLAYERS = 2; // for now, we only allow 2 person games private int numCardsPerHand; private int numPlayers; private JPanel computerPanel, playerPanel, gamePanel; public CardTable(String title, int numCardsPerHand, int numPlayers) { super(title); setComputerPanel(new JPanel(new GridLayout(1 , numCardsPerHand))); setPlayerPanel(new JPanel(new GridLayout(1 , numCardsPerHand))); setGamePanel(new JPanel(new GridLayout(2 , numPlayers))); setLayout (new BorderLayout(20, 10)); add(getComputerPanel(), BorderLayout.NORTH ); add(getGamePanel(), BorderLayout.CENTER); add(getPlayerPanel(), BorderLayout.SOUTH); }
answer count: 1
accepted answer: http://stackoverflow.com/a/21875982
favorite count: 0

http://stackoverflow.com/q/21957011
has body: I want to make a check if resultCode is RESULT_OK in Android's BroadcastReceiver's onReceive method like we do in onActivityResult method of an Activity, but how will I do that is my question. Receiver's code is: new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub //This is what I like to check. //if(resultCode == RESULT_OK) } };
has answer: http://stackoverflow.com/a/21998418
tagged with: android
tagged with: android-intent
upvote count: 12
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
tagged with: broadcastreceiver
has answer: http://stackoverflow.com/a/21957787
accepted answer: http://stackoverflow.com/a/21957787
score: 12
answer count: 3
has title: Check for resultCode in Android's BroadcastReceiver?
has answer: http://stackoverflow.com/a/21957185
possible better answer: http://stackoverflow.com/a/21998418
favorite count: 0

http://stackoverflow.com/a/21914761
has body: Your diagram indicates the TimeTable table has a primary key composed of three columns (Period, Day, and Class_idClass). You will need to add an annotation to Absence.timeTable that looks something like this: public class Absence implements Serializable { ... @JoinColumns[ @JoinColumn(name = "TimeTable_Period", referencedColumnName = "Period", ...), @JoinColumn(name = "????", referencedColumnName = "Day", ...), @JoinColumn(name = "Class_idClass", referencedColumnName = "Class_idClass", ...) ] @ManyToOne(optional = false) private TimeTable timeTable; ... }
score: 1
upvote count: 1
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33331128
answers question: http://stackoverflow.com/q/21910968
has comment: http://stackoverflow.com/comment/33264098
accepted answer of: http://stackoverflow.com/q/21910968
type: Answer

http://stackoverflow.com/a/21955257
has comment: http://stackoverflow.com/comment/46651273
type: Answer
upvote count: 173
has comment: http://stackoverflow.com/comment/35958793
has comment: http://stackoverflow.com/comment/137773170
has comment: http://stackoverflow.com/comment/52267986
has body: UCanAccess is a pure Java JDBC driver that allows us to read from and write to Access databases without using ODBC. It uses two other packages, Jackcess and HSQLDB, to perform these tasks. The following is a brief overview of how to get it set up. Option 1: Using Maven If your project uses Maven you can simply include UCanAccess via the following coordinates: groupId: io.github.spannm artifactId: ucanaccess The following is an excerpt from pom.xml, you may need to update the to get the most recent release: io.github.spannm ucanaccess 5.1.2 Option 2: Manually adding the JAR to your project UCanAccess provides its standard dependencies in its uber.jar file. Usually all you need to do is add that file to your project. (Additional dependencies are required for working with encrypted .accdb files. See the UCanAccess documentation for details.) Go to UCanAccess on Maven Central, Browse the latest version, and download the uber.jar file. Eclipse: Right-click the project in Package Explorer and choose Build Path > Configure Build Path.... Click the "Add External JARs..." button to add the uber.jar file. When you are finished your Java Build Path should look something like this That's it! Now you can access data in .accdb and .mdb files using code like this // assumes... // import java.sql.*; Connection conn=DriverManager.getConnection( "jdbc:ucanaccess://C:/__tmp/test/zzz.accdb"); Statement s = conn.createStatement(); ResultSet rs = s.executeQuery("SELECT [LastName] FROM [Clients]"); while (rs.next()) { System.out.println(rs.getString(1)); } Disclosure At the time of writing this Q&A I had no involvement in or affiliation with the UCanAccess project; I just used it. I later became a contributor to the project.
has comment: http://stackoverflow.com/comment/40830126
has comment: http://stackoverflow.com/comment/57348003
has comment: http://stackoverflow.com/comment/44538442
has comment: http://stackoverflow.com/comment/35959106
has comment: http://stackoverflow.com/comment/71669998
score: 173
has comment: http://stackoverflow.com/comment/46651533
has comment: http://stackoverflow.com/comment/38640008
has comment: http://stackoverflow.com/comment/53805268
has comment: http://stackoverflow.com/comment/137771777
has comment: http://stackoverflow.com/comment/60163591
accepted answer of: http://stackoverflow.com/q/21955256
has comment: http://stackoverflow.com/comment/57349110
answers question: http://stackoverflow.com/q/21955256
has comment: http://stackoverflow.com/comment/33265006
has comment: http://stackoverflow.com/comment/47688021
has comment: http://stackoverflow.com/comment/123357189
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/137768582
has comment: http://stackoverflow.com/comment/54664309
has comment: http://stackoverflow.com/comment/52268655
has comment: http://stackoverflow.com/comment/40829772

http://stackoverflow.com/comment/114545417
score: 0
type: AnswerComment
has text: please try to explain what you did, and why it should be done like that, so people reading this will get what and why the code is like this. try add some comments or explanation
type: Comment
comment on: http://stackoverflow.com/a/64785340

http://stackoverflow.com/comment/33180742
score: 0
type: AnswerComment
has text: I know, I only write an example, I can also write a range in 09-F1, if you prefer. Thanks for the reply!
comment on: http://stackoverflow.com/a/21909003
type: Comment

layout-manager
tags question: http://stackoverflow.com/q/21898425
tags question: http://stackoverflow.com/q/22002085
tags question: http://stackoverflow.com/q/21948289
tags question: http://stackoverflow.com/q/21946267
tags question: http://stackoverflow.com/q/21988511
type: Tag
tags question: http://stackoverflow.com/q/21864729
tags question: http://stackoverflow.com/q/21996543
tags question: http://stackoverflow.com/q/21946950
tag name: layout-manager

http://stackoverflow.com/a/39043788
score: 6
type: Answer
upvote count: 15
has body: I have created a text class that renders text. It is written in java with LWJGL. Just do drawString("text", positionX, positionY, scale, width); package text; import org.lwjgl.opengl.GL11; public class Text { public static void drawString(String s, float x, float y, float scale, float width) { float startX = x; scale = scale * 0.25f; GL11.glLineWidth(width); GL11.glBegin(GL11.GL_LINES); GL11.glEnable(GL11.GL_LINE_WIDTH); GL11.glColor3f(1, 1, 1); boolean space = false; int charNum = 1, spaceNum = 0; for (char c : s.toLowerCase().toCharArray()) { switch(c){ case ' ': space = true; break; case '\n': y -= 2; startX -= charNum * (scale * 5); startX -= spaceNum * (scale * 3); spaceNum = 0; charNum = 0; break; case 'a': GL11.glVertex2f(scale * (startX - 0.5f), scale * y); GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + -1)); GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + -1)); GL11.glVertex2f(scale * startX, scale * (y + -1)); GL11.glVertex2f(scale * startX, scale * (y + -1)); GL11.glVertex2f(scale * startX, scale * y); GL11.glVertex2f(scale * startX, scale * y); GL11.glVertex2f(scale * (startX - 0.5f), scale * y); GL11.glVertex2f(scale * startX, scale * y); GL11.glVertex2f(scale * startX, scale * (y + 0.5f)); GL11.glVertex2f(scale * startX, scale * (y + 0.5f)); GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.5f)); break; case 'b': GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.8f)); GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1)); GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1)); GL11.glVertex2f(scale * (startX), scale * (y - 1)); GL11.glVertex2f(scale * (startX), scale * (y - 1)); GL11.glVertex2f(scale * (startX), scale * (y)); GL11.glVertex2f(scale * (startX), scale * (y)); GL11.glVertex2f(scale * (startX - 0.5f), scale * (y)); break; case 'd': GL11.glVertex2f(scale * startX, scale * (y - 1)); GL11.glVertex2f(scale * startX, scale * (y + 0.8f)); case 'c': GL11.glVertex2f(scale * startX, scale * y); GL11.glVertex2f(scale *…
downvote count: 9
has comment: http://stackoverflow.com/comment/73103895
answers question: http://stackoverflow.com/q/21960902
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21960902

http://stackoverflow.com/comment/33278150
comment on: http://stackoverflow.com/q/21963203
score: 0
type: Comment
type: QuestionComment
has text: What purpose are you trying to achieve...can you add what is the expected output ?

http://stackoverflow.com/q/21942546
has body: Im trying to validate a string that only allows letters, numbers and these characters : !"#$%&amp;'()*+,-./:;&lt;=&gt;?@[\]^_`{|}~ I tried doing this but its not working and allowing me to enter characters not in the regex. Im still pretty new to java and something similar was working in javascript but I cant figure out whats going on here. I think its running as if it cant find any of the characters mentioned then it will return four. Pattern allowedCharacters = Pattern.compile("[A-Za-z0-9!\"#$%&amp;'()*+,.\\/:;&lt;=&gt;?@[\\]^_`{|}~-]+$]"); if (!allowedCharacters.matcher(pw).find()){ return 4; } Any help is appreciated. Thanks EDIT: I also tried: if (pw.matches("^[A-Za-z0-9!\"#$%&amp;'()*+,.\\/:;&lt;=&gt;?@[\\]^_`{|}~-]+$]")){ return 4; } and if (!pw.matches("[A-Za-z0-9!\"#$%&amp;'()*+,.\\/:;&lt;=&gt;?@[\\]^_`{|}~-]+$]")){ return 4; }
accepted answer: http://stackoverflow.com/a/21942856
has comment: http://stackoverflow.com/comment/33240716
favorite count: 0
linked to: http://stackoverflow.com/q/21914179
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33243391
upvote count: 2
possible better answer: http://stackoverflow.com/a/21942661
type: Question
has answer: http://stackoverflow.com/a/21942661
tagged with: java
has answer: http://stackoverflow.com/a/43872934
has answer: http://stackoverflow.com/a/21942856
downvote count: 0
has comment: http://stackoverflow.com/comment/33240539
has comment: http://stackoverflow.com/comment/33243068
has title: Validate string has no illegal characters
answer count: 3
tagged with: regex

http://stackoverflow.com/comment/42025371
type: Comment
comment on: http://stackoverflow.com/a/21898426
has text: I am wondering if this might work: http://masl.cis.gvsu.edu/2012/01/31/java-client-for-appengine-channels/
score: 0
type: AnswerComment

http://stackoverflow.com/q/21961245
has title: Keep sprite on top and in view of screen
has answer: http://stackoverflow.com/a/21968186
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/21961523
tagged with: libgdx
tagged with: eclipse
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21961523
type: Question
has body: I have a sprite that the OrthographicCamera follows. I have a border, that comes into the screens view when the sprite comes close to it, obviously using the OrthographicCamera. My code for this is: float minCameraX = camera.zoom * (camera.viewportWidth / 2)-55; float maxCameraX = stageWidthHeight.x - minCameraX-80; float minCameraY = camera.zoom * (camera.viewportHeight / 2)-200; float maxCameraY = stageWidthHeight.y - minCameraY-250; // set the camera to either the player or the min/max of the camera based on player position camera.position.set( Math.min(maxCameraX, Math.max(playerSprite.getX(), minCameraX)), Math.min(maxCameraY, Math.max(playerSprite.getY(), minCameraY)), 0); spriteBatch.setProjectionMatrix(camera.combined); camera.update(); I also have another texture/sprite (scoreboard) that I want to always have at the bottom of the user's view, and on top of everything. How would I go about doing this? Here are some images for what I want to achieve.
answer count: 2
tagged with: android
possible better answer: http://stackoverflow.com/a/21968186

http://stackoverflow.com/comment/33351109
type: QuestionComment
comment on: http://stackoverflow.com/q/22004059
has text: Because they went to great lengths to make it concurrent? You can always synchronize it if you must.
score: 1
type: Comment

http://stackoverflow.com/comment/33093136
has text: then clear() array lists and add new ones
score: 0
comment on: http://stackoverflow.com/q/21859696
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21945661
has body: To expand, an out-of-bounds array exception means that you've tried to access an array index that isn't populated by a value. In this case, no data was passed in to args. You can set arguments in Eclipse or specify them when you run your program from the command line, etc.
score: 0
answers question: http://stackoverflow.com/q/21945598
type: Answer

http://stackoverflow.com/q/21962701
has answer: http://stackoverflow.com/a/21967923
type: UnansweredQuestion
upvote count: 4
downvote count: 0
has body: Some of our pages have 3rd party analytics running on the back end. It seems to me that selenium is waiting for those process to finish before going to the next step. The problem is that it takes around 5-6 minutes. Is there any way to aboard this wait and to move on to the next step? I tried clicking on the button (which takes user to the page that has some backend processes) with JavaScript click, that worked, but then it gets stuck on the next step. Thanks.
tagged with: java
tagged with: selenium
type: Question
tagged with: wait
score: 4
answer count: 2
has answer: http://stackoverflow.com/a/21964294
has comment: http://stackoverflow.com/comment/55473517
tagged with: load
favorite count: 0
has title: How to make Selenium WebDriver not to wait for complete load of the page

http://stackoverflow.com/a/21969605
type: Answer
has body: You could use just jdbcTemplate.batchUpdate. See an example here: http://www.mkyong.com/spring/spring-jdbctemplate-batchupdate-example/ This allows you to use different sql but still execute in batch. With preparedstatement you would have to group together all inserts with same date values and prepare different statements for each of those dates.
score: 0
answers question: http://stackoverflow.com/q/21969200

http://stackoverflow.com/q/21968327
tagged with: java
tagged with: unreachable-code
has body: Here the code: package com.example.appbsp; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.TextView; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; TextView textView1 = (TextView) findViewById(R.id.textView1); } } First I added a new TextView in activity_main.xml and gave it the Id: @+id/textView1 Then I entered this code in MainActivity.java for futher outputs: TextView textView1 = (TextView) findViewById(R.id.textView1); Then I imported android.widget.TextView but then the upper code becomes red underlined and it says unreachable code and just "remove" as quick fix. One month before it worked and now I don´t work anymore. Anyone knows an answer? (Target SDK:API 18; Compile with API 19) I´m a newbe so please try to give a not too complicated answer. Sorry for bad English. Thanks
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21968626
has answer: http://stackoverflow.com/a/21968626
score: 0
has answer: http://stackoverflow.com/a/21968618
tagged with: android
has title: TextView unreachable code
accepted answer: http://stackoverflow.com/a/21968618
type: AnsweredQuestion

http://stackoverflow.com/q/21996593
has comment: http://stackoverflow.com/comment/33337626
answer count: 1
has answer: http://stackoverflow.com/a/22000493
score: 0
linked to: http://stackoverflow.com/q/21910529
has title: Skinning a cat called int, improved
accepted answer: http://stackoverflow.com/a/22000493
has body: I have an Object which did represent an int. I need different, fantastic and obscure ways that Object can be used for an int param. I can only think of 5 variations to do this.. abstract void take(int i); void run(){ Object o = get(); take( /* VARIATIONS */ ); } VARIATIONS: o //Hope for the best (Integer)o //Casting New Integer(o.toString()) //Construct from string Integer.valueOf(o) //valueOf New Integer(String.valueOf(o)) //Sort of the same as #3 I'm aware of the multitude of exceptions that could be thrown, which is not a concern here. Edit Using reflection the value of field can be returned as an Object. I then need to use this value in param for a method. The assumption mal code makes with reflections is that the field type is always an int. When assumption is true: 1-5 work. When assumption is false &amp;&amp; Field type == String: 3+5 work, 1,2+4 fail. When assumption is false &amp;&amp; Field type == ArrayList&lt;Character&gt;: 1-5 fail. I need more variations to test. This continues my work discussed here. It was answered that robustness can not be added to combat all the different parsed field types. But now I need to test and gather results for which variations pass and fail. I'm asking for variations of ways to produce the param value which are not rehashes of 1-5 (e.g 3 &amp; 5 are a bit similar). From eltabo new BigDecimal(o.toString()).intValue() new BigInteger(o.toString()).intValue() new Double(o.toString()).intValue() new Float(o.toString()).intValue() Integer.parseInt(o.toString()) javax.swing.text.NumberFormat.getInstance().parse(o.toString()).intValue()
has comment: http://stackoverflow.com/comment/33340790
tagged with: integer
has comment: http://stackoverflow.com/comment/33341010
type: Question
tagged with: parameters
tagged with: object
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/33162192
has text: this is common uuid 00001101-0000-1000-8000-00805f9b34fb, what is this fa87c0d0-afac-11de-8a39-0800200c9a66, how you generated this id?
type: AnswerComment
comment on: http://stackoverflow.com/a/21856592
score: 0
type: Comment

http://stackoverflow.com/q/21967656
answer count: 2
possible better answer: http://stackoverflow.com/a/21986718
has answer: http://stackoverflow.com/a/21986718
has answer: http://stackoverflow.com/a/21967835
accepted answer: http://stackoverflow.com/a/21967835
type: AnsweredQuestion
tagged with: java
type: Question
has body: I have a server with two NICs and I need to specify which NIC must be used to to connect to a backend LDAP. I know that in Java the NICs can be specified when a socket is created (http://docs.oracle.com/javase/tutorial/networking/nifs/definition.html), but how can I do that using the JNDI/LDAP framework? Thanks
has title: Java LDAP with multiple network interface
tagged with: ldap
score: 0

http://stackoverflow.com/comment/33347208
has text: I've figured this out by simply adding: String word = dis.readLine();
type: AnswerComment
comment on: http://stackoverflow.com/a/22001821
type: Comment
score: 0

http://stackoverflow.com/q/21842492
tagged with: jframe
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21842512
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33063160
has title: Java: when calling repaint() on a JPanel, the components in the same JFrame redraw themselves in the top left corner
score: 0
accepted answer: http://stackoverflow.com/a/21842512
has body: I have a Graph class that extends JPanel. It gets repainted on mouseMoved. When this happens, basically any other component that was added to a layout (whether it be the same JPanel or a seperate JFrame) will get pained on the top left corner. I have a screen shot to go with the following code. If you look closely in the top left, there is a small textarea that is appearing. This will happen with any component. public class GUI extends JFrame { private JTextArea txtPoints = new JTextArea(20, 40); GUI() { setSize(800, 1000); setLayout(new MigLayout()); add(new Graph(), "wrap"); add(txtPoints); setVisible(true); } }
has comment: http://stackoverflow.com/comment/33063056
answer count: 1
tagged with: repaint

http://stackoverflow.com/a/21970981
has body: BigInteger has a toString() method, which gives a decimal string representation of the value.
score: 16
upvote count: 16
has comment: http://stackoverflow.com/comment/33292269
answers question: http://stackoverflow.com/q/21970944
has comment: http://stackoverflow.com/comment/33292167
downvote count: 0
has comment: http://stackoverflow.com/comment/33291805
has comment: http://stackoverflow.com/comment/33292479
has comment: http://stackoverflow.com/comment/33292062
type: Answer

jar
tags question: http://stackoverflow.com/q/21922634
tags question: http://stackoverflow.com/q/21878088
tags question: http://stackoverflow.com/q/21977139
tags question: http://stackoverflow.com/q/21987507
tags question: http://stackoverflow.com/q/21888219
tags question: http://stackoverflow.com/q/21950908
tags question: http://stackoverflow.com/q/21858301
tags question: http://stackoverflow.com/q/22000046
tags question: http://stackoverflow.com/q/21955007
tags question: http://stackoverflow.com/q/21886471
tags question: http://stackoverflow.com/q/21916750
tags question: http://stackoverflow.com/q/21858956
tags question: http://stackoverflow.com/q/21967251
tags question: http://stackoverflow.com/q/21921196
tags question: http://stackoverflow.com/q/21974596
type: Tag
tags question: http://stackoverflow.com/q/21928936
tags question: http://stackoverflow.com/q/21866830
tags question: http://stackoverflow.com/q/22001172
tags question: http://stackoverflow.com/q/21885764
tags question: http://stackoverflow.com/q/21919009
tags question: http://stackoverflow.com/q/21991429
tags question: http://stackoverflow.com/q/21953061
tags question: http://stackoverflow.com/q/21965180
tags question: http://stackoverflow.com/q/21987967
tags question: http://stackoverflow.com/q/21968104
tags question: http://stackoverflow.com/q/21919276
tag name: jar
tags question: http://stackoverflow.com/q/21907879
tags question: http://stackoverflow.com/q/21885450
tags question: http://stackoverflow.com/q/21999067
tags question: http://stackoverflow.com/q/21911052
tags question: http://stackoverflow.com/q/21912297
tags question: http://stackoverflow.com/q/21997003
tags question: http://stackoverflow.com/q/21931158
tags question: http://stackoverflow.com/q/21950483
tags question: http://stackoverflow.com/q/21873594
tags question: http://stackoverflow.com/q/21941252
tags question: http://stackoverflow.com/q/21952381
tags question: http://stackoverflow.com/q/21858573
tags question: http://stackoverflow.com/q/21892910
tags question: http://stackoverflow.com/q/21971218
tags question: http://stackoverflow.com/q/21977528
tags question: http://stackoverflow.com/q/21861542
tags question: http://stackoverflow.com/q/21991732

http://stackoverflow.com/comment/33169751
has text: If this does not help, please inform.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21902641

http://stackoverflow.com/a/21950713
answers question: http://stackoverflow.com/q/21950684
has comment: http://stackoverflow.com/comment/33255674
has comment: http://stackoverflow.com/comment/33255636
type: Answer
has comment: http://stackoverflow.com/comment/33255627
has comment: http://stackoverflow.com/comment/33255616
has body: That statement will throw a NullPointerException if and only if a is null. (It is possible that an NPE exception could be thrown within the call to the b method ... but the stack trace would show clearly that the NPE is being thrown in a different statement to this one.)
score: 4
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/21844058
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33065291
accepted answer: http://stackoverflow.com/a/21844089
has comment: http://stackoverflow.com/comment/33065311
has answer: http://stackoverflow.com/a/21844089
type: AnsweredQuestion
tagged with: oop
has comment: http://stackoverflow.com/comment/33065330
tagged with: java
type: Question
has title: How to access a typecasted object's method directly?
tagged with: casting
has body: This looks like a basic object oriented problem, but I was coming from Pascal / Delphi background, and I can't find the similar method to get the same result in Java. In Pascal/Delphi, I can change something like this (this is not entirely correct, but just to give you an illustration): var a: TButton; b: string; begin a := TButton(getObject(request)); b := a.caption; end; into this: var b: string; begin b := TButton(getObject(request)).caption; end; But how to achieve the same solution in Java? how to change: Button a; String b; a = (Button) getObject(request); b = a.caption; into String b; b = (Button) getObject(request).caption; or something like that? The point is, I want to eliminate the need of declaring temporary variable to hold an object, if what I want is just to take another value (or object) inside that object. But the problem is, the object need to be typecasted first because all I receive is just a general Object from the getObject() function. Thanks for your help.
has comment: http://stackoverflow.com/comment/33065347

http://stackoverflow.com/q/21902873
tagged with: maven-plugin
upvote count: 9
tagged with: nexus
has title: automate deployment to sonatype's oss maven repository
accepted answer: http://stackoverflow.com/a/21904327
tagged with: maven
has body: I've got several github java projects. One of them I've manually deployed to sonatype's repository so that it gets published in maven central. This has been a somewhat painful process in the sense that it seems to involve too many hoops to jump through and a lot of manual work and I'd like to automate that. So I actually stopped doing that because it was just too much work. There's plenty of documentation that suggests this is possible and quite a bit that suggest that it somehow involves doing something with the nexus-staging-maven-plugin. Unfortunately all of that documentation is (in typical maven style) skipping over the essential details that would allow me to figure out in a straightforward way the minimum amount of steps necessary that allow me to automatically publish release builds to the sonatype repository (i.e. without me manually approving things). So, what is the blurb that needs to be present in my pom (assume a otherwise bog standard uncomplicated java project), including urls for the sonatype repository, all documentation I've found seems to insist localhost:8081 is it, and the required maven incantations to make it do a release (preferably via the mvn release plugin), have it sign the artifacts, and have it deploy the resulting artifacts to sonatype, approved and all ready to be synced to maven central, etc. So, I'm sort of looking for the maven replacement of a "gem push" in the ruby world, which gets the job done in a convenient one liner. It's a simple case of given a jar file approved by me, how do I get it to end up in maven central with the least amount of fuss. I'd very much appreciate some examples of pom files already setup to do this that I can copy and adapt. Edit: Here's my working pom file: 4.0.0 com.jillesvangurp jsonj 1.34-SNAPSHOT JsonJ A framework for working with json in Java the "proper" way. No mappings or model classes, it's all just lovely json, but in Java. https://github.com/jillesvangurp/jsonj MIT license https://github.com…
tagged with: sonatype
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/21904327
score: 9
type: Question
answer count: 2
favorite count: 0
possible better answer: http://stackoverflow.com/a/28999786
has answer: http://stackoverflow.com/a/28999786

http://stackoverflow.com/a/21921524
has comment: http://stackoverflow.com/comment/33216435
score: 0
has comment: http://stackoverflow.com/comment/33206571
type: Answer
has body: Concerning this part: When I compile project2, all the class files from project1 should be copied to project2 This is actually not the case, maven compiles the two projects into two separate jars if the projects are of jar type, or copies project1.jar into WEB-INF/lib of project2 if project 2 is of type WAR. The difference between the two class files shows that the version of project2 does not have the Roo aspects applied to it, although it was compiled with AspectJ as well. Try to build the project from the command line only by closing all IDEs and compare the two versions to see if the same problem remains. It could be that your IDE is compiling the class with aspectJ but without the correct Roo aspects. Also have a look at this report on having to add the aspectj plugin on both the dependent and the depending project, and this documentation on 3.7.2.2. Limitations on Roo multi-module maven support.
answers question: http://stackoverflow.com/q/21916962

http://stackoverflow.com/a/21855260
type: Answer
answers question: http://stackoverflow.com/q/21855191
accepted answer of: http://stackoverflow.com/q/21855191
score: 5
type: AcceptedAnswer
downvote count: 0
has body: Simply add a ^ in front of your regex and a $ at the end, so it isn't allowed to start/end with a space anymore: ^[a-zA-Z0-9!#\$%\&amp;'\*\+\-/\=\?\^_`\{\|\}~]+(\.[a-zA-Z0-9!#\$%\&amp;'\*\+\-/\=\?\^_`\{\|\}~]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$ ^and $ denote the start and end of the input.
upvote count: 5

http://stackoverflow.com/comment/33114786
has text: [For loop](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html)
comment on: http://stackoverflow.com/q/21871881
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/a/40458451
upvote count: 2
answers question: http://stackoverflow.com/q/21934310
has comment: http://stackoverflow.com/comment/110670316
type: Answer
has comment: http://stackoverflow.com/comment/110671774
downvote count: 0
score: 2
has body: Considering you have a SYS_REFCURSOR OUT parameter: CREATE OR REPLACE PROCEDURE post_comments ( postId IN NUMBER, postComments OUT SYS_REFCURSOR ) AS BEGIN OPEN postComments FOR SELECT * FROM post_comment WHERE post_id = postId; END; You can call the stored procedure like this: StoredProcedureQuery query = entityManager .createStoredProcedureQuery("post_comments") .registerStoredProcedureParameter(1, Long.class, ParameterMode.IN) .registerStoredProcedureParameter(2, Class.class, ParameterMode.REF_CURSOR) .setParameter(1, 1L); query.execute(); List<Object[]> postComments = query.getResultList();

http://stackoverflow.com/q/21975152
favorite count: 0
tagged with: spring
tagged with: logging
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21981843
upvote count: 2
tagged with: java
type: Question
has title: Logging in Spring initialization
accepted answer: http://stackoverflow.com/a/21981843
score: 2
answer count: 1
downvote count: 0
has body: I am initializing Spring in a web application using the ContextLoaderListener in web.xml. While initializing the context I see only [INFO] messages. How can I enable [DEBUG]? The web app uses logback which is properly configured with [DEBUG] enabled in the root looger.

http://stackoverflow.com/a/21967424
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21967386
has body: Volatile keyword hints about a variable to be accessed from different threads. volatile int a; You need to access using synchronized keyword to make a body(or a method) a thread-safe around the variable. // in thread 1 sycnhronized(lockedItem) { a++; // just a++ alone may not be tread-safe because being non-atomic } // in thread 2 sycnhronized(lockedItem) { a--; // just a-- alone may not be tread-safe because being non-atomic }
type: Answer

hive
tags question: http://stackoverflow.com/q/21873050
tags question: http://stackoverflow.com/q/21915054
type: Tag
tag name: hive

http://stackoverflow.com/q/21953465
upvote count: 3
has title: com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found
tagged with: java
has answer: http://stackoverflow.com/a/21953653
has comment: http://stackoverflow.com/comment/33260392
has comment: http://stackoverflow.com/comment/33260333
type: Question
possible better answer: http://stackoverflow.com/a/21953643
score: 3
has body: I am getting the following exception when I am deploying my APP of Google App Engine server with Objectify, although I have already configured all the indexes of my application. Still didn't understand why I am getting this exception, due to this error, I am not able to do anything on this web application. Exception in Production Server /search com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found. The suggested index for this query is: <property name="cityName" direction="asc"/> <property name="updatedOn" direction="asc"/> datastore.indexes.xml <?xml version="1.0" encoding="UTF-8"?> <property name="countryCode" direction="asc" /> <property name="countryName" direction="asc" /> <property name="active" direction="asc" /> <property name="countryCode" direction="asc" /> <property name="cityName" direction="asc" /> <property name="cityCode" direction="asc" /> <property name="active" direction="asc" /> <property name="cityName" direction="asc" /> <property name="supplierUserName" direction="asc" /> <property name="updatedOn" direction="asc" /> <property name="active" direction="asc" /> <property name="countryName" direction="asc" /> Datastore index image snapshot from production server
answer count: 2
accepted answer: http://stackoverflow.com/a/21953653
downvote count: 0
favorite count: 0
tagged with: objectify
has comment: http://stackoverflow.com/comment/33260465
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/33260358
linked to: http://stackoverflow.com/q/5115270
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21953643

http://stackoverflow.com/comment/33251310
comment on: http://stackoverflow.com/a/21947610
has text: All the stuff about how the code is compiled to bytecodes and translated to dex, etcetera is an *implementation detail* and *irrelevant*. The correct answer is this is the Java language, and Java's short-circuiting semantics are *specified* by the JLS. The JLS does not permit platform specific behaviour for this kind of thing.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21898743
score: 2
accepted answer of: http://stackoverflow.com/q/21894813
upvote count: 2
answers question: http://stackoverflow.com/q/21894813
has body: You can change your method to return a String which will be interpreted as the next navigation outcome. public String markSectionOne() { // ... unrelevant code return "/lecturer/marking/marking-section-two"; } If the method returns null, then JSF will stay on the same page.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33176138

http://stackoverflow.com/q/21863685
has answer: http://stackoverflow.com/a/21864008
favorite count: 0
tagged with: colors
has answer: http://stackoverflow.com/a/21863833
has answer: http://stackoverflow.com/a/21863798
accepted answer: http://stackoverflow.com/a/21863798
answer count: 4
has body: I am trying to write a method of following logic: I've got 3 integers, r, g and b. at the beginning: r = 255; g = 0; b = 0; now as you can see, r is 255, now g should rise one by one until it reaches 255, too r = 255; g = 255; b = 0; All three integers together asseble a color. First one was red, now it's yellow. Not it should turn green, so r should decrease until only g is 255: r = 0; g = 255; b = 0; Next color should be cyan, and so on. This is the order: red - yellow - green - cyan - blue - violet - red --> and from beginning. I've tried to achieve this by using if-methods: e.g.: if(r == 255 &amp;&amp; g == 0) g++; etc. , but i realized this is going to be long and complicated. Does anybody has another idea of how to cycle through colors? My goal is to change the color of a square object on each update: public void update() { --&gt;color change code here&lt;-- color = new Color(r, g, b, alpha); } so every time the update method is called (all 5 ms), the code gets called. Any ideas?
downvote count: 0
possible better answer: http://stackoverflow.com/a/21864060
tagged with: cycle
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21864060
tagged with: algorithm
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33100117
type: Question
upvote count: 1
has title: Going through all colors in java

http://stackoverflow.com/q/21995818
has comment: http://stackoverflow.com/comment/40032785
tagged with: jersey
has body: i've got a big problem by using a REST setup. Returning of complex types is working fine, but i'm not able to return primitive types: @GET @Path("/testbool") @Produces(MediaType.APPLICATION_XML) public Boolean testbool(){ return false; } @GET @Path("/testbool") @Produces(MediaType.APPLICATION_XML) public boolean testbool(){ return false; } doesn't work, because i get an exception: Caused by: com.sun.jersey.api.MessageException: A message body writer for Java class java.lang.Boolean, and Java type class java.lang.Boolean, and MIME media type application/xml was not found is there an easy way to fix this? - i already googled for it, but i was not able to find an easy solution without writing a wrapper or implementing the bodywriter by myself... But i cannot imagine that such a simple thing isn't included.. thanks for your help!
score: 4
has title: Jersey boolean as return value, how?
linked to: http://stackoverflow.com/q/2629544
downvote count: 0
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has comment: http://stackoverflow.com/comment/33336861
tagged with: rest
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33336333
answer count: 0
tagged with: java
tagged with: primitive
type: Question
upvote count: 4

http://stackoverflow.com/a/21955549
answers question: http://stackoverflow.com/q/21955529
type: Answer
has body: The singleton pattern should suit your needs. This basically is a class that can only be instantiated once and manages that instance itself, so you can get it from anywhere. A tutorial like this will help you get started: http://portabledroid.wordpress.com/2012/05/04/singletons-in-android/
score: 0

http://stackoverflow.com/a/21984264
has comment: http://stackoverflow.com/comment/87457411
has comment: http://stackoverflow.com/comment/87458004
has comment: http://stackoverflow.com/comment/87456954
answers question: http://stackoverflow.com/q/21966778
has comment: http://stackoverflow.com/comment/48529402
downvote count: 0
has comment: http://stackoverflow.com/comment/87451423
has comment: http://stackoverflow.com/comment/87444456
has comment: http://stackoverflow.com/comment/87457892
type: Answer
has body: (Answering my own question) It seems fge's answer is correct, and the Guava Cache cannot be iterated according to the order of insertion. As a workaround, I used the previously noted ConcurrentLinkedHashMap, which is less feature rich, but allows for ordered iteration. I'd still appreciate an official answer from someone on the Guava team since this seems to indicate that the ConcurrentLinkedHashMap is not fully integrated into Guava (contrary to the ConcurrentLinkedHashMap documentation)
score: 2
has comment: http://stackoverflow.com/comment/33345576
upvote count: 2
has comment: http://stackoverflow.com/comment/87457275
has comment: http://stackoverflow.com/comment/87456881
has comment: http://stackoverflow.com/comment/33385890

http://stackoverflow.com/comment/33130423
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21880053
has text: .//td[contains(text(),'CCC')][1] part1: you suggested working fine, but i think the problem with the second part of the code /preceding-sibling::td -- full merged code: [code].//td[contains(text(),'CCC')][1]/preceding-sibling::td [/code]
type: AnswerComment

http://stackoverflow.com/comment/33081390
type: QuestionComment
has text: 1st Question is Can we catch error in catch block or not ?
score: 0
comment on: http://stackoverflow.com/q/21853439
type: Comment

http://stackoverflow.com/q/21872701
answer count: 1
has body: Java: I have implemented my own version of a Binary Heap. It should be able to store any type of Comparable object. The objects that are inserted into the heap come from input data, and all the input data will be of the same type. Is there a way to tell what Object type a given input is? I'm using BufferedReader in = new BufferedReader(new InputStreamReader(System.in)) to read the inputs, and in.readLine() always returns a String. Right now, I'm explicitly testing to see if the user inputs an Integer, otherwise the object is always stored as a String. What is the best way to read an input, see what type it is and then create a BinaryHeap&lt;T&gt; of that type, to then insert properly?
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/33129137
score: 0
has answer: http://stackoverflow.com/a/27139425
type: UnansweredQuestion
tagged with: binary-heap
tagged with: input
tagged with: java
tagged with: comparable
type: Question
has title: How to store any type of comparable object in a Binary Heap

http://stackoverflow.com/comment/33319592
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21983463
has text: @smttsp How do you try to dispose the images? And what does `linear_list` contain?
score: 0

http://stackoverflow.com/comment/33098554
has text: @JasonP: it is clearer now what you wanted to say. Yes, you're right, in case of a longer AJAX call setInterval might have some issues - i mentioned it as a simplification.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21862639
score: 0

http://stackoverflow.com/comment/33151962
comment on: http://stackoverflow.com/q/21891125
score: 0
type: Comment
has text: src/META-INF is not valid at runtime, it should be the META-INF of the jar that is added to the WEB-INF/lib. But the error message indicates that your config file is found. Which means may be either the EclipseLink jars are missing or the config file that the JPA is reading is out of date.
type: QuestionComment

http://stackoverflow.com/q/21996252
has comment: http://stackoverflow.com/comment/33336674
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/33336969
favorite count: 0
type: UnansweredQuestion
tagged with: port
tagged with: jetty
has answer: http://stackoverflow.com/a/21996375
has title: Getting error message "Server port In Use 8080-Http" when running servlet on jetty
downvote count: 0
score: 1
tagged with: java
type: Question
has body: Trying to run a servlet with jetty and I'm getting the error message "Server port In Use 8080-Http". I assume we can just change the port, but I have no clue how.
has comment: http://stackoverflow.com/comment/33337018
linked to: http://stackoverflow.com/q/11652058

http://stackoverflow.com/comment/90074332
score: 0
type: Comment
comment on: http://stackoverflow.com/a/51553422
type: AnswerComment
has text: You should also consider adding a brief description to your code to explain what it does.

http://stackoverflow.com/comment/33238120
type: AnswerComment
has text: More info about licensing issue with iText 2.1.7 with XDocReport available here : https://code.google.com/p/xdocreport/wiki/WhichLicenseApplies
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21893290

http://stackoverflow.com/comment/33268040
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21856733
has text: @Qui Exception in thread "main" java.lang.StackOverflowError
score: 0

http://stackoverflow.com/comment/33273564
type: QuestionComment
comment on: http://stackoverflow.com/q/21960420
score: 0
has text: Using a hash table will probably be faster than quickselect though
type: Comment

http://stackoverflow.com/comment/33211687
score: 0
type: Comment
type: QuestionComment
has text: Which programming language are you using? Add it in the tag list of your question will attract more posible answers.
comment on: http://stackoverflow.com/q/21926014

http://stackoverflow.com/comment/33098582
comment on: http://stackoverflow.com/a/21862915
score: 0
type: AnswerComment
type: Comment
has text: id is the rowid of the newly inserted record. `counter` is the number of wins, just replace it with your variable.

http://stackoverflow.com/comment/33162538
type: Comment
has text: Catching generic exceptions can be harmful and many a man-hour have been wasted tracking done errors due to this. If this answer was for a experienced programmer I would not have picked up on it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21898191

http://stackoverflow.com/a/22221520
answers question: http://stackoverflow.com/q/21938857
has body: Your MapBean is not recognized in the jsf page. For it to be recognized, use @Named. So your bean should be as below. import org.primefaces.model.map.DefaultMapModel; import org.primefaces.model.map.LatLng; import org.primefaces.model.map.MapModel; import org.primefaces.model.map.Marker; import javax.inject.Named @Named public class MapBean implements Serializable { private MapModel simpleModel; ......
score: 0
type: Answer

http://stackoverflow.com/q/21927744
type: UnansweredQuestion
tagged with: cxf
tagged with: web-services
type: Question
tagged with: java
has title: compress base 64 png image in java
score: 0
has body: Hi I would like to know if there is any way in Java to reduce the size of an image.Actually My front end is IOS,they are sending Base 64 encode data and when i'm getting the encoded data and i'm decoding the encoded data and storing in byte array. and now i want to compress the PNG image in java and my method code something like public String processFile(String strImageBase64, String strImageName,String donorId) { FileOutputStream fos =null; File savedFile=null; try { String FileItemRefPath = propsFPCConfig.getProperty("fileCreationReferencePath"); String imageURLReferncePath = propsFPCConfig.getProperty("imageURLReferncePath"); File f = new File(FileItemRefPath+"\\"+"productimages"+"\\"+donorId); String strException = "Actual File "+f.getName(); if(!f.exists()) { boolean isdirCreationStatus = f.mkdir(); } String strDateTobeAppended = new SimpleDateFormat("yyyyMMddhhmm").format(new Date(0)); String fileName = strImageName+strDateTobeAppended; savedFile = new File(f.getAbsolutePath()+"\\"+fileName); strException=strException+" savedFile "+savedFile.getName(); Base64 decoder = new Base64(); byte[] decodedBytes = decoder.decode(strImageBase64); if( (decodedBytes != null) &amp;&amp; (decodedBytes.length != 0) ) { System.out.println("Decoded bytes length:"+decodedBytes.length); fos = new FileOutputStream(savedFile); System.out.println(new String(decodedBytes) + "\n") ; int x=0; { fos.write(decodedBytes, 0, decodedBytes.length); } fos.flush(); } //System.out.println(savedFile.getCanonicalPath() +" savedFile.getCanonicalPath() "); if(fos != null) { fos.close(); return savedFile.getAbsolutePath(); } else { return null; } } catch(Exception e) { e.printStackTrace(); } finally { try { if( fos!= null) { fos.close(); } else { savedFile = null; } } catch (IOException e) { e.printStackTrace(); } } return savedFile.getName(); } and i'm storing this decoded data with imagename,now i want to store this compressed image in anothe url
has answer: http://stackoverflow.com/a/21927901
answer count: 1
tagged with: tomcat

http://stackoverflow.com/comment/33228691
has text: Do I need do add some config in ejb-jar.xml or ibm-ejb-jar-bnd.xml?
comment on: http://stackoverflow.com/q/21934427
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21871817
answers question: http://stackoverflow.com/q/21871639
downvote count: 0
has comment: http://stackoverflow.com/comment/33115753
upvote count: 2
has body: Maybe not directly related but perhaps you can structure the 25 into groups? group1(){ return method1() &amp;&amp; method2...... method7(); } .. ... .. if (group1() &amp;&amp; group2() &amp;&amp; group3()){ }else{ } This would make the code easier to read (as long as you name the groups well. This is of course if the methods fit into this style, don't force it. To blatantly steal an example from a different answer, this can be a group example IsUserValid(){ return IsNameValid() &amp;&amp; IsAddressValid() &amp;&amp; IsPhoneNumberValid()..... }
type: Answer
score: 2

http://stackoverflow.com/comment/101328461
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21996880
has text: @pveentjer I tried to delete million entries from Imap using Predicate based condition:IMap.executeOnEntries(new DeleteMillionsEntryProcessor(), predicate).This deleted entries from IMap as verified on mancenter map count. But, the exact number of deleted entries was shown up under "Hits". Is it because deletion via EntryProcessor refers to accessing the record and nullifying it. Also, is there a way to run GC manually as the millions of unreferenced objects result in my heap threshold reaching 70% and my application breaking down.

http://stackoverflow.com/a/21898348
score: 2
downvote count: 0
upvote count: 2
has body: hi you are using GPS PROVIDER which can take some time as it depends on several constraints like yours building position, physical position, weather as gps data is available from the satellite so use a network provider which may faster in yours case please have a look on the given code snippet at http://www.androidhive.info/2012/07/android-gps-location-manager-tutorial/
answers question: http://stackoverflow.com/q/21898272
type: Answer

http://stackoverflow.com/comment/33086681
type: Comment
comment on: http://stackoverflow.com/q/21856531
type: QuestionComment
has text: ALTER is a **reserved keyword**
score: 0

http://stackoverflow.com/comment/33113812
comment on: http://stackoverflow.com/a/21871209
type: Comment
score: 0
type: AnswerComment
has text: @Broseph In that case, the suggestion by Brian is an excellent one, you should take the time to have a read through the [Collections](http://docs.oracle.com/javase/tutorial/collections/) tutorial - +1 to Brian

http://stackoverflow.com/comment/33136091
has text: The error message says your assumption is not correct: it's not a int[454][454] if the message says length=452
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21883822
type: QuestionComment

http://stackoverflow.com/comment/33205330
comment on: http://stackoverflow.com/q/21922354
has text: how is 3-2-3 not a "duplicate" in your first example? It's a little unclear what you're asking.
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/comment/33119146
type: Comment
comment on: http://stackoverflow.com/a/21868324
has text: your solution looks fine, but it feels like a weird requirement: so the user sorts and sees _different_ content? My-oh-my ... smells like a bad user experience, @Rated
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33204907
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21922082
type: Comment
has text: what language? That should be in the tags the ones you have are not helpful

http://stackoverflow.com/comment/33326365
type: Comment
comment on: http://stackoverflow.com/a/21989528
has text: how to register that custom (de) serializer on JERSEY?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33154590
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21892900
type: Comment
has text: Out of topic but the main problem with `Vector` is that most of its methods are synchronized, so it will introduce some overhead even when no synchronization is needed. When you don't need a thread-safe collection go with `ArrayList` (BTW, this is clearly stated on [Vector Javadocs](http://docs.oracle.com/javase/7/docs/api/java/util/Vector.html))

http://stackoverflow.com/comment/33328335
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21990667
score: 0
has text: Service is a component of android and you need to define it in Androidmenifest.xml and service has its lifecycle you need to manage it. Rather then creating service an abstract class, you should create a simple class for sensor, in service use collection of sensors and use AIDL to modify/interact with sensors or what ever you want to do with your custom sensor.

http://stackoverflow.com/comment/33263022
type: QuestionComment
has text: i am really stupid.thanks both of you
score: 0
comment on: http://stackoverflow.com/q/21954902
type: Comment

http://stackoverflow.com/comment/33255118
comment on: http://stackoverflow.com/a/21950260
has text: @AwfullyAwesome: That's right but I feel like import statements should be included regardless. Doesn't make a difference in this case.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21847017
tagged with: android-4.2-jelly-bean
has answer: http://stackoverflow.com/a/21849129
type: Question
has title: Writing to logfile does not work with Android 4.2 Jelly Bean
has comment: http://stackoverflow.com/comment/33072097
has comment: http://stackoverflow.com/comment/33070165
downvote count: 0
has comment: http://stackoverflow.com/comment/33103660
answer count: 2
tagged with: android
favorite count: 0
has body: I am trying to integrate some code for a school project that takes sensor values received over bluetooth and write them to a comma separated data log file. I can not get a simple example of the file writing functionality running on Jelly Bean after trying dozens of examples. The code works perfectly fine on my personal device running android 4.0.2. I am trying to run the following example on a motorolla xt1060, and although there is no removable sd card, my understanding is that this does not preclude the use of external storage. I've used both linux with MTPFS and windows with the default drivers to look for the file anywhere on the file-system but it has never shown itself. I can see text files when I create them with the MTPFS mounted via terminal and when I take pictures so I don't think MTP is causing the problem. Here is the most simple java example I've written that works on 4.0 and not 4.2: import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import android.app.Activity; import android.os.Bundle; import android.os.Environment; import android.util.Log; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); path.mkdirs(); File file = new File(path, "test.txt"); Log.d("FILE_TEST", file.getPath()); try { Log.d("FILE_TEST", "Creating buffer"); BufferedWriter buf = new BufferedWriter(new FileWriter(file)); Log.d("FILE_TEST", "Writing to buffer"); buf.write("Hello FS!\n"); Log.d("FILE_TEST", "Flushing buffer"); buf.flush(); Log.d("FILE_TEST", "Closing file"); buf.close(); } catch (IOException e) { Log.d("FILE_TEST","Caught Exception:" + e.toString()); } } } The manifest xml contains the following: &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt; And nothing exciting I can see happens in the log: 02-18 00:…
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/18292694
upvote count: 1
has comment: http://stackoverflow.com/comment/33109738
has answer: http://stackoverflow.com/a/21865485
score: 1
tagged with: java
tagged with: filewriter

http://stackoverflow.com/comment/91960746
comment on: http://stackoverflow.com/a/37349751
score: 0
has text: Hi, I had something like this - `MainActivity activity = Robolectric.buildActivity(MainActivity.class).create().start().get();` and if I change `start()` to `visible()`, I get stackoverflow exception. Any idea what could be causing the issue?
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/33234492
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21937865
has text: Push is definitely the correct option, but I think it requires you have BlackBerry Data plan on your BB7 device (not so for BB10 I believe). But there are cross platform chat applications already available for the BB. Are you sure you are not just "recreating the wheel"?
score: 0

http://stackoverflow.com/a/21977944
has comment: http://stackoverflow.com/comment/33386163
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/21974050
score: 2
has body: Try to use : eclipse-scripts plugin grails install-plugin eclipse-scripts
downvote count: 0

http://stackoverflow.com/comment/33242130
score: 0
comment on: http://stackoverflow.com/q/21942861
type: Comment
type: QuestionComment
has text: i guess i am way too tired , now i get you ,thanks its done <3

http://stackoverflow.com/q/21996637
has answer: http://stackoverflow.com/a/21998519
answer count: 3
possible better answer: http://stackoverflow.com/a/21996774
tagged with: matrix
has answer: http://stackoverflow.com/a/21996774
has answer: http://stackoverflow.com/a/21996837
has title: method to do in place reversal of columns in a 2D array in Java
has comment: http://stackoverflow.com/comment/33337798
accepted answer: http://stackoverflow.com/a/21998519
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
tagged with: arrays
has body: The problem is given a 2D array write a method to reversal of columns. If possible, do it in-place I have implemented and it works fine.but it is not in-place.It uses auxillary storage, is it possible to reverse columns of a 2D array without using matrix. Here is my code: public static int[][] reverseColumns(int[][] matrix){ int rows=matrix.length; int cols=matrix[0].length; int temp=0; int[][] result= new int[rows][cols]; for (int row=rows-1; row &gt;=0; row--){ for (int col=0;col&lt;cols;col++){ result[row][col]=matrix[temp][col]; } temp++; } return result; } public static void print2DArray(int[][] result){ for (int i=0; i &lt; result.length;i++){ System.out.println(Arrays.toString(result[i])); } } public static void main(String[] args) { int[][] matrix = { {1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13,14,15,16} int[][] result = reverseColumns(matrix); print2DArray(result); System.out.println() }; output is : [13, 14, 15, 16] [9, 10, 11, 12] [5, 6, 7, 8] [1, 2, 3, 4]

http://stackoverflow.com/comment/33173638
score: 0
has text: yes @jyotisman. But my next question would be why marker interface why not have custom annotation then?
type: Comment
comment on: http://stackoverflow.com/a/21903825
type: AnswerComment

http://stackoverflow.com/q/21984562
tagged with: java
has answer: http://stackoverflow.com/a/21985029
tagged with: eclipse
answer count: 1
tagged with: eclipse-plugin
tagged with: eclipse-rcp
has body: Suppose I have an API method which is intended to perform long-term operation and which therefore receives monitor as a parameter, like in org.eclipse.ui.part.EditorPart.doSave(IProgressMonitor monitor) If I had single operation to do in this method, I would code, for instance, to write an image imageFile.create(imageInput, false, monitor); But what if I do SEVERAL long-term sub-routines inside single doSave? How to make that monitor measures each with 50% or something? imageFile.create(imageInput, false, monitor); descriptionFile.create(descriptionInput, false, monitor);
accepted answer: http://stackoverflow.com/a/21985029
has title: How to pass through the progress monitor to several subroutines?
type: AnsweredQuestion
tagged with: progressmonitor
score: 0
type: Question

http://stackoverflow.com/comment/33140918
score: 0
comment on: http://stackoverflow.com/q/21879672
type: Comment
type: QuestionComment
has text: tell me what you want to do this validation ?

http://stackoverflow.com/comment/33100607
type: Comment
comment on: http://stackoverflow.com/a/21852581
has text: Ok maybe my question was unclear : The list of Elements contain : text, Element, text, Element etc. But I want only the element, element, element so I can delete the correct . Is there a way to filter away the text?
type: AnswerComment
score: 0

http://stackoverflow.com/q/21946466
has title: Remove sine wave sound from wave file
has comment: http://stackoverflow.com/comment/33248034
answer count: 1
tagged with: javasound
tagged with: audio
type: UnansweredQuestion
tagged with: java
has body: Basically I have one wave file that as some audio messages mixed with a loud beep, that I suspected is a sine wave sound generated. My questions are: It's possible to remove this beep, or somehow filter it using java? I already tried applying some low level and high level filters, but with no sucess...
has answer: http://stackoverflow.com/a/21947039
type: Question
has comment: http://stackoverflow.com/comment/33254148
score: 0

http://stackoverflow.com/q/21874544
has comment: http://stackoverflow.com/comment/33119891
tagged with: gwt
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/21874649
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/33120411
has comment: http://stackoverflow.com/comment/33119722
has title: Parent Class method is getting called before child class method
has body: I am facing a problem something like shadowing in Java. I have the following code: public abstract class AsyncCallback&lt;T&gt; implements com.google.gwt.user.client.rpc.AsyncCallback&lt;T&gt;{ @Override public void onFailure(Throwable caught){ try{ throw caught; }catch(){ }//various catch blocks . . catch(Throwable e){ onError(); } } public void onError() { //print something } abstract public void retry(); } now I call a rpc call with the following syntax: rpc.callAnyMethod(param, new AsyncCallback&lt;SomeClass&gt;(){ @Override public void onSuccess(SomeClass class) { setSomeClass(class); } @Override public void onFailure(Throwable caught) { try { throw caught; } catch (ClientException e) { if (e.getMessage().equals(sometoken)) { //redirect to a link } } catch (Throwable e) { retry(); } } @Override public void retry() { //call the method again. } }); But the problem is that the method in the parent class XYZ is printing from onError() function first and then redirecting to the link i want. Any help would be appreciated.
has comment: http://stackoverflow.com/comment/33120311
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33120149
type: Question
has comment: http://stackoverflow.com/comment/33120537

http://stackoverflow.com/comment/33343587
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21998591
score: 0
has text: Is the code correct? I do not know if I misunderstood the problem, but for A = int[]{10,10,1,2} the expected result is 3 but 1 is found.

http://stackoverflow.com/a/28547883
type: Answer
answers question: http://stackoverflow.com/q/21937644
has body: There is a free command line tool for transforming files with special characters in text to valid XML. It also assures that the file encoding matches what is specified in the declaration. There is also a Java developer suite that allows you to use the parser to parse such files (called XPL) as an alternative to XML or a pre-process into XML. It uses a StAX-like process called StAX-PL.
score: 0

http://stackoverflow.com/a/76778275
has body: Run /usr/libexec/java_home -V you will get all the java version that you have Example:- Matching Java Virtual Machines (3): 17.0.7 (x86_64) "Amazon.com Inc." - "Amazon Corretto 17" /Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home 11.0.19 (x86_64) "Amazon.com Inc." - "Amazon Corretto 11" /Users/abhishek.khaiwale/Library/Java/JavaVirtualMachines/corretto-11.0.19/Contents/Home 11.0.19 (x86_64) "Amazon.com Inc." - "Amazon Corretto 11" /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home If you need java version 11.0.19 Run export JAVA_HOME=`/usr/libexec/java_home -v 11.0.19` Youtube Video Link
downvote count: 1
score: 21
upvote count: 22
answers question: http://stackoverflow.com/q/21964709
has comment: http://stackoverflow.com/comment/135356560
type: Answer
has comment: http://stackoverflow.com/comment/135423835

http://stackoverflow.com/a/21982673
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21982619
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21982619
has body: Use a Hashmap, as it does not allow duplicates and will replace the original key with the new one. HashMap hm = new HashMap(); hm.put (U_ID, new user(Name, U_ID, Pass));

http://stackoverflow.com/q/21881802
tagged with: java
has comment: http://stackoverflow.com/comment/33180258
type: Question
has answer: http://stackoverflow.com/a/21881923
has comment: http://stackoverflow.com/comment/33177156
has body: My requirement is as below: In our application the user's credentials are validated against the database(not using spring security since it is a legacy application) for the first time. If the user is a valid user, he will be logged into the application. Once the user logs into the application he can make few rest calls. Now, I want to once again validate the user's credentials by using spring security before making any rest call. Here, the challenge is we should not redesign the database schemas. We need to use a stored procedure which validates the user. This particular stored procedure returns an error message if authentication fails, otherwise nothing is returned. There are no roles defined in this case. Just simple authentication using a stored procedure. Now, I want to accomplish this whole thing by spring security. May be writing a java class/ custom spring framework's class and in which the stored procedure is called and using that class in spring security configuration files. Can anybody suggest ideas on how to start up with please? I have implemented AuthenticationProvider. The following is the *security.xml. &lt;http auto-config="true" use-expressions="true"&gt; &lt;intercept-url pattern="/rest/*" access="permitAll"&gt;&lt;/intercept-url&gt; &lt;/http&gt; &lt;authentication-manager &gt; &lt;authentication-provider ref="csAuthenticationProvider" /&gt; &lt;/authentication-manager&gt; But, the security framework is looking for roles. In my case there are no roles defined. As I said earlier, the user is authenticated for the first time without using spring framework. If the user wants to make any rest call, the spring security needs to re authenticate the user. It doesn't mean that the user needs to re enter credentials. The user's credentials are available in the rest call/request since he is already authenticated. The only thing needs to be done is I need to use the credentials by using request and re validate using the stored procedure. of course, using Aut…
has comment: http://stackoverflow.com/comment/33179551
tagged with: spring-security
tagged with: security
score: 0
has answer: http://stackoverflow.com/a/21881851
answer count: 3
has title: how to use Spring security with Custom java class/ custom spring framework's class?
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/21883765

http://stackoverflow.com/a/22402261
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21979805
has body: @xxeemez-ashu: I get response, change your GetReport.java with below code public class GetReport extends Activity { private static final String NAMESPACE = "http://tempuri.org/"; // com.service.ServiceImpl private static final String URL = "http://commodities.karvy.com/services/NetPositionReport.asmx"; private static final String METHOD_NAME = "NetPositionReport"; private static final String SOAP_ACTION = "http://tempuri.org/NetPositionReport"; private String webResponse = ""; private Handler handler = new Handler(); private Thread thread; private TextView textView1; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(1); setContentView(R.layout.activity_tv); textView1 = (TextView) findViewById(R.id.textView1); String title = getIntent().getExtras().getString("ClientCode"); startWebAccess(title); } public void startWebAccess(String a) { final String aa = a; thread = new Thread() { public void run() { try { Log.d("Req value0R", "Starting...");// log.d is used for // debug SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); request.addProperty("ClientCode", "64396"); request.addProperty("key", "Om$@!#@M^#R"); Log.d("Req value1", request.toString()); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(request); HttpTransportSE androidHttpTransport = new HttpTransportSE( URL); androidHttpTransport.debug = true; androidHttpTransport.call(SOAP_ACTION, envelope); SoapObject objectResult = (SoapObject) envelope.bodyIn; webResponse = objectResult.toString(); System.out.println("response: " + webResponse); } catch (SoapFault sp) { sp.getMessage(); System.out.println("error = " + sp.getMessage()); } catch (Exception e) { System.out.println("problem8"); e.printStackTrace(); webResponse = "Connection/Internet problem"; } handler.post(createUI); } }; thread.start(); } final Runnable createUI = new Runnable() { public void run…
type: Answer
downvote count: 0

http://stackoverflow.com/comment/33342562
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21996134
type: Comment
has text: execuse me for delay. I check it in debugger.

http://stackoverflow.com/q/21858482
has title: What is a Java 8 Lambda Expression Compiled to?
score: 26
has body: Consider the following Java 8 snippet. public static void main(String[] args) { List&lt;Integer&gt; integers = Arrays.asList(1, 2, 3, 4, 5); Consumer&lt;Integer&gt; consumer = x -&gt; System.out.print(x); integers.forEach(consumer); } What is Consumer&lt;Integer&gt; consumer = x -&gt; System.out.print(x) getting compiled to? I understand that Lambdas are not implemented as anonymous inner classes. However Consumer&lt;Integer&gt; is an interface therefore x -&gt; System.out.print(x) must be producing an object of some kind but it is not clear what kind of object is being produced. Is there some new type of object in Java 8 to represent a lambda expression? Update Here is the decompiled program the program was complied with the eclipse java 8 complier and the output below is from eclipse when you open a class file. It looks like that the lambda expression is getting turned into a static method on the class that contains the lambda expression private static synthetic void lambda$0(java.lang.Integer x); // Compiled from Example.java (version 1.8 : 52.0, super bit) public class Example { // Method descriptor #6 ()V // Stack: 1, Locals: 1 public Example(); 0 aload_0 [this] 1 invokespecial java.lang.Object() [8] 4 return Line numbers: [pc: 0, line: 7] Local variable table: [pc: 0, pc: 5] local: this index: 0 type: Example // Method descriptor #15 ([Ljava/lang/String;)V // Stack: 4, Locals: 3 public static void main(java.lang.String[] args); 0 iconst_5 1 anewarray java.lang.Integer [16] 4 dup 5 iconst_0 6 iconst_1 7 invokestatic java.lang.Integer.valueOf(int) : java.lang.Integer [18] 10 aastore 11 dup 12 iconst_1 13 iconst_2 14 invokestatic java.lang.Integer.valueOf(int) : java.lang.Integer [18] 17 aastore 18 dup 19 iconst_2 20 iconst_3 21 invokestatic java.lang.Integer.valueOf(int) : java.lang.Integer [18] 24 aastore 25 dup 26 iconst_3 27 iconst_4 28 invokestatic java.lang.Integer.valueOf(int) : java.lang.Integer [18] 31 aastore 32 dup 33 iconst_4 34 iconst_5 35 invokestat…
has comment: http://stackoverflow.com/comment/33093061
answer count: 1
has answer: http://stackoverflow.com/a/21858791
downvote count: 0
accepted answer: http://stackoverflow.com/a/21858791
favorite count: 0
has comment: http://stackoverflow.com/comment/33090361
duplicate of: http://stackoverflow.com/q/16827262
tagged with: lambda
tagged with: java-8
has comment: http://stackoverflow.com/comment/33090561
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33090670
upvote count: 26
linked to: http://stackoverflow.com/q/16827262
type: Question

http://stackoverflow.com/q/21880694
answer count: 2
tagged with: euclidean-distance
type: UnansweredQuestion
has body: Basically I'm using data from TSPLIB and I have this spec . This is how I calculated the Euclidean distance (according to the above spec): public static double calculateDistance(double x1, double y1, double x2, double y2){ double xDistance = Math.abs(x1 - x2); double yDistance = Math.abs(y1 - y2); double distance = Math.sqrt( (xDistance*xDistance) + (yDistance*yDistance) ); return distance; } This is how I calculated the geographic distance (according to the above spec): public static double calculateGeoDistance(double lat1, double lon1, double lat2, double lon2) { double lat1Rad = coordinates2Radians(lat1); double lat2Rad = coordinates2Radians(lat2); double lon1Rad = coordinates2Radians(lon1); double lon2Rad = coordinates2Radians(lon2); double R = 6378.388; double q1 = Math.cos(lon1Rad - lon2Rad); double q2 = Math.cos(lat1Rad - lat2Rad); double q3 = Math.cos(lat1Rad + lat2Rad); double distance = (R * Math.acos(0.5 * ((1.0 + q1) * q2 - (1.0 - q1) * q3)) + 1.0); return distance; } private static double coordinates2Radians(double coordinate) { double deg = Math.round(coordinate); double min = coordinate - deg; double rad = Math.PI * (deg + 5.0 * min / 3.0) / 180.0; // NOTE: Bug in TSPLIB95 Docu. Divide by 300 instead of 3.0. // 5.0 * 60 / 300 = 1 (60 minutes are 1 degree) // or use Math.PI * (deg in decimal) / 180.0; return rad; } But this problem is that I'm getting results that are less than the TSPLIB optimal (that cant be possible!). Is there something wrong with my calculation? I have tried calculating the optimal using predefined data and distances and I do get the optimal, I'm not sure why this isnt working.. Many thanks.
has comment: http://stackoverflow.com/comment/33130194
has comment: http://stackoverflow.com/comment/33132812
has answer: http://stackoverflow.com/a/30744997
has answer: http://stackoverflow.com/a/21885536
has comment: http://stackoverflow.com/comment/119118462
tagged with: coordinates
type: Question
has comment: http://stackoverflow.com/comment/33132655
linked to: http://stackoverflow.com/q/365826
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/33138551
has title: Calculating the geographic and euclidean distances for TSP in Java
tagged with: distance
score: 0

http://stackoverflow.com/a/21915233
score: 1
accepted answer of: http://stackoverflow.com/q/21914497
upvote count: 1
answers question: http://stackoverflow.com/q/21914497
downvote count: 0
type: AcceptedAnswer
has body: The reason for this is because of your infinite loop in gameLoop(). When you execute the Game constructor and initialize() method directly from the main() method, you're on the main thread. The infinite loop is executed on the main thread. When you call repaint(), the EDT is free to call the paintComponent() method. When you execute the Game constructor and initialize() method from SwingUtilities.invokeLater(), you're putting that code on the EDT. The infinite loop is then executed on the EDT. Since you're blocking the EDT inside the infinite loop with your approach, that means the EDT isn't free to call the paintComponent() method. It's stuck inside the infinite loop. The way around this is to put your gameLoop on another thread. Something like: public void initialize() { super.setGameScreen(this.gameScreen); this.game = true; this.startGameLoop(); } private void startGameLoop() { new Thread(){ public void run(){ while(game) { update(); render(); } } }.start(); } Just make sure that any changes to your gui take place on the EDT. Take a look at the concurrency and Swing concurrency tutorials for more detail.
type: Answer
has comment: http://stackoverflow.com/comment/33215453

http://stackoverflow.com/comment/33090107
has text: It's going to be hard for us to help you with only part of the code, but that part of the code containing things we really don't need. It would be *much* easier to help you if you could provide a short but complete program demonstrating the problem. Also, given that you've got logging, it would help if you'd show the logs...
comment on: http://stackoverflow.com/q/21858308
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/21980346
has body: Yes, that is true you cannot have more than one slf4j related log files in your class path. Either you remove that project c from class path or else Remove those slf4j jars from class path because indirectly those are added through projectC. Main thing is there should not be double slf4j related jar files in you class path.
has comment: http://stackoverflow.com/comment/33357288
answers question: http://stackoverflow.com/q/21978993
has comment: http://stackoverflow.com/comment/33309838
has comment: http://stackoverflow.com/comment/33354825
type: Answer
score: 0

http://stackoverflow.com/comment/33257344
has text: it's better to use `"2".equals(input)`, because in such a case you can't get NPE
type: AnswerComment
comment on: http://stackoverflow.com/a/21951804
score: 0
type: Comment

http://stackoverflow.com/comment/33337617
type: QuestionComment
type: Comment
has text: Did Text implement equals/hashCode? Look at http://stackoverflow.com/questions/18032172/why-java-uses-equals-instead-of-to-check-an-objects-presence-in-a-map/18032235#18032235
score: 1
comment on: http://stackoverflow.com/q/21996617

http://stackoverflow.com/a/21892469
answers question: http://stackoverflow.com/q/21892390
has comment: http://stackoverflow.com/comment/33190129
score: 0
type: Answer
has body: Change this: &lt;permission android:name="com.vogella.android.locationapi.maps.permission.MAPS_RECEIVE" android:protectionLevel="signature" /&gt; // and &lt;uses-permission android:name="com.example.newmapview.permission.MAPS_RECEIVE" /&gt; By the package name of your app as: &lt;permission android:name="com.example.chicagobus.permission.MAPS_RECEIVE" android:protectionLevel="signature" /&gt; // and &lt;uses-permission android:name="com.example.chicagobus.permission.MAPS_RECEIVE" /&gt; Also, try to add this code to your onCreate method to initialize your fragment map: myMap = ((SupportMapFragment) (getSupportFragmentManager().findFragmentById(R.id.map))).g‌​etMap(); Finally, as @mohammedmomn said: you cannot use Google Play Services on an emulator... I mean not always. To use it, see these tips: 1. Running google map application on Android Emulator 2. How to Run Google Map API V2 on Android Emulator. And this question might help you: Running Google Maps v2 on Android Emulator Let me know if that helps you.
has comment: http://stackoverflow.com/comment/33285063

http://stackoverflow.com/q/21929210
has comment: http://stackoverflow.com/comment/33639326
answer count: 0
has comment: http://stackoverflow.com/comment/33666322
tagged with: neo4j
has title: neo4j SDN @Index annotation mixes domain objects
has body: I have a class EntityNode defined like below @NodeEntity @TypeAlias("Entity") public class EntityNode { @GraphId private Long id; @Indexed(indexName="entity_name_ft", indexType=IndexType.FULLTEXT) private String name; also I have many other domain objects annotated with @NodeEntity and @TypeAlias(...) (@TypeAlias("Document"), @TypeAlias("UrlVisit") etc...) After inserting some data and I run this query: start n=node:entity_name_ft('*:*') return n.name, n.type, labels(n); i also get nodes that are NOT of type EntityNode but are returned by the index 'entity_name_ft': ==&gt; | &lt;null&gt; | &lt;null&gt; | ["__TYPE__UrlVisit","UrlVisit"] | ==&gt; | &lt;null&gt; | &lt;null&gt; | ["File","__TYPE__File"] | ==&gt; | &lt;null&gt; | &lt;null&gt; | ["__TYPE__UrlVisit","UrlVisit"] | ==&gt; | &lt;null&gt; | &lt;null&gt; | ["File","__TYPE__File"] | ==&gt; | &lt;null&gt; | &lt;null&gt; | ["__TYPE__UrlVisit","UrlVisit"] | ==&gt; | &lt;null&gt; | &lt;null&gt; | ["__TYPE__UrlVisit","UrlVisit"] | ==&gt; | "Blog software" | &lt;null&gt; | ["DocumentCategory","__TYPE__DocumentCategory"] | ==&gt; | &lt;null&gt; | &lt;null&gt; | ["File","__TYPE__File"] | ==&gt; | "WordPress" | &lt;null&gt; | ["DocumentCategory","__TYPE__DocumentCategory"] | ==&gt; | "Content management systems" | &lt;null&gt; | ["DocumentCategory","__TYPE__DocumentCategory"] | ==&gt; | &lt;null&gt; | "WEB_PAGE" | ["Document","__TYPE__Document"] | ==&gt; | &lt;null&gt; | "WEB_PAGE" | ["Document","__TYPE__Document"] | ==&gt; | &lt;null&gt; | &lt;null&gt; | ["__TYPE__UrlVisit","UrlVisit"] | ==&gt; | &lt;null&gt; | &lt;null&gt; | ["ScreenCapture","__TYPE__ScreenCapture"] | ==&gt; | &lt;null&gt; | "WEB_PAGE" | ["Document","__TYPE__Document"] | ==&gt; | &lt;null&gt; | &lt;null&gt; | ["__TYPE__UrlVisit","UrlVisit"] | ==&gt; | &lt;null&gt; | &lt;null&gt; | ["ScreenCapture","__TYPE__ScreenCapture"] | ==&gt; | &lt;null&gt; | "WEB_PAGE" | ["Document","__TYPE__Document"] | ==&gt; | &lt;null&gt; | &lt;null&gt; | ["__TYPE__UrlVisit",…
tagged with: spring-data-neo4j
type: Question
has comment: http://stackoverflow.com/comment/33552067
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33641172
type: UnansweredQuestion

http://stackoverflow.com/q/21944527
tagged with: backbone.js
has title: Backbone Routes and Webservices Path
has comment: http://stackoverflow.com/comment/33244525
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/33244799
has comment: http://stackoverflow.com/comment/33244992
tagged with: java
tagged with: javascript
type: Question
has body: I have been building my own Backbone application with a java EE backend, I am getting confused with paths between Web services and backbone. This is the example I have been follwoing: http://coenraets.org/blog/2012/01/using-backbone-js-with-a-restful-java-back-end/ So my understanding of this code is that when the url wines:idis called the before function loads the complete list of wines and then uses the get() method to find the item you were looking for. 1. If this is so why have the findById in the web resource as its never even used? 2. If I had a vast array of wines this seems a strange way of doing it, So how could I use the findByName function in the wineresource in backbone to create a collection of only the required items? 3. If the route says wines:id a backbone function is called but dose this also activate the web service path at /wines/{id} aswell? Or do I have a complete mis-understanding of this code? I come from a Java back round and am only being to understand backbone. EDIT My Best Guess at answering Question two: If I wanted to go about selecting only certain wines by using the findByName would I have to create a new model and collection with with urlRoot: "api/wines/:id"? EDIT TWO For my solution above, the ID is a variable, How do setup the url to take variables and how do I properly call the model passing the desired value of ID ? Backbone.View.prototype.close = function () { console.log('Closing view ' + this); if (this.beforeClose) { this.beforeClose(); } this.remove(); this.unbind(); }; var AppRouter = Backbone.Router.extend({ initialize: function() { $('#header').html( new HeaderView().render().el ); }, routes: { "" : "list", "wines/new" : "newWine", "wines/:id" : "wineDetails" }, list: function() { this.before(); }, wineDetails: function(id) { this.before(function() { var wine = app.wineList.get(id); app.showView( '#content', new WineView({model: wine}) ); }); }, newWine: function() { this.before(function() { app.showView( '#content', new …

http://stackoverflow.com/a/21873406
has body: You need to change your mapping and add a timestamp
has comment: http://stackoverflow.com/comment/35376890
score: 0
answers question: http://stackoverflow.com/q/21872448
upvote count: 1
downvote count: 1
type: Answer

http://stackoverflow.com/q/21981902
possible better answer: http://stackoverflow.com/a/22726848
downvote count: 0
tagged with: java
tagged with: gson
score: 17
type: Question
answer count: 2
has title: Best practice to Serialize java.time.LocalDateTime (java 8) to js Date using GSON
tagged with: javascript
has answer: http://stackoverflow.com/a/22726848
has answer: http://stackoverflow.com/a/21982332
accepted answer: http://stackoverflow.com/a/21982332
upvote count: 17
favorite count: 0
tagged with: serialization
has body: In our recent project we use java 8. I need to serialize java.time.LocalDateTime to java script Date format. Currently what I did was define a custom serializer to convert LocalDateTime to timestamp. public class LocalDateTimeSerializer implements JsonSerializer&lt;LocalDateTime&gt; { @Override public JsonElement serialize(LocalDateTime localDateTime, Type type, JsonSerializationContext jsonSerializationContext) { Instant instant = localDateTime.atZone(ZoneId.systemDefault()).toInstant(); Date date = Date.from(instant); return new JsonPrimitive(date.getTime()); } } then create Gson object using GsonBuilder with my custom LocalDateTimeSerializer GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()); Gson gson = gsonBuilder.create(); Then in Java Script I create a Date object using this time stamp. It's working fine. I need to know, is this way ok or is there a better way to do this?
type: AnsweredQuestion

http://stackoverflow.com/q/21843057
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
answer count: 1
has title: Unable to start eclipse kepler without root
tagged with: ubuntu
has body: I have ask the same question in the ubuntu forum as well. unable to start ubuntu without root I am using eclipse Kepler on ubuntu 13.10 with java 8 and I am facing following error while starting without root.
has answer: http://stackoverflow.com/a/21843107
score: 0
has comment: http://stackoverflow.com/comment/33063640
accepted answer: http://stackoverflow.com/a/21843107

file
tags question: http://stackoverflow.com/q/21987038
tags question: http://stackoverflow.com/q/21911739
type: Tag
tags question: http://stackoverflow.com/q/21942953
tags question: http://stackoverflow.com/q/22000574
tags question: http://stackoverflow.com/q/21842678
tags question: http://stackoverflow.com/q/21930859
tags question: http://stackoverflow.com/q/21895067
tags question: http://stackoverflow.com/q/21909956
tags question: http://stackoverflow.com/q/21930458
tags question: http://stackoverflow.com/q/21918283
tags question: http://stackoverflow.com/q/21970879
tags question: http://stackoverflow.com/q/21943509
tags question: http://stackoverflow.com/q/21914116
tags question: http://stackoverflow.com/q/21927640
tag name: file
tags question: http://stackoverflow.com/q/21951491
tags question: http://stackoverflow.com/q/21963781
tags question: http://stackoverflow.com/q/21863507
tags question: http://stackoverflow.com/q/21929825
tags question: http://stackoverflow.com/q/21893851
tags question: http://stackoverflow.com/q/21975172
tags question: http://stackoverflow.com/q/21986649
tags question: http://stackoverflow.com/q/22004233
tags question: http://stackoverflow.com/q/21904933
tags question: http://stackoverflow.com/q/21919141
tags question: http://stackoverflow.com/q/21847844
tags question: http://stackoverflow.com/q/21991890
tags question: http://stackoverflow.com/q/21944450
tags question: http://stackoverflow.com/q/21963529
tags question: http://stackoverflow.com/q/21842496
tags question: http://stackoverflow.com/q/21914728
tags question: http://stackoverflow.com/q/21863058
tags question: http://stackoverflow.com/q/21859020
tags question: http://stackoverflow.com/q/22001161
tags question: http://stackoverflow.com/q/21948298
tags question: http://stackoverflow.com/q/21962227
tags question: http://stackoverflow.com/q/21939896
tags question: http://stackoverflow.com/q/21969060
tags question: http://stackoverflow.com/q/21855290
tags question: http://stackoverflow.com/q/21896535
tags question: http://stackoverflow.com/q/21958083
tags question: http://stackoverflow.com/q/21844307
tags question: http://stackoverflow.com/q/21985653
tags question: http://stackoverflow.com/q/21891654
tags question: http://stackoverflow.com/q/21976557
tags question: http://stackoverflow.com/q/21967251
tags question: http://stackoverflow.com/q/21948109
tags question: http://stackoverflow.com/q/21869978
tags question: http://stackoverflow.com/q/21870819

http://stackoverflow.com/comment/33170704
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21902860
has text: i asked the support but they gonna respond in 24 hours
type: Comment

http://stackoverflow.com/a/21913658
type: Answer
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21913620
has body: That's because you have different instances of the variable lane int lane = MathUtils.random(1, 3); here lane is being redefined. Just remove int from that line.

http://stackoverflow.com/comment/33194918
type: QuestionComment
comment on: http://stackoverflow.com/q/21916691
score: 3
type: Comment
has text: What is variable `countUp`?

http://stackoverflow.com/q/21851958
has comment: http://stackoverflow.com/comment/33078960
score: 0
has title: Java deserialize Arrays.toString() - human readable serialization - config file
answer count: 1
tagged with: deserialization
has answer: http://stackoverflow.com/a/21904612
tagged with: string
tagged with: serialization
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33078500
accepted answer: http://stackoverflow.com/a/21904612
tagged with: java
has comment: http://stackoverflow.com/comment/33079289
type: Question
has body: I'm building a configuration file, and I'd like to make it both human readable and simple to process. I only need to use primitives and arrays of primitives (and strings). Here's an example ID 100; Links [99, 100, 101]; Options [qwe, asd] ID 100; Links [99, 100, 101]; Options [asd, zxc] Right now I'm using Arrays.toString() and string concatenation to create the above. I can split the above string using String.split(), which is still simple enough. Then I'm left with the [.., ..] strings that I need to"deserialize". Is there a simple and straightforward way to reverse what was created by Arrays.toString()?
tagged with: arrays

http://stackoverflow.com/comment/33064714
comment on: http://stackoverflow.com/a/21843563
score: 0
has text: the player with the 57.3%. I am trying to print out the player who has the highest field goal percentage
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33246694
type: Comment
has text: There's a possibility that there's a concurrent modification issue wherein the UI gets passed a `Vector` of a certain size, elements are removed, and the UI doesn't get informed that the size is reduced.
score: 2
comment on: http://stackoverflow.com/q/21945638
type: QuestionComment

http://stackoverflow.com/q/21932628
upvote count: 1
linked to: http://stackoverflow.com/q/14236767
tagged with: java
type: UnansweredQuestion
has title: Fetch XML-Nodes by Path
has comment: http://stackoverflow.com/comment/33222727
linked to: http://stackoverflow.com/q/8791600
downvote count: 0
score: 1
has body: I have following (very large => 5GB) XML: Hotel 1 City 1 12345 Hotel 2 City 2 67890 ... And I have a file which defines which fields I want to extract and what their path is: $root = "/Hotels/Hotel"; $fields = array("HotelName" => "/Name", "PhoneNumber" => "/Phone"); So the path for HotelName would be: /Hotels/Hotel/Name. Now I want to get the information for every hotel. I cannot create classes for them (like here) because the script has to be dynamically and different XML-files with different definition-files will be passed. How can I solve this by using the paths, without classes and with low memory usage (=> large files)? //Edit: Everything is implemented. I just need a way to iterate through the Hotel and get their values with the paths I have.
favorite count: 0
has comment: http://stackoverflow.com/comment/33222732
type: Question
has comment: http://stackoverflow.com/comment/33223899
linked to: http://stackoverflow.com/q/5374455
has answer: http://stackoverflow.com/a/21932908
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/33226793
tagged with: xpath
has answer: http://stackoverflow.com/a/21932796
answer count: 2

http://stackoverflow.com/comment/33192273
has text: im not asking for you to do my homework im asking for hints like what commands to use like what Zemzela did, thanks by the way
comment on: http://stackoverflow.com/q/21899400
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33141628
type: AnswerComment
type: Comment
has text: @Jessica Your welcome. Have fun coding :)
comment on: http://stackoverflow.com/a/21870869
score: 0

http://stackoverflow.com/q/21947486
has answer: http://stackoverflow.com/a/21947722
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33249890
has title: Java project archive file submission?
has comment: http://stackoverflow.com/comment/33251790
has comment: http://stackoverflow.com/comment/33250025
has comment: http://stackoverflow.com/comment/33249930
has comment: http://stackoverflow.com/comment/33250349
accepted answer: http://stackoverflow.com/a/21947722
possible better answer: http://stackoverflow.com/a/21947733
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21947733
tagged with: java
type: Question
has body: What does it mean to archive all my files into one file? Below are the requirements. I have my program working and stuff, but I don't know why it should be submitted online through an archive file? Does this mean zip? If anyone has experience with this and can inform me. Thank you! The files of the problem should be archived into one archive file named BinTree&lt;your initials&gt;. The archive file should contain: UML class diagram (including class relationship) for the main classes Commented source code (comments per class and all public methods and instance variables) A short description on what kind of Java codes get generated automatically from the UML diagram and what you have to add to make the program working. API docs produced by javadoc A Readme file for those who use linux as the main development platform
tagged with: archive

http://stackoverflow.com/comment/33267871
has text: Polymorphism works when the reference variable is the parent and the object is a subclass. For example: Animal dog = new Dog();
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21957595

http://stackoverflow.com/a/21967731
has comment: http://stackoverflow.com/comment/33286634
answers question: http://stackoverflow.com/q/21967386
type: Answer
has comment: http://stackoverflow.com/comment/33286401
score: 0
has comment: http://stackoverflow.com/comment/33286500
has comment: http://stackoverflow.com/comment/33286725
has body: Protected keyword Regarding the protected key word, read more here: In Java, difference between default, public, protected, and private http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html Short version: methods/fields marked protected can be accessed by subclasses and by classes in the same package. Synchronization I think you have confused the terms (or I do not understand your question properly). There is no synchronization guaranteed just because you create a setter or a getter for a field in a class. However, if you add the synchronized keyword to the method signature (public synchronized void doSomething()), you are guaranteed there will be only one thread running the method at any given time. Other calls to doSomething() will block until the thread running the method have left the method. The volatile keyword can be used if you want to make sure all thread sees the updated reference to a (for example) immutable object (object which cannot be changed after creation). If you have two threads modifying a public String value;, the first thread might not see that the second thread has updated the reference if you do not have the volatile keyword. Read more here: When exactly do you use the volatile keyword in Java?. I'm not sure any of this would help in your example, as you are asking for "exclusive access" to a member variable. In general, I would try to avoid mixing active object (threads) with passive objects (data). Perhaps you could instead make the MyDataMember thread-safe (perhaps by using synchronized), and you will not need to care about how you access it?

executorservice
type: Tag
tags question: http://stackoverflow.com/q/21911406
tags question: http://stackoverflow.com/q/21979639
tag name: executorservice
tags question: http://stackoverflow.com/q/21958611
tags question: http://stackoverflow.com/q/21945695
tags question: http://stackoverflow.com/q/21974093

http://stackoverflow.com/comment/33113830
type: Comment
comment on: http://stackoverflow.com/a/21870947
has text: I have updated the question. Please check.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21873832
duplicate of: http://stackoverflow.com/q/19125707
has body: I am trying to set a background image for tabbed pane in java swing application but i can keep only colors how to go through with image ? EDIT from comment i want the image for the full tabbed pane. if i set image to label and keep it for full screen i cant keep any components on the label
has comment: http://stackoverflow.com/comment/33118349
linked to: http://stackoverflow.com/q/468328
type: Question
has comment: http://stackoverflow.com/comment/33118199
has comment: http://stackoverflow.com/comment/33118531
has comment: http://stackoverflow.com/comment/33118474
score: 0
has answer: http://stackoverflow.com/a/21874284
linked to: http://stackoverflow.com/q/19125707
answer count: 1
has title: How to set a background image for the tabbed pane in java swing using Netbeans GUI Builder?
tagged with: netbeans
has comment: http://stackoverflow.com/comment/33118155
tagged with: gui-builder
type: UnansweredQuestion
tagged with: swing
tagged with: java

http://stackoverflow.com/q/21890423
has title: Using jOOQ with Google Cloud SQL
accepted answer: http://stackoverflow.com/a/21900489
tagged with: sql
downvote count: 0
answer count: 1
favorite count: 0
tagged with: jooq
has body: I want to know how to use jOOQ with Google Cloud SQL. The link provided in the guide seems to be broken: https://github.com/lukaseder/jOOQ/blob/master/jOOQ-google-cloud-sql/src/org/jooq/test/JOOQTest.java Is it still supported, or there were changes in the Cloud SQL that jOOQ cannot run on it anymore?
tagged with: google-app-engine
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/21900489
type: Question

http://stackoverflow.com/comment/33299760
comment on: http://stackoverflow.com/a/21975072
score: 0
type: AnswerComment
type: Comment
has text: Ok Ive put it in the onclicklistener but now ive got an error saying: "The type new AsyncTask<Object,Object,String>(){} must implement the inherited abstract method AsyncTask<Object,Object,String>.doInBackground(Object...)". I believe i need to extend the ASyncTask in my class, but my class already extends Activity so I cant do it.

http://stackoverflow.com/q/21923512
has title: Hibernate just insert first time
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21925074
accepted answer: http://stackoverflow.com/a/21925074
tagged with: jsf
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/21923968
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21923968
has body: @Entity public class Human { @Id @GeneratedValue(strategy = GenerateType.AUTO) int id; String name; } @ManagedBean @SessionScoped public class PessoaFisicaBean { Human human = new Human(); HumanDaoImp dao = new HumanDaoImp(); public void add() { dao.add(human); } } if i use this, it only work in first time, in the second will work like merge, but i have the persist: DaoIMP -> public void add(Human human) { entityManager.getTransaction().begin(); entityManager.persist(human); entityManager.getTransaction().commit(); } but if i edit the managedbean in this way: public void add() { dao.add(human); human = new Human(); } it works flawless, however i will never be able to "recover" the last insert, since after the .add it clean the human for new one, and i cant understand why in the persist it dont create another id, use the same =( Obs: using PostGreSQL Obs2: JSF + Hibernate

http://stackoverflow.com/comment/33068865
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21845261
has text: what is in Circle Class ?
type: QuestionComment

http://stackoverflow.com/a/21870388
has comment: http://stackoverflow.com/comment/33478674
upvote count: 1
score: 1
has body: Can you add a relationship from B back to A? Then you could iterate over each List of children with the following bean mapping: new String[] { "a.col1", "a.col2", "b1", "b2" } Here's an example of how you'd use this. Note the nested loops to iterate over each B inside each A. public class DozerTest { @Test public final void test() throws IOException { StringWriter out = new StringWriter(); ICsvDozerBeanWriter writer = new CsvDozerBeanWriter(out, CsvPreference.STANDARD_PREFERENCE); writer.configureBeanMapping(B.class, new String[] { "a.col1", "a.col2", "b1", "b2" }); for (A a : generateData()) { for (B b : a.getbList()) { writer.write(b); } } writer.flush(); System.out.println(out.toString()); } private List&lt;A&gt; generateData() { List&lt;A&gt; data = new ArrayList&lt;A&gt;(); for (int i = 0; i &lt; 3; i++) { A a = new A(); a.setCol1("col1 for a" + i); a.setCol2("col2 for a" + i); B firstB = new B(); firstB.setB1("first b1 for a" + i); firstB.setB2("first b2 for a" + i); firstB.setA(a); B secondB = new B(); secondB.setB1("second b1 for a" + i); secondB.setB2("second b2 for a" + i); secondB.setA(a); a.setbList(Arrays.asList(firstB, secondB)); data.add(a); } return data; } } This prints: col1 for a0,col2 for a0,first b1 for a0,first b2 for a0 col1 for a0,col2 for a0,second b1 for a0,second b2 for a0 col1 for a1,col2 for a1,first b1 for a1,first b2 for a1 col1 for a1,col2 for a1,second b1 for a1,second b2 for a1 col1 for a2,col2 for a2,first b1 for a2,first b2 for a2 col1 for a2,col2 for a2,second b1 for a2,second b2 for a2 Update to address comments If you can't add a relationship, then you can just use CellProcessors (and you don't even need to use Dozer). I've just created 3 simple cell processors: ElementAt - just grabs the element at the desired index GetB1 - gets the b1 field of a B GetB2 - gets the b2 field of a B And here they are in action: @Test public final void test2() throws IOException { StringWriter out = new StringWriter(); ICsvDozerBeanWriter writer …
has comment: http://stackoverflow.com/comment/33140415
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21862624
type: Answer
answers question: http://stackoverflow.com/q/21862624

http://stackoverflow.com/q/21896242
has answer: http://stackoverflow.com/a/21896279
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21896305
answer count: 4
has answer: http://stackoverflow.com/a/21896361
has answer: http://stackoverflow.com/a/21896306
tagged with: java
type: Question
has title: The type of the expression must be an array type but it is resolved to ArrayList<Point2D.Double>
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/33159053
has body: I am trying to figure out the proper way to call arrays from the area method, which are then supposed to calculate the area of the points given. Not sure what the proper way to select the specific x and y coordinates from each array is. MyPolygon class import java.util.ArrayList; import java.awt.geom.Point2D; import java.awt.geom.Point2D.Double; /** * A class that represents a geometric polygon. Methods are provided for adding * a point to the polygon and for calculating the perimeter and area of the * polygon. */ class MyPolygon { // list of the points of the polygon private ArrayList&lt;Point2D.Double&gt; points; /** * Constructs a polygon with no points in it. */ public MyPolygon() { points = new ArrayList&lt;Point2D.Double&gt;(); } /** * Adds a point to the end of the list of points in the polygon. * * @param x * The x coordinate of the point. * @param y * The y coordinate of the point. */ public void add(double x, double y) { points.add(new Point2D.Double(x, y)); } /** * Calculates and returns the perimeter of the polygon. * * @return 0.0 if &lt; 2 points in polygon, otherwise returns the sum of the * lengths of the line segments. */ public double perimeter() { if (points.size() &lt; 2) { return 0.0; } int i = 0; double d = 0; double total = points.get(0).distance(points.get(points.size() - 1)); while (i &lt; points.size() - 1) { Point2D.Double point1 = points.get(i); // double x = point1.x; // double y = point1.y; Point2D.Double point2 = points.get(i + 1); // double x1 = point2.x; // double y1 = point2.y; d = point1.distance(point2); // d = Math.sqrt(Math.pow(x1 - x,2) + Math.pow(y1 - y, 2)); total = total + d; i++; } return total; } /** * Calculates and returns the area of the polygon. * * @return 0.0 if &lt; 3 points in the polygon, otherwise returns the area of * the polygon. */ public double area() { int i = 0; double a = 0; double total = 0; total = total + a; if (points.size() &lt; 3) { return 0.0; } for (int m = 0; m &lt; points.size(); m++) { total = t…

http://stackoverflow.com/comment/33335099
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21995288
score: 0
has text: How do you know if the client is able to send a connect request to server? I mean waiting in accept() loop probably means there is no client to connect to.

http://stackoverflow.com/q/21995995
answer count: 2
has title: Unable Take screenshot of JFrame Java Swing
favorite count: 0
has comment: http://stackoverflow.com/comment/33340118
has body: I have tried to save the JFrame as an image using the following approach. try { BufferedImage image = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB); this.paint(image.getGraphics()); ImageIO.write(image,"png", new File("Test.png")); } catch(Exception exception) { //code System.out.print("Exception unable to write image"); } I am trying to save a screenshot as follows: I would like to have even the title in my screenshot import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.Shape; import java.awt.geom.AffineTransform; import java.awt.geom.Path2D; import java.awt.geom.Point2D; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class DividedSquare { public static void main(String[] args) { new DividedSquare(); } public DividedSquare() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { private TriangleShape baseTriangle; private Color[] colors; public TestPane() { colors = new Color[]{Color.RED, Color.GREEN, Color.BLUE, Color.MAGENTA}; } @Override public void invalidate() { super.invalidate(); baseTriangle = new TriangleShape( new Point(0, 0), new Point(getWidth(), 0), new Point(getWidth() / 2, getHeight() / 2)); } @Override public Dimension getPreferredSize() { return n…
tagged with: jframe
tagged with: swing
linked to: http://stackoverflow.com/q/14786319
possible better answer: http://stackoverflow.com/a/74328634
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: screenshot
linked to: http://stackoverflow.com/q/17690275
tagged with: java
has comment: http://stackoverflow.com/comment/33336412
type: Question
has answer: http://stackoverflow.com/a/21998201
accepted answer: http://stackoverflow.com/a/21998201
has comment: http://stackoverflow.com/comment/33338969
has comment: http://stackoverflow.com/comment/33340107
linked to: http://stackoverflow.com/q/5853879
has comment: http://stackoverflow.com/comment/33345919
tagged with: image
has answer: http://stackoverflow.com/a/74328634
has comment: http://stackoverflow.com/comment/33337953
upvote count: 2

http://stackoverflow.com/comment/33191955
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21900425
has text: 1+ -- I like this better than my answer.
score: 0

http://stackoverflow.com/a/22002759
has comment: http://stackoverflow.com/comment/33348872
type: Answer
has comment: http://stackoverflow.com/comment/33348616
has comment: http://stackoverflow.com/comment/33348742
answers question: http://stackoverflow.com/q/22002708
has comment: http://stackoverflow.com/comment/33352207
score: 0
has body: Just use getter to get the variable: public double getRadius() { return radius; } This is in fact a good programming practice. You could do a setter similarly if you wanted to alter this value.

http://stackoverflow.com/comment/33281085
comment on: http://stackoverflow.com/a/21963674
score: 0
type: Comment
type: AnswerComment
has text: I did as you suggested, and the problem persists. p is relative the CM, but for some reason I thought I needed the tangent of it. Thoughts?

http://stackoverflow.com/comment/33105225
type: QuestionComment
score: 1
has text: **Why** do you think you want to pause the game in this method?
comment on: http://stackoverflow.com/q/21866253
type: Comment

http://stackoverflow.com/comment/33062785
score: 1
has text: Same as http://stackoverflow.com/questions/21724103/mediacodec-converted-file-from-wav-to-amr-does-not-play#comment32866411_21724103 / http://stackoverflow.com/questions/21626156/vp8-encoding-nexus-5-returns-empty-0-frames/21630351#21630351 ? Looks like you're not setting position & limit on the output buffer.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21842536

http://stackoverflow.com/comment/33349248
type: Comment
type: QuestionComment
score: 0
has text: Not that it is necessarily wrong, but you don't need to have the JFrame be static for the reason you cite. You could have in the constructor to your subclass of JPanel an argument that is the JFrame it lives in. Better yet, you can abstract up a level GUI events from logical events, and have an object that both the JFrame and JPanel can see that acts as a pub-sub channel.
comment on: http://stackoverflow.com/q/21994739

http://stackoverflow.com/comment/33078576
comment on: http://stackoverflow.com/q/21841991
type: Comment
score: 0
has text: On the Jssc website there is an applet terminal deem demo and it works fine, I downloaded the source and if I use their compiled .jar it lotada fine on my Web server, if I compile myself and sign myself it won't work.
type: QuestionComment

http://stackoverflow.com/comment/33099152
score: 0
type: AnswerComment
has text: Thanks, this is exactly what I wanted to know. Although, I would have to learn using Saxon or BaseX, which I don't know yet :-) But sounds good, since I will be using some more XPath on this XML later.
type: Comment
comment on: http://stackoverflow.com/a/21863152

http://stackoverflow.com/comment/33118356
has text: Can u show me the sample code..
type: Comment
comment on: http://stackoverflow.com/q/21873325
score: 0
type: QuestionComment

http://stackoverflow.com/a/21925124
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21925092
answers question: http://stackoverflow.com/q/21925092
type: Answer
upvote count: 4
has body: (In your current question, I believe there is a typo. I assume that cc should not be matched.) ([a-zA-Z])\1* The parentheses denote a capture group. The \1 is a backreference to the first capture group. That will work with java.util.regex.Matcher.matches, but if you use something like java.util.regex.Matcher.find which allows subsequence matches, you will want ^([a-zA-Z])\1*$ to make sure it matches the entire input.
score: 4
has comment: http://stackoverflow.com/comment/33209812
has comment: http://stackoverflow.com/comment/33209787
type: AcceptedAnswer

http://stackoverflow.com/comment/34257681
score: 0
type: AnswerComment
has text: In my experience, switching backend databases is not a oft-occurring practice.
comment on: http://stackoverflow.com/a/21974843
type: Comment

http://stackoverflow.com/comment/33267773
has text: @JonSkeet yes that what I mean. I have edited the question
type: QuestionComment
comment on: http://stackoverflow.com/q/21957595
score: 0
type: Comment

http://stackoverflow.com/q/21846846
type: Question
score: 5
has answer: http://stackoverflow.com/a/64326924
answer count: 6
accepted answer: http://stackoverflow.com/a/21847313
has answer: http://stackoverflow.com/a/46321080
has answer: http://stackoverflow.com/a/67024581
has answer: http://stackoverflow.com/a/28415395
downvote count: 0
has answer: http://stackoverflow.com/a/21847313
favorite count: 0
has title: Jmeter - Future timestamp
has body: im trying to create a parameter in Jmeter that gives the current timestamp + 5 minutes. Does anyone know how to do this? To generate the current timestamp i have this: ${__time(HH:mm:ss,TIMESTAMP)}
upvote count: 5
has answer: http://stackoverflow.com/a/28416606
type: AnsweredQuestion
tagged with: jmeter
possible better answer: http://stackoverflow.com/a/28415395
tagged with: java

http://stackoverflow.com/q/21957252
has comment: http://stackoverflow.com/comment/33270308
has body: I am implementing checkers graphics with SWT graphics. the board is a shell with a board picture as a backgroung and each piece is represent as a composite in a fit place (the composite has a image of the piece). I add a MouseListener to the shell. I also have a method that translate mouse coordinates to a place in the board (for example: clicking in (60,173) mean choosing the square in the place [1,4]). I tested the method in an empty board and it worked just fine but now when i add the pieces i cannot get coordinates from the mouse when clicking on a piece. So i added the same listener to each composite but now i get very strange coordinates when mouse click on it. Seem like the coordinates are in scale to the composite picture and not to the shell. Now my translate method work fine on empty squares click but getting very strange results on non empty squares click. What should I do for fix it? How can i get a composite click coordinate in the board shell scale?
tagged with: shell
has title: Getting right mouse coordinates on swt composite click
type: UnansweredQuestion
tagged with: swt
has comment: http://stackoverflow.com/comment/33268015
has comment: http://stackoverflow.com/comment/33268147
type: Question
tagged with: java
tagged with: mouseevent
score: 0
tagged with: user-interface
answer count: 1
has answer: http://stackoverflow.com/a/21968659

http://stackoverflow.com/tag/csv
tags question: http://stackoverflow.com/q/21966509
type: Tag
tags question: http://stackoverflow.com/q/21939794
tags question: http://stackoverflow.com/q/21870739
tag name: csv
tags question: http://stackoverflow.com/q/21866787
tags question: http://stackoverflow.com/q/21982151
tags question: http://stackoverflow.com/q/21912780
tags question: http://stackoverflow.com/q/21876286
tags question: http://stackoverflow.com/q/21884834
tags question: http://stackoverflow.com/q/21862624
tags question: http://stackoverflow.com/q/22000955

http://stackoverflow.com/comment/33315873
comment on: http://stackoverflow.com/a/21984495
type: AnswerComment
has text: @Joseph i still don't understand the need. aside form that. i haven't mentioned the first mistake which is psoted in prosper k post. Secondly use a Handler.
score: 0
type: Comment

integer
tags question: http://stackoverflow.com/q/21996593
tags question: http://stackoverflow.com/q/21914135
tags question: http://stackoverflow.com/q/21920433
tags question: http://stackoverflow.com/q/21868378
tags question: http://stackoverflow.com/q/21949570
tags question: http://stackoverflow.com/q/21975172
tags question: http://stackoverflow.com/q/21982664
tags question: http://stackoverflow.com/q/22002892
tags question: http://stackoverflow.com/q/21915569
tags question: http://stackoverflow.com/q/21996430
tags question: http://stackoverflow.com/q/21999750
tags question: http://stackoverflow.com/q/21911511
tags question: http://stackoverflow.com/q/21895078
tag name: integer
tags question: http://stackoverflow.com/q/21879426
tags question: http://stackoverflow.com/q/21984140
tags question: http://stackoverflow.com/q/21936336
type: Tag

http://stackoverflow.com/a/21851941
has comment: http://stackoverflow.com/comment/33079639
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33080265
type: Answer
has comment: http://stackoverflow.com/comment/33080421
answers question: http://stackoverflow.com/q/21851174
has body: You can read TIFF using ImageIO.read(...). There's just no plugin installed by default. You can use the plugins from JAI ImageIO, or you could try the TIFF reader from my Twelvemonkeys project. These are both plugins for ImageIO, and allows you to use the API you already know. Commons Imaging should also work, if you don't mind using a different API for reading.
score: 1

http://stackoverflow.com/comment/33346258
type: Comment
has text: @DavidWallace Among other things, they also appear to load an Image from a file on every repaint.
type: AnswerComment
comment on: http://stackoverflow.com/a/22001217
score: 0

http://stackoverflow.com/comment/33169700
comment on: http://stackoverflow.com/a/21894559
has text: Yes HashMap does but the Anonymous Class does not. You can confirm this by trying to get: new HashMap<String, String>() {{System.out.println(serialVersionUID);}} to compile.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21917985
has comment: http://stackoverflow.com/comment/33197804
tagged with: java-6
tagged with: java-7
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33197497
has answer: http://stackoverflow.com/a/23573203
has title: Java 6 -> 7 migration ClassFormatError: Illegal local variable table length
linked to: http://stackoverflow.com/q/17993041
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33198264
type: Question
linked to: http://stackoverflow.com/q/12173420
has comment: http://stackoverflow.com/comment/33197682
has body: I'm working on upgrading several programs to JDK 1.7 for the company I work for. I have run into the ClassFormatError described in Java7 ClassFormatError: Illegal local variable table length while creating the object and Java 7 with emma and junit causing java.lang.VerifyError and Illegal local variable Errors Is anyone aware of a fix other than the "-XX:-UseSplitVerifier" jvm arg?

http://stackoverflow.com/a/21898666
accepted answer of: http://stackoverflow.com/q/21896509
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21896509
has comment: http://stackoverflow.com/comment/33200305
type: Answer
has comment: http://stackoverflow.com/comment/33200908
downvote count: 0
has body: Your test is muddled: Your add text is also deleting, then testing that it's not there, but if both add and delete are broken (ie do nothing), your test would still pass! Better to add, then confirm it's been added. In your delete, it's OK to do both, because you're testing the add part separately. Also, don't use variables like that. Change: boolean expResult = true; boolean result = instance.delete(z); assertEquals(expResult, result); To simply: assertTrue(instance.delete(z)); Less code, easier to read, easier to debug.
has comment: http://stackoverflow.com/comment/33200637
has comment: http://stackoverflow.com/comment/33205582
score: 1

http://stackoverflow.com/q/21990079
score: 4
has comment: http://stackoverflow.com/comment/33893467
upvote count: 4
has comment: http://stackoverflow.com/comment/59266482
tagged with: aspectj
downvote count: 0
tagged with: jax-rs
favorite count: 0
has comment: http://stackoverflow.com/comment/33326261
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33332653
has comment: http://stackoverflow.com/comment/41459876
has body: I'm trying to get AOP to work on a JAX-RS service. It is working on Spring-injected objects, but not my JAX-RS services. My assumption is that it's not working because Jersey creates my JAX-RS objects, rather than Spring. How can I get AOP to work on my JAX-RS services? Here's how I declare my aspects: @Pointcut("execution (* com.ancestry.academy.api.user.UserService.*(..))") public void apiMethods() {} @Around("com.ancestry.academy.api.ApiAdvisor.apiMethods()") public Object aroundApi(ProceedingJoinPoint pjp) throws Throwable { System.out.println("User Service API called"); return pjp.proceed(); } @Pointcut("execution (* com.ancestry.academy.services.user.UserManagerImpl.*(..))") public void serviceMethods() {} @Around("com.ancestry.academy.api.ApiAdvisor.serviceMethods()") public Object aroundService(ProceedingJoinPoint pjp) throws Throwable { System.out.println("User Maanageer API called"); return pjp.proceed(); } The first aspect is on my JAX-RS service, and is the one that doesn't work. The second aspect is on a spring-injected bean that provides business logic, and it does work. There's nothing particularly special about UserService, except that it extends SpringBeanAutowiringSupport. I have &lt;aop:aspectj-autoproxy/&gt; in my spring XML file.
tagged with: spring
has comment: http://stackoverflow.com/comment/33554159
answer count: 0
has title: Cannot get AspectJ to work with JAX-RS services
linked to: http://stackoverflow.com/q/21271485
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/33486392

http://stackoverflow.com/a/22000974
score: 1
type: Answer
upvote count: 1
has body: The while statement keeps running untill a condition is true, in your case the condition is x&lt;=5, but let's go step by step. When the code first reachs the while your condition is true because x=1, so the block inside is executed and z = 1 + 1 = 2 and x = 1 + 1 = 2, then the iteration starts again, this time z = 2 + 2 = 4 and x = 2 + 1 =3 and so on until x &gt; 5 that renders the condition false and the program exit the while loop. At that point z will be 16.
answers question: http://stackoverflow.com/q/22000848
downvote count: 0

http://stackoverflow.com/comment/33133167
has text: `The file is in the same package / directory as the java file.`. Your expectations are wrong.
comment on: http://stackoverflow.com/q/21882444
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21924748
tagged with: fonts
accepted answer: http://stackoverflow.com/a/21924778
tagged with: java
tagged with: swing
type: Question
has body: okay, so i need a little helping hand, i'm using a set of varibles to declare my fonts etc, i have made the bold and italics function work by using the deriveFont method - creating a new font and applying the new style etc. This one is more tricky because im getting the value out of the text box and applying it to the fontSize variable and then applying that to the currentFont i have there... HELP?! :( A snippet of my code is below... public class Practice01 extends javax.swing.JFrame { private int fontStyle; private int fontSize = 12; private void changeSize(){ Font currentFont = edtText.getFont(); //getting the current font fontSize = Integer.parseInt(txtSize.getText()); //getting the number input from the text box and putting it to the fontSize variable txtSize.setText(Integer.toString(fontSize)); //setting the txtSize entry to the fontSize variable? currentFont.deriveFont(fontSize); //deriving a new font edtText.setFont(currentFont.deriveFont(fontSize)); //setting the new font and size to the text box. } and here's my font variable bits... Font serifFont; Font monoFont; Font sansserifFont; public Practice01() { serifFont = new Font ("Serif", fontStyle, fontSize); monoFont = new Font ("Monospaced", fontStyle, fontSize); sansserifFont = new Font ("SansSerif", fontStyle, fontSize); initComponents(); }
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21924778
tagged with: textbox
has title: Changing a font size in Java, using a textbox
tagged with: text
type: AnsweredQuestion

sublimetext2
tags question: http://stackoverflow.com/q/21936968
tags question: http://stackoverflow.com/q/21895151
type: Tag
tag name: sublimetext2

http://stackoverflow.com/a/22228433
downvote count: 0
answers question: http://stackoverflow.com/q/21964316
type: Answer
upvote count: 3
score: 3
has body: It seems that your application take more time to respond that apache ProxyTimeout ProxyTimeout try to increase proxytimeout in you vhost/httpd configuration and try again The root cause is slowness in you application. you need to find the root cause of slowness

http://stackoverflow.com/comment/33154842
has text: possible duplicate of [How to: generic array creation](http://stackoverflow.com/questions/529085/how-to-generic-array-creation)
comment on: http://stackoverflow.com/q/21893782
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21962568
has body: I'm trying to implement a tokenizer to parse mathematical input strings into their separate parts and I'm getting what seems like a trivial error in the second line of code as I post it that it's expecting an ; somewhere midway through the line. public static void parseFormula(String text){ List&lt;String&gt; tokenize(String s) throws IOException { StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(s)); tokenizer.ordinaryChar('-'); List&lt;String&gt; tokBuf = new ArrayList&lt;String&gt;(); while (tokenizer.nextToken() != StreamTokenizer.TT_EOF) { switch(tokenizer.ttype) { case StreamTokenizer.TT_NUMBER: tokBuf.add(String.valueOf(tokenizer.nval)); break; case StreamTokenizer.TT_WORD: tokBuf.add(tokenizer.sval); break; default: tokBuf.add(String.valueOf((char) tokenizer.ttype)); } } return tokBuf; } }
has answer: http://stackoverflow.com/a/21962684
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21962661
has title: StreamTokenizer expected end character
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/21988532
downvote count: 0
has body: I'm confused. I am using log4j 2 for logging and everything works fine, when I launch my program with eclipse. But after packing the sources to a jar there are no logs written to console or files. Here's the jar's manifest: Manifest-Version: 1.0 Built-By: s Build-Jdk: 1.6.0_45 Class-Path: settings settings/log4j2.xml lib/poi-3.9.ja r lib/commons-codec-1.5.jar lib/mysql-connector-java-5.1.29.jar lib/l og4j-api-2.0-rc1.jar lib/log4j-core-2.0-rc1.jar Created-By: Apache Maven 3.0.4 Main-Class: application.Start Archiver-Version: Plexus Archiver My log4j2.xml is here: <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} %C{1}.%M{1}:%L{1} - %msg%n"/> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} %C{1}.%M{1}:%L{1} - %msg%n"/> <SizeBasedTriggeringPolicy size="500 KB"/> <AppenderRef ref="app" /> <AppenderRef ref="Console"/> All the other jars in lib are bound correctly and the application works well. What I'm doing wrong with log4j ?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21988701
has answer: http://stackoverflow.com/a/21990052
favorite count: 0
has comment: http://stackoverflow.com/comment/33322503
possible better answer: http://stackoverflow.com/a/21988701
type: Question
has title: Log4j 2 is not logging from executable jar
upvote count: 2
has comment: http://stackoverflow.com/comment/33323377
tagged with: log4j2
tagged with: logging
linked to: http://stackoverflow.com/q/13548573
has comment: http://stackoverflow.com/comment/33473484
accepted answer: http://stackoverflow.com/a/21990052
tagged with: java
tagged with: eclipse
answer count: 2
score: 2

http://stackoverflow.com/q/21900643
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33169087
has body: I'm performing file viewing operation as follows: private void openFile(File file, String format) { try { if (file.exists()) { Uri path = Uri.fromFile(file); Intent intent = new Intent(Intent.ACTION_VIEW); String mimeType = "*/*"; if (format.length() &gt; 0) { mimeType = MimeTypeMap.getSingleton() .getMimeTypeFromExtension(format); if (mimeType == null) mimeType = "*/*"; } else mimeType = "*/*"; intent.setDataAndType(path, mimeType); try { startActivity(intent); } catch (Exception e) { Toast.makeText(LoginSuccessActivity.this, constants.Error_NoCompatibleApp, Toast.LENGTH_SHORT) .show(); e.printStackTrace(); } } else { Toast.makeText(LoginSuccessActivity.this, constants.Error_DocNotFound, Toast.LENGTH_SHORT).show(); } } catch (Exception e) { e.printStackTrace(); } } This is working fine, as I get app chooser pop-up for the filetypes which has multiple apps related to it(for eg. kingsoft office and polaris office for word file) OR directly file is opened for the filetypes which has only one app related to it(HTMLViewer for html file). What I don't understand is my main activity is getting destroyed in few moments after calling file viewer activity. I've checked this by placing logs in onPause(), onStop() and onDestroy(). So, after file viewing is done, when I press back key, instead of taking back to app, it navigated to main menu. I tried with startActivityForResult(intent, 1); instead of startActivity(intent); hoping that it'll preserve my main activity as it'll be waiting for result, but to no avail. Please note that I've added android:configChanges="orientation|screenSize" in manifest file and @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); } in java file. Am I doing anything wrong? Any help appreciated. Sometimes, mind you, "Sometimes", I get follwing messages on log: file:// Uri exposed through Intent.getData() java.lang.Throwable: file:// Uri exposed through Intent.getData() at android.os.StrictM…
has answer: http://stackoverflow.com/a/21900832
favorite count: 0
tagged with: android
tagged with: android-activity
has answer: http://stackoverflow.com/a/21900743
has comment: http://stackoverflow.com/comment/33171576
has comment: http://stackoverflow.com/comment/33166919
upvote count: 3
type: UnansweredQuestion
downvote count: 1
score: 2
tagged with: java
has title: Activity getting destroyed when starting another activity for file viewing

http://stackoverflow.com/q/21928424
has title: Cannot center progressDrawable over background in progressBar
answer count: 1
tagged with: graphical-logo
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21928850
has comment: http://stackoverflow.com/comment/33215270
type: Question
has body: I'm trying to create a progressBar using a image with text on it (actually the image is a text logo saved as png). I already created a normal progressBar using 2 images (a gray one as background and a blue one as the progress bar) and it worked just fine. &lt;ProgressBar android:id="@+id/pbLoading" style="?android:attr/progressBarStyleHorizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="25dp" android:layout_marginRight="25dp" android:layout_marginTop="130dp" android:background="@drawable/grayloadingbar" android:progress="@integer/loadingProgress" android:progressDrawable="@drawable/custom_progress" android:radius="0dp" android:visibility="visible" /&gt; This is the custom_progress.xml &lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;item android:id="@android:id/progress"&gt; &lt;bitmap android:gravity="center" android:src="@drawable/blueloadingbar" android:layout_height="fill_parent" /&gt; &lt;corners android:radius="0dp" /&gt; &lt;/item&gt; &lt;/layer-list&gt; The problem is that replacing those 2 images with other images (the text logo images mentioned above), this doesn't look good anymore. The loading works just fine and I can see the progress but the progress bar image seams to be having a fixed size while the background src is variable, depending on the display and I can resize it myself, something I cannot do for the progress bar. Here is the XML: &lt;ProgressBar android:id="@+id/pbLoading" style="?android:attr/progressBarStyleHorizontal" android:layout_width="fill_parent" android:layout_height="68dp" android:layout_gravity="center_vertical" android:layout_marginLeft="25dp" android:layout_marginRight="25dp" android:layout_marginTop="130dp" android:background="@drawable/loading_bw" android:minHeight="20dip" android:mirrorForRtl="false" android:progress="@integer/fullProgress" android:progressDrawable="@drawable/custom_progress" android:radius="0dp" android:visibility="v…
has comment: http://stackoverflow.com/comment/33215423
tagged with: progress-bar
score: 0
accepted answer: http://stackoverflow.com/a/21928850

http://stackoverflow.com/comment/33254944
type: Comment
score: 0
type: AnswerComment
has text: @mike: You need not import java.lang.StringBuffer as it is in the lang package which gets imported automatically.
comment on: http://stackoverflow.com/a/21950260

http://stackoverflow.com/comment/33098513
comment on: http://stackoverflow.com/q/21862919
type: Comment
has text: Why do you believe `Charset.defaultCharset` is relevant? What does that have to do with the JDBC connection?
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33253114
type: QuestionComment
has text: I would think that would work. You could try doing an invalidate on the JTable after you set the model.
comment on: http://stackoverflow.com/q/21947205
score: 0
type: Comment

http://stackoverflow.com/q/21962757
upvote count: 1
tagged with: methods
answer count: 7
has answer: http://stackoverflow.com/a/21962806
has answer: http://stackoverflow.com/a/21962955
downvote count: 0
has answer: http://stackoverflow.com/a/21962856
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21962921
tagged with: class
has body: public class car { private int model; private String make; private double speed; /** * * My constructor */ public car() { model = 2000; make= "Ferrari"; speed= 50; } public int getYear() { return model; } public String getMake() { return make; } public double getSpeed() { return speed; } public double accerlate () { double accerlate = speed++; return accerlate; } public void output(double accerlate) { System.out.println("Year: " +model); System.out.println("Make: " + make); System.out.println("Speed: " + speed); System.out.println(accerlate); } } connect to this class public class RaceTrack { public static void main(String args[]){ double speed = 50; car mycar= new car(); mycar.getYear(); mycar.getMake(); mycar.getSpeed(); mycar.output(speed); mycar.accerlate(); } } Anyways, I try to get an output and the accerlate method doesn't work the way I want. It should be add +1 and it is not working. Why isn't it working? It just prints the original speed.
score: 1
has answer: http://stackoverflow.com/a/21963063
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/21963091
has answer: http://stackoverflow.com/a/21962794
tagged with: java
has title: classes returning a method value

http://stackoverflow.com/q/21846921
has comment: http://stackoverflow.com/comment/33073947
tagged with: hdfs
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33075154
type: UnansweredQuestion
has body: I have class files loaded on to Hadoop file system.And also i have loaded input file to hdfs. When I run class file through hadoop command in terminal i get Class not found error. E.G.: I have HDFS contents as WordCount.class WordCountMapper.class WordCOuntReducer.class SampleInpujt.txt Can Some one correct me where i am doing wrong.Or is this can be done in real.
has title: How to execute Hadoop Job written in Java on Hadoop Environment
has comment: http://stackoverflow.com/comment/33083602
tagged with: java
has answer: http://stackoverflow.com/a/21861513
tagged with: mapreduce
type: Question
tagged with: hadoop

http://stackoverflow.com/comment/33186198
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21911742
has text: skiwi , thanks did what u said...
type: Comment

http://stackoverflow.com/q/21878074
type: UnansweredQuestion
has body: Given the following code, why is it that I'm able to access a protected variable in a class that is neither in the same package nor extends the class that declared the variable? public class B{ protected String s = "B1"; public B() {}; } public class P{ public void out(Object o){ System.out.println(o);} } public class M{ B b = new B(); P.out(b.s);} Why can the out method access b.s?
has comment: http://stackoverflow.com/comment/33125996
tagged with: java
has comment: http://stackoverflow.com/comment/33125900
type: Question
has comment: http://stackoverflow.com/comment/33125770
answer count: 2
score: 2
has answer: http://stackoverflow.com/a/21879330
has title: Access protected variable
downvote count: 0
tagged with: inheritance
tagged with: protected
favorite count: 0
has comment: http://stackoverflow.com/comment/33125802
linked to: http://stackoverflow.com/q/215497
has answer: http://stackoverflow.com/a/21878476
has comment: http://stackoverflow.com/comment/33125801
upvote count: 2
has comment: http://stackoverflow.com/comment/33125625

http://stackoverflow.com/a/24334495
type: Answer
has body: It looks like you have built a library file for one arch (ARM) and you could be trying to install it on different type of arch(x86 or MIPS). EDIT: I don't think you built the library or it was compiled correctly. You should have a .so file in your libs directory. IMO you should be using Ubuntu/OS to build native apps.
score: 0
answers question: http://stackoverflow.com/q/21864035

http://stackoverflow.com/q/21938161
has answer: http://stackoverflow.com/a/21938208
linked to: http://stackoverflow.com/q/7220681
type: AnsweredQuestion
has title: Division of two static integers always returning 0% ratio
duplicate of: http://stackoverflow.com/q/7220681
tagged with: java
has answer: http://stackoverflow.com/a/21938187
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/21938208
possible better answer: http://stackoverflow.com/a/21938187
has body: My code: public class Test { public static int l = 29; public static int w = 16; public static int total = w + l; public static int result = w / total; public static int Result = total * 100; public static void main(String[] args) { System.out.println("You're W/L ratio is: " + (Result) + "%"); // Display the string. } } Response in console: You're W/L ratio is: 0%
has answer: http://stackoverflow.com/a/21938334
favorite count: 0
score: 0
answer count: 3
upvote count: 2
downvote count: 2

http://stackoverflow.com/comment/33066717
type: QuestionComment
has text: Does your device support Hindi fonts??
comment on: http://stackoverflow.com/q/21844988
score: 0
type: Comment

http://stackoverflow.com/comment/33248034
score: 0
comment on: http://stackoverflow.com/q/21946466
type: Comment
type: QuestionComment
has text: You can use digital filtering, but it's complicated.

http://stackoverflow.com/comment/33064324
type: Comment
comment on: http://stackoverflow.com/a/21843479
type: AnswerComment
score: 0
has text: @TerryChern: I'm pretty sure that gives numeric addition instead of string concatenation.

http://stackoverflow.com/q/21850907
has answer: http://stackoverflow.com/a/21851098
tagged with: java
score: 24
has comment: http://stackoverflow.com/comment/33076655
has answer: http://stackoverflow.com/a/21851088
downvote count: 1
has answer: http://stackoverflow.com/a/28131675
linked to: http://stackoverflow.com/q/285793
type: Question
has comment: http://stackoverflow.com/comment/33076928
answer count: 8
has comment: http://stackoverflow.com/comment/33077243
has answer: http://stackoverflow.com/a/21851056
has answer: http://stackoverflow.com/a/21850967
has body: There are 3 ways to define the serialVersionUID : 1. private static final long serialVersionUID = 1L; (Default) 2. private static final long serialVersionUID = -8940196742313994740L; (Generated) 3. Don't define serialVersionUID and let the JVM define it at runtime. @Lance Java But I don't understand the first way! I have seen it already, that somebody defines "serialVersionUID=1L" for all java-classes in source code. What is the meaning? Is that useful? If all classes have the same serialVersionUID 1L, is there no problem?
has title: What means 1L serialVersionUID? When could I use this default value 1L?
has comment: http://stackoverflow.com/comment/33076512
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33076768
has answer: http://stackoverflow.com/a/21851149
linked to: http://stackoverflow.com/q/3284979
has answer: http://stackoverflow.com/a/21851045
has answer: http://stackoverflow.com/a/21851309
upvote count: 25

http://stackoverflow.com/comment/33279625
score: 0
type: Comment
has text: I have done a ton of research and I am still really confused. Could you give me an example of what it would look like for my code?
comment on: http://stackoverflow.com/a/21964005
type: AnswerComment

http://stackoverflow.com/comment/79890848
comment on: http://stackoverflow.com/a/21910604
type: AnswerComment
score: 0
type: Comment
has text: This tells me "never use `autowire=constructor`" if there's more than one constructor :) And since more constructors can be added in the future and the xml being forgotten, just "never use `autowire=constructor`"

http://stackoverflow.com/q/21874340
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33119307
tagged with: list
has answer: http://stackoverflow.com/a/21874513
tagged with: java
type: Question
tagged with: recursion
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33119487
accepted answer: http://stackoverflow.com/a/21874513
score: 0
answer count: 1
has title: How to get values from a list that has child lists and store all the values in order in another list
has body: I have a list named ionList which has values named structs in it. Each struct in the list has more lists and those lists has some more structs in it. You can imagine it like kind of a parent list and child lists I want to retrieve all the structs in the ionList completely and store it in one list named StructList. The code i used is a recursive code but the data is getting lost when i call the recursive function whenevr i encounter a child list in my ionList. public List&lt;IonStruct&gt; findStructsFromParentList(IonList ionList) { String objectType = "object_type"; String diffType = "diff_type"; String childList = "children"; IonList ionChildList = null; IonList ionChildList1 = null; List&lt;IonStruct&gt; ionStructList = new ArrayList&lt;IonStruct&gt;(); System.out.println("ION LIST"+ionList.size()); for (int index = 0; index &lt; ionList.size();index++) { ionStructList.add((IonStruct) ionList.get(index)); ionChildList = (IonList) ionStructList.get(index).get(childList); if (ionChildList != null) { System.out.println("Found child"); ionStructList.addAll(findStructsFromParentList(ionChildList)); } } return ionStructList; } The childList found is altering my for loop initialisation in my recursive call which i think is the reason for not parsing more than one struct with child lists in it. Please help me out..
has comment: http://stackoverflow.com/comment/33119349
has comment: http://stackoverflow.com/comment/33150798

http://stackoverflow.com/q/21947850
type: Question
score: 5
has title: How do I change template engine in Play Framework?
answer count: 2
tagged with: playframework
tagged with: template-engine
upvote count: 5
has answer: http://stackoverflow.com/a/21957119
type: AnsweredQuestion
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/21957119
favorite count: 0
has answer: http://stackoverflow.com/a/21952621
has body: How would I change the template engine in Play! to a different engine than the default one? Can you give an example?
accepted answer: http://stackoverflow.com/a/21952621

http://stackoverflow.com/comment/33085107
comment on: http://stackoverflow.com/a/21855328
type: AnswerComment
type: Comment
has text: Why are you adding `(\.[A-Za-z]{2,})` at the end? You should have a look at http://en.wikipedia.org/wiki/Email_address#Valid_email_addresses
score: 1

http://stackoverflow.com/comment/33264996
comment on: http://stackoverflow.com/q/21956097
type: QuestionComment
type: Comment
has text: post your `Record` class?
score: 0

http://stackoverflow.com/q/21954488
has comment: http://stackoverflow.com/comment/33327026
type: Question
has comment: http://stackoverflow.com/comment/33285173
tagged with: bean-validation
answer count: 1
downvote count: 0
favorite count: 0
tagged with: hibernate-validator
has body: I have a simple java pojo which i give to my android users: @XmlRootElement @AllArgsConstructor @NoArgsConstructor @ToString public class PostAccount { @Getter @Setter private String email; @Getter @Setter private String pass1; @Getter @Setter private String pass2; } This pojo is serialized to json and send to my server. On my server i which to use jersey bean validation: public NumberResult add(@Valid ValidAccount account) { But because the Account pojo doesn't have any validation annotations validation doesn't do much. I can create a second pojo with validation annotations and use that on server side: public class ValidAccount { @Getter @Setter @NotEmpty @CheckEmail private String email; @Getter @Setter @NotBlank private String pass1; @Getter @Setter @NotBlank private String pass2; } Works perfectly. But when i now add a field at Account pojo i do have to remember to change ValidAccount pojo. No problem, but when you have a lot of pojo's things get complicated to manage. Is there a better solution? For example is it possible to extends the Account pojo and in a way add the validation rules? (please i which to continue using annotations, xml gives me the creeps)
has title: Add validation rules to Pojo.name to object extending Pojo?
has answer: http://stackoverflow.com/a/78093355
type: UnansweredQuestion
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33314297
tagged with: jersey
has comment: http://stackoverflow.com/comment/33276406
tagged with: java

http://stackoverflow.com/q/21955443
answer count: 2
tagged with: 3d
has answer: http://stackoverflow.com/a/23161944
has body: I'm trying to create a hollow cylinder on android application with LibGDX. Looks like there isn't any method that would create it. I tought of drawing two cylinders. One bigger and a smaller one with which I could "remove" the inside of the bigger one therefor creating a hollow cylinder. Now what I'm asking, is there any better way to do this? Thanks!
favorite count: 0
upvote count: 3
tagged with: android
possible better answer: http://stackoverflow.com/a/21958487
linked to: http://stackoverflow.com/q/21670740
downvote count: 0
type: AnsweredQuestion
score: 3
tagged with: libgdx
accepted answer: http://stackoverflow.com/a/23161944
tagged with: java
has answer: http://stackoverflow.com/a/21958487
type: Question
has title: Create hollow cylinder with LibGDX

http://stackoverflow.com/q/21861639
has comment: http://stackoverflow.com/comment/33096132
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33096327
has comment: http://stackoverflow.com/comment/33097818
tagged with: java
has comment: http://stackoverflow.com/comment/33096312
type: Question
has comment: http://stackoverflow.com/comment/33096291
tagged with: arrays
answer count: 1
has body: I have the following method: public ArrayList&lt;String&gt; process() throws IOException{ Document doc = Jsoup.connect(url).get(); ArrayList&lt;String&gt; capture = new ArrayList&lt;String&gt;(); Elements tableRows = doc.getElementsByTag("tr"); for(Element tr: tableRows){ if(tr.text().contains(airline)){ capture.add(tr.text()); System.out.println(tr.text()); } } return capture; } which when the println is run, outputs the text below London-LHR Aer Lingus EI159 18 Feb 13:45 Arrived 13:34 Paris-CDG Aer Lingus EI523 18 Feb 13:55 Arrived 14:35 Rome Aer Lingus EI403 18 Feb 14:10 Arrived 13:56 Amsterdam Aer Lingus EI609 18 Feb 17:25 Arrived 17:14 and so on. I want to be able to add the above data into a mulitdimensional array, like rows and columns, as I want to be able to sort by different columns: ie in ascending or descending arrival time etc..... I'm new to java and learning as I go here and I'm unable to find anything online to help me. Any help greatly appreciated. Thanks
has title: Add data to a multidimensional string array
score: 0
has answer: http://stackoverflow.com/a/21861986
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/33096110

http://stackoverflow.com/comment/33099849
type: Comment
type: QuestionComment
has text: Oops I had it backwards. I have a Julian day value like 2456707.5 and want to convert it to an actual calendar date like "6 Feb 2014". Will make an edit...
score: 0
comment on: http://stackoverflow.com/q/21862970

http://stackoverflow.com/comment/33234407
comment on: http://stackoverflow.com/q/21936750
score: 0
type: Comment
type: QuestionComment
has text: @Mark, thank you, looks really convenient. I'll try it now :D

http://stackoverflow.com/q/21990108
answer count: 3
accepted answer: http://stackoverflow.com/a/21990171
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21990171
has body: System.out.println(Integer.parseInt(e.getMessage())); System.out.println(e.getMessage()); System.exit(Integer.parseInt(e.getMessage())); when I am runnig the code in unix system.exit(Integer.parseInt(e.getMessage())) is giving 254 output: -2 -2 254
possible better answer: http://stackoverflow.com/a/21990172
has answer: http://stackoverflow.com/a/21990127
tagged with: unix
type: AnsweredQuestion
tagged with: java
score: 6
type: Question
upvote count: 6
has answer: http://stackoverflow.com/a/21990172
has title: why I am getting two different values from system.out.println() and system.exit()?

http://stackoverflow.com/comment/33230844
type: AnswerComment
comment on: http://stackoverflow.com/a/21937177
score: 0
type: Comment
has text: From the code above only the array not the elements appears to be initialized

jaxp
type: Tag
tag name: jaxp
tags question: http://stackoverflow.com/q/21879321

http://stackoverflow.com/a/23767694
accepted answer of: http://stackoverflow.com/q/21943381
score: 0
has body: Currently working on a javascript only solution. Will contribute it here in the next days: https://github.com/redaktor/exiftool.js (it is just a fork for now) Some Olympus Cameras seem to store their makernotes only in subIFDs. I wouldn't mind juggling bytes but I have no idea where to start :( start here : this has a special meaning :: 0x3000: 'RawInfo', 0x4000: 'MainInfo', they can be either pointers to SubIFDs or arrays some cameras store the "root tags" in 0x4000 ... { 0x2010: '_IFDpointer_Equipment', // (misleading name returns many things, e.g. serial) 0x2020: '_IFDpointer_CameraSettings', 0x2030: '_IFDpointer_RawDevelopment', 0x2031: '_IFDpointer_RawDevelopment2', 0x2040: '_IFDpointer_ImageProcessing', 0x2050: '_IFDpointer_FocusInfo', 0x0000: 'MakerNoteVersion', 0x0001: 'CameraSettings', 0x0003: 'CameraSettings', 0x0040: 'CompressedImageSize', 0x0081: 'PreviewImageData', 0x0088: 'PreviewImageStart', 0x0089: 'PreviewImageLength', 0x0100: 'ThumbnailImage', 0x0104: 'BodyFirmwareVersion', 0x0200: 'SpecialMode', 0x0201: 'Quality', 0x0202: 'Macro', 0x0203: 'BWMode', 0x0204: 'DigitalZoom', 0x0205: 'FocalPlaneDiagonal', 0x0206: 'LensDistortionParams', 0x0207: 'Olympus CameraType Values', 0x0208: 'Olympus TextInfo', 0x020b: 'EpsonImageWidth', 0x020c: 'EpsonImageHeight', 0x020d: 'EpsonSoftware', 0x0280: 'PreviewImage', 0x0300: 'PreCaptureFrames', 0x0301: 'WhiteBoard', 0x0302: 'OneTouchWB', 0x0303: 'WhiteBalanceBracket', 0x0304: 'WhiteBalanceBias', 0x0404: 'SerialNumber', 0x0405: 'Firmware', 0x0e00: 'PrintIM', 0x0f00: 'DataDump', 0x0f01: 'DataDump2', 0x0f04: 'ZoomedPreviewStart', 0x0f05: 'ZoomedPreviewLength', 0x0f06: 'ZoomedPreviewSize', 0x1000: 'ShutterSpeedValue', 0x1001: 'ISOValue', 0x1002: 'ApertureValue', 0x1003: 'BrightnessValue', 0x1004: 'FlashMode', 0x1006: 'ExposureCompensation', 0x1007: 'SensorTemperature', 0x1008: 'LensTemperature', 0x1009: 'LightCondition', 0x100a: 'FocusRange', 0x100b: 'FocusMode', 0x100c: 'ManualFocusDistance', 0x100d: 'ZoomStepCount', 0x…
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21943381
type: Answer

http://stackoverflow.com/comment/33333852
comment on: http://stackoverflow.com/q/21994493
has text: Because of a shrinking/small market share to other technology like Flash (which has almost ubiquitous market penetration) and *huge* improvements in client-side HTML/CSS.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33217367
type: AnswerComment
has text: Ty Raul for answer , but i've changed it to: List<Map<String,String>> list_objects = null; and Type collectionType = new TypeToken<List<Map<String,String>>>(){}.getType(); with no success , throws same error
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21929660

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/21963961

http://stackoverflow.com/comment/41896632
type: Comment
has text: Yeah, I didn't really have a question about it yet, it was just an observation related to the other comments.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21858791

http://stackoverflow.com/q/21842864
has comment: http://stackoverflow.com/comment/33063601
has comment: http://stackoverflow.com/comment/33063372
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/33063417
tagged with: loops
upvote count: 1
downvote count: 1
has title: Null Pointer Exception Error on a Constructor
type: Question
has comment: http://stackoverflow.com/comment/33063298
has answer: http://stackoverflow.com/a/21843065
tagged with: java
has comment: http://stackoverflow.com/comment/33064048
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33063420
tagged with: null
has comment: http://stackoverflow.com/comment/33063467
has comment: http://stackoverflow.com/comment/33063489
answer count: 1
tagged with: nested
has comment: http://stackoverflow.com/comment/33063383
favorite count: 0
has body: So I have a constructor here that copies PandemicModel other to another grid called this.grid. I have an error saying java.lang.NullPointerException and another error that when I click the error on Eclipse it highlights my last statement on the nested for loop. I don't know how to fix the problem. Any ideas? /** * Copy constructor * It is assumed that other is not null and that this PandemicModel * is a deep copy of other (i.e., other.grid is copied into a new * 2-dim array this.grid) * @param other the PandemicModel that is copied */ public PandemicModel (PandemicModel other){ this.rows = other.rows; this.columns = other.columns; for (int i=0; i&lt;other.rows; i++){ for (int j=0; j&lt;other.columns; j++){ this.grid[i][j] = other.grid[i][j]; } } }
accepted answer: http://stackoverflow.com/a/21843065
has comment: http://stackoverflow.com/comment/33063252

http://stackoverflow.com/a/69920433
has body: If anyone reached this thread trying to avoid the following exception when parsing a Mongodb ObjectId: java.lang.IllegalArgumentException: invalid hexadecimal representation of an ObjectId: [anInvalidId] Then note this utility method offered by the mongo-java-driver library: ObjectId.isValid(stringId) Related thread: How to determine if a string can be used as a MongoDB ObjectID?
answers question: http://stackoverflow.com/q/21992023
score: 0
type: Answer

http://stackoverflow.com/a/21992077
type: Answer
has body: This is Java Generic, and the correct use is some like this: ArrayList&lt;ArrayList&gt; list = new ArrayList&lt;ArrayList&gt;(); for(int i=8;i&gt;0;i--) { list.add(i, new ArrayList()); } for(int i=8;i&gt;0;i--) { tileRows.get(i).add( //add other stuff ); }
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21991993
upvote count: 2

http://stackoverflow.com/comment/33256725
comment on: http://stackoverflow.com/q/21951094
score: 0
type: Comment
type: QuestionComment
has text: Yes, I did try that, it works well but I want to rename the file while being uploaded.

http://stackoverflow.com/comment/33113433
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21870863
has text: I suspect `ipconfig /renew` might also have worked, but I (like your maid) don't really **do** Windows.

fxml
tags question: http://stackoverflow.com/q/21974737
tags question: http://stackoverflow.com/q/21937057
tags question: http://stackoverflow.com/q/21995359
tags question: http://stackoverflow.com/q/21944532
tag name: fxml
type: Tag

http://stackoverflow.com/q/21863058
type: Question
has answer: http://stackoverflow.com/a/21863378
tagged with: bufferedwriter
has comment: http://stackoverflow.com/comment/33098754
has comment: http://stackoverflow.com/comment/33098778
score: -1
has comment: http://stackoverflow.com/comment/33098836
downvote count: 1
has answer: http://stackoverflow.com/a/26205694
has comment: http://stackoverflow.com/comment/33098949
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/33098761
has answer: http://stackoverflow.com/a/21863340
has comment: http://stackoverflow.com/comment/33098932
has comment: http://stackoverflow.com/comment/33098897
has comment: http://stackoverflow.com/comment/33098866
has comment: http://stackoverflow.com/comment/33099175
upvote count: 0
has answer: http://stackoverflow.com/a/21863115
has comment: http://stackoverflow.com/comment/33099070
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33099090
tagged with: java
tagged with: filewriter
tagged with: file
has body: I have a program that I am working on and I have an issue with writing a string into my file. The file is created, but the string value that should be written into it ultimately does not get written. There are no syntax errors according to Eclipse, so I suppose it's a semantical error. public boolean createFile() { try { f = new File("house.txt"); if(!f.exists()) { f.createNewFile(); exists = true; } else exists = false; } catch(IOException e) { e.printStackTrace(); } return exists; } That's the method that creates the file. This next one is the method that actually writes to the file, which is successfully created. The action is derived from a JButton that, when pressed, should perform this: if(evt.getActionCommand().equals("CONFIRM")) { attribute = txt.getText(); try { createFile(); fWriter = new FileWriter(f); String content = attribute; BufferedWriter output = new BufferedWriter(new FileWriter(f)); output.write(content); output.close(); } catch (IOException e) { e.printStackTrace(); } }
tagged with: output
has answer: http://stackoverflow.com/a/21863105
has title: Why does nothing write to my file?

http://stackoverflow.com/a/21972379
type: Answer
has comment: http://stackoverflow.com/comment/33294646
has body: This is a great candidate for an enum: /** &lt;P&gt;{@code java EnumDeltaXmpl}&lt;/P&gt; **/ public class EnumDeltaXmpl { public static final void main(String[] ingo_red) { test(MachineAction.ONE); test(MachineAction.TWO); test(MachineAction.THREE); test(MachineAction.FOUR); } private static final void test(MachineAction m_a) { System.out.println("MachineAction." + m_a + ": name=" + m_a.sName + ", ip=" + m_a.sIP + ""); } } enum MachineAction { ONE("Name1", "192.1.1.1"), TWO("Name2", "292.2.2.2"), THREE("Name3", "392.3.3.3"), FOUR("Name4", "492.4.4.4"), FIVE("Name5", "592.5.5.5"); public final String sName; public final String sIP; private MachineAction(String s_name, String s_ip) { sName = s_name; sIP = s_ip; } } Output: [C:\java_code\]java EnumDeltaXmpl MachineAction.ONE: name=Name1, ip=192.1.1.1 MachineAction.TWO: name=Name2, ip=292.2.2.2 MachineAction.THREE: name=Name3, ip=392.3.3.3 MachineAction.FOUR: name=Name4, ip=492.4.4.4
has comment: http://stackoverflow.com/comment/33294530
answers question: http://stackoverflow.com/q/21972141
has comment: http://stackoverflow.com/comment/33294822
score: 0
has comment: http://stackoverflow.com/comment/33294359

http://stackoverflow.com/a/21873309
has body: public static void printAll(){ String[] seats={"Jerry","chen","Jack"}; for(int i = 0; i &lt;seats.length; i++) { if(!seats[i].equals(null)) { System.out.print(i + " , " + seats[i] + "\n"); } }
answers question: http://stackoverflow.com/q/21872834
score: 0
type: Answer

http://stackoverflow.com/comment/33262717
type: QuestionComment
comment on: http://stackoverflow.com/q/21954319
score: 0
type: Comment
has text: What is that additional field for?

http://stackoverflow.com/q/21902101
has comment: http://stackoverflow.com/comment/33169750
has comment: http://stackoverflow.com/comment/33168981
has comment: http://stackoverflow.com/comment/33401162
answer count: 0
type: UnansweredQuestion
has title: extract location of tweet from twitter
tagged with: java
tagged with: twitter
tagged with: twitter-oauth
type: Question
score: 0
has body: if the location of a tweet is not available there is any other idea to extract location i have tried to extarct location from friends tweet but it was not successsful..if the tweet is send from a mobile we track it using geolocation but if tweet is send from a computer we could not extract it..i am using java language...i have extracted the tweets related to the query..and i extarct the location of tweet if its send from a mobile phone.but if its send from a desktop computer we are not getting the place name..

innodb
tags question: http://stackoverflow.com/q/21884701
tag name: innodb
type: Tag

http://stackoverflow.com/q/21941207
upvote count: 0
has comment: http://stackoverflow.com/comment/33238129
has answer: http://stackoverflow.com/a/21941267
linked to: http://stackoverflow.com/q/6742533
has comment: http://stackoverflow.com/comment/33238201
favorite count: 0
has comment: http://stackoverflow.com/comment/33238111
has comment: http://stackoverflow.com/comment/33238180
linked to: http://stackoverflow.com/q/1612334
type: UnansweredQuestion
has title: Why the HttpServlet class is an abstract?
has comment: http://stackoverflow.com/comment/33238161
has comment: http://stackoverflow.com/comment/33238237
downvote count: 1
has body: I am very confused. Why the HttpServlet class is an abstract? And what is the basic difference between bean and pojo?
type: Question
has answer: http://stackoverflow.com/a/21941323
has comment: http://stackoverflow.com/comment/33238199
tagged with: java
has comment: http://stackoverflow.com/comment/33238090
score: -1
tagged with: servlets
linked to: http://stackoverflow.com/q/18909206
answer count: 3
has comment: http://stackoverflow.com/comment/33238289
has answer: http://stackoverflow.com/a/21941321

http://stackoverflow.com/comment/33186478
type: AnswerComment
score: 0
type: Comment
has text: I followed this guide and i got "java.lang.NoClassDefFoundError"...i don't understand why!
comment on: http://stackoverflow.com/a/21858368

http://stackoverflow.com/comment/33302385
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21976517
type: Comment
has text: How to use a second JVM instance ? Can you show me a simple example ?

http://stackoverflow.com/comment/33253362
has text: @KugathasanAbimaran I am sorry. I removed the comments.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21949430

http://stackoverflow.com/comment/33186805
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21912266
has text: That was my thought, but I've tested with just "if (id.intValue() > 0)" and still get the exception

http://stackoverflow.com/a/21960540
downvote count: 0
type: Answer
has body: You are taking the USER input only one time so i m not sure why you are using do-while loop.Also if you are trying to iterate on the basis on YES\NO then add the inputs in the do loop and add one for input about YES/NO and add this check in while. Use below code : public class Temperature { public static void main(String[] args){ Scanner input = new Scanner (System.in); double deg; char dg; String con; do{ System.out.println("Enter a number, a space and F to convert from degF to degC and C to convert to degC to degF and YES to continue"); deg= input.nextDouble(); String letter = input.next().toUpperCase(); dg = letter.charAt(0); con = input.next(); if( dg == 'C'){ double cTemp= (deg-32)*5.0/9.0; System.out.printf("%f degC converted to degF is %.2f%n",deg, cTemp );; } else if(dg == 'F'){ double fTemp = (deg*9/5) + 32; System.out.printf("%f degF converted to degC is %.2f%n",deg, fTemp ); continue; } else{ System.out.println("That character does not correspond to a valid unit of measure "); break; } }while(con.equalsIgnoreCase("YES")); } }
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/33273547
has comment: http://stackoverflow.com/comment/33273329
answers question: http://stackoverflow.com/q/21960477

http://stackoverflow.com/q/21878085
tagged with: itext
upvote count: 1
type: Question
tagged with: c#
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21966858
answer count: 1
downvote count: 0
has body: I'm trying to find something like \vfill from Latex in iTextSharp (a way to insert spaces and place text at the bottom of the page). It's only for one page, not a footer. I searched online and in the book iText in Action, but didn't find any answers.
has title: iTextSharp vertical page fill
has answer: http://stackoverflow.com/a/21966858
favorite count: 0

http://stackoverflow.com/q/21908737
accepted answer: http://stackoverflow.com/a/21908968
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21908966
has comment: http://stackoverflow.com/comment/33180173
has answer: http://stackoverflow.com/a/21908878
has comment: http://stackoverflow.com/comment/33180228
has title: is it requited to have MYSQL installed in a pc where i am running tomcat application
possible better answer: http://stackoverflow.com/a/21908878
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21908968
tagged with: java
has body: I am trying to run an application in my localhost in tomcat, Application has a database . Now is it required to Install complete MYSQL in that machine or i can just place my sqlDump somewhere in that computer and run my application . please guide. Thanks
type: Question

http://stackoverflow.com/a/21983836
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21967222
type: Answer
answers question: http://stackoverflow.com/q/21967222
score: 2
downvote count: 0
has body: For a reason I can't explain, by writing to a file and returning this file to the output fixed the problem of encoding. I decided to keep this question in case other people had a similar problem. Here's the snippet : TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(); transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1"); File file = new File("Path/to/file.xml"); transformer.transform(new DOMSource(doc), new StreamResult(file)); response().setHeader("Content-Disposition", "attachment;filename=" + file.getName()); response().setHeader("Content-Type", "text/xml; charset=ISO-8859-1"); return ok(file).as("text/xml");

http://stackoverflow.com/q/21843682
accepted answer: http://stackoverflow.com/a/21843710
has comment: http://stackoverflow.com/comment/33064673
possible better answer: http://stackoverflow.com/a/21844219
has answer: http://stackoverflow.com/a/21844219
answer count: 2
has title: Trouble getting a card shuffle method to work
score: 2
downvote count: 0
has body: Here is the problem description: "The shuffle method shuffles the array of Card objects by looping through the array of Card objects one position at a time and exchanging (see slides 62-63 of the array lecture) the Card in that position with the Card in a random position (as determined by a Random number) between 0 and 51." I've written the below code to do the above, but it's not shuffling my card objects. public void shuffle() { //reset nextCard to 0. nextCard = 0; Random randomGen = new Random(); Card tempCard; int randomNum = randomGen.nextInt(DECK_SIZE); int i; for(i=0;i&lt;DECK_SIZE;i++) { tempCard = deck[i]; deck[i] = deck[randomNum]; deck[randomNum] = tempCard; }//end for. }//end shuffle(). What's the problem and how do I fix it? P.S. I will post console output upon request.
favorite count: 0
has answer: http://stackoverflow.com/a/21843710
type: AnsweredQuestion
tagged with: shuffle
upvote count: 2
tagged with: java
type: Question

http://stackoverflow.com/q/21967500
tagged with: java
tagged with: timeout
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21967889
has body: I start Server program and it waits for Client for just 30 seconds.It works fine in the first iteration and does not wait in the remaining iterations.Any suggestions. Here the minLinkWt() sets the index. It is however remains the same in the program. import java.sql.*; import java.net.*; import java.lang.*; class Democ{ int index,port,min=100; ServerSocket ss=null; Socket s=null; void begin(){ int av=0;boolean b=false; minLinkWt(); while(!b){ av=checkStatus(index); if(av==1){b=true;} } if(av==1) Connect(); else System.out.println("No Routers Available"); } void Connect() { System.out.println("Enter the Message to send to clients::"); try{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String msg=br.readLine(); PrintStream ps=new PrintStream(s.getOutputStream()); ps.println(msg); }catch(Exception e){e.printStackTrace();} } void callSwitch(int index_formal) { switch(index_formal) { case 1: port=2000; break; case 2: port=2001; break; case 3: port=2002; break; case 4: port=2003; break; default: System.out.println("No Routers in Available"); } } int checkStatus(int index_formal){ try { ss=new ServerSocket(port); ss.setSoTimeout(30000); s=ss.accept(); }catch(InterruptedIOException e){ System.out.println("Cannot connect through Router1 Waiting for Router2");} catch(Exception g){g.printStackTrace();} if(s==null) return 0; else return 1; } class DemoCopy{ public static void main(String s[]) { Democ obj=new Democ(); obj.begin(); } } So At every iteration The Server has to wait for the Client but its not waiting. I get the output as hello hello hello hello min is6 AT index2 Cannot connect through Router1 Waiting for Router2 No Routers Available
tagged with: while-loop
tagged with: sockets
upvote count: 1
accepted answer: http://stackoverflow.com/a/21967889
type: AnsweredQuestion
has title: Making Server Socket to wait for Client Socket in each iteration
score: 1

http://stackoverflow.com/comment/33414467
has text: Thanks Baz and Anonymous :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22034211
type: Comment

http://stackoverflow.com/a/21979125
answers question: http://stackoverflow.com/q/21979099
has comment: http://stackoverflow.com/comment/33306589
has comment: http://stackoverflow.com/comment/33306514
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33306493
has comment: http://stackoverflow.com/comment/33306460
type: Answer
accepted answer of: http://stackoverflow.com/q/21979099
has body: Change android:id="@+id/listView" to android:id="@android:id/list" because you are extending ListActivity so you must have ListView id @android:id/list

http://stackoverflow.com/comment/33066504
type: Comment
comment on: http://stackoverflow.com/a/21844732
has text: You really should avoid creating a new instance of the `JTable` if it can be helped
score: 1
type: AnswerComment

http://stackoverflow.com/q/22002064
type: UnansweredQuestion
tagged with: animation
has body: I wish to do something like a progress bar animation in Android app. I'm trying to make a simple line which Width increases. This is my code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash); for(int i = 0; i &lt; 100; i++) { ImageView iv = (ImageView) findViewById(R.id.init_line); LinearLayout.LayoutParams parms = new LinearLayout.LayoutParams(i, 2); iv.setLayoutParams(parms); try { Thread.sleep(20); } catch(Exception e) { } } However is not working and it doesn't appear nothing on the screen. It would be great if you guys could give me a hand on this. Thank you very much
has answer: http://stackoverflow.com/a/22002153
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22002325
has title: Making progress bar in Android
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/33347900
tagged with: progress

jsoup
tags question: http://stackoverflow.com/q/21928760
tags question: http://stackoverflow.com/q/21959048
tags question: http://stackoverflow.com/q/21922766
tags question: http://stackoverflow.com/q/21868795
tags question: http://stackoverflow.com/q/21894944
tags question: http://stackoverflow.com/q/21926877
tags question: http://stackoverflow.com/q/21954118
tags question: http://stackoverflow.com/q/21873167
tags question: http://stackoverflow.com/q/21974780
tags question: http://stackoverflow.com/q/21986055
type: Tag
tag name: jsoup
tags question: http://stackoverflow.com/q/21854538
tags question: http://stackoverflow.com/q/21972317
tags question: http://stackoverflow.com/q/21991542
tags question: http://stackoverflow.com/q/21974758
tags question: http://stackoverflow.com/q/21849039
tags question: http://stackoverflow.com/q/21849853
tags question: http://stackoverflow.com/q/21866784
tags question: http://stackoverflow.com/q/21922362
tags question: http://stackoverflow.com/q/21858701
tags question: http://stackoverflow.com/q/21985044
tags question: http://stackoverflow.com/q/21960820

http://stackoverflow.com/a/22001821
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33347261
answers question: http://stackoverflow.com/q/22001611
accepted answer of: http://stackoverflow.com/q/22001611
type: Answer
has comment: http://stackoverflow.com/comment/33347070
downvote count: 0
has body: Here's my recommendation. Don't use streams for something so trivial and non-load intensive. Stick to the basics, use a Scanner and read your file line-by-line. Here's the method to success! Learn how to use a Scanner to read Strings from a text file line-by-line. Make sure you split the Strings apart with the str.split() method accordingly. Store each line's String value into a array/list/table. Modify your stored Strings to remove the last two letters. Look into the str.subString(s,f) method. Learn how to use a PrintWriter to output your modified Strings to a file. Good luck! Comment Reply Read in a line as a String from texfile. File file = new File("fileName.txt"); Scanner input = new Scanner(file); while (input.hasNextLine()) { String line = input.nextLine(); //&lt;------This is a String representation of a line System.out.println(line); //prints line //Do your splitting here of lines containing more than 1 word //Store your Strings here accordingly //----&gt; Go on to nextLine }
score: 1
has comment: http://stackoverflow.com/comment/33347326
has comment: http://stackoverflow.com/comment/33347067
has comment: http://stackoverflow.com/comment/33347208
has comment: http://stackoverflow.com/comment/33347284
upvote count: 1
has comment: http://stackoverflow.com/comment/33347277

http://stackoverflow.com/comment/33208364
type: Comment
type: QuestionComment
score: 2
has text: Recursive? Maybe. Could you extract that into its own method and profit from a new found clarity? ***Yes, immediately.***
comment on: http://stackoverflow.com/q/21924315

http://stackoverflow.com/q/21855420
answer count: 2
possible better answer: http://stackoverflow.com/a/21864892
downvote count: 0
has title: Are multiple VBO's/DL's needed for different resolutions?
favorite count: 0
has body: I have a 3D application in which I render terrain as a heightmap. The further away the terrain is from the camera the lower the resolution it will be at. Is there any option other than creating a vertex buffer object / display list for every resolution or would there be a way to have one, at the highest resolution, and somehow tell the GPU to only use some of the data?
accepted answer: http://stackoverflow.com/a/23661296
type: AnsweredQuestion
tagged with: opengl
score: 1
tagged with: java
tagged with: lwjgl
upvote count: 1
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/21864892
has answer: http://stackoverflow.com/a/23661296

http://stackoverflow.com/q/21999970
has comment: http://stackoverflow.com/comment/33345971
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33358483
type: AnsweredQuestion
tagged with: javascript
has comment: http://stackoverflow.com/comment/33344931
has comment: http://stackoverflow.com/comment/33343798
type: Question
has comment: http://stackoverflow.com/comment/33343991
has answer: http://stackoverflow.com/a/22018862
linked to: http://stackoverflow.com/q/3177733
has comment: http://stackoverflow.com/comment/33343877
has comment: http://stackoverflow.com/comment/33344061
score: 0
has comment: http://stackoverflow.com/comment/33343751
answer count: 1
has title: Javascript/Java: suppress syntax error?
accepted answer: http://stackoverflow.com/a/22018862
tagged with: java
has body: Mostly regarding Javascript, but there is some Java involved. I am using the Eclipse IDE and I have the following type of code in a .jsp file. &lt;% //some stuff try { //some java code %&gt; &lt;script type="text/javascript"&gt; //Some javascript code to try &lt;% } catch(Exception e) {} %&gt; The issue is in the top portion of java, where it doesn't know that I later add in the catch(). I have an annoying error message showing up: Multiple annotations found at this line: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Syntax error, insert "Finally" to complete TryStatement &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Syntax error, insert "}" to complete ClassBody While it has no effect on the compilation or actually causes any issues, I am curious if there is a way to suppress the warning so I don't have the red 'X' going up through all the folders? It would be preferable if the solution did not affect the warnings in other files. I would give Imaginary Bonus Points for a solution which does not use Eclipse settings to handle the situation. Solution: The reason the javascript code was in the try/catch was to keep it from running if an error was caught. Rather than doing it like above, it was reformatted like so: &lt;% //some stuff boolean valid = false; try { //some java code valid = true; } catch(Exception e) {} %&gt; &lt;script type="text/javascript"&gt; if (&lt;%valid%&gt;) { //Some javascript code to try }

http://stackoverflow.com/a/21925074
has body: I think you should change your method likes this; @ManagedBean @SessionScoped public class PessoaFisicaBean { HumanDaoImp dao = new HumanDaoImp(); public void add() { Human human = new Human();//New object dao.add(human); } public void edit() { Human human = getHuman();//Old object that want to edit dao.edit(human); } } In your DAOImpl public void add(Human human) { entityManager.getTransaction().begin(); entityManager.persist(human); entityManager.getTransaction().commit(); } public void edit(Human human) { entityManager.getTransaction().begin(); entityManager.merge(human); entityManager.getTransaction().commit(); } So you don't need to worry which is persist or merge.
type: Answer
answers question: http://stackoverflow.com/q/21923512
accepted answer of: http://stackoverflow.com/q/21923512
type: AcceptedAnswer
score: 0

http://stackoverflow.com/a/21902826
type: Answer
score: 3
upvote count: 3
has body: That is anonymous Inner class. It can actually come in handy when making an instance of an object which something extra such as overloading methods, without having to actually subclass a class. I use it mostly when i want to attach a listner. When you conventionally attach a listner you have to overload each method but when you use annonymous inner class you just overload the method you want. button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Method to be used. } });
accepted answer of: http://stackoverflow.com/q/21902661
answers question: http://stackoverflow.com/q/21902661
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33240027
comment on: http://stackoverflow.com/q/21941971
has text: Instead of run there must be start and you need to define the run method.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33082065
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21854044
has text: Im not having problem with transporting the user Item, I have a problem obtaining one particular User Item from the LinkedHashSet by its ID

http://stackoverflow.com/comment/33203201
comment on: http://stackoverflow.com/a/21875657
type: AnswerComment
has text: @sethu: You could actually add your own answer containing that update, instead of modifying the question. For future visitors of this question, it will be more obviuous to understand how your solution came to be...
type: Comment
score: 0

http://stackoverflow.com/q/21877562
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21877890
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/33168859
has body: &lt;%@attribute name="myid" required="true"%&gt; &lt;input type="text" id="&lt;%=it.java.class.utils.ParameterPortlet.%&gt;${myid}" /&gt; I want to concatenate &lt;%=java.class%&gt; with ${myid} to get it.java.class.utils.ParameterPortlet.myid. But after deploying my project I get this error: ERROR [http-bio-8080-exec-86][PortletRequestDispatcherImpl:137] org.apache.jasper.JasperException: Unable to compile class for JSP org.apache.jasper.JasperException: Unable to compile class for JSP In it.java.class.utils.ParameterPortlet I have myClass.java that contains a list of strings: public final class myClass { public static final String INPUTNAMEID = "myname"; public static final String INPUTCITYID = "mycity"; public static final String INPUTID = "myid"; } So what I want to do is to change dynamically the "myid" &lt;%=it.java.class.utils.ParameterPortlet.myid%&gt; using JSTL to myinput, myselect, myid, etc.. What I did wrong? Any help is appreciated. Thank you!
score: 0
tagged with: jstl
answer count: 1
tagged with: jsp
linked to: http://stackoverflow.com/q/122254
has comment: http://stackoverflow.com/comment/33124973
has title: How to concatenate a JSTL variable with JSP id?

http://stackoverflow.com/q/21986569
score: 2
tagged with: jruby
answer count: 1
downvote count: 0
favorite count: 0
has title: Chat Application in java without polling concept
has comment: http://stackoverflow.com/comment/33319163
has body: I have created one to one a chat application in java using spring3. What it does is polling the database for new messages for the particular user. This is still a development code and can't give it to production &amp; u know what will happen. I want to create a chat application without this polling concept. I need the users to get messages when the messages arrive for them only more like push. I searched and found results for web sockets, comet,XMPP etc and most of them need specific server and beta versions. I am running my application in IBM WebSphere. Anybody have any idea what to do? Does J Ruby a worthy try?
has comment: http://stackoverflow.com/comment/33320715
has comment: http://stackoverflow.com/comment/33319182
upvote count: 2
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21988653
type: Question
has comment: http://stackoverflow.com/comment/33320439
has comment: http://stackoverflow.com/comment/33320479
has comment: http://stackoverflow.com/comment/33319260
tagged with: chat

http://stackoverflow.com/q/21989351
tagged with: swing
has title: Draw transparent path
tagged with: java
has comment: http://stackoverflow.com/comment/33325157
tagged with: draw
type: Question
linked to: http://stackoverflow.com/q/17414933
score: 0
has body: I'm developing a java application for draw through the drag of the mouse. I need the JPanel to be transparent, but in this way lose the function rubber. With the getBackground() can set the transparent color to use, but the path is not going to erase what was previously drawn.
answer count: 1
has answer: http://stackoverflow.com/a/21989524
type: UnansweredQuestion

http://stackoverflow.com/q/21926962
has comment: http://stackoverflow.com/comment/33212835
tagged with: database
has comment: http://stackoverflow.com/comment/33213008
has comment: http://stackoverflow.com/comment/33213126
has comment: http://stackoverflow.com/comment/33212829
has title: Android trouble in getting data from Database to Edit Text View
has comment: http://stackoverflow.com/comment/33213044
has body: Like if I type some text on Edit Text View and press save button, the data is getting saved to database. Now I want, when I restarts the emulator, the saved text will remain there on the Edit Text View. I am calling getMsg() method from database for displaying the text. Please have look on my code... MainActivity.java public class MainActivity extends Activity implements LocationListener { String separator = "; "; private Button btn_cntct; private EditText message; LinearLayout linearLayoutSec; private Button GPSState; Button b_alert; Button b_save_message; public int REQUESTCODE = 1; int temp; ScrollView ScrView; Context c = MainActivity.this; Button AlertMessages; private static ArrayList&lt;ContactItems&gt; selectedContactList = new ArrayList&lt;ContactItems&gt;(); static CustomAdapter adapter; public static String[] myvalue = new String[1]; Spinner spinner; static String[] alert = { " ", "I am in danger", "Help Me", "Watch Out", "Look For Me", "Cover ME" }; MySQLiteHelper dbHelper; String savedMessage; Button bsave; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); message = (EditText) findViewById(R.id.et_message); dbHelper = new MySQLiteHelper(this); String dis = dbHelper.getMsg(); if (dis != null) { message.setText(dis); } bsave = (Button) findViewById(R.id.b_save); bsave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub String str = message.getText().toString(); dbHelper.updateMsg(str); } }); MySQLiteHelper.java public class MySQLiteHelper extends SQLiteOpenHelper { public static final String TABLE_NAME = "userdetails"; public static final String TABLE_NAME_MSG = "usermessage"; public static final String COLUMN_ID = "_id"; public static final String COLUMN_NUMBER = "NUMBER"; public static final String COLUMN_NAME = "name"; public static final String COLUMN_TYPE = "type"; public static final String C…
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/33212877
tagged with: sqlite
has comment: http://stackoverflow.com/comment/33212778
has answer: http://stackoverflow.com/a/21927263
has answer: http://stackoverflow.com/a/21928114
has comment: http://stackoverflow.com/comment/33213032
has comment: http://stackoverflow.com/comment/33213077
has answer: http://stackoverflow.com/a/21927183
has comment: http://stackoverflow.com/comment/33213239
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33212867
tagged with: android
has comment: http://stackoverflow.com/comment/33212905
tagged with: android-edittext
has comment: http://stackoverflow.com/comment/33213202
tagged with: java
linked to: http://stackoverflow.com/q/14142908
has comment: http://stackoverflow.com/comment/33213024
has comment: http://stackoverflow.com/comment/33213142
has comment: http://stackoverflow.com/comment/33212896
type: Question
has comment: http://stackoverflow.com/comment/33212793

http://stackoverflow.com/q/21913578
has body: I have both jre 6 and 7 installed in my machine (with Windows 7). The default jre for my workspace is 6, and all my projects reference to the workspace default jre. So far so good, everything works fine. But if I change the system variable JRE_HOME to the location of jre 7, I keep getting NoClassDefFoundError for random classes when running my application. Why does this happen? I don't want to know how to solve it, I want to know why does it happen.
has title: NoClassDefFoundError when workspace's jre not the same as jre_home
score: 0
tagged with: windows
type: UnansweredQuestion
tagged with: system-variable
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/21913680
answer count: 1

http://stackoverflow.com/a/57162321
answers question: http://stackoverflow.com/q/21884378
has body: I fixed this issue with doing the following: Click at the menu Window - Preferences - Debug - Step Filtering And check all the packages like the following image. (Step Filtering) Then, debug again your project and thats it. Best regards,
type: Answer
score: 0

http://stackoverflow.com/q/21971243
has comment: http://stackoverflow.com/comment/33293203
tagged with: opengl
tagged with: java
has title: Exception in thread "LWJGL Application" java.lang.NullPointerException
tagged with: cross-platform
has body: I am following a tutorial on creating a game with LibGdx from some ebook. the tutorial has steps for creating a game called "Canyon Bunny". Its a simple 2D game. but i keep getting this annoying error! (i also used to get the error on a different tutorial of the same genre) i am in the early stages of the development for this game. and i am doing some test (of which i follow to the letter from the tutorial). I use a MAC and a i have tried many solutions with no luck at all. Exception in thread "LWJGL Application" java.lang.NullPointerException at com.Adel.CanyonBunny.game.WorldUpdater.updateTestObjects(WorldUpdater.java:83) at com.Adel.CanyonBunny.game.WorldUpdater.update(WorldUpdater.java:76) at com.Adel.CanyonBunny.CanyonBunnyMain.render(CanyonBunnyMain.java:39) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:207) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114) It is truly one of the most frustrating things a striving programmer can face. ill get the code of all the classes in case that's related somehow... This is CanyonBunnyMain in the general program: package com.Adel.CanyonBunny; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL10; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture.TextureFilter; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.Adel.CanyonBunny.game.*; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL10; import com.badlogic.gdx.Application; public class CanyonBunnyMain implements ApplicationListener { private static final String TAG = CanyonBunnyMain.class.getName(); private WorldUpdater worldUpdater; private WorldRenderer worldRenderer ; private boolean paused ; public void create() { //I'll set the log to d…
type: Question
tagged with: libgdx
has answer: http://stackoverflow.com/a/22492519
score: 0
answer count: 2
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/33297694
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22458005

http://stackoverflow.com/comment/33622050
has text: ... or use a GridLayout.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22155272
type: Comment

http://stackoverflow.com/comment/33276684
has text: try{ Class.forName("com.mysql.jdbc.Driver"); } catch(ClassNotFoundException e) { } try { Properties connInfo = new Properties(); connInfo.put("characterEncoding","UTF8"); connInfo.put("user", "root"); connInfo.put("password", "goskomstat"); conn = DriverManager.getConnection("jdbc:mysql://localhost", connInfo);
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21961204
type: Comment

http://stackoverflow.com/a/33086694
type: Answer
has body: Download jasperreports-fonts.jar file Add Mangal Font inside the jar file to the below mentioned location jasperreports-fonts-with-Mangal.jar\net\sf\jasperreports\fonts\dejavu Make following changes in fonts.xml with inside the jar and save the file net/sf/jasperreports/fonts/dejavu/mangal.ttf net/sf/jasperreports/fonts/dejavu/mangalb.ttf Identity-H true 4.) In jasper reports select font mangal in the above font bar. :) Enjoy.
answers question: http://stackoverflow.com/q/21980822
score: 0

http://stackoverflow.com/q/21927398
has comment: http://stackoverflow.com/comment/33213565
has comment: http://stackoverflow.com/comment/33213990
tagged with: java
tagged with: set
type: Question
has comment: http://stackoverflow.com/comment/33213674
score: 0
has body: I was recently asked this question in an interview, I was given given a class and a tester class which I had to run to check if the test cases were satisfied. I had to write addParent(), getParent(), addChild(), getChild(), setSpouse(), getSpouse, hasSpouse() and isRelated() methods. I was given 1 hour and this is what I could come up with. I have been trying to debug since 3 days but I only get empty sets after adding parents and children. Below is my code: package kashyap; import java.util.Set; import java.util.HashSet; public class MyPerson implements Person { //declarations private String name; private long ssn; private char gender; //private Person parent; private Set&lt;Person&gt; parents = new HashSet&lt;Person&gt;(); private Set&lt;Person&gt; children = new HashSet&lt;Person&gt;(); private Person spouse = null; //methods public String getName() { return name; } public void setName(String name) { this.name = name; } public long getSSN() { return ssn; } public void setSSN(long ssn) { this.ssn = ssn; } public char getGender() { return gender; } public void setGender(char gender) { this.gender = gender; } public MyPerson(String name, long ssn, char gender) { this.name = name; this.ssn = ssn; this.gender = gender; } public void addParent(Person parent) { // TODO Auto-generated method stub this.parents.add(parent); } public Set&lt;Person&gt; getParents() { // TODO Auto-generated method stub if(parents.isEmpty()) { return null; } else { return parents; } } public void addChild(Person child) { // TODO Auto-generated method stub this.children.add(child); } public Set&lt;Person&gt; getChildren() { // TODO Auto-generated method stub if(children.isEmpty()) { return null; } else { return children; } } public void setSpouse(Person spouse) { // TODO Auto-generated method stub this.spouse = spouse; } public Person getSpouse() { // TODO Auto-generated method stub if(spouse != null) { return spouse; } else { return null; } } public boolean hasSpouse() { // TODO Auto-generated…
has comment: http://stackoverflow.com/comment/33213580
answer count: 1
has comment: http://stackoverflow.com/comment/33213741
has answer: http://stackoverflow.com/a/21927524
has comment: http://stackoverflow.com/comment/33213544
has title: Having trouble in debugging - Empty Sets
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33213507

http://stackoverflow.com/a/21969475
answers question: http://stackoverflow.com/q/21969383
has comment: http://stackoverflow.com/comment/33290470
type: Answer
has body: In your outer ButtonActionListener class, write something like the following: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; public class ButtonActionListener implements ActionListener { public void actionPerformed(ActionEvent event) { if (event.getActionCommand().equals("button1")) { ((JButton) (event.getSource())).setText("X"); } } } You can call the getSource() method to fetch the component which called this actionPerformed(ActionEvent) method, and then cast it to JButton, since we know its a ButtonActionListener, and then set its appropriate text. UPDATE: Here's a demonstration of how to use outer ActionListener class: import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class Demo { public static final String BUTTON_1 = "Demo.BUTTON_1"; public static final String BUTTON_2 = "Demo.BUTTON_2"; public Demo() { JFrame frame = new JFrame("Outer ActionListener"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new FlowLayout(FlowLayout.CENTER)); ButtonActionListener buttonActionListener = new ButtonActionListener(); JButton button1 = new JButton("Button 1"); button1.setActionCommand(Demo.BUTTON_1); button1.addActionListener(buttonActionListener); JButton button2 = new JButton("Button 2"); button2.setActionCommand(Demo.BUTTON_2); button2.addActionListener(buttonActionListener); frame.add(button1); frame.add(button2); frame.pack(); frame.setLocationRelativeTo(null); frame.setResizable(false); frame.setVisible(true); } public static void main(String[] args) { // Doing this because Swing is not thread safe. SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new Demo(); } }); } } class ButtonActionListener implements ActionListener { @Override public void actionPerformed(ActionEvent event) { String actionCommand = event.getActionComm…
has comment: http://stackoverflow.com/comment/33290277
score: 4
has comment: http://stackoverflow.com/comment/33291565
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/21951285
answers question: http://stackoverflow.com/q/21951268
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: After replacing $ from your string use string.trim(); to remove spaces from string

http://stackoverflow.com/comment/33344752
has text: ok fair enough. I am surprised, 20-30 seconds seems much longer than I expected
type: AnswerComment
comment on: http://stackoverflow.com/a/21933027
type: Comment
score: 0

http://stackoverflow.com/comment/38198823
comment on: http://stackoverflow.com/q/22004361
score: 0
type: Comment
type: QuestionComment
has text: check this link http://grepcode.com/snapshot/repository.grepcode.com/java/eclipse.org/3.7/org.eclipse.jdt/core/3.7.0/ it will give full source code

http://stackoverflow.com/q/21965857
upvote count: 3
has comment: http://stackoverflow.com/comment/33283227
type: UnansweredQuestion
tagged with: spring-annotations
tagged with: spring
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/21966296
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/33283248
answer count: 2
tagged with: mockito
has title: Spring @Value annotation not working with mockito mock
downvote count: 0
favorite count: 0
has body: I am using spring @Value annotation and setting values for some fields in class A. I am writing unit tests for this class A. In the test class, I am annotating the reference for class A with Mockito @Spy. I am setting the values as system properties and then invoking MockitoAnnotations.initMocks(this). My expectation is the spied object will have the fields initialized with the values from system properties via @Value annotation. But this is not happening. Please anybody could explain?
has comment: http://stackoverflow.com/comment/33283226
has answer: http://stackoverflow.com/a/21967275

http://stackoverflow.com/q/21918631
accepted answer: http://stackoverflow.com/a/21918769
has comment: http://stackoverflow.com/comment/33198437
has body: I want to keep my Java projects on a flash drive. Whenever I start up Eclipse, I choose the folder on my flash drive with all of my projects, but the package explorer is always empty. I constantly have to make new duplicate projects and copy the text from the .java file. Can someone help me out?
type: AnsweredQuestion
tagged with: java
has title: Eclipse Package Explorer is always empty?
tagged with: eclipse
type: Question
possible better answer: http://stackoverflow.com/a/21918773
has answer: http://stackoverflow.com/a/21918769
has answer: http://stackoverflow.com/a/21918773
score: 0
answer count: 2

http://stackoverflow.com/a/21949789
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21941884
answers question: http://stackoverflow.com/q/21941884
has comment: http://stackoverflow.com/comment/33260791
score: 4
has body: The trick here is to create a JList before showing the option pane, then query it after the option pane is shown. import java.awt.BorderLayout; import java.util.List; import javax.swing.*; class MultiSelectListInOptionPane { public static void main(String[] args) { Runnable r = new Runnable() { @Override public void run() { JPanel gui = new JPanel(new BorderLayout()); String[] fruit = {"Apple", "Banana", "Grapefruit", "Orange"}; JList&lt;String&gt; list = new JList&lt;String&gt;(fruit); gui.add(new JScrollPane(list)); JOptionPane.showMessageDialog( null, gui, "Rekening", JOptionPane.QUESTION_MESSAGE); List items = (List)list.getSelectedValuesList(); for (Object item : items) { System.out.println("Selected: " + item); } } }; // Swing GUIs should be created and updated on the EDT // http://docs.oracle.com/javase/tutorial/uiswing/concurrency SwingUtilities.invokeLater(r); } } E.G. Output run: Selected: Banana Selected: Orange BUILD SUCCESSFUL (total time: 7 seconds)
type: AcceptedAnswer
type: Answer
upvote count: 4

http://stackoverflow.com/q/21894964
has title: Setting Java home enviroment variable in OSX Mavericks
has comment: http://stackoverflow.com/comment/33174973
accepted answer: http://stackoverflow.com/a/21941020
possible better answer: http://stackoverflow.com/a/21900408
tagged with: macos
has answer: http://stackoverflow.com/a/21900408
has comment: http://stackoverflow.com/comment/33157022
type: AnsweredQuestion
has body: I am having issues with my Java path. I have installed the latest version of Java 1.7.0_51. When I open the Java control panel it tells me "Your system has the recommended version of Java." However when I go to terminal and type java -version I get java version "1.6.0_32" So after searching around I came across this SO Question which tells me that my Java home environment variable needs to be set. I then opened the bash_profile file and added the below line to the top of the file, above my Python path info. export JAVA_HOME=`/usr/libexec/java_home -v 1.7.0_51` # Setting PATH for Python 2.7 # The orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" export PATH NOTE: I have tried this with both -v 1.7.0_51 and -v 1.7 I save the file and recheck in terminal but it is still showing java version "1.6.0_32" when I restart Terminal I do however see Last login: Wed Feb 19 23:32:19 on ttys000 Unable to find any JVMs matching version "1.7". localhost:/ user$ Note: Unable to find any JVMs matching version "1.7". So it is trying to look for my 1.7, but just not finding it. What am I doing wrong?
tagged with: osx-mavericks
tagged with: java
has answer: http://stackoverflow.com/a/21941020
type: Question
score: 0
answer count: 2
tagged with: environment-variables
linked to: http://stackoverflow.com/q/6588390

http://stackoverflow.com/comment/33431794
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21955970
has text: I tried, but I'm not able to influence the dimensions of the label in any way. Anyway, I care about the size of the taskPanel, which behaves odd if the label has lineWrap turned on. I'm quite lost here.

http://stackoverflow.com/comment/33373948
has text: I also see that I would need to implement an Editor class so that events could be handled when the checkbox for each node is selected and deselected. However, I am coming from a background of very little Java experience and even very little object-oriented programming experience, for that matter. And it is extremely obvious that you don't have the time to walk me through your code so I can learn how to do what I need to do. If you have a suggestion for a better place to get such help, please let me know.
score: 0
comment on: http://stackoverflow.com/a/21924930
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/33067088
type: Comment
comment on: http://stackoverflow.com/q/21844708
has text: cool brian :)hereon, will do that for sure :)
score: 0
type: QuestionComment

http://stackoverflow.com/q/21842848
has comment: http://stackoverflow.com/comment/33063348
upvote count: 1
has answer: http://stackoverflow.com/a/21842906
has title: What does through intent and programmatically mean?
favorite count: 0
score: 0
tagged with: android
downvote count: 1
has body: i'm searching for codes for my Android application and i encounter these two words. it says that i can do this by INTENT or i can do this PROGRAMATICALLY? what's the difference between the two by the way? thanks
type: UnansweredQuestion
type: Question
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/21842940

http://stackoverflow.com/comment/33258860
type: Comment
type: QuestionComment
has text: Are you sure you get a `ConcurrentModificationException` error when you **compile**? Can you post the exact error message or stack trace if it's actually a runtime error?
comment on: http://stackoverflow.com/q/21952648
score: 0

jndi
tags question: http://stackoverflow.com/q/21922006
tags question: http://stackoverflow.com/q/21934989
tag name: jndi
type: Tag
tags question: http://stackoverflow.com/q/21942292

http://stackoverflow.com/comment/33208002
has text: i think i will solve it just adding a human = new Human();, i dont know how to solve without it
comment on: http://stackoverflow.com/a/21923968
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21899705
has comment: http://stackoverflow.com/comment/33171865
has comment: http://stackoverflow.com/comment/33185854
has comment: http://stackoverflow.com/comment/33172271
answers question: http://stackoverflow.com/q/21874349
upvote count: 1
has comment: http://stackoverflow.com/comment/33171577
score: 1
has comment: http://stackoverflow.com/comment/33208836
has comment: http://stackoverflow.com/comment/33172702
downvote count: 0
has comment: http://stackoverflow.com/comment/33172770
has comment: http://stackoverflow.com/comment/33171515
has comment: http://stackoverflow.com/comment/33226544
has comment: http://stackoverflow.com/comment/33171284
has body: Please check GWT Internationalize. If you want to internationlize for messages with GWT , check Static String Internationalization and Dynamic String Internationalization. I used GWT ConstantsWithLookup for constant datas (such as Text of Buttons , Text ofLabels ). And I use GWT Messages for my message datas (such as alerts , warning , confirm , prompt dialogs). Don't be forget to add configuration at gwt.xml file as below... &lt;extend-property name="locale" values="en"/&gt; &lt;extend-property name="locale" values="ja"/&gt; &lt;!-- set the fallback for locale default Japan --&gt; &lt;set-property-fallback name="locale" value="ja"/&gt; ........ I used Local en for English and ja for Japanese. I created ListBox for user to choose Locale as they prefer and used Cookie to maintain as user perference. Below is my sample codes for saving locale in cookie to internationalize at next-time open... public static void initializeLocaleBox(final ListBox localeBox) { String currentLocale = LocaleInfo.getCurrentLocale().getLocaleName(); if (currentLocale.equals("default")) { currentLocale = "ja"; } String[] localeNames = LocaleInfo.getAvailableLocaleNames(); for (String localeName : localeNames) { if (!localeName.equals("default")) { String nativeName = LocaleInfo.getLocaleNativeDisplayName(localeName); localeBox.addItem(nativeName, localeName); if (localeName.equals(currentLocale)) { localeBox.setSelectedIndex(localeBox.getItemCount() - 1); } } } localeBox.addChangeHandler(new ChangeHandler() { public void onChange(final ChangeEvent event) { String localeName = localeBox.getValue(localeBox.getSelectedIndex()); Date now = new Date(); long sevenDays = now.getTime(); // seven days sevenDays = sevenDays + (1000 * 60 * 60 * 24 * 7); now.setTime(sevenDays); Cookies.setCookie("locale", localeName, now); UrlBuilder builder = Location.createUrlBuilder().setParameter("locale", localeName); Window.Location.replace(builder.buildString()); } }); } public static boolean isLocaleJapan() { Str…
type: Answer
has comment: http://stackoverflow.com/comment/33173455

http://stackoverflow.com/a/21952864
has body: The process is likely either blocking waiting for input or it has written so much output that it has filled up the processes output buffer and is waiting for you to read the output. Either way you can get more information if you make sure to print out the stdout and stderr of the process: private static class StreamReader implements Runnable { private InputStream stream; private volatile boolean finished = false; public StreamReader(InputStream stream) { this.stream = stream; } public void run() { Scanner scanner = new Scanner(stream); while(!finished) { System.out.println(scanner.nextLine()); } } } //... runtimeProcess = Runtime.getRuntime().exec(command); StreamReader stdoutReader = new StreamReader(runtimeProcess.getInputStream()); StreamReader stderrReader = new StreamReader(runtimeProcess.getErrorStream()); new Thread(stdoutReader).start(); new Thread(stderrReader).start(); int processComplete = -1; try { processComplete = runtimeProcess.waitFor(); } finally { stdoutReader.finished = true; stderrReader.finished = true; }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21950657

http://stackoverflow.com/comment/43224415
has text: @user2340612: I would not be so categorical. try `System.out.println("GET" == "GET");`, you may be surprised.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21867214

http://stackoverflow.com/q/21950055
has body: I am developing an eclipse plugin and I want the names of the all the methods (which exists in the Android API) used in the Android Project source code. Does anyone know how should I parse the code? Suppose my source code is: package com.example.androidsample; import android.content.Context; import android.location.Location; import android.location.LocationManager; import android.telephony.SmsManager; public class MockLocationProvider { String providerName; Context ctx; public MockLocationProvider(String name, Context ctx) { this.providerName = name; this.ctx = ctx; LocationManager lm = (LocationManager) ctx.getSystemService( Context.LOCATION_SERVICE); lm.addTestProvider(providerName, false, false, false, false, false, true, true, 0, 5); SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage("Phone Number", null, "Message", null, null); lm.setTestProviderEnabled(providerName, true); } public void pushLocation(double lat, double lon) { LocationManager lm = (LocationManager) ctx.getSystemService( Context.LOCATION_SERVICE); Location mockLocation = new Location(providerName); mockLocation.setLatitude(lat); mockLocation.setLongitude(lon); mockLocation.setAltitude(0); mockLocation.setTime(System.currentTimeMillis()); lm.setTestProviderLocation(providerName, mockLocation); } public void shutdown() { LocationManager lm = (LocationManager) ctx.getSystemService( Context.LOCATION_SERVICE); lm.removeTestProvider(providerName); } } Then the list that I requies is something like: [ getSystemService, addTestProvider, getDefault, sendTextMessage, setTestProviderEnabled, setLatitude, setLongitude, setAltitude, setTime, setTestProviderLocation, removeTestProvider ] Any help in this direction is appreciated.
tagged with: java
has title: Eclipse Plugin: Parse the Android Project source code to get the names of the methods used
type: Question
has answer: http://stackoverflow.com/a/22729627
score: 0
answer count: 1
tagged with: eclipse-plugin
tagged with: parsing
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/21915793
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/21916731
tagged with: java
tagged with: servlets
accepted answer: http://stackoverflow.com/a/21916731
score: 0
has title: Count number of objects in datastore AppEngine java
answer count: 1
has body: I am trying to do a simple application that will persist an object every time a get request is made. In the below code, I use a servlet Put to accomplish this. public class Put extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/plain"); PersistenceManagerFactory PMF = JDOHelper .getPersistenceManagerFactory("transactions-optional"); PersistenceManager pm = PMF.getPersistenceManager(); String id = req.getParameter("id"); String name = req.getParameter("name"); String email = req.getParameter("email"); String productId = req.getParameter("productid"); String timeStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); String mailSent = req.getParameter("mailsent"); Product product = new Product(id,name,email,productId,timeStamp,mailSent); /* * Get number of objects persisted till now * Increment the count and use that value as key */ Key key = KeyFactory.createKey(Product.class.getSimpleName(), "1001"); // ?? product.setKey(key); try { pm.makePersistent(product); } finally { pm.close(); } } } to retrieve all objects I use a Get servlet, public class Get extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/plain"); PersistenceManagerFactory PMF = JDOHelper .getPersistenceManagerFactory("transactions-optional"); PersistenceManager pm = PMF.getPersistenceManager(); /* * Get number of objects stored * loop from 0 to the count and print all objects * */ Product e = pm.getObjectById(Product.class, req.getParameter("id")); resp.getWriter().println(); } } My problem is how to get number of objects stored in the datastore?
tagged with: google-app-engine

http://stackoverflow.com/comment/33116750
score: 0
type: Comment
has text: @Val I should also point at that if you wish to monitor the state of an external process from within Swing, you need to do it from outside of the Event Dispatching Thread, otherwise it will "freeze" the program. If you didn't care about the return value or the output of the external process, then no, you wouldn't need a thread, but that wasn't the question
type: AnswerComment
comment on: http://stackoverflow.com/a/21872343

http://stackoverflow.com/q/21919236
has comment: http://stackoverflow.com/comment/33199480
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/21919298
has comment: http://stackoverflow.com/comment/33199552
has answer: http://stackoverflow.com/a/21924644
possible better answer: http://stackoverflow.com/a/21919286
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21919286
upvote count: 2
tagged with: java
type: Question
has body: So I want to check if anything exists in an array list in an if statement. So instead of MyArrayList.Contains("blah"); I want something that checks if ANYTHING is in it. EDIT!: Found it out! Thanks for all the help! Answer: MyArrayList.isEmpty(){ } THANKS!
has answer: http://stackoverflow.com/a/21919263
has title: How can I check if anything is in an ArrayList
has answer: http://stackoverflow.com/a/21919325
downvote count: 5
score: -3
accepted answer: http://stackoverflow.com/a/21919325
has comment: http://stackoverflow.com/comment/33199593

http://stackoverflow.com/a/22004018
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21998796
upvote count: 1
score: 1
has body: Try mvn clean package -U tomcat7:run As run-war-only run a packaged war so won't see your code changes. if you want debug in your ide use mvnDebug clean package -U tomcat7:run Then attach a debugger to port 8000 HTH

http://stackoverflow.com/comment/33196404
type: AnswerComment
type: Comment
has text: Bummer. JBoss class loading in EAP 5.1 is absolutely hellish. Sorry my suggestion didn't work for you.
score: 0
comment on: http://stackoverflow.com/a/21885571

http://stackoverflow.com/a/21925336
score: 1
has body: According to postgresql documentation , you faced connection_failure problem.So check the following steps, Check your connection configuration into your hibernate configuration file Check your database connection is opened or not. Check your network connection The above are not ok please post your postgressql log file again
answers question: http://stackoverflow.com/q/21925083
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/q/21865179
has comment: http://stackoverflow.com/comment/33107339
downvote count: 0
has body: I am trying to make a RESTful service using Java, using several tutorials and many, MANY StackOverflow entries. Unfortunately I don't seem to be able to get my code to work, I am persistantly getting Http 406 when I try and hit the endpoint. Any help is appreciated. GreetingController.java: import java.util.Random; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @Controller @RequestMapping("/greeting") public class GreetingController { protected final Logger log = LoggerFactory.getLogger(GreetingController.class); private static final String template = "Hello, %s!"; private static Random rand = new Random(); @RequestMapping(method = RequestMethod.GET, headers="Accept=*/*")//, value="/{name}") @ResponseBody public Greeting greeting() { log.debug("Entered greeting()"); return new Greeting(rand.nextInt(99999999), String.format(template, "Stephen")); } @RequestMapping(method = RequestMethod.GET, value="/{name}") @ResponseBody public Greeting greetingName(@PathVariable String name) { log.debug("Entered greetingName()"); return new Greeting(rand.nextInt(99999999), String.format(template, name)); } } Greeting.java: import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name="greeting") @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) public class Greeting { private Integer id; private String content; public Greeting() { } public Greeting(Integer id, String content) { this.id = id; this.content = content; } @XmlElement public void setId(Integer id) { this.id = id; } public Integer getId() { return id; } @XmlElement public void…
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has answer: http://stackoverflow.com/a/25388463
has answer: http://stackoverflow.com/a/50583537
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33146612
score: 6
tagged with: spring
upvote count: 6
answer count: 4
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/21865330
has title: Spring XML 406 error
has comment: http://stackoverflow.com/comment/33184193
tagged with: java
has comment: http://stackoverflow.com/comment/33144827
has comment: http://stackoverflow.com/comment/33107556
type: Question
tagged with: http-status-code-406
has answer: http://stackoverflow.com/a/29153793

http://stackoverflow.com/comment/33817793
type: Comment
has text: The "third way" works the best for me. It preserves all the other style attributes and only changes the menu bar.
comment on: http://stackoverflow.com/a/21863577
type: AnswerComment
score: 0

http://stackoverflow.com/q/21988470
has body: prefs = Preferences.userRoot().node("VAR_PREFS"+userName); Appears to put prefs in my registry. Is there a way I could specify a file in a specific folder instead? like: prefs = Preferences.folder("/usr/mypath/VAR_PREFS"+userName);
has comment: http://stackoverflow.com/comment/33323895
tagged with: preferences
has title: java how do I put Preferences in a specific folder?
type: UnansweredQuestion
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33322283
has comment: http://stackoverflow.com/comment/33322361
type: Question

http://stackoverflow.com/q/22002709
has comment: http://stackoverflow.com/comment/33350319
has title: Accessing a single item in listview of android using http json requests
has comment: http://stackoverflow.com/comment/33349201
tagged with: parsing
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33348998
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am following this tutorial and I have gotten the code to display a list view of contacts. However, I am having issues viewing a single instance. The class SingleContactActivity doesn't exist in the code or tutorial zip. I cannot find any other examples or explanations, I am completely stuck. For instance, when I click on a contact I want it to bring me to a new page showing that contacts' information. Using eclipse I created a SingleContactActivity class just to make the code happy, so when a contact is clicked on nothing actually happens- it brings me to a blank page. Does anyone have any resources or explanations on how to do this? http://www.androidhive.info/2012/01/android-json-parsing-tutorial/
type: Question
tagged with: listview
score: 0

http://stackoverflow.com/comment/33162443
type: Comment
has text: thanks for reply, it seems that I have to use SocketChannel.configureBlocking(true) before socketChannel.connect(address) , So if the connection failed, a java.net.ConnectException will be thrown.
type: AnswerComment
comment on: http://stackoverflow.com/a/21897847
score: 0

eclipse
tags question: http://stackoverflow.com/q/21858154
tags question: http://stackoverflow.com/q/21917947
tag name: eclipse
tags question: http://stackoverflow.com/q/21941161
tags question: http://stackoverflow.com/q/21983704
tags question: http://stackoverflow.com/q/21848394
tags question: http://stackoverflow.com/q/21852485
tags question: http://stackoverflow.com/q/21884378
tags question: http://stackoverflow.com/q/21917402
tags question: http://stackoverflow.com/q/22000110
tags question: http://stackoverflow.com/q/21963068
tags question: http://stackoverflow.com/q/21866315
tags question: http://stackoverflow.com/q/21862920
tags question: http://stackoverflow.com/q/21862970
tags question: http://stackoverflow.com/q/21841935
tags question: http://stackoverflow.com/q/21978937
tags question: http://stackoverflow.com/q/21868601
tags question: http://stackoverflow.com/q/21962874
tags question: http://stackoverflow.com/q/21854192
tags question: http://stackoverflow.com/q/21842864
tags question: http://stackoverflow.com/q/21910803
tags question: http://stackoverflow.com/q/21872702
tags question: http://stackoverflow.com/q/21907751
tags question: http://stackoverflow.com/q/21981234
tags question: http://stackoverflow.com/q/21909428
tags question: http://stackoverflow.com/q/21924037
tags question: http://stackoverflow.com/q/21900467
tags question: http://stackoverflow.com/q/21940873
tags question: http://stackoverflow.com/q/21964281
tags question: http://stackoverflow.com/q/21856659
tags question: http://stackoverflow.com/q/21851794
tags question: http://stackoverflow.com/q/21946936
tags question: http://stackoverflow.com/q/21955207
tags question: http://stackoverflow.com/q/21947076
tags question: http://stackoverflow.com/q/21988836
tags question: http://stackoverflow.com/q/21999201
tags question: http://stackoverflow.com/q/21888845
tags question: http://stackoverflow.com/q/21927755
tags question: http://stackoverflow.com/q/21945667
tags question: http://stackoverflow.com/q/21900965
tags question: http://stackoverflow.com/q/21879556
tags question: http://stackoverflow.com/q/21970927
tags question: http://stackoverflow.com/q/21996555
tags question: http://stackoverflow.com/q/21855658
tags question: http://stackoverflow.com/q/21918631
tags question: http://stackoverflow.com/q/21943726
tags question: http://stackoverflow.com/q/21996804
tags question: http://stackoverflow.com/q/21969383
tags question: http://stackoverflow.com/q/21964430
tags question: http://stackoverflow.com/q/21987038
tags question: http://stackoverflow.com/q/21981321
tags question: http://stackoverflow.com/q/21998184
tags question: http://stackoverflow.com/q/21911070
tags question: http://stackoverflow.com/q/21948873
tags question: http://stackoverflow.com/q/21995981
tags question: http://stackoverflow.com/q/21965792
tags question: http://stackoverflow.com/q/21937819
tags question: http://stackoverflow.com/q/21952445
tags question: http://stackoverflow.com/q/21969954
tags question: http://stackoverflow.com/q/21984525
tags question: http://stackoverflow.com/q/21869819
tags question: http://stackoverflow.com/q/21953655
tags question: http://stackoverflow.com/q/21960625
tags question: http://stackoverflow.com/q/21954733
tags question: http://stackoverflow.com/q/21866455
tags question: http://stackoverflow.com/q/21998366
tags question: http://stackoverflow.com/q/22002529
tags question: http://stackoverflow.com/q/21862337
tags question: http://stackoverflow.com/q/21870263
tags question: http://stackoverflow.com/q/21869203
tags question: http://stackoverflow.com/q/21883673
tags question: http://stackoverflow.com/q/21894766
tags question: http://stackoverflow.com/q/21907317
tags question: http://stackoverflow.com/q/21994082
tags question: http://stackoverflow.com/q/21913578
tags question: http://stackoverflow.com/q/21956385
tags question: http://stackoverflow.com/q/21961762
tags question: http://stackoverflow.com/q/21849063
tags question: http://stackoverflow.com/q/21970415
tags question: http://stackoverflow.com/q/21989842

http://stackoverflow.com/q/21897439
has comment: http://stackoverflow.com/comment/33161510
score: 4
linked to: http://stackoverflow.com/q/15948927
tagged with: java
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/21897632
has body: I saw Working Soap client example . But when i add child node for soapbody it throw an exception. Here is error: Exception in thread "main" com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to locate namespace for prefix ns3 Here is code for SOAPrequest: MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); SOAPEnvelope envelope = soapPart.getEnvelope(); SOAPBody soapBody = envelope.getBody(); SOAPElement node1 = soapBody.addChildElement("lookupEligibility","ns3"); How to solve it. Thanks!!!!
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: How to add child node for SOAPBody?
tagged with: soap

http://stackoverflow.com/a/21899621
score: 2
answers question: http://stackoverflow.com/q/21899543
upvote count: 2
has body: add this Spinner spin=(Spinner)findViewById(R.id.spinner2); in your mainactivity.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/33244664
has text: The gist is, your `readFromFile` method reads from a file, line-by-line, but that's all it does. It reads each line and forgets each line. It doesn't **process** each line to do something with it.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21944531

http://stackoverflow.com/q/21956239
has title: java - regex for string between two characters
has body: How do I get the stuff in between two #? I have this ^(#(.+?)#) and it returns a string #blah blah blah# but I only want blah blah blah How do I exclude the #?
type: Question
has answer: http://stackoverflow.com/a/21957560
has comment: http://stackoverflow.com/comment/33265334
answer count: 3
upvote count: 1
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/21956407
favorite count: 0
has comment: http://stackoverflow.com/comment/33265290
has answer: http://stackoverflow.com/a/21957848
has comment: http://stackoverflow.com/comment/33265313
type: UnansweredQuestion
tagged with: regex
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33265389

http://stackoverflow.com/a/21916109
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33234810
accepted answer of: http://stackoverflow.com/q/21914600
answers question: http://stackoverflow.com/q/21914600
has comment: http://stackoverflow.com/comment/33239396
has comment: http://stackoverflow.com/comment/33237247
type: AcceptedAnswer
downvote count: 0
has body: Taking the first state in your list, you need to explain why ooxxxo-xo should be 1. If I re-write this how I think I'm supposed to read it, the state reads as: oox xxo -xo If we correctly apply x as the next move, we would get the right answer. So, perhaps the problem is in your move generation. Looking at this, you have a single static array which is storing the moves, but when you make recursive calls, you will overwrite this moves over and over again. Instead, you need a local copy of the moves for each recursive call. So, moving your definition of minChildren and maxChildren into MinTurn and MaxTurn should fix at least one problem in the code. (I haven't verified that there aren't other problems.) To be clear, your call stack goes something like this: MaxTurn call Set maxChildren to legal moves // &lt;--- A Call MinTurn recursively MinTurn call Set minChildren to legal moves Call MaxTurn recursively MaxTurn call Set maxChildren to legal moves // &lt;--- B Call MinTurn recursively When you reach the line marked B you are overwriting the maxChildren which are computed at line A. Thus, when the program returns to A, the available moves will have been overwritten and may be different that what was previously expected. After fixing that, I believe your new problem is just in the way you are printing things. If you look at your printing code, you log the current max value, not the value returned by the child: int maxValue = Setting.NEGATIVE_INFINITY; maxChildren = generateMoves(state); for (State aChildren : maxChildren) { maxValue = Math.max(maxValue, MinTurn(aChildren)); // &lt;-- A nodes.add(aChildren.getState() + " " + maxValue); // &lt;--B } So, in the line marked B you are printing maxValue for all children seen so far. If you want to see the value of the child, you shouldn't immediately take the max in line A. Instead you store the result and log it. Then, take the max. You're having trouble with this state: oox xxo -x- This is printed from the parent state whe…
has comment: http://stackoverflow.com/comment/33238786

http://stackoverflow.com/comment/33328729
type: QuestionComment
has text: Please take care while posting, code needs to be formatted.
score: 0
comment on: http://stackoverflow.com/q/21991857
type: Comment

http://stackoverflow.com/q/21948873
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33253530
type: Question
has comment: http://stackoverflow.com/comment/33252769
has comment: http://stackoverflow.com/comment/33253436
has comment: http://stackoverflow.com/comment/33253579
has comment: http://stackoverflow.com/comment/33252511
has comment: http://stackoverflow.com/comment/33253386
has comment: http://stackoverflow.com/comment/33252596
has comment: http://stackoverflow.com/comment/33253506
has answer: http://stackoverflow.com/a/21956352
has comment: http://stackoverflow.com/comment/33252588
tagged with: eclipse
tagged with: servlets
linked to: http://stackoverflow.com/q/4245793
score: 0
answer count: 1
has title: How to run servlet in Eclipse?
tagged with: tomcat
has comment: http://stackoverflow.com/comment/33252787
has comment: http://stackoverflow.com/comment/33253647
has comment: http://stackoverflow.com/comment/33253673
has comment: http://stackoverflow.com/comment/33252653
has body: Installation Details: First I install the jdk then add a environment variable variable name = "path" variable value ="C:\Program Files\Java\jdk1.7.0_45\bin"(directory of java) Then Extract the eclipse and tomcat After extracting, I edit the catalina.bat from apache-tomcat-7.0.23\bin and add this: "set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_45" Then I made my first Servlet by creating new dynamic web project Test Form JAVA TEST import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class work */ @WebServlet("/work.html") public class work extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public work() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.print(" "); out.print(" "); out.print(" Login Authentication Result "); out.print(" Welcome to servlet "); out.print(" powered by" + getServletContext().getServerInfo()+ " "); out.print(" "); out.print("</hmtl>"); out.close(); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } } <?xml version="1.0" encoding="UTF-8"?> Test3 index.html index.htm index.jsp default.html default.htm default.jsp I'm new to servlet. I don't know why it is always have this error when clicking the button in the index.html I think I have the same problem

http://stackoverflow.com/q/21961313
has title: Heroku could not find or load main class on one-off dyno
favorite count: 0
has body: I am trying to split my Heroku application into a web process and another non-web process that could run on a one-off dyno. My directory looks something like this: app/ pom.xml src/ main/ java/ Main.java This is my pom.xml: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 app app 0.0.1-SNAPSHOT war ... org.codehaus.mojo appassembler-maven-plugin 1.1.1 target true Main oneoff package assemble maven-compiler-plugin 2.3.2 1.6 1.6 maven-war-plugin 2.2 org.apache.maven.plugins maven-dependency-plugin 2.4 package copy com.github.jsimone webapp-runner 7.0.34.0 webapp-runner.jar After I mvn package, everything and try to run sh target/bin/oneoff, it says Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCodebaseOnly= true -Djava.rmi.server.useCodebaseOnly=true Error: Could not find or load main class Main. I get this error both locally on Windows bash and on Heroku. However, it works when I use the batch counterpart, target\bin\oneoff.bat on Windows. I even tried to run it by doing java -cp target/classes:target/dependency/* Main on both heroku through heroku run and locally which results in the same error.
type: UnansweredQuestion
tagged with: maven
tagged with: heroku
has comment: http://stackoverflow.com/comment/33274867
answer count: 0
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33274850
upvote count: 1

http://stackoverflow.com/comment/33129489
has text: I am not sure how I would use this without having an actual mysql server running. However that thought did make me think about an embedded mysql server to run during my unit tests.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21879908

http://stackoverflow.com/comment/33208405
has text: Actually, I would create a new instance if I follow your advice, which wouldn't help. Thanks for helping.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21924246
type: Comment

http://stackoverflow.com/comment/33250547
type: AnswerComment
comment on: http://stackoverflow.com/a/21937130
type: Comment
has text: Had to tweak the code to also pass the activity as "GetApplicationContext()" Is now out of scope, but other than that worked like a charm. Cheers!
score: 0

http://stackoverflow.com/a/21998424
has body: Try: Server: import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; public class NewConnections { public NewConnections() { acceptConnections.start(); } Thread acceptConnections = new Thread(new Runnable() { public void run() { try { int port = 81; ServerSocket ssocket = new ServerSocket(port, 0, InetAddress.getLocalHost()); while (true) { System.out.println("waiting..."); Socket socket = ssocket.accept(); // buffered reader to read a line at a time from client BufferedReader ois = new BufferedReader(new InputStreamReader( socket.getInputStream())); String x = null; // read till input is available from client while ((x = ois.readLine()) != null) { System.out.println("Server: " + x); } ois.close(); socket.close(); } } catch (Exception e) { e.printStackTrace(); } } }); } Client: import java.io.PrintWriter; import java.net.InetAddress; import java.net.Socket; public class Client { public Client() { int port = 81; int x = 0; try { Socket socket = new Socket(InetAddress.getLocalHost(), port); // use auto flush to send the data immediately to the server PrintWriter oos = new PrintWriter(socket.getOutputStream(), true); for (int i = 0; i &lt; 3; i++) { x++; oos.println(x); System.out.println("Client: " + x); } oos.close(); socket.close(); } catch (Exception e) { e.printStackTrace(); } } }
has comment: http://stackoverflow.com/comment/33472282
has comment: http://stackoverflow.com/comment/33370267
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33340956
answers question: http://stackoverflow.com/q/21992526
accepted answer of: http://stackoverflow.com/q/21992526
type: Answer

http://stackoverflow.com/comment/33191305
type: QuestionComment
comment on: http://stackoverflow.com/q/21914503
has text: Please use capital letters where appropriate. I don't even think your print statements will work since `System` is not capitalized.
score: 0
type: Comment

http://stackoverflow.com/a/21921069
score: 0
answers question: http://stackoverflow.com/q/21911943
has body: You are not ignoring case because you never added a restriction to ignore case. You can add an ignore case to your order. Example: criteria.addOrder(Order.asc("column1").ignoreCase());
has comment: http://stackoverflow.com/comment/33270748
type: Answer

http://stackoverflow.com/q/21962227
type: Question
has comment: http://stackoverflow.com/comment/33277142
has answer: http://stackoverflow.com/a/67269811
tagged with: java
has title: Why would this cause a StringIndexOutOfBoundsException? Android
answer count: 2
has comment: http://stackoverflow.com/comment/33276410
downvote count: 0
has body: I am working on a small file manager to help me learn the basics of android, but I keep running into an error. WHenever I have a lot of items in the folder, it crashes and I get a message similar to this one, java.lang.StringIndexOutOfBoundsException: length=26; regionStart=23; regionLength=-2 What could be causing this? The line it points to is line 2: 1.)String mimeType = ""; 2.)mimeType = URLConnection.guessContentTypeFromName(f.getName());
favorite count: 0
tagged with: exception
type: UnansweredQuestion
tagged with: android
score: 1
tagged with: file
upvote count: 1
has answer: http://stackoverflow.com/a/21962327

http://stackoverflow.com/comment/33065316
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21843956
score: 0
has text: but actually, it did, it cached.

http://stackoverflow.com/q/21876386
favorite count: 0
upvote count: 5
accepted answer: http://stackoverflow.com/a/21877080
has title: How to get xml attribute value containing colon?
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/33122979
tagged with: xpath
has answer: http://stackoverflow.com/a/21877080
tagged with: java
has comment: http://stackoverflow.com/comment/33138666
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33122847
linked to: http://stackoverflow.com/q/5518096
has body: I am trying to parse an xml file using Xpath in java. I need to get all element values under text element with attribute value xml:lang="en". Here is my xml file: <?xml version="1.0" encoding="UTF-8" ?> Lake two mountains.png <description /> Location map of Lake of Two Mountains. <description/> Lage des Lac des Deux Montagnes (ganz rechts liegt Montréal) <description /> () GFDL Here is my java code snippet: DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = null; Document xmlDocument = null; try { builder = builderFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { e.printStackTrace(); } try { xmlDocument = builder.parse(new FileInputStream(fileEntry.getAbsolutePath())); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } XPath xPath = XPathFactory.newInstance().newXPath(); //prepare node expressions String nameExpr = "/image/name"; String descriptionExpr = "/image/text[@lang='en']/description"; String captionExpr = "/image/text[@lang='en']/caption"; String commentExpr = "/image/text[@lang='en']/comment"; //read a string value String name = xPath.compile(nameExpr).evaluate(xmlDocument); String description = xPath.compile(descriptionExpr).evaluate(xmlDocument); String caption = xPath.compile(captionExpr).evaluate(xmlDocument); String comment = xPath.compile(commentExpr).evaluate(xmlDocument); I tried some Xpath expressions to get element values eg: (1) /image/text[@xml:lang='en']/description" which doesn't work. (2) /image/text[@lang='en']/description" works fine. I am curious to know what is the problem with first Xpath expression. Thanks in Advance.
score: 5
has comment: http://stackoverflow.com/comment/33123661
answer count: 1
downvote count: 0

http://stackoverflow.com/q/21940880
tagged with: derby
has body: Hi below code form from my Derby embedded example... when i run on my pc(developed)it run smoothly. And then i export as jar file and run on another pc .it throws an exception table already exists. How can i create table only once on any pc public class Main { public static void main(String[] args) throws SQLException { final String driver="org.apache.derby.jdbc.EmbeddedDriver"; final String url="jdbc:derby:db/testdb"; try { Class.forName(driver); Connection connection=DriverManager.getConnection(url); //connection.createStatement().execute("create table channels(channel varchar(20),topic varchar(20))"); // connection.createStatement().execute("insert into channels (channel,topic) values('hbo','action')"); // System.out.println("saved"); PreparedStatement preStmt=connection.prepareStatement("select * from channels"); ResultSet set=null; set=preStmt.executeQuery(); while(set.next()){ System.out.print(set.getString(1)); System.out.println(set.getString(2)); } } catch (ClassNotFoundException e) { e.printStackTrace(); } } Also how to configure same issue on hibernate.cfg.xml file...!!
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/21957801
has answer: http://stackoverflow.com/a/21956865
type: UnansweredQuestion
type: Question
has title: Derby Embedded create tabel inorder run on any pc
tagged with: java

http://stackoverflow.com/q/21921507
possible better answer: http://stackoverflow.com/a/21921586
upvote count: 21
linked to: http://stackoverflow.com/q/9489384
has answer: http://stackoverflow.com/a/21921586
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21921575
downvote count: 0
has body: I've been using Guava's ImmutableMap with a Builder for awhile without giving much thought to how/why it works. I've been using the builder in the way described by the Javadoc: ImmutableMap&lt;String, Integer&gt; WORD_TO_INT = new ImmutableMap.Builder&lt;String, Integer&gt;() .put("one", 1) .put("two", 2) .put("three", 3) .build(); I've also seen examples elsewhere on SO of this syntax: ImmutableMap&lt;String,Integer&gt; myMap = ImmutableMap.&lt;String, Integer&gt;builder() .put("one", 1) .put("two", 2) .put("three", 3) .build(); Both seem to produce the exact same result. A quick glance at the ImmutableMap source shows that the static builder() call in the 2nd example returns: new Builder&lt;K, V&gt;() There doesn't appear to be any functional difference between the two methods. Is there any difference under the hood? Any reason to prefer one or the other? EDIT: Adding bytecode difference. The bytecode generated is almost identical except for one line: Method 1(Builder&lt;K,V&gt;): static {}; 0 new com.google.common.collect.ImmutableMap$Builder [12] 3 dup 4 invokespecial com.google.common.collect.ImmutableMap$Builder() [14] 7 ldc &lt;String "key1"&gt; [17] ........ Method 2:(&lt;K,V&gt;builder()) static {}; 0 invokestatic com.google.common.collect.ImmutableMap.builder() : com.google.common.collect.ImmutableMap$Builder [12] 3 ldc &lt;String "key1"&gt; [18] ........ After that they're pretty much the same, the first line being different makes sense given the source differences, but I'm not sure why the first one calls dup and the second doesn't.
favorite count: 0
accepted answer: http://stackoverflow.com/a/21921575
tagged with: immutability
has title: Guava ImmutableMap Builder syntax
type: AnsweredQuestion
tagged with: guava
score: 21
tagged with: java

http://stackoverflow.com/a/21982781
downvote count: 0
answers question: http://stackoverflow.com/q/21982367
type: Answer
has body: In my case SQLiteHelper extends SQLiteOpenHelper, then I´ve got a custom class that makes use of this SQLiteHelper with the next 3 methods (initialization, open and close). Take a look at the dbHelper.getWritableDatabase(); method please. That might be the one you need. private SQLiteDatabase database; private SQLiteHelper dbHelper; public CallHistoryDataSource(Context context) { dbHelper = new SQLiteHelper(context); } private void open() throws SQLException { database = dbHelper.getWritableDatabase(); } private void close() { dbHelper.close(); }
score: 1
upvote count: 1

http://stackoverflow.com/q/21924045
type: Question
has title: threading from Java to C++
has answer: http://stackoverflow.com/a/21924161
has answer: http://stackoverflow.com/a/21924140
score: 0
tagged with: mutex
answer count: 2
tagged with: pthreads
type: UnansweredQuestion
tagged with: c++
tagged with: semaphore
tagged with: java
has body: I have this Kevin class that implements runnable on JAVA and this KevinThreads class that create thread objects based on the Kevin instances and run it. public class KevinThreads{ public static void main(String[] args){ if(args.length!=2) { System.err.println("Usage: KevinThreads.java (1st param) (2nd param)"); System.err.println("1st param: specifies the number of threads to be executed"); System.err.println("2nd param: specifies the state of execution. 1=MUTEX,2=NON-MUTEX"); return; } int number_of_threads = Integer.parseInt(args[0]); int thread_mode = Integer.parseInt(args[1]); for(int i=0;i&lt;number_of_threads;i++){ new Thread(new Kevin(i+1,thread_mode)).start(); } } } I am now trying to replicate this logic to C++ with pthread. What I've done so far is I have a Kevin class #include &lt;iostream&gt; #include &lt;time.h&gt; #include &lt;pthread.h&gt; using namespace std; class Kevin { public: Kevin(); void Speak(int value); }; Kevin::Kevin() { cout &lt;&lt; "new instance of Kevin is created"; } void Kevin::Speak(int value) { cerr &lt;&lt; "Name: Kevin\n" &lt;&lt; value &lt;&lt; "Seconds since epoch:" &lt;&lt; time(0) &lt;&lt; "\nThread id:" &lt;&lt; pthread_self() &lt;&lt; endl; } and a main.cc that somewhat similar to KevinThreads #include &lt;iostream&gt; #include &lt;pthread.h&gt; #include "Kevin.cc" using namespace std; int main(int argc, char *argv[]) { Kevin kevin1; int status; // creating thread objects pthread_t thrd_1; pthread_t thrd_2; // create thread pthread_create(&amp;thrd_1,NULL,kevin1.Speak(1),(void *)0); //14 pthread_create(&amp;thrd_2,NULL,kevin1.Speak(2),(void *)0); //15 pthread_join(thrd_1, (void **)&amp;status); pthread_join(thrd_2, (void **)&amp;status); system("PAUSE"); return EXIT_SUCCESS; } however, it does not compile and gave me "Invalid use of void expression at main:14,15". I'm new to the C++ syntax, what does that error even mean? I've tried changing (void *)0 to NULL, and I'm pretty sure the return type of kevin1.Speak() is not the…

http://stackoverflow.com/q/21994957
has body: I want to parse a resume to get different titles and content, which includes bullets, paragraphs, urls. I have the resume in .doc/.docx format. Research so far has resulted in 1.building an xml file from the .doc file and then 2. build an xml parser using JDOM. Is there any other approach or a better way to do this? some algorithm that would help identify structures in resume?
score: 1
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22062678
tagged with: .doc
tagged with: jdom
tagged with: xml-parsing
has title: Resume parser in Java
accepted answer: http://stackoverflow.com/a/22044611
has answer: http://stackoverflow.com/a/22062678
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/22044611
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/22003854
answers question: http://stackoverflow.com/q/21996175
type: Answer
has body: There is nothing especially wrong with your layout. Though I would probably change the layout_width for AdView to be: android:layout_width="match_parent" But it is not clear what initialize (new RedSquare(), cfg); is doing? I suspect it is altering the layout.
score: 0

http://stackoverflow.com/comment/33103921
has text: Because that's the default form for Object.toString.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21865627

http://stackoverflow.com/comment/33230007
has text: Okey, this will be laborious but it seems to be the only option that will work. Thanks again
type: Comment
comment on: http://stackoverflow.com/a/21936429
type: AnswerComment
score: 0

http://stackoverflow.com/a/22000925
answers question: http://stackoverflow.com/q/22000890
downvote count: 0
type: Answer
has body: It doesn't matter which negative number is returned. The only important piece of information here is the sign of what compareTo returns. It wouldn't matter if it returned -1, -4, -5, or -1000000. The only thing to conclude is that str1 is less than each of the other strings. From the Javadocs for the compareTo method in Comparable: Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/33345498

http://stackoverflow.com/comment/33285176
score: 0
type: QuestionComment
has text: "Nonlinear" is quite unspecific. If it involves anything else than the standard analytical functions, that will probably make the solution much less accessible.
comment on: http://stackoverflow.com/q/21966992
type: Comment

http://stackoverflow.com/a/21924998
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21924992
upvote count: 4
has comment: http://stackoverflow.com/comment/33209514
score: 4
has comment: http://stackoverflow.com/comment/33209524
accepted answer of: http://stackoverflow.com/q/21924992
has body: you are checking kilos are greater than 200 and pounds greater than 515 change this for ( kilos = 1; kilos &gt; 200; kilos++ ) { for ( pounds = 20; pounds &gt; 515; pounds++) { to for ( kilos = 1; kilos &lt; 200; kilos++ ) for ( pounds = 20; pounds &lt; 515; pounds++) {
type: AcceptedAnswer

http://stackoverflow.com/q/21901086
has comment: http://stackoverflow.com/comment/33207717
has comment: http://stackoverflow.com/comment/33167183
tagged with: java
has comment: http://stackoverflow.com/comment/33277347
has answer: http://stackoverflow.com/a/21901297
has body: Okay, so I've gotten to the point where I am starting to write code that's actually practical and reduces a good chunk of my work load. However, how do I package it into a user friendly self contained interface for people to use, that also provides an option for user's input and produces an output? I can't very well tell people to download Eclipse and compile/run the code. So what's the next step for putting together an actual application?
score: 0
tagged with: user-interface
has comment: http://stackoverflow.com/comment/33167941
possible better answer: http://stackoverflow.com/a/21901164
accepted answer: http://stackoverflow.com/a/21901297
has answer: http://stackoverflow.com/a/21901307
has answer: http://stackoverflow.com/a/21901164
answer count: 4
type: AnsweredQuestion
has title: How do I create an interactive I/O GUI for my Java project?
has comment: http://stackoverflow.com/comment/33167236
has answer: http://stackoverflow.com/a/21901625
type: Question
has comment: http://stackoverflow.com/comment/33167167
has comment: http://stackoverflow.com/comment/33213128

http://stackoverflow.com/a/21847769
answers question: http://stackoverflow.com/q/21847733
downvote count: 0
type: Answer
upvote count: 3
score: 3
has body: just as the error says, the error variable is most likely a String whereas JOptionPane.showMessageDialog doesn't return a value, as you can see in the docs if(database_name == null) { JOptionPane.showMessageDialog(null, "This is an Error Message", "Error", JOptionPane.ERROR_MESSAGE); } will work fine.

http://stackoverflow.com/comment/33216897
type: QuestionComment
comment on: http://stackoverflow.com/q/21929258
has text: Transactions don't just randomly disappear. I will suspect it is the connection to the database that is somehow responsible, although I then would expect a different kind of error (connection failures, to be more exact). The fact that you DON'T get an exception here confuses me a great deal.
score: 0
type: Comment

http://stackoverflow.com/a/21960023
has body: You are close :) The syntax for your "create table" statement needs more info. Here is the SQLite doc page: enter link description here Here is an example statement I recently used on a project. It gives you a concrete example of a create table statement: create table authors (id INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL, first_name varchar(25) NOT NULL, last_name varchar(25) NOT NULL,created_at datetime, updated_at datetime); Note! You need to specify the column data types. I also showed you how to create a primary key (whose value is generated by the database). Hope that helps :)
type: Answer
accepted answer of: http://stackoverflow.com/q/21959453
answers question: http://stackoverflow.com/q/21959453
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33226345
type: Comment
score: 0
type: AnswerComment
has text: I'm sorry, I'll try to explain better. I have a JFrame with many objects, TextFields, JLabels, Buttons etc.. I want to use a custom font in some labels in my JFrame. I have a lot of code but It's irrelevant to what i'm doing to the font, The only relevant code I have is the one I showed to you guys. I don't know if I have to include it in a method or something
comment on: http://stackoverflow.com/a/21909008

http://stackoverflow.com/comment/33277495
type: Comment
type: QuestionComment
has text: Post the actual error from log cat...
comment on: http://stackoverflow.com/q/21962659
score: 0

http://stackoverflow.com/q/21991942
has comment: http://stackoverflow.com/comment/33329199
has comment: http://stackoverflow.com/comment/33329000
has title: Create a specific number of buttons
linked to: http://stackoverflow.com/q/21994278
has comment: http://stackoverflow.com/comment/33333318
linked to: http://stackoverflow.com/q/6868957
has comment: http://stackoverflow.com/comment/33328753
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21992147
tagged with: java
has comment: http://stackoverflow.com/comment/33328746
has comment: http://stackoverflow.com/comment/33329130
type: Question
tagged with: layout
answer count: 1
tagged with: button
tagged with: class
score: 0
has body: I want to create a layout in Android in a java class. I need that the user introduce a number between 1 to 20 and this create the number of butttons that the user has chosen. I know that this is possible in Java but I don't know if this is possible in Android, any idea?Thnaks!!
has answer: http://stackoverflow.com/a/21992147
tagged with: android

http://stackoverflow.com/a/21945270
has comment: http://stackoverflow.com/comment/33249066
score: 0
type: Answer
has body: Interesting question. There are no methods that help you with this directly, but by calculating the bounding rectangle and intersecting with two opposing rectangles from your dividing line, you should be able to create such a method. The general idea is to Find the bounding rectangle of your original area: either getBounds() or getBounds2D(). Calculate two rectangles from your line that overlaps your area on both sides of the line. When doing this you will have to take several special cases into account (like is the line long enough, does it intersect the area at all, does the rectangles completely overlap each side of the original area, etc). The size of the rectangles should be decided by the bounding rectangle of your original area. Get the two areas by intersecting each of the two rectangles with your original area, i.e. by using the intersect() method
has comment: http://stackoverflow.com/comment/33247941
answers question: http://stackoverflow.com/q/21941156

spring
tags question: http://stackoverflow.com/q/22001492
tags question: http://stackoverflow.com/q/21870654
tags question: http://stackoverflow.com/q/21897827
tags question: http://stackoverflow.com/q/21884983
tags question: http://stackoverflow.com/q/21848063
tags question: http://stackoverflow.com/q/21914583
tags question: http://stackoverflow.com/q/21842287
tags question: http://stackoverflow.com/q/21865472
tags question: http://stackoverflow.com/q/22002254
tags question: http://stackoverflow.com/q/21901648
tags question: http://stackoverflow.com/q/21923355
tags question: http://stackoverflow.com/q/21945271
tags question: http://stackoverflow.com/q/21899777
tags question: http://stackoverflow.com/q/21907777
tags question: http://stackoverflow.com/q/21943338
tags question: http://stackoverflow.com/q/21992985
tags question: http://stackoverflow.com/q/21866571
tags question: http://stackoverflow.com/q/21877373
tags question: http://stackoverflow.com/q/22003290
tags question: http://stackoverflow.com/q/21998405
tags question: http://stackoverflow.com/q/21952041
tags question: http://stackoverflow.com/q/21923285
tags question: http://stackoverflow.com/q/21940826
tags question: http://stackoverflow.com/q/21980427
tags question: http://stackoverflow.com/q/21983048
tags question: http://stackoverflow.com/q/21882284
tags question: http://stackoverflow.com/q/21944868
tags question: http://stackoverflow.com/q/21881657
tags question: http://stackoverflow.com/q/21889660
tags question: http://stackoverflow.com/q/21909679
tags question: http://stackoverflow.com/q/21992201
tags question: http://stackoverflow.com/q/21944008
tags question: http://stackoverflow.com/q/21844455
tags question: http://stackoverflow.com/q/21876385
tags question: http://stackoverflow.com/q/21895507
tags question: http://stackoverflow.com/q/21922646
tags question: http://stackoverflow.com/q/21851586
tags question: http://stackoverflow.com/q/21969197
tags question: http://stackoverflow.com/q/21885247
tags question: http://stackoverflow.com/q/21999704
tags question: http://stackoverflow.com/q/21951189
tags question: http://stackoverflow.com/q/21960242
tags question: http://stackoverflow.com/q/21945695
tags question: http://stackoverflow.com/q/21965857
tags question: http://stackoverflow.com/q/21989966
tags question: http://stackoverflow.com/q/21974050
tags question: http://stackoverflow.com/q/21926003
tags question: http://stackoverflow.com/q/21942486
type: Tag
tags question: http://stackoverflow.com/q/21958819
tags question: http://stackoverflow.com/q/21855259
tags question: http://stackoverflow.com/q/21894128
tags question: http://stackoverflow.com/q/22001118
tags question: http://stackoverflow.com/q/21909399
tags question: http://stackoverflow.com/q/21966339
tags question: http://stackoverflow.com/q/21953408
tags question: http://stackoverflow.com/q/21914282
tags question: http://stackoverflow.com/q/21989619
tags question: http://stackoverflow.com/q/21982564
tags question: http://stackoverflow.com/q/21981940
tags question: http://stackoverflow.com/q/21990079
tags question: http://stackoverflow.com/q/21871497
tags question: http://stackoverflow.com/q/21879824
tags question: http://stackoverflow.com/q/21854907
tags question: http://stackoverflow.com/q/21944202
tags question: http://stackoverflow.com/q/21945968
tags question: http://stackoverflow.com/q/21954560
tags question: http://stackoverflow.com/q/21987589
tags question: http://stackoverflow.com/q/21956542
tags question: http://stackoverflow.com/q/21927685
tags question: http://stackoverflow.com/q/21909632
tags question: http://stackoverflow.com/q/21939804
tags question: http://stackoverflow.com/q/21953340
tags question: http://stackoverflow.com/q/21932640
tags question: http://stackoverflow.com/q/21949897
tags question: http://stackoverflow.com/q/21906890
tags question: http://stackoverflow.com/q/21843612
tags question: http://stackoverflow.com/q/21889756
tags question: http://stackoverflow.com/q/21852085
tags question: http://stackoverflow.com/q/21992936

http://stackoverflow.com/comment/33243040
type: QuestionComment
type: Comment
has text: you should post the relevant parts of your source code here
comment on: http://stackoverflow.com/q/21943803
score: 0

http://stackoverflow.com/a/21986211
has body: Change the first parameter in transform method to StreamSource. transformer.transform(new StreamSource(new java.io.File("path_to_xml")), new StreamResult(outputStream)); I used your code snippet except for the above line for the transform and it works fine (with my sample xml and xsl files).
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21981763

http://stackoverflow.com/comment/33602922
has text: check this https://netbeans.org/kb/docs/websvc/jax-ws.html
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21965650

http://stackoverflow.com/comment/33338773
comment on: http://stackoverflow.com/a/21996083
type: AnswerComment
score: 0
has text: If you give me a little time, I will add better information later. Currently I am on my iPhone and editing is rather uneasy here :-) For now: that line gives you access to the second controller in which you want to access the TextArea. Inside that secondary controller you can access the TextArea just with the field primaryTextArea.
type: Comment

http://stackoverflow.com/q/21880061
has comment: http://stackoverflow.com/comment/33137854
has comment: http://stackoverflow.com/comment/33129697
tagged with: libgdx
has body: This code is showing strange behavior. The BaseActor class just call in order: initPhysics, initGraphics and onCreate (only once) and then act (for each frame). The expected behaviors is that in onCreate method I hold the fixX value (that actually is -6) to use the this value to set the X position of object each frame, for make the X axis of object static. I put a debug point in onCreate and act and he is called appropriately. When fixX = getBody().getPosition().x; he get value 6, as expected, but in act the fixX value back to 0. When I change the fixX variable to static, the things works like expected. I don't realize how. I put a System out on the constructor of BirdActor to be sure the object is create only once. The methods setTransform of body is an Jni interface for C++ code of Libgdx with Box2d Engine. public class BirdActor extends BaseActor { private float fixX = 0; public BirdActor() { System.out.println("Created"); } @Override protected Body initPhysics() { return Assets.scene.getNamed(Body.class, "bird").get(0); } @Override protected void onCreate() { fixX = getBody().getPosition().x; } @Override public void act() { getBody().setTransform(fixX, getBody().getPosition().y, 0); super.act(); } @Override protected Sprite initGraphics() { Sprite sprite = new Sprite(Assets.textureBird); return sprite; } }
upvote count: 1
has title: Instance variable resetting their value
answer count: 1
has comment: http://stackoverflow.com/comment/33137832
accepted answer: http://stackoverflow.com/a/21881620
favorite count: 0
has comment: http://stackoverflow.com/comment/33137773
has answer: http://stackoverflow.com/a/21881620
has comment: http://stackoverflow.com/comment/33130091
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33131064
type: Question

http://stackoverflow.com/q/21946454
tagged with: debugging
has title: Merge Sort using Linked List throws an odd error in Java
has comment: http://stackoverflow.com/comment/33247891
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/33247920
has comment: http://stackoverflow.com/comment/33248413
tagged with: linked-list
answer count: 0
type: UnansweredQuestion
tagged with: java
has body: I have checked all of the push, pop, and peek methods and they work properly. I have attempted to debug this code in Eclipse, and after setting a breakpoint at divide(), it points straight to the line 'private Node next;' in the class Node. I am thinking it is because the parameters in divide are of the class Node. Here is the code: import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class mergeSort { Scanner scanner; Node firstNode = null; Node lastNode = null; Node currentNode = null; int size = 0; public mergeSort(String fileName) throws FileNotFoundException{ scanner = new Scanner(new File(fileName)); while(scanner.hasNextInt()){ push(scanner.nextInt()); } } public void divide(Node tempFirstNode, Node tempLastNode, int tempSize){ if(tempFirstNode != tempLastNode){ Node midNode = tempFirstNode; for(int i = 0; i &lt; (tempSize/2-1); i++){ midNode = tempFirstNode.next; } divide(tempFirstNode, midNode, tempSize/2); divide(midNode.next, tempLastNode, tempSize-tempSize/2); merge(tempFirstNode, tempLastNode, midNode); } } public void merge(Node firstNode, Node lastNode, Node midNode){ Node leftHead = firstNode; Node rightHead = midNode.next; Node rightTail = lastNode; while(leftHead != rightHead &amp;&amp; rightHead != rightTail.next){ if(leftHead.data &lt;= rightHead.data){ if(currentNode != null){ currentNode.next = leftHead; currentNode = leftHead; leftHead = leftHead.next; } else{ currentNode = leftHead; leftHead = leftHead.next; } } else{ if(currentNode != null){ currentNode.next = rightHead; currentNode = rightHead; rightHead = rightHead.next; } else{ currentNode = rightHead; rightHead = rightHead.next; } } } } public void push(int newEntry) { Node newNode = new Node(newEntry, firstNode); if(lastNode == null) lastNode = newNode; firstNode = newNode; size++; } public int pop(){ int top = peek(); if(firstNode != null) firstNode = firstNode.next; size--; return top; } public int peek() { if(firstNode != null) return firstNode.…
has comment: http://stackoverflow.com/comment/33248233
type: Question

http://stackoverflow.com/q/21925830
has answer: http://stackoverflow.com/a/21925874
has comment: http://stackoverflow.com/comment/130649606
has comment: http://stackoverflow.com/comment/65431012
has comment: http://stackoverflow.com/comment/130697615
has comment: http://stackoverflow.com/comment/130649215
possible better answer: http://stackoverflow.com/a/21925874
has answer: http://stackoverflow.com/a/21926037
has title: Java program to find the largest & smallest number in n numbers without using arrays
accepted answer: http://stackoverflow.com/a/21926229
has comment: http://stackoverflow.com/comment/33211078
has answer: http://stackoverflow.com/a/30883247
favorite count: 0
has answer: http://stackoverflow.com/a/29602442
has body: I could get the largest without using arrays but, unable to get the smallest one. public static void main(String[] args) { int smallest=0; int large=0; int num; System.out.println("enter the number"); Scanner input=new Scanner(System.in); int n=input.nextInt(); for(int i=0;i&lt;n;i++) { num=input.nextInt(); if(num&gt;large) { large=num; } System.out.println("the largest is:"+large); //gives the largest number in n numbers code for the smallest.. if(i==0&amp;&amp;num&gt;0) small=num; if(num&lt;small) small=num; System.out.println(small); }
score: -10
linked to: http://stackoverflow.com/q/19671453
type: AnsweredQuestion
downvote count: 14
has answer: http://stackoverflow.com/a/41217860
tagged with: java
has answer: http://stackoverflow.com/a/39033286
has answer: http://stackoverflow.com/a/21926229
has answer: http://stackoverflow.com/a/21926027
type: Question
upvote count: 4
answer count: 8

http://stackoverflow.com/comment/33310004
comment on: http://stackoverflow.com/q/21981247
type: Comment
type: QuestionComment
has text: What is your current code?
score: 0

http://stackoverflow.com/q/21948547
downvote count: 1
answer count: 1
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
upvote count: 0
has comment: http://stackoverflow.com/comment/33252595
tagged with: java
has body: I am trying to develop a small pizza ordering app. I have 3 classes so far and the purpose of them right now is to display 3 menus with the menu items accessible. Previously I had only one class and that worked just fine however issues started occurring when I split the program to use several classes. Main.java: http://pastebin.com/bZJ7Pgdt MakeFileMenu.java: http://pastebin.com/wv2Smm6E MakeFrame.java: http://pastebin.com/J7DV294P The errors I am getting are: Exception in thread "main" java.lang.NullPointerException at main.MakeFileMenu.MakeMenu(MakeFileMenu.java:24) at main.Main.start(Main.java:26) at main.Main.main(Main.java:16) Furthermore in the Makeframe.java file lines 37, 42, 49 and 57 should be uncommented. I commented them out as they were giving me errors so I thought I will at least try to get the menus to appear. Anything you guys see out of the ordinary? I double checked the code I can't seem to figure out what could be wrong with it. Thanks for your help!
has answer: http://stackoverflow.com/a/21948571
has comment: http://stackoverflow.com/comment/33251703
has comment: http://stackoverflow.com/comment/33251989
type: Question
linked to: http://stackoverflow.com/q/218384
has title: Java: Getting exception errors across multiple class files
score: -1
has comment: http://stackoverflow.com/comment/33252739

http://stackoverflow.com/comment/33212274
comment on: http://stackoverflow.com/a/21882611
score: 0
type: AnswerComment
has text: @SalmanAmaan Do not modify answers to ask more questions or to elaborate on your question/requirements. Thanks.
type: Comment

http://stackoverflow.com/a/21896778
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21896583
has body: Your "if" statements won't work because you follow them with a semi-colon. You mean to do this: if (a) dosomething; ... but instead you do this: if (a) ; // does nothing dosomething; // always does something regardless of "a" Either you do it perfectly, or it won't work. There is no "A for effort". Regarding your desire to use a switch statement, this is an easy one, but you've gone and tried to do it backwards. First you calculated the average. (That's a good idea.) Then you told the computer that the grade was an 'H'. (Why? That is obviously not a good idea.) Then you asked it to switch on the grade (which is an 'H') and if it's an 'H' you overwrite the average that you calculated with a zero. So all students will get zeros. And H's. What you meant to do, was to take the average that you calculated, and get the grade letter from that. So switch on the average, and provide as case labels the values that the average could be: switch (avg) { case 100: case 99: case 98: // etc. letter = 'A'; break; // and so on } Since you probably don't want to type "case 50" down to "case 0", just use a "default:" to match all the cases that you don't explicitly list. p.s. make your avg into an int (not a double) so you can switch on it p.p.s. print out the variables that you calculate so that you actually know that they are what you think they should be ... we call this "debugging" ;-)
has comment: http://stackoverflow.com/comment/33161735
score: 2
answers question: http://stackoverflow.com/q/21896583
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/21927505
has body: I expect getServerAddress to return the address of the Mongo server (one of replica set nodes), which actually handles the query. I am logging output of getServerAddress and see only the primary address although I am pretty sure that some queries are handled by secondary. I am a little bit confused since I see queries (having set profillingLevel) in the secondary while getServerAddress returns the primary. Maybe I am mistaken though ... Can it be a bug in the API ? Does anybody encounter such a problem ? Is it possible that getServerAddress always returns the primary while some queries are actually handled by secondaries ?
has comment: http://stackoverflow.com/comment/33235643
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33214980
has comment: http://stackoverflow.com/comment/33236824
type: Question
has comment: http://stackoverflow.com/comment/33214686
score: 0
has comment: http://stackoverflow.com/comment/33214760
has comment: http://stackoverflow.com/comment/33246688
answer count: 1
has comment: http://stackoverflow.com/comment/33214899
has title: Does DBCursor.getServerAddress work as I expect?
tagged with: database-replication
tagged with: java
has comment: http://stackoverflow.com/comment/33236115
has answer: http://stackoverflow.com/a/22110693
tagged with: mongodb
has comment: http://stackoverflow.com/comment/33214561
accepted answer: http://stackoverflow.com/a/22110693
has comment: http://stackoverflow.com/comment/33235217

http://stackoverflow.com/comment/33296218
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21973500
has text: Not an Android person, but in Java Swing, you'd create a Circle with the center specified and the radius of two miles. If Android does not have circles, that's a bummer, you'd have to create one from lines (a polygon like you said), that's basic trigonometry: use polar coordinate system, xcenter + r * cost (fi), ycenter + r * sin fi. Hope you don't have to resort to that!

http://stackoverflow.com/a/21872819
score: 4
accepted answer of: http://stackoverflow.com/q/21872567
type: Answer
answers question: http://stackoverflow.com/q/21872567
has body: Put the logo.png file in the same package as the class that's calling it ProjectRoot src MyClass.java logo.png and use ImageIcon icon = new ImageIcon(getClass().getResource("logo.png")); setIconImage(icon.getImage()); See Load Image icon Exception for more details
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33198072
has text: @Denis Your code works fine for me. What errors are you getting and what do your numbers look like?
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21918275

http://stackoverflow.com/comment/33129552
score: 0
has text: Try D:\\ instead of D:/ [make it simple and test copy it in D drive and check it]
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21874865

http://stackoverflow.com/q/21902673
has title: KeyListeners for a JComboBox which is used as a cell editor in a table
tagged with: jcombobox
has body: I am sorry if this sounds likes a basic question but I am relatively new to java. I have a JComboBox which I populate from a database and then use it in a JTable. I do that using the following code: itemEditortxt = new JComboBox(buildComboBoxmodel("SELECT item_name FROM items ORDER BY item_name")); AutoCompleteDecorator.decorate(itemEditortxt); TableColumn ledgerColumn = invoicePurchasedTable.getColumnModel().getColumn(0); ledgerColumn.setCellEditor(new ComboBoxCellEditor(itemEditortxt)); I am trying to add key listeners to the JComboBox but for some reason they are not being called when I press any key when the focus is on the cell which uses the JComboBox. Following is how I add the litterers: itemEditortxt.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) {System.out.print("line1");} @Override public void keyReleased(KeyEvent e) {System.out.print("line2");} @Override public void keyTyped(KeyEvent e) {System.out.print("line3");} }); Can someone please tell me what Im doing wrong? Thanks. Following is the SSCCE. There are two similar JComboBoxes, one is added normally and the other is used as a cell editor. In the first one the user can use the keyboard arrows and then press ENTER in order to make a selection. This is not the case for the one in the table. Thanks: package sp2; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.util.*; import javax.swing.table.*; import org.jdesktop.swingx.autocomplete.*; class InvoicePurchasedModel extends DefaultTableModel { public InvoicePurchasedModel (Vector&lt;Vector&lt;Object&gt;&gt; data, Vector&lt;String&gt; columnNames) { super(data, columnNames); } @Override public Class getColumnClass(int col) { if (col == 0) return String.class; else return Double.class; } } public class SP2 { JFrame mainPage; JTabbedPane jtp; JPanel mainPanel; JPanel purchasedInvoicesPanel; RXTable invoicePurchasedTable; DefaultTableModel invoicePurchasedtm; JComboBox …
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/33219996
has comment: http://stackoverflow.com/comment/33195042
tagged with: swing
has comment: http://stackoverflow.com/comment/33170040
has comment: http://stackoverflow.com/comment/33170830
type: Question
has answer: http://stackoverflow.com/a/21903318
has comment: http://stackoverflow.com/comment/33174113
tagged with: java
possible better answer: http://stackoverflow.com/a/21903318
has comment: http://stackoverflow.com/comment/33177080
has comment: http://stackoverflow.com/comment/33176905
tagged with: jtable
answer count: 2
has comment: http://stackoverflow.com/comment/33184924
has answer: http://stackoverflow.com/a/21954466
has comment: http://stackoverflow.com/comment/33219724
tagged with: swingx
has comment: http://stackoverflow.com/comment/33177095
accepted answer: http://stackoverflow.com/a/21954466

http://stackoverflow.com/q/21952319
has title: MultiThreading with Possible Long Delay
type: Question
has comment: http://stackoverflow.com/comment/33260504
tagged with: thread-safety
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33258293
type: UnansweredQuestion
has body: I have been studying up on writing apps with multiple threads accessing shared variables as I am about to write my first application that uses multiple threads! I think I understand the risks of using multiple threads, but am unsure what the best approach is for my scenario. In my app, I only have one Object which will be accessed by multiple threads. I would like it to look something like this: public class SharedObj { // Variables shared by all threads private String value1; private byte[] value2; // A connector which maintains a tcp connection and handles transactions with a server // It is used to update 'value1' and 'value2' with there values on the server private Connector connector; public void update() { String newValue1 = connector.getValue1(); synchronized(this) { value1 = newValue1; } byte[] newValue2 = connector.getValue2(); synchronized(this) { value2 = newValue2; } } public void setValue1(String newValue) { if(connector.updateValue1(newValue)) { synchronized(this) { value1 = newValue; } } } public String getValue1() { String ret; synchronized(this) { ret = value1; } return ret; } } I think a simple solution to this problem would be to make each function synchronized, but then when update() is called, the object could be locked for long periods of time, as the byte array can be virtually any size, and therefore take a long time to transmit over the network. This is why I would only like to lock the object when variables are being read or changed, so that they can remain accessible without long delays. I don't care if setValue1() or update() gets blocked for a long period of time, but the getValue1() function cannot be blocked for long periods of time. Now back to the example above. Let's assume that all functions in my Connector class are synchronized. If that was the case, would the above example be considered safe? My confusion is around exactly how synchronization works. My concern would be that update() could be called by one thread, and be in the m…
has comment: http://stackoverflow.com/comment/33258478
has answer: http://stackoverflow.com/a/21953509
tagged with: java
tagged with: multithreading

http://stackoverflow.com/a/21855688
accepted answer of: http://stackoverflow.com/q/21855198
type: Answer
has body: You're attempting to hold a reference to an instance of an enum which isn't very useful, but you can require that the enum class is passed to the constructor (called a type token). With a class, you can use the (typed) class method getEnumConstants() (which returns null if the class isn't an enum class, but we've bound it to be an enum class). This compiles: public class GenericClass&lt;T extends Enum&lt;T&gt;&gt; { Class&lt;T&gt; enumClass; public GenericClass(Class&lt;T&gt; enumClass) { this.enumClass = enumClass; } public void doSomething() { for (T element : enumClass.getEnumConstants()) { } } }
score: 2
upvote count: 3
downvote count: 1
answers question: http://stackoverflow.com/q/21855198
type: AcceptedAnswer

http://stackoverflow.com/comment/33218927
comment on: http://stackoverflow.com/q/21930458
type: QuestionComment
type: Comment
score: 0
has text: Pls share Exception traces

http://stackoverflow.com/a/21969444
answers question: http://stackoverflow.com/q/21969383
has comment: http://stackoverflow.com/comment/33289347
downvote count: 0
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/33289482
has comment: http://stackoverflow.com/comment/33289708
has comment: http://stackoverflow.com/comment/33289547
has comment: http://stackoverflow.com/comment/33289559
score: 2
has body: You're creating a new ButtonPanel object inside of your outer ActionListener. This new ButtonPanel object is completely distinct from the one that is being displayed and interacting with the user. A solution: pass in a reference to the true ButtonPanel instance into your outer listener via the listener's constructor. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; class ButtonActionListener implements ActionListener { private ButtonPanel buttonPanel; public ButtonActionListener(ButtonPanel buttonPanel) { this.buttonPanel = buttonPanel; } public void actionPerformed(ActionEvent actionEvent) { // ButtonPanel bp=new ButtonPanel(); if (actionEvent.getActionCommand().equals("button1")) { buttonPanel.buttons[0].setText("X"); } } } Then you can set this up via: buttons[i].addActionListener( new ButtonActionListener(/*pass in the valid ButtonPanel reference here*/)); Another and better option is to link the buttons to a Model object, give your control a reference to the Model object and have it make method calls on the model or notification calls on its model listeners.

http://stackoverflow.com/a/21972368
upvote count: 1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21972248
score: 0
has body: An attribute can not have multiple types, using a generic Object as suggested in comments and answer is really dirty. You could either use generic methods or have your method return a custom object.

http://stackoverflow.com/comment/33104869
type: QuestionComment
comment on: http://stackoverflow.com/q/21866192
has text: It's up to you to define what "precedes", "equals", and "proceeds" mean in your context. Just so long as you maintain the rule that if a > b and b > c, a > c, and the equivalent with < and =.
score: 0
type: Comment

http://stackoverflow.com/q/21973603
has comment: http://stackoverflow.com/comment/33296403
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33304692
tagged with: youtube
has comment: http://stackoverflow.com/comment/33490392
answer count: 0
tagged with: java
tagged with: webview
has comment: http://stackoverflow.com/comment/33298430
type: Question
has comment: http://stackoverflow.com/comment/33490287
linked to: http://stackoverflow.com/q/17706580
has title: Android, WebView not playing YouTube videos
duplicate of: http://stackoverflow.com/q/17706580
score: 0
has body: import com.google.ads.AdRequest; import com.google.ads.AdView; import android.os.Bundle; import android.app.Activity; import android.graphics.Bitmap; import android.view.Menu; import android.view.View; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ProgressBar; public class Youtube extends Activity { private WebView webView; private ProgressBar progress; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_youtube); webView = (WebView) findViewById(R.id.webView4); webView.setWebViewClient(new MyWebViewClient()); progress = (ProgressBar) findViewById(R.id.progressBar4); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl("http://www.youtube.com/"); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. //getMenuInflater().inflate(R.menu.ver_web, menu); return true; } private class MyWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } @Override public void onPageFinished(WebView view, String url) { progress.setVisibility(View.GONE); Youtube.this.progress.setProgress(100); super.onPageFinished(view, url); } @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { progress.setVisibility(View.VISIBLE); Youtube.this.progress.setProgress(0); super.onPageStarted(view, url, favicon); } } public void setValue(int progress) { this.progress.setProgress(progress); } @Override public void onBackPressed() { // Check if there's history if (this.webView.canGoBack()) this.webView.goBack(); else super.onBackPressed(); } public void onCreate1(Bundle savedInstanceState) { //Request an ad AdView ad = (AdView) findViewById(R.id.adView); ad.loadAd(new AdRequest()); } }

http://stackoverflow.com/a/21842676
score: 1
has body: You are not changing cursor at all in your if-statement, you are only changing count, which has no effect on cursor so you get stuck in an infinite loop. You need to change cursor when you find a match as well as incrementing count. See below for an example: if(compare==0) { //System.out.println("aa"); stuck in here count++; cursor = cursor.left } This is assuming that the way it is sorted, anything that is equal will be in the left branch. Just change cursor.left to cursor.right if the opposite is true.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21842634
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21842634
type: Answer
downvote count: 0

http://stackoverflow.com/comment/33124425
type: Comment
type: QuestionComment
has text: I can, but I'm not going to because that would be wasted time on my part. Google 'java servlet forward data' and find the existing example code. Or perhaps just read a book on servlets.
comment on: http://stackoverflow.com/q/21874326
score: 0

http://stackoverflow.com/a/21906290
has comment: http://stackoverflow.com/comment/33176117
has comment: http://stackoverflow.com/comment/33176164
type: Answer
answers question: http://stackoverflow.com/q/21906222
accepted answer of: http://stackoverflow.com/q/21906222
upvote count: 2
has body: from api 9 you can not directly call network operation on main thread instead you can do so using AsyncTask. have a look at this tutorial for more information.
score: 2
has comment: http://stackoverflow.com/comment/33176215
has comment: http://stackoverflow.com/comment/33176063
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33176127

http://stackoverflow.com/q/21951482
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/37899184
has title: appengine endpoint Failed to retrieve API configs with status: 500
has comment: http://stackoverflow.com/comment/33273140
answer count: 4
tagged with: google-cloud-endpoints
downvote count: 0
has body: I run appengine local dev server in eclipse with params 0.0.0.0 When I try to access any of the methods I get the following error. I get the same error if I try to access api explorer http://localhost:8888/_ah/api/explorer Notes: I just updated my app engine server to java 7. Does anyone know how to fix this problem? java.io.IOException: Failed to retrieve API configs with status: 500 at com.google.api.server.spi.tools.devserver.ApiServlet.getApiConfigSources(ApiServlet.java:102) at com.google.api.server.spi.tools.devserver.ApiServlet.initConfigsIfNecessary(ApiServlet.java:67) at com.google.api.server.spi.tools.devserver.RestApiServlet.service(RestApiServlet.java:117) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125) at org.mortbay.jetty.servlet.ServletHan…
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/33273609
tagged with: java
has comment: http://stackoverflow.com/comment/37779510
has comment: http://stackoverflow.com/comment/33273127
linked to: http://stackoverflow.com/q/24378419
score: 9
has comment: http://stackoverflow.com/comment/33273348
tagged with: java-7
has answer: http://stackoverflow.com/a/38426578
has comment: http://stackoverflow.com/comment/33257470
favorite count: 0
has answer: http://stackoverflow.com/a/35161594
upvote count: 9
has answer: http://stackoverflow.com/a/28140968

jms
tags question: http://stackoverflow.com/q/21881657
tags question: http://stackoverflow.com/q/21882127
tags question: http://stackoverflow.com/q/21931208
tags question: http://stackoverflow.com/q/21966241
tags question: http://stackoverflow.com/q/21900846
tag name: jms
tags question: http://stackoverflow.com/q/21884150
tags question: http://stackoverflow.com/q/21860195
type: Tag
tags question: http://stackoverflow.com/q/21865266
tags question: http://stackoverflow.com/q/21927973
tags question: http://stackoverflow.com/q/21865472

http://stackoverflow.com/q/21916177
has comment: http://stackoverflow.com/comment/33196479
has comment: http://stackoverflow.com/comment/33196555
score: 2
tagged with: java
tagged with: jenkins-plugins
type: Question
upvote count: 2
has body: Using the EnvInject plugin, I have added a password to the Global Passwords list, like so: Within the job, I enable global passwords, like so: I was under the assumption that using the name as an environment variable within the Maven build goal would work just fine, like so: Unfortunately, I see this in the build output: .../my-project/pom.xml clean install -Dwhatever.password=${qa.password} What am I missing? I've been toying around with config for a while, but this seems like it should work for what I'm trying to accomplish. For the sake of the question, the reasoning for utilizing a password as a maven option is out of the context of this question.
has comment: http://stackoverflow.com/comment/33201021
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23303843
has title: Jenkins not filtering global passwords for Maven build
favorite count: 0
tagged with: jenkins
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/88854843
tagged with: maven

http://stackoverflow.com/comment/33176781
type: Comment
has text: In the 1st approach, giving left hand side value as ascii char so assign to long type giving numberformat exception. 2nd Approach its giving null pointer exception.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21899739

http://stackoverflow.com/q/21921777
answer count: 1
linked to: http://stackoverflow.com/q/2644172
accepted answer: http://stackoverflow.com/a/21922473
tagged with: serialization
has title: Java Serializing Objects Like an Area
has comment: http://stackoverflow.com/comment/33204997
has answer: http://stackoverflow.com/a/21922473
type: AnsweredQuestion
tagged with: java
type: Question
has body: I have read a little bit about 3rd party serialization methods such as JSON, but was wondering if there is any other way to serialize objects such as an area that do not implement serializable. In other word would JSON be the best way to serialize such an object? EDIT : Throwing A NotSerializable Exception public class Test { public static void main(String[] args) throws Exception { Pojo pojo = new Pojo(new Area()); // The original object, NOT SERIALIZABLE ! byte[] pojoBytes = Serializer.serialize(pojo); // Serialize pojo = (Pojo) Serializer.deserialize(pojoBytes); // Deserialize System.out.println(pojo); // Good as new ! } } public class Pojo implements Serializable { private final Area msg; public Pojo(Area msg) { this.msg = msg; } public Area getMsg() { return msg; } public String toString() { return "Pojo says : " + msg; } } public class Serializer { public static byte[] serialize(Object o) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); FileOutputStream fileOut = new FileOutputStream("Test.ser"); ObjectOutputStream oos = new SurrogateObjectOutputStream(fileOut); // Magically handle Pojos ! oos.writeObject(o); oos.flush(); oos.close(); return baos.toByteArray(); } public static Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException { ByteArrayInputStream bais = new ByteArrayInputStream(bytes); FileInputStream fileIn = new FileInputStream("Test.ser"); ObjectInputStream ois = new ObjectInputStream(fileIn); Object o = ois.readObject(); bais.close(); return o; } } public class SurrogateObjectOutputStream extends ObjectOutputStream { public SurrogateObjectOutputStream(OutputStream out) throws IOException { super(out); enableReplaceObject(true); } protected SurrogateObjectOutputStream() throws IOException, SecurityException { super(); enableReplaceObject(true); } @Override protected Object replaceObject(Object obj) throws IOException { if (obj instanceof Pojo) { return new PojoSurrogate((Pojo) obj); } else return super…
has comment: http://stackoverflow.com/comment/33205619
tagged with: area
score: 0

http://stackoverflow.com/comment/33129819
score: 0
type: QuestionComment
has text: My bad. We usually do all kinds of formatting to the PL/SQL code before running it against the database. The ending `/` would normally have been removed. I edited my question to remove the `/`. When removing the colons, the code runs fine.
type: Comment
comment on: http://stackoverflow.com/q/21880393

http://stackoverflow.com/comment/33104127
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21865812
type: Comment
has text: do-while loop will help in this case. Good luck

http://stackoverflow.com/q/21883631
answer count: 3
has answer: http://stackoverflow.com/a/21883808
upvote count: 0
favorite count: 0
type: UnansweredQuestion
score: -3
tagged with: user-input
has title: Passing parameters inside if-else
tagged with: java
downvote count: 3
has body: I have been through the forum numerous times, found a few answers, very helpful. I am new to Java so be gentle. By basic issue is I have two classes a Main and a method container. I need to take commandline input from the user that will ask the user to set the size of an array. The user can then set each element in the array to a specific value, it must be there option to set those values, i.e, enter 2. Then further options include getting min, max, average etc... What I am struggling with is the code works until I do the checking of the user input, either using if-else or switch as each code block does not see the variable values that were create. For example, setting the array size parameter does not get passed into the method that sets the values of each element. Any suggestions would be great. Here is the code: public class MyMain { public static void main(String[] args) { fc program= new fc(); program.commandline(); } } Method container below import java.util.Scanner; public class fc { int command; public void commandline() { Scanner scan = new Scanner(System.in); int command; System.out.print("Enter command&gt;"); command = scan.nextInt(); while (command!=9) { if(command==1){ //set the array size int arraySize=getArraySize(); }else if (command==2){ //enter values for the array int[]arrValues=setArrayValues(arraySize); }else if (command==3){ int [] theNumbers=arrayPrint(arrValues); arrayPrint(arrValues); }else if (command==4){ sumArray(arrValues); System.out.println("The sum of the array is " ); }else if (command==5){ minArray(arrValues); }else if (command==6){ maxArray(arrValues); }else if (command==7){ avgArray(arrValues); }else{ printMenu(); } //Read in next command System.out.print("Enter command&gt;"); command = scan.nextInt(); } } public static int[] arrayPrint(int[] arrayValues) { System.out.println("Elem Value"); for(int i=0;i&lt;arrayValues.length;i++){ System.out.printf("%s\t%d\n", i,arrayValues[i]); } return arrayValues; } public static int avgArray(…
type: Question
has comment: http://stackoverflow.com/comment/33135367
has answer: http://stackoverflow.com/a/21883917
has answer: http://stackoverflow.com/a/21883829

http://stackoverflow.com/comment/33253005
has text: @user2939808 Absolutely. But don't you want the user to choose which?
type: Comment
comment on: http://stackoverflow.com/a/21949140
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33603527
score: 0
type: AnswerComment
has text: thanks for your reply, for now i removed "pentaho-big-data-plugin" this folder, now i want to run my job, i am giving below command, ./kitchen.sh -job=jobname.kjb (here how can i give the location of kjb file) because it is giving me error of job couldn't be loaded.
type: Comment
comment on: http://stackoverflow.com/a/22102567

http://stackoverflow.com/q/21989560
score: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21990095
downvote count: 1
has answer: http://stackoverflow.com/a/21989699
has comment: http://stackoverflow.com/comment/33324146
has comment: http://stackoverflow.com/comment/33324164
tagged with: compareto
tagged with: java
has comment: http://stackoverflow.com/comment/33324298
has comment: http://stackoverflow.com/comment/33324291
type: Question
has comment: http://stackoverflow.com/comment/33324365
tagged with: sorting
favorite count: 0
has answer: http://stackoverflow.com/a/21989768
answer count: 3
has comment: http://stackoverflow.com/comment/33324231
has body: I am trying to overwrite the compareTo in Java such that it works as follows. There will be two string arrays containing k strings each. The compareTo method will go through the words in order, comparing the kth element of each array. The arrays will then be sorted thusly. The code I have currently is as follows, but it does not work properly. I need a return statement outside the for-loop. I'm not sure what this return statement should return, since one of the for-loop return statements will always be reached. Also, am I using continue correctly here? public int compareTo(WordNgram wg) { for (int k = 0; k &lt; (this.myWords).length; k++) { String temp1 = (this.myWords)[k]; String temp2 = (wg.myWords)[k]; int last = temp1.compareTo(temp2); if (last == 0) { continue; } else { return last; } } }
has comment: http://stackoverflow.com/comment/33324597
has title: Java Implementing Comparable
has comment: http://stackoverflow.com/comment/33324596
has comment: http://stackoverflow.com/comment/33324243

http://stackoverflow.com/comment/33305040
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21976844
type: Comment
has text: @MarkW, I need to pass this ObjectID value to another query, can I just pass it directly as it is? Or do I need to change the format to BigInteger and then pass it to the next query function?

http://stackoverflow.com/comment/33281630
score: 0
has text: What above says, you say for sure userDAO is null, that's your error. it's null.. how is your class being initialized? surely userDAO has to be set somewhere or injected.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21964959

jetty
tags question: http://stackoverflow.com/q/21996252
tags question: http://stackoverflow.com/q/21869225
tag name: jetty
tags question: http://stackoverflow.com/q/21988749
tags question: http://stackoverflow.com/q/21878375
tags question: http://stackoverflow.com/q/21858573
tags question: http://stackoverflow.com/q/21963961
tags question: http://stackoverflow.com/q/21923178
tags question: http://stackoverflow.com/q/21896522
tags question: http://stackoverflow.com/q/21861019
tags question: http://stackoverflow.com/q/21970717
type: Tag
tags question: http://stackoverflow.com/q/21863363

http://stackoverflow.com/q/21847418
upvote count: 1
has answer: http://stackoverflow.com/a/21848032
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21847575
has body: Please help me to write a java function to convert a string into numerical value function must accept a string and it should returns a integer array that contains numbers Each alphabet having a numerical value shown below:- 1 = A I J Q Y 2 = B K R 3 = C G L S 4 = D M T 5 = E H N X 6 = O Z 8 = F P For string "Stack overflow" Numerical value is = 3 4 1 3 2 7 6 5 2 8 3 7 6" for example:- input:- String str = "Stack overflow"; . . . . .//ignoring spaces return array= {3,4,1,3,2,7,6,5,2,8,3,7,6};
answer count: 6
has answer: http://stackoverflow.com/a/21847520
score: 0
has comment: http://stackoverflow.com/comment/33071243
has comment: http://stackoverflow.com/comment/33070636
tagged with: string
favorite count: 0
type: UnansweredQuestion
has title: JAVA- how to convert letters in a string to specified number?
has answer: http://stackoverflow.com/a/21847713
has comment: http://stackoverflow.com/comment/33070700
has answer: http://stackoverflow.com/a/21847668
tagged with: java
has answer: http://stackoverflow.com/a/21847536

http://stackoverflow.com/comment/33079243
type: Comment
has text: I now, there was a mistake in my code: RelativeLayout rl = (RelativeLayout)findViewById(R.id.**id_relative_layout**);
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21852274

http://stackoverflow.com/a/62581237
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21937091
has body: static int sumFromString(String str){ int sum=0; for (char ch : str.toCharArray()){ if (Character.isDigit(ch)){ sum+=(ch-'0'); } } return sum; } my 5 cents - fastest variant
downvote count: 0
type: Answer

http://stackoverflow.com/comment/33104935
type: Comment
comment on: http://stackoverflow.com/q/21865625
score: 0
has text: Thank you for your help! I don't know how to upvote comments though but thank you
type: QuestionComment

http://stackoverflow.com/a/21940394
answers question: http://stackoverflow.com/q/21940258
upvote count: 2
has body: You seem to be looking for the ViewPager component. This will allow you to swipe between screens. Please note you will have to implement the different screens as Fragments though. There is a guide on this in the docs: http://developer.android.com/training/animation/screen-slide.html
score: 2
downvote count: 0
type: Answer

http://stackoverflow.com/a/21965964
answers question: http://stackoverflow.com/q/21965828
type: Answer
accepted answer of: http://stackoverflow.com/q/21965828
upvote count: 7
score: 7
has body: Its in real not getting converted into int. Only thing happening is as JS Object its not showing .0 which is not relevant. In your sample program, change some of the value from double[] d = new double[]{1.0,2.0,3.0} to double[] d = new double[]{1.0,2.1,3.1} and run the program. You will observer its in real not converting into int. The output you will get is {"doubles":[1,2.1,3.1]}
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21925160
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: It can catch an exception that the app throw an exception in the block of try. In your block of try, we just see average = totalScores / 3;, it don't throw any exception. So it don't catch anything what was throwed. You can use this function to throw an exception - IllegalArgumentException. public static int getInputScore(Scanner keyboard) { int score = keyboard.nextInt(); if (score &lt; 0 || score &gt;= 100) { throw new IllegalArgumentException(); } return score; } And use it in main code: public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int[] scores = new int[3]; System.out.println("Score 1:"); try { scores[0] = getInputScore(keyboard); } catch (IllegalArgumentException e) { System.out.println("Numbers were too low or high."); return; } System.out.println("Score 2:"); try { scores[1] = getInputScore(keyboard); } catch (IllegalArgumentException e) { System.out.println("Numbers were too low or high."); return; } System.out.println("Score 3:"); try { scores[2] = getInputScore(keyboard); } catch (IllegalArgumentException e) { System.out.println("Numbers were too low or high."); return; } int totalScores = scores[0] + scores[1] + scores[2]; int average = totalScores / 3; System.out.println("Average Score: " + average); }
answers question: http://stackoverflow.com/q/21924955

http://stackoverflow.com/q/21967329
has answer: http://stackoverflow.com/a/21967368
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21967390
linked to: http://stackoverflow.com/q/1892765
tagged with: string
has title: Capitalizing first char in every word in a String in java (but ignoring specific word)
type: Question
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21969169
has answer: http://stackoverflow.com/a/21967365
answer count: 4
has body: Can anyone please tell me why the following code prints 1 the high street and not 1 The High Street?: String propertyPageTitle = "1-the-high-street"; propertyPageTitle = propertyPageTitle.replace("-", " "); WordUtils.capitalizeFully(propertyPageTitle); System.out.println(propertyPageTitle); EDIT to show solution: String propertyPageTitle = "1-the-high-street"; propertyPageTitle = propertyPageTitle.replace("-", " "); propertyPageTitle = WordUtils.capitalizeFully(propertyPageTitle); System.out.println(propertyPageTitle); Supposing I wanted to ignore the word 'and' if it appears (I'm reading values from a .csv) and NOT change to titlecase? how would that be possible.

http://stackoverflow.com/comment/33346575
comment on: http://stackoverflow.com/a/22001473
type: AnswerComment
score: 0
type: Comment
has text: He didn't say anything about the problem being to do wiht inserting at a position. He just said that he's trying to do that. The problem that he's asking us to solve is to eliminate the error.

http://stackoverflow.com/comment/33138013
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21882808
has text: @HarryKitchener: you're not running the right file. You've got to run the code above, not some other class (which is what you're doing since there is no "hello world" in my code above). At least read the code above if you can't run it to get some ideas of what I'm talking about.
score: 0

http://stackoverflow.com/q/22004260
accepted answer: http://stackoverflow.com/a/22005171
upvote count: 1
has comment: http://stackoverflow.com/comment/33351487
type: AnsweredQuestion
tagged with: rectangles
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22005171
tagged with: game-engine
has body: public void update() { speedY = bg.getSpeedY() / 2; tileY += speedY; r.set(tileX, tileY, 50, 48); // Collision with cycle here: if (tileY &gt; 480) { r = null; } if (tileY &lt; 480) { checkCollision(); } } private void checkCollision() { if (type != 0) { boolean val = Rect.intersects(Cycle.rect, r); if (val) { test = true; } } } Using the debugger I determined that all the Rectangles are updating correctly, and the Cycle.rect returns the correct rectangle location. If the rectangles are intersecting on the very first check it works fine. However, as the update runs the intersects never returns true. Why might this be happening? I used the boolean val only to help in debugging. I Logged two values where I believe the rectangles should be intersecting but is not: r: 02-24 23:32:50.762: V/Rect(16624): Rect(50, 314 - 50, 48) Cycle.rect: 02-24 23:32:50.762: V/Rect(16624): Rect(49, 329 - 100, 100)
downvote count: 0
has comment: http://stackoverflow.com/comment/33352728
tagged with: intersection
has comment: http://stackoverflow.com/comment/33351982
tagged with: android
answer count: 1
score: 1
has title: Checking if rectangles intercect only working if they intersect on first check
favorite count: 0

http://stackoverflow.com/comment/33160290
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of http://stackoverflow.com/questions/20623209/how-would-i-switch-from-an-array-to-an-arraylist/20623906#20623906 (always good to be able to plug my own answers!)
comment on: http://stackoverflow.com/q/21896781

http://stackoverflow.com/comment/33315248
type: QuestionComment
comment on: http://stackoverflow.com/q/21983989
has text: i thought it is not the code problem,seems that the wlfullclient.jar does not works.
score: 0
type: Comment

http://stackoverflow.com/q/21922354
has comment: http://stackoverflow.com/comment/33205890
has answer: http://stackoverflow.com/a/21922760
linked to: http://stackoverflow.com/q/6122315
score: 2
has comment: http://stackoverflow.com/comment/33205330
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21922703
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33205427
tagged with: arrays
downvote count: 0
has title: Check duplicate in rows and columns 2D Array
accepted answer: http://stackoverflow.com/a/21922703
tagged with: multidimensional-array
has body: how would I go about checking a duplicate for columns and rows and return true or false depending if there's duplicates. For example 1 2 3 3 1 2 2 3 1 Would return true because no duplicates, but.. 1 2 2 3 2 3 2 1 1 would return false because there is a duplicate in column 2 {2, 2, 1}. How would I go about checking for if there are in duplicates in the rows and then checking if there are duplicates in the columns? So far I have only the following: public static boolean hasDuplicates(int [][] inArray) { for (int row = 0; row &lt; inArray.length; row++) { int rowCheck = inArray[row][inArray.length]; for (int col = 0; col &lt; inArray[row].length; col++) { } } return false; } So I need to take in an array and check if there are any duplicates among the columns or rows. Any pointers? Thank you! NOTE: This cannot be done with outside methods
answer count: 4
has answer: http://stackoverflow.com/a/21922754
favorite count: 0
has answer: http://stackoverflow.com/a/21922409
possible better answer: http://stackoverflow.com/a/21922760
upvote count: 2

http://stackoverflow.com/comment/33189226
score: 0
type: Comment
has text: Thanks for sharing this information with me, the example about CardLayout really got things going..
comment on: http://stackoverflow.com/a/21883864
type: AnswerComment

http://stackoverflow.com/q/21901118
answer count: 1
accepted answer: http://stackoverflow.com/a/21901249
favorite count: 0
has comment: http://stackoverflow.com/comment/33167680
score: 0
has comment: http://stackoverflow.com/comment/33167432
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
has body: I might be blind but I don't find the possibility to change the hierarchy of "Annotations" in the Preferences of eclipse. My problem is that warnings, which are displayed as yellow bars, hide "write occurrences" at the same line. Is there an easy way to move warnings to the lowest graphical level? To be more verbose: If I selected a variable and it is written to in a line were also a warning is, then the "write occurrences" mark is invisible as it is fully covered by the "warning" mark. I don't want to switch off the warnings, I just would prefer them to have lower priority. PS.: A "complex" way is also appreciated.
has title: How to change the hierarchy of annotations in eclipse?
tagged with: eclipse
has answer: http://stackoverflow.com/a/21901249
type: Question

http://stackoverflow.com/a/23661296
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21855420
answers question: http://stackoverflow.com/q/21855420
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has body: You need to implement a Level of Detail (LOD) algorithm. A comprehensive list of algorithms with colorful pictures can be found here. I would suggest geomipmapping as an easy starting point. There are also some interesting implementations which you may be able to reuse or learn from. In most of the simple implementations, there are typically several index buffers for different levels of detail and one or more vertex buffers for different parts of the terrain. The GPU cannot reduce the level of detail of geometry by itself, except for tesselation shaders, which have been also used for terrain rendering using vertex texturing (the terrain data is then in a texture instead of in a VBO and the roughness is controlled by different tesselation level).

http://stackoverflow.com/comment/33147748
type: Comment
comment on: http://stackoverflow.com/a/21890035
has text: I'm working on eclipse, and I set up a web.xml. I also tried to use the URL that maps to the BooksBought servlet, but nothing works.
score: 0
type: AnswerComment

http://stackoverflow.com/a/22022844
has body: i hope this will solve your problem! in your activity define boolean first public class Atherosclerosis extends Activity { boolean favClicked; use this in your on create. setContentView(R.layout.activity_main); SharedPreferences myPrefs = PreferenceManager.getDefaultSharedPreferences(this); favClicked = myPrefs.getBoolean("menu_item", false); and then public boolean onOptionsItemSelected(MenuItem item) { SharedPreferences myPrefs = PreferenceManager.getDefaultSharedPreferences(this); final SharedPreferences.Editor editor = myPrefs.edit(); favClicked = myPrefs.getBoolean("menu_item", false); switch (item.getItemId()) { case R.id.id_favorit: favClicked=true; editor.putBoolean("menu_item", favClicked); editor.commit(); invalidateOptionsMenu(); return true; case R.id.id_favorit2: favClicked=false; editor.putBoolean("menu_item", favClicked); editor.commit(); invalidateOptionsMenu(); return super.onOptionsItemSelected(item); } return true; } @Override public boolean onPrepareOptionsMenu(Menu menu) { if(favClicked==true){ menu.findItem(R.id.id_favorit).setVisible(false); menu.findItem(R.id.id_favorit2).setVisible(true); }else{ menu.findItem(R.id.id_favorit).setVisible(true); menu.findItem(R.id.id_favorit2).setVisible(false); } return super.onPrepareOptionsMenu(menu); } }
type: Answer
accepted answer of: http://stackoverflow.com/q/21972930
upvote count: 1
answers question: http://stackoverflow.com/q/21972930
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21861806
score: 0
answers question: http://stackoverflow.com/q/21858954
has body: In your server part you can execute whatever you want. Of course that is true also for any server service provided in the GWT kit: RPC and RF. But GWT is almost client side, hence the only way to call a remote procedure in your server, is using Ajax. So create a service method in your server side using RPC, RF, AutoBeans or any other JSON, XML, etc apprach. Then call that method from the client using Ajax (RPC, RF, RequestBuilder, etc). The data transfered must be in a format understandable in client side, if you use RPC, RF or AutoBeans, that is almost out-of-the-box, for any other mechanism you are the responsible for the data-binding. Said that, as you can see GWT uses the same architecture than any other JavaScript application. Except that in the case you use Java in server side you have some utilities for transfering data and calling remote methods.
type: Answer

http://stackoverflow.com/q/21850156
has title: how string Constant pool works in java
linked to: http://stackoverflow.com/q/21621958
answer count: 4
has body: First i got a doubt that, when I create a string as String s = new String("Stack"); whether "Stack" is saved in String Constant pool or not? but this post : what happens with new String(&quot;&quot;) in String Constant pool tell that it is not. but according to answers of this post : where do actual parameters in java store tell that it is present in Constant pool. Please give a clarification on this.
score: 1
tagged with: java
duplicate of: http://stackoverflow.com/q/21676143
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21850240
has answer: http://stackoverflow.com/a/21850228
linked to: http://stackoverflow.com/q/21676143
has answer: http://stackoverflow.com/a/21850296
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/33075263
has answer: http://stackoverflow.com/a/21850248
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/21979606
downvote count: 0
tagged with: log4j
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21979657
score: 4
tagged with: java
has title: changing date format in log4j.xml
has body: Can anyone help me out on how to change the date format in the console. Currently the date format is like this : Feb 1, 2014 8:36:02 PM. All i want to change is the date format to 24 hour format. I tried changing the format in the log4j.xml file. this is the log4j.xml file : <?xml version="1.0" encoding="UTF-8" ?> http://jakarta.apache.org/log4j/'> <appender-ref ref="RollFile"/> <appender-ref ref="CONSOLE"/> <appender-ref ref="RollFile"/> <appender-ref ref="CONSOLE"/>
type: Question
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/21979623

http://stackoverflow.com/comment/33065030
type: QuestionComment
type: Comment
has text: Editing R.java doesn't help you, ADT does that for you. as per your XML, you should be having, `public static final int imageView1 = XXXXX;` under `class id` if not you have trouble in generating R.java, check if `Project > Build Automatically` is checked
score: 0
comment on: http://stackoverflow.com/q/21843865

http://stackoverflow.com/q/21964776
has comment: http://stackoverflow.com/comment/33281263
has comment: http://stackoverflow.com/comment/33281087
type: UnansweredQuestion
has title: Rectangle.overlaps() Method not working [LibGDX]
tagged with: android
answer count: 0
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33281187
tagged with: libgdx
has comment: http://stackoverflow.com/comment/33281083
has comment: http://stackoverflow.com/comment/33281191
has body: Iterator&lt;Rectangle&gt; iter = incomingCars.iterator(); while (iter.hasNext()) { Rectangle incomingCar = iter.next(); incomingCar.y -= score/2+200 * Gdx.graphics.getDeltaTime(); } if(incomingCar.overlaps(car)) { iter.remove(); } } Followed a tutorial for this very closely and it's still messing up, there is 0 detecting/collision being detected between the two Rectangles. public void create() { car = new Rectangle(); car.x = 180; car.y = 0; car.height = 172; car.width = 100; incomingCars = new Array&lt;Rectangle&gt;(); } private void spawnCar() { int lane; Rectangle incomingCar = new Rectangle(); lane = MathUtils.random(0, 2); if (lane == 0) { incomingCar.x = 30; } if (lane == 1) { incomingCar.x = 180; } if (lane == 2) { incomingCar.x = 330; } incomingCar.y = 1000; incomingCars.add(incomingCar); So I'll try to debug this stuff now, but I feel like im missing something slightly important. gotta add some extra details here, not sure what to say, I guess i'll try check if the cars are actually colliding in any way.
has comment: http://stackoverflow.com/comment/33281774

http://stackoverflow.com/comment/33487921
has text: @ajb is right about this. The form I've given here used to be frowned on back in the 1980s when debuggers couldn't show you the assignment inside the 'while' condition. My own preference is for the least code.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22001575
type: AnswerComment

http://stackoverflow.com/a/21954466
type: Answer
accepted answer of: http://stackoverflow.com/q/21902673
answers question: http://stackoverflow.com/q/21902673
downvote count: 0
score: 1
has body: Ok, so the problem was caused by the AutoCompleteDecorator. I deactivated it and used instead the AutoCompletion.enable(employeeDelete). Now the ENTER and TAB keys work as expected. I appreciate all the comments that helped me.
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/21956950
has answer: http://stackoverflow.com/a/21967545
has comment: http://stackoverflow.com/comment/33289522
score: 2
tagged with: fluent-interface
type: AnsweredQuestion
has title: Deserializing json string to fluid objects with genson
upvote count: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33289888
type: Question
accepted answer: http://stackoverflow.com/a/21967545
has comment: http://stackoverflow.com/comment/33289968
has body: I am trying to convert a simple array of string elements in a json document to a java List, which is inside a bean using genson. I was expecting this to happen automatically, but it is not working. Am I missing something? Here is my Json-String: {"id":12345,"permissions":["READ_XX","WRITE_XX"]} And here is the output of my object, showing that my permissions-list is not bein populated: DefaultRole [id=12345, name=null, permissions=[]] My DefaultRole class looks like this: public class DefaultRole implements Role { public Id id = null; @XmlElementWrapper(name = "permissions") @XmlElement(name = "permission") private List&lt;String&gt; permissions = Lists.newArrayList(); @Inject public DefaultRole() { } [...] The JAXB annotations are only for XML-conversion. They shouldn't play a role here. I am creating the Genson object like this: Genson genson = new Genson.Builder() .setWithClassMetadata(false) .setWithBeanViewConverter(true) .setWithDebugInfoPropertyNameResolver(true) .setSkipNull(true) .create(); My deserialize call: genson().deserialize(jsonString, DefaultRole.class) Does anyone have a tip on how I can deseriealize my json string array into a java List object residing inside a bean? EDIT [SOLVED PARTLY - STILL ONE QUESTION OPEN] I have got a step further now. I went back to the roots and started off with a basic bean that simply has a list of strings. And as expected the first time, this works. The difference between the previous object is mainly that this one follows the bean specification. The other object (DefaultRole) follows the fluid-object-pattern (not sure if that is the correct denfinition). Basically, instead of the setter method being void I return the object, so that the next value can easily be set in a fluid manner. So this works: public void setPermissions(List&lt;String&gt; permissions) { this.permissions = permissions; } This does not work: public Role setPermissions(List&lt;String&gt; permissions) { this.permissions = permissions; return this; …
has comment: http://stackoverflow.com/comment/33289872
tagged with: genson
has comment: http://stackoverflow.com/comment/33289797
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33290315
favorite count: 0
tagged with: serialization

http://stackoverflow.com/comment/33141886
type: QuestionComment
comment on: http://stackoverflow.com/q/21882405
score: 0
has text: The default permitted XML nesting level is 100, if you exceed this you get that exception. A solution would be to increase the default maxPackageEntryDepth. The maximum nesting limits can be set directly on the SecureContentHandler level.
type: Comment

http://stackoverflow.com/comment/33190195
type: QuestionComment
comment on: http://stackoverflow.com/q/21914116
type: Comment
score: 1
has text: Please do not paraphrase important information, such as "special characters like ...". Do a copy/paste to show EXACTLY what you see, preferably in a code block (indent 4 spaces), and also tell us where/how you are displaying the data. It is highly likely that the output is actually correct, and whatever is displaying the data does not support UTF-8.

http://stackoverflow.com/q/21960745
accepted answer: http://stackoverflow.com/a/21960812
has body: This is my manifest file http://grab.by/uzwu (screenshot) when I run it on the phone it does not show up with in the apps when I go to app manager its right there running but it wont open or display on the app drawer any help is appreciated. Thank you.
type: Question
has title: android java manifest.xml wont load on phone
score: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
tagged with: android
tagged with: android-manifest
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21960812

http://stackoverflow.com/q/21860557
score: -1
type: Question
has body: I have a couple of radio buttons on a page in my android application, I was wondering if anyone knew how to limit the user's selection to only one radio button. Thanks in advance.
tagged with: radio-button
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33094081
tagged with: android
has title: Single selection of Radio Button in android application
upvote count: 0
has comment: http://stackoverflow.com/comment/33094114
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21860744
accepted answer: http://stackoverflow.com/a/21860744

http://stackoverflow.com/q/21949337
answer count: 1
has title: maven resources are not getting included
has body: When I click on "update maven project", resources are not included. When we look at the resources build path, it is shown as ** pom.xml src/main/resources **/*.* lib/config **/*.* Question Why my maven resources are not getting included ?
has answer: http://stackoverflow.com/a/21949453
type: UnansweredQuestion
tagged with: maven
tagged with: java
type: Question
score: 0

http://stackoverflow.com/comment/33334785
type: Comment
has text: Hint: there's a file called `eclipse.ini` in your installation directory.
comment on: http://stackoverflow.com/q/21995185
score: 3
type: QuestionComment

http://stackoverflow.com/a/21923420
has body: I figured it out. The scanner is reading multiple lines of the file at once. I thought that there was one line, but it just appears that way in the txt file. It's actually three lines sitting next to each other. EDIT: False alarm, after deleting the other lines, it is still incorrectly reading the remaining line EDIT 2: Or at least the print of the list is not correct
type: Answer
has comment: http://stackoverflow.com/comment/33207865
answers question: http://stackoverflow.com/q/21922244
score: 0

http://stackoverflow.com/a/21962995
downvote count: 0
score: 1
has body: I see this dotted about in your code: sumOfWeight += item.weight; Slow down a moment here - you're not using a concrete instance of a class; you're referring to the interface instead. You'll observe that the interface doesn't have a field for weight, hence your compilation failure. If you want to adhere to using the interface, then you need to change a few things. Add a method getWeight() to your interface. public float getWeight(); Remove the abstract declaration from your Fish class (that will only serve to hurt and confuse you). Then, when you want to perform that summation operation, you can: sumOfWeight += item.getWeight();
answers question: http://stackoverflow.com/q/21962929
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/33277806
has comment: http://stackoverflow.com/comment/33277825

http://stackoverflow.com/a/21882486
answers question: http://stackoverflow.com/q/21878972
score: 0
has comment: http://stackoverflow.com/comment/34129826
has body: My advice would be to separate the business logic from the presentation logic and you'll end up with something like this: /** * Represents the concept of getting a `Integer` quantity from some source. */ public inteface Quantity { public Integer getValue(); } /** * Represents the combination of a price and quantity to produce a total. */ public class Total { private double price; private Quantity quantity; public Total(double price, Quantity quantity) { this.price = price; this.quantity = quantity; } public Double getValue() { Integer quantity = quantity.getValue(); return quantity != null ? quantity * price : null; } } Then you can use this inteface and class in your Swing code like this (which is only intended to show the interaction with Swing, not how to layout the controls): public class MyFrame extends JFrame { private static final List&lt;Double&gt; PRICES = Arrays.asList(20.0, 25.0, 30.0); public MyFrame() { List&lt;Total&gt; totals = new ArrayList&lt;Total&gt;(); JList totalsList = new JList(new TotalListModel(totals)); addComponent(totalsList); for (Double price : PRICES) { JTextField quantityTextField = new JTextField(); quantityTextField.addActionListener(new RepaintComponentActionListener(totalsList)); addComponent(quantityTextField); totals.add(new Total(price, new TextFieldQuantity(quantityTextField))); } } private class TotalListModel extends AbstractListModel { private List&lt;Total&gt; totals; public TotalListModel(List&lt;Total&gt; totals) { this.totals = totals; } public Object getElementAt(int index) { Double value = totals.get(index).getValue(); return value != null ? value.toString() : "NO VALUE"; } public int getSize() { return totals.size(); } } private class TextFieldQuantity implements Quantity { private JTextField textField; public TextFieldQuantitySource(JTextField textField) { this.textField = textField; } public Integer getQuantity() { try { return Integer.parseInt(textField.getText()); } catch (NumberFormatException e) { return null; …
type: Answer

http://stackoverflow.com/q/21908112
tagged with: selenium
upvote count: 7
type: Question
has comment: http://stackoverflow.com/comment/33542678
has body: I am creating a frame work for my AUT. I plan to use Webdriver/Java. I am relatively new to Selenium, Java and html programming. I want to implement the framework in following manner. There will be an HTML interface where user can select check boxes for the test cases he wants to run. He can submit after making his selection. On submitting the script will be executed. Execution will consist of only selected cases. My questions are: Is anything better than html for point 1? I don't want to use Excel as I want this interface to be interactive so that anyone can use the interface, without any knowledge of domain or the script running behind it. How should I go about point 3? I would need to start my main function and pass the selected 'cases' as an array or something.
tagged with: javascript
has answer: http://stackoverflow.com/a/22086067
has title: Executing Webdriver script from HTML
tagged with: http://stackoverflow.com/tag/html
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33542688
has comment: http://stackoverflow.com/comment/33316762
favorite count: 0
has comment: http://stackoverflow.com/comment/33180849
has comment: http://stackoverflow.com/comment/33180763
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33179846
tagged with: selenium-webdriver
score: 7
tagged with: java

http://stackoverflow.com/q/21903740
score: 0
possible better answer: http://stackoverflow.com/a/21903868
accepted answer: http://stackoverflow.com/a/21903809
answer count: 4
has title: Normal Class extend to another abstract class
has answer: http://stackoverflow.com/a/21904111
has body: public abstract class A { abstract void polo(); } class B extends A { } My doubt is if I give abstract keyword in class B means it wont shows anything abstract class B extends A { } Why its not showing the message here to implement methods in class A - this is my doubt. If I didn't give abstract keyword means class B indicates like this The type B must implement the inherited abstract method A.polo() What's wrong with that one. Can abstract class extend another abstract class or not.
has answer: http://stackoverflow.com/a/21904063
has answer: http://stackoverflow.com/a/21903809
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21903868
type: Question
has comment: http://stackoverflow.com/comment/33171604

http://stackoverflow.com/comment/33333424
score: 0
type: AnswerComment
type: Comment
has text: I've removed the scalat dependency, cleaned the project and restarted eclipse. Still no good
comment on: http://stackoverflow.com/a/21991409

http://stackoverflow.com/comment/33332140
has text: onClick requires only one param that is the view sure you have the right imports??
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21993755

http://stackoverflow.com/q/21863945
answer count: 1
has body: Hi all I want to how to make this code works without serialization here is my code: List&lt;Integer&gt; k = new ArrayList&lt;Integer&gt;(); // TODO Auto-generated method stub for (int i = 0; i &lt; MainActivity.lista_wybranych_towarow.size(); i++) { k.add(towary.get(i).getTow_ilosc()-MainActivity.lista_wybranych_towarow.get(i).getTow_ilosc()); } Intent i = new Intent(getApplicationContext(), Zatwierdz.class); i.putIntegerArrayListExtra("rozmiar_listy", (ArrayList&lt;Integer&gt;) k); // String.valueOf(lista.get(j).size())); startActivity(i); and here is what I'm trying to make in my next class where I pass data ArrayList&lt;Integer&gt; rozmiar_listy = getIntent().getIntegerArrayListExtra(k); But it doesn't work poperly. Why ?
score: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/21863988
has title: Advice with getIntegerArrayListExtra();
tagged with: android-intent
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21863988

jodatime
tags question: http://stackoverflow.com/q/22001683
tags question: http://stackoverflow.com/q/21937147
type: Tag
tags question: http://stackoverflow.com/q/21864726
tag name: jodatime
tags question: http://stackoverflow.com/q/21912769
tags question: http://stackoverflow.com/q/21941750
tags question: http://stackoverflow.com/q/21952989
tags question: http://stackoverflow.com/q/21972361
tags question: http://stackoverflow.com/q/21973842

http://stackoverflow.com/q/21924403
favorite count: 0
tagged with: jdbc
score: 2
downvote count: 0
type: Question
has title: send a broadcast message to all items in list in java
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21931504
upvote count: 2
has body: I would like to send a broadcast message to all numbers returned from the select statement. It saves elements in the list but then it sends the same message to everyone. What am I doing wrong? Please see my method below. public static List&lt;Message&gt; listAllMessages(Connection connection) { List&lt;Message&gt; msg = new ArrayList&lt;Message&gt;(); String messages = ReturnTexts.getMessage(connection, "EMPTYMESSAGE"); String sql = "SELECT b.`productid` as productid, p.`productname` as productname, b.`msisdn` as msisdn , MAX(b.`amount`) as amount, b.`productcode` as productcode, a.`endDate` as enddate FROM " + TableNames.SAVEDBIDSTABLE + "b LEFT JOIN " + TableNames.PRODUCTTABLE1 + " p ON b.`productcode`= p.`code` " + " JOIN " + TableNames.AUCTIONTABLE1 + " a" + " ON b.`productcode`= a.`productcode` " + "GROUP BY msisdn, productcode "; PreparedStatement statement = null; ResultSet resultSet = null; try { if (connection == null || connection.isClosed() ) connection = DBConnection.getConnection(); // LOGGER.info(sql); statement = DBConnection.isConnected(connection).prepareStatement( sql); // statement = connection.createStatement(); resultSet = statement.executeQuery(); long productid = 0; String productname = null; String msisdn = null; int amount = 0; String productcode = null; Date enddate = null; while (resultSet.next()) { productid = resultSet.getLong("productid"); productname = resultSet.getString("productname"); msisdn = resultSet.getString("msisdn"); amount = resultSet.getInt("amount"); productcode = resultSet.getString("productcode"); enddate = resultSet.getTimestamp("enddate"); msg.add(new Message(Long.valueOf(productid), productname, msisdn, amount, productcode, String.valueOf(enddate))); } String messages = ReturnTexts .getMessage(connection, "BROADCAST") .replace("XXXX", productname) // .replace("YYYY", String.valueOf(amount)) .replace("YYYY", String.valueOf(maxBid(productcode, connection))) .replace("ZZZZ", String.valueOf(enddate)); //LOGGER.info(messag…
has answer: http://stackoverflow.com/a/21931504
answer count: 1

http://stackoverflow.com/q/21934862
linked to: http://stackoverflow.com/q/9321543
has title: Android passing of string to another activity
score: 0
has answer: http://stackoverflow.com/a/21935051
has answer: http://stackoverflow.com/a/21934939
tagged with: sqlite
answer count: 5
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21935016
has answer: http://stackoverflow.com/a/21935076
tagged with: java
has comment: http://stackoverflow.com/comment/33226620
type: Question
has answer: http://stackoverflow.com/a/21935008
has body: Can I ask if someone knows how to pass the data entered from one activity to another activity? The string to be passed to that activity will be compared to the images in the database of the Android phone.. Here is the code sirs: AlphabetConversion.java package com.mobilebasedsignlanguage; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; public class AlphabetConversionMenu extends Activity { EditText et_conv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.alphaconv); Button alphaConv = (Button)findViewById(R.id.btn_alphaconv); et_conv = (EditText)findViewById(R.id.et_convtxt); alphaConv.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { String checkWord = et_conv.getText().toString(); Bundle word = new Bundle(); word.putString("key", checkWord); Intent a = new Intent(AlphabetConversionMenu.this, AlphabetCompareClass.class); a.putExtras(word); startActivity(a); } }); } } Here is the java for the second activity package com.mobilebasedsignlanguage; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class AlphabetCompareClass extends Activity { String get; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.alphabetcompare); Bundle gotWord = getIntent().getExtras(); get = gotWord.getString("key"); TextView Word = (TextView)findViewById(R.id.textView1); Word.setText(get); for(int x = 0; x &gt; gotWord.getString("key").length(); x++){ //if(gotWord.getString("key").charAt(0) == "SELECT * from " + TABLE_CONTACTS) // Get Image from the Database // Set it on Image View // set timer 2 secs } }; } The comments in the second activity I think I don't know how to code that. Really need someones h…

http://stackoverflow.com/comment/33203782
comment on: http://stackoverflow.com/q/21901470
has text: Try the jax-rs and java object serialization then, it should be as fast as rmi. Btw, why did you use servlets + xml over jax-ws services (servlet + xml combination is much harder to get right performance wise, esp if you are using jaxb for marshalling/unmarshalling)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33111555
type: Comment
has text: OK I understand that, but what I don't understand is where the name must be changed. Changing the name inside the preference causes a crash because it says "No activity found to handle intent". Is the android:action="" line supposed to say something different?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21869850

http://stackoverflow.com/q/21940645
has comment: http://stackoverflow.com/comment/33238959
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33238084
has title: EditText drawable left will not be changed
has comment: http://stackoverflow.com/comment/33238817
tagged with: android
has comment: http://stackoverflow.com/comment/33237937
type: AnsweredQuestion
tagged with: android-edittext
tagged with: java
has answer: http://stackoverflow.com/a/21941951
accepted answer: http://stackoverflow.com/a/21941951
has body: I have an EditText box that I want to change the background color and drawable left of when the character count is greater than or equal to 4. As seen in my code snippet below I used a TextWatcher to capture typing events and at the moment the background color changes, but the setCompoundDrawable does not change the drawable on the EditText box. Am I doing something wrong, or is it a glitch of some sort? final EditText input = (EditText)view.findViewById( R.id.editText ); input.addTextChangedListener( new TextWatcher() { @Override public void beforeTextChanged( CharSequence charSequence, int i, int i2, int i3 ) { } @Override public void onTextChanged( CharSequence charSequence, int start, int count, int after ) { } @Override public void afterTextChanged( Editable editable ) { if(editable.length() &lt;= 3 ){ input.setBackgroundColor( getResources().getColor( R.color.edittext_background_red) ); input.setCompoundDrawables( getResources().getDrawable( R.drawable.ic_cross ), null, null, null ); }else if(editable.length() &gt;= 4 ){ input.setBackgroundColor( getResources().getColor( R.color.edittext_background_green )); input.setCompoundDrawables( getResources().getDrawable( R.drawable.ic_tick ), null, null, null ); } } } );
type: Question

http://stackoverflow.com/comment/33068322
type: Comment
score: 0
has text: @RC., that is commented part now i am not using that method. I am trying to implement with Asynctask.
comment on: http://stackoverflow.com/q/21845916
type: QuestionComment

http://stackoverflow.com/q/21979639
tagged with: multithreading
has comment: http://stackoverflow.com/comment/33308021
type: Question
has answer: http://stackoverflow.com/a/21980224
linked to: http://stackoverflow.com/q/2733356
linked to: http://stackoverflow.com/q/15900387
has title: Using Executor & Runnable together to kill threads after some time
tagged with: runnable
answer count: 1
type: UnansweredQuestion
tagged with: executorservice
score: 0
has body: I happened to come across this article for killing a thread after some time using the Executor service : Killing thread after some specified time limit in Java This is the code mentioned in the article : ExecutorService executor = Executors.newSingleThreadExecutor(); executor.invokeAll(Arrays.asList(new Task()), 10, TimeUnit.MINUTES); // Timeout of 10 minutes. executor.shutdown(); Now that I have a runnable thread to be executed in my program .How do I kill this thread after some time using the above mentioned code? Here's a part of my code which I have used for creating threads : public static List&lt;Thread&gt; thread_starter(List&lt;Thread&gt; threads,String filename) { String text=read_from_temp(filename); Runnable task = new MyRunnable(text); Thread worker = new Thread(task); worker.start(); // Remember the thread for later usage threads.add(worker); return threads; } public class MyRunnable implements Runnable { MyRunnable(String text) { this.text=text; } @Override public void run() { /* other computation*/ } I create multiple threads by calling thread_started() function . Can anyone please help me on combining Executor Service with it . I tried a lot but couldn't find any way out !
tagged with: java

http://stackoverflow.com/a/21946526
answers question: http://stackoverflow.com/q/21946482
score: 7
has body: "so that i can swap pairs of characters like dictionary in python" Just use a Map. It's just like a Python Dictionary. Map&lt;Character, Character&gt; likeADict = new HashMap&lt;Character, Character&gt;(); likeADict.put('a','b'); likeADict.get('a'); You can add and remove values from it at runtime.
has comment: http://stackoverflow.com/comment/33248484
has comment: http://stackoverflow.com/comment/33248121
has comment: http://stackoverflow.com/comment/33248300
upvote count: 7
downvote count: 0
has comment: http://stackoverflow.com/comment/33248159
has comment: http://stackoverflow.com/comment/33248509
type: Answer

http://stackoverflow.com/comment/33226295
has text: Well, then you need to register a TypeAdapter indeed, but I would just do it for that `images` 'object'. See for instance this example: http://stackoverflow.com/questions/6014674/gson-custom-deseralizer-for-one-variable-in-an-object
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21934633
score: 1

http://stackoverflow.com/a/22374109
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21854945
answers question: http://stackoverflow.com/q/21854945
has body: You can write this style of query using HQL: from User where statuses[0].name = 'Created' I don't believe there is an equivalent form using the Criteria API.

http://stackoverflow.com/q/21927779
type: Question
score: 3
duplicate of: http://stackoverflow.com/q/5943330
possible better answer: http://stackoverflow.com/a/21927936
linked to: http://stackoverflow.com/q/5943330
has comment: http://stackoverflow.com/comment/33214209
answer count: 3
has title: issue in adding common elements of arraylist in third arraylist using for loop
tagged with: for-loop
downvote count: 0
has answer: http://stackoverflow.com/a/21927953
has comment: http://stackoverflow.com/comment/33214312
favorite count: 0
has comment: http://stackoverflow.com/comment/33216658
has answer: http://stackoverflow.com/a/21927936
tagged with: android
has comment: http://stackoverflow.com/comment/33214177
has comment: http://stackoverflow.com/comment/33214139
has body: I am trying to compare two ArrayLists, and after comparision i have to get common elements between those two arraylists and show them in a third arraylist. This is my code, here newList is the arraylist in which i want to add the common elements but each time i am adding elements in this arraylist it is showing only the last element. ArrayList&lt;String&gt; list2 = new ArrayList&lt;String&gt;(); list2.add("1"); list2.add("abc"); list2.add("3"); list2.add("4"); ArrayList&lt;String&gt; list1 = new ArrayList&lt;String&gt;(); list1.add("3"); list1.add("4"); list1.add("7"); list1.add("8"); list1.add("12"); list1.add("4"); list1.add("53"); list1.add("2"); list1.add("62"); list1.add("abc"); System.out.println("btn click r_answer "+list1+" "+list2); for (int i=0;i&lt;list1.size();i++) { for (int j=0;j&lt;list2.size(); j++) { if(list1.get(i).equals(list2.get(j))) System.out.println("equals..:"+list2.get(j)); newList.add(list2.get(j)); } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21927892
accepted answer: http://stackoverflow.com/a/21927892
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/33214114

http://stackoverflow.com/q/21974093
tagged with: executorservice
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/22075538
has answer: http://stackoverflow.com/a/21974194
upvote count: 5
tagged with: java
has body: I have a question regarding using a single threaded executor. Since it reuses the same thread, does that means that If I modify an object state in one submit call, can I assume that another modification of that object state in subsequent calls of submit are thread safe? Let me give a toy example... public class Main { public static void main(String[] args) throws Exception { final A a = new Main().new A(); ExecutorService executor = Executors.newSingleThreadExecutor(); Callable&lt;Integer&gt; callable = new Callable&lt;Integer&gt;() { @Override public Integer call() throws Exception { return a.modifyState(); } }; /* first call */ Future&lt;Integer&gt; result = executor.submit(callable); result.get(); /* second call */ result = executor.submit(callable); int fin = result.get(); System.out.println(fin); executor.shutdown(); } class A { private int state; public int modifyState() { return ++state; } public int getState() { return state; } } } So I am sharing object A. I submit a callable and modify it's state first ( see /* first call / ). I then do another submit call, modify again A state. (/ second call */).Now my big question Is it safe to say that, since it's the same thread, the second submit call will see A.state as being 1? Or could it see it as being 0 in some cases too? So basically I am asking if it's safe to modify variables that are not marked as volatile/accessed from synchronized blocks in subsequent submit calls of a single thread executor?, since it reuses the same thread What exactly does thread reusing means regarding executors? Is it really the same thread at OS level in the case of an single thread executor?
tagged with: thread-safety
possible better answer: http://stackoverflow.com/a/21974194
answer count: 2
score: 5
downvote count: 0
has title: Thread safety between subsequent calls of an Executors.newSingleThreadExecutor
accepted answer: http://stackoverflow.com/a/22075538
favorite count: 0

http://stackoverflow.com/comment/33618997
has text: i have posted my code as answer. kindly comment on it and give your suggestion. thanks in advance.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21986276
type: AnswerComment

http://stackoverflow.com/comment/33116940
type: Comment
has text: I removed it, and now the header isn't being included anymore.
comment on: http://stackoverflow.com/a/21873078
type: AnswerComment
score: 0

http://stackoverflow.com/q/21866954
has body: I am running mvn test in Eclipse on a Maven Project. The JUnit tests pass, but i get a stack trace error which is below. It's got to do with the javax.peristence.Persistence class I think. I did a bit of research and I think I need to add the javax library to the class path (getting some advice on how to do that would be great. I have put this dependency in the pom.xml, but still get the error. I thought listing it explicitly in the pom.xml would solve my problems. org.hibernate ejb3-persistence 1.0.2.GA pom Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.399 sec <<< FAILURE! - in tableTests.TestBaseDataConfig testCreateDeleteRow(tableTests.TestBaseDataConfig) Time elapsed: 0.087 sec <<< ERROR! java.lang.NoClassDefFoundError: javax/persistence/Persistence 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 persistence.PersistenceUtil.<clinit>(PersistenceUtil.java:12) at config.AbstractTableConfig.createRow(AbstractTableConfig.java:11) at tableTests.TestBaseDataConfig.testCreateDeleteRow(TestBaseDataConfig.java:51)
type: UnansweredQuestion
tagged with: eclipse
has answer: http://stackoverflow.com/a/21866975
upvote count: 0
favorite count: 0
type: Question
tagged with: maven
score: -1
tagged with: java
downvote count: 1
answer count: 1
has title: Maven test, build failure, java.lang.NoClassDefFoundError

http://stackoverflow.com/q/21928760
score: 0
has comment: http://stackoverflow.com/comment/33215654
possible better answer: http://stackoverflow.com/a/21929246
has answer: http://stackoverflow.com/a/21929246
has comment: http://stackoverflow.com/comment/33216298
accepted answer: http://stackoverflow.com/a/21939426
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/33215772
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33215962
tagged with: java
has comment: http://stackoverflow.com/comment/33216171
type: Question
has comment: http://stackoverflow.com/comment/33216189
has body: I've been able to use JSoup successfully to parse an entire page, however I've encountered a bit of a challenge to parse the first and in the first and last of a table. Especially seeing as the number of table rows changes throughout the length of the day. So far I understand that I need to get the table from within the page so I'm using this doc.select("table.tabular zebra").toString(); (although I don't know how to deal with the space in the table class, but that's a separate problem). The sample table is below: Latest trades Time Price Volume Value Bid Ask B/S 16:22:40 204p 2,500 £5,100 192.5p 192.5p Buy 16:05:23 200p 2,500 £5,000 192.5p 192.5p Buy 15:59:51 197p 1,000 £1,970 192.5p 192.5p Buy
tagged with: jsoup
answer count: 2
has title: Parsing the first value in the first and last of a with JSoup
has answer: http://stackoverflow.com/a/21939426

http://stackoverflow.com/q/21964937
has answer: http://stackoverflow.com/a/21965032
favorite count: 0
possible better answer: http://stackoverflow.com/a/21965032
score: -2
has comment: http://stackoverflow.com/comment/33281382
has comment: http://stackoverflow.com/comment/33281404
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/62632994
has answer: http://stackoverflow.com/a/21965106
tagged with: java
has title: Why are BigInteger calculations faster than any other primitive used calculations in JAVA
has comment: http://stackoverflow.com/comment/33281450
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/33281397
has comment: http://stackoverflow.com/comment/33281433
has body: For large numbers what algorithm is followed by BigIntegers to give results in really quick time? Ex- finding factorials or finding huge exponents
accepted answer: http://stackoverflow.com/a/21965106
downvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/33281535
has comment: http://stackoverflow.com/comment/33281396

http://stackoverflow.com/a/21984505
upvote count: 1
answers question: http://stackoverflow.com/q/21984304
downvote count: 0
score: 1
has body: There is a simple xml parser topic on stackoverflow : Stack link And I would encourage you to look at this tutorial : Xml parsing tut
type: Answer

http://stackoverflow.com/comment/33115314
type: AnswerComment
comment on: http://stackoverflow.com/a/21872081
score: 0
type: Comment
has text: The `onStop()` method isn't sufficient for what I want. What I'm doing is creating an ongoing notification that allows you to play, pause, and go to the previous and next songs in my application. I want this notification to remain alive even if you switch to another application, or go home on your phone, so you can still access the player's functions outside of the app. The `onStop()` function is called if you hit home on your phone, so this defeats the purpose of my ongoing notification.

http://stackoverflow.com/a/48744031
has body: This can be resolved by setting blank Output Stream to System error stream. Please see my answer in similar thread https://stackoverflow.com/a/48743963/1303210
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21851217

http://stackoverflow.com/comment/33297273
has text: JTextField is undefined for the type Object. You have to use private JTextField jTextField2. You did not instantiate the JTextField jTextField2. And the class NewJFrame1 does not exist. These are the errors shown in Eclipse.
type: Comment
comment on: http://stackoverflow.com/a/21972756
score: 0
type: AnswerComment

http://stackoverflow.com/q/21984822
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21985035
accepted answer: http://stackoverflow.com/a/21985035
type: AnsweredQuestion
has title: OpenGL Graphics Artifacts
tagged with: lwjgl
has body: I'm having some graphics artifacts in OpenGL (I'm using LWJGL) that are shown in the image below. I've no clue how it's called exactly so I had hard time searching for the solution. https://i.sstatic.net/ihzlJ.png Those are textured quads, but it's same with models and other kinds of primitives. Antialiasing is helping it only a bit. I'm sorry that I have to post that, probably there were lot of questions about it but I can't find anything.
type: Question
tagged with: opengl
tagged with: java

http://stackoverflow.com/comment/33101376
comment on: http://stackoverflow.com/q/21859595
score: 0
has text: I'm not using any such tool. This is just a standard pure-Java program using Swing.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21944464
has answer: http://stackoverflow.com/a/21944590
accepted answer: http://stackoverflow.com/a/21944590
has answer: http://stackoverflow.com/a/77740409
type: Question
has answer: http://stackoverflow.com/a/78247426
has title: what's my application package name in android?
possible better answer: http://stackoverflow.com/a/77740409
answer count: 6
has comment: http://stackoverflow.com/comment/33244444
tagged with: manifest
has answer: http://stackoverflow.com/a/76048080
downvote count: 1
favorite count: 0
score: 8
upvote count: 9
has answer: http://stackoverflow.com/a/79141592
has answer: http://stackoverflow.com/a/77930897
has body: I'm writing an android application. It has some packages under src. how can I figure out which of them is my application package? I want to add C@DM permissions: &lt;permission android:name="YOUR_PACKAGE_NAME.permission.C2D_MESSAGE" android:protectionLevel="signature" /&gt; &lt;uses-permission android:name="YOUR_PACKAGE_NAME.permission.C2D_MESSAGE" /&gt; how will my YOUR_PACKAGE_NAME change if I create a custom MyApplication extends Application class?
tagged with: android
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/33348578
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22002752
has text: Are those values Strings?
score: 0

http://stackoverflow.com/q/21971528
tagged with: java
has comment: http://stackoverflow.com/comment/33292893
type: Question
has body: I am having some issues with importing library which is needed to complete an assignment that I have been set. I'm not sure if I have added the library to the project, but the classes from the library appear to be in the libraries section of the project. https://i.sstatic.net/bGUqe.png I added the libraries by right clicking on project1 and going to properties: https://i.sstatic.net/bGUqe.png#1 However whenever I have "package project1" at the top of Project1.java I receive a message that MaInput - which is one of the classes in this library - is not recognised: cannot find symbol: symbol: class MaInput Whenever I take away "package project1" when trying to compile it reads: Error: Could not find or load main class project1.Project1 Java Result: 1.
downvote count: 0
tagged with: importerror
has answer: http://stackoverflow.com/a/21971808
answer count: 1
has title: Trouble with Importing Java Libraries into a project with NetBeans
favorite count: 0
tagged with: netbeans
type: UnansweredQuestion
upvote count: 1
tagged with: import-libraries
score: 1

http://stackoverflow.com/q/21923457
has comment: http://stackoverflow.com/comment/33207396
has comment: http://stackoverflow.com/comment/33207506
has comment: http://stackoverflow.com/comment/33207321
has comment: http://stackoverflow.com/comment/33207208
accepted answer: http://stackoverflow.com/a/21923710
has body: More specifically, suppose I have an array with duplicates: {3,2,3,4,2,2,1,4} I want to have a data structure that supports search and remove the first occurrence of some value faster than O(n), say if the value is 4, then it becomes: {3,2,3,2,2,1,4} I also need to iterate the list from head according to the same order. Other operations like get(index) or insert are not needed. You can use O(n) time to record the original data(say it's an int[]) in your data structure, I just need the later search and remove faster than O(n). "Search and remove" is considered as ONE operation as shown above. If I have to make it myself, I would use a LinkedList to store the data, and HashMap to map every key to a list of all occurrence of nodes together with their previous and next ones. Is it a right approach? Are there any better choices already there in Java?
type: AnsweredQuestion
tagged with: linked-list
downvote count: 0
has comment: http://stackoverflow.com/comment/33207354
type: Question
has answer: http://stackoverflow.com/a/21923710
has title: Data structure in Java that supports quick search and remove in array with duplicates
has comment: http://stackoverflow.com/comment/33207473
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33207304
tagged with: duplicates
has comment: http://stackoverflow.com/comment/33207125
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/21923536
tagged with: data-structures
favorite count: 0
tagged with: hash
possible better answer: http://stackoverflow.com/a/21923536

http://stackoverflow.com/comment/33109262
score: 0
has text: I'll edit the code to give you a quick walkthrough. Eating right now though, give me like 15 minutes.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21867780

http://stackoverflow.com/q/21961975
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33276494
upvote count: 1
has title: Can't figure out what's triggering "java.util.ConcurrentModificationException"
type: Question
has body: My code is throwing an error that I've never seen before. So hey! I guess I'm learning ;) Anyway, I did some reading and generally this error is thrown when a list that is being iterated over is modified mid-iteration. However, I'm pretty sure I'm not modifying it. While the error is being thrown on partition(), if I don't assign a new value for currentList in updateCurrentList() (by commenting out the code), the program no longer throws the error. These two functions are called one after the other in my play() method, however the list iteration should be complete by the time the change is made. What am I missing? Do I have to close down the iterator somehow? package hangman; import java.io.*; import java.util.*; import javax.swing.JOptionPane; public class Hangman { private Map&lt;String, List&lt;String&gt;&gt; wordPartitions; // groups words according to positions of guessed letter private List&lt;String&gt; currentList; // remaining possible words that fit the information given so far Set&lt;Character&gt; wrongGuesses; // holds all the "wrong" guesses so far StringBuilder guessString; // current state of the word being guessed String justHyphens; // for checking whether a guess was "wrong" // initialize fields // currentList should contain all (and only) words of length wordLength // justHyphens and guessString should consist of wordLength hyphens public Hangman(int wordLength) throws FileNotFoundException { this.currentList = new ArrayList&lt;String&gt;(); addWords(wordLength); wrongGuesses = new HashSet(); for(int i = 0; i &lt; wordLength; i++) { justHyphens += "-"; } guessString = new StringBuilder(); wordPartitions = new HashMap(); } private void addWords(int wordLength) throws FileNotFoundException { Scanner words = new Scanner(new File("lexicon.txt")); String word = ""; while(words.hasNext()) { word = words.next(); if (word.length() == wordLength) { currentList.add(word); } } } // main loop public void play() { char choice; do { choice = getUserChoice(); pa…
has comment: http://stackoverflow.com/comment/33276065
has answer: http://stackoverflow.com/a/21962460
has comment: http://stackoverflow.com/comment/33276337
answer count: 1
has comment: http://stackoverflow.com/comment/33276147
downvote count: 0
has comment: http://stackoverflow.com/comment/33276047
favorite count: 0
has comment: http://stackoverflow.com/comment/33276162
tagged with: exception
accepted answer: http://stackoverflow.com/a/21962460
has comment: http://stackoverflow.com/comment/33276043
has comment: http://stackoverflow.com/comment/33276193
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33276415

http://stackoverflow.com/q/21970390
has comment: http://stackoverflow.com/comment/33290831
score: 1
has comment: http://stackoverflow.com/comment/33290769
upvote count: 1
tagged with: swing
has body: String[] i2ColumnNames = {"Sr. No." "Head ID", "Name", "Category", "Financial Year", "Debit", "Credit"};
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21970528
tagged with: jtable
answer count: 1
has title: Why is my table not showing column names?
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/2320812
accepted answer: http://stackoverflow.com/a/21970528
type: AnsweredQuestion

http://stackoverflow.com/a/33944296
answers question: http://stackoverflow.com/q/21850298
accepted answer of: http://stackoverflow.com/q/21850298
type: AcceptedAnswer
has body: This was my question. I fixed this using libjars option with Hadoop. export libpath=/path to hbase jar hadoop jar myjarname.jar &lt;classpath&gt; arguments -libjar ${libpath}
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/60123681

http://stackoverflow.com/q/21904569
tagged with: android
has comment: http://stackoverflow.com/comment/33173008
has comment: http://stackoverflow.com/comment/33173089
has comment: http://stackoverflow.com/comment/33174256
has answer: http://stackoverflow.com/a/21905020
accepted answer: http://stackoverflow.com/a/21905020
possible better answer: http://stackoverflow.com/a/21904735
has comment: http://stackoverflow.com/comment/33172970
has answer: http://stackoverflow.com/a/21904735
has body: I have an EditText with 140 characters maximum length for typing. Now I have one button, when I click the button, the contents of the edit text should be printed on log cat. Up to this I have implemented. But my question is, I should validate for words which means a continuous text without meaning (for eg. "ajldjlkdjkjfdjdjjd") should not be printed instead words should be checked say word length of 10 approx. for grammar. How to implement this ? any ideas would be helpful for me. thanks in advance. Note:- I may type word as well as numbers, if i typed word without meaning it should alert a message.
type: AnsweredQuestion
tagged with: android-edittext
has comment: http://stackoverflow.com/comment/33174476
has comment: http://stackoverflow.com/comment/33174553
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33173101
tagged with: spell-checking
answer count: 2
linked to: http://stackoverflow.com/q/14192199
has title: How to find word Length of the Edittext in android?
score: 0

http://stackoverflow.com/comment/33178573
comment on: http://stackoverflow.com/a/21907737
has text: In this case just change the way the devices are stored to an array. Also use Arrays.copyOfRange() to copy all the items, if the split length is greater than 2 (there is at least one deviceID).
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21882846
has comment: http://stackoverflow.com/comment/33134041
has comment: http://stackoverflow.com/comment/33139720
has answer: http://stackoverflow.com/a/21882913
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/21883115
has title: FATAL EXCEPTION: AsyncTask #1 Caused by: java.lang.NullPointerException
score: 0
has body: I'm getting a FATAL EXCEPTION with a NullPointerException in line 275 of mainActivity ( Log.d("Create Response", json.toString());) I have referenced the object before as JSONObject json = new JSONObject(); and I'm still getting null pointer. My log cat is below. Log cat : 02-19 08:56:34.101: E/AndroidRuntime(1913): FATAL EXCEPTION: AsyncTask #1 02-19 08:56:34.101: E/AndroidRuntime(1913): Process: com.example.newjudoapp, PID: 1913 02-19 08:56:34.101: E/AndroidRuntime(1913): java.lang.RuntimeException: An error occured while executing doInBackground() 02-19 08:56:34.101: E/AndroidRuntime(1913): at android.os.AsyncTask$3.done(AsyncTask.java:300) 02-19 08:56:34.101: E/AndroidRuntime(1913): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) 02-19 08:56:34.101: E/AndroidRuntime(1913): at java.util.concurrent.FutureTask.setException(FutureTask.java:222) 02-19 08:56:34.101: E/AndroidRuntime(1913): at java.util.concurrent.FutureTask.run(FutureTask.java:242) 02-19 08:56:34.101: E/AndroidRuntime(1913): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 02-19 08:56:34.101: E/AndroidRuntime(1913): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 02-19 08:56:34.101: E/AndroidRuntime(1913): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 02-19 08:56:34.101: E/AndroidRuntime(1913): at java.lang.Thread.run(Thread.java:841) 02-19 08:56:34.101: E/AndroidRuntime(1913): Caused by: java.lang.NullPointerException 02-19 08:56:34.101: E/AndroidRuntime(1913): at com.example.newjudoapp.MainActivity$selectUser.doInBackground(MainActivity.java:275) 02-19 08:56:34.101: E/AndroidRuntime(1913): at com.example.newjudoapp.MainActivity$selectUser.doInBackground(MainActivity.java:1) 02-19 08:56:34.101: E/AndroidRuntime(1913): at android.os.AsyncTask$2.call(AsyncTask.java:288) 02-19 08:56:34.101: E/AndroidRuntime(1913): at java.util.concurrent.FutureTask.run(FutureTask.java:237) 02-19 08:56:34.101:…
tagged with: nullpointerexception
answer count: 3
has comment: http://stackoverflow.com/comment/33139887
has answer: http://stackoverflow.com/a/21883338
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/33133975
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/21964655
score: 0
accepted answer of: http://stackoverflow.com/q/21951094
type: AcceptedAnswer
has body: i think what you have to do is the following : 1st - parse the request to get a list of FileItem like the following : List&lt;FileItem&gt; items = upload.parseRequest(request); 2nd - process the uploaded items like the following : Iterator&lt;FileItem&gt; iter = items.iterator(); while (iter.hasNext()) { FileItem item = iter.next(); if (item.isFormField()) { processFormField(item); } else if (!item.isFormField()) { // Process a file upload String fieldName = item.getFieldName(); String fileName = item.getName(); String contentType = item.getContentType(); boolean isInMemory = item.isInMemory(); long sizeInBytes = item.getSize(); //here you change the name of the uploaded file and then write it File uploadedFile = new File(dir , "fileName"); item.write(uploadedFile); } } and please check the documentation here in the section Processing the uploaded items . and give me some feedback Hope That Helps .
type: Answer
answers question: http://stackoverflow.com/q/21951094

http://stackoverflow.com/comment/33112947
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21870694
has text: No, those issues won't cause ClassCastException. The reason why Stack Overflow lets us post comments under a question is so that we can ask for the actual information we need _before_ we post an answer, not the other way round.

http://stackoverflow.com/comment/33085638
comment on: http://stackoverflow.com/q/21855847
type: Comment
score: 2
has text: Define "parceable problems", possibly with a stacktrace. `transient` and `Serializable` are available from API Level 1 on and should therefore work on any level.
type: QuestionComment

http://stackoverflow.com/comment/33161804
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21897785
has text: Seriously, don't bother doing that. Unless you're quite sure that you know why this doesn't work for the OP.

http://stackoverflow.com/a/21852029
type: Answer
answers question: http://stackoverflow.com/q/21851855
has body: First,after you executed the javac ,you should check the existence of class file of main Java file
score: 0
has comment: http://stackoverflow.com/comment/33169710

http://stackoverflow.com/q/21945566
tagged with: floating-point
has body: Hi I have been trying to keep a count on the float in each object so that I can get a sum of all the floats. the float represents weight so I have tried to do the following: i declared a weight sum as float sumOfWeight; and the say sumOfWeight = ++weight;but it was not been working out, any suggestions ? Lake weirdLake = new Lake(15); weirdLake.add(new Fish(76, 6.1f)); weirdLake.add(new Fish(32, 0.4f)); weirdLake.add(new Fish(20, 0.9f)); weirdLake.add(new Fish(30, 0.4f)); weirdLake.add(new Fish(140, 7.4f)); weirdLake.add(new Fish(15, 0.3f)); weirdLake.add(new Fish(90, 5.9f)); weirdLake.add(new Fish(120, 6.8f)); weirdLake.add(new Fish(80, 4.8f)); weirdLake.add(new Fish(42, 3.2f)); weirdLake.add(new Fish(100, 5.6f)); weirdLake.add(new Fish(45, 2.0f)); weirdLake.add(new Fish(16, 0.2f)); weirdLake.add(new Fish(30, 1.2f)); weirdLake.add(new Fish(7, 0.1f)); here is my fish class: public class Fish { // Any fish below this size must be thrown back into the lake public static int THROW_BACK_SIZE = 18; public static float WEGHT_LIMIT = 10; protected int size; protected float weight; public Fish(int aSize, float aWeight) { size = aSize; weight = aWeight; } public boolean isDesirableTo(Fisher f) { if(canKeep() &amp;&amp; f.numFishCaught &lt; f.LIMIT &amp;&amp; weight) { return true; } else { return false; } } public boolean canKeep() { if(this.size &gt; THROW_BACK_SIZE) { return true; } else { return false; } } public int getSize() { return size; } public float getWeight() { return weight; } public String toString () { return ("A " + size + "cm " + weight + "kg Fish"); } } and here is my fisher class: import java.util.*; public class Fisher { private String name; private Fish [] fishCaught; public int numFishCaught; private int keepSize; public static int LIMIT = 10; public String getName() { return this.name; } public int getNumFishCaught() { return this.numFishCaught; } public int getKeepSize() { return this.keepSize; } public Fisher(String n, int k) { name = n; keepSize = k…
type: Question
has answer: http://stackoverflow.com/a/21945612
has answer: http://stackoverflow.com/a/21945665
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/33246403
tagged with: attributes
accepted answer: http://stackoverflow.com/a/21945612
possible better answer: http://stackoverflow.com/a/21945632
has title: how to do i keep a count on certain attributes in objects
tagged with: object
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21945632
tagged with: oop
tagged with: java

http://stackoverflow.com/comment/33140373
comment on: http://stackoverflow.com/q/21886090
type: Comment
type: QuestionComment
has text: How about using the Apache Commons StringUtils library? http://commons.apache.org/proper/commons-lang/javadocs/api-3.2.1/index.html . Maybe StringUtils.splitByWholeSeparator(String str, String separator)
score: 0

http://stackoverflow.com/q/21860349
upvote count: 2
has answer: http://stackoverflow.com/a/21871145
tagged with: android
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21871145
has body: I'm getting a ESDIR (is a directory) error from the exception catch. I know it's because of something wrong with the paths that I've used and it seems that I'm referencing a folder rather than a file (maybe?), but I'm unsure how to correct it. I've checked that the .mkdirs is working - I can see the files get created. Edit: With suggestions. private void exportDB(){ try { String DB =getDatabasePath(DBHandler.DATABASE_NAME).toString(); Toast.makeText(getApplicationContext(), "Path is: " +DB, Toast.LENGTH_LONG).show(); String sd = Environment.getExternalStorageDirectory().toString(); Toast.makeText(getApplicationContext(), "Path is: " +sd, Toast.LENGTH_LONG).show(); String backupDBPath = sd + "/com.AH.memorisethai/Backup/database.db"; File currentDB =(getDatabasePath(DBHandler.DATABASE_NAME)); File backupDB = new File(backupDBPath); backupDB.mkdirs(); Toast.makeText(getApplicationContext(), "Path is: "+backupDBPath, Toast.LENGTH_LONG).show(); FileInputStream inStream = new FileInputStream(currentDB); FileOutputStream outStream = new FileOutputStream(backupDBPath); FileChannel inChannel = inStream.getChannel(); FileChannel outChannel = outStream.getChannel(); inChannel.transferTo(0, inChannel.size(), outChannel); inStream.close(); outStream.close(); } catch (Exception e) { Toast.makeText(getBaseContext(), e.toString(), Toast.LENGTH_LONG).show(); } } Error Log: 02-19 09:45:59.820: W/myApp(22243): Start Copy 02-19 09:45:59.825: W/System.err(22243): java.io.FileNotFoundException: /storage/emulated/0/com.AH.memorisethai/Backup/database.db: open failed: EISDIR (Is a directory) 02-19 09:45:59.825: W/System.err(22243): at libcore.io.IoBridge.open(IoBridge.java:409) 02-19 09:45:59.825: W/System.err(22243): at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:88) 02-19 09:45:59.825: W/System.err(22243): at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:128) 02-19 09:45:59.830: W/System.err(22243): at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.…
tagged with: java
has answer: http://stackoverflow.com/a/21860477
type: Question
has comment: http://stackoverflow.com/comment/33095063
answer count: 2
has title: Backing up SQLite database to external storage - Wrong file reference
score: 2
tagged with: sqlite
downvote count: 0
accepted answer: http://stackoverflow.com/a/21860477
has comment: http://stackoverflow.com/comment/33118077
favorite count: 0
has comment: http://stackoverflow.com/comment/33094493

http://stackoverflow.com/comment/33252303
has text: @BheshGurung You don't "have" to use multiple layouts, you could accomplish this using just GridBagLayout, if you're feeling really adventurous, but a compound layout approach will make significantly easier all round ;)
type: Comment
comment on: http://stackoverflow.com/q/21948289
score: 0
type: QuestionComment

http://stackoverflow.com/q/21979040
tagged with: java
has comment: http://stackoverflow.com/comment/33306351
favorite count: 0
type: Question
upvote count: 1
answer count: 1
has body: Where should I use print and println statements to draw a building on my console window. Let's say the height of the building will be 2 then it should show two storeyed building like the one below. OUTPUT Well, it looks to me like it's nested loops. I think the most outer loop should be the number of stories. In that loop have another loop for the number of windows, and in that another one for how tall it is, then inside, how wide. Could anyone please give me an example how to do it? I know I have to use for loops. import java.util.Scanner; public class BuildingAssign { public static void main (String [] args){ int input; int stories; int windows; int wide; int tall; final int MAXSTORIESHIGH= 4; final int MINSTORIESHIGH = 1; final int MAXWINDOWS = 16; final int MINWINDOWS = 2; final int MAXWIDE = 4; final int MINWINDE = 3; final int MAXTALL = 4; final int MINTALL =3 ; Scanner in = new Scanner(System.in); do { System.out.print("How many stories high the building will be? (1-4): "); stories = in.nextInt(); }while (stories &lt; MINSTORIESHIGH || stories &gt; MAXSTORIESHIGH); do { System.out.print("How many windows on each story? (2-16): "); windows = in.nextInt(); }while (windows &lt; MINWINDOWS || windows &gt; MAXWINDOWS); if (stories &lt; 2){ System.out.print("It won't work"); } do { System.out.print("How wide each window will be? (3-4): "); wide = in.nextInt(); }while (wide &lt; MINWINDE || wide &gt; MAXWIDE); do { System.out.print("How tall each window will be? (3-4): "); tall = in.nextInt(); }while (tall &lt; MINTALL || tall &gt; MAXTALL); for (; stories == 1; stories++){ System.out.println("***********\n* *\n* *\n* *\n* *\n* *\n***********"); System.exit(0); } for (; stories == 2; stories++){ System.out.println("***********\n* *\n* *\n* *\n* *\n* *\n*********** \n* *\n* *\n* *\n* *\n* *\n***********"); System.exit(0); } for (; stories == 3; stories++){ System.out.println("***********\n* *\n* *\n* *\n* *\n* *\n*********** \n* *\n* *\n* *\n* *\n* *\n*********** \n*…
has comment: http://stackoverflow.com/comment/33346565
downvote count: 0
has title: Trying to Make a Building
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22002221
score: 1
accepted answer: http://stackoverflow.com/a/22002221

http://stackoverflow.com/comment/33343521
type: AnswerComment
type: Comment
has text: so it is now way how to do it... thanks
comment on: http://stackoverflow.com/a/21999773
score: 0

http://stackoverflow.com/a/21936462
answers question: http://stackoverflow.com/q/21935859
upvote count: 1
has comment: http://stackoverflow.com/comment/33232659
score: 1
has body: Try this: public static void main(String[] args) { String text = "the quick brown fox jumps fox fox over the lazy dog brown"; String[] textArray = text.split(" "); String[] keysToSearch = {"the", "fox", "dog"}; int count = 0; System.out.println(text); for(String key: keysToSearch) { for(String s : textArray) { if(key.equals(s)) { count++; } } System.out.println("Count of ["+key+"] is : "+count); count=0; } } Output: the quick brown fox jumps fox fox over the lazy dog brown Count of [the] is : 2 Count of [fox] is : 3 Count of [dog] is : 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21935859
type: Answer

http://stackoverflow.com/q/21923057
tagged with: reflection
tagged with: java
has answer: http://stackoverflow.com/a/21923171
has title: Jmock with reflection
tagged with: jmock
type: Question
has body: I have a requirement where i need to mock the com.sun.deploy.security.DeployManifestChecker and return null when accessing printWarningsIfRequired in that class. Since Deploy.jar is not in my build path, i couldnt directly mock it up. I'm looking at a way to implement it using Java reflection API. but i'm not sure how to invoke the mock method with the Class argument. method.invoke(null, new Class[]{claz1}); is failing with NP exception. Here is the code Mockery context ; final Class&lt;?&gt; claz1; try { Class mclaz = Class.forName("org.jmock.Mockery"); context = (Mockery) mclaz.newInstance(); claz1 = Class.forName("com.sun.deploy.security.DeployManifestChecker"); final Method method = mclaz.getDeclaredMethod("mock", new Class[]{Class.class} ); method.invoke(null, new Class[]{claz1}); } catch (ClassNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); }
score: 0
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/q/21897343
has comment: http://stackoverflow.com/comment/33161077
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33162053
tagged with: java
has answer: http://stackoverflow.com/a/21897447
tagged with: methods
has comment: http://stackoverflow.com/comment/33161029
type: Question
has answer: http://stackoverflow.com/a/21897544
tagged with: class
score: 0
has body: The program I am trying to create is a basic game where the user inputs a grid size the selects blocks receiving either a prize which adds to the score, a bandit which takes points away from the score or a bomb to end the game. I am getting a stack flow error and i can not figure out why? Sorry for the large amounts of code I am just unable to find the problem! This is the stack overflow error I'm receiving. It happens after you enter the grid size(It is much longer then this as you can see gameItems, blockHop, and prize keep repeating continuously : java.lang.StackOverflowError at java.lang.System.nanoTime(Native Method) at java.util.Random.&lt;init&gt;(Random.java:62) at BlockHop.&lt;init&gt;(BlockHop.java:12) at GameItems.&lt;init&gt;(GameItems.java:20) at Prize.&lt;init&gt;(Prize.java:9) at BlockHop.&lt;init&gt;(BlockHop.java:27) at GameItems.&lt;init&gt;(GameItems.java:20) at Prize.&lt;init&gt;(Prize.java:9) at BlockHop.&lt;init&gt;(BlockHop.java:27) at GameItems.&lt;init&gt;(GameItems.java:20) at Prize.&lt;init&gt;(Prize.java:9) at BlockHop.&lt;init&gt;(BlockHop.java:27) at GameItems.&lt;init&gt;(GameItems.java:20) Block Hop GUI: import java.util.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class BlockHopGUI extends JFrame{ private BlockHop bh; private JButton [][] board; private JLabel scorePoints; private PlayHandler ph; // listener for buttons public BlockHopGUI( int gridSize ) { super( "Click to uncover prizes" ); bh = new BlockHop( gridSize ); System.out.println( "gridsize: " + gridSize ); Container c = getContentPane( ); JPanel p = new JPanel( ); board = new JButton[gridSize][gridSize]; p.setLayout( new GridLayout( gridSize, gridSize ) ); ph = new PlayHandler( ); for ( int row = 0; row &lt; board.length; row++ ) for ( int col = 0; col &lt; board.length; col++ ) { board[row][col] = new JButton( "" ); board[row][col].addActionListener(ph); p.add( board[row][col] ); } c.add( p, BorderLayout.CENTER ); JPanel scorePanel = new JP…
answer count: 2
accepted answer: http://stackoverflow.com/a/21897447
has comment: http://stackoverflow.com/comment/33161042
possible better answer: http://stackoverflow.com/a/21897544
tagged with: stack-overflow
tagged with: extends
has title: Getting StackOverFlowError and unsure why?
has comment: http://stackoverflow.com/comment/33161112

http://stackoverflow.com/a/21968188
has body: I think your Location myLocation = locationManager.getLastKnownLocation(provider); line returning null. Please check this answer. It might be helpful
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21968077
has comment: http://stackoverflow.com/comment/33287645
score: 3
answers question: http://stackoverflow.com/q/21968077
has comment: http://stackoverflow.com/comment/33290283
has comment: http://stackoverflow.com/comment/33287181
type: AcceptedAnswer
downvote count: 0

input
tags question: http://stackoverflow.com/q/21844757
tags question: http://stackoverflow.com/q/21975413
tags question: http://stackoverflow.com/q/21899448
tags question: http://stackoverflow.com/q/21961750
tags question: http://stackoverflow.com/q/21917705
tags question: http://stackoverflow.com/q/21973192
tags question: http://stackoverflow.com/q/21864516
tags question: http://stackoverflow.com/q/22000544
tags question: http://stackoverflow.com/q/21872701
tags question: http://stackoverflow.com/q/21996615
tags question: http://stackoverflow.com/q/21924417
tags question: http://stackoverflow.com/q/21982664
tags question: http://stackoverflow.com/q/21973000
tag name: input
tags question: http://stackoverflow.com/q/21949110
type: Tag
tags question: http://stackoverflow.com/q/21859947

http://stackoverflow.com/a/22000672
score: 0
has body: Try using a scanner and splitting the String into a String[] by the spaces import java.util.Scanner; public class Foo { public static void main(String[] args) { Scanner s = new Scanner(System.in) String input = s.nextLine(); String[] parts = input.split(" "); for (String part : parts) { System.out.println(part); } } } I extended my above answer with the below code. It worked when I compiled and ran it, separating nine numbers by the spaces. public static void main(String[] args) { //Variables and Scanner Scanner input = new Scanner(System.in); int[] numbers = new int[9]; int checksum = 0; //Input System.out.print("For the our text enter the first 9 digits, separated by spaces: "); String numInput = input.nextLine(); String[] parts = numInput.split(" "); for (int i = 0; i &lt; parts.length; i++) { numbers[i] = Integer.parseInt(parts[i]); checksum += numbers[i] * (i + 1); } //Calculation checksum %= 11; } Tracing through the code, first I create a Scanner input object, an int[] numbers with 9 indices, and an int checksum instantiated at zero. Next, I prompt the user to input nine numbers, separated by spaces, then receive the entire line with input.nextLine(), which returns the stdin up to a newline character. I then split the numInput into a String[] parts by the spaces, making everything up the first space index zero, second space is index one, etc.. I iterate through the list, changing each String representation of the numbers into int objects and place it in the numbers array at index i. I then update the checksum Integer with numbers[i] (the number just converted) and multiply by i+1. After the loop, I modulus the checksum by 11. The input on the terminal will look like For the our text enter the first 9 digits, separated by spaces: 1 4 6 2 8 7 2 4 10 If you wanted to, change the line where it says String[] parts = input.split(" "); to String[] parts = input.split(","); and you could input your numbers like so: 1,4,6,2,8,7,2,4,10
type: Answer
answers question: http://stackoverflow.com/q/22000544
has comment: http://stackoverflow.com/comment/33351367

http://stackoverflow.com/comment/33308918
comment on: http://stackoverflow.com/q/21980158
type: Comment
type: QuestionComment
has text: ... use a better decompiler.
score: 1

http://stackoverflow.com/q/21852289
has answer: http://stackoverflow.com/a/21852795
has answer: http://stackoverflow.com/a/21852362
type: Question
has answer: http://stackoverflow.com/a/21852392
answer count: 8
possible better answer: http://stackoverflow.com/a/21854151
has title: Storing file in java using arraylist
has body: I am reading a file and want to save it in an array list to be able to call this method in another class for later use. Here's my code: package com.qmul.rfid.reader; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; public class ReadFile { public static void main(String[] args) { ArrayList&lt;ReadFile&gt; fileList = new ArrayList&lt;ReadFile&gt; (); try (BufferedReader br = new BufferedReader(new FileReader("C:\\tagNo.txt"))) { String CurrentLine; while ((CurrentLine = br.readLine()) != null) { System.out.println(CurrentLine); fileList.add(CurrentLine); } } catch (IOException e) { e.printStackTrace(); } } } I get an error at fileList.add(CurrentLine);. I know this is because CurrentLine does not match with ReadFile. How can I make this work? Thank you.
has answer: http://stackoverflow.com/a/21854151
tagged with: java-io
tagged with: arraylist
has answer: http://stackoverflow.com/a/21852360
score: 0
has comment: http://stackoverflow.com/comment/33079237
has comment: http://stackoverflow.com/comment/33079232
has answer: http://stackoverflow.com/a/21852349
accepted answer: http://stackoverflow.com/a/21852349
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21852344
tagged with: java
has answer: http://stackoverflow.com/a/21852407

http://stackoverflow.com/q/21929157
has comment: http://stackoverflow.com/comment/33218496
has comment: http://stackoverflow.com/comment/33310413
answer count: 2
score: 5
has body: My application is calling a webservice and I have generated the Java classes from the WSDL/XSDs with the maven-jaxb2-plugin. The webservice calls worked fine for a while but recently I had a problem on marshalling an object into XML: [org.xml.sax.SAXParseException: cvc-complex-type.2.4.d: Invalid content was found starting with element 'ns1:TheFooAndBarThing'. No child element '{"http://www.myschemanamespace.xyz/v1":BarId}' is expected at this point.] The XSD part looks like this: &lt;xs:complexType name="TheFooAndBarThing"&gt; &lt;xs:sequence&gt; &lt;xs:element name="FooId" minOccurs="1" maxOccurs="1" type="nx:FooIdType"/&gt; &lt;xs:element name="BarId" minOccurs="1" maxOccurs="100" type="nx:BarIdType"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; The generated class TheFooAndBarThing looks like this (Javadoc removed): @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "TheFooAndBarThing", propOrder = { "fooId", "barId" }) public class TheFooAndBarThing { @XmlElement(name = "FooId", required = true) protected String fooId; @XmlElement(name = "BarId", required = true) protected List&lt;String&gt; barId; public String getFooId() { return fooId; } public void setFooId(String value) { this.fooId = value; } public List&lt;String&gt; getBarId() { if (barId == null) { barId = new ArrayList&lt;String&gt;(); } return this.barId; } } It cost me some time and coffee to find out the real problem. My mistake was that I put more than 100 BarId elements in my list. So here's my question: How can I get the maxOccurs/minOccurs value from the XSD into my Java code so that I can use it as a max/min value while building my list of elements?
possible better answer: http://stackoverflow.com/a/31874009
has title: How to get the minOccurs / maxOccurs values from the XSD in Java using JAXB?
favorite count: 0
has answer: http://stackoverflow.com/a/31874009
tagged with: maven-jaxb2-plugin
upvote count: 5
tagged with: xsd
accepted answer: http://stackoverflow.com/a/22517241
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: jaxb
has answer: http://stackoverflow.com/a/22517241
type: Question

srid
tag name: srid
tags question: http://stackoverflow.com/q/21906723
type: Tag

swt
tags question: http://stackoverflow.com/q/21935289
tags question: http://stackoverflow.com/q/21986575
tags question: http://stackoverflow.com/q/21988996
tags question: http://stackoverflow.com/q/21913207
tags question: http://stackoverflow.com/q/21981784
tags question: http://stackoverflow.com/q/21942724
tags question: http://stackoverflow.com/q/21940631
tags question: http://stackoverflow.com/q/21918301
tags question: http://stackoverflow.com/q/21957252
tags question: http://stackoverflow.com/q/21879093
tags question: http://stackoverflow.com/q/21983463
tags question: http://stackoverflow.com/q/21966819
tags question: http://stackoverflow.com/q/21902859
tags question: http://stackoverflow.com/q/21851929
tags question: http://stackoverflow.com/q/21918012
type: Tag
tags question: http://stackoverflow.com/q/21954319
tags question: http://stackoverflow.com/q/21989687
tags question: http://stackoverflow.com/q/21885637
tags question: http://stackoverflow.com/q/21908964
tags question: http://stackoverflow.com/q/21975870
tags question: http://stackoverflow.com/q/21976939
tags question: http://stackoverflow.com/q/21873725
tags question: http://stackoverflow.com/q/21940399
tags question: http://stackoverflow.com/q/21995981
tag name: swt
tags question: http://stackoverflow.com/q/21853503
tags question: http://stackoverflow.com/q/21900696

http://stackoverflow.com/comment/33301727
type: QuestionComment
comment on: http://stackoverflow.com/q/21976405
has text: Should have been a little more specific. The this.alldata.add(i,d); is the line that is throwing the exception. It's line 109. I've tried with and with the "this." descriptor as well.
score: 0
type: Comment

http://stackoverflow.com/comment/33257852
type: QuestionComment
has text: No, it's not possible
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21952089

http://stackoverflow.com/q/21976093
tagged with: eofexception
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21976126
tagged with: java-io
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33302430
has answer: http://stackoverflow.com/a/21976126
has body: I am trying to read a csv file and having the output shown in the console. However, I can't understand why I am getting an end of file exception and nothing is being shown in the console? The Exception message is: java.io.EOFException at java.io.DataInputStream.readFully(DataInputStream.java:197) at java.io.DataInputStream.readUTF(DataInputStream.java:609) at java.io.DataInputStream.readUTF(DataInputStream.java:564) at ByteIO.main(ByteIO.java:17) My code is: import java.io.*; import javax.swing.*; public class ByteIO { public static void main(String[] args) { try { FileInputStream fis = new FileInputStream("BaseballNames1.csv"); BufferedInputStream bis = new BufferedInputStream(fis); DataInputStream dis = new DataInputStream(bis); while(dis.available() &gt; 0) { String header = (dis.readUTF()); String firstName = (dis.readUTF()); String lastName = (dis.readUTF()); String fullName = (firstName + " " + lastName); int birthDay = (dis.readInt()); int birthMonth = (dis.readInt()); int birthYear = (dis.readInt()); String birthDate = (birthMonth + "/" + birthDay + "/" + birthYear); int weight = (dis.readInt()); double height = (dis.readDouble()); System.out.println( header + fullName + birthDate + weight + height); dis.close(); } } catch(EOFException eof) { System.out.println("End of File!"); } catch(FileNotFoundException fe) { System.out.println("File not found!"); } catch(IOException ie) { ie.printStackTrace(); } } }
has comment: http://stackoverflow.com/comment/33301053
tagged with: datainputstream
possible better answer: http://stackoverflow.com/a/21976135
has title: Why am I getting an EOFException in my Java code?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21976135

http://stackoverflow.com/q/21845730
accepted answer: http://stackoverflow.com/a/21878865
has body: Is there a way to disable enhancement for play framework model classes? The reason why I'm asking this is because I want to serialize the model objects to JSON but as soon as json serializer touches any non initialized model, that model will be initialized causing an extra database hit and the resulting json will be bloated with unnecessary model objects. I tried excluding the models.* from the application.conf and using a ServerConfigStartup with this call serverConfig.addClass(Model.class) or that call serverConfig.addPackage("models") but neither of them worked for me.
possible better answer: http://stackoverflow.com/a/21846186
has answer: http://stackoverflow.com/a/21846186
type: AnsweredQuestion
tagged with: playframework-2.0
tagged with: java
has title: Disable enhancement for Play Framework model classes
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21878865
score: 0

http://stackoverflow.com/a/21964682
type: Answer
has body: define a class containing these two data. class Info{ int shares; double price; } then create an instance of this class with the data of your method parameter. then add this object intolinkedlist public static void addToDBLList(int shares, double price){ Info i = new Info; i.shares = shares; i.price = price; DoublyLinkedList list = new DoublyLinkedList(); list.addToFront(i); } also make sure that your DoublyLinkedList.addtoFront method can take the Info object as parameter.
has comment: http://stackoverflow.com/comment/33281027
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21964654

http://stackoverflow.com/comment/33117944
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21869294
has text: This is true however I am trying to override the String in the anonymous class. To access the parent String should I not use `super.string`?

http://stackoverflow.com/a/21873897
upvote count: 2
has body: The Answer could be dependent on kind of application you are making. Since you mentioned php I guess you want a web based application. For Web Based application I would prefer it to be used as JNDI data source . With JNDI you will not be storing any of your User Id , Password etc in your Codes.
answers question: http://stackoverflow.com/q/21873746
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/33069679
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21846811
has text: What OS? Windows? Linux? Something you invented?

http://stackoverflow.com/a/21895155
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21850722
has body: worked out what the issue was; I need to create a JpaRepository for the Purchase entity. Soon as I added that, the REST links for purchases are available.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21850722
downvote count: 0

http://stackoverflow.com/comment/33238720
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21941319
score: 1
has text: mark his answer as accepted, to help others see the solution

http://stackoverflow.com/q/22004321
type: Question
has comment: http://stackoverflow.com/comment/33351393
has comment: http://stackoverflow.com/comment/33351454
upvote count: 1
has comment: http://stackoverflow.com/comment/33351421
has answer: http://stackoverflow.com/a/22004409
has answer: http://stackoverflow.com/a/22004376
favorite count: 0
accepted answer: http://stackoverflow.com/a/22004376
has body: Background: The code is intended to use a recursive binary search algorithm to loop through an ArrayList of PhoneBookEntries with a name and a number. I think I'm getting infinite recursion with my search method here. I've copied in the code. I'm confused: from what I can tell, each time, the array should be divided in half and searched through again until the search term is found, but the method doesn't seem to be terminating correctly. Any tips? EDITS: I've changed the code as suggested by the comments below, but it still doesn't work? import java.util.ArrayList; public class BinarySearcher { private ArrayList&lt;PhoneBookEntry&gt; entries; public BinarySearcher(ArrayList&lt;PhoneBookEntry&gt; entries) { this.entries = entries; } public int search(String find, int low, int high){ int mid = (low + high) / 2; if(entries.get(mid).getName().compareTo(find) == 0){ return mid; } if(entries.get(mid).getName().compareTo(find) &lt; 0){ return search(find, mid+1, high); } else if(entries.get(mid).getName().compareTo(find) &gt; 0){ return search(find, low, mid-1); } return -1; } }
answer count: 3
score: -4
has comment: http://stackoverflow.com/comment/33351418
possible better answer: http://stackoverflow.com/a/22004409
type: AnsweredQuestion
tagged with: recursion
has title: How do I fix this StackOverflowError?
has answer: http://stackoverflow.com/a/22004425
tagged with: java
downvote count: 5
has comment: http://stackoverflow.com/comment/33351456

http://stackoverflow.com/q/21914282
answer count: 2
score: 5
tagged with: spring
upvote count: 5
tagged with: java
has title: ItemReader returning a FlatFileItemReader containing entire lines as strings
has answer: http://stackoverflow.com/a/21918282
downvote count: 0
has answer: http://stackoverflow.com/a/21984791
has body: Using Spring Batch I am trying to get every line of an input file as a String giving it to the ItemProcessor without any "CSV parsing" in the ItemReader. I came out with a configuration Java class (using @Configuration and @EnableBatchProcessing) containing the following reader() method which is making the next ItemProcessor to throw a ClassCastException though. This ItemReader should read an input file and pass to the ItemProcessor every line of the input file as a String. @Bean public ItemReader&lt;String&gt; reader() { FlatFileItemReader&lt;String&gt; reader = new FlatFileItemReader&lt;&gt;(); reader.setResource(new ClassPathResource("data-to-process.txt")); reader.setLineMapper(new DefaultLineMapper() {{ setLineTokenizer(new DelimitedLineTokenizer()); setFieldSetMapper(new PassThroughFieldSetMapper()); }}); return reader; } When running the previous code I am getting an exception in the ItemProcessor which is expecting a String from the reader(): java.lang.ClassCastException: org.springframework.batch.item.file.transform.DefaultFieldSet cannot be cast to java.lang.String The custom ItemProcessor I wrote is defined as: public class MyOwnCustomItemProcessor implements ItemProcessor&lt;String, MyOwnCustomBusinessBean&gt; { I believe I should use this PassThroughFieldSetMapper in the ItemReader and I would not like to use any kind of tokenizer. According to the documentation I think I must use it and I can not avoid it, but I am keeping getting exceptions thrown. How can I "transfer" every input line directly as a String to an ItemProcessor e.g. ?
tagged with: spring-batch
possible better answer: http://stackoverflow.com/a/21984791
type: AnsweredQuestion
favorite count: 0
tagged with: parsing
type: Question
accepted answer: http://stackoverflow.com/a/21918282

http://stackoverflow.com/comment/33211038
comment on: http://stackoverflow.com/q/21925685
has text: Did you check that you are getting that JSON in JSONObject jsonObj = jsonParser.getJSONFromURL(twitterURL); ?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/21920462
score: 0
accepted answer of: http://stackoverflow.com/q/21864762
type: Answer
answers question: http://stackoverflow.com/q/21864762
type: AcceptedAnswer
has body: It turns out that the issue was not in the Hibernate annotations. Instead, the issue resided in how I was accessing the collections in the annotated methods. As you can see in the question, the Collection setters clear the collection and then add any items in the new collection. The updated code (which works!) is shown here: @ManyToMany(targetEntity = AbstractEntity.class, fetch = FetchType.LAZY) @JoinTable(name = "conflict_affected_entity", joinColumns = { @JoinColumn(name = "conflict_id", referencedColumnName = "id") }, inverseJoinColumns = { @JoinColumn(name = "affected_entity_id", referencedColumnName = "id") }) public Set&lt;AbstractEntity&gt; getAffectedEntities() { Hibernate.initialize(affectedEntities); return affectedEntities; } public void setAffectedEntities(Set&lt;AbstractEntity&gt; affectedEntities) { this.affectedEntities = affectedEntities; } and @ManyToMany(targetEntity = Conflict.class, fetch = FetchType.LAZY) @JoinTable(name = "conflict_affected_entity", joinColumns = { @JoinColumn(name = "affected_entity_id", referencedColumnName = "id") }, inverseJoinColumns = { @JoinColumn(name = "conflict_id", referencedColumnName = "id") }) public Set&lt;Conflict&gt; getConflicts() { Hibernate.initialize(conflicts); return conflicts; } public void setConflicts(Set&lt;Conflict&gt; conflicts) { this.conflicts = conflicts; } For future viewers, this Hibernate configuration (mapping each side as a ManyToMany) creates two uni-directional associations: from Conflict -> AbstractEntities and from AbstractEntity -> Conflicts. This means that if you decide to use this configuration, you will have to be careful when adding or deleting items from the collections to make sure the joining table entries get updated to avoid foreign key constraint violations. For example, when deleting a Conflict, we can't just say ConflictDAO.getInstance.delete(toDelete). Instead, we have to make sure the Conflict doesn't retain any associations: for (AbstractEntity affectedEntity : toDelete…

http://stackoverflow.com/comment/33295220
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21972908
type: Comment
has text: @skiwi `flatMap` is one of those magic functions that can do all sorts of things but it's not always obvious how. Playing around with functional idioms will help give you a few ideas ;).

http://stackoverflow.com/a/27330541
has body: I faced the same exception using unirest: java.lang.NoSuchFieldError: INSTANCE at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.&lt;init&gt;(DefaultHttpRequestWriterFactory.java:52) at com.mashape.unirest.http.options.Options.refresh(Options.java:55) at com.mashape.unirest.http.options.Options.&lt;clinit&gt;(Options.java:36) And found it was due to DefaultConnectionKeepAliveStrategy.INSTANCE; and the conflicting jar was apache-httpcomponents-httpclient.jar in my classpath. Adding this post to help anyone who faces similar exception
answers question: http://stackoverflow.com/q/21864521
type: Answer
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/q/21975254
type: UnansweredQuestion
upvote count: 0
has body: The test in /home/nhamoinesu/NetBeansProjects/Dancerocket/src/test/java/com/dancerockit/video/YouTubeTests/TestVideo.java uses Video.java which is in /home/nhamoinesu/NetBeansProjects/Dancerocket/src/main/java/com/dancerockit/video/persistence/domain/Video.java The test is throwing the following error java: package com.dancerockit.video.persistence.domain does not exist Where should the tests live relative to the classes being tested in Inteliij?
tagged with: java
type: Question
has title: Junit testing in Intellij
tagged with: intellij-idea
score: -1
has comment: http://stackoverflow.com/comment/33299521
has answer: http://stackoverflow.com/a/21975297
answer count: 1
tagged with: junit
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/33252431
comment on: http://stackoverflow.com/a/21948916
score: 0
type: AnswerComment
type: Comment
has text: I think I need something like public `public Player(Player player) { this = player; }` I wonder.

http://stackoverflow.com/comment/33273507
type: AnswerComment
comment on: http://stackoverflow.com/a/21960448
type: Comment
has text: Try inserting some value first then check whether it is working with data or not if yes then just we need to pass if condition,
score: 0

w3c
type: Tag
tag name: w3c
tags question: http://stackoverflow.com/q/21971233

http://stackoverflow.com/a/21906400
has comment: http://stackoverflow.com/comment/33176534
has comment: http://stackoverflow.com/comment/33177578
type: Answer
upvote count: 3
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/21905377
has body: You are incorrectly starting up the driver webdriver.chrome.driver is supposed to be the path to the driver that you've downloaded and not Chrome's physical location.

http://stackoverflow.com/a/21974885
accepted answer of: http://stackoverflow.com/q/21974687
has comment: http://stackoverflow.com/comment/33336144
has body: You have a couple of options. Here are the two basic options: You can maintain a Map&lt;Object,Integer&gt; that holds indexes, in parallel to the array. When you append an element to the array you can just add it to the map. When you remove an element from the beginning you will have to iterate through the entire map and subtract one from every index. If it's appropriate for your situation and the Map does not meet your performance requirements, you could add an index field to your objects and store the index directly when you add it to the array. When you remove an element from the beginning you will have to iterate through all objects in the list and subtract one from their index. Then you can obtain the index in constant time given an object. These still have the performance hit of updating the indexes after a remove. Now, after you choose one of these options, you can avoid having to iterate through the map / list to update after removal if you make a simple improvement: Instead of storing the index of each object, store a count of the total number of objects added so far. Then to get the actual index, simply subtract the count value of the first object from the value of the one you are looking for. E.g. when you add: add a to end; a.counter = counter++; remove first object; (The initial value of counter when starting the program doesn't really matter.) Then to find an object "x": index = x.counter - first object.counter; Whether you store counter as a new field or in a map is up to you. Hope that helps. By the way; a linked list will have better performance when removing object from the front of the list, but worse when accessing an object by index. It may be more appropriate depending on your balance of add/remove vs. random access (if you only care about the index but never actually need to retrieve an object by index, random access performance doesn't matter). If you really need to optimize further you could consider using a fixed-capacity ring buffer instea…
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21974687
score: 4
has comment: http://stackoverflow.com/comment/105755553
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/105775413
has comment: http://stackoverflow.com/comment/33397525
has comment: http://stackoverflow.com/comment/33299193
downvote count: 0

http://stackoverflow.com/q/21997704
has comment: http://stackoverflow.com/comment/33339641
answer count: 2
has comment: http://stackoverflow.com/comment/33339617
has comment: http://stackoverflow.com/comment/33339728
has comment: http://stackoverflow.com/comment/33339665
has comment: http://stackoverflow.com/comment/33339793
has comment: http://stackoverflow.com/comment/33339823
score: 0
has comment: http://stackoverflow.com/comment/33339782
has comment: http://stackoverflow.com/comment/33340041
has comment: http://stackoverflow.com/comment/33339724
has comment: http://stackoverflow.com/comment/33340056
tagged with: string
possible better answer: http://stackoverflow.com/a/21998172
has comment: http://stackoverflow.com/comment/33339542
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/33339716
has comment: http://stackoverflow.com/comment/33339568
has comment: http://stackoverflow.com/comment/33339605
tagged with: zerofill
has title: Storing numeric input - Why does Java Scanner nextInt() allows "invalid" zero filled integers?
has comment: http://stackoverflow.com/comment/33340380
has body: I'm creating a phone directory which will consist of multiple nameEntry objects each containing a surname and a phone extension. public class nameEntry { public String surname; public String number; public nameEntry(String surname, int number) { this.surname = surname.toUpperCase(); this.number = String.format("%04d", number); // converts int literal to 0 filled string of numbers } public String toString() { return surname + "\t" + number; //eg HOOD 0123 } } Having read into good java practice about storing alphanumerics I have programmed the nameEntry objects to take an int as a parameter and then convert it to a zero filled String, because storing as int Objects would be inappropriate given their nature. However, this approach means that I cannot create new nameEntry objects with zero filled numbers by this method as it tells me the integers are invalid; nameEntry e = new nameEntry(surname, 0123); //this would be flagged as wrong However if I use a Scanner nextInt(System.in) method, is it perfectly happy with me entering a zero filled digit and then using that object to create a new nameEntry object. Why is this scenario valid? Regardless, this all seems over the top just to get a single zero filled input string - what is a better way of allowing a user to enter a single number of up to 4 characters that is either zero filled, or will be automatically zero filled after entry?
type: AnsweredQuestion
tagged with: alphanumeric
has comment: http://stackoverflow.com/comment/33339783
has answer: http://stackoverflow.com/a/21998068
accepted answer: http://stackoverflow.com/a/21998068
tagged with: java
has comment: http://stackoverflow.com/comment/33339634
has answer: http://stackoverflow.com/a/21998172
type: Question

http://stackoverflow.com/a/21894268
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21889718
score: 9
answers question: http://stackoverflow.com/q/21889718
type: AcceptedAnswer
has body: The FileDataSource only points to the directory, not the file. It looks like attachmentName is supposed to name the file within the directory named by attachmentPath. Try this instead: File att = new File(new File(attachmentPath), attachmentName); messageBodyPart.attachFile(att);
upvote count: 9
type: Answer

http://stackoverflow.com/q/21857528
has body: I have a String with a url like this: http://www.website.com/search?productId=1500 How do I get the value of productId with regular expression?
type: Question
has comment: http://stackoverflow.com/comment/33088776
possible better answer: http://stackoverflow.com/a/21857718
score: -1
has answer: http://stackoverflow.com/a/21857855
has title: Getting specific value from url query string using Regex in Java
answer count: 3
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/21857570
accepted answer: http://stackoverflow.com/a/21857855
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33088459
tagged with: java
downvote count: 3
linked to: http://stackoverflow.com/q/13592236
has answer: http://stackoverflow.com/a/21857718

http://stackoverflow.com/q/21965293
tagged with: multithreading
has body: I have an apllication where there are three folders. I am trying to implement the producer consumer concept using LinkedBlockingQueue. Folder 1: Contains a class which has a shared queue public static BlockingQueue sharedQueue = new LinkedBlockingQueue(); From a method in this class I try to call the Producer thread and the Consumer thread both of which reside in separate files. Thread updateThread = new Thread(new Producer(sharedQueue)); Thread takeThread = new Thread(new Consumer(sharedQueue)); updateThread.start(); takeThread.start(); Folder 2:Contains the producer thread class as follows: public class Producer implements Runnable { private final BlockingQueue Queue; public Producer(BlockingQueue sharedQueue){ Queue = sharedQueue; } public void run() { while (Thread.currentThread() != null) { Random random = new Random(); int pos = random.nextInt(productList.size()); String query = "insert into tab1 values("+pos+")"; Queue.put(query); } } Folder 3: Contains the consumer class as follows: public class Consumer implements Runnable{ private final BlockingQueue queue; Collection&lt;String&gt; joblist; public Consumer (BlockingQueue sharedQueue) { queue = sharedQueue; MonitoringForm.txtInforamtion.append("hi"+sharedQueue.size()); joblist = new ArrayList&lt;String&gt;(); } @Override public void run() { while(true){ try { for(int i = 0; i &lt; queue.size(); i++) { joblist.add(queue.take().toString()); MonitoringForm.txtInforamtion.append("What we got "+queue.take().toString()); } } catch (InterruptedException ex) { Logger.getLogger(Consumer.class.getName()).log(Level.SEVERE, null, ex); } try { Thread.sleep(60*1000); } catch (Exception e) { } } } } Can somebody tell me how to make sure that the data added to the shared queue by Producer class can be taken by Consumer class. The consumer consumes the data every minute. Not necessary that data is consumed as soon as it is produced. Calling the Consumer and Producer threads is not working as I have them in separate director…
downvote count: 1
has comment: http://stackoverflow.com/comment/33282200
type: Question
has comment: http://stackoverflow.com/comment/33282473
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/21965418
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/33282620
tagged with: producer-consumer
favorite count: 0
has answer: http://stackoverflow.com/a/21965354
has title: How to start a remote thread in java?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33285369
has comment: http://stackoverflow.com/comment/33287910
has answer: http://stackoverflow.com/a/21965357

http://stackoverflow.com/a/21912605
has comment: http://stackoverflow.com/comment/101333827
has comment: http://stackoverflow.com/comment/33188920
has comment: http://stackoverflow.com/comment/42504633
has comment: http://stackoverflow.com/comment/33232870
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21912314
has comment: http://stackoverflow.com/comment/33188438
answers question: http://stackoverflow.com/q/21912314
has comment: http://stackoverflow.com/comment/91869175
type: Answer
has comment: http://stackoverflow.com/comment/33233335
has comment: http://stackoverflow.com/comment/79756332
has comment: http://stackoverflow.com/comment/33188804
has comment: http://stackoverflow.com/comment/33221402
upvote count: 154
downvote count: 0
has comment: http://stackoverflow.com/comment/33227203
has comment: http://stackoverflow.com/comment/33188511
has body: So, what concrete type (subclass) of List is being used here? Are there any guarantees? If you look at the documentation of Collectors#toList(), it states that - "There are no guarantees on the type, mutability, serializability, or thread-safety of the List returned". If you want a particular implementation to be returned, you can use Collectors#toCollection(Supplier) instead. Supplier&lt;List&lt;Shape&gt;&gt; supplier = () -&gt; new LinkedList&lt;Shape&gt;(); List&lt;Shape&gt; blue = shapes.stream() .filter(s -&gt; s.getColor() == BLUE) .collect(Collectors.toCollection(supplier)); And from the lambda, you can return whatever implementation you want of List&lt;Shape&gt;. Update: Or, you can even use method reference: List&lt;Shape&gt; blue = shapes.stream() .filter(s -&gt; s.getColor() == BLUE) .collect(Collectors.toCollection(LinkedList::new));
has comment: http://stackoverflow.com/comment/91831684
has comment: http://stackoverflow.com/comment/33232576
has comment: http://stackoverflow.com/comment/79790948
has comment: http://stackoverflow.com/comment/125633802
has comment: http://stackoverflow.com/comment/33187745
has comment: http://stackoverflow.com/comment/82188548
has comment: http://stackoverflow.com/comment/81881147
has comment: http://stackoverflow.com/comment/82207937
score: 154

http://stackoverflow.com/q/21890588
has comment: http://stackoverflow.com/comment/33148891
has comment: http://stackoverflow.com/comment/33148617
has comment: http://stackoverflow.com/comment/33149263
has body: I am asked in an assignment in java course to sort multiple arrays according to the Average of the student 201302972, AhmadJouni, 82 , 85 , 89 , Average: 85.333336 201303123, Joe, 70 , 75 , 96 , Average: 80.333336 201401034, Mohamad, 90 , 54 , 49 , Average: 64.333336 201402100, Ali, 80 , 90 , 99 , Average: 89.666664 My arrays : int ID[] = new int [4]; int Grades[][]= new int [4][3]; String Name[] = new String[4]; I have to sort all of the above according to averages in increasing order Final output should look like 201401034, John, 90 , 54 , 49 , Average: 64.333336 201303123, Joe, 70 , 75 , 96 , Average: 80.333336 201302972, Mike, 82 , 85 , 89 , Average: 85.333336 201402100, Amy, 80 , 90 , 99 , Average: 89.666664 Note : The use of objects/constructors is not allowed , should be done in some simple way. This is the challenge Full code : http://textuploader.com/1he1
has comment: http://stackoverflow.com/comment/33149316
type: UnansweredQuestion
has title: sorting multiple arrays of different data types without using objects
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/21890635
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33149573
tagged with: arrays
has answer: http://stackoverflow.com/a/21890869
tagged with: sorting
score: 0

http://stackoverflow.com/comment/33198112
score: 0
comment on: http://stackoverflow.com/q/21918275
type: Comment
type: QuestionComment
has text: @John u are right! Errors disappeared

http://stackoverflow.com/q/21954131
has answer: http://stackoverflow.com/a/21954856
type: AnsweredQuestion
tagged with: ms-access-2010
has comment: http://stackoverflow.com/comment/33262303
score: 1
accepted answer: http://stackoverflow.com/a/21954856
tagged with: java
type: Question
tagged with: jdbc-odbc
linked to: http://stackoverflow.com/q/20008501
has body: I've been trying to connect to a MS Access 2007 database through JDBC (JDK is 64-bit under Windows 7 64-bit) and I receive the following error: java.sql.SQLException: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application. I upgraded Access to 2010, I used odbcad32.exe in Windows\SysWOW64 and downloaded/installed 32-bit Microsoft Access Database Engine 2010 Redistributable (couldn't install the 64-bit MS Access Database Engine 2010 because I currently have 32-bit Office products installed), but I get still the same error. What can I do to overcome this error?
has title: An "architecture mismatch between the Driver and Application" in JDBC with MS Access
tagged with: ms-access-2007
answer count: 1
downvote count: 0
favorite count: 0
tagged with: jdbc
upvote count: 1

http://stackoverflow.com/comment/33156501
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21893721
has text: If you remove the inputType line it should allow any text to be entered.
score: 0

http://stackoverflow.com/comment/33256260
comment on: http://stackoverflow.com/q/21951123
has text: http://stackoverflow.com/questions/407929/how-do-i-change-eclipse-to-use-spaces-instead-of-tabs
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33210269
type: AnswerComment
comment on: http://stackoverflow.com/a/21920375
score: 1
type: Comment
has text: Actually, both Date *and* Calendar are overcomplicated. Use Joda-Time or java.time.* in Java 8.

http://stackoverflow.com/a/21914076
has body: You haven't initialized people. person[] people = new person[5]; makes all pointing to null.
answers question: http://stackoverflow.com/q/21914050
score: 0
type: Answer

http://stackoverflow.com/comment/33120496
score: 1
comment on: http://stackoverflow.com/q/21869693
has text: @AndrewThompson as we all know, anti-aliasing is a story-without-happy-ending :-) For simple text rendering, it's best _not_ to fiddle with the rendering hints because it's too tricky to get it right for each OS/LAF/hardware. Actually, I even do it the other way round: whenever I need some text rendered, I use a JLabel and stamp it onto the graphics (vs. setting the hints and call text.drawText) So I'm wondering why the default rendering comes out so badly in your context?
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21875361
type: AcceptedAnswer
upvote count: 1
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21875238
answers question: http://stackoverflow.com/q/21875238
has body: Just use: Gson gson = new Gson(); User user = gson.fromJson(json, User.class); Or if you don't know the type: Gson gson = new Gson(); Object obj = gson.fromJson(json, Class.forName("User")); The error you're getting is to do with generics - the return type is being inferred from the type of the variable you're assigning the return value to. This inferred type is is then being used with the class parameter. public &lt;T&gt; T fromJson(String json, Class&lt;T&gt; classOfT) Changing the type of the variable the return value is assigned to an Object means the class parameter will be type Class&lt;?&gt; and the compiler is happy.
has comment: http://stackoverflow.com/comment/33120913

http://stackoverflow.com/q/21968077
has comment: http://stackoverflow.com/comment/33287479
tagged with: android
has comment: http://stackoverflow.com/comment/33287073
has comment: http://stackoverflow.com/comment/33286939
has title: Runtime Exception unable to start MainActivity
type: AnsweredQuestion
score: 2
tagged with: java
linked to: http://stackoverflow.com/q/21475489
possible better answer: http://stackoverflow.com/a/21968279
tagged with: eclipse
has answer: http://stackoverflow.com/a/21968262
linked to: http://stackoverflow.com/q/15997079
type: Question
has answer: http://stackoverflow.com/a/21968279
tagged with: runtime
has body: I'm trying to test my Android app on a new phone I've just purchased with Android 4.2. It runs every other app I test, and this particular app also works on other devices. When I try to run the code it's giving me the following errors: &gt; 02-23 12:15:08.532: E/AndroidRuntime(5431): FATAL EXCEPTION: main 02-23 12:15:08.532: E/AndroidRuntime(5431): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.antiquity/com.example.antiquity.MainActivity}: java.lang.NullPointerException 02-23 12:15:08.532: E/AndroidRuntime(5431): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2343) 02-23 12:15:08.532: E/AndroidRuntime(5431): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395) 02-23 12:15:08.532: E/AndroidRuntime(5431): at android.app.ActivityThread.access$600(ActivityThread.java:162) 02-23 12:15:08.532: E/AndroidRuntime(5431): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364) 02-23 12:15:08.532: E/AndroidRuntime(5431): at android.os.Handler.dispatchMessage(Handler.java:107) 02-23 12:15:08.532: E/AndroidRuntime(5431): at android.os.Looper.loop(Looper.java:194) 02-23 12:15:08.532: E/AndroidRuntime(5431): at android.app.ActivityThread.main(ActivityThread.java:5371) 02-23 12:15:08.532: E/AndroidRuntime(5431): at java.lang.reflect.Method.invokeNative(Native Method) 02-23 12:15:08.532: E/AndroidRuntime(5431): at java.lang.reflect.Method.invoke(Method.java:525) 02-23 12:15:08.532: E/AndroidRuntime(5431): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 02-23 12:15:08.532: E/AndroidRuntime(5431): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 02-23 12:15:08.532: E/AndroidRuntime(5431): at dalvik.system.NativeStart.main(Native Method) 02-23 12:15:08.532: E/AndroidRuntime(5431): Caused by: java.lang.NullPointerException 02-23 12:15:08.532: E/AndroidRuntime(5431): at com.example.antiquity.MainActivity.setUpLocation(MainActivity.java:127) 02…
has comment: http://stackoverflow.com/comment/33287031
answer count: 3
has answer: http://stackoverflow.com/a/21968188
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21968188
upvote count: 2
tagged with: exception

http://stackoverflow.com/q/21848475
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/21848906
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33073118
accepted answer: http://stackoverflow.com/a/21848906
upvote count: 1
has comment: http://stackoverflow.com/comment/33072738
type: Question
has answer: http://stackoverflow.com/a/21849011
has comment: http://stackoverflow.com/comment/33073096
score: 1
tagged with: java
has title: setOnFocusChangeListener change backgroundcolor
possible better answer: http://stackoverflow.com/a/21849011
answer count: 2
downvote count: 0
has body: I'm trying to make it so when the user focuses on a text view the background changes colour and then when it looses focus the textview looses the focus colour. Can you please help? TextView tv1=new TextView(this); tv1.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if(hasFocus){ v.setBackgroundColor(Color.RED); }else{ v.setBackgroundColor(Color.TRANSPARENT); } } });

http://stackoverflow.com/a/36760212
answers question: http://stackoverflow.com/q/21858528
has body: Object myJsonObj = bundleObject.get("yourKey"); JsonParser parser = new JsonParser(); JsonObject json = parser.parse(myJsonObj.toString()).getAsJsonObject(); json.get("memberInJson").getAsString();
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/61099366
score: 0

http://stackoverflow.com/q/21934734
has answer: http://stackoverflow.com/a/21934766
type: Question
has title: i have three checkbox as three columns in a row all are get selected but i want to select one from the row. If one is select other to are unselect
score: 0
has comment: http://stackoverflow.com/comment/33226238
answer count: 1
has comment: http://stackoverflow.com/comment/33226258
type: UnansweredQuestion
tagged with: swing
has body: i have three checkbox as three columns in a row all are get selected but i want to select one from the row. If one is select other two are unselect.... import java.awt.*; import java.awt.event.ActionEvent; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import javax.swing.*; import javax.swing.table.DefaultTableModel; public class CheckABunch extends JPanel { private static final int CHECK_COL = 2; @SuppressWarnings("unused") private static Object[][] DATA = new Object[1][1]; private static final String[] COLUMNS = {"Number", "Present","Absent","Chk"}; private DataModel dataModel ; private JTable table; private DefaultListSelectionModel selectionModel; @SuppressWarnings("unused") private static Integer cntrow = 0; private static JCheckBox jc1,jc2,jc3; public CheckABunch() { super(new BorderLayout()); //accessing data from database final String driver = "com.mysql.jdbc.Driver"; final String connection ="jdbc:mysql://localhost/search"; final String user = "root"; final String password = "root"; Connection con; Statement st; ResultSet rs; try { Class.forName(driver); con = DriverManager.getConnection(connection, user, password); st = con.createStatement(); rs = st.executeQuery("Select count(*) from test;"); Object[][] DATA = new Object[1][1]; if(rs.first()){ DATA = new Object[rs.getInt(1)][COLUMNS.length]; cntrow = rs.getInt(1); } rs = st.executeQuery("Select * from test;"); int i = 0; while (rs.next()) { DATA[i][0] = rs.getString(2); DATA[i][1] = new Boolean(false); DATA[i][2] = new Boolean(false); DATA[i][3] = new Boolean(false); ++i; } dataModel = new DataModel(DATA, COLUMNS); table = new JTable(dataModel); /* * for (int j = 0; j &lt; columns.length; j++) { System.out.println(columns[j]); } */ this.add(new JScrollPane(table)); this.add(new ControlPanel(), BorderLayout.PAGE_END); table.setPreferredScrollableViewportSize(new Dimension(250, 175)); selectionModel = (DefaultListSelectionModel) table.getSele…
tagged with: java

http://stackoverflow.com/q/21878091
accepted answer: http://stackoverflow.com/a/21878160
answer count: 5
tagged with: android
has answer: http://stackoverflow.com/a/21878193
has title: Notifications Builder in android 2.3
has comment: http://stackoverflow.com/comment/33125608
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21878196
has body: Pretty new in android here :) I have a notification builder which works with no problem if the application target version is > 4.0 However when I switch to 2.3 I get an error on this line which says "Notificaiton.Builder cannot be resolved to a type". Notification notification = new Notification.Builder(this) .setSmallIcon(drawable_small) .setLargeIcon(drawable_big) .setWhen(System.currentTimeMillis()).setTicker(content_title) .setContentTitle(content_title).setContentInfo(content_info) .setContentText(content_text).setContentIntent(pIntent) .getNotification(); This problem is now solved! However I`m having another one now It gives me an error on every R (resource) and I have the option to Import R. If I import it,its giving me errors on every resource. setContentView(R.layout.activity_main);
has comment: http://stackoverflow.com/comment/33125715
tagged with: notifications
possible better answer: http://stackoverflow.com/a/21878238
has answer: http://stackoverflow.com/a/21878160
downvote count: 0
has answer: http://stackoverflow.com/a/21878238
favorite count: 0
has answer: http://stackoverflow.com/a/21878266

http://stackoverflow.com/comment/33251543
type: QuestionComment
comment on: http://stackoverflow.com/q/21948462
has text: Hmmm, access to the code is always a helpful tool when debugging, I find. Call me pampered.
score: 0
type: Comment

http://stackoverflow.com/a/21879476
has comment: http://stackoverflow.com/comment/65007709
has comment: http://stackoverflow.com/comment/54102920
accepted answer of: http://stackoverflow.com/q/21878714
type: AcceptedAnswer
has body: Make sure you have imported the correct package. If I remeber correctly there are two different packages for Autowiring. Should be :org.springframework.beans.factory.annotation.Autowired; Also this looks wierd to me : @ContextConfiguration("classpath*:conf/components.xml") Here is an example that works fine for me : @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "/applicationContext_mock.xml" }) public class OwnerIntegrationTest { @Autowired OwnerService ownerService; @Before public void setup() { ownerService.cleanList(); } @Test public void testOwners() { Owner owner = new Owner("Bengt", "Karlsson", "Ankavägen 3"); owner = ownerService.createOwner(owner); assertEquals("Check firstName : ", "Bengt", owner.getFirstName()); assertTrue("Check that Id exist: ", owner.getId() &gt; 0); owner.setLastName("Larsson"); ownerService.updateOwner(owner); owner = ownerService.getOwner(owner.getId()); assertEquals("Name is changed", "Larsson", owner.getLastName()); }
downvote count: 1
answers question: http://stackoverflow.com/q/21878714
has comment: http://stackoverflow.com/comment/33128215
upvote count: 26
type: Answer
score: 25
has comment: http://stackoverflow.com/comment/99490166

http://stackoverflow.com/a/21993090
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33331720
has body: What is synchronized(getClass()) supposed to do? It gets a lock on the Class object returned by getClass(). However, you should never use that, as already being instructed. The issue is, that synchronized block might lock on a different Class objects, based on which subclass object the method is being invoked. As getClass() returns the runtime type of the object. Due to that, two different threads, which are not supposed to execute that block at the same time, will eventually end up doing that, as the lock is not the same. That may cause serious bug in you application. I was instructed to change that to synchronized(AbstractServiceProcessor.class). What is that going to do? Why was I instructed to change to this? I've already explained why you're instructed to do this change. Now, synchronizing on AbstractServiceProcessor.class ensures that you always lock on the same Class object, no matter on which subclass object you are invoking the method.
type: Answer
has comment: http://stackoverflow.com/comment/33484970
accepted answer of: http://stackoverflow.com/q/21992951
has comment: http://stackoverflow.com/comment/33497863
upvote count: 3
answers question: http://stackoverflow.com/q/21992951
has comment: http://stackoverflow.com/comment/33331941
score: 3

http://stackoverflow.com/comment/33107319
comment on: http://stackoverflow.com/q/21867404
score: 0
type: Comment
type: QuestionComment
has text: Are you trying to upload FROM the Android App to AppEngine or are you trying to Upload from the Android App to Your server which in turn uploads the file to AppEngine? Please clarify.

http://stackoverflow.com/a/21923580
answers question: http://stackoverflow.com/q/21923361
type: Answer
has body: You could use indexOf() and lastIndexOf() : int first = str.indexOf("."); if ( (first &gt;= 0) &amp;&amp; (first - str.lastIndexOf(".")) == 0) { // only one decimal point } else { // no decimal point or more than one decimal point }
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/q/21872040
accepted answer: http://stackoverflow.com/a/21872283
tagged with: mysql
tagged with: date
downvote count: 0
has answer: http://stackoverflow.com/a/21872283
favorite count: 0
possible better answer: http://stackoverflow.com/a/21872089
upvote count: 8
answer count: 3
tagged with: sql
tagged with: jdbc
score: 8
has answer: http://stackoverflow.com/a/21872090
has body: I would like to know how to set Date values to MySQL database, using Java JDBC. Following is my code. String lastCrawlDate = "2014-01-28" PreparedStatement p = con.prepareStatement("insert into JsonData (last_crawl_date) values(?))"); p.setDate(1, Date.valueOf(lastCrawlDate)); As you can see, the lastCrawlDate is a String and in the format of yyyy/mm/dd. Following is how my table looks like and how the Date field is defined. How can I do this?
has title: JDBC: Inserting Date values into MySQL
has comment: http://stackoverflow.com/comment/33115161
type: Question
has answer: http://stackoverflow.com/a/21872089
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/21899174
downvote count: 0
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/33164206
answers question: http://stackoverflow.com/q/21898843
has body: They don't have to match because each stream stands on its own (despite being associated with the same Socket instance). The Java API wouldn't be very sane if handling a stream one way caused side-effects that required you handle a second, completely independent stream in a certain way. Nothing prevents you from using a comparable approach to handle both your input and your output streams. But nothing requires it, either. In general you should think more about the behavior that you want (and about what makes sense for whatever communication protocol you are implementing) than about whether or not the "same" classes are being used to manage input and output. For instance, you use a BufferedReader if you want to read text data line by line. It would not be appropriate to use this class if you are reading binary data in which newline characters have no special significance. And similarly, if you want to output text data, it's reasonable to use a BufferedWriter to do so. But you wouldn't generally do that if you need to output binary data. So really it depends upon what best suits your needs/use-case. Sometimes your input and output requirement will be the same. And sometimes not. The developer's job is to understand the requirements, and use the most appropriate tools to solve the problem.
has comment: http://stackoverflow.com/comment/33164361

http://stackoverflow.com/q/21999565
has comment: http://stackoverflow.com/comment/33346891
tagged with: transparency
has comment: http://stackoverflow.com/comment/33343956
type: UnansweredQuestion
has title: Java blur translucent background
answer count: 0
tagged with: java
has body: How can I blur the background of my translucent JFrame? The background of my JFrame is a label which has an image as its icon. I make the picture transparent, but now I want to make it blurred (almost like the blur at the top of windows frames). float[] matrix = { 0.111f, 0.111f, 0.111f, 0.111f, 0.111f, 0.111f, 0.111f, 0.111f, 0.111f, }; BufferedImageOp op = new ConvolveOp( new Kernel(3, 3, matrix) ); blurredImage = op.filter(sourceImage, destImage); I was thinking this might work, but I want to blur my image temporarily (as long as the JFrame is open). What can I do? I've tried researching this and can't find anything that suits me. Keep in mind I'm quite new to JFrames.
type: Question
tagged with: blur
score: 0

http://stackoverflow.com/comment/33078200
type: QuestionComment
comment on: http://stackoverflow.com/q/21851855
score: 0
has text: Please post your command line running the `java` utility
type: Comment

http://stackoverflow.com/a/21961769
has comment: http://stackoverflow.com/comment/33276223
has comment: http://stackoverflow.com/comment/33275867
answers question: http://stackoverflow.com/q/21961725
has comment: http://stackoverflow.com/comment/33276282
has comment: http://stackoverflow.com/comment/33275679
has body: but when I move it over to my HomeFragment the errors show. You need to make sure that you are using the onCreateoptionsMenu() signature that corresponds to the Fragment class. You can delete this method in the Fragment, then start typing its name and then use your IDEs autocomplete functionality to use the correct method signature.
upvote count: 2
has comment: http://stackoverflow.com/comment/33276024
downvote count: 1
has comment: http://stackoverflow.com/comment/33276174
has comment: http://stackoverflow.com/comment/33276322
has comment: http://stackoverflow.com/comment/33275705
type: Answer
has comment: http://stackoverflow.com/comment/33276161
score: 1

http://stackoverflow.com/q/21866192
has comment: http://stackoverflow.com/comment/33104889
possible better answer: http://stackoverflow.com/a/21866248
has title: Java Comparable Contract
has answer: http://stackoverflow.com/a/21866248
accepted answer: http://stackoverflow.com/a/21866266
score: 0
has comment: http://stackoverflow.com/comment/33104940
type: AnsweredQuestion
has body: Must I always adhere to the contract established for Comparable Interface? Is there acceptable leverage when all three cases of the contract are unclear? The contract simply states: If this object precedes that; return negative value If this object equals that; return zero If this object proceeds that; return positive value I desire to compare two points which are Point2D objects. Comparing two points using the distance(Point2D point) behavior makes a compareTo() appear binary; Either two points have a zero distance or their distance is nonzero. If I were to write such a compareTo() behavior that overrides the default, perhaps it would be as follows: private Point2D location; public int compareTo(Object o) { if(this.getLocation().distance(o.getLocation() == 0) { return 0; } else { return 1; } } Perhaps comparing two Point2D objects would be better suited using simple behavior testing distance and not bother implementing Comparable. There may even be a way to adhere to the contract I do not know.
tagged with: contract
tagged with: java
tagged with: comparable
type: Question
has answer: http://stackoverflow.com/a/21866266
answer count: 2
has comment: http://stackoverflow.com/comment/33105035
has comment: http://stackoverflow.com/comment/33104869

http://stackoverflow.com/comment/33123533
has text: if so then how can it move the whole table correctly under the proper column names... I dont think so this would be the problem. :-(
comment on: http://stackoverflow.com/a/21876838
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21868956
linked to: http://stackoverflow.com/q/21866382
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
has title: How to obtain the actual packet size `byte[]` array in Java UDP
has answer: http://stackoverflow.com/a/21869243
has body: This is the subsequent question of my previous one: Java UDP send - receive packet one by one As I indicated there, basically, I want to receive a packet one by one as it is via UDP. Here's an example code: ds = new DatagramSocket(localPort); byte[] buffer1 = new byte[1024]; DatagramPacket packet = new DatagramPacket(buffer1, buffer1.length); ds.receive(packet); Log.d("UDP-receiver", packet.getLength() + " bytes of the actual packet received"); Here, the actual packet size is say, 300bytes, but the buffer1 is allocated as 1024 byte, and to me, it's something wrong with to deal with buffer1. How to obtain the actual packet size byte[] array from here? and, more fundamentally, why do we need to preallocate the buffer size to receive UDP packet in Java like this? ( node.js doesn't do this ) Is there any way not to pre-allocate the buffer size and directly receive the UDP packet as it is? Thanks for your thought.
score: 14
downvote count: 0
has answer: http://stackoverflow.com/a/21869101
type: Question
tagged with: network-programming
tagged with: java
upvote count: 14
tagged with: udp
answer count: 2

http://stackoverflow.com/comment/33163761
has text: Your code as is doesn't even compile... you know, if you can compile it your can run it and see if it does what you want.
comment on: http://stackoverflow.com/q/21898958
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21949874
upvote count: 1
possible better answer: http://stackoverflow.com/a/21949922
has comment: http://stackoverflow.com/comment/33254276
type: Question
has answer: http://stackoverflow.com/a/21949922
has comment: http://stackoverflow.com/comment/33254155
has answer: http://stackoverflow.com/a/21949969
has comment: http://stackoverflow.com/comment/33254182
answer count: 3
accepted answer: http://stackoverflow.com/a/21949969
tagged with: arrays
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/33254136
favorite count: 0
has title: How to evaluate string as array in Java?
tagged with: multidimensional-array
has body: I have a String like this: [["123","Albert","foo"],["456","Mark","bar"],["789","Jackson","baz"]] How can I do to turn it into a corresponding array? I get this response from a HttpPost in Java (Android). Thanks in advance
tagged with: android
has comment: http://stackoverflow.com/comment/33254230
has answer: http://stackoverflow.com/a/21949991
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/21900134
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33166436
accepted answer: http://stackoverflow.com/a/21900258
has comment: http://stackoverflow.com/comment/33165892
has title: Date chooser not showing date after conversion
upvote count: 1
has body: After Conversion of date ,the date chooser not displaying date,plz following code. This code giving error.But i tried with setDateFormatString() , but this also not displaying date. String date1 = rs.getString("date"); java.util.Date date2 = new SimpleDateFormat("yyyy-MM-dd").parse(date1); String date = new SimpleDateFormat("dd-MM-yyyy").format(date2); jDateChooser1.setDate(date);
type: Question
score: 1
tagged with: simpledateformat
tagged with: java
downvote count: 0
answer count: 1
tagged with: netbeans-7
has answer: http://stackoverflow.com/a/21900258
favorite count: 0

http://stackoverflow.com/comment/33387164
comment on: http://stackoverflow.com/q/21968851
type: QuestionComment
type: Comment
has text: The above part of the code is from Main Class. Here i am just checking that weather elemnts are added in array list of not Error was Exception in thread "main" java.lang.NullPointerException. The error came at this line: System.out.println(ChromosomeClust1.get(2).getRows());
score: 0

http://stackoverflow.com/a/21895133
has body: Because you are adding it twice! Your If statement is attempting to add it to values, then if it succeeds, you are adding it again. Try something like this: int i = 0; for ( i = 0; i &lt; inputToStringArray.length; i++) { try { values.add(Double.parseDouble(inputToStringArray[i])); } catch (NumberFormatException e) { // not a number! e.printStackTrace(); } }
answers question: http://stackoverflow.com/q/21895084
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/21858370
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21860553
type: Question
tagged with: jasper-reports
has body: The JasperReports library defines a set of optional dependencies (POI, Xalan, Ant, Jackson, ...) I could not find anything in the documentation that clearly indicates when to add which dependency (one or more JAR files). I am searching for a document that would indicates which dependency is related to which features. Does such a documents exists ?
has answer: http://stackoverflow.com/a/21860553
upvote count: 1
has comment: http://stackoverflow.com/comment/33115058
answer count: 1
downvote count: 0
favorite count: 0
has title: JasperReports optional dependencies
has comment: http://stackoverflow.com/comment/92798360
type: AnsweredQuestion

http://stackoverflow.com/q/21896290
has answer: http://stackoverflow.com/a/21896343
has answer: http://stackoverflow.com/a/21896391
has answer: http://stackoverflow.com/a/21896679
accepted answer: http://stackoverflow.com/a/21896477
has answer: http://stackoverflow.com/a/21897756
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33159866
answer count: 5
has body: So I have a chess game. I'm trying to implement a method where the user can undo their last move. I created the appropriate action listener for the menu option. The action listener sets the game's undo boolean to true. pseudocode for my game loop: while (!game end) { if (undo) { undo the last move continue; } prompt user to input next move user inputs move into console model, view are updated } This logic doesn't work. The only time the game loop will handle undo is after a user has inputted their next move. So.. basically it just undoes the move they just put in. I need it to be so that any time a user clicks undo move on the GUI, the game loop does the stuff in the if statement. I have a feeling there is a smarter way to handle this.
linked to: http://stackoverflow.com/q/21142686
upvote count: 1
tagged with: swing
linked to: http://stackoverflow.com/q/19209650
tagged with: model-view-controller
has answer: http://stackoverflow.com/a/21896477
type: AnsweredQuestion
score: 1
tagged with: java
has title: "Undo move" in game loop
type: Question
possible better answer: http://stackoverflow.com/a/21896343

http://stackoverflow.com/a/21931073
answers question: http://stackoverflow.com/q/21930921
has comment: http://stackoverflow.com/comment/33220149
accepted answer of: http://stackoverflow.com/q/21930921
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: try this query DELETE FROM TABLE_NAME WHERE DATE_ADD(INSERT_TIME, INTERVAL EXPECTED_TIME MINUTE) &gt; NOW()
has comment: http://stackoverflow.com/comment/33220855
score: 1
upvote count: 1

http://stackoverflow.com/comment/33266372
comment on: http://stackoverflow.com/a/21938723
score: 0
has text: Ok, but the constructor of the class "B" as I create it? I have to pass it as a parameter to the instance of the class "A"?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33099307
type: QuestionComment
has text: What do you expect it to print? And why?
type: Comment
score: 2
comment on: http://stackoverflow.com/q/21863380

http://stackoverflow.com/comment/33071575
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21847844
has text: There are about 15.000 files with avarage 100K fileszie.
score: 0

http://stackoverflow.com/a/61726257
score: 0
type: Answer
has body: my case is installed the javafx sdk to C:\Program Files\Java\openjfx-11.0.2_windows-x64_bin-sdk. And root cause is the the space contained in the sdk path name. Fixed by install the javafx sdk to folder which name without space, such as C:\javafx-sdk-11.0.2\lib
answers question: http://stackoverflow.com/q/22000423

http://stackoverflow.com/a/21895380
has body: The problem is that Angular is by default trying to use CORS as this is an ajax request attempt from one page loaded from one server to a REST service running in another server. The way it tries to use CORS is by issuing the GET with a default header that triggers the browser to do a 'pre-flight' OPTIONSrequest. This pre-flight automatic OPTIONS request is for the browser to get the list of supported methods by the server, and this is the first step of CORS. So the 404 comes from this OPTIONS request. See this issue in Angular, it seems that this was fixed in more recent versions as it was causing a lot of questions from users. See also the original issue that triggered the fix. In you case for local development you can always deploy both applications in the same server and the problem is solved. If in production it's necessary to run frontend/backend on separate servers, then either proxy those servers by a common frontend server like nginx/Apache or or turn on CORS, see enable-cors.org.
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21886746
score: 1
answers question: http://stackoverflow.com/q/21886746
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33204197
has comment: http://stackoverflow.com/comment/33164496

http://stackoverflow.com/a/21872634
has body: method onDestroy() won't be called every time, but you can do like this: public void onPause() { super.onPause() if (isFinishing()) { //call some method } }
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33164591
has comment: http://stackoverflow.com/comment/33116170
upvote count: 2
has comment: http://stackoverflow.com/comment/33138289
type: Answer
answers question: http://stackoverflow.com/q/21872024
has comment: http://stackoverflow.com/comment/33118439

http://stackoverflow.com/comment/33339332
has text: "Separating my code from what exactly happens in response to a given event" *is* what I want. I want the event to say "get ready for something to happen" - I don't care how or what subscribers have to do to get ready. They might not have to do anything. I just want to be confident that after posting the event, the subscribers are ready so I can proceed with some action. The event bus seems perfect for this case because I can easily add and remove components that might handle the event differently. The code posting the event doesn't care.
type: Comment
comment on: http://stackoverflow.com/a/21995894
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33309435
has text: Print the stack trace using only e,change e.getMessage() to e
type: Comment
comment on: http://stackoverflow.com/q/21980881
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33324513
comment on: http://stackoverflow.com/a/21987593
has text: can I reset expiration timeout from removal listener and restore entity? If yes, how?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33315545
has text: have you tried something?
comment on: http://stackoverflow.com/q/21984578
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/21979228
score: 0
has comment: http://stackoverflow.com/comment/33307170
tagged with: junit
has comment: http://stackoverflow.com/comment/33307592
type: UnansweredQuestion
has body: when you write integrated test, it seems you cannot run unit test with real data that produced in integrated tests. for example, you have written a unit test: class SomeClassTest{ @Test somemothedTest (){ push test data //the data is build in run target method of target class } } so, you have to refactor your unit test to accept test data from outside of this unit test case. is it right? in a junit book, the author wirte: .... Once you have the tests for a class up and running, the next step is to hook up the class with other methods and services. .... is this mean, we should refactor our unit test to make it can work togethor to form a large test and can be called by integrited test?
answer count: 0
tagged with: java
has title: How could unit test be used in integrated test/functional test to locate the bug?
has comment: http://stackoverflow.com/comment/33308687
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/33306911
tagged with: testing
has comment: http://stackoverflow.com/comment/33307326

http://stackoverflow.com/comment/33085531
type: Comment
comment on: http://stackoverflow.com/a/21855843
score: 0
type: AnswerComment
has text: exclude(no becasue i need to map all thoose objects to second object) move dozer(thats some solution, but i would prefer try smth else) re-attach in what way ?

http://stackoverflow.com/a/21884362
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21869416
has comment: http://stackoverflow.com/comment/33161315
has body: I'm not 100% sure, but it looks like the problem is you are trying to Autowire DataSource, which has not actually been defined as a Spring bean: &lt;jee:jndi-lookup id="dataSource" jndi-name="jdbc/TyedArtDB"/&gt; Creates an object that can be referenced in XML, but don't think it actually creates a bean? (could be wrong, don't really do much with JNDI lookups in spring). Is it possible to switch over to pure java config and drop the XML references? @Bean public DataSource dataSource() throws Exception { Context ctx = new InitialContext(); return (DataSource) ctx.lookup("jdbc/TyedArtDB"); } (taken from this answer: https://stackoverflow.com/a/15440797/258813) And you can move the password encoder like this: @Bean public BCryptPasswordEncoder bCryptPasswordEncoder(){ return new BCryptPasswordEncoder(); } taken from: http://automateddeveloper.blogspot.co.uk/2014/02/spring-4-xml-to-annotation-configuration.html

http://stackoverflow.com/a/21979370
has body: This method will print the elements in your one-dimensional array as close as possible to a square pattern on the console output. It places tabs in between elements to line them up on each row. private void printMyArray(String[] onDimensionalArray) { int cols = (int) Math.floor(Math.sqrt(onDimensionalArray.length)); int currentCol = 0; for(String element : onDimensionalArray) { System.out.print(element + "\t"); if(currentCol &gt;= cols) { System.out.println(""); currentCol = 0; } else { currentCol++; } } }
answers question: http://stackoverflow.com/q/21979106
score: 0
type: Answer

http://stackoverflow.com/q/21898072
has title: Execute sudo command in ubuntu from java class
type: Question
tagged with: java
tagged with: ubuntu
score: 0
has answer: http://stackoverflow.com/a/21898134
answer count: 1
has body: I have a sh file which conatins a many sudo commands, say a script as below: test.sh #!/bin/sh sudo apt-get install gedit sudo date --set="2014/02/20 10:00" When I execute the test.sh from terminal it works fine. Problem is when I try to execute this file from a java class. The script doesn't execute. I tried this: Process proc = Runtime.getRuntime().exec("/bin/sh","/home/priyatam/test.sh"); Does anyone have an idea to execute this sudo command from java class? Please share.
tagged with: terminal
tagged with: linux
accepted answer: http://stackoverflow.com/a/21898134
tagged with: sudo
type: AnsweredQuestion

http://stackoverflow.com/comment/33248901
type: Comment
type: QuestionComment
has text: why you don't post a snippet of code of your problem !
score: 0
comment on: http://stackoverflow.com/q/21946855

http://stackoverflow.com/comment/33269424
has text: Sorry, I have no idea, your logcat is clear: java.lang.ClassCastException: android.app.Application cannot be cast to com.example.smartnav.Globals. It means you have not properly implemented `android.app.Application` class or you have some error in your manifest. Check if in `<manifest` element you have `package="com.example.smartnav"`
score: 1
comment on: http://stackoverflow.com/a/21956766
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33159832
comment on: http://stackoverflow.com/q/21896672
type: Comment
type: QuestionComment
has text: learn the difference between System.out.println and System.out.print
score: 0

http://stackoverflow.com/q/21887824
linked to: http://stackoverflow.com/q/21675487
has answer: http://stackoverflow.com/a/21887870
duplicate of: http://stackoverflow.com/q/21675487
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/21887870
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: methods
has body: when I put an array inside my method public int[] insertionSort(final int array[]) I do not change the array[] public int[] insertionSort(final int array[]) { int[] array_for_sorting = array; final int[]TempArray = array; int n = array_for_sorting.length; // printNumbers(TempArray); for (int j = 1; j &lt; n; j++) { int key = array_for_sorting[j]; int i = j-1; while ( (i &gt; -1) &amp;&amp; ( array_for_sorting [i] &gt; key ) ) { array_for_sorting [i+1] = array_for_sorting [i]; i--; } array_for_sorting[i+1] = key; // printNumbers(array_for_sortying); } //array = TempArray; printNumbers(TempArray);// for printing return array_for_sorting; } also, why my TempArray change after the for loop ?
answer count: 2
tagged with: arrays
downvote count: 0
tagged with: sorting
favorite count: 0
possible better answer: http://stackoverflow.com/a/21888034
has answer: http://stackoverflow.com/a/21888034
has title: I do not want to change the array inside the method

http://stackoverflow.com/comment/33177900
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21906093
type: Comment
has text: when do i allocate before wrapping or after ?

http://stackoverflow.com/q/21957520
has body: At first: I know there were some similar topics and I wrote some code according to them (as seeing below). I'm new in Facebook api so I'm a little bit lost :D Anyway, my app has to get all wall posts and comments but I'm not able to get it all. Could anyone help me please? Here are my methods: public static void getFacebookPosts(String url){ try{ LoggedFacebookClient client = new LoggedFacebookClient(); Page page = client.fetchObject(url, Page.class); System.out.println(page.getName()); Connection&lt;Post&gt; pageFeed = client.fetchConnection(page.getId() + "/feed", Post.class); //Getting posts: for (List&lt;Post&gt; feed : pageFeed){ for (Post post : feed){ //PRINTING THE POST getAllPostComments(post.getId(), client); } } }catch(com.restfb.exception.FacebookOAuthException ex){ System.out.println("\n!!!!!!! Token Expired !!!!!!!!\n"); } } private static void getAllPostComments(String postId, DefaultFacebookClient client){ int currentCount = 0; JsonObject jsonObject = client.fetchObject(postId + "/comments", JsonObject.class, Parameter.with("summary", true), Parameter.with("limit", 1)); long commentsTotalCount = jsonObject.getJsonObject("summary").getLong("total_count"); System.out.println("\nComments:"); boolean pom = true; while(pom == true){ //There should be "while(currentCount &lt; commentsTotalCount)" but currentCount is always &lt; then commentsTotalCount. That's the problem :) pom = false; Connection&lt;Comment&gt; comments = client.fetchConnection(postId + "/comments", Comment.class, Parameter.with("limit", 50000), Parameter.with("offset", currentCount)); for(Comment komentar : comments.getData()){ pom = true; currentCount++; stazenychKomentu++; String mess = komentar.getMessage().replaceAll("\n", " ").replaceAll("\r", " "); System.out.println(" [" + currentCount + "]: " + komentar.getFrom().getName() + " ## " + mess); } } celkemKomentu += commentsTotalCount; System.out.println(currentCount + " / " + commentsTotalCount); } and here is the way I get the acces…
score: 1
tagged with: java
tagged with: comments
upvote count: 1
tagged with: restfb
type: Question
tagged with: posts
has answer: http://stackoverflow.com/a/29558448
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: facebook
has title: Getting all wall posts and comments using RestFB

http://stackoverflow.com/a/22001406
has body: You should specify a layout manager for your rightPanel variable, if it hasn't any. Absence of a layout manager may give you unexpected results, as you don't set the bounds of your components manually. Besides, as pointed out by MadProgrammer's answer, you shouldn't set preferred sizes on your components, if possible. There are other ways to determine appealing dimensions. For instance, with JList, using setVisibleRowCount. In order for the scroll to appear only as needed, you can specify the scroll bar policies on the JScrollPane constructor, or use its set methods to do so. Example: jlist.setVisibleRowCount(5); JScrollPane scroll = new JScrollPane(jlist); scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); Also, make sure the container of the scroll pane respects its preferred size, as the scroll pane respects the list's preferred size.
answers question: http://stackoverflow.com/q/22001129
type: Answer
has comment: http://stackoverflow.com/comment/33346828
score: 0
has comment: http://stackoverflow.com/comment/33346616

http://stackoverflow.com/comment/33313909
score: 0
type: Comment
type: QuestionComment
has text: @user3058983 Yeah, you do have a debugger. If you're not using an IDE, have a look at http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html
comment on: http://stackoverflow.com/q/21983353

http://stackoverflow.com/comment/33168415
comment on: http://stackoverflow.com/a/21901615
type: Comment
has text: Then I want to delete the old index folder, there comes the message: "files in the folder is being used by the application". But the searchers is using the new index folder, I don't know why I cannot delete the old one
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33290737
type: AnswerComment
has text: it was giving exception on my system
comment on: http://stackoverflow.com/a/21968598
score: 0
type: Comment

http://stackoverflow.com/comment/33185130
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21910916
type: Comment
has text: I guess your answer is worded such that it assumes the object is a part of public API and that its client is distinct from its provider. I see a lot of answers which take that for granted, in fact. Very different rules apply to code which defines a public API and to implementation code, and clearly there's at least 10 lines of implementation for each line of public API.

http://stackoverflow.com/q/21853741
favorite count: 0
has answer: http://stackoverflow.com/a/21854145
has comment: http://stackoverflow.com/comment/33081676
has body: i want to make a little game for android devices. All works... except the collision with the player and objects. Did i do something wrong? I have tried many of methods for checking collision. E. g. intersect, intersects, contains and a function with self made collision test. Edit: My Problem is that nothing happens :) DisplayMetrics metrics = getContext().getResources().getDisplayMetrics(); int width = metrics.widthPixels; int height = metrics.heightPixels; private Bitmap player, enemy; private int speedrun=1, x= 0, y = height - height / 5, i=1, yg=height - height / 5 + 40, xe= 920, xp =width / 2 - width / 4; private Rect p, e; public static int speed=0; //other code @Override protected void onDraw(Canvas c) { c.drawColor(Color.CYAN); handelPlayer(); p = new Rect(xp, y, 0, 0); wayrect = new Rect(x, yg, 0, 0); wayrect2 = new Rect(x + width, yg, 0, 0); e = new Rect(xe, yg - 250, 0, 0); c.drawBitmap(enemy, e.left, e.top, null); c.drawBitmap(player, p.left, p.top, null); } public void handelPlayer() { x -= speed*speedrun; xe -= speed*speedrun; if (x + width &lt; 0) x = 0; if (xe &lt; -100) xe = 920; if (MainActivity.touch == 1) { y -= 100;//jump MainActivity.touch = 0; i = 1; } if (y &lt;= height - height / 5) y += 3 * i / 10; //gravity i++; if (p.intersect(e)) //collosision speedrun = 0; }
tagged with: android
tagged with: collision
score: 2
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33086943
tagged with: java
has title: Android Rect Collision
type: Question
accepted answer: http://stackoverflow.com/a/21854145
tagged with: canvas
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/97467289
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21987084
has text: there is a not recommend workaround : if you have a field in the java bean named : Company and you want to access it in the jsf page you can access it as company with small letter (jsf here will call the getter which has the correct syntax getCapital)
type: AnswerComment

http://stackoverflow.com/a/21935606
score: 0
answers question: http://stackoverflow.com/q/21932815
type: Answer
has body: Open eclipse.ini form your eclipse folder and set the following parameter as shown in image -vm //your java7-dir/bin/javaw.exe (use mac javaw in your case)
has comment: http://stackoverflow.com/comment/33255155

http://stackoverflow.com/a/21869462
downvote count: 0
score: 4
type: Answer
has body: Your code is extremely convoluted, I believe that it's suffering from something called cyclomatic complexity, so much so, it is difficult for you or us to see what object is creating what other object, and what is running what. And this is your problem. You have at least two MultipleBall objects, two Ball2 objects, and you're starting the Timer for one of the Ball2 objects and stopping it for the other. The solution: simplify this code greatly. Create one MultipleBalls object, just one. Don't have MultipleBalls implement ActionListener. Rather use an anonymous inner class for your ActionListener and create it on the spot where you need it. Create just one Ball2 object, just one. Also note that you almost never call run() on a Thread object but rather start(), but having said that, I'm not even sure that you should be using a Thread object where you're using it. Edit My main class would be simple, and would simply have a main method and supporting method that gets things started. Something like: public class MultipleBalls { private static void createAndShowGui() { BallsPanel mainPanel = new BallsPanel(); JFrame frame = new JFrame("Multiple Balls"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(mainPanel); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGui(); } }); } } Edit For an example of a separation of concerns: import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.swing.*; public class MultipleBallsZ { private static void createAndShowGui() { BallsPanelZ ballsPanel = new BallsPanelZ(); new Control(ballsPanel); JFrame frame = new JFrame("Multiple Balls"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getCo…
answers question: http://stackoverflow.com/q/21869390
accepted answer of: http://stackoverflow.com/q/21869390
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/33349487
has text: Java's `Queue` does not. http://docs.oracle.com/javase/7/docs/api/java/util/Queue.html
type: Comment
comment on: http://stackoverflow.com/a/22003164
score: 0
type: AnswerComment

http://stackoverflow.com/q/21996475
downvote count: 0
has title: java for each loop expects object as type while it contains an integer array
accepted answer: http://stackoverflow.com/a/21996497
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21996546
possible better answer: http://stackoverflow.com/a/21996524
has answer: http://stackoverflow.com/a/21996497
upvote count: 2
favorite count: 0
tagged with: arraylist
answer count: 3
has answer: http://stackoverflow.com/a/21996524
score: 2
type: AnsweredQuestion
has body: I got a beginner's Java question. I am filling an ArrayList like this: private ArrayList getDuplicatesIndexes(char[] letters) { ArrayList&lt;int[]&gt; duplicatesIndexes = new ArrayList&lt;int[]&gt;(); for(int i = 0; i &lt; letters.length; i++ ) { for(int j = 0; j &lt; letters.length; j++) { System.out.println("compare this"); System.out.println(letters[i]); System.out.println("with this:"); System.out.println(letters[j]); if(letters[i] == letters[j] &amp;&amp; i != j) { System.out.println("match!"); int[] indexes = new int[2]; indexes[0] = i; indexes[1] = j; duplicatesIndexes.add(indexes); } } } return duplicatesIndexes; } I want to loop through it like this: private void checkForSingularLetters(ArrayList duplicatesIndexes, char[] letters) { for(int[] indexes : duplicatesIndexes ){ System.out.println(indexes[0]); ... } } I cant wrap my mind about why the foreach loop is expecting an object while im sure its filled with int[] Maybe someone could explain it to me. Thanks.

http://stackoverflow.com/comment/33351438
has text: Sorry for the code in comment, didn't know how else to do it. Thank you very much for the answer
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22004187
type: Comment

http://stackoverflow.com/comment/33295580
comment on: http://stackoverflow.com/a/21972163
has text: If that code works just fine, why do I get this error: "file not found: null: Java"
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21841946
score: 0
has body: Capitalization is important. Change android:name=".main" to android:name=".Main".
type: Answer
answers question: http://stackoverflow.com/q/21841929

variables
tags question: http://stackoverflow.com/q/21969603
tag name: variables
tags question: http://stackoverflow.com/q/21948458
tags question: http://stackoverflow.com/q/21893910
tags question: http://stackoverflow.com/q/21869969
tags question: http://stackoverflow.com/q/21918762
tags question: http://stackoverflow.com/q/21962929
type: Tag
tags question: http://stackoverflow.com/q/21855290
tags question: http://stackoverflow.com/q/21920433
tags question: http://stackoverflow.com/q/21868380
tags question: http://stackoverflow.com/q/21951042
tags question: http://stackoverflow.com/q/21944301
tags question: http://stackoverflow.com/q/21844671
tags question: http://stackoverflow.com/q/21978666
tags question: http://stackoverflow.com/q/21858226

http://stackoverflow.com/comment/44608174
type: Comment
has text: How can you specify in the default value in the schema definition. We tried to add <expiry-delay> tag in the schema but it didn't work. Is there any other option?
comment on: http://stackoverflow.com/a/21909472
score: 0
type: AnswerComment

http://stackoverflow.com/a/21918175
has comment: http://stackoverflow.com/comment/33202114
score: 0
has comment: http://stackoverflow.com/comment/33200684
has comment: http://stackoverflow.com/comment/33200358
has body: You're transforming a byte array, containing any kind of byte, into a String, using new String(bytes); This constructor expects the bytes to represent characters transformed to bytes using your default platform encoding, and it has a very good chance of not being the case. Don't use String to represent binary data? Leave it as a byte array. Or encode the byte array using Hex or Base64 encoding.
has comment: http://stackoverflow.com/comment/33202477
has comment: http://stackoverflow.com/comment/33198890
has comment: http://stackoverflow.com/comment/33199355
has comment: http://stackoverflow.com/comment/33198497
answers question: http://stackoverflow.com/q/21913803
has comment: http://stackoverflow.com/comment/33198986
type: Answer
has comment: http://stackoverflow.com/comment/33200697
has comment: http://stackoverflow.com/comment/33198463
has comment: http://stackoverflow.com/comment/33200594
has comment: http://stackoverflow.com/comment/33199562

http://stackoverflow.com/a/21900107
has body: The System.out.println() may not help while running job. To make sure your initialize() is called or not try throw some RuntimeException there as below: @Override public void initialize(InputSplit genericSplit, TaskAttemptContext job) throws IOException, InterruptedException { throw new NullPointerException("inside initialize()"); .... This will definitely do.
answers question: http://stackoverflow.com/q/21855690
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33216645

http://stackoverflow.com/q/21974729
has title: Restart mysql from JDBC
has comment: http://stackoverflow.com/comment/33298622
score: 0
answer count: 1
tagged with: jdbc
has answer: http://stackoverflow.com/a/21974843
type: UnansweredQuestion
tagged with: java
tagged with: mysql
has body: I was wondering if it is possible to restart the database from JDBC. I am dynamically setting mysql system variables, and in order to see if the values I am setting are making any difference I need to restart database after each execution. I could restart it from shell script, but know I am working with java code and so I would like to call database with JDBC rather than calling shell script from java code.
type: Question

http://stackoverflow.com/q/21951181
score: 0
has answer: http://stackoverflow.com/a/21951278
answer count: 1
has comment: http://stackoverflow.com/comment/33256828
tagged with: iteration
has body: I have a List of object, List&lt;Field&gt; fieldList and a list of String List&lt;String&gt; fieldNameList. Each Field object in the fieldList consists of String filedName and various properties. What is the best way to iterate over the fieldList and access their properties in the order of the fieldNameList? For example, fieldList: [name, color, size] contains: [field1, red, 10] [field2, yellow, 8] [filed3, green, 9] [field4, blue, 10] And the fieldNameList contains: [field2, field3, field1, field4] I want to access the fieldList in order of the fieldNameList, i.e. color = yellow, green, red, blue One way that I know is to iterate through the fieldList first and create a HashMap&lt;String, Field&gt; nameFieldMap and then iterate through the fieldNameList and access the required field properties by the fieldNames in order. However, this involves 2 iterations and hence the time taken would be 2n. Is there a better way to do this? Can this be achieved in one iteration?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33256482
tagged with: list
tagged with: java
has comment: http://stackoverflow.com/comment/33256431
has title: Java: iterating through one list in order of the objects in other list
type: Question
has comment: http://stackoverflow.com/comment/33256375
has comment: http://stackoverflow.com/comment/33256447
tagged with: listiterator

http://stackoverflow.com/a/21918409
score: 2
has comment: http://stackoverflow.com/comment/44048201
downvote count: 0
answers question: http://stackoverflow.com/q/21918353
has body: 2 possibilities: Change to this: shortcutIntent.setComponent(new ComponentName( getApplicationContext().getPackageName(), GetQuoteActivity.class)); Use this code to create the shortcut: Intent shortcutIntent = new Intent (this, YourActivity.class); Intent addIntent = new Intent(); addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Title"); addIntent.putExtra("duplicate", false); addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(this, R.drawable.icon)); sendBroadcast(addIntent);
has comment: http://stackoverflow.com/comment/33198393
accepted answer of: http://stackoverflow.com/q/21918353
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33199350
type: Answer

http://stackoverflow.com/q/21955127
score: 0
possible better answer: http://stackoverflow.com/a/21955352
has answer: http://stackoverflow.com/a/21955352
has comment: http://stackoverflow.com/comment/33263254
tagged with: console
has title: Duplicate output
has answer: http://stackoverflow.com/a/21955536
has comment: http://stackoverflow.com/comment/33263264
tagged with: io
linked to: http://stackoverflow.com/q/21949775
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21955225
accepted answer: http://stackoverflow.com/a/21955225
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21955403
linked to: http://stackoverflow.com/q/15273449
has body: Why Number lower than 9 is printed twice in my console, in the bellow code example? public static void main(String[] args) throws java.io.IOException { System.out.println("Input from keyboard should be '49'"); char e; for (int a = 0; ; a++) { e = (char) System.in.read(); if (e == 49) break; else System.out.println("Use number lower than 9"); } } And here is the output when you type anything except of number 1: run: Input from keyboard should be '49' 2 Number lower than 9 Number lower than 9 Edit Basicly, I am trying to get an input from console and store it inside char e. What I'm getting after I type 1 is value 49. That's why I used in code above e == 49. I dont know how to retrieve just character 1. Next thing is that i used an infinite loop to force the input to ask for specific character until its the correct one.

http://stackoverflow.com/q/21932640
has comment: http://stackoverflow.com/comment/33222876
tagged with: tomcat
favorite count: 0
accepted answer: http://stackoverflow.com/a/21932843
has comment: http://stackoverflow.com/comment/33222829
has comment: http://stackoverflow.com/comment/33222948
tagged with: spring
has comment: http://stackoverflow.com/comment/33223123
has body: I was following this tutorial http://manueljordan.wordpress.com/2011/12/12/creating-a-spring-web-mvc-project-with-springsource-tool-suite/ However it looks as if my spring project does not get recognised. What I mean is that when I navigate to localhost:8080/Spring-default I get a 404 error. Here are some screen shots that show my configuration: This screenshot shows that my VMware vFabric tc Server is configured correctly: The project directory structure is the same as the template that spring tool suit offers. My controller is the controller that comes with the template: package com.vlad.myapp; import java.text.DateFormat; import java.util.Date; import java.util.Locale; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; /** * Handles requests for the application home page. */ @Controller public class HomeController { private static final Logger logger = LoggerFactory.getLogger(HomeController.class); /** * Simply selects the home view to render by returning its name. */ @RequestMapping(value = "/", method = RequestMethod.GET) public String home(Locale locale, Model model) { logger.info("Welcome home! The client locale is {}.", locale); Date date = new Date(); DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); String formattedDate = dateFormat.format(date); model.addAttribute("serverTime", formattedDate ); return "home"; } } If I go to localhost:8080 I get the default page that VMware offers however as mentioned above localhost:8080/Default-spring gives me a 404. Here is the pom.xml if it's of any help: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.vlad myapp Spring-default war 1.0.0-BUILD-SNAPSHOT 1.6 <org.springframework-version>3.1.1.RELEASE</org.springframework-version> <org.aspectj-version>1.6.10</…
has comment: http://stackoverflow.com/comment/33222789
tagged with: spring-mvc
type: AnsweredQuestion
has title: Routing fails in spring vmware vFabric
has comment: http://stackoverflow.com/comment/33223333
upvote count: 1
has comment: http://stackoverflow.com/comment/33222968
type: Question
has comment: http://stackoverflow.com/comment/33222903
has answer: http://stackoverflow.com/a/21932843
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33223087
has comment: http://stackoverflow.com/comment/33222836
has comment: http://stackoverflow.com/comment/33224115
has comment: http://stackoverflow.com/comment/33223712
has comment: http://stackoverflow.com/comment/33223233
tagged with: routes
has comment: http://stackoverflow.com/comment/33223946
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/33322264
comment on: http://stackoverflow.com/q/21988444
score: 0
type: Comment
type: QuestionComment
has text: but how to make that JSP page run with HTTPS ?

http://stackoverflow.com/q/21996884
has body: Assume 4 strings, 2 to be matched the other not: String string1 = "Hello World View"; String string2 = "Hello Nether World"; String string3 = "A World You should not find"; String string4 = "Any World is good"; What regular expression will only match string1 or string4 where World starts in position 6?
has answer: http://stackoverflow.com/a/21996984
type: Question
has answer: http://stackoverflow.com/a/21996980
downvote count: 0
favorite count: 0
answer count: 5
tagged with: regex
has comment: http://stackoverflow.com/comment/33338134
has answer: http://stackoverflow.com/a/48559018
has answer: http://stackoverflow.com/a/21996954
type: UnansweredQuestion
upvote count: 1
tagged with: matching
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21997433
has title: How can I use a regex to match a pattern only at a specific position in the string?
tagged with: substring

http://stackoverflow.com/q/21859579
downvote count: 0
score: 10
has answer: http://stackoverflow.com/a/60233774
accepted answer: http://stackoverflow.com/a/21860551
answer count: 3
favorite count: 0
has title: Authentication during connection to MongoDB server instance using Java
has comment: http://stackoverflow.com/comment/33093573
possible better answer: http://stackoverflow.com/a/36290232
has body: Is it possible to make something like : MongoClient mongo = new MongoClient(ip, port, usrName, password) in JAVA similar to the MongoVUE or other SQL based databases' authentication method. There the authentication is done during connection to DB instance. I don't see an appropriate instance method in MongoClient java doc And the way in Authentication (Optional) Official docs doesn't fit my goals, because it requires to change all the existing query methods in my application which don't use authentication now. The way in Authenticate to MongoDB with the Java Driver looks exactly what i need, but there's no com.mongodb.MongoCredential class in mongo 2.10.1 distribution.
has answer: http://stackoverflow.com/a/36290232
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21860551
tagged with: java
tagged with: mongovue
tagged with: authentication
upvote count: 10
type: Question
tagged with: mongodb

http://stackoverflow.com/comment/33335707
type: Comment
score: 0
has text: public static void main(String[] args) Main m = new Main(); Main() { gbl = new GridBagLayout(); c = new GridBagConstraints(); int colwidth[]={1,1,1,1,1,1,1,1}; int colheight[]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; // theres 18 double colweightb[]={1,1,1,1,1,1,1,1}; gbl.SetLayout(Display); gbl.SetBounds(0,0,300,900);
type: AnswerComment
comment on: http://stackoverflow.com/a/21995116

http://stackoverflow.com/q/21875066
tagged with: service-provider
upvote count: 2
answer count: 1
favorite count: 0
tagged with: encryption
has body: I am a college student trying to implement a service provider plugin for WebSSO in java. I am using Shibboleth IdP as identity provider. I have been able to send the authentication request to IdP and is successfully receiving the response from IdP through a servlet. I tried decoding the response and was able to get the XMLObject. Now the issue is that the response is encrypted. So when I am using Assertion assertion = response.getAssertions().get(0); It basically returns null. But when I am using Assertion assertion = response.getEncryptedAssertions().get(0); It is not null. So it basically means that the response is encrypted. Now I don't know the flow of how to decrypt the SAMLReponse. Any pointer, code or suggestion is welcome.
accepted answer: http://stackoverflow.com/a/21875482
score: 2
has title: how to decrypt SAMLResponse received from Shibboleth IdP
type: AnsweredQuestion
tagged with: shibboleth
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/21875482
type: Question
tagged with: opensaml

http://stackoverflow.com/comment/33329080
type: Comment
has text: Thank you very much, finally I created a "Pair" class with the array declaration and worked with It in doInBackground. It works fine!!
comment on: http://stackoverflow.com/a/21922865
score: 0
type: AnswerComment

http://stackoverflow.com/q/21848607
type: Question
has comment: http://stackoverflow.com/comment/33074679
has comment: http://stackoverflow.com/comment/33073206
has answer: http://stackoverflow.com/a/21849083
score: -1
has comment: http://stackoverflow.com/comment/33073588
has body: I am trying to close the TCP/IP session created from a java application using a linux command to check how application behaves. can you suggest a command from linux to do this?
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33072763
favorite count: 0
tagged with: linux
type: UnansweredQuestion
tagged with: sockets
tagged with: java
has title: how do i close the TCP session created from a linux box using a command?
downvote count: 1

google-cloud-messaging
tags question: http://stackoverflow.com/q/21861363
tags question: http://stackoverflow.com/q/21871847
tag name: google-cloud-messaging
tags question: http://stackoverflow.com/q/21853129
tags question: http://stackoverflow.com/q/21918264
tags question: http://stackoverflow.com/q/21916750
type: Tag

http://stackoverflow.com/comment/33198624
comment on: http://stackoverflow.com/a/21918462
score: 0
type: Comment
has text: call saveMessage in try catch block and check what error its giving.
type: AnswerComment

http://stackoverflow.com/comment/33212711
type: AnswerComment
comment on: http://stackoverflow.com/a/21904409
has text: I found a solution for it. Actually the way I was calling the class was wrong. Now I am able to laod jars. load one main class which internally uses instances of other classes from other jars and all of them are available at runtime.
type: Comment
score: 0

http://stackoverflow.com/comment/33273568
type: Comment
has text: @hotlicks I always print with surrounding square brackets so i can clearly see leading/trailing whitespace, especially trailing newlines.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21960532

http://stackoverflow.com/q/21845301
answer count: 1
has body: I am using Google App Engine as a backend for my Android app.I am able to insert entities into the datastore using the method(auto-generated when i created the endpoint for my Note class) /** * This inserts a new entity into App Engine datastore. If the entity already * exists in the datastore, an exception is thrown. * It uses HTTP POST method. * * @param note the entity to be inserted. * @return The inserted entity. */ @ApiMethod(name = "insertNote") public Note insertNote(Note note) { EntityManager mgr = getEntityManager(); try { if (containsNote(note)) { throw new EntityExistsException("Object already exists"); } mgr.persist(note); } finally { mgr.close(); } return note; } So to use this method from my Android app and insert an Entity i use this from my AsyncTask class try { Note note = new Note(); String descrptn = descriptionTF.getText().toString(); String email = emailTF.getText().toString(); String noteID = new Date().toString(); note.setDescription(descrptn); note.setId(noteID); note.setEmailAddress(email); Note result = endpoint.insertNote(note).execute(); } catch (IOException e) { e.printStackTrace(); } It's all sunshine and rainbows till i try to retrieve the entity from the datastore.I get FATAL Exception:...Caused by Java.lang.NullPointerException: required parameter id must be specified This is the method to call when trying to retrieve an Entity(Auto-generated also) /** * This method gets the entity having primary key id. It uses HTTP GET method. * * @param id the primary key of the java bean. * @return The entity with primary key id. */ @ApiMethod(name = "getNote") public Note getNote(@Named("id") String id) { EntityManager mgr = getEntityManager(); Note note = null; try { note = mgr.find(Note.class, id); } finally { mgr.close(); } return note; } and this is what am trying from my Android activity try { Note newNote = new Note(); String noteID = newNote.getId(); Note newResult = endpoint.getNote(noteID).execute(); String descrptn = newResult.getDesc…
type: UnansweredQuestion
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/21850357
score: 0
tagged with: java
has title: Error fetching entity by Entity Id from Google App Engine backend for Android app
type: Question
tagged with: jpa
tagged with: android

http://stackoverflow.com/comment/33271670
type: AnswerComment
has text: @MadProgrammer I was wrong my entirely java life I guess :P
score: 0
comment on: http://stackoverflow.com/a/21959258
type: Comment

http://stackoverflow.com/comment/33231268
type: QuestionComment
type: Comment
has text: Ok, the code gets simpler. I got that. And i think ill come back to your suggestion and implement that. But for now, id like to solve the first problem. There is a new problem as written in the update section. The hql string does not deliver Account objects, but something different. I cannot apply account methods on elements of the resultlist. I get an exception (see Update section)
comment on: http://stackoverflow.com/q/21934268
score: 0

http://stackoverflow.com/q/21947708
score: 2
has title: JFreeChart Java - How to create it is a lot of series in a cycle
upvote count: 2
possible better answer: http://stackoverflow.com/a/21947778
has answer: http://stackoverflow.com/a/21953170
tagged with: swing
has answer: http://stackoverflow.com/a/21947778
tagged with: jfreechart
has body: I have a spline graphic that get coordinates from InitP file. I plan to expand a code to make loading of graphics of several files (for each graphic there is the file with a set of coordinates). On an input the line with names of files. In a cycle in each series for dataset coordinates for the appropriate diagram will be skidded. Difficulty arises in creation of new series, I don't know as to create a new series when reading the new file (I don't know how to create series2, series3 in cycle because I dont know how many series will be). There is a code for one graphic. series1 = new XYSeries("Graph"); try { Scanner s = new Scanner(new File("InitP")); System.out.println("Open success!"); float xpol = 0, ypol = 0; s.useLocale(Locale.US); while (s.hasNext()) { if (s.hasNextFloat()) { xpol = s.nextFloat(); ypol = s.nextFloat(); System.out.println("x = " + xpol + ", y = " + ypol); series1.add(xpol, ypol); } else { s.next(); } } dataset.addSeries(series1); } catch (FileNotFoundException ex) { System.out.println("Can't find file!"); } XYSeriesCollection dataset = new XYSeriesCollection();
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5522575
tagged with: java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/21953170
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/13205251

http://stackoverflow.com/comment/33308001
comment on: http://stackoverflow.com/a/21979848
score: 1
has text: Thanks for the explaination. I have a better understanding now.
type: AnswerComment
type: Comment

timer
tag name: timer
tags question: http://stackoverflow.com/q/21932702
tags question: http://stackoverflow.com/q/21898844
tags question: http://stackoverflow.com/q/21931433
tags question: http://stackoverflow.com/q/21934839
tags question: http://stackoverflow.com/q/21854187
tags question: http://stackoverflow.com/q/21943237
type: Tag
tags question: http://stackoverflow.com/q/21882285
tags question: http://stackoverflow.com/q/21868170
tags question: http://stackoverflow.com/q/21869390
tags question: http://stackoverflow.com/q/21935065
tags question: http://stackoverflow.com/q/21984332
tags question: http://stackoverflow.com/q/21853894
tags question: http://stackoverflow.com/q/21864259
tags question: http://stackoverflow.com/q/21981817
tags question: http://stackoverflow.com/q/21950305
tags question: http://stackoverflow.com/q/21973682
tags question: http://stackoverflow.com/q/21989382

http://stackoverflow.com/comment/34135194
type: Comment
type: QuestionComment
has text: Good, that's the right place to solve this issue. but I am surprised why `String.split("\\r?\\n")` is not working at client side.
comment on: http://stackoverflow.com/q/22003764
score: 0

http://stackoverflow.com/q/21956260
tagged with: uml
type: Question
downvote count: 0
has body: I have installed UML Netbeans plugin for reverse engineering that automatic convert my Java code into UML. But my question is, how can I draw the activity diagram using the Netbeans plugin? Whenever I select activity, sequence , collaboration or any other UML diagram instead class diagram then only class diagram, it doesn't create the desired UML diagram.
upvote count: 1
has comment: http://stackoverflow.com/comment/33270918
favorite count: 0
tagged with: netbeans
answer count: 0
type: UnansweredQuestion
tagged with: reverse-engineering
has comment: http://stackoverflow.com/comment/33284918
has title: how to draw Activity Diagram in netbeans
has comment: http://stackoverflow.com/comment/33424453
has comment: http://stackoverflow.com/comment/33279259
score: 1
tagged with: java

http://stackoverflow.com/comment/33279676
has text: You should really start with a good introductory book or tutorial.
type: Comment
comment on: http://stackoverflow.com/q/21964039
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33098496
has text: what is Id?, do I have to create a new method in database class?, and how do I reference "counter" because it is saying it cannot be resolved?
type: Comment
comment on: http://stackoverflow.com/a/21862915
type: AnswerComment
score: 0

http://stackoverflow.com/comment/65796543
has text: Guys.. LFTP does exist, and its much faster than using ftp or sftp. here is the page for it: https://lftp.yar.ru/ I am still looking for the java API, will try to update if I do find it.
score: 0
comment on: http://stackoverflow.com/q/21990086
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22001260
tagged with: out-of-memory
type: UnansweredQuestion
has title: Cassandra generates “java.lang.OutOfMemoryError: Java heap space” error on startup
tagged with: cassandra-2.0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33354375
has comment: http://stackoverflow.com/comment/33346792
score: 4
has comment: http://stackoverflow.com/comment/33346404
has comment: http://stackoverflow.com/comment/33346240
upvote count: 4
has body: I upgraded my system from 13.04 to 13.10 and I could not start Cassandra anymore, getting an out of memory error, so the heap was getting full even though all I was doing at that point was start the server. I went in and increased the maximum heap size with -Xmx1992m (the default) to -Xms2500m. I am wondering why would it be required to do such a thing? Could it be that the memory decreased a little bit between running Linux kernel 3.5.0 and moving to kernel 3.11.0 and could that impact Cassandra? (i.e. say I "lost" 200M, now it was allocating 1992Mb instead of 2192Mb with the previous kernel, could that be??) My concern here is that any time I upgrade I could run in a problem like this unless I force the maximum heap size to a fixed number (instead of letting the script determine the Mb to use dynamically.) Plus, I just cannot continue to increase the limit forever. My RAM is limited... (obviously.) On startup Cassandra shows the following (broken on 3 lines to make it easier to read here): xss = -ea -javaagent:bin/../lib/jamm-0.2.5.jar -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms1994M -Xmx2500M -Xmn400M -XX:+HeapDumpOnOutOfMemoryError -Xss256k Update: Argh! It was still starting OpenVMS because the $JAVA_HOME variable that points to /usr/lib/jvm/default-java (it is defined in /etc/environment): JAVA_HOME=/usr/lib/jvm/default-java And somehow it was setup back to OpenVMS in there. Although I changed the /etc/alternatives/java softlink, and thus java -version in my command line was "working fine" (returning what I'd expect) the Cassandra startup script makes use of the $JAVA_HOME variable! So I checked the list of available VMs with: ls -l /usr/lib/jvm lrwxrwxrwx 1 root root 24 Apr 27 2012 default-java -&gt; java-1.7.0-openjdk-amd64 drwxr-xr-x 4 root root 4096 Feb 23 17:54 java-1.5.0-gcj-4.8-amd64 lrwxrwxrwx 1 root root 20 Sep 2 2012 java-1.6.0-openjdk-amd64 -&gt; java-6-openjdk-amd64 lrwxrwxrwx 1 root root 20 Jul 3 2013 java-1.7.0-openjdk-amd64 -&gt; j…
has answer: http://stackoverflow.com/a/22001431
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33351577
has comment: http://stackoverflow.com/comment/33346300
has comment: http://stackoverflow.com/comment/33347214
favorite count: 0
tagged with: cassandra

http://stackoverflow.com/q/21957562
has comment: http://stackoverflow.com/comment/33480107
score: 0
has body: I have action with registered accelerator key for it public Rotate180Action() { putValue(NAME, "180"); putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_R, KeyEvent.CTRL_MASK)); } this action attached to Context menu (not a top menu or other) private JMenu buildRotateSubMenu() { rotateSubMenu.add(new JMenuItem(rotateLeft90Action)); rotateSubMenu.add(new JMenuItem(rotateRight90Action)); rotateSubMenu.add(new JMenuItem(rotate180Action)); return rotateSubMenu; } So, the problem is that action called by "Ctrl+R" when context menu is visible on screen, but not called when context menu is not showed thanks for your help!
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33271874
tagged with: swing
has comment: http://stackoverflow.com/comment/33477417
type: Question
tagged with: java
has title: Action not called when attached to context MenuItem (and when it hidden)
tagged with: awt

http://stackoverflow.com/comment/33304028
score: 0
has text: Thanks for the tip, but I can't see how that could be a problem when it gives me the exact same error on a fresh installation of tomcat?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21977030

http://stackoverflow.com/a/21893072
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/21892924
has body: Sure. T13 hold a static member s, which is first initialized with 1. Static class variable are the one shared by all instances of the class. That is, each time you create a T13 instance variable (such in your code new T13()), the member s is the same memory location and shared by all T13. A static initialization is performed only once by run, before any T13 instance is actually created. As a consequence, before your first T13 t1 = new T13(), s is set to 1. Then you enter the creator, where is still 1, id set to s, so it's 1, ans s is incremented to 2. The next new T13() find s to 2, id is set to 2, and s is incremented to 3. Hence your results. Hope it helps.
has comment: http://stackoverflow.com/comment/33154975
accepted answer of: http://stackoverflow.com/q/21892924
has comment: http://stackoverflow.com/comment/33155686
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33153303
has comment: http://stackoverflow.com/comment/33155165
type: Answer

actionlistener
tags question: http://stackoverflow.com/q/21969383
tags question: http://stackoverflow.com/q/21978743
tags question: http://stackoverflow.com/q/21892526
tags question: http://stackoverflow.com/q/21874923
tags question: http://stackoverflow.com/q/21956404
tags question: http://stackoverflow.com/q/21921934
tags question: http://stackoverflow.com/q/21961778
tags question: http://stackoverflow.com/q/21980890
tags question: http://stackoverflow.com/q/21885849
type: Tag
tags question: http://stackoverflow.com/q/21978872
tag name: actionlistener
tags question: http://stackoverflow.com/q/21899105
tags question: http://stackoverflow.com/q/21978245

http://stackoverflow.com/a/21956575
score: 0
has body: If we use singletone we do not need to create instance for use. Because when we are creating singletone then we are creating new instance if not created. Take a look of below code : public class Singleton { private static Singleton singleton; private Singleton() { } public static Singleton getSingleton() { if (singleton == null) { singleton = new Singleton(); } return singleton; } public void testSingleTone(){ System.out.println("test"); } public static void main(String[] args){ Singleton.getSingleton().testSingleTone(); } }
type: Answer
answers question: http://stackoverflow.com/q/21956333

http://stackoverflow.com/comment/33305851
type: Comment
has text: http://www.youtube.com/watch?v=wpbQ0DCFF0M - THis video is where I saw. He just writes stat where I write statJCBaccountname
type: AnswerComment
comment on: http://stackoverflow.com/a/21978554
score: 0

http://stackoverflow.com/comment/33328107
score: 0
type: QuestionComment
has text: Jetbrains support helped resolve the issue. With IntelliJ 13, we need to use the "Import Project" option and point the the existing source directory for it to scan sources and detect existing modules.
type: Comment
comment on: http://stackoverflow.com/q/21989960

http://stackoverflow.com/comment/33269027
type: Comment
type: AnswerComment
has text: Anyone care to comment what's wrong with this, as opposed to a vote down?
comment on: http://stackoverflow.com/a/21958307
score: 0

http://stackoverflow.com/comment/33120708
type: QuestionComment
has text: You need to define `myClass` as `Class<User>`
comment on: http://stackoverflow.com/q/21875238
score: 0
type: Comment

http://stackoverflow.com/comment/33069569
comment on: http://stackoverflow.com/q/21843101
has text: @AndrewThompson Sure, let me create one and post as soon as my work hours are over. And DesignGridLayout is a layout manager (https://designgridlayout.java.net/).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21942978
score: 0
answers question: http://stackoverflow.com/q/21940467
type: Answer
has body: Basically, the APPLICATION value is a hardcoded constant. The value for the APPLICATION constant is obtained from the ASN.1 BER encoding specifications. In ASN.1 BER encodings each value has an associated tag and length. A tag is composed of tag class and tag number. There are four tag classes: universal, application, context-specific, private. These four values are encoded as two bits on the positions 8 and 7 of the first octet of the tag encoding. The bits corresponding to the application class are 01 (bit 8 and bit 7), and translated in hex this gives the 0x40 bit mask, which is used below to compute the tag values using bitwise operations. For more details about the BER encoding, see for example http://luca.ntop.org/Teaching/Appunti/asn1.html.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21940467
has comment: http://stackoverflow.com/comment/33243417

http://stackoverflow.com/a/21843479
upvote count: 3
downvote count: 1
has body: Print quotes around it? System.out.println("\"" + i + "\"");
answers question: http://stackoverflow.com/q/21843464
has comment: http://stackoverflow.com/comment/33064393
type: Answer
has comment: http://stackoverflow.com/comment/33064491
has comment: http://stackoverflow.com/comment/33064292
score: 2
has comment: http://stackoverflow.com/comment/33078889
has comment: http://stackoverflow.com/comment/33064454
has comment: http://stackoverflow.com/comment/33064324

http://stackoverflow.com/a/71066769
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21856211
has body: If anyone encountered the problem after including Apache Tika 2, it could be due to a mail dependency embedded in Tika. We manage to fix the issue by adding a Maven exclusion, leaving only javax.mail on classpath. Something like: org.apache.tika tika-parsers-standard-package org.bouncycastle bcmail-jdk15on
upvote count: 1
type: Answer

http://stackoverflow.com/comment/33112825
score: 0
type: QuestionComment
type: Comment
has text: If Spring isn't logging anything at either debug or info level at least, that means Spring isn't involved. In other words, your Servlet container is giving you the 404 response.
comment on: http://stackoverflow.com/q/21870726

http://stackoverflow.com/q/21858488
has body: I managed to implement a simple file I/O in my Spring project for files not inside my project (then WAR file) using a .properties file that contains the path (source) and now I need to do it in the server. Before, when I included the files inside the WAR file, I can access them in the Tomcat server using the path /home/my_username/tomcat7/webapps/my_project/WEB-INF/classes/ But now that the files are not inside the WAR file, I just put them adjacent to the webapps folder. The structure of my Tomcat 7 folder is: tomcat7 |----&gt; bin |----&gt; conf |----&gt; logs |----&gt; resources* |----&gt; temp |----&gt; webapps |----\----&gt; springapp.war* |----&gt; work where /resources is the folder I need inside the WAR file I/O. My .properties file has: dir.server=home/my_username/tomcat7/resources // or dir.server=/home/my_username/tomcat7/resources but an error shows (from my catalina.out file): java.io.FileNotFoundException: /home/my_username/tomcat7/resources/my_file.file (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:120) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:79) at weka.core.SerializationHelper.read(SerializationHelper.java:270) Is there a proper way to declare the file path or do I have to change my implementation of file I/O?
tagged with: spring
tagged with: deployment
has comment: http://stackoverflow.com/comment/33095333
tagged with: tomcat7
linked to: http://stackoverflow.com/q/21820779
type: Question
has comment: http://stackoverflow.com/comment/33091711
has title: Tomcat deployment file paths (for Java I/O process)
has comment: http://stackoverflow.com/comment/33091918
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21859390
tagged with: file-io
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33093720

http://stackoverflow.com/a/21848191
has comment: http://stackoverflow.com/comment/33071980
has body: From my experience with the SharedPreferences I have noticed the following: 1) Always use try to make your SharedPreference name and Attributes name unique all over the device. 2) Do not use the name of your SharedPreference like "myPreference", "preference", "appPreference"...etc. Use your PackageName as a unique identifier for the SharedPreference name. Example: SharedPreferences preferences = getSharedPreferences(Context.getPackageName(), Context.MODE_PRIVATE); 3) Use also a unique Keys for your attributes by concatenating the attribute name with the package name. Example: Editor editor = sharedpreferences.edit(); boolean isAdminKey = Context.getPackageName()+"admin"; editor.putString(isAdminKey , "value"); editor.commit(); 4) No problem with editing multiple Keys values with one commit(). 5) Use MODE_PRIVATE when you create your preferences to prevent other applications from reading your SharedPreferences. See step 2 for example 6) Do not rely on the SharedPreferences 100% because it will be cleared if the user pressed Clear Data button from the App info screen. Otherwise, create file in the ExternalDirectory() or send your info to a server.
upvote count: 10
type: Answer
has comment: http://stackoverflow.com/comment/33072003
answers question: http://stackoverflow.com/q/21847872
downvote count: 0
has comment: http://stackoverflow.com/comment/33072143
has comment: http://stackoverflow.com/comment/33072064
score: 10

http://stackoverflow.com/q/21955593
linked to: http://stackoverflow.com/q/19366301
possible better answer: http://stackoverflow.com/a/21957034
has answer: http://stackoverflow.com/a/21957034
favorite count: 0
tagged with: android
score: 8
type: AnsweredQuestion
tagged with: android-webview
downvote count: 0
accepted answer: http://stackoverflow.com/a/21958954
tagged with: webview
upvote count: 8
type: Question
has title: android webview.loadUrl won't load another webpage
has body: In my simple android app I programmatically load a webpage in the WebView. It initially starts with a default webpage, and the next one is loaded based upon the user inputs for the first one. The JavaScript pass information back into the Android side of things via a message. Everything works fine, except when the second webpage doesn't load no matter what I do and which URL I give. When I load the second test, a warning appears "All WebView methods must be called on the same thread." But to my knowledge I'm not using multithreading, nor do I need to use multithreading. Here's the relevant code: public class MainActivity extends Activity { public WebView myWebView; public int state; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_main); myWebView = (WebView) findViewById(R.id.webview); WebSettings myWebViewSettings = myWebView.getSettings(); myWebViewSettings.setJavaScriptEnabled(true); myWebViewSettings.setDomStorageEnabled(true); myWebViewSettings.setAllowFileAccessFromFileURLs(true); myWebViewSettings.setAllowUniversalAccessFromFileURLs(true); myWebView.addJavascriptInterface(new JavascriptHandler(), "cpjs"); state = 0; loadNextTest(); } public void webviewLoadURL(String url) { Log.d("app", "now loading " + url); myWebView.clearHistory(); myWebView.clearFormData(); myWebView.clearCache(true); myWebView.loadUrl(url); } final class JavascriptHandler { @JavascriptInterface public void sendToAndroid(String text) { if (text.equals("confirmed at target")) { loadNextTest(); } } } public void loadNextTest() { Log.d("app", "now loading test " + (state + 1)); if (state == 0) { webviewLoadURL("file:///android_asset/test1.html"); state = state + 1; } else if (state == 1) { webviewLoadURL("file:///android_asset/test2.html"); // webviewLoadU…
has answer: http://stackoverflow.com/a/21958954
tagged with: java
tagged with: javascript
answer count: 2

http://stackoverflow.com/comment/33301153
comment on: http://stackoverflow.com/a/21975939
score: 0
type: AnswerComment
type: Comment
has text: thanks for your response. Since I am extensively using `chrome`, is it possible to let `java 1.6` run as default, and set the `JDK 7` only when choosing the `SDK` of my IDE projects ?

http://stackoverflow.com/comment/33401162
has text: sometimes user will explicitly given some location in his tweet..so i am planning to extract unigrams from tweets..but when i am trying to use this method am getting longitude and latitude for each word so each word is condisered as location..i have used a google location founder and i hope that only those words whic a location will get the longitude and latitude but i was not successful
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21902101
score: 0

http://stackoverflow.com/q/21878146
has body: Here is the code my util class public static void addSuccessMessage(String msg){ FacesMessage facesMsg=new FacesMessage(FacesMessage.SEVERITY_INFO, "Successfully Inserted" , msg); // FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,"No results found with ")); FacesContext.getCurrentInstance().addMessage("successInfo", facesMsg); } public static void addErrorMessage(String msg){ FacesMessage facesMsg=new FacesMessage(FacesMessage.SEVERITY_ERROR,msg,msg); FacesContext.getCurrentInstance().addMessage(null, facesMsg); here is the default message that is printed can someone plz help me out &lt;h:messages infoStyle="color:green;" showDetail="false" /&gt; My message i getting printed like .Successfully inserted i want my message to be in panel for sometime and disappear by Showing success or failur message this the method that is method that is getting called on performing operation and i am printing my success and failure message through this method public String updateEmpActn() throws Exception{ if("updated".equals(empapp.updtEmpApp())){ JsfUtil.addSuccessMessage("Successfully Saved"); //i tried putting this also some error of incompatable type is coming FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN,"Successfully Saved")); return "inserted"; }else{ JsfUtil.addErrorMessage("Not Saved"); return "notinserted"; }
score: 0
has comment: http://stackoverflow.com/comment/33223927
has comment: http://stackoverflow.com/comment/33225476
has title: How to remove default message and place required msg using jsf/primefaces?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33224341
linked to: http://stackoverflow.com/q/12600170
has comment: http://stackoverflow.com/comment/33222703
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/33224435
tagged with: jsf
tagged with: primefaces
tagged with: java
has comment: http://stackoverflow.com/comment/33221977
has comment: http://stackoverflow.com/comment/33222469
linked to: http://stackoverflow.com/q/3694450
has comment: http://stackoverflow.com/comment/33224934
type: Question
tagged with: jsf-2
has answer: http://stackoverflow.com/a/22871937
has comment: http://stackoverflow.com/comment/33222247
answer count: 1

http://stackoverflow.com/a/23741676
score: 2
upvote count: 2
has body: you need to get a auth key first Link: http://twitchapps.com/tmi/ and then you need to set this in the main java file bot.connect("irc.twitch.tv", 6667, "oauth:YOURAUTHKEY"); bot.joinChannel("#YOURCHANNEL-INLOWERCASE"); let me know if you have some other problems
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21926374

http://stackoverflow.com/q/21887050
linked to: http://stackoverflow.com/q/13578963
tagged with: put
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22016358
tagged with: java
tagged with: mapreduce
type: Question
answer count: 1
tagged with: hdfs
has body: I has been crazy with this error in a week. There was a post with the same problem Pass a Delete or a Put error in hbase mapreduce. But that resolution's not really work on mine. My Driver: Configuration conf = HBaseConfiguration.create(); Job job; try { job = new Job(conf, "Training"); job.setJarByClass(TrainingDriver.class); job.setMapperClass(TrainingMapper.class); job.setMapOutputKeyClass(LongWritable.class); job.setMapOutputValueClass(Text.class); FileInputFormat.setInputPaths(job, new Path("my/path")); Scan scan = new Scan(); scan.setCaching(500); // 1 is the default in Scan, which will be bad for MapReduce jobs scan.setCacheBlocks(false); // don't set to true for MR jobs // set other scan attrs TableMapReduceUtil.initTableReducerJob(Constants.PREFIX_TABLE, TrainingReducer.class, job); job.setReducerClass(TrainingReducer.class); //job.setNumReduceTasks(1); // at least one, adjust as required try { job.waitForCompletion(true); } catch (ClassNotFoundException | InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } My Mapper: public class TrainingMapper extends Mapper&lt;LongWritable, Text, LongWritable, Text&gt; { public void map(LongWritable key, Text value, Context context) throws IOException { context.write(key, new Text(generateNewText()); } My Reducer public class TrainingReducer extends TableReducer&lt;LongWritable,Text,ImmutableBytesWritable&gt;{ public void reduce(LongWritable key, Iterator&lt;Text&gt; values,Context context) throws IOException { while (values.hasNext()) { try { Put put = new Put(Bytes.toBytes(key.toString())); put.add("cf1".getBytes(), "c1".getBytes(), values.next().getBytes()); context.write(null, put); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } Do you have any experience on that? Please tell me how to fix it.
score: 0
has answer: http://stackoverflow.com/a/22016358
tagged with: hbase
has title: "java.io.IOException: Pass a Delete or a Put" when reading HDFS and storing HBase

http://stackoverflow.com/q/21983704
downvote count: 0
has comment: http://stackoverflow.com/comment/33314285
linked to: http://stackoverflow.com/q/5014128
tagged with: android
has body: I have developed an Android Library (without resources) and I want to release it as a jar. For standard Android applications I use to "export" them but for Android Library it doesn't work. Is there a standard way to create a distribution jar for those libraries within Eclipse? In case of a positive answer can I use Proguard to obfuscate them? Thank you.
favorite count: 0
has comment: http://stackoverflow.com/comment/33314333
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: How to create a distribution jar for an Android Library with Eclipse
score: 1
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33410004
type: Question

http://stackoverflow.com/a/21995840
type: Answer
answers question: http://stackoverflow.com/q/21991456
has body: If your Database supports trigger then this can be implemented in the trigger. In case of trigger there is no issue with session - you can always update with OLD and NEW value. Wikipedia entry gives more details about the solution: http://en.wikipedia.org/wiki/Log_trigger
score: 0

http://stackoverflow.com/a/22375533
has comment: http://stackoverflow.com/comment/34013835
has comment: http://stackoverflow.com/comment/34041803
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34066080
accepted answer of: http://stackoverflow.com/q/21932056
answers question: http://stackoverflow.com/q/21932056
has comment: http://stackoverflow.com/comment/34014775
has comment: http://stackoverflow.com/comment/34014645
has comment: http://stackoverflow.com/comment/34013788
has comment: http://stackoverflow.com/comment/34058747
has body: Consider leveraging the Hibernate cascading functionality for persisting object trees in one go with minimal database locking: @Entity public class Article { @OneToMany(cascade=CascadeType.MERGE) private List&lt;Images&gt; images; } @Transactional public void createArticle() { //images created as Java objects in memory, no DAOs called yet List&lt;Image&gt; images = ... Article article = getArticle(); article.addImages(images); // cascading will save the article AND the images em.merge(article); } Like this the article AND it's images will get persisted at the end of the transaction in a single transaction with a minimal lifetime. Up until then no locking occurred on the database. Alternativelly split the createArticle in two @Transactional business methods, one createImages and the other addImagesToArticle and call them one after the other in a third method in another bean: @Service public class OtherBean { @Autowired private YourService yourService; // note that no transactional annotation is used, this is intentional public otherMethod() { yourService.createImages(); // first transaction - images are committed yourService.addImagesToArticle(); // second transaction - images are added to article } }

http://stackoverflow.com/q/21900530
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33187971
has comment: http://stackoverflow.com/comment/33186588
type: Question
tagged with: amazon-s3
tagged with: java
has answer: http://stackoverflow.com/a/21958039
has comment: http://stackoverflow.com/comment/33181874
score: 0
has title: Java AmazonS3Client constructor failing
answer count: 1
tagged with: javascript
has body: I have an Applet whose method gets called from a JavaScript function within a browser. This method will eventually send a file to an Amazon S3 bucket. When this method attempts to create the AmazonS3Client however, the method fails without displaying any errors. The relevant snippet of the code within the method is: InputStream input = DigitalLive.class.getResourceAsStream("AwsCredentials.properties"); System.out.println("File loaded into Input Stream."); PropertiesCredentials theCredentials = new PropertiesCredentials(input); System.out.println("Credentials created."); System.out.println("AccessKey is:" + theCredentials.getAWSAccessKeyId()); System.out.println("SecretKey is:" + theCredentials.getAWSSecretKey()); //All of the above strings print to the console with the correct AccessKey and SecretKey try{ AmazonS3 s3Client = new AmazonS3Client(theCredentials); //This message never prints System.out.println("Client created."); } catch(Exception e) { //This message never prints System.err.println("Error creating AmazonClient: " + e.getMessage()); } None of the messages within the try/catch block ever print. None of the rest of the method's code (not shown here for brevity) gets fired either. The jar file compiles without error. I'm using jdk 1.7.0_51 and the amazon aws-java-sdk-1.7.1. I'm using Eclipse as the IDE and am building the jar with a build file using ANT. I'm not really sure what else to try other than wrapping the code in a try/catch block. Is there a different/better way for me to debug the Java code to learn why the AmazonS3Client is not created? Or perhaps a more obvious reason why it might fail given the code snippet above? EDIT: I added a try/catch block in the JavaScript code that calls the Java method and it throws an error: Error calling method on NPObject Error: java.lang.reflect.InvocationTargetException I think what this tells me that the Java Applet is in fact throwing an error. I'm just not sure how to figure out which one and how to solve it. …
has comment: http://stackoverflow.com/comment/33187528
accepted answer: http://stackoverflow.com/a/21958039

http://stackoverflow.com/comment/33088231
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21857206
has text: Why would it need to stay in the same Activity? If it's just an animation then surely there'd be no issues like passing values or params around making a new Activity harder to implement. Can you elaborate on what part of your design limits you to a single activity?
score: 2

http://stackoverflow.com/q/21967433
score: 3
upvote count: 3
tagged with: java
tagged with: http
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/21967596
answer count: 3
tagged with: http-get
has comment: http://stackoverflow.com/comment/33285939
has answer: http://stackoverflow.com/a/24047428
favorite count: 0
has body: I use API for connect information but I can't to get data from this API because I don' know How to use HTTP get connect with input username and password for access this data. Main String url = "http://flightxml.flightaware.com/json/FlightXML2/"; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); StrictMode.ThreadPolicy policy = new StrictMode. ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); TextView txt1 = (TextView)findViewById(R.id.textView1); String result = HttpGet(url); txt1.setText(result); } // Connect Http Get // public String HttpGet(String url) { StringBuilder builder = 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) { // Status OK HttpEntity entity = response.getEntity(); InputStream content = entity.getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(content)); String line; while ((line = reader.readLine()) != null) { builder.append(line);} } else { Log.e("Log", "Failed to download result.."); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return builder.toString(); }} In browser I can input username and password but in Android App I don't know How to input. same this pic. https://i.sstatic.net/63EBI.jpg
has answer: http://stackoverflow.com/a/21967807
tagged with: android
accepted answer: http://stackoverflow.com/a/21967596
possible better answer: http://stackoverflow.com/a/24047428
has title: How to use HTTP-GET connect with input username and password for access API
type: AnsweredQuestion

http://stackoverflow.com/a/21950789
accepted answer of: http://stackoverflow.com/q/21950645
has comment: http://stackoverflow.com/comment/33255858
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: When a multithreaded program is running, and there is some shared variable which isn't declared as volatile, what these threads do is create a local copy of the variable, and work on the local copy instead. So the changes on the variable aren't reflected. This local copy is created because cached memory access is much faster compared to accessing variables from main memory. When you declare a variable as volatile, it tells the program NOT to create any local copy of the variable and use the variable directly from the main memory. By declaring a variable as volatile, we are telling the system that its value can change unexpectedly from anywhere, so always use the value which is kept in the main memory and always make changes to the value of the variable in the main memory and not create any local copies of the variable. Note that volatile is not a substitute for synchronization, and when a field is declared volatile, the compiler and runtime are put on notice that this variable is shared and that operations on it should not be reordered with other memory operations. Volatile variables are not cached in registers or in caches where they are hidden from other processors, so a read of a volatile variable always returns the most recent write by any thread.
score: 8
upvote count: 8
has comment: http://stackoverflow.com/comment/33255812
answers question: http://stackoverflow.com/q/21950645

http://stackoverflow.com/comment/33239114
score: 0
type: Comment
has text: You also need to exchange `i` and `j` in and only in `drawEmbedded(...)`
type: AnswerComment
comment on: http://stackoverflow.com/a/21918723

http://stackoverflow.com/a/21982531
upvote count: 2
has body: You are looping the array with maximum of 25 and with 0, Change the maximum upto the size of the array and then initialize the i greater than zero otherwise you'll get ArrayIndexOutOfBoundsException Do like this for (int i = 1; i &lt;= a.length; i++) { System.out.println("random of i is" + a[rand.nextInt(i)] + "and j is " + b[rand.nextInt(i)]); }
answers question: http://stackoverflow.com/q/21982386
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/22002745
has body: Just make a getter method: public double getRadius() { return radius; }
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22002708
upvote count: 3

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/21983022
type: Tag

http://stackoverflow.com/comment/33294196
score: 0
comment on: http://stackoverflow.com/q/21972108
has text: Got it, Thank you RoHIT... I really appreciate this prompt help from your side...
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21869056
tagged with: python
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33114618
type: UnansweredQuestion
answer count: 0
downvote count: 0
score: 1
has title: run python code from android and return to android
favorite count: 0
type: Question
has body: hello currently am developing a app in pure native Android code. but i came across a python script that would be very useful in my project. So i want to use this in my android code. My question is: is it possible to call this piece of python code from android and return the result that the python script has put out to my android environment? PSEUDO PSUEDO CODE: Python p = new Python(); String resultOfPythonScript = p.execute("somescript.py"); Log.d(TAG, resultOfPythonScript);
tagged with: android

http://stackoverflow.com/a/21937115
upvote count: 1
has body: SOLVED: Instead of using Collections.singleton(PlusScopes.PLUS_ME), I used PlusScopes.all() and that got rid of the Rate Limit error. Strange, isn't it?
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21886517
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21886517
type: Answer
has comment: http://stackoverflow.com/comment/33319213

http://stackoverflow.com/comment/33379750
type: QuestionComment
type: Comment
has text: @Jeffrey - How would one go about adding n, where n>1, elements atomically?
score: 0
comment on: http://stackoverflow.com/q/22004059

http://stackoverflow.com/comment/33335088
has text: Okay Thanks. As you can see I have an AsyncTask right before that. I get the same exception in `onPostExecute` but can't use rootview. Should I put the `new Body().execute()` in `onActivityCreated`?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21995284
type: Comment

http://stackoverflow.com/q/21919177
upvote count: 1
type: Question
tagged with: android-fragments
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21920400
answer count: 1
downvote count: 0
has title: Fragment transition?
favorite count: 0
has comment: http://stackoverflow.com/comment/33200568
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has body: Any help would be great with my issue. Basically I'm using this tutorial and its a web view fragment. So I got rid of the WebView and made new activities. My issue is connection the activities with the drawer so then every thing goes to a different activity. Once again, any idea on how to do this would be helpful.
type: UnansweredQuestion

http://stackoverflow.com/comment/33156440
type: AnswerComment
type: Comment
has text: I took your new sample document and added the time stamping authority certificate to the trusted certificates in Adobe. Since then Adobe Reader has been happy with the time stamp. It is a test tsa after all, so you have to add it to your trusted certificates manually...
comment on: http://stackoverflow.com/a/21875456
score: 0

http://stackoverflow.com/a/21912490
upvote count: 3
downvote count: 2
answers question: http://stackoverflow.com/q/21912314
type: Answer
has body: It doesn't matter, but the concrete type is non-generic as indeed all types are non-generic at runtime. So, what concrete type (subclass) of List is being used here? Are there any guarantees? I don't think so, but ArrayList or LinkedList seem likely.
score: 1

http://stackoverflow.com/a/21880386
answers question: http://stackoverflow.com/q/21880107
has body: def myMatch(step: Int): Int = step match { case 0 =&gt; { dosomething(); myMatch(step + 1) } case 1 =&gt; { dosomethingMore(); myMatch(step + 1) } case 2 =&gt; etc() case _ =&gt; doSomethingElse(); } If the performance isn't critical, this should be fine.
upvote count: 5
type: Answer
downvote count: 0
score: 5

http://stackoverflow.com/comment/33330008
score: 0
type: Comment
type: QuestionComment
has text: no i just googled around a bit but its very confusing
comment on: http://stackoverflow.com/q/21992460

http://stackoverflow.com/q/21904707
tagged with: error-handling
accepted answer: http://stackoverflow.com/a/21904918
type: AnsweredQuestion
has body: I am trying to catch a specific exception using MySQL in Java. However, it is running the catch (SQLException ex) instead of the one I want it to. catch (MySQLIntegrityConstraintViolationException ex) { } catch (SQLException ex) { } Getting the following error, I would expect it to run the catch (MySQLIntegrityConstraintViolationException ex) function. 11:12:06 AM DAO.UserDAO createUser SEVERE: null com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'idjaisjddiaij123ij' for key 'udid' Why is it running catch (SQLException ex) instead of catch (MySQLIntegrityConstraintViolationException ex)?
has comment: http://stackoverflow.com/comment/33174669
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/56197365
type: Question
upvote count: 4
downvote count: 0
has title: Catching the wrong exception
favorite count: 0
has answer: http://stackoverflow.com/a/21904918
answer count: 5
tagged with: exception
has answer: http://stackoverflow.com/a/33070712
score: 4
has comment: http://stackoverflow.com/comment/33173261
possible better answer: http://stackoverflow.com/a/33070712
has answer: http://stackoverflow.com/a/31504057
has answer: http://stackoverflow.com/a/21905320

http://stackoverflow.com/comment/33246017
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21945229
has text: if you disable the 'AutoCompleteDecorator' (outcomment the line), is the error still present?
score: 0

http://stackoverflow.com/comment/43711002
has text: How about adding an example of the same but in a batch, say we're looping over a collection of books and publishers, preparing a batch to be executed outside the loop.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22001194
type: Comment

http://stackoverflow.com/q/21843117
has answer: http://stackoverflow.com/a/21843457
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21843697
has title: Android Bundle is shares memory?
score: 0
answer count: 2
has body: I using setArgument() / getArgument() for passing data from one fragment to another fragment. I stored ArrayList into bundle using Bundle.putParcelableArrayList(), and I founded they - putted data and get data - are equals on memory. Generally, I think, Parcelable source and regenerated(through CREATOR) instance is another instance, but they are same. If Bundle shares memory, Why bundle has several methods for supports variety datatypes- Why not just passing Object instance or using generic on Bundle?
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/35873101
type: AnswerComment
type: Comment
has text: @Nolesh Hi, just trying to understand your code, why do you rotate the worldTrans (what is it?) by +=0.1f every frame? And what is the fake cam? Thanks
score: 1
comment on: http://stackoverflow.com/a/22777350

http://stackoverflow.com/comment/33281950
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21958321
has text: I have added how the problem got resolved as an answer.Thanks :)

http://stackoverflow.com/comment/33235981
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21939531
has text: I have to admit I don't know, I only had to use the above but never had to limit the minimum number of characters :-/

http://stackoverflow.com/comment/33111101
type: AnswerComment
has text: Yep, didn't list all the possible things you could do in the block, cos I'd probably miss one ;-) `exit()`, `return` and `throw` are the most obvious.
comment on: http://stackoverflow.com/a/21869575
type: Comment
score: 0

http://stackoverflow.com/comment/33142110
has text: RAM actually does noz influence how fast the files are read/written on the disk. Especially, if the amount of files is relatively big (let's say 2 files per patient) compared to the numerical conputation, additional RAM ond/or processors won't help. FileIO is much, much slower than numerical/logical instructions.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21886997
type: Comment

http://stackoverflow.com/comment/33121048
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21874557
type: Comment
has text: And what you mean by that, @BoristheSpider, is "good luck, l33tspeak, with your classes on polymorphism."

http://stackoverflow.com/comment/33147633
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21889983
type: Comment
has text: this is not java. it is smali. and it looks much more logically to me too when it is decompiled back to java:

http://stackoverflow.com/comment/33268959
score: 0
type: Comment
type: QuestionComment
has text: But if it's an ArrayList you should use `.add(21*i)` not `[i] = 21*i`
comment on: http://stackoverflow.com/q/21958230

http://stackoverflow.com/comment/33072003
comment on: http://stackoverflow.com/a/21848191
type: Comment
score: 3
type: AnswerComment
has text: Besides, when user wants to clear data, the data should be cleared. There is no point to stop it.

http://stackoverflow.com/comment/122943901
has text: It might not be the case of the topic owner, but the error message is similar. Upvoted because this help me. Others might need this as well
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/68858464
type: Comment

http://stackoverflow.com/comment/33282528
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21965123
has text: I followed your suggestions and the program worked. However, I still get `OutOfMemory error:` `Java heap space` if I try to transfer files larger than 1GB. The program works for smaller files. Is there any way of making this work for large files?
type: AnswerComment

http://stackoverflow.com/q/21849174
has comment: http://stackoverflow.com/comment/33073806
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/21850284
type: Question
score: 5
upvote count: 5
tagged with: arrays
has body: I have a two dimensional JSON array object like below {"enrollment_response":{"condition":"Good","extra":"Nothig","userid":"526398"}} I would like to parse the above Json array object to get the condition, extra, userid.So i have used below code JSONParser parser = new JSONParser(); try { Object obj = parser.parse(new FileReader("D:\\document(2).json")); JSONObject jsonObject = (JSONObject) obj; String name = (String) jsonObject.get("enrollment_response"); System.out.println("Condition:" + name); String name1 = (String) jsonObject.get("extra"); System.out.println("extra: " + name1); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } Its throwing an error as "Exception in thread "main" java.lang.ClassCastException: org.json.simple.JSONObject cannot be cast to java.lang.String at com.jsonparser.apps.JsonParsing1.main(JsonParsing1.java:22)" Please anyone help on this issue.
has comment: http://stackoverflow.com/comment/33073723
has comment: http://stackoverflow.com/comment/33073904
answer count: 3
has answer: http://stackoverflow.com/a/21849630
downvote count: 0
has answer: http://stackoverflow.com/a/21850284
has comment: http://stackoverflow.com/comment/33073956
possible better answer: http://stackoverflow.com/a/21849407
has title: How to parse multidimensional json array in java
has comment: http://stackoverflow.com/comment/33074938
favorite count: 0
has answer: http://stackoverflow.com/a/21849407

http://stackoverflow.com/q/21854552
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/21854937
has body: I have a button on my screen and I'm using my own custom XML file to define how this button looks. The problem I come across is that when this button is pressed, the effect that usually shows the button in a pressed state does not occur. my XML file &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;corners android:bottomLeftRadius="7dp" android:bottomRightRadius="7dp" android:radius="7dp" android:topLeftRadius="7dp" android:topRightRadius="7dp" /&gt; &lt;solid android:color="@color/PaleGoldenrod"/&gt; &lt;/shape&gt; I'm not very familiar with this and google did not yield results because my question might be vague or I phrased it poorly.
answer count: 1
tagged with: button
tagged with: http://stackoverflow.com/tag/xml
tagged with: android
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/14023886
has title: How would I make my button who's shape is defined in my own XML file appear clickable?
tagged with: java
has answer: http://stackoverflow.com/a/21854937
has comment: http://stackoverflow.com/comment/33083739
duplicate of: http://stackoverflow.com/q/14023886

http://stackoverflow.com/q/21867404
tagged with: http-post
has body: I want to upload a video to app engine (blob store) via android. Currently when running , nothing happens (only thread executing but I do get a warning when running : VFY: unable to resolve static field 2678 (INSTANCE) in Lorg/apache/http/message/BasicHeaderValueParser; Any ideas to solve this ? Thanks ! Filepath for FileBody : /storage/emulated/0/test/djfff_20140219.mp4 This is my JSP : <%@ page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory" %> <%@ page import="com.google.appengine.api.blobstore.BlobstoreService" %> <% BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService(); %> Upload video <form action="<%= blobstoreService.createUploadUrl("/uploadUrl") %>" method="post" enctype="multipart/form-data"> Selecteer video This is my thread in Android : private static class uploadVideo extends AsyncTask<Void, Void, Void>{ String selectedPath; public uploadVideo(String selectedPath) { this.selectedPath = selectedPath; System.out.println(selectedPath); } @Override protected Void doInBackground(Void... params) { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://www.kinevub.appspot.com/video_upload.jsp"); FileBody filebodyVideo = new FileBody(new File(selectedPath)); MultipartEntity reqEntity = new MultipartEntity(); reqEntity.addPart("myFile", filebodyVideo); httppost.setEntity(reqEntity); try { httpclient.execute(httppost); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { // TODO Auto-generated method stub super.onPostExecute(result); } }
tagged with: google-app-engine
tagged with: android
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33107422
type: Question
has title: Uploading a video to App Engine
has comment: http://stackoverflow.com/comment/33107507
tagged with: java
has comment: http://stackoverflow.com/comment/33107569
has comment: http://stackoverflow.com/comment/33107319
score: 0

http://stackoverflow.com/a/21980939
has comment: http://stackoverflow.com/comment/33310589
type: Answer
answers question: http://stackoverflow.com/q/21980558
has comment: http://stackoverflow.com/comment/33315529
has comment: http://stackoverflow.com/comment/33309784
has comment: http://stackoverflow.com/comment/33311130
has body: You have exported the wrong path of JAVA_HOME. It should be the as below: export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64
has comment: http://stackoverflow.com/comment/33544207
has comment: http://stackoverflow.com/comment/33310222
has comment: http://stackoverflow.com/comment/33310110
score: 0

http://stackoverflow.com/q/21934994
tagged with: arraylist
tagged with: android
has comment: http://stackoverflow.com/comment/33227245
has comment: http://stackoverflow.com/comment/33226827
has body: I have this code ArrayList&lt;File&gt; internalPaths = new ArrayList&lt;File&gt;(); ArrayList&lt;File&gt; externalPaths = new ArrayList&lt;File&gt;(); for (int i = 0; i &lt; pathCounter; i++) { Log.e("PK", Integer.toString(pathCounter)); if (i == 0) { // first path String path = pathString.substring(commaPositions[i], commaPositions[i + 1] + 1); if (path.length() &gt; 7 &amp;&amp; path.substring(0,8).contains("storage")) { externalPaths.add(new File(path)); } else { internalPaths.add(new File(path)); } } } It is failing exactly on part else { internalPaths.add(new File(path)); } With exception: Invalid index 0, size is 0. I wonder how it is possible, as I have no problem with adding to externalPaths, but with internalPaths there is this error.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21990747
has comment: http://stackoverflow.com/comment/33226977
has title: Invalid index 0, size is 0. Can not add to arrayList
accepted answer: http://stackoverflow.com/a/21935251
has comment: http://stackoverflow.com/comment/33227148
downvote count: 1
has comment: http://stackoverflow.com/comment/33226920
type: Question
has comment: http://stackoverflow.com/comment/33227195
has comment: http://stackoverflow.com/comment/33226837
possible better answer: http://stackoverflow.com/a/21990747
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/33226989
answer count: 2
has comment: http://stackoverflow.com/comment/33227721
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21935251

http://stackoverflow.com/comment/33247195
type: QuestionComment
comment on: http://stackoverflow.com/q/21946042
type: Comment
has text: http://stackoverflow.com/questions/12734721/using-string-replace-in-java and http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#toUpperCase() just a start..
score: 0

http://stackoverflow.com/comment/33259550
has text: You need to use Directory watcher. Here is a link to tutorial: http://java.dzone.com/news/how-watch-file-system-changes
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21953022
score: 1

http://stackoverflow.com/a/21974349
has comment: http://stackoverflow.com/comment/33307767
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33297914
answers question: http://stackoverflow.com/q/21974162
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21974162
has body: inside manifest &lt;service android:enabled="true" android:name=".NotifyIntentService" /&gt; &lt;receiver android:name=".AlarmReciever"/&gt; inside Activity Intent intent = new Intent(this, AlarmReciever.class); AlarmManager alarm = (AlarmManager)getSystemService(ALARM_SERVICE); PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0); Calendar cal = Calendar.getInstance(); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MINUTE, 6); cal.set(Calendar.HOUR, 9); cal.set(Calendar.AM_PM, Calendar.PM); alarm.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pIntent); inside main project public class AlarmReciever extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Intent serviceIntent = new Intent(context, NotifyIntentService.class); startService(serviceIntent); } } intent service public class NotifyIntentService extends IntentService { @Override protected void onHandleIntent(Intent intent) { //your notification code //notify(); } } notification in all device
has comment: http://stackoverflow.com/comment/33297878
score: 1
downvote count: 0

http://stackoverflow.com/a/21965851
type: Answer
answers question: http://stackoverflow.com/q/21965837
score: 2
downvote count: 0
has body: You ask: but when the window goes off screen, the images that have been drawn have disappeared, and I have been wondering if there is a way to avoid that? This means that you have a bug in your code somewhere, in code that you're not in fact showing us. Perhaps you're drawing with a Graphics object that you've obtained by calling getGraphics() on a component, but all I can do is make a wild A$$ed guess at this point. If you are doing this, don't. Calling getGraphics() on a component will get you a Graphics object that will not persist on repeat paints, and will result in images that likewise don't persist. Draw instead in the paintComponent(Graphics g) method of a JPanel that is displayed in the JFrame as is well described in the Performing Custom Painting with Swing tutorials. But most important, please put just a little effort into asking your question so we don't have to guess at code not seen.
upvote count: 2

http://stackoverflow.com/a/21867823
type: Answer
answers question: http://stackoverflow.com/q/21867456
has body: You have a method called inputTriangleSides() in both class Triangle and class TriangleDriver. In your main program, you call the method in the Triangle class, which doesn't print out anything as you can see. Try TriangleDriver yourTriangle= new TriangleDriver(); yourTriangle.inputTriangleSides(); instead.
score: 0

http://stackoverflow.com/comment/33180745
type: QuestionComment
comment on: http://stackoverflow.com/q/21908610
score: 0
has text: If it does not work on dos command with command sqlplus user/password@SID then the user/password combination it self is wrong... try with a valid user/password.
type: Comment

http://stackoverflow.com/comment/33190052
comment on: http://stackoverflow.com/q/21914135
has text: Why are you putting a period?
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21861217
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33098121
type: Answer
has comment: http://stackoverflow.com/comment/33098077
has comment: http://stackoverflow.com/comment/33097711
accepted answer of: http://stackoverflow.com/q/21861136
score: 2
has comment: http://stackoverflow.com/comment/33095839
answers question: http://stackoverflow.com/q/21861136
has comment: http://stackoverflow.com/comment/33097972
has comment: http://stackoverflow.com/comment/33095347
has comment: http://stackoverflow.com/comment/33096008
has body: By the time the data has been read within Javascript, it will have the appropriate name. This is just an escape sequence, which doesn't change the value of the data. For example, in a Javascript console: var x = "foo\/bar"; var y = "foo/bar"; x == y // true I'm surprised that the forward slashes are being escaped - just "C:/Users/joao/..." would work fine - but it shouldn't make any difference to the actual value.
upvote count: 2
has comment: http://stackoverflow.com/comment/33096764
has comment: http://stackoverflow.com/comment/33095379

http://stackoverflow.com/comment/33105591
has text: They're completely different patterns. JavaBean: http://stackoverflow.com/q/3295496/139010
score: 0
comment on: http://stackoverflow.com/q/21866571
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33286527
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21966778
score: 0
has text: Ah ok, I thought you meant extending the existing LoadingCache. Thanks.

http://stackoverflow.com/comment/33363628
type: AnswerComment
score: 0
type: Comment
has text: deleting the annotation (@NotPersistent) in A class on the field "List a;" I do not get the NullPointerException more, but now I get: "Insert of object" A@1496569th "using statement" INSERT INTO `A` (`PROVA`, `ID`) VALUES (?,?) "failed: Duplicate entry '1a'for key' PRIMARY '" It may be because of how I made the constructor of B? check because the class "A" to the variable of type "A" and probably every time it creates a new one? http://pastebin.com/D4ch8ep3 I do not know what to do! :(
comment on: http://stackoverflow.com/a/21993611

http://stackoverflow.com/a/21842808
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21842723
answers question: http://stackoverflow.com/q/21842723
type: AcceptedAnswer
upvote count: 3
type: Answer
has body: I think that your problem is the default implementation of hashCode(), it may be based on the adress of the object. So, if you test two times (one with the overrided method, one without), you can have different results. If you try it like that: public class TestToString { public static void main(String[] args) { TestToString tts = new TestToString (); System.out.println(tts); System.out.println(tts.superToString()); } public String superToString() { return super.toString (); } @Override public String toString() { return getClass().getName()+"@"+Integer.toHexString(hashCode()); } } you will have the same result for the two methods: com.test.TestToString@8dc8569 com.test.TestToString@8dc8569

http://stackoverflow.com/q/22003084
possible better answer: http://stackoverflow.com/a/22003385
has comment: http://stackoverflow.com/comment/33350173
has answer: http://stackoverflow.com/a/22003385
tagged with: java
accepted answer: http://stackoverflow.com/a/22003452
downvote count: 3
has comment: http://stackoverflow.com/comment/33351363
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33349186
has comment: http://stackoverflow.com/comment/33349481
has comment: http://stackoverflow.com/comment/33349324
has comment: http://stackoverflow.com/comment/33349512
score: -2
has body: This is regarding another question: Java Recursion Bug? I am going crazy. I understand the solution there. But, why does C++ behaves differently than Java in this case? Can anybody please give exact pointers (no pun) to C++/Java specifications? I know that java assigns 0 to sum before each call, while C++ does it differently. But what's the specification which allows this? Edit: Adding code from link public class Test { public static int sum=0; public static int fun(int n) { if (n == 1) return 1; else sum += fun(n - 1); // this statement leads to weird output // { // the following block has right output // int tmp = fun(n - 1); // sum += tmp; // } return sum; } public static void main(String[] arg) { System.out.print(fun(5)); } } The output is 1 which should be 8. Relative C/C++ code is as follows: #include&lt;stdio.h&gt; int sum=0; int fun(int n) { if (n == 1) return 1; else sum += fun(n - 1); return sum; } int main() { printf("%d",fun(5)); return 0; } Output in C++ is 8.
has comment: http://stackoverflow.com/comment/33349346
linked to: http://stackoverflow.com/q/11813692
has comment: http://stackoverflow.com/comment/33349450
has comment: http://stackoverflow.com/comment/33349388
has comment: http://stackoverflow.com/comment/33349313
has comment: http://stackoverflow.com/comment/33441680
answer count: 3
has comment: http://stackoverflow.com/comment/33350057
has comment: http://stackoverflow.com/comment/33349642
has comment: http://stackoverflow.com/comment/33349801
has comment: http://stackoverflow.com/comment/33349258
has comment: http://stackoverflow.com/comment/33349914
has answer: http://stackoverflow.com/a/22003452
tagged with: operator-precedence
favorite count: 0
has answer: http://stackoverflow.com/a/22003473
has comment: http://stackoverflow.com/comment/33349143
has title: Order of evaluation for C++ vs Java
has comment: http://stackoverflow.com/comment/33349971
has comment: http://stackoverflow.com/comment/33351429
tagged with: c++
type: AnsweredQuestion

http://stackoverflow.com/q/21958040
has answer: http://stackoverflow.com/a/21958199
tagged with: mockito
accepted answer: http://stackoverflow.com/a/21958306
possible better answer: http://stackoverflow.com/a/21958199
score: 0
answer count: 2
has body: I have the following short code snippet which I try to do unit testing on it via mockito public String getExecutable() { String result = executable; String ex = !hasExtension() ? executable + ".bat" : executable; File f = new File( dir, ex ); if ( f.isFile() ) { result = ex; } return result; } The dir is an instance of the class File which is been given via constructor to the class so no problem. Only this line: File f = new File( dir, ex ); if ( f.isFile() ) { .. } So does exist any chance to mock out this via Mockito to make some tests on it so i can control the result of isFile()? Any idea?
has comment: http://stackoverflow.com/comment/33269575
has comment: http://stackoverflow.com/comment/33268692
has answer: http://stackoverflow.com/a/21958306
has comment: http://stackoverflow.com/comment/33268788
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33269607
has title: Creating File instance within code
tagged with: unit-testing
type: Question

http://stackoverflow.com/a/21863447
downvote count: 0
answers question: http://stackoverflow.com/q/21863364
upvote count: 2
has body: Make all of your objects extend an abstract class. Perhaps add a property check to skip this logic when not debugging( i.e. -Dmy.class.MyObjectDebugging=true ) public abstract class MyObject { StackTraceElements[] pob = null; long pobThreadID; public MyObject() { if( System.getProperty("my.class.MyObjectDebugging") != null ) { pob = Thread.currentThread().getStackTrace(); pobThreadID = Thread.currentThread().getId(); } } }
type: Answer
score: 2

http://stackoverflow.com/comment/33075990
comment on: http://stackoverflow.com/q/21849642
has text: @matcheek this is not only about lingpipe library but also about naive bayes.I want to classify all those data other than those belongs to c1,c2,c3 into the category "others". Iam just asking how can I implement it
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21995978
tagged with: network-programming
has comment: http://stackoverflow.com/comment/33340217
has comment: http://stackoverflow.com/comment/33340954
tagged with: security
has answer: http://stackoverflow.com/a/29865220
has comment: http://stackoverflow.com/comment/33338035
has comment: http://stackoverflow.com/comment/33338130
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33340408
has comment: http://stackoverflow.com/comment/33340188
favorite count: 0
has comment: http://stackoverflow.com/comment/33341214
upvote count: 2
type: UnansweredQuestion
has title: DDoS resistant network application design
has body: Okay, for my application I'm trying to decide on an architecture that's as DDoS resistant as possible. Obviously it will never be perfect but I'd like protection against simple attacks. There's a few that I've thought of so far: 1) Single thread per connection. This method seems to have unbelievable scalability problems, and with a tonne of connections, having too many threads seems like it would be a scheduling nightmare for the OS. 2) 2 threads. first thread will accept connections and append them to a list, the second thread loops through the list (with the proper synchro here) and checks if there's anything in the InputStream. Upon finding something, read a line. Any of the actual work will be done, including the reply, in a new event thread. The new thread is just passed the line that is read. This method seems to have even bigger problems. It appears as though a simple cat /dev/urandom | telnet server port would lock it down. 3) This is similar to #2, but only read a single byte from each connection at each iteration, and processing it as a string when I get to a newline byte. This seems like my best option so far, but it means that if the attack initiates a lot of connections and sends input on all of them, it could slow the loop down considerably. Are there any other potential architectures that might be better suited for the job?
score: 2
has comment: http://stackoverflow.com/comment/33340899
has comment: http://stackoverflow.com/comment/33340473
tagged with: java
type: Question

http://stackoverflow.com/a/41720264
has comment: http://stackoverflow.com/comment/70635239
score: 0
has body: I know this post is old, but maybe someone is still interested. My solution: XStream xstream = new XStream(new MyPureJavaReflectionProvider()); class MyPureJavaReflectionProvider extends PureJavaReflectionProvider { public MyPureJavaReflectionProvider() { this(new FieldDictionary(new ImmutableFieldKeySorter())); } public MyPureJavaReflectionProvider(FieldDictionary fieldDictionary) { super(fieldDictionary); } protected boolean fieldModifiersSupported(Field field) { int modifiers = field.getModifiers(); return !Modifier.isStatic(modifiers); } public boolean fieldDefinedInClass(String fieldName, Class type) { Field field = fieldDictionary.fieldOrNull(type, fieldName, null); return field != null &amp;&amp; fieldModifiersSupported(field); } }
type: Answer
answers question: http://stackoverflow.com/q/21929024

http://stackoverflow.com/a/21858137
score: 2
downvote count: 0
upvote count: 2
has body: You could always run the Java program from an applet. You might need to sign the applet and take care of permissions if you need filesystem or socket access.
answers question: http://stackoverflow.com/q/21858053
type: Answer

http://stackoverflow.com/a/21927540
score: 2
type: AcceptedAnswer
has body: I think what you're supposed to do is use Collections.EmptyList for comparisons and returning. for example: if (pointPath.equals(Collections.emptyList()){ return Collections.emptyList(); } I don't think it changes how your program will execute, but it makes the code readable and self-documenting.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21927438
answers question: http://stackoverflow.com/q/21927438
type: Answer
upvote count: 2

socketchannel
tags question: http://stackoverflow.com/q/22000818
tag name: socketchannel
tags question: http://stackoverflow.com/q/21897181
type: Tag
tags question: http://stackoverflow.com/q/21964363

http://stackoverflow.com/comment/33271773
comment on: http://stackoverflow.com/q/21959650
has text: ankit if you know the index then access using it otherwise you need to iterate
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/a/21928216
has body: Well the original code would give 4 if comparing "aa" to "aa". The code with Set#retainAll would however give 1 which might not be correct as well. Following code will give 2: char[] letters1 = name1.toCharArray(); char[] letters2 = name2.toCharArray(); Arrays.sort(letters1); Arrays.sort(letters2); int index1 = 0; int index2 = 0; int sameLetters = 0; while ((index1 &lt; letters1.length) &amp;&amp; (index2 &lt; letters2.length)) { switch (Integer.signum(Character.compare(letters1[index1], letters2[index2]))) { case -1: // Letter from name1 before letter from name2 ++index1; break; case 0: // Same letters in name1 and name2 ++index1; ++index2; ++sameLetters; break; case 1: // Letter from name1 after letter from name2 ++index2; break; } } System.out.println("Same letters: " + sameLetters);
score: 0
answers question: http://stackoverflow.com/q/21920137
type: Answer

http://stackoverflow.com/comment/33291143
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21970644
score: 0
has text: One main point is that java is case-sensitive on identifiers you need to be more attentive on what you type.

http://stackoverflow.com/comment/33065660
comment on: http://stackoverflow.com/q/21844307
type: Comment
has text: Typecast that to double average = (double)sum / 30;
type: QuestionComment
score: 0

http://stackoverflow.com/comment/46491813
score: 0
type: AnswerComment
type: Comment
has text: Yes, it works on non-vm environments. The file is dynamically generated and stored on disk with Fileoutputstream and out.close() before I pass the filename to download it.
comment on: http://stackoverflow.com/a/22730778

http://stackoverflow.com/comment/33282473
comment on: http://stackoverflow.com/q/21965293
score: 0
type: Comment
type: QuestionComment
has text: I am not able to invoke the Producer and Consumer threads since they reside in separate folders. I get a "cannot find symbol" error for Producer and Consumer.

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/21868389
tags question: http://stackoverflow.com/q/21954146
tags question: http://stackoverflow.com/q/21949879
tags question: http://stackoverflow.com/q/21890164
tags question: http://stackoverflow.com/q/22003338
tag name: android-actionbar
tags question: http://stackoverflow.com/q/21884675

http://stackoverflow.com/q/21869908
downvote count: 0
favorite count: 0
tagged with: jtabbedpane
linked to: http://stackoverflow.com/q/19787146
has answer: http://stackoverflow.com/a/21870484
upvote count: 3
has body: I am creating my own custom JTabbedPane object, with a simple little class that extends JTabbedPane. I have gotten a fair amount of this done, but recently found a problem, that being that the Title text for a tab does not auto align to the center of the Tab. And I want it to. Here is what it looks like: As I said, it's just an extension of JTabbedArea, like so: private static final long serialVersionUID = 1L; private String name; private final int width = 150, height = 50; public ColoredTabs(String paneName, int tabPlacement, String[] names, Color[] colors, JComponent[] components){ super(tabPlacement); this.name = paneName; if(names.length != components.length || names.length != colors.length || components.length != colors.length){ throw new IllegalArgumentException("The arguments for COMPONENTS, COLORS, and NAMES do not match up for '"+this.name+"'..."); } setFont(Resources.getFont()); setBackground(Color.YELLOW); for(int i = 0; i &lt; names.length; i++){ addTab(names[i], components[i]); setBackgroundAt(i, colors[i]); setIconAt(i, new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB))); } } The reason I go through the trouble of making the BufferedImage is to stretch the area of the Tab, for the ICON, maybe there is a way to center the text on the BufferedImage, any ideas?
tagged with: swing
tagged with: text
type: AnsweredQuestion
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/21870484
type: Question
has title: Java JTabbedPane align Title text to center
answer count: 1

http://stackoverflow.com/comment/33334720
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21994968
score: 0
has text: Always has size 30 the arrayOriginal.

http://stackoverflow.com/q/21951354
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/13815479
has comment: http://stackoverflow.com/comment/33256617
downvote count: 0
has comment: http://stackoverflow.com/comment/33256902
favorite count: 0
accepted answer: http://stackoverflow.com/a/21951488
has comment: http://stackoverflow.com/comment/33256639
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/12532056
has body: I am working on java application where I have a JTextArea in which I want the user to input in Punjabi language. At the backend, how does Java store that language and also could someone please make a small program illustrating that?
tagged with: java
tagged with: swing
tagged with: eclipse
answer count: 1
has title: How to type in different languages in JTextArea java?
has comment: http://stackoverflow.com/comment/33256716
has answer: http://stackoverflow.com/a/21951488
score: 2

http://stackoverflow.com/q/21923361
downvote count: 0
tagged with: string
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33207018
has answer: http://stackoverflow.com/a/41010747
has title: How to check a string contains only digits and one occurrence of a decimal point?
tagged with: regex
has comment: http://stackoverflow.com/comment/33206984
has answer: http://stackoverflow.com/a/21923485
has answer: http://stackoverflow.com/a/21923448
tagged with: java
has answer: http://stackoverflow.com/a/26059565
upvote count: 10
has answer: http://stackoverflow.com/a/21923424
type: Question
has body: My idea is something like this but I dont know the correct code if (mystring.matches("[0-9.]+")){ //do something here }else{ //do something here } I think I'm almost there. The only problem is multiple decimal points can be present in the string. I did look for this answer but I couldn't find how.
answer count: 8
has answer: http://stackoverflow.com/a/21923538
score: 10
has answer: http://stackoverflow.com/a/21923580
tagged with: decimal
has comment: http://stackoverflow.com/comment/33206987
has answer: http://stackoverflow.com/a/21923399

http://stackoverflow.com/a/21972692
answers question: http://stackoverflow.com/q/21972561
type: Answer
has body: grade [r][c-1] = Integer.parseInt(stToken.nextToken()); in this piece of code you are trying to access the nextToken again..this will move the tokenizer one step ahead of its current position. Instead you should do first check if that token is available and then access the token. Correct Way : if(stToken.hasNextToken()) { grade[r][c-1] = Integer.parseInt(stToken.nextToken()); }
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/a/22201631
answers question: http://stackoverflow.com/q/21974854
upvote count: 1
downvote count: 0
type: Answer
has body: You need to create a producer and put these values in a normal properties file instead. Look at @Produces This should probably have been tagged CDI too because some problems you solved with Seam is of course solved directly with CDI core and not Deltaspike. This example will get you there: Depedency inject request parameter with CDI and JSF2 Instead of producing from the request parameter map you will produce from your resourceBundle. I also think deltaspike may have a functionality for this either done or in the works but it would be good practice for you to write this producer and it is very minimal anyways
score: 1

http://stackoverflow.com/a/21957209
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21935073
has body: I would try using appfuse:gen-model: http://static.appfuse.org/plugins/appfuse-maven-plugin/gen-model-mojo.html Note, that AppFuse isn't great at creating relationships between classes, so you might have to do some work after it generates the code. You also might try searching the user mailing list archives: http://appfuse.547863.n4.nabble.com/AppFuse-User-f547864.html
answers question: http://stackoverflow.com/q/21935073
has comment: http://stackoverflow.com/comment/48103871
downvote count: 0

http://stackoverflow.com/comment/33279708
has text: @user3277779: Answer expanded.
comment on: http://stackoverflow.com/a/21963914
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/22003508
has body: I don't think that code would work correctly, first because in getAllPositions function you are returning something called "positions" which is not visible from there, and even if you returned "position", which is the position array, it seems to be empty... You could use LatLng class as follows public List&lt;LatLng&gt; getAllPositions() { List&lt;LatLng&gt; positionList = new ArrayList&lt;LatLng&gt;(); Cursor cursor = database.query(MySQLiteHelper.TABLE_NAME, allColumns, null, null, null, null, null); cursor.moveToFirst(); while (!cursor.isAfterLast()) { String positions = cursor.getString(1); double latitude = cursor.getColumnIndex("lat"); double longitude = cursor.getColumnIndex("long"); LatLng newLatLng = new LatLng(latitude, longitude); positionList.add(newLatLng); cursor.moveToNext(); } // make sure to close the cursor cursor.close(); return positionList; } And then: List&lt;LatLng&gt; positionToDraw = getAllPositions(); for(int i=0;i&lt;positiontoDraw.size();i++){ CircleOptions circleOptions = new CircleOptions().center(positionToDraw.get(i)); // [...] } Let me know if it helped. Regards
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22001026
type: Answer
answers question: http://stackoverflow.com/q/22001026
upvote count: 1
score: 1

http://stackoverflow.com/a/21944585
has comment: http://stackoverflow.com/comment/41165206
accepted answer of: http://stackoverflow.com/q/21944202
answers question: http://stackoverflow.com/q/21944202
has body: XML-less configuration of EhCache in Spring @Configuration @EnableCaching public class CachingConfig implements CachingConfigurer { @Bean(destroyMethod="shutdown") public net.sf.ehcache.CacheManager ehCacheManager() { CacheConfiguration cacheConfiguration = new CacheConfiguration(); cacheConfiguration.setName("myCacheName"); cacheConfiguration.setMemoryStoreEvictionPolicy("LRU"); cacheConfiguration.setMaxEntriesLocalHeap(1000); net.sf.ehcache.config.Configuration config = new net.sf.ehcache.config.Configuration(); config.addCache(cacheConfiguration); return net.sf.ehcache.CacheManager.newInstance(config); } @Bean @Override public CacheManager cacheManager() { return new EhCacheCacheManager(ehCacheManager()); } @Bean @Override public KeyGenerator keyGenerator() { return new SimpleKeyGenerator(); } @Bean @Override public CacheResolver cacheResolver() { return new SimpleCacheResolver(); } @Bean @Override public CacheErrorHandler errorHandler() { return new SimpleCacheErrorHandler(); } } Alternatively for testing, you can use a simple ConcurrentMapCache running without XML as below. @Configuration @EnableCaching public class CachingConfig implements CachingConfigurer { @Bean @Override public CacheManager cacheManager() { SimpleCacheManager cacheManager = new SimpleCacheManager(); List&lt;Cache&gt; caches = new ArrayList&lt;Cache&gt;(); caches.add(new ConcurrentMapCache("myCacheName")); cacheManager.setCaches(caches); return cacheManager; } @Bean @Override public KeyGenerator keyGenerator() { return new SimpleKeyGenerator(); } @Bean @Override public CacheResolver cacheResolver() { return new SimpleCacheResolver(); } @Bean @Override public CacheErrorHandler errorHandler() { return new SimpleCacheErrorHandler(); } } Edit: Updated to add shutdown method on underlying cache Edit: Added configuration for error handler and cache resolver Edit: changing constructor call on SimpleCacheResolver which resolves CacheManager must not be null issue (Spring v5.1+) @Configuration @Enab…
upvote count: 52
has comment: http://stackoverflow.com/comment/41376871
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/77567472
downvote count: 0
has comment: http://stackoverflow.com/comment/41165359
has comment: http://stackoverflow.com/comment/53751297
has comment: http://stackoverflow.com/comment/97171307
has comment: http://stackoverflow.com/comment/77990576
type: Answer
has comment: http://stackoverflow.com/comment/35119878
has comment: http://stackoverflow.com/comment/41164467
score: 52
has comment: http://stackoverflow.com/comment/62150253

http://stackoverflow.com/comment/33269062
score: 0
comment on: http://stackoverflow.com/a/21958183
type: AnswerComment
type: Comment
has text: And add an image to my drawables?

web-services
tags question: http://stackoverflow.com/q/21991788
type: Tag
tags question: http://stackoverflow.com/q/21887954
tags question: http://stackoverflow.com/q/21911302
tags question: http://stackoverflow.com/q/21848394
tags question: http://stackoverflow.com/q/21938278
tags question: http://stackoverflow.com/q/21867120
tags question: http://stackoverflow.com/q/21999041
tags question: http://stackoverflow.com/q/21932333
tags question: http://stackoverflow.com/q/21933182
tags question: http://stackoverflow.com/q/21946520
tags question: http://stackoverflow.com/q/21979805
tags question: http://stackoverflow.com/q/21843595
tags question: http://stackoverflow.com/q/21857758
tags question: http://stackoverflow.com/q/21882548
tags question: http://stackoverflow.com/q/21884051
tags question: http://stackoverflow.com/q/21985038
tags question: http://stackoverflow.com/q/21847525
tags question: http://stackoverflow.com/q/21944462
tags question: http://stackoverflow.com/q/21934250
tags question: http://stackoverflow.com/q/21871847
tags question: http://stackoverflow.com/q/21987322
tags question: http://stackoverflow.com/q/21851565
tags question: http://stackoverflow.com/q/21968777
tags question: http://stackoverflow.com/q/21996776
tags question: http://stackoverflow.com/q/21855407
tags question: http://stackoverflow.com/q/21944321
tags question: http://stackoverflow.com/q/21992985
tags question: http://stackoverflow.com/q/21911776
tags question: http://stackoverflow.com/q/21940826
tags question: http://stackoverflow.com/q/21888354
tags question: http://stackoverflow.com/q/21915941
tags question: http://stackoverflow.com/q/21872021
tags question: http://stackoverflow.com/q/21993187
tags question: http://stackoverflow.com/q/21861263
tag name: web-services
tags question: http://stackoverflow.com/q/21935292
tags question: http://stackoverflow.com/q/21994504
tags question: http://stackoverflow.com/q/21845266
tags question: http://stackoverflow.com/q/21887979
tags question: http://stackoverflow.com/q/21883042
tags question: http://stackoverflow.com/q/21927744
tags question: http://stackoverflow.com/q/21944486
tags question: http://stackoverflow.com/q/21955621
tags question: http://stackoverflow.com/q/21860513
tags question: http://stackoverflow.com/q/21897419
tags question: http://stackoverflow.com/q/21898902
tags question: http://stackoverflow.com/q/21900965

http://stackoverflow.com/q/21960236
upvote count: 5
has title: jSpinner time picker model editing
answer count: 2
has answer: http://stackoverflow.com/a/21960677
has comment: http://stackoverflow.com/comment/33276164
downvote count: 0
favorite count: 0
tagged with: timepicker
has body: I have jSpinner using for time picking. Problem 1: User can edited hour minutes and second seperator ":" and can write extra digits like "123" Problem 2: model get always current time. I want "00:00:00" When i write this in code instead "hh:mm:ss" user can't edit the values. My Code is; spinner1 = new javax.swing.JSpinner(); SpinnerDateModel spinnermodel = new SpinnerDateModel(); spinnermodel.setCalendarField(Calendar.MINUTE); spinner1 .setModel(spinnermodel); spinner1 .setEditor(new JSpinner.DateEditor(spinner1 , "hh:mm:ss")); Any help appreciated. Thanks.
has comment: http://stackoverflow.com/comment/33274636
score: 5
accepted answer: http://stackoverflow.com/a/21960677
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33277989
tagged with: jspinner
tagged with: java
has comment: http://stackoverflow.com/comment/33273595
tagged with: swing
possible better answer: http://stackoverflow.com/a/36021771
has comment: http://stackoverflow.com/comment/33273484
has answer: http://stackoverflow.com/a/36021771
type: Question
linked to: http://stackoverflow.com/q/11881301

http://stackoverflow.com/comment/33135175
type: QuestionComment
has text: you should not http://developer.android.com/reference/android/app/Fragment.html#isAdded()
comment on: http://stackoverflow.com/q/21882840
score: 0
type: Comment

http://stackoverflow.com/comment/33197895
score: 0
type: Comment
type: QuestionComment
has text: _"Network is unreachable"_ is a very low-level message indicating there's no route to the remote host. Please edit your post and show (copy/paste) the result of the commands `telnet 172.16.200.60 25` and `traceroute 172.16.200.60` (on Windows use `tracert 172.16.200.60`)
comment on: http://stackoverflow.com/q/21918007

http://stackoverflow.com/a/21888416
score: 0
type: Answer
has body: Lets say you have an ArrayList and you have a few classes that implement CarDAO. These Classes could be Car1, Car2, and Car3. Since they all implement the class CarDAO they can all be added to the ArrayList previously stated. Also you can iterate through all of the CarDAO implementations and call the methods in common since they all inherit the methods of CarDAO
answers question: http://stackoverflow.com/q/21888318

http://stackoverflow.com/q/21897181
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21897847
score: 1
tagged with: java
tagged with: socketchannel
tagged with: nio
has title: How to make sure the SocketChannel is really connected when using NIO?
type: Question
has answer: http://stackoverflow.com/a/21897847
answer count: 1
downvote count: 0
tagged with: selector
favorite count: 0
tagged with: broken-pipe
has body: I'm working on a NIO client program on Android, Basically it functions well, but when the network is not avaliable(WIFI is disabled, etc), I have no idea how to distinguish the socket is 'really' connected, SocketChannel.finishConnect() always returns true even there is no avaliable network.If I try to write to a unconnected SocketChannel, an Broken pipe exception will happen. So I wonder how to make sure the SocketChannel is really connected?
upvote count: 1

http://stackoverflow.com/comment/33175141
score: 0
type: Comment
type: QuestionComment
has text: I know ur using it in wrong manner...SeasonResults.java should not be like that ..and usage of result in if(result.equals("HW")) also not at all correct
comment on: http://stackoverflow.com/q/21887622

http://stackoverflow.com/comment/33251503
has text: Caused by: java.lang.ArrayIndexOutOfBoundsException: length=5; index=5 , can you post your code?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21948462
score: 0

http://stackoverflow.com/q/21963972
tagged with: memory-management
tagged with: garbage-collection
possible better answer: http://stackoverflow.com/a/21963999
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21963999
tagged with: performance
has answer: http://stackoverflow.com/a/21964481
accepted answer: http://stackoverflow.com/a/21964011
tagged with: java
upvote count: 1
tagged with: memory
downvote count: 1
type: Question
has body: If a variable points to a null reference in memory, then Java Garbage Collection will deallocate the memory, when it runs (which is nearly never known.) Thus, is it more efficient to point an object to a null reference when you're done using it in a method, or is it better to have one allocation as a class variable? For example, is it better to do this: private TestFile TestFile = new TestFile(); public class Configuration{ //Methods accesing 'TestFile' } } or public class Configuration{ public void getFileName(){ TestFile TestFile = new TestFile(); TestFile.getName(); TestFile = null; } public void setFileName(String name){ TestFile TestFile = new TestFile(); TestFile.setName(name); TestFile = null; } } } I'm not sure if, for the second example, you have to restate the constructor in each method, but my reasoning is that if the constructor variable points to null, and is removed, there's a high change for a NullPointerException to be thrown almost always (again, GC is extremely sophisticated, and nearly impossible to predict.) Lastly, I would NOT ever want to run the GC method, from my understanding, as it can mess up the schedule that GC has set, as well as cost more performance to run the method, than the resources it's collecting prematurely would. Thanks for the help!
score: 0
answer count: 3
has title: Is it more efficient to point objects to a null reference, and realocate the memory, or to allocate the memory only once?
has answer: http://stackoverflow.com/a/21964011
favorite count: 0

http://stackoverflow.com/a/21952776
has comment: http://stackoverflow.com/comment/33259244
has comment: http://stackoverflow.com/comment/33259229
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/33259287
has comment: http://stackoverflow.com/comment/33259267
upvote count: 1
has body: For one String, you can do: private static final BigDecimal ONE_HUNDRED = new BigDecimal(100); // In code: new BigDecimal(inputString).multiply(ONE_HUNDRED).intValueExact(); Note the use of BigDecimal here; a double will NOT do. Note also that it will work only if the input has at most two decimal digits: if more than that, .intValueExact() will throw an exception (it will also throw an exception if the decimal integer is out of bounds for an int). Now, it depends on how precise you need to be; this method guarantees the results. The method to remove dots and parse as int is obviously faster ;)
answers question: http://stackoverflow.com/q/21952750

http://stackoverflow.com/q/21854471
has comment: http://stackoverflow.com/comment/33082992
possible better answer: http://stackoverflow.com/a/21854632
has answer: http://stackoverflow.com/a/21854649
type: Question
has answer: http://stackoverflow.com/a/21854701
score: -2
tagged with: java
has title: Array Out of Bound Index Error
accepted answer: http://stackoverflow.com/a/21854590
upvote count: 0
has comment: http://stackoverflow.com/comment/33082839
has answer: http://stackoverflow.com/a/21854632
favorite count: 0
has answer: http://stackoverflow.com/a/21854590
has body: I am attempting to find the occurrence frequency of a number in a sequence. for example when sequence is : 1, 1, 3, 4 output should be 1 found 3 times , 3 found 1 times , 4 found 1 time and so on. I have the following code import java.util.*; class fre { public static void main(String a[]) { int c = a.length; int d[] = new int[c]; int num = 0; for (int p = 0; p &lt; c; p++) d[p] = Integer.parseInt(a[p]); for (int z : d) System.out.println(z); for (int i = 0; i &lt; c - 1; i++) // FROM THIS LINE ERROR IS THROWN { for (int t = 0; t &lt; c - 1; i++) { if (d[i] == d[t]) { num++; } } System.out.println("the element" + i + "found" + num + "times"); } } } ERROR : ARRAY OUT OF BOUND INDEX
has comment: http://stackoverflow.com/comment/33083002
has comment: http://stackoverflow.com/comment/33082895
answer count: 4
type: AnsweredQuestion
downvote count: 2

http://stackoverflow.com/comment/33283151
has text: I thought that when you said that you decrease the variable value from 0.5 to 0.4, it meant dynamic decrement. :D
type: AnswerComment
comment on: http://stackoverflow.com/a/21965742
score: 0
type: Comment

http://stackoverflow.com/q/21987948
upvote count: 1
linked to: http://stackoverflow.com/q/7926864
has body: I have learnt the concepts of Future ,Fork and Join. Can someone explain differences/similarities between these two. Where to apply which concept.
type: Question
has comment: http://stackoverflow.com/comment/33321601
tagged with: java
has answer: http://stackoverflow.com/a/21988291
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33321678
has title: Concurrent Programming in Java : Future Vs Fork/Join
has comment: http://stackoverflow.com/comment/33321558
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/33322192
has text: Sure! It's updated with the output :)
comment on: http://stackoverflow.com/q/21973396
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33230356
type: Comment
comment on: http://stackoverflow.com/q/21936973
score: 0
type: QuestionComment
has text: The class is 500 lines long but I will get the relevant lines now

http://stackoverflow.com/comment/33297669
score: 0
type: Comment
type: QuestionComment
has text: I am aware of some, but now my code will not let me add an else statement after the first system.out.println. It will also print the line I have even if the combination does not match any of the above requirements
comment on: http://stackoverflow.com/q/21973163

http://stackoverflow.com/q/21962531
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/21962573
type: Question
has title: FileNotFoundException thrown when downloading file from URL
has body: So I want to download a file from a permanent URL and then save it locally so I can access it later to write into an SQLite database. I have an AsynchTask class that handles this functionality but I'm getting a FileNotFoundException error all the time (see Logcat). Download CSV file class private class CSVFileDownloader extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected Void doInBackground(Void... params) { try { DefaultHttpClient httpClient = new DefaultHttpClient(); httpClient.getCredentialsProvider().setCredentials( new AuthScope(null, -1), new UsernamePasswordCredentials("username", "password")); HttpContext localContext = new BasicHttpContext(); HttpGet httpGet = new HttpGet("http://www.cardigan.cc/app/locations.csv"); //GET FILE FROM URL AND WRITE TO LOCATIONS.CSV LOCALLY HttpResponse response = httpClient.execute(httpGet); HttpEntity entity = response.getEntity(); if(entity != null){ BufferedInputStream bis = new BufferedInputStream(entity.getContent()); filename = "locations.csv"; BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(filename))); int inByte; while((inByte = bis.read()) != -1) bos.write(inByte); bis.close(); bos.close(); } else if(entity == null) { System.out.println("NO FILE DOWNLOADED FROM SERVER"); } } catch (IOException e) { e.printStackTrace(); } return null ; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); //LOAD CSV FILE try { file = new FileReader(filename); //CREATE READ FOR LOCATIONS.CSV FILE A.K.A filename } catch (FileNotFoundException e1) { e1.printStackTrace(); } } } And the resulting LogCat printout: 02-23 00:12:16.550: W/System.err(28119): java.lang.NullPointerException: lock == null 02-23 00:12:16.610: W/System.err(28119): at java.io.Reader.&lt;init&gt;(Reader.java:64) 02-23 00:12:16.610: W/System.err(28119): at java.io.BufferedReader.&lt;init&gt;(BufferedReader.java:92) 02-23 00:12:1…
score: 0
tagged with: sqlite
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion

http://stackoverflow.com/q/21994640
has answer: http://stackoverflow.com/a/21994725
has body: I've tried textArea.setText(); but that doesn't work. I really have no idea what else to do. I know there is probably some simple way to do this but i'm stumped. please help. i know java. but swing just confuses me. import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import java.awt.GridLayout; import javax.swing.JLabel; import javax.swing.SwingConstants; import javax.swing.JTextField; import javax.swing.JTextArea; import javax.swing.JButton; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class GeoUI extends JFrame{ private static final long serialVersionUID = 1L; private JPanel contentPane; private JTextField textField; private JTextField textField_1; final JTextArea textArea = new JTextArea(); /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { GeoUI frame = new GeoUI(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public GeoUI() { setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 150); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(new GridLayout(0, 3, 0, 0)); JPanel panel = new JPanel(); contentPane.add(panel); panel.setLayout(new GridLayout(3, 1, 0, 0)); JLabel lblRadiussidelength = new JLabel("Radius/SideLength:"); lblRadiussidelength.setHorizontalAlignment(SwingConstants.CENTER); panel.add(lblRadiussidelength); JLabel lblShape = new JLabel("Shape:"); lblShape.setHorizontalAlignment(SwingConstants.CENTER); panel.add(lblShape); JPanel panel_1 = new JPanel(); contentPane.add(panel_1); panel_1.setLayout(new GridLayout(3, 1, 0, 0)); textField_1 = new JTextField(); panel_1.add(textField_1); textField_1.setColumns(10); textField = new JTextField(); panel_1.add(textField); textField.setColumns(1…
tagged with: swing
tagged with: java
type: Question
answer count: 2
score: 0
has title: I want to make it so if i hit btnNewButton it changes the text on textArea
has answer: http://stackoverflow.com/a/21994971
tagged with: jframe
type: UnansweredQuestion

http://stackoverflow.com/a/28764844
has comment: http://stackoverflow.com/comment/45811440
downvote count: 0
has comment: http://stackoverflow.com/comment/45809131
has comment: http://stackoverflow.com/comment/45810542
has comment: http://stackoverflow.com/comment/45824392
has comment: http://stackoverflow.com/comment/45811737
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21850359
has comment: http://stackoverflow.com/comment/45812947
score: 1
has body: If you do mvn dependency:tree you'll see that org.osgl:osgl-storage:jar:0.3-SNAPSHOT is bringing org.osgl:osgl-tool:jar:0.3-SNAPSHOT as a dependency too, which will conflict with you own version of this same artifact. [INFO] org.osgl:osgl-tool:jar:0.4.1-SNAPSHOT [INFO] +- junit:junit:jar:4.10:test [INFO] | \- org.hamcrest:hamcrest-core:jar:1.1:test [INFO] +- commons-codec:commons-codec:jar:1.8:compile [INFO] +- com.carrotsearch:junit-benchmarks:jar:0.7.2:test [INFO] \- org.osgl:osgl-storage:jar:0.3-SNAPSHOT:provided [INFO] +- org.osgl:osgl-tool:jar:0.3-SNAPSHOT:provided [INFO] \- org.osgl:osgl-logging:jar:0.2:provided All you need to do is tell Maven to exclude this transitive dependency: org.osgl osgl-storage 0.3-SNAPSHOT provided org.osgl osgl-tool What happened is you had two versions of the same artifact together (your 0.4.1-SNAPSHOT and the other 0.3-SNAPSHOT version). The solution above excludes the 0.3-SNAPSHOT version brought transitively by org.osgl:osgl-storage:jar:0.3-SNAPSHOT. You also created a cyclic dependency by making your org.osgl:osgl-tool depend on org.osgl:osgl-storage, since org.osgl:osgl-storage originally depends on org.osgl:osgl-tool. org.osgl:osgl-storage <──┐ ... you added this dependency │ │ └──> org.osgl:osgl-tool Your org.osgl.util.IO class is the one that depends on org.osgl.storage.ISObject and org.osgl.storage.impl.SObject. You should avoid cyclic dependencies if you don't want further issues. EDIT: Regarding the _ class, it has a valid name. But if such name is being used to avoid repeating a long class name, like in your example: void foo(_.Func2<Integer, String> f) { F2<Integer, String> newF = _.f2(f); ... } then you should consider renaming the class and using static imports: import static org.osgl.Osgl.*; // Osgl instead of _ void foo(Func2<Integer, String> f) { // Func2 statically imported F2<Integer, String> newF = f2(f); // f2 statically imported ... }

http://stackoverflow.com/a/21967993
accepted answer of: http://stackoverflow.com/q/21967944
type: Answer
has comment: http://stackoverflow.com/comment/37880683
answers question: http://stackoverflow.com/q/21967944
upvote count: 1
score: 1
has body: There must be a listener class/interface defined as IotdHandlerListener. Couldn't see that in imports. The IotdHandler cannot identify it from where it is declared. Either you need to define/code it or import it, if already exists. In using Eclipse, press Ctrl+Shift+O to automatically arrange your imports.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33287221

http://stackoverflow.com/a/21956461
has comment: http://stackoverflow.com/comment/33353135
has comment: http://stackoverflow.com/comment/33400025
has comment: http://stackoverflow.com/comment/33360230
accepted answer of: http://stackoverflow.com/q/21941156
has comment: http://stackoverflow.com/comment/33410917
upvote count: 2
answers question: http://stackoverflow.com/q/21941156
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33298195
has body: Here is another https://stackoverflow.com/help/mcve (I started this "yesterday" at ~3:00 am, obviously Andrew Thompson is in a different time zone ;-)) The basic idea here is as follows: The two given points define a line. That is, an infinite line, and not only a line segment. The corner points of the bounding box of the object are projected on this line and its perpendicular. This gives (an upper bound of) the extent of the object along these lines. These upper bounds can be used to define the "minimum half-spaces" above and below the line that are required to cover the respective half of the object. These half-spaces can then be intersected with the object to obtain the desired results. The split method in this example receives a Graphics2D parameter. This is only used for "debugging" - that is, to show the intermediate results (extents, half-spaces) that are computed, and a preview of the final results. This Graphics g parameter (and the corresponding debugging output) can simply be removed (but it might also help to show the idea of the approach). import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Shape; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import java.awt.geom.AffineTransform; import java.awt.geom.Area; import java.awt.geom.Ellipse2D; import java.awt.geom.Line2D; import java.awt.geom.Path2D; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class ShapeSplit { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); } private static void createAndShowGUI() { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new ShapeSplitPanel()); f.setSize(1100,600); f.setLocationRelativeTo(null); f.setVisible(true); } } class ShapeSplitPanel extends JPanel i…
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33294973

http://stackoverflow.com/comment/33247351
type: Comment
has text: @user3338991 Although there's no condition between the `nextInt` and the print, the scanner already knows that `nextInt` would succeed, because it knows that the loop condition holds. When you call `hasNextInt` and get a `true` back, the scanner already has that `int`, it just haven't given it to you, because you didn't ask. The condition inside a `while` loop is a real condition, it is checked before the first entry, and each time the control goes back to the top of the loop. So you can retrace this with paper and pencil - prompt, check, scan, print, prompt, check, scan, print, prompt, etc.
comment on: http://stackoverflow.com/a/21945533
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33363030
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22010329
has text: i was trying to provide a hint.

http://stackoverflow.com/a/21979562
downvote count: 0
score: 1
type: Answer
has body: Just put it in a for loop. A for loop is used for repeating stuff when you know at the beginning how often you want to repeat. See this answer to a related question for lots of examples for various for loops.
accepted answer of: http://stackoverflow.com/q/21979534
upvote count: 1
has comment: http://stackoverflow.com/comment/33307179
answers question: http://stackoverflow.com/q/21979534
has comment: http://stackoverflow.com/comment/33307152
type: AcceptedAnswer

http://stackoverflow.com/a/21996650
score: 0
has body: static ArrayList&lt;String&gt; capture = new ArrayList&lt;String&gt;(); You can't add the Flight class object in capture list which can only contain element in String type. Flight f = new Flight(singleRowArray[]); capture.add(f); // Issue -----------------^
answers question: http://stackoverflow.com/q/21996598
type: Answer

http://stackoverflow.com/a/21963318
upvote count: 3
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/33278562
has comment: http://stackoverflow.com/comment/33278512
score: 3
has comment: http://stackoverflow.com/comment/33278576
answers question: http://stackoverflow.com/q/21963300
has body: you can say private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { String mess = message.getText(); System.out.println(mess); log.append(mess); } append() function Appends the given text to the end of the document.
has comment: http://stackoverflow.com/comment/33278284

http://stackoverflow.com/a/21930128
type: Answer
has body: I've managed to find the solution. I only have to change this line builder.addPart("userfile", fb); to builder.addPart("userfile[]", fb); because on the server side, $_FILES['userfile'] receives array type. Thank you.
answers question: http://stackoverflow.com/q/21874740
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21874740
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/21988903
has comment: http://stackoverflow.com/comment/33323134
has comment: http://stackoverflow.com/comment/33326237
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21988341
upvote count: 2
has body: Why not try this: import java.util.ArrayList; public class Iteration { private ArrayList&lt;ArrayList&lt;String&gt;&gt; array; public Iteration() { array = new ArrayList&lt;&gt;(); array.add(new ArrayList&lt;String&gt;()); array.get(0).add("000"); array.get(0).add("001"); array.get(0).add("010"); array.add(new ArrayList&lt;String&gt;()); array.get(1).add("100"); array.get(1).add("101"); array.get(1).add("110"); array.get(1).add("111"); iterateRowWise(); System.out.println("\n\n"); iterateColumnWise(); } public void iterateRowWise() { // This uses iterator behind the scene. for (ArrayList&lt;String&gt; row : array) { for (String element : row) { System.out.print(element + " "); } System.out.println(); } } public void iterateColumnWise() { int arraySize = array.size(); int maxColumns = getMaximumListSize(); for (int c = 0; c &lt; maxColumns; c++) { for (int r = 0; r &lt; arraySize; r++) { ArrayList&lt;String&gt; rowList = array.get(r); if (c &lt; rowList.size()) { System.out.print(rowList.get(c) + " "); } } System.out.println(); } } private int getMaximumListSize() { int maxListSize = 0; for (ArrayList&lt;String&gt; rowList : array) { if (maxListSize &lt; rowList.size()) maxListSize = rowList.size(); } return maxListSize; } public static void main(String[] args) { new Iteration(); } } The iterateRowWise() method iterates using the iterator, but it does so behind the scene. The iterateColumnWise() method doesn't use iterator, but its safe to use.

http://stackoverflow.com/a/21961846
answers question: http://stackoverflow.com/q/21961845
score: 0
type: Answer
has body: I would try to keep it simple. I is a GameEvent&lt;TYPE, ATT&gt; which can be entirely deducted from TYPE and ATT. So I'd just remove I and write: public interface GameEventHandler&lt;TYPE extends Enum&lt;?&gt;, ATT extends Enum&lt;?&gt;&gt; { public void handleEvent(final GameEvent&lt;TYPE, ATT&gt;... e); public void registerListener(final GameEventListener&lt;TYPE, ATT&gt; listener, final TYPE... type); public void unregisterListener(final GameEventListener&lt;TYPE, ATT&gt;... listener); public void unregisterAllListener(); public void unregisterAllListener(final GameEvent&lt;TYPE, ATT&gt;... type); public void processEvents(); public void processEvents(final int maxTimeInMS); } public class GameEventListener&lt;TYPE extends Enum&lt;?&gt;, ATT extends Enum&lt;?&gt;&gt; { } public enum EventTypes {} public enum AttributeTypes {} public class DefaultGameEventHandler implements GameEventHandler&lt;EventTypes, AttributeTypes&gt; { }

http://stackoverflow.com/comment/33263699
type: QuestionComment
type: Comment
has text: I believe there's a major misunderstanding. The pool is already created and stored during application's startup! With `context.lookup()` you're just obtaining a reference to it ... A cleaner way is using `@Resource`.
comment on: http://stackoverflow.com/q/21908088
score: 1

stack-trace
tags question: http://stackoverflow.com/q/21872507
type: Tag
tag name: stack-trace

http://stackoverflow.com/q/21975618
linked to: http://stackoverflow.com/q/23056091
favorite count: 0
tagged with: spring-data-jpa
tagged with: spring-data-rest
answer count: 3
type: UnansweredQuestion
score: 11
tagged with: spring
has answer: http://stackoverflow.com/a/46862146
downvote count: 0
tagged with: java
has body: Is there a way to return the full details of a joined entity instead of a link? In the example below I want to also return the details of the product, if I have list of 100 purchases, it would avoid having to make 100 calls to get the product details. The repositories for Product, User and Purchase entities are all created using spring-data-jpa { "_embedded" : { "purchase" : [ { "_links" : { "product" : { "href" : "http://localhost:8080/webapp/purchase/1/product" }, "user" : { "href" : "http://localhost:8080/webapp/purchase/1/user" } }, "purchasedOn" : "2014-02-23", "amount" : 1 } ] } } Entities and Repositories; @Entity public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, targetEntity = Purchase.class, orphanRemoval = true) @JoinColumn(name = "user_id", updatable = false) private List&lt;Purchase&gt; purchases = new ArrayList&lt;&gt;(); } @Entity public class Product { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String name; } @Entity public class Purchase implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Long id; @ManyToOne @JoinColumn(name = "user_id", referencedColumnName = "id") private User user; @ManyToOne(fetch = FetchType.EAGER, targetEntity = Product.class) @JoinColumn(name = "product_id", referencedColumnName = "id") private Product product; @Column(name = "purchase_date") private Date purchaseDate; private Integer amount; } @Repository public interface PurchaseRepository extends JpaRepository&lt;Purchase, Long&gt; {}
upvote count: 11
type: Question
duplicate of: http://stackoverflow.com/q/23056091
has answer: http://stackoverflow.com/a/21976057
has answer: http://stackoverflow.com/a/22066091
has title: spring-data-rest, can you provide full details of entity instead of (or with) link

http://stackoverflow.com/a/21938030
answers question: http://stackoverflow.com/q/21931318
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33232641
has body: Create a factory that will give you an instance of your interface. Within the factory you check the java.version system property. If it is &gt;= 8 then you will instantiate the interface implementation for JDK 8, otherwise the one for JDK 7. Those implementation classes must only be loaded in that factory. So you won't get a problem with missing APIs, because the class won't be loaded that depends on that API.
has comment: http://stackoverflow.com/comment/33232479
accepted answer of: http://stackoverflow.com/q/21931318

http://stackoverflow.com/comment/33318432
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21985571
has text: Great Dude its absolutely right answer heads off. :)

http://stackoverflow.com/q/21984578
has comment: http://stackoverflow.com/comment/33315627
accepted answer: http://stackoverflow.com/a/21984628
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/33315696
has answer: http://stackoverflow.com/a/21984611
favorite count: 0
has title: Rounding to the closest 100
has body: How do you round an integer to the closest 100? For example, 497 would round to 500, 98 would round to 100, and 1423 would round to 1400.
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/21984628
has comment: http://stackoverflow.com/comment/33315800
upvote count: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33315545
possible better answer: http://stackoverflow.com/a/21984877
tagged with: rounding
has answer: http://stackoverflow.com/a/21984877

http://stackoverflow.com/q/21914135
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21914511
tagged with: calculator
tagged with: string
has title: how to control exceptin on "." when converting to string
type: UnansweredQuestion
tagged with: integer
tagged with: netbeans
has comment: http://stackoverflow.com/comment/33190052
type: Question
has body: I'm creating simple CAL.I'm a beginner to JAVA. I got error Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "0." at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:492) at java.lang.Integer.parseInt(Integer.java:527) at javaapplication11.GUI.NewJFrame.jButton4ActionPerformed(NewJFrame.java:237) at javaapplication11.GUI.NewJFrame.access$400(NewJFrame.java:11) at javaapplication11.GUI.NewJFrame$5.actionPerformed(NewJFrame.java:81) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6505) at javax.swing.JComponent.processMouseEvent(JComponent.java:3321) at java.awt.Component.processEvent(Component.java:6270) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) at java.awt.Container.dispatchEventImpl(Container.java:2273) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessCo…
has answer: http://stackoverflow.com/a/21914423
tagged with: java

list
type: Tag
tags question: http://stackoverflow.com/q/21950524
tags question: http://stackoverflow.com/q/21938141
tags question: http://stackoverflow.com/q/21893358
tags question: http://stackoverflow.com/q/21900923
tags question: http://stackoverflow.com/q/21973342
tags question: http://stackoverflow.com/q/21986752
tags question: http://stackoverflow.com/q/21971988
tags question: http://stackoverflow.com/q/21979534
tags question: http://stackoverflow.com/q/21998061
tags question: http://stackoverflow.com/q/21951181
tags question: http://stackoverflow.com/q/21894095
tags question: http://stackoverflow.com/q/21992463
tags question: http://stackoverflow.com/q/21876785
tags question: http://stackoverflow.com/q/21933983
tags question: http://stackoverflow.com/q/21889469
tag name: list
tags question: http://stackoverflow.com/q/21992526
tags question: http://stackoverflow.com/q/21912314
tags question: http://stackoverflow.com/q/21950349
tags question: http://stackoverflow.com/q/21857009
tags question: http://stackoverflow.com/q/21868178
tags question: http://stackoverflow.com/q/21956951
tags question: http://stackoverflow.com/q/21842120
tags question: http://stackoverflow.com/q/21874340
tags question: http://stackoverflow.com/q/21848648
tags question: http://stackoverflow.com/q/21859018
tags question: http://stackoverflow.com/q/21850539
tags question: http://stackoverflow.com/q/21946587
tags question: http://stackoverflow.com/q/21899111
tags question: http://stackoverflow.com/q/21894860
tags question: http://stackoverflow.com/q/21967081
tags question: http://stackoverflow.com/q/21942316
tags question: http://stackoverflow.com/q/21949761
tags question: http://stackoverflow.com/q/21991993
tags question: http://stackoverflow.com/q/21847294
tags question: http://stackoverflow.com/q/21867177
tags question: http://stackoverflow.com/q/21908799
tags question: http://stackoverflow.com/q/21927438
tags question: http://stackoverflow.com/q/21985397
tags question: http://stackoverflow.com/q/21893964

http://stackoverflow.com/comment/33065176
type: QuestionComment
has text: As written your method seems to be printing string representations of whatever it is in `employees` array (which seems to hold strings) and if that string starts with "SU" it will be printed twice.
comment on: http://stackoverflow.com/q/21843892
score: 0
type: Comment

http://stackoverflow.com/comment/33250671
comment on: http://stackoverflow.com/a/21947818
has text: Thanks! It did compile but the problem i'm actually having now is its using student 3's info even if i pick student 1. Any idea why?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33244864
score: 0
comment on: http://stackoverflow.com/a/21944587
type: AnswerComment
has text: awesome! yeah, got it working with multiline. not regex savvy at all. i like your solution....and yes I was complicating my life quite a bit apparently. =)
type: Comment

http://stackoverflow.com/q/21972603
has answer: http://stackoverflow.com/a/22096507
downvote count: 0
favorite count: 0
tagged with: nfc
accepted answer: http://stackoverflow.com/a/22096507
has comment: http://stackoverflow.com/comment/33366551
type: AnsweredQuestion
score: 7
tagged with: java
tagged with: apdu
has title: Get UID of Mifare Ultralight with SCL010
upvote count: 7
possible better answer: http://stackoverflow.com/a/26052363
type: Question
has answer: http://stackoverflow.com/a/26052363
has body: I want get the UID of the Mifare Ultralight NFC tag. In Java I have this code: TerminalFactory factory = TerminalFactory.getDefault(); List&lt;CardTerminal&gt; terminals = factory.terminals().list(); System.out.println("Terminals: " + terminals); CardTerminal terminal = terminals.get(0); Card card = terminal.connect("*"); System.out.println("card: " + card); CardChannel channel = card.getBasicChannel(); ResponseAPDU answer = channel.transmit(new CommandAPDU(0xFF, 0xCA, 0x00, 0x00, 0x00)); byte[] uid = answer.getBytes(); The problem is that I receive two bytes and not the UID. What's the problem? Is the APDU correct?
tagged with: smartcard-reader
tagged with: mifare
has comment: http://stackoverflow.com/comment/33442859
answer count: 2

http://stackoverflow.com/comment/33272397
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21959829
has text: thanks. that’s what i assumed. is it more efficient to maintain two hash tables or to occasionally do a blanket search throughout the entire list?
score: 0

http://stackoverflow.com/q/21846024
tagged with: persistence.xml
has answer: http://stackoverflow.com/a/21847256
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33069657
has comment: http://stackoverflow.com/comment/33068917
has comment: http://stackoverflow.com/comment/33069899
has comment: http://stackoverflow.com/comment/33069946
has comment: http://stackoverflow.com/comment/33069308
type: Question
accepted answer: http://stackoverflow.com/a/21847256
has title: class listed in the persistence.xml file but not mapped
score: 0
answer count: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33069992
has body: I have listed my class in persistence.xml but mapped class is not recognized inside. I tried <exclude-unlisted-classes>false</exclude-unlisted-classes> But no luck. My persistence.xml file org.hibernate.ejb.HibernatePersistence com.advertiser.model.Application <property name="hibernate.connection.url" value="jdbc:mysql://host:port/DB" /> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/> <property name="hibernate.connection.autoReconnect" value="true"/> <property name="hibernate.connection.username" value="root"/> <property name="hibernate.connection.password" value="password"/> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.validator.apply_to_ddl" value="false"/> <property name="hibernate.hbm2ddl.auto" value="validate"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="false"/> <property name="hibernate.use_sql_comments" value="true"/> <property name="hibernate.default_batch_fetch_size" value="16"/> <property name="hibernate.current_session_context_class" value="thread"/> Test class file package com.advertiser.model.test; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.persistence.Query; import javax.servlet.ServletException; import org.junit.Test; import com.advertiser.model.Application; public class ApplicationTest { @Test public void listAll() throws ServletException { EntityManagerFactory emf = Persistence.createEntityManagerFactory("advertiserAPI"); try { EntityManager em = emf.createEntityManager(); Query query = em.createQuery("SELECT id FROM Application"); System.out.println("query " + query); } catch (Exception ex) { ex.printStacktrace(); } } } Application class has following package com.advertiser.model; import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.Generat…
has comment: http://stackoverflow.com/comment/33069711

http://stackoverflow.com/a/21857266
has comment: http://stackoverflow.com/comment/33088714
type: Answer
answers question: http://stackoverflow.com/q/21857029
score: 2
has comment: http://stackoverflow.com/comment/33089735
has comment: http://stackoverflow.com/comment/33089222
has body: JFreeChart is not thread safe. Just like any other AWT/Swing component, any updates to JFreeChart should be done on the EDT. That being said, you could (and probably should) put your loading on a different thread, and only update your chart (on the EDT) after you've loaded the whole dataset.
upvote count: 2
has comment: http://stackoverflow.com/comment/33088198
downvote count: 0

http://stackoverflow.com/comment/33320743
type: QuestionComment
comment on: http://stackoverflow.com/q/21986871
has text: I didn't understand the down vote. This is a useful thing for everyone.
score: 0
type: Comment

windows-server-2008-r2
tag name: windows-server-2008-r2
tags question: http://stackoverflow.com/q/21903326
type: Tag
tags question: http://stackoverflow.com/q/21983812

http://stackoverflow.com/a/21858680
type: AcceptedAnswer
has body: Yes; this is the reason for recommending packaging dependencies in WEB-INF/lib instead of putting them in the container's classpath. Each Web application in a container gets its own class loader and has distinct runtime instances of the classes it uses.
type: Answer
accepted answer of: http://stackoverflow.com/q/21858573
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21858573
upvote count: 2

http://stackoverflow.com/a/21894475
answers question: http://stackoverflow.com/q/21868284
upvote count: 4
downvote count: 0
score: 4
has body: There are quite some issues with your code You should not use the null layout. You should not extent JFrame and even if you do it, you should not override the paint method of JFrame. You should create the GUI on the Event Dispatch Thread. You should have an idea of how you are going to define which area of the function is plotted into which area of the panel. (Plotting a function like sin(x) will result in a straight, horizontal line, because the values will alternate between -1 and 1, and thus, span a range of only 3 pixels...) However, once I created a https://stackoverflow.com/help/mcve showing a very simple plotter that can be used to plot arbitrary functions. Maybe you find parts of it "inspiring". import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridLayout; import java.awt.RenderingHints; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSpinner; import javax.swing.SpinnerNumberModel; import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; /** * Main class of the simple function plotter. Contains the * main method and creates the GUI */ public class SimplePlotMain { /** * Entry point * * @param args not used */ public static void main(String[] args) { // Create the GUI on the Event-Dispatch-Thread SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); } /** * Creates the frame containing the simple plotter */ private static void createAndShowGUI() { // Create the main frame JFrame frame = new JFrame("SimplePlot"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new BorderLayout()); frame.setSize(800,600); // Create the SimplePlotPanel and add it to the frame SimplePlotPanel plotPanel = new SimplePlotPanel(); frame.getContentPane().add(plotPanel, BorderLayout.CENTER); …
type: Answer

http://stackoverflow.com/a/21961697
accepted answer of: http://stackoverflow.com/q/21961450
has body: Use the following: import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; public class MainClass { public static void main(String[] args) { ArrayList&lt;HashMap&lt;String, String&gt;&gt; recallList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); HashMap&lt;String, String&gt; hashMap; hashMap = new HashMap&lt;String, String&gt;(); hashMap.put("company", "a"); recallList.add(hashMap); hashMap = new HashMap&lt;String, String&gt;(); hashMap.put("company", "c"); recallList.add(hashMap); hashMap = new HashMap&lt;String, String&gt;(); hashMap.put("company", "b"); recallList.add(hashMap); System.out.println(recallList); Collections.sort(recallList, new Comparator&lt;HashMap&lt;String, String&gt;&gt;() { @Override public int compare(HashMap&lt;String, String&gt; hashMap1, HashMap&lt;String, String&gt; hashMap2) { return hashMap1.get("company").compareTo(hashMap2.get("company")); } }); System.out.println(recallList); } } The first and second output are: [{company=a}, {company=c}, {company=b}] [{company=a}, {company=b}, {company=c}]
answers question: http://stackoverflow.com/q/21961450
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/21942039
has title: App Engine Pull Queue tasks disappear before being properly handled
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21977977
has body: Update 4 - rephrasing question for clarity I am using Pull Queues to feed back-end workers tasks that send push notifications. I can see the front-end instance queue the task in the logs. However, the task is only occasionally handled by the back-end. I see no indication of why the task disappears prior to being handled and deleted from the queue. This may be related: I am seeing an unusually high number of TransientFailureExceptions when attempting to lease tasks from the queue - despite sleeping between attempts. Everything works properly on my development server (and an earlier version had worked in production) but production is no longer working properly. At first I thought it was a certificate issue. However, notifications are sometimes sent when the backend first starts. There is no indication that an error is happening except for the TransientFailureException when I call leaseTasks on the queue. Also, it seems to take a very long time for my logs to show up. I can provide more information and code snippets as needed. Thanks for the help. Update 1: The application uses 10 pull queues. It would normally use 2 but queue tagging is still considered experimental. They are declared in the standard fashion: gcm-henchdist pull The lease tasks function is: public boolean processBatchOfTasks() { List< TaskHandle > tasks = attemptLeaseTasks(); if( null == tasks || tasks.isEmpty() ) { return false; } processLeasedTasks( tasks ); return true; } private List< TaskHandle > attemptLeaseTasks() { for( int attemptNnum = 1; !LifecycleManager.getInstance().isShuttingDown(); ++attemptNnum ) { try { return m_taskQueue.leaseTasks( m_numLeaseTimeUnits, m_leaseTimeUnit, m_maxTasksPerLease ); } catch( TransientFailureException exc ) { LOG.warn( "TransientFailureException when leasing tasks from queue '{}'", m_taskQueue.getQueueName(), exc ); ApiProxy.flushLogs(); } catch( ApiDeadlineExceededException exc ) { LOG.warn( "ApiDeadlineExceededException when when leasing tasks from queue '{…
type: Question
tagged with: google-app-engine
possible better answer: http://stackoverflow.com/a/21961659
has comment: http://stackoverflow.com/comment/33276908
has answer: http://stackoverflow.com/a/21961659
score: 0
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/21977977
has comment: http://stackoverflow.com/comment/33274643
has comment: http://stackoverflow.com/comment/33254487

http://stackoverflow.com/comment/33270598
has text: Hi there! Glad it helped. The main reason for those panels is because otherwise `BorderLayout` will try to fill the whole available space. F.i.: if you place the button directly like this: `content.add(button, BorderLayout.SOUTH);` then this button will fill the whole south position. Don't worry about how many panels you need to use, `JPanel` is a light-weight container which won't consume too much memory(if this is what concerns you). Please note that after your edit your question doesn't make sense. You should leave it as before so it will help others having similar issues. @HarryKitchener
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21947758
type: Comment

http://stackoverflow.com/comment/33206417
type: Comment
type: QuestionComment
has text: Where do you define `i`? What is the error.
score: 1
comment on: http://stackoverflow.com/q/21923099

http://stackoverflow.com/q/21847567
has title: Java rock, paper, scissors program with file input
downvote count: 0
answer count: 1
has body: I'm having a problem with my line.charAt(0) and line.charAt(2). I keep getting an error saying: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:658) at RockPaperScissors1.main(RockPaperScissors1.java:31) I can't figure out why I am getting that. My file looks like this: 3 2 R P S R 3 P P R S S R 1 P R Here is my program: import java.util.*; import java.lang.*; import java.io.*; public class RockPaperScissors1 { public static void main(String[] args) throws IOException { File file = new File("a.txt"); Scanner fin = new Scanner(file); int cases = fin.nextInt(); String line = fin.nextLine(); int rounds = fin.nextInt(); for(int i = 0; i&lt;cases; i++) { int tie = 0; int p1win = 0; int p2win = 0; for(int j=0; j&lt;rounds; j++) { char p1 = line.charAt(0); char p2 = line.charAt(2); if (p1 == p2) tie = tie + 1; else if (p1 == 'R') { if (p2 == 'S') p1win = p1win + 1; else if (p2 == 'P') p2win = p2win + 1; } else if (p1 == 'P') { if (p2 == 'S') p2win = p2win + 1; else if (p2 == 'R') p1win = p1win + 1; } else if (p1 == 'S') { if (p2 == 'P') p1win = p1win + 1; else if (p2 == 'R') p2win = p2win + 1; } } if(p1win &gt; p2win) System.out.println("Player 1"); else if(p2win &gt; p1win) System.out.println("Player 2"); else System.out.println("Tie!"); } } } Any help would be appreciated.
favorite count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21850977
tagged with: java-io

http://stackoverflow.com/q/21864516
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21864584
tagged with: java
accepted answer: http://stackoverflow.com/a/21865049
linked to: http://stackoverflow.com/q/7899525
linked to: http://stackoverflow.com/q/15973624
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33101637
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/33101652
duplicate of: http://stackoverflow.com/q/15973624
has comment: http://stackoverflow.com/comment/33101672
has comment: http://stackoverflow.com/comment/33101605
tagged with: string
favorite count: 0
has body: I'm really new to Java programming, so this is a simple question I guess. I need to write a program that gets as an input the height and weight of a person as one string in which the height and weight separated by white space, for example: 1.68 70 and it calculates and prints the BMI (calculation by the formula weight/height^2). I read on the internet that getting input from the user can be done by the Scanner class, and that's what I used. Now I want to save the height and weight in different variables so I can convert them from string to Double, but I don't know how to do it as the whole input is one string . I'm used to Python and slicing :( .. Please help? Thanks a lot.
tagged with: double
downvote count: 2
tagged with: input
has answer: http://stackoverflow.com/a/21864584
has title: I got one string consisted of 2 numbers and white space between them, how can I save the numbers in 2 variables?
has answer: http://stackoverflow.com/a/21865049

http://stackoverflow.com/q/21855811
tagged with: money-format
answer count: 4
downvote count: 0
has title: How to change NumberFormat from especific currency to a dollar currency
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21855890
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21856021
has answer: http://stackoverflow.com/a/21855899
accepted answer: http://stackoverflow.com/a/21855899
has body: I have this block of code double price = rs.getDouble("price"); NumberFormat nf= NumberFormat.getCurrencyInstance(); String formatedPrice = nf.format(price); buff.append("( " + formatedPrice + ")"); When I run the code everything works fine but the currency is set to for example: ( C800 ). I guess is because my country has the "Colon" for currency, but that is a thing from the past we now use the Dollar currency. So how can I change the currency to show this: ($400) instead of this (C300). Thanks very much for any help.
upvote count: 1
has answer: http://stackoverflow.com/a/21856006
favorite count: 0
has answer: http://stackoverflow.com/a/21855890

http://stackoverflow.com/a/22370168
has comment: http://stackoverflow.com/comment/34021537
accepted answer of: http://stackoverflow.com/q/21891182
answers question: http://stackoverflow.com/q/21891182
has body: Because your class is in a package "pkgtry", you start it with: java -cp . pkgtry.Main while the current directory is the directory containing the "pkgtry" directory. You do not start it with: java -cp . Main while the current directory is the "pkgtry" directory. That only works if your class is not in a package (but is in a directory called "pkgtry" for whatever reason)
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/33153607
type: Comment
comment on: http://stackoverflow.com/q/21893128
type: QuestionComment
has text: @user270349 yes, I guess I could have said that XD
score: 0

http://stackoverflow.com/comment/33143194
type: QuestionComment
comment on: http://stackoverflow.com/q/21886746
has text: In fact, Websevice is being hit from browser and from client side as well. I suspected the issue with cross domain request, but i don't receive any message regarding it. Only 404 error.
score: 0
type: Comment

http://stackoverflow.com/a/21943785
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33244572
answers question: http://stackoverflow.com/q/21942733
has comment: http://stackoverflow.com/comment/33246618
downvote count: 0
type: Answer
has body: As @MrUsefull said you need to sum and divide to get the average but your code may be much simpler not differentiating cases but restricting boundaries: class Average { private static PrintStream out = System.out; public static void main(String[] args) throws IOException { /* Constant definitions */ final int absMinRow = 0; final int absMinCol = 0; final int absMaxRow = 4; final int absMaxCol = 4; final int[][] matrix = { { 1, 2, 3, 4, 5 }, { 15, 7, 8, 9, 71 }, { 6, 7, 11, 2, 5 }, { 6, 7, 8, 9, 14 }, { 5, 4, 3, 2, 33 } }; try (Scanner f = new Scanner(new File("pr20.dat"))) { int times = f.nextInt(); f.nextLine(); for (int x = 0; x &lt; times; x++) { /* Next input data */ int r = f.nextInt(); int c = f.nextInt(); /* variable boundaries */ int minRow = Math.max(r - 1, absMinRow); int maxRow = Math.min(r + 1, absMaxRow); int minCol = Math.max(c - 1, absMinCol); int maxCol = Math.min(c + 1, absMaxCol); int sum = 0; int count = 0; // &lt;--!!!! for (int i = minRow; i &lt;= maxRow; i++) { for (int j = minCol; j &lt;= maxCol; j++) { sum += matrix[i][j]; count++; // &lt;--!!!! } } out.println(sum); out.println(count); out.println(sum / count); // &lt;-- Average!!!! out.println(); } } } }
has comment: http://stackoverflow.com/comment/33247734

http://stackoverflow.com/q/21974407
downvote count: 0
has comment: http://stackoverflow.com/comment/75931464
accepted answer: http://stackoverflow.com/a/21974655
tagged with: httpurlconnection
favorite count: 0
has answer: http://stackoverflow.com/a/33824626
has body: I can not see what is wrong with this code: JSONObject msg; //passed in as a parameter to this method HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); httpCon.setDoOutput(true); httpCon.setDoInput(true); httpCon.setUseCaches(false); httpCon.setRequestProperty( "Content-Type", "application/json" ); httpCon.setRequestProperty("Accept", "application/json"); httpCon.setRequestMethod("POST"); OutputStream os = httpCon.getOutputStream(); OutputStreamWriter osw = new OutputStreamWriter(os, "UTF-8"); msg.write(osw); osw.flush(); osw.close(); os.close(); //probably overkill On the server, I am getting no post content at all, a zero length string.
answer count: 5
has answer: http://stackoverflow.com/a/36154536
has answer: http://stackoverflow.com/a/21975279
has answer: http://stackoverflow.com/a/32983497
upvote count: 17
possible better answer: http://stackoverflow.com/a/33824626
has answer: http://stackoverflow.com/a/21974655
type: AnsweredQuestion
tagged with: java
has title: How to stream a JSON object to a HttpURLConnection POST request
score: 17
tagged with: post
type: Question

http://stackoverflow.com/a/21982464
accepted answer of: http://stackoverflow.com/q/21982386
type: Answer
upvote count: 7
answers question: http://stackoverflow.com/q/21982386
score: 7
type: AcceptedAnswer
downvote count: 0
has body: Your error is because of you are passing 0 in rand.nextInt(i). rand.nextInt() expects positive integer greater that 0.

http://stackoverflow.com/comment/33330743
score: 0
comment on: http://stackoverflow.com/q/21992951
has text: That was my 2 cents :). The answer is in the documentation for the various keywords in my previous comment. Look up the javadoc for `Object#getClass()`. Read the tutorial on synchronization. Look up what a class literal is. There's a lot to go through here and it wouldn't fit nicely into an answer IMO.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21872830
has body: NoClassDefFoundError This isn't the same as ClassNotFoundException. It usually means that a file was found in the expected place, but it didn't contain the expected class, i.e. wrong name or wrong package. A clean build usually fixes it, otherwise check that your class name matches the file name exactly, and that the package name agrees exactly with the directory hierarchy the source file is in.
score: 0
answers question: http://stackoverflow.com/q/21871003
type: Answer

http://stackoverflow.com/q/21964302
upvote count: 1
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/68762138
score: 1
tagged with: java
tagged with: javadoc
type: Question
has title: How to attach javadocs in java ee netbeans
downvote count: 0
has answer: http://stackoverflow.com/a/60109443
has answer: http://stackoverflow.com/a/21964829
has body: I am developing for a project, and sometimes I encounter some codes that I would like to read the documentations about. But I am having "Javadoc not found" in my tooltip,and attaching javadocs in my netbeans. Also there is this online api documentation (Online Java EE API Docs) but sometimes its a bit tedious for checking it everytime, is there a way that i can integrate it somehow in my netbeans? I tried the Attach Javadoc... button below, but nothing seem to work. Also, if you have a link where i can download a .jar of java-ee-apidocs, thanks. I already tried downloaded Java EE 6 Update 2 Javadocs, are there updated versions for Java EE7? Thanks!
answer count: 3
favorite count: 0
tagged with: netbeans
type: UnansweredQuestion

http://stackoverflow.com/q/21937512
tagged with: java
tagged with: caching
upvote count: 1
answer count: 1
favorite count: 0
tagged with: terracotta
type: AnsweredQuestion
tagged with: ehcache
downvote count: 0
has body: I have configuration for Ehcache as next: &lt;cache name="test-cache" maxEntriesLocalHeap="50" maxEntriesLocalDisk="50" eternal="false" diskSpoolBufferSizeMB="10" timeToIdleSeconds="90" timeToLiveSeconds="60" memoryStoreEvictionPolicy="LFU" transactionalMode="off"&gt; &lt;persistence strategy="localTempSwap"/&gt; &lt;/cache&gt; And the following code that use it: Ehcache cache = CacheManager.getInstance().getCache("test-cache"); cache.setStatisticsEnabled(true); cache.setStatisticsAccuracy(Statistics.STATISTICS_ACCURACY_GUARANTEED); /* put 100 elements */ for (int i = 1; i &lt;= 100; i++) { cache.put(new Element("key-"+i, "value-"+i)); } /* hit 100 elements in cache 10000 times */ for (int i = 1; i &lt;= 100; i++) { for (int j = 1; j &lt;= 100 ; j++) { cache.get("key-"+j); } } /* consider values of misses, onDiskMisses, inMemoryMisses */ System.out.println("Statistics = " + cache.getStatistics().toString()); I've prepared simple one-class demo you can run https://github.com/Bezuhlyi/ehcahce-statistics-test You can see, that misses != inMemoryMisses + offHeapMisses + onDiskMisses. The question is what actually Statistics.getCacheMisses() counts? Also, naturally cache hitrate = hits / (hits + misses). And what is a correct way to know actual hitrate of Ehcache instance then? I haven't found nothing useful about it in docs, as well as about SampledCacheStatistics purpose.
type: Question
has answer: http://stackoverflow.com/a/21995872
accepted answer: http://stackoverflow.com/a/21995872
has title: Ehcache misses count and hitrate statistics
score: 1

http://stackoverflow.com/comment/33107908
type: Comment
comment on: http://stackoverflow.com/q/21867593
has text: Can you edit your json to fix it?
score: 0
type: QuestionComment

http://stackoverflow.com/a/21998340
has body: Problem solved. This appears to be due to a bug in IBM's JDK. Once I changed to Sun's, everything works.
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21996162
has comment: http://stackoverflow.com/comment/88004584
accepted answer of: http://stackoverflow.com/q/21996162
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/33636988

http://stackoverflow.com/q/21884532
type: Question
upvote count: 2
tagged with: transformation
tagged with: replace
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33137222
has comment: http://stackoverflow.com/comment/33141248
has body: I have a String like this "4 + 5 = 9;" and I want to add one to each number found. I want to use regular expressions and a transformation function for every match. I know how to do it in Java &lt;= 7. It is in the javadoc and in this answer. I want to know if there is something new about this in Java 8. EDIT: This is my best try: private static String regexTransform(String regex, String input, Function&lt;String, String&gt; function) { Matcher m = Pattern.compile(regex).matcher(input); StringBuffer sb = new StringBuffer(); while (m.find()) { m.appendReplacement(sb, function.apply(m.group())); } m.appendTail(sb); return sb.toString(); } String res = regexTransform("[0-9]+", "4 + 5 = 9;", s-&gt; String.valueOf(Long.parseLong(s) + 1)); System.out.println(res); // 5 + 6 = 10
linked to: http://stackoverflow.com/q/19737653
type: UnansweredQuestion
tagged with: regex
tagged with: java-8
score: 2
has answer: http://stackoverflow.com/a/23317578
downvote count: 0
has title: What is the equivalent of Regex-replace-with-function-evaluation in Java 8?
tagged with: java

http://stackoverflow.com/comment/33221290
type: QuestionComment
comment on: http://stackoverflow.com/q/21931892
score: 0
has text: why u get text from edText in onCreate, should not it be in onClick method?
type: Comment

http://stackoverflow.com/a/21959620
has body: The problem you have is that the names move1 and move2 are out of scope in the setList method. They're defined in Start.main as local variables, so they are only visible there. There are a innumerable ways you can solve this. The most straight-forward way is to move the setList method to Start. Because you're calling it from main, which is a static method, setList will also have to be static. public class Start { public static void main(String[] args) { Move move1 = new Move(); Move move2 = new Move(); move1.setName(kick); move2.setName(punch); setList(move1, move2); } public static void setList(Move move1, Move move2) { System.out.println(move1.getName() + move2.getName()); } } If you think setList should be in the Move class, you'll need to pass the second move as a parameter. public class Move { ... public void setList(Move other) { System.out.println(this.getName() + other.getName()); } }
score: 1
accepted answer of: http://stackoverflow.com/q/21958740
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21958740
has comment: http://stackoverflow.com/comment/33274014
type: Answer
downvote count: 0

http://stackoverflow.com/comment/33254103
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21926014
score: 0
has text: What's your question exactly?

http://stackoverflow.com/comment/33113970
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21871152
type: Comment
has text: @BalwantChauhan Can you clarify which above difference you are referring to?

http://stackoverflow.com/a/21851562
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21850673
has body: Since you are calling resetList() from Activity's (UI) thread, you cannot click an item in the middle of method ecexution, as clicks are processed by the same UI thread, therefore, you are able to perform a click only before or after the method execution.
score: 1
accepted answer of: http://stackoverflow.com/q/21850673
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33263263
has text: i am not getting GMT TIME in above code.its giving me my local time
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21954902

http://stackoverflow.com/q/21966840
tagged with: tags
has answer: http://stackoverflow.com/a/21967105
score: 0
answer count: 1
tagged with: jsp
tagged with: jquery
has comment: http://stackoverflow.com/comment/33284846
has comment: http://stackoverflow.com/comment/33284916
type: UnansweredQuestion
has body: I am learning to write my first web application. I have a jsp file which used .tag files. Both the .jsp and .tag files use jquery functions. In this case should jquery resource be specified in both the files or can i specify it in JSP alone and tag file can use it ? Since im importing the tag file into a jsp, I assumed the resulting html would be a single file so no need to link the jquery resource in multiple places? Am i correct here? Something like this: common/dummy.tag ******************* . . . $("#blah").show(); . . Sample.jsp *********** . . . &lt;common:dummy/&gt; . . . $("#somethingelse").hinde(); . . . &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"&gt;&lt;/script&gt; If i link the jquery in my tag as well is there any issue? Since its possible my tag could be reused some where else which doesnt use jquery byitself.
has title: Webapp JSP vs Tag files and resource declaration
tagged with: java
tagged with: web-applications
type: Question

http://stackoverflow.com/comment/33204046
has text: @helderdarocha -- I should have framed my question in a better way..I will post another question related to this in 10 mins with my code
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21921354
score: 0

http://stackoverflow.com/comment/33129262
type: QuestionComment
comment on: http://stackoverflow.com/q/21879803
has text: then it says no BigFish class found
score: 0
type: Comment

http://stackoverflow.com/a/21881989
has comment: http://stackoverflow.com/comment/33133690
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33132813
has body: Maybe this will help (PhoneNumberUtils): http://developer.android.com/reference/android/telephony/PhoneNumberUtils.html A little example: String formattedNumber = PhoneNumberUtils.formatNumber(unformattedNumber); This will automatically format the number according to the rules for the country the number is from. Look at PhoneNumberUtils for more options.
answers question: http://stackoverflow.com/q/21881728
has comment: http://stackoverflow.com/comment/33133292
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21881728
type: Answer

http://stackoverflow.com/comment/33172822
type: QuestionComment
score: 0
has text: Just create a suitable Tomcat home for this other user. It's not very hard to do, and docs abound about it.
comment on: http://stackoverflow.com/q/21904372
type: Comment

http://stackoverflow.com/a/21980373
score: 0
has body: As suggested by other, there is a problem with your listview implementation. Why don't you check out Exhaustive ListView with simple examples
answers question: http://stackoverflow.com/q/21979099
type: Answer

http://stackoverflow.com/comment/33275372
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21960255
has text: @johncarl What if you then provide some hidden reflection-based access mechanism that would make the package-level field accessible programmatically, provided the `SecurityManager` allows for that.

http://stackoverflow.com/q/21926970
answer count: 1
downvote count: 0
score: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/21927159
tagged with: regex
has title: Backtrack in Possesive Quantifier
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21927159
has body: Earlier I posted a question about regex which resulted in stackoverflow error in java. My Regex was greedy and many commented to use possessive quantifier in regex. So, I started learning Possessive quantifier in regex. I tried to match string between double quotes. My regex is "([^\\"]|\\.)++" I tried to match the string "Hello I am \" chitti" While matching there was backtracks. I tested using http://regex101.com/#PCRE. The link to regex is REGEX 101 LINK Can someone please explain why there is a backtrack involved steps 6,8,10 etc
upvote count: 4
tagged with: regex-greedy

http://stackoverflow.com/q/21909617
has comment: http://stackoverflow.com/comment/35555158
has comment: http://stackoverflow.com/comment/39699358
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36458276
tagged with: c++
score: 2
answer count: 0
tagged with: java
downvote count: 1
has title: Swig : Java packaging give violation access exception
type: Question
has body: I've been struggling during all the day to fix a problem : When I create a Java wrapper by Swig to my C/C++ application without specifying a package I don't get any access error while runing my Java program and everything works fine. BUT, when I do : swig -c++ -java -package my.package.name -outdir my/pachage/name , My JVM crash and gives me the following error trace : A fatal error has been detected by the Java Runtime Environment: EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006eaf26c0, pid=10348, tid=5500 JRE version: Java(TM) SE Runtime Environment (7.0_51-b13) (build 1.7.0_51-b13) Java VM: Java HotSpot(TM) 64-Bit Server VM (24.51-b03 mixed mode windows-amd64 compressed oops) Problematic frame: V [jvm.dll+0x1226c0] Failed to write core dump. Minidumps are not enabled by default on client versions of Windows I absolutely need to make my code in a package, and not leave it in "default package". I'm using JDK 7 (51u), 64-bits. My DLLs are successfuly loaded in both cases ( with/without packaging ) using System.loadLibrary. I will be so grateful for any help! thank u!
tagged with: swig
has comment: http://stackoverflow.com/comment/42573514
tagged with: java-native-interface
upvote count: 3
favorite count: 0

http://stackoverflow.com/a/21948366
type: Answer
score: 0
has body: InterstitialAd interstitial = new InterstitialAd(this); You are not writing your new instance to the class member, but you're creating a local variable instead. Remove the InterstitialAd at the beginning and you should be fine.
answers question: http://stackoverflow.com/q/21948225

http://stackoverflow.com/q/21918640
tagged with: java
has comment: http://stackoverflow.com/comment/33251254
type: Question
tagged with: liferay
tagged with: weblogic
tagged with: spring-portlet-mvc
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33235473
has body: Has anyone seen and resolved this error? Caused by: java.lang.IllegalStateException: Current request is not a portlet request at org.springframework.web.portlet.context.PortletApplicationContextUtils.currentRequestAttributes(PortletApplicationContextUtils.java:194) at org.springframework.web.portlet.context.PortletApplicationContextUtils.access$0(PortletApplicationContextUtils.java:191) at org.springframework.web.portlet.context.PortletApplicationContextUtils$WebRequestObjectFactory.getObject(PortletApplicationContextUtils.java:238) at org.springframework.web.portlet.context.PortletApplicationContextUtils$WebRequestObjectFactory.getObject(PortletApplicationContextUtils.java:1) at org.springframework.beans.factory.support.AutowireUtils$ObjectFactoryDelegatingInvocationHandler.invoke(AutowireUtils.java:178) at $Proxy866.getAttribute(Unknown Source) at org.ihc.mh.proxy.portlet.factory.PortletProxyInfoFactory$PortletSessionScope.getAttribute(PortletProxyInfoFactory.java:198) at org.ihc.mh.proxy.portlet.factory.PortletProxyInfoFactory$ProxyInfoImpl.getUnitNumber(PortletProxyInfoFactory.java:52) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.Reflecti…
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: "Current request is not a portlet request" error running Liferay portlets on WebLogic using Spring 3.0.5 and aop with a request scope bean
tagged with: spring
linked to: http://stackoverflow.com/q/20338125
score: 1

http://stackoverflow.com/q/22005080
score: 0
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/22005103
has body: Right, in this program I am supposed to be able to search for a person in the list. If I search for someone who is not in the list then the Found variable should be kept at false. If I search for someone who is in the list eg: "Ben" then Found should be set to true. However for some reason, searching for someone who is in the list does not set found to true. It seems like the if statement which checks the player's input to the array is not working properly. I have no idea why this is. There are no errors. Can anyone help? Thanks code: package com.test.main; import java.util.Scanner; public class Main { public static void main(String[] args){ String[] Names = new String[4]; Names[0] = "Ben"; Names[1] = "Thor"; Names[2] = "Zoe"; Names[3] = "Kate"; int Max = 4; int Current = 1; boolean Found = false; System.out.println("What player are you looking for?"); Scanner scanner = new Scanner(System.in); String PlayerName = scanner.nextLine(); while(!Found &amp;&amp; Current &lt;= Max){ //System.out.println(Names[Current-1]); //System.out.println("PLAYERNAME: " + PlayerName.length() + ", ARRAY: " + Names[Current-1].length()); if(Names[Current-1] == PlayerName){ //System.out.println("found"); Found = true; } else{ Current++; } } //System.out.println(Found); if(Found){ System.out.println("Yes, they have a top score"); } else{ System.out.println("No, they do not have a top score"); } } }
tagged with: string
has title: Java if statement is stupid(simple)
has comment: http://stackoverflow.com/comment/33352530
has answer: http://stackoverflow.com/a/22005305
has answer: http://stackoverflow.com/a/22005119
type: UnansweredQuestion
answer count: 4
tagged with: java
has comment: http://stackoverflow.com/comment/33352555
duplicate of: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/22005131
type: Question
tagged with: comparison
has comment: http://stackoverflow.com/comment/33352524

http://stackoverflow.com/comment/136722285
score: 0
has text: UML does not allow creating objects that do not instantiate a class (they say "A CreateObjectAction is an Action that creates a direct instance of a given Classifier"), while JS does allow this. No, the linked page is okay, it contains three links: (1) to an English HTML document, (2) to a Russian HTML document, and (3) to a PDF.
type: Comment
comment on: http://stackoverflow.com/a/22000255
type: AnswerComment

http://stackoverflow.com/comment/33186264
score: 0
type: QuestionComment
type: Comment
has text: The right approach should include passing the name of the file you will read to the program as a command line argument.
comment on: http://stackoverflow.com/q/21910623

http://stackoverflow.com/a/21929912
has body: After entering the catch block, flow continues on, so the next line to execute is the bottom print. If you want to terminate from within the catch: try { int a = sn.nextInt(); } catch (InputMismatchException ex) { System.out.println("error please enter integer value"); return; // program will end }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21929782

http://stackoverflow.com/a/21965737
type: Answer
answers question: http://stackoverflow.com/q/21965526
has comment: http://stackoverflow.com/comment/33597519
downvote count: 0
has comment: http://stackoverflow.com/comment/33597815
score: 1
has body: Check this link for more info on using pools GenericObjectPool Another post which might help is this You need to associate a factory with your ObjectPool to create objects. Hope this helps.
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33283113
accepted answer of: http://stackoverflow.com/q/21965526

http://stackoverflow.com/comment/33220707
type: QuestionComment
comment on: http://stackoverflow.com/q/21931146
type: Comment
has text: @Shayanpourvatan what this check should do?
score: 0

http://stackoverflow.com/comment/33201144
has text: Move `@Id` annotation to `id` fiekd instead of it's getter. BTW is there any particular reason why you don't want to follow Play's way with public model fields? Play relly on this approach on many places, and if you decide to do not use it, you can just also start common Java app instead
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21919470

http://stackoverflow.com/comment/33298570
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/21974786
has text: Note: don't compare String values using `==`. Use `equals()`.
type: Comment

http://stackoverflow.com/comment/33264932
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21956010
has text: @jlhonora I getting this error `Multiple markers at this line - The constructor GPS(GPSPos) is undefined - GPSPos cannot be resolved to a type` with `gps = new GPS((GPSPos) MainActivity.this);`

http://stackoverflow.com/comment/33276301
has text: Thanks, the `root.get(Hours_.trainer).get(Trainer_.id)` did the trick. Regarding the composite PK: this is one of my biggest criticism of ORMs: they force you to use PKs that are the "real thing". Adding an autogenerated column to the hours table does improve the model from a relational point of view. It only adds the overhead of another index to the table without giving any benefit (in SQL). After I played around with this I agree: the benefits of the type safety that the API gives us does not warrant the complexity of it.
type: AnswerComment
comment on: http://stackoverflow.com/a/21961994
score: 0
type: Comment

http://stackoverflow.com/q/21872800
linked to: http://stackoverflow.com/q/17876945
has comment: http://stackoverflow.com/comment/33116470
has body: Howzit, I have a static header that is being included in my layout that contains a listview. The functionality works great, however whenever I click on the job it throws a NullPointerException (I want nothing to happen) Not to sure why this is happening. Container.xml <?xml version="1.0" encoding="utf-8"?> <include android:id="@+id/headerItem" android:layout_alignParentTop="true" android:layout_width="fill_parent" android:layout_height="76dip" android:background="@color/standard_background" layout="@layout/List_Item"/> <ListView android:id="@id/android:list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/headerItem" android:background="@color/standard_background" /> List_Item.xml ...a couple of textviews ...a single textview I have attempted to set it to disabled, not focusable as well as disabled the click and long click. Not sure what else to try. Stacktrace Exception in MessageQueue callback: handleReceiveCallback java.lang.NullPointerException at android.support.v4.widget.DrawerLayout.isContentView(DrawerLayout.java:840) at android.support.v4.widget.DrawerLayout.onInterceptTouchEvent(DrawerLayout.java:866) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1859) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2068) at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneW…
has comment: http://stackoverflow.com/comment/33116527
tagged with: java
has comment: http://stackoverflow.com/comment/33116347
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/33116385
accepted answer: http://stackoverflow.com/a/21889001
has comment: http://stackoverflow.com/comment/33123206
has comment: http://stackoverflow.com/comment/33116496
tagged with: android-layout
possible better answer: http://stackoverflow.com/a/21873078
has comment: http://stackoverflow.com/comment/33116419
has comment: http://stackoverflow.com/comment/33116557
has answer: http://stackoverflow.com/a/21873078
has answer: http://stackoverflow.com/a/23343093
type: AnsweredQuestion
has title: NullPointerException when pressing on included layout part
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33116442
has answer: http://stackoverflow.com/a/21889001
type: Question
tagged with: android

http://stackoverflow.com/comment/33349258
type: QuestionComment
comment on: http://stackoverflow.com/q/22003084
has text: Java: [JLS 15.26.2](http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.26.2) says that it's equivalent to `sum = (int)(sum + fun(n-1))`, and [JLS 15.7.1](http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.7.1) specifies that the left operand of `+` is evaluated first. I'm pretty sure C++ leaves the evaluation order undefined, but I haven't found the reference.
score: 0
type: Comment

http://stackoverflow.com/a/21851461
has body: There is no such thing as "The Java Web framework to choose". The framework you choose depends on many factors like: Use case Technical requirements (Organization) standards Performance Extendibility Community &amp; support ... Because of it, this question cannot be answered. There are simply too many factors and too many frameworks that will apply.
answers question: http://stackoverflow.com/q/21851109
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/21887399
has body: Suppose we have a Spock specification class like below. class SomeFeature extends Specification { def "some scenario"() { given: "some resource" def resource = someResource() when: "some action is taken" someAction() then: "some condition must be met" true == someCondition() } } How can I extract the BDD meta-statements like some scenario, given, when, then? It is straightforward to process the source file, but I am wondering if it is possible to use reflection to achieve that. BTW, the motivation to get that information is to facilitate the communication between product owner and developer, such that the product owner can know what behaviors have been implemented and verified without looking at the source code. Thank you very much.
tagged with: groovy
has comment: http://stackoverflow.com/comment/33249494
tagged with: bdd
downvote count: 0
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/13690778
score: 5
has answer: http://stackoverflow.com/a/21888183
type: UnansweredQuestion
type: Question
tagged with: spock
upvote count: 5
tagged with: java
has title: How to extract BDD meta-statements from Spock specification classes
has comment: http://stackoverflow.com/comment/33144419
has comment: http://stackoverflow.com/comment/33144255

http://stackoverflow.com/q/21917598
has title: With Elastic Beanstalk, can I determine programmatically if I'm on the leader node?
score: 4
has comment: http://stackoverflow.com/comment/33318009
has answer: http://stackoverflow.com/a/23796075
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
linked to: http://stackoverflow.com/q/32107608
downvote count: 0
has answer: http://stackoverflow.com/a/21983919
tagged with: amazon-web-services
possible better answer: http://stackoverflow.com/a/21957096
answer count: 3
has answer: http://stackoverflow.com/a/21957096
accepted answer: http://stackoverflow.com/a/21983919
has body: I have some housekeeping tasks within an Elastic Beanstalk Java application running on Tomcat, and I need to run them every so often. I want these tasks run only on the leader node (or, more correctly, on a single node, but the leader seems like an obvious choice). I was looking at running cron jobs within Elastic Beanstalk, but it feels like this should be more straightforward than what I've come up with. Ideally, I'd like one of these two options within my web app: Some way of testing within the current JRE whether or not this server is the leader node Some some way to hit a specific URL (wget?) to trigger the task, but also restrict that URL to requests from localhost. Suggestions?
tagged with: scheduled-tasks
tagged with: amazon-elastic-beanstalk
favorite count: 0

http://stackoverflow.com/comment/33249516
score: 0
has text: Thank you, I had tried, but nothing's happend. I solved my issue with changing IDE to IDEA from Netbeans.
type: Comment
comment on: http://stackoverflow.com/a/21928921
type: AnswerComment

http://stackoverflow.com/q/21949185
favorite count: 0
has comment: http://stackoverflow.com/comment/33252978
accepted answer: http://stackoverflow.com/a/21949243
tagged with: singly-linked-list
has comment: http://stackoverflow.com/comment/33252995
type: AnsweredQuestion
has title: Removing a specific node from a single linked list
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33252950
type: Question
answer count: 2
has body: I posted a question yesterday about an issue I was having overriding the toString() for this program, but now I have a different problem. The removeItem() method is supposed to remove the node with the given data value (in this case a String name). I'm getting a NullPointerException on line 64 and I can't seem to figure it out for whatever reason. My code is below, and thanks in advance for any help. public class StudentRegistration&lt;E&gt; { private static class Node&lt;E&gt; { /** The data value. */ private E data; /** The link */ private Node&lt;E&gt; next = null; /** * Construct a node with the given data value and link * @param data - The data value * @param next - The link */ public Node(E data, Node&lt;E&gt; next) { this.data = data; this.next = next; } /** * Construct a node with the given data value * @param data - The data value */ public Node(E data) { this(data, null); } public Node getNext() { return next; } public E getData() { return data; } public void setNext(Node append) { next = append; } } /** A reference to the head of the list */ private Node&lt;E&gt; head = null; /** The size of the list */ private int size = 0; /** Helper methods */ /** Remove the first occurance of element item. @param item the item to be removed @return true if item is found and removed; otherwise, return false. */ public void removeItem(E item) { Node&lt;E&gt; position = head; Node&lt;E&gt; nextPosition1, nextPosition2; while (position != null) { if(position.getNext().getData() == item) //NullPointerException { nextPosition1 = position.getNext(); nextPosition2 = nextPosition1.getNext(); position.setNext(nextPosition2); } else { position = position.getNext(); } } } /** Insert an item as the first item of the list. * @param item The item to be inserted */ public void addFirst(E item) { head = new Node&lt;E&gt;(item, head); size++; } /** * Remove the first node from the list * @returns The removed node's data or null if the list is empty */ public E removeFirst() { Node&lt;E…
downvote count: 0
possible better answer: http://stackoverflow.com/a/21949271
has answer: http://stackoverflow.com/a/21949271
has answer: http://stackoverflow.com/a/21949243

http://stackoverflow.com/a/21901555
has body: writeChar writes char as a 2-byte value in UTF-16 encoding. In case 'J' it is 00 4A. To display it correctly you need to use correct encoding
answers question: http://stackoverflow.com/q/21901251
downvote count: 0
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/33257319
type: Comment
comment on: http://stackoverflow.com/q/21951612
type: QuestionComment
score: 0
has text: Thank you for trying to help; I still don't understand how I can create an array to save values if I don't know how many values there will be. But I think the piping should be sufficient for at least partial credit.

http://stackoverflow.com/comment/33104725
score: 0
type: Comment
type: QuestionComment
has text: You are missing one value in your output right? I just want to make sure that is not a typo :)
comment on: http://stackoverflow.com/q/21865255

http://stackoverflow.com/q/21854945
has comment: http://stackoverflow.com/comment/33101219
has comment: http://stackoverflow.com/comment/33084221
score: 0
has comment: http://stackoverflow.com/comment/33084640
answer count: 1
has comment: http://stackoverflow.com/comment/33084275
has title: Getting array aliases elements by index
has answer: http://stackoverflow.com/a/22374109
has body: I have 2 objects: User { int id, String name, List&lt;Status&gt; statusList } Status { int id, int userId, String name, Date createDate } I have mapped that pojo classes in two .hbm files, at that, in Status.hbm file i said hibernate, that I want to get statuses from base in DESC sorted by date view: &lt;set name="statuses" order-by="date desc"&gt; &lt;key&gt; &lt;column name="userId" /&gt; &lt;/key&gt; &lt;one-to-many class="Status" /&gt; &lt;/set&gt; Now I want to select a list of users, wich has selected (f.e. "Created", or "Deleted") first element in statusList property. I write: sessionFactory.getCurrentSession().createCriteria(User.class) .createAlias("statuses", "statusesAlias") .add(Restrictions.eq("statusesAlias[0].name", "Created")).list(); But I get an error in .add(Restrictions.eq("statusesAlias[0].name", "Created")) So, that's a question - how can I access to first element of property of object, when that property is aliased like .createAlias("statuses", "statusesAlias")
has comment: http://stackoverflow.com/comment/33084437
has comment: http://stackoverflow.com/comment/33083958
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33084599
tagged with: java
tagged with: hibernate
type: Question
accepted answer: http://stackoverflow.com/a/22374109
has comment: http://stackoverflow.com/comment/33129807

http://stackoverflow.com/comment/33140541
type: QuestionComment
comment on: http://stackoverflow.com/q/21885705
has text: You can ask a question, but follow the guidelines in the [help center](http://stackoverflow.com/help). In this case, you are dumping all your code and expecting us to debug it for you. No, that's your work. Your question shows complete lack of effort.
score: 0
type: Comment

http://stackoverflow.com/q/21954850
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33265467
has comment: http://stackoverflow.com/comment/33265568
type: Question
has comment: http://stackoverflow.com/comment/33263393
has comment: http://stackoverflow.com/comment/33264518
has comment: http://stackoverflow.com/comment/33263706
accepted answer: http://stackoverflow.com/a/28720737
tagged with: api
has comment: http://stackoverflow.com/comment/33262742
answer count: 1
downvote count: 0
has title: Neo4j, REST API, java - cypher queries
favorite count: 0
has body: I learn REST API with Java and tried run this simple code, but I got error. Something wrong with this part of code: RestAPI graphDb = new RestAPI.... I use this external JAR (http://m2.neo4j.org/content/repositories/releases/org/neo4j/neo4j-rest-graphdb/2.0.0/neo4j-rest-graphdb-2.0.0.jar) import java.util.Collections; import java.util.Iterator; import java.util.Map; import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.rest.graphdb.RestAPI; import org.neo4j.rest.graphdb.RestAPIFacade; import org.neo4j.rest.graphdb.RestGraphDatabase; import org.neo4j.rest.graphdb.query.QueryEngine; import org.neo4j.rest.graphdb.query.RestCypherQueryEngine; import org.neo4j.rest.graphdb.util.QueryResult; public class CypherQuery { public static void main(String[] args) { RestAPI graphDb = new RestAPIFacade("http://localhost:7474/db/data/"); QueryEngine engine=new RestCypherQueryEngine(graphDb); QueryResult&lt;Map&lt;String,Object&gt;&gt; result = engine.query("start n=node(*) return count(n) as total", Collections.EMPTY_MAP); Iterator&lt;Map&lt;String, Object&gt;&gt; iterator=result.iterator(); if(iterator.hasNext()) { Map&lt;String,Object&gt; row= iterator.next(); System.out.println("Total nodes: " + row.get("total")); } } } Error: Exception in thread "main" java.lang.NoClassDefFoundError: javax/ws/rs/core/Response$StatusType at org.neo4j.rest.graphdb.RestAPIFacade.&lt;init&gt;(RestAPIFacade.java:295) at cz.mendelu.bp.CypherQuery.main(CypherQuery.java:19) Caused by: java.lang.ClassNotFoundException: javax.ws.rs.core.Response$StatusType at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 2 more
tagged with: rest
has comment: http://stackoverflow.com/comment/33264631
tagged with: cypher
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28720737
score: 1

http://stackoverflow.com/q/21952207
score: 0
tagged with: groovy
answer count: 1
linked to: http://stackoverflow.com/q/14225264
type: UnansweredQuestion
has body: Using the AntBuilder seems to be the best way to create a backup zip file in Groovy. There are lots of solutions on this site that use methods like copy and zip but I can't see those methods the AntBuilder class in Groovy 2.1.5. Do I need to install an additional Jar? new AntBuilder().zip( destfile: "mydir/myzip.zip") { fileset(dir: "mydir/myFile.txt") }
linked to: http://stackoverflow.com/q/14978846
has title: Back up folder in Groovy
has answer: http://stackoverflow.com/a/21952304
tagged with: java
type: Question

http://stackoverflow.com/a/21939537
type: Answer
score: 1
upvote count: 1
has body: String oldVersion = "v100"; String[] splitString = oldVersion.split("v"); int newVersion = Integer.valueOf(splitString[1])+1; String completeNewVersion = splitString[0] + newVersion; System.out.print(completeNewVersion);
answers question: http://stackoverflow.com/q/21938228
downvote count: 0

methods
tags question: http://stackoverflow.com/q/21992659
tags question: http://stackoverflow.com/q/21843892
tags question: http://stackoverflow.com/q/21966794
tags question: http://stackoverflow.com/q/21920178
tags question: http://stackoverflow.com/q/21868117
tags question: http://stackoverflow.com/q/21900958
tags question: http://stackoverflow.com/q/21892865
tags question: http://stackoverflow.com/q/21887824
tags question: http://stackoverflow.com/q/21956171
tags question: http://stackoverflow.com/q/21843707
tags question: http://stackoverflow.com/q/21883856
tags question: http://stackoverflow.com/q/22000167
tags question: http://stackoverflow.com/q/21962297
tag name: methods
tags question: http://stackoverflow.com/q/21976110
tags question: http://stackoverflow.com/q/21903801
tags question: http://stackoverflow.com/q/21962929
tags question: http://stackoverflow.com/q/21951061
tags question: http://stackoverflow.com/q/21965286
tags question: http://stackoverflow.com/q/21947898
tags question: http://stackoverflow.com/q/21972355
tags question: http://stackoverflow.com/q/21964037
tags question: http://stackoverflow.com/q/21901257
type: Tag
tags question: http://stackoverflow.com/q/21958740
tags question: http://stackoverflow.com/q/21993438
tags question: http://stackoverflow.com/q/21970486
tags question: http://stackoverflow.com/q/21958622
tags question: http://stackoverflow.com/q/21981048
tags question: http://stackoverflow.com/q/21893371
tags question: http://stackoverflow.com/q/21962757
tags question: http://stackoverflow.com/q/21961720
tags question: http://stackoverflow.com/q/21897794
tags question: http://stackoverflow.com/q/21857009
tags question: http://stackoverflow.com/q/21976389
tags question: http://stackoverflow.com/q/21891403
tags question: http://stackoverflow.com/q/21982077
tags question: http://stackoverflow.com/q/21979106
tags question: http://stackoverflow.com/q/21948458
tags question: http://stackoverflow.com/q/21865627
tags question: http://stackoverflow.com/q/21938863
tags question: http://stackoverflow.com/q/21926005
tags question: http://stackoverflow.com/q/21857063
tags question: http://stackoverflow.com/q/21958566
tags question: http://stackoverflow.com/q/21867456
tags question: http://stackoverflow.com/q/21897343
tags question: http://stackoverflow.com/q/21902306
tags question: http://stackoverflow.com/q/21978005
tags question: http://stackoverflow.com/q/21880168
tags question: http://stackoverflow.com/q/21927132
tags question: http://stackoverflow.com/q/21965771
tags question: http://stackoverflow.com/q/21939224
tags question: http://stackoverflow.com/q/21846618
tags question: http://stackoverflow.com/q/21917685
tags question: http://stackoverflow.com/q/21976310
tags question: http://stackoverflow.com/q/21973682
tags question: http://stackoverflow.com/q/21977168
tags question: http://stackoverflow.com/q/21942124
tags question: http://stackoverflow.com/q/21943647
tags question: http://stackoverflow.com/q/21963203

http://stackoverflow.com/comment/33278503
type: Comment
score: 0
type: QuestionComment
has text: Why are you using v13 for `FragmentStatePagerAdapter`?
comment on: http://stackoverflow.com/q/21961762

http://stackoverflow.com/q/21870365
tagged with: ms-office
tagged with: ms-word
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33115992
type: UnansweredQuestion
has body: So after modifying a file in java, code taken from Naresh in: http://www.coderanch.com/t/534754/java/java/Editing-pdf-word-content-text I've noticed something, while it works flawlessly, Office is now telling me: "Office has detected a problem with this file. Editing it may harm your computer" Any way to fix this? I'm opening the file, replacing a text, and then saving a copy of the file.
has comment: http://stackoverflow.com/comment/33154664
has title: After modifying a doc file, office has issues opening it for editing
has comment: http://stackoverflow.com/comment/33140058
answer count: 0
type: Question

http://stackoverflow.com/comment/33346002
has text: Had that before posting. Didn't work.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22001129
score: 0

http://stackoverflow.com/q/21967734
answer count: 1
has answer: http://stackoverflow.com/a/21967881
has comment: http://stackoverflow.com/comment/33286929
has comment: http://stackoverflow.com/comment/33286450
has comment: http://stackoverflow.com/comment/33286875
has comment: http://stackoverflow.com/comment/33286662
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33287095
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33286980
accepted answer: http://stackoverflow.com/a/21967881
has comment: http://stackoverflow.com/comment/33289796
has body: Got a little Problem; il receive a JSON lost array from https://api.twitch.tv/kraken/streams/yeroise and i want the keyword "viewers" (From stream.viewers). So how do i write this command then since the one below doesnt work; json.get("stream.viewers") Full Code; private String readAll(Reader rd) throws IOException { StringBuilder sb = new StringBuilder(); int cp; while ((cp = rd.read()) != -1) { sb.append((char) cp); } return sb.toString(); } public JSONObject readJsonFromUrl(String url) throws IOException, JSONException { InputStream is = new URL(url).openStream(); try { BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); String jsonText = readAll(rd); JSONObject json = new JSONObject(jsonText); return json; } finally { is.close(); } } public void StreamChecker() throws IOException, JSONException { json = readJsonFromUrl("https://api.twitch.tv/kraken/streams/"+ownerchannel); System.out.println(json.get("stream.viewers"));
has comment: http://stackoverflow.com/comment/33286531
type: Question
has title: Get a JSON Keyword out of an Array
has comment: http://stackoverflow.com/comment/33286332
tagged with: arrays
has comment: http://stackoverflow.com/comment/33286642
score: 0
has comment: http://stackoverflow.com/comment/33286767

http://stackoverflow.com/comment/33182272
has text: This question seems more fits for [Ask Ubuntu](http://askubuntu.com/) than here.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21909742

http://stackoverflow.com/comment/33086918
comment on: http://stackoverflow.com/q/21856700
score: 0
type: Comment
has text: Christopher, I know, I'm actually trying things as well. I just can't seem to get anywhere after trying since yesterday
type: QuestionComment

http://stackoverflow.com/q/21987632
downvote count: 0
tagged with: maven-3
favorite count: 0
has comment: http://stackoverflow.com/comment/33322990
has answer: http://stackoverflow.com/a/21991425
has body: i have a maven multi-modular project (model,service,util,webapp). I have a few profiles defined in the pom.xml of the webapp project. Dev <db.driverClass>..</db.driverClass> <db.connectionURL>..</db.connectionURL> <db.username>..</db.username> <db.password>..</db.password> myFolder/myFirstPath/ Prod <db.driverClass>..</db.driverClass> <db.connectionURL>..</db.connectionURL> <db.username>..</db.username> <db.password>..</db.password> myFolder/mySecondPath/ I'm trying to change dynamically the property path that is located in my util project. This is the skeleton of my modular project |-- parent `-- pom.xml |-- model | `-- pom.xml |-- util |--src |--main |--resources |--props props.properties | `-- pom.xml |-- webapp ` -- pom.xml In the pom.xml of the util project i enabled the resource filtering src/main/resources true And finally i wrote pathToChange=${pathFile} in the props.properties file. But when i run mvn jetty:run -P Dev the value of pathToChange property doesn't change. Where am i doing wrong?
score: 2
type: AnsweredQuestion
upvote count: 2
has title: Resource filtering in modular project
tagged with: maven
accepted answer: http://stackoverflow.com/a/21991425
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/33320989
answer count: 1

http://stackoverflow.com/comment/33351941
score: 1
type: Comment
has text: Did you notice that, going backwards, -190/2=-95 and -95+230=135, you're keeping the previous result somewhere every other time
type: QuestionComment
comment on: http://stackoverflow.com/q/22004470

http://stackoverflow.com/comment/33271589
score: 0
type: Comment
type: QuestionComment
has text: What exactly is the error you receive?
comment on: http://stackoverflow.com/q/21959526

http://stackoverflow.com/q/21972190
has body: In the code below, why will it not work if I place an if statement telling it to increment if "root &lt;101;". I have been starring at this and cannot figure out why it doesnt like that. Is this just due to scoping? do { ++root; if ((number / root) == root) { System.out.printf("\nThe square root of %.0f is %.0f.\n", number, root); root = 101; } else if (root == 101) { System.out.printf( "The number %.0f does not have a square root.\n", number); } } while (root &lt; 101); such as this: do { if ((number / root) == root) { System.out.printf("\nThe square root of %.0f is %.0f.\n", number, root); root = 101; } else if (root &lt; 101) { ++root; } else { System.out.printf( "The number %.0f does not have a square root.\n", number); } } while (root &lt; 101);
has comment: http://stackoverflow.com/comment/33294023
has comment: http://stackoverflow.com/comment/33294046
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21972295
tagged with: do-while
tagged with: if-statement
tagged with: java
has comment: http://stackoverflow.com/comment/33293973
has comment: http://stackoverflow.com/comment/33294132
type: Question
score: 0
has comment: http://stackoverflow.com/comment/33294183
has comment: http://stackoverflow.com/comment/33294071
has comment: http://stackoverflow.com/comment/33294094
answer count: 3
has answer: http://stackoverflow.com/a/21972398
has title: Incrementing in an IF Statement
tagged with: increment
has comment: http://stackoverflow.com/comment/33294093
has answer: http://stackoverflow.com/a/21972458

http://stackoverflow.com/a/21955830
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21932184
accepted answer of: http://stackoverflow.com/q/21932184
score: 1
has body: The org.eclipse.ui.newWizards extension point has a finalPerspective argument where you can specify the id of the perspective you want opened at the end of project creation.

http://stackoverflow.com/a/21860680
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/21860573
score: 3
has body: The only difference is that in the second case, variable will still be in scope when the loop is over ,no. of objects that are created in both the cases are equal as Strings are immutable as you have just edit the question still in this case new Objects are created in the memory at each iteration in both the cases

http://stackoverflow.com/q/21916962
tagged with: spring
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33197210
linked to: http://stackoverflow.com/q/13287581
has body: I have two projects. My one project (say project2) depends on another project(project2). Both projects are maven project and project1 is listed in dependancies of project2. When I compile project2, all the class files from project1 should be copied to project2 (I imagine). But, I see that the file size of one of the class files in project1 is different than file size of class file for the same class in project2. If I decompile the files I get following results. Decompiled FacebookUserDetail.class from project1: package com.***.domain.user.external; import com.***.domain.user.UserDetailType; import java.util.List; import javax.persistence.Entity; import javax.persistence.TypedQuery; import org.aspectj.lang.JoinPoint; import org.aspectj.runtime.internal.CFlowCounter; import org.aspectj.runtime.reflect.Factory; import org.springframework.beans.factory.annotation.Configurable; import org.springframework.beans.factory.aspectj.AbstractDependencyInjectionAspect; import org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect; import org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl; @Configurable @Entity public class FacebookUserDetail extends ExternalUserDetail { public FacebookUserDetail() { JoinPoint localJoinPoint = Factory.makeJP(ajc$tjp_1, this, this); if ((!AnnotationBeanConfigurerAspect.ajc$if$bb0((Configurable)getClass().getAnnotation(Configurable.class))) &amp;&amp; (AbstractDependencyInjectionAspect.ajc$if$6f1(localJoinPoint))) AnnotationBeanConfigurerAspect.aspectOf().ajc$afterReturning$org_springframework_beans_factory_aspectj_AbstractDependencyInjectionAspect$2$1ea6722c(this); } public static FacebookUserDetail findFacebookUserDetailByFacebookId(String facebookId) { String str = facebookId; JoinPoint localJoinPoint = Factory.makeJP(ajc$tjp_0, null, null, str); if ((AnnotationDrivenStaticEntityMockingControl.ajc$cflowCounter$1.isValid()) &amp;&amp; (AnnotationDrivenStaticEntityMockingControl.hasAspect())) return (Fa…
has comment: http://stackoverflow.com/comment/33195981
tagged with: aspectj
has comment: http://stackoverflow.com/comment/33196172
has title: Java class file truncated
has answer: http://stackoverflow.com/a/21921524
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33196334
favorite count: 0
type: UnansweredQuestion
tagged with: maven

http://stackoverflow.com/comment/33088650
comment on: http://stackoverflow.com/a/21847427
type: AnswerComment
score: 0
type: Comment
has text: @Srikanth That's a separate question. You may need to consider forking your JVM per test class: http://stackoverflow.com/a/1332135/207238

http://stackoverflow.com/comment/33178407
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21907697
has text: What code is there before the `return` statement in the `try` block, and what exceptions can this code code throw?
score: 0

http://stackoverflow.com/q/21974854
favorite count: 0
has comment: http://stackoverflow.com/comment/33391174
linked to: http://stackoverflow.com/q/13239975
tagged with: deltaspike
type: UnansweredQuestion
score: 1
tagged with: wildfly
has comment: http://stackoverflow.com/comment/33464362
has comment: http://stackoverflow.com/comment/33391581
upvote count: 1
tagged with: seam3
has comment: http://stackoverflow.com/comment/33385734
has comment: http://stackoverflow.com/comment/33318047
tagged with: seam
tagged with: java
has body: I am migrating from Seam 3 to DeltaSpike on WildFly 8 (Java EE 7). What is the equivalent DeltaSpike file to Seam's seam-beans.xml? Could you tell me any more info? Edit: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:j="urn:java:ee" xmlns:s="urn:java:seam:core" xmlns:c="urn:java:xxx.xxxxxxxxx.core.model"&gt; &lt;c:Configuration&gt; &lt;j:modifies /&gt; &lt;c:tradingEnabled&gt;false&lt;/c:tradingEnabled&gt; &lt;c:defaultCurrency&gt;USD&lt;/c:defaultCurrency&gt; &lt;c:defaultPeriodLength&gt;300000&lt;/c:defaultPeriodLength&gt; &lt;c:updateTime&gt;5&lt;/c:updateTime&gt; &lt;/c:Configuration&gt; .... This what I did with seam-beans.xml, which did not work for me in beans.xml (values are not injected). Thanks
has answer: http://stackoverflow.com/a/22201631
has title: From Seam 3 to Apache DeltaSpike (seam-beans.xml)
has comment: http://stackoverflow.com/comment/33392808
type: Question
has comment: http://stackoverflow.com/comment/33385829
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/39699358
type: QuestionComment
has text: You might find this easier to do with [JNA](https://github.com/twall/jna)
score: 0
comment on: http://stackoverflow.com/q/21909617
type: Comment

http://stackoverflow.com/a/21913148
answers question: http://stackoverflow.com/q/21912314
type: Answer
upvote count: 11
score: 11
has comment: http://stackoverflow.com/comment/47608584
has body: Navigating through Netbeans (Ctrl + Click), I landed in this code. It seems to be using an ArrayList as Supplier. public static &lt;T&gt; Collector&lt;T, ?, List&lt;T&gt;&gt; toList() { return new CollectorImpl&lt;&gt;((Supplier&lt;List&lt;T&gt;&gt;) ArrayList::new, List::add, (left, right) -&gt; { left.addAll(right); return left; }, CH_ID); }
downvote count: 0
has comment: http://stackoverflow.com/comment/81881048

http://stackoverflow.com/comment/33262279
score: 0
type: Comment
type: QuestionComment
has text: If i remove autowire="byType" spring will inject only employee dependency but not others. As i said in my post i want both
comment on: http://stackoverflow.com/q/21954560

http://stackoverflow.com/comment/33269330
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21958306
has text: Your assumption about dir class is correct. Better separation of concerns. Thanks.
type: Comment

http://stackoverflow.com/comment/33073377
has text: @Dropout: you still not using hashmap keys as keys, you could switch it even for List.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21848032
type: AnswerComment

http://stackoverflow.com/q/21955338
favorite count: 0
upvote count: 2
tagged with: sockets
score: -3
has body: I am new to programming in Java and would like to send messages from a client to a server using If Statements. So I'm developing a Bukkit Plugin that will be used on a server WITHOUT BungeeCord. What I would like to do is when someone sends a command (ex:On server 1) that my plugin recognizes, I would like it to execute on that server and send the command to another server for it to execute it. if (cmd.equalsIgnoreCase("OTWG")) { if (args[0].equalsIgnoreCase("kick")) { if (sender instanceof Player) { // prevents possible NPE if (sender.hasPermission("net.OTWG.kick")) { if (args.length == 1) { sender.sendMessage(ChatColor.DARK_RED + "[OTWG] " + ChatColor.GRAY + "Please enter a players name!"); return true; } else if (args.length &gt;= 2) { // Corrected from: args.length &gt; 1 Player target = Bukkit.getServer().getPlayerExact(args[1]); if (target != null) { // prevents possible NPE target.kickPlayer(ChatColor.DARK_RED + "[OTWG] " + ChatColor.GRAY + "You were kicked by " + sender.getName()); Bukkit.getServer().broadcastMessage(ChatColor.DARK_RED + "[OTWG]" + ChatColor.GRAY + "The player " + target.getName() + " was kicked by " + sender.getName()); return true; } } } else { sender.sendMessage(ChatColor.DARK_RED + "[OTWG] " + ChatColor.GRAY + "You do not have the permissions to do this action."); } } else { if (sender.hasPermission("net.OTWG.kick")) { if (args.length == 1) { sender.sendMessage(ChatColor.DARK_RED + "[OTWG] " + ChatColor.GRAY + "Please enter a players name!"); return true; } else if (args.length &gt;= 2) { // Corrected from: args.length &gt; 1 Player target = Bukkit.getServer().getPlayerExact(args[1]); if (target != null) { // prevents possible NPE target.kickPlayer(ChatColor.DARK_RED + "[OTWG] " + ChatColor.GRAY + "You were kicked by " + sender.getName()); Bukkit.getServer().broadcastMessage(ChatColor.DARK_RED + "[OTWG]" + ChatColor.GRAY + "The player " + target.getName() + " was kicked by " + sender.getName()); return true; } } } else { sender.sendMessa…
has comment: http://stackoverflow.com/comment/33265783
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33263715
tagged with: java
tagged with: bukkit
accepted answer: http://stackoverflow.com/a/22264993
type: Question
has comment: http://stackoverflow.com/comment/33263700
tagged with: if-statement
has title: Trying To Send commands to Bukkit server using sockets
has comment: http://stackoverflow.com/comment/33273410
downvote count: 5
has comment: http://stackoverflow.com/comment/33264248
has comment: http://stackoverflow.com/comment/33263628
has comment: http://stackoverflow.com/comment/33273017
answer count: 1
has answer: http://stackoverflow.com/a/22264993

http://stackoverflow.com/q/21969197
has title: Hibernate throws queries even on cache hits
score: 1
favorite count: 0
tagged with: ehcache
type: Question
has answer: http://stackoverflow.com/a/21970139
tagged with: spring
tagged with: java
tagged with: hibernate
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/21970139
has body: I'm not sure if it's a real problem or it's only a matter of configuration but I can see on my log console how hibernate hits (or at least throws the select query) even on cache hits. I've checked the cache is properly working on Ehcache monitor and it registers 100% of hits for a certain request. But I always see the queries in the log. All entities are anotated as shown: @Entity @Cacheable @Cache(usage = READ_WRITE) @Table(name = "city") //@NamedQuery(name = "city.findById", query = "from City where ID = :id") public class City extends Audit implements Serializable { My ehcache.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" dynamicConfig="true" monitoring="autodetect"&gt; &lt;!-- Location of persistent caches on disk --&gt; &lt;diskStore path="java.io.tmpdir/MxlServiceLayer" /&gt; &lt;cacheManagerPeerListenerFactory class="org.terracotta.ehcachedx.monitor.probe.ProbePeerListenerFactory" properties="monitorAddress=localhost, monitorPort=9889, memoryMeasurement=true" /&gt; &lt;defaultCache eternal="false" maxElementsInMemory="1000" overflowToDisk="false" diskPersistent="false" timeToIdleSeconds="0" timeToLiveSeconds="600" memoryStoreEvictionPolicy="LRU" statistics="true" /&gt; &lt;cache name="authToken" eternal="false" maxElementsInMemory="100" overflowToDisk="false" diskPersistent="true" timeToIdleSeconds="0" timeToLiveSeconds="31536000" memoryStoreEvictionPolicy="LRU" statistics="true" /&gt; &lt;/ehcache&gt; And what I see in my over and over again... Hibernate: select city0_.ID as ID2_, city0_.CREATED as CREATED2_, city0_.CREATOR as CREATOR2_, city0_.MODIFIED as MODIFIED2_, city0_.MODIFIER as MODIFIER2_, city0_.NAME as NAME2_, city0_.state_fk as state7_2_ from city city0_ where State_fk=? Is hibernate really hitting the DB? Can anyone explain this to me, please? I'm using: JPA 2.0 in Spring Data JPA 1.2.0 Ehcache 2.6.0 Spring 3.2.1
type: AnsweredQuestion
tagged with: jpa
downvote count: 0

http://stackoverflow.com/comment/33186495
has text: Did you try something like that? List<Sensor> entries = xmlMmapper.readValue(conn.getInputStream(), new TypeReference<List<Sensor>>() {});
type: QuestionComment
comment on: http://stackoverflow.com/q/21911199
type: Comment
score: 1

http://stackoverflow.com/comment/33098866
type: QuestionComment
comment on: http://stackoverflow.com/q/21863058
has text: Also note that you don't need to use `File.createNewFile()` at all. Creating the `FileWriter` will create the file if necessary.
score: 3
type: Comment

http://stackoverflow.com/a/21883102
has body: A pop gets the topmost value from the stack and removes it from the stack. So you would need to do i = pop; j = pop; push(i + top) Example: Operation Stack 1 1 3 i = pop 1 3 j = pop 3 push(i+top) 4 3
answers question: http://stackoverflow.com/q/21882829
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21882829

http://stackoverflow.com/comment/33266817
type: AnswerComment
has text: fm.setText() was typo, it's fm.setMyText, and if your fragment is inflated it should be inside fragmentmanager. The point is you need to find inflated fragment and set the text.
comment on: http://stackoverflow.com/a/21956192
type: Comment
score: 0

stdout
tags question: http://stackoverflow.com/q/21965019
type: Tag
tag name: stdout

http://stackoverflow.com/q/21939224
score: 0
has comment: http://stackoverflow.com/comment/33234507
has answer: http://stackoverflow.com/a/21939274
answer count: 1
tagged with: methods
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21939274
has body: public static String factorX(long x){ String factor=""; long number = x; long i = 2; while (i &lt; number) { if (number % i == 0) { factor += i+", "; number /= i; } else { i++; } } return factor; For example if I put 120, i get 2,2,2,3. I am missing factor 5. Everything else works find; is just that thing that is not displayed.....................................................................
has title: How can I mix the method so that all factors are display? I am missing one more factor
type: Question

http://stackoverflow.com/comment/33346764
comment on: http://stackoverflow.com/q/22001625
has text: Can you write in words _exactly_ what `makeDeck()` should do? Then, you might have some ideas about how to translate that to Java.
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/comment/33513005
type: Comment
has text: Did it work? Did you find another solution? Consider selecting an answer as the correct one or putting down your own answer if you found a separate solution
comment on: http://stackoverflow.com/a/21929660
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33542204
type: QuestionComment
has text: You don't need to keep creating and closing `DatagramSockets.` This is half the problem. You only need one for the server and one for the client, and they can exist for the lifetime of the program in each case. You also don't need to bind the client socket to any specific port. The server should reply to the source-address contained in any datagrams it receives.
type: Comment
comment on: http://stackoverflow.com/q/22003570
score: 1

http://stackoverflow.com/a/21987778
answers question: http://stackoverflow.com/q/21987507
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/33322108
accepted answer of: http://stackoverflow.com/q/21987507
has body: The exception is saying that this class: org.apache.solr.client.solrj.SolrServerException cannot be found in the webapp's classpath. According to the findjar service, that class is defined solr-core-1.3.0.jar and solr-solrj-1.3.0.jar. You may need to update your build procedure to include one of those JARs in the WAR file. (If you are using Maven, add a runtime dependency for the relevant artifact to the POM file ...)

http://stackoverflow.com/comment/33266616
type: Comment
has text: Thanks but it came up with some errors. Firstly, it finds `findViewById(R.id.article_fragment);` as undefined for fragment manager. Also same thing for `fm.setText`. Secondly, I noticed you did not use the setMyText method, or Im wrong ?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21956192

http://stackoverflow.com/comment/58182806
type: QuestionComment
has text: does your drive contains rt.jar? That should dissapear on Java 9 and could perhaps make a serious mess.
score: 0
comment on: http://stackoverflow.com/q/21878004
type: Comment

http://stackoverflow.com/q/21984308
answer count: 0
type: UnansweredQuestion
has body: InetAddress.getByName(address).isReachable(timeout); I am using this line to ping, and i wonder what is the propriate timeout to ping ? I use 1000 but it doesn't work properly than i changed to 2000?
tagged with: java
has comment: http://stackoverflow.com/comment/33316013
type: Question
has title: How to do true pingin in java code?
score: 0
has comment: http://stackoverflow.com/comment/33315587
has comment: http://stackoverflow.com/comment/33315304
has comment: http://stackoverflow.com/comment/33330622
linked to: http://stackoverflow.com/q/9922543

http://stackoverflow.com/comment/33151317
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/21891970
has text: Compiler can't know value of `i` at compilation time so concatenation must be done at runtime, that is why it is compiled to use another StringBuilder.

http://stackoverflow.com/comment/33103578
score: 0
type: AnswerComment
type: Comment
has text: Yeah that was my first idea but I just wanted to ask if there was a more elegant way using NumberFormat.
comment on: http://stackoverflow.com/a/21865457

http://stackoverflow.com/q/21977844
has comment: http://stackoverflow.com/comment/33304189
has body: I have been working a program for a long time and am stuck. The program has a file with infix values in the file. It reads the file and converts the infix to postfix then a class takes the postfix value and evaluates it. I have converted to postfix but can’t send the string for evaluation in the other class. I am using my own stack for this. I must be doing something wrong. I hope someone here can help me with this. import java.io.*; import java.util.Scanner; public class Driver { public static void main(String[] args) throws IOException { PrintWriter pw = new PrintWriter(new FileWriter("output.txt")); Scanner fileScan = new Scanner(new File("infix.txt")); InfixToPostfix infix = new InfixToPostfix(pw); EvalPostfix evpostfix = new EvalPostfix(pw); while(fileScan.hasNext()) { String stringinfix = fileScan.nextLine(); infix.convertToPostfix(stringinfix); //CAN'T PASS POSTFIX STRING FROM INFIXTOPOSTFIX CLASS OVER TO EVALPOSTFIX CLASS //evpostfix.convertToPostfix(postfix); } fileScan.close(); pw.close(); } } public class InfixToPostfix { // Constructor: private PrintWriter pw; ObjectStack operatorStack = new ObjectStack(); String stringinfix; StringBuffer postfix; public InfixToPostfix(PrintWriter pw) { this.pw = pw; } // Method to convert infix to postfix: public String convertToPostfix(String stringinfix) { System.out.print("infix: " + stringinfix + "\n"); pw.println("Infix: " + stringinfix); // Return a postfix representation of the expression in infix. char c; // the first character of a token StringTokenizer parser = new StringTokenizer(stringinfix,"+-*/^() ",true); // StringTokenizer for the input string //StringBuffer postfix = new StringBuffer(stringinfix.length()); // result postfix = new StringBuffer(stringinfix.length()); // Process the tokens. while (parser.hasMoreTokens()) { String token = parser.nextToken(); // get the next token c = token.charAt(0); // the first character of this token if ((token.length() == 1) &amp;&amp; isOperator(c)) { // if token is //…
has comment: http://stackoverflow.com/comment/33304880
score: 0
has title: Can't send postfix for evaluation to class
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33304451
answer count: 0
tagged with: stack
tagged with: java
type: Question

xpath
tags question: http://stackoverflow.com/q/21942680
tags question: http://stackoverflow.com/q/21932628
tags question: http://stackoverflow.com/q/21893563
tags question: http://stackoverflow.com/q/21876386
tags question: http://stackoverflow.com/q/21892347
tags question: http://stackoverflow.com/q/21973777
tags question: http://stackoverflow.com/q/21914748
tags question: http://stackoverflow.com/q/21987780
tag name: xpath
tags question: http://stackoverflow.com/q/21987930
tags question: http://stackoverflow.com/q/21998672
tags question: http://stackoverflow.com/q/21892639
tags question: http://stackoverflow.com/q/21863035
tags question: http://stackoverflow.com/q/21892880
tags question: http://stackoverflow.com/q/21867365
type: Tag
tags question: http://stackoverflow.com/q/21879321
tags question: http://stackoverflow.com/q/21933384
tags question: http://stackoverflow.com/q/21865501
tags question: http://stackoverflow.com/q/21945377
tags question: http://stackoverflow.com/q/21884010
tags question: http://stackoverflow.com/q/21879867

http://stackoverflow.com/q/21976557
has body: I am having trouble storing values from a file. 3 10 2 100 35 5 4 17 20 3 5 6 10 6 9 12 15 18 21 24 27 30 33 I wish to store the first line as an integer and the other lines with multiple values as separate int arrays. BufferedReader br = null; try { String sCurrentLine; br = new BufferedReader(new FileReader("candy.dat")); while ((sCurrentLine = br.readLine()) != null) { System.out.println(sCurrentLine); } } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null)br.close(); } catch (IOException ex) { ex.printStackTrace(); } } Is there another way to do so? Thanks EDIT: Basically the first integer (in this example is 3) will represent how many test cases there are to follow. Each test case will be followed by two lines. So the first test case is [10, 2] [100, 35]. EDIT2: I managed to fix my problem if anyone was wondering. this is my code Scanner sc = new Scanner(new File("candy.dat")); String testCase = sc.nextLine(); String[] numOfCandy = new String[0]; String[] NK = new String[0]; for (int i = 0; i &lt; Integer.parseInt(testCase); i++) { System.out.println("test case " + (i+1)); NK = sc.nextLine().split(" "); numOfCandy = sc.nextLine().split(" "); //System.out.println(NK[0] + " " + NK[1]); //System.out.println(numOfCandy[0] + " " + numOfCandy[1]); find(NK[0], NK[1], numOfCandy); //method to solve problem } I first stored the testcase value, which is 3, to tell the for loop how many times to run. I instantiated 2 String arrays for later use. Inside the for loop, I read the next line and split it to store into string array NK, and then the line after that to store into numOfCandy. From there, I was able to successfully retrieve data from the arrays to solve my problem.
has comment: http://stackoverflow.com/comment/33302635
answer count: 1
has comment: http://stackoverflow.com/comment/33301992
has answer: http://stackoverflow.com/a/21976832
type: UnansweredQuestion
tagged with: store
tagged with: java
tagged with: file
has title: Alternative read file method
type: Question
tagged with: arrays
score: 0

http://stackoverflow.com/comment/33171048
type: Comment
has text: OH, You need to Create it in your project. and make it the default class to run when you Run you project.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21903369

http://stackoverflow.com/a/21900662
upvote count: 7
downvote count: 0
answers question: http://stackoverflow.com/q/21900632
type: Answer
has body: private modifer Methods, Variables and Constructors that are declared private can only be accessed within the declared class itself.
score: 7
has comment: http://stackoverflow.com/comment/33166457

http://stackoverflow.com/comment/33150505
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21891577
has text: "but that doesn't do what I want." - and what does it?
score: 0

http://stackoverflow.com/a/21920321
upvote count: 4
has body: Your code could be simplified a bit: public static void compare_letters(String name1, String name2) { int equal_letters = 0 ; for( char c1 : name1.toCharArray() ) for( char c2 : name2.toCharArray() ) if( c1 == c2 ) equal_letters++; System.out.println("num of equal letters " + equal_letters); } But note that this way of comparing will double-count repeated letters, e.g. comparing "aa" to "aa" will return four, because each a in one string will be compared to each a in the other. If you want to count common letters without double-counting repetitions, you'd need to do something like public static void compare_letters(String name1, String name2) { // Declare a couple of sets: sets don't allow duplicate elements. Set&lt;Character&gt; letters1 = new HashSet&lt;Character&gt;(); Set&lt;Character&gt; letters2 = new HashSet&lt;Character&gt;(); // Populate the sets with the letters from the strings. for( char c : name1.toCharArray() ) letters1.add(c); for( char c : name2.toCharArray() ) letters2.add(c); // remove anything that isn't in letters2 from letters1 letters1.retainAll(letters2); // letters1 is now the set of letters that appear in both names. // Its size is the number of common letters. System.out.println("num of equal letters " + letters1.size();); }
answers question: http://stackoverflow.com/q/21920137
downvote count: 0
has comment: http://stackoverflow.com/comment/33202629
score: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21920137
type: Answer

http://stackoverflow.com/comment/33123689
comment on: http://stackoverflow.com/q/21875105
score: 0
type: Comment
type: QuestionComment
has text: @RaviShekhar You can look at this posts: [Use custom fonts when creating pdf using iReport](http://stackoverflow.com/q/8985497/876298) & [iReport external font](http://stackoverflow.com/q/9256114/876298)

http://stackoverflow.com/comment/33417894
score: 0
type: Comment
has text: I think you're right about the solution that I've to create a daemon. However, I've understood in your answer that the child process doesn't work with `&`, it is the opposite, `&` working. Your reply has been very helpful, thanks.
comment on: http://stackoverflow.com/a/21985352
type: AnswerComment

http://stackoverflow.com/comment/33348266
type: AnswerComment
comment on: http://stackoverflow.com/a/22002480
has text: Thanks, modified the answer to use this
type: Comment
score: 0

http://stackoverflow.com/q/21849602
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/34498634
has comment: http://stackoverflow.com/comment/33074695
has body: I'm trying to play video but having no luck so I'm testing with some bare bones code to see what the problem is. The following doesn't work and I'm not really sure why: Manifest: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.videotest" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&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.videotest.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; MainActivity: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); VideoView vid = (VideoView) findViewById(R.id.videoView1); Uri vidUri = Uri.parse("http://somewebsite.com/somevideo.mp4"); vid.setVideoURI(vidUri); vid.setMediaController(new MediaController(this)); vid.start(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } } activity_main: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingT…
type: Question
has title: Android: how to play mp4 video from URL?
has comment: http://stackoverflow.com/comment/33074729
has answer: http://stackoverflow.com/a/21849939
upvote count: 6
has answer: http://stackoverflow.com/a/41929411
has answer: http://stackoverflow.com/a/21849982
favorite count: 0
answer count: 5
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21849950
score: 6
tagged with: http://stackoverflow.com/tag/xml
tagged with: video
has comment: http://stackoverflow.com/comment/33074741

http://stackoverflow.com/a/22833526
has body: Check this thread, it explains how controller buttons are assigned: http://slick.ninjacave.com/forum/viewtopic.php?t=3271&amp;view=next
accepted answer of: http://stackoverflow.com/q/21889908
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21889908
type: Answer
score: 0

http://stackoverflow.com/a/21970456
accepted answer of: http://stackoverflow.com/q/21970441
type: Answer
answers question: http://stackoverflow.com/q/21970441
downvote count: 0
has body: There is no return type for getDeck, you need to specify it as ArrayList&lt;Integer&gt; or any of its supertype in your case public static ArrayList&lt;Integer&gt; getDeck(ArrayList&lt;Integer&gt; cards) { for (int total = 1; total !=5; total++) { for (int suit = 1; suit != 14; suit++) { cards.add(suit); } } Collections.shuffle(cards); // Randomize the list return cards; }
has comment: http://stackoverflow.com/comment/33291224
score: 5
has comment: http://stackoverflow.com/comment/33290878
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33291391
upvote count: 5

http://stackoverflow.com/q/21973163
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33295548
accepted answer: http://stackoverflow.com/a/21973187
possible better answer: http://stackoverflow.com/a/21973184
has answer: http://stackoverflow.com/a/21973184
has comment: http://stackoverflow.com/comment/33297669
has title: how to find out if user input has x characters
has comment: http://stackoverflow.com/comment/33295542
favorite count: 0
has comment: http://stackoverflow.com/comment/33296569
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21973187
score: 1
tagged with: java
has body: trying to make another &amp;&amp; to see if the lock_combination is exactly 9 characters long import java.util.Scanner; public class charlespeppers { public static void main(String[] args) { Scanner user_input = new Scanner (System.in); String lock_combination; System.out.print ("Please enter a lock combination ( ddRddLddR ) : "); lock_combination = user_input.next(); if (lock_combination.charAt(0) &gt;= '0' &amp;&amp; lock_combination.charAt(0)&lt;= '9' &amp;&amp; lock_combination.charAt(1) &gt;= '0' &amp;&amp; lock_combination.charAt(1)&lt;= '9' &amp;&amp; lock_combination.charAt(3) &gt;= '0' &amp;&amp; lock_combination.charAt(3)&lt;= '9' &amp;&amp; lock_combination.charAt(4) &gt;= '0' &amp;&amp; lock_combination.charAt(4)&lt;= '9' &amp;&amp; lock_combination.charAt(6) &gt;= '0' &amp;&amp; lock_combination.charAt(6)&lt;= '9' &amp;&amp; lock_combination.charAt(7) &gt;= '0' &amp;&amp; lock_combination.charAt(7)&lt;= '9' &amp;&amp; lock_combination.charAt(2) == 'R' &amp;&amp; lock_combination.charAt(8) == 'R' &amp;&amp; lock_combination.charAt(5) == 'L' &amp;&amp; lock_combination == 9); { System.out.println("This is a valid lock combination."); } } }
type: Question

http://stackoverflow.com/comment/33291878
type: AnswerComment
has text: yes RunJetty and ClientServlet are inside the same package. Still not working!! :(
type: Comment
comment on: http://stackoverflow.com/a/21958720
score: 0

http://stackoverflow.com/a/21964870
has comment: http://stackoverflow.com/comment/33281836
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33282378
has comment: http://stackoverflow.com/comment/33281442
has body: What has happened is that the GC has crashed. The most likely cause is that something else (e.g. some native code library) has corrupted some heap objects, and that the GC has been tripped up by the corruption. So what can you do? Well the first thing I would try would be to upgrade to the latest patch of Java 7 and see it the problem recurs. Java 7u25 is rather old, and if the problem is caused by some bug in the JVM or the standard libraries, there is a good chance that it has already been fixed. If that fails, take a look at any native code libraries you wrote yourself: Are you doing things that could corrupt the heap? Are the libraries thread-safe? Then look at the native libraries you may have included as part of 3rd-party libraries you are using. Do they claim to be thread-safe? Are there reports of related JVM crashes? I would not blame this on a full heap. Heap par new generation total 118016K, used 118016K [0x6fef0000, 0x77ef0000, 0x77ef0000) eden space 104960K, 100% used [0x6fef0000, 0x76570000, 0x76570000) from space 13056K, 100% used [0x76570000, 0x77230000, 0x77230000) to space 13056K, 100% used [0x77230000, 0x77ef0000, 0x77ef0000) concurrent mark-sweep generation total 1966080K, used 383181K [0x77ef0000, 0xefef0000, 0xefef0000) concurrent-mark-sweep perm gen total 51256K, used 29682K [0xefef0000, 0xf30fe0 The "new" generation is full, but there is lots of space in the "concurrent mark-sweep" generation. What was happening was that the collector was starting to collect the "new" generation when it ran into the heap corruption that crashed it. (There are various clues in the native stack trace at the beginning of the dump.)
answers question: http://stackoverflow.com/q/21964620
type: Answer
has comment: http://stackoverflow.com/comment/33282524

http://stackoverflow.com/comment/33273040
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21921860
type: Comment
has text: hahahaha that's pretty funny XD don't worry it's just my own project XD XD

http://stackoverflow.com/q/21973807
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/33296751
has answer: http://stackoverflow.com/a/21973930
answer count: 2
upvote count: 0
has title: Java text analysis program
has answer: http://stackoverflow.com/a/21973872
favorite count: 0
type: UnansweredQuestion
downvote count: 1
has body: The following requisites are those for the program I'm currently having an issue with: The program must be able to open any text file specified by the user, and analyze the frequency of verbal ticks in the text. Since there are many different kinds of verbal ticks (such as "like", "uh", "um", "you know", etc) the program must ask the user what ticks to look for. A user can enter multiple ticks, separated by commas. The program should output: the total number of tics found in the text the density of tics (proportion of all words in the text that are tics) the frequency of each of the verbal tics the percentage that each tic represents out of all the total number of tics My program is working very well, but what I basically need to do is that I must use separate methods for each component of the analysis. So I think the idea is that I need to split up the program in a few parts, which I have done by using the comments // because I'm basically having problems determining which type I should return, I know the last part (// public static void output(){) should definitely be void because it returns nothing and only prints out. public static void main(String[] args) throws FileNotFoundException { double totalwords = 0; // double so density (totalwords/totalticks) returned can be double int totalticks = 0; System.out.println("What file would you like to open?"); Scanner sc = new Scanner(System.in); String files = sc.nextLine(); Scanner input = new Scanner(new File(files)); // public static int[] initialise() System.out.println("What words would you like to search for? (please separate with a comma)"); String ticks = sc.nextLine(); ticks = ticks.toLowerCase(); String[] keys = ticks.split(","); int[] values = new int[keys.length]; // public static int[] processing(){? for (int z=0; z&lt;keys.length; z++){ values[z] = 0; } while (input.hasNext()){ String next = input.next(); totalwords++; for (int x = 0; x&lt;keys.length; x++){ if (next.toLowerCase().equals(keys[x])){ values[…

http://stackoverflow.com/q/21918097
tagged with: java
type: Question
score: 2
has body: I am having an issue with a client that is using some crazy (it likely isn't crazy, I really mean unfamiliar to myself ;) ) ruby rails plugin to handle the uploading of images with data attached. The way they say the server is looking for the information is { "objectname"{ "field"=&gt;"value" "field"=&gt;"value" "photo"=&gt;#&lt;ActionDispatch::Http::UploadedFile:0x00000004864fd0 @original_filename="avatar.png", @content_type="image/png", @headers="Content-Disposition: form-data; name=\"aPhoto\"; filename=\"avatar.png\"\r\nContent-Type: image/png\r\n", @tempfile=#&lt;File:/tmp/RackMultipart20140211-8-1456165191981&gt; } } the problem is that with MultiPartEntity (which is what they say to use) all I can do is get the server to see this { "field"=&gt;"value" "field"=&gt;"value" "photo"=&gt;#&lt;ActionDispatch::Http::UploadedFile:0x00000004864fd0 @original_filename="avatar.png", @content_type="image/png", @headers="Content-Disposition: form-data; name=\"aPhoto\"; filename=\"avatar.png\"\r\nContent-Type: image/png\r\n", @tempfile=#&lt;File:/tmp/RackMultipart20140211-8-1456165191981&gt; } that extra layer of wrapping is proving difficult. here is how I have it, how can I achieve that extral layer under that key "objectname"? MultipartEntity multiPartEntity = new MultipartEntity(HttpMultipartMode.STRICT, null, Charset.forName("UTF-8")); ByteArrayBody imageByteArrayBody = new ByteArrayBody(imageBytes, "image/png", "avatar.png"); FormBodyPart imageFormBodyPart = new FormBodyPart("photo", imageByteArrayBody); // sanity checks to make sure the headers are right imageFormBodyPart.addField("Content-Disposition", "form-data; name=\"aPhoto\""); imageFormBodyPart.addField("name", "aPhoto"); imageFormBodyPart.addField("filename", "avatar.png"); imageFormBodyPart.addField("Content-Type", "image/png"); // add the image body part to the multipart entity multiPartEntity.addPart(imageFormBodyPart); // add customer data Map&lt;String, String&gt; customerMap = user.getUserMap(); // loop …
downvote count: 0
answer count: 1
favorite count: 0
has title: multipartentity that seems to be multiple levels deep?
tagged with: android
tagged with: multipartform-data
has answer: http://stackoverflow.com/a/33659420
tagged with: ruby
upvote count: 2
type: UnansweredQuestion
tagged with: ruby-on-rails

http://stackoverflow.com/q/21932184
has comment: http://stackoverflow.com/comment/33262636
tagged with: eclipse
upvote count: 1
tagged with: perspective
answer count: 1
has comment: http://stackoverflow.com/comment/33221917
favorite count: 0
has body: I am developing a New Project Wizard as an Eclipse plug-in. I made it, but I don't know how to open it in particular perspective, say Java perspective. Any ideas on this?
tagged with: plugins
has title: How to make project be opened in a particular perspective?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33222219
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21955830
accepted answer: http://stackoverflow.com/a/21955830
type: Question

http://stackoverflow.com/comment/33688533
type: AnswerComment
has text: I tested it also with EclipseLink and it does not set the position field either. I checked the JPA spec, and it is really obscurely formulated that `The OrderColumn annotation may be specified on a one-to-many or many-to-many relationship or on an element collection. The OrderColumn annotation is specified on the side of the relationship that references the collection that is to be ordered. The order column is not visible as part of the state of the entity or embeddable class.[107]`. So I am not sure if that should really be supported, but I admit that it is not a big problem to fix it.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22183095

http://stackoverflow.com/comment/33125689
has text: The char is 16 bits. It is very unlikely that the msb is set.
comment on: http://stackoverflow.com/a/21877875
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33455464
comment on: http://stackoverflow.com/a/22020285
score: 0
type: AnswerComment
has text: Please upvote my answer since it helped solving your issue, Thanks.
type: Comment

http://stackoverflow.com/comment/33329312
score: 0
comment on: http://stackoverflow.com/q/21991788
has text: Why is the text file no longer possible though? Jorge_B's answer is a valid solution, but so is the existing file-exchange idea.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21988042
has comment: http://stackoverflow.com/comment/33321958
has comment: http://stackoverflow.com/comment/33321770
type: Question
has comment: http://stackoverflow.com/comment/33321738
answer count: 1
has comment: http://stackoverflow.com/comment/33321713
has body: I have an Object Person(id, name). public class Person { /** Personid. **/ private Long personId; /** Person Adresse. **/ private String adresse // Getters, Setters How can i remove duplicate person (who have same id) using CollectionUtils ? For example Person1(10, aaaa), Person2(10, bbbb), Person3(20, cccc) Result => Person1(10, aaaa), Person3(30, cccc) EDIT : This Solution work using Set and overrinding equals and hashcode: List&lt;Person&gt; oldPerson = new ArrayList&lt;&gt;(); //oldPerson.add ... Set&lt;Person&gt; newPerson = new HashSet&lt;&gt;(oldPerson); List&lt;Person&gt; theRightPerson = new ArrayList&lt;&gt;(newPerson); The solution that i m looking for is something like : List&lt;Person&gt; theRightPerson = (List&lt;Person&gt;) CollectionUtils.collect(oldPerson, new Transformer() { @Override public Object transform(Object input) { // TODO Auto-generated method stub return null; } })
has comment: http://stackoverflow.com/comment/33321911
has comment: http://stackoverflow.com/comment/33321779
has comment: http://stackoverflow.com/comment/33321671
score: 0
linked to: http://stackoverflow.com/q/3559731
has comment: http://stackoverflow.com/comment/33321638
linked to: http://stackoverflow.com/q/6680157
has comment: http://stackoverflow.com/comment/33321729
has comment: http://stackoverflow.com/comment/33322225
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33322154
has answer: http://stackoverflow.com/a/21992231
has title: Collection Utils removing duplicates object
tagged with: performance
has comment: http://stackoverflow.com/comment/33321524
has comment: http://stackoverflow.com/comment/33321580
has comment: http://stackoverflow.com/comment/33321689
tagged with: java

http://stackoverflow.com/comment/33340798
comment on: http://stackoverflow.com/a/21998313
type: Comment
has text: @AndyG how do i move it now ?
score: 0
type: AnswerComment

http://stackoverflow.com/a/21958307
has comment: http://stackoverflow.com/comment/33272096
has comment: http://stackoverflow.com/comment/33273014
has comment: http://stackoverflow.com/comment/33269055
upvote count: 0
answers question: http://stackoverflow.com/q/21958147
has comment: http://stackoverflow.com/comment/33269027
score: -1
has comment: http://stackoverflow.com/comment/33269446
type: Answer
has body: Add a mouseListener instead of your actionListener method. addressBar.addMouseListener(new MouseAdapter(){ @Override public void mouseClicked(MouseEvent e){ addressBar.setText(""); }
downvote count: 1
has comment: http://stackoverflow.com/comment/33269081
has comment: http://stackoverflow.com/comment/33269088

http://stackoverflow.com/a/21871562
score: 0
accepted answer of: http://stackoverflow.com/q/21871419
has body: Better use dimension to define size.. res>values-hdpi>dimen.xml dimen.xml 20dp And in the same way res>values-xhdpi>dimen.xml dimen.xml 30dp Like so on for other density.
type: Answer
answers question: http://stackoverflow.com/q/21871419
type: AcceptedAnswer

http://stackoverflow.com/a/31452951
has body: String a = "jklmn489pjro635ops"; int sum = 0; for(int i = 0; i &lt; a.length(); i++) { if(Character.isDigit(a.charAt(i))) { sum = sum + Integer.parseInt(a.charAt(i) + ""); } } System.out.println(sum);
answers question: http://stackoverflow.com/q/21937091
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/21949033
has comment: http://stackoverflow.com/comment/33252691
type: Answer
accepted answer of: http://stackoverflow.com/q/21949020
answers question: http://stackoverflow.com/q/21949020
has comment: http://stackoverflow.com/comment/33252755
upvote count: 3
has comment: http://stackoverflow.com/comment/33252733
downvote count: 0
has comment: http://stackoverflow.com/comment/33252789
has body: http://&lt;your-ipaddress&gt;:8080 Make sure your firewall permits TCP on port 8080
has comment: http://stackoverflow.com/comment/33252700
score: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/33243456
type: Comment
comment on: http://stackoverflow.com/a/21943790
has text: I guess yeah. Good Idea.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33296819
type: QuestionComment
has text: You can create function in your backing bean with parameter _device_ which return date based on timeZone. And use this function in `h:outputText`.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21966417

http://stackoverflow.com/q/21893371
has comment: http://stackoverflow.com/comment/33154673
has comment: http://stackoverflow.com/comment/33153934
possible better answer: http://stackoverflow.com/a/21893418
answer count: 4
has answer: http://stackoverflow.com/a/21893442
has body: How do you call a method with parameters inside another method? For example, I am trying to call my likes() method inside my goFishingIn() method but it's not compiling. Here's my code: import java.util.*; public class Fisher { public void keep(Fish fish) { if(this.numFishCaught &lt; LIMIT) { fishesCaught.add(fish); numFishCaught++; } } public boolean likes(Fish fish) { if(fish.size &gt;= this.keepSize &amp;&amp; fish.species != "Sunfish") { return true; } else { return false; } } public void goFishingIn(Pond pond) { pond.catchAFish(); this.likes(Fish fish); } }
tagged with: java
has comment: http://stackoverflow.com/comment/33153937
tagged with: methods
type: Question
type: AnsweredQuestion
has title: How to call a method with parameters inside another method?
has answer: http://stackoverflow.com/a/21893625
tagged with: oop
has answer: http://stackoverflow.com/a/21893427
has comment: http://stackoverflow.com/comment/33154084
accepted answer: http://stackoverflow.com/a/21893427
has answer: http://stackoverflow.com/a/21893418
tagged with: class
score: 0
linked to: http://stackoverflow.com/q/513832
upvote count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/q/21918741
possible better answer: http://stackoverflow.com/a/21925018
has answer: http://stackoverflow.com/a/21935620
has answer: http://stackoverflow.com/a/21925018
has body: I have used findElements to get all elements in drop down. List&lt;WebElement&gt; list = driver.findElements(By.xpath("//*@id='flyout']/div[1]/ul/li")); In a for loop, I am getting the name of the link. Now I want to click on the link. When I do list.get(i).click();, the corresponding element is highlighted but click is not happened. also no error was thrown. I'm using Firefox. Note: I have used findElements as drop down is not given in select value in HTML.
tagged with: selenium-webdriver
tagged with: java
tagged with: selenium
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21935620
has comment: http://stackoverflow.com/comment/33217812
score: 0
answer count: 2
has title: Unable to click on link given in dropdown. Able to get link text and also link is highlighted when i do click();

http://stackoverflow.com/comment/33232921
score: 0
comment on: http://stackoverflow.com/q/21923290
type: QuestionComment
type: Comment
has text: Leo, I found another site [LINK CLICK HERE](http://examples.javacodegeeks.com/core-java/xml/dom/copy-nodes-subtree-from-one-dom-document-to-another/) that worked! Thanks a lot without you help I wouldn't have fixed it

http://stackoverflow.com/q/21898029
tagged with: java
has answer: http://stackoverflow.com/a/21898060
type: Question
has title: Why is the date not showing up when I launch android?
has answer: http://stackoverflow.com/a/21898165
tagged with: date
score: 4
has answer: http://stackoverflow.com/a/21898083
has body: This is what I all have so far. I researched the command in the Date_Class.java and it said that was supposed to show the current date. But when I launch the android application, nothing shows up. Why is this? Do I have the wrong code? What did I do wrong? Any help with this would be greatly appreciated. Thank you. activity_main.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;!-- Header --&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#000000" android:textColor="#FFFFFF" android:gravity="center" android:layout_marginTop="20dp" android:id="@+id/Header" android:text="" /&gt; &lt;!-- Name --&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="50dp" android:id="@+id/Name" android:text="" /&gt; &lt;!-- Project Name --&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="50dp" android:id="@+id/ProjectName" android:text="" /&gt; &lt;!-- Digital Clock --&gt; &lt;DigitalClock android:id="@+id/DigitalClock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="50dp" android:text="" /&gt; &lt;!-- Calendar --&gt; &lt;TextView android:id="@+id/stringCalendar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="50dp" android:text="" /&gt; &lt;!-- End of Program --&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#FFFFFF" android:background="#000000" android:gravity="center" android:id="@+id/EndOfProgram" android:text="" /&gt; &lt;/LinearLayout&gt; MainActivity.java package com.example.d1project1; import java.util.Calendar; import android.os.Bundle; import and…
tagged with: class
has comment: http://stackoverflow.com/comment/33162125
downvote count: 1
possible better answer: http://stackoverflow.com/a/21898083
favorite count: 0
has comment: http://stackoverflow.com/comment/33162416
upvote count: 5
has answer: http://stackoverflow.com/a/21898345
answer count: 5
tagged with: android
accepted answer: http://stackoverflow.com/a/21898060
has answer: http://stackoverflow.com/a/21898067
type: AnsweredQuestion

http://stackoverflow.com/comment/33271667
type: Comment
has text: 10 was just an example. I would be needing N. But if we give it a thought we conclude that this is worthless. I can just use AtomicBoolean[], right?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21959145

http://stackoverflow.com/a/21939402
answers question: http://stackoverflow.com/q/21937887
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/33243504
has body: I'm pretty sure the configuration is not correct or simply try to set also the BSSID: wc.BSSID = yourBSSID; cause you've an hidden network. You can obtain it from a network scan where the SSID has no value.

http://stackoverflow.com/a/21988483
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21987420
has body: You can specify a filter on the target platform to remove all but one version: <plugin> org.eclipse.tycho target-platform-configuration ${tycho-version} eclipse-plugin id.of.dependency 1.2.3.2014020241355 <plugin>
answers question: http://stackoverflow.com/q/21987420
type: Answer

http://stackoverflow.com/q/22001703
has answer: http://stackoverflow.com/a/22001724
score: 0
tagged with: android
tagged with: sqlite
has title: Sqlite : Comparing timestamp value stored in a column to current Date
accepted answer: http://stackoverflow.com/a/22001724
tagged with: timestamp
type: AnsweredQuestion
tagged with: java
has body: I store information in a sqlite database table as follows: ActionDate column is of type : DEFAULT CURRENT_TIMESTAMP private String getDateTime() { SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss", Locale.getDefault()); Date date = new Date(); return dateFormat.format(date); } I want to write an SQL query that returns all rows in my table having ActionDate value as today's date from sqlite DB. However as ActionDate is of type timestamp what is the most appropriate way to convert it to todays date.
type: Question
answer count: 1

http://stackoverflow.com/a/21930243
has comment: http://stackoverflow.com/comment/33218818
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33218722
has comment: http://stackoverflow.com/comment/33218964
has body: The * operator is greedy, so it matches as many characters as it can. In your expression, the [a-zA-Z]{2} [0-9]{5} part that matches the zip code and state matches the very last ZIP and state in the input, because the .* patterns you have earlier in the expression, expand to as many characters as they can. Try changing the .s to [^0-9] so that it matches anything except digits.
has comment: http://stackoverflow.com/comment/33218797
answers question: http://stackoverflow.com/q/21930140

http://stackoverflow.com/q/21954622
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/21954685
has comment: http://stackoverflow.com/comment/33262221
favorite count: 0
type: UnansweredQuestion
upvote count: 0
tagged with: java
score: -1
has title: pascal triangle starting and ending with 1
has comment: http://stackoverflow.com/comment/33263800
type: Question
has body: Pasted below is a program to print Pascal's triangle. The way to compute any given position's value is to add up the numbers to the position's right and left in the preceding row. For instance, to compute the middle number in the third row, you add 1 and 1. the sides of the triangle are always 1 because you only add the number to the upper left or the upper right (there being no second number on the other side). int pascal[][]=new int[50][50]; int j; for(int i=0;i&lt;m;i++) { pascal[i][i]=1; for(j=1;j&lt;i;j++) { pascal[i][j]=pascal[i-1][j-1]+pascal[i-1][j]; } for(int n=1;n&lt;=m-i;n++) { System.out.print(" "); } for(int k=1;k&lt;=i;k++) { System.out.print(pascal[i][k]); System.out.print(" "); } System.out.println(" "); } Is there any way to accomplish this without using arrays? I'm trying this combination without arrays: 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1

http://stackoverflow.com/q/22003487
type: Question
has title: Conway's Game of Life Loop Logic
has comment: http://stackoverflow.com/comment/33349886
tagged with: arrays
score: 0
has comment: http://stackoverflow.com/comment/33349869
answer count: 1
has comment: http://stackoverflow.com/comment/33350107
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22003946
has comment: http://stackoverflow.com/comment/33349940
tagged with: conways-game-of-life
has comment: http://stackoverflow.com/comment/33350002
tagged with: java
has comment: http://stackoverflow.com/comment/33350203
has comment: http://stackoverflow.com/comment/33350016
has body: When I run my program my output stays the same after the first run of the while loop. Why is testgrid not being set to the new value of copygrid after each pass? The loop is directly under the comment //Run again for x generations package assignment2; /** * @author jaw209 * Date: 2/24/14 * Purpose: Conway's Game of Life Program */ import java.io.*; import java.util.*; import javax.swing.*; public class Assignment2 { private static int livecount; static char[][] copygrid = new char[30][30]; public static void main(String[] args) throws FileNotFoundException { String inputfile; String output; String generations; char[][] testgrid = new char[30][30]; //Fills array copygrid with - for(int i = 0; i &lt; 30; i++){ for(int x= 0; x &lt; 30; x++){ copygrid[i][x] = '-'; } } //Input file = L:\Java 2\Assignment2\Sample input.txt //Inputs from file to char array inputfile = JOptionPane.showInputDialog ("Where is the input file? Ex: C:\\users\\public\\desktop\\input.txt "); Scanner input = new Scanner (new FileReader(inputfile)); char[] chararray = new char[904]; String allvalues = null; do { String values = input.next(); allvalues = allvalues + values; } while(input.hasNextLine()); chararray = allvalues.toCharArray(); //Reads values in chararray into multidimensional array char[][] grid1 = new char[30][30]; int i = 4; for(int row = 0; row &lt; 30; row++){ for(int col = 0; col &lt; 30; col++){ grid1 [row][col] = chararray[i]; i++; System.out.print(grid1[row][col]); } System.out.println(); } //Finds how many generations should be calculated generations = JOptionPane.showInputDialog ("How many generations should be calculated?"); int gens = Integer.parseInt(generations); //Prompts for output file output = JOptionPane.showInputDialog ("Where is the output file?"); PrintWriter out = new PrintWriter(output); //Runs the cycle once for (int row = 0; row &lt; 30; row++){ for (int col = 0; col &lt; 30; col ++){ if (status(grid1[row][col])){ liveSurrounding(grid1, row, col); moves(row, col…

http://stackoverflow.com/comment/33314266
comment on: http://stackoverflow.com/a/21983724
type: Comment
has text: Oh! Okay so you want me to give this on my jsp page?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33096745
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/47788/discussion-between-gomino-and-end-game)
type: AnswerComment
comment on: http://stackoverflow.com/a/21859574
type: Comment
score: 0

http://stackoverflow.com/q/21963146
favorite count: 0
has answer: http://stackoverflow.com/a/21963343
tagged with: android
tagged with: toast
upvote count: 3
accepted answer: http://stackoverflow.com/a/21963343
type: AnsweredQuestion
score: 3
has title: "setView must have been called" - Custom Class extending button
tagged with: java
type: Question
answer count: 1
downvote count: 0
has body: So I've got a 12 x 9 grid of "buttons" called "tiles". Tile.java extends the widget "Button". I've got an issue right now though, where I'm trying to get the button to display a toast that recalls the ID of the button pushed. The grid is added dynamically and I want it to stay that way. Here's the code from GameBoardActivity.java: This makes the 12x9 grid of "tiles" and adds a listener for each. public void gridRowButtons(int iterations){ final Tile[] gridSpaces = new Tile[12]; LinearLayout.LayoutParams buttonParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f); for (int i = 0; i &lt; 12; i++) { String idString = String.valueOf(aToI[iterations]) + String.valueOf(i + 1); final int id = getResources().getIdentifier(idString, "id", getPackageName()); gridSpaces[i] = new Tile(getApplicationContext()); gridSpaces[i].setText(""); gridSpaces[i].setHeight(40); gridSpaces[i].setWidth(40); gridSpaces[i].setLayoutParams(buttonParams); gridSpaces[i].setId(id); OnClickListener showID = new OnClickListener(){ public void onClick(View view){ TextView text = (TextView) findViewById(R.id.tileIDText); String tileID = getApplicationContext().getResources().getResourceEntryName(id); text.setText(tileID); Tile clickedTile = (Tile) findViewById(id); clickedTile.tileClick(0, tileID); } }; gridSpaces[i].setOnClickListener(showID); } LinearLayout buttonRow = new LinearLayout(getApplicationContext()); buttonRow.setOrientation(LinearLayout.HORIZONTAL); buttonRow.setLayoutParams(buttonParams); LinearLayout boardSpace = (LinearLayout) this.findViewById(R.id.boardLayout); for (int i = 0; i &lt; gridSpaces.length; i++) { buttonRow.addView(gridSpaces[i]); } boardSpace.addView(buttonRow); } And here's the tileClick method mentioned above: public void tileClick(int action, String tileID) { switch(action) { case 1 : //action 1 case 2 : //action 2 default : Context context = getContext(); Toast toast = new Toast(context); Toast.makeText(context, tileID, To…

http://stackoverflow.com/comment/33266806
type: AnswerComment
score: 0
has text: Look at the while loop condition though, it needs to be based on the line being null.
type: Comment
comment on: http://stackoverflow.com/a/21957012

object
tags question: http://stackoverflow.com/q/21956042
tags question: http://stackoverflow.com/q/21955951
tag name: object
tags question: http://stackoverflow.com/q/21854146
tags question: http://stackoverflow.com/q/21955459
tags question: http://stackoverflow.com/q/21964003
tags question: http://stackoverflow.com/q/21961724
tags question: http://stackoverflow.com/q/21857063
tags question: http://stackoverflow.com/q/21958566
tags question: http://stackoverflow.com/q/21944625
tags question: http://stackoverflow.com/q/21996593
tags question: http://stackoverflow.com/q/21965771
tags question: http://stackoverflow.com/q/21889478
tags question: http://stackoverflow.com/q/21947764
tags question: http://stackoverflow.com/q/21978084
tags question: http://stackoverflow.com/q/21866815
tags question: http://stackoverflow.com/q/21864216
tags question: http://stackoverflow.com/q/21891449
tags question: http://stackoverflow.com/q/21939722
tags question: http://stackoverflow.com/q/21924439
tags question: http://stackoverflow.com/q/21995048
tags question: http://stackoverflow.com/q/21867038
tags question: http://stackoverflow.com/q/21844540
tags question: http://stackoverflow.com/q/21965286
tags question: http://stackoverflow.com/q/22003431
tags question: http://stackoverflow.com/q/21995277
type: Tag
tags question: http://stackoverflow.com/q/21958740
tags question: http://stackoverflow.com/q/21945566
tags question: http://stackoverflow.com/q/21860573
tags question: http://stackoverflow.com/q/21878302
tags question: http://stackoverflow.com/q/21976110
tags question: http://stackoverflow.com/q/21908158

http://stackoverflow.com/comment/33294990
has text: I think 1024 is a good size and won't cause any significant impact. You can also improve performance initializing the StringBuilder with the buffer size using `new StringBuilder(cbuf.length)`.
comment on: http://stackoverflow.com/a/21970898
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/115466114
comment on: http://stackoverflow.com/a/21915294
score: 0
type: Comment
has text: Thanks @davidehrmann, what I mean is, say I had a HashMap that took a custom 'House' object as the key and then something else as the value, if the House object took a single String property (say 'houseName') and used that to determine equality, would it be OK to simply return the hashCode of the houseName property (since the String class creates a pretty good hash), or would it be necessary to write our own hash as shown above? Hope that's clear. Cheers
type: AnswerComment

http://stackoverflow.com/q/21951770
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21952213
score: 2
tagged with: java
tagged with: bukkit
type: Question
has title: How to set the Explosion Power in the config?
answer count: 2
downvote count: 0
has body: I'm trying to set the float explosionPower to 10F in the config so I can easily change it through the plugin. How do I do this? Code: @EventHandler @SuppressWarnings("deprecation") public void onPlayerInteractBlock(PlayerInteractEvent event) { Player player = event.getPlayer(); float explosionPower = 10F; if (player.getItemInHand().getType() == Material.DIAMOND_SWORD) { player.getWorld().strikeLightning(player.getTargetBlock(null, 50).getLocation()); player.getWorld().createExplosion(player.getTargetBlock(null, 50).getLocation(), explosionPower); }
has answer: http://stackoverflow.com/a/21957127
favorite count: 0

http://stackoverflow.com/q/21944609
type: Question
answer count: 2
tagged with: arrays
score: 0
has title: How to find the repetitive/duplicate array values and display them in output ?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21944806
has answer: http://stackoverflow.com/a/21944664
tagged with: java
has body: I have tried the below program and i am stuck please assist me.Below is my program import java.util.ArrayList; public class PrintNosandRepetition { public static void main(String[] args) { int a[] = new int[] {1,3,4,5,6,3,2,4,6,7,9,4,12,3,4,6,8,9,7,6,43,2,4,7,7,5,2,1,3,4,6,311,1}; for (int i=0; i&lt; a.length; i++){ System.out.print(a[i]+ " "); } for (i=1, j&lt;a.length; j++) } The output has to be is the fashion "1- repeated 3 times".etc
has comment: http://stackoverflow.com/comment/33244505

http://stackoverflow.com/q/21857413
answer count: 1
has answer: http://stackoverflow.com/a/21857575
score: 0
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
tagged with: mysql
has body: Sometimes when I run my app, Hibernate notifies me about lost connection to MySql server. I found a solution on SO - add autoReconnect=true to connection url. Problem is that I already have one parameter in my url. I tried adding above one with &, ? and ;, but none of them work. My connection string: jdbc:mysql://localhost:3306/db?zeroDateTimeBehavior=convertToNull;autoReconnect=true
type: Question
has title: Hibernate connection.url in hibernate.cfg.xml - handling mulitple parameters

http://stackoverflow.com/q/21863003
type: Question
answer count: 1
score: 0
tagged with: android
has body: I have one activity with 3 fragments, (top, center, bottom), and the top fragment it's like a title bar that I want to display different names and buttons, corresponding to the current screen. How can I implement this ? Thanks, Pedro Simão
type: UnansweredQuestion
tagged with: android-layout
tagged with: android-fragments
tagged with: java
has title: Android dynamic title bar
has answer: http://stackoverflow.com/a/21863077

http://stackoverflow.com/q/21990968
upvote count: 4
has comment: http://stackoverflow.com/comment/33326952
tagged with: race-condition
answer count: 1
downvote count: 0
tagged with: synchronization
favorite count: 0
has answer: http://stackoverflow.com/a/21991083
has body: I am trying to write a decorator to an existing class that rejects if there are not enough resources available. Here is an example version of the code with no multithreading at all: public interface Handler { boolean handleTask(Task myTask); // returns true if successful, false if failure } public interface Task { int getResources(); // Among other things } public BlockingHandler implements Handler { private int occupied; private final int limit; private final Handler backingHandler; BlockingHandler(Handler backingHandler) { this.backingHandler = backingHandler; } @Override public boolean handleTask(Task myTask) { if(myTask.getResources() + occupied &gt; limit) return false; occupied += myTask.getResources(); return backingHandler.handleTask(myTask); } // Don't worry about this part, I'm not doing it this way, I just want the code to make sense public void notifyResourceRelease(Task finishedTask) { if(finishedTask.isDone()) occupied -= myTask.getResources(); } } The problem is, this handleTask method can be called on multiple threads, and I want to be very fast (i.e. avoid synchronized). It's not enough to make occupied be volatile or an AtomicInteger, because a race condition is still possible, for instance: Thread 1: call handleTask Thread 1: call atomicOccupied.get() Thread 2: call handleTask Thread 1: evaluate if condition Thread 2: call atomicOccupied.get() Is it possible to do this without using synchronized? Is there, for instance, an extended AtomicInteger class with a more powerful compareAndSet?
score: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4210292
tagged with: multithreading
has comment: http://stackoverflow.com/comment/33326961
has title: Is there a better AtomicInteger compare feature for race conditions?
accepted answer: http://stackoverflow.com/a/21991083
type: Question
has comment: http://stackoverflow.com/comment/33326923
linked to: http://stackoverflow.com/q/12859008
tagged with: java
has comment: http://stackoverflow.com/comment/33327032
has comment: http://stackoverflow.com/comment/33326868

http://stackoverflow.com/comment/33243800
has text: (If you know which statement is failing it's a simple matter to either stop on that statement with a debugger to examine the pointers being used, or use System.out.println to print the pointers, to figure out which is bad. NullPointerException is one of the easiest to debug.)
comment on: http://stackoverflow.com/q/21939791
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33150426
score: 0
has text: I declare it in the EmployeeList constructor method, EmployeeList is the class that handles the array apparently. It looks like this. employees = new Employee[EMPLOYEES_MAX]; what debugger would you recommend?
type: AnswerComment
comment on: http://stackoverflow.com/a/21891536
type: Comment

http://stackoverflow.com/a/21974652
score: 0
answers question: http://stackoverflow.com/q/21974596
type: Answer
has comment: http://stackoverflow.com/comment/33298503
has body: You just need to enable the Java console when you run a .jar. To do so, follow the steps on the official documentation here. It may change a little bit depending on your Operating System, but that is the idea.
has comment: http://stackoverflow.com/comment/33298604

http://stackoverflow.com/a/21943663
score: 1
answers question: http://stackoverflow.com/q/21943509
has body: No, the design isn't good. The class that instantiates the Executor pool, reads the file, and doles out the work is the only one that needs to know about EOF. The threads that take their portion and do the work don't have to know. Don't use raw Threads; leverage the new concurrency classes like Excecutor.
accepted answer of: http://stackoverflow.com/q/21943509
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33247754
type: Answer
upvote count: 1

http://stackoverflow.com/q/21909073
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21909139
answer count: 2
has title: Android - Random Integer value when adding button title
has comment: http://stackoverflow.com/comment/33180893
downvote count: 0
tagged with: button
has body: I'm using a heap of boolean values to set an integer value to a certain amount, based of the results of these boolean values. This code is working fine. The first line from my code that I have provided is displaying the CORRECT values of 'completedtotal' and 'total'. But when I add the text to the button, it will display random numbers. Whats worse, is that it doesn't show any value at all in my horizontal progress bar. Log.d("MyLog", "The value of completed is " + completedtotal + " and total is " + total); int temp = completedtotal / total; temp = temp * 100; String tempString = completedtotal + "/" + total + " Challenges Completed"; Button b = (Button) findViewById(R.id.button1); b.setText(tempString); ProgressBar pb = (ProgressBar) findViewById(R.id.prog); Log.d("Mylog", "value is " + temp); pb.setProgress(temp); Thanks heaps!!
favorite count: 0
has answer: http://stackoverflow.com/a/21909168
type: UnansweredQuestion
tagged with: android
tagged with: android-progressbar
score: 1
tagged with: java

http://stackoverflow.com/q/21889783
has title: Generating random coplanar points in a 3-D space
tagged with: geometry
has comment: http://stackoverflow.com/comment/33150282
upvote count: 3
has comment: http://stackoverflow.com/comment/79127811
has comment: http://stackoverflow.com/comment/79127388
has comment: http://stackoverflow.com/comment/33155441
has comment: http://stackoverflow.com/comment/33412861
has comment: http://stackoverflow.com/comment/33148695
tagged with: java
tagged with: rounding-error
has comment: http://stackoverflow.com/comment/79123109
tagged with: random
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33147441
has comment: http://stackoverflow.com/comment/33147084
favorite count: 0
has body: I need to generate random coplanar points in a 3-D space. The plane equation is: a*x + b*y + c*z = d I generate the plane by randomizing a, b, c and d. In order to generate random points on this plane, I use this code: switch(random.nextInt(3)) { case 0: { x = random.nextInt(length); y = random.nextInt(width); z = (d - (a*x) - (b*y))/c; break; } case 1: { x = random.nextInt(length); z = random.nextInt(height); y = (d - (a*x) - (c*z))/b; break; } case 2: { y = random.nextInt(width); z = random.nextInt(height); x = (d - (b*y) - (c*z))/a; break; } } But when I use Cayley-Menger Determinant to check if the points are coplanar, the determinant is never equal to zero (i.e. points are not coplanar). The interesting point is, when I generate points on x = 0 plane, Cayley-Menger determinant works perfectly fine! Is this a rounding error or something else? EDIT: length, width and height are integer values.
has comment: http://stackoverflow.com/comment/33148809
type: Question
score: 3
tagged with: determinants

http://stackoverflow.com/q/21917375
tagged with: svn
tagged with: java
type: Question
has body: I am using SvnKit in my application to manage my working copy and the repository. I am facing following issue: I have a file that was edited in the working copy and deleted on the repository. When I am trying to commit, I see that this file is in conflict, but I don't know how to solve it. For those who use SvnKit, I tried to resolve the conflict by using: doResolve(java.io.File path, SVNDepth depth, boolean resolveContents, boolean resolveProperties, boolean resolveTree, SVNConflictChoice conflictChoice) I set the conflict choice to SVNConflictChoice.MINE_FULL and SVNDepth.EMPTY, but that doesn't work. Do anyone have an idea? This is a part of the code I use First, on my file, I perform a update operation by doing this ourClientManager.getUpdateClient().doUpdate(new File[]{file}),SVNRevision.HEAD,SVNDepth.EMPTY, true, false); in order to set the conflict, and to resolve it. Then I check if the status of the file changed : SVNStatus status = null; try { status = ourClientManager.getStatusClient().doStatus(file, false); } catch (SVNException e) { e.printStackTrace(); } if (status != null) { SVNConflictChoice conflictChoice = null; if (status.isConflicted()) { if (localIsRight) { conflictChoice = SVNConflictChoice.MINE_FULL; } else { conflictChoice = SVNConflictChoice.THEIRS_FULL; } try { ourClientManager.getWCClient().doResolve(file, SVNDepth.EMPTY, true, true, true, conflictChoice); } catch (SVNException e) { e.printStackTrace(); } } } Thanks in advance
has comment: http://stackoverflow.com/comment/33243844
upvote count: 1
has comment: http://stackoverflow.com/comment/33212325
favorite count: 0
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33978997
has title: Svnkit Resolve a tree conflict
score: 1

http://stackoverflow.com/comment/33085968
type: Comment
has text: personally I will recommend avoid doing that. Calling shell script is making the maven build not portable. Learn to write a little MOJO, or switch to other build tools.
type: QuestionComment
comment on: http://stackoverflow.com/q/21855988
score: 0

http://stackoverflow.com/q/21954679
type: UnansweredQuestion
has body: Hi, I am working on web applications.I have a query.How can I export data from database to JSON using spring,I am unable to understand.Please help me to resolve this. Thank you very much in advance!!
has answer: http://stackoverflow.com/a/21954721
has title: JSON export data from database?
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/33263118
has comment: http://stackoverflow.com/comment/33281703
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: database
score: -1
downvote count: 2
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/33262376
has answer: http://stackoverflow.com/a/21965076
favorite count: 0

jax-ws
tags question: http://stackoverflow.com/q/21993241
tags question: http://stackoverflow.com/q/21938278
tags question: http://stackoverflow.com/q/21999041
tags question: http://stackoverflow.com/q/21857758
type: Tag
tags question: http://stackoverflow.com/q/21989914
tags question: http://stackoverflow.com/q/21872021
tags question: http://stackoverflow.com/q/21993187
tags question: http://stackoverflow.com/q/21965650
tags question: http://stackoverflow.com/q/21935292
tag name: jax-ws

websocket
tags question: http://stackoverflow.com/q/21975167
tags question: http://stackoverflow.com/q/21846530
tags question: http://stackoverflow.com/q/21991788
tags question: http://stackoverflow.com/q/21849553
tags question: http://stackoverflow.com/q/21852459
type: Tag
tags question: http://stackoverflow.com/q/21856058
tag name: websocket
tags question: http://stackoverflow.com/q/21877373
tags question: http://stackoverflow.com/q/21849179

http://stackoverflow.com/comment/33256617
type: QuestionComment
comment on: http://stackoverflow.com/q/21951354
score: 0
has text: Input encode by 'UTF-8'
type: Comment

http://stackoverflow.com/q/21842857
has answer: http://stackoverflow.com/a/21842911
type: UnansweredQuestion
has body: public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if(sender instanceof Player) { Player player = (Player) sender; if(cmd.getName().equalsIgnoreCase("member")) { String member = "member " + player.getName(); Bukkit.dispatchCommand(Bukkit.getConsoleSender(), member); player.sendMessage(getConfig().getStringList("MemberText")); How do i make the player.sendMessage(getConfig().getStringList("MemberText")); work? An error message pops up when i try to post it. Error: The method sendMessage(String) in the type CommandSender is not applicable for the arguments (List)
downvote count: 0
score: 1
tagged with: java
tagged with: bukkit
type: Question
has title: How do i add a message through a config in bukkit?
has answer: http://stackoverflow.com/a/21868398
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/21853415
favorite count: 0

http://stackoverflow.com/a/21904036
has comment: http://stackoverflow.com/comment/33173656
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21903801
has comment: http://stackoverflow.com/comment/33172556
score: 0
has comment: http://stackoverflow.com/comment/33172316
type: Answer
accepted answer of: http://stackoverflow.com/q/21903801
has comment: http://stackoverflow.com/comment/33173825
has body: I think you should have 2 constructors in the UPC class. One that accepts a string and another that will accept (int item, int man, int prod, int check); the constructor that accepts the string will use a scanner to get the numbers out of it and call the other constructor with them. That way everything will be encapsulated in the UPC class. import java.util.Scanner; public class Driver { public static void main(String[] args) { // Create a new scanner to help you get information from the input // stream. Scanner scanner = new Scanner(System.in); // Prompt and get user input for all 12 digits of UPC code System.out.println("Enter all twelve digits of your UPC code."); System.out.println("Please enter in this format: * ***** ***** *."); // get the next input String input = scanner.nextLine(); Upc userUpc = new Upc(input); // Output data System.out.println("The item's UPC value is: " + userUpc.toString()); System.out.println(); System.out.println("Product Type: " + userUpc.getItemType()); System.out.println("Manufacturer: " + userUpc.getManufacturer()); System.out.println("Product: " + userUpc.getProduct()); System.out.println(); System.out.println("Calculated Check Digit: " //+ userUPC.getCalculatedCheck() ); System.out.println("UPC Check Digit: " + userUpc.getCheckDigit()); scanner.close(); } } class Upc { // Instance variables private int itemType; // digit 1 private int manufacturer; // digits 2,3,4,5,6 private int product; // digits 7,8,9,10,11 private int checkDigit; // digit 12 // constructor that accepts String public Upc(String upcString) { //Scanner for the given input that will help us get data from it Scanner scanner = new Scanner(upcString); itemType = scanner.nextInt(); //get item type manufacturer = scanner.nextInt(); //get manufactor product = scanner.nextInt(); //get product checkDigit = scanner.nextInt(); //get chackDigit setVariables(itemType, manufacturer, product, checkDigit); scanner.close(); } public Upc(int item, int man, int prod, int check) { …

http://stackoverflow.com/a/22122136
type: Answer
has body: Okay so unless I have misunderstood the question want you want to do is overload a method. As a single method in can only accept a fix set of parameters, the way around this would be to create multiple methods (static or otherwise) with the same name but different parameters. E.g. static int method(int a, int b) { return a + b; } static double method(double b) { return b*b; } And so on for each different set of parameters required. However I would recommend also looking up this concept thoroughly as its very fundamental. To add further, an if statement most likely wouldn't evaluate the parameters inside the function correctly most likely be a lot more cumbersome to program than simply overloading your method to accept different types of parameters and act upon them accordingly
score: 0
answers question: http://stackoverflow.com/q/21977103
has comment: http://stackoverflow.com/comment/33562968

http://stackoverflow.com/a/21995140
upvote count: 3
has body: I think a simple if/else should be fine. An Exception is for some usually wrong, exceptional event that occurs within the context of your code. A failed login is much more like a business event. It is expected, and your code would be working properly. I would have whatever method this is to check a user's credentials return the proper status than to throw an exception if the login fails. However, if the process that checks the login fails itself, then that is an exception condition and that should throw an exception.
has comment: http://stackoverflow.com/comment/33338979
has comment: http://stackoverflow.com/comment/33360117
score: 3
answers question: http://stackoverflow.com/q/21995041
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21995041

http://stackoverflow.com/a/21900489
has comment: http://stackoverflow.com/comment/33306233
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21890423
upvote count: 2
has comment: http://stackoverflow.com/comment/47428674
has comment: http://stackoverflow.com/comment/33314337
type: Answer
has comment: http://stackoverflow.com/comment/33283411
score: 2
has comment: http://stackoverflow.com/comment/33413193
has body: I suspect you have found that link on this blog post here. That was a proof of concept of using jOOQ as a dependency in a Google App Engine project. It worked nicely, but the integration is currently not maintained. The main changes in Cloud SQL were changes in licensing terms for us as the jOOQ vendor. If you'd like formal support for this platform, I'm sure that some agreement can be made.
has comment: http://stackoverflow.com/comment/33272416
answers question: http://stackoverflow.com/q/21890423

http://stackoverflow.com/a/22146213
score: 0
type: Answer
has body: I think you should use ArrayBlockingQueue and avoid using loops but replace loops with blocking methods like poll/take/put/offer. Array based collections perform better and so you should consider first these then Linked node based collections. So ArrayBlockingQueue is better that than ConcurrentLinkedQueue.
answers question: http://stackoverflow.com/q/21893325

http://stackoverflow.com/comment/33078932
type: Comment
has text: thanks for your reply, I need to set the session expiry time in web.xml file only not any jsp file, and I am using struts frame work, can you please tell me how to use Listener for this purpose.
comment on: http://stackoverflow.com/a/21852088
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33216360
type: Comment
type: QuestionComment
has text: please have a look at json added
comment on: http://stackoverflow.com/q/21928512
score: 0

http://stackoverflow.com/a/21950933
score: 6
type: Answer
upvote count: 6
has body: Consider a directory structure for your .java &amp; .class file: HelloWorld(root directory) | |\src\HelloWorld.java | |\classes\mypackage\HelloWorld.class HelloWorld.java will look like package mypackage; public class HelloWorld { public static void main(String[] args){ System.out.println("Hello World"); } } To compile and get the class file in classes folder use the -d option in javac like: F:\HelloWorld\src&gt;javac -d ../classes HelloWorld.java to add all .java files you can use *.java To create a executable jar of HelloWorld execute the below command from classes directory: F:\HelloWorld\classes&gt;jar cfe HelloWorld.jar mypackage.HelloWorld mypackage/HelloWorld.class after the jar command the options cfe means: c: indicates that you want to create a JAR file. f: indicates that you want the output to go to a file rather than to stdout. e: overrides the manifest's Main-Class attribute. Finnaly, to run the generated jar file, execute below command: F:\HelloWorld\classes&gt;java -jar HelloWorld.jar Output: HelloWorld Suppose, If you want to specify your own manifest.mf file, then go for jar cfm MyJar.jar Manifest.txt mypackage/*.class
answers question: http://stackoverflow.com/q/21950483
downvote count: 0

http://stackoverflow.com/q/21871497
has body: applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:cache="http://www.springframework.org/schema/cache" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd"> <context:annotation-config /> <context:component-scan base-package="com.company" /> <property name="persistenceUnitName" value="eipjpa" /> <property name="entityManagerFactory" ref="entityManagerFactory" /> <tx:annotation-driven transaction-manager="transactionManager" /> <jpa:repositories base-package="com.company.repository" /> persistence.xml <?xml version="1.0" encoding="UTF-8"?> org.apache.openjpa.persistence.PersistenceProviderImpl com.company.domain.User <property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:3306/eipdb?characterEncoding=utf-8" /> <property name="openjpa.ConnectionUserName" value="root" /> <property name="openjpa.ConnectionPassword" value="passw0rd" /> <property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE" /> <property name="openjpa.DynamicEnhancementAgent" va…
accepted answer: http://stackoverflow.com/a/21871592
has title: Spring Data JPA + OpenJPA @autowired repository field null in webapp but fine for junit
tagged with: java
tagged with: jpa
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21871592
tagged with: spring
linked to: http://stackoverflow.com/q/19896870
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33114179
upvote count: 2
duplicate of: http://stackoverflow.com/q/19896870
tagged with: openjpa
has comment: http://stackoverflow.com/comment/33114432
type: Question

http://stackoverflow.com/q/21879179
tagged with: android
has comment: http://stackoverflow.com/comment/33128529
answer count: 0
has comment: http://stackoverflow.com/comment/33137849
has comment: http://stackoverflow.com/comment/33129275
tagged with: internal-storage
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/33127437
has comment: http://stackoverflow.com/comment/33136601
has title: Browse Android Internal Storage - Afterwards
has comment: http://stackoverflow.com/comment/33130577
score: 0
has body: This is a simple question: is there a way to browse files stored in an app specific Android App utilising Internal Storage the trick is that I think I need to do this via a 3rd party app. Why would I want to do this? Well. I have versions of the software that I deliver and a previous version had a bug whereby saved PDF's (generated in the APP on the device) were not getting delivered under all circumstances - now - I have fixed the bug, and introduced a failsafe to get the files off a NEW installation going forward, but I now have a BIG problem because if I implement a NEW APP it will by default UNINSTALL all the internal storage files- therby loosing the associated data - which I need Is there a way round this? My idea was to maybe create a 2nd app that allows the browsing / emailing of files of the internal storage - get the files off the phone - then uninstall all you like
has comment: http://stackoverflow.com/comment/33128588
has comment: http://stackoverflow.com/comment/33129674
type: UnansweredQuestion

http://stackoverflow.com/comment/33300162
comment on: http://stackoverflow.com/q/21973062
has text: You could also be receiving an error in the output, before the JSON is encoded. If you inspect the raw response - does it only contain JSON?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/21863378
score: 0
has comment: http://stackoverflow.com/comment/33100047
has comment: http://stackoverflow.com/comment/33099845
type: Answer
has body: All you really need is this: try { BufferedWriter output = new BufferedWriter(new FileWriter(new File("house.txt"))); output.write(txt.getText()); output.close(); } catch (IOException e) { e.printStackTrace(); } If house.txt does not exist then it will be created. If txt.getText() returns a string it will be written to house.txt. I would also suggest using a try-with-resources statement if possible which will close your stream for you after the try block exits. try (BufferedWriter output = new BufferedWriter(new FileWriter(new File("house.txt")))){ output.write(txt.getText()); } catch (IOException e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/33101398
answers question: http://stackoverflow.com/q/21863058

http://stackoverflow.com/comment/33272669
score: 0
type: Comment
has text: Also, here's my Util.getSystemTime(boolean getOnlyTime) function: http://redsandbox.no-ip.org/Files/get_system_time.java so now you can use that function instead of using System.getCurrentTimeMillis(), which is just a bunch of random numbers when looking for a specific date.
comment on: http://stackoverflow.com/a/21950293
type: AnswerComment

http://stackoverflow.com/q/21866315
has title: Android, change fragment textview from activity
tagged with: eclipse
answer count: 1
has comment: http://stackoverflow.com/comment/33105139
has comment: http://stackoverflow.com/comment/33105615
tagged with: android
has answer: http://stackoverflow.com/a/21866873
has comment: http://stackoverflow.com/comment/33105276
has comment: http://stackoverflow.com/comment/33105543
has comment: http://stackoverflow.com/comment/33105375
has body: I've one activity with 3 fragments, - top fragment has a textview, - center fragment has main content - bottom fragment has a tabwidget at the start I want my top fragment to display a "text", but when I click on a tab and the center fragment shows me another fragment (this is working fine), I want to display another text in my top fragment. how can I do this? thanks, Pedro Simão
has comment: http://stackoverflow.com/comment/33105221
type: UnansweredQuestion
score: 0
tagged with: java
type: Question

http://stackoverflow.com/q/22001019
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22001490
has title: How to format webpage source code in java?
has body: The below code i have helps me get the source code from the provided url without any errors. But what i am looking for is to format the source code i receive. My manual task earlier was to go to this website http://www.freeformatter.com/html-formatter.html paste my source code and then format it by selecting 3 space per indent option. How do i get my java code to do the same formatting for me ? The reason i want it formatted is because i have another script which reads it line by line and saves data which is required and ignores the rest. private static String getUrlSource(String url) throws IOException { URL x= new URL(url); URLConnection yc = x.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader( yc.getInputStream(), "UTF-8")); String inputLine; StringBuilder a = new StringBuilder(); while ((inputLine = in.readLine()) != null) { a.append(inputLine); a.append("\n"); } in.close(); return a.toString(); } public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Hello"); url="http://www.bctransit.com/regions/cfv/schedules/schedule.cfm?p=day.text&amp;route=1%3A0&amp;day=1&amp;"; try { String value= getUrlSource(url); System.out.println(value); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }
accepted answer: http://stackoverflow.com/a/22001490
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/33162408
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21898123
has text: Have you confirmed via the debugger that you're actually getting the correct file content?

http://stackoverflow.com/comment/33136215
score: 1
has text: The requirement is that a stored proc is used to perform authentication. A UserDetailsService doesn't perform authentication so is not a suitable option.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21883765

http://stackoverflow.com/comment/33116700
has text: I'm saddened with the responses. Thanks anyways guys.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21872802

http://stackoverflow.com/comment/33356090
has text: For this price I could give you no advice. But there are combination certificates with SSL and website certification. May be you could get a better price with that. But only for codesigning I have no better idea.
type: AnswerComment
comment on: http://stackoverflow.com/a/21959873
score: 0
type: Comment

http://stackoverflow.com/comment/33283983
comment on: http://stackoverflow.com/q/21966176
score: 0
type: Comment
type: QuestionComment
has text: Also change `CREATE TABLE devices` to 'CREATE TABLE IF NOT EXISTS devices` for good practices :)

http://stackoverflow.com/comment/33106021
comment on: http://stackoverflow.com/q/21855681
score: 0
type: Comment
type: QuestionComment
has text: My first question in this relationship would be: Why would you like to do such a thing? It sounds you are mistaken deployment (in the Maven sense) and building ..

tags
tags question: http://stackoverflow.com/q/21936749
tags question: http://stackoverflow.com/q/21966840
type: Tag
tags question: http://stackoverflow.com/q/21948157
tag name: tags

http://stackoverflow.com/comment/33251638
score: 0
type: Comment
type: QuestionComment
has text: Done. Code is above @saiarcot895
comment on: http://stackoverflow.com/q/21948462

http://stackoverflow.com/a/43872934
has body: Using other answers from this question, I found this to work for me. Nothing needs to be escaped between the \Q and \E. They do that for you. Pattern whitelist = Pattern.compile("^[\\w\\s\\Q!\"#$%&amp;'()*+,-.\\/:;&lt;=&gt;?@[]^_`{|}~\\E]+$"); if (!whitelist.matcher(pw).matches()) { // error }
score: 0
answers question: http://stackoverflow.com/q/21942546
type: Answer

http://stackoverflow.com/comment/33128984
has text: Duplicate of http://stackoverflow.com/questions/7588091/how-to-override-extend-an-inner-class-from-a-subclass.
comment on: http://stackoverflow.com/q/21879998
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21899400
has title: Compression and Decompression of Argument Strings in Java
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21900143
tagged with: java
tagged with: compression
type: Question
has comment: http://stackoverflow.com/comment/33192273
has comment: http://stackoverflow.com/comment/33164752
score: 0
has comment: http://stackoverflow.com/comment/33165059
has comment: http://stackoverflow.com/comment/33164815
has answer: http://stackoverflow.com/a/21900143
answer count: 1
tagged with: string
has body: I'm having trouble coming up with a way too decompress a String in Java. This is a basic Java class I'm taking so it only requires basic commands, nothing too fancy. The objective it to able to type C:\&gt;java Compress -c aaaabbbbbcc in the command prompt and it will print a4b5c2 (like it is compress the argument string). The other objective is to type C:\&gt;java Compress -d a5b7c4 and it will print aaaaabbbbbbbcccc (like it will decompress the argument String). The decompression is the issue I'm having. Here is my code, any help I get is much appreciated. import java.util.*; public class Compress { public static void main(String args[]) { Scanner scan = new Scanner(System.in); String originalString = scan.nextLine(); int number = scan.nextInt(); if (args[0].equals("-c")) { System.out.println("compress"); compress(originalString); } else if (args[0].equals("-d")) { System.out.println("decompress"); decompress(originalString); } else { System.out.println("Compress program by Kelsey Faram"); System.out.println("usage: java Compress [-c,-d] &lt; inputFile &gt; outputFile"); } } public static void compress(String originalString) { int count = 0; char comp = originalString.charAt(0); for (int i = 0; i &lt; originalString.length(); i++) { originalString.charAt(i); if (comp == originalString.charAt(i)) count++; else { System.out.print(comp + "" + count); comp = originalString.charAt(i); count = 1; } } System.out.println(comp + "" + count); } public static void decompress(String originalString) { } }
tagged with: arguments

http://stackoverflow.com/a/21902146
has body: This way is safe and SQL injection cannot take place in this. If you use as below there is a good chance for SQL injection getHibernateTemplate().find("select name from users where city="+'Colombo');
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21901880
upvote count: 2
answers question: http://stackoverflow.com/q/21901880

http://stackoverflow.com/comment/33231802
type: Comment
has text: We're looking for time-sensitive tokens. GUIDs wouldn't give us that. Unless I don't fully understand GUIDs. I'll edit to state we need time-sensitivity.
comment on: http://stackoverflow.com/a/21937618
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33323807
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21988625
type: Comment
has text: logcat updated and mDbHelper.createDataBse() published

http://stackoverflow.com/comment/33236822
has text: Maybe we should add some configuration into tomcat/logs/logging.properties
score: 0
comment on: http://stackoverflow.com/q/21935447
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33177478
has text: @kdoteu You could make the class abstract so it cannot be instantiated. Also, what would happens if somebody would actually add a constructor and instantiates the class?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21905036
type: Comment

http://stackoverflow.com/a/33461922
answers question: http://stackoverflow.com/q/21960869
upvote count: 2
downvote count: 0
type: Answer
has body: In Java 1.7- you can't have multiple annotations of the same type. The way round this is with List. Say you have a class-level validation to check that 2 fields are equal and you want to use it twice (eg to validate that passwd = repeatPasswd and email = repeatEmail: @ValidateEquals.List({ @ValidateEquals(field1 = "pwd", field2="repPwd"), @ValidateEquals(field1 = "email", field2="repEmail") }) public class MyForm Not sure if it is mandatory, but it is highly recommended for class-level validators.
score: 2

http://stackoverflow.com/a/21932495
downvote count: 0
answers question: http://stackoverflow.com/q/21932416
type: Answer
score: 1
upvote count: 1
has body: Try running this code for(i=0;i&lt;days.length;i++) { System.out.println("days: " + days[i] + ", " + months[i]); }

http://stackoverflow.com/q/21872507
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21872644
possible better answer: http://stackoverflow.com/a/21872779
has title: How to print Stack traces into log file?
has answer: http://stackoverflow.com/a/21872779
score: 0
answer count: 2
has body: How to print Stack traces into log file, COM interface is calling our jar file, so need to know the stack trace for debugging.
accepted answer: http://stackoverflow.com/a/21872644
has comment: http://stackoverflow.com/comment/33128275
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33116023
tagged with: stack-trace
tagged with: logging

http://stackoverflow.com/comment/33237026
type: Comment
has text: If this is a quiz then what is the prize?
score: 3
comment on: http://stackoverflow.com/q/21940555
type: QuestionComment

http://stackoverflow.com/comment/33251832
type: Comment
has text: You are wrong, you initialized the first frame, but frame.frame is not. The method initializing it in MakeFrame is never called in scope of MakeFileMenu. You have makeFrame called in Main, but those are 2 different things. Also, you have not used constructor in MakeFileMenu. I hope this helps!
comment on: http://stackoverflow.com/a/21948571
type: AnswerComment
score: 0

http://stackoverflow.com/a/21929822
type: Answer
answers question: http://stackoverflow.com/q/21929616
score: 0
has body: As npinti said, Tess4j is great and usable.There is another solution : JavaCV provides you a bridge to OpenCV which can help you realizing what you want to do You can for example look at how Sikuli use it to OCR texts in the sikuli-core repo

http://stackoverflow.com/a/21953354
type: Answer
has body: when the below statement is called , the getX() of class B is invoked. System.out.println(a.getX()); @Override public int getX() { return super.getX() + x; // this will add 15 from class A + 5 in this method. } the above statement displays 20 when the below statement is called, a.setX(10); @Override public void setX(int x) { super.setX(x); // observe this method, this prints 15 super.printX(); // this prints 10 } //super.setX(x); it will call public void setX(int x) { this.x=x; // 10 &lt;--- 15 so 15 is displayed } here this.x refers the value which is passed through a.setX(10).
answers question: http://stackoverflow.com/q/21953122
score: 0

http://stackoverflow.com/comment/33285206
type: AnswerComment
comment on: http://stackoverflow.com/a/21965304
score: 0
type: Comment
has text: Now when I change that line, the line: list = new GroceryItemOrder[10]; says incompatible types. Why is that so? Aren't I still just constructing an array? Or what should I change? Thanks.

http://stackoverflow.com/comment/33241026
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21942720
has text: how your InventoryItem looks like?

http://stackoverflow.com/q/21989020
tagged with: arraylist
type: AnsweredQuestion
tagged with: grouping
score: 1
has comment: http://stackoverflow.com/comment/73594795
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/21989275
answer count: 2
has body: Is there a simple and fast way to group elements from an ArrayList in Java? I'm asking if there is already a way without implementing it by my self? something like Collections.sort(monuments,new objectComparator()); EDIT: I have a list of Objects That have a field called category, this list is shown to the user. I want the objects of category_type==1 to be shown first and so on. I can't achieve this with comparator, since the way the comparator works is like this: return int a>0 if the first value is bigger return int a
upvote count: 1
tagged with: collections
has comment: http://stackoverflow.com/comment/45841722
has answer: http://stackoverflow.com/a/21989290
has comment: http://stackoverflow.com/comment/33358707
possible better answer: http://stackoverflow.com/a/21989275
tagged with: java
has title: How to group elements in ArrayList<CustomObject>
has comment: http://stackoverflow.com/comment/33323174
linked to: http://stackoverflow.com/q/21678430
linked to: http://stackoverflow.com/q/8463543
has comment: http://stackoverflow.com/comment/33323147
tagged with: arrays
downvote count: 0
accepted answer: http://stackoverflow.com/a/21989290
has comment: http://stackoverflow.com/comment/33323223

http://stackoverflow.com/a/21857240
has comment: http://stackoverflow.com/comment/33164232
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33134716
has body: thanks for reporting. The issue is https://github.com/Atmosphere/atmosphere/issues/1473 and will be fixed in 2.1.1. You can try it now using 2.1.1-SNAPSHOT. Thanks! -- Jeanfrancois
has comment: http://stackoverflow.com/comment/33122528
accepted answer of: http://stackoverflow.com/q/21854052
answers question: http://stackoverflow.com/q/21854052
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/21852961
possible better answer: http://stackoverflow.com/a/21853086
has title: How can i fetch all data present in Map<String,Map<String,String>> data structure?
has body: i want to retrieve all data that are present in my data structure, which is of type Map of Maps.The data structure is mentioned below. public static Map&lt;String, Map&lt;String, String&gt;&gt; hourlyMap = new HashMap&lt;String, Map&lt;String, String&gt;&gt;(); i need all the data that are stored in the map irrespective of key.
answer count: 3
accepted answer: http://stackoverflow.com/a/21853068
has comment: http://stackoverflow.com/comment/33080266
has comment: http://stackoverflow.com/comment/33080242
tagged with: dictionary
has comment: http://stackoverflow.com/comment/33080177
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33080709
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/33080238
has answer: http://stackoverflow.com/a/21853086
has answer: http://stackoverflow.com/a/21853068
has answer: http://stackoverflow.com/a/21853142

http://stackoverflow.com/comment/34519733
type: QuestionComment
has text: I started by using the Matlab GUIDE. But I found it to be hard to customize and thought it would be easier to do in Swing, then import into Matlab. The whole thing feels cheap put together like it is, but it works for now. I am sure there is a better way to do it, I just don't know what it is.
comment on: http://stackoverflow.com/q/21896347
score: 0
type: Comment

http://stackoverflow.com/a/21972522
type: Answer
score: 8
accepted answer of: http://stackoverflow.com/q/21972488
answers question: http://stackoverflow.com/q/21972488
type: AcceptedAnswer
downvote count: 0
upvote count: 8
has body: Still, after your edit, its unclear what T is. If you're able to narrow it down to a Number (which is the super class for Integer and Double as you mentioned), the following will work: List&lt;Number&gt; numbers = new ArrayList&lt;Number&gt;(); for (Number number : numbers) { sum += number.doubleValue(); }

digital-signature
tags question: http://stackoverflow.com/q/21945036
tags question: http://stackoverflow.com/q/21841991
tag name: digital-signature
tags question: http://stackoverflow.com/q/21886718
type: Tag
tags question: http://stackoverflow.com/q/21886778
tags question: http://stackoverflow.com/q/21986956

http://stackoverflow.com/q/21860735
has answer: http://stackoverflow.com/a/21861362
upvote count: 12
has answer: http://stackoverflow.com/a/42796107
downvote count: 0
has comment: http://stackoverflow.com/comment/33094806
possible better answer: http://stackoverflow.com/a/21861362
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: nio
score: 12
answer count: 3
has title: Java - memory mapped file benefits
favorite count: 0
has answer: http://stackoverflow.com/a/21860834
accepted answer: http://stackoverflow.com/a/21860834
tagged with: memory-mapped-files
has body: I am struggling to see the benefits of the memory mapped file (buffer) in Java. here is how I see the approach in practice: We map chunks of file into main memory and deal with any writes/reads directly in memory, leaving OS to do the job of persisting the file into disk. Now, I wanted to contrast this with regular I/O and a few scenarios: Appending into a file In order to map the file into mem I have to read it in as a whole, to make overall modifications. The buffer size is the size of a file initially (let's say I do not know how much data I am about to write into the file). Now, in order to append to the file, I cannot do that, because the buffer is of limited size. So the most basic operation seems impossible to me. Also, reading in the whole file to append a small portion seems rather wasteful. So I guess regular I/O performs better in this scenario. Persisting changes In order to persist the changes i still need to flush them. Therefore, if I don't do this periodically I might have lost the changes in the main memory. This is the same idea with regular I/O streams, so no gain here either. Random changes This is where I can see this to work - replacing n bytes with other n bytes. Nevertheless, this seems rather unusual operation to have m characters being replaced by exactly m characters. we would rather have Hello and replace it with Hi. But we have a filled, fixed sized buffer, so that is not easy... Besides, it reminds me of RandomAccessFile with a better performance. Probably most of what I wrote is nonsense, but I will be happy to be told so, as for me atm the MemoryMappedBuffer seems hard and cumbersome (or even impossible) to use.

http://stackoverflow.com/q/21893781
has comment: http://stackoverflow.com/comment/33154743
upvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/2605032
favorite count: 0
has title: Java execute math equation
has comment: http://stackoverflow.com/comment/33154717
type: UnansweredQuestion
has body: As you'll probably be able to tell by my way of doing things, I'm a beginner when it comes to Java. Basically I have something like this: String math = "1 + 1"; I want to be able to execute that math equation so that it will return the value 2. Something presumably like this: String math = "1 + 1"; int answer = Math(math); System.out.print(answer); How would I go about doing this? Thanks in advance.
has comment: http://stackoverflow.com/comment/33154700
has comment: http://stackoverflow.com/comment/33157660
tagged with: java
downvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/2605032
tagged with: math
has answer: http://stackoverflow.com/a/21895470
score: -1

http://stackoverflow.com/a/21920255
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21920178
type: Answer
accepted answer of: http://stackoverflow.com/q/21920178
has body: The first thing you should be looking into is a for each loop. This is a type of loop that goes through every single element in an array or Collection implementation. You can read up on these here. Next, you'll need to look into the StringBuilder class, which can be read about here. This class is designed to allow efficient creation of a String object, which you will be using. Finally, you'll need to use the append method in the StringBuilder class, to link up several String representations of each HotelRoom, probably using the toString() method. NOTE You'll notice I've not provided any code, because I don't think you've had a fair go at solving the issue just yet. Edit in your attempts and I'll edit in some code.

http://stackoverflow.com/comment/33351388
type: AnswerComment
score: 0
type: Comment
has text: Another question: The file created is being labeled as FQSEMI.mp4.flv. How do I name it simply as FQSEMI.flv?
comment on: http://stackoverflow.com/a/22004264

http://stackoverflow.com/comment/33265307
type: AnswerComment
type: Comment
has text: That depends... if you only need to verify the validity of the code, then yes, if you need to be able to do your checks at normal runtime, then no.
score: 1
comment on: http://stackoverflow.com/a/21956241

http://stackoverflow.com/q/21854146
score: 11
has comment: http://stackoverflow.com/comment/38566213
has answer: http://stackoverflow.com/a/24839492
answer count: 3
downvote count: 0
favorite count: 0
has body: I have a choiceBox which represents a list objects. When the name representing one of those objects is changed by another bit of code the name in the drop down list for the choice box does not change. For example if I have a choice box which is made up of list Test objects. The Code for Test is shown below: class Test { String name; public Test(String name) { this.name = name; } public void setName(String name) { this.name = name; } public String getName() { return name; } @Override public String toString() { return name; } } Then have a choice Box as follows: ChoiceBox&lt;Test&gt; chi = new ChoiceBox&lt;&gt;(); ObservableList&lt;Test&gt; items = FXCollections.observableArrayList(); chi.setItems(items); items.addAll(new Test("ITEM1"),new Test("ITEM2"),new Test("ITEM3")); The ChoiceBox will show the list ITEM1, ITEM2 and ITEM3 If I then change the name of one of the items via the following code: items.get(1).setName("CHANGED"); The ChoiceBox will still show the list ITEM1, ITEM2 and ITEM3. How can I make it so the choiceBox will update and show the list ITEM1, CHANGED and ITEM3?
possible better answer: http://stackoverflow.com/a/24818314
accepted answer: http://stackoverflow.com/a/24839492
upvote count: 11
tagged with: javafx-2
has answer: http://stackoverflow.com/a/24818314
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/21883209
has title: JavaFX 2.0 Choice Box Issue. How to update a choiceBox, which represents a list of objects, when an object is updated?

http://stackoverflow.com/comment/33189974
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21914009
score: 3
has text: Why do you think it will be inefficient? You will keep `O(1)` complexity.

semaphore
type: Tag
tags question: http://stackoverflow.com/q/21924045
tags question: http://stackoverflow.com/q/21973719
tag name: semaphore
tags question: http://stackoverflow.com/q/22001964

http://stackoverflow.com/q/21929032
tagged with: android
possible better answer: http://stackoverflow.com/a/21929785
tagged with: zxing
tagged with: maven
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22073414
accepted answer: http://stackoverflow.com/a/22073414
answer count: 2
has answer: http://stackoverflow.com/a/21929785
tagged with: intellij-idea
has body: I can compile zxing which is included as an AndroidLibrary to my project without problem through intellij idea, but when I want to compile it with maven, it gives errors. Here is my pom.xml and the error POM.XML <?xml version="1.0" encoding="utf-8"?> 4.0.0 com.somecompany.zxing zxing 1.0.0 apklib zxing library <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <platform.version>4.1.1.4</platform.version> <sdk_path>D:\Android</sdk_path> com.google.android android ${platform.version} provided com.google.android support-v4 r7 com.google.zxing core 2.0 src com.jayway.maven.plugins.android.generation2 android-maven-plugin 3.8.0 10 ${sdk_path} false false /tmp/predexedLibs true true maven-compiler-plugin 3.1 1.6 1.6 THE ERROR [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building zxing library 1.0.0 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ zxing --- [INFO] Deleting D:\Projects\Inherd\Libraries\trunk\zxing\target [INFO] [INFO] --- android-maven-plugin:3.8.0:generate-sources (default-generate-sources) @ zxing --- [INFO] ANDROID-904-002: Found aidl files: Count = 0 [INFO] ANDROID-904-002: Found aidl files: Count = 0 [INFO] Manifest merging disabled. Using project manifest only [INFO] D:\Android\build-tools\19.0.1\aapt.exe [package, --non-constant-id, -m, -J, D:\Projects\Inherd\Libraries\trunk\zxing\target\generated-sources\r, -M, D:\Projects\Inherd\Libraries\trunk\zxing\AndroidManifest.xml, -S, D:\Projects\Inherd\Libraries\trunk\zxing\res, --auto-add-overlay, -A, D:\Projects\Inherd\Libraries\trunk\zxing\assets, -I, D:\Android\platforms\android-10\android.jar] [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ zxing --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] skip non existing resourceDirectory D:\Projec…
score: 0
has title: Zxing Maven Compile Error

http://stackoverflow.com/q/21965012
has answer: http://stackoverflow.com/a/21965123
tagged with: sockets
has comment: http://stackoverflow.com/comment/33281595
possible better answer: http://stackoverflow.com/a/21965343
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21965123
has body: The code works fine when I close the client just after sending one instruction. But when I want a client and server connection to persist, so that the client can send multiple instructions to the server one after another, I get a Null pointer exception at the server and the message java.net.SocketException: Socket is closed at the client. This happens after the client sends a file to the server and the server successfully receives it. Need help. The error occurs at the Connection class code line switch(clientMsg). It seems to me that for some reason the BufferedReader in goes null, but I might be mistaken about that. The code is as follows. Thanks. Server public class server { private static ServerSocket serverSocket; private static Socket socket = null; public static void print(Object s) { System.out.println(s); } @SuppressWarnings("resource") public static void main (String args[]) throws IOException { System.out.print("Specify listening port: "); Scanner _a = new Scanner(System.in); int a = _a.nextInt(); try{ serverSocket = new ServerSocket(a); } catch(IOException e) { System.out.println(e); } while (true) { try { socket = serverSocket.accept(); print("Connected to " + socket); Thread client = new Thread(new Connection(socket)); client.start(); } catch (IOException e) { print(e); } } } } Connection public class Connection implements Runnable { public static void print(Object s) { System.out.println(s); } private Socket socket; private BufferedReader in = null; public Connection(Socket client) { this.socket = client; } @Override public void run(){ try { in = new BufferedReader(new InputStreamReader( socket.getInputStream())); String clientMsg; while (true) { clientMsg = in.readLine(); switch (clientMsg) { case "1": receiveFile(); //method code not included break; default: print("Command not recognized"); break; } //in.close(); } }//try run() catch (IOException e) { print(e); } } Client public class client { private static Socket connectToServer; private static Str…
has answer: http://stackoverflow.com/a/21965343
has comment: http://stackoverflow.com/comment/33281792
tagged with: java
has comment: http://stackoverflow.com/comment/33281698
has comment: http://stackoverflow.com/comment/33281575
type: Question
has comment: http://stackoverflow.com/comment/33281635
has comment: http://stackoverflow.com/comment/33281815
has comment: http://stackoverflow.com/comment/33281621
score: 0
has title: Null pointer exception occurs while trying to read repeatedly from an InputStream
answer count: 3
has answer: http://stackoverflow.com/a/21965413

http://stackoverflow.com/q/21971340
score: 1
tagged with: java
tagged with: signal-processing
type: Question
has comment: http://stackoverflow.com/comment/33293051
has comment: http://stackoverflow.com/comment/33305497
has comment: http://stackoverflow.com/comment/33292978
tagged with: playback
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/33396190
favorite count: 0
accepted answer: http://stackoverflow.com/a/21971702
tagged with: javasound
has title: How to programmatically add reverb effect to sound files in Java?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21971702
downvote count: 0
has body: I want to add a reverb effect for audio files in Java or at the very least the playback of those audio files. The Java program is a desktop application so I cannot use the android libraries. I have tried use the controls on the ports using the Java Sound API, but it has not worked on my test machine. (My tests show that none of the ports support reverb control). Port line = null; if (AudioSystem.isLineSupported(Port.Info.SPEAKER)) { try { line = (Port) AudioSystem.getLine( Port.Info.SPEAKER); } catch(Exception ex){ ex.printStackTrace(); return; } } EnumControl reverb = (EnumControl)line.getControl(EnumControl.Type.REVERB); System.out.println(Arrays.toString(reverb.getValues())); The above code has not worked. Is there a way I can manually add a reverb effect? Perhaps through some overlooked api or by manipulating the waveform and or playback of that waveform? Any advice at all would be duely appreciated.

http://stackoverflow.com/a/21850179
has comment: http://stackoverflow.com/comment/33075379
has comment: http://stackoverflow.com/comment/33076123
has comment: http://stackoverflow.com/comment/33075524
score: 1
has body: Naive Bayes gives you the "confidence" in each classification, as it computes P(y|x) ~ P(y)P(x|y) Up to the normalization by P(x) it is a probability of x being a part of class y. You can simply cut-off on this value and say, that cl(x) = "other" iff max_{over y}(P(y|x)) &lt; T where T can be for example minimum confidence on the training set T = min_{over x and y in Training set}( P(y|x) )
answers question: http://stackoverflow.com/q/21849642
has comment: http://stackoverflow.com/comment/33075377
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/33075637
type: Answer
has comment: http://stackoverflow.com/comment/33075726

http://stackoverflow.com/q/21952467
has comment: http://stackoverflow.com/comment/37519966
has answer: http://stackoverflow.com/a/24306137
score: 0
tagged with: java
type: Question
has title: Can open SFTP connection via WinSCP, but cannot with JSch
accepted answer: http://stackoverflow.com/a/24306137
tagged with: sftp
has comment: http://stackoverflow.com/comment/37563399
answer count: 1
tagged with: jboss7.x
has comment: http://stackoverflow.com/comment/37563580
tagged with: jsch
has body: I am trying to connect to a remote device that I cannot manage via a JSch, although I can connect using WinSCP client with the same credentials. The application is a J2EE based enterprise application, which runs on JBoss AS 7.1.1, on a Windows server, and I am trying to connect the SFTP server from a Quartz job. The code that I am using to verify SFTP login is below. try { Session session = jsch.getSession("username", "host", 22); session.setConfig("StrictHostKeyChecking", "no"); session.setPassword("password"); session.connect(); Channel channel = session.openChannel("sftp"); ChannelSftp channelSftp = (ChannelSftp) channel; channel.connect(); session.disconnect(); channelSftp.disconnect(); } catch (JSchException e) { log("Cannot make connection to FTP server "); e.printStackTrace(); } I am getting com.jcraft.jsch.JSchException: java.net.ConnectException: Connection refused: connect exception at session.connect(); I am using 0.1.50 version of JSch Another inconsistency occurs when I ran this code in development environment; I can connect to a server with SFTP. Can you help me pinpoint the probable cause of this behavior?
type: AnsweredQuestion

http://stackoverflow.com/comment/33272562
score: 0
type: Comment
type: QuestionComment
has text: make it big, but don't use the whole thing. keep a separate `size` variable instead of using arr.length. this way you dont need to reallocate or copy elements over when changing the size.
comment on: http://stackoverflow.com/q/21960072

http://stackoverflow.com/a/21889402
type: Answer
score: 2
upvote count: 2
has body: You could create queues for each group and when a task terminates you read the corresponding queue and submit the next task if needed. For that you somehow need to identify when a Runnable terminates. With the standard JDK classes you cannot really do that in a simple way but using the Guava library you can wrap your ExecutorService into a ListeningExecutorService. If you submit a task through this wrapper it will return you a ListenableFuture instead of the plain Java Future. A ListenableFuture will let you register callbacks that will be executed when the task terminates. In these callbacks you can check your queues and submit the next tasks in the same group.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21888226
answers question: http://stackoverflow.com/q/21888226

http://stackoverflow.com/comment/33221778
comment on: http://stackoverflow.com/q/21932200
type: Comment
type: QuestionComment
has text: this is code for update but not working try{ ps=oon.prepareStatement("UPDATE Student set Studentid=?,Studentname=?,age=?,Contactno=?,Degreeprogram=? WHERE Studentid="+Integer.parseInt(jTextField1.getText())); ps.setString(2, jTextField2.getText()); ps.setString(3, jTextField3.getText()); ps.setString(4, jTextField4.getText()); JOptionPane.showMessageDialog(null, "Update"); ps.executeQuery(); // TODO add your handling code here: }
score: 0

relation
tags question: http://stackoverflow.com/q/21931447
tag name: relation
type: Tag

http://stackoverflow.com/comment/33100861
comment on: http://stackoverflow.com/a/21863624
score: 0
type: AnswerComment
type: Comment
has text: Eclipse is just generating some boilerplate code for you (it probably just makes the class extend `Activity` and overrides some of the basic lifecycle methods). If you make a new file from scratch and have it extend `Activity` or some subclass of it, then the class will behave as an `Activity` regardless of what IDE you use.

http://stackoverflow.com/q/21892639
has comment: http://stackoverflow.com/comment/33152718
answer count: 1
has comment: http://stackoverflow.com/comment/33153007
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
has body: I have an XML file and want to read the information using XPath, I want to read the 'listings_Id' and 'budget_remaining' together. XML example &lt;ads&gt; &lt;ad&gt; &lt;listing_ids&gt; &lt;listing_id&gt;2235&lt;/listing_id&gt; &lt;listing_id&gt;303&lt;/listing_id&gt; &lt;listing_id&gt;394&lt;/listing_id&gt; &lt;/listing_ids&gt; &lt;reference_id&gt;11&lt;/reference_id&gt; &lt;net_ppe&gt;0.55&lt;/net_ppe&gt; &lt;budget_remaining&gt;50000.0&lt;/budget_remaining&gt; &lt;/ad&gt; &lt;ad&gt; &lt;listing_ids&gt; &lt;listing_id&gt;2896&lt;/listing_id&gt; &lt;/listing_ids&gt; &lt;reference_id&gt;8&lt;/reference_id&gt; &lt;net_ppe&gt;1.5&lt;/net_ppe&gt; &lt;budget_remaining&gt;1.3933399&lt;/budget_remaining&gt; &lt;/ad&gt; &lt;/ads&gt; I want to output it to a CSV file as the following ListingId,BudgetRemaining 2235,0.55 303,0.55 394,0.5 2896,1.5 I am trying to use the example as DataReader reader = new XmlReader(new File("links.xml")) .addField("ListingId", "//ad/listing_ids/listing_id") .addField("BudgetRemaining", "//ad/budget_remaining") .addRecordBreak("//ad") .setExpandDuplicateFields(true); But it seems so I cannot find the jar file for XMLReader and DataReader and also I am going definitely wrong with the format. New to Java, please any help is appreciated.
type: UnansweredQuestion
upvote count: 1
tagged with: xmlreader
has title: How to read an XML using Xmlreader in java?
has comment: http://stackoverflow.com/comment/33152802
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21893033
linked to: http://stackoverflow.com/q/2811001
type: Question
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/21854688
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21855306
has title: Vaadin - MenuBar - MenuItem how to get action - maybe javascript
tagged with: java
tagged with: vaadin
type: Question
tagged with: javascript
tagged with: mouseevent
score: 0
answer count: 1
has body: I try to get action at mouseOver and mouseOut for MenuItem in vaadin but without result, maybe someone can help me ? I want to get behaviour : When I click on menuItem I set the style color for this item, but if I move on other menuItem (without click) I remove the color from last clicked item and set new style for element on which I move the mouse cursor. I got implementation for set style color but I can't get mouse event at mouseOver/mouseOut - can't add any handler or listener ??

http://stackoverflow.com/q/21907659
linked to: http://stackoverflow.com/q/11338132
tagged with: netbeans
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21907838
tagged with: servlets
has body: I am writing a Servlet. Here is my code: private LinkedList &lt;HashSet&gt; completeHashList; private LinkedList&lt;String&gt;hashStr; @Override public void init(ServletConfig config) { completeHashList = new LinkedList&lt;HashSet&gt;(); hashStr = new LinkedList&lt;String&gt;(); System.out.println("Hash Loading started"); try { //Read the Hash File String str = ""; File inputFile = new File("E:/Amazon HashFile/Hash.txt"); BufferedReader br = new BufferedReader(new FileReader(inputFile)); int hashNumber=1; while((str=br.readLine())!=null) { HashSet&lt;String&gt;lineCollector = new HashSet&lt;String&gt;(); int lastIndex = 0; hashStr.add(str); for(int i=0;i&lt;=str.length();i=i+3) { lastIndex = i; try { String stringPiece = str.substring(i, i+3); // pw.println(stringPiece); lineCollector.add(stringPiece); } catch(Exception arr) { String stringPiece = str.substring(lastIndex, str.length()); // pw.println(stringPiece); lineCollector.add(stringPiece); } } completeHashList.add(lineCollector); System.out.println(hashNumber); hashNumber++; } System.out.println("Hash Loading Done"); } catch(Exception e) { e.printStackTrace(); } } Here I get the following error. Exception in thread "http-apr-8080-exec-2" Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.lang.OutOfMemoryError: Java heap space at java.lang.String.substring(String.java:1960) at analyzer.SiteAnalizer.init(SiteAnalizer.java:74) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1228) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1147) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:836) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(Stan…
has answer: http://stackoverflow.com/a/21907790
has answer: http://stackoverflow.com/a/21907886
answer count: 3
upvote count: 1
tagged with: jsp
favorite count: 0
tagged with: out-of-memory
type: UnansweredQuestion
has title: Servlet: OutOfMemory Error

http://stackoverflow.com/comment/45824840
score: 0
comment on: http://stackoverflow.com/a/28764207
type: AnswerComment
has text: @green: You can try to clean your .m2 directory, maybe it some cache issue. BTW I was testing this on win7, java 1.7.0.65.
type: Comment

soap
tags question: http://stackoverflow.com/q/21876631
tags question: http://stackoverflow.com/q/21900965
tags question: http://stackoverflow.com/q/21979805
type: Tag
tags question: http://stackoverflow.com/q/21937426
tags question: http://stackoverflow.com/q/21957871
tags question: http://stackoverflow.com/q/21872021
tags question: http://stackoverflow.com/q/21993187
tags question: http://stackoverflow.com/q/21887979
tags question: http://stackoverflow.com/q/21989914
tags question: http://stackoverflow.com/q/21944321
tags question: http://stackoverflow.com/q/21897439
tags question: http://stackoverflow.com/q/21860513
tags question: http://stackoverflow.com/q/21949399
tags question: http://stackoverflow.com/q/21899034
tag name: soap
tags question: http://stackoverflow.com/q/21845266
tags question: http://stackoverflow.com/q/21944486
tags question: http://stackoverflow.com/q/21932333

http://stackoverflow.com/comment/33332710
type: Comment
comment on: http://stackoverflow.com/a/21993570
has text: This is not `both` arrays. It is just one 2-dimensional array. And depends how you use setText method. - let me edit anwer
type: AnswerComment
score: 0

http://stackoverflow.com/a/21949243
score: 0
type: AcceptedAnswer
has body: You have an exception when you reach the end and there is no next value. You should be checking like this: while (position.getNext() != null) also use equals() instead of == operatoor: if(position.getNext().getData().equals(item))
accepted answer of: http://stackoverflow.com/q/21949185
type: Answer
answers question: http://stackoverflow.com/q/21949185

http://stackoverflow.com/q/21935320
has body: please view the following code and suggest best way to store byte array current i am trying to store byte array but it is only storing reference not actual data (byte). sequence.setFileData(dataInBytes); // here is the problem ??? please provide solution for this problem. package com.asn; /** * Class TestSequence Represent the following ASN.1 Syntax * This is class support one document one signature * and one document counter signature. * * ASN.1 Syntax : * * SignedDocument DEFINITIONS ::= * BEGIN * * Doc ::= SEQUENCE { * file-name UTF8String, * file-type UTF8String, * fileData OCTET STRING, * * } * * * * ASN.1 Value Syntax : * * first-Doc Doc ::= * { file-name "test", * file-type "pdf", * fileData '7465737420'H * * } * * * */ import java.io.ByteArrayOutputStream; import java.io.Serializable; import java.util.Vector; import org.bn.annotations.ASN1Element; import org.bn.annotations.ASN1Sequence; import org.bn.annotations.ASN1String; import org.bn.coders.UniversalTag; @ASN1Sequence ( name = "TestSequence", isSet = false ) public class TestSequence implements Serializable{ @ASN1String(name = "", stringType = UniversalTag.UTF8String, isUCS = false ) @ASN1Element(name = "fileName" , isOptional = false, hasTag = false, hasDefaultValue = false) private String fileName = null; @ASN1String(name = "", stringType = UniversalTag.UTF8String, isUCS = false) @ASN1Element(name = "fileType", isOptional = false, hasTag = false, hasDefaultValue = false) private String fileType = null; @ASN1String(name = "", stringType = UniversalTag.OctetString, isUCS = false) @ASN1Element(name = "fileData", isOptional = false, hasTag = false, hasDefaultValue = false) private byte[] fileData = null; public String getFileName(){ return this.fileName; } public void setFileName(String value){ this.fileName = value; } public String getFileType() { return fileType; } public void setFileType(String fileType) { this.fileType = fileType; } public byte[] getFileData() { return fileData; } public void setFileDa…
has comment: http://stackoverflow.com/comment/33227524
tagged with: asn.1
type: Question
has comment: http://stackoverflow.com/comment/33227477
tagged with: arrays
has comment: http://stackoverflow.com/comment/33227640
score: 0
has comment: http://stackoverflow.com/comment/33227442
answer count: 1
has title: store byte array into class object java
has comment: http://stackoverflow.com/comment/33227440
has comment: http://stackoverflow.com/comment/33227300
has answer: http://stackoverflow.com/a/21942382
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/33193498
type: QuestionComment
has text: @jabliuka, `ASM` and `CGLIB` are not included as dependencies. Moreover, according to [this migration guide](https://community.jboss.org/wiki/HibernateCoreMigrationGuide33) Hibernate 3.3 default is now `javassist`
comment on: http://stackoverflow.com/q/21866342
score: 0
type: Comment

http://stackoverflow.com/a/21856486
score: 1
downvote count: 0
has body: If you want to compare lists of similar objects, you should introduce a method type parameter public static &lt;T&gt; int maxSimilarity(List&lt;T&gt; g, List&lt;List&lt;T&gt;&gt; groups) { because it's nearly useless comparing completely different objects.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21856319

http://stackoverflow.com/comment/33275495
score: 0
comment on: http://stackoverflow.com/q/21961720
type: Comment
type: QuestionComment
has text: What's your question, exactly? Why can't you just use threading the way you normally would?

http://stackoverflow.com/comment/33326814
comment on: http://stackoverflow.com/q/21990742
score: 1
has text: [See here](http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.1.6) about what is allowed in a class body. You can't execute code directly like `ts.start()` in the class body.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33173749
has text: if you return `null` from `getView()` method of `Adapter`, NPE will occur...
comment on: http://stackoverflow.com/q/21904938
score: 4
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21991501
has answer: http://stackoverflow.com/a/21991770
has comment: http://stackoverflow.com/comment/33328207
has title: the left element of a 2D array
has answer: http://stackoverflow.com/a/21991861
type: Question
type: AnsweredQuestion
tagged with: 2d
possible better answer: http://stackoverflow.com/a/21991770
tagged with: java
has body: I'm using a 2d array to compare elements with each other. I know that if I want to see if an element is the lowest element in a column, i do: if(array[i][j]==array[array.length-1][j]) What I was wondering is how I find if the element is the left-most or the right-most element in the array?
score: 0
answer count: 2
tagged with: arrays
accepted answer: http://stackoverflow.com/a/21991861

http://stackoverflow.com/comment/33502467
comment on: http://stackoverflow.com/a/21875456
type: AnswerComment
score: 0
type: Comment
has text: I just cleaned up the trusted certificates in Adobe Reader from any leftovers from experiments with your documents and then only added your `Certum CA` to that list. Then I checked your newest document `signed_1724252717318210996.pdf`: Your signature and timestamp are shown as [valid and LTV enabled](https://i.sstatic.net/r08ej.png)! The document now is quite huge, though... ;)

http://stackoverflow.com/q/21908233
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/33179578
score: -1
has body: I want to get keys in ordered form so I used Sorted Map but I got ClassCastException in that I wanted to know reason of this problem that is in my program or I am doing any thing wrong? My sample code is as follows : public class TreeTest { public static void main(String[] args) { SortedMap<SectorInfo, List<String>> map2 = new TreeMap<TreeTest.SectorInfo, List<String>>(); ArrayList<String> list = new ArrayList<String>(); ArrayList<String> list1 = new ArrayList<String>(); ArrayList<String> list2 = new ArrayList<String>(); list.add("Test1"); list.add("Test2"); list1.add("Test3"); list1.add("Test4"); list2.add("Test5"); list2.add("Test6"); map2.put(new SectorInfo("S1", "P1"), list); map2.put(new SectorInfo("S2", "P2"), list1); map2.put(new SectorInfo("S3", "P3"), list2); for (SectorInfo sectorInfo : map2.keySet()) { System.out.println(SectorInfo.pName +" In " + SectorInfo.sName); } } protected static class SectorInfo { public String sName; public String pName; SectorInfo(String sName, String pName) { this.sName = sName; this.pName = pName; } } }
has comment: http://stackoverflow.com/comment/33179372
has answer: http://stackoverflow.com/a/21908294
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: classcastexception
has title: ClassCastException in Sorted Map. How to resolve?
has comment: http://stackoverflow.com/comment/33179650
downvote count: 1

http://stackoverflow.com/a/21989591
answers question: http://stackoverflow.com/q/21989069
type: Answer
score: 0
has body: Your question is not much clear, but may be this is what you want : try { BufferedReader bf = new BufferedReader(new FileReader("C:\\fileName.txt")); String line = bf.readLine(); while (line != null) { System.out.println(line); line = bf.readLine(); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }

http://stackoverflow.com/q/21894873
has comment: http://stackoverflow.com/comment/112829217
has answer: http://stackoverflow.com/a/79379124
linked to: http://stackoverflow.com/q/7341537
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/38664260
score: 59
downvote count: 0
has comment: http://stackoverflow.com/comment/121034186
has comment: http://stackoverflow.com/comment/116719038
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/116699899
type: Question
has answer: http://stackoverflow.com/a/38664260
has comment: http://stackoverflow.com/comment/33160986
has comment: http://stackoverflow.com/comment/33157051
has answer: http://stackoverflow.com/a/69084965
has answer: http://stackoverflow.com/a/53712849
answer count: 6
possible better answer: http://stackoverflow.com/a/47750255
has answer: http://stackoverflow.com/a/64795405
upvote count: 59
has title: Generate sample Json output from Json Schema
has answer: http://stackoverflow.com/a/47750255
favorite count: 0
has comment: http://stackoverflow.com/comment/116719136
has body: I want to know whether there is a method in which I can generate sample json output based on a json schema input. For example of the following input: { "title": "Example Schema", "type": "object", "properties": { "firstName": { "type": "string" }, "lastName": { "type": "string" }, "age": { "description": "Age in years", "type": "integer", "minimum": 0 } }, "required": ["firstName", "lastName"] } Output: { "firstName": "RandomFirstName", "lastName": "RandomLastName" } I have a large json schema with plenty of validations, so to generate a sample valid json, I could either create one manually using either Java or just a type it into a file. Is there a better way available?

http://stackoverflow.com/comment/33200939
type: QuestionComment
has text: You may want to post the snippet you used to persist the entity.
score: 0
comment on: http://stackoverflow.com/q/21919884
type: Comment

http://stackoverflow.com/a/23792013
upvote count: 1
answers question: http://stackoverflow.com/q/21861944
type: Answer
downvote count: 0
score: 1
has body: This is happening because you are using DailyRollingFileAppender. You need to set your log4j.appender.File.DatePattern "For example, if the File option is set to /foo/bar.log and the DatePattern set to '.'yyyy-MM-dd, on 2001-02-16 at midnight, the logging file /foo/bar.log will be copied to /foo/bar.log.2001-02-16 and logging for 2001-02-17 will continue in /foo/bar.log until it rolls over the next day. Is is possible to specify monthly, weekly, half-daily, daily, hourly, or minutely rollover schedules." http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html

http://stackoverflow.com/q/21976590
tagged with: android-edittext
has title: Detect newline in EditText
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/68359665
type: Question
accepted answer: http://stackoverflow.com/a/21976670
has comment: http://stackoverflow.com/comment/128067414
score: 5
has answer: http://stackoverflow.com/a/68288626
downvote count: 0
possible better answer: http://stackoverflow.com/a/21976721
has answer: http://stackoverflow.com/a/21976721
tagged with: android
has answer: http://stackoverflow.com/a/63854826
favorite count: 0
has answer: http://stackoverflow.com/a/21976670
answer count: 5
has body: How can I detect when I press the return button on the on-screen keyboard which creates a newline in the EditText field. I don't really care if I have to check for newline characters or the return key, but I want to send a message by pressing the return key on the keyboard. I already tried a few different things, but I can't seem to get it working. My EditText object is called chatInputET if you want to know.
type: AnsweredQuestion

http://stackoverflow.com/comment/33254703
type: QuestionComment
comment on: http://stackoverflow.com/q/21950063
score: 0
type: Comment
has text: Your method is way too big; it can easily be broken down into small, individually-testable methods. For example, the code to read a file into an `ArrayList` should be its own method.

http://stackoverflow.com/a/21984841
has body: You could use DOM4j for doing that.
downvote count: 1
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/21984686
score: -1

http://stackoverflow.com/comment/33411513
score: 0
type: Comment
has text: What error does it throw? Try: mSpeech.speak("hello", TextToSpeech.QUEUE_FLUSH, null); If this works check why you don't get the right text... If you want to know what it exactly does, first go dive into the documentations, if you don't get it, ask your question here.
comment on: http://stackoverflow.com/a/21990417
type: AnswerComment

http://stackoverflow.com/q/21887122
has body: I am trying to implement lazy loading data in data table using the demo code in the site PrimeFaces Lazy loading and I am getting the error javax.el.PropertyNotFoundException: /table.xhtml @14,49 value="#{car.year}": Property 'year' not readable on type java.lang.String Here is my table.xhtml code &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"&gt; &lt;h:form id="form"&gt; &lt;p:dataTable var="car" value="#{tableBean.lazyModel}" paginator="true" rows="10" id="carTable" lazy="true"&gt; &lt;p:column headerText="Year" sortBy="year" filterBy="#{car.year}"&gt; &lt;h:outputText value="#{car.year}" /&gt; &lt;/p:column&gt; &lt;p:column headerText="Color" sortBy="color" filterBy="#{car.color}"&gt; &lt;h:outputText value="#{car.color}" /&gt; &lt;/p:column&gt; &lt;/p:dataTable&gt; TableBean code @ManagedBean public class TableBean { private LazyDataModel&lt;Car&gt; lazyModel; private List&lt;Car&gt; cars; public TableBean() { System.out.println("Girish"); cars = populateRandomCars(50); lazyModel = new LazyCarDataModel(cars); lazyModel.setRowCount(10); } public LazyDataModel&lt;Car&gt; getLazyModel() { return lazyModel; } public void setLazyModel(LazyDataModel&lt;Car&gt; lazyModel) { this.lazyModel = lazyModel; } public List&lt;Car&gt; getCars() { return cars; } public void setCars(List&lt;Car&gt; cars) { this.cars = cars; } private List&lt;Car&gt; populateRandomCars( int size) { List&lt;Car&gt; list = new ArrayList&lt;Car&gt;(); Car car = null; for(int i = 0 ; i &lt; size ; i++) { car = new Car(); car.setColor("color "+i); car.setYear(""+i); list.add(car); } return list; } } Car code class Car { private String year; private String color; public String getYear() { return year; } public void setYear(String year) { this.year = year; } public String getColor() { return color; } public void setColor(String color) { this.color = c…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33142429
tagged with: jsf
tagged with: primefaces
tagged with: java
type: Question
tagged with: jsf-2
has answer: http://stackoverflow.com/a/29432205
has comment: http://stackoverflow.com/comment/33142565
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 6
accepted answer: http://stackoverflow.com/a/29432205
has title: Property not readable on type java.lang.String when using JSF PrimeFaces
score: 6

http://stackoverflow.com/q/21859698
has answer: http://stackoverflow.com/a/34070110
has answer: http://stackoverflow.com/a/21860000
favorite count: 0
has answer: http://stackoverflow.com/a/22560304
has comment: http://stackoverflow.com/comment/33093234
answer count: 5
tagged with: oracle-database
linked to: http://stackoverflow.com/q/985010
possible better answer: http://stackoverflow.com/a/22560304
upvote count: 6
has comment: http://stackoverflow.com/comment/33093609
has answer: http://stackoverflow.com/a/22559602
has title: JDBC automatical query turned to be very slow
type: AnsweredQuestion
tagged with: database-metadata
has body: I am maintaining an application creating an Oracle DB via JDBC. Starting from today this query: SELECT NULL AS pktable_cat , p.owner AS pktable_schem, p.table_name AS pktable_name , pc.column_name AS pkcolumn_name, NULL AS fktable_cat , f.owner AS fktable_schem, f.table_name AS fktable_name , fc.column_name AS fkcolumn_name, fc.position AS key_seq , NULL AS update_rule , DECODE (f.delete_rule, 'CASCADE', 0, 'SET NULL', 2, 1) AS delete_rule , f.constraint_name AS fk_name , p.constraint_name AS pk_name , DECODE(f.deferrable, 'DEFERRABLE',5 ,'NOT DEFERRABLE',7 , 'DEFERRED', 6 ) deferrability FROM all_cons_columns pc, all_constraints p , all_cons_columns fc, all_constraints f WHERE 1 = 1 AND p.table_name = :1 AND p.owner = :3 AND f.constraint_type = 'R' AND p.owner = f.r_owner AND p.constraint_name = f.r_constraint_name AND p.constraint_type = 'P' AND pc.owner = p.owner AND pc.constraint_name = p.constraint_name AND pc.table_name = p.table_name AND fc.owner = f.owner AND fc.constraint_name = f.constraint_name AND fc.table_name = f.table_name AND fc.position = pc.position ORDER BY fktable_schem, fktable_name , key_seq started becoming really slow due to some oracle internals as it seems to be the same for all my branches. Does somebody know one possible reason and how to face this? Regards, Nunzio
has answer: http://stackoverflow.com/a/21861982
tagged with: java
has comment: http://stackoverflow.com/comment/33093072
downvote count: 1
linked to: http://stackoverflow.com/q/8792890
type: Question
accepted answer: http://stackoverflow.com/a/21861982
score: 5
tagged with: sql
tagged with: jdbc

http://stackoverflow.com/a/21947461
upvote count: 1
answers question: http://stackoverflow.com/q/21947080
has body: Do you have the permission to save files ? You can add that by adding android.permission.WRITE_EXTERNAL_STORAGE permission to you AnroidManifest.xml.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21947080
type: Answer
has comment: http://stackoverflow.com/comment/33274787
score: 1

http://stackoverflow.com/comment/33330561
has text: @AdamArold thanks but I prefer to skip your useless advice.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21992690
score: 1

http://stackoverflow.com/q/21952876
has answer: http://stackoverflow.com/a/21965492
has answer: http://stackoverflow.com/a/21965543
has body: I have a date in Integer format(YYYYMMDD). And a start_time as a String (HH:mm 24 hour system). and a time_duration in hours as a double. int date = 20140214; String start_time = "14:30"; double duration = 50.30; I want to use these 3 values and create 2 Java Date Objects. One is start_date and one is end_date. They should be in the format YYYY-MM-DD HH:mm. And then after I get 2 data Strings like YYYY-MM-DD HH:mm. how can I obtain those previous variables. date, start_time, duration. This is my attempt. public void solve() throws IOException { int date = 20140214; String start_time = "14:30"; double duration = 24.50; String startDate = ""; DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm"); startDate = getDate(date) + " " + start_time; try { Date start_Date = df.parse(startDate); Date end_Date = new Date(start_Date.getTime()+(int)(duration*3600*1000)); System.out.println(df.format(start_Date)); System.out.println(df.format(end_Date)); } catch (ParseException ex) { } } public String getDate(int dateInt) { String date = ""; String dateIntString = String.valueOf(dateInt); date = date + dateIntString.substring(0, 4) + "-"; date = date + dateIntString.substring(4, 6) + "-"; date = date + dateIntString.substring(6, 8); return date; } Is there any easy way to do it. ? Or some built-in capabilities I can use other than those I have used ?
type: UnansweredQuestion
tagged with: java
tagged with: string-conversion
has answer: http://stackoverflow.com/a/21966013
tagged with: java.util.date
type: Question
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/33259218
has title: Create a Java Date from a String and vise versa

http://stackoverflow.com/q/21863002
has comment: http://stackoverflow.com/comment/58667259
accepted answer: http://stackoverflow.com/a/21870517
upvote count: 3
possible better answer: http://stackoverflow.com/a/47469673
type: Question
has body: I am trying to write a script in PowerShell that will use the invoke command with credentials on a remote machine to execute code that will return a string containing the Java version on that machine. Java is not installed, sometimes it is just dropped in the server as a JDK folder and the application is pointed to that location, so unfortunately I cannot use the registry to find the Java version. The only idea I came up with is to call from within the invoke command something along the lines of: &amp; "path_to_java.exe" "-version" Or even something more complicated and then use a regular expression to find the version: start-process $java -ArgumentList "-version" -NoNewWindow -Wait -RedirectStandardError "$path\tempoutput.txt" $javaversionoutput = gc "$path\tempoutput.txt" del "$path\tempoutput.txt" However, on some servers I keep running into an issue where it is complaining about not having enough heap space to run that Java version command (through the invoke command on that remote server). Error occurred during initialization of VM Could not reserve enough space for object heap D:\Java\jdk1.6.0_39\bin\java.exe Could not create the Java virtual machine. + CategoryInfo : NotSpecified: (Could not creat...irtual machine.:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError + PSComputerName : &lt;server&gt; From my research it has to do with the MaxMemoryPerShellMB that is set for a remote PowerShell session. On some servers it is set to 150, on some it's 1024. So sometimes I can successfully get the java -version to run from the PowerShell remote session, and sometimes I cannot, because there is too little memory. If I set it on the remote machine by logging in and doing it manually: winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="1000"} It starts to work. But I cannot go to each server each time and set it manually. If I try to set MaxMemoryPerShellMB through an invoke command, it says I don't have access, even though I can use the same ac…
score: 3
has title: Get Java version from PowerShell of remote server
tagged with: java
linked to: http://stackoverflow.com/q/4741676
tagged with: powershell-remoting
linked to: http://stackoverflow.com/q/18890926
tagged with: invoke-command
has comment: http://stackoverflow.com/comment/33145349
has comment: http://stackoverflow.com/comment/33100587
answer count: 3
has answer: http://stackoverflow.com/a/21870517
has comment: http://stackoverflow.com/comment/33145649
tagged with: version
downvote count: 0
has comment: http://stackoverflow.com/comment/33103732
tagged with: powershell
linked to: http://stackoverflow.com/q/16811332
favorite count: 0
has comment: http://stackoverflow.com/comment/33098887
has answer: http://stackoverflow.com/a/47469673
has answer: http://stackoverflow.com/a/32368724
type: AnsweredQuestion

http://stackoverflow.com/a/21978857
accepted answer of: http://stackoverflow.com/q/21978741
type: Answer
has body: You may need to install "JST Server Adapters". Tomcat adapter is coming in JST Server Adapters. Go to help ---> Install New Software. Add below link in Eclipse http://download.eclipse.org/webtools/updates Try to install "JST Server Adapters".
has comment: http://stackoverflow.com/comment/33305979
has comment: http://stackoverflow.com/comment/33306004
score: 0
answers question: http://stackoverflow.com/q/21978741
type: AcceptedAnswer

http://stackoverflow.com/comment/33252133
comment on: http://stackoverflow.com/q/21948738
score: 0
type: QuestionComment
has text: I suspect you may fundamentally misunderstand inheritance. When you create a `SpecialPlayer` instance, the new instance **is** a `Player`, as well as a `SpecialPlayer`. Therefore, you probably don't need to include a `Player` argument in the `SpecialPlayer` constructor, unless it really does refer to a *different* `Player` (e.g. an opponent or a teammate or something). I'm not really sure what you're trying to do, though.
type: Comment

http://stackoverflow.com/q/21976254
has title: Duplicate file naming on save
has comment: http://stackoverflow.com/comment/33301546
tagged with: model-view-controller
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33301517
tagged with: java
tagged with: filestream
type: Question
has body: i am working on my word Processor and i have managed to get the save file to work. However i am encountering an annoying error where saving the file will cause the file name (which is typed in) to duplicate itself for example, say you type in a file name "test" the file would save and it would appear as "testtest.txt". I also would highly appreciate a code review, if it can be offered. I am also trying to adhere to the MVC (model view controller paradigm) and i am wondering if i am correctly doing it, can i abstract this further, anyways here is my code: Model import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class DataStuff { private File file; String text; String name; private File saveFile; int counter = 0; FileInputStream fis = null; FileOutputStream fout = null; StringBuilder sb = new StringBuilder(4096); int count = 0; public void loadFile(File fileName){ this.file = fileName; try{ fis = new FileInputStream(file); while ((counter = fis.read()) != -1) { System.out.print((char) counter); sb.append((char) counter); } } catch(IOException ex){ System.out.println("file couldn't be opened, or was incorrect or you clicked cancel"); } finally { try { if (fis != null) fis.close(); } catch (IOException ex) { ex.printStackTrace(); } } } public StringBuilder showText(){ return sb; } public void saveFile(String name, String text) { this.name = name; try{ fout = new FileOutputStream(name); fout.write(text.getBytes()); System.out.println("file saving worked"); } catch(IOException e){ System.out.println("File failed to save or something went horribly wrong"); } } } this is the View. import java.awt.Font; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JScrollPane; import javax.swing.JTextArea; public class WordFrame extends JF…
score: 0
has answer: http://stackoverflow.com/a/21976292
accepted answer: http://stackoverflow.com/a/21976292
answer count: 1

http://stackoverflow.com/q/21978020
answer count: 1
has body: I was looking at this code and I was wondering what's the best way to change the output to state the number of hashtags instead of what the hashtags are? Like if you input #one #two blue red #one #green four #jaja hg instead of getting a output of [#one, #two, #jaja, #green] you would get a output of [4] import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class HashTags { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Please enter a line of text"); String tweet = scanner.nextLine(); Set&lt;String&gt; hashtags = getHashtags(tweet); System.out.println(hashtags.toString()); } public static Set&lt;String&gt; getHashtags(String tweet) { String[] words = tweet.split(" "); Set&lt;String&gt; hashtags = new HashSet&lt;String&gt;(); for (String word : words) { if (word.startsWith("#")) { hashtags.add(word); } } return hashtags; } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33304546
has answer: http://stackoverflow.com/a/21978051
tagged with: hashtag
has comment: http://stackoverflow.com/comment/33304446
tagged with: java
type: Question
has title: Unique Hashtags Counter
accepted answer: http://stackoverflow.com/a/21978051
score: 0

http://stackoverflow.com/a/21951060
has comment: http://stackoverflow.com/comment/36702738
has body: INFO: validateJarFile(D:\Softwares\tomcat\apache-tomcat-7.0.50\webapps\myWebApp_ 1\WEB-INF\lib\javax.servlet-api-3.0.1.jar) - jar not loaded Servlet3.0 is already shipped with the tomcat inside its lib folder and by default tomcat will always load the servlet jar present there. Thats why you are getting the warning that tomcat is not loading your jar inside the project. Simple solution : If you are using maven, set its scope as provided inside the pom.xml and maven will not place it in the WEB-INF/lib of your project. Something like javax.servlet servlet-api 3.0 provided
has comment: http://stackoverflow.com/comment/36700471
accepted answer of: http://stackoverflow.com/q/21950908
has comment: http://stackoverflow.com/comment/77820466
upvote count: 47
answers question: http://stackoverflow.com/q/21950908
has comment: http://stackoverflow.com/comment/36702485
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/49507207
has comment: http://stackoverflow.com/comment/36702373
score: 47
type: Answer
has comment: http://stackoverflow.com/comment/36700635
has comment: http://stackoverflow.com/comment/36700423
has comment: http://stackoverflow.com/comment/36700779

http://stackoverflow.com/comment/33118640
comment on: http://stackoverflow.com/a/21873875
score: 0
type: AnswerComment
type: Comment
has text: Why recompile? There was no suggestion of storing those information in the code; property file or environment (OS).

http://stackoverflow.com/comment/34800476
comment on: http://stackoverflow.com/q/21902652
score: 0
has text: If you connect wirelessly, probably you need check WIFI Lock...http://goltermann.cc/2011/11/android-accessing-wifi-even-in-standby-using-wakelock-wifilock-alarmmanager-and-services/
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21914978
accepted answer: http://stackoverflow.com/a/21915357
answer count: 1
downvote count: 0
has title: How to extract the Bitmap out of the onDraw() method of a View?
tagged with: android-canvas
favorite count: 0
has comment: http://stackoverflow.com/comment/33196913
tagged with: android
has body: How can I extract a Bitmap object out of my onDraw() routine in my CustomView? Here is my code: public class DrawView extends View { private Paint paint = new Paint(); private Point point; private LinkedList&lt;Point&gt; listaPontos; private static Context context; class Point { public Point(float x, float y) { this.x = x; this.y = y; } float x = 0; float y = 0; } public DrawView(Context context) { super(context); this.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT)); this.context = context; paint.setColor(Color.YELLOW); this.listaPontos = new LinkedList&lt;Point&gt;(); } @Override public void onDraw(Canvas canvas) { if(listaPontos.size() != 0){ for(Point point : listaPontos){ canvas.drawCircle(point.x, point.y, 25, paint); } } calculateAmount(canvas); } private void calculateAmount(Canvas canvas) { LinkedList&lt;Integer&gt; colors = new LinkedList&lt;Integer&gt;(); for(int i = 0 ; i != canvas.getWidth(); i++) { for(int j = 0; j != canvas.getHeight(); j++){ int color = BITMAP.getPixel(i,j); //How can I get the bitmap generated on onDraw ? colors.add(color); } } int yellow = 0; int white = 0; for(Integer cor : colors) { if(cor == Color.WHITE) { white++; } if(cor == Color.YELLOW) { yellow++; } } } @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_MOVE: listaPontos.add(new Point(event.getX(), event.getY())); break; } invalidate(); return true; } } Thanks alot in advance ;) EDIT: The bitmap thing is to calculate each pixel color, how can I add a background image to my DrawView ? I tested this.setBackgroundResource(R.drawable.a); at constructor but didn't work, thanks again ;)
has comment: http://stackoverflow.com/comment/33195802
has comment: http://stackoverflow.com/comment/33193744
score: 2
upvote count: 2
tagged with: android-bitmap
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33194206
tagged with: android-custom-view
type: Question
has answer: http://stackoverflow.com/a/21915357

http://stackoverflow.com/comment/33218703
type: Comment
comment on: http://stackoverflow.com/q/21930458
has text: Can you define `not able` ? Any exception ? Error ? Stacktrace ?
score: 0
type: QuestionComment

post
tags question: http://stackoverflow.com/q/21896205
tags question: http://stackoverflow.com/q/21897067
tag name: post
type: Tag
tags question: http://stackoverflow.com/q/21873517
tags question: http://stackoverflow.com/q/21974407
tags question: http://stackoverflow.com/q/21996190
tags question: http://stackoverflow.com/q/21989323
tags question: http://stackoverflow.com/q/21953402
tags question: http://stackoverflow.com/q/21930554

http://stackoverflow.com/comment/33302968
score: 0
has text: Instead of new_array[i.indexOf()] have you tried just new_array[i]?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21977094

http://stackoverflow.com/comment/33356850
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22004610
type: Comment
has text: Yes, so each different anonymous class implementation would need to have its own (named) class which implements `ITest`. If wish is the ONLY method on the interface, and if the anonymous class doesn't require state in between calls to the method, as you say, a Lambda implementation would be a good conversion.

http://stackoverflow.com/comment/33130221
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21880467
has text: By calling `.close` on it.
score: 0

http://stackoverflow.com/comment/124343224
score: 0
comment on: http://stackoverflow.com/q/21879804
type: Comment
type: QuestionComment
has text: Regarding the first answer of Avi & Ev0oD. Abstract classes can only be extended and not implemented, ie `public abstract class AppleFactory { public abstract Apple createInstance(final String str); } public class AppleFactoryImpl extends AppleFactory { public Apple createInstance(final String str) { // Implementation } }`

http://stackoverflow.com/comment/33095280
type: AnswerComment
comment on: http://stackoverflow.com/a/21860244
type: Comment
score: 0
has text: I have no idea what your talking about.

http://stackoverflow.com/a/21948110
has comment: http://stackoverflow.com/comment/33346603
upvote count: 1
score: 1
downvote count: 0
has body: Either omit the 6th table row, then select all descendants: /html/body/table/tbody/tr[position() != 6]//* or only select all table rows that are not at position 1 and have an attribute (and then select their descendants): /html/body/table/tbody/tr[position() = 1 or @*]//* or to be more specific, also check the attribute name: /html/body/table/tbody/tr[position() = 1 or @height or @class]//*
type: Answer
answers question: http://stackoverflow.com/q/21945377

jakarta-ee
tags question: http://stackoverflow.com/q/21990396
tags question: http://stackoverflow.com/q/22002170
tags question: http://stackoverflow.com/q/21913419
tags question: http://stackoverflow.com/q/21871656
tags question: http://stackoverflow.com/q/21909059
tags question: http://stackoverflow.com/q/21944527
tags question: http://stackoverflow.com/q/21962380
tags question: http://stackoverflow.com/q/21896129
type: Tag
tags question: http://stackoverflow.com/q/21934430
tags question: http://stackoverflow.com/q/21902110
tags question: http://stackoverflow.com/q/21878146
tags question: http://stackoverflow.com/q/21963919
tags question: http://stackoverflow.com/q/21901881
tags question: http://stackoverflow.com/q/21947753
tags question: http://stackoverflow.com/q/21901470
tags question: http://stackoverflow.com/q/21919009
tags question: http://stackoverflow.com/q/21865266
tags question: http://stackoverflow.com/q/21849450
tags question: http://stackoverflow.com/q/21954404
tags question: http://stackoverflow.com/q/21966945
tags question: http://stackoverflow.com/q/21846426
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/21912626
tags question: http://stackoverflow.com/q/21932565
tags question: http://stackoverflow.com/q/21912921
tags question: http://stackoverflow.com/q/21891127
tags question: http://stackoverflow.com/q/21874597
tags question: http://stackoverflow.com/q/21847382
tags question: http://stackoverflow.com/q/21933778
tags question: http://stackoverflow.com/q/21982512
tags question: http://stackoverflow.com/q/21842099
tags question: http://stackoverflow.com/q/21950993
tags question: http://stackoverflow.com/q/21979699
tags question: http://stackoverflow.com/q/21961309
tags question: http://stackoverflow.com/q/21934427
tags question: http://stackoverflow.com/q/21996940
tags question: http://stackoverflow.com/q/21927685
tags question: http://stackoverflow.com/q/21870962
tags question: http://stackoverflow.com/q/21915875
tags question: http://stackoverflow.com/q/21959667
tags question: http://stackoverflow.com/q/21900846
tags question: http://stackoverflow.com/q/21927824
tags question: http://stackoverflow.com/q/21941307
tags question: http://stackoverflow.com/q/21846731
tags question: http://stackoverflow.com/q/21940739
tags question: http://stackoverflow.com/q/21932411
tags question: http://stackoverflow.com/q/21910968
tags question: http://stackoverflow.com/q/21912334
tags question: http://stackoverflow.com/q/21883609
tags question: http://stackoverflow.com/q/21903076
tags question: http://stackoverflow.com/q/21920421
tags question: http://stackoverflow.com/q/21967518
tags question: http://stackoverflow.com/q/21964302

http://stackoverflow.com/comment/33092915
type: Comment
comment on: http://stackoverflow.com/q/21859893
has text: Should just work. Is it a native library?
score: 0
type: QuestionComment

http://stackoverflow.com/q/21881469
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: I have untypical class: * @generated public class Something { protected EList&lt;A&gt; a; //generated from eclipse emf ... (only Strings and Ints) } I don't have any possibility to modify this class (generated code). I want to deserialize it in this way: public static void main(String args[]) throws JsonParseException, JsonMappingException, IOException { AMD converter = new AMD (); String json = "{\"id\": \"2\",\ ... \"art\": [ null ]}"; // converting JSON String to Java object A a = (A) converter.fromJson(json); System.out.println(a); } public Object fromJson(String json) throws JsonParseException, JsonMappingException, IOException { A a = new ObjectMapper().readValue( json, A.class); return a; } Everything works ok (for String, int itp.) but I have a problem with Elist type. How can I deserialize this list ?
answer count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33137650
upvote count: 1
type: Question
has title: Untypical deserialization from json to object

http://stackoverflow.com/a/21969496
answers question: http://stackoverflow.com/q/21968358
has body: You need to install jdk. If you already installed the jdk, then set the environment variable, so your application can find the jdk path to execute javac command
score: 0
type: Answer

http://stackoverflow.com/comment/33312138
comment on: http://stackoverflow.com/q/21982512
type: Comment
type: QuestionComment
has text: You are aware that it does not need to be a folder on the file system? A web container can choose to run the web app out of the WAR file without expanding it.
score: 1

nutiteq
tag name: nutiteq
tags question: http://stackoverflow.com/q/21862228
type: Tag

http://stackoverflow.com/a/21915278
has comment: http://stackoverflow.com/comment/33192372
type: AcceptedAnswer
type: Answer
upvote count: 15
has body: According to Java Language Specification, section 14.14.1.2: for ( ForInitopt ; Expressionopt ; ForUpdateopt ) Statement If the Expression is not present, or it is present and the value resulting from its evaluation (including any possible unboxing) is true, then the contained Statement is executed. Since the standard treats missing expressions and expressions evaluating to true in the same way, the for loop with the missing expression is equivalent to an infinite loop.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21915198
answers question: http://stackoverflow.com/q/21915198
score: 15

http://stackoverflow.com/comment/33283571
score: 0
type: Comment
has text: @1xQ: The OOME isn't clear to me. You are never reading the file fully into memory, so according to the provided code it's not clear why the memory consumption increases when the file size increases.
comment on: http://stackoverflow.com/a/21965123
type: AnswerComment

http://stackoverflow.com/a/67783167
upvote count: 1
has body: Below snippet shows how you can open chrome browser using selenium webdriver. public static void main(String[] args) { //Creating a driver object referencing WebDriver interface WebDriver driver; //Setting the webdriver.chrome.driver property to its executable's location System.setProperty("webdriver.chrome.driver", "/lib/chromeDriver/chromedriver.exe"); //Instantiating driver object driver = new ChromeDriver(); //Using get() method to open a webpage driver.get("https://stackoverflow.com"); //Closing the browser driver.quit(); }
answers question: http://stackoverflow.com/q/21905377
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/90370517
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21876717
has text: The downside of this approach is that you're handing over the entire list, with all the mutator methods therein. An iterator allows you to restrict operations to just iterating. C++ is much better at this...
score: 0

http://stackoverflow.com/a/21875305
has body: In Java there are more types of memory. Using MaxPermSize you are increasing the max of your permgen memory which is used to store "static" info about your classes. You want to increase the memory for your "dynamic" data. That is the heap and for this -J-Xmx is used. You could verify your settings using jvisualvm. So to increase your heap try something like: -J-Xmx512m If you are using a 32 bit Java your memory is somewhat limited to I think 1g. If you are using invalid (too large) settings, Netbeans will not start. The memory Netbeans shows in its memory display is the addition of PermGenSpace and Heap. Again: look into jvisualvm to control the used settings for each memory type.
answers question: http://stackoverflow.com/q/21875171
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33128759
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/33123967
score: 1
has comment: http://stackoverflow.com/comment/33122157
has comment: http://stackoverflow.com/comment/33121173
has comment: http://stackoverflow.com/comment/33123786
has comment: http://stackoverflow.com/comment/33123375
accepted answer of: http://stackoverflow.com/q/21875171
has comment: http://stackoverflow.com/comment/33122421

http://stackoverflow.com/comment/87458381
score: 0
type: Comment
has text: Unfortunately read/write locks are usually [worse](http://joeduffyblog.com/2009/02/11/readerwriter-locks-and-their-lack-of-applicability-to-finegrained-synchronization/), unless you have long hold times due to I/O.
comment on: http://stackoverflow.com/a/50220470
type: AnswerComment

http://stackoverflow.com/comment/33209363
has text: use c3p0 api for connection pooling. and set pool size property in hibernate configuration.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21924558
score: 0

http://stackoverflow.com/q/21962495
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21963440
tagged with: android-fragments
tagged with: java
tagged with: listview
type: Question
has answer: http://stackoverflow.com/a/21963440
score: 0
answer count: 1
tagged with: android
has body: I'm an Android beginner. I'm using Android Studio, and I create my activity with the NavigationDrawer. So I have a ListView, but I want to add some other things to my Drawer. I created a custom layout and inside NavigationDrawerFragment.java: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { RelativeLayout insideDrawer = (RelativeLayout) inflater.inflate( R.layout.fragment_fragment_inside_drawer, container, false); return insideDrawer; } And it works. I have a ListView and a button inside the drawer. I tried to access the list view with getActivity.findViewById(R.id.mylistview) but it doesn't work. So how can I access my objects inside the drawer? Thanks!
tagged with: navigation-drawer
has title: access items inside custom NavigationDrawer

http://stackoverflow.com/comment/33332951
has text: XML Parser will make it easy
score: 0
comment on: http://stackoverflow.com/q/21994082
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21916191
has comment: http://stackoverflow.com/comment/33196473
has comment: http://stackoverflow.com/comment/33201943
tagged with: android
has comment: http://stackoverflow.com/comment/33201107
has comment: http://stackoverflow.com/comment/33195600
has comment: http://stackoverflow.com/comment/33196594
has comment: http://stackoverflow.com/comment/33195942
favorite count: 0
has answer: http://stackoverflow.com/a/21916459
has comment: http://stackoverflow.com/comment/33197933
has comment: http://stackoverflow.com/comment/33201803
linked to: http://stackoverflow.com/q/9477922
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33195243
has comment: http://stackoverflow.com/comment/33193973
has comment: http://stackoverflow.com/comment/33194234
has comment: http://stackoverflow.com/comment/33197476
has comment: http://stackoverflow.com/comment/33197129
downvote count: 1
has comment: http://stackoverflow.com/comment/33195155
type: Question
has comment: http://stackoverflow.com/comment/33200912
has comment: http://stackoverflow.com/comment/33196980
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/33200036
answer count: 1
has title: What is the reason ScheduledExecutorService is not executing while display is off?
has body: Im fairly new to Android and have encountered a problem, which i would like to understand. The problem is that the java.util.concurrent.ScheduledExecutorService doesn't seem to issue its tasks while the display of my smartphone is off. I was using a java.util.Timer before which didn't have this issue, but was transitioning to ScheduledExecutorService because of the need to wait for the end of the task execution after stoping the Timer. The Timer is used in a Service running in the background. Note: Using AlarmManager isn't an option, because i want to understand the problem with ScheduleExecutorService or else will use Timer again (synchronizing the shutdown). Here is how the task is scheduled: mScheduler = Executors.newSingleThreadScheduledExecutor(); mScheduler.scheduleAtFixedRate(mTask, 1, 1, TimeUnit.SECONDS); To furher clarify the purpose: I am trying to update a Notification as well as parts of the User Interface periodically, this doesn't need to be done if the device wants to go into "sleep" mode, but i would need to handle this case. I think understanding why ScheduledExecutorService is behavoring the way it does compared to Timer will help me handle it. UPDATE: As recommended by Chris Stratton, i'm using a BroadcastReceiver to receive the Intent.ACTION_SCREEN_ON and Intent.ACTION_SCREEN_OFF Intents to pause/resume the ScheduledExecutorService, which works like a charm. However there seems to be another issue with the ScheduledExecutorService while having a phone call, the execution doesn't stop but seems to be throttled somehow. This is only the case if the screen is turned off due to the proximity sensor (no intents are received in this case either)...
score: 4

http://stackoverflow.com/q/21898844
has comment: http://stackoverflow.com/comment/33163970
has comment: http://stackoverflow.com/comment/33163829
has comment: http://stackoverflow.com/comment/33163589
linked to: http://stackoverflow.com/q/21800147
has comment: http://stackoverflow.com/comment/33163562
has comment: http://stackoverflow.com/comment/33163563
favorite count: 0
has comment: http://stackoverflow.com/comment/33163729
tagged with: timer
duplicate of: http://stackoverflow.com/q/21800147
has comment: http://stackoverflow.com/comment/33164044
has comment: http://stackoverflow.com/comment/33163611
has body: I want to pause the execution of a Swing Program for a specified amount of time. Naturally the first thing that I used was Thread.sleep(100) (since, I am a noob). Then I got to know that my program is not thread safe so I decided to use Timer with some suggestions from fellow programmers. The problem is I am unable to get any sources from where I can learn how to delay the thread, using Timer. Most of them use Timer for delaying execution. Please help me solve this problem. I have provided a compileable code snippet below. import javax.swing.*; import java.awt.*; public class MatrixBoard_swing extends JFrame{ public static void main(String[] args){ SwingUtilities.invokeLater(new Runnable() { public void run() { MatrixBoard_swing b = new MatrixBoard_swing(); } }); } MatrixBoard_swing(){ this.setSize(640, 480); this.setVisible(true); while(rad &lt; 200){ repaint(); rad++; try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } int rad = 10; public void paint(Graphics g){ super.paint(g); g.drawOval(400-rad, 400-rad, rad, rad); } } EDIT: My trial for a Timer implementation(please tell me if it is wrong): import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class MatrixBoard_swing extends JFrame implements ActionListener{ Timer timer; public static void main(String[] args){ SwingUtilities.invokeLater(new Runnable() { public void run() { MatrixBoard_swing b = new MatrixBoard_swing(); } }); } MatrixBoard_swing(){ this.setSize(640, 480); this.setVisible(true); timer = new Timer(100, this); timer.start(); } int rad = 10; public void paint(Graphics g){ super.paint(g); g.drawOval(400-rad, 400-rad, rad, rad); } @Override public void actionPerformed(ActionEvent arg0) { repaint(); rad++; if(rad &gt;= 200){ timer.stop(); } }
has comment: http://stackoverflow.com/comment/33163687
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/33163536
has comment: http://stackoverflow.com/comment/33163762
linked to: http://stackoverflow.com/q/21869390
has title: Using Timer To Pause Program Execution
has answer: http://stackoverflow.com/a/21899112
accepted answer: http://stackoverflow.com/a/21899112
has comment: http://stackoverflow.com/comment/33163945
upvote count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/33163543
answer count: 1

http://stackoverflow.com/a/21940121
answers question: http://stackoverflow.com/q/21939896
score: 0
has body: There is no direct way to do it using standard Java. You may be able to approximate it though by taking the count once and then keeping track of how many times you add and remove things. That only works if you are the only one adding and removing files though. Slightly more complicated would be to use the java nio functionality to monitor the folder for changes. Count the folder once, then monitor the folder for changes and as files are added and removed update your count. http://docs.oracle.com/javase/tutorial/essential/io/notification.html
type: Answer

http://stackoverflow.com/comment/33243904
score: 0
type: AnswerComment
has text: @DavidEhrmann If you're referring to the generic exception, you're completely right, and I agree. I only put it there as a generic example. In hindsight it might have been giving off the wrong signal. Let me edit it.
type: Comment
comment on: http://stackoverflow.com/a/21944272

http://stackoverflow.com/q/21907879
tagged with: dll
tagged with: java
has answer: http://stackoverflow.com/a/21929322
score: 0
answer count: 1
tagged with: jar
type: UnansweredQuestion
has body: I am trying to install the JOGL libraries into my eclipse. I was fortunate enough to find a question asked on stack overflow for a link towards the download however I couldn't find a up-to-date installation guide on the internet. I have downloaded the jogl-all-platforms zip which looks like this: However I'm not sure at all where the jars that I need are. Reading the Learning Java Binding by Gene Davis, I am guided in the book to include the jogl.jar and the native library called jogl.dll. I have searched all of the folders for these files however I seem to be missing them. Do I have a bad zip? Did the name of the files change from when the author wrote the book? Here is a print screen of a search for the jogl.jar Here is a print screen of a search for the jogl.dll My question is how would I be able to install the java binding so that I'm able to follow the code in the book.
tagged with: jogl
has title: JOGL libraries installation
type: Question
tagged with: java-binding

tostring
tags question: http://stackoverflow.com/q/21922855
tag name: tostring
type: Tag
tags question: http://stackoverflow.com/q/21948944
tags question: http://stackoverflow.com/q/21979151

http://stackoverflow.com/a/22002563
has body: In distributed queue, messages with same UOO is processed by same node. It is briefed in below video with example. Presentation is done by Oracle. http://www.youtube.com/watch?v=B9J7q5NbXag
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21927973
answers question: http://stackoverflow.com/q/21927973
type: AcceptedAnswer

http://stackoverflow.com/q/21998366
has body: I followed this guide: http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html but am still getting this error: E/AndroidRuntime(916): java.lang.UnsatisfiedLinkError: Couldn't load opencv_java248 from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.smartlab-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.smartlab-2, /system/lib]]]: findLibrary returned null When I call this line: System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
has title: Unsatified Link Error: Android OpenCV
has answer: http://stackoverflow.com/a/22001462
type: Question
tagged with: opencv
tagged with: java
tagged with: eclipse
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22001462
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/comment/33306384
has text: Z is being translated by -2f in `translateCircle()`, that might take the object off the screen. Did you check making it 0 ? Also Can you publish the sequence of calls of all these functions ?
comment on: http://stackoverflow.com/a/21978795
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/33220109
comment on: http://stackoverflow.com/a/21931170
has text: Problem mentioned two problem, 1. "I am trying to read in a file path from an XML file in java", 2. "I am getting a file not found exception"
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21968909
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33378272
has answer: http://stackoverflow.com/a/22018672
tagged with: unicode
has comment: http://stackoverflow.com/comment/33373901
type: UnansweredQuestion
has title: Getting Unicode of text entered in regional language in JTextArea (Java)
tagged with: java
has body: I am building an app where I want user to input text in some other my regional language which I have achieved by changing its Font. Now but at backend I want that its Unicode to be extracted but how could I achieve it ..?? If I copies that string and enter it anywhere its just the English language ..?? How do Java gets to know about the language..?? This is the code :- /* some code */ static Font f4=new Font("AnmolLipiThick",Font.BOLD ,15); /* some code */ ta = new JTextArea(); //ta.setFont(f2); ta.setFont(f4); //ta.setWrapStyleWord(false); ta.setBackground(Color.ORANGE); ta.setLineWrap(true); c.gridy = 2; c.weighty = 0.4; c.fill = GridBagConstraints.BOTH; frame.add(ta,c); /* some code */ Such as in my above java code the font is for Punjabi language..!! How could Java get to know about that such that it starts Unicode from that code plane...!! How to achieve it plz help me out..??
type: Question
has comment: http://stackoverflow.com/comment/33349518
has comment: http://stackoverflow.com/comment/33376886
has answer: http://stackoverflow.com/a/22019230

http://stackoverflow.com/comment/33356641
score: 0
comment on: http://stackoverflow.com/q/22004886
type: QuestionComment
type: Comment
has text: One solution could be to use [`java.awt.Robot`](http://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html), but the command window would need to have focus for this to work correctly.

http://stackoverflow.com/comment/99683484
comment on: http://stackoverflow.com/a/22030994
type: AnswerComment
has text: I had to also do disableAnsi="false"
type: Comment
score: 3

http://stackoverflow.com/q/21943263
score: 0
has answer: http://stackoverflow.com/a/21961766
has title: GWT - google vizualization tools - scheduling a chart refresh
type: UnansweredQuestion
tagged with: gwt
tagged with: java
type: Question
tagged with: google-visualization
answer count: 1
has body: I am building an application that display semi-real time data (refresh every minute) using google visualization tools in gwt. Since I am very new to GWT I was following this guide: http://code.google.com/p/gwt-google-apis/wiki/VisualizationGettingStarted I got this code at the moment: public void onModuleLoad() { // Create a callback to be called when the visualization API has been loaded. Runnable onLoadCallback = new Runnable() { public void run() { Panel panel = RootPanel.get("graph_box"); // Create a chart visualization. AnnotatedTimeLine graph = new AnnotatedTimeLine(createTable(), createOptions(), "1000px", "500px"); graph.addStyleName("timeLine"); panel.add(graph); } }; // Load the visualization api, passing the onLoadCallback to be called when loading is done. VisualizationUtils.loadVisualizationApi(onLoadCallback, AnnotatedTimeLine.PACKAGE); Timer timeoutTimer = new Timer() { public void run() { Window.alert("Reloaded chart."); } }; timeoutTimer.scheduleRepeating(1000 * 3); } and I am not clear how to call the draw() function of AnnotatedTimeLine (https://developers.google.com/chart/interactive/docs/gallery/annotatedtimeline) inside my scheduler, so that it redraws itself, without reloading the whole page.

http://stackoverflow.com/a/21979086
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/106413557
has comment: http://stackoverflow.com/comment/106412732
has body: In cases where there is problem with connectivity like network blip, JMS providers like WebSphere MQ have a automatic reconnection feature where the JMS client attempts to reconnect if there is a connectivity problem during execution of a API. For example if connection to JMS provider breaks during the execution Send API, JMS client attempts to reconnect to JMS provider and if a connection is established, message is sent to the provider. The reconnection attempts are transparent to JMS application meaning the application is unaware of the reconnection. In cases where a queue is full, the application will have to handle the exception and take appropriate action.
has comment: http://stackoverflow.com/comment/33312860
answers question: http://stackoverflow.com/q/21966241
upvote count: 2
has comment: http://stackoverflow.com/comment/33312691
type: Answer

http://stackoverflow.com/comment/33178888
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21907031
type: AnswerComment
has text: You're a gentleman. thanks ;-)

http://stackoverflow.com/a/21970139
score: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33314498
has body: What you enabled is the second-level cache. This cache caches the state of the entities, and indexes them by their ID. It's like a Map&lt;ID, EntityState&gt;. This cache is only used if you get the entity by ID: by calling session.get() by calling session.load() by navigating through a XxxToOne association targeting the entity Your query doesn't fall into this category: it looks for your entity by one of its fields, and not by its ID. For the rest, Hibernate can't execute arbitrary SQL queries against the cache, and even if it could, the cache only contains a subset of the table, so it has to query the database. You can however, cache the result of queries as well. You'll need to enable the query cache to do so, and to mark your query as cacheable. You can also cache an association (which seems like the reason for this query: it's looking for all the cities of a given state). You'll have to annotate the association with @Cache. Read the documentation.
has comment: http://stackoverflow.com/comment/79917315
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21969197
answers question: http://stackoverflow.com/q/21969197

http://stackoverflow.com/comment/33138197
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21884518
has text: [object adapter](http://i.imgur.com/XeZA2rp.png) and [class adapter](http://i.imgur.com/s9FxW8Q.png) uml
type: AnswerComment

http://stackoverflow.com/comment/33234874
has text: When i change the argument type in frighten method from int to byte then why the dragon frighten method is not printing and method in monster is printing twice
type: Comment
comment on: http://stackoverflow.com/a/21939040
type: AnswerComment
score: 0

http://stackoverflow.com/a/21996967
score: 0
has body: Some mistake is there... char[] chararray = new char[900]; -> you are fixed the length ? is your file contents more than 30 char then IndexOutOfBoundsException will come Here you declare int i=4 of so then 30 x 30 + 4 = 904 and then IndexOutOfBoundsException will come int i = 4; for(int row = 0; row &lt; 30; row++){ for(int col = 0; col &lt; 30; col++){ grid1 [row][col] = chararray[i]; i++; System.out.print(grid1[row][col]); } System.out.println(); } ALSO if (grid[a - 1][b] == 'X') if a=0 than 0-1=-1 so IndexOutOfBoundsException will come............. Similarly more and many .... SO I DO SAY, REVIEW YOUR CODE
type: Answer
answers question: http://stackoverflow.com/q/21996169

http://stackoverflow.com/comment/33110028
score: 0
type: Comment
type: QuestionComment
has text: Do you want to change your activity background according to clicked button ?
comment on: http://stackoverflow.com/q/21868560

http://stackoverflow.com/a/21913694
has body: You can use System.setOut() to redirect the System.out.println writes to a PrintStream(OutputStream). Then you can write that OutputStream to a String and test it.
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21913408

http://stackoverflow.com/comment/33268789
has text: Is your html file in the src\assignment2 directory? The location of your html is probably the issue. It is working fine for me.
type: AnswerComment
comment on: http://stackoverflow.com/a/21957914
type: Comment
score: 0

http://stackoverflow.com/comment/33132510
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21882025
has text: yes is possible to loading keys for UImanager from FileIO

http://stackoverflow.com/comment/33141767
comment on: http://stackoverflow.com/q/21886517
type: Comment
type: QuestionComment
has text: SOLVED: Instead of using `Collections.singleton(PlusScopes.PLUS_ME)`, I used PlusScopes.all() and that got rid of the Rate Limit error. Strange, isn't it?
score: 0

http://stackoverflow.com/a/22181234
answers question: http://stackoverflow.com/q/21922547
has body: You can register @Provider annotated classes in a number of different ways: Automatically scanned by Resteasy as a ServletContextListener. Configured explicitly in web.xml as a ServletContextListener. Configured explicitly as a standalone javax.ws.rs.Application. Automatically scanned by an IOC container like Spring. Automatically Scanned by Resteasy Configure your application to automatically scan for @Provider annotated class in your web.xml file by setting the resteasy.scan.providers context parameter. org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap resteasy.scan.providers true Resteasy org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher Resteasy /resteasy/* NOTE: Do not use this if you are deploying on JBoss 7 or later. @Provider is automatically enabled in version 7 and later of JBoss and using this value can cause errors during application startup. Configured Explicitly in web.xml Providers can be explicitly registered with Resteasy in your web.xml file by setting the resteasy.providers context parameter. resteasy.providers com.foo.NotFoundExceptionMapper,com.foo.SomeOtherProvider ... All of the other HttpServletDispatcher and ResteasyBootstrap stuff like above. Configured Explicitly as Standalone App If you are bootstrapping your Resteasy service using the javax.ws.rs.Application class you can add your provider implementations as follows: public class FooApplication extends Application { private Set<Object> singletons = new HashSet<Object>(); private Set<Class> classes = new HashSet<Class>(); public FooApplication() { classes.put(NotFoundExceptionMapper.class); } public Set<Class<?>> getClasses() { return classes; } public Set<Object> getSingletons() { return singletons; } } Automatically Scanned by Spring If you are using Spring to scan for your Resteasy providers you need to tell Spring that you are interested in @Provider annotations and you need to configure Spring to tell Resteasy about the beans it has scanned. ExceptionMapper Yo…
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/33316771
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21950317
has text: Thanks for your answer, but i think that the MimeType could change from browser to browser

http://stackoverflow.com/a/21937314
accepted answer of: http://stackoverflow.com/q/21936864
score: 0
has body: You can use addBatch String s1 = "SET @count = 0"; String s2 = ... try { // query to reset menu_id manly after delete row connection = database.getConnection(); Statement statement = connection.createStatement(); statement.addBatch(s1); statement.addBatch(s2); statement.addBatch(s2); s.executeBatch(); connection.commit(); } catch (SQLException e) { connection.rollback(); throw e; } finally { close(statement); close(connection); }
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21936864
type: Answer

iterator
tags question: http://stackoverflow.com/q/21956515
tags question: http://stackoverflow.com/q/21954680
tag name: iterator
tags question: http://stackoverflow.com/q/21977718
tags question: http://stackoverflow.com/q/21976392
tags question: http://stackoverflow.com/q/21998543
tags question: http://stackoverflow.com/q/21876383
tags question: http://stackoverflow.com/q/21965671
tags question: http://stackoverflow.com/q/21995499
tags question: http://stackoverflow.com/q/21865095
tags question: http://stackoverflow.com/q/21926407
tags question: http://stackoverflow.com/q/21972572
tags question: http://stackoverflow.com/q/22004092
tags question: http://stackoverflow.com/q/21988341
tags question: http://stackoverflow.com/q/21972108
tags question: http://stackoverflow.com/q/21947242
type: Tag

http://stackoverflow.com/q/21865621
has comment: http://stackoverflow.com/comment/33339441
has comment: http://stackoverflow.com/comment/33368193
tagged with: statusbar
score: 28
has comment: http://stackoverflow.com/comment/33338849
favorite count: 0
has comment: http://stackoverflow.com/comment/33382507
tagged with: android
has title: Transparent status bar - before Android 4.4 (KitKat)
has comment: http://stackoverflow.com/comment/33382093
upvote count: 29
has body: I know in Android 4.4 KitKat (API 19) it's possible to make the status bar transparent. But for example, Go Launcher Ex and others have an option to make it transparent, and it's working on pre KitKat also, for me (Android&nbsp;4.3 (Jelly Bean)) too and also on my Android&nbsp;4.0 (Ice Cream Sandwich) device. I didn't need root or any special privileges to use it. Download Go Launcher Ex and try it yourself. For me it would also be OK if I would need root. But how did they do that? How can I make Android's status bar translucent on pre-KitKat devices? ---To clarify things--- I'm not talking about the Action Bar; I mean the Status Bar (Notification Bar)! see these example pictures: (Notice, this is taken from my Stock Galaxy Note 3 with Android 4.3 and Go Launcher Ex.) (The same thing works with my Galaxy S2 and Android 4.0 too.) Without a transparent status bar: With transparent status bar enabled: (I want to achieve this on pre 4.4 (API 19) devices)
possible better answer: http://stackoverflow.com/a/52167773
has comment: http://stackoverflow.com/comment/33387468
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33382584
has answer: http://stackoverflow.com/a/52167773
tagged with: transparent
has answer: http://stackoverflow.com/a/22049872
has comment: http://stackoverflow.com/comment/33382702
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33382641
tagged with: java
has comment: http://stackoverflow.com/comment/33338894
answer count: 2
accepted answer: http://stackoverflow.com/a/22049872
has comment: http://stackoverflow.com/comment/33387536

method-hiding
tag name: method-hiding
type: Tag
tags question: http://stackoverflow.com/q/21948701

http://stackoverflow.com/comment/33190645
has text: This might be something simillar http://stackoverflow.com/questions/8281752/replace-the-legacy-stack-with-what-from-java-collections?rq=1
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21914374

http://stackoverflow.com/q/21899089
has body: We are looking for an enterprise solution that can convert a PDF document to XML data. I am ok with any solutions; if there is an off the shelf product from a major software provider. Is there a Java framework that we can use? Is there a API that adobe provides?
score: 0
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
has title: PDF to XML Conversion
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21899166
tagged with: adobe
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
type: Question
tagged with: enterprise

http://stackoverflow.com/comment/33415469
type: Comment
comment on: http://stackoverflow.com/a/21956195
has text: if things weren't confusing enough: what's the difference between `RunnableExecutor` and `Executor` ?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33317522
has text: Post updated - see the bottom. Basically all content of the Java method consists of a Java methods with SQL queries.
type: QuestionComment
comment on: http://stackoverflow.com/q/21972375
score: 0
type: Comment

http://stackoverflow.com/comment/33196987
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21917687
has text: ok then pareshMayani's answer is very well explained in short. +1 for him.

http://stackoverflow.com/comment/33268845
comment on: http://stackoverflow.com/q/21958147
type: Comment
has text: JTextField is what I meant
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33264561
has text: Thanks @donn-felker. How would I go about implementing the audio player as a fragment?
type: AnswerComment
comment on: http://stackoverflow.com/a/21867573
score: 0
type: Comment

http://stackoverflow.com/a/21918314
answers question: http://stackoverflow.com/q/21918262
upvote count: 3
has body: If you have an if followed by an else, that ends the block. You can have if followed by multiple else if statements, but only one else -- and the else must be last.
score: 3
has comment: http://stackoverflow.com/comment/33198281
has comment: http://stackoverflow.com/comment/33198136
downvote count: 0
type: Answer

http://stackoverflow.com/comment/33283113
comment on: http://stackoverflow.com/a/21965737
score: 0
type: AnswerComment
has text: Thank you , i wish it was more straighforward than this. addObject should have done the job. Trying to associate a factory now.
type: Comment

http://stackoverflow.com/comment/33199194
type: AnswerComment
has text: This doesn't verifies if the minute is > 10
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21918981

http://stackoverflow.com/q/21912891
possible better answer: http://stackoverflow.com/a/21913687
tagged with: java
has answer: http://stackoverflow.com/a/21913687
has comment: http://stackoverflow.com/comment/33189442
has body: This is a homework assignment and I apologize for the dumb question I just can't seem to crack it and I have tried a few ways, including .hasInt();. The code I have works for checking if the user is entering integers buy won't allow anything after I want to allow the user to enter "5 hours, 10 minutes, 15 seconds.". So far I can only allow them to enter "5 10 15" and anything else gets caught by the exception and asks him to enter valid numbers. Here is the code. import java.util.*; public class TimetoSeconds { public static void main(String[] args) { System.out.println("Time converter"); System.out.println(); //start scanner and variables Scanner sc = new Scanner(System.in); int x = 60; String choice = "y"; while (choice.equalsIgnoreCase("y")) { //catch exceptions int hours = 0; int minutes = 0; int seconds = 0; try { // get user input System.out.print("Enter time in hours (space), minutes (space), and seconds: "); hours = sc.nextInt(); minutes = sc.nextInt(); seconds = sc.nextInt(); System.out.println(); } catch (InputMismatchException e) { sc.nextLine(); System.out.print("Error! Invalid number. Try again.\n"); continue; } int sec1 = (hours * x) * x; int sec2 = minutes * x; int totalSec = sec1 + sec2 + seconds; System.out.print("Total seconds are: " + totalSec + "\n"); System.out.println(); System.out.print("Continue? (y/n): "); choice = sc.next(); System.out.println(); } } }
has answer: http://stackoverflow.com/a/21913033
has comment: http://stackoverflow.com/comment/33187995
has title: How can I allow for three integers to be entered followed by a space and a word before the system checks for exceptions?
has comment: http://stackoverflow.com/comment/33188108
answer count: 3
tagged with: exception
has answer: http://stackoverflow.com/a/21913811
accepted answer: http://stackoverflow.com/a/21913033
score: 0
has comment: http://stackoverflow.com/comment/33188768
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33188188

http://stackoverflow.com/q/21915545
answer count: 1
has answer: http://stackoverflow.com/a/21918723
has body: I am trying to load and render levels (tile maps) in Slick2D from text files. The text files look something like this: res/RPGSheet 32x32.png (tileset to be used with this map) 5 (How many tiles wide the map is) 5 (How many tiles tall the map is) 16 (How many tiles wide the tileset is) 16 (How many tiles tall the tileset is) 4,1 4,1 4,1 4,1 4,1 4,1 1,1 2,0 4,1 4,1 4,1 4,1 1,1 4,1 4,1 4,1 1,1 4,1 1,1 4,1 4,1 4,1 4,1 4,1 4,1 First I'll explain how my tilemaps work: Each coordinate indicates where the tile is located on the tileset image. So 0,0 is the tile in the upper left hand corner of the map, 0,1 is the tile below it, and 1,0 is the tile to the right of it. Now for the problem... For some reason, the tilemaps don't render to the screen correctly. I am sure that it is reading the files correctly, but it's not rendering them correctly for some reason. For example, the tilemap above should display like this: W W W W W W G D W W W W G W W W G W G W W W W W W (If W is a water tile, G is grass and D is dirt) But instead, it renders the tiles to the screen in this formation: W W W W W W G W G W W D G W W W W W G W W W W W W Why does this happen? Here is my code: public class Play extends BasicGameState{ int x; int y; Image image; SpriteSheet tileset; int MapWidth; int MapHeight; int TilesAcross; int TilesTall; int TileWidth; int TileHeight; String[] coords; int[] tilesX; int[] tilesY; String TileDir; Image tile; String map; int renderCount = 0; public void init(GameContainer gc, StateBasedGame sbg) throws SlickException{ int count = 0; map = new String("res/DefaultMap.txt"); try(BufferedReader in = new BufferedReader(new FileReader(map))){ String line; TileDir = new String(in.readLine()); MapWidth = Integer.parseInt(in.readLine()); MapHeight = Integer.parseInt(in.readLine()); TilesAcross = Integer.parseInt(in.readLine()); TilesTall = Integer.parseInt(in.readLine()); System.out.println("(DEBUG)Tileset Directory: " + TileDir); System.out.println("(DEBUG)Map Width: " + Map…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21918723
type: Question
tagged with: 2d
tagged with: tile
tagged with: java
tagged with: slick2d
score: 0
has title: Why Aren't My Tile Maps Displaying Correctly?

http://stackoverflow.com/q/21898272
has comment: http://stackoverflow.com/comment/33162694
tagged with: android
has title: Getting longitude and latitude takes a very long time
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21898348
tagged with: java
tagged with: locationmanager
has comment: http://stackoverflow.com/comment/33162601
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21898364
has answer: http://stackoverflow.com/a/21898421
answer count: 6
has comment: http://stackoverflow.com/comment/33162584
has answer: http://stackoverflow.com/a/21898401
has body: I am getting the longitude and latitude of my device, but it takes at 30 seconds to a minute to do so. Any suggestions to cut the time down? public class MainActivity extends Activity { public String zipcode; public double latG; public double lonG; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE); boolean enabled = service.isProviderEnabled(LocationManager.GPS_PROVIDER); if (!enabled) { Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(intent); } LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationManager.getLastKnownLocation(Context.LOCATION_SERVICE); LocationListener locationListener = new LocationListener() { public void onLocationChanged(Location location) { if (location != null) { latG = location.getLatitude(); lonG = location.getLongitude(); Toast.makeText(MainActivity.this, latG + " " + lonG, Toast.LENGTH_LONG).show(); } } public void onProviderDisabled(String provider) { } public void onProviderEnabled(String provider) { } public void onStatusChanged(String provider, int status, Bundle extras) { } }; locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener); Geocoder geocoder = new Geocoder(this, Locale.getDefault()); List&lt;Address&gt; addresses = null; try { addresses = geocoder.getFromLocation(latG, lonG, 1); } catch (IOException e) { Context context = this; AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context); alertDialogBuilder.setTitle("Error"); alertDialogBuilder.setMessage("Error in getting address information."); alertDialogBuilder.setCancelable(true); } for (Address address : addresses) { if(address.getPostalCode() != null) { zipcode = address.getPostalCode(); Toast.makeText(MainActivity.this, zipcode, Toast.LENGTH_LONG).show(); break; } } } …
score: 1
tagged with: locationlistener
has answer: http://stackoverflow.com/a/21898383
favorite count: 0
accepted answer: http://stackoverflow.com/a/21898364
has answer: http://stackoverflow.com/a/21898389
upvote count: 2
has answer: http://stackoverflow.com/a/21898348

http://stackoverflow.com/comment/33171045
comment on: http://stackoverflow.com/q/21903326
type: Comment
type: QuestionComment
score: 0
has text: Does this program produce output in the console, when you run it there? Or does it read from standard input?

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/21884724
tags question: http://stackoverflow.com/q/21968104

http://stackoverflow.com/a/21897847
has comment: http://stackoverflow.com/comment/33162443
has comment: http://stackoverflow.com/comment/33164751
answers question: http://stackoverflow.com/q/21897181
has comment: http://stackoverflow.com/comment/33164696
type: AcceptedAnswer
has body: If I try to write to a unconnected SocketChannel, an Broken pipe exception will happen. Correct. So I wonder how to make sure the SocketChannel is really connected? That's how. There is no API that can tell you. TCP doesn't work like that. The only way to detect a broken TCP connection is to try to use it.
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21897181
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33164195
has comment: http://stackoverflow.com/comment/52965465

http://stackoverflow.com/comment/33182005
score: 0
comment on: http://stackoverflow.com/q/21907384
type: Comment
type: QuestionComment
has text: @Sheridan As it stands, this question appears to be asking about the basics regarding how to use an ArrayList, which is exactly what the linked question addresses, which is why I think it's a duplicate (and I certainly won't remove my close vote if I think the question should be closed and, if I didn't, I wouldn't need prompting to do so). What makes you think the others voting to close don't agree with my reasoning, or think the question should be closed for another reason (unclear or too broad comes to mind), but think closing it as a duplicate of a fairly related question is better?

http://stackoverflow.com/a/21996083
has comment: http://stackoverflow.com/comment/40517361
has comment: http://stackoverflow.com/comment/34392093
has comment: http://stackoverflow.com/comment/33410702
has comment: http://stackoverflow.com/comment/40524375
has comment: http://stackoverflow.com/comment/33338222
has comment: http://stackoverflow.com/comment/33358709
has comment: http://stackoverflow.com/comment/34391252
has comment: http://stackoverflow.com/comment/33380140
has comment: http://stackoverflow.com/comment/33405263
answers question: http://stackoverflow.com/q/21995359
type: Answer
score: 11
has comment: http://stackoverflow.com/comment/33410752
has comment: http://stackoverflow.com/comment/33337817
has comment: http://stackoverflow.com/comment/33338773
has body: When you load the FXML for the secondary controller, do this: FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(getClass().getResource("second.fxml")); AnchorPane frame = fxmlLoader.load(); FXMLSecondaryController c = (FXMLSecondaryController) fxmlLoader.getController(); Then you can pass references to the second controller. This could just be the TextArea. EDIT: Replaced the load() call in the snippet above and added the setLocation() call. The old line AnchorPane frame = fxmlLoader.load(getClass().getResource("second.fxml")); was wrong as it called the static load function, which is useless here. EDIT: (Changed the code snippet above to better match your variable names.) The code snippet above replaces this part of your code: AnchorPane frame = FXMLLoader.load(getClass().getResource("second.fxml")); That line uses the FXMLLoader to load the view and also creates the instance of the controller - in this case FXMLSecondaryController. However, you cannot use the static FXMLLoader.load method for that, you need an instance of FXMLLoader. That instance holds a reference to the controller after load and you can retrieve that with getController(). And you need to cast the returned value to your controller class (with (FXMLSecondaryController)). Your primary controller has a field: @FXML private TextArea myArea; This holds a reference to your TextArea and is initialized by the fxml loader. (If you remove the @FXML annotation, the loader won't touch it.) In your secondary controller, add this field: public TextArea primaryTextArea; Note that @FXML is gone (the fxml loader shall not touch the field) as well as private (you want to set the field, hence others must see it). Now you can set this field after the controller has been loaded. So back to the loading code: FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(getClass().getResource("second.fxml")); AnchorPane frame = fxmlLoader.load(); FXMLSecondaryController c = (FXMLSecondaryController) f…
has comment: http://stackoverflow.com/comment/33375405
has comment: http://stackoverflow.com/comment/33380864
has comment: http://stackoverflow.com/comment/34396249
downvote count: 1
has comment: http://stackoverflow.com/comment/33337073
upvote count: 12
has comment: http://stackoverflow.com/comment/34377847
has comment: http://stackoverflow.com/comment/33341164

http://stackoverflow.com/q/21866439
tagged with: java
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/33107914
type: Question
tagged with: jtable
downvote count: 0
answer count: 1
tagged with: rowfilter
favorite count: 0
has comment: http://stackoverflow.com/comment/33119016
has title: Filtering - How to make JTable Display x amount of fields
has answer: http://stackoverflow.com/a/21868324
type: AnsweredQuestion
has body: I have a JTable which uses a RowFilter to filter fields but i want those results to be narrowed down to x amount like e.g. 5
linked to: http://stackoverflow.com/q/6187566
accepted answer: http://stackoverflow.com/a/21868324
score: 1

http://stackoverflow.com/a/21874628
answers question: http://stackoverflow.com/q/21874510
has body: Rhino is a pure Java implementation of JavaScript, which is co-bundled with JDK7. You can compile JavaScript to bytecode, or compile on-the-fly from JavaScript source.
accepted answer of: http://stackoverflow.com/q/21874510
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33119881
upvote count: 1
has comment: http://stackoverflow.com/comment/33120012
type: AcceptedAnswer
type: Answer

pca
tag name: pca
tags question: http://stackoverflow.com/q/21953912
type: Tag

http://stackoverflow.com/q/21942056
has answer: http://stackoverflow.com/a/21942127
tagged with: apache-poi
score: 37
answer count: 3
has title: is it possible to change sheet name with apache poi MS excel java android
upvote count: 37
possible better answer: http://stackoverflow.com/a/44335989
accepted answer: http://stackoverflow.com/a/21942127
tagged with: java
has answer: http://stackoverflow.com/a/44335989
tagged with: rename
type: AnsweredQuestion
downvote count: 0
tagged with: spreadsheet
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/69510271
tagged with: android
has body: is there any way to update existing sheet name of MS Excel file knowing that I am using apache poi in my android app I can create a sheet with my custom name HSSFSheet sheet = workbook.createSheet("my custom name"); but when I want to copy another sheet to this one , the name also is copied and my custom name is crashed

http://stackoverflow.com/comment/33181583
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21909385
has text: Also `if(newestFirst = true)`, is certainly not what you are looking for. It should be `if(newestFirst == true)`, or even better `if(newestFirst)`.
type: Comment

http://stackoverflow.com/q/21871639
has answer: http://stackoverflow.com/a/21872257
accepted answer: http://stackoverflow.com/a/21872257
has body: I am some what new to programming . I need to write an if condition that checks for the 25 methods , and if all methods are returning true then only control enters into if block . so i tried like if(meth1()&amp;&amp;meth2()&amp;&amp;meth3()&amp;&amp;meth4() ....... meth25()){ ..... ..... } else { print("in else"); } boolean meth1(){ if (valid){ return true; } else return false; } boolean meth2(){ if (valid){ return true; } else return false; } ... ... ... boolean meth25(){ if (valid){ return true; } else return false; } Is there any other way to do this? EDIT: im posting my actual code here ..... if(v.isValidRecordType(recordType)&amp;&amp; v.isValidClientReferance(clientReferance)&amp;&amp; v.isValidInitials(initials) &amp;&amp; v.isValidPrefixes(prefixes)&amp;&amp; v.isValidLastname(lastname)&amp;&amp; v.isValidGender(gender)&amp;&amp; v.isValidDateOfBirth(dateOfBirth) &amp;&amp; v.isValidStreetName(streetName)&amp;&amp; v.isValidHouseNumber(houseNumber)&amp;&amp; v.isValidHNExtension(hnExtension)&amp;&amp; v.isValidPostalCode(postalCode)&amp;&amp; v.isValidTownName(townName)&amp;&amp; v.isValidTelephone1(telephone1)&amp;&amp; v.isValidTelephone2(telephone2)&amp;&amp; v.isValidEmail(email) &amp;&amp; v.isValidPrincipalDebit(principalDebit)&amp;&amp; v.isValidCollectionFee(collectionFee)&amp;&amp; v.isValidAdditionalFees(additionalFees)&amp;&amp; v.isValidTotalDebit(totalDebit)&amp;&amp; v.isValidDateOfInvoice(dateOfInvoice)&amp;&amp; v.isValidActivationDateCollectionFile(activationDateCollectionFile) &amp;&amp; v.isValidBranch(branch)&amp;&amp; v.isValidKnownOnAddress(knownOnAddress)&amp;&amp; v.isValidFilters(filters)) { System.out.println("processed"); continue; } else{ System.out.println("in the record having clientReferance :"+clientReferance +"\n"); } and isValid*** methods look like.. public boolean isValidClientReferance(String ClientReferance){ String pattern= "^[a-zA-Z0-9]*"; if(ClientReferance.matches(pattern) &amp;&amp; mandatory(ClientReferance) ){ ret…
has comment: http://stackoverflow.com/comment/33114460
type: AnsweredQuestion
tagged with: performance
tagged with: java
possible better answer: http://stackoverflow.com/a/21871817
has answer: http://stackoverflow.com/a/21871806
has answer: http://stackoverflow.com/a/21871714
has comment: http://stackoverflow.com/comment/33114358
type: Question
has answer: http://stackoverflow.com/a/21871696
tagged with: if-statement
has comment: http://stackoverflow.com/comment/33114439
has answer: http://stackoverflow.com/a/21872590
answer count: 6
tagged with: optimization
score: 0
has comment: http://stackoverflow.com/comment/33114426
upvote count: 1
has comment: http://stackoverflow.com/comment/33123497
has comment: http://stackoverflow.com/comment/33115149
has answer: http://stackoverflow.com/a/21871817
downvote count: 1
has title: java: how could i reduce if(method1()&&method2()....&&method25())?
favorite count: 0

http://stackoverflow.com/a/21946249
answers question: http://stackoverflow.com/q/21946162
score: 4
has body: You are actually taking two powers, for example in the second line (the one for five years interest): five = a * Math.pow((1 + b/12),Math.pow(12,5)); which comes down to: a * (1 + b/12)^(12^5). This is a number close to infinity on normal 32 or 64 bit computers. Try using a * Math.pow((1 + b/12), 12 * years); where years is the number of interest years.
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/21858675
has comment: http://stackoverflow.com/comment/33116989
type: UnansweredQuestion
has title: org.apache.axis2.description is missing in java code
answer count: 0
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33091288
type: Question
has body: I have to write Java program who call Web Service, I have the wsdl file. So, I generate Java class from wsdl with Eclipse and Axis2Wizards functionalities. All my files have the following error: org.apache cannot be resolved to a type I understand that some org.apache.axis2.* libraries are missing, but I don't know where to find them and how install them.
score: 0
tagged with: wsdl

http://stackoverflow.com/comment/33154743
type: Comment
comment on: http://stackoverflow.com/q/21893781
has text: That eval is exactly what I'm looking for, thanks.
score: 0
type: QuestionComment

http://stackoverflow.com/q/21844540
tagged with: object
has comment: http://stackoverflow.com/comment/33065972
tagged with: arraylist
has comment: http://stackoverflow.com/comment/33066263
score: 0
answer count: 2
has title: Why isnt my for loop of objects printing out?
has comment: http://stackoverflow.com/comment/33066024
tagged with: arrays
has comment: http://stackoverflow.com/comment/33066068
has comment: http://stackoverflow.com/comment/33066025
has body: I feel like this is somewhat right to at least print out the toString method of each subclass but for some reason its resulting in nothing being printed whatsoever. Any help will be greatly appreciated. data.txt: 1 meter 1 inch 1 foot 1 yard 401.336 meters 15839 inches 1319 feet 439 yards code public abstract class Length implements Comparable&lt;Length&gt; { public String toString() { return this.getClass() + ": " + getLength() + " " + getUnit(); } public static void main(String[] args){ ArrayList&lt;Length&gt; lo = new ArrayList &lt;Length&gt;(); Scanner in = null; try { in = new Scanner(new File("src/length/data.txt")); } catch (FileNotFoundException exception) { throw new RuntimeException("failed to open data.txt"); } // need more code for other parts of this assignment while (in.hasNextDouble()) { double value = in.nextDouble(); String unit = in.next(); Length length = null; if(unit.equals("Meter")){ length = new Meter(value); lo.add(length); } else if(unit.equals("Foot")){ length = new Foot(value); lo.add(length); } else if(unit.equals("Inch")){ length= new Inch(value); lo.add(length); } else if(unit.equals("Yard")){ length = new Yard(value); lo.add(length); } } Length[] myLengths = new Length[lo.size()]; //declares myLengths integer array for(int i=0; i &lt; lo.size(); i++){ myLengths[i]=lo.get(i); //copies arrayList to lo to Length array myLengths } for(int i = 0; i &lt; myLengths.length; i++) { System.out.println(myLengths[i].toString()); } } }
has comment: http://stackoverflow.com/comment/33066032
has answer: http://stackoverflow.com/a/21844792
has answer: http://stackoverflow.com/a/21844928
has comment: http://stackoverflow.com/comment/33066020
has comment: http://stackoverflow.com/comment/33066424
has comment: http://stackoverflow.com/comment/33066203
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33066209
tagged with: java
type: Question

http://stackoverflow.com/comment/33197391
comment on: http://stackoverflow.com/a/21917871
type: AnswerComment
type: Comment
has text: You could also use a PropertyChangeListener if you're only interested in knowing when the text property changes
score: 1

http://stackoverflow.com/q/21906753
has comment: http://stackoverflow.com/comment/33176766
type: UnansweredQuestion
score: -4
tagged with: multimedia
upvote count: 1
tagged with: php
tagged with: java
downvote count: 5
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/21906932
has title: Which language would be best suited to produce a multimedia player/manager?
has comment: http://stackoverflow.com/comment/33176928
tagged with: http://stackoverflow.com/tag/html
has body: I have a major project for my last year of high school and I am required to complete a software solution to create a multimedia player/manager in any operating system, but I have my preference set on Windows. Simply it requires the playback of many common media files, the display of metadata of these media files (ID3 tags etc.), management of the files as in adding files to the library and the ability to add notes to individual files. Also the grouping of different file types and the ability to search for specific file types or specific files. I have knowledge in very simple Python, a basic knowledge of Java (like arrays, while loops, dabbling in some Swing), pretty decent knowledge in HTML and PHP with MySQL database interactivity. We had a project last year that involved creating a website that would essentially be an online store. It had user accounts, dynamic product pages (as the database updated, the page would), saving a wishlist to a text file etc. So my question is what would be the best language for me to complete this? I have looked into using Java as I have some ability to use arrays and a GUI, but i understand that I'll need a library for multimedia playback. I've looked into JMF, JSFML, JavaFx and these libraries are either outdated or don't completely solve my needs. Although I am willing to try harder with Java. My other option that I thought about would be a HTML and PHP combination as I know HTML natively supports audio and video in HTML5 and I also found this website of a project which would help me greatly in getting meta data within a HTML and PHP situation. On the other hand I wanted to know if I could learn something like C++ just for this project and if C++ or any other language would be the easiest to learn for this?
favorite count: 0
tagged with: c++

http://stackoverflow.com/comment/33115401
has text: Then post `client.getId()` code
type: Comment
comment on: http://stackoverflow.com/q/21871656
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33300300
score: 1
has text: @mattcoker : Hmmm, multiple phones and Android versions but one common denominator - your app. Sorry but unless you provide at least minimal code to reproduce the problem nobody will be able to help you.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21975117

http://stackoverflow.com/q/21881767
has answer: http://stackoverflow.com/a/51411584
favorite count: 0
possible better answer: http://stackoverflow.com/a/46895995
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24631175
tagged with: jsf
tagged with: primefaces
tagged with: java
type: Question
tagged with: jsf-2
score: 5
upvote count: 5
downvote count: 0
has title: Primefaces - how to get the column of a CellEditEvent
has body: I am using primefaces 4. I am using an editable table and when I edit a cell, a listener method is called passing a CellEditEvent Like this public void onCellEdit(CellEditEvent event) { /* * The rowIndex here can be changed according to the sorting/filtering. * FilteredData starts as null, but primefaces initializes it, so you * don't have to check for NPE here */ int alteredRow = event.getRowIndex(); UIColumn o = event.getColumn(); System.out.println(this.filteredData.get(event.getRowIndex()).get(columns.get(0))); } So far, so good. The event has a getRowIndex() But it does not have a getColumnIndex(). Instead, it has a getColumn() method that returns a UIColumn object. The problem is, while debugging, I could not find a way to get any column information (name, id, etc) I can hack the column to have some unique ID like this &lt;p:ajax event="cellEdit" listener="#{myMB.onCellEdit}"/&gt; &lt;c:forEach items="#{myMB.columns}" var="column" varStatus="loop"&gt; &lt;p:column id="col#{loop.index}" headerText="#{column}" sortBy="#{column}" filterBy="#{column}" filterMatchMode="contains"/&gt; &lt;p:cellEditor&gt; &lt;f:facet name="output"&gt; &lt;h:outputText value="#{dataRow[column]}" /&gt; &lt;/f:facet&gt; &lt;f:facet name="input"&gt; &lt;p:inputText value="#{dataRow[column]}" /&gt; &lt;/f:facet&gt; &lt;/p:cellEditor&gt; &lt;/p:column&gt; &lt;/c:forEach&gt; But still I can't find a way to retrieve the column id from the CellEditEvent So, assuming that a cell is something that has a row and a column, I have to ask How do I retrieve the column of an edited cell in a CellEditEvent? ps. I feel I am missing something, because no one would create a cell event without providing the row and the column, right? update - it seems I can get the ID like org.primefaces.component.column.Column o = (org.primefaces.component.column.Column)event.getColumn(); still, this seems like a hack for me. I am still interested in more elegant solutions for this ;-)
has answer: http://stackoverflow.com/a/46895995
answer count: 3
has answer: http://stackoverflow.com/a/24631175

http://stackoverflow.com/comment/33227908
type: AnswerComment
score: 0
type: Comment
has text: Hi thanks for the quick answer... but I am getting this warning (check the question update)... also it doesn't seem to be registering the click event..
comment on: http://stackoverflow.com/a/21935156

http://stackoverflow.com/a/21915358
has comment: http://stackoverflow.com/comment/33192924
has comment: http://stackoverflow.com/comment/33192809
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/33192693
has comment: http://stackoverflow.com/comment/33192556
has comment: http://stackoverflow.com/comment/33192651
has body: If you're using Java 7, then replace return IA1.Priority.compareTo(IA2.Priority); with return Integer.compare(IA1.Priority, IA2.Priority); ...otherwise, you'll have to replace it with if (IA1.Priority &lt; IA2.Priority) { return -1; } else if (IA1.Priority == IA2.Priority) { return 0; } else { return 1; }
has comment: http://stackoverflow.com/comment/33192447
has comment: http://stackoverflow.com/comment/33192411
answers question: http://stackoverflow.com/q/21915342
accepted answer of: http://stackoverflow.com/q/21915342
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/q/21898620
has comment: http://stackoverflow.com/comment/33163988
duplicate of: http://stackoverflow.com/q/1555262
type: UnansweredQuestion
has body: How to get number of days between two dates range including start date and end date. The start date is stored t3 as 20140221 in string. The end date is stored t4 as 20140315 in string. How to get The number of days between these two dates in java and gwt. how to get range of dates with respective day between two given dates. for example:- from 10/10/2004 to 14/10/2004 range of dates are 10/10/2004 sunday 11/10/2004 monday 12/10/2004 tuesday 13/10/2004 wednesday 14/10/2004 thursday ///////////////////////////////////////////////////////////////////////////////////////////////////// private ArrayList&lt;Date&gt; searchDatesBetween(Date stdate,Date endate) { ArrayList&lt;Date&gt; searchList=new ArrayList&lt;Date&gt;(); Date begin=new Date(stdate.getTime()); searchList.add(new Date(begin.getTime())); while(begin.compareTo(endate)&lt;0){ begin=new Date(begin.getTime()+864000); searchList.add(new Date(begin.getTime())); } return searchList; } Blockquote void onButCreateRosterClick(ClickEvent event) { DateTimeFormat l_format = DateTimeFormat.getFormat("EEE-dd/MM/yyyy"); Date stdate=new Date(); Date endate=new Date(); dateList=new ArrayList&lt;Date&gt;(); stDateOfRoster=mRosterList.get(indexofdate).getT3(); enDateOfRoster=mRosterList.get(indexofdate).getT4(); codeOfShift=mShiftList.get(indexofshift).getT1(); stdate=l_format.parse(stDateOfRoster); endate=l_format.parse(enDateOfRoster); dateList=searchDatesBetween(stdate,endate); }
has comment: http://stackoverflow.com/comment/33163299
has title: getting numbers day between two dates range include start date and end date
type: Question
tagged with: gwt
tagged with: java
has answer: http://stackoverflow.com/a/21899061
has answer: http://stackoverflow.com/a/21898725
answer count: 2
has comment: http://stackoverflow.com/comment/33209202
has comment: http://stackoverflow.com/comment/33163169
score: 0
linked to: http://stackoverflow.com/q/20208749
linked to: http://stackoverflow.com/q/1555262

http://stackoverflow.com/comment/33214552
comment on: http://stackoverflow.com/q/21928009
type: Comment
type: QuestionComment
has text: PLEASE DON'T SHOUT AT US.
score: 3

http://stackoverflow.com/a/21855343
downvote count: 0
answers question: http://stackoverflow.com/q/21854351
has body: I suppose you could directly serialize your object into the clob like so: Object o = new Object(); // anything serializable ObjectOutputStream out = new ObjectOutputStream(clob.setAsciiStream(0)); out.writeObject(o); out.close(); And read vice versa: ObjectInputStream in = new ObjectInputStream(clob.getAsciiStream()); Object o = in.readObject(); in.close();
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/a/21978019
answers question: http://stackoverflow.com/q/21978005
downvote count: 0
has body: You've declared the List so that it is expecting String values only, but you are trying to add Fish object to it... This is a violation of the contract you made with ArrayList Try using ArrayList&lt;Fish&gt; stringer = new ArrayList&lt;Fish&gt;(); instead Take a look at Generics for more details
has comment: http://stackoverflow.com/comment/33304918
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/33305093
upvote count: 4

http://stackoverflow.com/comment/33198136
type: Comment
comment on: http://stackoverflow.com/a/21918314
has text: How would you say a string is not equal to another string
type: AnswerComment
score: 0

http://stackoverflow.com/q/21967251
has comment: http://stackoverflow.com/comment/33285788
has body: In my code, I am embedding Apache Felix, and install a bundle as the following: Bundle AB= adereContext.installBundle("file:ADEREBundle_1.0.0.201402211848.jar"); AB.start(); The bundle "ADEREBundle_1.0.0.201402211848.jar" is saved on the project directory, and so I assume that this should work. Now, when I run this code in a normal java application, it shows no error, and the bundle is successfully installed. However, when I jar my whole project (including the code above), and try to use it in another java application, it shows: org.osgi.framework.BundleException: Unable to cache bundle: file:ADEREBundle_1.0.0.201402211848.jar at org.apache.felix.framework.Felix.installBundle(Felix.java:2870) at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165) at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:138) at aderetest.Main.main(Main.java:40) Caused by: java.io.FileNotFoundException: ADEREBundle_1.0.0.201402211848.jar (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:120) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:79) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161) at org.apache.felix.framework.util.SecureAction.getURLConnectionInputStream(SecureAction.java:524) at org.apache.felix.framework.cache.JarRevision.initialize(JarRevision.java:165) at org.apache.felix.framework.cache.JarRevision.&lt;init&gt;(JarRevision.java:77) at org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:878) at org.apache.felix.framework.cache.BundleArchive.reviseInternal(BundleArchive.java:550) at org.apache.felix.framework.cache.BundleArchive.&lt;init&gt;(BundleArchive.java:153) at org.apache.felix.framework.cache.BundleCache.create(BundleCache.java…
has comment: http://stackoverflow.com/comment/33285825
has title: Jar file trying to install a bundle saved on its classpath shows "Cannot Find The File Specified"
has comment: http://stackoverflow.com/comment/33285666
has answer: http://stackoverflow.com/a/21967537
type: AnsweredQuestion
tagged with: jar
downvote count: 0
tagged with: bundle
score: 1
has comment: http://stackoverflow.com/comment/33285538
possible better answer: http://stackoverflow.com/a/21967330
favorite count: 0
has answer: http://stackoverflow.com/a/21967330
type: Question
tagged with: osgi
has comment: http://stackoverflow.com/comment/33285819
accepted answer: http://stackoverflow.com/a/21967537
has comment: http://stackoverflow.com/comment/33285604
has comment: http://stackoverflow.com/comment/33285577
tagged with: java
answer count: 2
tagged with: file
upvote count: 1
has comment: http://stackoverflow.com/comment/33285899
has comment: http://stackoverflow.com/comment/33285529

http://stackoverflow.com/a/22006905
accepted answer of: http://stackoverflow.com/q/21864550
type: Answer
answers question: http://stackoverflow.com/q/21864550
has body: I found the solution! I ended up completely removing the FOR loop logic and using recursion which raises a Boolean flag once it has used all 5 available TextViews. The method that gets the next TextView and String message and execute the animated setText(): public void updateTextView(List&lt;String&gt; mMessages) { mNextTextViewToUse = mTextViewArrayList.get(mCurrentMessageIndex); mNextMessageToDisplay = mMessages.get(mCurrentMessageIndex); mNextTextViewToUse.startAnimation(mFadeOutAnimation); if (mCurrentMessageIndex == 4) { mStopMessageDisplayRepeat = true; } else { mCurrentMessageIndex++; } } The Runnable that calls the method above, while the recursion stop Boolean is false: public Runnable mUpdateTextViewRunnable = new Runnable() { final static int POSTDELAY_INTERVAL = 600; @Override public void run() { updateTextView(mFiveMessages); if (! mStopMessageDisplayRepeat) { mMessageDisplayRepeatHandler.postDelayed(mUpdateTextViewRunnable, POSTDELAY_INTERVAL); } } }; Execute the Runnable: public void startTextViewRunnableRepeat() { mUpdateTextViewRunnable.run(); } This is how my AsyncTask's onPostExecute() looks like: @Override protected void onPostExecute(List&lt;String&gt; mFiveMessagesToDisplay) { super.onPostExecute(mFiveMessagesToDisplay); mFiveMessages = mFiveMessagesToDisplay; startTextViewRunnableRepeat(); }
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/21891355
linked to: http://stackoverflow.com/q/16050723
has body: I am drawing a tile map, where I draw a different 64x64 pixel image for every tile, and each tile object draws itself. I also have a player object and zombie objects that also draw themselves. the player and zombie objects have their own affine transform instantiation that modify the g.drawImage I call for each one. My question is. how would I implement a 'camera' that I can zoom and pan with, to see only the part of the map inside the JPanel?
accepted answer: http://stackoverflow.com/a/21892200
answer count: 1
has title: Zoom and Pan JPanel with multiple Images drawn on it
favorite count: 0
tagged with: swing
type: AnsweredQuestion
tagged with: java
score: -1
tagged with: affinetransform
has answer: http://stackoverflow.com/a/21892200
downvote count: 1
type: Question
upvote count: 0

http://stackoverflow.com/q/21952912
has comment: http://stackoverflow.com/comment/33259358
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33259466
has answer: http://stackoverflow.com/a/21953062
accepted answer: http://stackoverflow.com/a/21953062
has comment: http://stackoverflow.com/comment/33259435
type: Question
linked to: http://stackoverflow.com/q/5929120
has comment: http://stackoverflow.com/comment/33260533
answer count: 1
upvote count: 6
tagged with: integer-division
has comment: http://stackoverflow.com/comment/33259411
has comment: http://stackoverflow.com/comment/33259556
has body: So, I'm new to programming, and I was trying to make a basic mole (chemistry) calculator just for fun. I didn't find this question. If it was answered please send me the link. This is the formula: n = N / Na where n = mole and Na = 6.022E23 The first part of the code throws an error. Just trying to get one, dividing Na by my given N, and even with 6.022 instead of 6.022E23 I'm getting 1000.0 as an answer. Scanner in = new Scanner(System.in); double Na = 6.022; System.out.print("What do you want to know? Mol(0) or N(1)? "); int first = in.nextInt(); if (first == 0){ System.out.print("Insert N: "); double N = in.nextDouble(); double mol = N/Na; System.out.print("There are " + mol + " mol in that sample."); } else if (first == 1){ System.out.print("Insert mol: "); double mol = in.nextDouble(); double N = mol*Na; System.out.print("There are " + N + " molecules, atoms or ions in that sample."); } Output 0: What do you want to know? Mol(0) or N(1)? 0 Insert N: 6.022 There are 1000.0 mol in that sample. Output 1: What do you want to know? Mol(0) or N(1)? 1 Insert mol: 1 There are 6.022 molecules, atoms or ions in that sample. Thanks in advance.
favorite count: 0
has comment: http://stackoverflow.com/comment/33259935
has title: Getting 1000 as an answer instead of 1 when dividing (6.022/6.022=1000) Java
score: 6

http://stackoverflow.com/comment/33302957
type: Comment
comment on: http://stackoverflow.com/a/21977042
has text: Sorry, can't make a screenshot at the moment. You should be able to find the list of plugins in the launch configuration in the 'Plugins' tab of your Run/Debug Configuration dialog (the one with Main, Arguments, Plugins, Configuration, etc) that you use to setup your environment). Scroll through the list and make sure to only select the correct SWT for the architecture you're running on.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33172806
comment on: http://stackoverflow.com/a/21902273
type: AnswerComment
score: 0
type: Comment
has text: result was added to topic

http://stackoverflow.com/a/21873031
answers question: http://stackoverflow.com/q/21872349
has comment: http://stackoverflow.com/comment/33118059
score: 0
has body: I figured it out. This was my solution: public void reverseMePlz() { Node nextNode = null, currentNode = firstNode, first = firstNode; while (currentNode.next != null) { nextNode = currentNode.next; currentNode.next = currentNode.previous; currentNode.previous = nextNode; firstNode = currentNode; currentNode = nextNode; } lastNode.next = firstNode; firstNode = lastNode; lastNode = first; firstNode.previous = null; }
type: Answer

http://stackoverflow.com/a/21994676
upvote count: 1
answers question: http://stackoverflow.com/q/21994257
score: 1
has body: This is because the &lt;iframe&gt; is effectively a separate browser. The outer browser window cannot communicate with the code in the &lt;iframe&gt;, and when you click a link within the iframe, it only affects that frame. You will need to have the links within the iframe change your parent window (see: How to force link from iframe to be opened in the parent window) or you will need to redesign your application.
downvote count: 0
type: Answer

http://stackoverflow.com/q/21884010
type: Question
upvote count: 1
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
has comment: http://stackoverflow.com/comment/33136852
has body: I need to know if, using XPath in java, I can obtain a fragment of XML in result of a query. I'll explain better, I'm working oh this simple XML file: J.R.R. Tolkien The Lord of the Rings The query XPath I have to evaluate is: /bookshelf/shelf/book. I need to find a way to keep the XML tag in the XPATH response getting a result like the following: J.R.R. Tolkien The Lord of the Rings Is possible to do that?
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21884392
accepted answer: http://stackoverflow.com/a/21884392
score: 1
tagged with: java
has title: Evaluating an XPath query excluding xml tag

http://stackoverflow.com/comment/33198567
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21918450
has text: I see. I think he just couldn't get any matching algorithm to work at all.

http://stackoverflow.com/comment/33102434
comment on: http://stackoverflow.com/q/21864763
score: 0
type: QuestionComment
has text: @LingWillOk Catch the exception, but print the stacktrace to see what really happens.
type: Comment

http://stackoverflow.com/comment/33199476
score: 0
has text: I'll update that. As for that post, wasn't very clear to me, RC.
comment on: http://stackoverflow.com/q/21919009
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21933902
score: 0
answers question: http://stackoverflow.com/q/21932951
type: Answer
has body: java.sql.Timestamp inheritance java.util.Date then you can use this objects across all aplication layers. I use java.sql.Timestamp readed by Spring JDBC from db tables in my applications without any problems.

http://stackoverflow.com/q/21936749
has title: Getting Data from Java To JSP
type: AnsweredQuestion
has body: It's been so long since I've worked this low in the stack that I can't remember how to get a value from Java to my JSP without Struts or Spring MVC or anything. So if I have a String that I want to display in an arbitrary location in an HTML fragment, which could be anywhere, including in the middle of some JavaScript: Where do I put the value so that it can be displayed? The response? The header? Somewhere else? What's the tag + EL for grabbing it? You would think you could get this info anywhere but a straight answer without teaching JSP from stem to stern has been very hard to come across. I even have pulled out my old "Head First JSP and Servlets" book but while it was good for learning the first time around, it apparently makes a terrible reference. Very hard to find specific items.
tagged with: java
tagged with: tags
accepted answer: http://stackoverflow.com/a/21936802
tagged with: servlets
type: Question
tagged with: jsp
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21936802

http://stackoverflow.com/comment/33395034
score: 0
type: QuestionComment
has text: i change indigo version to juno problem solved
type: Comment
comment on: http://stackoverflow.com/q/21999201

http://stackoverflow.com/comment/33192288
type: Comment
has text: Thanks. That helps. What about this question ? WILL obj of type C be executed by the same thread ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21914239

http://stackoverflow.com/q/21845231
favorite count: 0
has body: I have 4 array list ArrayList&lt;String[]&gt; split_url = new ArrayList&lt;String[]&gt;(); ArrayList&lt;String&gt; mediaID = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; productID = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; clusResult = new ArrayList&lt;String&gt;(); and each arraylist contains some values. i want to take first value from each arralist and save that into one row in database then take second values from each database and save that to next row and so on.... how can i do that ?
downvote count: 2
has comment: http://stackoverflow.com/comment/33068152
has title: Taking values from multiple arraylist in order
accepted answer: http://stackoverflow.com/a/21845340
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33067139
tagged with: java
has comment: http://stackoverflow.com/comment/33067116
type: Question
upvote count: 0
score: -2
tagged with: database
tagged with: arraylist
has answer: http://stackoverflow.com/a/21845340
answer count: 1

http://stackoverflow.com/a/22003005
type: AcceptedAnswer
type: Answer
has body: If all of the java files you need to compile are in your directory you can javac *.java And then java NameOfClassWithMainMethod Otherwise if you want to learn to work without an IDE I would suggest learning to use Maven or Gradle. They will abstract away a lot of the tedium of compiling a project, and if become a pro dev you'll need to know at least Maven anyway.
downvote count: 0
score: 7
accepted answer of: http://stackoverflow.com/q/22002963
answers question: http://stackoverflow.com/q/22002963
upvote count: 7

http://stackoverflow.com/q/21948655
accepted answer: http://stackoverflow.com/a/21950075
favorite count: 0
has comment: http://stackoverflow.com/comment/33252151
has comment: http://stackoverflow.com/comment/33251972
has comment: http://stackoverflow.com/comment/33251965
type: AnsweredQuestion
tagged with: build.xml
score: 1
has body: So i am having trouble running my project via the ant build.xml file. The project runs perfectly when executed normally, image link posted below: http://puu.sh/75krJ.png However, when the project is ran through a build.xml file, it produces this error below: [code] Ant Build File for myproj0/ <property name="src" location="src" /> <property name="build" location="build" /> <property name="main.class" value="driver.Driver"/> <property name="doc" location="doc" /> <mkdir dir="${build}"/> <mkdir dir="${src}"/> <javac srcdir="${src}" destdir="${build}"/> <pathelement location="${build}" /> <delete dir="${build}"/> <delete dir="bin"/> <delete dir="doc"/> <javadoc sourcepath="${src}" destdir="${doc}" /> </project> [/code] Error: http://puu.sh/75kRy.png I am refraining from posting my assignment code due to others from school probably looking at this site for help as well Any help would be appreciated :D
has comment: http://stackoverflow.com/comment/33251981
type: Question
has title: Ant command run problems
tagged with: ant
tagged with: java
has comment: http://stackoverflow.com/comment/33252016
has comment: http://stackoverflow.com/comment/33251956
upvote count: 2
has comment: http://stackoverflow.com/comment/33252281
answer count: 1
has answer: http://stackoverflow.com/a/21950075
downvote count: 1

http://stackoverflow.com/comment/33191945
has text: Http calls are done inside a jar file and the response is given back as a json, so in this case the stream(image binary) is converted as string and added to json, the application layer is now trying to use the string to get the stream back & get the image.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21904903

http://stackoverflow.com/q/21905684
answer count: 1
has answer: http://stackoverflow.com/a/21907735
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: admob
has body: My MainActivity java Is a simple game but the admod dont show public class MainActivity extends Activity { private AdView adView; private MainView mainView; private final int MENU_SELECT_RESET = 1, MENU_SELECT_CONTACT = 2; // MUSICA MediaPlayer mediaPlayer;// para musica de fondo (se declara aqui para que // pueda // utilizarla todos nuestros metodos) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Crear el objeto adView adView = new AdView(this, AdSize.BANNER, "a14e2f8fe3af5a6"); // Buscar LinearLayout suponiendo que se le ha asignado // el atributo android:id="@+id/mainLayout" LinearLayout layout = (LinearLayout)findViewById(R.id.mainLayout); // Añadirle adView layout.addView(adView); // Iniciar una solicitud genérica para cargarlo con un anuncio adView.loadAd(new AdRequest()); // MUSIC mediaPlayer = MediaPlayer.create(this, R.raw.merry); mediaPlayer.setLooping(true); mediaPlayer.setVolume(100, 100); mediaPlayer.start(); //MAINVIEW // TURN OFF THE TITLE // requestWindowFeature(Window.FEATURE_NO_TITLE); // Apago la barra de estado // getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); Intent i = getIntent(); // Activity Quiero solo tapa // i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); setVolumeControlStream(AudioManager.STREAM_MUSIC); // View Establezca el // mainView = new MainView(this); //setContentView(mainView); RelativeLayout layout1 = (RelativeLayout) findViewById(R.id.mainView); mainView = new MainView(this); layout1.addView(mainView); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. // getMenuInflater().inflate(R.menu.activity_main, menu); menu.add(0, MENU_SELECT_RESET, 0, "Reset"); menu.add(0, MENU_SELECT_CONTACT, 0, "Contact"); return true; } @Override protected void onResume() { mediaPlayer.start(); // Leí el recuento juego this.mainView.gameCount.read(); Log.d("", …
has title: Not enough space to show ad in my game
score: 0
tagged with: android

http://stackoverflow.com/comment/33301059
type: QuestionComment
has text: What is your specific question? Do you see any error messages when you run the code?
type: Comment
comment on: http://stackoverflow.com/q/21975841
score: 0

http://stackoverflow.com/q/21878949
has title: IntelliJ IDEA 13 gives invalid error about incompatible types (Java-Scala-InterOp in Play)
answer count: 2
tagged with: intellij-idea
has body: I just upgraded from IDEA 12 to 13 (community edition) and since then I get an error in IDEA about incompatible types for my play project. Option&lt;String&gt; authHeaderOption = requestHeader.headers().get(AUTHORIZATION); requestHeader is of type play.api.mvc.RequestHeader. The error message states: Incompatible types. Found: 'scala.Option&lt;java.lang.String&gt;', required: 'scala.Option&lt;java.lang.String&gt; So it complains about types being incompatible but at the same moment states that required and found types are the same. When running the app from play console everything works fine, so compilation works. The error occurs in a java class that calls the scala play api. Before upgrading IntelliJ there was no such error so it must be an IDE issue but I have not been able to figure out what yet. Has anyone seen this kind of error before?
tagged with: playframework
upvote count: 7
has answer: http://stackoverflow.com/a/37296998
favorite count: 0
has comment: http://stackoverflow.com/comment/33128327
tagged with: scala
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33129394
downvote count: 0
tagged with: java
score: 7
has answer: http://stackoverflow.com/a/21880763
type: Question
has comment: http://stackoverflow.com/comment/33129966

http://stackoverflow.com/comment/33157155
comment on: http://stackoverflow.com/q/21891967
score: 0
type: Comment
type: QuestionComment
has text: Are you trying to make sort of test? Why dont you extend Certificate for example?

http://stackoverflow.com/q/21936535
has comment: http://stackoverflow.com/comment/33229685
downvote count: 1
has title: library for Multiple-bit Error correcting code?
linked to: http://stackoverflow.com/q/2921599
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33230342
answer count: 0
score: 1
tagged with: java
type: Question
has body: In my project I want to use Multiple-bit Error correcting Code.I already read about BCH algorithm ,it provide supports for single bit error correction and detection. I also aware of this but it also supports for single bit error correction,so is there any library in java ?
has comment: http://stackoverflow.com/comment/33229840
has comment: http://stackoverflow.com/comment/33230445
has comment: http://stackoverflow.com/comment/33230833
upvote count: 2
has comment: http://stackoverflow.com/comment/33229562

http://stackoverflow.com/q/21989065
tagged with: tycho
score: 1
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/22009962
answer count: 1
has comment: http://stackoverflow.com/comment/33323784
favorite count: 0
tagged with: eclipse-rcp
has comment: http://stackoverflow.com/comment/33326816
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33323573
tagged with: maven
downvote count: 1
has title: how to convert plugin (Created from existing jar) to maven
has body: I had created eclipse plugin from existing jar and I'm exporting all the packages as in below image. All the packages Exported packages. Now I'm converting This plugin to Maven by using configurator Now my plugin look like following and there no package is showing for export. Now packages showing as folders there is not package showing to export. So every where I'm getting error because there is no class under this plugin in. Question How to convert plugin which are created by jar.?

http://stackoverflow.com/q/21946501
type: Question
has answer: http://stackoverflow.com/a/21947710
score: 0
answer count: 3
has title: Cannot manage convert hibernate mapping to annotations
has body: I do not really want to talk about why one approach is better than other. I started with annotations and could not get it working simple as it was. When tried using XML configuration it worked. But why? How to debug this kind of problem? I have a pretty simple existing table "tRegion" with 2 String columns - "Code" and "Region" where Code field is the unique key. I create a class: @Entity @Table(name = "tRegion") public class Region { @Id String Code; @Column String Region; public void setCode(String code) { Code = code; } public void setRegion(String region) { Region = region; } public String getCode() { return Code; } public String getRegion() { return Region; } } If I run the code: List&lt;Region&gt; result = (List&lt;Region&gt;) session.createQuery("from Region").list(); I get the error: INFO: HHH000397: Using ASTQueryTranslatorFactory org.hibernate.hql.internal.ast.QuerySyntaxException: Region is not mapped [from Region] Something is wrong with my annotations... However if I add an XML mapping file: &lt;hibernate-mapping package="com.mypackage"&gt; &lt;class name="Region" table="tRegion"&gt; &lt;id name="Code" /&gt; &lt;property name="Region"/&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; it works. For me the mapping looks equivalent to my annotations. What could be wrong? I'm using Hibernate 4.3.1 libraries if it could make any difference. Edited/solution: Everybody seemed to agree on solution to modify the persistence.xml, however I'm a beginner in Entity management in Java, so I had no clue I was supposed to use one. Well, after reading suggestions, I even tried to add it (I enabled JPA facet and added the class element to persistence.xml), but I guess I had to do something else to make it use JPA (tried to add @PersistanceContext annotation with no success) I am also not keen to add another configuration file. In fact the way I deploy my application prevents me modifying any configuration files, and having configuration files that you do not use to eventual…
type: UnansweredQuestion
tagged with: hibernate-mapping
has answer: http://stackoverflow.com/a/21948076
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/21948013

http://stackoverflow.com/q/21961750
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/21962294
has body: Hi I'm trying to program a game using java. This is my first time using java, I am used to C#. In C# I would call Mouse.getLocation() and create a rect using the mouses location. Then by using if(Mouse.Left().toString() == "Pressed") I would then check if the mouse rect intersected with any other objects and act accordingly. I've noticed in java you aren't provided with methods like these. So I was wondering, is the best way to approach mouse input simply to add listeners on all my clickable objects? I understand listeners and have a good idea how to use them but I was just wanting to check if there are more efficient ways to handle input or ways geared more towards what I'm most conformable with.
score: 0
tagged with: input
has title: How to set up mouse and keyboard input
has answer: http://stackoverflow.com/a/21961788
possible better answer: http://stackoverflow.com/a/21961788
tagged with: mouse
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21962294
tagged with: java
has comment: http://stackoverflow.com/comment/33275555

http://stackoverflow.com/comment/33209472
comment on: http://stackoverflow.com/a/21902284
score: 0
type: AnswerComment
has text: if remove as like `dialogbox.removeFromParent` , can I use it again ?
type: Comment

http://stackoverflow.com/a/21967545
accepted answer of: http://stackoverflow.com/q/21956950
has comment: http://stackoverflow.com/comment/33289808
has body: Indeed Genson (as most other libs) use Java beans conventions to detect a setter/getter, thus it won't detect your setPermissions as a setter. Two quick solutions: 1) You can annotate it with @JsonProperty (no need to define the name). This will tell genson to use it as a setter (however genson will not reuse the returned object, meaning that in your case it works, but builder like is nut supported like that). 2) You can force genson to use only fields and no methods (this directly sets the field value without calling get/set). Genson.Builder() .setUseFields(true) .setFieldFilter(VisibilityFilter.DEFAULT) .setUseGettersAndSetters(false) .create(); More generic: 3) add a custom BeanMutatorAccessorResolver in the chain, that will handle your specific case Genson genson = Genson.Builder().with(new BeanMutatorAccessorResolver.BaseResolver() { @Override public Trilean isMutator(Method method, Class&lt;?&gt; fromClass) { // if method starts with setXXX and return type same as method.getDeclaringClass return Trilean.TRUE; // else return Tilean.UNKNOWN genson will use its built-in resolvers } }).create(); EDIT Should have seen that you were using set instead of with method on the builder. When you see setXXX in genson API this usually means that you will override/force some mechanism (you set a value), but with is used to add behaviour.
has comment: http://stackoverflow.com/comment/33286265
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33293105
type: Answer
answers question: http://stackoverflow.com/q/21956950
downvote count: 0
score: 1

http://stackoverflow.com/a/21981097
has comment: http://stackoverflow.com/comment/33310373
has comment: http://stackoverflow.com/comment/33310070
answers question: http://stackoverflow.com/q/21981048
has comment: http://stackoverflow.com/comment/33309849
type: Answer
accepted answer of: http://stackoverflow.com/q/21981048
has comment: http://stackoverflow.com/comment/33310326
has comment: http://stackoverflow.com/comment/33310026
has comment: http://stackoverflow.com/comment/33310112
has comment: http://stackoverflow.com/comment/33310224
has comment: http://stackoverflow.com/comment/33310590
downvote count: 1
has body: You need to break out of for loop as soon as you found if it is not a prime and slighlty modified approach you can follow to omit some code and optimize it as well. public static boolean Isprime(int x){ boolean isprime = true; for(int m=2;m&lt;=Math.sqrt(x);m++){ int temp = x%m; if(temp == 0){ isprime = false; break; } } return isprime; }
has comment: http://stackoverflow.com/comment/33310464
score: 1
has comment: http://stackoverflow.com/comment/33310429
has comment: http://stackoverflow.com/comment/33310386
upvote count: 2
has comment: http://stackoverflow.com/comment/33310119
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33310304
has comment: http://stackoverflow.com/comment/33310684
has comment: http://stackoverflow.com/comment/33310497

http://stackoverflow.com/q/21853556
score: 0
answer count: 2
tagged with: generics
has body: I got the following class: public class Repository&lt;T&gt; extends ExternalRepository&lt;Wrapper&lt;T&gt;&gt; { public Repository(Class&lt;Wrapper&lt;T&gt;&gt; type, DB db) { super(type, db); } } But I have no idea how to call the construtor since new Repository(Wrapper&lt;SomeClass&gt;.class, dbInstance) does not work. So what can I do? I can change the Repository class if necessary.
has title: How to call constructor with nested generic in java
possible better answer: http://stackoverflow.com/a/21853753
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33081240
has answer: http://stackoverflow.com/a/21853629
accepted answer: http://stackoverflow.com/a/21853629
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21853753

http://stackoverflow.com/q/21842536
answer count: 0
has title: MediaCodec AAC -> PCM Decoder Configuration on Android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/124167632
upvote count: 1
tagged with: android-mediacodec
has comment: http://stackoverflow.com/comment/33062785
score: 1
tagged with: java
has body: I'm trying to implement AAC -&gt; PCM Decoder by MediaCodec. Firstly, I successfully implemented PCM -&gt; AAC Encoder by MediaCodec as intended as below private boolean setEncoder(int rate) { encoder = MediaCodec.createEncoderByType("audio/mp4a-latm"); MediaFormat format = new MediaFormat(); format.setString(MediaFormat.KEY_MIME, "audio/mp4a-latm"); format.setInteger(MediaFormat.KEY_CHANNEL_COUNT, 1); format.setInteger(MediaFormat.KEY_SAMPLE_RATE, 44100); format.setInteger(MediaFormat.KEY_BIT_RATE, 64 * 1024);//AAC-HE 64kbps format.setInteger(MediaFormat.KEY_AAC_PROFILE, MediaCodecInfo.CodecProfileLevel.AACObjectHE); encoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE); return true; } INPUT: PCM Bitrate = 44100(Hz) x 16(bit) x 1(Monoral) = 705600 bit/s OUTPUT: AAC-HE Bitrate = 64 x 1024(bit) = 65536 bit/s So, the data size is approximately compressed x11 ,and I confirmed this working by observing a log AudioRecoder﹕ 4096 bytes read AudioEncoder﹕ 369 bytes encoded the data size is approximately compressed x11, so far so good. Now, I have a UDP server to receive the encoded data, then decode it. The decoder profile is set as follows: private boolean setDecoder(int rate) { decoder = MediaCodec.createDecoderByType("audio/mp4a-latm"); MediaFormat format = new MediaFormat(); format.setString(MediaFormat.KEY_MIME, "audio/mp4a-latm"); format.setInteger(MediaFormat.KEY_CHANNEL_COUNT, 1); format.setInteger(MediaFormat.KEY_SAMPLE_RATE, 44100); format.setInteger(MediaFormat.KEY_BIT_RATE, 64 * 1024);//AAC-HE 64kbps format.setInteger(MediaFormat.KEY_AAC_PROFILE, MediaCodecInfo.CodecProfileLevel.AACObjectHE); decoder.configure(format, null, null, 0); return true; } Since UDPserver packet buffer size is 1024 UDPserver ﹕ 1024 bytes received and since this is the compressed AAC data, I would expect the decoding size will be approximately 1024 x11, however the actual result is AudioDecoder﹕ 8192 bytes decoded It's approximately x8, and I feel something wrong. Can a…
type: Question
has comment: http://stackoverflow.com/comment/33063001
downvote count: 0
linked to: http://stackoverflow.com/q/21804390
favorite count: 0
has comment: http://stackoverflow.com/comment/33064943
tagged with: android
linked to: http://stackoverflow.com/q/21724103
linked to: http://stackoverflow.com/q/21626156

http://stackoverflow.com/comment/33091036
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21858686
has text: How should we know, what you are "looking for"?

http://stackoverflow.com/q/21941311
type: Question
answer count: 2
has body: Here is the code in the first activity: Bundle UserEntries = new Bundle(); UserEntries.putString("Venue_Name", VenueName); UserEntries.putString("Event_Name", EventName); UserEntries.putString("Category", Category); UserEntries.putString("Region", Region); Intent openGetData = new Intent(SearchDatabase.this, GetData.class); openGetData.putExtra("UserEntries", UserEntries); startActivity(openGetData); And this is the code in the activty opened: Intent i = getIntent(); Bundle Parameters = i.getExtras(); url = "http://192.168.1.74/android_connect/get_venues.php"; VenueName = Parameters.getString("Venue_Name"); EventName = Parameters.getString("Event_Name"); Category = Parameters.getString("Category"); Region = Parameters.getString("Region"); if(VenueName != null){ phpExtension = ("?Venue_Name=" + VenueName); } url = (url + phpExtension); However Venue_Name returns null, i have tested the code and in the first activity it is not null and in the second activity the bundle Parameters is not null, however the string Venue_Name within the bundle in the second activity is. Anyone have any ideas where im going wrong? Thanks in advance
has title: String within bundle is null
accepted answer: http://stackoverflow.com/a/21941394
tagged with: android
tagged with: bundle
possible better answer: http://stackoverflow.com/a/21941430
score: 0
has comment: http://stackoverflow.com/comment/33238413
has answer: http://stackoverflow.com/a/21941430
tagged with: android-intent
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21941394
tagged with: getstring
tagged with: java

http://stackoverflow.com/q/21873749
upvote count: 2
answer count: 2
tagged with: jsp
has answer: http://stackoverflow.com/a/48594857
favorite count: 0
type: UnansweredQuestion
has title: how to exclude weekend from month using jsp
score: 2
has answer: http://stackoverflow.com/a/21873793
downvote count: 0
tagged with: java
has body: Hi want to exclude weekend from month please help me. But this is not Exclude weekend from month how to Exclude Weekend. &lt;% Calendar cal = Calendar.getInstance(); int day = cal.get(cal.DAY_OF_WEEK); int days=day-1; DateFormat df = new SimpleDateFormat("dd/MM/yyyy"); Date date1 = df.parse("1/02/2014"); Date date2 = new Date(); Calendar cal1 = Calendar.getInstance(); Calendar cal2 = Calendar.getInstance(); cal1.setTime(date1); cal2.setTime(date2); int numberOfDays = 0; while (cal1.before(cal2)) { if ((Calendar.SATURDAY != cal1.get(Calendar.DAY_OF_MONTH))&amp;&amp;(Calendar.SUNDAY != cal1.get(Calendar.DAY_OF_MONTH))) { numberOfDays++; session.setAttribute("numberOfDays",numberOfDays); cal1.add(Calendar.DATE,1); }else { cal1.add(Calendar.DATE,1); } } %&gt;
tagged with: calendar
type: Question
has comment: http://stackoverflow.com/comment/84186764
linked to: http://stackoverflow.com/q/38922754
tagged with: date

http://stackoverflow.com/a/21911851
score: 0
answers question: http://stackoverflow.com/q/21910823
has body: You could test the Rest API using Apache HttpClient libraries. An example Java code would looks like below. String uri = "http://localhost:7001/myapis/search/json"; URIBuilder uriBuilder = new URIBuilder(uri); uriBuilder.addParameter("institutionName", "HSBC%"); uriBuilder.addParameter("isoCountryCode", "GB"); HttpGet httpGet = new HttpGet(uriBuilder.build()); HttpClient httpClient = new DefaultHttpClient(); HttpResponse httpResponse = httpClient.execute(httpGet); HttpEntity httpEntity = httpResponse.getEntity(); String result = EntityUtils.toString(httpEntity);
type: Answer

http://stackoverflow.com/comment/33263505
score: 0
comment on: http://stackoverflow.com/q/21955207
type: Comment
type: QuestionComment
has text: I've installed the early access binaries from there (the beta support)

http://stackoverflow.com/q/21946016
tagged with: jdialog
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21946391
tagged with: swing
tagged with: jcalendar
type: AnsweredQuestion
has body: My program uses JDialogs to open up forms and in the form I want to use JCalendar for the user to select a date and for me to use it for other methods afterwards. I have downloaded JCalendar library. I read some example codes but still not sure how to do it. I have an idea that in the form you press a button (Select Date) and like a small window opens with that JCalendar and when the date is selected it is displayed in the form as a TextField. Can someone recommend me some method of doing this with the least trouble?
tagged with: java
accepted answer: http://stackoverflow.com/a/21946391
type: Question
has title: Using JCalendar in a JDialog

http://stackoverflow.com/comment/33179060
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21907737
has text: ArrayLists are resizable, so they should do your job just fine. If you need to make optimizations due to lack of resources, you can go with an Array, but you must know before the maximum number of lines. You can even go without any collection if you decide to process each move event right after you read a line from a file.

http://stackoverflow.com/comment/33068302
type: Comment
has text: Use a consistent and logical indent for code blocks. The indentation of the code is intended to help people understand the program flow!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21845834

http://stackoverflow.com/comment/33287454
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21967418
type: Comment
has text: Thread safety is unrelated to access modifiers. Restricting access makes it easier to ensure all access is thread safe, but this is something you still need to do.

http://stackoverflow.com/q/21884834
type: AnsweredQuestion
tagged with: java
tagged with: mapreduce
type: Question
tagged with: hadoop
score: -2
accepted answer: http://stackoverflow.com/a/21885831
has title: Process unstructured and multiple line CSV in hadoop
downvote count: 3
tagged with: http://stackoverflow.com/tag/csv
upvote count: 1
has answer: http://stackoverflow.com/a/21885831
has body: I would like to process data in Hadoop Mapreduce, I am having data below format with unstructured, multiple line and un-terminated quotations. 2/1/2013 5:16,Edward Felton,2,8/1/2012 3:57,Working on all the digital elements for our big event in Sydney in a couple of weeks... for more visit http://www.xy.com/au/geworks/,324005862,2,18200695 12/28/2012 19:28,Laura McCullum,2,7/26/2012 18:03,"The Day You Give Them Jive &lt;br&gt; &lt;a href="http://youtu.be/qfq9LVD2Qr4" &gt; http://youtu.be/qfq9LVD2Qr4 &lt;br&gt; &lt;br&gt; 'Like' if you have always wanted to destroy a cube!",502114904,2,18400313 11/21/2012 13:35,Timothy Widdowson,4,8/17/2012 12:38,"Can a table really replace a laptop... With the new Windows tablets on the horizon and the Apple / Android devices out there I have been wondering if it is possible to really work with just and tablet. My mission: -For one whole week I will be working with just my iPad. Hardware: -Apple iPad -Apple keyboard. -Apple to HDMI connector. -HDMI capable monitor. - InCase iPad stand. :-)",105001439,1,19301609 3/15/2013 13:43,Mary Romeo,3,8/16/2012 22:23,"HOW TO SHORTEN LONG LINKS YOU'RE POSTING &lt;br&gt; The attached image describes how to shorten a long url before posting it. In 4 easy steps the 3-4 line urls can become a tiny link to post.",213022329,1,19901561 11/30/2012 2:17,Lu Yin Zhong,3,8/29/2012 1:29,working on 2013 comms plan...need big ideas!!,302014449,2,20300666 3/5/2013 22:15,Tim Steigert,12,8/29/2012 15:36,"Looking up 1024 email addresses. Manually? Probably a day! Doing it with SSOget, the add-in for #[&amp;quot;excel&amp;quot;]? 5 minutes! Effort saved and #[&amp;quot;productivity&amp;quot;] gained? Priceless! Now go get it and enjoy it for yourself! :)&lt;br&gt;http://sc.xy.com/*SSOget @@@data@@@{&amp;quot;image&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;title&amp;quot;:&amp;quot;&amp;quot;}",100011871,11,20400713 11/1/2012 20:46,Pranay Jain,2,8/30/2012 14:26,Do people agree with the iCloud restrictions that Airwatc…
answer count: 1
tagged with: opencsv
favorite count: 0
has comment: http://stackoverflow.com/comment/33138528

http://stackoverflow.com/q/21911908
accepted answer: http://stackoverflow.com/a/21912106
type: Question
linked to: http://stackoverflow.com/q/1903252
has comment: http://stackoverflow.com/comment/33186140
has body: Hi all I am hoping to strip a string in Java into a String and an integer for example: "String1" into: String StringName = "String"; int StringInt = 1; the Strings also may vary in length, is there an easy way to do this in Java, apologies if easy complete newbie.
tagged with: string
tagged with: int
has comment: http://stackoverflow.com/comment/33186106
possible better answer: http://stackoverflow.com/a/21912273
has comment: http://stackoverflow.com/comment/33186348
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/21912273
has answer: http://stackoverflow.com/a/21912144
upvote count: 2
has comment: http://stackoverflow.com/comment/33186262
has title: Java separating String and Integer
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21912106
has answer: http://stackoverflow.com/a/21912497
tagged with: java
downvote count: 3
score: -1

xamarin.android
type: Tag
tag name: xamarin.android
tags question: http://stackoverflow.com/q/21862998

http://stackoverflow.com/comment/33261416
comment on: http://stackoverflow.com/a/21946038
type: AnswerComment
has text: well i have set classpath=C:\ProgramFiles\Java\jdk1.7.0_25\bin\Toms\Project path=C:\Program Files\Java\jdk1.7.0_25\bin my a.java & a.class file are in the Project folder. It compiles properly, but when i try to run using a.java it gives error message could not find or load class file. I tried using java -cp "." a ... which loads my JFrame but with no components and some error showing up at cmd. "Exception in thread "main" java.lang.ClassNotFoundException:net.java.dev.designgridlayout.DesignGridLayout .... ....
score: 0
type: Comment

http://stackoverflow.com/a/46496785
type: Answer
has comment: http://stackoverflow.com/comment/91442373
has comment: http://stackoverflow.com/comment/91470877
score: 8
upvote count: 13
downvote count: 5
has body: There are some interesting use cases by using scope prototype you will build a better and reliable application design/architecture, for example, a real-time system. Imagine that you must build a real-time system for vehicle tracking, and you will have 2.000.000 cars sharing information every 5 seconds, In the server side, you will work with two or more distinct group of configurations, one for Cars and another one for Trucks. Based on this simple example, if you design your application to work with distinct configuration groups in memory through the prototype pattern you will achieve a better performance. So, in this case, whenever the server receives a new message from a Truck, for example, the server will get the instance of the configuration in memory from a hashmap of instances of VehicleGrupConfiguration and then apply the configuration behavior that this message must have, e.g: like time-out, retry... and etc. I would like to highlight that there are many ways to implement this situation, but this example shows that a prototype pattern is very powerful in matters of performance and design patterns.
has comment: http://stackoverflow.com/comment/91474567
answers question: http://stackoverflow.com/q/21969044

http://stackoverflow.com/q/21960160
tagged with: android
has answer: http://stackoverflow.com/a/21960455
has comment: http://stackoverflow.com/comment/33272968
score: 0
answer count: 1
has title: Set EditText Digits Programatically with Filters
tagged with: java
accepted answer: http://stackoverflow.com/a/21960455
type: AnsweredQuestion
type: Question
has body: I am trying to set the digits value of an EditText programatically with pattern "9,999" (where 9 it's digit 0-9). So far I have: final EditText editText = new EditText(v.getContext()); editText.setLayoutParams(params); editText.setText(""); editText.setKeyListener(DigitsKeyListener.getInstance("0123456789")); editText.setInputType(InputType.TYPE_CLASS_NUMBER); editText.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLenght)}); editText.addTextChangedListener(new TextWatcher() { int len=0; //int count=0; @Override public void afterTextChanged(Editable s) { String str = editText.getText().toString(); if(str.length()==1&amp;&amp; len &lt;str.length()){//len check for backspace editText.append(","); } } @Override public void beforeTextChanged(CharSequence c, int arg1, int arg2, int arg3) { String str = editText.getText().toString(); len = str.length(); } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { String str = editText.getText().toString(); } }); Which is not best, because: DigitsKeyListener won't accept "," separator. When I type "1,0" and then go 2x backspace I can type "11111". I have to go 3x backspace and then when I type "11111" it will be "1,1111" Any ideas?

http://stackoverflow.com/a/21925237
answers question: http://stackoverflow.com/q/21925162
downvote count: 0
has comment: http://stackoverflow.com/comment/33238216
upvote count: 2
type: Answer
score: 2
has body: setBackground() can be used only for api level 16 and above. Use setBackgroundDrawable() as I think in your case the api level is set to below 16. Phone with api level below 16,they will support setBackgroundDrawable() OR you can do this: if ( Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.JELLY_BEAN ) { myTextView.setBackground(d); } else { myTextView.setBackgroundDrawable(d); }

http://stackoverflow.com/comment/33387286
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22009409
has text: Again I cannot make it work can you point me where I'm wrong?

http://stackoverflow.com/comment/33425686
comment on: http://stackoverflow.com/q/21971988
type: Comment
has text: That's a good point.. It should be performed for all previously generated rows.. if in row 1, box 1 has blue, in row 2, box 1 has red, then in row 3 box 1 cannot have blue or red, it should be orange. Hope that makes sense to you..
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33386446
type: Comment
type: QuestionComment
has text: I have edited the original post to include the images @Kakarot
score: 0
comment on: http://stackoverflow.com/q/21975607

http://stackoverflow.com/comment/35130427
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21861664
has text: Not so specific to your installation, since I ran into the same issue, too.

http://stackoverflow.com/a/21974647
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33298577
has body: In your add bigints function, try change store the addition into a temp variable and use that in the if statement int temp = numArray1[i] + numArray2[i] if( temp &gt; 9)
answers question: http://stackoverflow.com/q/21974588

http://stackoverflow.com/comment/84869036
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/28041170
has text: A refinement is just to use the existing GsonHttpMessageConverter class but invoke the setSupportedMediaTypes() setter.

http://stackoverflow.com/comment/33290223
has text: They are the same model class from the Google api as listed in the post. The json is generated by a spring mvc controller returning a person object. Could the server side Jackson serializer be causing the issue?
type: Comment
comment on: http://stackoverflow.com/a/21969920
type: AnswerComment
score: 0

http://stackoverflow.com/a/21936577
has body: You can use Objects.toString() (standard in Java 7): Objects.toString(gearBox, "") Objects.toString(id, "") From the linked documentation: public static String toString(Object o, String nullDefault) Returns the result of calling toString on the first argument if the first argument is not null and returns the second argument otherwise. Parameters: o - an object nullDefault - string to return if the first argument is null Returns: the result of calling toString on the first argument if it is not null and the second argument otherwise. See Also: toString(Object)
has comment: http://stackoverflow.com/comment/33230261
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/80680590
has comment: http://stackoverflow.com/comment/93093508
has comment: http://stackoverflow.com/comment/100996679
answers question: http://stackoverflow.com/q/21936503
type: Answer
accepted answer of: http://stackoverflow.com/q/21936503
upvote count: 261
has comment: http://stackoverflow.com/comment/33229729
score: 260

http://stackoverflow.com/comment/33234923
comment on: http://stackoverflow.com/a/21935379
has text: It seems that cleaning out the tomcat working directory fixed the problem! Appreciate the help Ravinder anyways :-)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33283747
comment on: http://stackoverflow.com/a/21964969
score: 0
type: AnswerComment
has text: Controllers and services will need to be groovy files but the language used in the actions and methods can be Java. Another good way of making sure only Java is used is to keep all business logic in the src and just call them from the controllers or services. This reduces dependency on groovy. Either way my point is one could very well write Java code in groovy files and it would compile just as well.
type: Comment

http://stackoverflow.com/q/21903250
score: 0
tagged with: cmd
accepted answer: http://stackoverflow.com/a/21959538
tagged with: exe
type: AnsweredQuestion
has title: Can't run exe file from cmd in Java
tagged with: java
has comment: http://stackoverflow.com/comment/33172044
tagged with: eclipse
has body: I try to run an exe file from cmd that I open by Java, but nothing happens. The cmd that oppened seems like: C:\&gt;file.exe C:\&gt; When I open manually cmd the exe file runs. the cmd seems the same in both cases! (manually and via Java). My code is: File projDir = new File("C:/"); String command = "cmd /c start file.exe"; Process p = Runtime.getRuntime().exec(command, null, projDir); Do you have an idea?
possible better answer: http://stackoverflow.com/a/21904641
type: Question
has answer: http://stackoverflow.com/a/21904641
answer count: 2
has answer: http://stackoverflow.com/a/21959538

http://stackoverflow.com/a/22149440
answers question: http://stackoverflow.com/q/21963780
has body: Try this... activity_main: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:minHeight="20dp" android:minWidth="20dp" &gt; &lt;ImageView android:id="@+id/gameBoard" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:contentDescription="@string/gameboard" android:src="@drawable/gameboard" /&gt; &lt;RelativeLayout android:id="@+id/squareOneLayout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="290dp" android:layout_marginRight="220dp" android:layout_marginTop="70dp" &gt; &lt;ImageButton android:id="@+id/squareOne" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_marginBottom="288dp" android:layout_marginRight="219dp" android:layout_marginTop="71dp" android:background="@android:color/transparent" android:contentDescription="@string/top_left" android:onClick="squareOneClick" android:src="@drawable/blank_button" /&gt; &lt;!-- Top-left images --&gt; &lt;ImageView android:id="@+id/blueOTopLeft" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/greyOTopLeft" android:layout_centerVertical="true" android:src="@drawable/piece_o" android:visibility="invisible"/&gt; &lt;ImageView android:id="@+id/greyOTopLeft" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:src="@drawable/piece_o_grey" android:visibility="invisible"…
type: Answer
score: 0

http://stackoverflow.com/a/21967774
has comment: http://stackoverflow.com/comment/36853215
has comment: http://stackoverflow.com/comment/33298996
has comment: http://stackoverflow.com/comment/36854573
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33289524
has body: You can use a symbolic algebra library such as javacalculus. import java.util.Scanner; import javacalculus.core.CALC; import javacalculus.core.CalcParser; import javacalculus.evaluator.CalcSUB; import javacalculus.struct.CalcDouble; import javacalculus.struct.CalcObject; import javacalculus.struct.CalcSymbol; public class Demo { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); System.out.println("Enter expression:"); String expression = in.nextLine(); // javacalculus uses uppercase function names expression = expression.replace("sin", "SIN"); expression = expression.replace("cos", "COS"); System.out.println("Differentiate with respect to:"); String variable = in.nextLine(); // differentiate String command = "DIFF(" + expression + ", " + variable + ")"; CalcParser parser = new CalcParser(); CalcObject parsed = parser.parse(command); CalcObject result = parsed.evaluate(); // compute numerical value result = subst(result, "a1", 0.0); result = subst(result, "a2", 10.0); result = CALC.SYM_EVAL(result); System.out.println("Result:"); System.out.println(result); } static CalcObject subst(CalcObject input, String var, double number) { CalcSymbol symbol = new CalcSymbol(var); CalcDouble value = new CalcDouble(number); return CalcSUB.numericSubstitute(input, symbol, value); } } Sample input and output: Enter expression: sin(a1) * 4 * a2 + (a1 + 1)^2 Differentiate with respect to: a1 Result: 42
type: Answer
has comment: http://stackoverflow.com/comment/33287345
accepted answer of: http://stackoverflow.com/q/21966992
has comment: http://stackoverflow.com/comment/33290069
has comment: http://stackoverflow.com/comment/36856032
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/21966992

http://stackoverflow.com/comment/33108972
has text: I am not getting bad quality because of algorithm choice. I am getting bad quality because of bug in code somewhere. I am getting heavy distortion, and values way out of whack....not just aliasing from poor algorithm.
comment on: http://stackoverflow.com/a/21844077
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/21995058
has comment: http://stackoverflow.com/comment/33336201
has body: you could use another table where you store only the parent-child relationships category children ----------- ------------ id INT category_id INT name VARCHAR child_id INT ... example as a tree: cat1 / | \ cat2 – cat3 cat4 | \ cat5 cat6 in words: cat1 has children: cat2, cat3, cat4 cat2 has no children cat3 has children: cat2, cat5, cat6 cat4 has no children cat5 has no children cat6 has no children In your tables it would looke like this: category children ------------ ---------- 1, "cat1" 1, 2 2, "cat2" 1, 3 3, "cat3" 1, 4 4, "cat4" 3, 5 5, "cat5" 3, 6 6, "cat6" 3, 2 So in your additional table children you don't have a unique id but you can have each category_id multiple times, each time relating it to another child [EDIT] I added 2 to be the child of 3 and 1 (not that obvious in the tree). The children ids and the parent ids can occur multiple times in the children table. They are not unique. [EDIT2] This is a SQL query to get one parent and all its children (first generation): SELECT id, name FROM category WHERE id=1 UNION ( SELECT children.child_id, category.name FROM children JOIN category ON children.child_id=category.id WHERE children.category_id=1 ) Haven't tested it, but something like this should do the trick. It will return this list: 1 "cat1" 2 "cat2" 3 "cat3" 4 "cat4" which you can format like this: 1 "cat1" &lt;-- parent | +– 2 "cat2" &lt;-- the children +– 3 "cat3" +– 4 "cat4" Now you will have to play with JOIN and UNION a little bit or simply call this statement in a nested loop for every parent and every child generation. MySQL is holding 2D- tables with rows and columns, so to have more dimensions (like more generations) you have to put the data together either with the JOIN / UNION statements or outside the DB in your program.
has comment: http://stackoverflow.com/comment/33339380
type: Answer
has comment: http://stackoverflow.com/comment/33336581
has comment: http://stackoverflow.com/comment/33341232
has comment: http://stackoverflow.com/comment/33376494
has comment: http://stackoverflow.com/comment/33338085
answers question: http://stackoverflow.com/q/21994771
has comment: http://stackoverflow.com/comment/33341818
accepted answer of: http://stackoverflow.com/q/21994771
score: 0
has comment: http://stackoverflow.com/comment/33342443
type: AcceptedAnswer

http://stackoverflow.com/comment/33303556
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21977139
has text: If you want an cross-platform example startup script, I've grabbed the outputs from Gradle (a build tool) when it packages things. They are made to work in most circumstances and therefore are very long, so I put them up as a gist: https://gist.github.com/flaviut/9180497
type: Comment

http://stackoverflow.com/a/21851343
score: 1
has comment: http://stackoverflow.com/comment/33077466
type: Answer
has body: As far as I know, you should choose the technology bringing less risks for you. If you consider yourself proficient with a JSF-Dojo combination, and have no non-functional requirements on the framework you must use... then use it. Take profit of your know-how at work, then go home and spend some hours learning new technologies and acquiring new know-how on some technologies that make you feel curious :)
has comment: http://stackoverflow.com/comment/33077458
upvote count: 1
has comment: http://stackoverflow.com/comment/33077586
answers question: http://stackoverflow.com/q/21851109
downvote count: 0

http://stackoverflow.com/comment/33099002
comment on: http://stackoverflow.com/q/21858934
has text: that should say RestEasy **jars**, as you are missing multiple ones.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22003152
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22003104
has body: You can use the Java predefined class StringBuilder. It is more effective than concatenating and manipulating Strings directly. StringBuilder also has a replace() method to cater your problem. See documentation StringBuilder#replace

http://stackoverflow.com/comment/33074750
type: AnswerComment
score: 0
type: Comment
has text: hello, I got two different suggestions now. Checking out both of them. Thank you for the suggestion both of you :) I am not so good in Arraylist so despite receiving the error message, couldnt fix it..
comment on: http://stackoverflow.com/a/21849638

http://stackoverflow.com/a/22072946
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/33473860
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21975117
has body: Looks like you're registering both the GPS and NETWORK providers to listen for a location for 10 seconds, and when the timer goes off after 10 seconds you try to get the most recent location from both providers. There are a few things going on here. First, you seem to be listening for updates in the wrong method. Your two listeners should look like: LocationListener locationListenerGps = new LocationListener() { // This will never be called, its not part of the LocationListener interface - http://developer.android.com/reference/android/location/LocationListener.html /* public void onStatusChanged(Location location) { timer1.cancel(); locationResult.gotLocation(location); lm.removeUpdates(this); lm.removeUpdates(locationListenerNetwork); } */ public void onProviderEnabled(String provider) {} public void onProviderDisabled(String provider) {} public void onLocationChanged(Location location) { // This is the correct method to receive location callbacks timer1.cancel(); locationResult.gotLocation(location); lm.removeUpdates(this); lm.removeUpdates(locationListenerNetwork); } public void onStatusChanged(String provider, int status, Bundle extras) {} }; Second, I'd use the ScheduledThreadPoolExecutor or Handler instead of Timer. From the Timer docs: Prefer ScheduledThreadPoolExecutor for new code...This class does not offer guarantees about the real-time nature of task scheduling. If a reboot is required to get the app working, its likely something to do with the Timer not firing after 10 seconds. Note that this doesn't necessarily mean that GPS itself isn't working. Handler should do the job and it's designed for Android, so I'd suggest using it. It looks like: Handler handler = new Handler(); handler.postDelayed(getLastLocation, 10000); ...and your GetLastLocation would change to: Runnable getLastLocation = new Runnable() { @Override public void run() { ... } } ...and your cancel() and other methods would need to reference the Handler. Also, note that you're declaring t…
downvote count: 0
has comment: http://stackoverflow.com/comment/57650629
answers question: http://stackoverflow.com/q/21975117
type: Answer

http://stackoverflow.com/comment/33251789
type: Comment
type: QuestionComment
has text: Its not about motivation right now for me , and yes i did not know that one port can handle multiple clients and i would certainly like to learn that .
comment on: http://stackoverflow.com/q/21948363
score: 1

http://stackoverflow.com/comment/33222968
score: 0
comment on: http://stackoverflow.com/q/21932640
type: Comment
type: QuestionComment
has text: what about localhost:8080/Spring-default/, the browser may add that by default. Let's see the mvc configuration to make sure the dispatcher and viewresolver are setup correctly

http://stackoverflow.com/a/21999457
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21912161
has body: Used postman plugin for Firefox to test and debug. Works great.
answers question: http://stackoverflow.com/q/21912161

http://stackoverflow.com/q/21901881
downvote count: 0
favorite count: 0
duplicate of: http://stackoverflow.com/q/5635483
has answer: http://stackoverflow.com/a/21902641
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: glassfish-4
upvote count: 1
linked to: http://stackoverflow.com/q/5635483
has body: iam a complete newbie in this area and dont know what to do. For a Java ee tutorial i have to install the GlassFish server on my Windows 7. I have followed the instructions and installed the newest JDK. After i have downloaded the GlassFish native installer with multilingual from this website glassfish.java.net/download.html i pressed the exe and it starts to install, but after 30 seconds it stops and a window pops and says that the software was not correctly installed that i have to do it again with the correct settings. The result of the tried install is that the GlassFish installer creates a glassfish4 folder under c:/glassfish4 but the glassfish4 folder is complete empty. The newest JDK is installed even so i did not know what to do. Than i choose to install the GlassFish server 3 and everything worked fine. A glassfish3 folder was created under c:/glassfish3 and i have installed the glassfish tools for eclipse. The problem here is that the glassfish3 installer did not create the domain1 folder. I followed the instruction given in this question eclipse error: glassfish\domains\domain1 does not exist but the command glassfish-install-dir\bin\asadmin create-domain your-domain-name doesnt work i get the same error message like the poster of this question that cmd gives path error. I also tried to execute the glassFish4 installer exe as admin but it failed also. Now i dont know what to and how to install the GlassFish4 server correctly it is so frustrating. Please help!
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/21901926
tagged with: glassfish
answer count: 2
has title: Installing Glassfish Server with installer fails on Windows 7

http://stackoverflow.com/comment/33199002
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21918275
has text: @mdl program didn't enter in "while", why? **s.hasNextFloat() = false**
score: 0

http://stackoverflow.com/comment/33245665
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21944587
type: AnswerComment
has text: Uh yes, sorry... Edited.

http://stackoverflow.com/comment/33129133
score: 0
comment on: http://stackoverflow.com/q/21879690
has text: My other loops are stating from 1 so thats not the problem is in 1st code its not inserting value at 2nd position it throws error as size of array is 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21867283
upvote count: 1
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/33106960
has title: Method keeps window from closing
has body: Im making a Simon Says game and when I call the randomColorChange() method in the KeyListener pressed() method, it keeps the winow from closing. The randomColorChange() method changes colors randomly. After the method is finished, I want the keyPressed() method to light up the keys: public void randomColorChange(){ decrement = simonIncrease; try{ int random; for (int i = 0; i &lt; simonIncrease; i++) { random = (int) (Math.random() * 4); Thread.sleep(lightUpSpd); if (random == 0) { green = green.brighter(); repaint(); Thread.sleep(lightUpSpd); green= green.darker(); repaint(); } if (random == 1) { red = red.brighter(); repaint(); Thread.sleep(lightUpSpd); red = red.darker(); repaint(); } if (random == 2) { blue = blue.brighter(); repaint(); Thread.sleep(lightUpSpd); blue = blue.darker(); repaint(); } if (random == 3) { yellow = yellow.brighter(); repaint(); Thread.sleep(lightUpSpd); yellow = yellow.darker(); repaint(); } } } catch (InterruptedException e){ e.printStackTrace(); } } public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub if (e.getKeyCode() == KeyEvent.VK_DOWN) { blue = blue.brighter(); repaint(); } if (e.getKeyCode() == KeyEvent.VK_LEFT) { red = red.brighter(); repaint(); } if (e.getKeyCode() == KeyEvent.VK_UP) { green = green.brighter(); repaint(); } if (e.getKeyCode() == KeyEvent.VK_RIGHT) { yellow = yellow.brighter(); repaint(); } decrement--; if (decrement == 0) { simonIncrease++; randomColorChange(); decrement = simonIncrease; } } The problem is that the segments will light up, but when I add the randomColorChange() method after simonIncrease++, the program doesn't work at all and I can't close the window Here's the whole class: import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.geom.Arc2D; import javax.swing.JFrame; import javax.swing.JLabel; public class SimonShape extends JFrame implements Ke…
has answer: http://stackoverflow.com/a/21867339
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21867339
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/33288973
type: Comment
has text: no this is not opening the bat file. you are telling me to add pushd %~dp0 at the end of the path like that ( ProcessBuilder pb = new ProcessBuilder( "C:\\Users\\user\\Desktop\\NetBeansProjects\\Genomic DataWarehouse Project\\biodwh.startBioDWH.batpushd %~dp0" )
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21969302

http://stackoverflow.com/q/21887896
type: Question
possible better answer: http://stackoverflow.com/a/21888006
has title: Java - replace all non-ASCII but leave HTML special characters
has body: If I have a String String mine = "Some Name &amp;reg; plus encoding issue ????? \u0000 something "; I would like to keep all the ASCII characters and HTML entities, but remove any other encoding. I tried mine.replaceAll("[^\\x00-\\x7F]", ""); but this removes things like trademark and copyright Is there a way to keep the HTML entities but remove all other encoding?
has comment: http://stackoverflow.com/comment/33143934
has answer: http://stackoverflow.com/a/21888006
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21888362
favorite count: 0
tagged with: regex
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/21888362

http://stackoverflow.com/q/21896815
tagged with: java
tagged with: hibernate
has body: In my controller: @Controller public class RandomController { @RequestMapping(value="/randomPage", method=RequestMethod.GET){ Map&lt;String, Map&lt;String, Object&gt;&gt; model = new HashMap&lt;String, Map&lt;String, Object&gt;&gt;(); List&lt;Builds&gt; builds = new ArrayList&lt;Builds&gt;(); model.put("buildCommand", builds); List&lt;BuildTypes&gt; buildTypes = new ArrayList&lt;BuildTypes&gt;(); buildTypes = buildTypesBus.findListById(buildCommand.getBuildId() ); model.put("buildTypes", buildTypes); .......bunch of other stuff here return new ModelAndView("randomPage", model); } } Then in my view of randomPage.jsp: I would have a for loop through all the buildCommand and display buildCommand.name buildCommand.buildTypeId etc. The question I want to know is how do I pull the buildTypes.name from the buildTypes and relate that to buildTypeId. I know I could crate a loop though the list of buildTypes till I find the buildTypeId and then pull the name, but I feel this is really inefficient. I could also go through hibernate and change the model but do not want to do this, would rather handle this in the jsp. Is there a faster more efficient alternative.
type: Question
has answer: http://stackoverflow.com/a/21897169
score: 0
has title: Spring update value from multiple models elements in Jsp
answer count: 1
tagged with: jsp
tagged with: model
tagged with: spring
type: UnansweredQuestion

http://stackoverflow.com/comment/33350624
type: Comment
type: AnswerComment
has text: @Radiodef I've just read this. Currently I'm using a singleton pattern for some classes that only need 1 instance by having a static instance and get-function that stores a newly-created object in the instance field if it's null. From what I've read there it seems that by using static the processor will always access the same memory and I should not have this problem. It's not synchronized, but I can guarantee, based on the order of my code, that 2 threads will never access the get-function at the same time when it hasn't been accessed before.
score: 0
comment on: http://stackoverflow.com/a/21950720

http://stackoverflow.com/a/21983268
has body: Your conclusion in the comments is correct. SubList requires a parent field because sub-lists of a SubList use the SubList as the parent -- the enclosing ArrayList is not the parent in that case. In particular, the source for ArrayList.SubList.subList() is: public List&lt;E&gt; subList(int fromIndex, int toIndex) { subListRangeCheck(fromIndex, toIndex, size); return new SubList(this, offset, fromIndex, toIndex); } Note that this (a SubList) is passed as the parent parameter to the new SubList. There would be no way to track this without an explicit parent field.
type: Answer
accepted answer of: http://stackoverflow.com/q/21923674
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21923674
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21942092
upvote count: 1
type: Question
has title: android.os.NetworkOnMainThreadException while executing request of facebook Graph API
has body: I need to use FACEBOOK GRAPH API from my Android App. I downloaded Facebook SDK for Android and studied Samples given with SDK. I also studied one of the samples titled GraphApiSample. In this sample, A batch of requests are executed using the following method: Request.executeBatchAndWait(Collection<Request> requests) Well, Now I am trying to execute a single request but I am getting android.os.NetworkOnMainThreadException while executing request. So far I know this exception occurs when we wanna try to execute HTTP requests without using AsyncTask/Thread. But in FB sample "GraphApiSample", they executed request without any thread and it works good. Then what's wrong with my request ? AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="16" /> <uses-permission android:name="android.permission.INTERNET" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <TextView android:id="@+id/welcome" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="TextView" /> <com.facebook.widget.LoginButton android:id="@+id/authButton" android:layout_width="wrap_content" android:layout_hei…
has answer: http://stackoverflow.com/a/21942201
has comment: http://stackoverflow.com/comment/33239830
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33239944
tagged with: facebook-android-sdk
score: 1
tagged with: facebook-graph-api
linked to: http://stackoverflow.com/q/6343166
favorite count: 0
has comment: http://stackoverflow.com/comment/33242533
tagged with: android
duplicate of: http://stackoverflow.com/q/6343166
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/33244879
comment on: http://stackoverflow.com/q/21944321
score: 0
type: QuestionComment
type: Comment
has text: I just delete all libraries but the error continues.

stack
tags question: http://stackoverflow.com/q/21969603
tags question: http://stackoverflow.com/q/21950215
tags question: http://stackoverflow.com/q/22002892
tags question: http://stackoverflow.com/q/21849410
tags question: http://stackoverflow.com/q/21871412
tags question: http://stackoverflow.com/q/21977844
tags question: http://stackoverflow.com/q/21914374
tags question: http://stackoverflow.com/q/22002296
tags question: http://stackoverflow.com/q/21882829
tags question: http://stackoverflow.com/q/21895478
type: Tag
tag name: stack
tags question: http://stackoverflow.com/q/21995651
tags question: http://stackoverflow.com/q/21979461

http://stackoverflow.com/a/21874284
has comment: http://stackoverflow.com/comment/33119036
has comment: http://stackoverflow.com/comment/33122039
has comment: http://stackoverflow.com/comment/33122168
downvote count: 0
has comment: http://stackoverflow.com/comment/33122127
answers question: http://stackoverflow.com/q/21873832
has comment: http://stackoverflow.com/comment/33121316
type: Answer
upvote count: 1
score: 1
has body: Here's what you do using GUI Builder. Instead of using the drag and drop in the JFrame form to drag and drop JPanels for the JTabbedPane, do this. Create a JPanel form class Layout the JPanel with all the components you want. In the constructor add this to load the image. Use your own image path public class TabPanelOne extends javax.swing.JPanel { Image img; public TabPanelOne() { try { img = ImageIO.read(getClass().getResource("/resources/stackoverflow5.png")); } catch (IOException ex) { Logger.getLogger(TabPanelOne.class.getName()).log(Level.SEVERE, null, ex); } initComponents(); } Override the paintComponent method of the JPanel and draw the image @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(img, 0, 0, getWidth(), getHeight(), this); } You should have an empty JTabbedPane in your JFrame form class. In the constructor, just add the JPanel form public class NewJFrame extends javax.swing.JFrame { public NewJFrame() { initComponents(); jTabbedPane1.add("panel1", new TabPanelOne()); }

http://stackoverflow.com/a/21925351
type: AcceptedAnswer
has body: You should be using startActivityForResult in "app1": startActivityForResult(intent, SOME_CONSTANT); The constant you pass will be passed back as the requestCode argument. So in your case it looks like you would want to pass in 1. See the docs for more info: Android Developers
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21925271
type: Answer
answers question: http://stackoverflow.com/q/21925271
score: 2
upvote count: 2

http://stackoverflow.com/q/21868721
has comment: http://stackoverflow.com/comment/33109730
type: Question
has comment: http://stackoverflow.com/comment/33110619
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/33110976
has comment: http://stackoverflow.com/comment/33110138
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/33110993
answer count: 1
has comment: http://stackoverflow.com/comment/33109823
has comment: http://stackoverflow.com/comment/33110754
has comment: http://stackoverflow.com/comment/33110729
tagged with: jlabel
type: UnansweredQuestion
tagged with: swing
has title: GUI Issue: Don't Even Know Where to Begin
has body: I'm getting somewhere, but now I ran into an even bigger snag: I cannot seem to understand how to create a listener that changes the information on my JLabel to what is inputted and output information stored in my JTextArea. Here is my code to give you an idea: public class DisplayStudent extends JFrame { private JMenuItem jmiConnect, jmiClose, jmiExit, jmiSearch, jmiClear; private JPanel contentPane; private JPanel contentPane2; private JTextArea info; private String information; public JPanel contentPane() { JPanel something = new JPanel(new BorderLayout()); //something.setLayout(); String information; info = new JTextArea(4, 30); info.setEditable(false); info.setLineWrap(true); info.setWrapStyleWord(true); JPanel one = new JPanel(); one.setBackground(Color.WHITE); one.setSize(50, 50); one.add(info, BorderLayout.CENTER); something.add(one, BorderLayout.NORTH); JPanel two = new JPanel(new BorderLayout()); two.setBackground(null); two.setSize(10, 10); two.add(new JLabel(" No Connection "), BorderLayout.WEST); two.add(new JLabel(" Number of Students = "), BorderLayout.EAST); something.add(two); something.setOpaque(true); return something; } public static void GUI() { JFrame frame = new JFrame("Display Student"); DisplayStudent panel = new DisplayStudent(); frame.setContentPane(panel.contentPane()); DisplayStudent bar = new DisplayStudent(); frame.setJMenuBar(bar.DisplayStudent()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 150); frame.setVisible(true); //frame.setJMenuBar(jmb); } public JMenuBar DisplayStudent() { //Drop down menu JMenuBar jmb = new JMenuBar(); JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('F'); jmb.add(fileMenu); JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic('E'); jmb.add(editMenu); //Buttons in menu - "File" menu JMenuItem jmiConnect = new JMenuItem("Connect", 'C'); JMenuItem jmiClose = new JMenuItem("Close", 'L'); JMenuItem jmiExit = new JMenuItem("Exit", 'E'); fileMenu.add(jmiConnect); fileMenu.…
has answer: http://stackoverflow.com/a/21869469
tagged with: java
has comment: http://stackoverflow.com/comment/33110897

http://stackoverflow.com/comment/33161550
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21897683
has text: You say that the column names are contained in a String array. What about the column data types? Are they all the same (i.e. varchar())? In your static example, you include a primary key and requisite NOT NULL constraint. In the dynamic table you want to create, are all columns nullable? Is there a primary key? Is the primary key user-definable (or is it a simple int)? The answers to these questions will determine how to create the code to dynamically create the table.

http://stackoverflow.com/comment/33184168
has text: @mikera embedded device dont have a JIT
type: Comment
comment on: http://stackoverflow.com/a/21910859
score: 0
type: AnswerComment

http://stackoverflow.com/q/21942610
tagged with: java
has comment: http://stackoverflow.com/comment/33240625
type: Question
has body: I am creating a generic Java jar with a main function. The jar itself is not to be executed, but other jars will use it and name the main inside the generic jar as their default main. This will allow me to produce a common interface for a set of jars designed for relatively the same purpose. My problem comes when I try to write a usage statement. I want the usage statement to name the jar that is being called from the command line. However, I can't find a way to discover the name of the head jar being executed from my my generic Java code. Any ideas?
score: 0
has comment: http://stackoverflow.com/comment/33248472
tagged with: executable-jar
has title: Get name of Executable Jar from code in another generic jar
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/21968231
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21968210
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21968210
has comment: http://stackoverflow.com/comment/33287277
score: 1
downvote count: 0
has body: Your Label[] k = null; is null, You have to initialize it like: Label[] k = new Label[5];
has comment: http://stackoverflow.com/comment/33287287

http://stackoverflow.com/comment/33112892
score: 0
comment on: http://stackoverflow.com/q/21870679
has text: I can't have any other methods...
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33349653
has text: It look's like you're trying to hunt sparrows with a 12 Ga shotgun. Sure you'll get a lot of feathers, but not much bird will be left. Rather than trying to add the MouseListener willy-nilly to components on the JPanel, and thus missing the JList, why not have decent references to the JLists themselves, and then add the MouseListener **directly** to the JList references?
comment on: http://stackoverflow.com/q/22003328
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/22108079
has comment: http://stackoverflow.com/comment/33715964
type: Answer
has body: The TextArea consists of several nodes. To make the background transparent it is necessary to change the background of the child panes as well (TextArea,ScrollPane,ViewPort,Content). This can be accomplished via CSS. CSS Example: .text-area { -fx-background-color: rgba(53,89,119,0.4); } .text-area .scroll-pane { -fx-background-color: transparent; } .text-area .scroll-pane .viewport{ -fx-background-color: transparent; } .text-area .scroll-pane .content{ -fx-background-color: transparent; } The same can be accomplished via code. The code shouldn't be used for production. It's just for demonstrating the node structure. Code Example (makes all backgrounds fully transparent): TextArea textArea = new TextArea("I have an ugly white background :-("); // we don't use lambdas to create the change listener since we use // the instance twice via 'this' (see *) textArea.skinProperty().addListener(new ChangeListener&lt;Skin&lt;?&gt;&gt;() { @Override public void changed( ObservableValue&lt;? extends Skin&lt;?&gt;&gt; ov, Skin&lt;?&gt; t, Skin&lt;?&gt; t1) { if (t1 != null &amp;&amp; t1.getNode() instanceof Region) { Region r = (Region) t1.getNode(); r.setBackground(Background.EMPTY); r.getChildrenUnmodifiable().stream(). filter(n -&gt; n instanceof Region). map(n -&gt; (Region) n). forEach(n -&gt; n.setBackground(Background.EMPTY)); r.getChildrenUnmodifiable().stream(). filter(n -&gt; n instanceof Control). map(n -&gt; (Control) n). forEach(c -&gt; c.skinProperty().addListener(this)); // * } } }); Further reference: JavaFX CSS Documentation
has comment: http://stackoverflow.com/comment/33537737
has comment: http://stackoverflow.com/comment/74484543
score: 27
upvote count: 27
answers question: http://stackoverflow.com/q/21936585
downvote count: 0

http://stackoverflow.com/comment/33342030
comment on: http://stackoverflow.com/q/21998989
score: 1
type: Comment
type: QuestionComment
has text: can you post a test case. say user attempted 5 times...when do we alert him ? on his 6th attempt or on his 8th attempt (3rd attempt after first 5 attempts)

http://stackoverflow.com/comment/33178239
has text: maybe this will help http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html it explain it quite well
comment on: http://stackoverflow.com/q/21885462
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22000903
has comment: http://stackoverflow.com/comment/33350453
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33345538
has comment: http://stackoverflow.com/comment/33345451
type: Answer
answers question: http://stackoverflow.com/q/22000850
has comment: http://stackoverflow.com/comment/33346734
has body: So you don't need to declare the calling methods as catching or throwing IOException. Checked exceptions may be nice in some situations, but not everywhere.
upvote count: 1

http://stackoverflow.com/a/21889568
has body: When you are passing reference to object to ArrayList you actually create yet another reference that is used by ArrayList to refer to the object. When you assign null to variable test you actually "cancel" your reference. Nothing happens with reference of array list. Even simpler. If you have 2 variables: one and two: Test one = new Test() Test two = one; At this point both references point to the same object. one = null; Now one is null, but two still refers to that object.
score: 1
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21889478

http://stackoverflow.com/comment/33155162
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21893964
has text: Ah. Well, in your code snippet, you're using the raw type, and even if you weren't, remember that `List<Class<T>>` isn't the same thing as a `List<T>`.

http://stackoverflow.com/comment/33245720
comment on: http://stackoverflow.com/q/21927755
score: 0
has text: I understand that Ant is a preferred alternative. However, this is a simple project, and all the Makefile is doing is running `javac` with some custom arguments to compile to a different folder. I'm really just wondering how to setup the run configuration to run `nachos.package1.Main` from inside the `proj1` directory, instead of the main outer `nachos` directory.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33157618
score: 0
has text: I also tried removing the methods and putting the entire thing in start() because of which i had to declare GoingOut only once but then my code gave a NullPointerException on the line GoingOut.writeBytes(send);
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21895010

http://stackoverflow.com/comment/33124214
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21877104
has text: It's for a list view in android. I display on each row a key/value pair thanks to the linkedhashmap. Some values in the array are identical and I only want to display one of them in the list view.
score: 0

http://stackoverflow.com/a/21947405
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21947294
has body: While there are ways to set the priority of running thread to "high", perhaps you should consider a different overall strategy. Your problem description implies that you will have multiple independent calculations to make ("one sub-process with different initial values"). Perhaps you should consider breaking the calculation into the "sub work units", storing initial values and results in a database ... and recruit other students to run these sub work units during free time on their computers. For the computer that you use, do try making multiple threads (many laptops have the equivalent of 8 CPUs via multi-core and hyperthreading).

http://stackoverflow.com/a/21950624
score: 0
has comment: http://stackoverflow.com/comment/33255782
has body: Try this... String st1= "1005 random array 2.2"; int a = Integer.parseInt(st1.substring(0, 4)); String stringArray = st1.substring(5,17); double number = Double.parseDouble(st1.substring(18));
answers question: http://stackoverflow.com/q/21950439
has comment: http://stackoverflow.com/comment/33255723
type: Answer

http://stackoverflow.com/a/21993015
answers question: http://stackoverflow.com/q/21991521
has comment: http://stackoverflow.com/comment/33337149
score: 1
upvote count: 1
has body: This is not an answer, so technically, it might have to be deleted - But something like this can hardly be discussed in a comment...: So I assume that the data structure should look like this interface LoginDatastructure, is this correct? import java.util.List; import java.util.Map; class UserAuthorities {} class Peer { private UserAuthorities authorities; } interface LoginDatastructure { // 1. Get all peers List&lt;Peer&gt; getAllPeers(); // 2. Get all peers grouped by UserAuthorities Map&lt;UserAuthorities, List&lt;Peer&gt;&gt; getPeersByUserAuthority(); // 3. Add new peer (with null UserAuthorities // and after some time set user authorities) void addPeer(Peer peer); // 4a Remove peer by peerUid void removePeer(long peerUid); // 4b. Remove peer by peerUid or all peers by UserAuthorities void removePeers(UserAuthorities u); } Where does your Map&lt;Long, Peer&gt; occur in this example? Concerning 3.: When the peer is added, and it has a null UserAuthority, should it be included in the list that is returned by method 1? And should it be included in the map that is returned by method 2? List&lt;Peer&gt; peersWithNull = map.get(null); ? Concerning the changing UserAuthority: Is it possible to inform this data structure when the User Authority changes? That is, can the LoginDatastructure have an additional method like void userAuthorityWasSet(Peer peer); that will be called when the UserAuthority of the given peer changed? Concerning point 5, the concurrency: Is there any reason not to blatantly make all of these methods synchronized? EDIT: Concerning the synchronization: What kind of thread-safety do you expect? For example, when one Peer is added, should this automatically become visible in all Lists that someone may have obtained from the Map of method 2? Should these lists also be updated when the authority is set? In any case, until now, the methods are primarily adding/removing elements to/from the data structure, so I think making them synchonrized would not ha…
downvote count: 0
has comment: http://stackoverflow.com/comment/33330958
type: Answer

http://stackoverflow.com/comment/121441894
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/52761204
has text: Great thx, though, seems that 2.1.18.RELEASE still do not fix the problem :( :(

http://stackoverflow.com/comment/33267498
type: QuestionComment
comment on: http://stackoverflow.com/q/21957421
has text: Can you show your schema for the `lastvisited` column? Given the last error message, it certainly *looks* like it can't be null...
type: Comment
score: 1

http://stackoverflow.com/comment/33209979
type: AnswerComment
comment on: http://stackoverflow.com/a/21856592
score: 0
has text: i understand the difference between base uuid and service uuid by your above post,is there any way/procedure to obtain/create custom uuid?
type: Comment

http://stackoverflow.com/comment/33152595
score: 1
has text: Wow. There are at least two problems with this code, and anyone who doesn't answer BOTH of them gets downvoted *immediately*. Territorial much? Answer retracted.
comment on: http://stackoverflow.com/q/21892667
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21996396
answer count: 4
accepted answer: http://stackoverflow.com/a/22183095
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21996548
type: Question
has answer: http://stackoverflow.com/a/22183095
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22173369
has answer: http://stackoverflow.com/a/22175160
has comment: http://stackoverflow.com/comment/33687637
score: 5
possible better answer: http://stackoverflow.com/a/22173369
tagged with: jpa
has body: I'm using JPA 2.0 with Hibernate 4.2.5. I have a bidirectional mapping to the same entity type. @OneToMany(mappedBy = "parent", cascade = { CascadeType.PERSIST, CascadeType.DETACH }, orphanRemoval = true, fetch = FetchType.EAGER) @Fetch(FetchMode.JOIN) @OrderColumn(name = "position", nullable=false) private List&lt;MenuItem&gt; children = new ArrayList&lt;MenuItem&gt;(); @ManyToOne(optional = false, fetch = FetchType.EAGER) @JoinTable(name = "MenuItem_MenuItem", joinColumns = { @JoinColumn(name = "child_id") }, inverseJoinColumns = { @JoinColumn(name = "parent_id") }) private MenuItem parent; This mapping creates a jointable with parent_id, child_id and position columns. When I want to add a child to the parent I do the following: MenuItem newItem = service.persist(..); parent.getChildren().add(newItem); newItem.setParent(parent); service.merge(newItem); service.merge(parent); which generates the following: Hibernate: select nextval ('hibernate_sequence') Hibernate: insert into MenuItem (menu_id, message, messageId, params, id) values (?, ?, ?, ?, ?) Hibernate: insert into MenuItem_MenuItem (parent_id, child_id) values (?, ?) The problem here is that the second insert doesn't include the position property so it remains null. What am I doing wrong? EDIT I'm using spring declarative transaction management, and all my merge and persist methods are annotated with @Transactional. Could it be a problem?
tagged with: jpa-2.0
has title: JPA OrderColumn null values on merge
favorite count: 0
upvote count: 5

http://stackoverflow.com/comment/33163008
comment on: http://stackoverflow.com/q/21897347
score: 0
type: Comment
type: QuestionComment
has text: Unfortunately no, I looked quickly and could only find the commands to ask the modem to dial a number, not as it it's current status. Maybe some digging around the web will turn something up

http://stackoverflow.com/a/21896710
downvote count: 0
type: Answer
score: 1
has body: If the commented lines are just above the writer.println(), then it might explain the strange behaviour you're experiencing. You should create the PrintWriter outside the for-loop. Something like this PrintWriter writer = null; try { writer = new PrintWriter(new BufferedWriter(new FileWriter("permutations.txt", true))); // Most outer for loop goes here for(int i=0......) { } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } finally { if(writer!=null) { try { writer.flush(); writer.close(); } catch(Exception ignore) {} } }
upvote count: 1
answers question: http://stackoverflow.com/q/21896535

http://stackoverflow.com/comment/33273153
score: 0
type: Comment
type: QuestionComment
has text: Have I answered your question?
comment on: http://stackoverflow.com/q/21956826

http://stackoverflow.com/comment/33062754
comment on: http://stackoverflow.com/q/21842287
type: QuestionComment
type: Comment
has text: @gravityplanx - whoops, sorry. I messed it up in an edit. If you check it out now, that's exactly how I have it, and it is indeed running locally.
score: 0

http://stackoverflow.com/q/21874393
linked to: http://stackoverflow.com/q/3323111
accepted answer: http://stackoverflow.com/a/21888907
has comment: http://stackoverflow.com/comment/33122493
tagged with: eclipselink
has comment: http://stackoverflow.com/comment/33123002
possible better answer: http://stackoverflow.com/a/21874588
has comment: http://stackoverflow.com/comment/33122951
has answer: http://stackoverflow.com/a/21874588
upvote count: 7
type: AnsweredQuestion
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/33123693
type: Question
answer count: 2
tagged with: validation
tagged with: jpa
has answer: http://stackoverflow.com/a/21888907
downvote count: 0
has title: How to validate model data with JPA?
favorite count: 0
has body: I am trying to get JPA validation to work, however it seems that the validation annotations are ignored. I found this example of JPA validation on SO: JPA Entity Validation, but it does not work for me. The @NotNull and @Size annotations seem to be ignored. As in the answer mentioned above I use only two classes: Customer.java: package com.validation.test; import javax.persistence.*; import javax.validation.constraints.*; @Entity @Table(name = "T_CUSTOMER") public class Customer { @Id @NotNull @SequenceGenerator(name = "customerIdSeq", sequenceName = "T_CUSTOMER_ID_SEQ", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "customerIdSeq") private Long id; @NotNull @Size(min = 3, max = 80) private String name; public Customer() {}; public Customer(String name) { this.name = name; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } } CustomerTest.java: package com.validation.test.test; import static org.junit.Assert.*; import javax.persistence.*; import javax.validation.*; import javax.validation.constraints.Size; import org.junit.*; import com.validation.test.Customer; public class CustomerTest { private static EntityManagerFactory emf; private EntityManager em; @BeforeClass public static void createEntityManagerFactory() { emf = Persistence.createEntityManagerFactory("testPU"); } @AfterClass public static void closeEntityManagerFactory() { emf.close(); } @Before public void beginTransaction() { em = emf.createEntityManager(); em.getTransaction().begin(); } @After public void rollbackTransaction() { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } if (em.isOpen()) { em.close(); } } @Test public void nameTooShort() { try { Customer customer = new Customer("bo"); em.persist(customer); em.flush(); fail("Expected ConstraintViolationException wasn't thrown."); } catch (ConstraintViolationExcept…

http://stackoverflow.com/comment/33219073
type: AnswerComment
has text: Note that OP uses different packages - when the two classes are in the same package it works, but `protected` denies access from other packages
type: Comment
comment on: http://stackoverflow.com/a/21930596
score: 1

http://stackoverflow.com/comment/33197004
type: Comment
comment on: http://stackoverflow.com/a/21917793
has text: @Pshemo - Wait, I didn't know you can use %n instead. you mean "OS independant" though right? thanks!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33070335
type: Comment
type: QuestionComment
has text: Why would a bus say it's a Car transport type?
comment on: http://stackoverflow.com/q/21847189
score: 1

http://stackoverflow.com/comment/33298610
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21940457
has text: The best why I find to learn how something works is to do it yourself. I could just do it in 3 or 4 lines of code but I wouldn't get the same understanding or knowledge if I did.
score: 0

http://stackoverflow.com/a/21868476
answers question: http://stackoverflow.com/q/21867775
downvote count: 0
has body: If you have void myMethod() { try { SomeClass x = someValue; } catch(..) {..} SomeClass y = x; } The compiler will (rightfully) complain that x is not defined in that final assignment statement, because x was declared inside the {} brackets of the try and that declaration cannot "escape" from the "scope" defined by the {}. If you instead have void myMethod() { SomeClass x; try { x = someValue; } catch(..) {..} SomeClass y = x; } The compiler will now complain that the value of x is not set in the final assignment statement. This is because there is no guarantee that the statements inside the try range were executed. (The same would hold if you replaced try with if (some condition), and did not also set x in the else leg.) But if you have void myMethod() { SomeClass x = null; try { x = someValue; } catch(..) {..} SomeClass y = x; } The compiler will be (reasonably) happy, since x is "visible" in the scope of the final assignment statement, and it's also known to have had a value assigned along all possible paths from it's declaration point to the place where its used.
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/33284561
has text: what's the problem? Looking the output, everything seems inserted correctly
comment on: http://stackoverflow.com/q/21966663
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33099461
comment on: http://stackoverflow.com/a/21862921
score: 0
has text: it should be `getWritableDatabase()`, also are you calling that inside your DBHelper?
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21965668
has comment: http://stackoverflow.com/comment/33289000
has body: Initialization vector is different in your Java code and Qt: private static final byte[] IV = { 0, 2, 4, 8, 16, 32, 64, 127, 127, 64, 32, 16, 8, 4, 2, 0 }; And in C++: memset( iv, 0x00, AES::BLOCKSIZE ); // ==&gt; This fills the iv array with 0s So you need to use same IV for both schemes. Update: In order to provide an IV for CBC mode of AES, you need to specify IV as you do in Java: byte iv[ AES::BLOCKSIZE ] = {0, 2, 4, 8, 16, 32, 64, 127, 127, 64, 32, 16, 8, 4, 2, 0}; Note that AES::BLOCKSIZE is defined in library headers and it is 16.
has comment: http://stackoverflow.com/comment/33283024
has comment: http://stackoverflow.com/comment/33381162
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33289188
answers question: http://stackoverflow.com/q/21965102
has comment: http://stackoverflow.com/comment/33283069
score: 2
upvote count: 2

http://stackoverflow.com/comment/33354870
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21853336
has text: Sami you may want phrase that as an answer so I can accept it.
score: 0

http://stackoverflow.com/comment/33098851
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21863057
type: Comment
has text: Which logger message is displayed?

http://stackoverflow.com/q/21871881
tagged with: for-loop
answer count: 1
favorite count: 0
has title: Why would the following code run?
has comment: http://stackoverflow.com/comment/33114786
downvote count: 6
type: AnsweredQuestion
score: -5
accepted answer: http://stackoverflow.com/a/21871973
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21871973
has comment: http://stackoverflow.com/comment/33114825
has body: Consider the following code: int x = 0; for(System.out.println("Confuse!"); Math.random()&gt;0.5; x--) { } I am quite puzzled on how this code would compile (it actually prints "Confuse!"). What is the explanation behind this? Wasn't it the case that in a for loop we have for(initiation;condition;increment)? Shouldn't we define an int variable there? Or does that not really matter and the initiation can be anything?

http://stackoverflow.com/comment/33170625
type: AnswerComment
score: 0
type: Comment
has text: or can you suggest me a good possibility how to store multi-line resource-strings in java?
comment on: http://stackoverflow.com/a/21903103

http://stackoverflow.com/comment/33194357
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21916393
has text: haha thank you, I did mean JPanel. I was researching JLayeredPane and was not thinking.
type: AnswerComment

http://stackoverflow.com/a/21903115
type: Answer
score: 0
has body: App1 (com.example.remoteservice) SharedPreferences configuracion2; configuracion2 = getSharedPreferences("telo", Context.MODE_WORLD_READABLE); Editor editor = configuracion2.edit(); editor.putFloat("x21", Float.parseFloat(x21.getText().toString())); editor.commit(); App2 (com.example.grafica) Context con = createPackageContext("com.example.remoteservice", Context.CONTEXT_IGNORE_SECURITY); SharedPreferences pref = con.getSharedPreferences( "telo",MODE_WORLD_READABLE); ancho = pref.getFloat("x21", 0); Log.i("smash", "ancho" + String.valueOf(ancho)); This should solve it. Also do not call the getSharedPreferences() of current context before this call.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21902770
accepted answer of: http://stackoverflow.com/q/21902770

http://stackoverflow.com/comment/33248144
has text: Hi Mikemil, the webservice doesn't return million records. It just searches within a million records. at a time the webservice should return max 20 records. I have pasted the code of the interface in my main post. hope it helps you figure out the issue.
comment on: http://stackoverflow.com/q/21944462
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22015166
score: 0
has body: Using @PrimaryKeyJoinColumn on a OneToOne means you want Profesor and Direccion to share the same Primary Key. If you really want to do this, that means Direccion must also have an association to the Profesor instance to get the ID and that you must define the appropriate strategy on the ID field. In Direccion entity I would add a : @OneToOne(mappedBy="direccion") private Profesor profesor; And redefine the id as follows to force hibernate to use field profesor to get the ID: @Id @GeneratedValue(generator = "foreignGenerator") @GenericGenerator(name = "foreignGenerator", strategy = "foreign", parameters = { @Parameter(name = "property", value = "profesor") }) private Integer idDireccion; Your sample code must also build the association both ways: p.setDireccion(d); d.setProfesor(p); Hope this helps. Regards JF
type: Answer
answers question: http://stackoverflow.com/q/21992936

http://stackoverflow.com/a/21960742
type: Answer
has body: You need to change the loop to include the user-prompting code and change it so that it only happens again after the user types "yes". Like so: import java.util.Scanner; public class Temperature { public static void main(String[] args){ Scanner input = new Scanner (System.in); double deg; char dg; String prompt; tempLoop: do{ System.out.println("Enter a number, a space and F to convert from degF to degC and C to convert to degC to degF"); deg = input.nextDouble(); String letter = input.next().toUpperCase(); dg = letter.charAt(0); if( dg == 'C'){ double cTemp= (deg-32)*5.0/9.0; System.out.printf("%f degC converted to degF is %.2f%n",deg, cTemp );; } else if(dg == 'F'){ double fTemp = (deg*9/5) + 32; System.out.printf("%f degF converted to degC is %.2f%n",deg, fTemp ); continue; } else{ System.out.println("That character does not correspond to a valid unit of measure "); break; } System.out.println("Would you like to continue?(yes/no)"); prompt = input.next(); }while(prompt.equalsIgnoreCase("yes")); } }
answers question: http://stackoverflow.com/q/21960477
score: 0
has comment: http://stackoverflow.com/comment/33273949

http://stackoverflow.com/q/21929790
has answer: http://stackoverflow.com/a/21929883
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has title: ResponseBody in Spring MVC 2
possible better answer: http://stackoverflow.com/a/21929883
answer count: 2
has answer: http://stackoverflow.com/a/22233192
accepted answer: http://stackoverflow.com/a/22233192
upvote count: 1
favorite count: 0
tagged with: rest
has body: I am currently working on implementing REST webservices into existing system. This system is using Spring in version 2 (particularly 2.5.6.SEC02). I can't upgrade it to version 3 as it could break existing system components. We didn't make the rest of this system, don't have source codes and don't want to lose warranty, so Spring version should basically stay as it is :) The question is, how can I implement Rest WS with automatic DTO serialization from/to JSON? I have appropriate Jackson libraries on the classpath. Spring 2 doesn't seem to know about @RequestBody and @ResponseBody yet. Are there any other annotations that can be used, or some alternative way?
tagged with: spring

http://stackoverflow.com/comment/33341604
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21998655
score: 0
has text: I don't see the point, if the array of colors is constant, make it a constant in `Sinebow`

http://stackoverflow.com/q/21984963
favorite count: 0
has comment: http://stackoverflow.com/comment/33316209
tagged with: out-of-memory
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21985106
tagged with: java
has body: I am trying to read a text file and create a string. I am using following code: String FILENAME = "file.txt"; File file = getApplicationContext().getFileStreamPath(FILENAME); int size = (int) file.length(); System.out.println("size: "+size); byte[] bytes = new byte[size]; BufferedInputStream buf = new BufferedInputStream(new FileInputStream(file)); buf.read(bytes, 0, bytes.length); buf.close(); System.out.println("buf string: "+new String(bytes)); size in this case is 5295164. in the last line of code, i get following exception: FATAL EXCEPTION: main java.lang.OutOfMemoryError at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:94) at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:145) at java.lang.StringBuilder.append(StringBuilder.java:216) at se.egretails.ssapp.MyActivity$4.onClick(MyActivity.java:461) at android.view.View.performClick(View.java:4084) at android.view.View$PerformClick.run(View.java:16966) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4812) 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:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) How should i solve this? Thanks in advance.
has title: How to Create a string from a BufferedInputStream using bytes?
type: Question
score: 5
upvote count: 5
tagged with: bufferedinputstream
linked to: http://stackoverflow.com/q/309424
has comment: http://stackoverflow.com/comment/33316286
duplicate of: http://stackoverflow.com/q/309424
answer count: 1
downvote count: 0
tagged with: string

wifi
tag name: wifi
tags question: http://stackoverflow.com/q/21937887
type: Tag

http://stackoverflow.com/q/21974225
has comment: http://stackoverflow.com/comment/33298234
type: Question
linked to: http://stackoverflow.com/q/7229226
linked to: http://stackoverflow.com/q/13404398
answer count: 1
score: 0
has title: How do I draw on a JFrame, or any JComponent?
tagged with: paintcomponent
tagged with: paint
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/33297633
has answer: http://stackoverflow.com/a/21974285
tagged with: java
has body: I am trying to draw something using paint() on my JFrame. I can't get it to show though. Why? claass DrawOn extends JFrame{ public static void main(String args[]){ new DrawOn(); } public DrawOn(){ setVisible(true); pack(); } paint(Graphics g){ g.drawOval(10,10,100,100); } }

http://stackoverflow.com/a/21955385
answers question: http://stackoverflow.com/q/21955069
has comment: http://stackoverflow.com/comment/33271840
type: AcceptedAnswer
has body: The documentation of read(byte[],int,int says that it: Reads up to len bytes of data. An attempt is made to read as many as len bytes A smaller number may be read. Since we are working with files that are right there in our hard disk, it seems reasonable to expect that the attempt will read the whole file, but input.read(result, 0, result.length) is not guaranteed to read the whole file (it's not said anywhere in the documentation). Relying in undocumented behaviors is a source for bugs when the undocumented behavior change. For instance, the file stream may be implemented differently in other JVMs, some OS may impose a limit on the number of bytes that you may read at once, the file may be located in the network, or you may later use that piece of code with another implementation of stream, which doesn't behave in that way. Alternatively, if you are reading the whole file in an array, perhaps you could use DataInputStream.readFully About the loop with read(), it reads a single byte each time. That reduces performance if you are reading a big chunk of data, since each call to read() will perform several tests (has the stream ended? etc) and may ask the OS for one byte. Since you already know that you want file.length() bytes, there is no reason for not using the other more efficient forms.
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/33270033
has comment: http://stackoverflow.com/comment/33270558
has comment: http://stackoverflow.com/comment/33270625
accepted answer of: http://stackoverflow.com/q/21955069
score: 3
downvote count: 0

http://stackoverflow.com/comment/33117773
score: 0
type: Comment
type: QuestionComment
has text: No it doesn't display any exception. i send a string from client to server its working but server to client is not working.
comment on: http://stackoverflow.com/q/21873476

http://stackoverflow.com/q/21961965
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
tagged with: client-server
tagged with: japplet
answer count: 1
has answer: http://stackoverflow.com/a/21964122
accepted answer: http://stackoverflow.com/a/21964122
tagged with: sockets
has body: If I have client server application written in java, the client is jApplet and the server is server class the use Socket to listen to any coming request, and also used thread. The communication between client and server is object serializable classes. Japplet uses localhost and port 8080 to connect to the server. Now if I want to deploy this client server application to external server, where I have to add the server class, is it under Public_html folder, or under www? the external server has tomcat use 8080 and it is installed under /var/lib, and also has port 80 for regular HTTP request. And where to add jApplet client class so it can be accessible by the user.
has comment: http://stackoverflow.com/comment/33306392
has title: Deploying japplet client Server application to external server

http://stackoverflow.com/comment/33161937
type: Comment
type: QuestionComment
has text: `Fish fish = fishesCaught;` in `giveAwayFish` should give you a compilation error.
score: 0
comment on: http://stackoverflow.com/q/21897794

http://stackoverflow.com/comment/33194938
score: 1
comment on: http://stackoverflow.com/q/21916696
has text: The format for `if` is `if (<expression>)`. You have `if <expression>`.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21949596
type: AcceptedAnswer
downvote count: 0
has body: Generics don't work with primitive types. The Stream.of method is declared as static &lt;T&gt; Stream&lt;T&gt; of(T... values) When you use Stream.of(ints) where ints is an int[], Java doesn't see a number of int elements (primitive types), it sees a single int[] element (which is a reference type). So the single int[] is bound as the only element in the array represented by T... values. So values becomes an int[][] and each of its elements is an int[], which print like [I@5acf9800
type: Answer
accepted answer of: http://stackoverflow.com/q/21949570
answers question: http://stackoverflow.com/q/21949570
has comment: http://stackoverflow.com/comment/33255338
score: 15
upvote count: 15

http://stackoverflow.com/comment/33392808
has text: Hi mabi, thanks. I've updated the question above with a seam-beans.xml snippet.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21974854

http://stackoverflow.com/comment/33241576
comment on: http://stackoverflow.com/q/21942637
score: 0
type: Comment
type: QuestionComment
has text: http://docs.oracle.com/javase/tutorial/java/generics/

http://stackoverflow.com/comment/33315277
type: QuestionComment
has text: what is the problem??
score: 0
comment on: http://stackoverflow.com/q/21984332
type: Comment

http://stackoverflow.com/q/21939246
downvote count: 0
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/33242455
has title: Mock any method signature with Mockito
has comment: http://stackoverflow.com/comment/33234842
type: Question
has body: Hi I have this piece of code that is not very well designed, but I'm not the owner of this code so I can't change it. public interface Car{ // This is a marker interface. } public class BigCar implements Car{ public boolean isVeryBig(){ return true;} } public class QuiteBigCar implements Car{ public boolean isVeryBig(boolean withHatchBack){ return true;} } public Pickup implements Car{ public boolean isVeryBig(boolean withHatchBack, boolean withRoofRack){ return true;} } You see the interface only exists to let me know that BigCar, QuiteBigCar and Pickup "is a" Car. Not very clever, but that's what I have to deal with. Now I have a method that receives a Car as a param and will returned a mocked version of the car. I want the mock to make sure every time isVeryBig() is called, it will return false regardless of the method signature. The problem is I don't have a common interface for all isVeryBig() methods; they all have a different signature. public Car mockMyCar(Car car){ Car mockedCar = mock(car); when(mockedCar.isVeryBig()) &lt;-- This wont work since the method doesn't exist on the interface return mockedCar; } Yes, I could cast Car into their subclass but this is not an option for me as there is too many classes that implement Car, make a instanceOf check on all implementation would make the code very nasty and I don't control new implementations of Car in the future. Any idea?
accepted answer: http://stackoverflow.com/a/21978763
tagged with: mockito
has answer: http://stackoverflow.com/a/21978763
upvote count: 7
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33325998
has comment: http://stackoverflow.com/comment/33234608
has comment: http://stackoverflow.com/comment/33242292
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33369972

http://stackoverflow.com/a/21879833
score: 0
has body: Servlet filters should do the trick with little effort. You also might want to use AOP (Aspect Oriented Programming). It comes usually withSpring Framework` along. Thus you can apply you validation not only to servlets, but also to other artifacts of your app.
type: Answer
answers question: http://stackoverflow.com/q/21879672

http://stackoverflow.com/q/21998061
type: AnsweredQuestion
tagged with: list
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33356165
upvote count: 1
has comment: http://stackoverflow.com/comment/33357135
type: Question
has answer: http://stackoverflow.com/a/22045721
has title: App Engine query, using where on a Collection
has comment: http://stackoverflow.com/comment/33350852
tagged with: jpa
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33359276
has comment: http://stackoverflow.com/comment/33425185
favorite count: 0
has body: I am developing an application using the App Engine datastore and, since Many To Many relationships are not supported I thought to use other features of the database to help myself in writing the application. I am, in fact, storing a list containing the IDs of the related objects inside every object I have to link with the other table. Note: I am using Java and JPA for everything. Here the class I use @Entity public class Book { @Id private Long id; @ElementCollection private List&lt;Long&gt; specsId = new ArrayList&lt;Long&gt;(); // ... getters &amp; setters &amp; other properties } Now I'd like to query the database filtering all the books which have in the specsId a certain value (or a combination of certain values). Right now I use Spring to manage the connection to the database so I have DAOs and Services which query the database using an entityManager. So far I tried loads of queries, starting with inverting the "in" operator which obviously didn't work select from Book b where (1, 2) in b.specsId Or tried simply to use select from Book b where b.specsId = 1 to see if it returned just the book which had at least the "1" in its specsId, but the query returned every book in the datastore. Then I found another similar question here which suggested to use select from Book b where 1 member of b.specsId but that just threw error (No meta-data for member named b on class Book Are you sure you provided the correct member name in your query?) So... Is there a way to do this using hand written queries or maybe using the functions provided by javax.persistence.EntityManager? Thank you in advance EDIT as suggested I tried also select b from Book b where b.specsId in (list) but gave me back all the elements in the Book table
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/33422684
accepted answer: http://stackoverflow.com/a/22045721
tagged with: members

http://stackoverflow.com/q/21890805
possible better answer: http://stackoverflow.com/a/21891215
answer count: 2
has comment: http://stackoverflow.com/comment/33149133
favorite count: 0
has title: Encrypt AES with C# to match Java encryption
has comment: http://stackoverflow.com/comment/33152826
tagged with: encryption
upvote count: 10
has comment: http://stackoverflow.com/comment/33153338
tagged with: aes
has answer: http://stackoverflow.com/a/21891059
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21891059
has comment: http://stackoverflow.com/comment/33149173
downvote count: 0
tagged with: rijndaelmanaged
tagged with: java
has body: I have been given a Java implementation for encryption but unfortunately we are a .net shop and I have no way of incorporating the Java into our solution. Sadly, I'm also not a Java guy so I've been fighting with this for a few days and thought I'd finally turn here for help. I've searched high and low for a way to match the way the Java encryption is working and I've come to the resolution that I need to use RijndaelManaged in c#. I'm actually really close. The strings that I'm returning in c# are matching the first half, but the second half are different. Here is a snippet of the java implementation: private static String EncryptBy16( String str, String theKey) throws Exception { if ( str == null || str.length() &gt; 16) { throw new NullPointerException(); } int len = str.length(); byte[] pidBytes = str.getBytes(); byte[] pidPaddedBytes = new byte[16]; for ( int x=0; x&lt;16; x++ ) { if ( x&lt;len ) { pidPaddedBytes[x] = pidBytes[x]; } else { pidPaddedBytes[x] = (byte) 0x0; } } byte[] raw = asBinary( theKey ); SecretKeySpec myKeySpec = new SecretKeySpec( raw, "AES" ); Cipher myCipher = Cipher.getInstance( "AES/ECB/NoPadding" ); cipher.init( Cipher.ENCRYPT_MODE, myKeySpec ); byte[] encrypted = myCipher.doFinal( pidPaddedBytes ); return( ByteToString( encrypted ) ); } public static String Encrypt(String stringToEncrypt, String key) throws Exception { if ( stringToEncrypt == null ){ throw new NullPointerException(); } String str = stringToEncrypt; StringBuffer result = new StringBuffer(); do{ String s = str; if(s.length() &gt; 16){ str = s.substring(16); s = s.substring(0,16); }else { str = null; } result.append(EncryptBy16(s,key)); }while(str != null); return result.toString(); } I'm not entirely sure why they're only passing in 16 chars at a time, but w/e. I tried the same with my c# implementation using a string builder and only sending in 16 chars at a time and got the same result as I got when I pass the entire string in at once. Here's a snippet of my c# implem…
has answer: http://stackoverflow.com/a/21891215
type: Question
has comment: http://stackoverflow.com/comment/33149009
tagged with: c#
has comment: http://stackoverflow.com/comment/33149072
has comment: http://stackoverflow.com/comment/33153192
score: 10

http://stackoverflow.com/comment/33116547
comment on: http://stackoverflow.com/q/21872802
score: 0
type: Comment
type: QuestionComment
has text: @sᴜʀᴇsʜᴀᴛᴛᴀ `i++` is `3` not `4`.

http://stackoverflow.com/q/21922943
tagged with: multidimensional-array
type: AnsweredQuestion
tagged with: java
has body: Is there a way to put a 2d array into a Hash map setup? Example of the array would be two strings {"John", "red"}, {"George", "blue} And I would want red to correspond to john etc. I know I can use a nested loop to go through every item in the 2d array but how would then set it up to add them to the hash-map hashMap.put("John", "red");
has answer: http://stackoverflow.com/a/21922993
type: Question
possible better answer: http://stackoverflow.com/a/21922980
answer count: 2
tagged with: hashmap
has answer: http://stackoverflow.com/a/21922980
has title: 2 Dimentional array with Hash-map
score: 0
accepted answer: http://stackoverflow.com/a/21922993

http://stackoverflow.com/comment/33205266
has text: Sorry, what's logcat?
type: Comment
comment on: http://stackoverflow.com/q/21922209
score: 0
type: QuestionComment

http://stackoverflow.com/q/21886949
has body: Environment: Java I want to match characters between two string, here is an example foo &lt;bar &lt;foo@bar.com&gt; xoo &lt;xoo@bar.com&gt; I need two String: foo@bar.com and xoo@bar.com I am using this regex: &lt;(.*?)> But this is returning me bar &lt;foo@bar.com and xoo@bar.com So basically I want to match characters between two Strings, but I need the internal ones. Any help is highly appreciated?
has answer: http://stackoverflow.com/a/21887019
upvote count: 3
possible better answer: http://stackoverflow.com/a/21887019
answer count: 3
has title: Regex to find internal match between two characters
favorite count: 0
has answer: http://stackoverflow.com/a/21887118
tagged with: regex
has answer: http://stackoverflow.com/a/21887017
accepted answer: http://stackoverflow.com/a/21887017
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
type: Question

http://stackoverflow.com/comment/79127811
type: QuestionComment
has text: @NickoPo thank you! that is a really good answer!
score: 0
comment on: http://stackoverflow.com/q/21889783
type: Comment

http://stackoverflow.com/q/21932023
linked to: http://stackoverflow.com/q/219585
tagged with: java
has comment: http://stackoverflow.com/comment/33221596
has title: java run cp not being recognized
tagged with: classpath
type: Question
has body: I have been trying too long to run a Java program in a server unsuccesfully. I run java -cp bin:../../lib/*:../../bin/:lib/*: Test and I get java.lang.NoClassDefFoundError: edu/uci/ics/jung/graph/UndirectedSparseGraph The class is in a .jar located in lib/ and is requested by another class located in ../../lib The weird thing is that some of the classes from other jars in lib/ are found. Only this particular one seems to be problematic. When I run it with Eclipse in my local it runs just fine. Any idea what may be happening? Thanks in advance Solution: No idea what happened. I just recompiled my jars.
has comment: http://stackoverflow.com/comment/33222484
has comment: http://stackoverflow.com/comment/33222264
has comment: http://stackoverflow.com/comment/33225111
score: 0
tagged with: command-line
answer count: 0
has comment: http://stackoverflow.com/comment/33221955
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33227414
has comment: http://stackoverflow.com/comment/33222166

tablemodel
type: Tag
tags question: http://stackoverflow.com/q/21956501
tag name: tablemodel
tags question: http://stackoverflow.com/q/21882288

http://stackoverflow.com/q/21886678
has answer: http://stackoverflow.com/a/33443722
score: 0
has title: Android ListView CHOICE_MODE_SINGLE will not set
has answer: http://stackoverflow.com/a/21916804
has comment: http://stackoverflow.com/comment/33141128
type: Question
has answer: http://stackoverflow.com/a/21886978
tagged with: java
tagged with: selector
tagged with: drawerlayout
has comment: http://stackoverflow.com/comment/33141240
tagged with: listview
has body: Here's an app that targets Android 4.1+. I want an active state on the listview. I am using code in other apps that I hae where this worked properly. Not sure what the difference is here (except for API version is higher). I have this Java: DrawerAdapter lAdapter = new DrawerAdapter(this, modeList); mDrawerList.setAdapter(lAdapter); mDrawerList.setChoiceMode(ListView.CHOICE_MODE_SINGLE); mDrawerList.setItemChecked(0, true); mDrawerList.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; arg0, View v, int pos, long id) { mDrawerList.setItemChecked(pos, true); } Drawer Layout: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;FrameLayout android:id="@+id/main_frag" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;ListView android:id="@+id/drawer_list" android:layout_width="250dp" android:layout_height="match_parent" android:layout_gravity="start" android:cacheColorHint="#ececec" android:background="@drawable/tile_repeat" android:fadingEdge="none" android:listSelector="@drawable/nav_selector" android:scrollbars="none" /&gt; &lt;/android.support.v4.widget.DrawerLayout&gt; Selector: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;!-- pressed --&gt; &lt;item android:drawable="@drawable/nav_press" android:state_activated="false" android:state_pressed="true"/&gt; &lt;!-- CHECKED --&gt; &lt;item android:drawable="@drawable/nav_active" android:state_activated="true" android:state_pressed="false" /&gt; &lt;/selector&gt; nav_active: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" &gt; &lt;solid android:color="#cecece" /&gt; &lt;…
answer count: 3
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/22003994
has title: Computing e^x using recursion and taylor series
upvote count: 1
has body: So I am required to recursively calculate e^x using a factored form of a Taylor series: equation: e^x = 1 +x + (x^2)/2! + ... + ((x^n)/n!)) factored form: e^x = 1 + x (1+x/2*(1+x/3*(...(1+x/n)))) In the function definition below, 'x' is the power and 'n' is the total number of terms to estimate e^x. I would prefer if someone could point me in the right direction. I have tried many different ways, including using a base case of the innermost term of the factored equation, but to no avail. static double eThree(double x, long n) { //this is what i tried if(n==0){ return 1 +x/n; }else{ double a= (1+(x/n)) * (eThree(x,n-1)); System.out.println(a); return a; } } I have realized that 'n' should increase not decrease as I have attempted, however, the original call to the function has the total number of iterations in variable 'n' and there is no way to keep track of the total number of iterations throughout all the recursive calls. the value of each term's divisor in (1 +(x/n)), where n is the divisor, should increase by one each time, and in the final iteration be equal to the total number of iterations.
downvote count: 1
type: Question
tagged with: recursion
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22004159
tagged with: taylor-series
answer count: 1
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/33350808
accepted answer: http://stackoverflow.com/a/22004159

http://stackoverflow.com/comment/33344734
score: 0
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis, I'm not sure why, but when I added that line and compiled, I started getting the expected output. When I removed the line again, I kept on getting expected output, even for my original test case. Do you know if there's a reason for that, or was I just overlooking something?
comment on: http://stackoverflow.com/q/21998553

http://stackoverflow.com/a/21882861
has comment: http://stackoverflow.com/comment/33200950
type: Answer
has comment: http://stackoverflow.com/comment/33175368
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21843595
has body: Check that metadata-complete is disabled in your deployed application. You can do this from WAS ND Console: Enterprise Applications &gt; Your App &gt; Metadata for modules &gt; Uncheck the metadata-complete attribute checkbox, Synchronize with the Node and restart your App. If this doesn't do the work uninstall/reinstall the application but be careful to set metadata-complete as disabled during the deployment.
downvote count: 0

http://stackoverflow.com/comment/33167967
has text: @rajeev ask a clearer question then...
type: Comment
comment on: http://stackoverflow.com/a/21895538
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33173768
type: Comment
type: QuestionComment
score: 1
has text: `SELF_SIGNED` is deprecated. Have a look at [Digital Signatures for PDF documents](http://itextpdf.com/book/digitalsignatures), *A White Paper by Bruno Lowagie (iText Software)* for the current API. I would advice against using old 2.1.x iText versions as they are... *really old*.
comment on: http://stackoverflow.com/q/21886800

http://stackoverflow.com/q/21948944
possible better answer: http://stackoverflow.com/a/21949087
type: AnsweredQuestion
type: Question
tagged with: tostring
accepted answer: http://stackoverflow.com/a/21948976
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/21949087
tagged with: class
has title: using an inherited/extended concrete class name in a toString()
score: 0
has answer: http://stackoverflow.com/a/21948976
answer count: 2
has body: Hi everyone at the moment, my toString() looks like this: public String toString () { return ("A " + size + "cm " + weight + "kg Fish" ); } which prints out something like this: "A 16cm 0.2kg Fish" I am looking for it print out something like this: "A 16cm 0.2kg Bass", where Bass inherits its attributes from a NonEndangeredFish class which inhertis its attributes from a Fish class. The to String is currently located in the Fish class. This is the Fish class: public abstract class Fish { // Any fish below this size must be thrown back into the lake public static int THROW_BACK_SIZE = 18; public static float WEIGHT_LIMIT = 10; protected float weight; protected int size; public Fish(int aSize, float aWeight) { size = aSize; weight = aWeight; } public boolean isDesirableTo(Fisher f) { if(canKeep() &amp;&amp; f.numFishCaught &lt; f.LIMIT &amp;&amp; this.weight + f.sumOfWeight &lt; WEIGHT_LIMIT) { return true; } else { return false; } } public abstract boolean canKeep(); public int getSize() { return size; } public float getWeight() { return weight; } public String toString () { return ("A " + size + "cm " + weight + "kg" ); } this is the superclass. An EndangeredFish class and a NonEndangeredFish class extends the Fish class (which are both abstract). Then a Perch class and Bass class extend the NonEndangeredFish class and the AtlanticWhiteFish class and the AuroraTrout class extends the Endangered class. my question is how would I use a class name in a toString()? I tried declaring a string in the Perch, AuroraTrout, AtlanticWhiteFish and Bass called name and using it in the toString and it did not work, then I tried declaring a name (a String) in the fish class and then making a constructor with three parameters but that didnt work so Im really stuck. This is how a fish is added: public class FishingTestProgram2 { public static void main(String [] args) { // Create a big lake with 15 fish Lake weirdLake = new Lake(15); weirdLake.add(new AuroraTrout(76, 6.1f)); weirdLak…

http://stackoverflow.com/comment/33159319
has text: but in this situation i can only use charAt, length, indexOf, substring..no other methods allowed, also no loops.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21896303

http://stackoverflow.com/comment/33299634
comment on: http://stackoverflow.com/q/21974806
type: Comment
score: 0
type: QuestionComment
has text: @rcook handleSelection is only called when the enter button is pressed, which is not when the error occurs.

http://stackoverflow.com/q/21885178
tagged with: weld
type: AnsweredQuestion
has title: Mixing Powermock with Weld?
has comment: http://stackoverflow.com/comment/33167838
accepted answer: http://stackoverflow.com/a/21902645
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33143543
tagged with: mockito
score: 4
has body: We have a project that uses Weld-SE for dependency injection static native methods to call a native library When writing unit tests, in order to test managed beans that interact with the native library, we'd like to mock the class on which they're defined. However, PowerMock (specifically, the annotation @PrepareForTest) seems to mess with Weld's initialization. For example, if I have the following: @RunWith(PowerMockRunner.class) @PrepareForTest(StaticNativeAPI.class) public class Test { @Before public void setup() { WeldContainer wc = new Weld().initialize(); } } then Weld will fail to initialize with the following error: org.jboss.weld.exceptions.DeploymentException: WELD-001423 Cannot enable the same alternative bean class [com.mycompany.AltBean in jar:file:/C:/Users/Me/.m2/repository/com/mycompany/project/version-SNAPSHOT/project-version-SNAPSHOT-tests.jar!/META-INF/beans.xml@8, com.mycompany.AltBean in jar:file:/C:/Users/Me/.m2/repository/com/mycompany/project/version-SNAPSHOT/project-version-SNAPSHOT-tests.jar!/META-INF/beans.xml@8] in beans.xml at org.jboss.weld.manager.Enabled.createMetadataMap(Enabled.java:123) at org.jboss.weld.manager.Enabled.&lt;init&gt;(Enabled.java:94) at org.jboss.weld.manager.Enabled.of(Enabled.java:79) at org.jboss.weld.bootstrap.BeanDeployment.&lt;init&gt;(BeanDeployment.java:114) at org.jboss.weld.bootstrap.WeldBootstrap$DeploymentVisitor.visit(WeldBootstrap.java:184) at org.jboss.weld.bootstrap.WeldBootstrap$DeploymentVisitor.visit(WeldBootstrap.java:153) at org.jboss.weld.bootstrap.WeldBootstrap.startContainer(WeldBootstrap.java:284) at org.jboss.weld.bootstrap.api.helpers.ForwardingBootstrap.startContainer(ForwardingBootstrap.java:42) at org.jboss.weld.environment.se.Weld.initialize(Weld.java:129) at com.mycompany.Test.setup(Test.java:58) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.inv…
upvote count: 4
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21902645
favorite count: 0
tagged with: cdi
tagged with: powermock

http://stackoverflow.com/a/21865825
has comment: http://stackoverflow.com/comment/33105261
has comment: http://stackoverflow.com/comment/33105956
answers question: http://stackoverflow.com/q/21865095
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/33105097
has body: The code in your question looks thread-safe because: Class Bar uses AtomicLong which is atomic and thread-safe. The CopyOnWriteArraySet is thread-safe as well (it copies whole array on every write operation). So it all is thread-safe, you will not get ConcurrentModificationException, and the result of this code is predictable, because the collection you iterate through is in fact immutable.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33108612
accepted answer of: http://stackoverflow.com/q/21865095
type: Answer

http://stackoverflow.com/comment/33385949
type: Comment
score: 2
comment on: http://stackoverflow.com/a/21984687
type: AnswerComment
has text: @Vignesh hte conclusion is, that you can't modify the user agent of the webbrowser by javascript. So vaadin can't do what you request (Nor any other web application based on JS)

http://stackoverflow.com/q/21935256
has body: I have created Struts 2 database application. In this one using Query I made Ajax call to the Struts 2 action. The problem is whenever I hit the submit button, it will trigger the Ajax call, but Ajax call is not properly hit the server action class URL. Every time I got 404 exception in browser. How to resolve this problem? this is my js file : $(document).ready(function(e){ $("#loginPage_emailid").blur(function () { console.log("OnBlur() EmailId"); var emailId=$("#loginPage_emailid").val(); console.log("emailId ------- "+emailId); if(emailId != null && emailId.length != 0 && typeof emailId != 'undefined' && emailId != "InvalidEmailId"){ FormValidator.prototype.validateEmailId(emailId); } else{ $("#loginPage_emailid").val("InvalidEmailId"); return false; } }); $("#loginPage_emailid").click(function () { var emailId=$("#loginPage_emailid").val(); if( emailId == "InvalidEmailId"){ $("#loginPage_emailid").val("EmailID"); } }); $("#loginPage_password").blur(function () { var password=$("#loginPage_password").val(); if( password != "InvalidPassword"){ $("#loginPage_password").val("Password"); } }); $("#loginPage_password").blur(function () { var password=$("#loginPage_password").val(); console.log("password ------- "+password); if(password != null && password.length != 0 && typeof password != 'undefined' && password != "InvalidPassword"){ FormValidator.prototype.validatePassword(password); } else{ $("#loginPage_password").val("InvalidPassword"); return false; } }); $("#loginPage_form").submit(function () { console.log("Submit !!!!"); if(!FormValidator.prototype.isValidEmailId || !FormValidator.prototype.isValidPassword){ console.log("@#$%^&#$%^&@#%*@#$%&*#^&*#$%&*($%&*("); if(!FormValidator.prototype.isValidEmailId){ $("#loginPage_emailid").val("InvalidEmailId"); } if(!FormValidator.prototype.isValidPassword){ $("#loginPage_password").val("InvalidPassword"); } return false; } else{ console.log("Success full submit"); var jsonData={}; jsonData.emailId=FormValidator.protot…
type: Question
answer count: 2
tagged with: jsp
tagged with: jquery
linked to: http://stackoverflow.com/q/18419661
tagged with: struts2
tagged with: ajax
has title: 404 exception in browser when making jQuery Ajax call from JSP page to Struts 2 action
score: 0
linked to: http://stackoverflow.com/q/17071499
has answer: http://stackoverflow.com/a/21953322
has answer: http://stackoverflow.com/a/21951465
has comment: http://stackoverflow.com/comment/33247848
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/17757947

http://stackoverflow.com/q/21882343
tagged with: swing
has answer: http://stackoverflow.com/a/21883705
type: AnsweredQuestion
tagged with: java
has title: How to set the JGoodies Look and Feel?
tagged with: look-and-feel
accepted answer: http://stackoverflow.com/a/21883623
type: Question
score: 9
answer count: 2
possible better answer: http://stackoverflow.com/a/21883705
has body: I added the jgoodies-looks-2.5.3.jar to my buildpath and started it with public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { UIManager.setLookAndFeel("com.jgoodies.looks.windows.WindowsLookAndFeel"); ExpenseManagerGUI frame = new ExpenseManagerGUI(); } catch (Exception e) { e.printStackTrace(); } } }); } But I get the following Error: (How to fix this?) Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/jgoodies/common/base/SystemUtils at com.jgoodies.looks.common.ShadowPopupFactory.install(ShadowPopupFactory.java:116) at com.jgoodies.looks.windows.WindowsLookAndFeel.initialize(WindowsLookAndFeel.java:199) at javax.swing.UIManager.setLookAndFeel(Unknown Source) at javax.swing.UIManager.setLookAndFeel(Unknown Source) at de.mayerhofersimon.expensemanager.ExpenseManagerGUI$2.run(ExpenseManagerGUI.java:94) 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) at java.awt.EventDispatchThread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: com.jgoodies.common.base.SystemUtils 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(U…
has answer: http://stackoverflow.com/a/21883623
favorite count: 0
tagged with: jgoodies
upvote count: 9
downvote count: 0
tagged with: embedded-resource

http://stackoverflow.com/comment/33174235
type: AnswerComment
comment on: http://stackoverflow.com/a/21905036
type: Comment
has text: @kdoteu - if you have only static utility methods, your unit tests should test just them! There is nothing what you really could test on a private constructor. You may write a test that (mis)uses some reflection magick to test if all constructors are private, but this gains you next to nothing.
score: 0

http://stackoverflow.com/q/21942116
downvote count: 0
tagged with: java
type: Question
tagged with: primefaces
tagged with: javascript
possible better answer: http://stackoverflow.com/a/21942359
upvote count: 2
tagged with: jsf-2
has answer: http://stackoverflow.com/a/21942359
answer count: 2
accepted answer: http://stackoverflow.com/a/21948101
favorite count: 0
has body: I'm trying to implement primefaces' RemoteCommand tag to my application, but somehow it doesn't work as the docs say. What I'm trying to implement: I have a several pages with different layouts, but all are using the same JSF Template. (Basically the content of the template changes). The different pages should load automatically though, one after another, one by one, with an interval between one another. &lt;p:remoteCommand name="remoteSwitchPage" actionListener="#{circuitBean.redirect()}" autoRun="false"/&gt; This is my JSF code, which should supply me with a JavaScript method called remoteSwitchPage(), but it does not! It should also not run, because I've said autoRun="false", but it runs on load! After calling the method remoteSwitchPage() it should render another page via Java (This one works actually. Somehow JSF wouldn't find the redirect method when leaving the brackets, that's why I've put them). So summarized: JavaScript does not supply me with the remoteSwitchPage() The remoteCommand runs on page load, which it should not! JSF won't find my ManagedBean method resize(), when leaving the brackets Do you guys got any clue what I am doing wrong here? I'm using primefaces 4.0 and JSF 2.1
has title: JSF & Primefaces - RemoteCommand not working properly
has answer: http://stackoverflow.com/a/21948101
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/33142630
type: QuestionComment
comment on: http://stackoverflow.com/q/21865627
score: 0
has text: @Hot Licks: sorry. by "raw form" i mean without having to output it as a string. I guess the more I learn the more I realize there's no such thing as a legible version of an array. So I think I'm answering my own question. Ultimately, to see an array it has to be converted to a string, correct?
type: Comment

http://stackoverflow.com/a/21844134
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21843892
score: 1
upvote count: 1
has body: As you are using JOptionPane you can use html inside to give it format. Make an Employee class and make it's natural order by type, or you can use a Comparator if you don't want to use Comparable I made a complete example for you. import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.swing.JOptionPane; public class Employee implements Comparable<Employee> { private String type; private String name; public Employee(String type, String name) { super(); this.type = type; this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Employee other = (Employee) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (type == null) { if (other.type != null) return false; } else if (!type.equals(other.type)) return false; return true; } public int compareTo(Employee o) { if (this.type.equals(o.type)) { return name.compareTo(o.name); } return type.compareTo(o.type); } public static void main(String[] args) { List<Employee> employees = new ArrayList<Employee>(); employees.add(new Employee("CA","John")); employees.add(new Employee("CA", "Suzy")); employees.add(new Employee("TA","Malcom")); employees.add(new Employee("AA","Rose")); // Sort the list by type as its natural order or use proper Comparator Collections.sort(employees); StringBuilder sb = new StringBuilder(); sb.append(" Type Name "); for (Employee e : employees) { sb.append(" "); sb.append(" ").append…

http://stackoverflow.com/a/21965354
upvote count: 1
has body: Here's a sample code I wrote which can help you understand the concept: import java.util.Random; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * We want a Producer thread to create random values, and the Consumer thread to * consume it. One caveat is that if the Producer has already created a random * value, which the Consumer thread hasn't consumed yet, the Producer thread * blocks or waits. On the flip side, the Consumer thread waits for the Producer * thread to produce some value if the Producer thread hasn't already. * * Write a program to simulate such a situation. */ public class ProducerConsumerCommunication { private volatile boolean running = true; private ArrayBlockingQueue&lt;Integer&gt; buffer = new ArrayBlockingQueue&lt;&gt;(1); private Random random = new Random(System.currentTimeMillis()); private class ProducerTask implements Runnable { public void run() { while (running) { try { Thread.sleep(random.nextInt(2000)); Integer value = random.nextInt(); buffer.put(value); // Blocks if buffer is full. System.out.println("Value Put: " + value); } catch (InterruptedException e) { e.printStackTrace(); } } } } private class ConsumerTask implements Runnable { public void run() { while (running) { try { Thread.sleep(random.nextInt(2000)); Integer value = buffer.take(); // Blocks if buffer is empty. System.out.println("Value Taken: " + value); } catch (InterruptedException e) { e.printStackTrace(); } } } } public ProducerConsumerCommunication() { ExecutorService service = Executors.newCachedThreadPool(); service.execute(new ProducerTask()); service.execute(new ConsumerTask()); service.shutdown(); } public static void main(String[] args) { new ProducerConsumerCommunication(); } }
downvote count: 0
answers question: http://stackoverflow.com/q/21965293
type: Answer
score: 1

http://stackoverflow.com/comment/33352771
score: 0
has text: All problems solved :D . Please give me your real name so that I can include you in the credits. If you have a website/blog give me the link please!
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22004264

http://stackoverflow.com/comment/33142164
score: 0
type: AnswerComment
type: Comment
has text: @Radiodef added a bit more detail. Hope it can help anyone in need of it.
comment on: http://stackoverflow.com/a/21886902

http://stackoverflow.com/comment/33442859
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21972603
score: 0
has text: Could this be the response (ATQA) to the REQA command which delivers 2 bytes?

http://stackoverflow.com/q/21855082
linked to: http://stackoverflow.com/q/18973185
has answer: http://stackoverflow.com/a/26094438
downvote count: 0
possible better answer: http://stackoverflow.com/a/57552072
has answer: http://stackoverflow.com/a/57552072
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33084114
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23435194
has comment: http://stackoverflow.com/comment/33084109
type: Question
has comment: http://stackoverflow.com/comment/33085563
score: 3
accepted answer: http://stackoverflow.com/a/23435194
has body: I'm trying to minimize all open applications, and using the following code: public class Test { public static void main(String args[]) throws Exception{ Runtime.getRuntime().exec (new String[] { "cmd.exe", "/c", "\"" + System.getenv("APPDATA") + "\\Microsoft\\Internet Explorer\\Quick Launch\\Show Desktop.scf" + "\"" }); } } When I run the code, nothing happens. I'm using Windows 7, when I open Internet Explorer the PC crash from some virus reason (maybe there is a connection?)
has title: Minimize all applications
answer count: 3

http://stackoverflow.com/a/21988566
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21988004
has body: Updated and corrected my answer: In my own library Time4J (v1.2) a pattern-based solution ready for Java 6 and later looks like: Duration&lt;?&gt; dur = Duration.of(37540, ClockUnit.SECONDS).with(Duration.STD_CLOCK_PERIOD); String s = Duration.Formatter.ofPattern("hh:mm:ss").format(dur); System.out.println(s); // 10:25:40 In Joda-Time following code is possible using a builder approach: PeriodFormatter f = new PeriodFormatterBuilder().appendHours().appendLiteral(":").appendMinutes() .appendLiteral(":").appendSeconds().toFormatter(); System.out.println("Joda-Time: " + f.print(new Period(37540 * 1000))); // 10:25:40 My previous posted solution was a field-based-workaround (using the field SECOND_OF_DAY) which has a serious disadvantage, namely to be limited to seconds less than 86400 (day-length). The accepted answer using old Calendar-code suffers from this bug, too, so it is not a real solution. In Java-8 (containing a new time library - JSR-310) there is also no solution available because it still misses the possibility to format durations. Sample outputs of the different proposals: input = 337540 seconds (almost 4 days) code of accepted solution =&gt; 21:45:40 (WRONG!!!) Time4J-v1.2 =&gt; 93:45:40 Joda-Time =&gt; 93:45:40 Conclusion, use an external library for solving your problem.

http://stackoverflow.com/a/21901482
has body: The difference resides not in the OutputStreams but in the write methods you are using: they differ. In your first example you use dp.write() and in your second example you use dp.writeChar(). Change dp.writeChar() to dp.write() in your second example and the results will be as expected. java.io.DataOutputStream.writeChar(int) method is implemented as follows: public final void writeChar(int v) throws IOException { out.write((v &gt;&gt;&gt; 8) &amp; 0xFF); out.write((v &gt;&gt;&gt; 0) &amp; 0xFF); incCount(2); } See soource code of writeChar(int) while java.io.DataOutputStream.write(int) has following implementation: public synchronized void write(int b) throws IOException { out.write(b); incCount(1); } See soource code of write(int)
type: Answer
accepted answer of: http://stackoverflow.com/q/21901251
answers question: http://stackoverflow.com/q/21901251
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33167863
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33168235

http://stackoverflow.com/a/21890356
type: AcceptedAnswer
downvote count: 0
has body: You should: Make sure the filenames are correct (Animal.java and MammalInt.java - the same as the class names with .java file extension) Make sure they are both in a directory called animals (same as the package name) Make sure they both have package animals; at the top of the files Compile tham at the same time with the command javac Animal.java MammalInt.java That works.
has comment: http://stackoverflow.com/comment/33148647
type: Answer
has comment: http://stackoverflow.com/comment/96489726
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/21890226
answers question: http://stackoverflow.com/q/21890226

http://stackoverflow.com/a/21983892
answers question: http://stackoverflow.com/q/21983230
type: Answer
downvote count: 1
has body: Make the default values in DB side. If you want to use it in entity mapping just set default value as below private String sourceFrom ="Case";
score: -1
upvote count: 0

http://stackoverflow.com/comment/33063717
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21843074
type: AnswerComment
has text: So rather than initializing like: ig.setup(...) I should initialize it with com.(..)?

http://stackoverflow.com/q/21866028
has comment: http://stackoverflow.com/comment/33105294
tagged with: math
tagged with: java
has title: Math Values not Calculating Properly
type: Question
has comment: http://stackoverflow.com/comment/33104686
has body: For some reason, I am getting different mathematical values than I should be. What am I doing wrong here? Code: overtimeHours = hoursWorked - 40; regularPay = hourlyWage * hoursWorked - overtimeHours; overtimePay = 1.5 * hourlyWage * overtimeHours; totalPay = hourlyWage * hoursWorked + overtimePay; Output: Please enter employee's name: John Please enter The Dragon's hourly wage: 22.50 Please enter how many hours The Dragon worked: 48.5 John's Wages Regular Pay: $ 1082.75 Overtime Pay: $ 286.88 Total Pay: $ 1378.13
has comment: http://stackoverflow.com/comment/33104565
has comment: http://stackoverflow.com/comment/33104711
has answer: http://stackoverflow.com/a/21866075
score: 0
has comment: http://stackoverflow.com/comment/33104605
answer count: 1
has comment: http://stackoverflow.com/comment/33104461
tagged with: system.out
has comment: http://stackoverflow.com/comment/33104487
accepted answer: http://stackoverflow.com/a/21866075
type: AnsweredQuestion

http://stackoverflow.com/comment/33226706
comment on: http://stackoverflow.com/a/21934461
type: AnswerComment
score: 0
has text: Have you tried to install the lib ? It should work with it installed
type: Comment

http://stackoverflow.com/comment/33251164
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21948225
has text: I don't know android, but I suggest that you mention the line which throws a NPE.
score: 1

http://stackoverflow.com/q/21846967
has title: Trigger Prolific Barcode Scanner device from Android
upvote count: 1
type: Question
has body: Sorry for my Bad English. I am using Prolific device to which I need to pass command and read data.I want to read and write data to com port. I referred code given in pl2303driver.jar library that I got with SDK provided here http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=230&amp;pcid=41. If I scan something from Bar code scanner I am able to read that data from com port. If I write some data to device write method returns number of bytes that were written. No problem about that. But I want to send command to device that will glow light of Bar code scanner and will scan bar code. I used USB Serial Terminal Lite application.If I give command #55#30#41#AA, USB Serial Terminal Lite triggers Bar code Scanner. Same thing I want in my application.I tried with #55#30#41#AA, 0x55, 0x30, 0x41, 0xAA commands given in Documentation.But they does not work. I think I am missing particular command that will trigger bar code scanner. I am posting some code here. PL2303Driver mSerial; private static final String ACTION_USB_PERMISSION = "com.prolific.pl2303hxdsimpletest.USB_PERMISSION"; mSerial = new PL2303Driver((UsbManager) getSystemService(Context.USB_SERVICE),this, ACTION_USB_PERMISSION); Code for method read: private void readDataFromSerial() { int len; byte[] rbuf = new byte[4096]; StringBuffer sbHex=new StringBuffer(); Log.d(TAG, "Enter readDataFromSerial"); if(null==mSerial) return; if(!mSerial.isConnected()) return; len = mSerial.read(rbuf); if(len&lt;0) { Log.d(TAG, "Fail to bulkTransfer(read data)"); return; } if (len &gt; 0) { if (SHOW_DEBUG) { Log.d(TAG, "read len : " + len); } for (int j = 0; j &lt; len; j++) { sbHex.append((char) (rbuf[j]&amp;0x000000FF)); } etRead.setText(sbHex.toString()); Toast.makeText(this, "len="+len, Toast.LENGTH_SHORT).show(); } else { if (SHOW_DEBUG) { Log.d(TAG, "read len : 0 "); } etRead.setText("empty"); return; } try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } Log.d(TAG, "Leave readDataFromSerial"); …
has answer: http://stackoverflow.com/a/21932055
score: 1
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/33196309
type: Comment
comment on: http://stackoverflow.com/a/21856196
has text: Thank you for your fast response.Your solution seems to be correct,thank you.Could you help me also get zoom in/zoom out functions?Also how can I add points to you for your quick answer :) Regards
score: 0
type: AnswerComment

http://stackoverflow.com/q/21883470
tagged with: java
has comment: http://stackoverflow.com/comment/33135101
has body: I am working on a problem which requires me to tokenize a string on the basis of white spaces except those which occur inside quotation marks. For example for the string : printf ( " the quick brown fox " ) ; The tokens generated should be: printf, (, ", the quick brown fox , ", ), ; So far I came up with the following code but it does not seem to do what I intend it to. String m = "printf ( " the quick brown fox " ) ;" String [] tokens = m.split("([^\"])(\\w)*(\\s)(\\w)*([^\"])"); Any help would be really appreciated !
type: Question
linked to: http://stackoverflow.com/q/7804335
has comment: http://stackoverflow.com/comment/33135089
duplicate of: http://stackoverflow.com/q/7804335
score: 0
has title: Java - Regular Expression for tokenzing a string based on white spaces not inside ""
type: UnansweredQuestion
tagged with: regex
tagged with: tokenize
answer count: 0

http://stackoverflow.com/q/21973067
answer count: 1
tagged with: database
has answer: http://stackoverflow.com/a/21973134
score: -1
accepted answer: http://stackoverflow.com/a/21973134
has body: So i have a java project build on eclipse. The code runs fine, but whenever the application has to access the database it says : Unable to access the database This is the only error that eclipse displays... I don't seem to understand where the problem is coming from. I have already imported the odcb driver in the referenced libraries and i have the connector ODCB installed... The database is a .mdb file... Here is part of the code... Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); final String fileName = "C:/Users/User1/Desktop/centrallab.mdb"; String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="+fileName; localConnection = DriverManager.getConnection(url,"",""); localStatement = localConnection.createStatement();
tagged with: ms-access
favorite count: 0
downvote count: 1
has title: Error when using ODCB to access.mdb database on eclipse?
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
upvote count: 0

http://stackoverflow.com/q/21985283
type: Question
has answer: http://stackoverflow.com/a/42505048
has comment: http://stackoverflow.com/comment/33354095
accepted answer: http://stackoverflow.com/a/22007280
score: 0
has comment: http://stackoverflow.com/comment/33355057
answer count: 3
has body: i am getting errors when using @Requestmapping in LoginController.java. Getting errors like Multiple markers at this line - The attribute value is undefined for the annotation type RequestMapping - RequestMethod cannot be resolved to a variable - The attribute method is undefined for the annotation type RequestMapping - RequestMapping cannot be resolved to a type and some other errors also. Please check bean.xml file also. LoginController.java package control; import model.User; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.ui.ModelMap; @Controller public class LoginControl{ private ApplicationContext context = null; private UserJDBCTemplate userJDBCTemplate = null; public LoginControl(){ context = new ClassPathXmlApplicationContext("Beans.xml"); userJDBCTemplate = (UserJDBCTemplate)context.getBean("userJDBCTemplate"); } @RequestMapping(value = "/login", method = RequestMethod.GET) public ModelAndView userLogin() { return new ModelAndView("login", "command", new User()); } @RequestMapping(value = "/loginCheck", method = RequestMethod.POST) public String checkUser(@ModelAttribute("SpringWeb")User user, ModelMap model) { model.addAttribute("username", user.getUsername()); if(userJDBCTemplate.checkLogin(user)){ return "loginsuccess"; } return "loginerror"; } @RequestMapping(value = "/add", method = RequestMethod.GET) public ModelAndView userAdd() { return new ModelAndView("add", "command", new User()); } @RequestMapping(value = "/addUser", method = RequestMethod.POST) public String addUser(@ModelAttribute("SpringWeb")User user, ModelMap model) { model.addAttribute("username"…
has answer: http://stackoverflow.com/a/21991091
tagged with: spring
has title: getting errors while using annotations in spring
possible better answer: http://stackoverflow.com/a/21991091
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33354312
has answer: http://stackoverflow.com/a/22007280

http://stackoverflow.com/a/21931494
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/21931233
upvote count: 1
has body: I think the right approach will be to use the new keyword, after all, that's it's role. The way you are using Beans seems a bit forced since you know what type of class you wish to instantiate. Second, since this is a swing application, most probably you are using default swing classes (maybe extending some of them). Another problem with this approach is that you must have a constructor without args in your class. Class.forName() can be used for the same thing as the code above, but if you don't want to dynamically create a class at runtime, stick with the new keyword.

http://stackoverflow.com/comment/33194964
type: Comment
has text: it was empty because everything i entered resulted in failure :3 thanks for your help
type: AnswerComment
comment on: http://stackoverflow.com/a/21916230
score: 0

http://stackoverflow.com/comment/33359326
type: Comment
type: QuestionComment
has text: By the way: changing the property to read-only isn't necessary if you're flattening the form anyway.
score: 1
comment on: http://stackoverflow.com/q/21994399

http://stackoverflow.com/q/21966176
has comment: http://stackoverflow.com/comment/33283861
tagged with: android
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21966231
has comment: http://stackoverflow.com/comment/33283983
tagged with: database
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33283739
score: 0
has title: Upgrade in SQLite seems not working in my App
has body: I'm following a beginner tutorial of SQLite for a mobile application and still I'm having a problem with the output. The data will be shown on a ListView but everytime I run it from my Eclipse to my phone the data is being added instead of having a list of 3 everytime I run the application from the Eclipse it will then have an output with a list of 6, 9, 12, 15 and so on. I guess the old table is not being drop by the SQLite upgrade. I'm having the following codes in my database: public class DatabaseHandler extends SQLiteOpenHelper { //all static variables; database version private static final int DATABASE_VERSION = 1; //database name private static final String DATABASE_NAME = "devicesqlite.db"; //Tag for Logcat private static final String LOGCAT = null; //for the switch //same in ControllerTab private final static Integer[] ids = { R.id.switch1, R.id.switch2, R.id.switch3 }; public DatabaseHandler(Context applicationContext) { //super(context, name, factory, version); super(applicationContext, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { //String CREATE_DEVICES_TABLE = " CREATE TABLE " + TABLE_DEVICES + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_NAME + " TEXT" + ")"; String createQuery = "CREATE TABLE devices ( deviceID INTEGER PRIMARY KEY, deviceName TEXT)"; db.execSQL(createQuery); Log.d(LOGCAT, "TABLE devices CREATED"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { //drop older table if existed String dropQuery = ("DROP TABLE IF EXISTS devices"); db.execSQL(dropQuery); onCreate(db); //create tables again } //adding new device public void addDevice(Device device) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put("deviceName", device.getName()); db.insert("devices", null, values); //inserting row db.close(); } //getting all devices public ArrayList&lt;HashMap&lt;String, String&gt;&gt; getAllDevices() { ////ArrayList&…
tagged with: sqlite
linked to: http://stackoverflow.com/q/21881992
answer count: 1
has comment: http://stackoverflow.com/comment/33283764

http://stackoverflow.com/a/35161594
type: Answer
answers question: http://stackoverflow.com/q/21951482
has body: I recently encountered a similar problem, and mine was caused by having public methods with an @ApiMethod. To fix this I re-factored my code to make the methode private. But I could have added a line like this before the new method: @ApiMethod(name = "yourNewPublicMethod", path = "profile", httpMethod = HttpMethod.POST)
score: 0

http://stackoverflow.com/comment/33179490
comment on: http://stackoverflow.com/q/21905353
has text: This question appears to be off-topic because it is about math
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33117217
comment on: http://stackoverflow.com/a/21872708
type: Comment
score: 1
has text: http://www.tutorialspoint.com/spring/spring_mvc_form_handling_example.htm In this example .. `Student.java` is `bean` In controller class the calling of `getters of parameters` please refer
type: AnswerComment

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/21866342
type: Tag

http://stackoverflow.com/q/21993438
has answer: http://stackoverflow.com/a/21993997
answer count: 3
has comment: http://stackoverflow.com/comment/33331498
has answer: http://stackoverflow.com/a/21993549
type: UnansweredQuestion
tagged with: java
tagged with: methods
has title: How to call a method within a method
has body: While this may be incredible simple, I am having trouble with it. I had to create a Fahrenheit to Celsius, and Celsius to Fahrenheit converter. The assignment after this one is to: In the main method declare a variable of type double and initialize it to a value. 3. Add a line in the main that calls the fToC method and passes as its argument the variable declared in step 2. I know that too declare a variable and set it to a number, I will have to do this: double var = 0; But I do not know how to call in the method in this. I tried calling the method, but it seems to be improper format, and I can not find how to properly do it (Googled quite a bit :( ) import java.util.Scanner; public class ExerciseOne { public static void main( String[] args ) { int choice; double variable = 0; public static float ftoC(double var) { //This line is giving me trouble System.out.println( "What would you like to do? \n \n 1 - Fahnrenheit to Celsius \n 2 - Celsius to Fahrenheit \n 3 - Quit" ); Scanner dylan = new Scanner(System.in); choice = dylan.nextInt(); if (choice == 1) { System.out.println( "What number do you want to convert to Celsius?" ); float input = dylan.nextFloat(); float output = ftoC(input); System.out.println( input + " degrees Fahrenheit is " + ftoC(input) + " degrees Celsius." ); } if (choice == 2) { System.out.println( "What number do you want to convert to Fahrenheit?" ); float input = dylan.nextFloat(); float output = ctoF(input); System.out.println( input + " degrees Celsius is " + ctoF(input) + " degrees Fahrenheit." ); } if (choice == 3) { System.out.println( "Exiting application."); } } } public static float ftoC(float f) { float celsius = (f-32)*(5f/9f); return celsius; } public static float ctoF(float c) { float fahrenheit = c*9/5 + 32; return fahrenheit; } }
type: Question
score: 0
has answer: http://stackoverflow.com/a/21993630

akka
type: Tag
tags question: http://stackoverflow.com/q/21914468
tag name: akka

http://stackoverflow.com/q/21858449
tagged with: generics
type: UnansweredQuestion
tagged with: addition
tagged with: linked-list
tagged with: java
tagged with: uml
has answer: http://stackoverflow.com/a/21858674
type: Question
has title: Is my code correct? UML-> Java translation
score: 0
answer count: 2
has body: I was just going through some examples of UML diagramms, being translated in Java, and I am stuck at this one. I am giving the diagramm as a reference: Since I am very new at Java programming there is something I don't understand in this code : why do I have to add LinkedList? What does the T:Tier at the right corner of Gehege mean? (Gehege=Zoo, Tiere=Animals in German) public class Tier { private int anzahlbeine; private String farbe; public Tier(int anzahlbeine, String farbe) { this.anzahlbeine=anzahlbeine; this.farbe=farbe; } public void laufen (double strecke) { System.out.println(strecke); } public void fressen () { System.out.println("I eat"); } } and public class Gehege &lt;T extends Tier&gt; { private int kapazitaet; private double groesse; private LinkedList&lt;T&gt; tiere; public Gehege(int kapazitaet, double groesse) { this.kapazitaet=kapazitaet; this.groesse=groesse; } public void addTier(T tier) { if (this.kapazitaet&gt;this.groesse.size) { this.tiere.add(tiere); } else { throw new Exception RunTimeException ("Full"); } } public void removeTier(T tier){ this.tiere.remove(tier);} } Better Quality image at https://i.sstatic.net/subAS.png
has answer: http://stackoverflow.com/a/21868160
has comment: http://stackoverflow.com/comment/33090459

http://stackoverflow.com/a/21996081
type: Answer
has body: int[] arr = { 1, 2, 3, 4, 5 }; Create an array and set the values. int[] arr1 = new int[5]; arr1[0] = 0; arr1[1] = 1; The first line create an array that can contains 5 values but they are not set. That is what the two last lines are doing. About performance, it depends on read and write operation, in memory it is the same size
score: 0
answers question: http://stackoverflow.com/q/21995980

http://stackoverflow.com/a/21887841
type: Answer
has body: Don't use ClickHandler on the ListBox. Use ChangeHandler instead. Also, I don't think you need to mess with Elements here. Simply add your Button widget and your ListBox widget to a container (i.e. some panel). You can add button on top of ListBox, if you want.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21887657
has comment: http://stackoverflow.com/comment/33187698
upvote count: 2
has comment: http://stackoverflow.com/comment/33172493

http://stackoverflow.com/comment/117531953
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21879767
has text: The correct answer, in these days, is to cast to JsonString then use getString() method.

http://stackoverflow.com/comment/33138028
score: 1
has text: Looks like when you have duplicated values, this condition: `if (leftmark > rightmark)` doesn't get fulfilled, thus always falling in an infinite loop.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21884858

http://stackoverflow.com/q/21921860
has title: Having trouble loading image to screen
tagged with: loading
accepted answer: http://stackoverflow.com/a/21939577
tagged with: bufferedimage
has answer: http://stackoverflow.com/a/21922968
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33273040
possible better answer: http://stackoverflow.com/a/21922968
tagged with: image
has comment: http://stackoverflow.com/comment/33236528
type: Question
score: 0
has body: I am making a game and I am stuck trying to get the image to screen. I states that- java.lang.IllegalArgumentException: input == null! at javax.imageio.ImageIO.read(Unknown Source) I am sure that my image path is the right path, but it keeps stating that it's not. background = new Background("C:/hello/flappybird.png"); The "debug" section of my workspace states that there is a problem with background.render(g); specifically, with g.drawImage(img,(int)x,(int)y,null); and I have no idea why it is doing this. I am 100% sure my build path is right! EDIT: just incase you want to know the constructor of the background class: public Background(String s) { try { img = ImageIO.read(this.getClass().getResource(s)); } catch (IOException e) { e.printStackTrace(); } }
answer count: 2
has answer: http://stackoverflow.com/a/21939577
has comment: http://stackoverflow.com/comment/33205643

http://stackoverflow.com/q/21915941
has title: calling asp webservice not working as i need
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21916213
tagged with: asp.net
has answer: http://stackoverflow.com/a/21916200
type: UnansweredQuestion
tagged with: android
tagged with: web-services
has body: I'm trying to send user and pass to asp webservice , but when getting back response get like this : so how to fix it and get true of false this is webservice link i have used : http://ictfox.com/demo/Hafil_Updates/Login_Check.aspx?UserLogin=Demo&Password=Demo 02-20 19:57:23.326: D/Http Response:(4007): True this is my full class in asyncTask android : HttpClient httpClient = new DefaultHttpClient(); // Creating HTTP Post HttpPost httpPost = new HttpPost( "http://ictfox.com/demo/Hafil_Updates/Login_Check.aspx?UserLogin=Demo&Password=Demo"); // Building post parameters // key and value pair List<NameValuePair> nameValuePair = new ArrayList<NameValuePair>(2); nameValuePair.add(new BasicNameValuePair("UserLogin", "Demo")); nameValuePair.add(new BasicNameValuePair("Password", "Demo")); // Url Encoding the POST parameters try { httpPost.setEntity(new UrlEncodedFormEntity(nameValuePair)); } catch (UnsupportedEncodingException e) { // writing error to Log e.printStackTrace(); } // Making HTTP Request try { HttpResponse response = httpClient.execute(httpPost); response.getEntity().getContentLength(); StringBuilder sb = new StringBuilder(); try { BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); String line = null; while ((line = reader.readLine()) != null) { sb.append(line); } } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } Log.d("Http Response:", sb.toString());
tagged with: java
type: Question

http://stackoverflow.com/q/22000339
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22000480
has body: Considering the annotation processing programming model, it is well established how to obtain a reference to the compiler context from within an annotation processor with something like this: context = ((JavacProcessingEnvironment) this.processingEnv).getContext(); This compiler context can be used when a reference is needed to an internal compiler facility like Attr, Enter, MemberEnter, TreeMaker, etc. via an instance method call: make = TreeMaker.instance(context); However, using the Java 8 plugin mechanism, how can one reference com.sun.tools.javac.util.Context instances? The documentation states: Within the compiler, a single Context is used for each invocation of the compiler. The context is then used to ensure a single copy of each compiler phase exists per compiler invocation. so within a plugin, whereas a reference to the JavacTask is passed (effectively BasicJavacTask), how can the context object of the current compiler phase be retrieved?
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22000480
has title: How to get the javac compiler Context from a JavacTask?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: javac
upvote count: 1
tagged with: java-8

http://stackoverflow.com/comment/33346240
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22001260
has text: 32-bit or 64-bit jvm?

http://stackoverflow.com/q/21904378
tagged with: spring
has comment: http://stackoverflow.com/comment/33173072
has body: I must link a Spring project using JPA and a localhost database. I use WAMP for this. But, I can't find any solution to solve my probleme. Somebody has a tutorial or any explication to link everything ? Cordially,
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33172691
type: Question
tagged with: jpa
upvote count: 1
tagged with: wamp
favorite count: 0
has title: Link Spring JPA and WAMP
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/21980794
accepted answer: http://stackoverflow.com/a/21984092
score: 4
type: AnsweredQuestion
has title: Performing setRGB on BufferedImage changes pixel to black instead of color
tagged with: bufferedimage
tagged with: javax.imageio
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21981173
upvote count: 4
has answer: http://stackoverflow.com/a/21984092
answer count: 2
possible better answer: http://stackoverflow.com/a/21981173
has body: ** Important update, see below! ** I am creating a program that changes the pixels of a BufferedImage to a certain color when that pixel fulfills a set of conditions in Java. However, when I write the image to disk, the pixels that should be colored are instead black. First I define the color, using RGB codes: Color purple = new Color(82, 0, 99); int PURPLE = purple.getRGB(); Then I read the image I want to alter from a File into a BufferedImage called "blank": BufferedImage blank = ImageIO.read(new File("some path")); Now, loop through the pixels, and when a pixel at location (x, y) matches a criteria, change its color to purple: blank.setRGB(x, y, PURPLE); Now, write "blank" to the disk. File output = new File("some other path"); ImageIO.write(blankIn, "png", output); // try-catch blocks intentionally left out The resulting file should be "blank" with some purple pixels, but the pixels in question are instead black. I know for a fact that the issue is with setRGB and NOT any import or export functions, because "blank" itself is a color image, and gets written to file as such. I read around and saw a lot of posts recommending that I use Graphics2D and to avoid setRGB, but with no discussion of pixel-by-pixel color changing. I also tried direct bit manipulation, like this: blank.setRGB(x, y, ((82 &lt;&lt; 16) + (0 &lt;&lt; 8) + 99)); I'm probably doing that wrong, but if I put it in correctly it wouldn't matter, because the pixels are getting set to transparent when I do this (regardless of what the numbers say, which is very strange, to say the least). ** When I try this: blank.setRGB(x, y, Color.RED.getRGB()); My output file is grayscale, so that means setRGB is, in fact, modifying my picture in grayscale. I think this is actually a rather simple issue, but the solution eludes me.
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/33099442
type: AnswerComment
has text: Isn't there some confusion between immutable objects in general and the specific case of String objects ? I thought the JVM just contained specialized mechanisms (pooling) for strings ? Is the JVM smart enough to pool any immutable objects ? Is it safe for it to assume that a programmer has correctly implemented equals and hash code for the purposes of pooling? Is there any specific language feature which marks an object 'immutable' ? The only way I have managed this in java is by carefully following certain patterns ? (Private constructor and other requirements?)
comment on: http://stackoverflow.com/a/21860716
score: 0
type: Comment

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/21955506
tags question: http://stackoverflow.com/q/21941050
tags question: http://stackoverflow.com/q/21951770
tags question: http://stackoverflow.com/q/21948142
type: Tag
tags question: http://stackoverflow.com/q/21842857
tags question: http://stackoverflow.com/q/21955338
tags question: http://stackoverflow.com/q/21844291
tags question: http://stackoverflow.com/q/21932694
tags question: http://stackoverflow.com/q/21957250

http://stackoverflow.com/a/21925876
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21924294
has body: read/replace PDF text using standard documented way i.e. through COSString (Tj and TJ operators) This "documented way" unfortunately is very misleading for two reasons: It assumes that the string parameters of Tj and TJ are encoded in some standard encoding. Actually the encoding is governed By The font and may be a completely custom-made one. Depending on the font type, the encoding may even be a multibyte encoding. It assumes letters and whole words come in the same order, unbroken, as you read them. This also need not be the case. PDF simply is not a format designed for editing content. It can be done pretty easily, though, in simply designed ones, in general, though, it is really difficult. PS: The strange output from your sample document is due to the use of a composite font using Identity-H encoding which embeds a subset of TimesNewRoman. That font does contain a ToUnicode mapping; thus, translating what you read to character data is possible. Replacing that text could be a problem , though, because only a subset is embedded; e.g. the capital letters 'I' and 'J' are not embedded and cannot be used in a replacement unless you either use a different font or possibly even add to the partial fonts. Neither of these operations is as simple as your original code. And this is not the worst imaginable scenario, sometimes there is no information on how to interpret the raw data in the string as text, the PDF only knows how to draw the glyphs.
has comment: http://stackoverflow.com/comment/33268838
has comment: http://stackoverflow.com/comment/33272573
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21924294

http://stackoverflow.com/q/21996795
has title: Rendering freemarker Chunks in java
type: Question
score: 0
has answer: http://stackoverflow.com/a/21998551
answer count: 1
tagged with: templates
tagged with: freemarker
has body: I have created a freemarker template in which I like to display 2items per row in html. example: if I have 4items I like to display 2 items/row. I have done this using Chunks of freemarker. But my problem is, I like to do a conditional check before I render the list,but not able to access "cell" value directl, when I using it is throwing following error: *freemarker.log.JDK14LoggerFactory$JDK14Logger error SEVERE: Expected hash. cell evaluated instead to freemarker.core.SequenceBuiltins$chunkBI$ChunkedSequence$1 on line 4, column 22 in shoppingPromo.ftl. The problematic instruction: ==> if cell.promoURL?? [on line 4, column 17 in shoppingPromo.ftl] * My Template <#list renderList?chunk(2) as cell> <!-- something like this <#if cell.promoURL??> --> <#list cell as keys> test </#list> </#list> Please help me to fix this.
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/33331554
type: Comment
has text: You still have THREE different variables (arr, array, and list). Please fix! Also, commenting here after I said I'd delete my comment was probably a poor choice, because now you have responded to the comment I said I'd delete. I'm gonna delete this one too after you fix your variable naming problem.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21993265

http://stackoverflow.com/comment/33347956
type: Comment
score: 0
type: AnswerComment
has text: I'm only doing it for one book, it supposed to teach about classes. I get how to do most of it, the problem is making a method that labels the book as returned and borrowed. My teacher was really vague on that part of it.
comment on: http://stackoverflow.com/a/22002329

http://stackoverflow.com/q/21938389
has body: I am attempting to use the "Hashmap" implementation for the code below. I simply want to get an element from the map and print it out to the console in eclipse. Unfortunately I keep getting this error (Exception in thread "main" java.lang.NullPointerException) printed onto the console. I don't know what I am doing wrong but I've tried allot of workarounds but I keep getting this error. Can anyone provide a solution for this? Here is my code: package repo; import java.util.*; import org.joda.time.DateTime; public class ConsoleDisplayData { // Fields static DateTime currentTime = new DateTime(); static Map&lt;Integer, String&gt; smtpSuccess = new HashMap&lt;Integer, String&gt;(); public static String step0; public static void storeSuccessData() { // Store Elements in Map smtpSuccess.put(0, "Initiating.."); smtpSuccess.put(1, "\nS: 220 smtp.localhost.com ESMTP Postfix"); smtpSuccess.put(2, "\nC: HELO relay.localhost.com"); smtpSuccess.put(3, "\nS: 250 Hello relay.localhost.com, I am glad to meet you"); smtpSuccess.put(4, "\nC: MAIL FROM:" + "&lt;" + presentation.SMTPMailClientGui.jtfSenderEmail.getText() + "&gt;" ); smtpSuccess.put(5, "\nC: RCPT TO: " + "&lt;" + presentation.SMTPMailClientGui.jtfRecepientEmail.getText() + "&gt;" ); smtpSuccess.put(6, "\nS: 354 End data with &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;"); smtpSuccess.put(7, "\nC: From: " + presentation.SMTPMailClientGui.jtfSenderName.getText() + "&lt;" + presentation.SMTPMailClientGui.jtfSenderEmail.getText() +"&gt;"); smtpSuccess.put(8, "\nC: To: Recepient Name" + "&lt;" + presentation.SMTPMailClientGui.jtfRecepientEmail.getText() +"&gt;"); smtpSuccess.put(9, "\nC: Date: " + currentTime ); smtpSuccess.put(10, "\nC: Subject: " + presentation.SMTPMailClientGui.jlSubject.getText()); smtpSuccess.put(11, "\nC: " + presentation.SMTPMailClientGui.jtaBody.getText()); smtpSuccess.put(12, "\nS: 221 End"); // Print Step 0 step0 = smtpSuccess.get(0); System.out.println(step0); } public static void main(String [] args…
has comment: http://stackoverflow.com/comment/33233336
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21938534
has comment: http://stackoverflow.com/comment/33233136
has comment: http://stackoverflow.com/comment/33233232
has comment: http://stackoverflow.com/comment/33233817
has title: Why do I keep getting this error at runtime? Exception in thread "main" java.lang.NullPointerException
tagged with: java
has comment: http://stackoverflow.com/comment/33233259
has comment: http://stackoverflow.com/comment/33233186
has comment: http://stackoverflow.com/comment/33233125
has comment: http://stackoverflow.com/comment/33233047
type: Question
has comment: http://stackoverflow.com/comment/33233037
has comment: http://stackoverflow.com/comment/33233461
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33233049
has comment: http://stackoverflow.com/comment/33233251
has comment: http://stackoverflow.com/comment/33234091
favorite count: 0
has comment: http://stackoverflow.com/comment/33234148
has comment: http://stackoverflow.com/comment/33233106
has comment: http://stackoverflow.com/comment/33233117
has comment: http://stackoverflow.com/comment/33233172
has comment: http://stackoverflow.com/comment/33233518
has comment: http://stackoverflow.com/comment/33233211
has comment: http://stackoverflow.com/comment/33233391
has comment: http://stackoverflow.com/comment/33234008
score: -6
has comment: http://stackoverflow.com/comment/33233948
has comment: http://stackoverflow.com/comment/33233307
downvote count: 6

http://stackoverflow.com/a/21899742
has body: Hey i resolved it changing my DAO like this: public class ClientApproveDAO { private DataSource dataSource; public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } Connection conn=null; PreparedStatement statement=null; ResultSet rs=null; public void insertClient(int id) { try{ conn=dataSource.createConnection(); PreparedStatement ps=conn.prepareStatement("insert into login(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); ps.executeUpdate("insert into login(id,FirstName,LastName,Gender,Category,Dateofbirth,Age,Address,Country,State,city,PinCode,EmailId,ContactNo,MobileNo)select * from register where id="+id+""); ps.setInt(1, id); } catch (SQLException e) { throw new RuntimeException(e); } finally { if (rs != null) try { rs.close(); } catch (SQLException ignore) {} if (statement != null) try { statement.close(); } catch (SQLException ignore) {} if (conn != null) try { conn.close(); } catch (SQLException ignore) {} } } } Thank you all for all the help and this is my final code its working absolutely fine and as desired.
score: 1
accepted answer of: http://stackoverflow.com/q/21876536
answers question: http://stackoverflow.com/q/21876536
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/comment/33187961
type: Comment
comment on: http://stackoverflow.com/a/21912341
type: AnswerComment
score: 0
has text: I liked both your and Rohit Jain's answers, will accept in a few moments. hard to choose :) Thank you all by the way

http://stackoverflow.com/comment/33225087
type: QuestionComment
has text: Try reading the documentation on `System.out.println`.
comment on: http://stackoverflow.com/q/21933983
score: 0
type: Comment

http://stackoverflow.com/a/21934700
has comment: http://stackoverflow.com/comment/33228550
has comment: http://stackoverflow.com/comment/33226699
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21931607
answers question: http://stackoverflow.com/q/21931607
type: Answer
score: 1
has body: I think that the injection is not occuring because CDI is not enabled. Make sure you have a beans.xml as stated in CDI documentation: http://docs.oracle.com/javaee/6/tutorial/doc/gjbnz.html. Here is a sample beans.xml file you can use to enable CDI:
upvote count: 1

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/21851511
type: Tag
tags question: http://stackoverflow.com/q/21863609
tags question: http://stackoverflow.com/q/21940008
tags question: http://stackoverflow.com/q/21940364
tags question: http://stackoverflow.com/q/21998306

http://stackoverflow.com/comment/33188329
type: QuestionComment
comment on: http://stackoverflow.com/q/21913072
has text: Through URL <my-app-url>/myservlet?id=<EncryptedText>
score: 0
type: Comment

http://stackoverflow.com/a/21867817
score: 0
has comment: http://stackoverflow.com/comment/33107904
has comment: http://stackoverflow.com/comment/33107971
type: Answer
answers question: http://stackoverflow.com/q/21867395
has body: It looks like you did not set the appropriate classpath. You can set it as follows: java -classpath lib/*.jar:. mypackage.MyClass Try that and I am sure it will work. If you are using maven, then read this article You can also check your current classpath with: System.getProperty("java.class.path") Just write simple app printing this property out and run it just as you run an app with which you are having problems.

http://stackoverflow.com/q/21858660
has answer: http://stackoverflow.com/a/21911693
downvote count: 0
type: UnansweredQuestion
tagged with: aop
favorite count: 0
type: Question
has body: I am implementing an interface from an an aspect declare parents: SomePackage.AClass+ extends InterfaceBelow public interface InterfaceBelow() { //bunch of methods } I want a method which should return the class/instance implementing the interface itself. Something such as adding a method to the interface public Object getSelf() and then use AspectJ to implement it like this: public InterfaceBelow.getSelf() { //how to return the instance implementing the interface } I need to do it in the aspect not from the class and then {return this;}
score: 3
upvote count: 3
tagged with: implements
tagged with: interface
answer count: 1
has title: Returning a class instance in an (aspect)interface method
tagged with: java
tagged with: aspectj

http://stackoverflow.com/comment/33156174
has text: Many will let you tweak vocal parameters and pronunciations to some degree. None that I know of will reliably imitate a specific person.
score: 0
comment on: http://stackoverflow.com/q/21894501
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21984907
answers question: http://stackoverflow.com/q/21983858
has body: One of the drawbacks to an IDE is that it can 'cover up' some of the basics of a language by automating it, and then as a result when you need to analyse without an IDE you get a bit stuck as it has always taken care of various elements of the program for you. So it is definitely a good idea to try and grasp the basics of language so you know what the IDE is automating for you. A Classpath is normally as it literally sounds, a pathway to class files used by an application. The main function behind it is to tell the JVM where to find certain resources that it requires. For example in an IDE like Eclipse you can add external jars to reference 3rd party librarys, and it will take care of the neccessary path setting. Were you to do this via a command line you would need to include a classPath to tell the JVM where the required libraries are, in a fashion similar to the following: javac -cp "path/to/lib.jar" MyProgram.java //-cp is set classpath option The reason you don't need to do this with the 'core api' library is because of Environment Variables set on your computer. Environment variables are used by your Operating system as stored pathways to various essential bits and bobs. For example in my environment variables under the Path variable I have: C:\Program Files\Java\jdk1.7.0_25\bin This goes to a directory containing the executable files such as java and javaw. How I 'think' this works (I don't have any definitive sources on this bit) is that when you compile/run a java application using something like: java MyApplication or javac MyApplication.java The computer will check along it's environment variables at some point looking for those executables, which is why javac doesn't work until you set the correct Path in the environment var section. Once found it runs the executables. I expect that it is also able to find the main Java api (rt.jar?) from this pathway as well. The main difference I feel is that Classpath is an argument supplied at run/compile time to add…
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21983858
type: Answer
has comment: http://stackoverflow.com/comment/33316324
score: 4
upvote count: 4

for-loop
tags question: http://stackoverflow.com/q/22002500
tags question: http://stackoverflow.com/q/21891798
tags question: http://stackoverflow.com/q/21923606
tags question: http://stackoverflow.com/q/21865095
tags question: http://stackoverflow.com/q/21947452
tags question: http://stackoverflow.com/q/21891352
tags question: http://stackoverflow.com/q/21950880
tags question: http://stackoverflow.com/q/21895084
tags question: http://stackoverflow.com/q/21943169
tag name: for-loop
tags question: http://stackoverflow.com/q/21924626
tags question: http://stackoverflow.com/q/22002274
tags question: http://stackoverflow.com/q/21915198
tags question: http://stackoverflow.com/q/21931853
tags question: http://stackoverflow.com/q/21940873
tags question: http://stackoverflow.com/q/21972635
tags question: http://stackoverflow.com/q/21960720
tags question: http://stackoverflow.com/q/21942154
tags question: http://stackoverflow.com/q/22001161
type: Tag
tags question: http://stackoverflow.com/q/21926349
tags question: http://stackoverflow.com/q/21924992
tags question: http://stackoverflow.com/q/21978231
tags question: http://stackoverflow.com/q/21871881
tags question: http://stackoverflow.com/q/21941146
tags question: http://stackoverflow.com/q/21927779
tags question: http://stackoverflow.com/q/21960597
tags question: http://stackoverflow.com/q/21843464

http://stackoverflow.com/comment/33152633
type: Comment
type: QuestionComment
score: 1
has text: Please add the LogCat !
comment on: http://stackoverflow.com/q/21892760

http://stackoverflow.com/comment/33261462
score: 0
type: AnswerComment
has text: @InnocentKiller, thank you... I used condition to check position and by which I have solved my problem. I have used only isEnabled().
type: Comment
comment on: http://stackoverflow.com/a/21953735

http://stackoverflow.com/comment/63298171
score: 0
has text: I think the duplicate flag should be swapped - the accepted answer on the other question is just a link to an off-site tutorial (which is not an acceptable answer for SO, anyways).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21898425

http://stackoverflow.com/q/21966819
has body: I'm trying to launch another application with in my SWT 4.3 browser. But the java script which is embedded in the called application has a reference to 'window.external' which is causing application not launching with a java script error. Can any one suggest?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33285779
has comment: http://stackoverflow.com/comment/33285595
has comment: http://stackoverflow.com/comment/33285624
tagged with: javascript
has title: SWT browser java script issue with window.external
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33285420
tagged with: swt

http://stackoverflow.com/q/21860061
favorite count: 0
has body: I have the following code to display current locale System.out.println(Locale.getDefault()); System.out.println(new Locale("en_US")); The above gives output as follows en_US en_us How do I construct a Locale instance which gives en_US ? EDIT I am asking this because my resources which is Messages_en_US.properties is being ignored when I try to set it as default locale if any exception occurs during ResourceBundle.getBundle("Messages", new Locale("en_US"));
tagged with: localization
has title: Java Locale case sensitivity
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21860155
score: 7
tagged with: java
accepted answer: http://stackoverflow.com/a/21860155
upvote count: 7
has comment: http://stackoverflow.com/comment/33093260
type: Question
has comment: http://stackoverflow.com/comment/33093313
possible better answer: http://stackoverflow.com/a/21860197
has comment: http://stackoverflow.com/comment/33093129
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21860197

http://stackoverflow.com/q/21935292
tagged with: java
tagged with: jax-ws
has answer: http://stackoverflow.com/a/25889563
type: Question
has title: Jax-ws can't get params from operation with default namespace
score: 0
answer count: 1
tagged with: xml-namespaces
type: UnansweredQuestion
tagged with: web-services
tagged with: namespaces
has body: Interface: @WebService @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.ENCODED, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED) public interface WebServ { @WebMethod(action = "Sum", operationName = "Sum") public abstract String sum(@WebParam(name = "a") int a, @WebParam(name = "b") int b); } Implementation: @WebService(endpointInterface = "com.company.wstest.WebServ") public class WebServImpl implements WebServ { @Override public String sum(@WebParam(name = "a") int a, @WebParam(name = "b") int b) { return String.valueOf(a + b); } } Publish: String endPoint = "http://localhost:" + port + "/" + env; Endpoint endpoint = Endpoint.publish(endPoint, new WebServImpl()); if (endpoint.isPublished()) { System.out.println("Web service published for '" + env + "' environment"); System.out.println("Web service url: " + endPoint); System.out.println("Web service wsdl: " + endPoint + "?wsdl"); } If I send from SoapUI such request (which is automatically generated from wsdl): <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wst="http://wstest.company.com/"> <soapenv:Header/> <soapenv:Body> <wst:Sum> 6 7 </wst:Sum> </soapenv:Body> </soapenv:Envelope> I receive correct answer: <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:SumResponse xmlns:ns2="http://wstest.company.com/"> 13 </ns2:SumResponse> </S:Body> </S:Envelope> But what I actually need, it's to send request with default namespace: 6 7 and response is: ... 0 ... how I understand this parameters (a and b) are null.. it is strange, because jax-ws parsed request without errors. It sees Operation, but not parameters. Do someone know what is the issue?

http://stackoverflow.com/q/21870739
has answer: http://stackoverflow.com/a/21876424
has title: Trying to query a .CSV file using Java and MetaModel API
type: Question
tagged with: metamodel
tagged with: java
linked to: http://stackoverflow.com/q/38105932
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21876424
tagged with: http://stackoverflow.com/tag/csv
has body: I am trying to query a .CSV file using Java and MetaModel API and not succeeding. This API is easy with a .XLS file but with a .CSV I am stumped because there is no table name for the SQL query. Can anyone provide any hint or insight on how to do this? public static Object[][] getCsvData( File csvFile ) { CsvConfiguration conf = new CsvConfiguration( 1, true, false ); DataContext ctx = DataContextFactory.createCsvDataContext( csvFile, conf ); // CsvDataSet dataSet = csvContext.query(). // .selectAll() // .where("run").eq("Y") // .execute(); // List&lt;Row&gt; rows = dataSet.toRows(); If you want to try my code, see my GitHub project here, which is a proof of concept in progress (with a working Excel example).
tagged with: testng
type: AnsweredQuestion

http://stackoverflow.com/q/21892555
has title: How do I include a 3rd party jar in maven?
tagged with: maven
type: Question
has comment: http://stackoverflow.com/comment/33154729
tagged with: java
has comment: http://stackoverflow.com/comment/33152593
score: 0
has body: I have OmnitureAPI.jar and I could not find it in mvn repo. Hence I though I will include it myself using the following command that I found online describing a similar issue that I am currently facing. mvn install:install-file -Dfile=c:\kaptcha-{version}.jar -DgroupId=com.google.code -DartifactId=kaptcha -Dversion={version} -Dpackaging=jar I have two questions: 1) Does the jar that I am including needs to following maven naming and packaging conventions such as the classes should be in src/main/java etc? 2) While executing above command what should I put in -DgroupId=xxxx and -DartifactId=xxx ? Please guide
answer count: 1
has comment: http://stackoverflow.com/comment/33152391
has comment: http://stackoverflow.com/comment/33152302
has answer: http://stackoverflow.com/a/21892709
tagged with: adobe-analytics
type: UnansweredQuestion

http://stackoverflow.com/comment/33213707
comment on: http://stackoverflow.com/a/21927469
type: Comment
score: 1
type: AnswerComment
has text: How come it is a `classpath` issue? If so, IDE might have made a complaint on that.

http://stackoverflow.com/comment/33141347
comment on: http://stackoverflow.com/a/21886532
score: 0
type: Comment
has text: @RohitJain Fair enough. Thanks for your explanation.
type: AnswerComment

http://stackoverflow.com/q/21857257
type: Question
linked to: http://stackoverflow.com/q/21443688
has body: I'd like to have static files URLs like /v1_2014-02-18_/img/logo.png match the static file /static/v1/img/logo.png. This is easy in Python or Go : see app.yaml : wildcard in URL with static_dir? I'd like to achieve this with appengine-web.xml and dispatch.xml, but it's not clear to me how to have the "virtual" folder v1_2014-02-18_ simply serve the content of the actual folder /static/v1/ Trivia I use Google App Engine to serve a Java webapp. I'd like to maximize browser cache longevity, minimize number of requests and still serve the fresh versions of my css/js/png, and I believe revving filenames is a best practice to achieve this. Also as adding a variable querystring (/v1/img/logo.png?2014-02-18) might cause proxy and cache problems, I prefer to show a variable directory name (/v1_2014-02-18_/img/logo.png), pointing to the same underlying server dir.
score: 0
linked to: http://stackoverflow.com/q/12045828
answer count: 0
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: url-routing
has comment: http://stackoverflow.com/comment/33126865
has title: Routing static files in a java webapp (App Engine)
tagged with: java
has comment: http://stackoverflow.com/comment/33088999

kettle
tags question: http://stackoverflow.com/q/21980558
type: Tag
tag name: kettle

http://stackoverflow.com/comment/33259842
comment on: http://stackoverflow.com/a/21947610
has text: @StephenC Because I find understanding how the Android build process works to be helpful in reasoning about what aspects are identical (syntax) and what parts may differ in unexpected ways (parts of the runtime).
score: 0
type: AnswerComment
type: Comment

nullpointerexception
tags question: http://stackoverflow.com/q/21895635
tags question: http://stackoverflow.com/q/21927046
tags question: http://stackoverflow.com/q/21971261
tags question: http://stackoverflow.com/q/21971243
tags question: http://stackoverflow.com/q/21928562
tags question: http://stackoverflow.com/q/21868560
tags question: http://stackoverflow.com/q/22004457
tags question: http://stackoverflow.com/q/21857655
tags question: http://stackoverflow.com/q/21930046
tags question: http://stackoverflow.com/q/21963686
tags question: http://stackoverflow.com/q/21940008
type: Tag
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/21936973
tags question: http://stackoverflow.com/q/21895625
tags question: http://stackoverflow.com/q/21996700
tags question: http://stackoverflow.com/q/21866078
tags question: http://stackoverflow.com/q/21869054
tags question: http://stackoverflow.com/q/21945810
tags question: http://stackoverflow.com/q/21868809
tags question: http://stackoverflow.com/q/21914050
tags question: http://stackoverflow.com/q/21950684
tags question: http://stackoverflow.com/q/21939791
tags question: http://stackoverflow.com/q/21945763
tags question: http://stackoverflow.com/q/21944845
tags question: http://stackoverflow.com/q/21975823
tags question: http://stackoverflow.com/q/21882846
tags question: http://stackoverflow.com/q/21904938
tags question: http://stackoverflow.com/q/21885705
tags question: http://stackoverflow.com/q/21980756
tags question: http://stackoverflow.com/q/21998827
tags question: http://stackoverflow.com/q/21872102
tags question: http://stackoverflow.com/q/21911511
tags question: http://stackoverflow.com/q/21960625
tags question: http://stackoverflow.com/q/21868721
tags question: http://stackoverflow.com/q/21995264
tags question: http://stackoverflow.com/q/21922950
tags question: http://stackoverflow.com/q/21948225
tags question: http://stackoverflow.com/q/21986976
tags question: http://stackoverflow.com/q/21842855

http://stackoverflow.com/comment/33178450
type: AnswerComment
comment on: http://stackoverflow.com/a/21907767
type: Comment
has text: i think that was possbile before java 7
score: 0

http://stackoverflow.com/q/21883530
type: UnansweredQuestion
tagged with: oracle-adf
has comment: http://stackoverflow.com/comment/33135359
has comment: http://stackoverflow.com/comment/33135416
score: 2
tagged with: jsf
has comment: http://stackoverflow.com/comment/33135445
tagged with: java
has answer: http://stackoverflow.com/a/21996638
type: Question
tagged with: passwords
has answer: http://stackoverflow.com/a/34138352
has body: Per company policy (and other recommendations), we should not use String class to handle passwords. Because this objects are immutable and may live until the GC deallocates it, so a "memory inspection" could show a not yet deallocated String containing the password. So the alternative is to use char[] instead and overwrite it contents once is no longer needed. However, when using an inputText component, the setter method must receive a String. I have an inputText like: &lt;af:inputText value="{myBean.password}" secret="true"/&gt; And public class MyBean { ... private transient char[] password; ... public void setPassword(String password) { this.password = password.toCharArray(); } ... public void sumbit(ActionEvent e) { ... //Wipe password for(int i = 0 ; i &lt; password.length ; i++) { password[i] = ' '; } password = null; } } As you can see, there is still a String object containing the password (the argument of the setter), and I don't know how to deal with that value. Is there any way to receive a char[] value? Does the cycle of ADF contemplates the fact that this is a password and should do something special? This is a server and calling the CG is not a good idea.
answer count: 2
has comment: http://stackoverflow.com/comment/33135484
downvote count: 0
favorite count: 0
has title: How to handle password Strings in ADF Faces?
upvote count: 2

http://stackoverflow.com/q/21855847
has title: serializable issue with Context and transient
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33085638
has comment: http://stackoverflow.com/comment/33086052
type: Question
tagged with: transient
score: 0
tagged with: serializable
has comment: http://stackoverflow.com/comment/33088196
tagged with: android-context
has body: I'm facing an issue with Parcelable and Serializable. All my attributes from a class are Serializable unless Context. In the case of Context I've done this object transient so I shouldn't have Serializable problems. My issue is that I keep having parceable problems only in devices with API &lt; 11. Could devices with API &lt; 11 have problems with transient?
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/33366258
type: Comment
comment on: http://stackoverflow.com/a/21983469
type: AnswerComment
has text: As far as I know there isn't a pure JAXB solution for this (except bullet 2)
score: 0

http://stackoverflow.com/q/21924500
tagged with: java
has title: Can't View Data Sqlite with Simple Adapter
linked to: http://stackoverflow.com/q/8319219
tagged with: listview
upvote count: 3
answer count: 2
tagged with: sqlite
has comment: http://stackoverflow.com/comment/33209769
favorite count: 0
possible better answer: http://stackoverflow.com/a/21924805
has body: I have a listview that shown my sqlite table. I try using Aray Adapter for my first experience and all field shown but its just messy. i want to make them view like a table with three column. i try to implement code from answer at this link here is my code. if (Globals.listoff == null){Globals.listoff = dataSource.getAllproductoff();} adapter = new MySimpleAdapter(ViewDataOff.this,dataSource.getAllproductoff() , R.layout.item_list_offeringpro, new String[] { "one", "two","three" }, new int[] { R.id.edmodul, R.id.edtype,R.id.edtype, R.id.edwinningpro}); adapter.notifyDataSetChanged(); setListAdapter(adapter); Here is my DBDataSource.java public ArrayList&lt;HashMap&lt;String,Object&gt;&gt; getAllproductoff() { ArrayList&lt;HashMap&lt;String, Object&gt;&gt; listoff = new ArrayList&lt;HashMap&lt;String, Object&gt;&gt;(); Cursor cursor = database.query(DBHelper.TABLE_NAME, allColumns, null, null, null, null, null); cursor.moveToFirst(); while (!cursor.isAfterLast()) { HashMap&lt;String, Object&gt; map1 = new HashMap&lt;String, Object&gt;(); map1.put("one", cursor.getLong(cursor.getColumnIndex(DBHelper.COLUMN_ID))); map1.put("two", cursor.getString(cursor.getColumnIndex(DBHelper.COLUMN_DESCRIPTION))); map1.put("three", cursor.getString(cursor.getColumnIndex(DBHelper.COLUMN_PRICE))); listoff.add(map1); cursor.moveToNext(); } cursor.close(); return listoff; } And Here is MySimpleAdapter.java public class MySimpleAdapter extends SimpleAdapter { Context localcontext = null; public MySimpleAdapter(Context context,ArrayList&lt;HashMap&lt;String, Object&gt;&gt; data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); localcontext = context; } public View getView(int position, View convertView, ViewGroup parent) { View view = super.getView(position, convertView, parent); return view; } } Here is my error Log 02-21 09:48:21.259: E/AndroidRuntime(21895): FATAL EXCEPTION: main 02-21 09:48:21.259: E/AndroidRuntime(21895): java.lang.ArrayIndexOutOfBoun…
tagged with: android
type: AnsweredQuestion
downvote count: 0
type: Question
has answer: http://stackoverflow.com/a/21924692
accepted answer: http://stackoverflow.com/a/21924692
score: 3
has answer: http://stackoverflow.com/a/21924805

http://stackoverflow.com/comment/33227165
type: QuestionComment
comment on: http://stackoverflow.com/q/21905013
has text: it would be nice if you can share some sample code.
score: 0
type: Comment

http://stackoverflow.com/a/21907767
has comment: http://stackoverflow.com/comment/33178594
has comment: http://stackoverflow.com/comment/33178522
type: Answer
has comment: http://stackoverflow.com/comment/33178450
accepted answer of: http://stackoverflow.com/q/21907697
has body: It is the feature added in Java 7. Have a look at Rethrowing Exceptions with More Inclusive Type Checking
answers question: http://stackoverflow.com/q/21907697
upvote count: 17
has comment: http://stackoverflow.com/comment/33178551
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33178520
score: 17

http://stackoverflow.com/comment/33231811
comment on: http://stackoverflow.com/q/21937518
score: 0
type: Comment
has text: @nachokk Added the result.
type: QuestionComment

http://stackoverflow.com/q/21914428
tagged with: android
has body: I am trying to show a notification form my IntentService. But nothing shows :-(((( public class CreditcheckService extends IntentService { AlertDialog dialog; public CreditcheckService() { super("CreditcheckService"); } @Override protected void onHandleIntent(Intent intent) { NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.icon) .setContentTitle("My notification") .setContentText("Hello World!"); NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(999, mBuilder.build()); }
tagged with: android-intent
has comment: http://stackoverflow.com/comment/33190882
type: AnsweredQuestion
has title: Trying with a Notification
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21914820
accepted answer: http://stackoverflow.com/a/21914820
answer count: 1
score: 0

http://stackoverflow.com/comment/33340648
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21997745
has text: The wave file exists in my Raw folder. The wave file is read in by program and the written out. I don't think that is important at the moment though. I does not matter what file I am writing out to the stream if the stream is no even opened.
score: 0

http://stackoverflow.com/a/21863425
upvote count: 6
has body: You are seeing the results of converting an array directly to a String. Arrays are objects too, but they don't override Object's toString() method, which is responsible for the "jumbled mess". In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode()) Explicitly convert the contents of the array to a String with Arrays.toString. System.out.println(Arrays.toString(Positive) + " " + Arrays.toString(Negative));
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21863380
score: 6
answers question: http://stackoverflow.com/q/21863380
type: Answer

http://stackoverflow.com/a/21877058
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21876660
answers question: http://stackoverflow.com/q/21876660
type: Answer
score: 2
upvote count: 2
has body: A TreeSet is a sorted set, and you don't need to sort your futures. You don't need to deal with duplicates either, so a Set is not necessary. Simply using an ArrayList should be fine.
has comment: http://stackoverflow.com/comment/33123923

http://stackoverflow.com/a/21928902
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21912293
score: 0
has body: The problem was that noOfValues = rs.getInt("rowcount"); came before rs.next() I have to change to code then it'll work. I'll store the results in an ArrayList so I don't have to know the number of results at the beginning. Thanks anyway.
type: Answer
accepted answer of: http://stackoverflow.com/q/21912293

http://stackoverflow.com/comment/33224384
score: 0
has text: Aha: Missed the original requirement :" If user gives a grade other than a number between 4 and 10, the text “Invalid grade!” will be printed on screen and program asks for another grade." So the break; should be replaced by a continue or keep the loop and see Don Temple's solution.
type: AnswerComment
comment on: http://stackoverflow.com/a/21933173
type: Comment

http://stackoverflow.com/comment/33086664
comment on: http://stackoverflow.com/q/21856233
has text: No its java app only.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21982510
tagged with: icedtea
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33312116
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21982858
has title: auto signed applet don't run
has comment: http://stackoverflow.com/comment/33324625
score: 0
answer count: 1
has body: I'm under Ubuntu and I have already installed icedtea. the is the applet I'm trying to execute is auto signed. I know that there is a security config under icedtea to prevent such applet to be run. I'm asking where/how can I add an exception so that website will be authorized to run his applet ?

http://stackoverflow.com/comment/33206654
score: 0
type: AnswerComment
has text: I'm re-looking the code and maybe I don't understend well but it seems to me that it try for 24 times to generate that number.. well if I have 1 chance on 24 to generate the desired number it dont mean that if I try 24 time I'll surely generate it...it may require 5 time or 20 or 30 or 100 or more time because is probabilistic
comment on: http://stackoverflow.com/a/21922946
type: Comment

http://stackoverflow.com/q/21891675
type: Question
has body: I've created this code to get unlimited values of integers, store them, and calculate the mean. It also does it in a squared format. My problem is, I created it so that the while loop only stops when the the number 0 is entered. However, I only put it there as a substitute, as it's the only way i could test the rest of the code to ensure it all works. What I really want to do it have the while loop continue until the user provides input that is not an integer. Ive tried everything, using hasNextint() or nextint and so forth, what can I do? import java.io.*; import java.util.*; public class InputStats { public static void main(String[] args) { Scanner TextIO = new Scanner(System.in); int inputNumber; // One of the integers input by the user. int sum; // The sum of all the integers. int count; // The number of integers that have been entered. double mean; // The mean value of the integers, rounded to 2 decimal places. int squarein; // Value of squared number. int sumsquare; // The sum of the squares of all the integers. double meansquare; // The mean value of the squares of integers, rounded to 2 decimal places. /* Initialize the summation and counting variables. */ sum = 0; count = 0; sumsquare = 0; meansquare = 0; /* Read and process the user's input. */ System.out.println("Enter your first positive integer: "); inputNumber = TextIO.nextInt(); while (inputNumber != 0) { sum += inputNumber; // Add inputNumber to running sum. squarein = inputNumber; // sumsquare = squarein * squarein; //square inputs count++; // Count the input by adding 1 to count. System.out.println("Enter your next positive integer, or 0 to end: "); inputNumber = TextIO.nextInt(); } /* Display the result. */ if (count == 0) { System.out.println("You didn't enter any data!"); } else { mean = ((double)sum) / count; meansquare = ((double)sumsquare) / count; TextIO.nextInt(); System.out.println("Numbers entered: " + count + "\n"); System.out.println("Sum: " + sum + "\n"); System.out.println("Mean: " + …
accepted answer: http://stackoverflow.com/a/21892165
has answer: http://stackoverflow.com/a/21892070
has title: While Loop not integer
tagged with: java.util.scanner
score: 0
has answer: http://stackoverflow.com/a/21892231
has comment: http://stackoverflow.com/comment/33151017
tagged with: java
has answer: http://stackoverflow.com/a/21892165
answer count: 5
has answer: http://stackoverflow.com/a/21892037
has answer: http://stackoverflow.com/a/21892300
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21892037

http://stackoverflow.com/comment/33292429
score: 0
type: Comment
type: QuestionComment
has text: Please give some demo values for `posX`, `posY`, `rows` and `cols`, *and* `myWorld`. Pretty hard to help with so much missing information.
comment on: http://stackoverflow.com/q/21971241

http://stackoverflow.com/q/21968918
tagged with: performance
accepted answer: http://stackoverflow.com/a/21969069
has body: In order to practise the Java 8 streams I tried converting the following nested loop to the Java 8 stream API. It calculates the largest digit sum of a^b (a,b &lt; 100) and takes ~0.135s on my Core i5 760. public static int digitSum(BigInteger x) { int sum = 0; for(char c: x.toString().toCharArray()) {sum+=Integer.valueOf(c+"");} return sum; } @Test public void solve() { int max = 0; for(int i=1;i&lt;100;i++) for(int j=1;j&lt;100;j++) max = Math.max(max,digitSum(BigInteger.valueOf(i).pow(j))); System.out.println(max); } My solution, which I expected to be faster because of the paralellism actually took 0.25s (0.19s without the parallel()): int max = IntStream.range(1,100).parallel() .map(i -&gt; IntStream.range(1, 100) .map(j-&gt;digitSum(BigInteger.valueOf(i).pow(j))) .max().getAsInt()).max().getAsInt(); My questions did I do the conversion right or is there a better way to convert nested loops to stream calculations? why is the stream variant so much slower than the old one? why did the parallel() statement actually increased the time from 0.19s to 0.25s? I know that microbenchmarks are fragile and parallelism is only worth it for big problems but for a CPU, even 0.1s is an eternity, right? Update I measure with the Junit 4 framework in Eclipse Kepler (it shows the time taken for executing a test). My results for a,b&lt;1000 instead of 100: traditional loop 186s sequential stream 193s parallel stream 55s Update 2 Replacing sum+=Integer.valueOf(c+""); with sum+= c - '0'; (thanks Peter!) shaved off 10 whole seconds of the parallel method, bringing it to 45s. Didn't expect such a big performance impact! Also, reducing the parallelism to the number of CPU cores (4 in my case) didn't do much as it reduced the time only to 44.8s (yes, it adds a and b=0 but I think this won't impact the performance much): int max = IntStream.range(0, 3).parallel(). .map(m -&gt; IntStream.range(0,250) .map(i -&gt; IntStream.range(1, 1000) .map(j-&gt;.digitSum(BigInteger.valueOf(250*m+i).p…
tagged with: nested-loops
linked to: http://stackoverflow.com/q/24027247
answer count: 2
favorite count: 0
has title: Java 8 nested loops with streams & performance
has comment: http://stackoverflow.com/comment/33288470
has comment: http://stackoverflow.com/comment/33292788
tagged with: java-8
linked to: http://stackoverflow.com/q/20375176
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33288361
tagged with: java-stream
upvote count: 14
tagged with: java
possible better answer: http://stackoverflow.com/a/21969015
score: 13
has answer: http://stackoverflow.com/a/21969069
downvote count: 1
has answer: http://stackoverflow.com/a/21969015
type: Question

http://stackoverflow.com/comment/33065193
score: 0
type: Comment
type: QuestionComment
has text: Do your logs say anything? Does the response only contain a 404 or a message to go along with it?
comment on: http://stackoverflow.com/q/21843127

http://stackoverflow.com/comment/33095276
type: Comment
type: QuestionComment
has text: Do you need it centered horizontally or vertically?
score: 0
comment on: http://stackoverflow.com/q/21861004

http://stackoverflow.com/a/21853998
answers question: http://stackoverflow.com/q/21851810
score: 0
type: Answer
has body: This is a typical error message when the number of columns is not correct. In this case, you have only one primary key column in your join. Joins are primary-key related tables, so they need to have the same primary keys. In your case, the vehicles have two ids, while the buses and cars have only one. The join element specifies a new table with the key column as both primary key and foreign key. Consider making it a many-to-one which has a different type per subclass. (Instead of the join). It would also map to a one-to-any property.

http://stackoverflow.com/comment/33240525
has text: The `"No Hints Left!"` is displayed when there are more than 4 digits entered. If i submit only one digit then it doesn't work.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21941146

mongodb
tags question: http://stackoverflow.com/q/21849590
tags question: http://stackoverflow.com/q/21991441
tags question: http://stackoverflow.com/q/21969370
tag name: mongodb
tags question: http://stackoverflow.com/q/21906890
tags question: http://stackoverflow.com/q/21927505
tags question: http://stackoverflow.com/q/21847294
type: Tag
tags question: http://stackoverflow.com/q/21911199
tags question: http://stackoverflow.com/q/21860258
tags question: http://stackoverflow.com/q/21876146
tags question: http://stackoverflow.com/q/21955149
tags question: http://stackoverflow.com/q/21988066
tags question: http://stackoverflow.com/q/21882143
tags question: http://stackoverflow.com/q/21906808
tags question: http://stackoverflow.com/q/21991293
tags question: http://stackoverflow.com/q/21984525
tags question: http://stackoverflow.com/q/21921442
tags question: http://stackoverflow.com/q/21859579
tags question: http://stackoverflow.com/q/21854329
tags question: http://stackoverflow.com/q/21927573
tags question: http://stackoverflow.com/q/21932850

http://stackoverflow.com/comment/33174897
comment on: http://stackoverflow.com/q/21904873
has text: you have two hibernate dependency in your **POM** remove hibernate 3.1.3
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/21923453
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21923431
upvote count: 1
has body: Why don't you use: if (isNook()) { // do something }

http://stackoverflow.com/comment/33068938
type: Comment
type: QuestionComment
has text: I checked... i installed an android app with hindi font.. it is displaying font.. but again I am getting ''' ???????' instead of texts when i installed my app
score: 0
comment on: http://stackoverflow.com/q/21844988

http://stackoverflow.com/a/21975951
score: 0
has body: Change this String[] rain = { "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" }; double[] values = { 0.40,0.94,3.21,3.74,1.73,1.03,1.27,2.58,6.98,6.90,2.80,2.53}; to this static String[] rain = { "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" }; static double[] values = { 0.40,0.94,3.21,3.74,1.73,1.03,1.27,2.58,6.98,6.90,2.80,2.53}; or put the (non-static) variables into the main function itself, and then pass them into the functions as needed. Such as public static final void main(String[] ignored) { String[] rain = { "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" }; double[] values = { 0.40,0.94,3.21,3.74,1.73,1.03,1.27,2.58,6.98,6.90,2.80,2.53}; Total(values); All functions called by main, as stated by others, either need to be static as well, or alternatively called via a new instance. (And please, change function names to lowercase.)
type: Answer
answers question: http://stackoverflow.com/q/21975917

http://stackoverflow.com/comment/33121998
comment on: http://stackoverflow.com/q/21875923
score: 0
has text: The first one just does not show you that it has the same approximate value http://floating-point-gui.de/
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33279078
has text: Thanks for this, but is there away to make it so that the new message goes below the old?
type: AnswerComment
comment on: http://stackoverflow.com/a/21963371
score: 0
type: Comment

http://stackoverflow.com/q/21845020
type: UnansweredQuestion
has title: using only 1 for loop
tagged with: java
has answer: http://stackoverflow.com/a/21845060
type: Question
tagged with: arraylist
score: 0
answer count: 1
has body: is it possible to do they following using only one for loop instead of 2: int index = ws.getLastRowNum() + 1; List&lt;AdditiveList&gt; list=new ArrayList&lt;&gt;(); for(int i=1; i&lt;index; i++){ list.add(new AdditiveList()); } for(AdditiveList x: list){ Row row=null; if (rowIterator.hasNext()) row=rowIterator.next(); x.inputAdditiveData(row); x.outputData(); }
has comment: http://stackoverflow.com/comment/33067203

http://stackoverflow.com/a/21984460
answers question: http://stackoverflow.com/q/21984297
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
has body: Since, the classloader would be same, it will not load the class again &amp; again. The same class can be reloaded again only if you have multiple classloader loading the classes at different point of time. Every classloader, first checks if the class its about to load is already loaded or not. If its not loaded then only it will load it.
accepted answer of: http://stackoverflow.com/q/21984297
type: Answer

http://stackoverflow.com/comment/33189872
comment on: http://stackoverflow.com/a/21892709
type: Comment
score: 0
type: AnswerComment
has text: I updated the answer. you need to specify the groupId, artifactId, and version, and you need to make them up yourself, essentially. When you include this in your maven project, you'll use those values to reference the lib.

http://stackoverflow.com/comment/131192696
type: Comment
type: AnswerComment
has text: This worked for me on Windows 10
comment on: http://stackoverflow.com/a/25582228
score: 0

http://stackoverflow.com/a/21930295
type: Answer
has comment: http://stackoverflow.com/comment/33218673
downvote count: 0
has body: You tried to access a method, before creating an instance. The instance is not yet fully initialized. Calling methods of objects that are being constructed from their own constructor can result in unexpected behavior as the objects are not initialized consistently until the constructor finishes.
has comment: http://stackoverflow.com/comment/33218705
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21930240
has comment: http://stackoverflow.com/comment/33219370

http://stackoverflow.com/q/21934436
has comment: http://stackoverflow.com/comment/33225851
has title: GSON Deserialize String[] to String inside one type
has answer: http://stackoverflow.com/a/21939068
has body: This may seem an odd requirement but I want to deserialize a JSONStringArray to a String, (not a String[]). Example of my object class Retailer { String name; String images; } Incoming JSON: { "name":"Mr Retailer", "images":[ "http://server.com/image1", "http://server.com/image2" ] } So the parsed object would contain the deserilized values like so: name = "Mr Retailer" images = "http://server.com/image1 http://server.com/image2" The delimiter is not important I will pick one that does not exist in my URLs, e.g. pipe white space etc.. I'm assuming I need to write a TypeAdapter for String[] to iterate through the JSONArray and concat the elements in the array into a String? I also only want to do this for that specific class, as other classes have String[] but I want to leave them alone.
has comment: http://stackoverflow.com/comment/33225679
possible better answer: http://stackoverflow.com/a/21934633
linked to: http://stackoverflow.com/q/6014674
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21934633
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
accepted answer: http://stackoverflow.com/a/21939068
type: Question
score: 0
answer count: 2

io
tags question: http://stackoverflow.com/q/21965019
tags question: http://stackoverflow.com/q/21927640
tags question: http://stackoverflow.com/q/21986649
tags question: http://stackoverflow.com/q/21941475
tag name: io
tags question: http://stackoverflow.com/q/21986063
tags question: http://stackoverflow.com/q/21963529
tags question: http://stackoverflow.com/q/21994624
type: Tag
tags question: http://stackoverflow.com/q/21842678
tags question: http://stackoverflow.com/q/21955127
tags question: http://stackoverflow.com/q/21949868
tags question: http://stackoverflow.com/q/21992526
tags question: http://stackoverflow.com/q/21947080
tags question: http://stackoverflow.com/q/21973910
tags question: http://stackoverflow.com/q/21861523
tags question: http://stackoverflow.com/q/21987038
tags question: http://stackoverflow.com/q/21882444

http://stackoverflow.com/q/21885462
upvote count: 2
type: UnansweredQuestion
has title: how do sub classes interact with super classes
score: -3
has comment: http://stackoverflow.com/comment/33138906
has answer: http://stackoverflow.com/a/21885888
tagged with: java
type: Question
has body: The question i'm asking is can you have the following. super is the super class of sub super thing = new sub(); and then call a method from the sub class
downvote count: 5
has comment: http://stackoverflow.com/comment/33138740
answer count: 1
has comment: http://stackoverflow.com/comment/33138787
favorite count: 0
has comment: http://stackoverflow.com/comment/33178239

http://stackoverflow.com/comment/33143261
score: 0
comment on: http://stackoverflow.com/a/21886997
type: Comment
has text: Your Threads can compute their stuff parallel, but they can't write parallel. You can use `ThreadPoolExecutor` class, so you will have less overhead regarding creating Thread objects. I think the best you can do, as you stated, is to store all information in a HashMap and to write the content in one file, after all the data was computed.
type: AnswerComment

http://stackoverflow.com/a/21884855
has comment: http://stackoverflow.com/comment/33138910
has comment: http://stackoverflow.com/comment/33139585
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/33139911
answers question: http://stackoverflow.com/q/21884720
downvote count: 0
has body: You can create the vector after getting the numer of grades. Try this instead: int laki; System.out.print("How many grades will you enter?"); strSize = dataIn.readLine(); laki = Integer.parseInt(strSize); float[] grades = new float[laki]; By the way, why do you read the number of grades as a String and then convert it to int? Read it like int instead.
has comment: http://stackoverflow.com/comment/33138683

http://stackoverflow.com/comment/33168322
score: 0
type: Comment
type: QuestionComment
has text: One of: `array`, `randomNumbers` is not known to the *compiler*. And we cannot say anything from the code you posted.
comment on: http://stackoverflow.com/q/21901776

http://stackoverflow.com/a/21889781
upvote count: 1
has body: If you're asking about Dependency Injection, you should read this What is dependency injection? To summarize Dependency injection, it is a pattern for shifting around type dependencies. Instead of having your dependencies directly in your application classes, you move them to a component that manages them. This component is usually known as an Inversion of Control container, and that's what Spring provides primarily. You can do this with XML or you can do it with Java. In other words, though you are shifting the dependencies, they can be defined at run-time (with XML) or at compile-time (with Java). If you're asking about why to configure your context with XML vs Java, then one of the answers is that you don't have to recompile your source code to change configurations if you're using XML. chrylis also brings up some good points. XML is not type safe (but I've never had a problem with that). However, there are some configurations that are hard to do with XML. The XML schemas that Spring declares are restrictive and force you to use some coding conventions. With Java configuration, you don't have those restrictions. You can create your objects any way you want.
downvote count: 1
has comment: http://stackoverflow.com/comment/33147648
has comment: http://stackoverflow.com/comment/33147159
has comment: http://stackoverflow.com/comment/33150441
has comment: http://stackoverflow.com/comment/33147049
has comment: http://stackoverflow.com/comment/33150680
answers question: http://stackoverflow.com/q/21889756
type: Answer
has comment: http://stackoverflow.com/comment/33148775
score: 0
has comment: http://stackoverflow.com/comment/33154573

xml-namespaces
tags question: http://stackoverflow.com/q/21935292
tag name: xml-namespaces
type: Tag
tags question: http://stackoverflow.com/q/21914748

http://stackoverflow.com/a/23693757
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21974719
has body: May be you are running a batch query, which exceeds the Facebook limit, You can try to run on graph request per second. It tracks one single request per second per auth-token and IP. Have details on this link Do Facebook Graph API calls using field expansion count differently against the rate limits than batch calls

http://stackoverflow.com/q/21860016
answer count: 1
has body: I am creating a Java application. I have 2 Forms, one is JFRAME FORM, which contains left and right JPanel; and JPANEL FORM which contains the contents.. I am having trouble of putting the JPanel Form and its contents to the right JPanel of the JFRame form using card layout.
has answer: http://stackoverflow.com/a/21860244
accepted answer: http://stackoverflow.com/a/21860244
score: 0
has comment: http://stackoverflow.com/comment/33093228
has comment: http://stackoverflow.com/comment/33093229
tagged with: swing
has title: Put JPanel Form in JFrame using Card Layout
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33093417
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/33093241
type: Question
tagged with: cardlayout
has comment: http://stackoverflow.com/comment/33093195

http://stackoverflow.com/a/21857983
score: -1
answers question: http://stackoverflow.com/q/21857915
upvote count: 0
has body: getPreferredSize and getMaximumSize only return the values assigned to preferredSize and maximumSize, respectively, for the JCheckBox object. If you want to change these values, use setPreferredSize and setMaximumSize instead: jCheckBox.setPreferredSize(new Dimension(100, 300)); and/or: jCheckBox.setMaximumSize(new Dimension(200, 600));
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/136526130

http://stackoverflow.com/comment/33063616
score: 0
type: QuestionComment
type: Comment
has text: Does the setBolt method accept the parameters you're passing?
comment on: http://stackoverflow.com/q/21843066

http://stackoverflow.com/q/21950631
has comment: http://stackoverflow.com/comment/33255592
score: 0
has title: How to solve java.lang.OutOfMemoryError?
tagged with: android
answer count: 1
has body: I am doing a dictionary App and i am using this xml url. While parsing this url I am getting OutOfMemoryError. Can anybody please tell me why it's coming and what is the correct way to solve this problem? And please give me some other idea to do dictionary App. Here is my code what i am using for this XML parsing: public class MainActivity extends Activity { TextView text; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder() .permitAll().build(); StrictMode.setThreadPolicy(policy); text = (TextView) findViewById(R.id.textView1); try { parse(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullParserException e) { // TODO Auto-generated catch block e.printStackTrace(); } } void parse() throws IOException, XmlPullParserException { URL url = new URL("http://dumps.wikimedia.org/enwiktionary/latest/enwiktionary-latest-abstract.xml"); // Create a new instance of a PullParserFactory that can be used to // create XML pull parsers XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); // Specifies that the parser produced by this factory will provide // support for XML namespaces. By default the value of this is set to // false. factory.setNamespaceAware(true); // Creates a new instance of a XML Pull Parser using the currently // configured factory features XmlPullParser xpp = factory.newPullParser(); // Sets the input stream the parser is going to process. This call // resets the parser state and sets the event type to the initial value // START_DOCUMENT. xpp.setInput(url.openStream(), null); // Returns the type of the current event (START_TAG, END_TAG, TEXT, // etc.) int eventType = xpp.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { // text.append(xpp.getName()); } else if (eventType == XmlPullPars…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21950770
tagged with: java
has comment: http://stackoverflow.com/comment/33255776
type: Question

http://stackoverflow.com/comment/33290620
has text: This is application is have c++ code and have java code as wrappers of c++ code. And I want to find out which of c++ object or dll is leaking.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21969231
score: 0

http://stackoverflow.com/comment/33289392
has text: I am trying to create interfaces that allow someone to create an `EventHandler` as he whishes but also provide a kind of guided way for it. (Those interfaces) Id like to provde a default handler that already creates a pushing of all events to the registered listeners when the process events is called. I think, that it would be rather good just to define the `Eventhandlers` and `GameEvents` with 2 `Enums`. But i think its not possible just with enums as you already marked.
comment on: http://stackoverflow.com/a/21965270
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21925091
answer count: 1
has body: I am now using Spring Data JPA + Hibernate for my data access layer. Assuming I have entity A, which is having One-To-May relationship to B. When I am trying to query for A join fetching B, my first trial is like this: from A a join fetch a.b However, because A.b is one to many, for the way JPA and Hibernate works, the result List&lt;A&gt; will contain multiple element pointing to same A instance (because each element in the result list will correspond to one row in result set). The way to solve is by writing select distinct a from A a join fetch a.b From my understanding, this is going to cause two effects: Result SQL will contains distinct keyword JPA/Hibernate will do a "Distinct Root" transformation when constructing the result list. I would want to know if there is any way that I only have point 2 (Distinct Root) in effect (because distinct in result SQL is not necessary in my case, and it is causing performance problem), preferably a JPA-based solution? Further more, is there something I can do on Spring Data to achieve what I am looking for? (e.g. Any @QueryHint or special JPQL/HQL syntax that I can use?) (I know some workaround like making the result a Set&lt;A&gt; but I would want to use it as the last resort if I cannot find any solution provided by JPA/Hibernate for such scenario)
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33210049
tagged with: spring-data
has comment: http://stackoverflow.com/comment/33214101
tagged with: jpa
has title: How to perform only "Distinct Root" but not generating distinct in result SQL for JPA?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21925461
has comment: http://stackoverflow.com/comment/33245139
type: Question

http://stackoverflow.com/comment/33136083
score: 1
comment on: http://stackoverflow.com/q/21883770
has text: I'm pretty sure that inputStream.read() will block until data becomes available. It will return -1 if the stream is closed, and inputStream.ready() will tell you if it has bytes in its buffer or not. The only thing I really see missing from your code is a way for the thread to exit in a controlled manner. So what exactly is the problem?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33324212
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21989200
has text: Thank you for pointing me to `@NaturalId`! Can you confirm that I will have to _'merge positions manually'_? (that seems to be the answer in http://stackoverflow.com/questions/6058875/hibernate-natural-id-duplicate-issue). Thanks in advance!

http://stackoverflow.com/a/21869306
type: AcceptedAnswer
upvote count: 3
type: Answer
has body: You need to get a handle on the Activity in order to call showDialog(). Try calling getActivity().showDialog()
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/21866965
answers question: http://stackoverflow.com/q/21866965

http://stackoverflow.com/a/21935348
upvote count: 1
has body: You can use dateformat class for that. DateFormat sdt = new SimpleDateFormat(put your format here); Date stime= sdt.parse(starttime); Date etime = sdt.parse(endtime); Starttime and end time are the strings which you want to parse
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21935187
type: Answer

http://stackoverflow.com/comment/33318096
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21985680
has text: Try this link => http://json.parser.online.fr/ to test your JSON. Once you spot the parse error in your JSON your problem will be solved if other things are working fine.

http://stackoverflow.com/a/21979657
upvote count: 17
has comment: http://stackoverflow.com/comment/51061697
score: 17
has comment: http://stackoverflow.com/comment/33308142
downvote count: 0
has body: You can add patterns as defined here. As per your requirement, pattern like - %d{yyyy-MM-dd HH:mm:ss} would be userful. Documentation says the following Pattern Example %d{ISO8601} 2012-11-02 14:34:02,781 %d{ISO8601_BASIC} 20121102 143402,781 %d{ABSOLUTE} 14:34:02,781 %d{DATE} 02 Nov 2012 14:34:02,781 %d{COMPACT} 20121102143402781 %d{HH:mm:ss,SSS} 14:34:02,781 %d{dd MMM yyyy HH:mm:ss,SSS} 02 Nov 2012 14:34:02,781 %d{HH:mm:ss}{GMT+0} 18:34:02,781 %d{UNIX} 1351866842 %d{UNIX_MILLIS} 1351866842781 [EDIT] This configuration works... Add the classes to console and root appenders &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!-- Appenders --&gt; &lt;appender name="console" class="org.apache.log4j.ConsoleAppender"&gt; &lt;param name="Target" value="System.out" /&gt; &lt;layout class="XXX"&gt; &lt;param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p [%c{1}] (%t) [%X] %m%n" /&gt; &lt;/layout&gt; &lt;/appender&gt; &lt;logger name="XXX"&gt; &lt;level value="info"/&gt; &lt;/logger&gt; &lt;!-- Root Logger --&gt; &lt;root&gt; &lt;priority value="warn" /&gt; &lt;appender-ref ref="console" /&gt; &lt;/root&gt;
answers question: http://stackoverflow.com/q/21979606
type: Answer

http://stackoverflow.com/q/21924903
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33209330
favorite count: 0
has answer: http://stackoverflow.com/a/21924917
has title: Is there a way to make a if(null) do something
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: hashmap
has body: I have a hashmap of States and capitals Currently a user inputs the state and it will give them the corresponding capital and then they will type done when they want to kick out of the program Is there a way to make an if statement that would take the null that the hashmap would send if there was no said state in it? Like if I ask for Canada it will return null because there is no state named Canada. Is there a way to use the null it sends back in a for loop so I can do something like if(null) { say that that isn't a capital } else { say the capital of what was inserted }
tagged with: if-statement
has comment: http://stackoverflow.com/comment/33209453
accepted answer: http://stackoverflow.com/a/21924917
upvote count: 1

http://stackoverflow.com/a/21872809
has comment: http://stackoverflow.com/comment/33117155
has comment: http://stackoverflow.com/comment/33116874
has comment: http://stackoverflow.com/comment/33116529
has comment: http://stackoverflow.com/comment/33116327
has comment: http://stackoverflow.com/comment/33116352
score: 0
has body: Cause of NoClassDefFoundError is: Definition of class specified in exception was need to execute the code, but it could not be found under the specified package. Root cause: Usually it turns out that either jar file containing that Class definition was added or it was not added to build path. You can download apache POI jars for various releases here
answers question: http://stackoverflow.com/q/21872636
type: Answer
has comment: http://stackoverflow.com/comment/33117021

http://stackoverflow.com/comment/33263406
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21954902
score: 0
has text: Imagine you live on the Sun. And you see something happening on the earth. It happens on the current date. What's the timezone of the moment where this thing happened on earth? It doesn't have any, because you live on the sun. Now if you ask yourself "what would the clock display for the current time if I lived in the UK", then you have to transform your date to a string or a calendar, and use the UK timezone to do so.

http://stackoverflow.com/comment/33061544
score: 1
comment on: http://stackoverflow.com/q/21841821
type: Comment
type: QuestionComment
has text: See [How to Use Modality in Dialogs](http://docs.oracle.com/javase/tutorial/uiswing/misc/modality.html)..

http://stackoverflow.com/comment/33187618
type: AnswerComment
score: 0
type: Comment
has text: Again, I think this is a coincidence. It the contents of the buttons was different (or used a different Font, maybe even depending on the L&F?), their size would be different. But I think that the actual question was answered, so this is probably not important any more.
comment on: http://stackoverflow.com/a/21912257

http://stackoverflow.com/comment/33314370
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21983610
score: 0
has text: Thank you! I feel kind of stupid now because it was obvious :) Thank you for the help!!!!

http://stackoverflow.com/a/21867707
score: 1
has body: This might work for you: StringBuffer s=... for(char c: passcode.toCharArray()){ int index=-1; while((index=s.indexOf(c))!=-1){ s.deleteCharAt(index); } }
type: Answer
has comment: http://stackoverflow.com/comment/33107797
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33107939
answers question: http://stackoverflow.com/q/21867189

http://stackoverflow.com/comment/33292674
score: 0
type: Comment
type: QuestionComment
has text: Inside `onPostExecute` method can you make the `dialog` reference `null` after dismissing it and check again? Just want to check something.
comment on: http://stackoverflow.com/q/21971188

http://stackoverflow.com/a/21898439
has body: How to Use CardLayout With a new JFrame form, add a JPanel, a few JButtons to the form so it looks like this Your navigator pane should look like this. Notice I changed the variable names. You can do that by right clicking on the component from the navigator and selecting change variable name. Now we se the layout of mainPanel to CardLayout. Double click the mainPanel in the navigator, so it's visible by itself in the design view. Then right click it in the navigator and select Set Layout -> CardLayout. Your navigator should now look like this Now we're going to add different JPanels to the mainPanel. Just right click on the mainPanel from the navigator and select Add from Palette -> Swing Containers -> JPanel. Do that three times so you have three different JPanels. I also changed their variable names. Your navigator should not look like this. The layout part is set but lets add some labels so we can differentiate between the JPanels and also change their card name. So double click panelOne from the navigator. You will see the panel in the design view. Just drag and drop a JLabel to it and edit the text of the label to Panel One. Do that for the other two also, naming their labels accordingly. When you're done, your navigator should look like this. We also want to change the name of the panels that were given as CardLayout references. We can do that by double clicking on one of the panel (panelOne) and going to the properties pane. There towards the bottom, you will see a property Card Name. Just change it to whatever you want, I used panelOne. Do that for the other two JPanel Note: At any time, you can change the layout position, say you want panelTwo initially shown, instead of panelOne. Just right click on mainPanel and select Change Order. You can move the panels up or down on the order. We're almost done. We just need add the listeners to the buttons to switch between panels in the CardLayout. So double click on the frame from the navigator. You should see the…
downvote count: 0
score: 73
upvote count: 73
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21898425
has comment: http://stackoverflow.com/comment/56861753
accepted answer of: http://stackoverflow.com/q/21898425
has comment: http://stackoverflow.com/comment/116824076
type: Answer

http://stackoverflow.com/comment/33075411
type: QuestionComment
comment on: http://stackoverflow.com/q/21847972
has text: Would be nice if you'd `mark the part which is crucial` for you, like where you want to get the data in your desired format and maybe a reason why that isn't possible for you (yet) and examples of `input and your desired output` would be best.
score: 0
type: Comment

http://stackoverflow.com/comment/33168981
type: Comment
type: QuestionComment
has text: If you don't give source code examples and ask concrete problems, you are not getting any useful answers.
comment on: http://stackoverflow.com/q/21902101
score: 0

http://stackoverflow.com/q/22005043
possible better answer: http://stackoverflow.com/a/22005130
has title: else if doesn't recognise a specific string
has answer: http://stackoverflow.com/a/22005130
answer count: 2
accepted answer: http://stackoverflow.com/a/22005102
tagged with: string
has comment: http://stackoverflow.com/comment/33352502
score: 0
has answer: http://stackoverflow.com/a/22005102
type: AnsweredQuestion
type: Question
has body: I have come across this problem a few times, my code seems good but it just won't recognise a certain string. I use else if statements all the time but some of them just don't seem to work. I'm making a simple textbased game to excersise the things I have learned so far in java, which isn't that much. Please be gentle on my noobyness. What am I doing wrong here, for some reason it doesn't recognise the command "herobrine" and just goes to the "else"? User input: "enter" output: "enter what" user input: "herobrine" output: "command not recognised" public void scenetwo() { System.out.println("You bump into herobrine, what do?"); Scanner in = new Scanner(System.in); boolean ifone; ifone = false; String cmdone = in.next(); if (cmdone.equalsIgnoreCase("Help")) { Help helpObject = new Help(); helpObject.Helpdisplay(); Scenes ScenesObject = new Scenes(); ScenesObject.scenetwo(); } else if (cmdone.equalsIgnoreCase("Enter")){ System.out.println("Enter what?"); String conone = in.next(); if (conone.equalsIgnoreCase("Forest") || conone.equalsIgnoreCase("The forest")){ System.out.println("You're already in the forest, dummy!"); Scenes ScenesObject = new Scenes(); ScenesObject.scenetwo(); } else if (("Herobrine").equalsIgnoreCase(cmdone)) { System.out.println("You pervert, ok, you enter herobrine and his holyness digests you whole. Happy now?"); } else { System.out.println("Command not recognised"); } }
tagged with: if-statement
tagged with: java

http://stackoverflow.com/comment/33349049
score: 0
type: AnswerComment
type: Comment
has text: try executing the following query and tell me what it returns you : select strftime('%Y-%m-%d ', datetime(ActionDate, 'unixepoch')) from table;
comment on: http://stackoverflow.com/a/22001724

http://stackoverflow.com/comment/33248266
type: QuestionComment
has text: How about sharing some of your code (whatever is relevant for this question)?
comment on: http://stackoverflow.com/q/21946516
score: 0
type: Comment

http://stackoverflow.com/comment/33333614
has text: You should start a new question posting your new code and new error log and avoid comments, this question is already answered.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21990447
type: AnswerComment

http://stackoverflow.com/q/21992788
has answer: http://stackoverflow.com/a/21993387
accepted answer: http://stackoverflow.com/a/21992896
has body: I'm starting to experiment with web applications using JSPs. I want to create a simple web app which will run locally connected with an Oracle 11gR2 database as well. If i understood Oracle's licensing i won't have any issues since Web Application won't be in Production, am i right? Which Edition of Oracle would you recommend for a simple Web App running on Windows-64 bit?
favorite count: 0
tagged with: oracle11g
downvote count: 1
type: AnsweredQuestion
tagged with: licensing
tagged with: java
has answer: http://stackoverflow.com/a/21992896
score: -1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33330732
upvote count: 0
tagged with: jsp
has title: Which Oracle 11g R2 edition for learning to develop Web Applications
possible better answer: http://stackoverflow.com/a/21993387
linked to: http://stackoverflow.com/q/8834410

http://stackoverflow.com/comment/33201547
type: QuestionComment
comment on: http://stackoverflow.com/q/21899836
score: 0
has text: I tried to completely rely on autoconfiguration so I commented out LOG4J stuff in web.xml. Configuration works, but warning is still displayed "No Log4j context configuration provided. This is very unusual" :-(
type: Comment

http://stackoverflow.com/comment/33163563
comment on: http://stackoverflow.com/q/21898844
has text: @AndrewThompson: he's already been told all of this.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22090405
score: 2
downvote count: 0
has body: I finally found the problem. The issue did was related to classpath as jeremyjjbrown suggested in his comment, but was related to the Eclipse-Gradle plugin and the way it imports projects. How I solved the problem deleted the project in Eclipse went to terminal, in the project source folder typed gradle cleanEclipse typed gradle eclipse in Eclipse, import the project following the Import -> Existing Projects into Workspace That indeed solved the problem, but then I could not manage Gradle directly inside Eclipse (i.e. I could not right click -> Gradle -> Refresh All) since the project did not have a Gradle nature. Converting it to a Gradle project made the original problem coming back. So, finally, How I really solved the problem Looking at my gradle.build, you can see testCompile "org.jmock:jmock-junit4:2.6.0". jMock has a subtle problem: it brings junit-dep:4.4 with it. That dependency in Eclipse was causing the problem, inserting the related jar into the classpath. Changing the testCompile line to testCompile ("org.jmock:jmock-junit4:${jmockVersion}") { exclude group:"junit" } really solved the problem. I thank pbanfi who personally helped my debugging and solving the problem for real
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21916100
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21916100
type: Answer

http://stackoverflow.com/a/21972329
upvote count: 2
downvote count: 0
has body: I would do something like boolean success = false; int times = 0; do { input.nextLine(); if (condition) { success = true; } else { count++; } } while(!success &amp;&amp; times &lt; MAX_TIMES); if (success) { print("SUCCESS!!"); } else { print("FAIL"); }
answers question: http://stackoverflow.com/q/21972212
type: Answer
score: 2

http://stackoverflow.com/a/21912090
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21911739
downvote count: 0
has body: /** * @param args */ public static void main(String[] args) { try { URL testUrl = new URL("file://C:/Users/myName/Desktop/abc.txt"); System.out.println(testUrl.toString()); } catch (MalformedURLException e) { e.printStackTrace(); } } } The above code is working file, just tested it, so you need to use file:// and if possible try full path
type: Answer
has comment: http://stackoverflow.com/comment/33186601

http://stackoverflow.com/comment/33301307
has text: You probably want to do a loop around the whole input process as well, I'll leave that for you to work out though.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21976123
score: 0

jvm
tags question: http://stackoverflow.com/q/21859378
tags question: http://stackoverflow.com/q/21906736
type: Tag
tags question: http://stackoverflow.com/q/21896125
tags question: http://stackoverflow.com/q/21964606
tags question: http://stackoverflow.com/q/21862337
tags question: http://stackoverflow.com/q/21903741
tags question: http://stackoverflow.com/q/21984297
tags question: http://stackoverflow.com/q/21914466
tags question: http://stackoverflow.com/q/21874449
tags question: http://stackoverflow.com/q/21963420
tags question: http://stackoverflow.com/q/21859893
tags question: http://stackoverflow.com/q/21954137
tags question: http://stackoverflow.com/q/21908614
tags question: http://stackoverflow.com/q/21962631
tag name: jvm
tags question: http://stackoverflow.com/q/21924239
tags question: http://stackoverflow.com/q/21983858
tags question: http://stackoverflow.com/q/21918965
tags question: http://stackoverflow.com/q/21961309
tags question: http://stackoverflow.com/q/21950392
tags question: http://stackoverflow.com/q/21962153
tags question: http://stackoverflow.com/q/21976121
tags question: http://stackoverflow.com/q/21984037
tags question: http://stackoverflow.com/q/21968436
tags question: http://stackoverflow.com/q/21983812

http://stackoverflow.com/comment/33349144
type: AnswerComment
type: Comment
has text: But shouldn't it stay constant inside the for-loop? At least for one iteration? Parray should be valid for one whole set I would think. Maybe not. I'll rework it.
comment on: http://stackoverflow.com/a/22003028
score: 0

http://stackoverflow.com/comment/33326423
type: Comment
type: QuestionComment
score: 1
has text: I can't answer the why, but consider using a more sophisticated HTTP client.
comment on: http://stackoverflow.com/q/21990677

image
tags question: http://stackoverflow.com/q/21914178
tags question: http://stackoverflow.com/q/21959705
tags question: http://stackoverflow.com/q/21974083
tags question: http://stackoverflow.com/q/21896503
tags question: http://stackoverflow.com/q/21995995
tags question: http://stackoverflow.com/q/21894766
tags question: http://stackoverflow.com/q/21970879
tags question: http://stackoverflow.com/q/22001172
tags question: http://stackoverflow.com/q/21984208
tags question: http://stackoverflow.com/q/21897041
tags question: http://stackoverflow.com/q/21947313
tags question: http://stackoverflow.com/q/21951892
tags question: http://stackoverflow.com/q/21869198
tags question: http://stackoverflow.com/q/21963030
tags question: http://stackoverflow.com/q/21977106
tags question: http://stackoverflow.com/q/21963815
tags question: http://stackoverflow.com/q/21991473
tags question: http://stackoverflow.com/q/21986224
tags question: http://stackoverflow.com/q/21867298
tags question: http://stackoverflow.com/q/21873479
tags question: http://stackoverflow.com/q/21845456
tags question: http://stackoverflow.com/q/21947459
tag name: image
tags question: http://stackoverflow.com/q/21906376
tags question: http://stackoverflow.com/q/21978781
tags question: http://stackoverflow.com/q/22001122
tags question: http://stackoverflow.com/q/21969742
tags question: http://stackoverflow.com/q/21921860
tags question: http://stackoverflow.com/q/21848456
tags question: http://stackoverflow.com/q/21918012
tags question: http://stackoverflow.com/q/21923837
tags question: http://stackoverflow.com/q/21925791
type: Tag
tags question: http://stackoverflow.com/q/21968342

hql
tag name: hql
tags question: http://stackoverflow.com/q/21884803
type: Tag
tags question: http://stackoverflow.com/q/21942646
tags question: http://stackoverflow.com/q/21882192
tags question: http://stackoverflow.com/q/21855065

http://stackoverflow.com/comment/33238498
type: AnswerComment
comment on: http://stackoverflow.com/a/21940913
type: Comment
score: 0
has text: `numbers` is initialized on the proceeding line. Your statement is true, though doesn't apply here.

http://stackoverflow.com/comment/33268786
type: Comment
type: QuestionComment
score: 1
has text: `JTextFrame`?what's that?is that your custom component?
comment on: http://stackoverflow.com/q/21958147

http://stackoverflow.com/a/21991336
has comment: http://stackoverflow.com/comment/33328669
has comment: http://stackoverflow.com/comment/33328858
upvote count: 2
type: AcceptedAnswer
has body: Now my problem is that how do i set the position of the textfields and buttons in Window1? Rows like Jlabel - JTextField then new row ,and in the end of the page the button The thing is you're not using any layout managers. The default layout manager for JPanel is FlowLayout, which will do exactly what you're experiencing (horizontal layout of the components). Getting vertical alignment could be achieved by using different layout managers. You could use a GridBagLayout for all the component, or a GridLayout, or you could nest JPanel with different layout managers. The possibilities are endless. It just comes down to the exact look you want. See Laying out Components Within a Container to learn how to use different layout managers. I'll give you an example, but don't let it stop you from looking at the tutorials. You need to learn them. Also besides just positioning of the components layout managers use dynamic sizing either by respecting the preferred of components are not respecting them. You can see a picture in this answer of some of the layout managers that do and don't respect preferred sizes. import java.awt.FlowLayout; import java.awt.GridBagLayout; import java.awt.GridLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.SwingUtilities; public class LayoutManagers extends JPanel{ public LayoutManagers() { JLabel label = new JLabel("Text Field"); JTextField textField = new JTextField(20); JRadioButton rb1 = new JRadioButton("Radio 1"); JRadioButton rb2 = new JRadioButton("Radio 2"); JButton button = new JButton("Button"); JPanel panel1 = new JPanel(); panel1.add(label); panel1.add(textField); JPanel panel2 = new JPanel(); panel2.add(rb1); panel2.add(rb2); JPanel panel3 = new JPanel(new FlowLayout(FlowLayout.TRAILING)); panel3.add(button); JPanel panel4 = new JPanel(new GridLayout(3, 1)); panel4.add(panel1); panel4.a…
has comment: http://stackoverflow.com/comment/33328928
has comment: http://stackoverflow.com/comment/33328973
type: Answer
accepted answer of: http://stackoverflow.com/q/21990250
has comment: http://stackoverflow.com/comment/33328597
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21990250

http://stackoverflow.com/comment/33253656
type: QuestionComment
comment on: http://stackoverflow.com/q/21949602
score: 0
type: Comment
has text: `if (denominator == 0)`!!!

http://stackoverflow.com/comment/33152106
comment on: http://stackoverflow.com/q/21857758
has text: It means there are multiple copies of that class available in your classpath. Fish out the duplicate and get rid of it
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33299794
type: Comment
type: QuestionComment
score: 2
has text: TLDR. `ConcurrentModificationException` means you are modifying a collection or array or ... (adding or removing from it) in a loop iterating on that collection or array or ...
comment on: http://stackoverflow.com/q/21975390

http://stackoverflow.com/comment/33310640
type: Comment
has text: I know this is a messy thing to edit... but there will be very very few of these cases I think
comment on: http://stackoverflow.com/a/21981583
score: 0
type: AnswerComment

http://stackoverflow.com/q/21913045
duplicate of: http://stackoverflow.com/q/21860621
score: 0
tagged with: java
tagged with: authentication
upvote count: 1
accepted answer: http://stackoverflow.com/a/21915332
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/33188293
tagged with: database
type: AnsweredQuestion
tagged with: sqlite
has title: Simple Android App SQLite login
favorite count: 0
has comment: http://stackoverflow.com/comment/33188502
has answer: http://stackoverflow.com/a/21915332
type: Question
tagged with: android
has body: I have an on going issue with my SQLite login for my app. I have a simple DBHandler class that has created a database, inside the database I have stored a single user: Username: test Password: 1234 I also have a LogInScreen class that handles the view of the login and also will hold the methods to authenticate the login. I want the user to enter their login details into the text fields and when they press the login button to verify this against my database. As you can see in the attached image. I already have the username stored and this is my code The code does work but as you can see in the LogInScreen class it is not checking against my database but the actual text fields. Unfortunately I am completely new to SQLite and programming so I just can not figure it out. Any help will be highly appreciated :) package com.C05025.noughtsandcrosses; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.database.sqlite.SQLiteOpenHelper; public class DBHandler extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 1; private static final String DATABASE_NAME = "userDB.db"; private static final String TABLE_USERS = "users"; public static final String COLUMN_NAME = "name"; public static final String COLUMN_PASSWORD = "password"; public DBHandler(Context context, String name, CursorFactory factory, int version) { //super(context, name, factory, version); super(context, DATABASE_NAME, factory, DATABASE_VERSION); // TODO Auto-generated constructor stub } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub String CREATE_USER_TABLE = "CREATE TABLE " + TABLE_USERS + "(" + " INTEGER PRIMARY KEY," + COLUMN_NAME + " TEXT," + COLUMN_PASSWORD + " INTEGER" + ")"; db.execSQL(CREATE_USER_TABLE); } @Override public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) { /…
linked to: http://stackoverflow.com/q/21860621

http://stackoverflow.com/comment/33124109
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21876606
has text: I did as u said in **UPDATE** its giving exception as above

readonly
tag name: readonly
tags question: http://stackoverflow.com/q/21993940
type: Tag

http://stackoverflow.com/q/21994616
tagged with: http://stackoverflow.com/tag/xml
has title: SAX : UTF-8 decoding / encoding fail
type: UnansweredQuestion
tagged with: sax
has comment: http://stackoverflow.com/comment/33334505
tagged with: java
has body: I am using SAX for parsing and then writing to XML files. Both the parsing and writing processes break the UTF encoding. Sample XML in : &lt;AddressInfo&gt; &lt;City name="Antalya" code="07"&gt; &lt;District name="Döşemealtı"&gt; &lt;Zip code="01680" /&gt; &lt;/District&gt; &lt;/City&gt; &lt;AddressInfo&gt; results in : &lt;AddressInfo&gt; &lt;City name="Antalya" code="07"&gt; &lt;District name="DÃ¶ÅŸemealtÄ±"&gt; &lt;Zip code="01680"/&gt; &lt;/District&gt; &lt;/City&gt; &lt;AddressInfo&gt; I have tried specifying the InputStreamReader and the InputSource that feed the SAXParser, it didnT work: SAXParserFactory parserFactor = SAXParserFactory.newInstance(); SAXHandler handler = new SAXHandler(); SAXParser parser; try { //dis is a DataInputStream parser = parserFactor.newSAXParser(); InputStreamReader inputReader = new InputStreamReader(dis, Charset.forName("UTF-8")); InputSource inputSource = new InputSource(); inputSource.setCharacterStream(inputReader); inputSource.setEncoding("UTF-8"); //ignoring the inputsource and using directly the DataInputStream parser.parse(dis, handler); //also tried with inputSource, no joy //parser.parse(inputSource, handler); .... What might be going wrong? Any ideas? Cheers Note: The input xml does not have any declaration such as `&lt;?xml version="1.0" encoding="UTF-8"?&gt;`
type: Question
tagged with: encoding
has answer: http://stackoverflow.com/a/34517868
score: 0
answer count: 1
tagged with: utf-8

http://stackoverflow.com/a/21937463
has body: Go through this site for reult http://www.tutecentral.com/android-swipe-listview/
upvote count: 4
has comment: http://stackoverflow.com/comment/33232240
score: 4
type: Answer
answers question: http://stackoverflow.com/q/21937327
downvote count: 0

http://stackoverflow.com/a/21985062
has comment: http://stackoverflow.com/comment/33323544
has comment: http://stackoverflow.com/comment/33329140
upvote count: 1
has comment: http://stackoverflow.com/comment/33317725
score: 1
has comment: http://stackoverflow.com/comment/33316871
has body: This is because your test classpath does not includes android classes. From the documentation (https://developer.android.com/tools/testing/testing_android.html) : Android test suites are based on JUnit. You can use plain JUnit to test a class that doesn't call the Android API, or Android's JUnit extensions to test Android components. If you're new to Android testing, you can start with general-purpose test case classes such as AndroidTestCase and then go on to use more sophisticated classes. If your code is a apklib (and not an application) , there two way of testing it. Quoting the documentation) You can set up a test project that instruments an application project that depends on the library project. You can then add tests to the project for library-specific features. You can set up a standard application project that depends on the library and put the instrumentation in that project. This lets you create a self-contained project that contains both the tests/instrumentations and the code to test. http://developer.android.com/tools/projects/index.html#testing As a bonus (not not mandatory) you can use roboelectric (http://robolectric.org/) to avoid java.lang.RuntimeException: Stub (but not ClassNotFoundException) exceptions and running your test without the emulator.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21984760

http://stackoverflow.com/q/21905913
tagged with: regex
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21907063
tagged with: java
has title: how to reverse the last and first word in a string using regex java
type: Question
has answer: http://stackoverflow.com/a/21905983
answer count: 2
has body: I have this string... "My Phone number is out of range. This is Mark" I want to reform this as ... "Mark Phone number is out of range. This is My" How to do it with regex in JAVA ? what I have tried so far public static void main(String args[]){ String str = "My Phone number is out of range. This is Mark"; str=str.replaceAll("^(\\w+)(.*)(\\w+)$","$3$2$1"); System.out.print(str); } output: ky Phone number is out of range. This is MarMy
tagged with: string
score: 0

http://stackoverflow.com/q/21958636
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21972347
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/21961331
has comment: http://stackoverflow.com/comment/33272793
type: Question
score: 1
tagged with: java
has body: Only one instance of my Java application can run at a time. It runs on Linux. I need to ensure that one thread doesn't modify the file while the other thread is using it. I don't know which file locking or synchronization method to use. I have never done file locking in Java and I don't have much Java or programming experience. I looked into java NIO and I read that "File locks are held on behalf of the entire Java virtual machine. They are not suitable for controlling access to a file by multiple threads within the same virtual machine." Right away I knew that I needed expert help because this is production code and I have almost no idea what I'm doing (and I have to get it done today). Here's a brief outline of my code to upload some stuff (archive files) to a server. It gets the list of files to upload from a file (call it "listFile") -- and listFile can be modified while this method is reading from it. I minimize the chances of that by copying listFile to a temp file and using that temp file thereafter. But I think I need to lock the file during this copy process (or something like that). package myPackage; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import com.example.my.FileHelper; import com.example.my.Logger; public class BatchUploader implements Runnable { private int processUploads() { File myFileToUpload; File copyOfListFile = null; try { copyOfListFile = new File("/path/to/temp/workfile"); File origFile = new File("/path/to/listFile"); //"listFile" - the file that contains a list of files to upload DataWriter.copyFile(origFile, copyOfListFile);//see code below } catch (IOException ex) { Logger.log(ex); } try { BufferedReader input = new BufferedReader(new FileReader(copyOfListFile)); try { while (!stopRunning &amp;&amp; (fileToUploadName = input.readLine()) != null) { upload(new File(fileToUploadName)); } } finally { input.close(); isU…
has answer: http://stackoverflow.com/a/21961331
has title: Java: how to synchronize file modification by threads
answer count: 2
possible better answer: http://stackoverflow.com/a/21972347
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33271828
tagged with: synchronization
favorite count: 0
has comment: http://stackoverflow.com/comment/33272893
tagged with: file-io
has comment: http://stackoverflow.com/comment/33272646

http://stackoverflow.com/comment/33107026
comment on: http://stackoverflow.com/q/21867214
has text: could it be a server side problem? Could you show a json object that is being returned with your GET request?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33330958
comment on: http://stackoverflow.com/a/21993015
has text: answer for concerning#3 yes: peers with `null` authorities should be included. Also method which changes UserAuthorities is in my class, I can modify it. And the last - it seems bad idea for me do make all methods `synchronized`, because my app based on non-blocking io (websockets) and there will be many users who simultaneously will do operations with the same peers collection.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33194255
comment on: http://stackoverflow.com/q/21916188
score: 0
type: QuestionComment
has text: Prolog comes in mind :) Here's a quick approach: generate hash for every permutation of the input alphabet, that's `len([A,L,E,P,P])!` in your case - and assuming you have a prebuilt hash table for every word in `.txt` file, you then just have to do 120 O(1) lookups to it.
type: Comment

http://stackoverflow.com/comment/33084426
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21854984
has text: well you should do a post request to 'SayisalLotoSonuclari.aspx' page, with a POST body..you should investigate the html code to discover the values of that body
score: 0

http://stackoverflow.com/a/21883623
score: 8
downvote count: 0
upvote count: 8
accepted answer of: http://stackoverflow.com/q/21882343
answers question: http://stackoverflow.com/q/21882343
has body: Looks very much like you're missing the jgoodies-common.jar on your classpath. You can get this from Maven I would strongly recommend using a dependency management system for your build which should avoid these kinds of problems in the future
type: AcceptedAnswer
type: Answer

while-loop
tags question: http://stackoverflow.com/q/21885635
type: Tag
tags question: http://stackoverflow.com/q/21979008
tags question: http://stackoverflow.com/q/21888210
tags question: http://stackoverflow.com/q/21998543
tags question: http://stackoverflow.com/q/21865913
tags question: http://stackoverflow.com/q/22000848
tags question: http://stackoverflow.com/q/21950867
tags question: http://stackoverflow.com/q/21943169
tags question: http://stackoverflow.com/q/21953242
tags question: http://stackoverflow.com/q/21975823
tags question: http://stackoverflow.com/q/21967500
tags question: http://stackoverflow.com/q/21976763
tags question: http://stackoverflow.com/q/21977213
tags question: http://stackoverflow.com/q/21915198
tag name: while-loop
tags question: http://stackoverflow.com/q/21978065

http://stackoverflow.com/comment/33333860
has text: Because all the money is in smartphones.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21994493
score: 1

http://stackoverflow.com/comment/33346404
score: 0
has text: Oh! I changed the alternative to Oracle, but it looks like that's not enough. It makes use of `/usr/lib/jvm/default-java/bin/java` and it looks like that would be OpenJVM. Arrrgh!
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22001260

http://stackoverflow.com/a/21948976
has body: do it like this: public String toString () { return ("A " + size + "cm " + weight + " " + this.getClass().getSimpleName() ); }
accepted answer of: http://stackoverflow.com/q/21948944
upvote count: 3
has comment: http://stackoverflow.com/comment/33252683
answers question: http://stackoverflow.com/q/21948944
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33252743
type: Answer
score: 3

http://stackoverflow.com/q/21950804
type: UnansweredQuestion
downvote count: 1
linked to: http://stackoverflow.com/q/8338193
has body: I got a program to convert integer to Hexadecimal, but I want the input to be Hexadecimal and convert to decimal. Please help.... int m; String Hdec=""; while(m&gt;0){ int rem; rem=m%16; if(rem&gt;=0&amp;rem&lt;=9) Hdec=rem+Hdec; else if(rem==10) Hdec="A"+Hdec; else if(rem==11) Hdec="B"+Hdec; else if(rem==12) Hdec="C"+Hdec; else if(rem==13) Hdec="D"+Hdec; else if(rem==14) Hdec="D"+Hdec; else if(rem==15) Hdec="D"+Hdec; m=m/16; } sop(Hdec);
has answer: http://stackoverflow.com/a/21950878
has title: Java a program that accepts a hexadecimal representation of a number and outputs the decimal representation of that number
tagged with: java
has comment: http://stackoverflow.com/comment/33255766
has comment: http://stackoverflow.com/comment/33255794
has answer: http://stackoverflow.com/a/21950853
type: Question
answer count: 2
upvote count: 0
duplicate of: http://stackoverflow.com/q/8338193
score: -1
has comment: http://stackoverflow.com/comment/33255753
favorite count: 0

http://stackoverflow.com/a/24556197
score: 1
type: Answer
upvote count: 1
has body: You just have to make sure 1- You have java installed 2- You have JDK installed 3- Add java PATH to the environment variables 4- Add JDK PATH to the environment variables 5- set the JAVA_HOME variable in environment variables
downvote count: 0
answers question: http://stackoverflow.com/q/21909165

http://stackoverflow.com/comment/33163784
has text: the equals doesnt compile, cuz i dont know how to do it...
comment on: http://stackoverflow.com/q/21898958
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21954240
has answer: http://stackoverflow.com/a/21954973
has answer: http://stackoverflow.com/a/21954397
score: 0
accepted answer: http://stackoverflow.com/a/21954369
has comment: http://stackoverflow.com/comment/33261968
possible better answer: http://stackoverflow.com/a/21954973
has comment: http://stackoverflow.com/comment/33261943
has comment: http://stackoverflow.com/comment/33263669
has comment: http://stackoverflow.com/comment/33261635
tagged with: large-data
answer count: 4
tagged with: som
has comment: http://stackoverflow.com/comment/33262848
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21954343
has answer: http://stackoverflow.com/a/21954369
type: Question
has title: How to process large data files iteratively?
tagged with: java
has body: I have a space separated data file with 4.5 million entries in the following format CO_1 A 0 0 0 0 1 CO_2 A 0 0 0 0 1 This data file is used as an input to the Self-Organizing Map (SOM) algorithm that iterates through this file 100 (in my case) times. I use the following readFile function to copy the file completely into the temp string and pass the string on to the SOM algorithm. public String readFile() { String temp = ""; try { FileReader file = new FileReader(FILE_LOCATION); BR = new BufferedReader(file); String strLine = null; while((strLine = BR.readLine()) != null) { temp += strLine + "\n"; } } catch(Exception e) { } return temp; } How ever I feel the above method puts a heavy burden on memory and slows down the iterations which could result in memory overruns. Currently I'm running this code in a cluster with 30GB memory allocation and the execution has not even completed a single iteration for about 36 hours. I cannot partially read the file (as in blocks of lines) since the SOM will have to poll for data once the initial block is done which could result in even further complications. Any ideas how I could improve this so I could successfully iterate 4.5 million entries 100 times. EDIT The whole files is read in to the string using the above method only once. Then the string variable is used throughout the 100 iterations. However, each time string tokenizers has been utilized to process each line in the file * number of iterations.

http://stackoverflow.com/comment/33240242
comment on: http://stackoverflow.com/a/21942359
score: 0
type: AnswerComment
has text: Thanks for the sample code. Is it possible to call `logoutAccount()` programatically, after X seconds, without needing the user to click on it? **Edit:** See, this is why I wanted to use that method in plain JavaScript ( )
type: Comment

http://stackoverflow.com/a/21854860
has body: You question is very generic so I'm going to assume you are a beginning Java web programmer. To your first question, I advise you to use JSP pages (or any other template technology). Yes, it is possible to serve .html files from a Servlet using a RequestDispatcher, but JSP pages are meant to generate such output - it is easy to make a small part of a JSP page dynamic, while serving HTML files from a servlet doesn't give you an option for some dynamic behaviour. Just rename your file.html page to file.jsp and put in in your web source directory of your war project. To your second question - HTML sent by a servlet or a JSP page is still normal HTML and you can use CSS as you would in any HTML page. Code example: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { RequestDispatcher dispatcher = request.getRequestDispatcher("/file.html"); // If you want to include the file in your response, use dispatcher.include - // you can include multiple different files or send more output using // response.getWriter() or response.getOutputStream dispatcher.include(request, response); // If you just want to send this one file as the response, use dispatcher.forward dispatcher.forward(request, response); }
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/21854575
type: Answer

http://stackoverflow.com/comment/33183965
type: Comment
comment on: http://stackoverflow.com/q/21910144
score: 0
type: QuestionComment
has text: Ok, by why write it as an Object Stream and give it a `.txt` file extension. BTW Soap is usually XML, I am confused why Object Stream is being used at all other than to confuse matters.

http://stackoverflow.com/comment/33362444
type: Comment
has text: thank you for your response.But my question is "if there is no any abstract method present in HTTP servlet class(means we have to override all methods) then why it is called ABSTRACT class?"
type: AnswerComment
comment on: http://stackoverflow.com/a/21941321
score: 0

http://stackoverflow.com/comment/33281135
comment on: http://stackoverflow.com/q/21963686
has text: This isn't the issue, but just so you know: `line.trim()` doesn't actually modify `line` (Strings are immutable), it returns the result. You want to do `line = line.trim();`
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33065445
comment on: http://stackoverflow.com/q/21844000
type: QuestionComment
type: Comment
score: 1
has text: 65280 is 0xff00. Keep in mind that Java chars are two bytes wide, not one byte.

http://stackoverflow.com/a/21910985
answers question: http://stackoverflow.com/q/21910532
has body: I've just done what you're trying to do. I called my first project 'project1'. In this projects i have a package called 'package1' which in turn contains a class called 'Class1' containing a (public) static method called 'staticMethod'. I called my second project 'project2' with a class 'Class2' in 'package2'. I added project1 to the build path of project2 and then inserted the statement import package1.Class1 at the beginning of the class Class2.
type: Answer
score: 0

http://stackoverflow.com/comment/33074695
score: 0
comment on: http://stackoverflow.com/q/21849602
type: Comment
type: QuestionComment
has text: You try another URI for mp4 video start.

http://stackoverflow.com/comment/33300874
score: 0
type: Comment
type: QuestionComment
has text: My component scan is in the root-context.xml, is this not where I should put it? I have package names such as com.myapp.spring.controllers com.myapp.spring.configuration and my XML file has the following <context:component-scan base-package="com.myapp.spring"></context:component-scan>
comment on: http://stackoverflow.com/q/21922646

http://stackoverflow.com/comment/33236373
type: QuestionComment
comment on: http://stackoverflow.com/q/21940162
score: 3
has text: Make `index` `private` and recompile your code, to detect accidental modification by client code.
type: Comment

http://stackoverflow.com/a/21974874
answers question: http://stackoverflow.com/q/21974856
type: Answer
has body: if (top&lt;bottom)min=top else min=bottom
score: 0

http://stackoverflow.com/comment/35352777
type: AnswerComment
comment on: http://stackoverflow.com/a/22165421
score: 0
type: Comment
has text: yeah, i've applied your correction.Sorry to say i don't know how to apply window function. Please give some codes for window function, Thank you.

http://stackoverflow.com/a/21972856
type: Answer
answers question: http://stackoverflow.com/q/21972205
score: 0
has body: Because you called the finish() method at the beginning of the onClick(). Which stops your activity without doing the following stuff.

http://stackoverflow.com/q/21865321
type: Question
linked to: http://stackoverflow.com/q/19040802
score: 0
has answer: http://stackoverflow.com/a/21865399
answer count: 1
accepted answer: http://stackoverflow.com/a/21865399
has title: How to transform with Guava, a List<String> and List<Integer> in another List<Person>?
has body: I've got two lists: List&lt;String&gt; names; List&lt;Integer&gt; ages; So, I would like to transform these lists in unique List of Person, Person class is like this: public class Person { private String name; private Integer age; } How I do it using Guava or another way?
linked to: http://stackoverflow.com/q/2118932
type: AnsweredQuestion
tagged with: guava
duplicate of: http://stackoverflow.com/q/19040802
has comment: http://stackoverflow.com/comment/33103471
tagged with: java
has comment: http://stackoverflow.com/comment/33103434

http://stackoverflow.com/a/21977878
has comment: http://stackoverflow.com/comment/33340902
answers question: http://stackoverflow.com/q/21977718
upvote count: 1
score: 1
downvote count: 0
has body: Here, I'll start it for you: public &lt;T&gt; Iterator&lt;T&gt; flatten(final Iterator&lt;Iterator&lt;T&gt;&gt; iterators) { if (iterators == null) { throw new IllegalArgumentException("iterators can't be null"); } return new Iterator&lt;&gt;() { @Override public boolean hasNext() { throw new UnsupportedOperationException("Not implemented: hasNext"); } @Override public T next() { throw new UnsupportedOperationException("Not implemented: next"); } }; } Now you just do that pesky brainwork and you'll be done. EDIT If you're not used to that syntax, here's a slightly easier one: public &lt;T&gt; Iterator&lt;T&gt; flatten(final Iterator&lt;Iterator&lt;T&gt;&gt; iterators) { return new MyFlatteningIterator&lt;&gt;(iterators); } public class MyFlatteningIterator&lt;T&gt; implements Iterator&lt;T&gt; { private final Iterator&lt;Iterator&lt;T&gt;&gt; iterators; public MyFlatteningIterator(final Iterator&lt;Iterator&lt;T&gt;&gt; iterators) { if (iterators == null) { throw new IllegalArgumentException("iterators can't be null"); } this.iterators = iterators; } @Override public boolean hasNext() { throw new UnsupportedOperationException("Not implemented: hasNext"); } @Override public T next() { throw new UnsupportedOperationException("Not implemented: next"); } }
has comment: http://stackoverflow.com/comment/33305008
type: Answer

http://stackoverflow.com/comment/33241303
comment on: http://stackoverflow.com/a/21942856
type: AnswerComment
has text: Kind of. Without `+` regex can only accept single characters, not group of them so it will only match strings containing one correct character.
type: Comment
score: 1

swig
tags question: http://stackoverflow.com/q/21909617
tag name: swig
type: Tag
tags question: http://stackoverflow.com/q/22001125
tags question: http://stackoverflow.com/q/21932242

http://stackoverflow.com/comment/33253399
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21949420
has text: Running the Junit tell me but i want to log it into file

http://stackoverflow.com/comment/33295851
score: 0
type: QuestionComment
has text: Use `Iterator.remove()`
type: Comment
comment on: http://stackoverflow.com/q/21973342

http://stackoverflow.com/q/21915667
has answer: http://stackoverflow.com/a/21919076
accepted answer: http://stackoverflow.com/a/21919076
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: c#
tagged with: sybase
score: 0
has title: Connect to Deprecated Sybase Database
answer count: 1
tagged with: sybase-asa
has body: I'm trying to connect to a Sybase Adaptive SQL Anywhere database that is running version 9. I'm currently trying to use iAnywhere.Data.AsaClient.dll. When I try to create a new connection, AsaConnection myConnection = new AsaConnection(); I get System.IO.FileNotFoundException stating File dbdata9.dll was not found. I can't find dbdata9.dll anywhere and it seems as if Sybase has long since deprecated that version. Is there anyway to get this file or are there any other tools that I can use to get access to this data programmatically?

http://stackoverflow.com/a/21945952
accepted answer of: http://stackoverflow.com/q/21944714
answers question: http://stackoverflow.com/q/21944714
type: Answer
score: 2
upvote count: 2
has body: If you want to go through with determining the clicked point color you could do something like this: Pixmap pixmap; void getScreenShot(){ Gdx.gl.glPixelStorei(GL10.GL_PACK_ALIGNMENT, 1); pixmap = new Pixmap(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), Pixmap.Format.RGBA8888); Gdx.gl.glReadPixels(0,0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, pixmap.getPixels()); } /** * Gets the RGB values of the clicked pixel * * @param screenX * X clicked position * @param screenY * Y clicked position * @return Vector3f of the RGB values. */ private Vector3 getRGBValues(int screenX, int screenY) { float newY = Gdx.graphics.getHeight() - screenY; //if using y up, you need to convert it to y up from a y down since by default all of the clicked cordinates are in a y down system int value = colorMap.getPixel((int) screenX, (int) newY); int R = ((value &amp; 0xff000000) &gt;&gt;&gt; 24); int G = ((value &amp; 0x00ff0000) &gt;&gt;&gt; 16); int B = ((value &amp; 0x0000ff00) &gt;&gt;&gt; 8); return new Vector3(R, G, B); } This code assumes that the camera has not been zoomed and has not been moved. If either of these conditions are not met some code must be added to account for camera movement and zooming. So you would first have to call the getScreenShot() method and then the getRGBValues with the clicked coordinates as the parameters. From these RGB values if it is the same as the line you are drawing you know that the user did in fact click the line. If not, then the user did not click the line. I am not sure how performance friendly this method is... but it should be a method
has comment: http://stackoverflow.com/comment/33258705
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21995185
has answer: http://stackoverflow.com/a/21995305
downvote count: 0
has answer: http://stackoverflow.com/a/60880018
tagged with: java
has comment: http://stackoverflow.com/comment/33334785
has body: The issue is that running from cmd is not very good for debugging . I need to debug the code , so is there any way i could increase heap and debug in eclipse . I tried increasing heap in control panel - &gt; java -&gt; view - &gt; 6g but still get the java out of memory in eclipse
type: Question
has title: How to increase heap space and debug in Eclipse
score: 3
tagged with: eclipse
has comment: http://stackoverflow.com/comment/107711270
upvote count: 3
has answer: http://stackoverflow.com/a/21995297
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/33337314
tagged with: heap-memory
type: UnansweredQuestion

http://stackoverflow.com/comment/33362724
comment on: http://stackoverflow.com/a/21957458
score: 0
type: AnswerComment
type: Comment
has text: I have created a custom class extending StrictSSL provided by apache and set false in the default contructor which worked but its security breach.

http://stackoverflow.com/a/48625490
answers question: http://stackoverflow.com/q/21985397
type: Answer
has body: public static List&lt;String&gt; removeDuplicateElements(List&lt;String&gt; array){ List&lt;String&gt; temp = new ArrayList&lt;String&gt;(); List&lt;Integer&gt; count = new ArrayList&lt;Integer&gt;(); for (int i=0; i&lt;array.size()-2; i++){ for (int j=i+1;j&lt;array.size()-1;j++) { if (array.get(i).compareTo(array.get(j))==0) { count.add(i); int kk = i; } } } for (int i = count.size()+1;i&gt;0;i--) { array.remove(i); } return array; } }
score: 0

http://stackoverflow.com/comment/33250095
score: 1
comment on: http://stackoverflow.com/q/21947300
has text: Can't you use both? Direct servlets for the complicated stuff and the framework for fluffy media stuff?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21945208
score: 8
has comment: http://stackoverflow.com/comment/36586400
accepted answer of: http://stackoverflow.com/q/21856285
has body: I found the way to do it. I ended up using JACOB (from here <= upd 2021-10-25: now here). Downloaded and installed Visual FoxPro OLE DB driver from http://msdn.microsoft.com/en-US/vfoxpro/bb190232 (upd 2021-10-25: links there do not work anymore). the direct link is: Microsoft OLE DB Provider for Visual FoxPro 9.0 SP2 (upd 2021-10-25: does not work anymore) Downloaded JACOB version 1.17 binary and source code. Added jacob.jar as a Java Build Path library Copied jacob-1.17-x86.dll to the project directory (same place as eclipse's .project file) Copied jacob-1.17_src\jacob-1.17\samples\com\jacob\samples\ado contents to my src directory and: Removed the ms directory renamed test.java to Main.java Changed the connection string to: String connectStr = "Provider=vfpoledb;Data Source=C:\\path\\to\\Data\\;Collating Sequence=general;"; Changed the queryStr to match one of the dbf's name Hope this helps someone else.
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/68805390
has comment: http://stackoverflow.com/comment/36586472
upvote count: 9
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36590819
has comment: http://stackoverflow.com/comment/76355698
has comment: http://stackoverflow.com/comment/76233224
has comment: http://stackoverflow.com/comment/36581260
answers question: http://stackoverflow.com/q/21856285

obiee
tag name: obiee
type: Tag
tags question: http://stackoverflow.com/q/22003742

http://stackoverflow.com/a/21999466
upvote count: 2
has comment: http://stackoverflow.com/comment/33343975
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33343213
has comment: http://stackoverflow.com/comment/33343053
has comment: http://stackoverflow.com/comment/33343549
has comment: http://stackoverflow.com/comment/33343333
has body: Per SupportMapFragment.getMap(), it returns null if the view of the fragment is not yet ready. This can happen if the fragment lifecyle have not gone through onCreateView(LayoutInflater, ViewGroup, Bundle) yet. This can also happen if Google Play services is not available. If Google Play services becomes available afterwards and the fragment have gone through onCreateView(LayoutInflater, ViewGroup, Bundle), calling this method again will initialize and return the GoogleMap. Consider configuring your initial state via XML attributes and moving your getMap().setMyLocationEnabled(true) to your onLocationChanged to ensure that your Map has been laid out and configured, rather than doing it in onCreate
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21999061
accepted answer of: http://stackoverflow.com/q/21999061

http://stackoverflow.com/a/21985868
type: Answer
answers question: http://stackoverflow.com/q/21985416
has comment: http://stackoverflow.com/comment/33359361
has comment: http://stackoverflow.com/comment/33359117
has comment: http://stackoverflow.com/comment/33359161
has comment: http://stackoverflow.com/comment/33359719
has comment: http://stackoverflow.com/comment/33359646
has comment: http://stackoverflow.com/comment/33358271
has comment: http://stackoverflow.com/comment/33359909
has comment: http://stackoverflow.com/comment/33359313
has comment: http://stackoverflow.com/comment/33358722
type: AcceptedAnswer
has body: ZK just wraps the standard Java HTML/HTTP API. Calling Sessions.getCurrent().getNativeSession() should give you an instance of type HttpSession.
has comment: http://stackoverflow.com/comment/33359333
score: 0
accepted answer of: http://stackoverflow.com/q/21985416

http://stackoverflow.com/comment/33167358
type: AnswerComment
comment on: http://stackoverflow.com/a/21900808
score: 0
type: Comment
has text: Welcome.. Sometimes you just need another pair of eyes. :)

http://stackoverflow.com/q/21879386
type: UnansweredQuestion
has title: Mocking not working for Socket class
tagged with: java
tagged with: easymock
has body: I want to return a defined Socket instance whenever new Socket("server ip", portNum) is called, my code looks like this (am using easymock) public static Socket mockSocket ; public static Object []arguments = {"Test Client",8443}; ........................................... .............................................. mockSocket = new Socket("20.206.214.76", 8080); PowerMock.createMock(Socket.class, arguments); expectNew(Socket.class,arguments).andReturn(mockSocket); its giving me compilation error on -> PowerMock.createMock(Socket.class, arguments); error is: "The type org.easymock.ConstructorArgs cannot be resolved. It is indirectly referenced from required .class files" Can someone pls help?
type: Question
has answer: http://stackoverflow.com/a/21879868
score: 0
answer count: 1

http://stackoverflow.com/a/21880888
has comment: http://stackoverflow.com/comment/33130639
has comment: http://stackoverflow.com/comment/33130415
downvote count: 0
answers question: http://stackoverflow.com/q/21880819
type: Answer
has comment: http://stackoverflow.com/comment/33130765
has body: logically, it is better to have all functions who deal with cell data be made / defined inside cell class? Generally, yes. You don't want to expose the members of a class, even via getters etc. If you do, do it in a fashion that allows you to change the implementation without having to change the API. For your particular question, I would add the method to render your cell class within the class. However I would perhaps write it to take an OutputStream or Writer such that it can write to a generic destination, rather than specifically to stdout or stderr. e.g. cell.outputTo(outputstream); I would then follow this pattern through to your Cell array. I would perhaps have a class representing this Cell array (call it a Culture, perhaps?) and that would be responsible for maintaining the underlying array (or whatever you choose your underlying collection to be implemented as), asserting the structure, contents etc. Otherwise you'll have a collection within your solution that can't assert such things centrally.
score: 3
has comment: http://stackoverflow.com/comment/33130487
upvote count: 3

http://stackoverflow.com/q/21936728
downvote count: 2
has answer: http://stackoverflow.com/a/21936794
has title: Min/Max of object.attribute in a list of object with guava
type: AnsweredQuestion
tagged with: guava
possible better answer: http://stackoverflow.com/a/21936794
tagged with: java
has answer: http://stackoverflow.com/a/21936905
has comment: http://stackoverflow.com/comment/33230582
type: Question
has body: Let's take a list of Person defined as Name Surname Age I want the max(age) in a List&lt;Person&gt;. I could iterate on this list and manually keep the max : Integer max = null; for(Person p : list) { if(max == null || max &lt; p.getAge()) { max = p.getAge(); } return max; } But I feel that there might exist a combination of Guava methods which can do it for me. If I write a Function&lt;Person, Integer&gt;, is there a ready-to-use method to get the max from the list?
favorite count: 0
has comment: http://stackoverflow.com/comment/33230664
has answer: http://stackoverflow.com/a/21940385
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/21936905
linked to: http://stackoverflow.com/q/11758982
has comment: http://stackoverflow.com/comment/33231114
has comment: http://stackoverflow.com/comment/33230429
upvote count: 2

http://stackoverflow.com/a/22003319
has comment: http://stackoverflow.com/comment/33349707
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33349776
has body: I would start by looking at this line: StringEntity postData = new StringEntity(json, "UTF8"); It's "UTF-8", not "UTF8". Note: I would suggest you using the HTTP.UTF_8 constant in order to avoid this kind of problem again. StringEntity postData = new StringEntity(json, HTTP.UTF_8);
type: Answer
answers question: http://stackoverflow.com/q/22002691

http://stackoverflow.com/a/21977010
accepted answer of: http://stackoverflow.com/q/21976953
has comment: http://stackoverflow.com/comment/33302880
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33304275
has body: wait is called on Object while sleep is called on Thread. The statement isn't even correct. wait() is a non-static method of Object, so must be called with a specific instance. sleep() is a static method of Thread,, so it doesn't require a specific instance, but what it does is to put the current thread to sleep. It is called via the static invocation Thread.sleep(). Nothing to do with any specific object at all.
answers question: http://stackoverflow.com/q/21976953
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/33076543
type: QuestionComment
comment on: http://stackoverflow.com/q/21848508
has text: @Kotsos well, yeah, in case if the number of insertions is supposed to be larger than the hits, then reqID-index hashing gives no advantage over using `indexOf` :) otherwise you're better off using hashing
score: 0
type: Comment

http://stackoverflow.com/comment/33318203
has text: check first your ftp.connect(Ftp_Path); ftp.login(ftpUserID, ftpPassword); ftp connected or not ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21986121

http://stackoverflow.com/comment/33101284
has text: It's unclear what is wrong
score: 0
comment on: http://stackoverflow.com/q/21864285
type: Comment
type: QuestionComment

maven
tags question: http://stackoverflow.com/q/21888845
tags question: http://stackoverflow.com/q/21968104
tags question: http://stackoverflow.com/q/21983204
tags question: http://stackoverflow.com/q/21993736
tags question: http://stackoverflow.com/q/21996804
tags question: http://stackoverflow.com/q/21893145
type: Tag
tags question: http://stackoverflow.com/q/21945556
tags question: http://stackoverflow.com/q/21988220
tags question: http://stackoverflow.com/q/22000423
tags question: http://stackoverflow.com/q/21902896
tags question: http://stackoverflow.com/q/21848126
tags question: http://stackoverflow.com/q/21948220
tags question: http://stackoverflow.com/q/22002529
tags question: http://stackoverflow.com/q/21936789
tags question: http://stackoverflow.com/q/21869203
tags question: http://stackoverflow.com/q/21958327
tags question: http://stackoverflow.com/q/21867477
tags question: http://stackoverflow.com/q/21877482
tags question: http://stackoverflow.com/q/21916177
tags question: http://stackoverflow.com/q/21866954
tags question: http://stackoverflow.com/q/21991429
tags question: http://stackoverflow.com/q/21861482
tags question: http://stackoverflow.com/q/21930907
tags question: http://stackoverflow.com/q/21877840
tags question: http://stackoverflow.com/q/21906010
tags question: http://stackoverflow.com/q/21961313
tags question: http://stackoverflow.com/q/21920616
tags question: http://stackoverflow.com/q/21998796
tags question: http://stackoverflow.com/q/21856550
tags question: http://stackoverflow.com/q/22001055
tags question: http://stackoverflow.com/q/21856131
tags question: http://stackoverflow.com/q/21884247
tags question: http://stackoverflow.com/q/21923387
tags question: http://stackoverflow.com/q/21952445
tags question: http://stackoverflow.com/q/21911052
tags question: http://stackoverflow.com/q/21962429
tags question: http://stackoverflow.com/q/21864521
tags question: http://stackoverflow.com/q/21912921
tags question: http://stackoverflow.com/q/21858934
tags question: http://stackoverflow.com/q/21889660
tags question: http://stackoverflow.com/q/21841857
tags question: http://stackoverflow.com/q/21978171
tags question: http://stackoverflow.com/q/21917527
tags question: http://stackoverflow.com/q/21989065
tags question: http://stackoverflow.com/q/21912078
tags question: http://stackoverflow.com/q/21894128
tags question: http://stackoverflow.com/q/21843869
tags question: http://stackoverflow.com/q/21888219
tags question: http://stackoverflow.com/q/21878375
tags question: http://stackoverflow.com/q/21987632
tags question: http://stackoverflow.com/q/21990160
tags question: http://stackoverflow.com/q/21914628
tags question: http://stackoverflow.com/q/21855988
tags question: http://stackoverflow.com/q/21892555
tags question: http://stackoverflow.com/q/21955007
tags question: http://stackoverflow.com/q/21903881
tags question: http://stackoverflow.com/q/21924558
tags question: http://stackoverflow.com/q/21930270
tags question: http://stackoverflow.com/q/21918454
tags question: http://stackoverflow.com/q/21923945
tags question: http://stackoverflow.com/q/21877064
tags question: http://stackoverflow.com/q/21884724
tags question: http://stackoverflow.com/q/21929820
tags question: http://stackoverflow.com/q/21855681
tags question: http://stackoverflow.com/q/21951049
tags question: http://stackoverflow.com/q/21957060
tags question: http://stackoverflow.com/q/21964254
tags question: http://stackoverflow.com/q/21985600
tags question: http://stackoverflow.com/q/21881183
tags question: http://stackoverflow.com/q/21991732
tags question: http://stackoverflow.com/q/21990396
tags question: http://stackoverflow.com/q/21856356
tags question: http://stackoverflow.com/q/21856682
tags question: http://stackoverflow.com/q/21985118
tags question: http://stackoverflow.com/q/21850359
tags question: http://stackoverflow.com/q/21847195
tags question: http://stackoverflow.com/q/21854665
tags question: http://stackoverflow.com/q/21902873
tags question: http://stackoverflow.com/q/21853847

http://stackoverflow.com/comment/33081974
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21853832
has text: use Class.forName("class name").getClass().

http://stackoverflow.com/a/21884851
has comment: http://stackoverflow.com/comment/33245910
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33157512
has comment: http://stackoverflow.com/comment/33160709
has body: Try this: import java.awt.*; import javax.swing.*; public class GridBagDemo implements Runnable { public static void main(String[] args) { SwingUtilities.invokeLater(new GridBagDemo()); } public void run() { JComponent redComp = new JPanel(); redComp.setBackground(Color.RED); JComponent greenComp = new JPanel(); greenComp.setBackground(Color.GREEN); JComponent blueComp = new JPanel(); blueComp.setBackground(Color.BLUE); JComponent whiteComp = new JPanel(); whiteComp.setBackground(Color.WHITE); GridBagConstraints gbc = new GridBagConstraints(); // we'll use this anchor/fill for all components gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.BOTH; JPanel panel = new JPanel(new GridBagLayout()); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 2; gbc.gridheight = 1; gbc.weightx = 0.8; // use 80% of the overall width gbc.weighty = 0.8; // use 80% of the overall height panel.add(redComp, gbc); gbc.gridx = 2; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 2; gbc.weightx = 0.2; // use 20% of the overall width gbc.weighty = 1.0; // use 100% of the overall height panel.add(blueComp, gbc); gbc.gridx = 0; gbc.gridy = 1; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.8; // use 80% of the width used by green/white comps gbc.weighty = 0.2; // use 20% of the overall height panel.add(greenComp, gbc); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.2; // use 20% of the width used by green/white comps gbc.weighty = 0.2; // use 20% of the overall height panel.add(whiteComp, gbc); JFrame frame = new JFrame("GrigBag Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(panel); frame.setSize(400, 300); frame.setLocationRelativeTo(null); frame.setVisible(true); } }
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21883086
accepted answer of: http://stackoverflow.com/q/21883086
upvote count: 2

http://stackoverflow.com/q/21893358
score: 1
tagged with: java
has body: I am generating PDF documents. It is OK. All works. I have only one problem: on each PDF page I need about 10 images (QR codes). Is it possible to put List of java.awt.Image to JasperReport template? Put each image in separate field is complicated... Example: In template I have image components with these settings (http://goo.gl/wcESGp): Expression Class: java.awt.Image Image Expression : com.google.zxing.client.j2se.MatrixToImageWriter.toBufferedImage( new com.google.zxing.qrcode.QRCodeWriter().encode( $F{CONTENT_TO_ENCODE}, com.google.zxing.BarcodeFormat.QR_CODE, 300, 300)) One image is no problem - just set field in template and put image to field in Java code. How can I fill images in JasperReports report template with List&lt;Image&gt;?
type: Question
tagged with: jasper-reports
downvote count: 0
has title: JasperReports: add List of images to PDF document
tagged with: http://stackoverflow.com/tag/pdf
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: collections
tagged with: list

http://stackoverflow.com/comment/33245027
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21944922
type: QuestionComment
has text: Probably a better question for code review.

http://stackoverflow.com/comment/33228888
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21936222
has text: So, I should put it on FocusListener?
type: AnswerComment

http://stackoverflow.com/comment/33228717
has text: Timestamp offerEndDate = (java.sql.Timestamp)offerDetailMap.get("endDateTime")
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21936095
score: 0

http://stackoverflow.com/a/21887474
answers question: http://stackoverflow.com/q/21887350
score: 1
has body: You can use the following code: Intent it = new Intent(getApplicationContext(), MainActivity.class); it.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(it); Where MainActivity is your primary stack activity. Hope it helps!
upvote count: 1
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21887350
type: Answer

http://stackoverflow.com/comment/33170575
type: AnswerComment
comment on: http://stackoverflow.com/a/21903103
type: Comment
score: 0
has text: which compiler does eclipse use? can't i use it with maven?

http://stackoverflow.com/comment/33189891
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21914009
has text: I mentioned this idea in question itself, but I guess there might be better implementations in terms of efficiency.
score: 0

http://stackoverflow.com/comment/47618776
type: Comment
comment on: http://stackoverflow.com/a/21921221
has text: I guess it is proper :- for(int j = 0; j < array.length; j++){ for(int i = 0; i < array[j].length / 2; i++) { int temp = array[j][i]; array[j][i] = array[j][array.length - i - 1]; array[j][array.length - i - 1] = temp; } } As above mentioned code is giving error for me? Am i correct?
type: AnswerComment
score: 0

java-server
tags question: http://stackoverflow.com/q/21948159
type: Tag
tags question: http://stackoverflow.com/q/21925764
tag name: java-server

http://stackoverflow.com/comment/33301711
has text: see http://stackoverflow.com/questions/1910194/garbage-collection-in-java-and-circular-references for an explination
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21976443
score: 1

http://stackoverflow.com/a/21948852
type: Answer
has comment: http://stackoverflow.com/comment/33253208
has body: You can nest JPanels with different layouts. Here is one way to go about it. Picture should say it all.
upvote count: 4
accepted answer of: http://stackoverflow.com/q/21948289
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21948289
has comment: http://stackoverflow.com/comment/33253345
score: 4

http://stackoverflow.com/a/22003473
score: 0
has comment: http://stackoverflow.com/comment/33386412
has comment: http://stackoverflow.com/comment/33390766
has comment: http://stackoverflow.com/comment/33384616
type: Answer
has comment: http://stackoverflow.com/comment/33366337
has body: update - declaring sum to be volatile would prevent using a cached copy of sum in an expression, but this may not solve the order of evaluation issue. If Java is always left to right then changing the statement to sum = fun(n-1) + sum should work, but the alternate code mentioned in the original example may be the only solution. volatile isn't needed in this example, but I left it there to show how it's implemented. #include &lt;iostream&gt; class Test{ public: static volatile int sum; static int fun(int n) { if (n == 1) return 1; int tmp = fun(n - 1); sum += tmp; return sum; } }; volatile int Test::sum = 0; // declare and initialize sum int main(){ std::cout &lt;&lt; Test::fun(5) &lt;&lt; std::endl; return(0); }
has comment: http://stackoverflow.com/comment/33376727
has comment: http://stackoverflow.com/comment/33388952
answers question: http://stackoverflow.com/q/22003084
has comment: http://stackoverflow.com/comment/33384420
has comment: http://stackoverflow.com/comment/33386841
has comment: http://stackoverflow.com/comment/33354853
has comment: http://stackoverflow.com/comment/33358871

http://stackoverflow.com/q/21929889
tagged with: jaxb2
has comment: http://stackoverflow.com/comment/33217735
upvote count: 1
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33217847
has body: I'am trying to marshall and unmarshal a HashMap as a list. The marshalling works in both Java versions (6u45 and 7u21), but unmarshalling the list entries with Java 6u45 will deliver an empty myModels-HashMap. In Java 7u21, the myModels-HashMap is filled. I have tried to use JAXB 2.2.7 with Java 6u45 (copied the jaxb-api.jar to the lib/endorsed dir) and the other jaxb-[core|impl|jxc|xjc] to my app lib and added them to the classpath), but i got the same result. Thanks for your answers. The marshalled xml: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> My Model 2 VALUE2 My Model 1 VALUE1 My Store MyModel: import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class MyModel { public enum MyEnum { VALUE1, VALUE2 } private String value; private MyEnum myEnum; public MyModel() { } public MyModel(String value, MyEnum myEnum) { this.setValue(value); this.setMyEnum(myEnum); } public String toString() { return getValue() + ", " + getMyEnum(); } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public MyEnum getMyEnum() { return myEnum; } public void setMyEnum(MyEnum myEnum) { this.myEnum = myEnum; } } MyStore: import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) public class MyStore { private String name; private Map<String, MyModel> myModels = new HashMap<String, MyModel>(); public MyStore() { } public MyStore(String name) { this.setName(name); } public void addMyModel(MyModel myModel) { myModels.put(myModel.getValue(), myModel); } public String getName() { return name; } public void setName(String name) { this.na…
downvote count: 0
score: 1
tagged with: java
tagged with: jaxb
has answer: http://stackoverflow.com/a/21933186
has title: JAXB unmarshalling list Java 6 not working, Java 7 works
type: Question

http://stackoverflow.com/q/21978495
has comment: http://stackoverflow.com/comment/33316834
tagged with: jcombobox
has title: Java - Populate a JCombobox with SQLite database
score: 0
tagged with: java
tagged with: swing
answer count: 1
has body: I want to populate a JComboBox with a database column (SQLite). My database connection is setup through a class called DatabaseConnection setup in anther package. Here is how it looks like import java.sql.*; import javax.swing.JOptionPane; public class DatabaseConnection { Connection conn = null; public static Connection ConnectDB() { try { Class.forName("org.sqlite.JDBC"); Connection conn = DriverManager.getConnection("jdbc:sqlite:database.db"); JOptionPane.showMessageDialog(null, "Connection Established"); conn.setAutoCommit(false); return conn; } catch (Exception e) { JOptionPane.showMessageDialog(null, e); return null; } } } In my JFrame class I am creating following method, which according to a youtube tutorial should work public void PopulateJCB() { String queryString = "SELECT DISTINCT [Account Name] FROM main ORDER BY [Account Name]"; try { Connection statJCBaccountname = DatabaseConnection.ConnectDB(); Statement stmt = statJCBaccountname.createStatement(); ResultSet rsJCBaccountname = stmt.executeQuery(queryString); while (rsJCBaccountname.next()) { comboAccountName.addItem(rsJCBaccountname.getString(1)); } catch (SQLException e) { e.printStackTrace(); } } But it displays following errors at "comboAccountName.addItem(rsJCBaccountname.getString(1));" Multiple markers at this line - Type safety: The method addItem(Object) belongs to the raw type JComboBox. References to generic type JComboBox&lt;E&gt; should be parameterized - comboAccountName cannot be resolved Please help!
tagged with: database
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21978554
tagged with: sqlite
type: Question

http://stackoverflow.com/comment/38362756
comment on: http://stackoverflow.com/a/21952125
type: AnswerComment
score: 0
type: Comment
has text: Works even though nothing in my stacktrace mentioned anything about "javassist".

http://stackoverflow.com/comment/33131432
type: AnswerComment
comment on: http://stackoverflow.com/a/21881187
type: Comment
has text: You did. But the `getRGB` method is nonetheless returning you ARGB values. Basically it's making the R, G and B part equal, so the final result is gray. At least, that's the way I understand it
score: 0

http://stackoverflow.com/comment/33280782
comment on: http://stackoverflow.com/a/21964522
type: Comment
has text: You would also need "camel:" prefix for all of the XML items inside camel context too. The other option which may be easier is to just use this: `<camelContext xmlns="http://camel.apache.org/schema/spring">`
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33078755
score: 0
has text: Could you tell me what do you use in server side app?
comment on: http://stackoverflow.com/q/21852177
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33192501
comment on: http://stackoverflow.com/q/21915198
has text: @pronox: So your question is about C? Then you should tag it as such.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33062865
comment on: http://stackoverflow.com/q/21842496
type: QuestionComment
type: Comment
has text: Either way, I imagine it'd be easier to use a built in sorter.
score: 0

http://stackoverflow.com/a/21876819
type: Answer
has body: Since future does not have its own implementation for equals it will fall back on the this==obj from Object. Since normally the ExecutorService will return distinct objects you should be fine. However, I'm thinking any container (list, set, array,...) should do so to be certain I'd advise using an (Array)List.
score: 0
answers question: http://stackoverflow.com/q/21876660

http://stackoverflow.com/comment/33118537
has text: _"but the moment I exit the application and re open it, the data entered previously gets deleted."_ - You need to store the data in a file or a database and retrieve the data upon opening the program if you want it to show up on open
comment on: http://stackoverflow.com/q/21873935
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33219155
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/21910859
has text: @Zack: You can't refactor code that uses your code. When you publish your code (even internally in your company), it's nearly impossible to change interfaces.
type: Comment

http://stackoverflow.com/comment/33239942
type: Comment
has text: I added a little piece about using a frame buffer instead of a pixelmap to get the blending to actually work correctly.
comment on: http://stackoverflow.com/a/21921527
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33287203
comment on: http://stackoverflow.com/q/21968212
type: Comment
has text: @OliCharlesworth Doesn't that defend the idea of being able to instantiate it? Or does it work different with inner classes, I am still confused about that.
score: 0
type: QuestionComment

http://stackoverflow.com/q/21941948
answer count: 1
has comment: http://stackoverflow.com/comment/33239502
has comment: http://stackoverflow.com/comment/33239537
has title: Algorithm to remove words in corpus with small occurrence
accepted answer: http://stackoverflow.com/a/21942387
has comment: http://stackoverflow.com/comment/33239863
score: 0
has body: I have a large (+/- 300,000 lines) dataset of text fragments that contain some noisy elements. With noisy I mean words of slang, type errors, etc… I wish to filter out these noisy elements to have a more clean dataset. I read some papers that propose to filter these out by keeping track of the occurrence of each word. By setting a treshold (eg. less than 20) we can assume these words are noise and thus can safely be removed from the corpus. Maybe there are some libraries or algorithms that do this in a fast and efficient way. Ofcourse I tried it myself first but this is EXTREMELY slow! So to summarize, I am looking for an algorithm that can filter out words, in a fast and efficient way, that occur less than a particular treshold. Maybe I add a small example: This is just an example of whaat I wish to acccomplish. The words 'whaat' and 'acccomplish' are misspelled and thus likely to occur less often (If we assume to live in a perfect world and typos are rare …). I wish to end up with This is just an example of I wish to. Thanks! PS: If possible, I'd like to have an algorithm in Java (or pseudo-code so I can write it myself)
has comment: http://stackoverflow.com/comment/33240948
type: AnsweredQuestion
tagged with: cpu-word
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/33240041
has answer: http://stackoverflow.com/a/21942387
type: Question

http://stackoverflow.com/comment/33255117
has text: Alright, what is it that you want this function to do? I'll write its code, once you tell me, to show how its done.
comment on: http://stackoverflow.com/q/21950346
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/21996679
duplicate of: http://stackoverflow.com/q/21995364
has comment: http://stackoverflow.com/comment/33337837
favorite count: 0
has title: Sending a simple Ndef Message from one Device to another?
tagged with: nfc
type: Question
has comment: http://stackoverflow.com/comment/33337675
has comment: http://stackoverflow.com/comment/33337763
has comment: http://stackoverflow.com/comment/33337905
tagged with: android
has body: I am trying to find a start writing an app using NFC. I simply need to send a NDef Message from one phone to another containing only a simple String. My transmit Activity: public class MainActivity extends Activity { NfcAdapter mNfcAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mNfcAdapter = NfcAdapter.getDefaultAdapter(this); if (mNfcAdapter == null) { Toast.makeText(this, "NFC is not available", Toast.LENGTH_LONG).show(); finish(); return; } NdefMessage msg = new NdefMessage( new NdefRecord[] { createTextRecord("Bla", Locale.GERMANY , true )}); mNfcAdapter.setNdefPushMessage(msg, this); } public NdefRecord createTextRecord(String payload, Locale locale, boolean encodeInUtf8) { byte[] langBytes = locale.getLanguage().getBytes(Charset.forName("US-ASCII")); Charset utfEncoding = encodeInUtf8 ? Charset.forName("UTF-8") : Charset.forName("UTF-16"); byte[] textBytes = payload.getBytes(utfEncoding); int utfBit = encodeInUtf8 ? 0 : (1 &lt;&lt; 7); char status = (char) (utfBit + langBytes.length); byte[] data = new byte[1 + langBytes.length + textBytes.length]; data[0] = (byte) status; System.arraycopy(langBytes, 0, data, 1, langBytes.length); System.arraycopy(textBytes, 0, data, 1 + langBytes.length, textBytes.length); NdefRecord record = new NdefRecord(NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_TEXT, new byte[0], data); return record; } } Then I simply try to receive some Intent on the other phone that something happend: public class MainActivity extends Activity { NfcAdapter mNfcAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mNfcAdapter = NfcAdapter.getDefaultAdapter(this); if (mNfcAdapter == null) { Toast.makeText(this, "NFC is not available", Toast.LENGTH_LONG).show(); finish(); return; } } @Override protected void onResume() { // TODO Auto-generated method stub super.on…
score: 0
tagged with: java
upvote count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/21995364
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33337710

http://stackoverflow.com/a/21949453
downvote count: 0
answers question: http://stackoverflow.com/q/21949337
type: Answer
score: 1
upvote count: 1
has body: try this src/main/resources lib/config

http://stackoverflow.com/a/21919340
accepted answer of: http://stackoverflow.com/q/21918688
type: AcceptedAnswer
has body: The issue occurs when the wrong URL is used to access the tools. Resolving the problem Use the correct URLs for the tools, which are as follows: WebSphere Commerce Accelerator : https://www.domain.com/webapp/wcs/tools/servlet/ToolsLogon?XMLFile=common.mcLogon Administration Console : https://www.domain.com/webapp/wcs/admin/servlet/ToolsLogon?XMLFile=adminconsole.AdminConsoleLogon Organization Administration Console : https://www.domain.com/webapp/wcs/orgadmin/servlet/ToolsLogon?XMLFile=buyerconsole.BuyAdminConsoleLogon
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21918688

http://stackoverflow.com/a/21939423
type: Answer
upvote count: 1
score: 1
has body: you say you know the key, so it's just map.get(key).size()
downvote count: 0
answers question: http://stackoverflow.com/q/21939328

http://stackoverflow.com/comment/33216402
comment on: http://stackoverflow.com/q/21928512
score: 0
type: Comment
type: QuestionComment
has text: Your computer disagrees, and is telling you that in that error. Of course, since what you're doing in your code isn't how to read the response from a http query thats not surprising; you aren't reading the entire response and then are passing the incomplete json to the parser.

http://stackoverflow.com/comment/33172271
comment on: http://stackoverflow.com/a/21899705
type: AnswerComment
score: 0
type: Comment
has text: @ClickUpvote your second comment was mean to my **getBaseUrl()** method. I used it on some page navigation , such as "_getBaseUrl(9997) + "#mylink:" +123);_". And I think , this may depends how you figure out.

http://stackoverflow.com/comment/33235923
score: 0
type: Comment
has text: I didn't say that the code wasn't gonna compile. What I said was that your explanation is wrong.
comment on: http://stackoverflow.com/a/21939812
type: AnswerComment

http://stackoverflow.com/q/21899256
has title: Using exception handling to get a correct file input
type: Question
tagged with: try-catch
tagged with: java
has body: I'm trying to use a try{} catch{} to get a correct file input from the user, however I don't know how to keep asking for input until I get a valid file. I can't use an if statement, this is what I have so far. The file is filled with integers, and it applies to another method. I have FileReader to make sure the file exists, if it doesn't it should throw an exception. public static int readFilename() { Scanner scan = new Scanner(System.in); String input; int average = 0; try{ System.out.print("Enter a filename: "); input = scan.next(); FileReader read = new FileReader(input); average = AverageFile.average(input); } catch(FileNotFoundException e){ System.out.println("Incorrect file input"); } return average; }
score: 0
accepted answer: http://stackoverflow.com/a/21899408
answer count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21899408

http://stackoverflow.com/q/21970339
linked to: http://stackoverflow.com/q/22017852
has body: When N=32,How to find arrays of items that make heapsort use as many and as few comparisons as possible? Does it mean O(N log N) (minimum comparisons) and O(N square) for maximum comparisons. Am i doing correct?
has comment: http://stackoverflow.com/comment/33290827
has comment: http://stackoverflow.com/comment/33291082
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34463272
type: Question
tagged with: heapsort
tagged with: sorting
score: 0
linked to: http://stackoverflow.com/q/22214495
has comment: http://stackoverflow.com/comment/34463478
has title: Maximum and minimum numbers of comparisons for heap sort
has comment: http://stackoverflow.com/comment/33290996
type: UnansweredQuestion

http://stackoverflow.com/a/21984397
upvote count: 1
has body: Shape firstLine = new Line2D.Float(0, imgHeight, imgWidth, 0); // this line is from bottom left to top right Shape secondLine = new Line2D.Float(0, 0, imgWidth, imgHeight); // this line is from top left to bot right
answers question: http://stackoverflow.com/q/21984208
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/33090437
type: Comment
comment on: http://stackoverflow.com/a/21857056
has text: Do you know good examples because I don't know much about enums
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33089297
type: Comment
type: QuestionComment
has text: @posdef: It was a design mistake in making Thread implement Runnable, IMO :(
comment on: http://stackoverflow.com/q/21857506
score: 0

http://stackoverflow.com/comment/33124247
comment on: http://stackoverflow.com/q/21874326
score: 0
type: Comment
type: QuestionComment
has text: @Gimby ok can you give a sample code for doing it.

http://stackoverflow.com/q/21982389
has answer: http://stackoverflow.com/a/21994023
accepted answer: http://stackoverflow.com/a/21994023
tagged with: encryption
tagged with: python
type: AnsweredQuestion
tagged with: java
has body: I am having issue while understanding the concept between triple Des algorithm of java and python. In java the key for the encryption is 48 chars long whereas the same key cannot be applied in case of python. I tried with both the suggestions mentioned here but it doesnot seem to work with either way. I cannot decrypt the string encrypted by java in python. The code in java look like: import java.security.spec.KeySpec; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESedeKeySpec; public class SecretKeyEncryptionExample { private static final String FORMAT = "ISO-8859-1"; public static final String DESEDE_ENCRYPTION_SCHEME = "DESede"; private KeySpec ks; private SecretKeyFactory skf; private Cipher cipher; SecretKey key; public SecretKeyEncryptionExample() throws Exception { String myEncryptionKey = "&lt;48 chars long string&gt;"; this.ks = new DESedeKeySpec(myEncryptionKey.getBytes("ISO-8859-1")); this.skf = SecretKeyFactory.getInstance("DESede"); this.cipher = Cipher.getInstance("DESede"); this.key = this.skf.generateSecret(this.ks); } Whereas in python if I use: from pyDes import * import hashlib import base64 key1 = "&lt;48 chars long key&gt;".decode('hex') data = "&lt;Some encrypted strings&gt;" k = triple_des(key1, ECB, "\0\0\0\0\0\0\0\0", pad=None, padmode=PAD_PKCS5) e = k.decrypt(data) print e I did it according to the first suggestion given here but it prints nothing. again I tried the second suggestion from the same page which asked to use first 24 chars as key and ignore rest as: from pyDes import * import hashlib import base64 key1 = "&lt;taking only first 24 chars long key&gt;" data = "&lt;Some encrypted data&gt;" k = triple_des(key1, ECB, "\0\0\0\0\0\0\0\0", pad=None, padmode=PAD_PKCS5) e = k.decrypt(data) print e But this also gives me no output.. I am confused with all this research. Please suggest which way is the correct one and why I am not getting any output from either of …
type: Question
possible better answer: http://stackoverflow.com/a/52049428
score: 0
has answer: http://stackoverflow.com/a/52049428
answer count: 2
has title: DESede in Java and 3des in python
linked to: http://stackoverflow.com/q/16203619

http://stackoverflow.com/comment/33280345
comment on: http://stackoverflow.com/q/21964418
score: 0
has text: so what is your exact question ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33260233
has text: To say nothing of validation code you may want to add to contruction
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21953474
type: AnswerComment

http://stackoverflow.com/comment/33298253
type: Comment
type: QuestionComment
has text: First, please note that your code is exception prone if the two operand arrays are not of same length. IF the two lengths differ, you will get an `ArrayIndexOutOfBoundsException` at this line: `sum[i+1] = numArray1[i] + numArray2[i];`
score: 0
comment on: http://stackoverflow.com/q/21974588

http://stackoverflow.com/comment/33619037
comment on: http://stackoverflow.com/q/22000661
score: 0
has text: @user3321425, sorry, I was off a few days. I see you managed anyway. Could you post your solution as an answer so that others may benefit from it?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21960768
answer count: 2
accepted answer: http://stackoverflow.com/a/21960834
possible better answer: http://stackoverflow.com/a/24500694
has answer: http://stackoverflow.com/a/24500694
has body: I am using JNativeHook to listen for key presses. When the key is hold down, say the computer is supposed to type the key 4 times, each JNativeHook method will register a lot more than that. I tried: public void nativeKeyReleased(NativeKeyEvent e) { System.out.println("registered key release"); } public void nativeKeyPressed(NativeKeyEvent e) { System.out.println("registered key press"); } public void nativeKeyTyped(NativeKeyEvent e) { System.out.println("registered key type"); } All of these methods will register the wrong amount of key presses while the key is being held down. I don't think this is a glitch of the JNativeHook library, since it is almost the same as Java's KeyListener, except it's global. Thanks in advance.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21960834
type: Question
tagged with: java
has title: JNativeHook registers more keyPresses than wanted during key hold
score: 0

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/21957095
tags question: http://stackoverflow.com/q/21991521
tags question: http://stackoverflow.com/q/21877652
tags question: http://stackoverflow.com/q/21905156
tags question: http://stackoverflow.com/q/21943269
tags question: http://stackoverflow.com/q/21884359
tags question: http://stackoverflow.com/q/21954808
tags question: http://stackoverflow.com/q/21849179
tags question: http://stackoverflow.com/q/21976208
tags question: http://stackoverflow.com/q/22001964
tags question: http://stackoverflow.com/q/21958926
tags question: http://stackoverflow.com/q/21994259
tags question: http://stackoverflow.com/q/21998701
tags question: http://stackoverflow.com/q/21955768
tags question: http://stackoverflow.com/q/21950645
tags question: http://stackoverflow.com/q/21886857
tags question: http://stackoverflow.com/q/22004059
tags question: http://stackoverflow.com/q/21958889
type: Tag
tags question: http://stackoverflow.com/q/21857424
tags question: http://stackoverflow.com/q/21917461
tags question: http://stackoverflow.com/q/21925546
tags question: http://stackoverflow.com/q/21925839

http://stackoverflow.com/comment/33066732
has text: I checked it in Emulator
comment on: http://stackoverflow.com/q/21844988
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21911070
upvote count: 7
tagged with: unit-testing
type: Question
tagged with: java
score: 7
has answer: http://stackoverflow.com/a/21911177
tagged with: eclipse
answer count: 3
tagged with: junit
has body: What is the Significance of this piece of code? e.g. @Test public void testGetDiameter() { **fail("Not yet implemented");** }
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21912268
has answer: http://stackoverflow.com/a/21911261
has title: Junit testing: Significance of fail("Not yet implemented");?
type: UnansweredQuestion

http://stackoverflow.com/comment/33321485
has text: hey @Doberman, he (@user3344382) want the solution in mysql. Did you mention the link in oracle. lot of difference for oracle and mysql. you must see the tags.
comment on: http://stackoverflow.com/a/21974843
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21905679
accepted answer: http://stackoverflow.com/a/21907538
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/2205073
favorite count: 0
tagged with: sockets
has answer: http://stackoverflow.com/a/21907538
has body: I ask this question again here ( How to create Java socket that is localhost only? ) 'cause all before mentioned methods (simply to say to create one ServerSocket by 3 parameters method) can not solve my problem. I am working in one big intranet in which, every time when I open one browser, I need enter my proxy account and password to access internet. This is why I hope to test my socket program on localhost. Occasionally my Client side can connect the Server side, but usually I have to wait for a long time before she coming out. I suppose, it should be related with some of proxy/firewall. Although I look over all following resources and believe all of them are well worth reading, but I still can not get my issues out. http://zerioh.tripod.com/ressources/sockets.html How to determine an incoming connection is from local machine My Server Side Code import java.net.Socket; import java.net.ServerSocket; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; import java.net.InetAddress; public class Myserver { private int serverPort = 8000; private ServerSocket serverSock = null; public Myserver(int serverPort) { this.serverPort = serverPort; try { /*SocketAddress socketAddress = new InetSocketAddress(InetAddress.getByName("localhost"), serverPort); ServerSocket serverSocket = new ServerSocket(); serverSocket.bind(socketAddress); serverSocket.accept();*/ serverSock = new ServerSocket(serverPort, 0, InetAddress.getByName(null)); } catch (IOException e){ e.printStackTrace(System.err); } } public void handleConnection(InputStream sockInput, OutputStream sockOutput) { while(true) { byte[] buf=new byte[1024]; int bytes_read = 0; try { // This call to read() will wait forever, until the // program on the other side either sends some data, // or closes the socket. bytes_read = sockInput.read(buf, 0, buf.length); // If the socket is closed, sockInput.read() will return -1. if(bytes_read &lt; 0) { System.err.println("Tried to read from socket, read…
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1542424
tagged with: serversocket
score: 1
tagged with: java
upvote count: 1
has title: How to create Java Socket object serving on localhost only?
type: Question

http://stackoverflow.com/q/21879867
tagged with: java
tagged with: selenium
upvote count: 1
type: Question
has body: Im stucked in java based selenium usage, i like to click on input box (within table )by another cell text value Here is my HTML code: CCC CCC I like to click on the second CCC text row related input,(not by only clicking name or xpath) im tried with followings: driver.findElement(By.xpath(".//td[contains(text(),'CCC')]/preceding-sibling::td")).click(); Code above working in a *very similar html only contains CCC one time (tested with another HTML code ) WebElement services = driver.findElement(By.xpath(".//*[@id='installationAddressForm']/table[4]/tbody/tr[2]/td/table/tbody/tr[4]/td[1][contains(text(),'CCC')]")); String contents = services.getText(); System.out.println(contents); Code above able to find text but when combined with the top code(/preceding-sibling::td) it cannot find the input Please help.Thanks in advance
answer count: 1
downvote count: 0
favorite count: 0
tagged with: xpath
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has title: Java based selenium webdriver - click on element in dynamically changing table content by row text ( click input by text in same row )
has answer: http://stackoverflow.com/a/21880053
score: 1

http://stackoverflow.com/comment/33229622
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21936383
has text: He was adding the same ArrayList instance to the combiarray, so of course it's values would be reset to the latest. Putting the innerArray in the loop makes that after each iteration, a new instance is created.

http://stackoverflow.com/comment/33139372
has text: if you have 12,14 13,15 as a line in the text file my first example would initially split the string at the space and store 12,14 and 13,15 as separate strings in in the String[] values, then it would split each string at the comma and parse the first two strings returned which would result in 12 and 14 stored as x and y in the first iteration of the loop. As for the second example, `readInt()` and `writeInt()` both will accept two digit integers, or any other integer that you give them. They do not only process one digit at a time, but the whole number.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21875916
type: Comment

http://stackoverflow.com/a/21869736
type: Answer
downvote count: 0
score: 1
has body: public void swap(String name1, String name2) { String temp = name1; name1 = name2; name2 = temp; } Here you are swapping the values of local variables name1 and name2. It doesn't affect your names array, so this doesn't actually do anything. You need to actually access the names array, find the existing positions in the array of name1 and name2, and swap them in the array.
upvote count: 1
answers question: http://stackoverflow.com/q/21869695

http://stackoverflow.com/comment/33317499
score: 0
has text: Code has been updated.
comment on: http://stackoverflow.com/a/21983231
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21978459
answers question: http://stackoverflow.com/q/21978231
accepted answer of: http://stackoverflow.com/q/21978231
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33309130
has comment: http://stackoverflow.com/comment/33305559
type: Answer
has comment: http://stackoverflow.com/comment/33306923
has comment: http://stackoverflow.com/comment/33305603
has body: You have: public Boolean somethingIsThere(GameObject user){ for(int i = 0; i &lt; theseWalls.size(); i++){ GameObject a = (Wall) theseWalls.get(i); if( user.returnPosition().equals(a.returnPosition())){ isSomethingThere= true; } else { isSomethingThere= false; } } return isSomethingThere; } Even if the user's position matches one of the walls, you continue checking through the rest of the walls and end up setting isSomethingThere to false. The only time this works is if the last wall in theseWalls is the one that matches. You'll want to break out of that loop as soon as you find a wall that matches, to avoid resetting isSomethingThere to false when you check walls later in the list that don't match.

http://stackoverflow.com/q/21968358
has answer: http://stackoverflow.com/a/21969496
has title: I want to compile my java file using php but it shows that javac is not recognised as a command
has answer: http://stackoverflow.com/a/21968523
has comment: http://stackoverflow.com/comment/33287400
score: 0
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/21968379
type: UnansweredQuestion
tagged with: php
answer count: 4
has answer: http://stackoverflow.com/a/21968446
tagged with: java
favorite count: 0
has body: &lt;?php echo shell_exec("javac test.java 2&gt;&amp;1"); echo exec("java test 2&gt;&amp;1"); ?&gt; The above code shows the following error: 'javac' is not recognized as an internal or external command, operable program or batch file. Help me resolve this please. I need to upload this on my website..don't know how to install jdk on that or is it pre installed?
type: Question

http://stackoverflow.com/comment/33181970
score: 2
type: AnswerComment
has text: While this question is correct, we should avoid providing answers to questions that don't demonstrate minimal understanding. Though, +1 this time for the explanation.
comment on: http://stackoverflow.com/a/21909780
type: Comment

http://stackoverflow.com/comment/33274776
type: AnswerComment
has text: @user3341642 make your constructor public
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21961191

http://stackoverflow.com/comment/33098383
has text: I have my doubts that tracing the execution flow of a method which throws `StackOverFlowError` with pen and paper will lead to a formula.
comment on: http://stackoverflow.com/q/21861445
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33154405
score: 0
comment on: http://stackoverflow.com/a/21892954
has text: As I mentioned : src/main/webapp/WEB-INF/jsp/dummy.jsp
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33264511
score: 0
type: Comment
type: QuestionComment
has text: If anyone want to run the project please create the database first dbname : accountDb username : aom passwoed: aom
comment on: http://stackoverflow.com/q/21955816

http://stackoverflow.com/q/21977718
has answer: http://stackoverflow.com/a/21977878
downvote count: 1
type: Question
has body: Flatten an iterator of iterators in Java. If the input is [ [1,2], [3,[4,5]], 6], it should return [1,2,3,4,5,6]. Implement hasNext() and next(). Be careful when the inner iterator or list is empty. I don't think my code works for multiple levels of inner lists. public class FlattenList { int index = 0; // keep an index to indicate where the current accessed element is List&lt;Integer&gt; flattenedList = new ArrayList&lt;&gt;(); // flattenedList public FlattenList(List&lt;List&lt;Integer&gt;&gt; lists){ for(List&lt;Integer&gt; list : lists){ // add all inner list to our underlying list. flattenedList.addAll(list); } } public boolean hasNext(){ // check if the index has exceeded the list size return flattenedList.size() &gt; index? true : false; } public Integer next(){ // return the next element, and increment the index Integer result = flattenedList.get(index); index++; return result; } }
tagged with: algorithm
tagged with: data-structures
has comment: http://stackoverflow.com/comment/33305409
tagged with: iterator
answer count: 3
has answer: http://stackoverflow.com/a/31817649
favorite count: 0
has title: Flatten an iterator of iterators in Java
upvote count: 2
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/74862304

http://stackoverflow.com/comment/33306589
type: Comment
comment on: http://stackoverflow.com/a/21979125
score: 0
type: AnswerComment
has text: prosper your suggestion just worked after fixing some other stuff, thank you sir.

http://stackoverflow.com/q/22003869
has comment: http://stackoverflow.com/comment/33399480
has answer: http://stackoverflow.com/a/24311518
has comment: http://stackoverflow.com/comment/33351225
downvote count: 0
answer count: 1
tagged with: jinternalframe
has comment: http://stackoverflow.com/comment/33351085
favorite count: 0
has comment: http://stackoverflow.com/comment/33386904
has comment: http://stackoverflow.com/comment/33370280
has comment: http://stackoverflow.com/comment/33351028
has comment: http://stackoverflow.com/comment/33370217
has title: Maximizing JInternalFrame Windows Look and Feel maximizes all JInternalFrame
has comment: http://stackoverflow.com/comment/33446679
type: AnsweredQuestion
has body: In the SSCCE below, you can see that if you maximize one of the JInternalFrames, then it maximizes them both. This only (AFAIK) happens with the "Windows" LookAndFeel (if you omit the LookAndFeel code, it works as expected). To reproduce: Run the SSCCE below. Maximize one of the JInternalFrames. Close (X) the one you maximized Observe the other one was maximized as well. Is there any way to stop this behavior? Is this a bug? SSCCE: import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.SwingConstants; class Test2 { public static void main(String[] args) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Windows".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException e) { e.printStackTrace(); } JFrame frame = new JFrame(); JDesktopPane jdp = new JDesktopPane(); jdp.setBackground(Color.gray); frame.add(jdp); jdp.setVisible(true); frame.setExtendedState(frame.getExtendedState()|JFrame.MAXIMIZED_BOTH ); frame.setVisible(true); JInternalFrame jiffy1 = new JInternalFrame("Jiffy1", true, true, true, true); jdp.add(jiffy1); JLabel jiffy1_label = new JLabel("Jiffy1"); jiffy1_label.setHorizontalAlignment(SwingConstants.CENTER); jiffy1_label.setFont(new Font("Tahoma", 0, 50)); jiffy1.add(jiffy1_label); jiffy1.setPreferredSize(new Dimension(300,300)); jiffy1.setVisible(true); jiffy1.pack(); centerJIF(jdp, jiffy1); JInternalFrame jiffy2 = new JInternalFrame("Jiffy2", true, true, true, true); jdp.add(jiffy2); JLabel jiffy2_label = new JLabel("Jiffy2"); jiffy2_label.setHorizontalAlignment(SwingConstants.CENTER); jiffy2_label.setFont(new Font("Tahoma", 0, 50)); jiffy2.add(jiffy2_label); jiffy2.setP…
tagged with: maximize-window
accepted answer: http://stackoverflow.com/a/24311518
has comment: http://stackoverflow.com/comment/33350837
score: 1
tagged with: java
tagged with: look-and-feel
upvote count: 1
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/33351243

http://stackoverflow.com/a/21896344
score: 1
has body: public static int[][] fliprows(int array[][]) { int temp[][] = new int[array.length][array[0].length]; int j; for (int i = 0; i &lt; array.length; ++i) { j = array.length - 1 - i; temp[i] = array[j]; } return temp; } public static int[][] flipcolumns(int array[][]) { int temp[][] = new int[array.length][array[0].length]; for (int i = 0; i &lt; array.length; ++i) { for (int j = 0; j &lt; array[i].length; ++j) { temp[i][j] = array[i][array[i].length - j - 1]; } } return temp; } public static void main(String[] args) { int array[][] = {{1, 2, 3}, {3, 2, 1}, {2, 1, 3}}; array = fliprows(array); for (int i = 0; i &lt; array.length; ++i) { for (int j = 0; j &lt; array[i].length; ++j) System.out.print(array[i][j]); System.out.println(); } }
has comment: http://stackoverflow.com/comment/33159776
answers question: http://stackoverflow.com/q/21896112
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/q/21874536
type: Question
linked to: http://stackoverflow.com/q/17858215
has title: "Google play services out of date" error i am running program built i 4.2.2 (API 17) running on emulator on API 17(google api)
upvote count: 2
has comment: http://stackoverflow.com/comment/33120874
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: 2
answer count: 0
downvote count: 0
tagged with: java
has body: Logcat 02-19 08:03:37.065: E/Trace(2154): error opening trace file: No such file or directory (2) 02-19 08:03:39.306: W/GooglePlayServicesUtil(2154): Google Play services out of date. Requires 4132500 but found 3136130 02-19 08:03:39.362: W/GooglePlayServicesUtil(2154): Google Play services out of date. Requires 4132500 but found 3136130 02-19 08:03:39.415: W/GooglePlayServicesUtil(2154): Google Play services out of date. Requires 4132500 but found 3136130 02-19 08:03:39.456: W/GooglePlayServicesUtil(2154): Google Play services out of date. Requires 4132500 but found 3136130 02-19 08:03:39.482: W/GooglePlayServicesUtil(2154): Google Play services out of date. Requires 4132500 but found 3136130 02-19 08:03:39.792: D/dalvikvm(2154): GC_CONCURRENT freed 175K, 11% free 2681K/2980K, paused 16ms+38ms, total 238ms 02-19 08:03:39.852: W/GooglePlayServicesUtil(2154): Google Play services out of date. Requires 4132500 but found 3136130 02-19 08:03:40.572: D/gralloc_goldfish(2154): Emulator without GPU emulation detected. Manifest.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.becram.signalmapping" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /&gt; &lt;permission android:name="com.becram.signalmapping.permission.MAPS_RECEIVE" android:protectionLevel="signature"/&gt; &lt;uses-permission android:name="com.becram.signalmapping.permission.MAPS_RECEIVE"/&gt; &lt;uses-permission android:name="android.permission.INTERNET"/&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt; &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt; &lt;uses-feature android:glEsVersion="0x00020000" android:…
has comment: http://stackoverflow.com/comment/33149405
tagged with: android-emulator

http://stackoverflow.com/comment/33176150
comment on: http://stackoverflow.com/a/21905830
score: 0
type: AnswerComment
has text: actually i need to get this quest object in displayQuest jsp page, so that i can use it...
type: Comment

http://stackoverflow.com/a/21961204
has comment: http://stackoverflow.com/comment/33276684
has comment: http://stackoverflow.com/comment/33276305
has comment: http://stackoverflow.com/comment/33276349
has comment: http://stackoverflow.com/comment/33274990
has comment: http://stackoverflow.com/comment/33274667
has comment: http://stackoverflow.com/comment/33275287
has body: You need to define your connection as follows: conn = DriverManager.getConnection("jdbc:mysql://localhost/", connInfo); That allows you to specify the JDBC driver by using the specific URI prefix.
accepted answer of: http://stackoverflow.com/q/21961185
has comment: http://stackoverflow.com/comment/33276694
has comment: http://stackoverflow.com/comment/33276083
has comment: http://stackoverflow.com/comment/33275355
has comment: http://stackoverflow.com/comment/33274684
has comment: http://stackoverflow.com/comment/33274771
score: 0
has comment: http://stackoverflow.com/comment/33275990
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21961185
type: Answer

http://stackoverflow.com/comment/33314647
has text: It's like you are asking how to fix a screw with a hammer. It simply isn't the right tool.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21983001

http://stackoverflow.com/comment/33202963
comment on: http://stackoverflow.com/a/21921012
has text: We haven't learnt about that in class, so I don't know how to use it. We just learnt about arrays, so we're practicing with arrays. Thank you for your input though.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33178297
type: QuestionComment
comment on: http://stackoverflow.com/q/21907597
score: 0
has text: hey dont get it. what is your issue?
type: Comment

http://stackoverflow.com/comment/33293103
score: 0
type: Comment
type: QuestionComment
has text: u r using 2D array so what will be [0][0],[0][1]... value
comment on: http://stackoverflow.com/q/21971468

http://stackoverflow.com/q/21904037
has body: I would like to achieve the following in Spring Integration: A message is received in an input channel This goes through a Transformer which persists it in the DB and thus gives it an ID it goes on to further processing into some external systems. My transformer looks like this: @PersistenceContext private EntityManager em; @Transactional public ServiceResponse persistBatchOperation(List<OperationDTO> operations) { for (OperationDTO op : operations) { em.persist(op); } em.flush(); ...rest omitted This exception is being thrown on em.flush(): org.springframework.integration.transformer.MessageTransformationException: org.springframework.integration.MessageHandlingException: javax.persistence.TransactionRequiredException: no transaction is in progress My integration context contains these elements: <tx:annotation-driven /> The AspectJ part: <tx:advice id="txGatewayJPA" transaction-manager="jpaTransactionManager"> <tx:attributes> <tx:method name="*HLR*" /> </tx:attributes> </tx:advice> <aop:pointcut id="allServices" expression="execution(* com.mypackage.IntegrationService.*(..))" /> <aop:advisor advice-ref="txGatewayJPA" pointcut-ref="allServices" /> </aop:config> Hibernate and DB config: It seems to me that I have configured everything what would make my transformer method transactional. Why isn't it working?
type: UnansweredQuestion
tagged with: spring
score: 1
tagged with: java
tagged with: hibernate
has title: Spring Integration: javax.persistence.TransactionRequiredException: no transaction is in progress
upvote count: 1
type: Question
answer count: 1
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/21905112
favorite count: 0

http://stackoverflow.com/a/21891802
has comment: http://stackoverflow.com/comment/33153320
answers question: http://stackoverflow.com/q/21891366
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: actually it's not true that Permgen does never get garbage collected. It contains the classes that where loaded by the application, and gets collected when classloaders get garbage collected, typically in redeployment scenarios. You can use these JVM flags to see when classes are loaded into and unloaded from the permgen: -XX:+TraceClassLoading -XX:+TraceClassUnloading To see which classes are getting loaded, use this flag: -verbose:class If the application is reflection intensive, that can be a cause too, have a look at this answer, try to use visualvm to take heap dumps an look for classes named lie sun.reflect.GeneratedMethodAccessor11. For the garbage collection flags refer to this answer, but the best bet to fix the permgen leak is to see what classes are being created and why using some tooling/logs.

http://stackoverflow.com/comment/33088618
type: Comment
has text: `In C/C++, it is possible to create typedef, it resolves the problem.` - I would say it does not solve it, but rather hides it. Use a tool like Eclipse to refactor your code instead.
type: QuestionComment
comment on: http://stackoverflow.com/q/21857598
score: 0

http://stackoverflow.com/q/21879232
favorite count: 0
answer count: 5
tagged with: android
has answer: http://stackoverflow.com/a/21879317
has answer: http://stackoverflow.com/a/25859611
accepted answer: http://stackoverflow.com/a/21879287
upvote count: 4
has answer: http://stackoverflow.com/a/21879423
downvote count: 0
has answer: http://stackoverflow.com/a/21879287
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21879301
has title: explain the syntax EditText editText = (EditText) findViewById(R.id.edit_message);
tagged with: java
has answer: http://stackoverflow.com/a/21879301
score: 4
type: Question
has body: /** Called when the user clicks the Send button */ public void sendMessage(View view) { Intent intent = new Intent(this, DisplayMessageActivity.class); EditText editText = (EditText) findViewById(R.id.edit_message); String message = editText.getText().toString(); intent.putExtra(EXTRA_MESSAGE, message); startActivity(intent); } in the line EditText editText = (EditText) findViewById(R.id.edit_message); EditText is class and editText is the instance we are creating. findViewById(R.id.edit_message) is method and R.id.edit_message is the argument we are passing But I can not understand why there is thos (EditText) present? is it the call to constructor?

http://stackoverflow.com/q/21870726
has title: Spring Webapp throwing 404 errors with no console log
has comment: http://stackoverflow.com/comment/92186909
accepted answer: http://stackoverflow.com/a/21893583
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33113032
has answer: http://stackoverflow.com/a/36323333
upvote count: 5
possible better answer: http://stackoverflow.com/a/21870828
has comment: http://stackoverflow.com/comment/33112825
linked to: http://stackoverflow.com/q/25356781
has answer: http://stackoverflow.com/a/21870828
has comment: http://stackoverflow.com/comment/33113067
downvote count: 0
has answer: http://stackoverflow.com/a/21893583
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/21871008
has body: I am working on a web application using the Spring framework and Hibernate. My problem is that I often receive 404 errors caused by a mistake I have made somewhere in the codebase but there are no exception messages in the console. Because of this I am struggling to find where the mistake is because the project has become very large and manually trying to find the problem is impractical. I'm assuming that Spring is causing the problem so my question is: is there some way of enabling more detailed error messages? Thanks
score: 5
tagged with: spring
tagged with: http-status-code-404
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/a/21950165
answers question: http://stackoverflow.com/q/21949970
downvote count: 0
has body: I think you are asking if it is safe to send a request with a URL like this: "http://localhost:8181/ServerSideProcessing/getAppletAuth.html?jsessionid=" + jsessionid + "&amp;userName=Ankit" If you send a request to localhost (i.e. a 127.x.x.x address), the request should go over the loopback newtwork ... and won't go off your computer. Assuming that your system's local security hasn't been comprised and you can trust the privileged users, the request should be safe enough. On the other hand, if you were not sending to "localhost", then what you are doing is not safe. Since you are using HTTP, the connection is going over the network in the clear ... and than some bad guy with access to the network could potentially intercept and read the data. That includes the start of the HTTP Request message ... which includes that session id. Once they have gotten hold of the session id, they could (in theory) hijack the session. The remedy for the latter issue would be to send the request over HTTPS. ... but i am not sure that whether this is the Correct way to use Applet as My web Application's Platform is highly Secured so i can't risk it. In that case, you should find a qualified / experienced Java security consultant who does understand this stuff completely, and pay them to do a thorough security audit of your code. Asking questions on StackOverflow is NOT an adequate substitute for a security review.
has comment: http://stackoverflow.com/comment/33256246
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/33256036
has comment: http://stackoverflow.com/comment/33257132
has comment: http://stackoverflow.com/comment/33256620
score: 3

http://stackoverflow.com/a/21857247
has body: StringBuilder sb = new StringBuilder(); BufferedReader br = new BufferedReader(new FileReader(PATH_TO_XML_FILE)); String sCurrentLine = null; while ((sCurrentLine = br.readLine()) != null) { sb.append(sCurrentLine); } Pattern pattern = Pattern.compile("A:"); Matcher matcher = pattern.matcher(sb); int count = 0; while (matcher.find()){ count++; } System.out.println(count); This answer contains code to read in the xml file as a String also, matcher.find() only finds next instance of match so you have to cycle through the whole thing, annoyingly.
accepted answer of: http://stackoverflow.com/q/21855290
type: Answer
answers question: http://stackoverflow.com/q/21855290
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21920939
has answer: http://stackoverflow.com/a/42848993
answer count: 7
score: 1
has answer: http://stackoverflow.com/a/61025434
favorite count: 0
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/33202852
has body: Yesterday I asked a very similar question and I kind of messed up with asking it. I need to pass an array to a method and inside of that method I need to swap the rows around so if it's 1 2 3 3 2 1 2 1 3 it needs to be 3 2 1 1 2 3 3 1 2 With the code I have right now it swaps the last column to the first column spot correctly then it puts the column that's supposed to be last. 3 1 2 1 3 2 3 2 1 Also, it needs to stay a void because I need to be modifying the original array so I can't set it as a temp array but I can use a temp integer to store. Here is the code I have right now that's sort of working public static void reverseRows(int[][] inTwoDArray) { for (int row = 0; row &lt; inTwoDArray.length; row++) { for (int col = 0; col &lt; inTwoDArray[row].length; col++) { int tempHolder = inTwoDArray[row][col]; inTwoDArray[row][col] = inTwoDArray[row][inTwoDArray[0].length - 1]; inTwoDArray[row][inTwoDArray[0].length - 1] = tempHolder; } } } any help would be great, I'm running out of hair to pull out! Thanks!
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21921221
tagged with: java
has comment: http://stackoverflow.com/comment/33203281
has answer: http://stackoverflow.com/a/49229992
type: Question
has answer: http://stackoverflow.com/a/29742968
possible better answer: http://stackoverflow.com/a/21921104
has comment: http://stackoverflow.com/comment/33203223
has answer: http://stackoverflow.com/a/44728048
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/21921104
has comment: http://stackoverflow.com/comment/33203403
has title: Reverse the rows of a 2d array
has answer: http://stackoverflow.com/a/21921221

http://stackoverflow.com/q/21972361
type: UnansweredQuestion
has body: Interval interval = new Interval(new DateTime("2014-01-01"), new DateTime("2014-01-30")); Is there a way to get the weekend days numbers? something like: interval.toPeriod.getWeekendDays();
tagged with: datetime
has answer: http://stackoverflow.com/a/59222776
score: 1
linked to: http://stackoverflow.com/q/2751302
tagged with: java
upvote count: 1
type: Question
has title: how to get weekends in an Interval? joda time
tagged with: jodatime
answer count: 3
has answer: http://stackoverflow.com/a/22110692
tagged with: intervals
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33294336
has answer: http://stackoverflow.com/a/36602998

http://stackoverflow.com/q/21936237
tagged with: memory
type: Question
upvote count: 0
has body: I need some kind of documentation how the access to java objects is handled? e.g.: what happens when an object is updated? how does java find and index the elements in the memory? Thank you
has answer: http://stackoverflow.com/a/21936519
tagged with: operating-system
answer count: 1
has comment: http://stackoverflow.com/comment/33229386
accepted answer: http://stackoverflow.com/a/21936519
favorite count: 0
has title: how are objects stored and handled in java internal?
has comment: http://stackoverflow.com/comment/33229407
score: -3
type: AnsweredQuestion
tagged with: java
downvote count: 3

http://stackoverflow.com/a/21901644
has body: You are initializing array like: String [] StopNamesForDB = new String[set.size()]; By doing this, size of StopNamesForDB array will always be 9, irrespective you add element to it or not. Also, please note that you are checking for a space in your code: if(string.equals(" ")){ Please change it to below code or trim it: if(string.equals("")){ Thanks, hope this helps.
type: Answer
accepted answer of: http://stackoverflow.com/q/21901541
answers question: http://stackoverflow.com/q/21901541
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33289526
comment on: http://stackoverflow.com/q/21969625
score: 0
type: Comment
type: QuestionComment
has text: Consider using the visitor pattern.

http://stackoverflow.com/q/21897308
score: 0
answer count: 3
upvote count: 1
linked to: http://stackoverflow.com/q/21865255
downvote count: 1
has body: I'm getting a StackOverFlowError when I try and use my recursive sort on an array that has a length that is greater than around 50. The method sorts properly if the array is small enough to not throw this error. Is there any way around this? public class RecursiveSort { static double[] arr; static int count = 0; public static void main(String[] args) { double[] anArr = new double[50]; for(int i = 0; i &lt; anArr.length; i++) { anArr[i] = Math.random(); } arr = anArr; recurseSort(arr.length - 1); display(); } public static void recurseSort(int position) { if(position == 0) { position = arr.length - 1; count++; } if (arr[position] &lt; arr[position - 1]) { double n = arr[position - 1]; arr[position - 1] = arr[position]; arr[position] = n; } if(count &lt;= arr.length) recurseSort(--position); } public static void display() { for(double n : arr) System.out.println(n); } }
favorite count: 0
type: UnansweredQuestion
has title: StackOverFlowError w/ Recursive Sort
tagged with: recursion
linked to: http://stackoverflow.com/q/214741
has answer: http://stackoverflow.com/a/21897621
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21898388
has comment: http://stackoverflow.com/comment/57626916
has answer: http://stackoverflow.com/a/21899513
tagged with: sorting

http://stackoverflow.com/comment/33240348
score: 0
has text: Why would the lack of mappedBy be causing this behavior? Putting a reference to the parent in the child class defeats the object of using Hibernate in the first place doesn't it?
type: Comment
comment on: http://stackoverflow.com/a/21937282
type: AnswerComment

http://stackoverflow.com/comment/40429776
has text: wouldn't it be nicer if you also post a UI screenshot :)
score: 3
comment on: http://stackoverflow.com/a/21984480
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21927396
has comment: http://stackoverflow.com/comment/33213508
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21927282
has body: place the these statements after the try-catch block, and also check the value of the variable gameover. p1 = new PopUp(); //keep p1.setLocation(((int)(Math.random()*2000)), ((int)(Math.random()*1000))); popUpsOpen++;

http://stackoverflow.com/a/21965304
has comment: http://stackoverflow.com/comment/33305988
has comment: http://stackoverflow.com/comment/33301785
upvote count: 4
has comment: http://stackoverflow.com/comment/33308922
has comment: http://stackoverflow.com/comment/33305512
score: 4
has comment: http://stackoverflow.com/comment/33301823
has body: The method add is not available for conventional Arrays.. It is available for Arraylist. private GroceryItemOrder[] list; // Standard Arrays Change it to private ArrayList&lt;GroceryItemOrder&gt; list; Now you can add using list.add(element).
has comment: http://stackoverflow.com/comment/33285206
has comment: http://stackoverflow.com/comment/33305474
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33306471
type: Answer
accepted answer of: http://stackoverflow.com/q/21965286
answers question: http://stackoverflow.com/q/21965286
has comment: http://stackoverflow.com/comment/33293845

http://stackoverflow.com/comment/33150705
has text: Thanks Joshua I think you already mentioned that as a solution in a different question of mine... But my code is indeed fast if I do not have to update weights... How would the hypergraph approach solve the weight update? Still I have to search for the right edge to update in the one-mode and still I would waste a lot of time, isn't it?
type: Comment
comment on: http://stackoverflow.com/a/21886648
type: AnswerComment
score: 0

http://stackoverflow.com/a/21870869
type: Answer
has comment: http://stackoverflow.com/comment/33141628
upvote count: 1
has comment: http://stackoverflow.com/comment/33137123
score: 1
accepted answer of: http://stackoverflow.com/q/21870607
answers question: http://stackoverflow.com/q/21870607
type: AcceptedAnswer
downvote count: 0
has body: Add a new TextArea say encryptedBuffer to a new Scroll Pane and add it to your jPanel and modify your load method like this: void load(){ try{ RandomAccessFile input=new RandomAccessFile(fileName.getText() ,"r"); byte buffer[]=new byte [(int) input.length()]; input.read(buffer); input.close(); String content = new String(buffer); fileBuffer.setText(content); encryptedBuffer.setText(TestMD5.encryptionMD5(content)); } catch(IOException e) {System.out.println(e);} } Hope this helps.

http://stackoverflow.com/comment/33156886
type: Comment
has text: You repeatedly remove the *smallest* if doing so would result in still being over the sum. What would then remain on the heap is the largest elements that sum up to at least the sum (which would also be the smallest number of elements). Then you return these. Consider your example in your code - first you add all the elements to the heap, then you remove 1, 2, 5 and 10, so we're left with 33, which you then return.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21894809

http://stackoverflow.com/comment/33137370
comment on: http://stackoverflow.com/a/21883871
score: 0
type: AnswerComment
type: Comment
has text: You could make your check method synchronized, you could write your own insert native SQL, you could allow duplicated records and clean afterwards, but these all are workarounds. And the trade-off again: is it more important to prevent duplicates or to maintain the performace? But I can't think of any JPA specific solution right now.

http://stackoverflow.com/a/21986266
upvote count: 1
answers question: http://stackoverflow.com/q/21985770
type: Answer
downvote count: 0
score: 1
has body: Try: org.json.JSONObject json = new JSONObject("Place your JSON here"); json = json.getJSONObject("List").getJSONObject("Summary").getJSONObject("2"); System.out.println(json.toString()); This only works if you know what ID your required Object has. Maven Dependency for JSONObject: org.json json 20140107

http://stackoverflow.com/comment/33623694
score: 0
comment on: http://stackoverflow.com/a/22156448
type: AnswerComment
has text: It depends on the sdk you are using... this is from openjdk 7. On what jdk did you make your tests?
type: Comment

http://stackoverflow.com/q/21966099
has comment: http://stackoverflow.com/comment/33283673
has comment: http://stackoverflow.com/comment/33283634
tagged with: android
has title: sql lite Transaction locked
possible better answer: http://stackoverflow.com/a/21966406
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21966406
has comment: http://stackoverflow.com/comment/33284042
type: Question
has body: I'm trying to use beginTransaction() in sqllite database when reading excel file but i face some problem get error the database is locked this is my edit . note i'm using this code five time to insert 5 excel files code : dbHandler.open(); try { url = new URL( "http://ictfox.com/Hafil_Updates/ImportExcel/schoolmaster.csv"); BufferedReader in = new BufferedReader(new InputStreamReader( url.openStream(), "Windows-1256")); while ((line = in.readLine()) != null) { String[] insertValues = line.split(","); if (flag_is_header) { dbHandler = new MySQLiteHelper(context); long row = dbHandler.insertSchoolMaster(insertValues[0], insertValues[1], insertValues[2], insertValues[3], insertValues[4], insertValues[5]); Log.e("no. of rows inserted", "" + row); } else { flag_is_header = true; } } dbHandler.setsucss(); in.close(); } catch (IOException e) { e.printStackTrace(); } finally { dbHandler.end(); dbHandler.close(); } return line; } public void open() { sqliteDB=this.getWritableDatabase(); sqliteDB.beginTransaction(); } public void setsucss() { sqliteDB.setTransactionSuccessful(); } // Close Database public void end() { sqliteDB.endTransaction(); }
tagged with: transactions
has answer: http://stackoverflow.com/a/21966157
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/80279892
accepted answer: http://stackoverflow.com/a/21966157
answer count: 2
tagged with: sql
tagged with: sqlite
has comment: http://stackoverflow.com/comment/33283612

textview
tags question: http://stackoverflow.com/q/21851967
tags question: http://stackoverflow.com/q/21912534
tags question: http://stackoverflow.com/q/21868753
tags question: http://stackoverflow.com/q/21981456
tags question: http://stackoverflow.com/q/21844988
tag name: textview
tags question: http://stackoverflow.com/q/21891839
tags question: http://stackoverflow.com/q/21967037
type: Tag
tags question: http://stackoverflow.com/q/21918402
tags question: http://stackoverflow.com/q/21944809
tags question: http://stackoverflow.com/q/21946744

http://stackoverflow.com/q/21862998
score: 0
tagged with: java
tagged with: xamarin.android
has title: How Can I Enable The Wifi Zone (Wifi AP) On Android Using Xamarin (C#)?
tagged with: c#
type: UnansweredQuestion
tagged with: android-wifi
has body: I'm trying to enable the Wifi Zone (Wifi AP) on Android, but i can't find a way to do it. Actually i can enable / disable the wifi connection, but not the AP (Wifi HotSpot). I'm working on Xamarin (C#), but it uses the same API's on the SDK, so any example in java will be helpful.
has answer: http://stackoverflow.com/a/24124077
tagged with: android
answer count: 1
type: Question

http://stackoverflow.com/a/21894809
accepted answer of: http://stackoverflow.com/q/21894466
upvote count: 2
answers question: http://stackoverflow.com/q/21894466
type: AcceptedAnswer
has body: Your comparison is the wrong way around. PriorityQueue puts the smallest item (based on your comparison) first, and, by saying return o2.compareTo(o1);, you'll treat the largest integer as the smallest, but you need the smallest element needs to be first, not the largest. You need to change that to: return o1.compareTo(o2); (note that I swapped the o1 and o2) Or, for what it's worth, you can remove the second argument completely from the constructor, as it will then use Integer.compareTo, which will do what you want.
has comment: http://stackoverflow.com/comment/33156934
type: Answer
has comment: http://stackoverflow.com/comment/33156745
score: 2
has comment: http://stackoverflow.com/comment/33156859
downvote count: 0
has comment: http://stackoverflow.com/comment/33156886

put
tags question: http://stackoverflow.com/q/21887050
tag name: put
type: Tag

http://stackoverflow.com/a/21858027
score: 4
answers question: http://stackoverflow.com/q/21857814
has comment: http://stackoverflow.com/comment/33089923
type: Answer
upvote count: 4
has body: You won't get any benefit from hadoop with only 2MB of data. Hadoop is all about big data. Distributing the 2MB to your 10 nodes costs more time then just doing the job on a single node. The real benfit starts with a high number of nodes and huge data.
downvote count: 0

http://stackoverflow.com/comment/33171657
comment on: http://stackoverflow.com/a/21903677
score: 0
type: Comment
has text: Hmmm, I kinda see what you did there. It kind of looks similar to that of a recursive method, at-least the return statement. So, for your sample it will return age minus the comparing object's age correct?
type: AnswerComment

http://stackoverflow.com/q/21852382
tagged with: netbeans
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: glassfish
score: 0
has answer: http://stackoverflow.com/a/21854914
tagged with: intellij-idea
answer count: 1
has body: In Intellij Idea 12, i'm trying to start glassfish and deploy my application. I got that error: rg.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: Connection could not be allocated because: java.net.ConnectException. Port 1527 closed. But when I run the same project in Netbeans, I see that Netbeans start the connection on 1527 before starting Glassfish. And the option is checked: "Enable JDBC Driver Deployment". How can I do the same in Intellij? Thanks in advance
has title: On IntelliJ, how to run JDBC connection on starting Glassfish
tagged with: jdbc

hadoop-plugins
type: Tag
tags question: http://stackoverflow.com/q/21929305
tag name: hadoop-plugins

http://stackoverflow.com/comment/33319257
comment on: http://stackoverflow.com/q/21986641
type: Comment
has text: the full log , the full stacktrace
type: QuestionComment
score: 0

http://stackoverflow.com/a/22002249
has body: XDocReport provides converters docx->pdf and odt->pdf based on iText 2.1.7 which is LGPL license although iText 5.5.0 provides a supported version under AGPL license. XDocReport is based on iText 2.1.7 for license reason. Perhaps it will be easy to switch to iText 5.5.0 just by renaming package from converter sources but never tried that. You can read more information about XDocReport lincense here
answers question: http://stackoverflow.com/q/21998010
downvote count: 0
has comment: http://stackoverflow.com/comment/51961116
accepted answer of: http://stackoverflow.com/q/21998010
score: 3
has comment: http://stackoverflow.com/comment/51950763
has comment: http://stackoverflow.com/comment/52525022
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33367890
has comment: http://stackoverflow.com/comment/33359062
type: Answer

grouplayout
type: Tag
tags question: http://stackoverflow.com/q/21946950
tag name: grouplayout

http://stackoverflow.com/a/21953735
accepted answer of: http://stackoverflow.com/q/21953655
has comment: http://stackoverflow.com/comment/33260928
answers question: http://stackoverflow.com/q/21953655
type: Answer
has body: Do it like this. define a boolean variable boolean ignoreDisabled = false; Then in areAllItemsEnabled: public boolean areAllItemsEnabled() { return ignoreDisabled; } and then at the beginning of isEnabled: public boolean isEnabled(int position) { if (areAllItemsEnabled()) { return true; } } or else second way is define following code in your adapter class private int mLastClicked; public void setLastClicked(int lastClicked){ mLastClicked = lastClicked; } and then public boolean areAllItemsEnabled() { return false; } public boolean isEnabled(int position) { // return false if position == position you want to disable } add position of your last click event with isEnabled method. For further reference you can check this link Hope this is gonna help you. Do it like this. ListAdapter adapter = new SimpleCursorAdapter(MyList, Layout, c, new String[] { "Name", "Score" }, to) { public boolean areAllItemsEnabled() { return false; } public boolean isEnabled(int position) { return false; } };
has comment: http://stackoverflow.com/comment/33260825
has comment: http://stackoverflow.com/comment/33260841
has comment: http://stackoverflow.com/comment/33261477
has comment: http://stackoverflow.com/comment/33260943
score: 2
has comment: http://stackoverflow.com/comment/33307087
has comment: http://stackoverflow.com/comment/33260905
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/33261100
has comment: http://stackoverflow.com/comment/33261293
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33261462
has comment: http://stackoverflow.com/comment/33260804

http://stackoverflow.com/comment/35932914
type: AnswerComment
score: 0
has text: This worked with STS 3.5.0.RC4, but not with STS 3.5.0 RELEASE. Instead, use the approach provided by @Pooma
type: Comment
comment on: http://stackoverflow.com/a/22778198

http://stackoverflow.com/a/22055443
answers question: http://stackoverflow.com/q/21986471
has comment: http://stackoverflow.com/comment/33449790
accepted answer of: http://stackoverflow.com/q/21986471
type: Answer
score: 1
upvote count: 1
has body: In your run() implementation, you do this: server.bind(port).sync().channel().closeFuture().sync(); .. which will block until the server socket is closed. Because you do not close the server socket, it will never return. Therefore, only the first server socket will be bound. What you probably want is just bind and return rather than waiting for the server sockets closed.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33133789
comment on: http://stackoverflow.com/a/21867780
score: 0
type: Comment
has text: Are you new to java as well? I thought you were intermediate+ in Java, but new to Android ^^
type: AnswerComment

http://stackoverflow.com/a/36839954
answers question: http://stackoverflow.com/q/21913526
upvote count: 2
has body: Can be done. You can add this and it will work (all done by HTML 5 and most browsers now support accept attribute) - this is example for .csv files: upload.setButtonCaption("Import"); JavaScript.getCurrent().execute("document.getElementsByClassName('gwt-FileUpload')[0].setAttribute('accept', '.csv')");
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/83468060

http://stackoverflow.com/a/21973234
score: 2
has body: Its possible that there are some leading or trailing whitespaces in the 2 strings, you should trim the whitespace before comparing the strings, try this : if(followdateold.trim().toLowerCase().equals(latestfollowerdate.trim().toLowerCase())) {
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/33295793
accepted answer of: http://stackoverflow.com/q/21973180
answers question: http://stackoverflow.com/q/21973180

http://stackoverflow.com/comment/33278861
has text: @Warlord OP states "any amount to two decimal places"
type: AnswerComment
comment on: http://stackoverflow.com/a/21963593
score: 0
type: Comment

http://stackoverflow.com/a/21962899
type: Answer
answers question: http://stackoverflow.com/q/21962886
score: 0
has body: Use frame.setUndecorated(true); but you never set up a frame so just put setUndecorated under setResizable

http://stackoverflow.com/q/21928891
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21929169
has answer: http://stackoverflow.com/a/21929076
has comment: http://stackoverflow.com/comment/33216330
has comment: http://stackoverflow.com/comment/33215890
has comment: http://stackoverflow.com/comment/33216078
has body: I am learning Java from the past one month. I am having difficulties to understand the line for(int i = 0;i&lt;list.length-1;i++){ Can anybody explain me in layman lang. I am a slow learner. I understand for loop but this thing i am not able to understand Int[]list = {5͵7͵54͵34͵87͵44}; boolean swap = true; int temp; while(swap){ swap = false; for(int i = 0;i&lt;list.length-1;i++){ if(list[i] &gt; list[i+1]){ temp = list[i]; list[i] = list[i+1]; list[i+1] = temp; swap = true; } } }
tagged with: java
has answer: http://stackoverflow.com/a/21929005
type: Question
has answer: http://stackoverflow.com/a/21928966
has comment: http://stackoverflow.com/comment/33216199
has comment: http://stackoverflow.com/comment/33215953
tagged with: sorting
has comment: http://stackoverflow.com/comment/33215863
has comment: http://stackoverflow.com/comment/33215911
has comment: http://stackoverflow.com/comment/33215993
score: 0
has title: java bubble sort issue
has comment: http://stackoverflow.com/comment/33216074
has answer: http://stackoverflow.com/a/21929116

http://stackoverflow.com/comment/33244977
has text: How do I get it to divide by ten and then add the ones digit?
comment on: http://stackoverflow.com/a/21944857
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33089690
type: QuestionComment
score: 3
has text: http://stackoverflow.com/questions/985754/how-to-deploy-a-java-applet-for-todays-browsers-applet-embed-object
comment on: http://stackoverflow.com/q/21858053
type: Comment

http://stackoverflow.com/comment/33164497
comment on: http://stackoverflow.com/a/21899351
type: Comment
score: 1
has text: Learn to google :) ... http://www.java2s.com/Code/Oracle/Sequence/Usesequenceininsertcommand.htm
type: AnswerComment

http://stackoverflow.com/comment/33351259
type: Comment
has text: Thanks a lot, I really appreciate it! Really cleared it up for me.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22004168

http://stackoverflow.com/a/21959951
has body: I recommend using the NetBeans GUI builder which is really easy to use and will save you a lot of time and effort, but if you prefer to do it manually, use: class x extends javax.swing.JFrame
has comment: http://stackoverflow.com/comment/33272377
answers question: http://stackoverflow.com/q/21959786
score: 0
type: Answer

http://stackoverflow.com/q/21974856
favorite count: 0
has answer: http://stackoverflow.com/a/21974911
answer count: 5
has comment: http://stackoverflow.com/comment/33298725
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21974874
has answer: http://stackoverflow.com/a/21974881
score: -1
has title: What does "int min = (top < bottom ? top : bottom);" exactly do?
tagged with: java
linked to: http://stackoverflow.com/q/798545
downvote count: 1
has answer: http://stackoverflow.com/a/21974873
type: Question
linked to: http://stackoverflow.com/q/16910359
duplicate of: http://stackoverflow.com/q/798545
duplicate of: http://stackoverflow.com/q/16910359
has body: I was reading through a Java program that my professor recommended we look at and think about how each line would work when I ran into this line of programming. The program deals with fractions and this line came up in a method used to determine the greatest common divisor. The part that confuses me is the coding within the parentheses because I'm not sure what the "?" would do in addition to the "top : bottom". If anyone could explain what this does, I would greatly appreciate it!
has answer: http://stackoverflow.com/a/21974877
upvote count: 0

http://stackoverflow.com/comment/33092056
has text: filename = the long thing , and why isnt it a valid url , @Sotiris Delimanolis , you misunderstood the whole thing. The whole issue is happening when I am trying to make filename a url.
type: QuestionComment
comment on: http://stackoverflow.com/q/21859020
score: 0
type: Comment

http://stackoverflow.com/comment/33240331
has text: Did you think about using SAX API? It is event based and you can add listeners to update the progress.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21942367

http://stackoverflow.com/comment/33313464
type: Comment
has text: try this http://mathiasrichter.blogspot.com.br/2009/10/character-encoding-utf-8-with.html
score: 0
comment on: http://stackoverflow.com/q/21983109
type: QuestionComment

optimization
tags question: http://stackoverflow.com/q/21871639
tags question: http://stackoverflow.com/q/21979662
tags question: http://stackoverflow.com/q/21924147
tags question: http://stackoverflow.com/q/21998655
tags question: http://stackoverflow.com/q/21973874
tags question: http://stackoverflow.com/q/21854687
tags question: http://stackoverflow.com/q/21967081
tags question: http://stackoverflow.com/q/21847844
tag name: optimization
tags question: http://stackoverflow.com/q/21895966
tags question: http://stackoverflow.com/q/21942373
tags question: http://stackoverflow.com/q/21954137
type: Tag
tags question: http://stackoverflow.com/q/21958889
tags question: http://stackoverflow.com/q/21963668

http://stackoverflow.com/q/21863507
has comment: http://stackoverflow.com/comment/33099705
type: UnansweredQuestion
tagged with: file
has title: Java - Read lines of file into different variables
type: Question
has answer: http://stackoverflow.com/a/21863897
tagged with: java
has comment: http://stackoverflow.com/comment/33099863
has body: I've worked with Java for a few years but during that time I've almost never had to do anything with text files. I need to know how to read lines of a text file into different variables as two-digit integers, along with several lines of said text file into a 2D integer array. Every text file is to be written like this: 5 5 1 2 4 3 2 4 2 1 4 0 1 2 3 5 2 0 4 4 1 2 5 5 3 2 4 3 3 2 1 The first three lines should all be separate integers, but the first line is indicative of the 2D array's dimensions. The last segment needs to go into that integer array. This is what I've got so far in terms of code. import java.util.*; import java.io.*; public class Asst1Main { public static void main(String[]args){ try { x = new Scanner(new File("small.txt")); } catch (FileNotFoundException e) { System.out.println("File not found."); } while(x.hasNext()){ } } } I'm completely at a loss of how to do this.
has answer: http://stackoverflow.com/a/21863792
tagged with: arrays
tagged with: string
has comment: http://stackoverflow.com/comment/33100152
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/33099875
has answer: http://stackoverflow.com/a/21863781
has comment: http://stackoverflow.com/comment/33099702
has comment: http://stackoverflow.com/comment/33099947

http://stackoverflow.com/a/21976182
has comment: http://stackoverflow.com/comment/33307128
has comment: http://stackoverflow.com/comment/33302315
answers question: http://stackoverflow.com/q/21975127
type: Answer
has body: Well, it seems like you know how to do this already. Basically, you'd do the same thing you've been doing for the others, but instead of hardcoding in the parameters, you'd put the variable instead. For example, final int MAXSTORIESHIGH= 12; final int MINSTORIESHIGH = 1; do { System.out.print("How many stories high the building will be? (1-5): "); input = in.nextInt(); }while (input &lt; MINSTORIESHIGH || input &gt; MAXSTORIESHIGH); If you wanted to change the max and min, you'd just change the variable's value.
has comment: http://stackoverflow.com/comment/33307780
has comment: http://stackoverflow.com/comment/33345754
score: 0

http://stackoverflow.com/comment/33326459
has text: Can you show the full stacktrace?
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21990677

http://stackoverflow.com/q/21847941
score: 0
answer count: 2
has body: I am Debugging my Java Web Application Using Log4j, I need to Log At Class Level. I do not want to put a line for each Class in my log4j.properties file as I have hundreds of classes in my application like this: log4j.logger.com.my.package.class1=DEBUG log4j.logger.com.my.package.class2=DEBUG log4j.logger.com.my.package.class3=DEBUG Is there a one line setup to Achieve loggin for all the Classes?
tagged with: log4j
has comment: http://stackoverflow.com/comment/33071558
possible better answer: http://stackoverflow.com/a/21848190
accepted answer: http://stackoverflow.com/a/21848054
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21848190
tagged with: java
has answer: http://stackoverflow.com/a/21848054
has title: Log4j Log at all Classes Level
type: Question

http://stackoverflow.com/comment/33081188
type: Comment
has text: You can find this really easily by searching the web. There are dozens of tutorials, many of which will be more informative and educational than answers to this question.
comment on: http://stackoverflow.com/q/21853374
score: 0
type: QuestionComment

http://stackoverflow.com/q/21998325
has comment: http://stackoverflow.com/comment/33365170
answer count: 1
has comment: http://stackoverflow.com/comment/33341779
favorite count: 0
has title: Adding number of Swing controls based on a user input
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10614151
tagged with: swing
tagged with: dynamic
tagged with: java
has answer: http://stackoverflow.com/a/21998697
downvote count: 1
has comment: http://stackoverflow.com/comment/33342338
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/33341317
score: -1
tagged with: label
has body: I have form 1 which has a combo box with values 1 to 5 and a Jbutton. when i click this button then form 2 opens up. now in form 2 dynamically the number of labels to be added depends on the value chosen in form 1's combo box. (example if the value of combo box is 3 and then the button is clicked then form 2 will will open with 3 labels) The article in link :- How can I dynamically add controls to a form based on JComboBox selection? does not answer the question so posting my question. Please help me getting the solution.

http://stackoverflow.com/q/21851552
tagged with: android
has comment: http://stackoverflow.com/comment/33079341
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/21851725
has comment: http://stackoverflow.com/comment/33078790
has body: I have developed an application, that has text view for display some Gujarati text from the JSON URL and data stored in PHP MySQL server database. So, problem with display Gujarati font: My code of JSON http is here: public class CustomHttpClient { public static final int HTTP_TIMEOUT = 30 * 1000; private static HttpClient mHttpClient; private static HttpClient getHttpClient() { if (mHttpClient == null) { mHttpClient = new DefaultHttpClient(); final HttpParams params = mHttpClient.getParams(); HttpConnectionParams.setConnectionTimeout(params, HTTP_TIMEOUT); HttpConnectionParams.setSoTimeout(params, HTTP_TIMEOUT); ConnManagerParams.setTimeout(params, HTTP_TIMEOUT); } return mHttpClient; } public static String executeHttpPost(String url,ArrayList<NameValuePair> postParameters) throws Exception { BufferedReader in = null; try { HttpClient client = getHttpClient(); HttpPost request = new HttpPost(url); UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity( postParameters); request.setEntity(formEntity); HttpResponse response = client.execute(request); in = new BufferedReader(new InputStreamReader(response.getEntity() .getContent())); // in = new BufferedReader(new InputStreamReader(is, "UTF-8"), 8000); StringBuffer sb = new StringBuffer(""); String line = ""; String NL = System.getProperty("line.separator"); while ((line = in.readLine()) != null) { sb.append(line + NL); } in.close(); String result = sb.toString(); return result; } finally { if (in != null) { try { in.close(); } catch (IOException e) { Log.e("log_tag", "Error converting result "+e.toString()); e.printStackTrace(); } } } } and main activity code here: desc_about=(TextView)v.findViewById(R.id.textdesc); Typeface tf=Typeface.createFromAsset(getActivity().getAssets(),"Shruti.ttf"); desc_about.setTypeface(tf); ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>(); postParameters.add(new BasicNameValuePair("temple_id","2")); String response = null; try { response = CustomHttpClient.exec…
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/67364866
tagged with: android-fonts
type: UnansweredQuestion
has title: JSON parsing issue with Gujarati font in Android text view

http://stackoverflow.com/a/38664144
has body: Try this: com.fasterxml.jackson.core jackson-databind 2.12.1
downvote count: 3
has comment: http://stackoverflow.com/comment/64709459
answers question: http://stackoverflow.com/q/21854369
score: 5
upvote count: 8
type: Answer

excel
tags question: http://stackoverflow.com/q/21941345
tags question: http://stackoverflow.com/q/21858308
tags question: http://stackoverflow.com/q/21912597
tags question: http://stackoverflow.com/q/21897041
tag name: excel
tags question: http://stackoverflow.com/q/21991473
tags question: http://stackoverflow.com/q/21896764
tags question: http://stackoverflow.com/q/21897412
tags question: http://stackoverflow.com/q/21872636
tags question: http://stackoverflow.com/q/21855842
tags question: http://stackoverflow.com/q/21931113
tags question: http://stackoverflow.com/q/21977355
tags question: http://stackoverflow.com/q/21912834
tags question: http://stackoverflow.com/q/22004483
tags question: http://stackoverflow.com/q/21845048
tags question: http://stackoverflow.com/q/21847131
tags question: http://stackoverflow.com/q/21925560
tags question: http://stackoverflow.com/q/21918522
tags question: http://stackoverflow.com/q/21879435
type: Tag
tags question: http://stackoverflow.com/q/21925294
tags question: http://stackoverflow.com/q/21935262
tags question: http://stackoverflow.com/q/21867120
tags question: http://stackoverflow.com/q/21907116
tags question: http://stackoverflow.com/q/21861523
tags question: http://stackoverflow.com/q/21877532
tags question: http://stackoverflow.com/q/21935922
tags question: http://stackoverflow.com/q/21879809

http://stackoverflow.com/a/21996306
type: Answer
answers question: http://stackoverflow.com/q/21996169
has body: To answer #3: Arrays.toString works by calling the overridden toString on each element. A two-dimensional array is an array of arrays. Thus, each element of the array is itself an array, and calling toString on an array gives you an address, as it looks like you're aware already. The documentation of toString says: If the array contains other arrays as elements, they are converted to strings by the Object.toString() method inherited from Object, which describes their identities rather than their contents. Look into Arrays.deepToString which I think is what you want.
score: 0

http://stackoverflow.com/a/21901048
answers question: http://stackoverflow.com/q/21900999
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: If you want a ScrollView without scroll bars, you can use the following: android:scrollbars="none" You can do it porgramatically as follows: yourScrollView.setVerticalScrollBarEnabled(false); yourScrollView.setHorizontalScrollBarEnabled(false); Edit: Can you try this one android:scrollbarStyle="insideOverlay"
has comment: http://stackoverflow.com/comment/33962623
score: 5
upvote count: 5
accepted answer of: http://stackoverflow.com/q/21900999

http://stackoverflow.com/q/21955134
has title: Is there a design pattern on how to implement field meta information in the user model?
tagged with: java
has answer: http://stackoverflow.com/a/21955391
has body: A very basic user model would look something like the following: @Entity public class User extends Model { @Email @Required public String email; (...) } The user field like the email for example is a single value within the model. Now I want additional information like lastUpdate and settings like whether or not this field should be displayed public or not. What is the best practice on implementing such field meta information? Is there a design pattern available? Thanks in advance!
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21955391
tagged with: model
score: 0
tagged with: design-patterns
answer count: 1
tagged with: model-view-controller

http://stackoverflow.com/a/21960891
upvote count: 2
has comment: http://stackoverflow.com/comment/33274388
type: Answer
answers question: http://stackoverflow.com/q/21960861
score: 2
downvote count: 0
has body: you can't access arr[Arraylength] the last element would be at arr[Arraylength -1] for example if you have int arr[] = new int[5]; then the elements would be at 4, because index starts from 0 arr[0], arr[1], arr[2], arr[3], arr[4]

http://stackoverflow.com/q/21936785
tagged with: jboss
score: 0
has answer: http://stackoverflow.com/a/21936995
answer count: 1
has body: Hi I am getting the below error Exception : java.net.SocketException: Too many open files I am in the process of moving from geronimo 2.1 to wildfly 8 During the testing of the new application server we get this error. Nothing else had changed exactly the same web appliations running and we have never had this issue on Geronimo. Any ideas? Thanks TOm
tagged with: linux
type: UnansweredQuestion
has title: Exception : java.net.SocketException: Too many open files
tagged with: java
tagged with: wildfly
type: Question

http://stackoverflow.com/comment/33484317
comment on: http://stackoverflow.com/a/21937282
type: AnswerComment
score: 0
type: Comment
has text: I think you are asking the wrong question. Its not a question of "Why use hibernate" but "how to use hibernate". Hibernate requires you to provide a column which will define the mapping column

http://stackoverflow.com/q/21849642
answer count: 2
tagged with: machine-learning
has answer: http://stackoverflow.com/a/21850179
has answer: http://stackoverflow.com/a/25929375
has comment: http://stackoverflow.com/comment/33075414
tagged with: java
has comment: http://stackoverflow.com/comment/33075551
has body: I want to classify certain data into different classes based on its content. I did it using naive bayes classifier and I get an output as the best category to which it belongs. But now I want to classify the news other than those in the training set into "others" class. I can't manually add each/every data other than the training data into a certain class since it has vast number of other categories.So is there any way to classify the other data?. private static File TRAINING_DIR = new File("4news-train"); private static File TESTING_DIR = new File("4news-test"); private static String[] CATEGORIES = { "c1", "c2", "c3", "others" }; private static int NGRAM_SIZE = 6; public static void main(String[] args) throws ClassNotFoundException, IOException { DynamicLMClassifier&lt;NGramProcessLM&gt; classifier = DynamicLMClassifier.createNGramProcess(CATEGORIES, NGRAM_SIZE); for (int i = 0; i &lt; CATEGORIES.length; ++i) { File classDir = new File(TRAINING_DIR, CATEGORIES[i]); if (!classDir.isDirectory()) { String msg = "Could not find training directory=" + classDir + "\nTraining directory not found"; System.out.println(msg); // in case exception gets lost in shell throw new IllegalArgumentException(msg); } String[] trainingFiles = classDir.list(); for (int j = 0; j &lt; trainingFiles.length; ++j) { File file = new File(classDir, trainingFiles[j]); String text = Files.readFromFile(file, "ISO-8859-1"); System.out.println("Training on " + CATEGORIES[i] + "/" + trainingFiles[j]); Classification classification = new Classification(CATEGORIES[i]); Classified&lt;CharSequence&gt; classified = new Classified&lt;CharSequence&gt;(text, classification); classifier.handle(classified); } } }
has title: Classifying data with naive bayes using LingPipe
has comment: http://stackoverflow.com/comment/33075228
upvote count: 4
possible better answer: http://stackoverflow.com/a/21850179
accepted answer: http://stackoverflow.com/a/25929375
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/33075990
favorite count: 0
type: Question
tagged with: lingpipe
has comment: http://stackoverflow.com/comment/33076482
score: 4
tagged with: classification

http://stackoverflow.com/a/21948772
downvote count: 2
upvote count: 1
score: -1
has body: The answer is to uninstall Java and reinstall it.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21940667
answers question: http://stackoverflow.com/q/21940667
type: Answer

http://stackoverflow.com/q/21930975
type: UnansweredQuestion
score: 2
upvote count: 3
has answer: http://stackoverflow.com/a/21931079
has comment: http://stackoverflow.com/comment/33219674
has answer: http://stackoverflow.com/a/21931057
downvote count: 1
type: Question
has body: I want to simulate keyboard inputs, using the Java Robots Class How can I simulate characters like æ ?
tagged with: java
has answer: http://stackoverflow.com/a/21931050
answer count: 3
has comment: http://stackoverflow.com/comment/33219827
tagged with: awtrobot
has title: How can the Java simulate string input?
favorite count: 0

http://stackoverflow.com/a/69084965
downvote count: 0
has comment: http://stackoverflow.com/comment/134727402
type: Answer
answers question: http://stackoverflow.com/q/21894873
has body: My team and I have created an online tool that allows you to parse JSON schema and generate an array of JSON data that complies to the schema. You can save it as .json file and parse it to your app with a Java parser. The tool is called Mock turtle - https://mockturtle.net .
upvote count: 7
has comment: http://stackoverflow.com/comment/134972983
score: 7

http://stackoverflow.com/comment/33456191
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21909471
has text: Why do you think, that `CubeMap`s won't help? I have cubes here, where i only need the front, back, left and right face. Sometimes i don't even need all that faces, if there are adjacent walls. So if i just set those faces to null they won't be drawn Or am i wrong? I think i will go with the meshpartBuilder approach anyway. Just for curiosity.

http://stackoverflow.com/comment/33236728
has text: From looking at the DAO, it looked like he only wanted to insert menu_id and price.
type: AnswerComment
comment on: http://stackoverflow.com/a/21940276
score: 0
type: Comment

http://stackoverflow.com/a/21901434
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21901366
accepted answer of: http://stackoverflow.com/q/21901366
type: Answer
has body: JSON serialization of collections usually have the collection name as a key present, so if you serialize A, the two collections should be serialized how you wish it to be.
score: 0

http://stackoverflow.com/comment/33111164
type: Comment
comment on: http://stackoverflow.com/a/21869575
type: AnswerComment
score: 0
has text: Agreed. Mostly I wanted to make sure the querant was also aware of `finally`, since if they're asking this question they probably need that answer too.

http://stackoverflow.com/comment/33175508
type: Comment
has text: yes itz wornking before this, but not setting the object was theproblem
comment on: http://stackoverflow.com/a/21905830
type: AnswerComment
score: 0

itemlistener
tags question: http://stackoverflow.com/q/21995100
tags question: http://stackoverflow.com/q/21862691
type: Tag
tag name: itemlistener

http://stackoverflow.com/a/21879317
upvote count: 1
has body: findViewById(R.id.edit_message) returns class View. EditText extends from this class, that's why we need to cast View to EditText. If we need View class then we can simply write View v = findViewById(R.id.some_view);
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21879232

http://stackoverflow.com/q/21865501
tagged with: xpath
score: 0
answer count: 2
tagged with: selenium
has comment: http://stackoverflow.com/comment/33103677
tagged with: java
type: UnansweredQuestion
has body: quicknav"> Sign In Create Your Account I tried using below but not working. Please help: driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.findElement(By.xpath("//div[contains(@id, 'userInfoQuickNav'/ title = 'Sign In'"));
type: Question
has answer: http://stackoverflow.com/a/21865705
has title: How Do I Click On This "Sign In" Link Using Selenium & Java?
has answer: http://stackoverflow.com/a/21871285
tagged with: selenium-webdriver

http://stackoverflow.com/comment/33173008
type: Comment
type: QuestionComment
has text: @rajshree - "But my question is, I should validate for words which means a continuous text without meaning (for eg. "ajldjlkdjkjfdjdjjd") should not be printed instead words should be checked say word length of 10 approx. for grammar. "
comment on: http://stackoverflow.com/q/21904569
score: 0

http://stackoverflow.com/comment/33282266
type: QuestionComment
has text: Please, include your code.
score: 0
comment on: http://stackoverflow.com/q/21965338
type: Comment

http://stackoverflow.com/q/21868809
has comment: http://stackoverflow.com/comment/33110075
has comment: http://stackoverflow.com/comment/33109848
type: Question
tagged with: java
has body: I keep getting a null pointer exception when calling the below method inside a run method. protected void swTimerDisplay() { String display; long now; long diff; long secs; long mins; long hours; if(timerIsRunning) { now = System.currentTimeMillis(); }else{ now = endTime; } diff = now - startTime; if(diff &lt; 0) { diff = 0; } /** * Calculate the * secs,mins and hours */ secs = diff / 1000; mins = secs / 60; hours = mins / 60; secs = secs % 60; mins = mins % 60; display = String.format("%d", hours) + ":" + String.format("%02d", mins) + ":" + String.format("%02d", secs); swCounter.setText(display); } here is the log cat output 02-18 19:47:27.143: E/AndroidRuntime(1695): FATAL EXCEPTION: main 02-18 19:47:27.143: E/AndroidRuntime(1695): Process: com.webdeveloper93.profitnessstopwatch, PID: 1695 02-18 19:47:27.143: E/AndroidRuntime(1695): java.lang.NullPointerException 02-18 19:47:27.143: E/AndroidRuntime(1695): at com.webdeveloper93.profitnessstopwatch.StopwatchTimer.swTimerDisplay(StopwatchTimer.java:57) 02-18 19:47:27.143: E/AndroidRuntime(1695): at com.webdeveloper93.profitnessstopwatch.timerUpdate.run(timerUpdate.java:22) 02-18 19:47:27.143: E/AndroidRuntime(1695): at android.os.Handler.handleCallback(Handler.java:733) 02-18 19:47:27.143: E/AndroidRuntime(1695): at android.os.Handler.dispatchMessage(Handler.java:95) 02-18 19:47:27.143: E/AndroidRuntime(1695): at android.os.Looper.loop(Looper.java:137) 02-18 19:47:27.143: E/AndroidRuntime(1695): at android.app.ActivityThread.main(ActivityThread.java:4998) 02-18 19:47:27.143: E/AndroidRuntime(1695): at java.lang.reflect.Method.invokeNative(Native Method) 02-18 19:47:27.143: E/AndroidRuntime(1695): at java.lang.reflect.Method.invoke(Method.java:515) 02-18 19:47:27.143: E/AndroidRuntime(1695): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777) Thanks for any help you can provide. EDIT: Line 57 is swCounter.setText(display); below is where swTimerDisplay(); is called public class timerUpd…
has comment: http://stackoverflow.com/comment/33109841
answer count: 1
has comment: http://stackoverflow.com/comment/33109851
has comment: http://stackoverflow.com/comment/33109890
has comment: http://stackoverflow.com/comment/33109794
has title: NullPointerException issue when calling method inside run method
score: 0
tagged with: nullpointerexception
tagged with: android
has comment: http://stackoverflow.com/comment/33113710
tagged with: android-handler
has answer: http://stackoverflow.com/a/21869430
type: UnansweredQuestion

http://stackoverflow.com/comment/33242292
score: 0
type: Comment
type: QuestionComment
has text: @TrustNoOne I agree this is a fundamental Java problem. However, there was a way around it using JMock. I could do: mockedCar.stubs().method("isVeryBig").will(returnValue(false)); So, yes that's a limitation I'm facing now that I'm using Mockito.
comment on: http://stackoverflow.com/q/21939246

http://stackoverflow.com/a/21947424
answers question: http://stackoverflow.com/q/21947411
downvote count: 0
has body: You made a syntax error with the + sign. System.out.println( tres + " sería el mayor y " + dos + " el menor"); Assuming tres and dos are variables.
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/33137698
type: Comment
type: QuestionComment
has text: Basically it always shows the array TO BE sorted and doesn't go to the algorithm part at all... it doesn't give errors but just doesn't show the the sorted array at all
comment on: http://stackoverflow.com/q/21884858
score: 0

http://stackoverflow.com/a/22004622
has comment: http://stackoverflow.com/comment/33352022
has comment: http://stackoverflow.com/comment/33352294
score: 0
answers question: http://stackoverflow.com/q/22004426
has body: Seems all you need to do is check to see if player/cpu has already taken that space. If not, you should just assign 'X' or 'O' to that element in the array. if(board[rowNumber][columnNumber] != 'X' &amp;&amp; board[rowNumber][columnNumber] != 'O') { board[rowNumber][columnNumber] = player; } You will probably want to have some kind of loop within your main() function to continuously allow players to move as well. The current implementation appears to only allow a player to make one move.
type: Answer

http://stackoverflow.com/q/21894023
upvote count: 3
tagged with: java
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21894059
tagged with: type-conversion
tagged with: boolean
tagged with: byte
has comment: http://stackoverflow.com/comment/33155110
has body: I am trying to write a TCP server/client program that transmits a stream of 4 bytes. Once the client receives the 4 bytes, I would then like to convert each received byte into a boolean[8]. Is there a way to do this? I can successfully transmit the 4 bytes from server to client, and the value of each byte received by the client matches the one transmitted to the server. I have pinpointed the error in the conversion method I wrote on the client side which is pasted below, I can post more code upon request if required. SAMPLE INPUT======(-2 11111110) (-10 11110110) (-2 11111110) (-2 11111110) ACTUAL OUTPUT====(-2 11111110) (-10 11110110) (-2 11111110) (-2 11111110) EXPECTED OUTPUT==(-2 11111110) (-10 11110110) (-2 11111110) (-2 11111110) [Same as input] public static boolean[] byteToBoolArr(byte x) { boolean[] boolArr = new boolean[8]; boolArr[0] = ((x &amp; 0x01) != 0); boolArr[1] = ((x &amp; 0x02) != 0); boolArr[2] = ((x &amp; 0x04) != 0); boolArr[3] = ((x &amp; 0x08) != 0); boolArr[4] = ((x &amp; 0x16) != 0); boolArr[5] = ((x &amp; 0x32) != 0); boolArr[6] = ((x &amp; 0x64) != 0); boolArr[7] = ((x &amp; 0x128) != 0); return boolArr; }
possible better answer: http://stackoverflow.com/a/44874790
favorite count: 0
has answer: http://stackoverflow.com/a/44874790
accepted answer: http://stackoverflow.com/a/21894059
has comment: http://stackoverflow.com/comment/33155486
has title: Is there a way to convert a byte to a boolean array in java?
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/21957696
type: Question
possible better answer: http://stackoverflow.com/a/21957813
tagged with: java
has answer: http://stackoverflow.com/a/21957813
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33268314
favorite count: 0
has answer: http://stackoverflow.com/a/21957870
has comment: http://stackoverflow.com/comment/33268049
has comment: http://stackoverflow.com/comment/33268448
has title: How to use JOptionPane with many options? java
has body: I was experimenting with different JOptionPane and I came across having different options in a array and then using it on JOptionPane. However I am finding it hard to use the given options, so for example, how would I use my GO back option? String[] options = new String[] {"Go ahead", "Go back", "Go forward", "close me"}; int option = JOptionPane.showOptionDialog(null, "Title", "Message", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]); I have tried doing it like this but it won't work if (option == JOptionPane.options[1]){ } edit: switch(option){ case 1: System.out.println("1"); break; case 2: System.out.println("2"); break; case 3: System.out.println("3"); break; case 4: System.out.println("4"); break; }
has comment: http://stackoverflow.com/comment/33268426
score: 2
tagged with: joptionpane
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/33268138
tagged with: swing
accepted answer: http://stackoverflow.com/a/21957870

http://stackoverflow.com/a/21945460
has body: Are you sure you need all those libs? You have many jars that might be conflicting with jboss own jars, finding which one and at the same time keeping your app from not crashing won't be easy. You could instead try isolating your deployment classloader and make your app classes override the server classes. Place a file named jboss-web.xml in your WEB-INF directory with this content: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;jboss-web&gt; &lt;class-loading java2ClassLoadingCompliance="false"&gt; &lt;loader-repository&gt; com.example:archive=unique-archive-name &lt;loader-repository-config&gt;java2ParentDelegation=false&lt;/loader-repository-config&gt; &lt;/loader-repository&gt; &lt;/class-loading&gt; &lt;/jboss-web&gt; com.example:archive=unique-archive-name is not really relevant as long as it's a unique name.
answers question: http://stackoverflow.com/q/21944321
type: Answer
score: 0

http://stackoverflow.com/q/21943471
score: 0
tagged with: java
has title: Requesting different parameters using request.getParameter
has answer: http://stackoverflow.com/a/21943531
type: Question
tagged with: servlets
has body: hi i'm using this code from android to send a json to a servlet what works fine, and i was wondering how i could i send a different tag ie Tag2 to the servlet side, but still be able to handle the Tag1 safely on the servlet side //aproximate desired code //android side ... url = new URL("http:// 10.0.2.2:8080 /Server/goTo?Tag1="+JSON); ... url = new URL("http:// 10.0.2.2:8080 /Server/goTo?Tag2="+JSON); ... //servlet side ... jsonRequest= new JSONObject(request.getParameter("Tag1")); ... jsonRequest= new JSONObject(request.getParameter("Tag")); ...
answer count: 1
accepted answer: http://stackoverflow.com/a/21943531
tagged with: jsp
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/comment/33194866
type: AnswerComment
has text: I also tried with only those two properties, but this issue of "list" command is kind of intermittent.sometime it shows me my tables and sometime it give either org.apache.hadoop.hbase.masterNotRunningException or java.lang.reflect.undeclaredThrowableException.Even if i left the client Port property in my Hbase-site.xml file.some time this shows table,sometimes gives exception.
comment on: http://stackoverflow.com/a/21892573
score: 0
type: Comment

http://stackoverflow.com/comment/33102710
score: 1
comment on: http://stackoverflow.com/a/21863432
has text: Basically you we're on the right track. It was not the Xmx or Xms Settings that caused my problem. In my eclipse.ini there are two entries in there: --launcher.XXMaxPermSize 256m and -XX:MaxPermSize=512m It seems that the -XX:MaxPermSize was ignored and eclipse started using a MaxPermSize of 256m. After changing that line, debugging is now possible without a headache.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21925178
answer count: 3
has answer: http://stackoverflow.com/a/21925222
has comment: http://stackoverflow.com/comment/33209910
has comment: http://stackoverflow.com/comment/33209865
favorite count: 0
accepted answer: http://stackoverflow.com/a/21925258
upvote count: 2
has comment: http://stackoverflow.com/comment/33209869
has answer: http://stackoverflow.com/a/21925275
has title: Null pointer java
has comment: http://stackoverflow.com/comment/33209902
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33209911
type: Question
has comment: http://stackoverflow.com/comment/33209909
has comment: http://stackoverflow.com/comment/33209853
has body: I'm trying to open a directory get its name and load all the images from it. I'm getting a null pointer after the first system out print. What am I doing wrong? Is there also a better way to code this? Here is my code: public void open() { JFileChooser chooser = new JFileChooser(); File studyPath = new File("C:\\"); chooser.setCurrentDirectory(studyPath); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = chooser.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { // gets study path and sets study name studyPath = chooser.getSelectedFile(); studyName = chooser.getName(studyPath); // get study images int x; int y; for(File i : studyPath.listFiles()) { try { FileInputStream file_input_stream = new FileInputStream(i); BufferedImage image_file = ImageIO.read(file_input_stream); x = image_file.getHeight(); y = image_file.getWidth(); int[] res = {x, y}; StudyImage image = new StudyImage(i.getName(), res, image_file); System.out.println(image.toString()); studyImages.add(image); } catch (FileNotFoundException ex) { Logger.getLogger(Study.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(Study.class.getName()).log(Level.SEVERE, null, ex); } } } } But I get a null pointer after the first Sys out print line Stack trace: run: Image name: ct_head01.jpg Resolution: [I@5f85f4b7 Exception in thread "main" java.lang.NullPointerException at medicalimageviewer.Study.open(Study.java:69) at medicalimageviewer.MedicalImageViewer.main(MedicalImageViewer.java:12) Java Result: 1 What studyImage is: private LinkedList&lt;StudyImage&gt; studyImages;
has answer: http://stackoverflow.com/a/21925258
downvote count: 0
possible better answer: http://stackoverflow.com/a/21925222

http://stackoverflow.com/comment/33228581
score: 0
type: Comment
type: QuestionComment
has text: In a way yes, I was thinking of taking a single sentence with keywords separated with spaces such as i.e "Enter keywords separated by a space" and the user would enter something such as, "President JAVA writing". Three different words, I was wondering if I could take those three words from one string and split it into different ones, then see if they show up in the text file and output for example "President shows up 20 times in the file"
comment on: http://stackoverflow.com/q/21935859

http://stackoverflow.com/comment/33283552
comment on: http://stackoverflow.com/a/21965876
score: 0
type: AnswerComment
type: Comment
has text: @user2249516, I thought in any way or other it is explained by Jon Skeet that there can be the case with cache that how your data is cacheable

http://stackoverflow.com/comment/33166077
type: AnswerComment
type: Comment
score: 0
has text: @StefanHaustein Maybe the word "locks" wasn't the best in this context. But generally I meant the same thing as james large
comment on: http://stackoverflow.com/a/21893496

http://stackoverflow.com/q/21889469
type: AnsweredQuestion
tagged with: list
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21889640
type: Question
answer count: 2
tagged with: hashmap
has body: I have a textfile like: fruits bananna blackbery apple vegetable carrot potato cars toyota honda ww bmw I need my Java program to take a string like vegetable and display the next words in line. In this case the program will display carrot potato I have the code below: public static void ParseWithHashMap(String wordGiven) throws IOException { HashMap&lt;String, ArrayList&lt;String&gt;&gt; map = new HashMap&lt;String, ArrayList&lt;String&gt;&gt;(); ArrayList&lt;String&gt; lemmes = new ArrayList&lt;String&gt;(); FileInputStream fin = null; InputStreamReader isr = null; BufferedReader br = null; try { fin = new FileInputStream("test.txt"); isr = new InputStreamReader(fin, "UTF-8"); br = new BufferedReader(isr); String line = br.readLine(); while (line != null) { String[] toks = line.split("\\s+"); for (int i = 1; i &lt; toks.length; i++) { lemmes.add(toks[i]); } map.put(toks[0], lemmes); line = br.readLine(); } } finally { } System.out.println(map.get(wordGiven)); } The problem is, when I type fruits the program will display all the words from textfile except first word of each line bananna blackbery apple carrot potato toyota honda ww bmw , and I want to show me the words that follow the word that I give, in this case would be bananna blackbery apple What am I doing wrong?
possible better answer: http://stackoverflow.com/a/21889859
has answer: http://stackoverflow.com/a/21889859
score: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/21889640
has comment: http://stackoverflow.com/comment/33146688
tagged with: parsing
favorite count: 0
has comment: http://stackoverflow.com/comment/33146772
has title: Text file parsing using HashMap and List

http://stackoverflow.com/comment/33359059
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21999694
has text: I implemented the AssetManager at it is now showing the model but when I add the "controller.update(Gdx.graphics.getDeltaTime());" line it returns a null pointer exception. I have the code over here: http://pastebin.com/E5tL5dJy Am I missing something?
type: AnswerComment

http://stackoverflow.com/comment/33257307
comment on: http://stackoverflow.com/q/21951436
score: 0
type: Comment
type: QuestionComment
has text: ...and because these are simple containers, and you are just measuring element adding, then memory use directly correlates with measured time. There's no searching the right place to insert, there's no calculating hashes, or nothing like that, just following pointers and doing addition.

http://stackoverflow.com/comment/33267825
has text: Yes that's the tutorial. I entered the api keys, I tried it first with a wrong one and then I got a fileNotFoundException. It does give multiple options when creating an app in the dashboard and it wasn't very clear which I should choose. So first I tried Mobile Cloud API App and that's when I got the fileNotFoundException so then I tried the Multiplayer WARP Cloud App and that key seems to work but I can't get it to connect.
score: 0
comment on: http://stackoverflow.com/q/21952349
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21888674
tagged with: imageview
has answer: http://stackoverflow.com/a/21891555
tagged with: fade
has answer: http://stackoverflow.com/a/45028837
downvote count: 0
favorite count: 0
upvote count: 8
possible better answer: http://stackoverflow.com/a/45028837
answer count: 5
accepted answer: http://stackoverflow.com/a/21891555
tagged with: android
score: 8
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: Is there any way to apply vertical/horizontal fading edges to an ImageView component? I already tried android:fadingEdge but unfortunately this attribute is deprecated and will be ignored as of API level 14, Any ideas?
has title: Apply fading edges to ImageView
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/47875481
has answer: http://stackoverflow.com/a/57766579
has answer: http://stackoverflow.com/a/29575215

http://stackoverflow.com/a/21904885
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33217564
has body: Applet does not maintain a state-full communication between client and server. It is a Java application that runes inside the browser and has an access to a local system resources (if signed) and existing browser session, i.e. can use the same cookies to perform HTTP calls within the same Server-Side session. 1) Yes, you can do you task in Applet as in any other java application, however, in case of Applet it must be signed with the digital signature: http://www.oracle.com/technetwork/java/javase/tech/java-code-signing-1915323.html#60 2) No. All the classpath dependencies Applet may have, will be downloaded and cached on the client machine. See http://docs.oracle.com/javase/tutorial/deployment/deploymentInDepth/index.html
has comment: http://stackoverflow.com/comment/33219381
type: Answer
has comment: http://stackoverflow.com/comment/33179395
has comment: http://stackoverflow.com/comment/33215688
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21904698
accepted answer of: http://stackoverflow.com/q/21904698
has comment: http://stackoverflow.com/comment/33177530

http://stackoverflow.com/a/58572214
has body: The persistence.xml should be in src/main/resources/META-INF. This worked for me. Please not that this was a non spring project
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21967952

http://stackoverflow.com/a/21964183
score: 0
answers question: http://stackoverflow.com/q/21964039
type: Answer
has body: //You need to declare a prototype if you want function after main function. //So that the compiler knows the function existed. //Prototype must matches the return type and parameter of the function header. int gameBoard(); void functionWithParameter(String text); //or just void functionWithParameter(String) int main() { gameBoard(); } int gameBoard(){ //gameboard code //needs to return int just like java } void functionWithParameter(String text) { //code here }

http://stackoverflow.com/comment/33269264
comment on: http://stackoverflow.com/q/21958391
has text: The source code looks ok to me... Might be that the area is too small so Java abreviates the labels.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/33079822
comment on: http://stackoverflow.com/a/21852274
has text: I gave one of the variants of answers
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/33280847
type: QuestionComment
has text: Rather than posting completely useless / invalid code "just for fun", please post a question that makes sense.
score: 1
comment on: http://stackoverflow.com/q/21964654
type: Comment

http://stackoverflow.com/a/21846857
score: 4
has body: Gradle is the main component of the new Android build system that was introduced with the new IDE for Android development, AndroidStudio. The Gradle user guide is a good read. It is possible to use the new gradle-based build system with Eclipse, just follow the steps pointed out here: Is there any way to integrate Eclipse with Gradle in Android project?
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/21846560
answers question: http://stackoverflow.com/q/21846560
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/21851384
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21849617
type: Answer
has body: Specify a generator for the above @Id @GeneratedValue(strategy=SEQUENCE, generator="CUST_SEQ") @Column(name="CUST_ID") public Long getId() { return id; } Example 2: @Id @GeneratedValue(strategy=TABLE, generator="CUST_GEN") @Column(name="CUST_ID") Long id; This is well explained here : Hibernate: rundown on how @GeneratedValue works
accepted answer of: http://stackoverflow.com/q/21849617
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/33079673

http://stackoverflow.com/q/21892289
has body: I am sending Email using AsyncTask: class AsyncSendEmail extends AsyncTask&lt;String, Void, String&gt; { private Exception exception; Session session; public AsyncSendEmail(Session _session) { session = _session; } protected String doInBackground(String... parms) { try { MimeMessage message = new MimeMessage(session); DataHandler handler = new DataHandler(new ByteArrayDataSource(parms[1].getBytes(), "text/plain")); message.setSender(new InternetAddress(parms[2])); message.setSubject(parms[0]); message.setDataHandler(handler); if (parms[2].indexOf(',') &gt; 0) message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(parms[2])); else message.setRecipient(Message.RecipientType.TO, new InternetAddress(parms[2])); Transport.send(message); return "SUC"; } catch (Exception e) { e.printStackTrace(); return "FLD"; } } The methos invocation: public synchronized void sendMail(String subject, String body, String sender, String recipients) throws Exception { new AsyncSendEmail(session).execute(subject,body,sender,recipients); } When my "doInBackground" method excecutes and failes i want to alert the user using Notification. How can i do this? how can i catch the Exception from the method invocation? Or how can i get a Context so i can show a notification?
score: 0
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/21892393
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/21892454
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/33151820
tagged with: java
has answer: http://stackoverflow.com/a/21892466
has title: Give feed back to user when AsyncTask failes

http://stackoverflow.com/a/21950803
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/33255932
score: 1
has comment: http://stackoverflow.com/comment/33260720
answers question: http://stackoverflow.com/q/21950645
has body: volatile concerns memory visibility. The value of the volatile variable becomes visible to all readers after a write operation completes on it. Kind of like turning off caching. Here is a good stack overflow response: Do you ever use the volatile keyword in Java? Concerning specific questions, no they are not synchronized. You still need to use locking to accomplish that. Normal variables are neither synchronized or volatile. To optimize threaded code its probably worth reading up on granularity, optimistic and pessimistic locking.
has comment: http://stackoverflow.com/comment/33256368
downvote count: 0

http://stackoverflow.com/a/21905509
has comment: http://stackoverflow.com/comment/33177352
has comment: http://stackoverflow.com/comment/33178067
has comment: http://stackoverflow.com/comment/33177490
type: Answer
upvote count: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/21905377
has body: Use the latest versions of ChromeDriver. Source| http://chromedriver.storage.googleapis.com/index.html
answers question: http://stackoverflow.com/q/21905377
has comment: http://stackoverflow.com/comment/33175699
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33176813
has comment: http://stackoverflow.com/comment/33176857
score: 0

http://stackoverflow.com/a/21855837
type: Answer
has body: You can do the following thing 1) Read the XML File using say filereader class. 2) Read the content of the file as string 3) For getting the number of instance of a particular content, you can either your String class equals method and increment a counter on every match found or use regex (Pattern and Matcher class) to know how many times, the content occured
answers question: http://stackoverflow.com/q/21855290
score: 0

http://stackoverflow.com/q/21857814
has comment: http://stackoverflow.com/comment/33090197
answer count: 3
upvote count: 1
accepted answer: http://stackoverflow.com/a/22157089
tagged with: java
tagged with: mapreduce
possible better answer: http://stackoverflow.com/a/21858027
tagged with: hadoop
has answer: http://stackoverflow.com/a/21858027
has comment: http://stackoverflow.com/comment/33089462
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: amazon-web-services
has body: I tried to distribute a calculation using hadoop. I am using Sequence input and output files, and custom Writables. The input is a list of triangles, maximum size 2Mb, but can be smaller around 50kb too. The intermediate values and the output is a map(int,double) in the custom Writable. Is this the bottleneck? The problem is that the calculation is much slower than the version without hadoop. also, increasing the nodes from 2 to 10, doesn't speed up the process. One possibility is that I don't get enough mappers because of the small input size. I made tests changing the mapreduce.input.fileinputformat.split.maxsize, but it just got worse, not better. I am using hadoop 2.2.0 locally, and at amazon elastic mapreduce. Did I overlook something? Or this is just the kind of task which should be done without hadoop? (it's my first time using mapreduce). Would you like to see code parts? Thank you. public void map(IntWritable triangleIndex, TriangleWritable triangle, Context context) throws IOException, InterruptedException { StationWritable[] stations = kernel.newton(triangle.getPoints()); if (stations != null) { for (StationWritable station : stations) { context.write(new IntWritable(station.getId()), station); } } } class TriangleWritable implements Writable { private final float[] points = new float[9]; @Override public void write(DataOutput d) throws IOException { for (int i = 0; i &lt; 9; i++) { d.writeFloat(points[i]); } } @Override public void readFields(DataInput di) throws IOException { for (int i = 0; i &lt; 9; i++) { points[i] = di.readFloat(); } } } public class StationWritable implements Writable { private int id; private final TIntDoubleHashMap values = new TIntDoubleHashMap(); StationWritable(int iz) { this.id = iz; } @Override public void write(DataOutput d) throws IOException { d.writeInt(id); d.writeInt(values.size()); TIntDoubleIterator iterator = values.iterator(); while (iterator.hasNext()) { iterator.advance(); d.writeInt(iterator.key()); d.writeDoubl…
favorite count: 0
has title: Hadoop mapreduce with input size ~ 2Mb slow
has answer: http://stackoverflow.com/a/22152017
type: Question
has answer: http://stackoverflow.com/a/22157089
tagged with: writable

http://stackoverflow.com/comment/33222480
type: QuestionComment
has text: hey share the console and db connection and where db connection in your program.
comment on: http://stackoverflow.com/q/21930458
score: 0
type: Comment

http://stackoverflow.com/q/21892972
tagged with: java
has comment: http://stackoverflow.com/comment/33153274
type: Question
score: 5
has body: I would like to draw a straight dotted line in libgdx for android game between to points of the screen. Currently I have the following code to draw the not-dotted line, using a ShapeRenderer: shapeRenderer.begin(ShapeType.Line); //draws normal line, would prefer it dotted............... shapeRenderer.line(touchPos.x, touchPos.y, someSprite.getX(), someSprite().getY()); shapeRenderer.end(); I have seen another question about dotted lines, but it is a bit of an overkill for me since I don't need it curved etc. I just need a straight dotted line, like ............................................................................................... Was thinking about having a loop that just calculates the positions of the dots on the line and just draws dots there? but is that really necessary, does anyone know a simpler way?
tagged with: libgdx
has answer: http://stackoverflow.com/a/22594342
upvote count: 5
linked to: http://stackoverflow.com/q/10401644
tagged with: draw
possible better answer: http://stackoverflow.com/a/21893243
answer count: 2
has answer: http://stackoverflow.com/a/21893243
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22594342
tagged with: android
has title: Easy way of drawing a straight dotted line in libgdx?
tagged with: drawing
type: AnsweredQuestion

http://stackoverflow.com/comment/33090767
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21858686
has text: You could use a profiler (netbeans comes with a profiler) or user System.nanoTime() to do your own profiling
score: 0

http://stackoverflow.com/q/21852257
tagged with: inheritance
favorite count: 0
upvote count: 5
has body: I have this method with a generic class as parameter: myMethod(Class myclass){ Superclass superclass = myclass; } then I use the method by passing a child class of the Superclass myMethod(Mychildclass.class) Netbeans is giving me a warning that I am using generic "Class". However this works fine. If I change the method's parameter to this more specific myMethod(Class&lt;Superclass&gt; myclass){ this.superclass = myclass; } then I am getting an error when trying to use my method: incompatibles types: Class&lt;Mychildclass&gt; cannot be converted to Class&lt;Superclass&gt; So my question: Why is this not working? How can I make Netbeans happy giving me no warning and no error messages?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21852347
accepted answer: http://stackoverflow.com/a/21852347
downvote count: 0
tagged with: parameter-passing
type: Question
tagged with: parameters
tagged with: java
score: 5
tagged with: casting
has title: Java: Inheriting class can not be converted to super class in method parameter
answer count: 1

http://stackoverflow.com/comment/33105956
comment on: http://stackoverflow.com/a/21865825
type: AnswerComment
has text: This answer seems to imply that thread safety is composable. It's not. If a(X), b(Y), and c(X) are all thread-safe methods, then a method, d() that does nothing but call a(x), b(y), and c(x) still might _not_ be thread safe. The a(x) and c(x) methods might guarantee to leave x in a 'safe' state no matter what happens in other threads, and likewise for b(y), but 'safety' for d() might mean preserving an important relationship _between_ x and y. With no mutual exclusion, it might not be able to do that when called from more than one thread at the same time.
score: 0
type: Comment

http://stackoverflow.com/comment/33303574
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21977479
has text: if i do this if (rating.equals("Excellent")) { percentRaise = .06; raise = (.06 * currentSalary); } else if (rating.equals("Good")) { percentRaise = .04; raise = (.04 * currentSalary); } else if (rating.equals("Poor")) { percentRaise = .015; raise = (.015 * currentSalary); }
score: 0

http://stackoverflow.com/a/21989450
accepted answer of: http://stackoverflow.com/q/21989330
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21989330
type: AcceptedAnswer
downvote count: 0
has body: You are looking for the Gradle Tooling API. See Embedding Gradle in the Gradle User Guide, and the samples in the full Gradle distribution.
type: Answer

http://stackoverflow.com/a/21943057
has body: Java is case sensitive - change the println argument to match the method argument System.out.println("Dear " + ttl + " " + fName + " " + lName + ","); ^
upvote count: 5
type: Answer
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/21943025

http://stackoverflow.com/comment/33078079
type: Comment
type: QuestionComment
has text: You mean java:/jdbc/dice ? Tried that but i get: JBAS011053: Incompatible conflicting binding at java:/jdbc/dice source: lookup (java:comp/DefaultDataSource)
comment on: http://stackoverflow.com/q/21849450
score: 0

http://stackoverflow.com/q/21998543
possible better answer: http://stackoverflow.com/a/21998625
upvote count: 0
tagged with: java.util.scanner
downvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33341076
has body: Basically I need this while loop to perform 4 times It will ask user for input then use that input in the nested if statements. (repeat 4 times) The first prompt will show up and I am able to type an input. but after that it just gives me an error. and keeps pointing the error to "int userInput = scan.nextInt();" I have no idea whats wrong with it. Can someone guide me? thanks int count = 0; while (count &lt; 4 ) { System.out.println(prompt1); int userInput = scan.nextInt(); (some nested if statements here to do my task, they all have count++ at the end) }
tagged with: java
has answer: http://stackoverflow.com/a/21998625
has comment: http://stackoverflow.com/comment/33341193
has comment: http://stackoverflow.com/comment/33341130
type: Question
tagged with: iterator
answer count: 2
score: -2
has title: nextInt() having issues in a while loop
favorite count: 0
has answer: http://stackoverflow.com/a/21998569
accepted answer: http://stackoverflow.com/a/21998569
tagged with: while-loop

http://stackoverflow.com/comment/33167261
has text: i am doing same task as u r and i have added `setType` tag to intent and also `setDataAndType` tag. and it is working perfectly. thats why i m suggesting you to add. @GAMA
comment on: http://stackoverflow.com/a/21900743
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21988784
type: Question
tagged with: testing
has answer: http://stackoverflow.com/a/21991759
has body: I was evaluating the APIGEE proxy apis and accessing by programmatic deploy and invoke. I downloaded the sample programs (api-pltform-samples-master). While testing the simpleProxy, I ran the deploy.sh and kept receiving the error: Deploying to test on https://api.enterprise.apigee.com using batabya and batabya Writing ../simpleProxy/deploy.sh to ./deploy.sh Writing ../simpleProxy/invoke.sh to ./invoke.sh Writing ../simpleProxy/apiproxy/weatherapi.xml to apiproxy/weatherapi.xml Writing ../simpleProxy/apiproxy/proxies/default.xml to apiproxy/proxies/default.xml Writing ../simpleProxy/apiproxy/resources/jsc/changeResponse.js to apiproxy/resources/jsc/changeResponse.js Writing ../simpleProxy/apiproxy/resources/jsc/generateResponse.js to apiproxy/resources/jsc/generateResponse.js Writing ../simpleProxy/apiproxy/resources/jsc/MashItUp.js to apiproxy/resources/jsc/MashItUp.js Writing ../simpleProxy/apiproxy/resources/py/calculateAddress.py to apiproxy/resources/py/calculateAddress.py Writing ../simpleProxy/apiproxy/resources/py/setHeader.py to apiproxy/resources/py/setHeader.py Writing ../simpleProxy/apiproxy/resources/py/Timer.py to apiproxy/resources/py/Timer.py Writing ../simpleProxy/apiproxy/resources/xsl/rewriteEndpoint.xsl to apiproxy/resources/xsl/rewriteEndpoint.xsl Writing ../simpleProxy/apiproxy/targets/default.xml to apiproxy/targets/default.xml Import failed to /v1/organizations/batabya/apis?action=import&amp;name=weatherapi with status 401: If 'State: deployed', then your API Proxy is ready to be invoked. Run '$ sh invoke.sh' If you get errors, make sure you have set the proper account settings in /setup/setenv.sh FYI: I have created my profile with admin rights.
score: 0
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21991157
tagged with: java
tagged with: apigee
has title: Programmatic testing of API proxies

http://stackoverflow.com/comment/33084727
has text: There are a few **very** common data structures in Java (and most other programming languages).
type: AnswerComment
comment on: http://stackoverflow.com/a/21854701
score: 0
type: Comment

http://stackoverflow.com/q/21923791
upvote count: 2
has answer: http://stackoverflow.com/a/21924172
favorite count: 0
answer count: 5
tagged with: absolute-value
has body: I want to implement a function to get the absolute value of a number in java: do nothing if it is positive, if it is negative, convert to positive. I want to do this only using bit manipulations and no number comparators. Please help
possible better answer: http://stackoverflow.com/a/21923881
score: 2
has answer: http://stackoverflow.com/a/21923881
downvote count: 0
tagged with: bit-manipulation
has answer: http://stackoverflow.com/a/21924413
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21923843
accepted answer: http://stackoverflow.com/a/21924172
has title: how to get absolute value of a number in java using bit manipulation
tagged with: java
has answer: http://stackoverflow.com/a/31021639

http://stackoverflow.com/comment/33078106
comment on: http://stackoverflow.com/a/21849161
score: 0
has text: @Boris the Spider: I decided against merging them as it would imply either, performing `+multiplier` more than necessary or to use a less readable syntax (`+=` inside the loop body).
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33147360
has text: Ok, you could just use DOM parser with XPATH for this. DOM has a nodelist. Loop the content from xml file and add to a NodeList Take the content from nodelist and add to a String[]
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21889920

http://stackoverflow.com/comment/33209200
comment on: http://stackoverflow.com/q/21893300
score: 0
type: QuestionComment
has text: in the first line after all imports, replace prefHeight="700.0" prefWidth="1000.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="10.0" minWidth="0.0" prefHeight="-1.0" prefWidth="-1.0"
type: Comment

http://stackoverflow.com/comment/33077171
comment on: http://stackoverflow.com/a/21850762
score: 0
type: AnswerComment
has text: @Brian - other than logging the `int` returned by `inputStream.read()` how else could we dump the raw bytes? -Thanks.
type: Comment

http://stackoverflow.com/comment/33264182
type: QuestionComment
comment on: http://stackoverflow.com/q/21954319
has text: You can't mix Swing and SWT components like that
score: 0
type: Comment

http://stackoverflow.com/q/21956689
score: -1
has body: I'm new in java, and I have a problem. I have two android phones (Client and Server). Can anybody say me how to display on Client application the Server IP address?
downvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
tagged with: android
upvote count: 0
has title: Client and Server socket connection
tagged with: java
has comment: http://stackoverflow.com/comment/33266313
has answer: http://stackoverflow.com/a/21956845
type: Question

http://stackoverflow.com/comment/33296516
comment on: http://stackoverflow.com/a/21973654
has text: This, effectively, is what I have done (in not so neat a code, though).
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21907886
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33178705
has body: The file I am reading is 77MB in size, Java can easily store that kind of file in memory. I did this with the desktop Java version of this application as well. But here, it crashes!! Look at your container(server) configuration. I suppose you should increase maximum heap size. Servlet should run this code and wait for the doGet() and doPost() requests. How can I do this? Here is how to get work done on initialization You can save your data somewhere in memory or disk and then return it by servlet (in do... method).
answers question: http://stackoverflow.com/q/21907659

http://stackoverflow.com/q/21852276
type: Question
linked to: http://stackoverflow.com/q/2226863
has title: How import data to java project pre-runtime
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21853852
tagged with: android
has body: I create matrices of data in Matlab which I want to use in my java project (Android). I could put it in a file and read it at runtime. But since the data is constant, I wonder if there isn't a better way to integrate it with the source code.
tagged with: java

http://stackoverflow.com/q/21950349
type: Question
has answer: http://stackoverflow.com/a/21950518
accepted answer: http://stackoverflow.com/a/21950433
has answer: http://stackoverflow.com/a/21950457
score: 0
has body: A Java list has repeated elements like [cat, apple, iphone, football, apple, adam, apple, football, cat, people, cat] cat repeated 3 times football repeated 2 times apple repeated 3 times How to extract only the repeated elements from the list such that the final list has [cat, apple, football]?
linked to: http://stackoverflow.com/q/203984
has answer: http://stackoverflow.com/a/21950371
has answer: http://stackoverflow.com/a/21950433
has title: Extract only repeated elements in a list in Java
answer count: 5
has answer: http://stackoverflow.com/a/21950449
possible better answer: http://stackoverflow.com/a/21950457
type: AnsweredQuestion
tagged with: list
tagged with: java

http://stackoverflow.com/a/50891487
score: 0
type: Answer
has body: Simple example of token revocation for current authorized user using DefaultTokenServices: Need Bean for Default token store @Bean public DefaultTokenServices tokenServices() { DefaultTokenServices defaultTokenServices = new DefaultTokenServices(); defaultTokenServices.setTokenStore(tokenStore()); defaultTokenServices.setSupportRefreshToken(true); return defaultTokenServices; } Then you can write your own controller @RestController @RequestMapping("/user") public class UserApi { @Autowired private DefaultTokenServices tokenServices; @Autowired private TokenStore tokenStore; @DeleteMapping("/logout") @ResponseStatus(HttpStatus.NO_CONTENT) public void revokeToken() { final OAuth2Authentication auth = (OAuth2Authentication) SecurityContextHolder .getContext().getAuthentication(); final String token = tokenStore.getAccessToken(auth).getValue(); tokenServices.revokeToken(token); } }
has comment: http://stackoverflow.com/comment/102742020
answers question: http://stackoverflow.com/q/21992201

http://stackoverflow.com/a/21860834
answers question: http://stackoverflow.com/q/21860735
has comment: http://stackoverflow.com/comment/33095344
has body: Memory Mapped File Benefits They are a means of IPC (Process intercommunication), which is very fast You don't have to use the slow system calls such as open, read, write (they are terribly slow, because the cpu has to do context switching if you are calling a system call You can use a very clean interface: writing to the main memory. That is easy and people know how to use it No disk-I/O is wasted, all modifications are done in RAM. For one, other processes can utilize the disk better and for another you increase the durability of your SSD, which has a limited amount of overwrites until it is defunct Random Access is much faster by any means, since RAM is "Random Access Memory" and was built for exactly that One drawback however is that you should save your memory-mapping back to disk from time to time. Imagine yourself doing some highly complicated operations in RAM for hours and all of a sudden there's a black out - all information is lost.
accepted answer of: http://stackoverflow.com/q/21860735
score: 6
has comment: http://stackoverflow.com/comment/33094639
has comment: http://stackoverflow.com/comment/33095161
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33094815
has comment: http://stackoverflow.com/comment/33094709
has comment: http://stackoverflow.com/comment/33094827
type: Answer
upvote count: 6

http://stackoverflow.com/comment/33231343
type: QuestionComment
comment on: http://stackoverflow.com/q/21921196
score: 1
has text: @John, the question was answered, but I edited the code for anyone who views the question in the future.
type: Comment

http://stackoverflow.com/a/21883220
score: 0
has body: Some tips for improving your overall project, making it easier for yourself. Some of these tips have been posted already in other answers. The basic principle is (like Ceiling Gecko commented): If you see yourself repeating code, make a generic way to code it once and reuse that code for each of the repetitions. Use a Product class public class Product { private String name; private double price; public Product(String name, double price) { this.name = name; this.price = price; } public String getName() { return name; } public double getPrice() { return price; } } This you will populate, for every product you have, at the very start of your program and store it either in an array or a List List&lt;Product&gt; productList = new ArrayList&lt;Product&gt;(); productList.add(new Product("Milk", 10.00)); productList.add(new Product("Bread", 20.00)); The products here is hard coded for example, but you may want to read it from a file or DB. More on this later. Use generics for your Collections Why Use Generics? Dynamically generate your 'TextBoxes' If you code a JPanel with 50 JTextFields for the purpose of inputting amount, what will happen when you add another product? You will then have to go and change your code. If you use the List of Products mentioned earlier you can dynamically generate your JTextFields If you populated your list from a file or DB you will never have to change your code if you update your product list and/or prices. You can then just update your file or DB and the changes will reflect in your code. List&lt;JTextField&gt; textFields = new ArrayList&lt;JTextField&gt;(); for (Product p : productList) { textFields.add(new JTextField()); } Then use that list along with your product list to place your Components on your JPanel JPanel panel = new JPanel(); for (int i = 0; i &lt; textFields.size(); i++) { panel.add(new JLabel(productList.get(i).getName())); panel.add(textFields.get(i)); } Put your calculation code in a separate reusable method private doubl…
accepted answer of: http://stackoverflow.com/q/21878972
type: Answer
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21878972

http://stackoverflow.com/a/21932843
type: Answer
accepted answer of: http://stackoverflow.com/q/21932640
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21932640
type: AcceptedAnswer
has body: Check that you are using the appropriate context root: Right click the project &gt; Properties &gt; Web Project Settings This value will be the context root for your application and will govern how the URL is constructed. localhost:8080/context-root/
upvote count: 1

http://stackoverflow.com/a/21899286
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21872968
answers question: http://stackoverflow.com/q/21872968
has comment: http://stackoverflow.com/comment/33192056
type: Answer
has comment: http://stackoverflow.com/comment/33185672
has body: It's a count in base 64 of millisecond units since the Unix epoch. What makes it a bit more confusing is that (1) the times in your examples are one hour offset from that, which I assume is Germany time; (2) one of them has had the wrong year (2012 should be 2013); (3) one of them also has DST. Apart from that, it does work out. The most common base 64 alphabet uses A-Z, a-z, 0-9, and + and /. However, you said some of the timestamps contain underscores, so I assume it is the variant base 64 alphabet that uses - and _ for the last two characters. There are other variations though, so it's impossible to be certain of the alphabet without more examples. You haven't said which language you're actually using, but here are Java methods for encoding and decoding those timestamps, which convert them to and from Java Date objects. (You can easily change that to use plain integer timestamps if wanted.) private static final String timestampAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; public static String encodeTimestamp(Date date) { long t = date.getTime(); StringBuilder timestamp = new StringBuilder(); do { timestamp.append(timestampAlphabet.charAt((int)(t % 64))); } while ((t /= 64) != 0); return timestamp.reverse().toString(); } public static Date decodeTimestamp(String timestamp) { long t = 0; for (char c : timestamp.toCharArray()) { t = t * 64 + timestampAlphabet.indexOf(c); } return new Date(t); } Here are the same functions in JavaScript, which convert to/from JavaScript Date objects: var timestampAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; function encodeTimestamp(date) { var t = date.getTime(); var timestamp = ""; do { timestamp = timestampAlphabet[t % 64] + timestamp; } while (t = Math.floor(t / 64)); return timestamp; } function decodeTimestamp(timestamp) { var t = 0; for (var i = 0; i &lt; timestamp.length; i++) { t = t * 64 + timestampAlphabet.indexOf(timestamp.charAt(i)); } return new Date(t); …
score: 3
has comment: http://stackoverflow.com/comment/33166972
upvote count: 3
has comment: http://stackoverflow.com/comment/33167054

http://stackoverflow.com/q/21882725
has title: Android dynamic form in dialog
type: Question
tagged with: java
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33133672
has body: I am trying to make a little form inside a dialog window in my android app but the below code won't work. How do I make it show. It needs to be dynamically built. Thanks @Override public void onClick(View v) { TextView myTV1=new TextView(getBaseContext()); TextView myTV2=new TextView(getBaseContext()); TextView myTV3=new TextView(getBaseContext()); EditText myET1=new EditText(getBaseContext()); myTV1.setText("hello"); myTV2.setText("world"); myTV3.setText("now"); myET1.setText("Enter your name please"); TableLayout t = new TableLayout(getBaseContext()); t.addView(myTV1); t.addView(myTV2); t.addView(myTV3); t.addView(myET1); Dialog dialog = new Dialog(getBaseContext()); dialog.setContentView(t); dialog.show(); }
has comment: http://stackoverflow.com/comment/33133820
has answer: http://stackoverflow.com/a/21882960

http://stackoverflow.com/comment/33077695
type: Comment
type: QuestionComment
has text: Welcome to StackOverflow. This sort of question isn't really suitable, since there is not a clear single right answer. Take a look at http://blog.stackoverflow.com/2010/09/good-subjective-bad-subjective/ for more information.
score: 0
comment on: http://stackoverflow.com/q/21851109

http://stackoverflow.com/comment/33166901
has text: will do. thanks alot for your help. i hope the second issue gets resolved too.. Its like the whole form is published again in place of the province list box.
comment on: http://stackoverflow.com/a/21900533
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33198531
comment on: http://stackoverflow.com/q/21918570
score: 0
type: Comment
type: QuestionComment
has text: what id generation strategy are you using?

http://stackoverflow.com/comment/33225111
has text: The class "edu/uci/ics/jung/graph/UndirectedSparseGraph" is present in jung-graph-impl-2.0.jar. Please verify whether you have this jar in your lib folder?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21932023
score: 0

http://stackoverflow.com/comment/33102929
type: Comment
has text: I debugged and it had 3 extra chars at the end of the time parameter. Thank you for helping me - I could not see it in exception...
comment on: http://stackoverflow.com/q/21864726
score: 1
type: QuestionComment

checkbox
tags question: http://stackoverflow.com/q/21862588
tag name: checkbox
tags question: http://stackoverflow.com/q/21847411
type: Tag
tags question: http://stackoverflow.com/q/21866455
tags question: http://stackoverflow.com/q/21908964

http://stackoverflow.com/a/21970326
has comment: http://stackoverflow.com/comment/33291015
has comment: http://stackoverflow.com/comment/33291299
has comment: http://stackoverflow.com/comment/33293201
has comment: http://stackoverflow.com/comment/33291847
has comment: http://stackoverflow.com/comment/33292198
has comment: http://stackoverflow.com/comment/33290911
has comment: http://stackoverflow.com/comment/33293590
has comment: http://stackoverflow.com/comment/33291547
answers question: http://stackoverflow.com/q/21970120
has body: Try like this into your Servlet, also get all information about file from item //TODO Create and check tmpDir &amp; destinationDir then do as below PrintWriter out = response.getWriter(); response.setContentType("text/xml;charset=UTF-8"); File file = null; DiskFileItemFactory fileItemFactory = new DiskFileItemFactory(); fileItemFactory.setSizeThreshold(10 * 1024 * 1024); fileItemFactory.setRepository(tmpDir); /* Set the temporary directory for uploaded files of size above threshold. */ ServletFileUpload uploadHandler = new ServletFileUpload(fileItemFactory); try { List items = uploadHandler.parseRequest(request); Iterator itr = items.iterator(); while (itr.hasNext()) { FileItem item = (FileItem) itr.next(); if (item.getSize() &lt;######||item.getSize() &gt; 0){ // Where you can control file size if (item.isFormField()) { System.out.println("Field = " + item.getFieldName() + ", Value = " + item.getString()); } else { System.out.println("Field Name = " + item.getFieldName() + ", File Name = " + item.getName() + ", Content type = " + item.getContentType() + ", File Size = " + item.getSize()); file = new File(destinationDir, item.getName()); ///Destination for permanent save*/ item.write(file); } out.println("Upload success"); }else{ out.println("File Size is not be zero OR more than ####"); } } } catch (FileUploadException ex) { out.println("Upload Failed" + ex.getMessage()); log("Error while parsing the request", ex); } catch (Exception ex) { out.println("Upload Failed" + ex.getMessage()); log("Error while uploading file", ex); } out.close();
score: 0
has comment: http://stackoverflow.com/comment/33292133
has comment: http://stackoverflow.com/comment/33291464
type: Answer
has comment: http://stackoverflow.com/comment/33291986

http://stackoverflow.com/a/21896292
downvote count: 0
has comment: http://stackoverflow.com/comment/33159149
score: 1
has body: public class ReverseArray { public static void main(String[] args) { int[][] arr = {{1,2,3},{3,2,1},{2,1,3}}; reverseRows(arr); } public static void reverseRows(int[][] inTwoDArray) { List&lt;int[]&gt; tmp = Arrays.asList(inTwoDArray); Collections.reverse(tmp); inTwoDArray = tmp.toArray(inTwoDArray); for(int[] outer:inTwoDArray){ for(int inner:outer){ System.out.print(inner + " "); } System.out.println(); } } }
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21896112

http://stackoverflow.com/comment/33318398
has text: This was a massive help. Identified the exact problem I was having with it running. Thank you so much. That makes complete sense. I really need to start working on simplifying my code.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21986241

http://stackoverflow.com/comment/33294314
comment on: http://stackoverflow.com/a/21964064
has text: You can't do anything with a component that hasn't been initialized
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33192651
has text: @louis: As I am developing for Android. Therefore, Your first replacement gives me this error: `Call requires API level 19 (current min is 8)`
type: Comment
comment on: http://stackoverflow.com/a/21915358
type: AnswerComment
score: 0

http://stackoverflow.com/q/21944946
has answer: http://stackoverflow.com/a/21979513
has comment: http://stackoverflow.com/comment/33247733
has comment: http://stackoverflow.com/comment/33245245
has title: Hibernate/JPA one-to-many relationship if parent reference is defined as an ID with no parent reference
has body: Standard way to define one-to-many relationship in Hibernate/JPA is to have a reference in a Child object to its Parent object. @Entity @Table(name="PARENT") public class Parent { // ... @OneToMany(mappedBy="department") private Set&lt;Child&gt; children; // ... } @Entity @Table(name="CHILD") public class Child { // ... @ManyToOne @JoinColumn(name="parent_id") private Parent parent; // ... } The problem with this method is that Child becomes a heavyweight class, which is harder to send across the wire, etc. Is it possible to define a one-to-many relationship with no Parent object referenced from Child and with no additional reference/join table? In that case Child class defined as follows: @Entity @Table(name="CHILD") public class Child { // ... @Column(name="DEPARTMENT_ID") private Long departmentId; // ... }
favorite count: 0
tagged with: one-to-many
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33245096
upvote count: 1
has comment: http://stackoverflow.com/comment/33245387
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33249036
type: Question
has comment: http://stackoverflow.com/comment/33245288
tagged with: jpa
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33248569

http://stackoverflow.com/a/21971660
has comment: http://stackoverflow.com/comment/33295913
has body: The DOM has no built-in undo mechanism. If you want that, your application has to figure out how to provide it.
answers question: http://stackoverflow.com/q/21971233
type: Answer
has comment: http://stackoverflow.com/comment/33293928
has comment: http://stackoverflow.com/comment/33339147
score: 0

http://stackoverflow.com/comment/33306254
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21978967
has text: Just checking the obvious here, did you restart tomcat after you copied the class file? Also check using netstat the pid bound into 8080 is actually your tomcat's process (not other process) (happened to me before)
score: 0

http://stackoverflow.com/q/21918262
downvote count: 0
has answer: http://stackoverflow.com/a/21918300
score: 4
favorite count: 0
answer count: 4
has body: I'm trying to write some code that makes the user input a valid username and they get three tries to do it. Every time I compile it I get an else without if error wherever I have a else if statement. Scanner in = new Scanner(System.in); String validName = "thomsondw"; System.out.print("Please enter a valid username: "); String input1 = in.next(); if (input1.equals(validName)) { System.out.println("Ok you made it through username check"); } else { String input2 = in.next(); } else if (input2.equals(validName)) { System.out.println("Ok you made it through username check"); } else { String input3 = in.next(); } else if (input3.equals(validName)) { System.out.println("Ok you made it through username check"); } else { return; }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21918499
has answer: http://stackoverflow.com/a/21918314
tagged with: conditional-statements
has comment: http://stackoverflow.com/comment/33197843
tagged with: if-statement
tagged with: java
has title: I keep getting an "else without if" error
has answer: http://stackoverflow.com/a/21918333
type: Question
upvote count: 4

http://stackoverflow.com/a/21957191
score: 1
has comment: http://stackoverflow.com/comment/33271296
has comment: http://stackoverflow.com/comment/33269979
upvote count: 1
has comment: http://stackoverflow.com/comment/33270997
accepted answer of: http://stackoverflow.com/q/21956501
has body: When you are executing something like FillTable fff = new FillTable(model1); fff.execute(); model1 = fff.model; jTable3.setModel(model1); then the line model1 = fff.model will most likely be executed before the SwingWorker has finished. The execute call will cause the work to be done in the background, and the next lines well be executed regardless of whether the work already finished or not. A general approach could be to use the model in your done() method, roughly like this: protected void done() { try { TableModel model = get(); jTable3.setModel(model); // Use it here! } catch (InterruptedException | ExecutionException ex) { ex.printStackTrace(); } } (You'll have to pass a reference of jTable3 to your SwingWorker for this - that is, pass it to the constructor and store it as a field in the SwingWorker). There may be more elegant solutions, but based on the code that was provided so far, this at least seems to be the reason for the error and a possible solution.
downvote count: 0
has comment: http://stackoverflow.com/comment/33269443
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21956501
has comment: http://stackoverflow.com/comment/33270793
has comment: http://stackoverflow.com/comment/33267883
type: Answer

http://stackoverflow.com/comment/33205933
type: AnswerComment
has text: Many thanks! How to know my context_path? Should it be something like /C:/SERVERS/x/y/x/yourApp/WEB-INF/classes ?
type: Comment
comment on: http://stackoverflow.com/a/21920447
score: 0

http://stackoverflow.com/a/21991956
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21991788
has body: In your case, we decided to expose our web app functionality as web services, because of: The client code is easily generated by your favorite WS library The server code is just an annotated POJO and every stub is generated by the same library (say you can choose CXF for both things but there are plenty of options) Security and operations people agreeded instantly to our proposal since functionality was exposed to the exterior through the corporative https security (exactly the same as our web application was doing) The kind of web services you use depends on your requirements: people normally expose their API as a REST api, which is more or less an http CRUD wrapper over your application entities. You can use standard SOAP web services, which is more of a procedural point of view. Up to you to decide, I hope this was useful
upvote count: 2

http://stackoverflow.com/q/21908768
possible better answer: http://stackoverflow.com/a/21911092
has answer: http://stackoverflow.com/a/21965270
has answer: http://stackoverflow.com/a/21911092
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/12462079
downvote count: 0
tagged with: event-handling
tagged with: generics
accepted answer: http://stackoverflow.com/a/21965270
has title: Generic interface with extends generic of Enums
favorite count: 0
has body: I am trying to write a generic Event System. For this i'd like to create an Interface for the EventHandler like this*(which not works)*: public interface GameEventHandler&lt;I extends GameEvent&lt;TYPE extends Enum&lt;?&gt;, ATT extends Enum&lt;?&gt;&gt;&gt; { public void handleEvent(final GameEvent&lt;TYPE, ATT&gt;... e); public void registerListener(final GameEventListener&lt;I&gt; listener, final TYPE... type); public void unregisterListener(final GameEventListener&lt;I&gt;... listener); public void unregisterAllListener(); public void unregisterAllListener(final I... type); public void processEvents(); public void processEvents(final int maxTimeInMS); } but this does not work as i "think" it. The Event itself is a Generic Element which is preaty simple this: public class GameEvent&lt;T extends Enum&lt;?&gt;, S extends Enum&lt;?&gt;&gt; { private HashMap&lt;S, String&gt; values; private T type; public void init(T type) { this.type = type; } public T getType() { return this.type; } public void addMessage(S t, String value) { this.values.put(t, value); } public void getMessage(S t) { this.values.get(t); } } if i implement the HandlerInterface id like to have it still generic so there is something like a DefaultHandler&lt;GameEvent&lt;TypeEnum, AttributEnum&gt;&gt;() to init it. So you can use the Interface to create your own handler or use the DefaultHandler which i provide but still can use your own Enums. At the moment i were able to create the interface like this: public interface GameEventHandler&lt;I extends GameEvent&lt;TYPE, ATT&gt;, TYPE extends Enum&lt;?&gt;, ATT extends Enum&lt;?&gt;&gt; But i dont get the Implementation of an DefaultHandler Generic public class DefaultGameEventHandler implements GameEventHandler&lt;GameEvent&lt;EventTypes, AttributeTypes&gt;, EventTypes, AttributeTypes&gt; // not generic those are testing Enums So what do i do wrong? Is it possible like i would like to have it?
upvote count: 3

http://stackoverflow.com/comment/33306808
has text: Can you please elaborate @FredericClose
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21951344

javassist
tags question: http://stackoverflow.com/q/21866342
type: Tag
tag name: javassist

http://stackoverflow.com/comment/33188108
type: QuestionComment
has text: The thing to remember is that numbers are integers, and words are strings. If you tell it you want to accept integers, you'll get only them. You need to accept a string and parse it.
comment on: http://stackoverflow.com/q/21912891
score: 0
type: Comment

http://stackoverflow.com/comment/33327708
type: AnswerComment
has text: I tried that and JUnit says `Could not find class: mymap.MyMapTest`.
type: Comment
comment on: http://stackoverflow.com/a/21991305
score: 0

http://stackoverflow.com/a/21844548
has comment: http://stackoverflow.com/comment/33067268
has comment: http://stackoverflow.com/comment/33066103
has comment: http://stackoverflow.com/comment/66286263
answers question: http://stackoverflow.com/q/21844478
has comment: http://stackoverflow.com/comment/33069210
has comment: http://stackoverflow.com/comment/33066191
has comment: http://stackoverflow.com/comment/33066598
type: Answer
has body: You shall not close the streams until your communication is completed. It will always result in closing the socket as well. What you need to do is to use dos.flush() after writing something to data output stream to enable server get the information and close dos only after you completed your communication.
has comment: http://stackoverflow.com/comment/33070095
has comment: http://stackoverflow.com/comment/33070762
has comment: http://stackoverflow.com/comment/33069426
has comment: http://stackoverflow.com/comment/33075555
downvote count: 1
has comment: http://stackoverflow.com/comment/33066223
has comment: http://stackoverflow.com/comment/66280103
has comment: http://stackoverflow.com/comment/33069525
has comment: http://stackoverflow.com/comment/33067724
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/33069961

http://stackoverflow.com/q/21999151
has comment: http://stackoverflow.com/comment/33342320
score: 2
has body: I have a ListView of Spinners I'm trying to get the selected values out of. Some of the Spinners have the first selection automatically selected if there is only 1 item in the list, so I feel setOnItemSelectedListener won't necessarily work? Either way, I'm unsure how to code this scenario. Even if I had the listener coded correctly, How do I use it in my class to work with the adapter? CustomAdapter public class CustomPLNViewAdapter extends BaseAdapter{ private static ArrayList&lt;ArrayList&lt;String&gt;&gt; partLotNumbersArrayList; private static ArrayList&lt;String&gt; partNames; private LayoutInflater mInflater; private Context myContext; public CustomPLNViewAdapter(Context context, ArrayList&lt;ArrayList&lt;String&gt;&gt; results, ArrayList&lt;String&gt; parts){ partLotNumbersArrayList = results; partNames = parts; mInflater = LayoutInflater.from(context); myContext = context; } @Override public int getCount() { return partLotNumbersArrayList.size(); } @Override public Object getItem(int position) { return partLotNumbersArrayList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.view_assembly_parts, null); holder = new ViewHolder(); holder.txtName = (TextView) convertView.findViewById(R.id.partName); holder.spinner = (Spinner) convertView.findViewById(R.id.LotNumbers); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.txtName.setText(partNames.get(position)); ArrayAdapter&lt;String&gt; adp1=new ArrayAdapter&lt;String&gt;(myContext, android.R.layout.simple_list_item_1, partLotNumbersArrayList.get(position)); adp1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //set the adapter to the spinnner holder.spinner.setAdapter(adp1); //if there is only one other part besides "" then set that as default part …
tagged with: java
has comment: http://stackoverflow.com/comment/33372458
has comment: http://stackoverflow.com/comment/33342220
has comment: http://stackoverflow.com/comment/33343421
has comment: http://stackoverflow.com/comment/33344033
type: Question
has comment: http://stackoverflow.com/comment/33343589
downvote count: 0
has comment: http://stackoverflow.com/comment/33343442
tagged with: listview
has comment: http://stackoverflow.com/comment/33344197
tagged with: android-listview
tagged with: android
has title: Get Selected value from Spinner inside ListView Android
has comment: http://stackoverflow.com/comment/33342529
favorite count: 0
has comment: http://stackoverflow.com/comment/33344236
has comment: http://stackoverflow.com/comment/33344573
answer count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/21866505
type: Answer
has body: You can do something like this: public List&lt;Tweets&gt; findTweets(Tweet t) { return Tweets.find .where() .eq("tweets.id", t.id) .findList(); } Same as mentioned in Here
answers question: http://stackoverflow.com/q/21842800
score: 0

http://stackoverflow.com/a/57612941
downvote count: 0
answers question: http://stackoverflow.com/q/21856211
type: Answer
has comment: http://stackoverflow.com/comment/115179735
upvote count: 1
has body: Under OSGI, the following workaround allows the javax.activation bundle to load the "META-INF/mailcap" resource from the javax.mail bundle : Thread.currentThread().setContextClassLoader(javax.mail.Message.class.getClassLoader()); Note : character sets conversions may have limitations with this workaround...
score: 1

http://stackoverflow.com/comment/33134077
comment on: http://stackoverflow.com/a/21878224
type: AnswerComment
has text: Well, I think being a little bit paranoid is not a bad thing when regarding security issues :) The steps you mentioned are about what I was looking for, I will have a look at those. I probably won't run a virtual machine for every user as it would be safer but a bit overloaded for my scenario.
type: Comment
score: 0

http://stackoverflow.com/q/21885568
has comment: http://stackoverflow.com/comment/33141898
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21887728
possible better answer: http://stackoverflow.com/a/21887116
type: Question
has answer: http://stackoverflow.com/a/21887116
answer count: 2
has body: I'm trying to set up a couple webapps on tomcat but none of the properties files are getting picked up 2014-02-19 15:47:02,106 - WARN org.springframework.core.io.support.PropertiesLoaderSupport - Could not load properties from class path resource [indexing.properties]: class path resource [indexing.properties] cannot be opened because it does not exist 2014-02-19 15:47:02,110 - WARN org.springframework.core.io.support.PropertiesLoaderSupport - Could not load properties from class path resource [user-service.properties]: class path resource [user-service.properties] cannot be opened because it does not exist 2014-02-19 15:47:05,169 - WARN com.cubeia.backoffice.users.Configuration - No user-service.properties configuration file found. U sing default. The /WEB-INF/classes/service.xml file has the following definition: classpath:default-indexing.properties classpath:indexing.properties I've tried copying the .property files everywhere i could think of. tomcat/conf, tomcat/lib, tomcat/conf/Catalina, tomcat/conf/catalina/localhost, webapps//WEB-INF/, webapps//WEB-INF/classes/, then also in the same directory with the actual .class files, temp directory, you name it. Just won't pick it up. Later edit: I have also tried values like /WEB-INF/classes, WEB-INF/, tomcat/conf, tomcat/lib, classpath*:... all possible combinations basically.
has title: Cannot Open properites file in Spring Web application
has comment: http://stackoverflow.com/comment/33141290
tagged with: tomcat
score: 0
accepted answer: http://stackoverflow.com/a/21887728
tagged with: spring

http://stackoverflow.com/comment/33226914
type: AnswerComment
has text: Thats not enough to center my TextView. I have edited my post so you might get an idea of what I want.
type: Comment
comment on: http://stackoverflow.com/a/21934836
score: 0

http://stackoverflow.com/comment/33282277
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21965219
has text: @jewelsea If the query I mentioned above works correctly, what will be the values of preparedStatement2 and resultSet2 ?
score: 0

http://stackoverflow.com/comment/33237667
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21940750
score: 0
has text: Do you know how I can get `base64FlotCode`?

http://stackoverflow.com/a/38814282
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21879568
upvote count: 0
has comment: http://stackoverflow.com/comment/65023058
has body: What worked for me is defect.get("FormattedID").toString().substring(1,defect.get("FormattedID").toString().length()-1)
score: -1

http://stackoverflow.com/comment/33279121
comment on: http://stackoverflow.com/q/21963797
score: 1
type: Comment
type: QuestionComment
has text: What does "that doesn't work" mean?

http://stackoverflow.com/q/21951039
has body: Can someone explain what this piece of code does. For example, what's the second declaration do? i.e. public static AlertDialogFragment newInstance() here: public static class AlertDialogFragment extends DialogFragment { public static AlertDialogFragment newInstance() { return new AlertDialogFragment(); }
possible better answer: http://stackoverflow.com/a/21951169
favorite count: 0
has answer: http://stackoverflow.com/a/21951169
tagged with: android
has title: Java: public static newInstance()
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21951063
has answer: http://stackoverflow.com/a/21951088
upvote count: 1
type: Question
score: 1
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/21951063
downvote count: 0

http://stackoverflow.com/a/21929561
has comment: http://stackoverflow.com/comment/33217103
upvote count: 1
has body: From form datas are passed from input fields like input type="text" or input type="password" etc You do not have any inout field in the form Secondly, when you are writting request.getParameter() then you are trying to get from a name attribute not from id
has comment: http://stackoverflow.com/comment/33217488
has comment: http://stackoverflow.com/comment/33217119
has comment: http://stackoverflow.com/comment/33218051
has comment: http://stackoverflow.com/comment/33217235
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33217276
answers question: http://stackoverflow.com/q/21929436
type: Answer

http://stackoverflow.com/q/21893706
score: 0
tagged with: sqlite
answer count: 1
has comment: http://stackoverflow.com/comment/33154694
tagged with: android
has body: My application crashes whenever I launch it! whats wrong with it? I have created a database and I am trying to populate my listview from the database I have created what is the problem with the code and what is the fix for it? 02-19 22:02:07.502: D/AndroidRuntime(330): Shutting down VM 02-19 22:02:07.502: W/dalvikvm(330): threadid=1: thread exiting with uncaught exception (group=0x40015560) 02-19 22:02:07.542: E/AndroidRuntime(330): FATAL EXCEPTION: main 02-19 22:02:07.542: E/AndroidRuntime(330): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.database/com.example.database.MainActivity}: java.lang.ClassNotFoundException: com.example.database.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.database-1.apk] 02-19 22:02:07.542: E/AndroidRuntime(330): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569) 02-19 22:02:07.542: E/AndroidRuntime(330): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 02-19 22:02:07.542: E/AndroidRuntime(330): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 02-19 22:02:07.542: E/AndroidRuntime(330): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 02-19 22:02:07.542: E/AndroidRuntime(330): at android.os.Handler.dispatchMessage(Handler.java:99) 02-19 22:02:07.542: E/AndroidRuntime(330): at android.os.Looper.loop(Looper.java:123) 02-19 22:02:07.542: E/AndroidRuntime(330): at android.app.ActivityThread.main(ActivityThread.java:3683) 02-19 22:02:07.542: E/AndroidRuntime(330): at java.lang.reflect.Method.invokeNative(Native Method) 02-19 22:02:07.542: E/AndroidRuntime(330): at java.lang.reflect.Method.invoke(Method.java:507) 02-19 22:02:07.542: E/AndroidRuntime(330): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 02-19 22:02:07.542: E/AndroidRuntime(330): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 02-19 22:02:07.542: E/AndroidRuntime(330):…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33154655
tagged with: java
has title: Error on launching activity
type: Question
has answer: http://stackoverflow.com/a/21894302

http://stackoverflow.com/q/21868284
answer count: 2
downvote count: 0
favorite count: 0
has body: I'm making a function grapher that take 4 parameters and size for the Panel, but I don't know how to create a Panel class that will draw the information from the Grapher class. Can some one help please?(The parameters are not important, I just want to learn how to make a Graph Panel for later use) Panel Class import java.awt.BorderLayout; public class Panel extends JFrame { private JPanel contentPane; /** * Launch the application. */ public static void main(String[] args) { } /** * Create the frame. */ public Panel(int w, int h) { setVisible(true); setSize(w,h); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, w, h); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setBackground(Color.WHITE); setContentPane(contentPane); contentPane.setLayout(null); JPanel panel = new JPanel(); panel.setBackground(Color.WHITE); panel.setBorder(new EmptyBorder(0, 0, 0, 0)); panel.setBounds(0, 0, w, h); contentPane.add(panel); } public void paint(Graphics g) { super.paint(g); //g.drawLine(110, 112,129, 132); } public Graphics getGraphics(Graphics g){ return g; } } Grapher class import java.awt.EventQueue; public class Grapher { private int panelWidth; private int panelHeight; int x1; int x2; int y1; int y2; int a; int b; int c; int d; private JFrame frmChinhsFunctionGrapher; private JTextField textFieldXMin; private JTextField textFieldXMax; private JTextField textFieldYMin; private JTextField textFieldYMax; private JTextField textFieldA; private JTextField textFieldB; private JTextField textFieldC; private JTextField textFieldD; private JLabel lblPeriod; private JLabel lblYIntercept; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Grapher window = new Grapher(); window.frmChinhsFunctionGrapher.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public Grapher() { initialize(); } …
has answer: http://stackoverflow.com/a/21868877
has answer: http://stackoverflow.com/a/21894475
upvote count: 2
type: UnansweredQuestion
tagged with: swing
tagged with: graphics
score: 2
has title: How to create a JPanel for graphing
tagged with: java
tagged with: jpanel
type: Question

http://stackoverflow.com/comment/33218242
type: QuestionComment
comment on: http://stackoverflow.com/q/21929783
has text: When this code is called the logs show "breached referential dependency". How can I fix this?
score: 0
type: Comment

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/21916547
tags question: http://stackoverflow.com/q/21907879
tags question: http://stackoverflow.com/q/21994850
type: Tag

http://stackoverflow.com/q/21998312
has body: NOTE : i have seen the JOIN in GAE related posts but GROUP BY in my requirements made me make a new post and I have made a solution of my own which I wanted to check how good is it Datastore Entities properties and types (database) Entity : PartyEntity lets call this as a String partyName String partyId BlobKey image Entity : InsertEntity lets call this as b String partyIdentifier String name String constituency Objective SELECT * FROM a JOIN b on a.partyId = b.partyIdentifier GROUP BY b.constituency; below I shall answer my question , THE CODE WORKS FINE DO ADVICE ME ANY CHANGES OR BETTER WAYS (I am just a student)
type: Question
score: 0
upvote count: 1
tagged with: google-cloud-datastore
answer count: 1
has title: GAE datastore JOIN + GROUP BY
favorite count: 0
downvote count: 1
has answer: http://stackoverflow.com/a/21998313
accepted answer: http://stackoverflow.com/a/21998313
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/33744553
comment on: http://stackoverflow.com/q/21890315
has text: I may be misunderstanding your question, but I believe you want to do something like. `bind(RestContext.class).in(RequestScoped.class)` in your config. This will allow you to do `@Inject RestContext ctx;` and ensure that only one instance lives per request. You can inject it into your filter and set the necessary info, and then inject it everywhere else as needed. You do not need to set anything on the `ContainerRequestContext`, just inject your `RestContext`. Also you don't need to clean up anything. Is this what you were looking for? If so I can add it as an answer.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/33398471
has text: Thanks - I found the solution was a buggy JVM (OpenJdk). I did try to upload pics but didn't have enough brownie points to do so. It was disallowed.
type: QuestionComment
comment on: http://stackoverflow.com/q/22002642
score: 0
type: Comment

http://stackoverflow.com/a/21899274
answers question: http://stackoverflow.com/q/21899015
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33164652
type: Answer
has body: A png is not a Java java.lang.Object (e.g. a raw byte sequence doesn't encode a length and byte arrays are not dynamically sized in Java they are java.lang.Objects). Therefore, one solution is to wrap your (ImageIO.write(image1, "png", oos); [and the second image write] and then the read calls) with a byte[]. Allow me to illustrate, that is something like - ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(image1, "png", baos); oos.writeObject(baos.toByteArray()); ByteArrayOutputStream baos2 = new ByteArrayOutputStream(); ImageIO.write(image2, "png", baos2); oos.writeObject(baos2.toByteArray()); and then update your read (that is) - image1 = ImageIO.read(new ByteArrayInputStream((byte[])ois.readObject())); image2 = ImageIO.read(new ByteArrayInputStream((byte[])ois.readObject()));
accepted answer of: http://stackoverflow.com/q/21899015
has comment: http://stackoverflow.com/comment/33168013
has comment: http://stackoverflow.com/comment/33164611
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/33112906
has text: store it in a string and everytime you show the popup set the edittext with the string, or set the edittext text from the textview text. The reason it doesn't stay is because the whole dialog gets destroyed when you close it
comment on: http://stackoverflow.com/a/21870504
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22001337
answers question: http://stackoverflow.com/q/22001129
upvote count: 3
score: 3
has body: Don't set the preferred size of the JList, this is preventing it from calculating the size of the list based on it's contents, which will mean that it will never exceed the preferred size you have supplied, meaning that it will never show any scroll bars. Instead, use a combination of JList#setVisibleRowCount and Jlist#setPrototypeCellValue to adjust how the JList calculates it's preferred size. IF you REALLY want more control, you should take a look at the Scrollable interface that JList implements, but even then, I'd be careful
downvote count: 0
type: Answer

http://stackoverflow.com/a/21868914
upvote count: 4
has comment: http://stackoverflow.com/comment/33111115
has body: Start by taking a look at How to Write an Action Listener and How to Use Color Choosers Basically, attach a ActionListener to the JButton you want to activate the JColorChooser and when the actionPerformed method is called, use inbuilt functionality to show the default chooser window, for example (from the linked tutorial)... Color newColor = JColorChooser.showDialog( ColorChooserDemo2.this, "Choose Background Color", banner.getBackground()); Updated Start by adding a Color instance variable to Kaleidescope, this will allow you to maintain a reference to the last chossen color private Color currentPaintColor = Color.BLACK; Next, when the ColorButton is pressed, you will want to create some kind of dialog to show the chooser in, this will allow you to wait until the user chooses a color and get the resulting color... } else if (e.getSource() == ColorButton) { ColorChooser chooser = new ColorChooser(); int result = JOptionPane.showConfirmDialog(this, chooser, "Color Chooser", JOptionPane.OK_CANCEL_OPTION); if (result == JOptionPane.OK_OPTION) { currentPaintColor = chooser.getChoosenColor(); } } //clear all You'll also want to change the stateChanged method in ColorChooser to make it more meaningful... public void stateChanged(ChangeEvent e) { Color newColor = tcc.getColor(); banner.setBackground(newColor); } Now, the question is, what do you want to do with this new color? Do you want to apply it to all the current shapes you are painting? If so you need to set the color before painting the shapes... public void paint(Graphics g) { //draw/paint box triangle and oval super.paint(g); g.setColor(currentPaintColor); for (Box box : boxes) { box.drawMe(g); } } Or do you only want to apply the color to new objects added after the change? You should avoid overriding paint of top level containers, lots of reason, they aren't double buffered, which will cause flickering when they are updated and you will be painting over the top of everything else on the frame and you can poten…
downvote count: 0
has comment: http://stackoverflow.com/comment/33111014
has comment: http://stackoverflow.com/comment/33110937
has comment: http://stackoverflow.com/comment/33110410
has comment: http://stackoverflow.com/comment/33110451
has comment: http://stackoverflow.com/comment/33110187
answers question: http://stackoverflow.com/q/21868856
type: Answer
has comment: http://stackoverflow.com/comment/33111285
score: 4

http://stackoverflow.com/q/21958230
has comment: http://stackoverflow.com/comment/33268950
has answer: http://stackoverflow.com/a/21958323
has comment: http://stackoverflow.com/comment/33268972
answer count: 4
type: AnsweredQuestion
score: -5
has body: "Write a snippet of Java code that adds every multiple of 21, starting with 642331 down to 21 to an unidentified ArrayList named "values" " I have alot of issues with this, but here is my code. I am not sure what is wrong. for (int =0 ; i = 642331; i++) { values [i] = 21*i ; }
accepted answer: http://stackoverflow.com/a/21958262
has answer: http://stackoverflow.com/a/21958298
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33268940
downvote count: 5
has title: Java Program multiples of a number
has answer: http://stackoverflow.com/a/21958315
has comment: http://stackoverflow.com/comment/33268942
upvote count: 0
has comment: http://stackoverflow.com/comment/33268959
has answer: http://stackoverflow.com/a/21958262
has comment: http://stackoverflow.com/comment/33268951
has comment: http://stackoverflow.com/comment/33269032
possible better answer: http://stackoverflow.com/a/21958323
favorite count: 0

http://stackoverflow.com/comment/33136794
score: 0
comment on: http://stackoverflow.com/q/21883856
has text: @epeleg Because of polymorphism, you can't force a call on a sub class object to go through the parent's implementation first. There will be considerable changes to do. You can minimize them by first refactoring the method name of `doSomething()` to `actuallyDoSomething()` and then just change the parent class by adding a new `doSomething()` method.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33208651
type: QuestionComment
has text: We know what it is, but you should show some input, your expected output, and your observed output.
score: 0
comment on: http://stackoverflow.com/q/21924364
type: Comment

http://stackoverflow.com/comment/34315463
type: AnswerComment
score: 0
type: Comment
has text: There can't be any caching issues. The array needs 4kB and so surely fits into L1 and so does the code. Other processing might have disturbed the measurement a bit, but I'm not seeking an explanation for random some 1% variance but for *repeatable factor 2 or 3*. **TL;DR That's not it.**
comment on: http://stackoverflow.com/a/22542720

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/21887318
tags question: http://stackoverflow.com/q/21969277
tags question: http://stackoverflow.com/q/21965469
tags question: http://stackoverflow.com/q/21973062
tags question: http://stackoverflow.com/q/21988512
tags question: http://stackoverflow.com/q/21985770
tags question: http://stackoverflow.com/q/21949674
tags question: http://stackoverflow.com/q/21867545
tags question: http://stackoverflow.com/q/21985068
tags question: http://stackoverflow.com/q/21929790
tags question: http://stackoverflow.com/q/21982934
tags question: http://stackoverflow.com/q/21869524
tags question: http://stackoverflow.com/q/21969429
tags question: http://stackoverflow.com/q/21967406
tags question: http://stackoverflow.com/q/21853354
tags question: http://stackoverflow.com/q/21907933
tags question: http://stackoverflow.com/q/21962699
tags question: http://stackoverflow.com/q/21929427
tags question: http://stackoverflow.com/q/21854538
tags question: http://stackoverflow.com/q/21998826
tags question: http://stackoverflow.com/q/21844084
tags question: http://stackoverflow.com/q/21955690
tags question: http://stackoverflow.com/q/21941698
tags question: http://stackoverflow.com/q/21894828
tags question: http://stackoverflow.com/q/21970492
tags question: http://stackoverflow.com/q/21967734
tags question: http://stackoverflow.com/q/21868321
tags question: http://stackoverflow.com/q/21969802
tags question: http://stackoverflow.com/q/21954679
tags question: http://stackoverflow.com/q/21920367
tags question: http://stackoverflow.com/q/21953958
tags question: http://stackoverflow.com/q/21934068
tags question: http://stackoverflow.com/q/21933978
tags question: http://stackoverflow.com/q/21851252
tags question: http://stackoverflow.com/q/21877885
type: Tag
tags question: http://stackoverflow.com/q/21916726
tags question: http://stackoverflow.com/q/21858528
tags question: http://stackoverflow.com/q/21960522
tags question: http://stackoverflow.com/q/21971188
tags question: http://stackoverflow.com/q/21894860
tags question: http://stackoverflow.com/q/21861136
tags question: http://stackoverflow.com/q/21979099
tags question: http://stackoverflow.com/q/21886601
tags question: http://stackoverflow.com/q/21955831
tags question: http://stackoverflow.com/q/21881469
tags question: http://stackoverflow.com/q/22004160
tags question: http://stackoverflow.com/q/22002709
tags question: http://stackoverflow.com/q/21888492
tags question: http://stackoverflow.com/q/21874340
tags question: http://stackoverflow.com/q/21925685
tags question: http://stackoverflow.com/q/21882660
tags question: http://stackoverflow.com/q/21989440
tags question: http://stackoverflow.com/q/21974423
tags question: http://stackoverflow.com/q/21861804
tags question: http://stackoverflow.com/q/21861542
tags question: http://stackoverflow.com/q/21879568
tags question: http://stackoverflow.com/q/21973141
tags question: http://stackoverflow.com/q/21966704
tags question: http://stackoverflow.com/q/21875238
tags question: http://stackoverflow.com/q/21867214
tags question: http://stackoverflow.com/q/21894312
tags question: http://stackoverflow.com/q/21969974
tags question: http://stackoverflow.com/q/21898902
tags question: http://stackoverflow.com/q/21911742
tag name: json
tags question: http://stackoverflow.com/q/21913955
tags question: http://stackoverflow.com/q/21956745
tags question: http://stackoverflow.com/q/21956950
tags question: http://stackoverflow.com/q/21904162
tags question: http://stackoverflow.com/q/21944294
tags question: http://stackoverflow.com/q/21851552
tags question: http://stackoverflow.com/q/21901366
tags question: http://stackoverflow.com/q/21849174
tags question: http://stackoverflow.com/q/21851251
tags question: http://stackoverflow.com/q/21861497
tags question: http://stackoverflow.com/q/22005012
tags question: http://stackoverflow.com/q/21867593
tags question: http://stackoverflow.com/q/21927116
tags question: http://stackoverflow.com/q/21976937

http://stackoverflow.com/comment/33301827
comment on: http://stackoverflow.com/a/21975939
has text: I dont know where to find one, there is no official source. I would install it on another machine and copy it over. Or you could install it, then copy the folder, then remove it (and just reinstall your old java version to make sure its setup properly). I know its a lot of messing around but I don't know of any other good work around.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21996175
has answer: http://stackoverflow.com/a/22003854
favorite count: 0
upvote count: 2
tagged with: android
score: 2
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21996319
has answer: http://stackoverflow.com/a/22005409
accepted answer: http://stackoverflow.com/a/22005409
tagged with: admob
type: Question
tagged with: libgdx
tagged with: eclipse
has body: I have made a free android game and I wanted to add a banner to it. I followed this tutorial and I don't know why it won't work. When I run my game on the emulator in LogCat I see a message "Ad is not visible. Not refreshing ad." and when I install the game on my phone I also don't see any ads. Here is my main.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adUnitId="hidden" ads:adSize="BANNER"/&gt; &lt;/LinearLayout&gt; and here is the code in MainActivity.java public class MainActivity extends AndroidApplication { private AdView adView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration(); cfg.useGL20 = true; cfg.useAccelerometer = true; cfg.useCompass = true; setContentView(R.layout.main); // Look up the AdView as a resource and load a request. adView = (AdView)this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); initialize (new RedSquare(), cfg); } @Override public void onPause() { adView.pause(); super.onPause(); } @Override public void onResume() { super.onResume(); adView.resume(); } @Override public void onDestroy() { adView.destroy(); super.onDestroy(); } }
answer count: 3
has title: Ad is not visible. Not refreshing ad
downvote count: 0
has answer: http://stackoverflow.com/a/21996319

http://stackoverflow.com/comment/33113205
comment on: http://stackoverflow.com/q/21870800
type: QuestionComment
score: 0
has text: yes, in mfx folder. bgc music plays, but i want bg music to play only on game scene, not on the splash and menu scene.
type: Comment

http://stackoverflow.com/comment/33158206
type: Comment
comment on: http://stackoverflow.com/a/21869430
has text: I rewrote everything and it now works thanks for the help again tho :)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33422471
type: AnswerComment
has text: Thank you for the code, found many interesting things and had to search about the synchronize flag, didn't knew that would be so used ^^
type: Comment
comment on: http://stackoverflow.com/a/21970810
score: 0

http://stackoverflow.com/comment/33097786
type: Comment
has text: You cannot, eg, "alias" a Java object with an array and get a byte view of the object -- it simply does not work that way. You can use shift/mask operations to move the data from your two ints into a byte array, but that's predicated on you understanding what I mean by "shift/mask operations".
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21862363

http://stackoverflow.com/comment/33183635
has text: Do I take that from `Class<?> type = field.getType();` ?
comment on: http://stackoverflow.com/q/21910529
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/21987534
has body: I guess you could create a profile and add the repository you want as the only repository.
answers question: http://stackoverflow.com/q/21987420
score: 0
type: Answer

http://stackoverflow.com/comment/33307567
type: QuestionComment
comment on: http://stackoverflow.com/q/21979741
score: 0
has text: How are you making war file of your project ?
type: Comment

access-control
tag name: access-control
type: Tag
tags question: http://stackoverflow.com/q/21973156

http://stackoverflow.com/comment/33265808
comment on: http://stackoverflow.com/q/21956299
type: Comment
type: QuestionComment
has text: Is your onTerminate ever being called? Actually, to be safe, you should change things in onPause() because your process can be killed by the OS after it calls onPause(). This implies that onStop() and onDestroy() may or may not be called. In any case, there is no guarantee that onDestroy() will ever be called. If the OS decides to kill your process it won't bother calling onDestroy() on any activities.
score: 0

http://stackoverflow.com/a/21897330
downvote count: 0
score: 1
has body: As your error says you can't run network tasks on the the main thread. AsyncTasks are good for running short tasks that you don't want to block the main thread with. Link to google docs. http://developer.android.com/reference/android/os/AsyncTask.html // This class is just added somewhere in your main activity, like a function. private class PostFormTask extends AsyncTask&lt;String, Integer, Long&gt; { protected Long doInBackground(String... queryDetails) { try{ String httpsURL = "https://example.com/apis/submit_credit_application.php"; String query = "fname="+URLEncoder.encode(queryDetails[0],"UTF-8"); query += "&amp;lname="+URLEncoder.encode(queryDetails[1],"UTF-8"); query += "&amp;addr="+URLEncoder.encode(queryDetails[2],"UTF-8"); // Keep adding to your query but instead of getting your details // from the textview they are in the queryDetails array. URL myurl = new URL(httpsURL); HttpsURLConnection con = (HttpsURLConnection)myurl.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Content-length", String.valueOf(query.length())); con.setRequestProperty("Content-Type","application/x-www-form-urlencoded"); con.setDoOutput(true); con.setDoInput(true); DataOutputStream output = new DataOutputStream(con.getOutputStream()); output.writeBytes(query); output.close(); }catch(IOException e){ Toast.makeText( getApplicationContext(), (CharSequence) e, Toast.LENGTH_LONG ).show(); } return false } protected void onPostExecute(Long result) { } } Then on your onClick event just have. new PostFormTask().execute(fname.getText().toString(), lname.getText().toString() ); // just send your form details to your task here, you will want to add all your details // from your above code. Hope that helps.
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21897067
accepted answer of: http://stackoverflow.com/q/21897067
type: Answer

http://stackoverflow.com/comment/33139621
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21872968
has text: Hi, URK4AgA is 19.02.2014 at 17:00; URAk1AA is 17.02.2014 at 17:00;

http://stackoverflow.com/comment/33322086
score: 1
comment on: http://stackoverflow.com/q/21983353
type: Comment
type: QuestionComment
has text: There seems to be a lot of extra information needed to get this question some form of clarity: try not to put it all in comments, but update the question! The goal is not to make a big forum topic-like mess in the comments, but have a clear, usefull question that can get an answer: so I 'd suggest you add some of the information (what you want, what you get, etc) to the question so one can read all important infomation at once instead of in the comments. Good luck!

http://stackoverflow.com/q/21957344
has answer: http://stackoverflow.com/a/21957737
has title: How can I keep TCP connection alive with Java?
type: Question
tagged with: java
answer count: 2
has body: What I want to do is: 1) Create a TCP socket listening to a particular port number in my local machine. ( Server ) 2) Create another TCP socket that will connect to the first TCP socket I have created.( Client ) 3) Send some data to the Server via Client. 4) Receive data by Client from the Server. 5) Do NOT close the connection.. Wait for a little while.. 6) Receive more data from the Server. Here is my code: public class MyTCPServer { 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'; outToClient.writeBytes(capitalizedSentence); outToClient.writeBytes(String.valueOf(System.currentTimeMillis())); Thread.sleep(1000); outToClient.writeBytes(String.valueOf(System.currentTimeMillis())); } } } So this TCP socket listens to port 6789. Please notice that it sends back the received String from the Client, uppercases it and returns it back. And then the Server sends the currentTimeMillis, waits for 1000 milliseconds, and sends the timeMillis again. Here is my Client: public class MyTCPClient { public static void main(String[] args) throws Exception { String sentence; String modifiedSentence; BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in)); Socket clientSocket = new Socket("localhost", 6789); DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream()); BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); sentence = inFromUser.readLine(); outToServer.write…
downvote count: 0
has answer: http://stackoverflow.com/a/21957812
favorite count: 0
has comment: http://stackoverflow.com/comment/33267805
tagged with: sockets
score: 2
type: AnsweredQuestion
upvote count: 2
possible better answer: http://stackoverflow.com/a/21957737
tagged with: tcp
accepted answer: http://stackoverflow.com/a/21957812

http://stackoverflow.com/comment/33151264
has text: for example, if you have 10000 object in a DB, and you are displaying them in a list, and you are using a LruCache, and your user is scrolling, a cache size of 10 is useless.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21889675
type: Comment

http://stackoverflow.com/a/21899855
type: Answer
has comment: http://stackoverflow.com/comment/33165189
has comment: http://stackoverflow.com/comment/33165331
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33165158
downvote count: 0
has body: You can use: &lt;value&gt;${my.set.value1}/value&gt; And set the value in property file: my.set.value1=Value1
has comment: http://stackoverflow.com/comment/33165131
answers question: http://stackoverflow.com/q/21899777

http://stackoverflow.com/q/21904682
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/469695
linked to: http://stackoverflow.com/q/16026918
tagged with: java
has title: how to avoid warning for the Base 64?
type: Question
accepted answer: http://stackoverflow.com/a/21904810
answer count: 2
downvote count: 1
possible better answer: http://stackoverflow.com/a/32227181
favorite count: 0
has answer: http://stackoverflow.com/a/21904810
upvote count: 17
has body: I have just tried a sample code form net it shows a warning as follows SimpleConvertImage.java:7: warning:com.sun.org.apache.xerces.internal.impl.dv.util.Base64 is internal proprietary API and may be removed in a future release import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; ^ SimpleConvertImage.java:16: warning: com.sun.org.apache.xerces.internal.impl.dv.util. Base64 is internal proprietary API and may be removed in a future release String base64String=Base64.encode(baos.toByteArray()); ^ SimpleConvertImage.java:19: warning: com.sun.org.apache.xerces.internal.impl.dv.util .Base64 is internal proprietary API and may be removed in a future release byte[] bytearray =Base64.decode(base64String); ^ the code is the below one import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; public class SimpleConvertImage { public static void main(String[] args) throws IOException{ String dirName="/root/Desktop"; ByteArrayOutputStream baos=new ByteArrayOutputStream(1000); BufferedImage img=ImageIO.read(new File(dirName,"Screenshot.png")); ImageIO.write(img, "png", baos); baos.flush(); String base64String=Base64.encode(baos.toByteArray()); baos.close(); byte[] bytearray =Base64.decode(base64String); BufferedImage imag=ImageIO.read(new ByteArrayInputStream(bytearray)); ImageIO.write(imag, "png", new File(dirName,"snap3.png")); } }
has comment: http://stackoverflow.com/comment/33177273
has comment: http://stackoverflow.com/comment/33173183
score: 16
has answer: http://stackoverflow.com/a/32227181

http://stackoverflow.com/comment/80633209
comment on: http://stackoverflow.com/a/46842446
type: AnswerComment
has text: Welcome to SO, kindly make sure before you post an answer at least look that thread for other positive score answers or accepted ones then decide if your amswer is adding something useful then its okay else refrain from posting it
type: Comment
score: 6

http://stackoverflow.com/q/22003417
has answer: http://stackoverflow.com/a/22003447
has answer: http://stackoverflow.com/a/22003526
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/16773599
tagged with: arrays
has title: How to assign variables in a string?
tagged with: string
has comment: http://stackoverflow.com/comment/33349777
possible better answer: http://stackoverflow.com/a/22003477
score: 0
has body: I need to assign variables in a string. String s = "102, 145, 163, 124"; I want to assign a separate variable like below; num1 = 102; num2 = 145; num3 = 163; num4 = 124; I need to do it programatically since the values will change and increase so whatever is in string s is assigned a variable. Thanks
upvote count: 1
accepted answer: http://stackoverflow.com/a/22003453
has comment: http://stackoverflow.com/comment/33349768
downvote count: 1
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/22003453
has comment: http://stackoverflow.com/comment/33349799
has comment: http://stackoverflow.com/comment/33349853
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22003477

http://stackoverflow.com/comment/33178994
has text: Okay, I implemented this pattern and it just works great. I also discovered that there was a sleep timer in libnodave library (library for working with plc). But it does work as intended! ;-) Thanks.
type: AnswerComment
comment on: http://stackoverflow.com/a/21882691
score: 0
type: Comment

http://stackoverflow.com/comment/33255168
has text: sure, you can accumulate the values into lists (see java.util.ArrayList)
comment on: http://stackoverflow.com/a/21950307
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33197209
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21916731
has text: Well thank you! I've been bothering my coworkers with how excited I was to be so close.
score: 0

http://stackoverflow.com/comment/33176405
type: Comment
has text: hey. Thanks for the reply. I don't understand what is this trying to do. should I do a try/catch for this?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21905927

http://stackoverflow.com/comment/33106133
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21866768
type: Comment
has text: Thank you. So would I have to instantiate it in a constructor in either class like @Szymon mentioned?

http://stackoverflow.com/a/22175341
downvote count: 0
type: Answer
has body: I would say that this answer might help with getting the sub-process IDs and this one - with killing them in Windows environment. Hope that helps!
answers question: http://stackoverflow.com/q/21918965
score: 2
has comment: http://stackoverflow.com/comment/33660263
upvote count: 2

http://stackoverflow.com/q/21990826
favorite count: 0
has body: I imported my project into eclipse and it became double spaced. Does anyone know how to fix this? Tried: Find: [\t ]+$ Replace With: Nothing //error: incompatible line delimiter Find: \s*\n Replace With: Nothing //error: incompatible line delimiter Find: ^\s*\r?\n Replace With: /R //error: incompatible line delimiter Find: ^\s*\r?\n Replace With: nothing //string not found Find: (.)\r\n(.) Replace With: nothing //string not found File &gt; Convert Line Delimiters to &gt; Windows //no changes Source &gt; Apply Formatting //grayed out CTRL + Shift + F //doesn't remove double spaces
linked to: http://stackoverflow.com/q/6619851
has answer: http://stackoverflow.com/a/21992457
has comment: http://stackoverflow.com/comment/33329656
has comment: http://stackoverflow.com/comment/33327280
tagged with: apache-flex
has title: Remove double spacing in eclipse
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33326635
has comment: http://stackoverflow.com/comment/33327577
upvote count: 3
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21992457
has comment: http://stackoverflow.com/comment/33329690
has comment: http://stackoverflow.com/comment/33326533
has comment: http://stackoverflow.com/comment/33327172
tagged with: flash-builder
has comment: http://stackoverflow.com/comment/33329644
has comment: http://stackoverflow.com/comment/33327303
possible better answer: http://stackoverflow.com/a/21990905
answer count: 2
has answer: http://stackoverflow.com/a/21990905
score: 3
downvote count: 0

http://stackoverflow.com/comment/33309938
has text: i tryed to set the TextureWrap.Reapeat on x and y coordinates. But i can't find how i can tell the texture where to repeat. So i can't change the UVs... Do you have any idea?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21909471
type: Comment

http://stackoverflow.com/comment/33138906
comment on: http://stackoverflow.com/q/21885462
score: 0
type: Comment
type: QuestionComment
has text: that not what i'm asking

http://stackoverflow.com/q/21848063
score: -1
has title: What does this code written in rsf producer class do?
has body: Can any explain the following line written in rsf producer class? Actually I am looking for next control flow UICommand.make(form, "saveSettings", UIMessage.make("administrate.save.settings.button"), null);
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21848300
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33122642
tagged with: spring
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33071791
upvote count: 0

http://stackoverflow.com/comment/33065081
comment on: http://stackoverflow.com/q/21843892
score: 0
type: QuestionComment
has text: how is the `employees` variable created
type: Comment

http://stackoverflow.com/comment/33257541
type: QuestionComment
comment on: http://stackoverflow.com/q/21950641
has text: What happens when you run your code and what do you expect to happen?
score: 0
type: Comment

http://stackoverflow.com/q/21915591
tagged with: java
has title: Oracle database alert opiodr aborting process ORA-609
type: Question
score: 5
has comment: http://stackoverflow.com/comment/33193719
has comment: http://stackoverflow.com/comment/33193144
has comment: http://stackoverflow.com/comment/33242103
answer count: 1
tagged with: c3p0
favorite count: 0
upvote count: 5
tagged with: oracle-database
has body: I am running a batch java application. The application runs every 10/20 minutes in my Production and UAT environment and I get database alerts like this: Thu Feb 06 15:15:08 2014 opiodr aborting process unknown ospid (28246400) as a result of ORA-609 After researching a bit on the internet the suggested fix for these alerts is to change INBOUND_CONNECT_TIMEOUT as: Sqlnet.ora: SQLNET.INBOUND_CONNECT_TIMEOUT=180 Listener.ora: INBOUND_CONNECT_TIMEOUT_listener_name=120 We have changed the setting on the database server side but don't know where to change in the client application. We are using c3p0 to create a connection pool and we are setting only these parameters: dataSource.setAcquireRetryDelay(30000); dataSource.setMaxPoolSize(50); dataSource.setMinPoolSize(20); dataSource.setInitialPoolSize(10); We have other web services running on the same server as the batch application and they use Tomcat's DBCP pool and they don't seem to create any alerts. Also strangely enough, our batch application doesn't generate the alerts in lower test environments. They happen once in a while but the UAT and PROD environments get these alerts very frequently based on the schedule. Any suggestions what configurations to set in the c3p0 pool or should I try changing to another pool API like DBCP? Update: I have added a few more parameters in the datasource and the frequency of alerts has reduced. I added the following and the number of alerts have gone down from 15 an hour to 4 an hour. dataSource.setLoginTimeout(120); dataSource.setAcquireRetryAttempts(10); dataSource.setCheckoutTimeout(60000);
type: AnsweredQuestion
tagged with: connection-pooling
has answer: http://stackoverflow.com/a/22285475
accepted answer: http://stackoverflow.com/a/22285475
downvote count: 0
has comment: http://stackoverflow.com/comment/33196188

http://stackoverflow.com/q/21856319
has answer: http://stackoverflow.com/a/21856410
has comment: http://stackoverflow.com/comment/33086261
downvote count: 0
has comment: http://stackoverflow.com/comment/33086384
has comment: http://stackoverflow.com/comment/33086336
favorite count: 0
tagged with: arraylist
type: UnansweredQuestion
tagged with: generics
answer count: 4
has answer: http://stackoverflow.com/a/21856481
upvote count: 3
has title: Generic list of lists Java
has body: i'm trying to make a generic function in Java to find out the maximum similarity between an ArrayList and a list from an ArrayList of ArrayLists. public static int maxSimilarity(ArrayList&lt;?&gt; g, ArrayList&lt;ArrayList&lt;?&gt;&gt; groups){ int maxSim = 0; for(ArrayList&lt;?&gt; g2:groups){ int sim = similarity(g, (ArrayList&lt;?&gt;) g2); if(sim &gt; maxSim) maxSim = sim; } return maxSim; } However, when i try to call it in my main function, it show an incompatible error ArrayList&lt;ArrayList&lt;Points&gt;&gt; cannot be converted to ArrayList&lt;ArrayList&lt;?&gt;&gt; I don't understand, i tought all objects can be represented by the ? sign. Also, it works in my similarity function, between two ArrayLists: public static int similarity(ArrayList&lt;?&gt; g1, ArrayList&lt;?&gt; g2){ int total = 0; for(Object o1:g1){ for(Object o2:g2){ if(o1.equals(o2)) total++; } } return total; }
type: Question
score: 3
has answer: http://stackoverflow.com/a/21856469
has answer: http://stackoverflow.com/a/21856486
tagged with: java

http://stackoverflow.com/a/21873657
score: 4
answers question: http://stackoverflow.com/q/21873487
has body: &lt;bean id="apple" class="AppleFactory" factory-method="createInstance" /&gt; &lt;bean id="manager" class="Manager"/&gt; &lt;context:annotation-config /&gt; Your manager public class Manager { @Autowired private Apple apple; } Should do the trick. See the reference guide and Initializing Spring bean from static method from another Class?
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21873487

http://stackoverflow.com/comment/33363307
has text: Sorry maybe I missed that then? It's just that my problem is specific to findout how I can make Java talk back to C#, your answer seems to revolve around how I can call Java functions from C#...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22010329
type: Comment

http://stackoverflow.com/a/21973898
has comment: http://stackoverflow.com/comment/82089335
has comment: http://stackoverflow.com/comment/33296891
has body: The second code won't even compile. But if you did return new String("" + foo);, it would. They are pretty much same after that.
score: 1
accepted answer of: http://stackoverflow.com/q/21973762
upvote count: 2
has comment: http://stackoverflow.com/comment/33296910
answers question: http://stackoverflow.com/q/21973762
type: AcceptedAnswer
downvote count: 1
type: Answer

http://stackoverflow.com/a/40368092
downvote count: 0
answers question: http://stackoverflow.com/q/21990086
upvote count: 2
type: Answer
score: 2
has body: LFTP is a program, not a protocol/server, therefore there is no "client" for it. LFTP program can act as a client itself for the following protocols: FTP, FTPS, HTTP, HTTPS, HFTP, FISH, SFTP

http://stackoverflow.com/comment/33222052
has text: You have to use a `ClassLoader` for that; what is more, you want `.getCanonicalPath()`.
score: 0
comment on: http://stackoverflow.com/q/21932263
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21855515
score: 1
has comment: http://stackoverflow.com/comment/33085142
has comment: http://stackoverflow.com/comment/33085648
type: AcceptedAnswer
downvote count: 0
has body: Your problem is the very typical indexOf(). It is usually a convention to return -1 when the element was not found, and the index (which is greater or equal to 0) otherwise. You have different ways to get to that result. Convert your array to a List int numUser = Integer.parseInt(inputUser); int index = Arrays.asList(sum).indexOf(numUser); if (index &lt; 0) { System.out.println("The number is not in the array"); } else { System.out.println("The number is in the array: " + index); } Use Apache ArrayUtils int numUser = Integer.parseInt(inputUser); int index = ArrayUtils.indexOf(sum, numUser); if (index &lt; 0) { System.out.println("The number is not in the array"); } else { System.out.println("The number is in the array: " + index); } Write it yourself int numUser = Integer.parseInt(inputUser); int index = -1; for (int i = 0; i &lt; sum.length; ++i) { if (sum[i] == numUser) { index = i; break; } } if (index &lt; 0) { System.out.println("The number is not in the array"); } else { System.out.println("The number is in the array: " + index); } If you don't mind converting to a List, I would use the first method (clearer code with least dependencies). If you do mind and are already using Apache Utils in your project, the second method is fine, and avoid the conversion. If you want to keep as little dependencies and are fine with more complex source code, the third method might be what you are after!
type: Answer
accepted answer of: http://stackoverflow.com/q/21855153
answers question: http://stackoverflow.com/q/21855153
upvote count: 1

http://stackoverflow.com/comment/33336494
type: AnswerComment
has text: @ naren thanks a lot.. you are gem..can you suggest me or help me how can i convert this in to an applet.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21966440

http://stackoverflow.com/a/21996961
accepted answer of: http://stackoverflow.com/q/21996617
has body: You're storing a reference to newval in the map. The containsKey(newval) checks false because Text checks to see if its contents are the same, but then the put call stores a reference to same newval that you've put in the map repeatedly (which contains only the latest string read in). Try changing the map to a map of String,Int and calling map.put(newval.toString()) to start, which should lead you to a better solution. Else, declare newval within the iterator loop so that you're storing a new Text object in the map each time (Text newval = it.next()).
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33349775
answers question: http://stackoverflow.com/q/21996617

http://stackoverflow.com/comment/33185324
has text: If the `hForm` variable is null, it would throw a null pointer trying to access the `.getId()` method of the variable.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21911511
score: 1

http://stackoverflow.com/comment/33319489
comment on: http://stackoverflow.com/a/21984260
has text: Thanks, it works and i think is a good idea since i have to keep those data for other operations. Btw there is something I dont understand with BufferedReader, because if I commented the `readlince` in the second class and remove the while, the result still being null. However, if I keep `System.out.println(" sshmanager result line : " + result.readLine());` I can read the result in my first class without the first line, it's a bit weird, isn't it?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33318871
comment on: http://stackoverflow.com/q/21986089
type: QuestionComment
has text: It would probably be good to add some information about the data set (how many relationships have to be traversed during a request?) and memory config etc.
type: Comment
score: 1

http://stackoverflow.com/comment/46264671
type: Comment
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/29004803
has text: I'm down voting this answer because it is irrelevant. If you have read the question you should have known that the issue is related to LUNA M5 and I've had already tried that. Also if you do not know M5=Milestone 5 and Luna has been released a very long time ago, so your answer is completely inappropriate.

http://stackoverflow.com/a/21942573
accepted answer of: http://stackoverflow.com/q/21941848
answers question: http://stackoverflow.com/q/21941848
type: Answer
downvote count: 0
score: 1
has body: I guess you should try session.flush() before delete().
upvote count: 1
has comment: http://stackoverflow.com/comment/77353591
type: AcceptedAnswer

http://stackoverflow.com/q/21893128
has answer: http://stackoverflow.com/a/21893302
has comment: http://stackoverflow.com/comment/33153722
has answer: http://stackoverflow.com/a/21893305
has comment: http://stackoverflow.com/comment/33153552
has comment: http://stackoverflow.com/comment/33153549
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33160705
tagged with: performance
has answer: http://stackoverflow.com/a/21893748
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/33153861
score: -1
has comment: http://stackoverflow.com/comment/33153753
accepted answer: http://stackoverflow.com/a/21893236
type: Question
has comment: http://stackoverflow.com/comment/33153474
upvote count: 0
has answer: http://stackoverflow.com/a/21893439
has answer: http://stackoverflow.com/a/21896974
has answer: http://stackoverflow.com/a/21893304
has title: Simplifying a Java IF or CASE statement
has answer: http://stackoverflow.com/a/21893285
favorite count: 0
has comment: http://stackoverflow.com/comment/33153491
answer count: 10
has answer: http://stackoverflow.com/a/21893470
has answer: http://stackoverflow.com/a/21893310
has body: I have an XML file that has four fields &lt;field1&gt; &lt;field2&gt; &lt;field3&gt; &lt;field4&gt; The values of these fields can be either TRUE or FALSE. I want to decide whether the output will be A, B, C or D. To do this i have to look at these four fields and every combination means that the output is either A, B, C or D. The possible combinations and outputs are as described below: 1T, 2F, 3F, 4F; A 1T, 2T, 3F, 4F; B 1T, 2T, 3T, 4F; C 1T, 2T, 3T, 4T; C 1T, 2F, 3T, 4F; A 1T, 2F, 3T, 4T; A 1T, 2F, 3F, 4T; A 1T, 2T, 3F, 4T; B The number represents the field number and the character after the number represents whether the value is TRUE or false, for example, the first combination (-1T, 2F, 3F, 4F; A) is saying if field1 is TRUE, field2 is false, field3 is false then the output is A. The output is D if there is no match. Obviously i can do something like if(field1, !field2, !field3, !field4) return 'A' else if(field1, field2, !field3, !field4) return 'B' else if(field1, field2, field3, !field4) return 'C' ... .... .... and so on The caveat is that some of these fields can be null (i.e the tag might not exist). Short of having 100s of IF statements, is there an easier way to code these combinations? Thanks in advance
has answer: http://stackoverflow.com/a/21893236
has comment: http://stackoverflow.com/comment/33153607
has comment: http://stackoverflow.com/comment/33153444
possible better answer: http://stackoverflow.com/a/21893302

http://stackoverflow.com/comment/33088623
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21843869
score: 0
has text: Your tomcat is running on localhost (127.0.0.1), right? So it would not make sense to map it to your IP address. You should map it to the IP of the Tomcat server. Unless you wanted to access it remotely or something.

dynamic
tags question: http://stackoverflow.com/q/21931447
tag name: dynamic
tags question: http://stackoverflow.com/q/21958552
tags question: http://stackoverflow.com/q/21991993
tags question: http://stackoverflow.com/q/21998325
type: Tag
tags question: http://stackoverflow.com/q/21994278

http://stackoverflow.com/comment/33168632
has text: And what is happening exactly???
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21901776
score: 0

spring-ioc
tag name: spring-ioc
tags question: http://stackoverflow.com/q/21885247
type: Tag

http://stackoverflow.com/q/21961778
type: Question
tagged with: actionlistener
has answer: http://stackoverflow.com/a/21962156
tagged with: event-handling
score: 0
answer count: 1
has title: Java - Actionlistener: Get components from parent
accepted answer: http://stackoverflow.com/a/21962156
tagged with: swing
type: AnsweredQuestion
tagged with: java
has body: The only way I found so far to get other components' info when an actionevent is activated is by doing the following: ((Swing Component)ActionEvent.getSource()).getParent().getComponent(---).method(); and while it work it's not that practical or readable, not to mention would most likely stop working properly if I moved around the components in the parent component. So what is the best way to go about this? Should I even use an actionlistener to begin with or are there better classes/design for this purpose?

http://stackoverflow.com/a/21887359
answers question: http://stackoverflow.com/q/21886836
type: Answer
downvote count: 0
score: 1
has body: The approach I'd use is to create a POJO (or some POJOs) to store the values as attributes and validate attribute by attribute. Since many times you're going to have the same validation per attribute type (e.g. dates and numbers can be validated by range, strings can be validated to ensure they´re not null or empty, etc), you could just iterate on these attributes using reflection (or even better, using annotations). If you need to validate on the POJO level, you can still reuse these attribute-level validators via composition, while you add more specific validations are you´re going up in the abstraction level (going up means basic attributes -> pojos -> pojos that contain other pojos -> etc). Passing several basic types as parameters of the same method is not good because the parameters themselves don't tell much and you can easily exchange two parameters of the same type by accident in the method call.
upvote count: 1

http://stackoverflow.com/q/21890029
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33147529
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21901822
has title: Check if time in millis is tomorrow
score: 0
has comment: http://stackoverflow.com/comment/33147806
has body: I want to query SQLite table and get records where the time field (which is a String representing long time in millis) is in the range of tomorrow from querying time. I also have a field which holds the record date time like this: dd/MM/yyyy, HH:mm:ss How would you recommend implementing this?
accepted answer: http://stackoverflow.com/a/21890555
tagged with: android
tagged with: datetime
has comment: http://stackoverflow.com/comment/33147511
has comment: http://stackoverflow.com/comment/33147893
has answer: http://stackoverflow.com/a/21890555
has comment: http://stackoverflow.com/comment/33147530
possible better answer: http://stackoverflow.com/a/21901822

http://stackoverflow.com/comment/33247689
comment on: http://stackoverflow.com/q/21945178
has text: compare(T left, T right) { if (left != null) left.compareTo(right); } But, as mentioned below, I'm sure that Radiodef is correct. Thanks, though!
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/21879851
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/21879672
has body: try to do something like the following : public class GeneralServlet extends HttpServlet { public boolean validate() { } } public class MyServlet extends GeneralServlet { } this what i used to do in my previous work . and please give me some feedback Hope that helps .
has comment: http://stackoverflow.com/comment/33132875
score: 0

http://stackoverflow.com/q/21842641
type: UnansweredQuestion
answer count: 0
score: 0
tagged with: flicker
tagged with: java
has comment: http://stackoverflow.com/comment/33108813
tagged with: doublebuffered
has body: I am currently making a path-laying Tile game in Java where I am using a JLayeredPane with multiple layers. The game runs fine, but everytime the repaint method is called, the entire pane flickers. Right now I have the game running on a timer where every tick automatically moves the character one tile at a time along the path in which I have laid out. Naturally, I would need to update the screen in order to reflect the changes to the user, but the problem is that the repaint method forces a redraw on all layers of the LayeredPane. Every tick would cause a flicker on the map area of the screen. While it is bearable, I would just like to get rid of it so it looks nicer. I have researched on the use of double buffering and have even set the option to double buffer the pane to true as well (e.g. pane.setDoubleBuffered(true)), but have had no luck with various implementations. Is there a way to just draw the entire pane with all layers for every tick in an outside buffer, then copy it in one go over to the main screen? Thank you
type: Question
tagged with: jlayeredpane
has comment: http://stackoverflow.com/comment/33063218
tagged with: double-buffering
has title: How to Double-Buffer JLayeredPane

http://stackoverflow.com/a/21922918
type: Answer
score: 2
upvote count: 2
has body: public static String ReadTextFile(String path) throws IOException{ String HoldsText= null; InputStream is = getClass().getResourceAsStream(path); InputStreamReader fr = new InputStreamReader(is); BufferedReader br = new BufferedReader(fr); StringBuilder sb = new StringBuilder(); while((HoldsText = br.readLine())!= null){ sb.append(HoldsText) .append("\n"); } return sb.toString(); } You need to append the lines and use InputStreamReader instead of FileReader
accepted answer of: http://stackoverflow.com/q/21922634
has comment: http://stackoverflow.com/comment/76194337
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21922634

http://stackoverflow.com/a/21881840
has comment: http://stackoverflow.com/comment/33132169
upvote count: 2
type: Answer
has body: put this line inside loop handler.postDelayed(runnable, x); and this in your activity Runnable runnable = new Runnable() { @Override public void run() { publishProgress((int) (written * 100 / size)); } }; Handler handler = new Handler();
score: 2
answers question: http://stackoverflow.com/q/21881613
downvote count: 0

http://stackoverflow.com/a/21930329
type: Answer
downvote count: 0
score: 1
has body: You should normally use ServletFilter for that. You can access your ManagedBean there, as it is available in HttpSession.
upvote count: 1
answers question: http://stackoverflow.com/q/21928134

http://stackoverflow.com/a/21859171
has body: Working code: import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.net.URL; public class MyFileReader { public static void main(String[] args) { String file = ""; String filename = ""; try { BufferedReader ins = new BufferedReader(new FileReader(new File("c:\\filename.txt")));// get file name while (ins.ready()) { filename = ins.readLine(); } ins.close(); } catch (Exception e) { e.printStackTrace(); } String[] sa = filename.split("/"); file = sa[sa.length - 1]; try { System.out.println(filename); URL url = new URL(filename); } catch (Exception e) { e.printStackTrace(); } try { System.out.println(file); } catch (Exception e) { e.printStackTrace(); } } } Contents of filename.txt: http://wordpress.org/plugins/about/readme.txt Output from program: http://wordpress.org/plugins/about/readme.txt readme.txt Errors/Exceptions: None
has comment: http://stackoverflow.com/comment/33097110
answers question: http://stackoverflow.com/q/21859020
has comment: http://stackoverflow.com/comment/33093608
score: -2
has comment: http://stackoverflow.com/comment/33091965
downvote count: 2
has comment: http://stackoverflow.com/comment/33093293
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/33091629

ehcache
tags question: http://stackoverflow.com/q/21937512
tags question: http://stackoverflow.com/q/21969197
tags question: http://stackoverflow.com/q/21878234
tags question: http://stackoverflow.com/q/21944202
tag name: ehcache
type: Tag
tags question: http://stackoverflow.com/q/21891078

http://stackoverflow.com/comment/33441884
has text: Thank you. This worked. The prepared statement was definitely the way to go.
type: AnswerComment
comment on: http://stackoverflow.com/a/21920590
score: 0
type: Comment

http://stackoverflow.com/a/21845135
type: Answer
has comment: http://stackoverflow.com/comment/33067000
has comment: http://stackoverflow.com/comment/33067090
answers question: http://stackoverflow.com/q/21845080
score: 0
has comment: http://stackoverflow.com/comment/33067016
has comment: http://stackoverflow.com/comment/33067111
has comment: http://stackoverflow.com/comment/33067155
has comment: http://stackoverflow.com/comment/33067191
has body: I would have thought the best way to do this is to change your Java class to reflect your data model 1) change marks field and getters/setters to double 2) change PreparedStatement to setDouble see setDouble

http://stackoverflow.com/a/21933026
has comment: http://stackoverflow.com/comment/33235433
has comment: http://stackoverflow.com/comment/33234857
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33226926
type: Answer
has comment: http://stackoverflow.com/comment/33224137
accepted answer of: http://stackoverflow.com/q/21932850
score: 2
has comment: http://stackoverflow.com/comment/33225226
answers question: http://stackoverflow.com/q/21932850
upvote count: 2
has comment: http://stackoverflow.com/comment/33223709
has body: The seed list is exactly that, the driver will query that list to understand the map of the replica set. This means it can actually use members NOT on that list, i.e. it can use S3. When the driver has to detect a change in the replica set, either by failover or by starting up it will query one of the members of the seed list for basically a rs.status() and it will store the result in itself for a time that the driver deems worthy to refresh it, or something happens that forces the driver to refresh it (i.e. failover). So the answer is yes, it will go for S3.
has comment: http://stackoverflow.com/comment/33235487

http://stackoverflow.com/comment/33072245
has text: You can get rid of the `toString()` call by just changing the return type to `CharSequence`. I always use `CharSequence` where possible as you can do a lot of things you normally do with `String` with a `CharSequence` as well and have the freedom to use `String`, `StringBuilder`, `CharBuffer`, etc. at all places. And if you really need a `String` somewhere you can still invoke `toString()` on the `CharSequence` at that place.
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/21847964

http://stackoverflow.com/a/21952847
has comment: http://stackoverflow.com/comment/33351144
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/33316711
has body: You can use long n = Math.round(Double.parseDouble(text) * 100); This will mean numbers like 0.1 will be 10 not 1 and 1.110 will be 111 not 1110 Let say I need 4 decimal: String:1 ; int: 10000 String:1.23 int: 12300 String:1.2345 int:12345 needs long n = Math.round(Double.parseDouble(text) * 10000);
has comment: http://stackoverflow.com/comment/33305803
answers question: http://stackoverflow.com/q/21952750
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21952750
type: AcceptedAnswer

http://stackoverflow.com/q/21889660
tagged with: maven
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33153043
tagged with: validation
downvote count: 0
favorite count: 0
has title: Validating an hibernate model against a database
has body: I need to validate if a database schema is still valid according to the java classes annotated by hibernate entities. Background : we want to migrate our production database with liquibase generated scripts + custom SQL scripts, and then assert if java/hibernate model is compliant with those changes before deploying the application server. I have seen the hibernate maven plugin able to use hbm2ddl to update/create/drop a schema, but the VALIDATE option seems to be missing. Any suggestion with the maven plugin? I have also seen in hibernate the SchemaValidator class with a validate() method that would be usefull, but since my ultimate goal is to validate the SQL migration scripts by the build server, I would prefer an existing maven plugin than wiring myself the schema validation in the build process.
tagged with: spring
answer count: 0
has comment: http://stackoverflow.com/comment/33172616
type: UnansweredQuestion

http://stackoverflow.com/q/21947080
type: AnsweredQuestion
tagged with: save
has answer: http://stackoverflow.com/a/21947461
type: Question
has title: Android Not Saving Files
tagged with: java
possible better answer: http://stackoverflow.com/a/21947707
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21947461
has answer: http://stackoverflow.com/a/21947707
has body: I've been doing some work in Android, and I've found after three or four different attempts, I can't seem to get Android to save my file anywhere. In fact, it doesn't even create a folder in data/ for my app. Here's how I'm trying to save the file - this is in my main activity also. @Override public void onStop(){ super.onStop(); try{ FileOutputStream memboricOut = getApplicationContext().openFileOutput("memboric.core", Context.MODE_PRIVATE); brain.save(memboricOut); }catch(Exception e){ System.err.println("Could not save memboric core."); e.printStackTrace(); } } And inside brain.save(): public boolean save(FileOutputStream fileOut) { try{ ObjectOutputStream oo = new ObjectOutputStream(fileOut); oo.writeObject(this); oo.close(); fileOut.close(); System.out.println("Memboric Core saved successfully."); return true; }catch (Exception e) { e.printStackTrace(); } return false; } This code seems to do nothing. I've also placed the saving in onDestroy as well. Have I just chosen bad placement for the saving? I can't imagine what could possibly being going wrong.
tagged with: android
tagged with: io

http://stackoverflow.com/q/22002552
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33379259
upvote count: 2
tagged with: crash
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33379488
has comment: http://stackoverflow.com/comment/33350198
score: 2
has answer: http://stackoverflow.com/a/30835908
has comment: http://stackoverflow.com/comment/33392541
has body: I tried using Eclipse after not using it for some time and I get this error: !MESSAGE Unable to resolve plug-in "platform:/plugin/org.eclipse.wst.server.ui/icons/cview16/servers_view.gif". The .log includes quite a few similar messages. I have checked the plugins folder and it seems all of the files in it are missing. I have been unable to find these files anywhere, even on a fresh installation. I've looked all over Google and StackOverflow and I still have no answer, especially when the last time I started up Eclipse, I did not have this error and I have never touched this folder in the past. More of the error log is here http://pastebin.com/kiejQThE
has comment: http://stackoverflow.com/comment/43913847
downvote count: 0
has title: Eclipse unable to resolve plugin org.eclipse.wst.server.ui
has comment: http://stackoverflow.com/comment/33357782
type: Question
linked to: http://stackoverflow.com/q/24530251

http://stackoverflow.com/comment/33275705
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21961769
has text: No. You cannot inflate a layout in the `Fragment`'s `onCreate()`; you use `onCreateView()` for that. The method you posted is `Activity`'s `onCreate()`. `Fragment` `onCreate()`'s signature is `public void onCreate (Bundle savedInstanceState)`; it is `public`
type: AnswerComment

http://stackoverflow.com/comment/33315107
type: AnswerComment
type: Comment
has text: @Akkusativobjekt, http://docs.oracle.com/javaee/6/api/javax/servlet/ServletContext.html#getRealPath%28java.lang.String%29
comment on: http://stackoverflow.com/a/21983850
score: 0

http://stackoverflow.com/q/21872065
has answer: http://stackoverflow.com/a/21873115
score: 1
tagged with: java
has title: how to set a path while saving image with jsp/servlet?
has comment: http://stackoverflow.com/comment/33116740
tagged with: servlets
has comment: http://stackoverflow.com/comment/33115627
type: Question
has comment: http://stackoverflow.com/comment/33117707
upvote count: 1
has comment: http://stackoverflow.com/comment/33116961
downvote count: 0
answer count: 1
tagged with: jsp
favorite count: 0
has body: signup.jsp: here am not able to set path to save my uploaded image inside a folder????thanks in advance..!!everything is fine and evrything is working properyly but image path is showing wrong. &lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;base href="&lt;%=basePath%&gt;"&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Interactive Demos&lt;/title&gt; &lt;link rel="stylesheet" href="css/style.css" type="text/css"/ &lt;/head&gt; &lt;body&gt; &lt;header&gt; &lt;jsp:include page="header1.jsp"/&gt; &lt;/header&gt; &lt;!--start mainwrap--&gt; &lt;div id="mainwrap"&gt; &lt;!--start midwrap--&gt; &lt;div id="midwrap"&gt; &lt;table style="width:100%; border:0; border-collapse: collapse; padding:0px;"&gt; &lt;!-- &lt;tr&gt; &lt;td style="width:74%; vertical-align:top;"&gt;&amp;nbsp;&lt;/td&gt; &lt;td style="width:26%; "&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; --&gt; &lt;h1 style="padding-top:6px; font-family: Palatino Linotype; font-size:25px; font-weight:bold; color:#476aba; border-bottom:2px solid #476aba"&gt;Registration&lt;/h1&gt; &lt;tr&gt; &lt;td style="vertical-align:top;"&gt; &lt;div class="lf" style="width:500px; margin-left: 240px;"&gt; &lt;!-- &lt;div style="font-size: 25px"&gt; --&gt; &lt;!-- &lt;/div&gt; --&gt; &lt;div class="tp-btm"&gt; &lt;div style="border-radius:7px; border:1px solid black; background-color: #e7ebf5; padding-top:15px; padding-bottom:15px;"&gt; &lt;form name = "frmRegistration" id="frmRegistration" onsubmit="submitAlbum()" method="post" enctype="multipart/form-data"&gt; &lt;table style="width:100%; text-align:center; border:0; border-collapse: collapse; padding:0px; text-align:center;"&gt; &lt;tr&gt; &lt;td class="text"&gt;&amp;nbsp;&lt;/td&gt; &lt;td style="height:40; text-align:left;" class="text"&gt;E-mail :&lt;span class="red"&gt;*&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&lt;input type="email" name="email" id="email" size="25" required="required" onmouseout=…
has comment: http://stackoverflow.com/comment/33117656
accepted answer: http://stackoverflow.com/a/21873115
type: AnsweredQuestion

http://stackoverflow.com/comment/33093366
has text: What is your sample rate and buffer size? What does your input signal look like?
type: Comment
comment on: http://stackoverflow.com/q/21853063
type: QuestionComment
score: 0

http://stackoverflow.com/q/21867353
has comment: http://stackoverflow.com/comment/33107255
has answer: http://stackoverflow.com/a/21869645
answer count: 3
has answer: http://stackoverflow.com/a/21867498
type: UnansweredQuestion
has title: Extract string delimited by integer and newline
has body: I have a method that returns a list of student records from a DB in a single string, where each line begins with a newline, then a student ID(integer), and each ends in a newline. It looks something like this: 1 John Doe 4.0 Nonresident Steve Jobs n/a Internet Security n/a 203 Jane Doe 2.4 Resident Bill Gates n/a Tree Lutz n/a 4343 Chris Farley 4.2 Resident B Obama n/a Trades Up PEI I need to extract just the record requested by student ID. For instance, if the user requests ID #203, the program would print out: 203 Jane Doe 2.4 Resident Bill Gates n/a Tree Lutz n/a I've looked into pattern matching and regex's but those seem to require specific characters, and I'm not sure how to parse by the int I want. I can't figure out how to loop through the string and grab just the one that begins with the requested ID. Not asking you to do my homework, but any hints would be appreciated.
tagged with: java
has answer: http://stackoverflow.com/a/21867429
type: Question
score: 0

http://stackoverflow.com/comment/33165412
type: QuestionComment
has text: is there any way to do a file lock other than java.nio.channels filelock?
comment on: http://stackoverflow.com/q/21899889
score: 0
type: Comment

http://stackoverflow.com/a/21853992
answers question: http://stackoverflow.com/q/21853922
score: 5
downvote count: 0
type: Answer
has body: The advantage to overriding is that Java automatically will use it instead of the toString() provided by Object. Try running System.out.println(yourObject); with and without the @Override public String toString(){ return String.format("%s is a %s", "Apple", "fruit."); } method and observe the difference.
upvote count: 5

http://stackoverflow.com/a/21848054
downvote count: 0
answers question: http://stackoverflow.com/q/21847941
accepted answer of: http://stackoverflow.com/q/21847941
score: 4
has body: All loggers are ordered into a hierarchy, by its names. So you may to configure a parent logger ("log4j.logger.com.my.package" or root logger) and override configuration for some of child loggers if you need. See more at http://logging.apache.org/log4j/2.x/manual/architecture.html .
type: AcceptedAnswer
type: Answer
upvote count: 4

http://stackoverflow.com/a/21844089
answers question: http://stackoverflow.com/q/21844058
has comment: http://stackoverflow.com/comment/33065405
accepted answer of: http://stackoverflow.com/q/21844058
score: 0
type: AcceptedAnswer
type: Answer
has body: I would do as below: b = (String)((Button) getObject(request).caption)

http://stackoverflow.com/q/21976389
has body: I'm attempting to have an array (fishWeights) be set to the values that are found using a method. Except that when I try to compile this: public class GoFishEdited { public static void main(String[] args) { System.out.println("\nProject 1, Stage 3\n"); Habitat h1 = new Habitat(); Habitat h2 = new Habitat(); int[] fishWeights = stockUp(); System.out.println("Start with some weights:"); for (int i : fishWeights) { System.out.print(i + " "); } System.out.println("\n\nMake fish of those weights.\n"); Fish[] fishGroup = new Fish[fishWeights.length]; // array of Fish for (int i=0; i &lt; fishWeights.length; i++) { fishGroup[i] = new Fish(fishWeights[i]); // make fish } } } It states that that the symbol stockUp() cannot be found. It is in this file: public class Habitat { ArrayList stringer = new ArrayList(); public int maxCount=25; public int minCount=9; public int maxWeight=10; public int minWeight=1; public int catchProbability=30; //0.3 public void stockUp(int[] fishArr){ int numofF = minCount + (int)(Math.random() * ((maxCount - minCount) + 1)); for(int i = 0; i&lt;numofF; i++){ fishArr[i] = minWeight + (int)(Math.random() * ((maxWeight - minWeight) + 1)); } } public Habitat(){ } public void addFish(Fish f) { stringer.add(f); } public void removeFish(Fish f){ stringer.remove(f); } public void printFish(){ System.out.println(stringer); } } So stockUp exists, I just can't seem to make getFishEdited to find it.
tagged with: methods
type: Question
tagged with: java
has title: Multiple methods in one program
tagged with: class
has answer: http://stackoverflow.com/a/21976415
score: 0
has answer: http://stackoverflow.com/a/21976418
type: UnansweredQuestion
tagged with: symbols
answer count: 4
has answer: http://stackoverflow.com/a/21976459
has answer: http://stackoverflow.com/a/21976449

http://stackoverflow.com/q/21856020
has answer: http://stackoverflow.com/a/21856692
score: 3
tagged with: android-fragments
upvote count: 3
tagged with: java
has title: Same Fragment appears in all tabs
type: Question
answer count: 2
downvote count: 0
has body: I have encountered a problem in my Android application. When I added two tabs, I also had two fragments. But the thing is that the same fragment is appearing on both tabs. The other fragment is not showing up. Here is what it looks like. Here is my code for my activity: public class DatabaseFiller extends Activity{ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); setContentView(R.layout.rmactivity); ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setSubtitle("Created by Rohit Nandakumar"); /*ActionBar.Tab searchdb = actionBar.newTab().setText("Search Database"); ActionBar.Tab searchlist = actionBar.newTab().setText("Show List"); */ ActionBar.Tab Frag1 = actionBar.newTab().setText("Search Database"); ActionBar.Tab Frag2 = actionBar.newTab().setText("Show List"); Fragment fragment1 = new DatabaseFillerFragment(); Fragment fragment2 = new DeleteDBItems(); Frag1.setTabListener(new MyTabListener(fragment1)); Frag2.setTabListener(new MyTabListener(fragment2)); actionBar.addTab(Frag1); actionBar.addTab(Frag2); } } Here is my whole MyTabListener class: package com.example.foodsaver2; import android.app.ActionBar.Tab; import android.app.ActionBar.TabListener; import android.app.ActionBar; import android.app.Fragment; import android.app.FragmentTransaction; public class MyTabListener implements TabListener { public Fragment fragment; public MyTabListener(Fragment fragment) { this.fragment = fragment; } @Override public void onTabReselected(Tab tab, FragmentTransaction ft) { // TODO Auto-generated method stub } @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { // TODO Auto-generated method stub if (fragment == null) { // If not, instantiate and add it to the activity ft.add(android.R.id.content, fragment); } else { // If it exists, si…
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/21856942
type: UnansweredQuestion

http://stackoverflow.com/comment/33247153
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21946019
has text: So the second one is very similar bu the `x` are shifted by `-deltax/2.0`. And if you want right sum start with `x=a + deltaX`. Draw a picture and it should becomes clear.
score: 0

http://stackoverflow.com/comment/33288539
comment on: http://stackoverflow.com/a/21969043
has text: Because? I always do it like this.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21940029
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33236168
has body: The trouble is with the while(false) continuation condition. Being a do while(false) statement, this means that it can never loop more than once. That is, when you try to jump the execution to the labeled statement, it won't cycle again through the do while because the continuation condition (false) is not validated, even if you think that continue will make the execution loop again. So it will never increment numb more than once per next() method execution. I'd do something like the following: nextCandidate: do{ numb += 2; int numbSqrt = (int)java.lang.Math.sqrt(numb); for (int i = 3; i &lt;= numbSqrt; i = i+2) { if (numb % i == 0) { continue nextCandidate; } } break; }while(true);
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/33236271
score: 1
accepted answer of: http://stackoverflow.com/q/21939807
answers question: http://stackoverflow.com/q/21939807

http://stackoverflow.com/comment/33292978
type: QuestionComment
has text: I see you _getting_ the reverb control value. I don't see you doing anything to actually turn on reverb...
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21971340

http://stackoverflow.com/q/21936103
tagged with: junit
downvote count: 0
has comment: http://stackoverflow.com/comment/33228696
has title: Why assertEquals(new int[]{1}, new int[]{1}) results in failure?
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/21936149
score: 2
tagged with: equals
possible better answer: http://stackoverflow.com/a/21936157
upvote count: 2
has answer: http://stackoverflow.com/a/21936157
has body: I was testing my shuffling class and came across one issue I cannot understand. Why does the following assert statement: assertEquals(new int[]{1}, new int[]{1}); results in an AssertionError? Naturally, the correct answer is "because they are not equal!", but could someone explain me why? And how to test a method, for which I would like the two such objects to be equal?
tagged with: unit-testing
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21936160
accepted answer: http://stackoverflow.com/a/21936149
linked to: http://stackoverflow.com/q/8777257
tagged with: java

http://stackoverflow.com/a/21842742
accepted answer of: http://stackoverflow.com/q/21842585
answers question: http://stackoverflow.com/q/21842585
type: AcceptedAnswer
score: 0
has body: You need to append the String to the return value. But in this case, using StringBuilder matches what you want to do. That's not good for performance because "+" creates new String instance every time it's called. public String toString() { StringBuilder sb = new StringBuilder("Contents of list: {"); appendRecursion(sb, 0); return sb.toString(); } private void appendRecursion(StringBuilder result, int pos) { if (pos != size()) { rotate(); result.append(get().getData()).append(","); pos = pos + 1; appendRecursion(result, pos); } }
type: Answer

http://stackoverflow.com/q/21992201
favorite count: 0
accepted answer: http://stackoverflow.com/a/23666417
answer count: 5
score: 11
tagged with: spring
has title: How to revoke auth token in spring security?
upvote count: 11
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/42933662
has body: In logout controller I tryed to write a lot of combination of code. Now I have this: final Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (auth != null) { new SecurityContextLogoutHandler().logout(request, response, auth); } SecurityContextHolder.getContext().setAuthentication(null); auth.setAuthenticated(false); But after provided code execution token still valid. What do I wrong? How to revoke token eventually?
type: Question
has answer: http://stackoverflow.com/a/42933662
has answer: http://stackoverflow.com/a/48239999
has answer: http://stackoverflow.com/a/23666417
has answer: http://stackoverflow.com/a/40786142
has answer: http://stackoverflow.com/a/50891487
downvote count: 0
tagged with: spring-security-oauth2

http://stackoverflow.com/a/21964637
has body: If you literally mean "anything", and you don't need access to the type within the method: public static void summary1(List&lt;?&gt; list){ } If you need access to the type: public static &lt;T&gt; void summary1(List&lt;T&gt; list){ // type T is available to code in here } All your examples were Number classes, so if you want to restrict it to those: public static &lt;T extends Number&gt; void summary1(List&lt;T&gt; list){ // a list of Numbers } and if you also need the Comparable behaviour that all Number classes have (but Number alone does not): public static &lt;T extends Number &amp; Comparable&lt;T&gt;&gt; void summary1(List&lt;T&gt; list){ // a list of Numbers, and you can compare them } Note also that I have changed the type to the abstract type List, instead of the implementation ArrayList - see Liskov substitution principle
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21964575
answers question: http://stackoverflow.com/q/21964575
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/22004406
score: 0
type: Answer
has body: You can't preload the Activity. Start the Activity, display the splash screen / progress bar, and load the data on another thread besides the main thread. Once the data is finished loading, switch the view with a ViewFlipper. I don't see a reason for multiple Activity's.
answers question: http://stackoverflow.com/q/22004257

regex
tags question: http://stackoverflow.com/q/21924002
tags question: http://stackoverflow.com/q/21887204
tags question: http://stackoverflow.com/q/21933704
tags question: http://stackoverflow.com/q/21908983
tags question: http://stackoverflow.com/q/21923361
tags question: http://stackoverflow.com/q/21884978
tags question: http://stackoverflow.com/q/21924478
tags question: http://stackoverflow.com/q/21844012
tag name: regex
tags question: http://stackoverflow.com/q/21867478
tags question: http://stackoverflow.com/q/21887690
tags question: http://stackoverflow.com/q/21878421
tags question: http://stackoverflow.com/q/21845294
tags question: http://stackoverflow.com/q/21916834
tags question: http://stackoverflow.com/q/21996884
tags question: http://stackoverflow.com/q/21944578
tags question: http://stackoverflow.com/q/21976152
tags question: http://stackoverflow.com/q/21925092
tags question: http://stackoverflow.com/q/21884532
tags question: http://stackoverflow.com/q/21848029
tags question: http://stackoverflow.com/q/21879764
tags question: http://stackoverflow.com/q/21873191
tags question: http://stackoverflow.com/q/21978933
tags question: http://stackoverflow.com/q/21929926
tags question: http://stackoverflow.com/q/21970766
tags question: http://stackoverflow.com/q/21956239
tags question: http://stackoverflow.com/q/21971430
tags question: http://stackoverflow.com/q/21855191
tags question: http://stackoverflow.com/q/21886949
tags question: http://stackoverflow.com/q/21857528
tags question: http://stackoverflow.com/q/21994942
tags question: http://stackoverflow.com/q/21973328
tags question: http://stackoverflow.com/q/22000062
tags question: http://stackoverflow.com/q/21977809
tags question: http://stackoverflow.com/q/21891362
tags question: http://stackoverflow.com/q/21894429
tags question: http://stackoverflow.com/q/21887896
tags question: http://stackoverflow.com/q/21912619
tags question: http://stackoverflow.com/q/21878526
tags question: http://stackoverflow.com/q/21930140
tags question: http://stackoverflow.com/q/21887570
tags question: http://stackoverflow.com/q/21999947
tags question: http://stackoverflow.com/q/21934428
tags question: http://stackoverflow.com/q/21931880
tags question: http://stackoverflow.com/q/21948302
tags question: http://stackoverflow.com/q/21933053
tags question: http://stackoverflow.com/q/21907054
tags question: http://stackoverflow.com/q/21962372
tags question: http://stackoverflow.com/q/21937377
tags question: http://stackoverflow.com/q/21905913
tags question: http://stackoverflow.com/q/21918605
tags question: http://stackoverflow.com/q/21974304
tags question: http://stackoverflow.com/q/21867189
tags question: http://stackoverflow.com/q/21940004
tags question: http://stackoverflow.com/q/21905912
tags question: http://stackoverflow.com/q/21883470
tags question: http://stackoverflow.com/q/21992460
tags question: http://stackoverflow.com/q/21883629
tags question: http://stackoverflow.com/q/21938352
tags question: http://stackoverflow.com/q/21934168
tags question: http://stackoverflow.com/q/21847972
tags question: http://stackoverflow.com/q/21944361
tags question: http://stackoverflow.com/q/21981433
tags question: http://stackoverflow.com/q/21945184
tags question: http://stackoverflow.com/q/21887162
tags question: http://stackoverflow.com/q/21969249
tags question: http://stackoverflow.com/q/21896440
tags question: http://stackoverflow.com/q/21909374
tags question: http://stackoverflow.com/q/21928277
tags question: http://stackoverflow.com/q/21921444
tags question: http://stackoverflow.com/q/21942546
tags question: http://stackoverflow.com/q/21926970
tags question: http://stackoverflow.com/q/21989283
tags question: http://stackoverflow.com/q/22002070
tags question: http://stackoverflow.com/q/21960854
tags question: http://stackoverflow.com/q/21962251
type: Tag
tags question: http://stackoverflow.com/q/21981657

http://stackoverflow.com/comment/33107422
type: QuestionComment
comment on: http://stackoverflow.com/q/21867404
score: 0
has text: Uploading the file to App Engine (through a form -> JSP (located on app engine)) -> App Engine uploads the file to the blobstore
type: Comment

http://stackoverflow.com/q/21847337
type: Question
tagged with: android-camera
tagged with: camera
score: 0
tagged with: flashlight
answer count: 1
type: UnansweredQuestion
tagged with: android
has body: I am implementing strobe functionality which works fine ( the LED camera flash light turn on/off) the problem that i occurring is that the turn on/off with different frequency in different devices. In HTC SensationXE its blinking fast and in NEXUS its blinking slow dont know what the issue is. Can anyone help please: Here is code: /* * This method turn on the LED camera flash light */ public void flashLightOn() { Log.d("Time", "On"); if (!isFlashOn) { if (cam != null || params != null) { params.setFlashMode(Parameters.FLASH_MODE_TORCH); cam.setParameters(params); cam.startPreview(); isFlashOn = true; } else { cam = Camera.open(); params = cam.getParameters(); params.setFlashMode(Parameters.FLASH_MODE_TORCH); cam.setParameters(params); cam.startPreview(); isFlashOn = true; } } else{ return; } } /* * This method turn off the LED camera flash light */ public void flashLightOff() { Log.d("Time", "Off"); if (isFlashOn) { if (cam != null || params != null) { //params.setFlashMode(Parameters.FLASH_MODE_OFF); //cam.setParameters(params); cam.stopPreview(); isFlashOn = false; } else{ //params = cam.getParameters(); //params.setFlashMode(Parameters.FLASH_MODE_OFF); //cam.setParameters(params); cam.stopPreview(); isFlashOn = false; } } else{ return; } } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { // TODO Auto-generated method stub } @Override public void surfaceCreated(SurfaceHolder holder) { // TODO Auto-generated method stub mHolder = holder; try { cam.setPreviewDisplay(mHolder); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void surfaceDestroyed(SurfaceHolder holder) { // TODO Auto-generated method stub cam.stopPreview(); mHolder = null; } private final Runnable mRunnable = new Runnable() { public void run() { if (mActive) { if (mSwap) { flashLightOn(); mSwap = false; mHander.postDelayed(mRunnable, strobeOnDelay); } else { flashLightOff(); mSwap = true; mHander.postD…
has answer: http://stackoverflow.com/a/22300103
tagged with: java
has title: Implementing strobe (Flash Light Blinking) effect on android which blinks with the same frequency

http://stackoverflow.com/a/21931429
answers question: http://stackoverflow.com/q/21931363
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21931363
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/33221489
score: 3
has body: Use this for edittext android:focusable="false"

http://stackoverflow.com/q/21899221
has comment: http://stackoverflow.com/comment/33164236
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/21899252
has answer: http://stackoverflow.com/a/21899252
favorite count: 0
linked to: http://stackoverflow.com/q/8798403
has body: I am unable to replace part of the substring in my code ? I want to get rid of the unwanted characters but i still get the same output ? String BusDetails = "ROUTE 3 &amp;#151; CLEARBROOK-UFV GOLINE TO UFV" ; System.out.println("BusDetails before"+BusDetails); BusDetails.replaceAll("&amp;#151;", ""); System.out.println("BusDetails After"+BusDetails); // Output BusDetails before ROUTE 3 &amp;#151; CLEARBROOK-UFV GOLINE TO UFV BusDetails After ROUTE 3 &amp;#151; CLEARBROOK-UFV GOLINE TO UFV
accepted answer: http://stackoverflow.com/a/21899246
has answer: http://stackoverflow.com/a/21899437
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33164177
has title: Unable to replace in String java ?
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21899246
tagged with: java

http://stackoverflow.com/a/21875358
answers question: http://stackoverflow.com/q/21874923
score: 3
has comment: http://stackoverflow.com/comment/33122305
has body: You should redesign your application. There is no need to wait at all. The entire state of your application will not change unless there is some event (i.e. user input) which triggers such a change. That’s especially true for a tic-tac-toe game. The condition you want to wait for cannot become true unless some user input changed the state in way that allows it. Therefore you can check for the condition inside the listener at places where the condition could have become true. And then react on it immediately. Therefore you should implement listeners which react on events, change the state of your application and return. The next state transition will happen when the next event occurs, not a single CPU cycle before that. If you want to do changes independent of user generated events, i.e. animations, use a Timer which will generate appropriate events.
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/33121876
downvote count: 0

http://stackoverflow.com/a/21967142
score: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21966714
type: Answer
has comment: http://stackoverflow.com/comment/33292796
upvote count: 3
has body: The easiest way with LibGDX to implement an offline Leaderboard would be to use the cross-platform Preferences. Preferences prefs = Gdx.app.getPreferences("leaderboard"); Integer score = prefs.getInteger("highscore", 0); // if there is no highscore yet, the score will be 0 // gameplay logic... Integer newScore = 1337; if (newScore &gt; score) { prefs.putInteger("highscore", score); } That's it. It should work on at least Desktop, Android and iOS and will be persisted so it can be retrieved also when the application is restarted.
has comment: http://stackoverflow.com/comment/33293657
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21966714

http://stackoverflow.com/comment/33215422
comment on: http://stackoverflow.com/a/21928620
has text: Did you apply both changes?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21952104
score: 5
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/21952079
type: Answer
has comment: http://stackoverflow.com/comment/33257853
has body: The command is running fine, it's just not connected to the console. If you want to see the commands's output, you'll have to print it yourself: String command = "java -cp 1outinstr;out Main"; Process p = Runtime.getRuntime().exec("cmd /c " + command); BufferedReader stdInput = new BufferedReader(new InputStreamReader( p.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader( p.getErrorStream())); // read the output from the command System.out.println("Here is the standard output of the command:\n"); String s = null; while ((s = stdInput.readLine()) != null) { System.out.println(s); } // read any errors from the attempted command System.out .println("Here is the standard error of the command (if any):\n"); while ((s = stdError.readLine()) != null) { System.out.println(s); } code taken from another answer If you want to learn more, read about standard streams: In computer programming, standard streams are preconnected input and output channels between a computer program and its environment (typically a text terminal) when it begins execution. The three I/O connections are called standard input (stdin), standard output (stdout) and standard error (stderr). - from Wikipedia

http://stackoverflow.com/comment/33294649
type: QuestionComment
has text: Which line is 28 in Student. java?
score: 0
comment on: http://stackoverflow.com/q/21972561
type: Comment

http://stackoverflow.com/q/21964768
downvote count: 4
has body: I'm trying to get a Java 2D graphics "hello world" going, and am finding it strangely difficult (ie, I'm Googling variations of "java hello world example" and coming up empty). Can anyone help me with a minimal hellow world example? Edit This is a good starting point though, "The Java Tutorials: Performing Custom Painting".
has comment: http://stackoverflow.com/comment/33281370
has comment: http://stackoverflow.com/comment/33281097
has comment: http://stackoverflow.com/comment/33281414
has comment: http://stackoverflow.com/comment/33281421
answer count: 3
has comment: http://stackoverflow.com/comment/33281302
accepted answer: http://stackoverflow.com/a/21964786
possible better answer: http://stackoverflow.com/a/21964831
favorite count: 0
upvote count: 11
has answer: http://stackoverflow.com/a/21964831
has comment: http://stackoverflow.com/comment/33281093
has comment: http://stackoverflow.com/comment/33281916
has comment: http://stackoverflow.com/comment/33282598
tagged with: swing
has comment: http://stackoverflow.com/comment/33281291
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33282538
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/33281200
has comment: http://stackoverflow.com/comment/33281250
has title: Simple Java 2D graphics: draw a rectangle?
has comment: http://stackoverflow.com/comment/33281478
has comment: http://stackoverflow.com/comment/33281470
has answer: http://stackoverflow.com/a/21965053
has answer: http://stackoverflow.com/a/21964786
type: Question
has comment: http://stackoverflow.com/comment/33281279

http://stackoverflow.com/comment/33168105
type: AnswerComment
comment on: http://stackoverflow.com/a/21901264
type: Comment
has text: how to write the same code in JSP as an expression and not as a JSTL Tag
score: 0

http://stackoverflow.com/q/21988519
has answer: http://stackoverflow.com/a/21996529
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Embedded Collection within JPA embeddable
has comment: http://stackoverflow.com/comment/33324054
has body: When there are more than one class(AClass, BClass below) using same @Embeddable class(CClass) which in turn is composed of an element collection of DClass or any Generic Class such as String. How can we support such an structure in JPA ? I am getting error when I run. Is there an easy way out , there are many classes similar to AClass and Bclass in my system. @Entity public class AClass { @Id String aid; CClass a; String member1; } @Entity public class BClass { @Id String bid; CClass a; int member2; } @Embeddable public class CClass { @ElementCollection List&lt;DClass&gt; member5; } @Embeddable public class DClass { int member4; int member3; } I get below error and only 2 tables are created &gt; Exception [EclipseLink-4002] (Eclipse Persistence Services - &gt; 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.DatabaseException Internal &gt; Exception: java.sql.SQLSyntaxErrorException: Column name 'MEMBER3' &gt; appears more than once in the CREATE TABLE statement. Error Code: -1 &gt; Call: CREATE TABLE AClass_MEMBER5 (MEMBER3 INTEGER, MEMBER4 INTEGER, &gt; AClass_AID VARCHAR(255), MEMBER3 INTEGER, MEMBER4 INTEGER, AClass_AID &gt; VARCHAR(255)) Query: DataModifyQuery(sql="CREATE TABLE AClass_MEMBER5 &gt; (MEMBER3 INTEGER, MEMBER4 INTEGER, AClass_AID VARCHAR(255), MEMBER3 &gt; INTEGER, MEMBER4 INTEGER, AClass_AID VARCHAR(255))") at &gt; org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340) &gt; at &gt; org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:679) &gt; at &gt; org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:558) &gt; at &gt; org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:1995) &gt; at &gt; org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:570) &gt; at &gt; org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanis…
linked to: http://stackoverflow.com/q/18215116
tagged with: jpa
has comment: http://stackoverflow.com/comment/33322326
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/33238808
score: 1
type: AnswerComment
has text: @lucasnadalutti 105/100 = 1, but 105/100.0 = 1.05
comment on: http://stackoverflow.com/a/21941512
type: Comment

http://stackoverflow.com/q/21966814
downvote count: 0
has answer: http://stackoverflow.com/a/21966884
tagged with: java
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/21967015
tagged with: arrays
upvote count: 6
tagged with: sorting
answer count: 6
has answer: http://stackoverflow.com/a/21966861
has answer: http://stackoverflow.com/a/21966862
has body: I'm having difficulty understanding the concept that I can pass a 2D array to java's Arrays.sort() method.(I have seen the java docs, the sort method can take only 1D arrays) But then when I try the following code I get error int[][] b={{1,2},{2,3}}; int[] a=b; But the following code works fine int[][] temp = { { 1, 50, 5 }, { 2, 30, 8 }, { 3, 90, 6 },{ 4, 20, 7 }, { 5, 80, 9 }, }; Arrays.sort(temp, new Comparator&lt;int[]&gt;() { @Override public int compare(int[] o1, int[] o2) { return Integer.compare(o2[1], o1[1]); } });
type: UnansweredQuestion
score: 6
has title: Java Arrays.sort() method takes 1D arrays, but I can pass a 2D array as well then why can't I do int[] a=b(where b is a 2D array)?
has answer: http://stackoverflow.com/a/21966866
has answer: http://stackoverflow.com/a/21966851

http://stackoverflow.com/comment/33304918
type: AnswerComment
type: Comment
has text: As op mention remove work fine. He may doing something wrong. Is it so?
score: 0
comment on: http://stackoverflow.com/a/21978019

http://stackoverflow.com/comment/33150176
has text: Why are you setting `mean1` equal to `sum1 / n;`? When you initiate `mean1`, `sum1 = 0`, and 0 divided by any number other than 0 equals 0. The same can be asked when you initiate `std1`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21891352

http://stackoverflow.com/q/21905287
has body: It doesnt have any errors ..when i run on my emulator it UNFORTUNATELY STOPS i am trying to make my button when i click it takes me to the next page....kindly help! Here is codes for MyActivity.java package com.example.INIKO_EVENTS; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MyActivity extends Activity { /** * Called when the activity is first created. */ Button login; Button sign_up; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); login=(Button)findViewById(R.id.Button15); login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(MyActivity.this,HomeActivity.class); MyActivity.this. startActivity(i); } }); sign_up=(Button)findViewById(R.id.signUpButton); sign_up.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(MyActivity.this,SignUpActivity.class); MyActivity.this. startActivity(i); } }); } } and heres my HomeActivity.java - it has buttons linking to other pages package com.example.INIKO_EVENTS; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class HomeActivity extends Activity { /** * Created by eddie kamau on 2/14/14. */ Button button2; Button button3; public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.home); button2 = (Button)findViewById(R.id.toEventButton); button2.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View arg0) { Intent i = new Intent(HomeActivity.this,EventActivity.class); HomeActivity.this. startActivity(i); } }); button3=(Button)findViewById(R.id.manage_your_guestButton2); button3.setOnClickListener(new View.OnClickListener() { @Override public void onClick…
has comment: http://stackoverflow.com/comment/33174681
tagged with: intellij-idea
answer count: 1
has answer: http://stackoverflow.com/a/21905763
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33175082
tagged with: android
has comment: http://stackoverflow.com/comment/33175559
has comment: http://stackoverflow.com/comment/33174185
type: Question
has comment: http://stackoverflow.com/comment/33175137
has title: how to move from my MyAcctivity.java (login page) to HomeActivity.java (home page) with a click of button- INTELLIJ
has comment: http://stackoverflow.com/comment/33174635
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/33174486

http://stackoverflow.com/q/21850505
tagged with: pid
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21851582
favorite count: 0
tagged with: linux
accepted answer: http://stackoverflow.com/a/21851582
has body: I am running pidstat on CentOS linux to monitor a Java application. When I feed the java pid to pidstat it never shows any context switches. top 2407 root 20 0 7939m 4.2g 11m S 129.3 58.4 138:47.08 java pidstat -w -I -p 2407 3 09:53:41 AM PID cswch/s nvcswch/s Command 09:53:44 AM 2407 0.00 0.00 java I have to find the pid of a specific Java thread (using top -H) to see the context switches. top -H 2915 root 20 0 7939m 4.2g 11m R 22.8 58.3 17:36.93 java pidstat -w -I -p 2915 3 09:53:41 AM PID cswch/s nvcswch/s Command 10:10:11 AM 2915 643.67 230.33 java How can you see the sum of all context switches of all threads within a Java process?
type: AnsweredQuestion
score: 2
tagged with: performance
upvote count: 2
tagged with: java
has title: How to see the sum of all context switches of all threads within a Java process?
type: Question
tagged with: monitoring

http://stackoverflow.com/q/21844988
has comment: http://stackoverflow.com/comment/33067030
has answer: http://stackoverflow.com/a/23340663
has comment: http://stackoverflow.com/comment/33066742
has comment: http://stackoverflow.com/comment/33066717
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23340663
has title: Android Display result in Hindi
tagged with: java
has comment: http://stackoverflow.com/comment/33066739
has comment: http://stackoverflow.com/comment/33066816
type: Question
has comment: http://stackoverflow.com/comment/33066787
has body: In my Android application a message is displayed in a text-view and the message is taken from server.. I updated both English and font in Hindi.. the English language is displaying correctly and when I tried to add Hindi text ,,.. ' ????? ' is displaying instead of text.. I tried. ..this code.. also.. txt4 = (TextView) findViewById(R.id.textView8); Typeface face=Typeface.createFromAsset(getAssets(), "fonts/hindi.ttf"); txt4.setTypeface(face);
has comment: http://stackoverflow.com/comment/33068938
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/33067459
answer count: 1
tagged with: textview
has comment: http://stackoverflow.com/comment/33066760
has comment: http://stackoverflow.com/comment/33066732

http://stackoverflow.com/comment/33139231
type: QuestionComment
has text: Are you sure your network allows the connection?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21883004

http://stackoverflow.com/comment/33251970
score: 0
type: AnswerComment
has text: Just to point out, while `close()` implementation uses a internal `lock` - there is no guarantee that interleaving `connect` and `close` will not break the `Socket` internal state. Actually there are no guarantees that `Socket` is thread safe at all. See the discussion [here](http://stackoverflow.com/questions/6672413/in-what-way-is-java-net-socket-threadsafe/6672582#6672582) (involving @EJP by the way :D). While, like EJP, I've seen sockets used in concurrent environments. We shouldn't assume thread-safe behavior, the client should properly handle concurrency.
comment on: http://stackoverflow.com/a/21947184
type: Comment

http://stackoverflow.com/comment/33247085
has text: @FancyPants Then it's another problem now... certainly with your logic :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21945975
type: AnswerComment

http://stackoverflow.com/q/21963500
has body: Say we have two textfields: First textfield - user enters an amount - can be any amount to two decimal places (3456.23, 555555.5, 23.44 etc) Second textfield - user enters an amount to equally split this by (2, 7, 1 etc) How can we then check whether the result of this calculation is an exact split (to two decimal places)? E.g. 54.2 / 2 = 27.1 (exact split) returns true 61.05 / 2 = 30.525 (not exact split) returns false
score: 1
tagged with: java
tagged with: floating-point
has comment: http://stackoverflow.com/comment/33278668
type: Question
has comment: http://stackoverflow.com/comment/33278590
has comment: http://stackoverflow.com/comment/33278585
upvote count: 1
has comment: http://stackoverflow.com/comment/33278581
favorite count: 0
has title: If number is equally split?
possible better answer: http://stackoverflow.com/a/21963578
answer count: 5
has answer: http://stackoverflow.com/a/21963575
has answer: http://stackoverflow.com/a/21963578
has answer: http://stackoverflow.com/a/21963581
downvote count: 0
has answer: http://stackoverflow.com/a/21963593
accepted answer: http://stackoverflow.com/a/21963593
has answer: http://stackoverflow.com/a/21963625
type: AnsweredQuestion

user-interface
tags question: http://stackoverflow.com/q/21901086
tags question: http://stackoverflow.com/q/21958670
tags question: http://stackoverflow.com/q/21957252
tags question: http://stackoverflow.com/q/21977502
tags question: http://stackoverflow.com/q/21896824
tags question: http://stackoverflow.com/q/21916326
tags question: http://stackoverflow.com/q/21976041
tags question: http://stackoverflow.com/q/21960720
tags question: http://stackoverflow.com/q/21955665
tags question: http://stackoverflow.com/q/21994739
type: Tag
tags question: http://stackoverflow.com/q/21898844
tags question: http://stackoverflow.com/q/21954319
tags question: http://stackoverflow.com/q/21892694
tags question: http://stackoverflow.com/q/21983642
tags question: http://stackoverflow.com/q/21857903
tags question: http://stackoverflow.com/q/21895966
tags question: http://stackoverflow.com/q/21846936
tags question: http://stackoverflow.com/q/21922156
tags question: http://stackoverflow.com/q/21972355
tags question: http://stackoverflow.com/q/21961516
tags question: http://stackoverflow.com/q/21841821
tags question: http://stackoverflow.com/q/21988426
tags question: http://stackoverflow.com/q/22002810
tags question: http://stackoverflow.com/q/21935289
tags question: http://stackoverflow.com/q/21976409
tags question: http://stackoverflow.com/q/21870607
tags question: http://stackoverflow.com/q/21948410
tags question: http://stackoverflow.com/q/21974806
tags question: http://stackoverflow.com/q/21890164
tags question: http://stackoverflow.com/q/21892526
tags question: http://stackoverflow.com/q/21851965
tags question: http://stackoverflow.com/q/21877277
tag name: user-interface
tags question: http://stackoverflow.com/q/21927824
tags question: http://stackoverflow.com/q/21897002
tags question: http://stackoverflow.com/q/21978743
tags question: http://stackoverflow.com/q/21864729

http://stackoverflow.com/q/22001589
type: Question
has body: I have two jbutton in a jpanel and when you click the first button you see a msg box saying "good morning" and when you click the second you see a "good night" msg box . But when i click on the first button and not closing the msg box first i can not click the second button to see the message. Can anyone help me? thanks.
score: 0
has comment: http://stackoverflow.com/comment/33346703
answer count: 1
accepted answer: http://stackoverflow.com/a/22001630
has title: Java jbutton msg box conflict
has comment: http://stackoverflow.com/comment/33346688
tagged with: swing
has answer: http://stackoverflow.com/a/22001630
tagged with: jbutton
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/33340382
score: 1
comment on: http://stackoverflow.com/q/21998015
has text: Every time you call this, it will do exactly the same thing.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21984912
linked to: http://stackoverflow.com/q/4157095
has answer: http://stackoverflow.com/a/21985050
linked to: http://stackoverflow.com/q/9168985
score: 0
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33316242
has body: I want to implement tab in my application. Tab works well. Now implementing expandable list view in one of the tab... That means activity extends Fragment and not FragmentActivity... But I face a problem in expendable list view... How can I overcome this... Here is my code.. public class ExpandableListView extends BaseExpandableListAdapter { private Context _context; private List&lt;String&gt; _listDataHeader; // header titles // child data in format of header title, child title private HashMap&lt;String, List&lt;String&gt;&gt; _listDataChild; public ExpandableListView(Context context, List&lt;String&gt; listDataHeader, HashMap&lt;String, List&lt;String&gt;&gt; listChildData) { this._context = context; this._listDataHeader = listDataHeader; this._listDataChild = listChildData; } @Override public Object getChild(int groupPosition, int childPosition) { // TODO Auto-generated method stub return this._listDataChild.get(this._listDataHeader.get(groupPosition)) .get(childPosition); } @Override public long getChildId(int groupPosition, int childPosition) { // TODO Auto-generated method stub return childPosition; } @Override public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { // TODO Auto-generated method stub final String childText = (String) getChild(groupPosition, childPosition); if (convertView == null) { LayoutInflater infalInflater = (LayoutInflater) this._context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = infalInflater.inflate(R.layout.child_battery, null); } TextView txtListChild = (TextView) convertView .findViewById(R.id.battery); txtListChild.setText(childText); return convertView; } @Override public int getChildrenCount(int groupPosition) { // TODO Auto-generated method stub return this._listDataChild.get(this._listDataHeader.get(groupPosition)) .size(); } @Override public Object getGroup(int groupPosition) { // TODO Auto-generated method stub return this._listDataHeader…
tagged with: expandablelistview
type: Question
has title: Android,want to show Expandible listview in a tab
tagged with: android-fragments
tagged with: java
has answer: http://stackoverflow.com/a/21985273
answer count: 2

http://stackoverflow.com/comment/33223555
score: 0
comment on: http://stackoverflow.com/q/21932694
has text: True that. Though I suppose you could be luckier over there as it is way more common in a game context.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33337710
has text: Yes the question was put on hold. I could edit but not delete it. Am not sure if anyone can see it.
comment on: http://stackoverflow.com/q/21996679
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21920660
has comment: http://stackoverflow.com/comment/33202404
type: AnsweredQuestion
has body: I am trying to find the sum of the integers in an ArrayList, however I am having issues with data types. Here is the code I have at the moment: int sum = 0; for (int i = 0; i &lt; InputArray.size(); i++) { sum = sum + InputArray.get(i) } However this is giving me the error: error: bad operand types for binary operator '+' I have also tried: int sum = 0; for (int i = 0; i &lt; InputArray.size(); i++) { int foo = Integer.parseInt(InputArray.get(i)); sum = sum + foo; } However this is giving me the error: error: no suitable method found for parseInt(object) The ArrayList contains integers only. What could be the problem?
has comment: http://stackoverflow.com/comment/33202394
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33202321
upvote count: 1
accepted answer: http://stackoverflow.com/a/21920790
has comment: http://stackoverflow.com/comment/33202385
downvote count: 1
has comment: http://stackoverflow.com/comment/33202282
type: Question
has comment: http://stackoverflow.com/comment/33202712
has comment: http://stackoverflow.com/comment/33202378
has answer: http://stackoverflow.com/a/21920920
answer count: 6
tagged with: arraylist
has answer: http://stackoverflow.com/a/21920811
has comment: http://stackoverflow.com/comment/33202525
has answer: http://stackoverflow.com/a/21920784
favorite count: 0
has answer: http://stackoverflow.com/a/21920790
possible better answer: http://stackoverflow.com/a/21920811
has title: Can't perform arithmetic operations on an ArrayList
has answer: http://stackoverflow.com/a/21920837
has answer: http://stackoverflow.com/a/21920951

http://stackoverflow.com/comment/33100645
comment on: http://stackoverflow.com/a/21848056
type: Comment
has text: With his current configuration the resulting beans are managed by Spring as those are singletons. It isn't any different then a normal Spring `FactoryBean`. The result of the factory bean is treated as any other Spring bean.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21907651
type: Question
has comment: http://stackoverflow.com/comment/33178323
has title: Running time calculation in multi threading
tagged with: sleep
has comment: http://stackoverflow.com/comment/33178336
has comment: http://stackoverflow.com/comment/33178396
score: 0
answer count: 2
tagged with: runnable
possible better answer: http://stackoverflow.com/a/21943172
has answer: http://stackoverflow.com/a/21943172
has body: In my code: public class thread1 implements Runnable { public static void main(String[] args) { thread1 d = new thread1(); new Thread(d).start(); Thread t1 = new Thread(d); t1.start(); } @Override public void run() { for (int i = 0; i &lt; 3; i++) { sleep1(); sleep2(); } } void sleep1() { try { Thread.sleep(1000); } catch (Exception e) { e.printStackTrace(); } } synchronized void sleep2() { try { Thread.sleep(1000); } catch (Exception e) { e.printStackTrace(); } } } I ran my code and calculate its running time to finished. The minimum time to finished was 7 seconds. Why? It should be 6 seconds, Because 3loops * 2seconds = 6seconds.
has answer: http://stackoverflow.com/a/21907911
accepted answer: http://stackoverflow.com/a/21907911
type: AnsweredQuestion
tagged with: java
tagged with: multithreading

http://stackoverflow.com/q/21993265
score: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33332325
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has answer: http://stackoverflow.com/a/21993532
has comment: http://stackoverflow.com/comment/33331554
type: Question
tagged with: arrays
downvote count: 0
accepted answer: http://stackoverflow.com/a/21993532
has comment: http://stackoverflow.com/comment/33332157
answer count: 1
upvote count: 6
favorite count: 0
has title: List of integers to JsonArray in GSON
has body: Right now my code is simply // list is a List&lt;Integer&gt; JsonArray arr = new JsonArray(); for(int i : list) { array.add(i); } I'm somewhat shocked looking through the API I haven't found a less manual, more functional way to do this. I would expect an addRange, addArray, constructor to go from a Collection to a JsonArray, etc. Is there one, or is there some fundamental limitation that makes this impossible?

http://stackoverflow.com/comment/33177264
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21906887
has text: As a rule, interfaces should change *very seldom*, so hopefully you won't have to do it that often. But when you do, you can just `select all`, `delete`, and re `generate delegate methods`.

http://stackoverflow.com/comment/33218768
comment on: http://stackoverflow.com/q/21930092
has text: Improve you question with more details
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33234003
type: Comment
comment on: http://stackoverflow.com/a/21937775
type: AnswerComment
has text: It is giving this error:: ...... The method notifyDataSetChanged() is undefined for the type ListView ...... (&) it is providing two suggestion Change to deferNotifyDatasetChanged .... and ... add cast to method reciever ...... listViewAdapter.notifyDataSetChanged(); ...or ..... xmlFragmentListView.defernotifyDataSetChanged();
score: 0

wamp
tag name: wamp
tags question: http://stackoverflow.com/q/21842114
tags question: http://stackoverflow.com/q/21904378
type: Tag

http://stackoverflow.com/a/21994190
has comment: http://stackoverflow.com/comment/33333215
answers question: http://stackoverflow.com/q/21993515
upvote count: 4
downvote count: 0
has body: This could be a start. Please note that I haven't tested this out and there could be errors but you'll get the idea. Read this for more info on multi dimensional array. Link String phpArray; int x=3; int y=array.length(); String[][] myStringArray = new String [y][x]; for(int i=0; i&lt;array.length; i++){ for(int j=0; j&lt;3; j++){ phpArray = contactsArray[i]; myStringARray[i][j] = phpArray[j]; } }
score: 4
type: Answer

gps
tags question: http://stackoverflow.com/q/21928389
tag name: gps
tags question: http://stackoverflow.com/q/21975117
type: Tag

aes
tags question: http://stackoverflow.com/q/21986824
tags question: http://stackoverflow.com/q/21904933
tags question: http://stackoverflow.com/q/21890805
type: Tag
tags question: http://stackoverflow.com/q/21965026
tags question: http://stackoverflow.com/q/21852889
tag name: aes
tags question: http://stackoverflow.com/q/21890769
tags question: http://stackoverflow.com/q/21960630
tags question: http://stackoverflow.com/q/21933484

http://stackoverflow.com/a/21876869
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21861364
answers question: http://stackoverflow.com/q/21861364
has body: I really don`t know a method to do what you want but you could do a trick like this Data[2]= "Currency"+jRst.getString("price_pro"); but when your retrieving data you have to split it or substring it
has comment: http://stackoverflow.com/comment/33152002

http://stackoverflow.com/comment/33227237
has text: The strangest thing is that version 3.3.1 that ships with JBoss works nicely. Thanks anyway for your help!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21885571
type: Comment

http://stackoverflow.com/a/21855517
downvote count: 1
score: -1
has body: If you mean by renaming using a different reference than you can simply do ArrayList newListRef = oldListInstance; //use newListRef thereafter If you mean to change some of the elements retaining the order then - ArrayList is dynamic in size. You can add and remove elements to and from specific index and ordering in retained. So no need to create separate List. If you want to change a specific element simply remove it and add new element at that index. APIs public E remove(int index) public void add(int index, E element)
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21855436
has comment: http://stackoverflow.com/comment/33085285

http://stackoverflow.com/comment/33298384
has text: It overrides element on position 2.
comment on: http://stackoverflow.com/q/21974676
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33353773
type: AnswerComment
comment on: http://stackoverflow.com/a/22005538
type: Comment
has text: Thanks. I can see why my method was stupid and wrong and this should work. But I'm still getting the previous error. Even with the initial code, at least it should output the duplicates right? But I'm (still, even after changing it to this) getting the same set of errors as shown in the OP
score: 0

http://stackoverflow.com/q/21966241
has answer: http://stackoverflow.com/a/21966609
has comment: http://stackoverflow.com/comment/33283846
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21966609
type: Question
has body: Consider a stand-alone Java main() program (no Java EE container) which is using JMS for sending messages to a remote JMS queue. As I understand, if the remote queue is not available for some reason (network problem, server down, queue full...), messageProducer.send(msg) throws an exception. Do I have to implement the retry-logic myself or will the JMS-api solve this for me somehow? TextMessage message = session.createTextMessage(); message.setJMSDeliveryMode(DeliveryMode.PERSISTENT); MessageProducer mp = session.createProducer(topic); mp.send(message); // Throws JMSException. How to retry, local storage etc?
has answer: http://stackoverflow.com/a/21968571
score: 4
has answer: http://stackoverflow.com/a/21979086
upvote count: 4
downvote count: 0
possible better answer: http://stackoverflow.com/a/21979086
has title: Creating a reliable JMS client?
tagged with: jms
favorite count: 0
has answer: http://stackoverflow.com/a/22319922
answer count: 5
has answer: http://stackoverflow.com/a/21977211

http://stackoverflow.com/comment/33148273
comment on: http://stackoverflow.com/a/21890173
score: 0
type: Comment
has text: @user3329588 It *is* an error. Try compiling it.
type: AnswerComment

http://stackoverflow.com/a/21904612
type: Answer
accepted answer of: http://stackoverflow.com/q/21851958
answers question: http://stackoverflow.com/q/21851958
has body: I abandoned the idea of making my config as a simple text file and went full XML. I found a nice library, XStream, that can generate some verbose but quite readable file. Example output and code Joe Walnes 123 1234-456 123 9999-999 PhoneNumber class public class PhoneNumber { private int code; private String number; public PhoneNumber(int code, String number) { this.code = code; this.number = number; } @Override public String toString() { return "PhoneNumber{" + "code=" + code + ", number=" + number + '}'; } } Person class public class Person { private String firstname; private String lastname; private PhoneNumber phone; private PhoneNumber fax; public Person(String firstname, String lastname) { this.firstname = firstname; this.lastname = lastname; } public void setPhone(PhoneNumber phone) { this.phone = phone; } public void setFax(PhoneNumber fax) { this.fax = fax; } @Override public String toString() { return "Person{" + "firstname=" + firstname + ", lastname=" + lastname + ", phone=" + phone + ", fax=" + fax + '}'; } } Runner class import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.xml.DomDriver; import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; public class Runner { private static final Logger LOG = Logger.getLogger(Runner.class.getName()); public static void main(String[] args) { XStream xstream = new XStream(new DomDriver()); // does not require XPP3 library // shorten tag names when saved xstream.alias(Person.class.getSimpleName(), Person.class); xstream.alias(PhoneNumber.class.getSimpleName(), PhoneNumber.class); // create object Person joe = new Person("Joe", "Walnes"); joe.setPhone(new PhoneNumber(123, "1234-456")); joe.setFax(new PhoneNumber(123, "9999-999")); // serialize String xml = xstream.toXML(joe); // open file File configFile = new File("Config.txt"); /…
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/21988511
has comment: http://stackoverflow.com/comment/33322545
downvote count: 0
has comment: http://stackoverflow.com/comment/33322641
has comment: http://stackoverflow.com/comment/33324030
accepted answer: http://stackoverflow.com/a/21989509
answer count: 1
tagged with: layout-manager
score: 1
has comment: http://stackoverflow.com/comment/33323280
favorite count: 0
upvote count: 1
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33322430
tagged with: java
has answer: http://stackoverflow.com/a/21989509
has title: Dynamic scaling in nested layout
type: Question
has comment: http://stackoverflow.com/comment/33322970
has body: I want to have arbitrary JPanels containing a JLabel sacling dynamically in a container (JPanel) with a fixed size. So something like this: __________________________________ | _____________ _____________ | | | Test Label| | Test Label| | | |___________| |___________| | |________________________________| scaling to this __________________________________ | ________ ________ ________ | | |Tes...| |Tes...| |Tes...| | | |______| |______| |______| | |________________________________| I tried to use a BoxLayout (X-Orientation), setting a maximum size for each contained JPanel: OuterContainer.Width / NumberOfContainedJPanels without success. The containers around the labels never fall below a specific width. Further more using a GridBagLayout does not work good, because i want to dynamically add more containers so it wouldn't be a good way to generate the GridBagLayout constraints on each adding. Is there a good solution for this problem? The following is a SSCCE for my problem: import javax.swing.JFrame; import java.awt.GridBagLayout; import javax.swing.JPanel; import java.awt.GridBagConstraints; import javax.swing.JLabel; import javax.swing.BoxLayout; import java.awt.Dimension; public class DynScalingExample extends JFrame { public DynScalingExample() { getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.X_AXIS)); //---Panel 1 JPanel panel = new JPanel(); panel.setMaximumSize(new Dimension(20, 32767)); getContentPane().add(panel); GridBagLayout gbl_panel = new GridBagLayout(); gbl_panel.columnWidths = new int[]{0, 0}; gbl_panel.rowHeights = new int[]{0, 0}; gbl_panel.columnWeights = new double[]{1.0, Double.MIN_VALUE}; gbl_panel.rowWeights = new double[]{1.0, Double.MIN_VALUE}; panel.setLayout(gbl_panel); JLabel lblNewLabel = new JLabel("Test label"); GridBagConstraints gbc_lblNewLabel = new GridBagConstraints(); gbc_lblNewLabel.anchor = GridBagConstraints.WEST; gbc_lblNewLabel.gridx = 0; gbc_lblNewLabel.gridy = 0; panel.add(lblNewLabel, gbc_lblNewLabel…

http://stackoverflow.com/comment/33281470
comment on: http://stackoverflow.com/q/21964768
score: 1
has text: @HovercraftFullOfEels may the lord have mercy on us all, my good sir. May god have mercy on us all. (Thx for your answer btw, it was helpful.)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21984877
type: Answer
has body: Another way, that avoids floating point arithmetic and possible precision errors is something along these lines: int value = 497; int rounded = 0; int remainder = value % 100; if (remainder &gt;= 50) { rounded = value - remainder + 100; } else { rounded = value - remainder; } or simpler: int rounded = ((value + 50) / 100) * 100;
answers question: http://stackoverflow.com/q/21984578
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/comment/33100792
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21845261
has text: @Sanjeev i edited it so my circle class is there as well.
score: 0

configuration
tags question: http://stackoverflow.com/q/21882198
tags question: http://stackoverflow.com/q/21923178
tags question: http://stackoverflow.com/q/21888845
type: Tag
tags question: http://stackoverflow.com/q/21927755
tag name: configuration

http://stackoverflow.com/q/21958278
has comment: http://stackoverflow.com/comment/33269524
tagged with: outputstream
linked to: http://stackoverflow.com/q/9459657
has title: Understanding method synchronization in Java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21958329
has comment: http://stackoverflow.com/comment/33268973
tagged with: java
has answer: http://stackoverflow.com/a/21958336
type: Question
has comment: http://stackoverflow.com/comment/33269097
has comment: http://stackoverflow.com/comment/33269038
has comment: http://stackoverflow.com/comment/33269137
score: 0
answer count: 2
has body: I know thread synchronization. But in this code from the book Java Network Programming by Merlin Hughes, it is written that the println method synchronizes on System.out. I don’t understand how a method could be synchronized on System.out. Second question I wanna ask: Is the println function an overridden method or is it just a user defined method in this code? import java.io.*; public class SimpleOut { public static void main(String[] args) throws IOException { for (int i = 0; i &lt; args.length; i++) { println (args[i]); } } public static void println(String msg) throws IOException { synchronized (System.out) { for (int i=0 ; i&lt;msg.length(); i++) { System.out.write(msg.charAt (i) &amp; 0xff); } System.out.write('\n'); } System.out.flush(); } }

http://stackoverflow.com/q/21974387
has body: So this is my first time posting here. I am trying to read data from a file, create multiple objects from that data, and then place the created objects into an ArrayList. But every time I have tried, I just get multiple copies of the same object, instead of different objects. I am at my wits end. Anyways, here is the code for the method to read the data in from the file. Thanks in advance for any help! public void openShop() throws IOException{ System.out.println("What is the name of the shop?"); shopName = keyboard.nextLine(); setShopFile(); File openShop = new File(shopFile); if (openShop.isFile()){ Scanner shopData = new Scanner(openShop); shopName = shopData.nextLine(); shopOwner = shopData.nextLine(); while (shopData.hasNextLine()){ shopItem.setName(shopData.nextLine()); shopItem.setPrice(Double.parseDouble(shopData.nextLine())); shopItem.setVintage(Boolean.parseBoolean(shopData.nextLine())); shopItem.setNumberAvailable(Integer.parseInt(shopData.nextLine())); shopItem.setSellerName(shopData.nextLine()); shopInventory.add(shopItem); } setNumberOfItems(); } else System.out.println("That shop does not exist. Please try to open" + "the shop again."); isSaved = true; }
has answer: http://stackoverflow.com/a/21974439
answer count: 3
has answer: http://stackoverflow.com/a/21974431
has title: Problems reading data into an array list from a file in Java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21974434
tagged with: java
type: Question
score: 0

http://stackoverflow.com/comment/96094289
type: Comment
comment on: http://stackoverflow.com/a/34646639
score: 3
type: AnswerComment
has text: I think its good practice to call `taskScheduler.initialize();` before returning your instance of `taskScheduler`

http://stackoverflow.com/a/21960030
has comment: http://stackoverflow.com/comment/69052154
type: Answer
answers question: http://stackoverflow.com/q/21959686
score: 0
has body: You are getting errors 404 if you use /HelloWorld in the context path of your application. Either you have deployed to the wrong path or this path doesn't exist. Try to remove it from the URL. Also in the tutorial you have mentioned it's not used. The url http://localhost:8080/StrutsExample1/helloWorld.do
has comment: http://stackoverflow.com/comment/33272663

http://stackoverflow.com/comment/33233381
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21919994
type: AnswerComment
has text: @Thatdude1 Then the returned Area won't be equal to the input area. Just make that check afterwards.

http://stackoverflow.com/a/21918450
has comment: http://stackoverflow.com/comment/33198567
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33198261
has comment: http://stackoverflow.com/comment/33198294
answers question: http://stackoverflow.com/q/21918191
upvote count: 2
has comment: http://stackoverflow.com/comment/33198902
accepted answer of: http://stackoverflow.com/q/21918191
type: AcceptedAnswer
has body: This finds all overlapping sub-strings in a larger string. The non-regex way followed by the regex way. An interesting problem. import java.util.regex.Pattern; import java.util.regex.Matcher; /** &lt;P&gt;{@code java OverlappingSubstringsXmpl}&lt;/P&gt; **/ public class OverlappingSubstringsXmpl { public static final void main(String[] igno_red) { String sToFind = "cdc"; String sToSearch = "cdcdcdedcdc"; System.out.println("Non regex way:"); int iMinIdx = 0; while(iMinIdx &lt;= (sToSearch.length() - sToFind.length())) { int iIdxFound = sToSearch.indexOf(sToFind, iMinIdx); if(iIdxFound == -1) { break; } System.out.println(sToFind + " found at index " + iIdxFound); iMinIdx = iIdxFound + 1; } System.out.println("Regex way:"); Matcher m = Pattern.compile(sToFind, Pattern.LITERAL).matcher(sToSearch); boolean bFound = m.find(); while (bFound) { System.out.println(sToFind + " found at index " + m.start()); bFound = m.find(m.start() + 1); } } } Output: [C:\java_code\]java OverlappingSubstringsXmpl Non regex way: cdc found at index 0 cdc found at index 2 cdc found at index 8 Regex way: cdc found at index 0 cdc found at index 2 cdc found at index 8
type: Answer

http://stackoverflow.com/comment/33191716
comment on: http://stackoverflow.com/q/21914503
score: 0
type: Comment
type: QuestionComment
has text: Yes sorry just noticed and changed them all

http://stackoverflow.com/comment/33335720
type: AnswerComment
has text: Thanks that helped a bit. But then I'm still facing the problem that existing rows can also be edited or deleted by mods. Would it be an appropriate way to use some kind of XML or JSON to just save "changesets"?
type: Comment
comment on: http://stackoverflow.com/a/21993047
score: 0

http://stackoverflow.com/comment/33104921
has text: AHH FOUND IT! it was nothing but zoning out due to too much focusing on it. I was testing this method with a tester method that contains some points and player objects. I was manually changing position of an enemy piece to some coordinate to test the canEat method. i was actually changing the piece position instead of coordinate information which i feed the canEat method with. And now i also discovered a new potential problem to fix with this new cool recursive method!
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21865625

http://stackoverflow.com/q/21873479
has title: I'm trying to add image to new word doc with docx4j
favorite count: 0
has answer: http://stackoverflow.com/a/21875166
answer count: 1
score: 4
tagged with: java
tagged with: image
upvote count: 4
tagged with: docx4j
accepted answer: http://stackoverflow.com/a/21875166
type: AnsweredQuestion
downvote count: 0
has body: I'm trying to add image to new word document using docx4j. I've taken this code from online and modified it for my program, however I receive a strange error and I'm not sure what is causing it or how to debug it... Here's my code private static void test() { WordprocessingMLPackage wordMLPackage = null; try { wordMLPackage = WordprocessingMLPackage.createPackage(); } catch (InvalidFormatException e1) { // TODO Auto-generated catch block e1.printStackTrace(); javax.swing.JOptionPane.showMessageDialog(panel, "Cannnot create package."); } wordMLPackage.getMainDocumentPart().addStyledParagraphOfText("Title", "Hello Word! \n\t" + "Try This!"); byte[] bytes = null; try { bytes = convertImageToByteArray(); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); javax.swing.JOptionPane.showMessageDialog(panel, "Image file not found."); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); javax.swing.JOptionPane.showMessageDialog(panel, "Image file exception: " + e1.toString()); } try { addImageToPackage(wordMLPackage, bytes); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); javax.swing.JOptionPane.showMessageDialog(panel, "Cannot add image to package: " + e.toString()); } try { wordMLPackage.save(new java.io.File("HelloWord7.docx")); } catch (Docx4JException e) { // TODO Auto-generated catch block e.printStackTrace(); javax.swing.JOptionPane.showMessageDialog(panel, "Cannot save image to file."); } } private static void addImageToPackage(WordprocessingMLPackage wordMLPackage, byte[] bytes) throws Exception { BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage, bytes); int docPrId = 1; int cNvPrId = 2; Inline inline = imagePart.createImageInline("Filename hint", "Alternative text", docPrId, cNvPrId, false); P paragraph = addInlineImageToParagraph(inline); wordMLPackage.getMainDocumentPart().addObject(paragraph); } private static P addInli…
type: Question

http://stackoverflow.com/q/21887114
tagged with: java
possible better answer: http://stackoverflow.com/a/21890035
has comment: http://stackoverflow.com/comment/33143467
tagged with: forms
has answer: http://stackoverflow.com/a/21890035
type: Question
has comment: http://stackoverflow.com/comment/33142418
tagged with: servlets
has answer: http://stackoverflow.com/a/21891584
score: 0
answer count: 2
has body: I'm trying to use forms in my servlet code like this; out.println(" \n" + " \n" + " \n"); But I keep getting errors like BooksBought cannot be resolved to a variable. BooksBought is another servlet that works by itself so I know this is where the problem is. Please help. web.xml BooksBought BooksBought BooksBought BooksBought
linked to: http://stackoverflow.com/q/14018215
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/21891584
has comment: http://stackoverflow.com/comment/33143099
type: AnsweredQuestion
has title: Using html forms in servlet code not working

http://stackoverflow.com/comment/33243504
type: AnswerComment
score: 0
type: Comment
has text: Thank you for your answer. I also set BSSID, but ID still shows -1. Would you show me where I made a mistake for the configuration in the code? Thanks.
comment on: http://stackoverflow.com/a/21939402

http://stackoverflow.com/comment/33325996
comment on: http://stackoverflow.com/a/21882611
type: AnswerComment
has text: @SalmanAmaan The data from the blogs is stored on each `Object[]` contained on the list. Mapping is not the issue when you're using native queries. Your question is centered on the exception you're having and how to avoid it and the iteration is not the center of my answer, it's a particular hint as to how can you solve the exception issue instead of "making the necessary changes in your code" as you asked. The data is there, if you need further data update your select query. The new fields will be added as additional elements in the array.
score: 0
type: Comment

javabeans
tags question: http://stackoverflow.com/q/21945271
tags question: http://stackoverflow.com/q/21960763
tags question: http://stackoverflow.com/q/21926265
type: Tag
tags question: http://stackoverflow.com/q/21932411
tags question: http://stackoverflow.com/q/21904592
tags question: http://stackoverflow.com/q/21888084
tags question: http://stackoverflow.com/q/21866571
tags question: http://stackoverflow.com/q/21968432
tag name: javabeans

http://stackoverflow.com/comment/33480058
comment on: http://stackoverflow.com/q/21994504
type: Comment
has text: I fixed the problem: the package-info.java file was missing in the Eclipse project. Once I added it to the package following these instructions, everything started to work: http://stackoverflow.com/questions/8405336/how-do-i-use-or-edit-package-info-java
score: 1
type: QuestionComment

http://stackoverflow.com/comment/33107372
has text: It has to be in the same folder as the folder that the `java` process was started in. If you're developing in Eclipse, that will be the Project directory.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21867451
type: QuestionComment

http://stackoverflow.com/q/21930643
type: Question
linked to: http://stackoverflow.com/q/299628
has title: How to submit object to delete method in CXF REST?
score: 0
tagged with: rest
has answer: http://stackoverflow.com/a/21931136
answer count: 1
has body: I have REST services with cxf. My delete method cannot take a custom object: @DELETE @Path("/soemPath") @Produces({ "application/json", "application/xml" }) public void deleteStg(@PathParam("someId") String someId, CustomObject customObject) throws InvalidClientIdException, TermsOfUseBusinessException { However, I cannot give the customObject (soapui does not have option for this one). If I change the method to update, everything works fine. Can you please tell me how should I handle this to be able to transmit customObject as input param?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21931136
tagged with: cxf
tagged with: java

http://stackoverflow.com/comment/33248609
type: Comment
has text: how exactly ,can you explain ? i mean random number is generated right ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21946793

http://stackoverflow.com/a/21922850
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/121071719
accepted answer of: http://stackoverflow.com/q/21922632
has body: That artefact isn't in Maven Central (or other default repo) and so Maven won't find it automatically. The reficio/soap-ws page on Github explains: soap-ws is not yet located in the central maven repo, thus you also have to add an additional repository to your config. reficio http://repo.reficio.org/maven/
answers question: http://stackoverflow.com/q/21922632
has comment: http://stackoverflow.com/comment/33236679
upvote count: 4

http://stackoverflow.com/a/21924161
has comment: http://stackoverflow.com/comment/33209074
has comment: http://stackoverflow.com/comment/33208576
has body: member function can not be directly used as callback function, and it should be a funciton address ,not the return value of a function call you can not include a cc file #include "Kevin.cc" try this piece of code #include &lt;iostream&gt; #include &lt;time.h&gt; #include &lt;pthread.h&gt; using namespace std; class Kevin { public: Kevin(); static void* Speak(void* value); }; Kevin::Kevin() { cout &lt;&lt; "new instance of Kevin is created"; } void* Kevin::Speak(void* value) { cout &lt;&lt; "Name: Kevin\n" &lt;&lt; *((int*)value) &lt;&lt; " Seconds since epoch:" &lt;&lt; "\nThread id:" &lt;&lt; pthread_self() &lt;&lt; endl; } int main(int argc, char *argv[]) { Kevin kevin1; int status; pthread_t thrd_1; pthread_t thrd_2; int i = 1; int j = 2; pthread_create(&amp;thrd_1,NULL,Kevin::Speak,(void *)&amp;i); //14 pthread_create(&amp;thrd_2,NULL,Kevin::Speak,(void *)&amp;j); //15 pthread_join(thrd_1, (void **)&amp;status); pthread_join(thrd_2, (void **)&amp;status); system("PAUSE"); return EXIT_SUCCESS; } compile command g++ -o main main.cc -lpthread it outputs: new instance of Kevin is createdName: Kevin 1 Seconds since epoch: Thread id:3083348896 Name: Kevin 2 Seconds since epoch: Thread id:3074960288
answers question: http://stackoverflow.com/q/21924045
has comment: http://stackoverflow.com/comment/33208722
has comment: http://stackoverflow.com/comment/33208750
has comment: http://stackoverflow.com/comment/33208477
score: 0
upvote count: 1
type: Answer
downvote count: 1

http://stackoverflow.com/a/21948698
has comment: http://stackoverflow.com/comment/33254918
answers question: http://stackoverflow.com/q/21948551
has body: in your code : dOpacity= 0.0 int opacity = 7; float dOpacity = (float)opacity/10; //casting to float , here dOpacity=0.7 String sOpacity = Float.toString(dOpacity)+"f"; // sOpacity="0.7f" this.setOpacity(Float.parseFloat(sOpacity)); //setOpacity(0.7f);
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21948551

http://stackoverflow.com/a/25837058
upvote count: 1
answers question: http://stackoverflow.com/q/21922362
accepted answer of: http://stackoverflow.com/q/21922362
downvote count: 0
has body: For this specific site, the user and domain parts of the address are in the script tag, so select the script tag, get its text, parse that text with a regular expression, and concatenate the user and email with an @ in between. Your selector might just be script:contains(write_email), assuming write_email isn't used elsewhere on the page. This only works because the address is exposed in the text, even if it's in two pieces. In general, Jsoup is not a JavaScript engine. You might try a browser automation tool like Selenium if you want to see the same page a human using a web browser would see.
type: AcceptedAnswer
score: 1
type: Answer

http://stackoverflow.com/q/21861621
has comment: http://stackoverflow.com/comment/33097637
score: 1
tagged with: java
has body: So I have a user-defined binary tree class that I'd like to represent graphically. JTree seems to be the best option here. My class has a reference to its current position, to allow the user easier traversals and abstract the inner Node class. When the next is called, it traverses and returns the value of the Node. For the most part, I've been able to get these trees to work together, but I've run into an issue when the user adds a node. I have it set up so they can add either a left choice or a right choice - this matters with the data I'm keeping, so it needs to be this way - and I'm totally stuck on how to do this. The way I've implemented it currently irrevocably desyncs the trees, to the point of needing to quit and reinitialise to regain sync. Here are the methods I'm having problems with: Some info: -Here, dTree is an object of my tree class, and gTree is a JTree object (data tree, graphics tree) -The method getShortName(String) returns the normalised name used to represent the current node in the JTree, which is extrapolated from the dTree object. //Adds a new right node to the currently selected node. public void addNextR() { if(!dTree.hasNextR()) { dTree.addNextChoiceR("Empty Node"); DefaultMutableTreeNode node = ((DefaultMutableTreeNode)gTree.getSelectionPath().getLastPathComponent()); node.add(new DefaultMutableTreeNode(getShortName(dTree.getCurrent()))); expandTree(); } } //Adds a new left node to the currently selected node. public void addNextL() { if(!dTree.hasNextL()) { dTree.addNextChoiceL("Empty Node"); DefaultMutableTreeNode node = ((DefaultMutableTreeNode)gTree.getSelectionPath().getLastPathComponent()); node.add(new DefaultMutableTreeNode(getShortName(dTree.getCurrent()))); expandTree(); } } It would be much appreciated if anyone could help me with this problem, and I hope I've followed the correct procedure and given enough info. Sorry about the wall of text, I'm just trying to make sure I get my problem across. Thanks for at least reading thi…
has title: Binary Tree graphical representation troubles
type: Question
tagged with: jtree
has answer: http://stackoverflow.com/a/21861917
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33097407
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33097859
has comment: http://stackoverflow.com/comment/33097768
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/68427691
score: 2
has text: This should have been a comment on the accepted answer, not a whole new answer.
comment on: http://stackoverflow.com/a/40411151
type: AnswerComment
type: Comment

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/21915193
tags question: http://stackoverflow.com/q/21978569

http://stackoverflow.com/q/21917990
has answer: http://stackoverflow.com/a/21918055
accepted answer: http://stackoverflow.com/a/21918055
score: 1
upvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33197419
has title: How to effectively get "AS" column name like ResultSetMetaData?
tagged with: java
has body: I am doing this in order to read the result set into an array of hashmaps: ResultSetMetaData md = rs.getMetaData(); int columns = md.getColumnCount(); ArrayList list = new ArrayList(50); while (rs.next()){ HashMap row = new HashMap(columns); for(int i=1; i&lt;=columns; ++i){ row.put(md.getColumnName(i),rs.getString(i)); } list.add(row); } but when I do a query that is like "SELECT id AS contact_id from contacts" I am obviously getting id=>#### instead of the desired contact_id. What is the best way to go about this? This topic is super hard to search for. :P Thanks!
tagged with: mysql
answer count: 1
downvote count: 0
favorite count: 0
tagged with: resultset
has comment: http://stackoverflow.com/comment/33245524

http://stackoverflow.com/q/21961720
score: -1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33275515
tagged with: implements
has answer: http://stackoverflow.com/a/21961759
tagged with: methods
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33275496
tagged with: oop
has comment: http://stackoverflow.com/comment/33275495
tagged with: java
tagged with: class
has comment: http://stackoverflow.com/comment/33275686
accepted answer: http://stackoverflow.com/a/21961759
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33276148
favorite count: 0
has body: apologies if this is an easy question, I have a java class that implements Serializable public class product extends UnicastRemoteObject implements Serializable I wish however to use threading within the same class, can anyone point me in the right direction please it would be much appreciated. ** apologies please notice the change above
has title: Java already implementing a class

http://stackoverflow.com/a/21881948
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21881815
has body: if (Wh.equals(("kitchen") &amp;&amp; Kt.equals("refrigerator"))) It should be if (Wh.equals(("kitchen") &amp;&amp; Kt.equals("refrigerator"))) Same error for below two ifs if (Kt.equals(("refrigerator") &amp;&amp; yn.equals("no"))) if (Wh.equals(("kitchen") &amp;&amp; Kt.equals("cabinet")))

http://stackoverflow.com/comment/33238289
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21941207
has text: Duplicate of http://stackoverflow.com/questions/1612334/difference-between-dto-vo-pojo-javabeans for the pojo/bean question
score: 0

http://stackoverflow.com/comment/33136307
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21881923
has text: See my comment in rhinds question - a UserDetailsService doesn't do authentication (see [this FAQ](http://docs.spring.io/spring-security/site/docs/3.2.x/reference/htmlsingle/faq.html#faq-what-is-userdetailservice). You are best to implement an AuthenticationProvider directly if you want to encapsulate your own authentication code.

http://stackoverflow.com/a/21948859
answers question: http://stackoverflow.com/q/21948738
score: 3
has body: I think you're a little confused about how inheritance works for example, this slightly changed version of your code below class Player { private int money; private boolean bar; public Player() {} // I've added this guy, so your subclass is not forced to implement a similar constructor as Player(int money) public Player(int money) { this.money = money; bar = true; } public void setBar() { } } class SpecialPlayer extends Player { private long foo; public long getFoo() { return foo; } } with this structure, it's legal for example to do things like SpecialPlayer sp = new SpecialPlayer(); sp.getFoo(); //method specific to special player sp.setBar(); //method inherited from Player there's no sense on wrapping a Player inside SpecialPlayer, if you want SpecialPlayer to be a Player. UPDATE: how to assign the data from an existent Player into a SpecialPlayer Think on a class like a memory space. For example Object SpecialPlayer [X] money [X] bar [X] foo Object Player [X] money [X] bar [ ] foo So it's easy to see that you can do something like Player p = new SpecialPlayer() because p must know only the data from "money" and "bar" and, despite "foo" is still there, from p point of view, it's irrelevant, because all p knows is "money" and "bar" the opposite, sure, is not true, because SpecialPlayer sp = p will force the interpreter to resolve the problem of assigning the field "foo" for p. There are two situations here p is actually a SpecialPlayer, so you can just typecast it like sp = (SpecialPlayer)p. The interpreter will just realize that p was initially created as a SpecialPlayer and then, there's a "foo" somewhere. p is not a SpecialPlayer, but a pure Player. In this case, there's no way for the interpreter to guess what value "foo" must have. In java, there's no way to just let SpecialPlayer be initialized with the same fields it has from Player and assume for example that "foo" is null. In this case, you have to manually do this assignment, creating a method such as pu…
downvote count: 0
has comment: http://stackoverflow.com/comment/33253082
has comment: http://stackoverflow.com/comment/33252367
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/33252630

http://stackoverflow.com/comment/33304056
has text: `DoublyLinkedList` is neither a collection class from Java, nor something coming from de facto 3rd party lib. How do we suppose to know what's that and be able to guess the problem?
comment on: http://stackoverflow.com/q/21977453
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21935028
type: Answer
answers question: http://stackoverflow.com/q/21932694
score: 0
has body: It should be the difference between them - if the player is looking north, and the object delta x, delta z gives a bearing of 45 degrees then the needle should be in front and to the right at 45 (=45-0), if the player is looking south and tho object x,z is 45 then the needle should be behind and to the left at 225 or -135 (=45-180). Check that you've converted the result of Math.atan2 to degrees so you're subtracting values in the same units, and that the axes conventions are consistent. This says that +ve x-axis is east and +ve z-axis is south. A bearing of 0, North is given by atan2(0,1), which implies that you should be using Math.toDegrees(Math.atan2(deltaX, -deltaZ)) to get the bearing. When doing these sort of things, it's much easier to write up half a dozen unit tests which cover the cases and play with the signs to see what the effects are.

http://stackoverflow.com/comment/33343808
comment on: http://stackoverflow.com/q/21999925
has text: Post a [minimal complete example](http://stackoverflow.com/help/mcve) for better help sooner
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/21966363
has comment: http://stackoverflow.com/comment/55092315
has body: I want to know how I can hide that from GitHub without making my project private You cannot push that information to the repo then. What you can do is declaring a content filter driver which, on checkout, will check if it has access to a private source of information (elsewhere than your public repo, potentially elsewhere than GitHub), and generate the right file (which remains private, and is declared in the .gitignore). That content filter driver is declared in a .gitattributes, and is taking a template file (which is versioned but contains, by its nature, no value), and will generate the complete file with: default values (if the source of the private data isn't found) sensitive values (if the script has access to the private source of information)
score: 2
has comment: http://stackoverflow.com/comment/33296308
answers question: http://stackoverflow.com/q/21965869
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/33093490
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21860153
has text: You are going to get an `IllegalArgumentException` if your `remainder` is greater than 200.
score: 0

http://stackoverflow.com/comment/33295507
comment on: http://stackoverflow.com/a/21966440
score: 0
type: Comment
has text: yes Heading are coming but values seems completely coming under 1 column
type: AnswerComment

http://stackoverflow.com/comment/33237541
has text: @ZouZou thanks, my using [google calculator](https://www.google.com/#q=what+is+2+to+the+power+of+32+-+1) seems to have misled me and I expected a value of `4294967295`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21940693

http://stackoverflow.com/comment/33202771
type: Comment
has text: @AndresY. I suggest that you use a debugger to find out exactly which reference is null. It still seems like the NPE is caused by code which you are not showing here.
comment on: http://stackoverflow.com/q/21895625
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33262958
comment on: http://stackoverflow.com/q/21954902
score: 2
has text: http://www.google.fr/imgres?client=firefox-a&hs=Sdt&sa=X&rls=org.mozilla%3Afr%3Aofficial&channel=fflb&biw=1440&bih=787&tbm=isch&tbnid=JkxOWdynlQUgtM%3A&imgrefurl=http%3A%2F%2Fmontessoritoys.com%2Fwooden-toys%2F&docid=tg7rW6co608QMM&imgurl=http%3A%2F%2Fmontessoritoys.com%2Fwp-content%2Fuploads%2F2011%2F02%2Fshape-cube.jpg&w=300&h=300&ei=KaYIU_PaKMqO0AXo14D4Aw&zoom=1&iact=rc&dur=2229&page=2&start=27&ndsp=34&ved=0CIICEK0DMDc :-)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22002480
has comment: http://stackoverflow.com/comment/33348091
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22002447
accepted answer of: http://stackoverflow.com/q/22002447
type: AcceptedAnswer
upvote count: 3
type: Answer
has body: The issue is that you are adding a new character into the string, but not incrementing the index to account for that. Try this (note, I haven't tested it, but it should work correctly. If you have an extra dash at start or finish, just remove them afterward): public static String expand (String word) { int stringLength = word.length(); for (int x=1; x&lt;(stringLength-1)*2; x+=2){ word = new StringBuffer(word).insert(x, "-").toString(); } return word; }
has comment: http://stackoverflow.com/comment/33348266
has comment: http://stackoverflow.com/comment/33348229
has comment: http://stackoverflow.com/comment/33348106

http://stackoverflow.com/comment/33346955
type: QuestionComment
score: 0
has text: Try something. Write or talk out loud in words what needs to be done. Then do it. You know you need some cards, what ones and how many do you need?
comment on: http://stackoverflow.com/q/22001625
type: Comment

http://stackoverflow.com/comment/33176143
has text: @triclosan Yes, because the Android client can connect to a java server that I first tried it on (Running on the same machine I'm trying to run the C server on)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21906162

http://stackoverflow.com/q/21987420
has comment: http://stackoverflow.com/comment/33320971
score: 0
has answer: http://stackoverflow.com/a/21988483
tagged with: maven
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/21987534
tagged with: tycho
tagged with: java
has body: I am facing a unique issue - I have a plugin dependency which is present in multiple repositories. The version number is same just the snapshot qualifier( time-stamp is different ). Is there a way I can force Maven/Tycho to prefer the snapshot from a particular repository? EDIT : They are P2 plugin repositories created for Eclipse PDE Build
has comment: http://stackoverflow.com/comment/33322205
possible better answer: http://stackoverflow.com/a/21991322
has answer: http://stackoverflow.com/a/21991322
answer count: 4
accepted answer: http://stackoverflow.com/a/21988483
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33320651
has answer: http://stackoverflow.com/a/21987547
has title: Snapshot dependency present in multiple repositories
tagged with: eclipse-plugin
favorite count: 0
type: Question

http://stackoverflow.com/comment/33269329
type: Comment
comment on: http://stackoverflow.com/a/21958176
score: 0
type: AnswerComment
has text: Yes. I added it to all the drawable folders

http://stackoverflow.com/comment/33151258
has text: Yes. But it didn't come out like that. I'll edit above
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21891737
type: AnswerComment

http://stackoverflow.com/comment/33196075
score: 0
type: Comment
has text: When I am trying to map line 151 by copy-pasting your code to eclipse it does not come in signIn() method. Which code snippet is pointing to line 151? Also, please put logger or else debug point to see whether you are able to connect with DB by inspecting Connection object.
type: QuestionComment
comment on: http://stackoverflow.com/q/21871332

http://stackoverflow.com/comment/33095119
type: Comment
comment on: http://stackoverflow.com/a/21861111
has text: Not if you want to 'extend' it you can't.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33269640
type: Comment
score: 1
type: AnswerComment
has text: I correct myself, he should use layout manager not using null layout
comment on: http://stackoverflow.com/a/21958425

http://stackoverflow.com/a/21909939
has comment: http://stackoverflow.com/comment/33183361
has comment: http://stackoverflow.com/comment/33183715
score: 2
has body: $ECLIPSE_HOME is not needed here, you either need to set $PATH to include the path to your eclipse executable or you can start eclipse from the terminal giving the full path to the executable, e.g. /opt/ALL_myprograms/eclipse/eclipse
accepted answer of: http://stackoverflow.com/q/21909742
has comment: http://stackoverflow.com/comment/33182902
answers question: http://stackoverflow.com/q/21909742
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33182623
upvote count: 2
has comment: http://stackoverflow.com/comment/33183134
type: Answer

http://stackoverflow.com/comment/33239863
has text: 1) construct a 2D array with number of rows equal to number of lines in the dataset. 2) read in line by line, add each word to a HashMap<String,Object> where String is the word, Object contains number of occurrences and a list of indexes (col, row) to find where this word occurs in the whole dataset. 3) I convert the line to a StringArray and add it to the 2D array as a row. 4) I sort the HashMap based on occurrences 5) For each word that has occurrences <= treshold, I take the (col, row) values and remove those 6) Read out the 2D array
comment on: http://stackoverflow.com/q/21941948
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21899569
has title: Ping an external server automatically every 30 mins
type: Question
tagged with: network-programming
upvote count: 0
has body: I have a set of servers in a list. I want to ping these servers every 30 mins.How can I achieve this.it's a jsp program with java code.
tagged with: jsp
has comment: http://stackoverflow.com/comment/33164712
has answer: http://stackoverflow.com/a/21899682
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33170592
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33164748
score: -3
tagged with: java
downvote count: 3

http://stackoverflow.com/comment/33247162
has text: ah you describe what my week has felt like with that simple phrase "... pound these into an Tomcat...". Thank you for the answer. The private PKI discussion is not something I follow, but I don't think I need to. The discussion regarding using the openssl api is interesting. The flow certainly helps solidify my understanding of events. Thanks.
comment on: http://stackoverflow.com/a/21944958
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33107308
type: QuestionComment
comment on: http://stackoverflow.com/q/21867456
has text: I would sort it this way: `int[] sides = {side1, side2, side3}; Arrays.sort(sides);`
score: 0
type: Comment

http://stackoverflow.com/comment/110256575
comment on: http://stackoverflow.com/q/21977704
type: Comment
type: QuestionComment
has text: @HotLicks I've found myself having the same issue, would you mind to point on where to look for these Apache utilities to find the equivalent function/method?
score: 0

http://stackoverflow.com/q/21854358
answer count: 2
has title: Can you put a basic command line java program on the cloud?
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: hosting
has answer: http://stackoverflow.com/a/21855229
tagged with: java
tagged with: web-applications
has body: I currently have a simple java command line program that i want to put up on the cloud in which users can play blackjack on the command line. Is their any cloud services that i can use the same java code that i currently have or will i need to rewrite the code for a specific engine. I looked into Google App engine https://developers.google.com/appengine/ but was a bit unsure as to whether it could be done. Any help would be greatly appreciated.
type: Question
tagged with: cloud
has answer: http://stackoverflow.com/a/21855165
score: 0

http://stackoverflow.com/comment/33069912
type: QuestionComment
score: 2
has text: If you handle javascript - why not? But you can use gwt/json services.
comment on: http://stackoverflow.com/q/21846936
type: Comment

http://stackoverflow.com/a/21994093
has body: In your Test class you have ArrayList grades = null; - you need to create the grades ArrayList and fill it with data before using it.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21994005
upvote count: 1
score: 1

rpc
tag name: rpc
type: Tag
tags question: http://stackoverflow.com/q/21913859

http://stackoverflow.com/comment/33337732
type: Comment
has text: @Dejel: To keep Profile of sub cat items... it may vary with category
type: AnswerComment
comment on: http://stackoverflow.com/a/21995577
score: 0

http://stackoverflow.com/q/21971664
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33293065
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33293045
has comment: http://stackoverflow.com/comment/33293042
type: Question
has comment: http://stackoverflow.com/comment/33293073
has comment: http://stackoverflow.com/comment/33293092
has body: I am relatively a newbie in android though have intermediate knowledge of Java. I am trying to understand AsyncTask&lt;&gt; I notice different parameters are passed e.g AsyncTask&lt;Object, String, Boolean&gt; AsyncTask&lt;Integer, Void, Bitmap&gt; into the angle brackets. Please What should or can those parameters be? Thanks Community.
has title: What decides the parameters to pass in to the AsynTask class <>?
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/21971802
accepted answer: http://stackoverflow.com/a/21971802
favorite count: 0
tagged with: android-asynctask

http://stackoverflow.com/comment/33225402
type: Comment
comment on: http://stackoverflow.com/q/21934149
score: 0
type: QuestionComment
has text: your working code : http://ideone.com/xFrQzY

http://stackoverflow.com/a/21972226
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21971831
answers question: http://stackoverflow.com/q/21971831
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/33294517
upvote count: 3
has comment: http://stackoverflow.com/comment/33294462
has body: Why you use that button there is it need! That must work without any button like that: @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.main, menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_new1: Intent intent = new Intent( getActivity(), Login.class); getActivity().startActivity(intent); return true; default: return super.onOptionsItemSelected(item); } }

http://stackoverflow.com/q/21869941
tagged with: arrays
has answer: http://stackoverflow.com/a/21871192
downvote count: 0
tagged with: jsp
has body: I have a jsp page which contains a hidden field with array value. &lt;input value="[Ljava.lang.String;@9700b4" name="val0" type="hidden"&gt; Now in java file which is servlet i want this array. So code like this, String str[] = request.getParameterValues("val0"); But this one gives me array and my actual array is at 1st index of that array. How can i get array values in my servlet page?
has title: How to fetch Array value from hidden field in Servlet?
favorite count: 0
has answer: http://stackoverflow.com/a/21871456
has comment: http://stackoverflow.com/comment/33114325
answer count: 5
has answer: http://stackoverflow.com/a/21872113
has answer: http://stackoverflow.com/a/21871324
has answer: http://stackoverflow.com/a/22334462
upvote count: 3
type: AnsweredQuestion
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/22334462
tagged with: servlets
type: Question
possible better answer: http://stackoverflow.com/a/21871192

http://stackoverflow.com/comment/33300409
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21972375
has text: Register a setOnFailed (or use a try-catch in your call) to see if an Exception is being thrown.
score: 0

http://stackoverflow.com/q/21954071
type: UnansweredQuestion
tagged with: onclick
tagged with: java
has body: I have a very simple question. I have an EditText, that when clicked on, opens a DatePickerDialog. However, repeatedly clicking on the EditText opens several dialogs. Is there any way to restrict the user from doing this, so that only one dialogue is displayed regardless of how many times the EditText is clicked on? Here is my EditText in my XML file: &lt;EditText android:id="@+id/etSetDate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/spDifficultyLevel" android:drawableLeft="@drawable/ic_calendar_view" android:ems="10" android:focusableInTouchMode="false" android:hint=" Set Date" /&gt; Here is the code: /** * Where user selects date, launch datepicker on click */ public void selectDate() { etSetDate.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { //launch datepicker DialogFragment dialogFragment = new StartDatePicker(); dialogFragment.show(getSupportFragmentManager(), "start_date_picker"); } }); } public class StartDatePicker extends DialogFragment implements DatePickerDialog.OnDateSetListener { Calendar c = Calendar.getInstance(); int startYear = c.get(Calendar.YEAR); int startMonth = c.get(Calendar.MONTH); int startDay = c.get(Calendar.DAY_OF_MONTH); @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the current date as the default date in the date picker DatePickerDialog dialog = new DatePickerDialog(getActivity(), this, startYear, startMonth, startDay); return dialog; } }
type: Question
upvote count: 4
answer count: 2
downvote count: 0
tagged with: android-datepicker
score: 4
has answer: http://stackoverflow.com/a/21954543
has comment: http://stackoverflow.com/comment/33261396
has title: Stop user multi-clicking on edittext to open several dialogues
tagged with: android
has comment: http://stackoverflow.com/comment/33261359
has comment: http://stackoverflow.com/comment/33261404
favorite count: 0
has answer: http://stackoverflow.com/a/21954155
tagged with: android-edittext

http://stackoverflow.com/comment/33307367
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21979631
type: Comment
has text: For better help sooner, post a [MCTaRE](http://stackoverflow.com/help/mcve) (Minimal Complete Tested and Readable Example).

http://stackoverflow.com/comment/33112668
type: QuestionComment
comment on: http://stackoverflow.com/q/21870613
has text: what is the question here ?\
type: Comment
score: 0

http://stackoverflow.com/a/21948924
downvote count: 0
has body: Most JSON parser/generator libraries have a type for each of the JSON types. Gson has JsonElement and its sub types. Here's an example where you can chain calls. public static void main(String[] args) throws Exception { String jsonString = "{\"property1\":\"someValue\", \"arrayProperty\":[{\"first\":1234, \"second\":-13.123}, {\"nested\":\"so deep\"}], \"finally\":\"last\"}"; Gson gson = new Gson(); JsonElement element = gson.fromJson(jsonString, JsonElement.class); System.out.println(element); JsonObject jsonObject = element.getAsJsonObject(); // should test type before you do this System.out.println(jsonObject.get("arrayProperty").getAsJsonArray().get(0)); } prints {"property1":"someValue","arrayProperty":[{"first":1234,"second":-13.123},{"nested":"so deep"}],"finally":"last"} {"first":1234,"second":-13.123} The above is more or less implemented with a LinkedTreeMap for JsonObject and a List for JsonArray. It provides wrappers to access the elements as more JsonObject, JsonArray, JsonNull, and/or JsonPrimitive instances.
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21948787
type: Answer
answers question: http://stackoverflow.com/q/21948787
score: 2

http://stackoverflow.com/comment/33135995
type: QuestionComment
comment on: http://stackoverflow.com/q/21882245
has text: @mthmulders I've already tried that too. The tests run fine in Netbeans (either using `Run > Test File` or `ant test`)
score: 0
type: Comment

http://stackoverflow.com/comment/33199001
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21918637
has text: Thanks but what about performance ? All my services use this generic method (create)

http://stackoverflow.com/a/21862995
answers question: http://stackoverflow.com/q/21862761
downvote count: 0
has body: Some setter methods return the previous value of the thing being set. For instance, Map.put(key,value) returns the previous value associated with the key. You might use that idiom to finish your method with: return setField( null ); to both set the field to null, and to return its (prior) value. This is certainly a little bit shorter: it turns three lines into one (at the cost of moving them someplace else, but that's not so much of a concern). Whether this is clearer or not, though, depends on whether your codebase makes much use of the "return the previous value" idiom. If you're not using it elsewhere, then this code isn't very clear (but you can add a comment, of course). If you use this idiom here, and you're using a "return the new value" idiom elsewhere (e.g., for method chaining), then this become very opaque. Aside from those issues of clarity, it's also worth noting that this does violate the typical convention and JavaBeans "protocol" of setters being void methods. It also becomes a bit hairy if you have lots of these kinds of fields, as you start to need such a method for each one. Your code would be like this: class Foo { T field; T method() { .... return setField( null ); } T setField( T value ) { T old = field; field = value; return old; } }
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33098970
has comment: http://stackoverflow.com/comment/33099259

http://stackoverflow.com/q/21892072
linked to: http://stackoverflow.com/q/6494557
score: 2
type: AnsweredQuestion
downvote count: 0
has title: How to check whether @Schedule annotation (Spring 3.1) cron job is running.
has body: In my application I have one cron job which connects to a FTP server and transfer files, a very simple functionality and it is configured using spring @Schedule annotation with cron expression as a parameter. It was running fine for few months and then suddenly it stopped, got the connectException. May be the FTP server was down or something happened which causes the cron thread to stop. I looked (google) for the reasons but didnt get any ( Nothing much in the logs also - Just the exception name ).It may be a one time thing :) my question is that can I put some check or watcher on the @Schedule cron job to know whether it is running or not ? Sorry for my bad explanation/english Thanks
tagged with: spring
has comment: http://stackoverflow.com/comment/33151703
accepted answer: http://stackoverflow.com/a/21893106
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21893106
upvote count: 2
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33151534
tagged with: cron

http://stackoverflow.com/comment/33217818
has text: I actually think it is a good question that most people may overlook when they talk about `protected` in Java. Blaming OP not testing in an IDE is not reasonable, as he is not asking what is the correct answer for that SCJP question, he is asking "Why NOT 'F'" which I think is a valid question (although OP can give a bit more background on why he think F should also be part of the answer)
comment on: http://stackoverflow.com/q/21927752
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33089902
score: 0
type: AnswerComment
has text: That's quite possible, but we'll need the op to post that code before we can tell..
comment on: http://stackoverflow.com/a/21857907
type: Comment

http://stackoverflow.com/comment/48980222
comment on: http://stackoverflow.com/q/21964375
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [How do I keep the Thread of an IntentService alive?](http://stackoverflow.com/questions/11700288/how-do-i-keep-the-thread-of-an-intentservice-alive)

http://stackoverflow.com/a/21875916
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21872476
has comment: http://stackoverflow.com/comment/33138363
type: Answer
has body: If you need your files to be in that format so that you can open them in a text editor then I would use a BufferedReader to read the file then read in each line as a string and split the line first at each space then at each comma, then parse the string to return your number. try(BufferedReader in = new BufferedReader(new FileReader("file"))){ String line; while((line=in.readLine())!=null){ String[] values = line.split(" "); for(String v:values){ String[] coords = v.split(","); int x = Integer.parseInt(coords[0]); int y = Integer.parseInt(coords[1]); } However an easier way to do this may be to simply write the int values directly from your map editor instead of converting them to strings. If you do this then you would save space and all you would need to do to read the data is: try(DataInputStream in= new DataInputStream(new BufferedInputStream(new FileInputStream(new File("file"))))){ int numValues=in.readInt(); for(int i=0;i&lt;numValues;i++){ int x = in.readInt(); int y = in.readInt(); } } And in your map editor to save the map you would just write the number of tiles to the file and then each of the tiles' x and y coordinates with writeInt() and a DataOutputStream. You may also want to write the width and height of the map to the file so that you can reconstruct it if those are not constant, or the coordinates of the tile on the map.
has comment: http://stackoverflow.com/comment/33138274
has comment: http://stackoverflow.com/comment/33139372
has comment: http://stackoverflow.com/comment/33139555
score: 0
accepted answer of: http://stackoverflow.com/q/21872476

http://stackoverflow.com/q/21903185
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1467913
has answer: http://stackoverflow.com/a/21903779
answer count: 4
has answer: http://stackoverflow.com/a/21903747
tagged with: java
score: -1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21903392
has answer: http://stackoverflow.com/a/21903377
upvote count: 0
has body: I have this code is to find the indexOf 3 elements in array, so I used java.util.. etc, but it gives me that there I mistake the result is -1, how to avoid this wrong answer, and is there another way to write this code int array [] = {1,0,1,0,0,1,1,0,1,1}; for(int counter = 0 ; counter &lt; 3; counter++) System.out.printf("%5d%8d\n",java.util.Arrays.asList(array). indexOf(array[randomNumbers.nextInt(10)]),array[randomNumbers.nextInt(10)]);
has title: indexOf int array elements
favorite count: 0

http://stackoverflow.com/comment/33285359
score: 0
comment on: http://stackoverflow.com/q/21966783
has text: Why not use a Service instead?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21907802
has title: CompareTo() method gives different results in differnt java versions
has comment: http://stackoverflow.com/comment/33178597
answer count: 2
has comment: http://stackoverflow.com/comment/33178897
has answer: http://stackoverflow.com/a/21908886
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33179432
has answer: http://stackoverflow.com/a/21908249
has comment: http://stackoverflow.com/comment/33179082
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33179057
has comment: http://stackoverflow.com/comment/33179178
has comment: http://stackoverflow.com/comment/33179094
tagged with: collections
has comment: http://stackoverflow.com/comment/33178908
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33178550
has body: I have the following java collections code. The main theme is that sorting the "Employee" objects based on their ids, but I have one problem here by writing "Collections.sort()" method. When "jvm" executes the "Collections.sort(al)", java 1.6 gives result as 50 and 60 in compareTo() method ie it calls e1.compareTo(e2). whereas in java 1.7 gives result as 60 and 50 in compareTo() method ie it calls e2.compareTo(e1). What actually "this" holds whether e1 or e2. What is the actual problem. Is "Jvm" Calling "e2.compareTo(e1)" in in java1.7 and "e1.compareTo(e2)" in java1.6 ? class Employee implements Comparable&lt;Employee&gt; { int eid;String name; Employee(String name,int eid){ this.name=name; this.eid=eid; } public int compareTo(Employee e) { int eid1=this.eid; int eid2=e.eid; System.out.println(eid1); System.out.println(eid2); System.out.println("-------------"); if(eid1&lt;eid2) return -1; if(eid1&gt;eid2) return +1; else return 0; }} public class ForEmployee { public static void main(String[] args) { Employee e1=new Employee("raja",50); Employee e2=new Employee("rani",60); ArrayList&lt;Employee&gt; al=new ArrayList&lt;Employee&gt;(); boolean a=al.add(e1); boolean b=al.add(e2); Collections.sort(al); }}

http://stackoverflow.com/a/21955679
score: 2
has body: I will try to explain what JB Nizet and others tried in the comments. In a simplified manner to make it understandable. A Date is nothing else but a long which represents the time since epoch and a nice toString() method. Basically. So if you create a Date date = new Date(); it sets the date's time value to System.currentTimeMillis();, nothing more, nothing less. The interesting thing is that the Unix time is already "in UTC (=GMT)", if you want to say so. If you now print the date like this Date date = new Date(); System.out.println(date); you implicitly call date.toString();. This toString() can be seen as follows: public String toString() { return new SimpleDateFormat("E MMM dd HH:mm:ss z YYYY").format(this); } The SimpleDateFormat uses by default YOUR timezone. But it doesn't change the value of the date at all, it just prints it in another way. If you now want to see the date in GMT you can simply set the SimpleDateFormat yourself: Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("E MMM dd HH:mm:ss z YYYY"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); System.out.println(sdf.format(date)); To push it further you could now write a simple static method somewhere to print dates in specific timezones: public static void printDate(Date date) { printDate(date, "GMT"); } public static void printDate(Date date, String timeZone) { printDate(date, TimeZone.getTimeZone(timeZone)); } public static void printDate(Date date, TimeZone timeZone) { SimpleDateFormat sdf = new SimpleDateFormat("E MMM dd HH:mm:ss z YYYY"); sdf.setTimeZone(timeZone); System.out.println(sdf.format(date)); } To see what we all are talking about (that the timestamp does never change) you can print both: public static void printDate(Date date, TimeZone timeZone) { SimpleDateFormat sdf = new SimpleDateFormat("E MMM dd HH:mm:ss z YYYY"); sdf.setTimeZone(timeZone); System.out.println(sdf.format(date) + " has the timestamp " + date.getTime()); } If we now do some simple tests we see the…
answers question: http://stackoverflow.com/q/21954902
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/33094180
comment on: http://stackoverflow.com/q/21860573
type: Comment
type: QuestionComment
score: 3
has text: String literals are not best example here because of string pool. Also both your examples creates "new instance" in each loop iteration.

http://stackoverflow.com/q/21930501
tagged with: database
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33218914
type: Question
tagged with: jdbc
has answer: http://stackoverflow.com/a/21930640
has comment: http://stackoverflow.com/comment/33219476
has answer: http://stackoverflow.com/a/21931818
answer count: 2
has title: Functions of jdbc Driver
score: 0
tagged with: java
tagged with: odbc
has body: Why jdbc odbc driver written as jdbc.odbc.JdbcOdbcDriver or sun.jadbc.odbc.JdbcOdbc Driver? In which file the name is stored? eg. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") And What are the functions of jdbcodbc driver and odbc driver?

http://stackoverflow.com/q/21962153
favorite count: 0
has body: First of all sorry for a little dummy question. I want to ask JVM professionals. Assume that you have a working java application. Are there some JVM APIs (JVM TI) that can give me an information about what methods is being called now, what arguments do they get and what values do they return. If yes, why there are no such testing java tools, that can rely on this information and produce jUnit tests?
downvote count: 0
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/21962232
score: 1
tagged with: java
has title: How to look inside JVM(?). Can I profile methods, arguments, return values etc in working application?
answer count: 2
upvote count: 1
tagged with: profiling
has answer: http://stackoverflow.com/a/21962221
tagged with: jvm

http://stackoverflow.com/comment/33168893
score: 1
comment on: http://stackoverflow.com/q/21902057
has text: its quite confusing .. whats ur expectation?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33327858
score: 0
has text: You can use a hack-y way, which is to grab the full javac filepath, like so `"C:\my programs\java\jdk_bin167etc\javac.exe" myheyworld.java`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21991483

http://stackoverflow.com/a/21858056
has body: Consider reading the API page for ByteBuffer. ByteBuffer get(byte[]) and ByteBuffer get(byte[] dst, int offset, int length)
answers question: http://stackoverflow.com/q/21857854
upvote count: 1
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/62632994
type: Comment
has text: Please upvote this question, or else I can't get the bronze badge for maintaining a positive question record.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21964937

java-io
tags question: http://stackoverflow.com/q/21852289
tags question: http://stackoverflow.com/q/21847567
tags question: http://stackoverflow.com/q/22001529
tags question: http://stackoverflow.com/q/21916942
tags question: http://stackoverflow.com/q/21952044
tags question: http://stackoverflow.com/q/21989887
tags question: http://stackoverflow.com/q/21852231
tags question: http://stackoverflow.com/q/21941345
tags question: http://stackoverflow.com/q/21938864
tags question: http://stackoverflow.com/q/21872021
type: Tag
tags question: http://stackoverflow.com/q/21976093
tag name: java-io

http://stackoverflow.com/comment/33198047
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21918275
has text: @Quincunx yes, i mean this, i wrote "number1" as an example
type: Comment

http://stackoverflow.com/comment/33095090
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21860573
has text: @HotLicks I assume that your last comment was for me. From examples it seems that OP uses new instances only inside loops. Is JIT smart enough to notice this and use this info to optimize both examples to act the same? I am just asking from curiosity, because it seems like possible thing.
score: 0

http://stackoverflow.com/q/21981940
tagged with: spring
tagged with: cxf
tagged with: java
tagged with: wss4j
type: Question
has title: Spring: configure a static field singleton instance
answer count: 2
has answer: http://stackoverflow.com/a/24247012
has body: There is CXF's PolicyBasedWSS4JInInterceptor that creates a singleton instance: public static final PolicyBasedWSS4JInInterceptor INSTANCE = new PolicyBasedWSS4JInInterceptor(); Having no Spring skills I'm struggling with how to set its acestor's (AbstractWSS4JInterceptor) properties map via Spring's bean definitions in a cxf.xml file. Basically I want to configure WSS-related properties like "signaturePropFile" in cxf.xml. Can someone show how to set the property map of PolicyBasedWSS4JInInterceptor.INSTANCE? Thanks!
score: 0
has answer: http://stackoverflow.com/a/21982103
type: UnansweredQuestion

http://stackoverflow.com/q/21861483
type: UnansweredQuestion
type: Question
has title: OWL:Nothing dl query issue
has comment: http://stackoverflow.com/comment/33117769
has body: I have written an interface that given for example the Pizza ontology it can distinguish between asserted and inferred axioms. For example, given Class: Food SubClassOf: Thing it will tell you that it is inferred. My question is that if I have an unsatisfiable class TomatoTopping, and I want to know if Class: TomatoTopping SubClassOf: Nothing is asserted, inferred or none, I will get the response that the axiom doesn't exist. Although I can see TomatoTopping under Nothing in the hierarchy. What is the problem? Can't I query such an axiom or my logic is flawed? This is the code that identifies Class: Food SubClassOf: Thing but not Class: TomatoTopping SubClassOf: Nothing // parsing input Set&lt;OntologyAxiomPair&gt; frame = parsingProcess(tool, input); Iterator&lt;OntologyAxiomPair&gt; frameit = frame.iterator(); while (frameit.hasNext()) { OntologyAxiomPair newPair = frameit.next(); OWLAxiom tempAx = newPair.getAxiom(); // the axiom type must be anything but declaration if (!tempAx.isOfType(AxiomType.DECLARATION)) { // get asseted and inferred axioms Set&lt;OWLAxiom&gt; asserted = getOntology().getAxioms(); if (asserted.contains(tempAx)) { Result = "System: this axiom is an asserted axiom."; displayUserMessage(Result, asetBlue); break; } // Use an inferred axiom generators else { // Calling TrOWL RELReasoner reasoner = relfactory.createReasoner(getOntology()); if(reasoner.isEntailed( tempAx)){ Result = "System: this axiom is an inferred axiom."; displayUserMessage(Result, asetMagenta); break; } } } } I think I discovered what the problem is. The Manchester Syntax parser needs a datafactory. OWLOntologyManager manager = inputOntology.getOWLOntologyManager(); this.dataFactory = manager.getOWLDataFactory(); Since the manager is not classified by a reasoner, the OWL:Nothing does not appear. Do you know of a way to classify a manager and then extract datafactroy?
tagged with: java
has comment: http://stackoverflow.com/comment/33099882
has comment: http://stackoverflow.com/comment/33097037
tagged with: owl-api
score: 0
tagged with: owl
has comment: http://stackoverflow.com/comment/33124666
answer count: 0

http://stackoverflow.com/q/21974106
favorite count: 0
type: Question
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/21974128
tagged with: oop
tagged with: java
has body: Current I have code like this: public void processAnimal(Animal a){ if (a instanceof Cat){ processCat((Cat)a); } else if (a instanceof Dog){ processDog((Dog)a); } else if (a instanceof Bird){ processBird((Bird)a); } } public void processCat(Cat c){ ... } public void processDog(Dog d){ ... } public void processBird(Bird b){ ... } Is there any way to get rid of the boilerplate if statements? Update: I have a set of models that get processed differently in different locations. Imagine each one of these are pets. A petstore may want to have a cat interact with other cats, and dogs interact with other dogs, wheras a home may want to have dogs and cats in the same locations. So each model won't know how to interact in the given situations.
has title: Correct way to manage inheritance
has comment: http://stackoverflow.com/comment/33297433
has comment: http://stackoverflow.com/comment/33297317
has comment: http://stackoverflow.com/comment/33297415
type: UnansweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/q/21853300
score: 0
has answer: http://stackoverflow.com/a/21853514
has comment: http://stackoverflow.com/comment/33080933
answer count: 1
accepted answer: http://stackoverflow.com/a/21853514
tagged with: swing
has comment: http://stackoverflow.com/comment/33080896
type: AnsweredQuestion
tagged with: java
has title: Get mouse position without being on main form
type: Question
has body: How do i get mouse position coordinates without being in form? Im using this code to get position: int x =getMousePosition().x; int y=getMousePosition().y; jTextCoordenadaRatoX.setText(String.valueOf(x)); jTextCoordenadaRatoY.setText(String.valueOf(y)); If i execute this code without being on "main form" the code above doesnt work. Thank you.

apache
tags question: http://stackoverflow.com/q/21976752
tag name: apache
tags question: http://stackoverflow.com/q/21869225
tags question: http://stackoverflow.com/q/21964601
tags question: http://stackoverflow.com/q/21852765
tags question: http://stackoverflow.com/q/21965526
tags question: http://stackoverflow.com/q/21960522
tags question: http://stackoverflow.com/q/21965379
tags question: http://stackoverflow.com/q/21875264
tags question: http://stackoverflow.com/q/21998405
tags question: http://stackoverflow.com/q/21968815
tags question: http://stackoverflow.com/q/21977355
tags question: http://stackoverflow.com/q/21964316
tags question: http://stackoverflow.com/q/21907513
tags question: http://stackoverflow.com/q/21850298
tags question: http://stackoverflow.com/q/21987639
tags question: http://stackoverflow.com/q/21921196
tags question: http://stackoverflow.com/q/21888652
type: Tag
tags question: http://stackoverflow.com/q/21966756
tags question: http://stackoverflow.com/q/21979933
tags question: http://stackoverflow.com/q/21929989
tags question: http://stackoverflow.com/q/21950428

http://stackoverflow.com/comment/33272631
type: Comment
has text: You haven't asked any question.
comment on: http://stackoverflow.com/q/21960140
type: QuestionComment
score: 0

http://stackoverflow.com/a/21851879
score: 10
has body: // "is" used because the value can be either true or false. It's like asking isTrue? public boolean isPrimitive() { return primitive; } // "get" is used because the value returned can be either true, false or null. // So, the third state 'null' makes you wonder if 'is' should be used or 'get'. // "get" is more appropriate as Boolean can also have null. public Boolean getObject() { return object; } But frankly, it's left to the developer. There's nothing "wrong" in using getBoolean() on a boolean value (is makes more sense, that's it).
upvote count: 10
type: Answer
answers question: http://stackoverflow.com/q/21851708
downvote count: 0
has comment: http://stackoverflow.com/comment/132592887

http://stackoverflow.com/comment/71091139
score: 0
has text: @NagarajanShanmuganathan: Support for Patch request is provided play 2.4 onwards. https://www.playframework.com/documentation/2.4.x/JavaRouting
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21964721

http://stackoverflow.com/comment/33305003
has text: @VexSilver Getting rude doesn't help here though. And Alexei isn't that wrong, you always should keep your questions neutral and in formal style here.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21977925
score: 1

http://stackoverflow.com/comment/33178321
score: 0
comment on: http://stackoverflow.com/q/21907642
has text: What are `date` and `time` in `date + " " + time`?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/61955710
downvote count: 0
has body: You can create directory and file in one code line: Files.createFile(Files.createDirectories(confDir).resolve(confFile.getFileName())) Files.createDirectories(confDir) will not throw an exception if the folder already exists and returns Path in any case.
type: Answer
has comment: http://stackoverflow.com/comment/116583881
answers question: http://stackoverflow.com/q/21958083
has comment: http://stackoverflow.com/comment/116562359
score: 4
has comment: http://stackoverflow.com/comment/116702673
upvote count: 4

http://stackoverflow.com/a/21875456
has comment: http://stackoverflow.com/comment/33372824
has comment: http://stackoverflow.com/comment/33156440
has comment: http://stackoverflow.com/comment/33342866
has comment: http://stackoverflow.com/comment/33121605
has comment: http://stackoverflow.com/comment/33502467
has comment: http://stackoverflow.com/comment/33475398
has comment: http://stackoverflow.com/comment/33431632
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/33435175
has comment: http://stackoverflow.com/comment/33122221
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21849187
has comment: http://stackoverflow.com/comment/33149884
answers question: http://stackoverflow.com/q/21849187
has comment: http://stackoverflow.com/comment/33173600
has comment: http://stackoverflow.com/comment/33362656
has comment: http://stackoverflow.com/comment/33581087
has comment: http://stackoverflow.com/comment/33155904
has body: signed_lipsum.pdf, first version The time stamp token references as signer some CN=e-Szigno Test TSA2,OU=e-Szigno CA,O=Microsec Ltd.,L=Budapest,C=HU which has been issued by CN=Microsec e-Szigno Test Root CA 2008,OU=e-Szigno CA,O=Microsec Ltd.,L=Budapest,C=HU with serial number 7. It does not provide this certificate itself, though, and neither is it provided by the encapsulating signature CMS container nor in some validation related information PDF document section. Thus, at least on my computer there is no chance of verifying the time stamp token in any way and Adobe Reader is completely right not to accept the time stamp. Have you provided the certificate in question on your computer in a way appropriate for your Adobe Reader? If you have and it still does not work, please supply it for further tests. If you have not, try to retrieve and provide them. You might want to beef up the time stamp token itself to include that certificate before including it into the signature. signed_lipsum.pdf, second version In the updated file signed_lipsum.pdf the signature time stamp contains a TSA certificate, but it is the wrong one! Just like in the first version the time stamp references a signer certificate with Subject CN=e-Szigno Test TSA2,OU=e-Szigno CA,O=Microsec Ltd.,L=Budapest,C=HU Issuer CN=Microsec e-Szigno Test Root CA 2008,OU=e-Szigno CA,O=Microsec Ltd.,L=Budapest,C=HU Serial number 7. The contained certificate, on the other hand, has Subject CN=e-Szigno Test TSA2,OU=e-Szigno CA,O=Microsec Ltd.,L=Budapest,C=HU Issuer CN=Microsec e-Szigno Test Root CA 2008,OU=e-Szigno CA,O=Microsec Ltd.,L=Budapest,C=HU Serial number 5. I assume that test TSA uses multiple signing devices / soft-tokens with individual certificates and the OP included the wrong one. You, therefore, might want to include the correct certificate instead. BTW, the time stamp in the PDF signed by iText contains a certificate matching the references in the stamp... RFC 3161 time stamp requests can ask the T…
has comment: http://stackoverflow.com/comment/33170865
has comment: http://stackoverflow.com/comment/33367263
has comment: http://stackoverflow.com/comment/33122704
has comment: http://stackoverflow.com/comment/33175756
has comment: http://stackoverflow.com/comment/33163833
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33122274
has comment: http://stackoverflow.com/comment/33342009
has comment: http://stackoverflow.com/comment/33176443
has comment: http://stackoverflow.com/comment/33123162

http://stackoverflow.com/comment/33186921
has text: That is a really classy refactor. Congrats !
comment on: http://stackoverflow.com/a/21912325
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/33251674
has text: i have changed the code, thanks.i do agree that in case we don't know all the cases we deal with or if we want a default value this approach is not good enough but for this scenario it seems sufficient.
comment on: http://stackoverflow.com/a/21946880
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33332833
score: 0
has text: I am almost sure ...your not giving chance to application for complete request-response cycle... u should access servlet first then only u can see that 15 on index.jsp other wise it will show you NULL definitely
type: Comment
comment on: http://stackoverflow.com/q/21992539
type: QuestionComment

http://stackoverflow.com/comment/33295807
score: 0
has text: My question would is how to implement either of these techniques.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21971702

http://stackoverflow.com/q/21946604
has comment: http://stackoverflow.com/comment/33248326
downvote count: 0
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21946664
answer count: 1
favorite count: 0
upvote count: 3
has body: I have an ArrayAdapter and within it an AsyncTask but I'm not sure how to call notifyDataSetChanged from the onPostExecute Example: public class ColorAdapter extends ArrayAdapter&lt;Color&gt; { List&lt;Color&gt; colorList; Context context; .... public ColorAdapter(Context context, List&lt;Color&gt; list) { this.context = context; this.colorList = list; } public View getView (final int position, final View view, final ViewGroup parent) { ..... } class DeleteColorTask extends AsyncTask &lt;String, String, String&gt; { int colorId; DeleteColorTask (int colorId) {this.colorId = colorId;} protected String doInBackgroud (String ... args) { //call to server to delete the color colorList.remove(colorList.indexOf(...)); } protected void onPostExecute(String s) { //HOW CAN I CALL notifyDataSetChanged() here?? this.notifyDataSetChanged() doesn't work since I am inside DeleteColorTask class } } } I call the above from my activity like this: adapter = new ColorAdapter(context, colorsList); setListAdapter(adapter);
tagged with: android
has answer: http://stackoverflow.com/a/21946664
tagged with: android-adapter
has title: How to call notifyDataSetChanged() from within AsyncTask
tagged with: android-asynctask

http://stackoverflow.com/comment/33344372
has text: This is definitely not true. Inner classes can be very *good* design if used appropriately. In fact, they are used many times in the standard JDK classes.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22000340
score: 5

http://stackoverflow.com/a/21998795
score: 0
has comment: http://stackoverflow.com/comment/33341901
has body: You don't import methods out of classes into other classes. Logically you'd want Rectangle to extend shape (also should be Shape in accordance with naming conventions), but you're doing the other way around. However there are many things that don't make sense in your code, so you might want to explain in clear English what you're trying to accomplish.
type: Answer
answers question: http://stackoverflow.com/q/21998689

http://stackoverflow.com/comment/33116527
comment on: http://stackoverflow.com/q/21872800
type: Comment
score: 1
type: QuestionComment
has text: @Johan ya i know that. error is coming from different but it's just your correction

http://stackoverflow.com/q/21912348
has title: Getting debug session timeout trying to debug Android junit tests
tagged with: debugging
has body: I'm trying to debug Android junit tests. I can set break points in a test or in the code under test and they get hit. However, there is a one minute timeout that ends the debug session. I've looked at using @LargeTest instead of @SmallTest since it is suppose to have a 5 minute timeout, but I see no difference. My colleague has the same problem, so it's not just my machine. How can I disable the junit 1 minute timeout?
tagged with: java
tagged with: connection-timeout
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/53924128
tagged with: junit
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/21913173
type: UnansweredQuestion

http://stackoverflow.com/comment/33170951
has text: where to create this start up class i cant understand
type: Comment
comment on: http://stackoverflow.com/a/21903369
score: 0
type: AnswerComment

http://stackoverflow.com/q/21974355
accepted answer: http://stackoverflow.com/a/21974579
has body: I'm writting a JAVA Class to validate input data, especifically integer numbers. The class I develop is running fine but when I press more than one time enter and then a char type, it display several times " Error!! Invalid number. Try again. " and I would like to avoid it. I have use nextLine() method but it doesn't seems to correct it. Here is the Class: package chapter07.libro; import java.util.Scanner; public class Validator_integer { public static int getInt (Scanner scanner, String promt) { int numberInteger = 0; boolean isValid = false; System.out.println(promt); while(isValid == false) { if(scanner.hasNextInt()) { numberInteger= scanner.nextInt(); isValid = true; }//if else { System.out.println("Error!! Invalid number. Try again."); }//else scanner.nextLine(); }//while return numberInteger; }//getInt }//Validator_integer and next is the app to use the class: package chapter.prueba; import java.util.Scanner; import chapter07.libro.Validator_integer; public class Test_Validator_Integer { public static void main(String[] args) { Scanner sc = new Scanner (System.in); String choice = "y"; while(choice.equalsIgnoreCase("y")) { int number = Validator_integer.getInt(sc, "Enter integer number: "); System.out.println(number); System.out.println("Continue (y/n): "); choice = sc.next(); }//while }//main }//Test_Validator_Integer The results I get are next: Enter integer number: 2 2 Continue (y/n): y Enter integer number: (Here I press several time enter) xx Error!! Invalid number. Try again. Error!! Invalid number. Try again. Error!! Invalid number. Try again. Error!! Invalid number. Try again. 2 2 Continue (y/n): n So the part of (Error!! Invalid number. Try again.) displayed several times, is the one I would like to avoid. Does any one know how to fix it??? Thanks in advance!!!
has title: how to avoid pressing several time enter affects the input data?
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33298006
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/21974579

http://stackoverflow.com/q/21904592
has comment: http://stackoverflow.com/comment/97413030
type: AnsweredQuestion
tagged with: enums
tagged with: apache-commons
tagged with: java
accepted answer: http://stackoverflow.com/a/27729476
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27729476
tagged with: javabeans
has body: I've implemented a converter for Apache BeanUtils library for converting String to an enum constant: class EnumConverter implements Converter { @Override public &lt;T&gt; T convert(Class&lt;T&gt; tClass, Object o) { String enumValName = (String) o; Enum[] enumConstants = (Enum[]) tClass.getEnumConstants(); for (Enum enumConstant : enumConstants) { if (enumConstant.name().equals(enumValName)) { return (T) enumConstant; } } throw new ConversionException(String.format("Failed to convert %s value to %s class", enumValName, tClass.toString())); } } I use it in the following way: // Register my converter ConvertUtils.register(new EnumConverter(), Enum.class); Map&lt;String, String&gt; propMap = new HashMap&lt;String, String&gt;(); // fill property map BeanUtils.populate(myBean, propMap); Unfortunatelly a setter in myBean instance except ConcreteEnumClass enum, instead of java.lang.Enum, that is why I receive the following exception during BeanUtils.populate method call: org.apache.commons.beanutils.ConversionException: Default conversion to ConcreteEnumClass failed. at org.apache.commons.beanutils.converters.AbstractConverter.handleMissing(AbstractConverter.java:314) at org.apache.commons.beanutils.converters.AbstractConverter.handleError(AbstractConverter.java:269) at org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:177) at org.apache.commons.beanutils.converters.ConverterFacade.convert(ConverterFacade.java:61) at org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java:491) at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1000) at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:821) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:431) If I register EnumConverter in the following way: ConvertUtils.register(new EnumConverter(), ConcreteEnumClass.class); Everything woks perfectly. Since I would like to use my EnumConverter in general case, I would…
favorite count: 0
upvote count: 11
linked to: http://stackoverflow.com/q/4956714
score: 11
has title: Convert String to Enum using Apache BeanUtils

http://stackoverflow.com/q/21842825
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21842863
answer count: 2
linked to: http://stackoverflow.com/q/8819738
has title: Why does the Math.round(float f) method in Android check for NaN?
upvote count: 1
duplicate of: http://stackoverflow.com/q/8819738
favorite count: 0
has body: I was looking at the Math sources in the Android Framework and here is what the round() method looks like : public static int round(float f) { // check for NaN if (f != f) { return 0; } return (int) floor(f + 0.5f); } I'm trying to wrap my head around what the first check does without success. How could f be different from itself ? I also can't think of any test case that would make this any different... Any idea ?
tagged with: android
has answer: http://stackoverflow.com/a/21842871
downvote count: 0
has comment: http://stackoverflow.com/comment/33063269
possible better answer: http://stackoverflow.com/a/21842871
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21842863

http://stackoverflow.com/q/21917917
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33197359
has comment: http://stackoverflow.com/comment/33197569
score: 1
tagged with: java
tagged with: apache-zookeeper
has answer: http://stackoverflow.com/a/21918010
downvote count: 0
answer count: 1
has title: Can I use static method from a different class?
favorite count: 0
has comment: http://stackoverflow.com/comment/33197285
tagged with: static
has comment: http://stackoverflow.com/comment/33198095
linked to: http://stackoverflow.com/q/215497
tagged with: apache-curator
has comment: http://stackoverflow.com/comment/33197727
has body: Below is my CuratorClient class which is connecting to Zookeeper and starting the leader election process as well. public class CuratorClient { // can I make this as static? private static CuratorFramework client; private String latchPath; private String id; private LeaderLatch leaderLatch; public CuratorClient(String connString, String latchPath, String id) { client = CuratorFrameworkFactory.newClient(connString, new ExponentialBackoffRetry(1000, Integer.MAX_VALUE)); this.id = id; this.latchPath = latchPath; } public void start() throws Exception { client.start(); client.getCuratorClient().blockUntilConnectedOrTimedOut(); leaderLatch = new LeaderLatch(client, latchPath, id); leaderLatch.start(); } public boolean isLeader() { return leaderLatch.hasLeadership(); } public Participant currentLeader() throws Exception { return leaderLatch.getLeader(); } public void close() throws IOException { leaderLatch.close(); client.close(); } // can I use below method from any other class ? protected static List&lt;String&gt; getChildren(String node) throws Exception { return client.getChildren().forPath(node); } } When my service gets started up, in the static block I am making a connection to Zookeeper using CuratorClient and starting the leader election process as well. public class TestService { private static CuratorClient curatorClient = null; static { try { String connectionString = "some-string"; String hostname = "machineA"; curatorClient = new CuratorClient(connectionString, "/my/latch", hostname); curatorClient.start(); } catch (Exception ex) { // log exception } } .... .... // some method public Map&lt;String, String&gt; installNewSoftware(String node) { //.. some other code try { List&lt;String&gt; children = CuratorClient.getChildren("/my/example"); System.out.println(children); } catch (Exception e) { e.printStackTrace(); } //.. some other code return null; } } Now I have some other class as well which likes to use the getChildren method of CuratorClient so in this …
accepted answer: http://stackoverflow.com/a/21918010
has comment: http://stackoverflow.com/comment/33197293
upvote count: 1

http://stackoverflow.com/a/21854425
accepted answer of: http://stackoverflow.com/q/21854344
downvote count: 0
score: 1
has body: I think that your problem is in ' and ``` symbols. You should fix the sql as follwing: String SQL = "SELECT * FROM ? WHERE HomeTeam = ?"; However I am not sure that parameter placeholder ? is supported after from. So, propbably you will have to put it yourself, e.g.: String table = box1.getSelectedItem().toString(); String SQL = "SELECT * FROM " + table + " WHERE HomeTeam = ?";
type: AcceptedAnswer
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21854344

http://stackoverflow.com/a/21960666
upvote count: 1
answers question: http://stackoverflow.com/q/21960597
has body: public static void printPowersof2(int maxNum) { int power = 0; int answer = 1; while (true) { if (power &lt;= maxNum) { System.out.println(answer); } else { return; } answer *= 2; } }
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33273822

cookies
tags question: http://stackoverflow.com/q/22004006
tags question: http://stackoverflow.com/q/21915936
tags question: http://stackoverflow.com/q/21944642
type: Tag
tags question: http://stackoverflow.com/q/21854085
tags question: http://stackoverflow.com/q/21972109
tags question: http://stackoverflow.com/q/21875089
tag name: cookies

http://stackoverflow.com/comment/35970552
type: Comment
has text: Unfortunately, this class doesn't work with LibGDX camera properly. If anybody will be able to extend this class to work with camera, it would be very nice.
type: AnswerComment
comment on: http://stackoverflow.com/a/22777350
score: 0

http://stackoverflow.com/a/21871059
score: 0
answers question: http://stackoverflow.com/q/21866395
has body: As Richard has mentioned, you should mention the link text which is visible to the user ,i.e, link text which is displayed on the screen.I'm sure the above solutions worked but it is important to know why your code hasn't worked. So replace, driver.findElement(By.linkText("server_databases.php?token=650c2ac770f7d54449d462b18ddd6a01")); with driver.findElement(By.linkText("Databases"));
type: Answer

http://stackoverflow.com/comment/33332335
score: 0
type: Comment
type: QuestionComment
has text: import android.view.View; I think that's it
comment on: http://stackoverflow.com/q/21993755

http://stackoverflow.com/comment/33230583
has text: should the sum be 4+8+9+6+3+5 or 489+635?
score: 2
comment on: http://stackoverflow.com/q/21937091
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21962623
answers question: http://stackoverflow.com/q/21962372
score: 0
has comment: http://stackoverflow.com/comment/33299314
type: Answer
has comment: http://stackoverflow.com/comment/33351057
has body: looks like this regex in the .replaceFirst should work: ^0+(?=\d) Try it out, and see if that helps.
has comment: http://stackoverflow.com/comment/33299765

http://stackoverflow.com/a/21944272
answers question: http://stackoverflow.com/q/21944180
has body: You can also use a try-with-resources. Like so: try (YourResource resource) { //Todo... } catch(YourSpecificException ex) { //Todo... } Your resource declared between parantheses will be automatically closed upon exiting the construction. You can even declare multiple resources in one go, separate them with a semi-colon. It's all in the above link, really.
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33243855
upvote count: 1
has comment: http://stackoverflow.com/comment/33243904

http://stackoverflow.com/comment/33295072
type: Comment
comment on: http://stackoverflow.com/q/21972809
has text: Not good in some cases but: if you know `array x` have 10 ints and `array y` have 15 ints and you merge it in a sequential order you could suppose in the `array z` you have from 0 - 10 `array x`, 11 - 24 `array y` Then check the index and you could say if it's from array X or Y.
score: 0
type: QuestionComment

http://stackoverflow.com/q/21920113
tagged with: memory
downvote count: 0
answer count: 1
has body: USING JNA API with Java, I've been searching through memory of a game, attempting to withdraw a multi-level pointer to a certain address in order to get around the DMA that is utilized. When I succeeded, the pointers address was based upon the "gamename.exe"+0000025C and several levels of offsets. With this, and the base address of the gamename.exe being dynamically reset upon restart of the client, I will need to calculate the base address. I am using Java and have found this StackOverflow post to be of great help setting up a method JNA - Getting Base address I have written a similar method, snippet below: public int getBaseAddress() { try { Pointer hProcess = main.Kernel32.INSTANCE.GetCurrentProcess(); System.out.println(hProcess); List<Module> hModules = PsapiTools.getInstance().EnumProcessModules(hProcess); System.out.println(hModules); for(Module m: hModules){ System.out.println(m.getFileName()); if(m.getFileName().contains("NexusTK.exe")){ m.log(m.getFileName() + ": 0x" + Long.toHexString(Pointer.nativeValue(m.getEntryPoint()))); System.out.println(m); return Integer.valueOf("" + Pointer.nativeValue(m.getLpBaseOfDll())); } } } catch (Exception e) { e.printStackTrace(); } return -1; } Full class found here This is what my console shows. Lots of DLL's but no .exe of my game. QUESTION: How do I find the process of my game client through the Module collection? Am I feeding the function the correct Pointer? Do I need to restructure the code to calculate the base address?
favorite count: 0
accepted answer: http://stackoverflow.com/a/21972096
tagged with: jna
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has title: Java (JNA API) - Calculating Base Address
type: Question
has answer: http://stackoverflow.com/a/21972096
has comment: http://stackoverflow.com/comment/33202312

http://stackoverflow.com/q/22000574
linked to: http://stackoverflow.com/q/2839137
tagged with: binary
has title: How to read objects from binary file to ArrayList in java?
tagged with: file
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
has body: I'm Java beginner. I have to write some objects in binary file and than be able to write next object at the end of file and in second case in chronogical order. My code right is looks like this: class Czas implements Serializable { private int rok; private int miesiac; private int dzien; private int godzina; private int minuta; public Czas(int rok, int miesiac, int dzien, int godzina, int minuta) { this.rok = rok; this.miesiac = miesiac; this.dzien = dzien; this.godzina = godzina; this.minuta = minuta; } public int getRok() { return rok; } public int getMiesiac() { return miesiac; } public int getDzien() { return dzien; } public int getGodzina() { return godzina; } public int getMinuta() { return minuta; } } class Pomiar implements Serializable /*,Comparable&lt;Pomiar&gt;*/ { private Czas czas; private double temperatura; public Pomiar (Czas czas, double temperatura) { this.czas = czas; this.temperatura = temperatura; } public void Zapisz(ObjectOutputStream fout) throws IOException{ fout.writeObject(this); } public void ZapisChrono(ObjectOutputStream fout) throws IOException { } public String toString() { return "Temperatura: " + temperatura; } } public class AlgorytmyZ3V3 { public static void main(String[] args) { try (ObjectOutputStream fout = new ObjectOutputStream(new FileOutputStream( "BazaPomiarow.dat"))) { Czas czas1 = new Czas(1988, 6, 15, 10, 18); Czas czas2 = new Czas(1980, 1, 28, 15, 20); Czas czas3 = new Czas(1980, 12, 9, 3, 4); Pomiar p1 = new Pomiar(czas1, 30); Pomiar p2 = new Pomiar(czas2, 20); Pomiar p3 = new Pomiar(czas3, 30); p1.Zapisz(fout); p2.Zapisz(fout); p3.Zapisz(fout); } catch (IOException e) { System.out.println("Błąd wejścia/wyjścia."); } try { ObjectInputStream fin = new ObjectInputStream(new FileInputStream("BazaPomiarow.dat")); ArrayList&lt;Pomiar&gt; lista = new ArrayList(); } catch(Exception e) { System.out.println("Wyjątek w czasie deserializacji: " + e); } } } So I can write next object using method Zapisz, and it will be written at…
answer count: 1
has answer: http://stackoverflow.com/a/22000746
accepted answer: http://stackoverflow.com/a/22000746
tagged with: arraylist

http://stackoverflow.com/a/21975861
answers question: http://stackoverflow.com/q/21975823
has comment: http://stackoverflow.com/comment/33300710
has comment: http://stackoverflow.com/comment/33300705
has comment: http://stackoverflow.com/comment/33300872
has comment: http://stackoverflow.com/comment/33300645
has comment: http://stackoverflow.com/comment/33300686
downvote count: 0
has body: You could do it "Yoda-style": while(!"String".equals(data)) { //writing code here you must! } because for the case data is null then it would not cause NPE because you call equals method of the "String"
has comment: http://stackoverflow.com/comment/33300639
type: Answer
has comment: http://stackoverflow.com/comment/33300752
upvote count: 6
score: 6
has comment: http://stackoverflow.com/comment/33300650
has comment: http://stackoverflow.com/comment/33300849

http://stackoverflow.com/comment/33180457
type: QuestionComment
has text: Just a side note: why are you connecting as SYSDBA from within your application code. That sounds like a terrible idea.
score: 0
comment on: http://stackoverflow.com/q/21908610
type: Comment

http://stackoverflow.com/q/21968894
answer count: 5
has title: ConcurrentModificationException when using Iterator
has body: I'm trying to iterate an ArrayList with the Iterator. The problem is that I get the ConcurrentModificationException. I have checked a lot of questions like this. All said that the exception occurs when you modify an ArrayList while iterating through it. But I think that my problem is a little bit different because I'm not modifying the ArrayList even with the Iterator methods. Cliente cliente1 = new Cliente(16096,"Alberto1","pass",1500.0,false); ArrayList&lt;Cliente&gt; miLista = new ArrayList&lt;Cliente&gt;(); Iterator&lt;Cliente&gt; miIterador = miLista.iterator(); miLista.add(cliente1); System.out.println(miLista.get(0).nombre); //This displays "Alberto1" System.out.println(miIterador.hasNext()); //This displays 'true' miIterador.next(); //Here I get the exception I don't know how to solve it. It could be a silly question because actually i'm beginner but I got stuck here. Thank you. --Well can't even answer my own question so I edit the question with the answer: Thank you very much to all of you! You all give me the right answer :D Sorry for the silly question by the way :P SOLVED
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21968932
type: Question
has comment: http://stackoverflow.com/comment/33289696
has answer: http://stackoverflow.com/a/21968934
has answer: http://stackoverflow.com/a/21968972
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/21968934
accepted answer: http://stackoverflow.com/a/21968932
downvote count: 0
has answer: http://stackoverflow.com/a/21968979
favorite count: 0
has comment: http://stackoverflow.com/comment/33288341
has answer: http://stackoverflow.com/a/21969100
upvote count: 2

http://stackoverflow.com/comment/33281117
type: Comment
has text: i have set `ServerSocket ss=new ServerSocket(2000);ss.setSoTimeout(30000);ss.accept(); `.Now when i first run the server program and next Client program, the server refuses the connection for 30 seconds.After that time the connection is established.But My need is that the server waits for the client for 2 minutes and then when the time is finished then server should not connect to client.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21934927

http://stackoverflow.com/q/21911052
has comment: http://stackoverflow.com/comment/33257640
type: UnansweredQuestion
has body: I have a multi-module maven project., where one module refers another in its dependency. I run install maven goal to get the dependencies. Module B works on module A (refers it) In module A their is a properties file (x.properties) which includes file1.path=src/main/resources/abc.xml This file1 property is refered from an xml via placeholder (in module A) {file1.path} Whenever I run module B I get an exception which says file not found. Since it resolves this relative path (file1.path) by adding a prefix of module B path. (which is obvious) I can add another properties file and probably change the relative path to whatever works, but I cannot add absolute path. I have referred many similar questions on this site, but I cannot use Class.getResourceAsStream() or ClassLoader.getResourceAsStream() since do not need file1.path in my code, instead the jar file uses it internally. Please let me know if there is any way to solve this.
tagged with: maven
tagged with: spring
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33197424
upvote count: 1
type: Question
has title: properties file inside a jar has a relative path for xml inside same jar
downvote count: 0
tagged with: jar
score: 1
favorite count: 0

http://stackoverflow.com/comment/33202930
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21920949
score: 0
has text: No I don't think so. For that problem you can use string tokenizer or simply split method on string and create function that parse one line and run it in loop.

http://stackoverflow.com/comment/33346792
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22001260
has text: So how much memory does a simple Java test program report available?
score: 0

http://stackoverflow.com/comment/33330205
comment on: http://stackoverflow.com/a/21992378
score: 0
has text: I guess I can create a custom `MessageInterpolator` to use Groovy in my project. I would really like to help but I don't think I have the resources to contribute a solution for HV-853 that will work on any scripting engines.
type: Comment
type: AnswerComment

http://stackoverflow.com/a/21926468
answers question: http://stackoverflow.com/q/21926397
score: 0
type: Answer
has body: Based on the documentation of ItemListener Invoked when an item has been selected or deselected by the user. The code written for this method performs the operations that need to occur when an item is selected (or deselected). This suggested that you will receive an event when an item is deselected or selected. Seen as a change in the selected item in the combo box requires that the currently selected item has to be deselected first, it stands to reason that you will receive a ItemEvent.DESELECTED and ItemEvent.SELECTED event

http://stackoverflow.com/q/21908676
has body: I am working on a program that processes images, and can flip them if the underlying OCR detects that they are upside down. However the OCR output is not 100% reliable in terms of bounding boxes, so sometimes it is wrongly detected that an invoice is upside down... forever. I need to prevent this: The files have no unique identifiers anymore after they've been flipped, I can not see anymore that they are the same file after it has been flipped two times. So what would be the best, or an acceptable, practice to create a hash from BufferedImages. I assume that every time the same file has been read, it will generate also the same RGB values for every pixel in the BufferedImage. I can implement some naive algorithm myself, taking the RGB of every pixel, and then computing a hash/checksum. However I do not believe this is a correct method, how would it be best to do it?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33180456
tagged with: bufferedimage
has comment: http://stackoverflow.com/comment/33180357
has comment: http://stackoverflow.com/comment/33180254
answer count: 0
has comment: http://stackoverflow.com/comment/33180199
tagged with: java
has title: What is the best practice to calculate a hash on a BufferedImage?
type: Question
has comment: http://stackoverflow.com/comment/33180689
score: 0
tagged with: hash

http://stackoverflow.com/q/21960902
tagged with: opengl
tagged with: rendering
tagged with: java
has comment: http://stackoverflow.com/comment/33274194
type: Question
has comment: http://stackoverflow.com/comment/69986134
answer count: 2
score: 5
possible better answer: http://stackoverflow.com/a/34315710
upvote count: 5
downvote count: 0
has body: Before you go off on me for "not searching", I've searched around a LOT and found a lot of answers, but none of them worked for me. Hi, I'm making a 3D java lwjgl game, and I'm trying to render some simple 2D text on my screen in the middle, but no matter what I try, I never see any text rendered onto my screen anywhere. Here's my Text2D.java class: package com.gmail.br45entei.base.engine.rendering; import java.awt.Font; import java.awt.FontFormatException; import java.io.IOException; import org.newdawn.slick.Color; import org.newdawn.slick.UnicodeFont; import com.gmail.br45entei.base.engine.core.Vector2f; import com.gmail.br45entei.base.game.Game; import com.gmail.br45entei.base.game.MainComponent; import com.gmail.br45entei.file.FileMgmt; /** * @author Brian_Entei * */ public class Text3D { private Camera camera; private UnicodeFont font; private Color color; private Vector2f position; private String text = "New string"; private int size = 12; public int getSize() { return this.size; } public void setSize(int size) { this.size = size; updateFont(); } private void updateFont() { try { this.font = new UnicodeFont(Font.createFont(Font.TRUETYPE_FONT, FileMgmt.getFile(MainComponent.resourceFolder, "/fonts/BrianOwenReidBold.ttf", false)), size, false, false); } catch (FontFormatException e) { FileMgmt.LogException(e, "updateFont()", "Failed to create font from file!", false); } catch (IOException e) { FileMgmt.LogException(e, "Text3D()", "Failed to load file to create font!", false); } } public Text3D(String text, Camera camera) { this.camera = camera; this.color = Color.black; this.position = new Vector2f(0, 0); this.text = text; updateFont(); } public void drawHudString() { //org.lwjgl.opengl.GL11.glPushMatrix();// This gets called right before here. org.lwjgl.opengl.GL11.glRotatef(camera.getForward().getX(), -1.0f, 0.0f, 0.0f); org.lwjgl.opengl.GL11.glRotatef(camera.getForward().getY(), 0.0f, -1.0f, 0.0f); org.lwjgl.opengl.GL11.glRotatef(camera.getForward().getZ(), 0…
has answer: http://stackoverflow.com/a/39043788
accepted answer: http://stackoverflow.com/a/39043788
has comment: http://stackoverflow.com/comment/33274753
favorite count: 0
tagged with: fonts
has answer: http://stackoverflow.com/a/34315710
has title: How do you render 2D text in lwjgl?
tagged with: text
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/69985589

http://stackoverflow.com/a/21873885
accepted answer of: http://stackoverflow.com/q/21873513
score: 1
has comment: http://stackoverflow.com/comment/33127243
upvote count: 1
answers question: http://stackoverflow.com/q/21873513
has comment: http://stackoverflow.com/comment/33129835
has comment: http://stackoverflow.com/comment/33119103
has comment: http://stackoverflow.com/comment/33119610
has body: You can do something like this getXXX method will depend upon the type of the column holding the value. <%@ page language="java" contentType="text/xml; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <% Connection connection=DBCreation.getConnection(); Stirng query="select latitude,longitude,time from jam_info"; Statement stmt=connection.createStatement(); ResultSet rs=stmt.executeQuery(query); response.setContentType("text/xml"); out.println(" "); while(rs.next()) { out.println(" "); out.println(" " + rs.getXXX("latitude") + " "); out.println(" " + rs.getXXX("longitude") + " "); out.println(" " + rs.getXXX("time") + " "); out.println(" "); } out.println(" "); %> Hope this helps.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33119740
has comment: http://stackoverflow.com/comment/33118404
type: Answer

http://stackoverflow.com/q/21848360
has title: List of elements in JDOM
has comment: http://stackoverflow.com/comment/33072944
accepted answer: http://stackoverflow.com/a/21852581
type: Question
answer count: 2
tagged with: jdom
has comment: http://stackoverflow.com/comment/33077032
has comment: http://stackoverflow.com/comment/33078878
has comment: http://stackoverflow.com/comment/33073529
possible better answer: http://stackoverflow.com/a/21911392
has answer: http://stackoverflow.com/a/21911392
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/21852581
type: AnsweredQuestion
has body: I have a question regarding list of elements in xml I am trying to delete everything under and also the tags. But when I debug my list of param I noticed my list looks like this : text element text element text element text element But I want only the elements in the list and not the text so I can more easily delete the correct element. How to do this? This is my code : public void deleteParameter(int row, int index) { int objTypeIndex = index + 1; File xml = new File(XMLEditorService.getXMLEditorService().getFile()); try { XMLOutputter xmlOut = new XMLOutputter(); org.jdom2.Document doc = new SAXBuilder().build(xml); Namespace ns = Namespace.getNamespace("http://www.xxx.com"); org.jdom2.Element rootNode = doc.getRootElement(); org.jdom2.Element typeContent = rootNode.getChildren().get( objTypeIndex); List&lt;Element&gt; list = typeContent.getChildren("param", ns); if (list.size() &gt; 0) { Element element = list.get(row); //remove correct element element.removeContent(); System.out.println("element removed: " + element.getName()); xmlOut.setFormat(Format.getPrettyFormat()); xmlOut.output(doc, new FileWriter(XMLEditorService .getXMLEditorService().getFile())); } } catch (IOException io) { System.out.println(io.getMessage()); } catch (JDOMException jdomex) { System.out.println(jdomex.getMessage()); } } The list i am refering to is this line : List&lt;Element&gt; list = typeContent.getChildren("param", ns);
score: 0
tagged with: java

http://stackoverflow.com/a/21888245
type: Answer
has comment: http://stackoverflow.com/comment/33146741
score: 2
has comment: http://stackoverflow.com/comment/33145872
upvote count: 3
has body: Just use standard Java networking APIs if they're operating over WiFi.
downvote count: 1
has comment: http://stackoverflow.com/comment/33146418
answers question: http://stackoverflow.com/q/21888202

http://stackoverflow.com/comment/33276223
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21961769
has text: I disagree with you when you say the best way to learn is to be granted the solution. If you want to see how `Fragment`'s work, create a new blank project and see how it is implemented.

http://stackoverflow.com/q/21968968
upvote count: 1
has title: how do is this the correct way of writing this <class name> = new constructor name?
has answer: http://stackoverflow.com/a/21969025
has comment: http://stackoverflow.com/comment/33288527
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33288495
has comment: http://stackoverflow.com/comment/33288412
linked to: http://stackoverflow.com/q/991757
downvote count: 0
has comment: http://stackoverflow.com/comment/33288656
favorite count: 0
has body: can some one please help me am having a compilation error with the last part of this code its saying create constructor please help public class Officer { public static void main(String args[]) { Scanner input = new Scanner(System.in); System.out.print("Enter the name of the Soldier: "); String name = input.nextLine(); System.out.print("Enter the sex of the Soldier: "); String sex = input.nextLine(); System.out.print("Enter the Age of the Soldier: "); String age = input.nextLine(); Soldier soldier = new Soldier(name, sex, age); } } package officer; public class Soldier { private String soldierName; private int soldierAge; private char soldierSex; public void Soldier( String name, char sex, int age) { soldierName = name; soldierSex = sex; soldierAge = age; } public String getSoldierName() { return soldierName; } public char getSoldierSex() { return soldierSex; } public int getSoldierAge() { return soldierAge; } }
answer count: 3
has comment: http://stackoverflow.com/comment/33288376
has answer: http://stackoverflow.com/a/21969036
linked to: http://stackoverflow.com/q/1788312
has comment: http://stackoverflow.com/comment/33288434
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21969043

http://stackoverflow.com/comment/33247396
has text: Try adding a Java Exception Breakpoint, and run the debugger, when the error occurs, execution will stop and hopefuly you will be directed to the line that caused it. (if using eclipse: Run->Add Java Exception Breakpoint (choose the nullpointer, wich is the one you get, and run the debugger)
comment on: http://stackoverflow.com/q/21945810
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21914870
accepted answer: http://stackoverflow.com/a/21916647
has title: Using Scanner count elements on line
tagged with: java
answer count: 2
possible better answer: http://stackoverflow.com/a/21915168
has answer: http://stackoverflow.com/a/21915168
has answer: http://stackoverflow.com/a/21916647
has comment: http://stackoverflow.com/comment/33191525
has body: If I am using Scanner in Java, how do I count the elements on the line so I know not to process the input if it doesn't have the required elements or continue to next line? All are integers. This is not homework. Example input: 1 &lt;-- ignore 1 2 3 &lt;-- use this 1 2 &lt;-- ignore
downvote count: 4
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/33191995
has comment: http://stackoverflow.com/comment/33191471
score: -4
favorite count: 0
has comment: http://stackoverflow.com/comment/33191663
type: Question

http://stackoverflow.com/q/21944778
has comment: http://stackoverflow.com/comment/33534794
tagged with: ws-security
answer count: 1
has body: I'm receiving a request from the client and after some data masking, I forward the request to a web services. In order for the webservice to authorize me, I have to send in the &lt; wsse:BinarySecurityToken > element. I have a .pfx certificate file and from this certificate, I need to generate the security token. The remaining part of the request is generated through SAAJ &lt;wsse:BinarySecurityToken&gt;my security token&lt;/wsse:BinarySecurityToken&gt; How to generate "my security token" from .pfx file? Demo code : InputStream inStream = new FileInputStream("C:\\development\\certs\\cert.pfx"); KeyStore ks = KeyStore.getInstance("PKCS12"); ks.load(inStream, "PASSWORD".toCharArray()); Enumeration&lt;String&gt; aliases = ks.aliases(); String aliaz = ""; while(aliases.hasMoreElements()){ aliaz = aliases.nextElement(); if(ks.isKeyEntry(aliaz)){ break; } } X509Certificate certificate = (X509Certificate) ks.getCertificate(aliaz); Base64 base64 = new Base64(); String token = base64.encodeToString(certificate.getSignature()) The token variable doesn't seem to match with the token generated from SOAPUI. Any help is very much appreciated. Thank You!
score: 4
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/34697845
has comment: http://stackoverflow.com/comment/33536590
has comment: http://stackoverflow.com/comment/33719631
tagged with: java
type: Question
upvote count: 4
has title: Generate BinarySecurityToken from .pfx certificate
downvote count: 0
has comment: http://stackoverflow.com/comment/33536037
has comment: http://stackoverflow.com/comment/33535866
favorite count: 0

http://stackoverflow.com/a/21999119
has comment: http://stackoverflow.com/comment/33344412
has body: I tried to look into that in javascript. I started with an average time of 0.101 and get down to 0.076 with those small modifications: function main() { var A = new Array() ; var randomNum ; for(var i= 0 ; i&lt;1000 ; i++) { randomNum = 0 + Math.random(); if(randomNum&gt;0.5) A[i]=-1; else A[i]=1; } console.log("Compute"); var start_time = new Date().getTime();; var result = 0; var minavg = 100000 ; for(var i=0 ; i&lt;A.length-1 ; i++) { var suma= A[i]; var count=1; for(var k=i+1 ; k&lt;A.length ; k++) { suma+=A[k]; count++; if(A[k]&lt;A[k-1]) { var avg=suma/count; if(minavg&gt;avg) { minavg=avg; result = i; } } } } var end_time = new Date().getTime(); var difference = (end_time - start_time)*1e-3; console.log(difference); } main(); My point was to limit the number or tests and allocate local variable at the very last time in order to maximum CPU register and context. On a compile java version you might have even better results than me.
has comment: http://stackoverflow.com/comment/33342896
answers question: http://stackoverflow.com/q/21998591
type: Answer
score: 0

http://stackoverflow.com/comment/33252466
type: AnswerComment
has text: @SSpoke: There is [`.clone()`](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#clone%28%29), but it's [typically not recommended](http://stackoverflow.com/questions/2427883) because its meaning is not precisely defined, and usually only does a shallow-clone. The only other option to is set every field manually.
type: Comment
comment on: http://stackoverflow.com/a/21948914
score: 0

http://stackoverflow.com/q/21843101
type: Question
has comment: http://stackoverflow.com/comment/33069569
score: 0
tagged with: java
has title: vlcj EmbeddedMediaPlayerComponent does not resize to original size
tagged with: swing
has comment: http://stackoverflow.com/comment/33064028
has comment: http://stackoverflow.com/comment/33064887
type: UnansweredQuestion
tagged with: vlcj
has comment: http://stackoverflow.com/comment/33065261
has comment: http://stackoverflow.com/comment/33064045
answer count: 0
has body: Please have a look at the attached images. The vlcj media component hides the control buttons when the window is resized to original dimensions after maximizing. public class PlayerVLCPanel extends JPanel { private EmbeddedMediaPlayerComponent playerComponent; public PlayerVLCPanel() { this.playerComponent = ComponentStore.getCameraStreamer(); setLayout(new BorderLayout()); add(this.playerComponent.getVideoSurface(), BorderLayout.CENTER); } } public class CameraJobControlPanel extends JPanel { public CameraJobControlPanel() { DesignGridLayout layout = new DesignGridLayout(this); layout.row().grid(expertDnLabel).add(expertDnField); layout.row().right().add(startCamButton, stopCamButton, startLazerButton, stopLazerButton).fill(); } } public class MainPlayerContainer extends JPanel { public MainPlayerContainer() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(new EmptyBorder(3, 3, 3, 3)); add(topRegion()); // contains PlayerVLCPanel add(bottomRegion()); // contains the Control buttons } } Finally, JFrame frame = new JFrame("vlcj Testing"); frame.add(new MainPlayerContainer()); frame.setLocation(100, 100); frame.setSize(1050, 600); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); How can I prevent this behaviour ? Thanks in advance.

http://stackoverflow.com/a/21847145
has body: Use this: String yourString = Arrays.toString(yourArray);
type: Answer
has comment: http://stackoverflow.com/comment/33070505
score: 0
answers question: http://stackoverflow.com/q/21847103

http://stackoverflow.com/a/21942842
upvote count: 2
type: Answer
score: 2
has body: If you're looking for the mean: Sum them up and divide by the number of elements you summed up.
downvote count: 0
answers question: http://stackoverflow.com/q/21942733
has comment: http://stackoverflow.com/comment/33241826

http://stackoverflow.com/a/21952641
score: 3
has body: In this case you have only one writer to a primitive, if you rewrote to like this clock = 1 - clock; or clock ^= 1; In this situation all you need do is make the field volatile. If you have multiple writers, or update multiple fields, or non primitive fields, you need to use synchronized or a Lock. There are other ways to avoid locks, but how you do this is specific to the situation. In the situation you have, because you update the field twice, you need to use a proper lock or synchronized.
has comment: http://stackoverflow.com/comment/33259250
upvote count: 3
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21950867

http://stackoverflow.com/a/22001217
has comment: http://stackoverflow.com/comment/33346146
has comment: http://stackoverflow.com/comment/33346198
has comment: http://stackoverflow.com/comment/33346197
has comment: http://stackoverflow.com/comment/33346258
has comment: http://stackoverflow.com/comment/33346411
answers question: http://stackoverflow.com/q/22001041
upvote count: 4
has comment: http://stackoverflow.com/comment/33346290
accepted answer of: http://stackoverflow.com/q/22001041
type: AcceptedAnswer
downvote count: 0
score: 4
has body: The reason it looks like an exception is not thrown is because the code is terrible and catches the exception: try { maxX = getWidth(); maxY = getHeight(); count = 0; hour = new int[30]; min = new int[30]; sec = new int[30]; msec = new int[30]; start = false; stop = true; for(int j = 0 ; j &lt;= 30 ; j++) { hour[j] = 0; min[j] = 0; sec[j] = 0; msec[j] = 0; } }catch(Exception e) {} // &lt;- catches the exception and does nothing Change the catch block to this: }catch(Exception e) { e.printStackTrace(); } And you will see that an exception is thrown. Then you could either: A) Remove the try/catch and change &lt;= 30 to &lt; 30. B) Discard the code because it's a poor example. As for the block in run, as far as I can tell, count is never changed so it's always 0.
has comment: http://stackoverflow.com/comment/33346303
has comment: http://stackoverflow.com/comment/33346406
has comment: http://stackoverflow.com/comment/33346049
type: Answer
has comment: http://stackoverflow.com/comment/33346330
has comment: http://stackoverflow.com/comment/33346087
has comment: http://stackoverflow.com/comment/33346567
has comment: http://stackoverflow.com/comment/33346353

http://stackoverflow.com/comment/33260258
has text: I can only guess but the error message shows the direction: `Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes` so not maven is the problem the calling process. I assume you are starting a java process via exec-maven-plugin:exec ? Without the full pom and configuration it's hard to guess what's wrong.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21952318
score: 1

http://stackoverflow.com/a/21922637
type: AcceptedAnswer
downvote count: 1
has body: Though I did not understand your question clearly, but it seems that you need to add the index to jumps when you increment the minsteps++. You need to un comment jumps.add(farthest); and pass the i instead of farthest. Also you may need to remove the jumps.add(i) with in if condition. Hope this helps. EDIT: It seems your logic is fine except for the first jump which is at index 0 always. So add 0 to your jumps just before your loop. UPDATE Okay, I was not tested and also not gone through the algorithm link you provided. The algo explains that we need to consider an element e and index i and get the max of the elements from current position to arr[e] and that is not happening. I tried to replicate the exact step the solution mentioned. Hope this might help you. public static int minJumps2(int[] arr, List&lt;Integer&gt; jumps) { boolean reachedEnd = false; if (arr.length &lt; 2) return 0; //calculate (index + value) int[] sums = new int[arr.length]; for (int i = 0; i &lt; arr.length; i++) { sums[i] = i + arr[i]; } // start with first index jumps.add(0); while (true) { int currentPosition = jumps.get(jumps.size() - 1); int jumpValue = arr[currentPosition]; // See if we can jump to the goal if (arr.length - 1 - currentPosition &lt;= jumpValue) { jumps.add(arr.length - 1); reachedEnd = true; break; } else { int maxIndex = currentPosition; int currentMax = sums[maxIndex]; // max of the reachable elements for (int i = currentPosition; i &lt;= currentPosition + jumpValue; i++) { if (sums[i] &gt; currentMax) { maxIndex = i; currentMax = sums[i]; } } if (maxIndex == currentPosition) { break; } jumps.add(maxIndex); } } System.out.println(jumps.size()); System.out.println(jumps); return jumps.size(); }
type: Answer
has comment: http://stackoverflow.com/comment/33243358
score: 1
has comment: http://stackoverflow.com/comment/110849419
answers question: http://stackoverflow.com/q/21922395
has comment: http://stackoverflow.com/comment/33241252
accepted answer of: http://stackoverflow.com/q/21922395
upvote count: 2

http://stackoverflow.com/comment/33157062
comment on: http://stackoverflow.com/q/21895084
score: 2
type: Comment
type: QuestionComment
has text: Because this is what you put in your code. you have `values.add` **twice**.

http://stackoverflow.com/q/21900696
has title: Avoid setting parent in widget constructor in SWT?
score: 1
tagged with: java
tagged with: swt
has comment: http://stackoverflow.com/comment/33235560
type: Question
upvote count: 2
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33168547
tagged with: swing
has comment: http://stackoverflow.com/comment/33169489
has body: While Swing architecture supposes that widgets are "added" one into another, SWT uses another paradigm: each widget is created having parent set in the constructor. I think former approach is better, because I can isolate a code of creating each control. For example // creating button 1 JButton button1 = new JButton("Button 1"); // creating button 2 JButton button2 = new JButton("Button 2"); // creating button 3 JButton button3 = new JButton("Button 3"); // creating panel JPanel panel = new JPanel(); panel.setLayout(new FlowLayout()); panel.add(button1); panel.add(button2); panel.add(button3); // creating frame JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(panel); frame.pack(); frame.setVisible(true); We can have three widgets here and each one is created in it's own block of code. If I want to add one more framing level, I just add new block and one small fix // creating button 1 JButton button1 = new JButton("Button 1"); // creating button 2 JButton button2 = new JButton("Button 2"); // creating button 3 JButton button3 = new JButton("Button 3"); // creating panel JPanel panel = new JPanel(); panel.setLayout(new FlowLayout()); panel.add(button1); panel.add(button2); panel.add(button3); // creating another panel JPanel panel2 = new JPanel(); panel2.setLayout(new FlowLayout()); panel2.add(panel); // creating frame JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //frame.add(panel); frame.add(panel2); // one fix frame.pack(); frame.setVisible(true); Not so in SWT. I have to make many fixes to reassign all child creation code to new parent. Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new RowLayout(SWT.HORIZONTAL)); Composite composite = new Composite(shell, SWT.NONE); composite.setLayout(new RowLayout(SWT.HORIZONTAL)); Composite composite2 = new Composite(composite, SWT.NONE); composite2.setLayout(new RowLayout(SWT.HORIZONTAL)); //Button button1 = ne…
has answer: http://stackoverflow.com/a/21901364

http://stackoverflow.com/comment/33222703
comment on: http://stackoverflow.com/q/21878146
has text: @adarsh:i would like my success or failure messages in form of panel which i have mentioned not like using <h:messages>orlike <p:messages> as like this http://www.primefaces.org/showcase/ui/messages.jsf
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21902504
tagged with: xquery
type: Question
has answer: http://stackoverflow.com/a/21912844
score: 0
answer count: 2
has body: I am using Weblogic Integration framework. While transforming one XML format to another using .xq file, I want to apply some logic written in a custom Java Class. For example, XML1 has tag: XYZ Custom Java Class: public class unitcodemapper{ public static String getMappedUnitCode(String unitCode){ if(unitCode=="XYZ") return <<value from DB table>> else return unitCode; } } XML2 will have a tag: unitcodemapper.getMappedUnitCode(XML1/UnitCode) I cannot find any documentation or example to do this. Can someone please help in understanding how this can be done?
tagged with: weblogic-10.x
type: UnansweredQuestion
tagged with: weblogic-integration
tagged with: java
has title: Import Java Custom Method in Xquery
has answer: http://stackoverflow.com/a/21910080

http://stackoverflow.com/q/21849450
favorite count: 0
tagged with: wildfly
has body: I migrate from jboss 7.1 to wildfly and i have some problems with my datasource. 10:04:37,900 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 49) JBAS017502: Undertow 1.0.0.Final starting 10:04:37,901 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017502: Undertow 1.0.0.Final starting 10:04:37,903 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 50) JBAS015537: Activating WebServices Extension 10:04:37,904 INFO [org.jboss.as.security] (MSC service thread 1-3) JBAS013170: Current PicketBox version=4.0.20.Final 10:04:37,913 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 28) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.0) 10:04:37,919 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010417: Started Driver service with driver-name = postgresql 10:04:37,924 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 28) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3) 10:04:37,926 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-13) JBAS010417: Started Driver service with driver-name = h2 10:04:37,939 INFO [org.jboss.as.naming] (MSC service thread 1-9) JBAS011802: Starting Naming Service 10:04:37,939 INFO [org.jboss.as.mail.extension] (MSC service thread 1-10) JBAS015400: Bound mail session [java:jboss/mail/Default] 10:04:38,013 INFO [org.jboss.remoting] (MSC service thread 1-11) JBoss Remoting version 4.0.0.Final 10:04:38,023 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 49) JBAS017527: Creating file handler for path C:\bin\wildfly-8.0.0.Final/welcome-content 10:04:38,044 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017525: Started server default-server. 10:04:38,061 INFO [org.wildfly.extension.undertow] (MSC service thread 1-14) JBAS017531: Host default-host starting 10:04:38,231 INFO [org.jboss.as.serve…
type: AnsweredQuestion
has title: Wildfly Datasource conflicting with DefaultDS
tagged with: java
has comment: http://stackoverflow.com/comment/33078485
accepted answer: http://stackoverflow.com/a/21852079
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/21852079
score: 10
has comment: http://stackoverflow.com/comment/33078079
upvote count: 10
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33076727

http://stackoverflow.com/a/21924686
has body: You can declare custom Exceptions, throw them using throw new MyException(); and catch them like this: class MyException extends Exception { public MyException() {} public MyException(String message) { super(message); } } void foo() throws MyException { /* ... */ throw new MyException("MyString"); } void bar() { try { foo(); } catch (MyException me) { /* Error handling here */ } } Edit: Alternatively you could declare an errno-like variable in your class and check it after each function call or pass an array to the function like this: void foo() { int[] errors = {0, 0}; bar(errors); if(errors[0] != 0) /* error handling */ if(errors[1] != 0) /* warning handling */ } void bar(int[] errors) { /* ... */ errors[0] = 42; /* error code */ errors[1] = 1337; /* warning code */; }
answers question: http://stackoverflow.com/q/21924593
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33209255
has comment: http://stackoverflow.com/comment/33208952

http://stackoverflow.com/q/21969909
tagged with: java
type: Question
upvote count: 4
has body: Upgrading to the latest Hibernate Validator in my Java desktop application causes java.lang.NoClassDefFoundError: javax/el/PropertyNotFoundException. It turns out that by default, Hibernate Validator now depends on EL. Can it be configured to not use EL? I'm okay with the previos version messaging format (without EL). I'm already using Groovy in my project. I believe including dependencies to EL in my current project is redundant since both serve the same purpose as scripting language.
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21992378
tagged with: hibernate-validator
tagged with: groovy
answer count: 1
accepted answer: http://stackoverflow.com/a/21992378
score: 4
has title: Can I use Hibernate Validator 5 without EL?
type: AnsweredQuestion

http://stackoverflow.com/q/21848394
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/21851112
tagged with: axis
answer count: 1
tagged with: tomcat
has body: I'm new to java web services. Now i'm trying to create a web service client to access a WSDL based web service. So using eclipse i generated the required client stubs/Binding stubs/Port/Port proxy/ServiceLocator etc. According to my understanding next step is to create a class with the main method to invoke it. Can anyone help me to write that piece of code or at least some links to refer? EDITED Thank you so much for the hint @pavan-kumar. Finally i come up with following code and it works. Thanks again. package clients; import requiredClasses; public class TestClient { public static void main(String args[]) throws Exception { TestPortProxy tProxy = new TestPortProxy(); RequestEntity rEntity = new RequestEntity(); rEntity.setAttribute1(100); rEntity.setAttribute2("value1"); tProxy.webServiceAction(rEntity); } }
type: AnsweredQuestion
has title: Java web service client + Axis + Eclipse + Tomcat
has answer: http://stackoverflow.com/a/21851112
score: 0
tagged with: web-services
type: Question
tagged with: java

http://stackoverflow.com/a/22096507
answers question: http://stackoverflow.com/q/21972603
upvote count: 12
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The command you are actually using is not what you might have expected. The correct command APDU to get the UID/serial number/enumeration identifier with this reader is: +------+------+------+------+------+ | CLA | INS | P1 | P2 | Le | +------+------+------+------+------+ | 0xFF | 0xCA | 0x00 | 0x00 | 0x00 | +------+------+------+------+------+ However, the constructor you are using is defined as: public CommandAPDU(int cla, int ins, int p1, int p2, int ne); So with new CommandAPDU(0xFF, 0xCA, 0x00, 0x00, 0x00) you are creating a C-APDU with the following parameters CLA = 0xFF, INS = 0xCA, P1 = 0x00, P2 = 0x00. So far this is the same as the above APDU. But the last parameter is Ne = 0x00. Ne = 0 means that the number of expected response bytes is zero (whereas Le = 0 would mean that the number of expected response bytes is (up to) 256). This results in effectively creating the following Case-1 APDU: +------+------+------+------+ | CLA | INS | P1 | P2 | +------+------+------+------+ | 0xFF | 0xCA | 0x00 | 0x00 | +------+------+------+------+ So at most you will get the 2-byte status word as a response (either indicating success with 0x90 0x00 or indicating an error with a status code like 0x6X 0xXX). So you can either use a byte array to form your APDU: new CommandAPDU(new byte[] { (byte)0xFF, (byte)0xCA, (byte)0x00, (byte)0x00, (byte)0x00 } ) Or you can specify a proper value for Ne: new CommandAPDU(0xFF, 0xCA, 0x00, 0x00, 256)
score: 12
accepted answer of: http://stackoverflow.com/q/21972603

http://stackoverflow.com/q/21902533
possible better answer: http://stackoverflow.com/a/21902860
has body: I want to integrate my app with Flurry Analytics service, but i would to ask whats the maximum number of projects can i create per account, and can i create the project programmatically via Flurry API.
type: AnsweredQuestion
score: 1
tagged with: java
has title: How many Flurry projects can be created per Account?
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33173204
tagged with: flurry
tagged with: analytics
has answer: http://stackoverflow.com/a/21944720
accepted answer: http://stackoverflow.com/a/21944720
upvote count: 1
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/21902860
downvote count: 0
tagged with: integration

http://stackoverflow.com/a/21956094
has body: The problem is, that you first read the tweet and then initiate a while cycle, that adds the same tweet over and over again, until you run out of memory. Add System.out.println(tweets.size()); behind tweets.add(tweet); to get a better grasp of what's happening.
answers question: http://stackoverflow.com/q/21956053
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/33070613
type: QuestionComment
has text: @Koitoer Can you please elaborate?
score: 0
comment on: http://stackoverflow.com/q/21847131
type: Comment

http://stackoverflow.com/comment/33214537
has text: Shouldn't you better make sure you don't rely on OS-specific providers?
type: Comment
comment on: http://stackoverflow.com/q/21926643
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33160739
type: Comment
type: QuestionComment
has text: depends upon content from maxBid(). what it is returning ?
score: 0
comment on: http://stackoverflow.com/q/21897188

http://stackoverflow.com/comment/33159945
comment on: http://stackoverflow.com/a/21893457
has text: Oh my gosh..I moved the employeeCount += 1 to the end of the method like you suggested and it fixed it. This is outrageously awesome!! Thank you so much!
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21907429
linked to: http://stackoverflow.com/q/13236123
has comment: http://stackoverflow.com/comment/33177999
tagged with: gridview
has title: How to make Horizontally scrollable Grid View?
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/33177860
has comment: http://stackoverflow.com/comment/33177906
score: 0
has body: I am trying to make a Grid View and it has a lot of images. So I want to make it Horizontally scrollable, but it is not scrolling. How to make Horizontally scrollable Grid View ? Please help me. Here is my code.
has comment: http://stackoverflow.com/comment/33177964
answer count: 1
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21908915

http://stackoverflow.com/q/21924417
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21930988
has answer: http://stackoverflow.com/a/21924573
type: UnansweredQuestion
tagged with: input
tagged with: swing
tagged with: numbers
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22400760
has body: I made ​​a method to input numbers. But I want that input is numeric but a dot (.) Can still be entered. please my friend help me. Thanks private void jTextField1KeyTyped(java.awt.event.KeyEvent evt) { // TODO add your handling code here: FilterHanyaAngka(evt); } public void FilterHanyaAngka(java.awt.event.KeyEvent evt) { char c = evt.getKeyChar(); if (!((Character.isDigit(c) || (c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)))) { evt.consume(); } }
has title: Java Input Numbers

http://stackoverflow.com/comment/33258255
type: Comment
comment on: http://stackoverflow.com/a/21952167
type: AnswerComment
has text: Well then once you have them splitted based on my logic above, you can search for particular commands and see if the next word in the splitted list contains the second word of the command or not. A better solution would be to have terse commands, as gestures like "Hey" and "Please" don't matter. You can simply search for your Keywords and execute appropriate Commands. Also check out Command Pattern as I think you'll need that in order to write modular and extensible code in this particular type of project.
score: 0

http://stackoverflow.com/q/21914497
favorite count: 0
has title: Java paintComponent wont be called upon repainting with invokelater
has comment: http://stackoverflow.com/comment/33190811
has body: I am using invoke later like this in my main method: public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { Game bird = new Game(); bird.initialize(); } }); } And then when I try to repaint, it won't call the paintComponent(Graphics g) in my JPanel. But if I remove the invoke later, and just do new Game, it works fine? This is how I do it: private void gameLoop() { while(this.game) { this.update(); this.render(); } } private void update() { // TODO UPDATRES } private void render() { super.repaint(); } And before the program sets the gui to visible, I add the component using super.add(Screen screen) and then set visible, this is my screen class: @SuppressWarnings("serial") public class Screen extends JPanel { private Game game; public Screen(Game bird) { this.game = bird; } public void paintComponent(Graphics g) { System.out.println("hey"); } } Why won't repaint call paintComponent when invokelater has ran? SRC: Game.java: public class Game extends Window { private static final long serialVersionUID = 1L; private Screen gameScreen; private boolean game = false; public Game() { this.gameScreen = new Screen(this); } public void initialize() { super.setGameScreen(this.gameScreen); this.game = true; this.gameLoop(); } private void gameLoop() { while(this.game) { this.update(); this.render(); } } private void update() { // TODO UPDATRES } private void render() { super.repaint(); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { Game bird = new Game(); bird.initialize(); } }); } } Window.java: public class Window extends JFrame { protected Window() { super.setTitle("test"); super.setSize(this.getPerfectSize()); } protected void setGameScreen(JPanel screen) { super.add(screen); super.setVisible(true); System.out.println("added"); } private Dimension getPerfectSize() { return new Dimension(350, 500); } } Screen.java: @SuppressWarnings("serial") publi…
has answer: http://stackoverflow.com/a/21915233
accepted answer: http://stackoverflow.com/a/21915233
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: swing
type: Question
upvote count: 1
answer count: 1

http://stackoverflow.com/a/21893302
answers question: http://stackoverflow.com/q/21893128
has body: You can encode the values somehow to a number so each combination gives a number that is not given for any other combination. That encoding may be just binary. 1000=8 A 1100=12 B 1110=14 C 1111=16 C 1010=10 A 1011=11 A 1001=9 A 1101=13 B Then you need a data structure like a map to associate each number with the output. EDIT: I said a number but indeed any encoding may work as well as maps allow almost anything as key. Other encodings: "TFFF", "1000", "1T 2F 3F 4F", Arrays.asList(true, false, false, false) ...
upvote count: 3
downvote count: 1
type: Answer
score: 2

http://stackoverflow.com/q/21892068
has title: How to get values and keys through single line string xml in android
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33151360
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/33151498
tagged with: android
has answer: http://stackoverflow.com/a/21914967
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/9605913
has comment: http://stackoverflow.com/comment/33151662
possible better answer: http://stackoverflow.com/a/21892285
type: Question
has body: I am encounter a problem. I have following xml &lt;string&gt;[{"BatchIDs":[],"HomeWorkCategoryName":"","FileURL":"","FileName":"","ID":1,"Title":"test","Description":"test","HomeworkCategoryID":1,"ExpiryDate":"\/Date(1386658800000)\/","FileID":-2147483648,"URL":"","Mode":1,"Type":2,"Status":1,"CreatedOnDate":"\/Date(1388093500883)\/","UpdatedOnDate":"\/Date(1388093500883)\/","Inactive":false,"Deleted":true}, {"BatchIDs":[],"HomeWorkCategoryName":"","FileURL":"","FileName":"","ID":1,"Title":"test","Description":"test","HomeworkCategoryID":1,"ExpiryDate":"\/Date(1386658800000)\/","FileID":-2147483648,"URL":"","Mode":1,"Type":2,"Status":1,"CreatedOnDate":"\/Date(1388093500883)\/","UpdatedOnDate":"\/Date(1388093500883)\/","Inactive":false,"Deleted":true}, {"BatchIDs":[],"HomeWorkCategoryName":"","FileURL":"","FileName":"","ID":1,"Title":"test","Description":"test","HomeworkCategoryID":1,"ExpiryDate":"\/Date(1386658800000)\/","FileID":-2147483648,"URL":"","Mode":1,"Type":2,"Status":1,"CreatedOnDate":"\/Date(1388093500883)\/","UpdatedOnDate":"\/Date(1388093500883)\/","Inactive":false,"Deleted":true}] And I want to read all values passed in this xml. This xml is single string return by web service. Currently I am using following code (it's also providing null value for first entry) Object result = envelope.getResponse(); str=result+""; String key,value; String[] couple = str.split(",\""); for(int i =0; i &lt; couple.length ; i++) { String[] items =couple[i].split(":"); key=items[0]; value=items[1]; key=key.replaceAll("\"", ""); value=value.replaceAll("\"", ""); /* some conditions to fetch values */ } Please tell me how can I get exact values and keys in android. Thanks,
has answer: http://stackoverflow.com/a/21892285
duplicate of: http://stackoverflow.com/q/9605913
accepted answer: http://stackoverflow.com/a/21914967

http://stackoverflow.com/a/21908758
has body: Values stored with set-variable can be retrieved with MEL as flowVars['varName']. Take a look at this: http://blogs.mulesoft.org/wp-content/uploads/2012/12/refcard-mel.pdf
has comment: http://stackoverflow.com/comment/33186370
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21894073

http://stackoverflow.com/a/57982059
has comment: http://stackoverflow.com/comment/102433571
downvote count: 0
answers question: http://stackoverflow.com/q/21863134
type: Answer
score: 1
upvote count: 1
has body: I have the same issue but I have a workaround that works for most of my cases: In Settings > Editor > General > Editor Tabs, and under Closing Policy, I set the tab limit to 1. This enforces a single tab per split, which prevents a hidden tab in another split from opening when you navigate to a symbol within it. When you go to declaration, if the destination file is in a split, it will go there, and if it doesn't exist, it will replace the tab in your split. This works for most cases, it might get trickier if you don't want intellij to change the part of the file you're looking at in a split, but for most cases it works. (Also I don't use tabs generally to remember which files, I usually use the Recent Files window to navigate).

http://stackoverflow.com/q/21885247
has comment: http://stackoverflow.com/comment/33163699
favorite count: 0
has body: I am implementing a custom authentication provider which has to authenticate and authorize user (through one time token/password). There is a server already in place for this purpose, and we have been provided a client API to use in our application for making calls to this authentication/authorization server. We are allowed to replicate a test setup of that authentication server in our test environments for commercial reasons, hence we have to somehow mock this client API when we deploy to our environments whereas use an actual impl when we deliver to customer. I am stuck creating a clean way of injecting this client API as a bean to my spring application the client API provided by them is essentially a single package JAR with a public class (no interfaces) and some public static methods to use, there is no interface I can use to inject this client API or a dummy implementation. this is what I was planning to do create an interface public interface ClientAPIWrapper { } and then inject diff implementations of it i.e. public class DummyClientApiBean implements ClientAPIWrapper and public class ClientApiBean extends ClientAPI implements ClientAPIWrapper but then I realized injecting as type of this interface will not allow accessing the methods of original client API class @Autowired private ClientAPIWrapper clientApiBean what I want to achieve is to either use the original Client API class as a bean or a dummy bean returning dummy data transparently to the classes using either of the implementations. something like public MyAuthenticationProvider @Autowired private ClientAPI clientApi how to achieve this?
accepted answer: http://stackoverflow.com/a/21886337
tagged with: spring
type: AnsweredQuestion
score: 2
has title: using multiple implementations for a 3rd party library in spring: stuck finding a clean approach
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/21886337
type: Question
has comment: http://stackoverflow.com/comment/33138832
upvote count: 2
tagged with: spring-aop
tagged with: spring-ioc
answer count: 1

http://stackoverflow.com/a/21886282
has comment: http://stackoverflow.com/comment/33150130
score: 2
downvote count: 0
type: AcceptedAnswer
upvote count: 2
answers question: http://stackoverflow.com/q/21876831
type: Answer
accepted answer of: http://stackoverflow.com/q/21876831
has body: zul : &lt;listbox mold="select" model="@load(vm.listboxModel)" selectedItem="@bind(vm.selectedListBoxItem)" onSelect="@command('check')"&gt; &lt;listitem&gt; &lt;listcell label="@load(each.value)" value="@load(each)" /&gt; &lt;/listitem&gt; &lt;/listbox&gt; vm : private ListModelList listData; // of course init and fill it private Person selectedListBoxItem; public ListModelList getListData() { return listData; } public void setSelectedListBoxItem(Person selectedListBoxItem) { this.selectedListBoxItem = selectedListBoxItem; } public Person getSelectedListBoxItem() { return selectedListBoxItem; } @Command @NotifyChange("listData") public void check() { if (selectedListBoxItem != null) { if (listData.get(0) != null) { System.out.println("added null"); listData.add(0, null); } } else { if (listData.get(0) == null) { System.out.println("removed null"); listData.remove(0); } } } edit: more like this? Did tested it (with the System.out.println("removed null"); so you can check that he does what he needs to do. Hope this is what you wanted (Its what I understand of your question). Greetz chill.

http://stackoverflow.com/comment/33099561
comment on: http://stackoverflow.com/q/21863483
score: 1
type: QuestionComment
has text: Random from 0 till 100000 then result divide by 100. Now try to implement it and if you will have problems with code ask more specific question.
type: Comment

http://stackoverflow.com/comment/33157093
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21895010
has text: Can you please tell me where? and how i can avoid it?

http://stackoverflow.com/comment/33081958
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21853753
type: AnswerComment
has text: As far as the compilation is concerned, it won't fail (tested). But indeed, it will instantiate a raw `Repository`, which will generate a warning.

http://stackoverflow.com/comment/33162663
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21898224
has text: There is no circular array built in to the standard Java 7 collections library.

http://stackoverflow.com/comment/33258415
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21945679
type: AnswerComment
has text: You cannot do this ```new ForgotPassword();``` if the only constructor you provide has two arguments.

http://stackoverflow.com/a/21922988
answers question: http://stackoverflow.com/q/21922855
accepted answer of: http://stackoverflow.com/q/21922855
type: Answer
has comment: http://stackoverflow.com/comment/33207170
has comment: http://stackoverflow.com/comment/33206377
score: 4
has comment: http://stackoverflow.com/comment/33207073
has comment: http://stackoverflow.com/comment/33207019
has comment: http://stackoverflow.com/comment/33208167
upvote count: 4
has comment: http://stackoverflow.com/comment/33208684
type: AcceptedAnswer
downvote count: 0
has body: You have the right idea. Think of it this way: Suppose you are designing a system that works with components that function across the globe and you use the internet to communicate between them. A component in Europe, wants to request a new doctor of Oncology to be transferred from the US component. It can't send a MedicalSpeciality enum over the wire, so instead it sends a String, e.g. "Oncology". Now, in the code of your US component, you want to translate that piece of text to something that your US component system understand: the enum. You need to write a method that takes the input String sent over the wire and returns the corresponding Enum value.

http://stackoverflow.com/comment/33290069
comment on: http://stackoverflow.com/a/21967774
type: Comment
score: 0
type: AnswerComment
has text: Thanks, again :) I was one step to give up tih project by thinking differenting is not possible in Java :)

http://stackoverflow.com/q/21985034
tagged with: java
has answer: http://stackoverflow.com/a/21985110
downvote count: 3
accepted answer: http://stackoverflow.com/a/21985110
has comment: http://stackoverflow.com/comment/33316329
has comment: http://stackoverflow.com/comment/33316577
type: Question
has comment: http://stackoverflow.com/comment/33317062
upvote count: 5
duplicate of: http://stackoverflow.com/q/810273
tagged with: operating-system
has comment: http://stackoverflow.com/comment/33316366
answer count: 1
favorite count: 0
has body: How can we code in java to find out the drive letter on which operating system is installed ?
has title: How to find out operating system drive using java?
linked to: http://stackoverflow.com/q/810273
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33316435

http://stackoverflow.com/comment/33265783
has text: @Pshemo I Added more information, sorry for not being clear the first time.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21955338
type: Comment

http://stackoverflow.com/comment/33100892
comment on: http://stackoverflow.com/q/21864069
type: Comment
type: QuestionComment
score: 3
has text: If the downcast fails, that means that the last thing you `push`ed onto the stack was **not** a `B`. So the problem must be somewhere else in your code.

http://stackoverflow.com/q/21985467
has body: I have ftp port as: ftp://173.201.0.1/ I am trying to connect it through following: String Ftp_Path = "ftp://173.201.0.1/"; public List&lt;String&gt; GetFileList() { String ftpServerIP = Ftp_Path; String ftpUserID = Ftp_UserName; String ftpPassword = Ftp_Password; FTPFile[] downloadFiles = null; StringBuilder result = new StringBuilder(); FTPClient ftp = new FTPClient(); List&lt;String&gt; xlsFiles = null; try { ftp.connect(Ftp_Path); ftp.login(ftpUserID, ftpPassword); downloadFiles=ftp.listFiles(); xlsFiles = new ArrayList&lt;String&gt;(); for(FTPFile i : downloadFiles) { if(i.toString().endsWith(".xls")) { xlsFiles.add(i.toString()); } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return xlsFiles; } But I am getting error on line: ftp.connect(Ftp_Path); Following is the error. java.net.UnknownHostException: ftp://173.201.0.1/ at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.&lt;init&gt;(Unknown Source) at java.net.Socket.&lt;init&gt;(Unknown Source) at org.apache.commons.net.DefaultSocketFactory.createSocket(DefaultSocketFactory.java:92) at org.apache.commons.net.SocketClient.connect(SocketClient.java:201) at org.apache.commons.net.SocketClient.connect(SocketClient.java:289) at com.amazonaws.mws.samples.ImportRulesPropertyClass.GetFileList(ImportRulesPropertyClass.java:33) at com.amazonaws.mws.samples.ManageReportScheduleSample.main(ManageReportScheduleSample.java:74) Plase help me. I am new with java.
has title: java.net.UnknownHostException not able to connect to ftp
has comment: http://stackoverflow.com/comment/33316982
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/21986121
accepted answer: http://stackoverflow.com/a/21985569
has comment: http://stackoverflow.com/comment/33316984
has comment: http://stackoverflow.com/comment/33317010
type: Question
upvote count: 4
tagged with: apache-commons-net
downvote count: 0
score: 4
answer count: 1
has comment: http://stackoverflow.com/comment/33317001
has answer: http://stackoverflow.com/a/21985569
favorite count: 0
tagged with: ftp

http://stackoverflow.com/comment/33206023
type: Comment
has text: Sorry, I should have mentioned above that I can't use any outside methods. Thanks for your help though, wish I could go this route
comment on: http://stackoverflow.com/a/21922703
score: 0
type: AnswerComment

http://stackoverflow.com/q/21886857
score: 3
has comment: http://stackoverflow.com/comment/33141744
has comment: http://stackoverflow.com/comment/33142493
tagged with: concurrency
has comment: http://stackoverflow.com/comment/33141573
has answer: http://stackoverflow.com/a/21887015
upvote count: 3
answer count: 2
has body: Intro So far, I have been working on a piece of software which I am now testing to see the benefit of concurrency. I am testing the same software using two different systems: System 1: 2 x Intel(R) Xeon(R) CPU E5-2665 @ 2.40GHz with a total of 16 cores , 64GB of RAM running on Scientific LINUX 6.1 and JAVA SE Runtime Enviroment (build 1.7.0_11-b21). System 2 Lenovo Thinkpad T410 with Intel i5 processor @ 2.67GHz with 4 cores, 4GB of ram running windows 7 64-bit and JAVA SE Runtime Enviroment (build 1.7.0_11-b21). Details: The program simulates patients with type 1 diabetes. It does some import (read from csv), some numerical computations(Dopri54 + newton) and some export (Write to csv). I have exclusive rights to the server, so there should be no noise at all. Results These are my results: Now as you can see system 1 is just as fast as system 2 despite it is a pretty powerfull machine. I have no idea why this is the case - and I am confident that the system is the same. The number of threads goes from 10-100. Question: Why would does the two runs have similar execution time despite system 1 being significantly more powerfull than system 2? UPDATE! Now, I just thought a bit about what you guys said about it being an I/O memory issue. So, I thought that if I could reduce the file size it would speed up the program, right? I managed to reduce the import file size with a factor of 5, however, no performance improvement at all. Do you guys still think it is the same problem?
downvote count: 0
has comment: http://stackoverflow.com/comment/33141462
has comment: http://stackoverflow.com/comment/33141720
favorite count: 0
has comment: http://stackoverflow.com/comment/33142024
has comment: http://stackoverflow.com/comment/33141722
tagged with: linux
has title: Why is multithreaded Java Program not faster on 'super' Linux server vs laptop Win7?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33142515
tagged with: java
linked to: http://stackoverflow.com/q/10486375
tagged with: multithreading
has answer: http://stackoverflow.com/a/21886997
type: Question
has comment: http://stackoverflow.com/comment/33156403

http://stackoverflow.com/comment/33284133
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21951292
type: Comment
has text: @fliedonion thnx for help... bt it did not work ..thn i have restore my pc... thnk a lot....

http://stackoverflow.com/a/24330032
type: Answer
has body: Currently my luck with the Joda-Time YearMonth class is not good so here is an alternative example using DateTimeFormatter. public static DateTimeFormatter DATEFORMATTER = new DateTimeFormatterBuilder() .appendPattern("MMM, YYYY").toFormatter(); An example piece of code that I added a println() for your benefit. /** * calculates the number of months between the upper and lower bounds * example: int m = numberOfMonths("January, 2009", "May, 2000"); * &gt;m=104 * Uses Joda * Months are full month names * @return */ public int numberOfMonths(String upperMMMMcommaYYYY, String lowerMMMMcommaYYYY){ DateTime upper = DATEFORMATTER.parseDateTime(upperMMMMcommaYYYY); DateTime lower = DATEFORMATTER.parseDateTime(lowerMMMMcommaYYYY); Months m = Months.monthsBetween(lower, upper); System.out.println(upperMMMMcommaYYYY.concat("printed from DateTime looks like ".concat(upper.toString(DATEFORMATTER)))); return m.getMonths; } the println result -> January, 2009 using DateTimeFormatter + DateTime looks like Jan, 2009
score: 0
has comment: http://stackoverflow.com/comment/87003512
answers question: http://stackoverflow.com/q/21941750

http://stackoverflow.com/a/21967715
score: 1
has comment: http://stackoverflow.com/comment/33289213
has comment: http://stackoverflow.com/comment/33287091
has comment: http://stackoverflow.com/comment/33289791
has comment: http://stackoverflow.com/comment/33287393
downvote count: 0
answers question: http://stackoverflow.com/q/21967309
has comment: http://stackoverflow.com/comment/33288992
has body: As far as I understand your concept I think you can simply declare getter method for Board object in Game class and implement it in G. class G { ... public Board getBoard() { return theBoardYouCreatedInG; } } If you already have G object then just provide it in the constructor of Algorithm. Then you just use the G object and its getter method to get Board object public class Algorithm&lt;G extends Game&lt;M&gt;, M extends Move&gt; implements AIp&lt;M&gt; { G g; public Algorithm(G g) { this.g = g; } public someMethod() { g.someMethodFromG(); g.getBoard().someMethodFromBoard(); } } EDIT: If you want to use your code this way, you need getBoard() implemented in Game. If that's not possible then I guess you will have to provide Board object in the constructor (like you did with G object) And G is not supposed to be a real class, it's a type parameter for some class that you will specify later (in this case, any class that implements Game), if you want to use methods of G they need to be declared in Game.
type: Answer
has comment: http://stackoverflow.com/comment/33288701
upvote count: 1

javacv
tags question: http://stackoverflow.com/q/21962234
tags question: http://stackoverflow.com/q/21968038
tag name: javacv
type: Tag
tags question: http://stackoverflow.com/q/21853894

http://stackoverflow.com/comment/33231358
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21937091
has text: sum of 4+8+9+6+3+5 please do modification and must rply

http://stackoverflow.com/q/21896544
type: Question
score: 0
has title: Java Programming onclickListner not working
answer count: 1
has comment: http://stackoverflow.com/comment/33159693
type: UnansweredQuestion
tagged with: android
has body: Here is the code: NewPlanet.java package chapter.hello.hello_world; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.ImageView; public class NewPlanet extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_add); ImageView marsImage = (ImageView)findViewById(R.id.imageMars); marsImage.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub WorldGen mars = new WorldGen("Mars", 642, 3.7); mars.setPlanetColonies(1); finish(); } }); } } Again Here is code:activity_add.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;ImageView android:id="@+id/imageEarth" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_margin="5dp" android:contentDescription="@string/content_desc_earth" android:src="@drawable/ic_launcher"/&gt; &lt;ImageView android:id="@+id/imageMars" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@+id/imageEarth" android:layout_margin="5dp" android:contentDescription="@string/content_desc_mars" android:src="@drawable/ic_launcher" /&gt; &lt;ImageView android:id="@+id/imageVenus" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/imageEarth" android:layout_margin="5dp" android:contentDescription="@string/content_desc_venus" android:src="@drawable/ic_launcher" /&gt; &lt;ImageView android:id="@+id/imageJupiter" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@+id/imageVenus" android:layout_below="@+id/imageMar…
has comment: http://stackoverflow.com/comment/33159886
tagged with: onclick
tagged with: java
has answer: http://stackoverflow.com/a/21896638

http://stackoverflow.com/comment/33227734
type: Comment
comment on: http://stackoverflow.com/q/21935426
has text: Also, `u.equals(%)` is illegal. It should be `u == '%'`.
type: QuestionComment
score: 0

http://stackoverflow.com/q/21876536
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/21876838
has comment: http://stackoverflow.com/comment/33124313
has comment: http://stackoverflow.com/comment/33123379
accepted answer: http://stackoverflow.com/a/21899742
has answer: http://stackoverflow.com/a/21876873
has comment: http://stackoverflow.com/comment/33124613
possible better answer: http://stackoverflow.com/a/21876606
tagged with: spring
has answer: http://stackoverflow.com/a/21876606
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21877404
has answer: http://stackoverflow.com/a/21877996
tagged with: mysql
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33123061
has comment: http://stackoverflow.com/comment/33124237
has answer: http://stackoverflow.com/a/21878383
has body: I have a list of users registered on a website and when the admin clicks to approve, it must fetch the id and then move that row to another table called login... now the problem here is from jsp how to fetch id in servlet so that it can be passed into a method to service and DAO layers. Below is my jsp: id FirstName LastName Gender Category DateOfBirth Age Address Country State City PinCode EmailId ContactNo MobileNo <c:forEach items="${clients}" var="client"> <c:out value="${client.id}"/> <c:out value="${client.firstName}"/> <c:out value="${client.lastName}"/> <c:out value="${client.gender}"/> <c:out value="${client.category}"/> <c:out value="${client.date}"/> <c:out value="${client.age}"/> <c:out value="${client.address}"/> <c:out value="${client.country}"/> <c:out value="${client.state}"/> <c:out value="${client.city}"/> <c:out value="${client.pinCode}"/> <c:out value="${client.emailId}"/> <c:out value="${client.contactNo}"/> <c:out value="${client.mobileNo}"/> APPROVE // I have fetched the id here REJECT ONHOLD </c:forEach> Stack TRace: java.lang.RuntimeException: 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 '?' at line 1 at com.affiliate.DAO.ClientApproveDAO.insertClient(ClientApproveDAO.java:28) at com.affiliate.service.ClientApproveService.clientApprove(ClientApproveService.java:12) at com.affiliate.servlet.ClientApproveServlet.doGet(ClientApproveServlet.java:35) 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 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFi…
has title: How to get id from jsp page to servlet?
has answer: http://stackoverflow.com/a/21899742
tagged with: servlets
score: 0
answer count: 7

http://stackoverflow.com/q/21994283
favorite count: 0
linked to: http://stackoverflow.com/q/1921514
tagged with: android
linked to: http://stackoverflow.com/q/9671546
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33333163
upvote count: 1
type: Question
has body: The problem is: "Skipped 100 frames! The application may be doing too much work on its main thread." As I can solve the problem? Sorry if it's something simple, I'm new to this, I'm learning MainActivity.java package com.ahora.si; import java.util.Date; import android.os.Bundle; import android.view.Menu; import android.widget.Toast; import java.text.DateFormat; import java.util.ArrayList; import java.util.Date; import android.app.Activity; import android.database.Cursor; import android.provider.CallLog; import android.util.Log; import android.app.AlertDialog; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getCallDetails(); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } public void getCallDetails() { StringBuffer sb = new StringBuffer(); Cursor managedCursor = getContentResolver().query(CallLog.Calls.CONTENT_URI, null, null, null, null); int number = managedCursor.getColumnIndex(CallLog.Calls.NUMBER); int name = managedCursor.getColumnIndex(CallLog.Calls.CACHED_NAME); int type = managedCursor.getColumnIndex(CallLog.Calls.TYPE); int date = managedCursor.getColumnIndex(CallLog.Calls.DATE); int duration = managedCursor.getColumnIndex(CallLog.Calls.DURATION); sb.append("Call Log :"); while (managedCursor.moveToNext()) { String phNumber = managedCursor.getString(number); String nombre = managedCursor.getString(name); String callType = managedCursor.getString(type); String callDate = managedCursor.getString(date); Date callDayTime = new Date(Long.valueOf(callDate)); String callDuration = managedCursor.getString(duration); String dir = null; int dircode = Integer.parseInt(callType); switch (dircode) { case CallLog.Calls.OUTGOING_TYPE: dir = "OUTGOING"; break; case CallLog.Calls.INCOMING_TYPE: di…
has title: Android: Error in execute query (Skipped * frames)
has answer: http://stackoverflow.com/a/21994378
accepted answer: http://stackoverflow.com/a/21994378
downvote count: 0
answer count: 1

http://stackoverflow.com/a/21901483
has body: Ok i was not able to build the source, but i was at least able to find a new bonecp-hibernate-provider.jar for the new hibernate 4.3.X You can find it linked here: http://jolbox.com/forum/viewtopic.php?f=3&amp;t=556 I still would appreciate it if someone can help me, why i'm unable to build the source. Thanks
has comment: http://stackoverflow.com/comment/35744069
has comment: http://stackoverflow.com/comment/35730650
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35743996
has comment: http://stackoverflow.com/comment/35744441
answers question: http://stackoverflow.com/q/21884247
type: Answer
accepted answer of: http://stackoverflow.com/q/21884247
has comment: http://stackoverflow.com/comment/35742246

http://stackoverflow.com/a/21974379
type: Answer
accepted answer of: http://stackoverflow.com/q/21973808
answers question: http://stackoverflow.com/q/21973808
has comment: http://stackoverflow.com/comment/33300013
score: 0
has body: You should do something along the lines of Intent i = new Intent(Intent.ACTION_ANSWER); startActivity(i); The doc for the Intent.ACTION_ANSWER is here, you might want to take a look at it. It seems it doesn't need any extras, so you may be good with this.
has comment: http://stackoverflow.com/comment/33300421
type: AcceptedAnswer

http://stackoverflow.com/comment/33122642
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21848063
has text: @jubinPatel I think the OP is using [RSF](http://rsf.fluidproject.org/wiki/Wiki.jsp?page=Main). I created a new [tag](http://stackoverflow.com/questions/tagged/rsf) for it.
score: 0

http://stackoverflow.com/q/21931259
tagged with: android
favorite count: 0
tagged with: ormlite
type: UnansweredQuestion
has body: I searched a lot but I did not understand how to solve my problem. I have two classes like these: public class A { @DatabaseField(generatedId = true) int mId; @DatabaseField(canBeNull = false) private String mName; @ForeignCollectionField(eager = true) private Collection&lt;B&gt; mB; } public class B { @DatabaseField(canBeNull = false) private String mIng; @DatabaseField(foreign = true) private A mA; } My purpose is to fill the object A with the the collection of object B. How can I do? I already have the two DAO object in a class that manage the database.
has answer: http://stackoverflow.com/a/22269254
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22202645
upvote count: 1
type: Question
answer count: 2
downvote count: 0
has title: ORMLite query foreign collection

http://stackoverflow.com/comment/33252287
score: 1
comment on: http://stackoverflow.com/q/21948787
has text: What library are you using?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21940162
score: 0
has comment: http://stackoverflow.com/comment/33236555
answer count: 2
has body: Every time I call getIndex static method of MyClass prints "Index: 1" to screen. I want to increase or decrease index's value. What is wrong with my code? public class MyClass { public static int index=0; public static void getIndex() { index++; System.out.println("Index:"+index); if(index&gt;10) index=0; } }
has title: Why my static variables' values change every time I call?
accepted answer: http://stackoverflow.com/a/21940395
favorite count: 0
tagged with: static
has comment: http://stackoverflow.com/comment/33236368
has comment: http://stackoverflow.com/comment/33237020
possible better answer: http://stackoverflow.com/a/21940456
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21940456
has comment: http://stackoverflow.com/comment/33236683
has comment: http://stackoverflow.com/comment/33236326
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33236557
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21940395
tagged with: static-members
has comment: http://stackoverflow.com/comment/33236373
tagged with: static-methods

http://stackoverflow.com/a/21887832
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21858934
score: 8
accepted answer of: http://stackoverflow.com/q/21858934
type: Answer
downvote count: 0
upvote count: 8
has body: Indeed, entries in POM were missing. I needed to add other entries like that: org.jboss.resteasy resteasy-client 3.0.6.Final provided Note fully specified version and scope still being "provided". I lost a lot of time chasing shadows. Lack of directly specified org.jboss.resteasy:resteasy-client etc in http://mvnrepository.com/artifact/org.jboss.spec/jboss-javaee-7.0/1.0.0.Final was surefire way to put me on wrong track.

http://stackoverflow.com/comment/33097891
has text: @Eluvatar i can't just do status.setChecked(true) if i do that all of the checkbox in array list will be checked. i need just suitable with my result and code in my list will be checked.
comment on: http://stackoverflow.com/q/21862588
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33170592
score: 1
has text: This question appears to be off-topic because OP asks us to write code for him/her.
comment on: http://stackoverflow.com/q/21899569
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21910604
score: 7
has comment: http://stackoverflow.com/comment/79890848
answers question: http://stackoverflow.com/q/21906361
type: Answer
upvote count: 7
accepted answer of: http://stackoverflow.com/q/21906361
type: AcceptedAnswer
has body: This is a consequence of how Spring autowires constructors. The first thing it does is gets all the bean class' constructors and sorts them, putting public constructors first with decreasing amount of arguments, then all non-public constructors again with decreasing amount of arguments. These are the candidate constructors. It then iterates through these candidates, trying to generate the arguments from the BeanFactory. If it can't because a bean is missing or for whatever other reason, it skips the candidate. If it succeeds in finding the arguments, it gives the current candidate constructor a weight based on a number of factors (argument list length, how close the types of the arguments vs the parameters are, etc.). It then checks the previous candidate's weight and swaps them if one is better than the other. If there is a candidate constructor at the end of this process, Spring uses it. If you're saying that Spring is using your 2 arg constructor over your 3 arg constructor, then that means you don't have a bean of one of the types in your 3 arg constructor.
downvote count: 0

http://stackoverflow.com/a/22002277
type: Answer
answers question: http://stackoverflow.com/q/22002188
score: 0
has body: The code could also be if (newWord[i].toLowerCase().equals(result.toLowerCase())) { count++; if (count &gt; 1) { palindromeWords += ", "; } palindromeWords += newWord[i]; }

http://stackoverflow.com/comment/33227623
comment on: http://stackoverflow.com/q/21935262
score: 0
has text: @Kayz : Thanks for replying. I have no idea where to start from. Actually i didn't encounter this type of situation earlier.
type: Comment
type: QuestionComment

opencv
type: Tag
tags question: http://stackoverflow.com/q/21853894
tags question: http://stackoverflow.com/q/21998366
tags question: http://stackoverflow.com/q/21962234
tag name: opencv
tags question: http://stackoverflow.com/q/21947379
tags question: http://stackoverflow.com/q/21860290
tags question: http://stackoverflow.com/q/21989097
tags question: http://stackoverflow.com/q/21968185
tags question: http://stackoverflow.com/q/21968038
tags question: http://stackoverflow.com/q/21949222
tags question: http://stackoverflow.com/q/21845778
tags question: http://stackoverflow.com/q/21921421
tags question: http://stackoverflow.com/q/21902253
tags question: http://stackoverflow.com/q/21880941

http://stackoverflow.com/q/21995443
downvote count: 0
favorite count: 0
tagged with: groovy
answer count: 0
linked to: http://stackoverflow.com/q/9584957
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33335823
upvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/9584957
has title: Accessing another's instance private field of the same class in Java and Groovy
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33336334
has body: Assume that we have such piece of code in Java: abstract class A { private int x = 1; public void smth(A a) { a.x = 2; } public void print() { System.out.println(x); } } class B extends A {} public class Main2 { public static void main(String[] args) { B b1 = new B(), b2 = new B(); b2.smth(b1); b1.print(); b2.print(); } } This code compiles and outputs 1 2, as expected. However, when we compile an analogous piece of code in Groovy, it throws a groovy.lang.MissingPropertyException: class A { private int x = 1; void smth (A a) { a.x = 2 } void print() {println x} } class B extends A {} B b1 = new B(), b2 = new B() b2.smth(b1) b1.print() b2.print() So the question is: can we access a private field of another instance of the came class in Groovy as we do in analogous Java code, and how?

http://stackoverflow.com/comment/77990576
type: AnswerComment
score: 4
type: Comment
comment on: http://stackoverflow.com/a/21944585
has text: @Hadi had the same problem. I fixed it replacing `return new SimpleCacheResolver();` with `return new SimpleCacheResolver(cacheManager());` in the CachingConfig class

http://stackoverflow.com/comment/33346914
type: AnswerComment
comment on: http://stackoverflow.com/a/22001724
score: 0
has text: i want to retrieve or select today time Stamp form column ActionDate
type: Comment

http://stackoverflow.com/a/21847248
upvote count: 5
answers question: http://stackoverflow.com/q/21847176
type: Answer
downvote count: 0
has body: Try this to get the Minutes, and Hour from the Calender instance of Current Day this.minutes = calendar.get(Calendar.MINUTE); this.hours= calendar.get(Calendar.HOUR_OF_DAY); Calendar.MINUTE and Calendar.HOUR_OF_DAY are constants, it only give the int value. Apply the int value to your calendar instance and get the Minute and Hour value.
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21847176

http://stackoverflow.com/q/21980309
tagged with: jsf-2
has body: I am working on JSF and Hibernate integration, where i have a dataTable , which contains records from multiple table records. I just want, When i click a row the row values should be assigned to respective pojo class . I identified that we can do it using setPropertyActionListener I have the following methods. HQL Query='select a from Personal as a &lt;p:dataTable var="leavereq" value="#{leaverequest.requestlist}" &gt; &lt;p:column headerText="Name" &gt; &lt;h:outputText value="#{leavereq.ename}" /&gt; &lt;/p:column&gt; &lt;p:column headerText="Action"&gt; &lt;p:commandButton id="selectButton" &gt; &lt;f:setPropertyActionListener value="#{leavereq}" target="#{leaverequest.lrb}" /&gt; &lt;/p:commandButton&gt; &lt;/p:column&gt; Target class: Personal lrb; This is working fine...!! HQL Query='select a.name,b.eid from Personal as a,Official as b'; &lt;p:dataTable var="leavereq" value="#{leaverequest.requestlist}" &gt; &lt;p:column headerText="Name" &gt; &lt;h:outputText value="#{leavereq.ename}" /&gt; &lt;/p:column&gt; &lt;p:column headerText="Id" &gt; &lt;h:outputText value="#{leavereq.eid}" /&gt; &lt;/p:column&gt; &lt;p:column headerText="Action"&gt; &lt;p:commandButton id="selectButton" &gt; &lt;f:setPropertyActionListener value="#{leavereq}" target="#{leaverequest.lrb}" /&gt; &lt;/p:commandButton&gt; &lt;/p:column&gt; Here the value will be depend on two tables Target classes: Personal lrb;Official official; This is not working !! How cal i set the values in two pojo classes using setPropertyActionListener ?
has title: How to set dataTable value in pojo using setPropertyActionListener?
type: Question
tagged with: jsf
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33351004
has comment: http://stackoverflow.com/comment/33340351
answer count: 0
type: UnansweredQuestion

collections
tags question: http://stackoverflow.com/q/21911871
tags question: http://stackoverflow.com/q/21973757
tags question: http://stackoverflow.com/q/21856422
tags question: http://stackoverflow.com/q/21907802
tags question: http://stackoverflow.com/q/21954628
tags question: http://stackoverflow.com/q/21967081
tags question: http://stackoverflow.com/q/21897314
tags question: http://stackoverflow.com/q/21865701
tags question: http://stackoverflow.com/q/21893358
tags question: http://stackoverflow.com/q/21986752
tags question: http://stackoverflow.com/q/21994259
tags question: http://stackoverflow.com/q/21951436
tags question: http://stackoverflow.com/q/21854353
tags question: http://stackoverflow.com/q/21947441
tags question: http://stackoverflow.com/q/21926480
type: Tag
tags question: http://stackoverflow.com/q/22001509
tags question: http://stackoverflow.com/q/21876785
tags question: http://stackoverflow.com/q/21947180
tags question: http://stackoverflow.com/q/21990651
tags question: http://stackoverflow.com/q/21914374
tags question: http://stackoverflow.com/q/21990133
tags question: http://stackoverflow.com/q/21986551
tags question: http://stackoverflow.com/q/21946258
tag name: collections
tags question: http://stackoverflow.com/q/21868178
tags question: http://stackoverflow.com/q/21995409
tags question: http://stackoverflow.com/q/21974361
tags question: http://stackoverflow.com/q/21895478
tags question: http://stackoverflow.com/q/21991521
tags question: http://stackoverflow.com/q/21989020
tags question: http://stackoverflow.com/q/21843689

http://stackoverflow.com/comment/33122957
has text: if I return a string then will user get a browser save/open dialog box? thats what i need
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21876436
type: AnswerComment

http://stackoverflow.com/a/21998750
accepted answer of: http://stackoverflow.com/q/21998658
answers question: http://stackoverflow.com/q/21998658
downvote count: 0
has body: I think you want this: arrl.add(new Data("phil",21)); arrl.add(new Data("sarah",43)); arrl.add(new Data("william",37));
type: Answer
has comment: http://stackoverflow.com/comment/33344819
upvote count: 4
type: AcceptedAnswer
score: 4

http://stackoverflow.com/a/21844983
type: Answer
answers question: http://stackoverflow.com/q/21844744
score: 0
has body: Check the javadocs for java.text.SimpleDateFormat It describes everything you need.

http://stackoverflow.com/comment/33117099
comment on: http://stackoverflow.com/a/21872708
type: Comment
score: 0
type: AnswerComment
has text: ya am partially able to understand but what do you mean by exact object of particular form?? you mean to say that object of particular bean of a particular form??

http://stackoverflow.com/q/21955816
has comment: http://stackoverflow.com/comment/33265394
has comment: http://stackoverflow.com/comment/33265441
has title: MVC: Views does not update
has comment: http://stackoverflow.com/comment/33264511
has comment: http://stackoverflow.com/comment/33265231
tagged with: netbeans
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33264516
tagged with: swing
has comment: http://stackoverflow.com/comment/33266964
has comment: http://stackoverflow.com/comment/33265053
tagged with: model-view-controller
tagged with: java
has comment: http://stackoverflow.com/comment/33265405
has comment: http://stackoverflow.com/comment/33265571
type: Question
has comment: http://stackoverflow.com/comment/33264885
has comment: http://stackoverflow.com/comment/33265023
tagged with: jpa
has body: At first This app was built without database It 's works well. But after I modified it to work with database ,the views become not responding when call the deposit or delete account function. but the database transaction is work normally. I don't know why please help me this is Institute public class Institute extends Observable { private String name; private String contactPerson; private String telephone; private String address; private List&lt;Account&gt; accountList; private static Institute instance; private List&lt;Account&gt; getAccountsFromDB() { EntityManagerFactory emf = Persistence.createEntityManagerFactory("Lab12WithDBPU"); EntityManager em = emf.createEntityManager(); List&lt;Account&gt; accounts = em.createNamedQuery("Account.findAll").getResultList(); return accounts; } private Institute(){ accountList = getAccountsFromDB(); }//end cons public static Institute getInstance(){ //follow singleton design pattern if (instance == null) { instance = new Institute(); }//end if return instance ; }//end method public static int addData (Account e) { persist(e); return 1; } public static void removeData (Account e) { EntityManagerFactory emf = Persistence.createEntityManagerFactory("Lab12WithDBPU"); EntityManager em = emf.createEntityManager(); Account employee = em.find(Account.class, e.getAccountId()); em.getTransaction().begin(); em.remove(employee); em.getTransaction().commit(); } public void closeAccount(String accountId) throws IllegalArgumentException { Account deleteAccount = findAccountById(accountId); //not found the account object if (deleteAccount == null) { throw new IllegalArgumentException("The Account ID not found"); }//end if //can't delete current that have saving if (deleteAccount.getAccountType() == AccountType.CURRENT &amp;&amp; this.accountList.size() &gt; 1) { throw new IllegalArgumentException("Can't Delete \"Current\" Account Type that have \"Saving\" Accounts Type"); }//end method //can't delete current that have balance &gt; 0 if (dele…
has comment: http://stackoverflow.com/comment/33265303
has comment: http://stackoverflow.com/comment/33264509
score: 0

http://stackoverflow.com/a/21961356
has comment: http://stackoverflow.com/comment/33275561
type: Answer
downvote count: 2
upvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/33275017
has comment: http://stackoverflow.com/comment/33275904
answers question: http://stackoverflow.com/q/21961239
has body: I'd recommend that you try using Javascript Regular Expressions to validate user inputs and show/hide error messages. I provided a code implementation example in the post at this link: Example using Regular Expresssions Add an event listener to relevant input field in the DOM to provide responsiveness. var letterField = document.getElementById('letterField'); // DOM element containing user input letterField.addEventListener('keyup', function() { // key press event listener using anonymous function if (event.keyCode === 13) { // run this code if the 'enter' key is pressed if ( ... ) { ... }; }; }; If you want to add effects, include the following code to transition the error message. Refer to the jQuery API for other effects: userInputError.delay(800).fadeOut();

http://stackoverflow.com/comment/33214781
type: QuestionComment
score: 0
has text: Thats what I wanted to know ..does it depend on platform ?
type: Comment
comment on: http://stackoverflow.com/q/21926643

http://stackoverflow.com/comment/38801206
has text: Have the same problem, but solution you describe here not working for me. BUILD FAILURE Could not find goal 'remove' in plugin org.codehaus.mojo:exec-maven-plugin:1.2
type: Comment
comment on: http://stackoverflow.com/a/22842364
score: 0
type: AnswerComment

http://stackoverflow.com/a/21958462
score: 0
has body: Turns out I had to make .SetSize greater
type: Answer
answers question: http://stackoverflow.com/q/21958391

http://stackoverflow.com/q/21994981
tagged with: ant
score: 0
accepted answer: http://stackoverflow.com/a/21997341
answer count: 1
tagged with: junit
has title: Junit Ant Jenkins ClassNotFoundException
has answer: http://stackoverflow.com/a/21997341
type: AnsweredQuestion
tagged with: java
type: Question
has body: I am running Junit Tests on Jenkins via ant, and I am getting really stuck with this one error. Relevant parts of my ant file: <export srcUrl="${svn.junit}" destPath="${junit.dir}" /> <pathelement location="${test.classes}" /> <pathelement location="${test.classes}" /> <formatter type="xml" /> <include name="**/*Test*.java" /> <fail message="TEST FAILER" if="failed" /> <pathelement location="${basedir}/junit-4.11.jar" /> <pathelement location="${basedir}/ant-junit-1.8.4.jar" /> <pathelement location="${build.classes.dir}" /> <pathelement location="${build.lib.dir}" /> <pathelement location="${source.dir}" /> The tests compile into test-classes folder and runs in test with console output: [junit] Test com.some.app.ProjectName.MyTestClass FAILED When you go to view the test in test results, it shows the stack trace java.lang.ClassNotFoundException: com.some.app.ProjectName.MyTestClass at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169)

http://stackoverflow.com/comment/33198150
comment on: http://stackoverflow.com/q/21918275
type: Comment
type: QuestionComment
has text: That's interesting, isn't it @TedHopp?
score: 0

androidasync-koush
tags question: http://stackoverflow.com/q/21998460
type: Tag
tag name: androidasync-koush

jdesktop
tag name: jdesktop
tags question: http://stackoverflow.com/q/21928045
type: Tag

http://stackoverflow.com/comment/33297387
comment on: http://stackoverflow.com/a/21973099
has text: The syntax and semantics of this construct is defined here: http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12, (pretty strong meat however).
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/21958926
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21959145
has answer: http://stackoverflow.com/a/22238512
tagged with: locks
possible better answer: http://stackoverflow.com/a/21959145
tagged with: cas
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/22238512
linked to: http://stackoverflow.com/q/22236928
type: AnsweredQuestion
tagged with: java
has body: So I want an array with 10 volatile booleans, not a volatile array with 10 booleans. It probably does not even make sense to have a volatile array reference, correct me if I am wrong.
has title: How to have an array of volatile booleans in Java and not a volatile array of booleans?
has comment: http://stackoverflow.com/comment/33270476
tagged with: concurrency
type: Question

http://stackoverflow.com/comment/33229131
comment on: http://stackoverflow.com/a/21936242
score: 0
type: Comment
has text: mViewPager is declared inside the MainActivity but when I try to use it in the `AppSectionsPagerAdapter` it says it is not static etc Im not sure if I should make it static?
type: AnswerComment

http://stackoverflow.com/a/21964766
accepted answer of: http://stackoverflow.com/q/21964541
answers question: http://stackoverflow.com/q/21964541
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33303948
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/33294345
has comment: http://stackoverflow.com/comment/33281144
upvote count: 1
has body: At n=22 the results seem to repeat from the position of n=2. So keep those 20 values in an array in the same order as in your list e.g. nums[20]. Then when the user provides an n: return nums[(n-2)%20] There is now a proof of this pattern repeating here. Alternatively, if you insist on computing at length; since you calculating the power by looping multiplication (and not BigDecimal pow(n)) you could trim the number you are working with at the front to the last 2 digits and the fractional part.

http://stackoverflow.com/q/21910754
accepted answer: http://stackoverflow.com/a/21911764
tagged with: java
upvote count: 1
tagged with: gradle
answer count: 1
tagged with: task
tagged with: class
has answer: http://stackoverflow.com/a/21911764
tagged with: groovy
has body: For creating Gradle's custom task classes does it matter which language we will use - Java or Groovy? For example if I want to create GreetingTask.groovy or GreetingTask.java? If there any considerations of prefer one over the other - performance or other?
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has title: Which language to use for custom Gradle tasks classes?
type: Question

http://stackoverflow.com/q/21894048
has title: How to fix a Java VM missing class
tagged with: java
tagged with: openfire
type: Question
has answer: http://stackoverflow.com/a/21894090
answer count: 1
has body: I am getting this error when trying to run OpenFire on the jamVM Java Virtual Machine java.util.jar.Pack200 not found in java.lang.ClassLoader We have found the Pack200 jar file, but don't understand how to add it to the Java VM
has comment: http://stackoverflow.com/comment/33155139
type: UnansweredQuestion
score: 0

http://stackoverflow.com/comment/33633070
type: Comment
has text: Thank you Anish it is perfect
comment on: http://stackoverflow.com/a/22141773
type: AnswerComment
score: 0

http://stackoverflow.com/a/21991257
has body: Yes, you use the String.toCharArray() method ( here's the API ). Learn more here - String to char array Java example: String happy = "Yaya happee"; char[] happier = happy.toCharArray();
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21991192
upvote count: 1
score: 1

http://stackoverflow.com/a/21890869
type: Answer
upvote count: 1
score: 1
has body: Create one additional array which contains the integer indices of your data arrays. Then sort the indices rather than the data arrays. By adding multiple index arrays, you could even have multiple sort orders based on different criteria without ever moving the original data. The sort would order the index set using pseudo-code logic along the lines of: if (average[index[i]] &gt; average[index[j]]) { swap(index[i], index[j]) } It's not clear from the restriction you cited whether you are supposed to write your own sort or can create a Comparator, but the fundamental idea remains the same: that you rearrange the index set rather than the much more expensive operation of moving multiple arrays worth of data synchronously.
downvote count: 0
answers question: http://stackoverflow.com/q/21890588

http://stackoverflow.com/comment/33195270
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21916861
has text: Not...not really, not without just shifting the work elsewhere. You could build a static final map of the enum names, or loop directly over the enum values.
score: 0

http://stackoverflow.com/comment/33097570
type: AnswerComment
comment on: http://stackoverflow.com/a/21857311
has text: I sadly have to shell out and make the function "windows-only", because java let windows do the file-moving-process. only single cmd commands move files in a sorted order.
type: Comment
score: 0

http://stackoverflow.com/comment/33293123
comment on: http://stackoverflow.com/q/21971358
has text: I've added a sample from the client code which needs an instance of IntervalComparator in order to create a TreeMap.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/43900696
has comment: http://stackoverflow.com/comment/108822778
downvote count: 2
type: Answer
upvote count: 33
answers question: http://stackoverflow.com/q/21964709
score: 31
has body: Use jenv, it is like a Java environment manager. It is super easy to use and clean For Mac, follow the steps: brew install jenv git clone https://github.com/gcuisinier/jenv.git ~/.jenv Installation: If you are using bash follow these steps: $ echo 'export PATH="$HOME/.jenv/bin:$PATH"' &gt;&gt; ~/.bash_profile echo 'eval "$(jenv init -)"' &gt;&gt; ~/.bash_profile $ exec $SHELL -l Add desired versions of JVM to jenv: jenv add /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home jenv add /System/Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/Home Check the installed versions: jenv versions Set the Java version you want to use by: jenv global oracle64-1.6.0

http://stackoverflow.com/q/21960597
tagged with: for-loop
has answer: http://stackoverflow.com/a/21960666
has comment: http://stackoverflow.com/comment/33273635
has answer: http://stackoverflow.com/a/21960646
favorite count: 0
has body: The method printPowersOf2 accepts a max number as the argument and prints each power of 2 from 2^0 up to that max number. printPowersOf2(3); outputs 1 2 4 8 printPowersOf2(5); outputs 1 2 4 8 16 32 I can't seem to figure out the right code to print. I have to use a loop and the *= operator. Math class not allowed. I know its something so simple too Here is my code public class Chap3LabP2 { public static void main(String[] args) { printPowersof2(3); printPowersof2(5); printPowersof2(10); printPowersof2(12); } public static void printPowersof2(int maxNum){ System.out.print("1" + " "); for(int i = 1; i &lt;= maxNum; i++){ System.out.print(i*2 + " "); } System.out.println(""); } }
answer count: 3
has comment: http://stackoverflow.com/comment/33273622
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33273451
has answer: http://stackoverflow.com/a/21960647
has title: Need help printing the powers of two
has comment: http://stackoverflow.com/comment/33273590
tagged with: loops
upvote count: 1
has comment: http://stackoverflow.com/comment/33273559
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33273489
tagged with: java
has comment: http://stackoverflow.com/comment/33273706
score: 0

http://stackoverflow.com/comment/33348966
type: Comment
score: 0
has text: I actually really like this method and have tried implementing it, works a treat, thanks :)
type: AnswerComment
comment on: http://stackoverflow.com/a/22002803

http://stackoverflow.com/a/21999437
answers question: http://stackoverflow.com/q/21999221
has comment: http://stackoverflow.com/comment/33342809
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: Before you check if the guessed number is less or more than the secret number, place this check just before: if (guess &lt; minimum || guess &gt; maximum) { System.out.print("Please enter a number between " + minimum + " and " + maximum); continue; } if (guess &gt; secretNumber) { maximum = guess - 1; System.out.print("Enter a number between " + minimum + " and " + maximum + " (inclusive): "); }

http://stackoverflow.com/a/22270697
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33833000
answers question: http://stackoverflow.com/q/21909439
has body: You could create and evaluate a ValueExpression using a bean or function as an intermediary: package hoteval; import javax.el.*; import javax.enterprise.context.ApplicationScoped; import javax.inject.Named; import javax.servlet.jsp.*; @ApplicationScoped @Named public class Expr { public Object eval(PageContext pageContext, String expression) { ExpressionFactory factory = JspFactory.getDefaultFactory() .getJspApplicationContext(pageContext.getServletContext()) .getExpressionFactory(); ELContext elCtxt = pageContext.getELContext(); ValueExpression ve = factory .createValueExpression(elCtxt, expression, Object.class); return ve.getValue(elCtxt); } } The invocation syntax looks like this: ${expr.eval(pageContext, "${bean.prop}")} Written/tested against Glassfish 4.0. The above code is just an example. To serve an expression of the form ${expr.eval(pageContext, object, path)} where path is a.b.c it could be rewritten as: public Object eval(PageContext pageContext, Object o, String path) { expression = "${_tmpRootObject."+expression+"}"; pageContext.setAttribute("_tmpRootObject", o); //etc. The evaluation code could equally become a function taking the form ex:eval(.... Regarding the comment about using an ELResolver. You would add an ElResolver to the JspApplicationContext (see above) in a ServletContextListener. It will get called before most other resolvers - see order. But now you have some problems in getValue(ELContext, Object, Object). For ${object[path]} you get whatever value path resolves to and need to distinguish between it and other properties (bean properties/map values/etc.) Looking for a string instance containing . might be enough so long as you check the base type is not a Map. You will probably have to split the string and use reflection to look for the properties. I don't think nested evaluation (resolving a ValueExpression in an ELResolver) is supported but I may be wrong.

http://stackoverflow.com/comment/33215995
comment on: http://stackoverflow.com/a/21928741
type: Comment
score: 0
type: AnswerComment
has text: You can also consider using the [StringTokenizer](http://docs.oracle.com/javase/7/docs/api/java/util/StringTokenizer.html)

http://stackoverflow.com/q/21915280
has answer: http://stackoverflow.com/a/21947957
has title: Drawing in panels that are in a frame, i have the title but the colon so far isnt working
score: 0
answer count: 2
tagged with: awt
has comment: http://stackoverflow.com/comment/33192798
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21927664
has comment: http://stackoverflow.com/comment/33204529
tagged with: java
tagged with: swing
has body: The overall goal is to create a static digital clock that will show the current time. I got the title to work how i wanted it, but i can not get the colon to draw appropriately. Here is my frame code. package hw04; /** * * @author Jake */ public class DigitalTimeUI extends javax.swing.JFrame { /** * Creates new form DigitalTimeUI */ public DigitalTimeUI() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { titlePanel1 = new hw04.TitlePanel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); javax.swing.GroupLayout titlePanel1Layout = new javax.swing.GroupLayout(titlePanel1); titlePanel1.setLayout(titlePanel1Layout); titlePanel1Layout.setHorizontalGroup( titlePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 700, Short.MAX_VALUE) ); titlePanel1Layout.setVerticalGroup( titlePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 100, Short.MAX_VALUE) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(titlePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(titlePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(209, Short.MAX_VALUE)) ); pack(); }// &lt;/editor-fold&gt; /** * @param args the command line ar…
type: Question

http://stackoverflow.com/comment/111833387
type: AnswerComment
score: 0
has text: I believe the first comment concerned the literal string `"null"`
type: Comment
comment on: http://stackoverflow.com/a/21936586

http://stackoverflow.com/comment/33114537
comment on: http://stackoverflow.com/q/21871672
score: 0
type: Comment
type: QuestionComment
has text: yes I have two methods one to remove from the front and tail but that's all right now..

http://stackoverflow.com/q/21902124
answer count: 3
has answer: http://stackoverflow.com/a/21902273
tagged with: windows
accepted answer: http://stackoverflow.com/a/21902206
has body: I have this system variable this code: System.out.println(System.getProperty("area")); returns null. Could I get acces to system variables from java code through System.getProperty method ? P.S
upvote count: 7
tagged with: properties
type: AnsweredQuestion
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/21902268
type: Question
has title: Why System.getProperty doesn't return value from System variables in windows
downvote count: 0
has answer: http://stackoverflow.com/a/21902206
favorite count: 0
tagged with: system
possible better answer: http://stackoverflow.com/a/21902273

http://stackoverflow.com/q/21951760
has body: public class ElectronicCounter { public ElectronicCounter(User user)throws IOException{ Scanner scanner = new Scanner(System.in); boolean done = false; loginName = user.getName(); System.out.println("--------------------------------------------------------"); System.out.println("Welcome to the Electronic-Sales Counter! "); while(!done){ try{ System.out.print("Please enter '1' to record sales or '2' to exit:"); input = scanner.nextLine(); System.out.println("bug"); if(input=="1"){ System.out.println("Please enter a list of purchasing-product ID and number"); done = true; } else if(input=="2"){ System.out.println("&lt;LOG&gt; User " +loginName+ " has successfully logged off! "); done = true; } else{ System.out.println("&lt;LOG&gt; Invalid command"); } } catch (NoSuchElementException e){ System.out.println("&lt;LOG&gt; No Such Element"); } catch (IllegalStateException e){ System.out.println("&lt;LOG&gt; IllegalState"); } } scanner.close(); } static String loginName; static String input; } The scanner doesn't stop to search the token when scanner.nextLine() is computed. I would like to ask how can I stop the scanner to wait input??Thanks
type: AnsweredQuestion
tagged with: java
duplicate of: http://stackoverflow.com/q/513832
accepted answer: http://stackoverflow.com/a/21951804
type: Question
has title: scanner.next() does not stop
answer count: 1
has answer: http://stackoverflow.com/a/21951804
score: 0
linked to: http://stackoverflow.com/q/513832
tagged with: java.util.scanner
linked to: http://stackoverflow.com/q/20385179

http://stackoverflow.com/q/22003104
has answer: http://stackoverflow.com/a/22015486
answer count: 7
has comment: http://stackoverflow.com/comment/33349192
has answer: http://stackoverflow.com/a/70241678
tagged with: java
has comment: http://stackoverflow.com/comment/33349232
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33349247
has answer: http://stackoverflow.com/a/22003152
has answer: http://stackoverflow.com/a/22003296
score: 8
has title: Java - Recursion to replace letter in string
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/70241238
favorite count: 0
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/22003377
has body: I am full aware that strings are immutable and can't be changed and can be "editabile" - ohhh the controversy! So I am trying to get it so that without the replace() method for strings in java, to implement where a specific char in a string gets switched out with another char. I want to do this as simply as possibly without needing to import any util or use arrays. thus far, I've gotten it to change the character, but it's not returning correctly, or, that is... the string ends. public static void main(String[] args) { String words = "hello world, i am a java program, how are you today?"; char from = 'a'; char to = '/'; replace(s, from, to); } public static String replace(String s, char from, char to){ if (s.length() &lt; 1) return s; if (s.charAt(0) == from) { s = to + s.substring(1); } System.out.println(s); return s.charAt(0) + replace(s.substring(1, s.length()), from, to); }
has answer: http://stackoverflow.com/a/22003150

http://stackoverflow.com/comment/33328209
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21991521
has text: No. Just asking. You said *sort*, but that looks more like grouping.

http://stackoverflow.com/comment/33235896
has text: Why not use Lists instead? And why not make the array non-nullable: would be better for the caller, who wouldn't have to do the null check that is bothering you.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21939876
score: 1

http://stackoverflow.com/q/21956004
type: AnsweredQuestion
has body: is it possible to have a variable set in the group of Z4. So that if i had the following code "int" x = 3; x = x + 1; the value of x would be 0. I know I can use mod 4 but I was wondering if you can change "int" to make it mod 4
has comment: http://stackoverflow.com/comment/33264887
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33264909
has title: using the group Z4 to shorten code
has comment: http://stackoverflow.com/comment/33264850
has comment: http://stackoverflow.com/comment/33264817
score: 0
has answer: http://stackoverflow.com/a/21956165
answer count: 1
has comment: http://stackoverflow.com/comment/33264869
favorite count: 0
has comment: http://stackoverflow.com/comment/33264941
has comment: http://stackoverflow.com/comment/33264952
upvote count: 1
accepted answer: http://stackoverflow.com/a/21956165

http://stackoverflow.com/comment/33080238
has text: for Map<String,String> i tried but unable to implement for above data structure.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21852961
type: QuestionComment

http://stackoverflow.com/comment/33261624
score: 0
comment on: http://stackoverflow.com/q/21952381
type: Comment
type: QuestionComment
has text: But it is installed on their computer?

http://stackoverflow.com/comment/33333141
type: AnswerComment
comment on: http://stackoverflow.com/a/21993539
has text: what i actually want is to switch between threads ,is that possible? a user has opened multiple threads when given the choice ,lets say 4 threads.now he want to go to thread 2 ,how do i do that?
type: Comment
score: 0

http://stackoverflow.com/comment/33085919
has text: mKorbel // thxs for editing title&tags
score: 0
comment on: http://stackoverflow.com/q/21854443
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33277231
has text: This wasn't a reasonable answer because you only had to read the logcat to see this was not the issue, as android is good at printing such advice
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21962607
type: AnswerComment

http://stackoverflow.com/a/21848195
has body: It is not bad practice at all. I think it is the opposite. I think different behaviours should use different sharedPreference files. .getDefaultSharedPreferences() uses the default com.company.packagename.xml file. And the others create their own files. The followings advantages of using multiple sharedPreference's come up in my mind. When you use BackupManager, you can provide which sharedPreference files to backup and restore. When the user logout, you can delete sharedPreference file with that users private values in it. You may not want to delete some other.
score: 24
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21847872
type: Answer
upvote count: 24
has comment: http://stackoverflow.com/comment/33072055
answers question: http://stackoverflow.com/q/21847872

http://stackoverflow.com/comment/33062223
type: Comment
has text: @SotiriosDelimanolis My context path is `/blah`, and I've tried a dozen different URLs - `/blah/hello` is the one I would expect to work... right?
type: QuestionComment
comment on: http://stackoverflow.com/q/21842287
score: 0

http://stackoverflow.com/a/21854293
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21846609
downvote count: 0
answers question: http://stackoverflow.com/q/21846609
score: 1
upvote count: 1
has body: No. S3 will do this correctly as you ask S3 to "assemble" the files in a separate call after all the parts are ready. It is at this stage, the file is made available on S3. http://aws.typepad.com/aws/2010/11/amazon-s3-multipart-upload.html Since you are doing video (and I have some experience with videos), the is a pitfall. Typically video encoding softwares does modification to the beginning part of the file, when you end the recording (this is to do with the way the video file format is organized and they do this so that the progressive-download of videos are good). If this is the case, you will end up with a corrupted video on S3, since your code "had already uploaded" the initial parts. This is not the case always - varies with video format, tools used etc. So be aware of this (if not beware !)

http://stackoverflow.com/comment/33125081
type: AnswerComment
score: 0
has text: @user3327151 Is there any reason you need to instantiate a separate `HbaseUtil1` for this method then? If the `MessageProcessor1` already has one set, there should be no need to instantiate a new one and use that one instead. I would remove the `HbaseUtil1 util = new HbaseUtil1();` from the `listAllKeyword` method and use the `hbaseUtil` from the `MessageProcessor1`, so you get `List<String> qualifiers = hbaseUtil.getAllKeyword("msg", userId)` Then in the test class, add `messageProcessor.setHbaseUtil(hbaseUtil);` as the last line in the `setUp` method.
type: Comment
comment on: http://stackoverflow.com/a/21876491

http://stackoverflow.com/comment/84053009
comment on: http://stackoverflow.com/q/21987675
has text: `saveOutputFlashMap()` was added to `FlashMapManager` in Spring 3.1.1 - it does not exist in Spring 3.1.0.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21969235
has body: Process process = Runtime.getRuntime().exec(String.format("python.exe test.py %s %d", "lightStatus", 1)); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String deviceCmd = reader.readLine(); System.out.println(deviceCmd); test.py: import sys import argparse if __name__ == "__main__": para = sys.argv[1] value = sys.argv[2] message = '{"message": "change_lightStatus", "value": %d}'%int(value) print (message) Wht the Java output is null? I want to get the String
tagged with: python
has answer: http://stackoverflow.com/a/21969375
accepted answer: http://stackoverflow.com/a/21969375
type: AnsweredQuestion
tagged with: java
tagged with: process
type: Question
has title: About the usage of exec for Python in Java?
score: 0
answer count: 1

http://stackoverflow.com/a/21947934
upvote count: 3
type: Answer
downvote count: 0
score: 3
has body: public class test { // Define the menu method in the class not in another method. public static void menu() { } public static void main(String[] args) { menu(); // Call it from the main method. } }
answers question: http://stackoverflow.com/q/21947898

compiler-errors
tags question: http://stackoverflow.com/q/21861891
tags question: http://stackoverflow.com/q/21948917
tag name: compiler-errors
type: Tag
tags question: http://stackoverflow.com/q/21864402
tags question: http://stackoverflow.com/q/21969603
tags question: http://stackoverflow.com/q/21880653
tags question: http://stackoverflow.com/q/21952549
tags question: http://stackoverflow.com/q/21872461
tags question: http://stackoverflow.com/q/21903583
tags question: http://stackoverflow.com/q/21867934
tags question: http://stackoverflow.com/q/21843269

http://stackoverflow.com/comment/33221402
has text: @RohitJain Perhaps `Collectors.toCollection(LinkedList<Shape>::new` works now with Java 8 b129 build, as some type interference has been improved. I don't know exactly how to try it myself though and Netbeans 8.0 doesn't support the improved type interference yet it seems (on an older testcase -> See http://stackoverflow.com/questions/21751830/cant-rely-on-target-typing-when-chaining-methods)
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21912605

http://stackoverflow.com/a/21901415
accepted answer of: http://stackoverflow.com/q/21901368
has comment: http://stackoverflow.com/comment/78395744
has comment: http://stackoverflow.com/comment/33173784
upvote count: 447
has comment: http://stackoverflow.com/comment/33191371
downvote count: 2
type: AcceptedAnswer
has body: InOrder helps you to do that. ServiceClassA firstMock = mock(ServiceClassA.class); ServiceClassB secondMock = mock(ServiceClassB.class); Mockito.doNothing().when(firstMock).methodOne(); Mockito.doNothing().when(secondMock).methodTwo(); //create inOrder object passing any mocks that need to be verified in order InOrder inOrder = inOrder(firstMock, secondMock); //following will make sure that firstMock was called before secondMock inOrder.verify(firstMock).methodOne(); inOrder.verify(secondMock).methodTwo();
has comment: http://stackoverflow.com/comment/133690705
type: Answer
has comment: http://stackoverflow.com/comment/82949859
has comment: http://stackoverflow.com/comment/63693744
answers question: http://stackoverflow.com/q/21901368
score: 445

http://stackoverflow.com/comment/33304691
score: 0
type: Comment
has text: @StephenC Actually it'S a good example to learn *any* language. It teaches how to build up algorithms while you ahve to deal with most language constructs, too (loop, comparison, if, ...). Works in almost any language as an introduction, including functional ones. Is also a good example to introduce recursion later on.
type: QuestionComment
comment on: http://stackoverflow.com/q/21977925

http://stackoverflow.com/comment/33066146
comment on: http://stackoverflow.com/a/21844454
has text: Thanks, this helped me figure it out.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21900459
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21901440
has title: Exectution of software slower in IDE, than outside?
has body: If I run a developed software in the IDE I have two opportunities: Debug Mode Normale Mode Debug Mode: Software is slower, than in normale mode, because the system needs time to watch all the variables and the program execution. Normale Mode: Software should run as desired. Is there a difference in the execution time and the execution itself, if I run the software in the IDE or I start it from the command line? I use Java software, developed in Eclipse.
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/21901440
tagged with: ide
tagged with: execution

http://stackoverflow.com/comment/33180177
type: AnswerComment
comment on: http://stackoverflow.com/a/21908599
type: Comment
has text: Ive done that before I posted and its casting exception
score: 0

http://stackoverflow.com/q/21853439
type: Question
has body: I appeared for an interview few days back. Some of the questions asked in interview of those i don't know the answer. Can anyone please help me understanding those. Q1 : Can we catch Errors ? Here answer is Yes we can catch errors. Anything under Throwable class can be caught. but as per the book standard we should the errors but as per the interviewer point of view we should catch so that in any case my application won't show any blank page or Java error to user. So i am able take the gist like whether we need to catch error or not Q2 : What is the DIALECT property in hibernate configuration file ? I didn't get any significance of this property anywhere.
tagged with: java
tagged with: hibernate
score: -1
has comment: http://stackoverflow.com/comment/33081390
answer count: 2
downvote count: 2
upvote count: 1
has title: Java_Questions: need help in understanding
favorite count: 0
has answer: http://stackoverflow.com/a/21853605
has comment: http://stackoverflow.com/comment/33081111
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21853615

http://stackoverflow.com/a/21922409
type: Answer
has body: for rows, try following this sort of procedure: boolean dup = false; for (int k = 0; k &lt; inArray[0].length){ //loop through columns for (i = 0; i &lt; inArray.length-1; i++) { for (int j = i; j &lt; inArray.length; j++){ if (inArray[k][i] == inArray[k][j]){ dup = true; break; } } } } so, you're starting at the first element, then scanning from element 2 to n (ie number of columns). If a match is found, then you're setting the boolean to true. If no match, then i is incremented and the inner for loop is scanning from element 3 to n. Follow a similar procedure for the columns, and you're done!
answers question: http://stackoverflow.com/q/21922354
has comment: http://stackoverflow.com/comment/33205778
upvote count: 1
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33206123

http://stackoverflow.com/comment/33149072
has text: That Java code is using encryption in a really gross way. :-( Usually, you don't ever want to pad with zeroes (like that code is doing) because you won't know the size of the original data (before padding). The standard way to pad is to use PKCS #5 padding. If you can arrange for the Java code to use that, your C# code will have a much easier time interoperating with that.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21890805
type: Comment

http://stackoverflow.com/a/21982511
accepted answer of: http://stackoverflow.com/q/21981101
answers question: http://stackoverflow.com/q/21981101
type: AcceptedAnswer
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/61049141
score: 2
has body: Wow, this was tough. The last line made it possible to resolve the bindings and retrieve the type via varDeclFrag.resolveBinding().getType().getQualifiedName(); although I already thought I did the same in setEnvironment when referring to sources: String[] sources = { "C:\\a\\TheMightyExampleProject\\src" }; String[] classPaths = { "C:\\a\\antlr-4.1-complete.jar" }; parser.setEnvironment(classPaths, sources, new String[] { "UTF-8" }, true); parser.setBindingsRecovery(true); parser.setResolveBindings(true); parser.setCompilerOptions(options); parser.setStatementsRecovery(true); parser.setUnitName("C:\\a\\TheMightyExampleProject\\src"); // ftw You can also check out the answer of Ida bindings not resolving with AST processing in eclipse
has comment: http://stackoverflow.com/comment/62198296
has comment: http://stackoverflow.com/comment/61113869
downvote count: 0

http://stackoverflow.com/a/21857907
has comment: http://stackoverflow.com/comment/33089902
answers question: http://stackoverflow.com/q/21857777
has comment: http://stackoverflow.com/comment/33094662
has body: Sometimes that occur because you might have errors in your xml, and it can be sintax error, resources that are not compatible try not having duplicates in the res-directory. Also import the R from your project, sometimes that error occurs because you havent imported the (in this case) import com.example.testfor23.R; Because if you don't import it, you're refering to the resource from the platform.
score: 0
has comment: http://stackoverflow.com/comment/33090258
has comment: http://stackoverflow.com/comment/33089623
has comment: http://stackoverflow.com/comment/33090294
has comment: http://stackoverflow.com/comment/33089983
has comment: http://stackoverflow.com/comment/33090217
type: Answer
has comment: http://stackoverflow.com/comment/33089551
has comment: http://stackoverflow.com/comment/33089807
has comment: http://stackoverflow.com/comment/33089670

http://stackoverflow.com/a/24631175
has body: You can get the column by referring back to the column header that you passed. In bean you could do this: public void onCellEdit(CellEditEvent event) { int alteredRow = event.getRowIndex(); String column_name; column_name=event.getColumn().getHeaderText(); // now you can use this to identify the column we are working on. } Using getColumnId() or getColumnKey() returns the column Id but with primefaces code added to it - making it difficult to work with.
score: 8
accepted answer of: http://stackoverflow.com/q/21881767
answers question: http://stackoverflow.com/q/21881767
downvote count: 0
upvote count: 8
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/33154346
score: 0
has text: Oh, Yeah, just iterate in the other direction. Easy to fix :-)
type: AnswerComment
comment on: http://stackoverflow.com/a/21881329
type: Comment

xml-entities
tags question: http://stackoverflow.com/q/21883496
type: Tag
tag name: xml-entities

http://stackoverflow.com/a/21960691
upvote count: 1
answers question: http://stackoverflow.com/q/21960487
accepted answer of: http://stackoverflow.com/q/21960487
has body: Here is a sample of how your SQL should look: SELECT count(*) FROM DonorDetails WHERE (((DateDiff("yyyy",[dob],Date()))&gt;25));
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33276121
score: 1

http://stackoverflow.com/q/21985776
has title: Retaining the value of root in a binary search tree using java
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm trying to code a binary search tree using java and currently I run into the problem of not being able to retain my value of root after calling certain methods. Right now I'm writing the add() and height() methods which look like this: public boolean add(E x) { BinaryNode&lt;E&gt; temp = null; if (root == null) { root = new BinaryNode&lt;&gt;(x); temp = root; return true; } else { BinaryNode&lt;E&gt; node = root; if(root.equals(x)){ root = temp; return false; } if (node.element.compareTo(x) &lt; 0) { if (node.left == null) { node.left = new BinaryNode&lt;E&gt;(x); return true; } root = node.left; add(x); } if (node.element.compareTo(x) &gt; 0) { if (node.right == null) { node.right = new BinaryNode&lt;E&gt;(x); return true; } root = node.right; add(x); } root = temp; } return false; } A node is described by the following class: static class BinaryNode&lt;E&gt; { E element; BinaryNode&lt;E&gt; left; BinaryNode&lt;E&gt; right; private BinaryNode(E element) { this.element = element; } } Now, I have BinaryNode root; as an attribute in my BST class. The purpose of this attribute is that it allows me to have methods without input parameters by recursively altering the value of root (for educational purposes only, I will not cheat here and use input parameters even though it might be easier). The add(E x) method seems to be working properly but the problem is that the method height() also alters the attribute root, so when I use add(E x) after calling height() it doesn't work since I've yet to figure out how to retain the value of root through the height() method. height() currently looks like this: public int height() { if(root == null){ return 0; } else { int lefth = 0; int righth = 0; BinaryNode&lt;E&gt; node = root; if(root.left != null){ root = root.left; lefth = height(); } if(root.right != null){ root = root.right; righth = height(); } root = node; if(lefth &gt; righth){ return lefth+1; } else { return righth+1; } } } I know for sure that this method is faulty si…
type: UnansweredQuestion
tagged with: binary-search-tree
has answer: http://stackoverflow.com/a/21986424
tagged with: root
upvote count: 1
type: Question
tagged with: tree
tagged with: recursion
score: 1
tagged with: java

http://stackoverflow.com/comment/33327658
comment on: http://stackoverflow.com/a/21990905
type: Comment
has text: If I do Find: ^\s*\r?\n and replace with: nothing I get "string not found"
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33334852
type: AnswerComment
score: 0
has text: and as I copy to array 3 times?
type: Comment
comment on: http://stackoverflow.com/a/21995204

http://stackoverflow.com/comment/33222387
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21932308
has text: fge, I believe I do need all of the mocks, though I might be mistaken. All of them are roughly related. If the socket is mocked, the resulting output and input streams from it have to be mocked, presumably.
score: 0

baseadapter
tags question: http://stackoverflow.com/q/21866979
type: Tag
tags question: http://stackoverflow.com/q/21944845
tag name: baseadapter

bit-manipulation
tags question: http://stackoverflow.com/q/21931738
tags question: http://stackoverflow.com/q/21847576
type: Tag
tags question: http://stackoverflow.com/q/21889838
tag name: bit-manipulation
tags question: http://stackoverflow.com/q/21923791

header
type: Tag
tags question: http://stackoverflow.com/q/21944059
tag name: header

jdbc
tags question: http://stackoverflow.com/q/21930323
tags question: http://stackoverflow.com/q/21890596
tags question: http://stackoverflow.com/q/21908610
tags question: http://stackoverflow.com/q/21900746
tags question: http://stackoverflow.com/q/21980890
tags question: http://stackoverflow.com/q/21965219
tags question: http://stackoverflow.com/q/21970077
tags question: http://stackoverflow.com/q/21912293
tags question: http://stackoverflow.com/q/21934989
tags question: http://stackoverflow.com/q/21866014
tags question: http://stackoverflow.com/q/21858956
tags question: http://stackoverflow.com/q/21980881
tags question: http://stackoverflow.com/q/21885215
tags question: http://stackoverflow.com/q/21956374
tags question: http://stackoverflow.com/q/21852382
tags question: http://stackoverflow.com/q/21850865
tags question: http://stackoverflow.com/q/21891871
tags question: http://stackoverflow.com/q/21952365
type: Tag
tags question: http://stackoverflow.com/q/21953331
tags question: http://stackoverflow.com/q/21842800
tags question: http://stackoverflow.com/q/21968834
tags question: http://stackoverflow.com/q/22000110
tags question: http://stackoverflow.com/q/21973551
tags question: http://stackoverflow.com/q/21872713
tags question: http://stackoverflow.com/q/22001206
tags question: http://stackoverflow.com/q/21883014
tags question: http://stackoverflow.com/q/21956042
tags question: http://stackoverflow.com/q/21897683
tags question: http://stackoverflow.com/q/21948619
tags question: http://stackoverflow.com/q/21979140
tags question: http://stackoverflow.com/q/21845307
tags question: http://stackoverflow.com/q/21849405
tags question: http://stackoverflow.com/q/21854351
tags question: http://stackoverflow.com/q/21930501
tags question: http://stackoverflow.com/q/21859698
tags question: http://stackoverflow.com/q/21880594
tags question: http://stackoverflow.com/q/21974729
tags question: http://stackoverflow.com/q/21856285
tags question: http://stackoverflow.com/q/21864977
tags question: http://stackoverflow.com/q/21864948
tags question: http://stackoverflow.com/q/21905156
tags question: http://stackoverflow.com/q/21843956
tags question: http://stackoverflow.com/q/21899237
tags question: http://stackoverflow.com/q/21879872
tags question: http://stackoverflow.com/q/21905938
tags question: http://stackoverflow.com/q/21880393
tags question: http://stackoverflow.com/q/21963923
tags question: http://stackoverflow.com/q/21854776
tags question: http://stackoverflow.com/q/21989782
tags question: http://stackoverflow.com/q/21907885
tags question: http://stackoverflow.com/q/21957421
tags question: http://stackoverflow.com/q/21942824
tags question: http://stackoverflow.com/q/21967544
tags question: http://stackoverflow.com/q/21936095
tags question: http://stackoverflow.com/q/21898053
tag name: jdbc
tags question: http://stackoverflow.com/q/22000915
tags question: http://stackoverflow.com/q/21954131
tags question: http://stackoverflow.com/q/21924403
tags question: http://stackoverflow.com/q/21989051
tags question: http://stackoverflow.com/q/21944861
tags question: http://stackoverflow.com/q/21862919
tags question: http://stackoverflow.com/q/21989816
tags question: http://stackoverflow.com/q/21969200
tags question: http://stackoverflow.com/q/21872040

http://stackoverflow.com/comment/33339031
type: QuestionComment
comment on: http://stackoverflow.com/q/21997276
has text: yes I am reading it from a file into a string.
score: 0
type: Comment

http://stackoverflow.com/comment/33226257
score: 0
type: AnswerComment
type: Comment
has text: I'm use this method and it's easy way
comment on: http://stackoverflow.com/a/21866276

http://stackoverflow.com/comment/33203376
type: QuestionComment
comment on: http://stackoverflow.com/q/21891182
has text: can anybody please help?i just need to run this damn program after i compile it and @DaveNewton ive tried already the api but it's for compiling only-i need ot to execute the code himself on my console-if there's println so hell print.if there's an exception or runtime error he will show the exactly console as if i'd ran that program itslef.
score: 0
type: Comment

http://stackoverflow.com/q/21920337
type: Question
tagged with: jpa
has comment: http://stackoverflow.com/comment/33204962
has body: i am wondering if you could help me basically i have created a db, and it adds data to two pieces of data to the table, leaving the rest of the columns blank, what i want to do, is be able to update these records with some more data for the blank columns, how can i achieve this ? this is my code atm, but i just get a null point error and don't know if im doing it right This is the u.i. &lt;p&gt; Student Number : &lt;!--More for me than anything --&gt; &lt;h:inputText value="#{editMarkingBean.markSectionTwo.studentNumber}" /&gt; &lt;/p&gt; this is where the student number is entered, this is what i want to update, the record that contains this student number (no way can there be more than one of the same username ) &lt;p:spinner id="ajaxspinner80-100" value="#{editMarkingBean.markSectionTwo.markSectionTwo}" stepFactor="1" min="80" max="100" disabled="#{formBean.number != 8}"&gt; &lt;p:ajax update="ajaxspinnervalue" process="@this" /&gt; &lt;/p:spinner&gt; this is the value i want to add to the column markSectionTwo the save button &lt;p:commandButton action="#{editMarkingBean.markSectionTwo}" value="#{bundle.buttonSave}" update=":growl" icon="ui-icon-disk"/&gt; the backing bean : private MarkingService markingService; @Inject private MarkingFacade markingFacade; public void markSectionTwo() { this.markingFacade.edit(this.markSectionTwo); this.setMessage("Mark Saved"); } and this is the entity for the table creation private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String studentNumber,markingStage, markingCompleted, markSectionOne, markSectionTwo, markSectionThree, markSectionFour, markSectionFive, overalMark, plagorism, feedback, comments; i get the error WARNING: javax.el.PropertyNotFoundException: /lecturer/marking/marking-section-two.xhtml @109,82 value="#{editMarkingBean.markSectionTwo.markSectionTwo}": Target Unreachable, 'null' returned null how can i update the records based on the st…
score: 0
has comment: http://stackoverflow.com/comment/33204607
tagged with: sql
answer count: 1
has answer: http://stackoverflow.com/a/21922895
accepted answer: http://stackoverflow.com/a/21922895
linked to: http://stackoverflow.com/q/21937863
has comment: http://stackoverflow.com/comment/33204735
has title: updating a record in a db - JSF JPA etc
type: AnsweredQuestion
tagged with: jsf
tagged with: java
has comment: http://stackoverflow.com/comment/33204390

http://stackoverflow.com/comment/35878975
comment on: http://stackoverflow.com/a/21859000
type: Comment
score: 2
has text: Good call. If you don't want to do the checking, there's also a `JSONObject#wrap` method that will wrap it for you.
type: AnswerComment

http://stackoverflow.com/q/21978314
has body: I try to implement some post-processing, so I need to use FrameBuffer to collect entire picture and then post-process it with shader. I've found some examples of how to work with FrameBuffer in LibGDX(Rendering a 3D model to texture in LibGDX), but it doesn't work. I get black screen. My code snippet: @Override public void show() { modelBatch = new ModelBatch(); environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 0f, 1f)); environment.add(new DirectionalLight().set(1f, 0.0f, 0.0f, 0f, -2f, 0f)); cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.position.set(1f, 1f, 1f); cam.lookAt(0,0,0); cam.near = 0.1f; cam.far = 300f; cam.update(); com.badlogic.gdx.graphics.g3d.loader.ObjLoader loader =new ObjLoader(); model = loader.loadModel(Gdx.files.internal("cube/cube.obj")); instance = new ModelInstance(model); fbo = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true); sb= new SpriteBatch(); camController = new CameraInputController(cam); Gdx.input.setInputProcessor(camController); } @Override public void render(float delta) { fbo.begin(); camController.update(); Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); modelBatch.begin(cam); modelBatch.render(instance, environment); modelBatch.end(); fbo.end(); //getting texture tex = fbo.getColorBufferTexture(); //render texture spriteBatch.begin(); spriteBatch.draw(tex,0,0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); spriteBatch.end(); } What do I wrong? UPDATE I got another problem. Look at the pictures bellow: I see this hidden fragment of landscape. I use fb = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false); But when I try to switch on the depth of FrameBuffer, it shows me black screen again: fb = new FrameBuffer(Format.RGB…
has answer: http://stackoverflow.com/a/21980833
tagged with: opengl-es-2.0
tagged with: android
score: 2
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33314521
has comment: http://stackoverflow.com/comment/33306271
tagged with: libgdx
has comment: http://stackoverflow.com/comment/33306869
tagged with: java
type: Question
upvote count: 2
tagged with: framebuffer
has title: LibGDX - Cannot get texture from FrameBuffer
answer count: 1
has comment: http://stackoverflow.com/comment/33306603
favorite count: 0

http://stackoverflow.com/comment/33141248
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21884532
score: 0
has text: looks good, think its the right approach.

http://stackoverflow.com/a/21912736
type: Answer
has comment: http://stackoverflow.com/comment/33313599
has comment: http://stackoverflow.com/comment/33313857
upvote count: 7
has comment: http://stackoverflow.com/comment/33313779
score: 7
answers question: http://stackoverflow.com/q/21912417
has comment: http://stackoverflow.com/comment/33313921
accepted answer of: http://stackoverflow.com/q/21912417
type: AcceptedAnswer
downvote count: 0
has body: They never get merged. Generally, the log4j.properties files get overwritten and you can not exactly tell which one. It depends on the sequence of loading the Jar files by container. So It is recommended to have one log4j.properties with multiple appenders each for other sub-modules in the core module of your application. But it would create problem while testing/working with sub-modules independently as it will stop logging when tested separately. In our case, the source control version of pom always used to exclude resource (which will exclude the properties file while building the jar). However in developer local, developers used to comment that exclusion in POM and can work independently.

http://stackoverflow.com/comment/33112036
type: QuestionComment
has text: Your `catch` doesn't line up with your `try` block, it has to go right after it. Right now, it's after your `for` loop. Also, you're looping from zero to `test.size()`, which is actually one more element than what the list contains-- remember that java indexes from zero. You should loop until `test.size()-1`.
comment on: http://stackoverflow.com/q/21869923
score: 0
type: Comment

http://stackoverflow.com/a/30268604
score: 0
answers question: http://stackoverflow.com/q/21935447
has body: Notice, that your log4j configuration file name is log4j2.xml, so trying to point to log4j.xml is quite pointless. Please find that unless using servlet container below 2.5, your log4j may be configurable by itself. First of all, verify if your log4j configuration is correct. Start container with -Dlog4j.configurationFile pointing to your log4j2.xml. You can also add debug with -Dorg.apache.logging.log4j.simplelog.StatusLogger.level=debug Using tomcat, edit your ${catalina.home}/bin/setenv.sh (or .bat, if using windows) and add it to JAVA_OPTS variable. If your log4j will start logging both to file and console, try removing both: log4jConfiguration /WEB-INF/classes/log4j2.xml as well as: org.springframework.web.util.Log4jConfigListener Spring is based on log4j 1.x, so add dependencies to your build (maven example): org.apache.logging.log4j log4j-core ${log4j.version} org.apache.logging.log4j log4j-api ${log4j.version} org.apache.logging.log4j log4j-web ${log4j.version} org.apache.logging.log4j log4j-1.2-api ${log4j.version} Where log4j-1.2-api is compatibility api, and log4j-web is web application support.
type: Answer

arrays
tags question: http://stackoverflow.com/q/21950063
tags question: http://stackoverflow.com/q/21935549
tags question: http://stackoverflow.com/q/21923993
tags question: http://stackoverflow.com/q/21977094
tags question: http://stackoverflow.com/q/22004636
tags question: http://stackoverflow.com/q/21916691
tags question: http://stackoverflow.com/q/21869978
tags question: http://stackoverflow.com/q/22001161
tags question: http://stackoverflow.com/q/21988625
tags question: http://stackoverflow.com/q/21964003
tags question: http://stackoverflow.com/q/21922695
tags question: http://stackoverflow.com/q/21995617
type: Tag
tags question: http://stackoverflow.com/q/21896781
tags question: http://stackoverflow.com/q/21892626
tags question: http://stackoverflow.com/q/21920063
tags question: http://stackoverflow.com/q/21906002
tags question: http://stackoverflow.com/q/21965026
tags question: http://stackoverflow.com/q/21938141
tags question: http://stackoverflow.com/q/22000745
tags question: http://stackoverflow.com/q/21968401
tags question: http://stackoverflow.com/q/21887824
tags question: http://stackoverflow.com/q/21996637
tags question: http://stackoverflow.com/q/21851958
tags question: http://stackoverflow.com/q/21979662
tags question: http://stackoverflow.com/q/21852578
tags question: http://stackoverflow.com/q/21978231
tags question: http://stackoverflow.com/q/21967181
tags question: http://stackoverflow.com/q/21996728
tags question: http://stackoverflow.com/q/21995541
tags question: http://stackoverflow.com/q/21971468
tags question: http://stackoverflow.com/q/21993512
tags question: http://stackoverflow.com/q/21953173
tags question: http://stackoverflow.com/q/22000569
tags question: http://stackoverflow.com/q/21953216
tags question: http://stackoverflow.com/q/21917705
tags question: http://stackoverflow.com/q/21971241
tags question: http://stackoverflow.com/q/21922354
tags question: http://stackoverflow.com/q/21970486
tags question: http://stackoverflow.com/q/21943803
tags question: http://stackoverflow.com/q/21952044
tags question: http://stackoverflow.com/q/21889389
tags question: http://stackoverflow.com/q/21962197
tags question: http://stackoverflow.com/q/21947455
tags question: http://stackoverflow.com/q/21993515
tags question: http://stackoverflow.com/q/21965833
tags question: http://stackoverflow.com/q/22000661
tags question: http://stackoverflow.com/q/21992712
tags question: http://stackoverflow.com/q/21844048
tags question: http://stackoverflow.com/q/21963797
tags question: http://stackoverflow.com/q/21890821
tags question: http://stackoverflow.com/q/21842306
tags question: http://stackoverflow.com/q/21886836
tags question: http://stackoverflow.com/q/21966063
tags question: http://stackoverflow.com/q/21960072
tags question: http://stackoverflow.com/q/21897794
tags question: http://stackoverflow.com/q/21967332
tags question: http://stackoverflow.com/q/21862363
tags question: http://stackoverflow.com/q/21893782
tags question: http://stackoverflow.com/q/21999266
tags question: http://stackoverflow.com/q/21971921
tags question: http://stackoverflow.com/q/21896672
tags question: http://stackoverflow.com/q/21872093
tags question: http://stackoverflow.com/q/22003487
tags question: http://stackoverflow.com/q/21890843
tags question: http://stackoverflow.com/q/21966814
tags question: http://stackoverflow.com/q/22001041
tags question: http://stackoverflow.com/q/21891403
tags question: http://stackoverflow.com/q/21895041
tags question: http://stackoverflow.com/q/21903404
tags question: http://stackoverflow.com/q/21872834
tags question: http://stackoverflow.com/q/21863507
tags question: http://stackoverflow.com/q/21944260
tags question: http://stackoverflow.com/q/21950346
tags question: http://stackoverflow.com/q/21847103
tags question: http://stackoverflow.com/q/21945611
tags question: http://stackoverflow.com/q/21948302
tags question: http://stackoverflow.com/q/21959804
tags question: http://stackoverflow.com/q/21921066
tags question: http://stackoverflow.com/q/21879568

http://stackoverflow.com/a/21957482
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21957470
has body: Remove the below import import android.R; Also you have &lt;html&gt; and &lt;/html&gt;// should be removed from xml Imnport import ahmed103.appdemo.R; And use &lt;?xml version="1.0" encoding="utf-8"?&gt; as the first statement in your activity_main.xml

http://stackoverflow.com/comment/33349860
has text: Creating a new instance of the `MouseListener` for each an every `Jlist` will use more memory, yes...
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22003359

http://stackoverflow.com/comment/33293590
comment on: http://stackoverflow.com/a/21970326
score: 0
type: AnswerComment
has text: Check the update post where your file size will control according to your need - Thanks
type: Comment

http://stackoverflow.com/comment/33240845
type: QuestionComment
has text: Agreed, it's O(n) for memory.
comment on: http://stackoverflow.com/q/21942720
score: 0
type: Comment

http://stackoverflow.com/comment/33279067
has text: @ChakradharVyza - He doesn't mention MySQL at all, so that's not likely the solution. For the OP - you're using floating point values for monetary values. This is **NOT** recommended, especially because you can't exactly represent values like `.1`. In Java you should be using `BigDecimal`.
comment on: http://stackoverflow.com/q/21962883
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21956610
favorite count: 0
has comment: http://stackoverflow.com/comment/33306375
answer count: 3
has comment: http://stackoverflow.com/comment/33265930
has answer: http://stackoverflow.com/a/21956643
accepted answer: http://stackoverflow.com/a/21956703
type: AnsweredQuestion
has title: Server with Multiple Clients - JAVA
possible better answer: http://stackoverflow.com/a/21956643
upvote count: 1
type: Question
has body: Given the two codes , one for the server and the other one for the client , i am trying to make multiple clients communicate with the server but i don't have a clue how to do it. Any idea how the server can recognize the client who spoke to him and reply back to the same client ? Server: import java.io.*; import java.net.*; public class Provider{ ServerSocket providerSocket; Socket connection = null; ObjectOutputStream out; ObjectInputStream in; String message; Provider(){} void run() { try{ //1. creating a server socket providerSocket = new ServerSocket(2004, 10); //2. Wait for connection System.out.println("Waiting for connection"); connection = providerSocket.accept(); System.out.println("Connection received from " + connection.getInetAddress().getHostName()); //3. get Input and Output streams out = new ObjectOutputStream(connection.getOutputStream()); out.flush(); in = new ObjectInputStream(connection.getInputStream()); sendMessage("Connection successful"); //4. The two parts communicate via the input and output streams do{ try{ message = (String)in.readObject(); System.out.println("client&gt;" + message); if (message.equals("byee")) sendMessage("Wosil"); } catch(ClassNotFoundException classnot){ System.err.println("Data received in unknown format"); } }while(!message.equals("bye")); } catch(IOException ioException){ ioException.printStackTrace(); } finally{ //4: Closing connection try{ in.close(); out.close(); providerSocket.close(); } catch(IOException ioException){ ioException.printStackTrace(); } } } void sendMessage(String msg) { try{ out.writeObject(msg); out.flush(); System.out.println("Zame-Server&gt;" + msg); } catch(IOException ioException){ ioException.printStackTrace(); } } public static void main(String args[]) { Provider server = new Provider(); while(true){ server.run(); } } } Client import java.io.*; import java.net.*; public class Requester{ Socket requestSocket; ObjectOutputStream out; ObjectInputStream in; String message; Requester(){} void ru…
score: 1
tagged with: java
tagged with: client-server
has answer: http://stackoverflow.com/a/21956703
downvote count: 0
has answer: http://stackoverflow.com/a/21956732

http://stackoverflow.com/a/21879968
answers question: http://stackoverflow.com/q/21878972
has body: Some tips for you on best practices since you mentioned it: double priceA = 20.00; First of all double isn't exactly precise, you should watch out if you plan to use floating point variables to make any calculations that have to be 100% accurate (such as money calculations), use java.math.BigDecimal class instead. Secondly you should store all constant (fixed) values at the top of your class where you define your variables, so you don't have any "magic numbers" roaming about. Example: private static final double priceA = 20.00 This way you don't have to re-define the variables each time you access the method. Thirdly you should always be suspicious of user input and handle it. What would happen here Integer.parseInt(strA) if I for example would leave one of the text boxes empty? Or even worse what if I would write some text there instead of numbers? You should always be aware that users will not always use your program as intended and will even try to break it. Finally you could define a calculating method outside of this method that would simplify your current method. From your example it could look something like this: private String calculcateTotal(double price, String amount) { int actualAmount = Integer.parseInt(amount); double totalAmount = (price * actualAmount); return String.valueOf(totalAmount); } Which would reduce your original method down to: private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { double priceA = 20.00; double priceB = 25.00; double priceC = 30.00; ArrayList caselist = new ArrayList(); caselist.add("Case A Total - £" + calculateTotal(priceA, txtbxCaseA.getText())); caselist.add("Case B Total - £" + calculateTotal(priceB, txtbxCaseB.getText())); caselist.add("Case C Total - £" + calculateTotal(priceC, txtbxCaseC.getText())); DefaultListModel myModel = new DefaultListModel (); for(int i = 0; i &lt; caselist.size(); i++){ jTextArea3.append((String)caselist.get(i) + ('\n')); myModel.addElement(caselist.get(i) + ","); /* - sav…
score: 0
type: Answer

http://stackoverflow.com/a/21910882
score: 0
has comment: http://stackoverflow.com/comment/33476060
has comment: http://stackoverflow.com/comment/33501679
answers question: http://stackoverflow.com/q/21884150
has body: Are you familiar with the TIBCO GEMS (graphical EMS admin) tool? It's downloadable for free on the tibcommunity website GEMS can display you pending messages for a durable subscriber ona a TIBCO EMS topic
type: Answer

http://stackoverflow.com/comment/33269956
type: Comment
has text: Group2 does not make much sense to do with multiple threads. Creates just higher than necessary lock contention. If you enqueue group1 in an thread pool executor, then iterate over the list of futures blocking until they are done you would have the correct order and can do the comparision from that thread.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21958601

http://stackoverflow.com/comment/33271746
comment on: http://stackoverflow.com/q/21959153
type: Comment
type: QuestionComment
score: 0
has text: Yes, just use [setAutoDelay](http://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html#setAutoDelay(int)) to compensate for the quick succession of key presses (or have a certain [delay](http://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html#delay(int)) inside the loop).

http://stackoverflow.com/q/21874349
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/3757608
has answer: http://stackoverflow.com/a/21899705
has body: I'm looking for a bit of help on how to internationalize my hibernate validation messages while using GWT, so that it works with both client and server messages. According to this question, I should put a ValidationMessages.properties file in my class path, or use the following code: Validation .byProvider(HibernateValidator.class) .configure() .messageInterpolator( new ResourceBundleMessageInterpolator( new PlatformResourceBundleLocator("com.mycompany.Messages"))) .buildValidatorFactory() .getValidator();` But will this method work on the client side, with GWT code? What should I do to make it work on the client side?
tagged with: hibernate-validator
linked to: http://stackoverflow.com/q/6261858
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: internationalization
tagged with: gwt
has title: How to internationalize error messages when using Hibernate Validator with GWT?
score: 1
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/comment/33251972
comment on: http://stackoverflow.com/q/21948655
type: Comment
type: QuestionComment
has text: I apologize. I didn't want anyone to say that im asking someone to do my homework for them
score: 0

http://stackoverflow.com/comment/33182341
has text: Thanks for the solution Kevin but i think it is the problem with web.xml. When I am using .html as the url pattern and using spring view resolver then again the code u provided is not working. If you want to see my application then please find it here [link](https://github.com/xtm/Local.git) .
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21905140

http://stackoverflow.com/comment/33073653
has text: Thanks! Is it possible to do this at runtime? To input the code, compile it and pass it as runnable?
comment on: http://stackoverflow.com/a/21849137
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33143310
has text: Yes that's correct about Javascript but you can use an alternative delimiter in Perl/sed to avoid escaping in substitute commands.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21887745
score: 0

http://stackoverflow.com/a/21950445
answers question: http://stackoverflow.com/q/21950346
type: Answer
has body: What you want is to put every character within the string array into the char array????. If it is, you have several ways to do this. To avoid using an array list (increases its capacity dinamycally), you will have to know the amount of character inside each index of you string array, go through each index adding the amount of character to a variable that you previouly had declared (lets called sumChar), then create the char array with a capacity equals to sumChar char [] Carray=new chat[sumChar]. then do something like this int indexPos=0; for (int i=0;i&lt;names.length;i++) { for (int c=0;c&lt;names[i];length;c++) { Carray[indexPos++]=names[i].charAt(c); } } that's all, the code above I made it without tested it , so any problem feel free to ask
score: 0

http://stackoverflow.com/q/21942824
score: 1
has comment: http://stackoverflow.com/comment/33241099
tagged with: java
tagged with: remote-access
has comment: http://stackoverflow.com/comment/33242823
has comment: http://stackoverflow.com/comment/33242279
tagged with: mysql
type: Question
upvote count: 2
tagged with: sql
has comment: http://stackoverflow.com/comment/33243278
has title: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has body: I am using jdbc to connect to a mysql database throw java. It works just fine when I am connecting to my localhost database. I want this database to be accessed from a remote pc, I singed up at freesqldatabase.com to get a database with remote access enabled. I got my username, password, sql server. I logged in using mysql workbench successfully. When I use the same exact info inside my java code replacing my localhost info I got this error ! com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user 'remoteserveruser'@'%' to database 'dbname' I dunno what am I doing wrong. Is remote connection requires something to be changed inside the java code than it is in the local host or what? thanks in advance :)
has comment: http://stackoverflow.com/comment/33241435
tagged with: jdbc
answer count: 0

http://stackoverflow.com/comment/33496812
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21984186
type: AnswerComment
has text: I have released the GC log , and found that the cause was due to the CMD-remark, please check my gc log below. 14703.367: [GC[YG occupancy: 289420 K (873856 K)]14703.367: [Rescan (parallel) , 0.2197166 secs]14703.587: [weak refs processing, 8.9358445 secs]14712.523: [class unloading, 0.0075905 secs]14712.530: [scrub symbol & string tables, 0.0075593 secs] [1 CMS-remark: 7870334K(15728640K)] 8159754K(16602496K), 9.6445978 secs] [Times: user=11.15 sys=0.00, real=9.64 secs]

http://stackoverflow.com/q/21864749
answer count: 2
accepted answer: http://stackoverflow.com/a/21865555
has body: I want to update an url that is a string comming from a izpack configuration. When I run the ant script I have an issue writing the config file. For example: the correct way to write the url in my property file is url=http://xxx.x.x.x:8080/consola But ant the end of the write process I obtain url=http\://xxx.x.x.x\:8080/consola As you can see the "\" character is not a part of the url. Here is the part of the script that is writing my config file: <echo message="${isAppUpdate}" /> <property name="main.url" value="${mainUrl}" /> <property name="bckup.url" value="${bckupUrl}" /> <entry key="url" operation="=" value="@mainUrl" /> <entry key="urlBackup" operation="=" value="@bckupUrl" /> <replace file="../config/config.properties" token="@mainUrl" value="${main.url}" /> <replace file="../config/config.properties" token="@bckupUrl" value="${bckup.url}" /> <equals arg1="${updateFlagCremona}" arg2="yes" /> <echo message="${mainUrl}" /> <echo message="${bckupUrl}" /> <echo message="${consoleId}" /> <entry key="url" value="${mainUrl}" /> <entry key="urlBackup" value="${bckupUrl}" /> <entry key="console.id" value="${consoleId}" /> What I doing wrong?
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33103230
tagged with: ant
possible better answer: http://stackoverflow.com/a/21881648
has title: How to write url with ant
has answer: http://stackoverflow.com/a/21865555
has answer: http://stackoverflow.com/a/21881648
type: AnsweredQuestion
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/10699055
favorite count: 0
type: Question

http://stackoverflow.com/a/21912788
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21912467
has comment: http://stackoverflow.com/comment/33188405
has comment: http://stackoverflow.com/comment/33187887
type: Answer
score: 2
upvote count: 2
has body: The Java Virtual Machines are themselves applications that need to run on top of a hardware architecture and operating system and most likely they are not implemented in Java themselves. That is the case of the popular Java HotSpot Virtual Machine (the default implementation from Oracle) which is mostly implemented in C/C++. That means you need a compiled version of it for every hardware architecture and operating system in which you intend to use it, and so that explains that there are versions of it for 32-bit and 64-bit hardware architectures. This is also the case of other JVM implementations, like JRockit, IBM J9, Azul Systems Zulu and probably many others. Other helper programs aside the Java Virtual Machine, typically included for programmers to develop applications as part of what is know as the JDK (Java Development Kit) may also be developed in this way. That is the case of tools like the compiler (javac), the documentation generator (javadoc), the RMI compiler (rmic), the Java disassembler, (javap), etc. So, those JDK tools would also require a hardware dependent implementation. And so that's why you are offered a choice when downloading the JDK. --Edit-- Addressing the questions on the "portability" subject It depends on what you mean by "portability". If you mean the Java's WORA (write once, run anywhere), then it has to be through a virtual machine like Java, Python or Ruby. But languages like C/C++ compile to machine code, and therefore, they are not run through a virtual machine, but by the hardware itself. This does not mean they are not portable, you may write your code in way that can be run in multiple architectures, it is just that you cannot use the same binaries. You have to recompile for every case, since the program must be written/compiled in a way a particular hardware/os understands. This gap is what the virtual machines intend to close. Now, portability can mean more than just using the same binaries. Even with Java you may write code th…
has comment: http://stackoverflow.com/comment/33188485
has comment: http://stackoverflow.com/comment/33188239
answers question: http://stackoverflow.com/q/21912467
has comment: http://stackoverflow.com/comment/33188732

http://stackoverflow.com/q/21964848
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21964996
type: Question
tagged with: android
has title: Android listview being updated by mutliple threads.You see an issue
score: 0
tagged with: multithreading
answer count: 1
has body: Maybe related to previous questions I posted but this is a different flavor. I have a list view with customized base adapted that takes Vector (it used to take ArrayList but I made it Vector as I heard it is threadsafer). The problem that I have two threads updating this vector and as a result the listview updating the GUI on data set change. How can I ensure no threading issue happen? Is what I did sufficient? Part of the Base adapter class: public class MyListAdapter extends BaseAdapter { private Vector&lt;Room&gt; roomList; private Context context; RoomListAdapter(Context c){ this.context = c; } @Override public int getCount() { return roomList.size(); } public void setData(Vector&lt;Room&gt; roomData){ roomList= roomData; notifyDataSetChanged(); } @Override public Object getItem(int number) { return roomList.get(number); } @Override public long getItemId(int arg0) { return 0; } @Override public View getView(final int position, View convertView, ViewGroup parent) { // Here I get the Room based on position and update my view } } My class that updates the list concurrently has the following method: protected void onCreate(Bundle savedInstanceState) { roomVect = new Vector&lt;RoomDataExtra&gt;(); mylistAdapter = new MyListAdapter(this); } private synchronized void addRoom(Room roomData){ roomVect.add(roomData); runOnUiThread(new Runnable() { @Override public void run() { myListAdapter.setData(roomVect); listView.setAdapter(myListAdapter); } }); } and offcourse the addRoom is being called by my threads many times. So there is a good chance that my thead calls this while the list is update. Note that it is the same vector being passed to the list which is updating from it Do you see an issue with above ? How do you recommend solving if there one?
has answer: http://stackoverflow.com/a/21964996
tagged with: java

http://stackoverflow.com/q/21967182
has body: I have file that I need to deserialize with multiple objects of the same type. public static ArrayList&lt;Dog&gt; readDogs() { ArrayList&lt;Dogs&gt; dogs = null; ObjectInputStream in = null; try { in = new ObjectInputStream(new BufferedInputStream(new FileInputStream(filename))); dogs = new ArrayList&lt;Dog&gt;(); while(true) { dogs.add((Dog) in.readObject()); } } catch (EOFException e) { } catch (Exception e) { System.err.println(e.toString()); } finally { try { in.close(); } catch (IOException e) { System.err.println(e.toString()); } } return dogs; } With the current implementation, I rely upon a try clause to catch and ignore an end of file exception, this seems pretty ugly but I'm not sure how else to handle this?
has answer: http://stackoverflow.com/a/21967298
upvote count: 1
type: Question
has title: Deserializing a list of objects
score: 1
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/21967282
favorite count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/21967377
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21967263
answer count: 4

http://stackoverflow.com/comment/34277614
type: QuestionComment
comment on: http://stackoverflow.com/q/21927431
has text: @RaviH Its possible but in another way, please check the answer below :) thanks for the response...
score: 0
type: Comment

http://stackoverflow.com/comment/33272576
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21960122
has text: Please fix the code formatting and indentation.

cd
tag name: cd
tags question: http://stackoverflow.com/q/21859667
type: Tag

http://stackoverflow.com/comment/33307621
type: Comment
type: QuestionComment
has text: +1 for the spirit of gaining knowledge by the asker.
score: 0
comment on: http://stackoverflow.com/q/21979791

http://stackoverflow.com/comment/33281018
type: AnswerComment
comment on: http://stackoverflow.com/a/21964736
type: Comment
score: 1
has text: how do i set JAVA_HOME Variable? is there a particular place I set it in?

http://stackoverflow.com/q/21877064
has comment: http://stackoverflow.com/comment/33139097
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/79506775
has body: I have a large JEE Maven Multi module project, and share a custom set of rules and suppressions for Checkstyle via build-tools module. I find very hard to release a stable version of this build-tools due to the testing of this same module. Each time I run a Maven phase, I get a different execution result. This is Checkstyle configuration in parent pom.xml: org.apache.maven.plugins maven-checkstyle-plugin ${checkstyle.plugin.version} ${skipQATests} qa/checkstyle_rules.xml ${checkstyleDir}/checkstyle.properties qa/suppressions.xml UTF-8 true true true false checkstyle-compile compile check I'm trying to find a pattern in the executions, project is set to fail in one particular check and I cannot find the 'bug'. I execute compile maven phase (mvn clean compile) and it fails on the given check. I execute package maven phase (mvn clean package) and it fails too. I execute again compile phase (mvn clean compile) and it doesn't fail (all SUCCESS) I execute again package and it fails It does not fail for a couple of runs and then it fails again on some different execution I know this behavior is kind of difficult to trace without all project information. But is there any kind of procedure, log, tool that would give more information on debuging this problem so that I can determine if it's a bug or some mis-configuration?? Thanks in advance!! UPDATE: I have just executed the same mvn command twice on the sub-module I'm testing Checkstyle (test that forces a rule violation) - mvn checkstyle:check -X Result was different from each other, the main differences are that the CORRECT EXECUTION (the one that fails the build does not find the files at the first try) and the WRONG EXECUTION (the one that ends in SUCCESS finds the configuration files at the first attempt) EXEC_1: ... [DEBUG] The resource 'qa/suppressions.xml' was not found with resourceLoader org.codehaus.plexus.resource.loader.FileResourceLoader. [DEBUG] The resource 'qa/suppressions.xml' was found as jar:file:/C:/User…
tagged with: java
has comment: http://stackoverflow.com/comment/33178161
type: Question
answer count: 2
tagged with: runtime
has answer: http://stackoverflow.com/a/21914492
score: 0
has comment: http://stackoverflow.com/comment/33139999
has comment: http://stackoverflow.com/comment/33139536
has title: Checkstyle - non deterministic check result
has comment: http://stackoverflow.com/comment/33320275
tagged with: checkstyle

http://stackoverflow.com/q/21900923
tagged with: list
score: 1
tagged with: java
has title: Is it possible to add int into the String ArrayList with out Converting int to String in java
downvote count: 1
has answer: http://stackoverflow.com/a/21901222
type: Question
has answer: http://stackoverflow.com/a/21900984
tagged with: casting
has comment: http://stackoverflow.com/comment/33166899
tagged with: arraylist
has body: i have an ArrayList which contains String elements and i want to add an int into the list but with out Converting that into the String is that possible. i have tried this and this is working too. int a1 = 10; java.util.List list = new ArrayList&lt;String&gt;(); list.add(a1); System.out.println("List element"+list.get(0)); and but i am wondering this to be happen. int a1 = 10; java.util.List&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add(a1); System.out.println("List element"+list.get(0)); is that possible to do?
has comment: http://stackoverflow.com/comment/33167497
has comment: http://stackoverflow.com/comment/33166883
has answer: http://stackoverflow.com/a/21901000
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/33166971
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/21901010

http://stackoverflow.com/comment/33116364
type: Comment
comment on: http://stackoverflow.com/a/21872790
type: AnswerComment
has text: Can you please provide code for both of your solutions so that I can better understand it?
score: 0

http://stackoverflow.com/q/21984525
has body: I'm using spray with casbah and salat. I get this error when I import the casbah imports, import com.mongodb.casbah.Imports._ object mongodb is not a member of package com However, sbt compiles successfully w/o any warning. My build.sbt looks scalaVersion := "2.10.3" scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8") resolvers ++= Seq( "spray repo" at "http://repo.spray.io/", "Sonatype releases" at "https://oss.sonatype.org/content/repositories/releases" ) libraryDependencies ++= { val akkaV = "2.2.3" val sprayV = "1.2.0" Seq( "io.spray" % "spray-can" % sprayV, "io.spray" % "spray-routing" % sprayV, "io.spray" % "spray-testkit" % sprayV % "test", "com.typesafe.akka" %% "akka-actor" % akkaV, "com.typesafe.akka" %% "akka-testkit" % akkaV % "test", "org.specs2" %% "specs2-core" % "2.3.7" % "test", "org.mongodb" %% "casbah" % "2.7.0-RC0", "com.novus" %% "salat" % "1.9.5" ) } Any idea on how to convince Eclipse to find the package?
accepted answer: http://stackoverflow.com/a/22029554
has answer: http://stackoverflow.com/a/21991409
answer count: 3
upvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/21984942
has answer: http://stackoverflow.com/a/22029554
tagged with: scala
tagged with: casbah
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: eclipse
has title: Scala + Eclipse + Casbah = object mongodb is not a member of package com
has answer: http://stackoverflow.com/a/21984942
type: Question
tagged with: mongodb

http://stackoverflow.com/q/21919276
accepted answer: http://stackoverflow.com/a/21919418
answer count: 2
linked to: http://stackoverflow.com/q/10007994
score: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/36558275
tagged with: dependencies
favorite count: 0
has answer: http://stackoverflow.com/a/36558275
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/21919418
tagged with: java
tagged with: gradle
has body: I created a new Java project in IntelliJ IDEA using its Gradle project template, and I am trying to set up a library so that my project can use it. I saved the library JAR file to ./libs/frink-2014-02-17.jar in the project. In the dependencies section of my build.gradle, I wrote runtime fileTree(dir: 'libs', include: '*.jar'). But my Java code cannot see that library. When I try to build the project, the compiler complains that import frink.parser.Frink; references a package that does not exist. How can I fix my build errors, so that I can use the Frink library in my Java project? Details The library is Frink. Frink is not in the Maven repository, so I downloaded its JAR file, renamed it so it has the version in the filename (following the recommendation of the Gradle docs), and put it in a libs folder at the root of the project. Then I copied the following line of code from Gradle User Guide: File dependencies to try to include all JAR files in that libs directory I created: runtime fileTree(dir: 'libs', include: '*.jar') But when I “Make Project”, or run ./gradlew build, I get these errors: /…/frink-soulver/src/main/java/Main.java:1: package frink.parser does not exist import frink.parser.Frink; ^ /…/frink-soulver/src/main/java/Main.java:5: cannot find symbol symbol : class Frink location: class Main Frink interp = new Frink(); ^ /…/frink-soulver/src/main/java/Main.java:5: cannot find symbol symbol : class Frink location: class Main Frink interp = new Frink(); ^ /…/frink-soulver/src/main/java/Main.java:11: package frink.errors does not exist } catch (frink.errors.FrinkEvaluationException fee) { ^ 4 errors :compileJava FAILED My IDE highlights the same errors when I open and view Main.java, before I compile it. My code in Main.java, including the import, is just the Frink sample code. And the Frink online JavaDocs indicate that there indeed should be a frink.parser package in that JAR file. So it’s not that I’m asking for a package that doesn’t exist. I have tried …
type: Question
tagged with: intellij-idea
tagged with: jar
has title: JAR file library included using Gradle fileTree isn’t being seen by Java code

http://stackoverflow.com/a/21842391
has comment: http://stackoverflow.com/comment/33062364
has body: Remove the array brackets to use the instance of Card that you just created deck[i] = newCard; ^
type: AcceptedAnswer
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21842378
has comment: http://stackoverflow.com/comment/33062387
score: 2
accepted answer of: http://stackoverflow.com/q/21842378
upvote count: 2

http://stackoverflow.com/comment/33288353
comment on: http://stackoverflow.com/a/21968502
score: 0
type: AnswerComment
has text: @pospeq it looks as if my server stops and says that it cannot find the file bean.xml. Looking at my directory structure ( see post ) I'm not sure why this would be the case
type: Comment

http://stackoverflow.com/q/21917606
linked to: http://stackoverflow.com/q/17054000
tagged with: android-bluetooth
accepted answer: http://stackoverflow.com/a/21917860
tagged with: android
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33196669
has body: I'm using BluetoothAdapter in android studio 0.4. Project api minSdkVersion 11. Main activity look as follows: public class MainActivity extends Activity { private BluetoothAdapter bluetoothAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); bluetoothAdapter = new BluetoothAdapter.getDefaultAdapter(); } } The getDefaultAdapter causes: Cannot resolve symbol 'getDefaultAdapter()'. Any ideas?
tagged with: bluetooth
answer count: 1
downvote count: 0
has title: Cannot resolve symbol 'getDefaultAdapter()'?
has answer: http://stackoverflow.com/a/21917860
favorite count: 0

http://stackoverflow.com/q/21868099
accepted answer: http://stackoverflow.com/a/21868274
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has title: How to refresh contents of Fragment through its Activity?
type: Question
has answer: http://stackoverflow.com/a/21868274
score: 0
tagged with: android
answer count: 1
tagged with: android-activity
has body: What I currently have implemented the SliderMenu and its custom Adapter from: http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/ However, I have modified the HomeFragment to have a few buttons, one of which creates a custom DialogBox. Once the Dialog appears, the user types in title and description of a Project class that is then being saved to an ArrayList in HomeFragment. The objects in this ArrayList get updated with this input data, but my HomeFragment does not display the input data. Currently I am trying to use getFragmentManager()...Transition...replace..commit routine and tried a number of other unsuccessful methods and it is giving me a NullPointerException. I am fairly new to Android developement, but I would like to figure out a method to pass this data to my MainActivity and then have it display a new View of the HomeFragment except with the new data from input displayed. Here is the MainActivity: //package and imports...etc. public class MainActivity extends Activity { private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ActionBarDrawerToggle mDrawerToggle; private CharSequence mDrawerTitle; private CharSequence mTitle; private String[] navMenuTitles; private TypedArray navMenuIcons; private ArrayList&lt;NavDrawerItem&gt; navDrawerItems; private NavDrawerListAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTitle=mDrawerTitle=getTitle(); //load drawer menu items navMenuTitles=getResources().getStringArray(R.array.nav_drawer_items); //nav drawer icons from res navMenuIcons=getResources().obtainTypedArray(R.array.nav_drawer_icons); mDrawerLayout=(DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList=(ListView) findViewById(R.id.list_slidermenu); navDrawerItems=new ArrayList&lt;NavDrawerItem&gt;(); //adding nav drawer items to array navDrawerItems.add(new NavDrawerItem(navMenuTitles[0], navMenu…

http://stackoverflow.com/q/21874976
has comment: http://stackoverflow.com/comment/33131126
has answer: http://stackoverflow.com/a/21878180
answer count: 2
downvote count: 0
tagged with: tomcat8
tagged with: tomcat
has body: I'm using Tomcat embedded in my Java 8 application. I tried to switch the port at runtime like this: Tomcat tomcat = new Tomcat(); tomcat.setPort(18080); Timer timer =new Timer(); timer.schedule(new TimerTask() { @Override public void run() { tomcat.setPort(18181); } },240000L); But it doesn't seem to work. The wepapp responds still only to port 18080 after the timer delay was reached. Is switching even possible at runtime? How can i do it? EDIT: Using Tomcat embedded 8.0.3 on JDK 1.8.0b129 I'd like to avoid to restart the server because the startup process takes a long time.
favorite count: 0
has comment: http://stackoverflow.com/comment/42573972
type: UnansweredQuestion
tagged with: java-8
has title: Can I change the port of an embedded Tomcat at runtime?
score: 2
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/33134382
type: Question
has comment: http://stackoverflow.com/comment/42683092
has answer: http://stackoverflow.com/a/21881709

http://stackoverflow.com/a/21940995
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33241919
upvote count: 1
answers question: http://stackoverflow.com/q/21940810
type: Answer
has body: You can try to use an HTML parser like http://about.validator.nu/htmlparser/ or like TagSoup.

linux
tags question: http://stackoverflow.com/q/21962030
tags question: http://stackoverflow.com/q/21953022
tags question: http://stackoverflow.com/q/22002963
tags question: http://stackoverflow.com/q/21898072
tags question: http://stackoverflow.com/q/21850505
tags question: http://stackoverflow.com/q/21904372
tags question: http://stackoverflow.com/q/21937588
tags question: http://stackoverflow.com/q/21886857
tags question: http://stackoverflow.com/q/21893145
type: Tag
tags question: http://stackoverflow.com/q/22004886
tags question: http://stackoverflow.com/q/21895436
tags question: http://stackoverflow.com/q/21892746
tags question: http://stackoverflow.com/q/21993218
tag name: linux
tags question: http://stackoverflow.com/q/21861453
tags question: http://stackoverflow.com/q/21899889
tags question: http://stackoverflow.com/q/21936785
tags question: http://stackoverflow.com/q/21873678
tags question: http://stackoverflow.com/q/21989097
tags question: http://stackoverflow.com/q/21848607
tags question: http://stackoverflow.com/q/21942937
tags question: http://stackoverflow.com/q/21911689
tags question: http://stackoverflow.com/q/21956800
tags question: http://stackoverflow.com/q/21937842

http://stackoverflow.com/comment/33374112
score: 0
type: AnswerComment
has text: Also do I have to load a Context ? `@ContextConfiguration(loader=WebContextLoader.class,classes={WebConfig.class})` because I do not have any Webcontext atm. I just hava my "kinda" core project with my dao,service and controller methods v
type: Comment
comment on: http://stackoverflow.com/a/21988396

http://stackoverflow.com/a/22000564
answers question: http://stackoverflow.com/q/22000275
score: 0
has body: In the game example that you are trying to implement, y. Map and tiles can be an appropriate data structure rather then separate inner classes. Any specific requirements of having them as classes?
type: Answer

http://stackoverflow.com/comment/33348030
comment on: http://stackoverflow.com/q/22002414
type: Comment
type: QuestionComment
has text: Sleeping would be better than busy waiting...
score: 1

http://stackoverflow.com/comment/33195877
score: 4
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21915253
has text: This is an *extremely* common idiom in almost **all** C-based languages and any language that even has a for loop. -1

http://stackoverflow.com/a/23891509
has body: The method test(int/Integer) can be used as Predicate&lt;Integer&gt; and as IntPredicate. The compiler does the conversion: IntPredicate ip = (i) -&gt; i&gt;0; Predicate&lt;Integer&gt; pi = (i) -&gt; i&gt;0; Predicate&lt;Integer&gt; ip2pi = ip::test; IntPredicate pi2ip = pi::test; But you can't cast the two types as they are not assignable. IntPredicate does not extend Predicate. So just use ::test when you create FibSupplier: new FibSupplier(p) =&gt; new FibSupplier(p::test) Or do that in a constructor. I'd introduce a new abstract type FiniteIntSupplier with an extra constructor that takes an IntSupplier and converts it to a general Supplier: public FiniteIntSupplier(IntPredicate p) { this(p::test); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21954680

http://stackoverflow.com/comment/33180763
has text: Thank you for the feed back. However, I believe I have already made quite a progress into Selenium with Java programming (I mentioned 'relatively new'). I am already using a data driven frame work, but I need to upgrade it as it is presenting a lot of limitations with respect to my AUT. After a lot of considerations I came to conclusion that the most efficient method for my AUT would be the one I described in question. So thanks once again for your concern, but it would be much better if you could answer the question.
comment on: http://stackoverflow.com/q/21908112
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21958715
type: UnansweredQuestion
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/21958876
has body: Web applications for Tomcat are wrapped into a .war file and thrown into Tomcat. The application can use classes inside the war file and contained jar files. This separates the runtime-classes of Tomcat from the application classes. When using storm (see storm-project.net), there is no similar segregation. Rather the recommended way requires to create a "fat jar", denoting a jar containing all the necessary class files after unwrapping them from their own individual jars. For simple situations this works, but the resulting fat jar must have all the META-INF/* files from all merged jars correctly merged, which does not work semi-automatically. I would not be shy to write my own class loader which simulates something like a war-file. Except I have no clue how to intercept the default class loader that loads all the classes I deploy. My theory is that one of the classes of my applications is loaded first by the default class loader. Presumably in its static-section I would cast the magic class loader spell such that all dependent classes will then be loaded by my own class loader, which would now how to get the necessary classes from whatever I deem suitable. Any hints towards the general problems described as well as the specific magic needed are appreciated.
tagged with: dynamic-class-loaders
answer count: 1
has title: Sandboxed or walled classloader to separate application from runtime environment
tagged with: classloader

http://stackoverflow.com/comment/33325026
type: Comment
has text: A break statement without a label would exit the loop. i going >=n would exit the loop.
type: AnswerComment
comment on: http://stackoverflow.com/a/21989803
score: 0

http://stackoverflow.com/comment/125347327
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24657630
type: AnswerComment
has text: Does not answer the question how to select the Java version for macOS.

http://stackoverflow.com/q/21966992
tagged with: partial
possible better answer: http://stackoverflow.com/a/22000582
favorite count: 0
has comment: http://stackoverflow.com/comment/33285423
has comment: http://stackoverflow.com/comment/33285050
tagged with: derivative
has comment: http://stackoverflow.com/comment/33285772
tagged with: matlab
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/33285097
has answer: http://stackoverflow.com/a/21967774
type: Question
has comment: http://stackoverflow.com/comment/33286442
has title: Calculating partial derivatives of function
has answer: http://stackoverflow.com/a/23581758
downvote count: 0
accepted answer: http://stackoverflow.com/a/21967774
has body: I need to compute the first derivative of user-specified function. Program reads function as string from a file and then needs to compute derivative by one variable. Function has more variables, and can be linear or nonlinear. What is the easiest way to do this? Can calling MATLAB (maybe) be possible or whatever? Program doesn't have any Internet accesses.
has comment: http://stackoverflow.com/comment/33285176
has answer: http://stackoverflow.com/a/22000582
has comment: http://stackoverflow.com/comment/33285212
answer count: 3
has comment: http://stackoverflow.com/comment/33285141

http://stackoverflow.com/q/21874001
favorite count: 0
has comment: http://stackoverflow.com/comment/33123505
answer count: 0
has comment: http://stackoverflow.com/comment/33118691
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33118633
upvote count: 1
has comment: http://stackoverflow.com/comment/33118799
has body: I'm trying to parse an XML file and insert into MySQL all the data that I've parsed. However, I don't quite get how to I should parse an XML file with variable fields. I have tried researching for hours on how to do this. From what I've learned, you have to know something about the type of data you're parsing. In this case, I believe I do. Here is the DTD file I am working with: XML format So if we have an XML file containing data such as this (just as a very simple example): Modern Database Systems: The Object Model, Interoperability, and Beyond. The INGRES Papers: Anatomy of a Relational Database System db/books/collections/Stonebraker86.html Then I feel like I would need a bunch of if statements and a bunch of null checks to see which fields aren't present since the DTD file specifies a lot of possible fields for each element. However, I feel like this is a really bad way to go about parsing it. I've tried Googling for examples which handles such a case, but all the examples seem to have the same fields for each element. NodeList nl = docEle.getElementsByTagName("book"); if(nl != null && nl.getLength() > 0) { for(int i = 0 ; i < nl.getLength();i++) { //get the book element Element bl = (Element)nl.item(i); //get the book's associated fields String title = getTextValue(b1,"title"); String url = getTextValue(bl,"url"); //and so on and so fourth //check if null if (title.equals("")) { // don't use this as a field to insert into the database } if (url.equals("")) { // don't use this as a field either } //and so on.. } }
score: 1
tagged with: java
has title: Best way to go about XML parsing a bunch of optional fields?
tagged with: dom
type: Question
tagged with: xml-parsing
downvote count: 0
has comment: http://stackoverflow.com/comment/33119754
has comment: http://stackoverflow.com/comment/33118619
linked to: http://stackoverflow.com/q/21534340

http://stackoverflow.com/a/35962893
answers question: http://stackoverflow.com/q/21911406
score: 0
type: Answer
has body: You can do better by not having your code doing busy waiting. That will free a CPU to get the tasks finished. And prevent contention for any lock used by isTerminated.

http://stackoverflow.com/comment/123499254
type: AnswerComment
has text: What do you do when `java -version` lists a version that is not listed with `/usr/libexec/java_home -V`? It confuses me a lot.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24657630

http://stackoverflow.com/a/21909433
has body: When i = 0, n-i will result in n, which is one larger than the available indexes( 0 -> n-1 ). for (i = 0; i &lt; n/2; i++){ j = a1[i]; k = a1[n-i]; //error line; a1[i]=k; a1[n-i]=j; }
upvote count: 6
has comment: http://stackoverflow.com/comment/33181662
has comment: http://stackoverflow.com/comment/33181495
has comment: http://stackoverflow.com/comment/33181552
has comment: http://stackoverflow.com/comment/33181618
downvote count: 0
answers question: http://stackoverflow.com/q/21909365
score: 6
type: Answer

http://stackoverflow.com/comment/33213029
has text: you can use same xml file names for portrait and landscape mode in two folders layout-land and layout-port
comment on: http://stackoverflow.com/q/21927046
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21889450
has body: Because you want your range to be inclusive. If you left the +1 out, you would have 20-15 = 5. However, you want to include 20 and 15, so you need an extra digit. Just count them: 15, 16, 17, 18, 19, 20 That's 6 digits (20-15+1), not 5 digits (20-15).
type: Answer
score: 4
answers question: http://stackoverflow.com/q/21889389
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/33241562
has text: I'll give it a try, thnx
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21943073

http://stackoverflow.com/a/21943061
has comment: http://stackoverflow.com/comment/33241402
has body: try changing from lname to lName
type: Answer
has comment: http://stackoverflow.com/comment/33243392
answers question: http://stackoverflow.com/q/21943025
score: 0

http://stackoverflow.com/comment/33260359
type: AnswerComment
type: Comment
has text: No. Even if the webapp is the root webapp, it will only work for URLs directly under the root 'i.e. it will work with /hello.jsp, but won't for /foo/bar/hello.jsp).
comment on: http://stackoverflow.com/a/21953455
score: 0

http://stackoverflow.com/comment/33226274
type: Comment
has text: Thanks so much. I've just confirmed that the above does work; sorry the code tags don't seem to be used properly.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21933225

http://stackoverflow.com/comment/33211686
type: Comment
has text: I had tried to add `<project.resources.sourceEncoding>UTF-8</project.resources.sourceEncoding>` into properties but nothing have changed.
comment on: http://stackoverflow.com/a/21925884
score: 0
type: AnswerComment

http://stackoverflow.com/q/21992539
has comment: http://stackoverflow.com/comment/33329949
has comment: http://stackoverflow.com/comment/33332833
linked to: http://stackoverflow.com/q/3177733
has comment: http://stackoverflow.com/comment/33330314
has answer: http://stackoverflow.com/a/22054223
type: AnsweredQuestion
has body: I got a question about servlets and jsp. Servlet: public class Servlet extends javax.servlet.http.HttpServlet { protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException { Integer i = new Integer(15); request.setAttribute("var", i); RequestDispatcher Dispatcher = getServletContext().getRequestDispatcher("/index.jsp"); Dispatcher.forward(request, response); } JSP page: <%= (request.getAttribute("var")) %> As a result I expect to see 15, but I see null. Why does it happen?
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33332556
score: 1
tagged with: java
has title: Sending a variable from Servlet to JSP
has answer: http://stackoverflow.com/a/21992605
possible better answer: http://stackoverflow.com/a/21992628
tagged with: servlets
has answer: http://stackoverflow.com/a/21992628
answer count: 3
accepted answer: http://stackoverflow.com/a/21992605
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/33332344
has comment: http://stackoverflow.com/comment/33330523
favorite count: 0

http://stackoverflow.com/comment/33251983
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21948559
has text: 0.7f is not a string it means 0.7 float. Try float fOpacity = (float)opacity/10; You could also say for example: double dOpacity = 0.7f; because a double is just actually a larger float.
type: AnswerComment

http://stackoverflow.com/comment/33109936
has text: Caching might or mightn't help to postpone the StackOverflowError, it make even make it to come faster as it speeds up the computation.
type: AnswerComment
comment on: http://stackoverflow.com/a/21865258
score: 0
type: Comment

http://stackoverflow.com/comment/90030190
type: AnswerComment
score: 1
has text: hi Sandhu, Why we are saving product, po2,po and po1 separately? Why Can't I populate Product with po,po1 and po2 and then save only Product. Then I should save all po, po1 and po2 internally. I am trying this its not working. Please help.
type: Comment
comment on: http://stackoverflow.com/a/22002647

http://stackoverflow.com/a/21871112
has body: The JSON document is invalid. Try logging it before decoding. Edit: The JSON document looks fine. The "id" value would overflow a 32 bit integer though, please check that it goes to a long integer.
has comment: http://stackoverflow.com/comment/33129577
type: Answer
answers question: http://stackoverflow.com/q/21869524
score: 0

http://stackoverflow.com/comment/35362666
has text: If you have any other working example for detecting peak frequency,.. Please share with me. Thanks
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22165421

http://stackoverflow.com/q/21952549
has answer: http://stackoverflow.com/a/21952837
tagged with: compiler-errors
tagged with: constructor
has body: Hi I have been trying to use my zero­parameter constructors to call my SunkenObject constructor with initial weight values but for some reason i keep getting this error constructor SunkenObject in class SunkenObject cannot be applied to given types;` required: float found: no arguments reason: actual and formal argument lists differ in length This is my SunkenObject constructor: public abstract class SunkenObject extends CatchableThing { protected float weight; public SunkenObject(float w) { weight = w; } public float getWeight() { return weight; } public String toString () { return (getClass().getSimpleName()); } } and this is one of the objects (a rusty chain) that is extended by SunkenObject public class RustyChain extends SunkenObject { public RustyChain (float w) { super(w); } public RustyChain() { weight = 8.0f; } } can anyone tell me what I am doing wrong because from my perspective nothing is wrong with the code. Thank You!
has title: calling a constructor from a derived class
type: AnsweredQuestion
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/21952559
type: Question
answer count: 2
tagged with: inheritance
score: 0
accepted answer: http://stackoverflow.com/a/21952559
possible better answer: http://stackoverflow.com/a/21952837

http://stackoverflow.com/a/21884569
has comment: http://stackoverflow.com/comment/33139742
has comment: http://stackoverflow.com/comment/33212471
has comment: http://stackoverflow.com/comment/33232224
accepted answer of: http://stackoverflow.com/q/21862228
answers question: http://stackoverflow.com/q/21862228
has body: Use markerLayer.remove(myMarker) , detachFromLayer is an internal method and you should not use it normally.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/21872791
upvote count: 6
has comment: http://stackoverflow.com/comment/33130791
has comment: http://stackoverflow.com/comment/33168999
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33116713
has comment: http://stackoverflow.com/comment/33170044
has body: package com.example.touch; import android.app.Activity; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.widget.Button; import android.widget.RelativeLayout; import android.widget.TextView; public class MainActivity extends Activity { Button b1, b2, b3, b4; int b1x1, b1x2, b1y1, b1y2; private TextView xcordview; private TextView ycordview; private TextView buttonIndicator; private RelativeLayout touchview; private static int defaultStates[]; private Button mLastButton; private final static int[] STATE_PRESSED = { android.R.attr.state_pressed, android.R.attr.state_focused | android.R.attr.state_enabled }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); xcordview = (TextView) findViewById(R.id.textView4); ycordview = (TextView) findViewById(R.id.textView3); buttonIndicator = (TextView) findViewById(R.id.button_indicator); touchview = (RelativeLayout) findViewById(R.id.relativelayout); b1 = (Button) findViewById(R.id.button1); b2 = (Button) findViewById(R.id.button2); b3 = (Button) findViewById(R.id.button3); b4 = (Button) findViewById(R.id.button4); defaultStates = b1.getBackground().getState(); } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); touchview.setOnTouchListener(new View.OnTouchListener() { private boolean isInside = false; @Override public boolean onTouch(View v, MotionEvent event) { int x = (int) event.getX(); int y = (int) event.getY(); xcordview.setText(String.valueOf(x)); ycordview.setText(String.valueOf(y)); for (int i = 0; i &lt; touchview.getChildCount(); i++) { View current = touchview.getChildAt(i); if (current instanceof Button) { Button b = (Button) current; if (!isPointWithin(x, y, b.getLeft(), b.getRight(), b.getTop(), b.getBottom())) { b.getBackground().setState(defaultStates); } if (isPointWithin(x, y, b.getLeft(), b.getRight(), b.getTop(), b.getBottom())) { b…
score: 6
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21872464
has comment: http://stackoverflow.com/comment/33116288
answers question: http://stackoverflow.com/q/21872464

http://stackoverflow.com/comment/45230383
comment on: http://stackoverflow.com/a/22028250
type: Comment
has text: Hi fetifati. Can you explain in details what you did to use it in your project (where you copied what etc.)? Thanks a lot
score: 0
type: AnswerComment

http://stackoverflow.com/a/21928565
has body: The month index start from 0-January 1 febuary ans so on 11 for december
downvote count: 0
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/21928495

http://stackoverflow.com/comment/33347058
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21998827
has text: OK, but did you step through with the debugger? Were you able to get the debugger to tell you exactly which expression was null?
score: 0

http://stackoverflow.com/comment/33295023
type: Comment
comment on: http://stackoverflow.com/q/21972572
type: QuestionComment
has text: @assylias I've implemented that before this solution, however perhaps my `has3DigitsFactors` was not really good, so if you could provide a fast version to check the factor, then it's fine, else it is not really an option.
score: 0

http://stackoverflow.com/q/21876068
possible better answer: http://stackoverflow.com/a/21876218
type: Question
tagged with: debugging
has answer: http://stackoverflow.com/a/21876237
has title: How to debug war dependency?
score: 0
has body: I am working on a web-app front end (spring mvc) which depends on war file (created also by me). Both module web and core communicate via REST (Jersey). Both modules are separate maven projects. On some occasions during development I screw up something in the core and exception is thrown. Many times I need to setup a breakpoint there and trap the issue. The problem is: I start the debug when running the web-app fine. But will never stop on any breakpoint in core (doooh). (core is build using maven package command, to generate war file). I could start only the core and debug it. Problem some complex functions expect many attributes (form object json format). Any ideas? Tnx
answer count: 3
has answer: http://stackoverflow.com/a/21876218
accepted answer: http://stackoverflow.com/a/21876410
tagged with: war
has answer: http://stackoverflow.com/a/21876410
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/47517592
type: Comment
comment on: http://stackoverflow.com/q/21880941
score: 0
type: QuestionComment
has text: Can you, please, post a full code of your facerec.cpp with all JNI injections?

http://stackoverflow.com/q/21969462
has comment: http://stackoverflow.com/comment/33316245
has body: I have a JTable which contains data that the user can edit. I want to make sure that when the user edits the "name" column, the new value is unique in the table, i.e. there are no other entries with the same name. I tried to do that using a custom cell editor and input verifier as follows: class CellEditor extends DefaultCellEditor { InputVerifier verifier = null; public CellEditor(InputVerifier verifier) { super(new JTextField()); this.verifier = verifier; } @Override public boolean stopCellEditing() { return verifier.verify(editorComponent) &amp;&amp; super.stopCellEditing(); } } class MyVerifier extends InputVerifier { DefaultTableModel tm = null; MyVerifier(DefaultTableModel tm) { super(); this.tm = tm; } @Override public boolean verify(JComponent input) { boolean verified = true; String text = ((JTextField) input).getText(); for (int i = 0; i &lt; tm.getRowCount(); i++) { String s = (String) tm.getValueAt(i, 1); if (s.equals(text)) { verified = false; break; } } return verified; } } In my code I used the following to set the cell editor to the specific column: tm = (DefaultTableModel) myTable.getModel(); myTable.getColumnModel().getColumn(1).setCellEditor(new CellEditor(new MyVerifier(tm))); The problem is that i always get that there is a duplicate value when I traverse the columns without changing anything because the loop in the verify method checks all the rows, including the focal row with itself. I want to exclude this case but I do not have access to the row number of the focal entry. Is there any other solution? Thanks.
type: UnansweredQuestion
tagged with: tablecelleditor
has title: Preventing duplicate values when editing in a JTable
answer count: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/5311230
has comment: http://stackoverflow.com/comment/33290158
tagged with: jtable
has comment: http://stackoverflow.com/comment/33291007
score: 0
tagged with: validation

http://stackoverflow.com/q/21968016
answer count: 0
tagged with: java
tagged with: jcomponent
tagged with: jpanel
has comment: http://stackoverflow.com/comment/33287226
type: Question
has comment: http://stackoverflow.com/comment/33286906
has comment: http://stackoverflow.com/comment/33288846
downvote count: 0
has body: I'm having a problem placing a custom JComponent on a JPanel. The JPanel is located in the main JFrame with absolute Positioning. All fine until now. My custom JComponent draws a simple rectangle and is also added to the JPanel by absolute positioning. The problem is that it isn't shown on the Panel. Letting the JPanel draw the rectangle works but this is not what I want to do. public class MyComponent extends JComponent { public MyComponent () { this.setBounds(50, 50, 50, 50); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(new Color(255, 255, 255)); g.fillRect(50, 50, 50, 50); } @Override public Dimension getPreferredSize() { Return new Dimension(50, 50); } @Override public Point getLocation(Point arg0) { return new Point(50, 50); } }
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: swing
score: 2
has comment: http://stackoverflow.com/comment/33286881
has title: Custom JComponent not showing in JPanel

http://stackoverflow.com/comment/33092674
type: QuestionComment
has text: @shylendra Where are you seeing a `TextView` in this question?
score: 0
comment on: http://stackoverflow.com/q/21859346
type: Comment

http://stackoverflow.com/q/21973874
type: Question
has comment: http://stackoverflow.com/comment/33297217
answer count: 2
has answer: http://stackoverflow.com/a/21973933
upvote count: 1
has comment: http://stackoverflow.com/comment/33297168
possible better answer: http://stackoverflow.com/a/21973974
has body: The problem is this: I need to shuffle a deck of cards (ArrayList or array of 52 ints (0 to 51)). I also need to do this 200,000 times and on an Android processor. Please help me optimize this, because this is taking an unbelievable amount of time even on a more high end device (up to 10 seconds). Methods I've tried: 1) Shuffle the deck with Collections.shuffle and draw first cards I get (takes 8 seconds on Nexus7): for(long i = 0; i &lt; ITERATIONS; i++) { // ITERATIONS is 200,000 ArrayList&lt;Integer&gt; fakeDeck = (ArrayList) deck.clone(); // deck is the sorted deck. Collections.shuffle(fakeDeck); int card1 = fakeDeck.get(0); int card2 = fakeDeck.get(1); int card3 = fakeDeck.get(2); int card4 = fakeDeck.get(3); int card5 = fakeDeck.get(4); // do something with cards. } 2) Randomly pick cards from an unshuffled deck (a bit better, takes 5 secs): for(long i = 0; i &lt; ITERATIONS; i++) { // ITERATIONS is 200,000 ArrayList&lt;Integer&gt; fakeDeck = (ArrayList) deck.clone(); // deck is the sorted deck. int card1 = pullCardFromDeck(fakeDeck); int card2 = pullCardFromDeck(fakeDeck); int card3 = pullCardFromDeck(fakeDeck); int card4 = pullCardFromDeck(fakeDeck); int card5 = pullCardFromDeck(fakeDeck); // do something with cards. } // pullCardFromDeck is: private int pullCardFromDeck(ArrayList&lt;Integer&gt; deck) { int randomNumber = new Random().nextInt(deck.size()); int card = deck.get(randomNumber); // get a random card. deck.remove(randomNumber); // remove the card from the deck. return card; }
has answer: http://stackoverflow.com/a/21973974
has comment: http://stackoverflow.com/comment/33296894
tagged with: java
has comment: http://stackoverflow.com/comment/33297118
has title: Optimize shuffling an ArrayList
accepted answer: http://stackoverflow.com/a/21973933
downvote count: 0
tagged with: optimization
has comment: http://stackoverflow.com/comment/33296927
tagged with: arraylist
has comment: http://stackoverflow.com/comment/33296857
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33297020
tagged with: android
has comment: http://stackoverflow.com/comment/33296882
has comment: http://stackoverflow.com/comment/33297302
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33297091

http://stackoverflow.com/comment/33316104
type: QuestionComment
comment on: http://stackoverflow.com/q/21983463
type: Comment
has text: @Baz, I deleted `try-catch` still the same exception. The problem is, I think, when I call `label1.setImage(SWTResourceManager(img))`, it loads the image to memory then it is not removing. Those images should already be disposed as I'm disposing labels at the end of the `refreshMyPanel()`. I editted the code.
score: 0

http://stackoverflow.com/q/21958751
answer count: 3
has comment: http://stackoverflow.com/comment/33302146
has comment: http://stackoverflow.com/comment/33269958
has comment: http://stackoverflow.com/comment/33283689
favorite count: 0
has answer: http://stackoverflow.com/a/21959479
has comment: http://stackoverflow.com/comment/33269952
has comment: http://stackoverflow.com/comment/33272023
upvote count: 4
downvote count: 4
type: AnsweredQuestion
tagged with: java
has title: Basic Java arraylist
type: Question
possible better answer: http://stackoverflow.com/a/21959479
has body: Write a Java method that recieves an undeclared ArrayList of integers and an integer as parameters, searches the ArrayList for the integer, returns true if found. A)Use a while loop to do the searching. B) Try it again but with a for loop C)Try again, but with for-each loop D) (this is hard) Write a Java method that recieves an ArrayList of integers as a parameter and returns the index of the largest integer in the collection. //part a int i =0 ; while (i&lt;500) { if (values [i] == 3927) { system.out.prinln("FOUND IT!"); break; } i++; } If needed , ill post the code I came up with, please comment if need. I really am having troubles getting this to compile.
has comment: http://stackoverflow.com/comment/33270471
has answer: http://stackoverflow.com/a/21959138
accepted answer: http://stackoverflow.com/a/21959138
has answer: http://stackoverflow.com/a/21958916
has comment: http://stackoverflow.com/comment/33269998
has comment: http://stackoverflow.com/comment/33269951
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/33270217

http://stackoverflow.com/q/21942367
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21944916
upvote count: 1
score: 1
tagged with: java
tagged with: dom
type: Question
has comment: http://stackoverflow.com/comment/33240255
has comment: http://stackoverflow.com/comment/33240331
has title: Is it possible to have progress reporting for javax.xml.parsers.DocumentBuilder.parse(File)?
has body: If execution of javax.xml.parsers.DocumentBuilder.parse(File) takes a long time, may I obtain somehow the progress information from somewhere? May be add some hooks or progress listeners?
downvote count: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0

http://stackoverflow.com/comment/33077579
score: 1
type: QuestionComment
has text: For starters, your method returns an `int`, while it seems you want to return more than one value, so you'd probably need a `Collection<Integer>` as the return value (or one if its implementations)
type: Comment
comment on: http://stackoverflow.com/q/21851511

http://stackoverflow.com/comment/33299115
has text: You should post a new question or, even better, comment on my answer if it doesn't work as expected. One thing I just noticed is that `while (i <= number && i < x)` should be used as otherwise the last factor is missed.
type: QuestionComment
comment on: http://stackoverflow.com/q/21927132
score: 0
type: Comment

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/21841821
tags question: http://stackoverflow.com/q/21989498
tags question: http://stackoverflow.com/q/22003943
type: Tag
tags question: http://stackoverflow.com/q/21863005

http://stackoverflow.com/comment/33347860
comment on: http://stackoverflow.com/q/22002296
score: 3
has text: Could you add examples where your code works and examples where your code does not work? It will be easier to debug that way
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22408530
type: Answer
has body: I was stuck with somehow the same issue. What i did to get something working a little bit better but still not perfectly. I'm on RHEL : [root@bus|in plugins]# cat /etc/munin/plugin-conf.d/munin-node [diskstats] user munin [iostat_ios] user munin [jmx_*] env.ip 192.168.1.101 env.port 5054 &lt;- being the port configured for your jmx then [root@bus|in plugins]# ls -l /etc/munin/plugins/jmx_MultigraphAll lrwxrwxrwx 1 root root 29 14 mars 15:36 /etc/munin/plugins/jmx_MultigraphAll -&gt; /usr/share/munin/plugins/jmx_ and I modified the /usr/share/munin/plugins/jmx_ with the following : #!/bin/sh # -*- sh -*- : &lt;&lt; =cut =head1 NAME jmx_ - Wildcard plugin to monitor Java application servers via JMX =head1 APPLICABLE SYSTEMS Tested with Tomcat 4.1/5.0/5.5/6.0 on Sun JVM 5/6 and OpenJDK. Any JVM that supports JMX should in theory do. Needs nc in path for autoconf. =head1 CONFIGURATION [jmx_*] env.ip 127.0.0.1 env.port 5400 env.category jvm env.username monitorRole env.password SomethingSecret env.JRE_HOME /usr/lib/jvm/java-6-sun/jre env.JAVA_OPTS -Xmx128m Needed configuration on the Tomcat side: add -Dcom.sun.management.jmxremote \ -Dcom.sun.management.jmxremote.port=5400 \ -Dcom.sun.management.jmxremote.ssl=false \ -Dcom.sun.management.jmxremote.authenticate=false to CATALINA_OPTS in your startup scripts. Replace authenticate=false with -Dcom.sun.management.jmxremote.password.file=/etc/tomcat/jmxremote.password \ -Dcom.sun.management.jmxremote.access.file=/etc/tomcat/jmxremote.access ...if you want authentication. jmxremote.password: monitorRole SomethingSecret jmxremote.access: monitorRole readonly You may need higher access levels for some counters, notably ThreadsDeadlocked. =head1 BUGS No encryption supported in the JMX connection. The plugins available reflect the most interesting aspects of a JVM runtime. This should be extended to cover things specific to Tomcat, JBoss, Glassfish and so on. Patches welcome. =head1 AUTHORS =encoding UTF-8 Mo Amini, Diyar Amin and…
accepted answer of: http://stackoverflow.com/q/21884562
upvote count: 2
answers question: http://stackoverflow.com/q/21884562
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34079685
has comment: http://stackoverflow.com/comment/34075209

http://stackoverflow.com/comment/33159414
comment on: http://stackoverflow.com/q/21896347
has text: Have you checked if any errors are being logged to the [Java console](http://www.java.com/en/download/help/javaconsole.xml)? Or if you're getting crash dumps – wherever those would show up on Windows.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21858528
downvote count: 0
answer count: 6
possible better answer: http://stackoverflow.com/a/37728241
has answer: http://stackoverflow.com/a/37728241
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/21859000
has answer: http://stackoverflow.com/a/69392840
has answer: http://stackoverflow.com/a/36760212
tagged with: android-intent
score: 31
has answer: http://stackoverflow.com/a/75232791
type: AnsweredQuestion
has title: Convert a Bundle to JSON
has comment: http://stackoverflow.com/comment/33090943
upvote count: 31
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33090525
accepted answer: http://stackoverflow.com/a/21859000
has body: I'd like to convert the an Intent's extras Bundle into a JSONObject so that I can pass it to/from JavaScript. Is there a quick or best way to do this conversion? It would be alright if not all possible Bundles will work.
type: Question
has answer: http://stackoverflow.com/a/45420083

http://stackoverflow.com/comment/33167568
comment on: http://stackoverflow.com/q/21901357
type: Comment
type: QuestionComment
has text: Who is `Jimmy` anyway? o.O
score: 1

http://stackoverflow.com/q/21924918
possible better answer: http://stackoverflow.com/a/21925563
has answer: http://stackoverflow.com/a/21925563
tagged with: java
score: 15
upvote count: 15
answer count: 2
has body: I have the following entity with enum collection. I would like to search the user with an enum parameter. The user might have multiple permission. When I search the users with the parameter like Permission.APPROVE, there may be one or more user who have that permission. How can I write JPQL query? User.java @Entity .... public class User implements Serializable { @ElementCollection(targetClass = Permission.class) @Enumerated(EnumType.STRING) @CollectionTable(name = "USER_PERMISSION", joinColumns = @JoinColumn(name = "PERMISSION", referencedColumnName = "ID")) private List&lt;Permission&gt; permisssionList; } Permission.java public enum Permission { REGISTER, APPROVE, REJECT, CONFIRM; } How to write ? public List&lt;User&gt; findUserList(Permission permission) { Query q = em.createQuery(.....); result = q.getResultList(); }
has answer: http://stackoverflow.com/a/21925506
tagged with: jpa
downvote count: 0
tagged with: jpql
favorite count: 0
has title: JPQL select query for ElementCollection
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21925506
type: Question

http://stackoverflow.com/q/21872464
answer count: 4
type: AnsweredQuestion
tagged with: motionevent
has answer: http://stackoverflow.com/a/21872720
tagged with: java
has answer: http://stackoverflow.com/a/57475479
type: Question
accepted answer: http://stackoverflow.com/a/21872791
possible better answer: http://stackoverflow.com/a/21872720
downvote count: 0
tagged with: android
score: 7
favorite count: 0
has body: I have 4 buttons in my android app activity. This is what it looks like: As you can see, the textViews at the bottom of the screen display the x and y coordinates. The coordinates are in reference to a relative layout. (See below given code) Now, what I want to do is get the x and y coordinates of the 4 buttons at runtime and then figure out if my finger is touching the buttons while moving or not. In simple words, I want to press the buttons by swiping my finger over them instead of lifting and touching. How can I achieve it? I want to implement it in my piano application. I was able to get the coordinates on screen and they change as I move my finger. So, my question is How can I get the coordinates of the buttons and detect if my finger is swiping above them?: XML &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff" android:id="@+id/relativelayout"&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="Y Cord : " android:layout_marginLeft="10dp" android:layout_marginBottom="10dp" android:id="@+id/textView" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="X Cord : " android:layout_marginLeft="10dp" android:layout_marginBottom="10dp" android:id="@+id/textView2" android:layout_above="@+id/textView" android:layout_alignParentLeft="true" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:id="@+id/textView3" android:textColor="#000000" android:layout_below="@+id/textView2" android:layout_toRightOf="@+id/textView" /&gt; &lt;TextView android…
has answer: http://stackoverflow.com/a/21872791
has title: Get button coordinates and detect if finger is over them - Android
upvote count: 7
has answer: http://stackoverflow.com/a/21872790

http://stackoverflow.com/a/21885975
type: Answer
has comment: http://stackoverflow.com/comment/33139866
has comment: http://stackoverflow.com/comment/33153750
has comment: http://stackoverflow.com/comment/33139921
has comment: http://stackoverflow.com/comment/33141041
has comment: http://stackoverflow.com/comment/33141704
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/21885869
type: AcceptedAnswer
has body: You're starting two threads new Thread(d).start(); // one here Thread t1 = new Thread(d); t1.start(); // another here with the same objects. Both threads will execute d.run(). In other words both will call sleep1 with a value of i equal to 1. How can i clearly determine that which thread is running at a time and when switched to another thread? You can find out by checking the thread's name, but you shouldn't. A thread shouldn't know about itself. It's just meant to run code that you give it.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21885869
has comment: http://stackoverflow.com/comment/33141639
has comment: http://stackoverflow.com/comment/33153807

http://stackoverflow.com/a/21993859
has body: You need to get the sum of the number of remaining cards BELOW the card value you have (not just determine the total number of remaining cards). For example, you could use something like int[] cardsBelow = new int[13]; for (int i=0; i &lt; cardsBelow.length; i++) { if (i == 0) { cardsBelow[i] = cardCounter[i]; } else { cardsBelow[i] = cardsBelow[i-1] + cardCounter[i]; } } that way, the cell cardsBelow[i-1] contains the number of cards below the "i"th card.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/33335160
answers question: http://stackoverflow.com/q/21993053
score: 1
downvote count: 0

http://stackoverflow.com/q/21902360
type: Question
tagged with: imageview
has answer: http://stackoverflow.com/a/21904789
score: 0
answer count: 3
tagged with: android
tagged with: spinner
has body: I am new to Android development and I am trying to create simple application including spinner ( 3 entries). My goal is, to show a different image for each spinner that is selected. With the help of some tutorials I managed to get the following code, but I have no idea, how to bind a image to a spinner entries. activity_main.xml &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" &gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;Spinner android:id="@+id/spinner1" android:layout_width="match_parent" android:layout_height="wrap_content" android:entries="@array/Stockwerk"/&gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:contentDescription="Plan der 8. Etage" /&gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; main_activity.java package com.example.raumplan; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.Spinner; public class MainActivity extends Activity { private Spinner spinner; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); addListenerOnSpinnerItemSelection(); } public void addListenerOnSpinnerItemSelection() { spinner = (Spinner) findViewById(R.id.spinner1); spinner.setOnItemSelectedListener(new CustomOnItemSelectedListener()); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflat…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/39335009
tagged with: android-layout
tagged with: java
has answer: http://stackoverflow.com/a/21902474
has title: Show different images on different spinner selections

http://stackoverflow.com/comment/33222830
type: QuestionComment
has text: I believe I have found the problem... Unfortunately we don't use the same JDK so sources differ. Can you check in your JDK source what is at DataOutputStream.java line 276? If my guess is correct, it is a line which would read `out.write(...);` -- and `out` is an instance variable of `FilterOutputStream`
score: 0
comment on: http://stackoverflow.com/q/21932308
type: Comment

http://stackoverflow.com/comment/33346673
comment on: http://stackoverflow.com/q/22000764
score: 0
type: Comment
type: QuestionComment
has text: @MadProgrammer I am indeed updating from the process() method of the SwingWorker.

http://stackoverflow.com/comment/33202581
comment on: http://stackoverflow.com/q/21920715
type: QuestionComment
type: Comment
has text: why are you mocking ´ImageConverter´ if it is the class you want to test? Furthermore, you prepare it for mocking but you never mock it
score: 0

http://stackoverflow.com/q/21950305
has comment: http://stackoverflow.com/comment/33255326
has comment: http://stackoverflow.com/comment/33254936
tagged with: timer
has comment: http://stackoverflow.com/comment/33255536
has comment: http://stackoverflow.com/comment/33255337
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33255411
tagged with: animation
has title: Creating a basic animation within a JFrame
has comment: http://stackoverflow.com/comment/33255502
tagged with: jframe
has answer: http://stackoverflow.com/a/21950659
tagged with: swing
has comment: http://stackoverflow.com/comment/33255249
linked to: http://stackoverflow.com/q/19209650
has comment: http://stackoverflow.com/comment/33255557
type: Question
has comment: http://stackoverflow.com/comment/33255494
tagged with: java
has comment: http://stackoverflow.com/comment/33255977
has comment: http://stackoverflow.com/comment/33255016
has answer: http://stackoverflow.com/a/21951471
score: 0
answer count: 2
has body: So I'm in my first programming class this quarter and I decided to test what I've learned so far and create my very first game! I completed a purely text based game that puts the user against a computer and attacks defends and evades trying to bring the computers life points down to zero. I wanted to add some sort of visual animation to the game and i cant seem to find a way to make it so that when the user presses a button on the buttonPanel a specific animation will appear. The goal is to have a default image of the human and computer standing on a battlefield, then when you press a button new frames will display in sequence making an animation, then i want the default image to display again. I built a BattleGame class and then a RolePlay class that extends BattleGame. My Question is: Why wont the images come up at all when i run the program. I tried putting the animation() method inside the attack() method and it still didn't work. The animation isn't coming up at all. I know the problem is inside the animation() method. I just don't know why it wont work. http://i1209.photobucket.com/albums/cc400/squaredcorn/program_zps23d42f2d.png The first chunk of code is the animation method I'm trying to create. The rest is the entire BattleGame class. "the animation method is just after actionPerformed Thanks for any help, I know its a lot of code but I'm really desperate and I'm not sure why it doesn't work :'( public Image[] frames = new Image[3]; public void animation() { try { frames[0] = ImageIO.read(new File("1.png")); frames[1] = ImageIO.read(new File("2.png")); frames[2] = ImageIO.read(new File("3.png")); } catch (Exception e) { } JPanel gui = new JPanel(new BorderLayout()); final JLabel attackAnimation = new JLabel(new ImageIcon(frames[0])); gui.add(attackAnimation, BorderLayout.EAST); int index = 0; if(index &lt; frames.length){ index++; if(index &gt; frames.length) index = 0; } attackAnimation.setIcon(new ImageIcon(frames[index])); final Timer timer = new Timer(…
has comment: http://stackoverflow.com/comment/33254959
has comment: http://stackoverflow.com/comment/33255373

http://stackoverflow.com/comment/33318491
type: AnswerComment
score: 0
has text: That's what I thought.But then I got the doubt that this was for the heap memory pertaining to the app. What about for the phone's internal memory?
type: Comment
comment on: http://stackoverflow.com/a/21986357

http://stackoverflow.com/a/21899809
score: 0
has body: Depends entirely on your needs. In this case -- outside of the problem the first has of not properly protecting the test (your if should be inside the synchronization, or you risk race conditions where someone else changes it after you've tested it but before you've finished acting on the result of the test), so you could wind up with two instances -- the two are probably equivalent after the JIT is done with them. In general, however, the problem with synchronized methods tends to be that they're oversynchronized. Many of them hold onto their lock longer than absolutely necessary, and may cost you performance by forcing other threads to wait longer. Synchronization should be done for the minimum time necessary to make the operation atomic, and often that can be limited to a few key lines rather than the whole method. On The Other Hand... sometimes it's best not to make the class threadsafe at all. Hashtables were threadsafe; HashMaps (the newer alternative) aren't. That's because getting the lock is a relatively expensive process, especially in multiprocessor environments, and in real-world code if threadsafety is needed it generally wants to cover more than the single hashmap access so locking at this level is more often wasteful than helpful.
type: Answer
answers question: http://stackoverflow.com/q/21898008

http://stackoverflow.com/a/22000255
has body: JavaScript objects are different from classical OO/UML (C++/Java/C# etc.) objects. In particular, they need not instantiate a class. And they can have their own (instance-level) methods in the form of method slots, so they do not only have (ordinary) property slots, but also method slots. In addition they may also have key-value slots. So, they may have three different kinds of slots, while classical objects (called "instance specifications" in UML) only have property slots. JavaScript objects can be used in many different ways for different purposes. Here are five different use cases for, or possible meanings of, JavaScript objects: A record is a set of property slots like, for instance, var myRecord = { firstName:"Tom", lastName:"Smith", age:26} An associative array (or 'hash map') is a set of key-value slots. It supports look-ups of values based on keys like, for instance, var numeral2number = { "one":"1", "two":"2", "three":"3"} which associates the value "1" with the key "one", "2" with "two", etc. A key need not be a valid JavaScript identifier, but can be any kind of string (e.g. it may contain blank spaces). An untyped object does not instantiate a class. It may have property slots and method slots like, for instance, var person1 = { lastName: "Smith", firstName: "Tom", getInitials: function () { return this.firstName.charAt(0) + this.lastName.charAt(0); } }; A namespace may be defined in the form of an untyped object referenced by a global object variable, the name of which represents a namespace prefix. For instance, the following object variable provides the main namespace of an application based on the Model-View-Controller (MVC) architecture paradigm where we have three subnamespaces corresponding to the three parts of an MVC application: var myApp = { model:{}, view:{}, ctrl:{} }; A typed object o that instantiates a class defined by a JavaScript constructor function C is created with the expression var o = new C(...) The type/class of such a typed obj…
upvote count: 17
has comment: http://stackoverflow.com/comment/136720695
has comment: http://stackoverflow.com/comment/136722285
has comment: http://stackoverflow.com/comment/136734362
score: 17
has comment: http://stackoverflow.com/comment/136720290
has comment: http://stackoverflow.com/comment/136718199
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22000241
downvote count: 0
answers question: http://stackoverflow.com/q/22000241
type: Answer
has comment: http://stackoverflow.com/comment/136722622

http://stackoverflow.com/comment/33077963
type: Comment
has text: +1, nice hack. I don't think you necessarily need all those iterators however - `j` & `k` can be merged into one.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21849161

http://stackoverflow.com/comment/55411722
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21985692
type: Comment
has text: How FibonacciSupplier can supply anything, not getting the index as input parameter anywhere?

http://stackoverflow.com/comment/33134960
type: AnswerComment
comment on: http://stackoverflow.com/a/21880152
type: Comment
has text: Yes, overriding can also work. But I want to reuse the run() coding part since it is so long.
score: 0

http://stackoverflow.com/comment/33197632
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21918010
has text: I don't have a compiler built in my head (yet) so the best way to test this is by executing your program and see what happens. After observing the results of this you can look into possible causes and draw conclusions. Having a field as `static` means that every instance of your object will refer to the same instance of your object in the `static` field. Sometimes this is what you want, sometimes it isn't: that's up to you. I can't possibly tell what `getChildren()` will do since I don't have the code for that (execute it, you'll see yourself what it does).

http://stackoverflow.com/comment/33072614
score: 0
type: Comment
has text: Thanks for your response! I've looked at it and there are some issues stated in the article of your first link. For example going back doesn't work all that well when going to a page with dynamic loaded content. Thanks for the tip though, I might be a better solution anyway.
comment on: http://stackoverflow.com/a/21847159
type: AnswerComment

http://stackoverflow.com/comment/33327741
type: QuestionComment
type: Comment
score: 1
has text: Possible Duplcate of http://stackoverflow.com/questions/4951695/receiving-wrong-name-noclassdeffounderror-when-executing-a-java-program-from-t/12044735#12044735
comment on: http://stackoverflow.com/q/21991285

http://stackoverflow.com/q/21857506
tagged with: multithreading
has comment: http://stackoverflow.com/comment/33089555
tagged with: swing
has comment: http://stackoverflow.com/comment/33088662
type: AnsweredQuestion
has body: I am working on a relatively simple DB manager, that takes in a number of files, parses and catalogs the information in a particular fashion. I also wrote a simple GUI in Swing for this purpose. In order to speed up the process I want to implement multithreading to the parallelizable parts of the execution in order to speed up the program. The below code sits in a class called FDBCreatePanel, a custom JPanel, that sits in a FDBManagerFrame which accommodates the main method. private void dbCreateActionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dbCreateActionButtonActionPerformed jfc = new JFileChooser(); jfc.setVisible(true); jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = jfc.showSaveDialog(null); ((FDBManagerFrame) SwingUtilities.getRoot(this)).startProcessAnimation(); if(returnVal == JFileChooser.APPROVE_OPTION) { new SwingWorker&lt;Void,Void&gt;(){ @Override protected Void doInBackground() throws Exception { File dir = jfc.getSelectedFile(); DbManager dbm = new DbManager(dir, dbNameField.getText()); try{ dbm.doTimeConsumingStuff(); } catch (SQLException e){ // errorhandling } @Override protected void done() { ((FDBManagerFrame) SwingUtilities.getRoot(FDBCreatePanel.this)).endProcessAnimation(); } }.execute(); } } The time consuming method in DbManager class leads to (among others) the following bits of code in the ParserType1 class: private void init() { try { this.reader = new LineNumberReader(new FileReader(this.datfile)); Thread t = new Thread(new Runnable(){ @Override public void run() { Entry e; while((e = parseNextEntry()) != null) queue.offer(e); } }, "t1-parser-thread"); t.run(); } catch (FileNotFoundException e) { // error handling } } I do not see any t1-parser-thread(s) in JVisualVM when I monitor the execution of my program. It appears as if my code executes entirely on a single thread, ignoring the initiation of new threads. Am I missing something with respect to threading and Swing?
tagged with: java
has comment: http://stackoverflow.com/comment/33089661
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21858155
has comment: http://stackoverflow.com/comment/33088498
has answer: http://stackoverflow.com/a/21857645
has comment: http://stackoverflow.com/comment/33089771
has comment: http://stackoverflow.com/comment/33088734
possible better answer: http://stackoverflow.com/a/21857645
accepted answer: http://stackoverflow.com/a/21858155
has title: Thread does not start in a Swing application
has comment: http://stackoverflow.com/comment/33089297

http://stackoverflow.com/comment/53543020
has text: Digits check is not done. "abc.de" will work too in this case.
comment on: http://stackoverflow.com/a/21923485
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/21960869
type: Question
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/33461922
tagged with: validation
downvote count: 0
has body: I'm trying to do my first custom validator. I defined my annotation : @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Constraint(validatedBy = PojoValidator.class) @Documented public @interface Pojo { String message() default "invalid pojo"; Class&lt;?&gt;[] groups() default {}; Class&lt;? extends Payload&gt;[] payload() default {}; And in many tutorial on the web i see something like that at the end of the declaration : @Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @Documented @interface List { Email[] value(); } What is the purpose of this @interface List, how should it be written in my example and is it mandatory?
answer count: 1
has title: Custom Validator and @interface List
favorite count: 0
has comment: http://stackoverflow.com/comment/33344522
has comment: http://stackoverflow.com/comment/33304257
upvote count: 3
has comment: http://stackoverflow.com/comment/33305327
type: UnansweredQuestion

http://stackoverflow.com/q/21981905
has body: How can I specify the SearchFilter with Java EWS library to fetch mails containing defined subject line? Thanks in advance.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22024071
upvote count: 1
has title: EWS fetch mails having specified subject line
type: Question
score: 1
tagged with: java
tagged with: exchangewebservices
accepted answer: http://stackoverflow.com/a/22024071
answer count: 1
downvote count: 0
tagged with: ewsjavaapi
favorite count: 0

http://stackoverflow.com/comment/33151647
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21892051
has text: Ah I see, makes sense now.

http://stackoverflow.com/comment/34870194
type: Comment
has text: @laxxy: It’s very likely that the `unzip` command uses the very same zip decompression library than `ZipInputStream` uses. Maybe we simply lack a good definition of “average today’s computer” as he claimed initially that decompressing a 50MB file took 5s on his computer whereas the other answer suggests <200ms for the same operation. I’m still wondering how reading into a byte array and decompressing *afterwards* can take the same time than reading into a byte array without decompression. Unless he found a magic way of speeding up the reading into the byte array, that’s just impossible.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21850690

http://stackoverflow.com/comment/33213572
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21927438
score: 0
has text: Please avoid reliance on link to external sites and include all relevant information within your question.

http://stackoverflow.com/q/21919896
has comment: http://stackoverflow.com/comment/33200781
type: Question
has title: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6
has body: public class IntegerSet { int dMax; boolean[] set; public IntegerSet(int domainMax) { dMax = domainMax + 1; set = new boolean[dMax]; } ...some methods... public static IntegerSet union(IntegerSet s1, IntegerSet s2) { IntegerSet union = new IntegerSet(Math.max(s1.dMax, s2.dMax)); for (int i = 0; i &lt; (Math.max(s1.dMax, s2.dMax)); i++) { union.set[i] = (s1.set[i] || s2.set[i]); } return union; } Can anyone tell me whats wrong with this? I can't understand why I'm getting the error message after hours: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6 As the two sets supplied as arguments may have different domain max; the resulting union should have whichever of these two domain max is larger hence why I am using Math.max. Any help would be appreciated.
score: 0
has answer: http://stackoverflow.com/a/21919928
has answer: http://stackoverflow.com/a/21920057
has answer: http://stackoverflow.com/a/21920718
possible better answer: http://stackoverflow.com/a/21919928
has answer: http://stackoverflow.com/a/21919997
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33200850
has comment: http://stackoverflow.com/comment/33200931
tagged with: java
accepted answer: http://stackoverflow.com/a/21920057

http://stackoverflow.com/q/21996804
tagged with: maven
has comment: http://stackoverflow.com/comment/33339102
has comment: http://stackoverflow.com/comment/33339339
tagged with: java
tagged with: eclipse
tagged with: m2eclipse
type: Question
has title: Maven project - Could not calculate build plan
tagged with: maven-3
linked to: http://stackoverflow.com/q/12533885
score: 0
has body: While creating maven project , eclipse giving below error..I'm using Eclipse Kepler Service Release 2 and maven version(mvn -version) Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T12:37:52-05:00) Maven home: C:\maven\bin\.. Java version: 1.6.0_45, vendor: Sun Microsystems Inc. Java home: C:\Program Files\Java\jdk1.6.0_45\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows" Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5 Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5 What am i missing and whats wrong here ? Please avise. pom.xml 4.0.0 Sample1 Sample1 0.0.1-SNAPSHOT war
duplicate of: http://stackoverflow.com/q/12533885
has comment: http://stackoverflow.com/comment/33356291
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/33208232
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21924174
has text: trying to use the code in my project
score: 0

http://stackoverflow.com/a/21947707
type: Answer
has body: oo.writeObject(this); Is brain have serializable data? Class Brain implements java.io.Serializable { public String toString() { return "serialized data"; } } If not, DataOutputStream maybe a better choice. DataOutputStream oo = new DataOutputStream(fileOut); oo.writeInt(value); // if breain have int value oo.flush(); oo.close(); Saved data will be appear in /data/data/(your.package.name)/files/memboric.core Check the file with emulator (or rooted device).
answers question: http://stackoverflow.com/q/21947080
score: 0

http://stackoverflow.com/q/21907384
has comment: http://stackoverflow.com/comment/33177882
has title: How to create an ArrayList of incoming data from text file
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/33177949
has answer: http://stackoverflow.com/a/21907578
has comment: http://stackoverflow.com/comment/33181033
has answer: http://stackoverflow.com/a/21907737
has comment: http://stackoverflow.com/comment/33182005
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33178459
has body: I have wrote 3 text files that contain 3 columns, Latitude, Longitude and Device_ID. Each file has between 50 - 100 different different longitude/latitude coordinates and between 2/4 device_id's. I wrote code that reads from these txt files and prints them on screen. My next step is to put this information into an ArrayList. I am aiming to get 3 ArrayLists for each text file, so that would be 9 ArrayLists in total. I have no idea how to create an ArrayList that would take the data? Here is what I have done so far; public static void main (String args []) throws FileNotFoundException { File textA = new File("C:/Users/Daniel Dold/Desktop/Routes/RoutesA.txt"); File textB = new File("C:/Users/Daniel Dold/Desktop/Routes/RoutesB.txt"); File textC = new File("C:/Users/Daniel Dold/Desktop/Routes/RoutesC.txt"); Scanner scannerA = new Scanner(textA); Scanner scannerB = new Scanner(textB); Scanner scannerC = new Scanner(textC); int lineNumber = 1; while(scannerA.hasNextLine()) { String line = scannerA.nextLine(); System.out.println(line); lineNumber ++; } System.out.println(); while(scannerB.hasNextLine()) { String line = scannerB.nextLine(); System.out.println(line); lineNumber ++; } System.out.println(); while(scannerC.hasNextLine()) { String line = scannerC.nextLine(); System.out.println(line); lineNumber ++; } } The printed result is; 51.51092066 -0.14513969 430 51.51073703 -0.14553129 431 51.51059347 -0.14583707 51.51047662 -0.1461026 51.51049331 -0.14613747 51.51048997 -0.14616698 51.51040651 -0.14641106 51.51035643 -0.14649421 51.51032972 -0.14652103 51.51027296 -0.14666057 51.51022789 -0.1467517 51.51021286 -0.14695287 51.51020285 -0.14709234 51.51021119 -0.14715671 51.51039983 -0.14728009 51.51031302 -0.14770388 51.51023081 -0.14809616 51.51037396 -0.14816656 51.51053838 -0.1482477 51.51074914 -0.14835298 51.51081507 -0.14799356 51.51090271 -0.14752015 51.51114643 -0.14763012 51.5114227 -0.14775619 51.51160215 -0.14783665 51.51171149 -0.147264 51.51179829 -0.14679461 …
has answer: http://stackoverflow.com/a/21907564
has comment: http://stackoverflow.com/comment/33178022
has answer: http://stackoverflow.com/a/21907635
accepted answer: http://stackoverflow.com/a/21907635
type: Question
has comment: http://stackoverflow.com/comment/33178343
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21907564
has answer: http://stackoverflow.com/a/21907618
answer count: 6
duplicate of: http://stackoverflow.com/q/2697182
has answer: http://stackoverflow.com/a/21907740
upvote count: 1
linked to: http://stackoverflow.com/q/2697182

http://stackoverflow.com/comment/33218348
has text: Spoon library is used to modify and replace file on the server. did you check home page of spoon library. Sample code is also available there.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21929931
type: AnswerComment

http://stackoverflow.com/comment/33143330
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21863306
has text: PLEASE, if you want help, please cut and paste and post the exact contents of your testSrv method; if that is too long, then copy your application to a test area, and whittle it down, removing unnecessary code, until you have something that compiles, runs, and demonstrates the problem. You are not helping yourself by manually copying only a portion of the code. E.g. you show code for a loop that uses returnString and rString -- are these supposed to be the same variable? Where is the 'return sb' call? For that matter - what is 'sb', since it doesn't appear in your code? What return statement?

http://stackoverflow.com/q/21956333
type: Question
has title: Singleton instantiated with this
has answer: http://stackoverflow.com/a/21956556
has answer: http://stackoverflow.com/a/21956601
downvote count: 0
possible better answer: http://stackoverflow.com/a/21956601
has comment: http://stackoverflow.com/comment/33265433
tagged with: singleton
has comment: http://stackoverflow.com/comment/33265547
has body: I have an assignment for school where I have to spot patterns in a certain given project. All is well (well, relatively..) but it seems that most patterns I find are some sort of variation. The singleton I had to find is no different. The code is given below. The strange thing about this is that this class does not seem to instantiate with the following constructor, as one would expect: public Singleton() { if (singleton == null) { singleton = new Singleton(); } } However, it is instatiated with this (as you can see in the original code below)? In my understanding this creates some sort of static singleton? I debugged and saw indeed that the first time the constructor is called by Singleton x = new Singleton(); x.Print(); , it is indeed null. And this is a Singleton instance. However, shouldn't there be private static Singleton singleton = new Singleton(); on top of the class instead of singelton = this;? public class Singleton { private static Singleton singleton; public static Singleton getDefault() { return singleton; } /** * The constructor. */ public Singleton() { if (singleton == null) { singleton = this; } } public void Print() { System.out.println("I'm a singleton!"); } } I'm pretty sure it is indeed a singleton, it's just of the type I have never seen and I don't get reasoning behind it, that's what I'm basicly asking.
favorite count: 0
has comment: http://stackoverflow.com/comment/33265660
has answer: http://stackoverflow.com/a/21956575
has answer: http://stackoverflow.com/a/21956477
upvote count: 2
has comment: http://stackoverflow.com/comment/33265542
answer count: 4
type: AnsweredQuestion
score: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/21956477

http://stackoverflow.com/q/21895458
tagged with: android-fragments
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/21895537
has title: Adding layout in Fragment results in NullPointerException
answer count: 1
tagged with: android-listview
tagged with: android
type: UnansweredQuestion
has body: I have encountered a problem in my Android application. When I try to add a view in my Fragment for my ListView, the app crashes. Here is my LogCat: java.lang.NullPointerException at com.example.foodsaver2.DatabaseFillerFragment$3.onItemClick(DatabaseFillerFragment.java:912) at android.widget.AdapterView.performItemClick(AdapterView.java:299) at android.widget.AbsListView.performItemClick(AbsListView.java:1113) at android.widget.AbsListView$PerformClick.run(AbsListView.java:2904) at android.widget.AbsListView$3.run(AbsListView.java:3638) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) 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) Here is my code: LinearLayout customerLayout = (LinearLayout)view.findViewById(R.id.customerLayout); if(customerLayout == null){ //Inflate the Customer Information View LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService( Context.LAYOUT_INFLATER_SERVICE ); LinearLayout leftLayout = (LinearLayout)view.findViewById(R.id.rightLayout); View customerInfo = getActivity().getLayoutInflater().inflate(R.layout.foodinfo, leftLayout, false); leftLayout.addView(customerInfo); //It crashes on this line! } I have checked SO and Google for a while now, and I am starting to get frustrated. Any help regarding this problem would be appreciated.

http://stackoverflow.com/q/21889389
tagged with: java
has body: I'm looking at this piece of code I found and hopefully someone can help me. The program takes two numbers and prints to the screen what is in between the the two numbers, so for example 20 and 15 would print [15, 16, 17, 18, 19, 20] I want to know why the person would wrote the code decided to add 1 to the array here: int[] range = new int[(upper - lower + 1)]; if you were to leave the +1 out the print statement would only produce [15, 16, 17, 18, 19] Hopefully someone can help me out. Actual desired program output : The array: [ 15 16 17 18 19 20 ] public class RangeLister { int[] makeRange(int lower, int upper) { int[] range = new int[(upper - lower + 1)]; for (int i = 0; i &lt; range.length; i++) { range[i] = lower++; } return range; } public static void main(String[] arguments) { int[] range; RangeLister lister = new RangeLister(); range = lister.makeRange(15, 20); System.out.print("The array: [ "); for (int i = 0; i &lt; range.length; i++) { System.out.print(range[i] + " "); } System.out.print("]"); } }
has title: Why do I need to add + 1 to this array in Java?
downvote count: 1
type: Question
upvote count: 0
tagged with: arrays
score: -1
tagged with: printing
has comment: http://stackoverflow.com/comment/33146332
has answer: http://stackoverflow.com/a/21889450
has answer: http://stackoverflow.com/a/21889465
favorite count: 0
possible better answer: http://stackoverflow.com/a/21889450
has answer: http://stackoverflow.com/a/21889484
has answer: http://stackoverflow.com/a/21889509
has comment: http://stackoverflow.com/comment/33146428
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21889465

http://stackoverflow.com/q/21909090
tagged with: java
tagged with: hibernate
tagged with: database
score: -1
has body: I'm writing a Java Program right now, which reads files and writes the content of these files (after some modifications) into an relational database. My problem right now is that the program should support a wide range of databases and not only one. So in my program I create SQL statements and commit them to the DB - no problem. (SAP HANA) Now I want so add another DB (MySQL) and have to slightly change the SQL syntax of the query before committing. My solution right now is copying the code block, that creates the statements and make the DB specific changes to it. But that obviously can't be it.(to many databases -> 80% code never used) I probably need some kind of mapper, that converts my sql to a dialect, that the chosen DB understands. Now, I found out about Hibernate and other mappers, but I don't think they fit my needs. The Problem is that they expect an java object (pojo) and convert them. But since I don't know what kind of data my Program is gonna load, I can not create static objects for each column for example. Sometimes I need to create 4 columns, sometimes 10. sometimes they are Integer, sometimes Strings / varchar. And all of the time they have different names. So all tutorials I found on hibernate are starting from a point where the program is certain what kind of data is going to be inserted into the db which my program is not. Moreover I need to insert a large number of lines per table (like a billion+) and I think it might be slow to create a object for each insert. I hope anyone understands my problem and can give me some hints. maybe a mapper, that just converts sql without the need to create a object before. thank you very much! : ) edit: to make it more clear: the purpose of the programm is to fill up a relational db with data that is stored / discribes in files like csv and xml ). so the db is not used as a tool to store the data but storing the data there is the main aim. I need a realtional db filled up with data that the user provides. and …
type: Question
answer count: 2
has title: Java program should support multiple Databases and variable input
possible better answer: http://stackoverflow.com/a/21909149
has answer: http://stackoverflow.com/a/21909538
accepted answer: http://stackoverflow.com/a/21909538
linked to: http://stackoverflow.com/q/1714461
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33181412
has answer: http://stackoverflow.com/a/21909149
upvote count: 0
has comment: http://stackoverflow.com/comment/33183173
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33182558
has comment: http://stackoverflow.com/comment/33181999

amazon-elastic-beanstalk
tag name: amazon-elastic-beanstalk
type: Tag
tags question: http://stackoverflow.com/q/21917598

http://stackoverflow.com/a/21892867
has comment: http://stackoverflow.com/comment/33206381
has comment: http://stackoverflow.com/comment/33206429
has comment: http://stackoverflow.com/comment/33153127
answers question: http://stackoverflow.com/q/21892626
downvote count: 0
type: Answer
has body: Your sorting algorithm is faulty. It's similar to selection sort, in that you take two elements and swap them if they're out of place. However, you don't stop the comparisons when you should: when the index d is less than the index i, the comparison-and-swap based on arr[d] &gt; arr[i] is no longer valid. The inner loop should terminate with i=d. The logic of your sort goes something like this: On the d-th loop, the elements at d+1 and to the right are correctly sorted (the larger numbers). This is true at the beginning, because there are 0 elements correctly sorted to the right of the right-most element. On each of the outer loops (with the d counter), compare the d-th largest element slot with every unsorted element, and swap if the other element is larger. This is sufficient to sort the array, but if you begin to compare the d-th largest element slot with already-sorted elements to its right, you'll end up with a larger number in the slot than should be. Therefore, the inner loop should terminate when it reaches d.
has comment: http://stackoverflow.com/comment/33249029
upvote count: 3
score: 3

http://stackoverflow.com/comment/33108291
comment on: http://stackoverflow.com/a/21866903
type: Comment
score: 0
type: AnswerComment
has text: Ok, thanks EJP. To me, to configure the buffer size pre-alocated does not make sense, actually C# or node does not do this so. Then I have another question. When the receiving buffer size is set, say 1024, on receiving packet which actual size is, 350, is there way to know the exact size is.

http://stackoverflow.com/comment/33076152
comment on: http://stackoverflow.com/q/21850196
has text: Thread name can be set either in `setName` method or using thread constructor see http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#Thread%28java.lang.String%29
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/21885888
downvote count: 0
answers question: http://stackoverflow.com/q/21885462
upvote count: 2
has comment: http://stackoverflow.com/comment/33140233
has comment: http://stackoverflow.com/comment/33140086
type: Answer
has body: class A { public void foo() { System.out.println("foo"); } public void baz() { System.out.println("baz"); } } class B extends A { public void foo() { System.out.println("fizz"); } public void bar() { System.out.println("bar"); } } public class Program { public static void main(String[] args) { A obj1 = new A(); A obj2 = new B(); obj1.foo(); // prints "foo" obj1.baz(); // prints "baz" obj2.foo(); // prints "fizz" obj2.baz(); // prints "baz" obj2.bar(); // compile error ((B)obj2).bar(); // prints "bar" ((B)obj1).bar(); // runtime error } } As you can see, an object of type A initialized as a B will call any overridden methods in B, but new methods in B can't be seen. Methods that aren't overridden will use the version in the super class. You can cast a class to something more specific (object declared as the superclass to the subclass type), but if the object isn't actually an instance of the more-specific type, you'll get a ClassCastException at runtime.
score: 2

http://stackoverflow.com/a/21846742
downvote count: 0
has body: Call the displaySortedNumbers method from the inputTriangleSides method. your main function will be like this public static void main(String args[]){ Triangle yourTriangle= new Triangle(); yourTriangle.inputTriangleSides(); } And your input triangles method will be like this public void inputTriangleSides() { System.out.println("Enter your triangle side lengths"); Scanner keyboard = new Scanner(System.in); int side1; int side2; int side3; System.out.println("Enter three integers to form a triangle:"); side1 = keyboard.nextInt(); side2 = keyboard.nextInt(); side3 = keyboard.nextInt(); yourTriangle.displaySortedNumbers(side1,side2,side3); yourTriangle.displayType(side1,side2,side3); yourTriangle.perimeter(side1,side2,side3); }
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/33114884
score: 2
has comment: http://stackoverflow.com/comment/33105871
answers question: http://stackoverflow.com/q/21846618

http://stackoverflow.com/comment/33307235
type: QuestionComment
score: 0
has text: @InnocentKiller, thank you. I hope it will help others.
comment on: http://stackoverflow.com/q/21953655
type: Comment

http://stackoverflow.com/comment/33192259
type: AnswerComment
comment on: http://stackoverflow.com/a/21913346
type: Comment
has text: You shouldn't put the code that adds the JTextField inside the paintComponent() method. That's going to add a new JTextField to your JPanel every time it's painted, which is a lot! Instead, treat the PaintPane as you would any other JPanel and add the components to it just *once*, whenever you add it to the JFrame.
score: 0

switch-statement
tags question: http://stackoverflow.com/q/21896583
tags question: http://stackoverflow.com/q/21953523
type: Tag
tags question: http://stackoverflow.com/q/21852282
tags question: http://stackoverflow.com/q/21975204
tags question: http://stackoverflow.com/q/21867727
tags question: http://stackoverflow.com/q/21951196
tags question: http://stackoverflow.com/q/21912219
tag name: switch-statement
tags question: http://stackoverflow.com/q/21880107
tags question: http://stackoverflow.com/q/21964037
tags question: http://stackoverflow.com/q/21946188
tags question: http://stackoverflow.com/q/21923423
tags question: http://stackoverflow.com/q/21936195
tags question: http://stackoverflow.com/q/21935056

http://stackoverflow.com/a/21984307
upvote count: 9
type: Answer
has body: @Column.columnDefinition is used during DDL phase to create your table and NOT during normal program running; probably you have to work with @DynamicInsert/@DynamicUpdate: this annotations insert (or update) only properties you setted into you POJO and let RDBMS to manage other fields. A small example @Entity class MyTable { @Id private int code; @Column(name = "SourceFrom", columnDefinition = "varchar(15) default 'Case'") private String sourceFrom; } and this is the generated code from DDL phase create table mytable (code integer not null,SourceFrom varchar(15) default 'Case') MyTable t = new MyTable(); t.setCode(10); session.save(t); will do this statement insert into mytable (code, SourceFrom) values (10,NULL) MyTable t = new MyTable(); t.setCode(10); t.setSourceFrom("MANUAL INSERT"); session.save(t); will do this statement insert into mytable (code, SourceFrom) values (10,'MANUAL INSERT') If you annotate MyTable with @DynamicInsert the first example will generate this statement insert into mytable (code) values (10) As you can see the value of field SourceFrom is not specified and value inserted into database table is defined by column definition default value ('Case' in this case). Manual processing of default value (in setter, with @PrePersist or other solution) are still valid.
downvote count: 0
score: 9
accepted answer of: http://stackoverflow.com/q/21983230
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21983230

http://stackoverflow.com/q/21866559
type: AnsweredQuestion
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/33105595
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/21867130
has body: How can I make my app to ignore certains configurations, for example, the device's language (forcint the app to use default strings) For better understanding thats the concret problem: I have a Android Library project with some strings in the strings.xml file That library have the strings in english, german, french and spanish. I want use the library in an app but this app only supports english and german so I'd like to ignore the strings provided by the library project in french and spanish in order to avoid a partial traduction Is that possible without magical workarrounds? Thanks
linked to: http://stackoverflow.com/q/4985805
has answer: http://stackoverflow.com/a/21866940
possible better answer: http://stackoverflow.com/a/21866940
has comment: http://stackoverflow.com/comment/33106465
tagged with: android
has answer: http://stackoverflow.com/a/21867130
has title: Disable some configurations for the app (for example locales)

http://stackoverflow.com/a/21976721
type: Answer
has body: chatInputET.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { String string = s.toString(); if (string.length() &gt; 0 &amp;&amp; string.charAt(string.length() - 1) == '\n') { // do stuff } } });
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/21976590
downvote count: 0

http://stackoverflow.com/comment/33196302
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21915675
score: 0
has text: depending on what Java features you need, you may have a look at Google Web Toolkit which is essentially a Java-to-JavaScript compiler

http://stackoverflow.com/q/21911739
type: AnsweredQuestion
has title: java.net.URL refer to a file in a parent directoty
has answer: http://stackoverflow.com/a/21911852
accepted answer: http://stackoverflow.com/a/21911852
upvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/21912090
favorite count: 0
has body: I have a very basic question. I need a URL object but the file is in the previous directory relative to the project. For instance, if I do File testFile = new File("../../data/myData.xml"); works perfectly fine, it finds the file However, URL testURL = new URL("file:///../../data/myData.xml") gives an Exception in thread "main" java.io.FileNotFoundException: /../../data/myData.xml Any idea, how to solve, work around this? without changing the position of the data? Thanks a lot in advance Altober
has answer: http://stackoverflow.com/a/21911886
possible better answer: http://stackoverflow.com/a/21912090
tagged with: path
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33185933
tagged with: file
type: Question

http://stackoverflow.com/q/21904812
type: AnsweredQuestion
tagged with: jsf
downvote count: 0
has answer: http://stackoverflow.com/a/34617274
has title: Browser error: PrimeFacesExt is not defined
type: Question
tagged with: primefaces
tagged with: java
tagged with: primefaces-extensions
score: 4
has answer: http://stackoverflow.com/a/26956220
has comment: http://stackoverflow.com/comment/42451477
accepted answer: http://stackoverflow.com/a/26956220
answer count: 2
favorite count: 0
has body: Im using PrimeFaces 3.5 with PrimeFaces Extensions 0.7.0 and OmniFaces version 1.4 I have a accordionPanel with a ui:fragment witch looks like that: <ui:fragment> <f:metadata> <f:event type="javax.faces.event.PreRenderViewEvent" listener="#{fleet.preRenderView()}" /> </f:metadata> <p:dialog id="createSubFleetDialog" widgetVar="createSubFleet" header="#{msg.administration_fleet_createFleetDialog_title}"> <h:panelGrid id="createSubFleetPanel" columns="2"> <h:outputLabel for="newFleetName" value="#{msg.administration_fleet_fleetName}" /> <p:inputText id="newFleetName" value="#{fleet.fleetName}"> <pe:keyFilter mask="alphanum"></pe:keyFilter> </p:inputText> </h:panelGrid> </p:dialog> </ui:fragment> There is no warning or error in eclipse but when running my application there is a browser error: Uncaught ReferenceError: PrimeFacesExt is not defined Does anybody know how how to fix this problem?
possible better answer: http://stackoverflow.com/a/34617274
upvote count: 4

google-play-services
tags question: http://stackoverflow.com/q/21969347
tags question: http://stackoverflow.com/q/21885855
tag name: google-play-services
tags question: http://stackoverflow.com/q/21916750
tags question: http://stackoverflow.com/q/21975117
type: Tag
tags question: http://stackoverflow.com/q/21951606

http://stackoverflow.com/a/21844792
answers question: http://stackoverflow.com/q/21844540
has body: The problem in this code is the string comparison. Instead of unit.equals("Inch"), please use unit.equalsIgnoreCase("Inch") etc. Corrected code: public abstract class Length implements Comparable&lt;Length&gt; { public String toString() { return this.getClass() + ": " + getLength() + " " + getUnit(); } public static void main(String[] args) { ArrayList&lt;Length&gt; lo = new ArrayList&lt;Length&gt;(); Scanner in = null; try { in = new Scanner(new File("src/length/data.txt")); } catch (FileNotFoundException exception) { throw new RuntimeException("failed to open data.txt"); } // need more code for other parts of this assignment while (in.hasNextDouble()) { double value = in.nextDouble(); String unit = in.next(); Length length = null; if (unit.equalsIgnoreCase("Meter")) { length = new Meter(value); lo.add(length); } else if (unit.equalsIgnoreCase("Foot")) { length = new Foot(value); lo.add(length); } else if (unit.equalsIgnoreCase("Inch")) { length = new Inch(value); lo.add(length); } else if (unit.equalsIgnoreCase("Yard")) { length = new Yard(value); lo.add(length); } } Length[] myLengths = new Length[lo.size()]; //declares myLengths integer array for (int i = 0; i &lt; lo.size(); i++) { myLengths[i] = lo.get(i); //copies arrayList to lo to Length array myLengths } for (int i = 0; i &lt; myLengths.length; i++) { System.out.println(myLengths[i].toString()); } } }
score: 0
type: Answer

http://stackoverflow.com/comment/33212505
type: Comment
comment on: http://stackoverflow.com/a/21926173
score: 0
has text: I checked for conflicts but there is no like that.
type: AnswerComment

http://stackoverflow.com/comment/33347140
comment on: http://stackoverflow.com/a/22001780
type: AnswerComment
score: 0
type: Comment
has text: this kind of helps me out with what im trying to do. Thanks

http://stackoverflow.com/q/21915675
has body: Hi I want to create a small web application which will take inputs such as 80 and 120 and return the GCD of those numbers. I want to write the logic in Java. When the user enters 80 and 120 and clicks on calculate button, the values must be passed to the algorithm and return the answer to be displayed on the application again. How do I link the java algorithm to the html page in order to achieve this? Kindly suggest. Is there no other way of doing this other than creating a Java applet for this and deploying it on the application? Kindly help.
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33192978
type: Question
accepted answer: http://stackoverflow.com/a/21916396
upvote count: 0
has comment: http://stackoverflow.com/comment/33193176
downvote count: 4
has comment: http://stackoverflow.com/comment/33196302
tagged with: http://stackoverflow.com/tag/html
answer count: 1
favorite count: 0
score: -4
has answer: http://stackoverflow.com/a/21916396
has title: Website with Java algorithms embedded into the site

http://stackoverflow.com/q/21955030
has answer: http://stackoverflow.com/a/21955751
score: 0
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/71344646
has comment: http://stackoverflow.com/comment/33266008
type: UnansweredQuestion
has title: Understanding client and server sockets
has comment: http://stackoverflow.com/comment/33263139
has answer: http://stackoverflow.com/a/21955118
has comment: http://stackoverflow.com/comment/33267064
has comment: http://stackoverflow.com/comment/33266009
type: Question
has answer: http://stackoverflow.com/a/42085624
favorite count: 0
tagged with: sockets
has body: i have a question. i do not fully understand how client and server sockets work? what i understand is when a server socket is created it has many ports that can be opened .socket objects are created on the server side which connects to different ports of the server socket.the socket connected to the server socket connects to the client socket and completes the connection? am i right or wrong? public class TryThreads extends Thread { private int Portnumber; private static String inputLine; public TryThreads(int portNumber) { Portnumber = portNumber; setDaemon(false); } public static void main(String[] args) { //create three threads Thread first = new TryThreads(63400); Thread second = new TryThreads(63401); first.start(); second.start(); //third.start(); System.out.println("ending main"); return; } public void run() { //System.out.println("one socket port opened"); try { System.out.println("one socket port opened"); ServerSocket serverSocket = new ServerSocket(Portnumber); System.out.println("one socket port opened"); while (true) { System.out.println("ending main2"); //System.out.println("one socket port opened"); Socket clientSocket = serverSocket.accept(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); while((inputLine = bufferedReader.readLine()) != null) System.out.println(inputLine); } } catch(IOException e) { System.out.println(e); } } } And the Client public class client { private static PrintWriter printWriter; public static void main(String[] args) { BufferedReader in = null; try { Socket socket = new Socket("localhost",63400); printWriter = new PrintWriter(socket.getOutputStream(),true); printWriter.println("Hello Socket"); printWriter.println("EYYYYYAAAAAAAA!!!!"); socket.close(); } catch(Exception e) { System.out.println(e); } } }
answer count: 3
upvote count: 1

http://stackoverflow.com/q/21893223
has comment: http://stackoverflow.com/comment/33153870
upvote count: 1
tagged with: types
answer count: 1
tagged with: generics
has title: Java generic issue: "incompatible types; inferred type argument(s) java.lang.Object do not conform to bounds of type variable(s) T
favorite count: 0
has comment: http://stackoverflow.com/comment/33153735
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33154052
downvote count: 0
has comment: http://stackoverflow.com/comment/33154102
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33158695
type: Question
has comment: http://stackoverflow.com/comment/33154006
has answer: http://stackoverflow.com/a/21893510
accepted answer: http://stackoverflow.com/a/21893510
has body: The following simple program compiles with Eclipse compiler, but not Javac: public class Test { public static interface Function&lt;T1, T2, Boolean&gt; { Boolean apply(T1 t1, T2 t2); } private static &lt;T extends Comparable&lt;T&gt;&gt; Function&lt;T, T, Boolean&gt; _cmp(final boolean lt) { return new Function&lt;T, T, Boolean&gt;() { @Override public Boolean apply(T t1, T t2) { if (lt) { return (t1.compareTo(t2) &lt; 0); } else { return (t1.compareTo(t2) &gt; 0); } } }; } public static Function LESS_THAN = _cmp(true); // error line public static Function GREATER_THAN = _cmp(false); // error line } The error message of Javac: java: P:\java-tool\src\main\java\T3.java:20: incompatible types; inferred type argument(s) java.lang.Object do not conform to bounds of type variable(s) T found : &lt;T&gt;T3.Function&lt;T,T,java.lang.Boolean&gt; required: T3.Function
has comment: http://stackoverflow.com/comment/33153999
has comment: http://stackoverflow.com/comment/33154053

http://stackoverflow.com/comment/33079341
type: QuestionComment
comment on: http://stackoverflow.com/q/21851552
score: 0
has text: getting error null pointer Exception
type: Comment

http://stackoverflow.com/comment/33237329
type: AnswerComment
comment on: http://stackoverflow.com/a/21940616
type: Comment
has text: are you sure this is if condition matches `if (GlobalVars.espera == 0)`??
score: 0

http://stackoverflow.com/comment/33197155
comment on: http://stackoverflow.com/q/21916834
has text: In most engines (not Dot-Net), there is a slight limitation in grouping. Geting array information per match is going to be limited to a single level of fixed, unquantified parenthesis. You can do `(John) KC Mary V (oranges)`, but if you do `(?:(John) KC Mary V (oranges) .+?)+` capture groups 1 and 2 will be overwritten each quantified pass of the expression. Effectively containing the last values found of John,oranges.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21934068
linked to: http://stackoverflow.com/q/16620843
linked to: http://stackoverflow.com/q/21682672
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33534511
has title: Getting Out of memory on a 2016016-byte allocation. error?
favorite count: 0
duplicate of: http://stackoverflow.com/q/19131205
has body: I am downloading waveforms (images) and decoding them. These are very large in size. So my main problem is that, as I am installing the app, it is working perfectly. But after some time suddenly Logcat is giving the following errors. I think I had saved too many waveforms. So now I need to delete saved waveforms. So how can I delete the saved waveforms ? 02-21 17:06:30.146: I/dalvikvm-heap(13642): Clamp target GC heap from 259.610MB to 256.000MB 02-21 17:06:30.146: D/dalvikvm(13642): GC_FOR_ALLOC freed 453K, 2% free 257622K/262108K, paused 113ms, total 113ms 02-21 17:06:30.154: I/dalvikvm-heap(13642): Forcing collection of SoftReferences for 2016016-byte allocation 02-21 17:06:30.232: I/dalvikvm-heap(13642): Clamp target GC heap from 259.609MB to 256.000MB 02-21 17:06:30.232: D/dalvikvm(13642): GC_BEFORE_OOM freed 1K, 2% free 257620K/262108K, paused 85ms, total 85ms 02-21 17:06:30.240: E/dalvikvm-heap(13642): Out of memory on a 2016016-byte allocation. 02-21 17:06:30.240: I/dalvikvm(13642): "AsyncTask #5" prio=5 tid=18 RUNNABLE 02-21 17:06:30.240: I/dalvikvm(13642): | group="main" sCount=0 dsCount=0 obj=0x41e3a290 self=0x40067e08 02-21 17:06:30.240: I/dalvikvm(13642): | sysTid=13699 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1492300400 02-21 17:06:30.240: I/dalvikvm(13642): | state=R schedstat=( 0 0 0 ) utm=3297 stm=228 core=1 02-21 17:06:30.240: I/dalvikvm(13642): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method) 02-21 17:06:30.240: I/dalvikvm(13642): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:529) 02-21 17:06:30.240: I/dalvikvm(13642): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:601) 02-21 17:06:30.240: I/dalvikvm(13642): at com.blackcobrastudios.footballchants.manager.SoundCloudManager.readBitmapFromResponse(SoundCloudManager.java:493) 02-21 17:06:30.240: I/dalvikvm(13642): at com.blackcobrastudios.footballchants.manager.SoundCloudManager$TaskCaller.doInBackground(SoundCloudManager.java:323…
tagged with: out-of-memory
upvote count: 2
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/19151719
score: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/33225147
has answer: http://stackoverflow.com/a/22195473

http://stackoverflow.com/comment/33177405
has text: @Kalkim you should _not_ have to explicitly put the `images` into the `bin`. It should get copied from the `src` to the `bin` when you build. You will also find that if your package uses layers dirs like `com.mypackage` you _will_ need the `/`. You don't need it if it's only one layer like `mypackage`, but you might as well make a habit of it. The `/` will work for both scenarios.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21900859
type: Comment

http://stackoverflow.com/q/21961220
has title: Single Log out not working with Shibboleth IdP
tagged with: saml-2.0
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: I have been trying to implement a WEB SSO Service provider in java. I am using Shibboleth Identity Provider. Things are working fine till authentication step and I am successfully able to create a session/set cookie for a user. But when I'm trying to use single sign out functionality I am getting an "RequestDenied" response from shibboleth IdP. I checked the logs and there it was written Inbound message issuer was not authenticated. The same issuer is working fine with log in step but giving error with log out step. Any configuration file to update for it, any pointer, suggestion? This is my log out request. &lt;samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" ID="jiojjcjckjaflbedlcjcpcnecigbjhaekalmfkcg" IssueInstant="2014-02-24T23:30:25.257Z" NotOnOrAfter="2014-02-24T23:35:25.257Z" Version="2.0" &gt; &lt;saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"&gt;https://localhost/sp/shibboleth&lt;/saml:Issuer&gt; &lt;saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient" NameQualifier="urn:oasis:names:tc:SAML:2.0:assertion" &gt;rohit&lt;/saml:NameID&gt; &lt;samlp:SessionIndex/&gt; &lt;/samlp:LogoutRequest&gt; And this is what I'm getting in response. &lt;saml2p:LogoutResponse xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" Destination="https://localhost:8091/SSO/consumer" ID="_02a145f4992cb2e11a8fc4aa43a74096" InResponseTo="jiojjcjckjaflbedlcjcpcnecigbjhaekalmfkcg" IssueInstant="2014-02-24T23:30:25.334Z" Version="2.0" &gt; &lt;saml2:Issuer xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity" &gt;https://localhost/shibboleth&lt;/saml2:Issuer&gt; &lt;saml2p:Status&gt; &lt;saml2p:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Responder"&gt; &lt;saml2p:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:RequestDenied" /&gt; &lt;/saml2p:StatusCode&gt; &lt;saml2p:StatusMessage&gt;Message did not meet securi…
has comment: http://stackoverflow.com/comment/33308671
tagged with: single-sign-on
tagged with: shibboleth
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23095383
upvote count: 1
has comment: http://stackoverflow.com/comment/33324715
type: Question
tagged with: opensaml

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

http://stackoverflow.com/comment/33337807
type: Comment
comment on: http://stackoverflow.com/a/21996548
type: AnswerComment
has text: I am doing this. Made changes to the question to reflect what you guys suggested so far.
score: 0

http://stackoverflow.com/comment/33284272
has text: This syntax is incorrect for COBOL.
comment on: http://stackoverflow.com/q/21966501
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/33111556
score: 3
type: AnswerComment
type: Comment
has text: You probably meant lexicographical. The word lexicological has a meaning unrelated to sort order.
comment on: http://stackoverflow.com/a/21869752

http://stackoverflow.com/comment/33198799
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21918762
has text: you being a little rigid.. scriptlets exists to be used and I dont agree when some people say that are pieces of ugly and poor code.. I like scriptlets and they avoid me spend a lot of time..
score: 0

http://stackoverflow.com/comment/33156643
has text: @TedHopp Maybe you are correct about the "implied" requirement. It just so happens that the first problem that caught *my* eye was that user input was coming through unchecked. The question asker did not provide a listing of his input, so there *could* very well be an error than nobody here can even see that would otherwise be glaring. You have to admit than an input error could completely disguise some of the more intricate problems. Since he did not provide the error message, you can't say I'm wrong.
score: 0
comment on: http://stackoverflow.com/q/21892667
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21865927
type: Answer
answers question: http://stackoverflow.com/q/21864977
score: 0
has body: YOu set 11 parameters but only have 10 ? in the statement. The last part of the statement, the where clause - you have where 'Reg_No'='temp'" which is not a variable. You should be able to drop the statement statement.setInt(11,temp1);

http://stackoverflow.com/comment/33111194
type: AnswerComment
score: 0
has text: No worries, glad I could help. I don't have that book, but I wonder if it's a versioning issue?
type: Comment
comment on: http://stackoverflow.com/a/21869413

http://stackoverflow.com/comment/33207208
type: QuestionComment
comment on: http://stackoverflow.com/q/21923457
has text: You can use O(n) time to set up the data structure, I need later search and remove to be faster.
score: 0
type: Comment

http://stackoverflow.com/comment/33209663
type: QuestionComment
comment on: http://stackoverflow.com/q/21924836
score: 0
has text: Wouldn't simply iterating over that, taking the redirect result each time until redirection no longer occurs, let you step through the redirections? Loop and counter...
type: Comment

http://stackoverflow.com/comment/33346878
score: 1
has text: I don't understand how you know about `File`, `FileInputStream`, `BufferedInputStream`, `DataInputStream`, etc. but you don't know `String`. As @Tdorno said, you should do more research and try things yourself before asking us to do it for you.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22001611

http://stackoverflow.com/comment/34215993
comment on: http://stackoverflow.com/a/21894147
type: AnswerComment
score: 0
type: Comment
has text: The problem I am having is with importing the "cf.keystore" into the JRE cacerts file, using keytool -import -v -alias <alias> -file cf.cer -keystore <jre cacerts file>. I get the same error. Do I need to import the cf.keystore file into jre cacerts file?

http://stackoverflow.com/comment/33261967
comment on: http://stackoverflow.com/q/21954378
score: 1
has text: A "frame" is a "stack frame" is the storage allocated to represent the instance of calling a method. It contains the parameters, the local variables for the method, the return address, etc. A "native frame" then obviously is the stack frame allocated for a native method (vs a Java method).
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21850762
type: Answer
has body: I suspect strongly you have a byte-order-mark at the beginning of your doc. That won't render as a valid character, and consequently could appear as a question mark. Can you dump the raw bytes out and check for that sequence ?
downvote count: 0
has comment: http://stackoverflow.com/comment/33077226
score: 1
has comment: http://stackoverflow.com/comment/33077171
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21850679
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21850679
has comment: http://stackoverflow.com/comment/33078084

http://stackoverflow.com/q/21936870
accepted answer: http://stackoverflow.com/a/21941629
has comment: http://stackoverflow.com/comment/33231037
tagged with: awtrobot
favorite count: 0
has answer: http://stackoverflow.com/a/21941629
has title: Robot KeyEvent.VK_AT Issue in JAVA
tagged with: swing
linked to: http://stackoverflow.com/q/2596641
possible better answer: http://stackoverflow.com/a/21936980
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21936980
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33231155
type: Question
has body: I created Robot class in JAVA but there is a issue robot.keyPress(KeyEvent.VK_AT) have to press -&gt; '@' -&gt; at But it presses 'q' &lt;-&gt; 'Q' What should i do to robot press '@' symbol ?
has comment: http://stackoverflow.com/comment/33230890
answer count: 2
has comment: http://stackoverflow.com/comment/33230642
tagged with: awt
upvote count: 2
has comment: http://stackoverflow.com/comment/33237797

http://stackoverflow.com/a/21923434
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: @Repository is missing, try adding above the interface of the repo and remove bean declaration that is not allowed in Spring.
score: 4
accepted answer of: http://stackoverflow.com/q/21923058
has comment: http://stackoverflow.com/comment/33233255
answers question: http://stackoverflow.com/q/21923058
upvote count: 4

http://stackoverflow.com/q/21872140
has body: I have this receiver for handling BOOT_COMPLETED event: public class BootReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { SystemUtills.scadualeAlarmManagerFromTable(context); } } No problem so far, my receiver catches the BOOT_COMPLETED event and start the method "scadualeAlarmManagerFromTable(context)". Inside the method i am doing among others: AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); alarmManager.set(AlarmManager.RTC, Long.getLong(time), pendingIntent); The problem is that alarmManager is null at this point. why is that? (i didnt post all the code take in notice that time, and pendingIntent params are set).
answer count: 0
tagged with: java
type: Question
tagged with: alarmmanager
score: 0
type: UnansweredQuestion
has title: Setting AlarmManager events following Boot event
tagged with: android
has comment: http://stackoverflow.com/comment/33115496
has comment: http://stackoverflow.com/comment/33115369

http://stackoverflow.com/a/21895179
has comment: http://stackoverflow.com/comment/33157406
has comment: http://stackoverflow.com/comment/33161361
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33165237
answers question: http://stackoverflow.com/q/21895041
type: Answer
accepted answer of: http://stackoverflow.com/q/21895041
has body: There's quite a few errors in the code example you posted before, but others have already pointed that out. To find highest and lowest, simply use Arrays utility class and sort the array, and simply pick the first and last values of array after its been sorted (I fixed the syntax errors): import java.util.Arrays; import java.util.Scanner; public class lowhighavg { private static int [] array; private static int i; public static void main(String [] args) { int numbers[] = new int[10]; double avg; avg = 00; Scanner sc = new Scanner(System.in); for (int i = 0; i &lt; 10; i++) { System.out.println("Enter a digit"); numbers[i]= sc.nextInt(); avg = avg+numbers[i]; } Arrays.sort(numbers); System.out.println("the highest number:" + numbers[numbers.length-1]); System.out.println("the lowest number:" + numbers[0]); avg =avg/10; System.out.println("the average number:" + avg); } }
has comment: http://stackoverflow.com/comment/33161386

http://stackoverflow.com/comment/33277766
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21962965
has text: `Catchable` can't have a `size` attribute, but it can have a getter method `getSize()` that you would use instead of `size` in your `Fisher` class.

http://stackoverflow.com/comment/33183369
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21909742
has text: @Yen Ines Okies,, What response you are getting ? Are you trying `eclipse &` in eclipse folder ?

http://stackoverflow.com/q/21911183
has answer: http://stackoverflow.com/a/21920096
has title: javaFX bind ObservableList with table
type: AnsweredQuestion
tagged with: java
tagged with: javafx
type: Question
has body: I'have some troubles binding dsata to my Tabl;e in JavaFX> I've got my model Conductor.java package model; public class Conductor { private Integer mID; private String mNombre; private String mNIF; private String mAutonomo; private String mEmpresa; private String mCIF; public Conductor(){} public Conductor(String nombre, String NIF, String autonomo, String empresa, String CIF) { super(); this.mNombre = nombre; this.mNIF = NIF; this.mAutonomo = autonomo; this.mEmpresa = empresa; this.mCIF = CIF; } public Conductor(Integer ID,String nombre, String NIF, String autonomo, String empresa, String CIF) { this.mID = ID; this.mNombre = nombre; this.mNIF = NIF; this.mAutonomo = autonomo; this.mEmpresa = empresa; this.mCIF = CIF; } public Integer getmID() { return mID; } public void setmID(Integer mID) { this.mID = mID; } public String getmNombre() { return mNombre; } public void setmNombre(String mNombre) { this.mNombre = mNombre; } public String getmNIF() { return mNIF; } public void setmNIF(String mNIF) { this.mNIF = mNIF; } public String getmAutonomo() { return mAutonomo; } public void setmAutonomo(String mAutonomo) { this.mAutonomo = mAutonomo; } public String getmEmpresa() { return mEmpresa; } public void setmEmpresa(String mEmpresa) { this.mEmpresa = mEmpresa; } public String getmCIF() { return mCIF; } public void setmCIF(String mCIF) { this.mCIF = mCIF; } @Override public String toString() { return "Conductor [mID=" + mID + ", mNombre=" + mNombre + ", mNIF=" + mNIF + ", mAutonomo=" + mAutonomo + ", mEmpresa=" + mEmpresa + ", mCIF=" + mCIF + "]"; } } and my layout file> SituacionView.fxml <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.layout.BorderPane?> <TableColumn editable="false" id="nombreConductorColumn" maxWidth="5000.0" minWidth="10.0" prefWidth="200.0" text="Nombre" fx:id="nombreConductorColumn" /> and my controller clas public class SituacionController { @FXM…
accepted answer: http://stackoverflow.com/a/21920096
tagged with: scenebuilder
score: 0
answer count: 1

http://stackoverflow.com/comment/33152448
comment on: http://stackoverflow.com/a/21890223
type: Comment
score: 0
type: AnswerComment
has text: The window title displays "Command Prompt - skrmedpostctl_start.bat" if I start the batch process using the command prompt. But if I simply double-click the batch file or execute from my Java code using `Runtime.getRuntime().exec()`, then it only shows "C:\Windows\System32\cmd.exe".

http://stackoverflow.com/a/21963475
has body: It is not enough to synchronize writing, you need to synchronize reading as well. Otherwise, a read that happens concurrently with a write may return inconsistent data, or trigger exceptions: public synchronized String getFirst() { if (myArray.size() != 0) return myArray.get(0); return null; } You could also use Collections.synchronizedList List&lt;String&gt; syncList = Collections.synchronizedList(new ArrayList&lt;String&gt;());
accepted answer of: http://stackoverflow.com/q/21963453
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21963453
type: Answer
score: 5
upvote count: 5

http://stackoverflow.com/q/21842507
has comment: http://stackoverflow.com/comment/33063596
linked to: http://stackoverflow.com/q/19919996
has comment: http://stackoverflow.com/comment/33062714
score: 0
has comment: http://stackoverflow.com/comment/33062551
has comment: http://stackoverflow.com/comment/33062627
type: UnansweredQuestion
has body: public void addAtIndex(int payload, int index) throws AmishException { if(index == 0) { this.addFront(payload); } else if(index == this.length()-1) { this.addEnd(payload); } else if(index &lt; this.numberOfElements || index &gt; this.length()-1) { throw new AmishException("LinkedList Error: Index: " + index + " is out of bound!!!"); } else { } } I have four classes in total, they can add nodes to the front and end without a problem, but I can't seem to figure out how to add them at an index. I have a method that determines length but after two hours I can't figure it out. This is the method that will add at index, but all it does now is throw an exception and adds to front and back.
tagged with: addition
has comment: http://stackoverflow.com/comment/33063895
has comment: http://stackoverflow.com/comment/33062603
has comment: http://stackoverflow.com/comment/33062662
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33062914
has comment: http://stackoverflow.com/comment/33063913
type: Question
has title: How do I add nodes at index in Java?

http://stackoverflow.com/q/21954967
has title: Running My App In The Background
tagged with: internet-radio
has answer: http://stackoverflow.com/a/21955079
score: 0
has comment: http://stackoverflow.com/comment/33263970
has comment: http://stackoverflow.com/comment/33264220
answer count: 1
has body: I have tried to get this working so that it plays in the background?? why won't it work it looks fine to me?? I am new to java/android development so hope someone can fix the issue and explain what I problem was so I can learn something Yes I got it to stream so far but once you exit the app the music stops playing For being new think im doing great must be since I have previous experience with PHP etc.. Thanks ;) package com.beanie.samples.streaming; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import com.beanie.samples.streaming.R; import com.beanie.samples.streaming.MyService; import android.app.Activity; import android.app.IntentService; import android.app.Service; import android.content.Intent; import android.media.MediaPlayer; import android.media.MediaPlayer.OnBufferingUpdateListener; import android.media.MediaPlayer.OnPreparedListener; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.HandlerThread; import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ProgressBar; import android.widget.Toast; ; public class HomeActivity extends Activity implements OnClickListener { private static final String TAG = "MyServices"; private final static String RADIO_STATION_URL = "http://195.154.237.162:8936/"; private static final String START_STICKY = null; Button buttonPlay, buttonStopPlay; /** Called when the activity is first created. * Keep this here all the application will stop working */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); initializeUIElements(); initializeMediaPlayer(); …
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33264288
tagged with: android-intent
tagged with: java
linked to: http://stackoverflow.com/q/21461191
type: Question
has comment: http://stackoverflow.com/comment/33262987
tagged with: audio-streaming

http://stackoverflow.com/comment/103988759
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21851201
type: Comment
has text: Great answer. Just a small picky comment: within `this.addMouseListener(...)` extend the `MouseAdapter` instead of implementing the `MouseListener`. You won't need to implement the unused methods. The adapter was created for that purpose.

http://stackoverflow.com/q/21948734
tagged with: jframe
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/19209650
has comment: http://stackoverflow.com/comment/33252640
has comment: http://stackoverflow.com/comment/33252265
answer count: 0
tagged with: java
tagged with: swing
tagged with: bufferedimage
type: Question
tagged with: rotation
has title: Rotating a BufferedImage and moving it to a spot
has comment: http://stackoverflow.com/comment/33256489
has comment: http://stackoverflow.com/comment/33252071
score: 0
has body: I have read many BufferedImage rotating posts and found that the method to rotate it is using an AffineTransform (at), and using at.rotate(double, int, int). I got this to work, and I can turn it and all but then I want to move it so it shows at a different spot on the screen. For that I used at.translate(int, int). However, the ints don't line up with the actual JFrame I'm using, and it rotates over a different point than the rotated one. How does the translate work with relation to the rotate method? Here's the code I tried using... public void draw(Graphics2D g){ counter++; g.drawImage(animation.getImage(), (int)x, (int)y, null); if (counter * .05 &gt; Math.PI * 2) counter = 0; g.rotate(counter * .05, test.getWidth() / 2, test.getHeight() / 2); g.drawImage(test, at, null); g.rotate(-counter * .05, test.getWidth() / 2, test.getHeight() / 2); }
has comment: http://stackoverflow.com/comment/33252945

http://stackoverflow.com/comment/33157425
type: Comment
comment on: http://stackoverflow.com/a/21893721
has text: Right, Thank You. So the word return catches the button press?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34066080
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22375533
has text: Yes, I know, (you may award you bounty in 2 hours) meant that I couldn't assign it too soon.

http://stackoverflow.com/a/21891500
type: AcceptedAnswer
has body: First Problem You passed in int empType, then switched on employeeType Second Problem You passed in int empType, but all of the cases in your switch are char, like case '1':. Edit: You edited your question to fix some of the problems >:-/ Third Problem In your listAll() method, you are attempting to print an object that has no toString() method. Give your abstract Employee class a toString() method like the following. public String toString() { return lastName + ", " + firstName + " " + middleInitial; } Now, imagine you want your child classes to have a more detailed representation like "Smith, John C. is hourly." You can do this by adding ANOTHER toString method to each of your children classes, but you get to reuse the part you already wrote! For example, this would go in your hourly employee class. public String toString() { return super.toString() + " is hourly."; }
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/33150313
accepted answer of: http://stackoverflow.com/q/21891449
answers question: http://stackoverflow.com/q/21891449
score: 4

http://stackoverflow.com/a/21987084
upvote count: 6
type: Answer
answers question: http://stackoverflow.com/q/21986326
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21986326
has comment: http://stackoverflow.com/comment/33332411
score: 6
has body: The BeanELResolver that translates your EL-Expressions to property access adheres to the JavaBean specification. It states (in Section 8.8): Thus when we extract a property or event name from the middle of an existing Java name, we normally convert the first character to lower case. However to support the occasional use of all upper-case names, we check if the first two characters of the name are both upper case and if so leave it alone. The resolver works by reflection on your actual class. It produces a list of FeatureDesriptor instances and matches those to your expression. So what the resolver sees from your bean is: Property FIELD, both read- and writable Transient property f1, read- and writable Unexposed property F1 Since you're trying to access F1, which has no getters and setters according to the JavaBeans specification, the resolver throws a PropertyNotFoundException. To fix this, adhere to the normal camelCase convention and/or use longer names. See also: Where is the JavaBean property naming convention defined?
has comment: http://stackoverflow.com/comment/97467289
type: AcceptedAnswer

http://stackoverflow.com/q/21858419
tagged with: sip
tagged with: voip
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21879930
type: AnsweredQuestion
has title: Java VOIP framework
tagged with: asterisk
tagged with: java
has body: I have standalone application written on Java/SWT. And now i required to implement softphone functionality in this app. Is there any ready to use VOIP framework written fully on java, which let me develop softphone fast without messing with low-level sip/rtp packets and media codecs? So far i tried: jain-sip + jmf: sound quality is real horrible c-library pjsip with jni: it did the trick, but library doesn't yet support 64bit and jni is such pain with this random jvm crashes. Now i am studying peers library, but maybe there is some easy to use frameworks? P.S. application should work with asterisk, and able to manage calls(transferring, conference e.t.c)
has answer: http://stackoverflow.com/a/21879930
type: Question
tagged with: frameworks

http://stackoverflow.com/a/21893064
upvote count: 4
answers question: http://stackoverflow.com/q/21892833
downvote count: 0
has body: It's because you're asking the scanner to grab the next TWO inputs, when you only want the first. System.out.print("Enter the credits's you will take each term: "); while (!in.hasNextDouble()){ System.out.print("Enter a valid number: "); in.next(); } creditUnits = in.nextDouble(); if (creditUnits &lt; 12){ System.out.print("Enter a number greater than 11: "); creditUnits = in.nextDouble(); } System.out.println("You will be taking " + creditUnits + " credits per term.") Also, one thing you should consider is putting the if(creditUnits &lt; 12) block in a while loop, so you can continually check if they entered a number greater than 12. Something like: System.out.print("Enter the credits's you will take each term: "); while (true){ System.out.print("Enter a valid number: "); creditUnits = in.nextDouble(); if (creditUnits &lt; 12){ System.out.print("\nNumber must be greater than 12!\n"); }else break; } System.out.println("You will be taking " + creditUnits + " credits per term."); Also also, there is no such thing as a stupid question. Only stupid Flyers fans. /joke
score: 4
type: Answer

http://stackoverflow.com/a/21936222
has comment: http://stackoverflow.com/comment/33228888
has comment: http://stackoverflow.com/comment/33229112
score: 0
answers question: http://stackoverflow.com/q/21935814
has body: Here is example of addFocusListener; jTextField.addFocusListener(new FocusListener() { public void focusLost(FocusEvent e) { //TODO: write here what you want } });
type: Answer

http://stackoverflow.com/a/21968618
answers question: http://stackoverflow.com/q/21968327
type: Answer
has comment: http://stackoverflow.com/comment/33288176
score: 2
upvote count: 2
has body: Because you wrote the return true before that statement so that why this line TextView textView1 = (TextView) findViewById(R.id.textView1); is unreachable because compiler wont reach to this statement. Do like this @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } and Intialize the views in the onCreate like @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView textView1 = (TextView) findViewById(R.id.textView1); // you can set the text here any }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21968327

http://stackoverflow.com/comment/33115929
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21871656
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/47813/discussion-between-user3222718-and-looser)
type: Comment

http://stackoverflow.com/comment/33137293
comment on: http://stackoverflow.com/q/21867545
has text: An oversight is my best guess. I'm thinking the original developer thought it was enough to specify it as having test scope on the dependenciesManagement section. Don't know if that's the case but I set the scope anyways just in case. However, that had no effect on the problem I'm having.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33258689
type: Comment
comment on: http://stackoverflow.com/a/21951356
has text: An HTML table is made of rows, each row containing columns. Your code should thus produce a list of Row objects(one for each team), and each row should have a team name (for the first column), and a list of imps (for the next 3 columns). Once you have such a list of rows, creating an HTML table becomes trivial.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33299250
score: 0
type: Comment
type: QuestionComment
has text: I don't know why people insist on using scanners during development, when it is an unbelievable chore to have to enter in everything *every*... ***single*** ...time...
comment on: http://stackoverflow.com/q/21975008

http://stackoverflow.com/comment/33238404
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21941319
score: 1
has text: LoL - no worries mate!

http://stackoverflow.com/q/21889983
has body: .method public c()Ljava/lang/String; .locals 3 const/4 v1, 0x0 const-string v0, "wifi" invoke-virtual {p0, v0}, Lcom/genwen/looltv/start/Appstart;-&gt;getSystemService(Ljava/lang/String;)Ljava/lang/Object; move-result-object v0 check-cast v0, Landroid/net/wifi/WifiManager; if-nez v0, :cond_1 move-object v0, v1 :goto_0 if-eqz v0, :cond_2 invoke-virtual {v0}, Landroid/net/wifi/WifiInfo;-&gt;getMacAddress()Ljava/lang/String; move-result-object v0 if-eqz v0, :cond_0 const-string v1, ":" const-string v2, "" invoke-virtual {v0, v1, v2}, Ljava/lang/String;-&gt;replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; move-result-object v0 new-instance v1, Ljava/lang/StringBuilder; const-string v2, "8c0f" invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-&gt;&lt;init&gt;(Ljava/lang/String;)V invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;-&gt;append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 invoke-virtual {v0}, Ljava/lang/StringBuilder;-&gt;toString()Ljava/lang/String; move-result-object v0 :cond_0 :goto_1 return-object v0 :cond_1 invoke-virtual {v0}, Landroid/net/wifi/WifiManager;-&gt;getConnectionInfo()Landroid/net/wifi/WifiInfo; move-result-object v0 goto :goto_0 :cond_2 move-object v0, v1 goto :goto_1 .end method this is a simple smali function that returns the mac address of the device with '8c0f' at the beginning after stripping the : from the mac address. i want it to return a static mac address like '8c0f0f0f0f0f0f0f' not the real mac address. how can i do that?
has title: How to return a static result in smali function
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/74354459
favorite count: 0
has comment: http://stackoverflow.com/comment/33149256
has answer: http://stackoverflow.com/a/22503642
tagged with: dalvik
has comment: http://stackoverflow.com/comment/33148971
has comment: http://stackoverflow.com/comment/33149055
tagged with: android
has answer: http://stackoverflow.com/a/22266372
has comment: http://stackoverflow.com/comment/33147587
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: smali
has comment: http://stackoverflow.com/comment/33147633
type: Question
tagged with: decompiling

http://stackoverflow.com/comment/97923128
type: Comment
has text: @syd I don't know Tomcat but, generally speaking, in an application server environment you should rely on the container logging system and not use your own.
comment on: http://stackoverflow.com/a/21886071
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33253673
comment on: http://stackoverflow.com/q/21948873
has text: I'm honestly out of ideas. Try putting your class in an actual package.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33286486
type: AnswerComment
comment on: http://stackoverflow.com/a/21967665
type: Comment
has text: No, this will create an int with the last 4 bits. `0xf` is `0000 .... 1111`. It will "extract" the last `.... xxxx` from the other number. `28 & 0xf` for instance will return 12 (0xc). This is a bitwise and operation. In a bitwise and, for any bit `x`, `x & 1` is `x` and `x & 0` is `0`.
score: 0

http://stackoverflow.com/comment/33280170
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21952349
has text: also ping won't work to appwarp.shephertz.com - ICMP pings are disabled. see if you can telnet to any other server which is running on a port other than 80/8080/443 - http/https ports

testng
tags question: http://stackoverflow.com/q/21853832
tags question: http://stackoverflow.com/q/21908396
tags question: http://stackoverflow.com/q/21967914
tag name: testng
tags question: http://stackoverflow.com/q/21935598
tags question: http://stackoverflow.com/q/21870739
type: Tag

http://stackoverflow.com/a/21857183
type: Answer
score: 2
has body: There are a couple of things you need to do: Learn the basics by going through an introductory Java book, or course notes, from the beginning, making sure you understand each step as it comes. Read the Javadocs of likely classes, to find methods that could be useful for the task. You have already found two core pieces of the solution: You are getting a line at a time using BufferedReader.readLine() You are doing it in a while loop, so you handle one line at a time Now, you need to work out how to deal with each line. Although you didn't include the type, name is a String. It would be better as: while ((String name = br.readLine()) != null) { ... do something with `line` } If your code compiled without String there, it means you declared name as a global. Don't do that, until you know what you're doing. Breaking things into methods is good; so let's make "do something with line" use a method now: while ((String name = br.readLine()) != null) { if(matches(line,"text")) { System.out.println(line); } } Now you need to write matches(): private boolean matches(String line, String word) { boolean result = // work out whether it's a match return result; } So, how do you write the guts of matches()? Well, start by looking at the methods available in String. It has methods like contains() and split(). Some of those methods return other types, like arrays. Your teaching material and reference materials tell you how to look in arrays. The answers are there.
downvote count: 0
answers question: http://stackoverflow.com/q/21856700
upvote count: 2

http://stackoverflow.com/comment/33214048
type: QuestionComment
comment on: http://stackoverflow.com/q/21926265
has text: That means that you're assigning a value to label_name after the JLabel has been created. To change the text of the JLabel, your code must call lblName.setText(). I really advise you to learn basic Java principles, and to code your GUI by hand, instead of using a GUI builder without understanding how it works.
score: 0
type: Comment

http://stackoverflow.com/comment/33295801
score: 0
has text: Are you also declaring a local variable called `deduction` in that method?
type: Comment
comment on: http://stackoverflow.com/q/21973297
type: QuestionComment

http://stackoverflow.com/a/22004187
has comment: http://stackoverflow.com/comment/33351409
type: Answer
has comment: http://stackoverflow.com/comment/33351438
has body: Assuming base is the JSON you posted in your question, then your assumptions stated here I get an exception saying that there is not an element "name" in the JSONObject when clearly there is. are wrong. The JSON object you've shown contains only 3 elements: success, item, and specs. item is a JSON array with a single element, another JSON object. That JSON object contains a value named name. You need to get that JSON object so that you can retrieve that value. Or consider using a different JSON parsing library like Jackson or Gson that mostly does this for you based on some POJO class.
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/33351390
downvote count: 0
answers question: http://stackoverflow.com/q/22004160

http://stackoverflow.com/q/21867477
downvote count: 0
has answer: http://stackoverflow.com/a/43845081
accepted answer: http://stackoverflow.com/a/21902369
answer count: 3
possible better answer: http://stackoverflow.com/a/43845081
favorite count: 0
score: 8
upvote count: 8
tagged with: maven
type: AnsweredQuestion
has title: Maven cxf-codegen-plugin does not generate source
tagged with: cxf
tagged with: java
has body: I've researched other answers to this question but I haven't been able to fix my specific issue yet. I'm trying to generate source client java files using Maven and the cxf-codegen-plugin. When I run mvn generate-sources it tells me BUILD SUCCESS but Nothing to generate. Any help is appreciated. Here is my pom: 4.0.0 com.tfs.common SpringCXF1 war 0.0.1-SNAPSHOT SpringCXF1 Maven Webapp http://maven.apache.org <cxf.version>2.7.3</cxf.version> <project.build.sourceencoding>UTF-8</project.build.sourceencoding> junit junit 3.8.1 test org.apache.cxf cxf-rt-frontend-jaxws ${cxf.version} org.apache.cxf cxf-rt-transports-http ${cxf.version} SpringCXF1 org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 org.apache.cxf cxf-codegen-plugin ${cxf.version} generate-sources generate-sources ${basedir}/src/main/java ${basedir}/src/main/resources/HostavailableService.wsdl -verbose -client wsdl2java org.codehaus.mojo build-helper-maven-plugin 1.7 add-source generate-sources add-source ${basedir}/src/main/java org.eclipse.m2e lifecycle-mapping 1.0.0 <lifecyclemappingmetadata> org.apache.cxf cxf-codegen-plugin [2.3.3,) wsdl2java </lifecyclemappingmetadata> <lifecycleMappingMetadata> org.apache.cxf cxf-codegen-plugin [2.7.3,) wsdl2java org.codehaus.mojo build-helper-maven-plugin [1.7,) add-source </lifecycleMappingMetadata> Here is the output when running mvn generate-sources: [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building SpringCXF1 Maven Webapp 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- cxf-codegen-plugin:2.7.3:wsdl2java (generate-sources) @ SpringCXF1 --- [INFO] Nothing to generate [INFO] [INFO] --- build-helper-maven-plugin:1.7:add-source (add-source) @ SpringCXF1 --- [INFO] Source directory: /Users/dmattrm/Documents/DevEnvironment/TFS_Maven2/SpringCXF1/src/main/java added. [INFO] ---------------------------------------…
type: Question
has answer: http://stackoverflow.com/a/76015356
has answer: http://stackoverflow.com/a/21902369

http://stackoverflow.com/comment/33348503
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22002746
has text: I should have mentioned I did try exactly that, declaring it in the circle class, and while the circle class loaded, the CircleTester didn't. I'm not sure what I did wrong (what would I replace c1.radius with - just c1.getRadius right?
type: AnswerComment

http://stackoverflow.com/comment/33349037
has text: After the loop, `parray` will be the result of the last call to `parseURL(url,page);`, if that's `null`, you'll end up with `null`.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22002992

http://stackoverflow.com/comment/33091626
comment on: http://stackoverflow.com/a/21858931
has text: Are you serious? It's doubling the amount of text to be concatenated 25 times. By the time it gets to the 25th loop it's concatenating 3.3MB of data.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21857854
has comment: http://stackoverflow.com/comment/33089218
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/21858056
tagged with: bytebuffer
favorite count: 0
has body: Whilst the ByteBuffer.put(ByteBuffer) method is present, ByteBuffer.get(ByteBuffer) seems to be missing? How am I supposed to achieve reading a smaller ByteBuffer from a larger ByteBuffer?
has title: How can I read a smaller ByteBuffer from a larger ByteBuffer?
has answer: http://stackoverflow.com/a/21858705
accepted answer: http://stackoverflow.com/a/21858705
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/33089124
has answer: http://stackoverflow.com/a/21858056
type: Question
has answer: http://stackoverflow.com/a/21858087
score: 1
tagged with: java

http://stackoverflow.com/comment/33315173
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21983231
type: AnswerComment
has text: 2min search: http://stackoverflow.com/a/9071224/1295422

http://stackoverflow.com/comment/33122157
score: 1
type: AnswerComment
has text: The memory Netbeans shows in its memory display is the addition of PermGenSpace and Heap. Maybe that is your problem. Again: look into jvisualvm to control the used settings for each memory type.
type: Comment
comment on: http://stackoverflow.com/a/21875305

http://stackoverflow.com/q/21936741
score: 4
answer count: 3
favorite count: 0
has body: What is Java BE? I've seen it a couple of times in articles. But I cannot find information. Is it a new type of JDK? Or is it just a typo? Thanks.
possible better answer: http://stackoverflow.com/a/63870792
downvote count: 1
has comment: http://stackoverflow.com/comment/112436892
has answer: http://stackoverflow.com/a/63870792
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21937067
has comment: http://stackoverflow.com/comment/33230291
upvote count: 5
tagged with: java
has title: What is Java BE?
has comment: http://stackoverflow.com/comment/33229814
has comment: http://stackoverflow.com/comment/33230234
type: Question
accepted answer: http://stackoverflow.com/a/21937067
has answer: http://stackoverflow.com/a/67909489

http://stackoverflow.com/comment/33250179
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21947496
has text: Actually, you can use different collections to fit different requirements. Think of `HashMap<Key, Entry>` as an index. For instance, as well as your "main" collection, you can have a separate "index" for requirement `3`. You just need to make sure that when you insert / update / remove an `Entry` from the "original" collection, all of the "indexes" are also correctly updated.

http://stackoverflow.com/a/21852061
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21851965
has body: See example of UndoManager http://www.java2s.com/Code/Java/Swing-JFC/Undomanager.htm Java Docs :-http://docs.oracle.com/javase/6/docs/api/javax/swing/undo/UndoManager.html
score: 1
upvote count: 1

http://stackoverflow.com/comment/33245618
has text: You're welcome. Keep going and don't lose hope. Cheers!
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21944991

http://stackoverflow.com/q/21912885
answer count: 1
has comment: http://stackoverflow.com/comment/33192309
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33192799
tagged with: jfreechart
type: Question
has title: My x-axis integer values are prefixed with "19:00:00."
has answer: http://stackoverflow.com/a/21928263
tagged with: java
has body: I am new to jFreeChart. I am trying to run the example code provided with the download. It is working fine. I want to display integer values on the x-axis. I changed the program to use NumberAxis instead of DateAxis. However, when I generated the graph, it displays my integer x values prefixed with "19:00:00." (it should be 5, 10 but it shows 19:00:00.005, 19:00:00.010). What am I doing wrong here? import java.awt.Color; import java.text.SimpleDateFormat; import java.io.File; import javax.swing.JPanel; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.StandardChartTheme; import org.jfree.chart.axis.DateAxis; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYItemRenderer; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org.jfree.data.time.Month; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; import org.jfree.data.xy.XYDataset; import org.jfree.ui.ApplicationFrame; import org.jfree.ui.RectangleInsets; import org.jfree.ui.RefineryUtilities; import org.jfree.chart.ChartUtilities; /** * An example of a time series chart. For the most part, default settings are * used, except that the renderer is modified to show filled shapes (as well as * lines) at each data point. */ public class PlotExample3 extends ApplicationFrame { private static final long serialVersionUID = 1L; { // set a theme using the new shadow generator feature available in // 1.0.14 - for backwards compatibility it is not enabled by default ChartFactory.setChartTheme(new StandardChartTheme("JFree/Shadow", true)); } /** * A demonstration application showing how to create a simple time series * chart. This example uses monthly data. * * @param title the frame title. */ public PlotExample3(String title) { super(title); ChartPanel chartPanel = (ChartPanel) createDemoPanel(); chartPanel.setPreferredSize(new java.awt.Dimen…
has comment: http://stackoverflow.com/comment/33188168
tagged with: axis

http://stackoverflow.com/a/21994057
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/21993973
answers question: http://stackoverflow.com/q/21993973
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: According to the javadocs: 0 represents any digit, where as # represents any digit that is not 0.

http://stackoverflow.com/a/22004419
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22004351
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: First of all, we're making the assumption that both k and v will be of equal length AND that keys will be unique. You may want to surround the mapping with a try/catch block. HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); ArrayList&lt;String&gt;k = receivedIntent.getStringArrayListExtra("keys"); ArrayList&lt;String&gt;v = receivedIntent.getStringArrayListExtra("values"); for(int i = 0; i &lt; k.size(); i++) map.put(k.get(i), v.get(i));
answers question: http://stackoverflow.com/q/22004351

http://stackoverflow.com/q/21854351
answer count: 1
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33084656
has title: Store java Object as clob and retrieve
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/21855343
favorite count: 0
linked to: http://stackoverflow.com/q/2836646
type: Question
has body: i am having a table in oracle. in that table one of the column is to store clob data. and in that clob column, have to insert object as clob. that object should be saved as clob and have to retrive again as object. In java is there any possible to store Obect as clob. i had tried the example as per link import java.sql.*; import java.io.*; import oracle.jdbc.driver.OracleResultSet; import oracle.sql.CLOB; public class TestOracleClob implements Serializable{ public static void main(String[] args) { //create table test (id integer,content clob); System.out.println("-------------------insert -----------------"); try{ DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Connection con = DriverManager.getConnection ("oracle server", "loginid", "loginpassword"); //Class.forName("oracle.jdbc.driver.OracleDriver"); con.setAutoCommit(false); //Ok 1 String sql="insert into test values(1,empty_clob())"; Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(sql); System.out.println("-------------------insert -----------------"); String sqll="select content from test where id=1 for update"; ResultSet rss=stmt.executeQuery(sqll); if(rss.next()){ //CLOB clob = ((OracleResultSet)rss).getCLOB(1); oracle.sql.CLOB clob= (oracle.sql.CLOB)rss.getClob("content"); clob.putString(1,"here is a string which contains more than 4000 character"); sql="update test set content=? where id=1"; PreparedStatement pstmt=con.prepareStatement(sql); pstmt.setClob(1,clob); pstmt.executeUpdate(); pstmt.close(); } con.commit(); //Ok 2 //String sql1="insert into test values(2,empty_clob())"; //ResultSet rs3=stmt.executeQuery(sql1); String sql12="insert into test values(?,?)"; PreparedStatement pstmt1=con.prepareStatement(sql12); pstmt1.setInt(1,2); pstmt1.setClob(2,oracle.sql.CLOB.empty_lob()); pstmt1.executeUpdate(); String sqll2="select content from test where id=2 for update"; ResultSet rss2=stmt.executeQuery(sqll2); if(rss2.next()){ CLOB clob = ((OracleResultSet)rss2).getCL…
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/33084080
tagged with: jdbc
tagged with: clob
upvote count: 1

http://stackoverflow.com/q/21997487
favorite count: 0
has answer: http://stackoverflow.com/a/21999129
downvote count: 1
type: AnsweredQuestion
has body: I want to make a query on multiple fields in Lucene 4.6. I have two fields -- title and body. I want to give more weights the title than to the body field for a specific query, for example in 0.7 to 0.3 split. Any idea?
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/21999129
type: Question
upvote count: 0
answer count: 1
has title: How to assign different weights to scores from multiple fields in lucene
tagged with: lucene

http://stackoverflow.com/comment/33245336
has text: @Yatendra, the 2nd implementation returns an index (see the comment above the method) and indices can't be negative in Java.
type: Comment
comment on: http://stackoverflow.com/a/21944944
score: 0
type: AnswerComment

http://stackoverflow.com/q/21900646
has answer: http://stackoverflow.com/a/21901735
accepted answer: http://stackoverflow.com/a/21901735
upvote count: 2
has answer: http://stackoverflow.com/a/21902152
downvote count: 1
has title: How we can use inner anonymous for c# interface?
has body: I am using converting one program of Java into C# in which I am having some problem of using interface anonymous. Please tell me how can I achieve this in C# This is example in java, how can we write inner anonymous for C#? interface Test { public void wish(); } class Main { public static void main(String[] args) { Test t=new Test() { public void wish() { System.out.println("output: hello how r u"); } }; t.wish(); } }
favorite count: 0
possible better answer: http://stackoverflow.com/a/21900733
linked to: http://stackoverflow.com/q/15581737
answer count: 5
has comment: http://stackoverflow.com/comment/37871709
linked to: http://stackoverflow.com/q/5848510
has comment: http://stackoverflow.com/comment/33168032
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21900733
linked to: http://stackoverflow.com/q/191013
has answer: http://stackoverflow.com/a/21902015
has comment: http://stackoverflow.com/comment/33167457
has answer: http://stackoverflow.com/a/22004610
type: Question
tagged with: c#
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/17708528

http://stackoverflow.com/q/21868795
accepted answer: http://stackoverflow.com/a/21869180
has body: I am trying to run a web scraper in Eclipse that, using Jsoup, that can take the names of the professors on this page: yu.edu/faculty and print them out. This is my code: import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class YUscraper { public static void main(String[] args) throws IOException { // fetches &amp; parses HTML String url = "http://yu.edu/faculty/"; Document document = Jsoup.connect(url).get(); // Extract data Element content = document.getElementById("mainlist"); Elements names = content.getElementsByTag("a"); // Output data for (Element name : names) { System.out.println("Name: " + name.text()); } } } I am getting this error: Exception in thread "main" java.lang.NullPointerException at YUscraper.main(YUscraper.java:18) I am relatively new to this so pardon me if I am missing something really evident. I used many examples I have seen to get to this point, but I still don't understand what throws IOException is for and what it means that an exception was found. Please help, thanks!
has title: "Exception in thread "main" java.Lang.NullPointerException" Error
tagged with: eclipse
score: 0
tagged with: jsoup
answer count: 2
has answer: http://stackoverflow.com/a/21869180
possible better answer: http://stackoverflow.com/a/21868846
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21868846
tagged with: java
tagged with: web-scraping
type: Question

http://stackoverflow.com/comment/33239068
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21941393
has text: Actually I don't know how can I make a custom thread non modifiable by any other thread.

http://stackoverflow.com/q/21867189
has body: I am trying to make an encryption program and part of this includes having a passcode displayed at the beginning of my encrypted text and then displaying the alphabet after that with the letters contained in the passcode being removed from the alphabet. I am trying to remove the characters in the passcode from my alphabet StringBuffer but it seems like there is no easy way to do this. There is no method that automatically searches a method for all occurences of a character but there is for a String object. However, I must replace a character with another character and I want to replace a character with nothing(essentially delete it). This is my code: Any help would be appreciated. StringBuffer alphabet = new StringBuffer("abcdefghijklmnopqrstuvwxyz"); for(int i = 0; i &lt; pass.length(); i++) { char replacedletter = pass.charAt(i); alphabet.replace(replacedletter,""); } System.out.println(pass + alphabet);
has answer: http://stackoverflow.com/a/21867235
has comment: http://stackoverflow.com/comment/33106784
tagged with: string
score: 0
tagged with: regex
type: UnansweredQuestion
has title: How can I remove characters from a StringBuffer?
tagged with: java
has answer: http://stackoverflow.com/a/21867707
tagged with: replace
type: Question
answer count: 2

http://stackoverflow.com/comment/33086946
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21854961
type: Comment
has text: In your addition, the reordering is illegal exactly because it violates the stipulation I have quoted.

http://stackoverflow.com/a/24161802
upvote count: 0
answers question: http://stackoverflow.com/q/21911776
has comment: http://stackoverflow.com/comment/37289923
score: -1
downvote count: 1
has body: this is tutorial show you how to call android application webservice using protocol soap http://android.programmerguru.com/how-to-call-asp-net-web-service-in-android/
type: Answer

http://stackoverflow.com/comment/33089001
score: 0
type: Comment
type: QuestionComment
has text: fix errors i resource files and clean and build
comment on: http://stackoverflow.com/q/21857777

http://stackoverflow.com/comment/33282031
has text: @Fusion Just give me an example of what you want to do :)
comment on: http://stackoverflow.com/a/21963371
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33282926
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21965677
type: Comment
has text: If i removed those line nothing is happening..Actually i need r rows and 4 columns of edittext...but nothing is seen

http://stackoverflow.com/comment/33265571
comment on: http://stackoverflow.com/q/21955816
score: 0
type: Comment
type: QuestionComment
has text: I think I used wrong word. I mean the view is not respond to some function. But with other function it work. It's not unresponsive forever.

http://stackoverflow.com/comment/33086469
score: 0
has text: tried it deployed? Often stuff does not work on the dev server but works when deployed.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21850826

fractions
type: Tag
tags question: http://stackoverflow.com/q/21926087
tag name: fractions

http://stackoverflow.com/q/21948289
has body: OY, not enough rep points to post an image... ____________________________________________________ |joes pizza | | pizza type toppings ----------- | | | | | | cheese mushrooms | 15.00 | | | veggie extra cheese | | | | pepperoni bacon | | | | ---------- | | _______________________________________________ | | | calculate total | | | ------------------------------------------------ | |___________________________________________________| I'm supposed to build this for class, where the options in the middle are radio buttons and check boxes, and I have all the components in my panels in my frame. All I have left to do is actionListener and make it look like this. We are learning Layout Managers, and have been given five (FlowLayout, BorderLayout, GridLayout, BoxLayout, CardLayout, and GridBagLayout). I can't seem to make any of them look like this, though. They either all end up in a line or in some crazy staggered representation, or crowded in from border to border. Any suggestions? In case my setup is getting in the way, I have joe's pizza in a label, pizza type in a pane, toppings in a pane, the textArea on the right, and finally a button. I'm not looking for an answer or the code to make it happen, just want to know what tools I should be using. If I can't figure out the tools, I'll ask another question or ask in the comments. Thanks for any suggestions. Tony
downvote count: 0
answer count: 1
tagged with: layout-manager
favorite count: 0
has answer: http://stackoverflow.com/a/21948852
has comment: http://stackoverflow.com/comment/33251966
has comment: http://stackoverflow.com/comment/33251247
has comment: http://stackoverflow.com/comment/33252278
has comment: http://stackoverflow.com/comment/33252303
has title: What layout manager will do this?
has comment: http://stackoverflow.com/comment/33251238
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/21948852
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33251281
type: Question

http://stackoverflow.com/q/21953771
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21953872
has comment: http://stackoverflow.com/comment/33260958
type: Question
has title: i cannot convert this java code to javascript
has comment: http://stackoverflow.com/comment/33261043
accepted answer: http://stackoverflow.com/a/21954018
tagged with: javascript
has comment: http://stackoverflow.com/comment/33260850
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/21954304
upvote count: 2
score: 0
has body: this a program that work based on a specific algorithm. it works perfectly in java but whenever I run the html code i dont get error but it show me only the first three number while in java code the for loop continues until to show the whole numbers Java code package test1; public class Test1 { public static void main(String arg[]) { int num = 1; counterA(num); } public static void counterA(int num) { for (int i = num; i <= 24; i += 5) { System.out.println(i); counterB(i); } } public static void counterB(int i) { counterA(i * 3); } } HTML code Try it
downvote count: 2
has comment: http://stackoverflow.com/comment/33260887
has answer: http://stackoverflow.com/a/21953872
has answer: http://stackoverflow.com/a/21954018

http://stackoverflow.com/comment/33065198
has text: I just got the max to work, but still have the min wrong... here's what I changed in the max
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21843563

package
tags question: http://stackoverflow.com/q/21888146
tag name: package
tags question: http://stackoverflow.com/q/21958273
tags question: http://stackoverflow.com/q/21907139
tags question: http://stackoverflow.com/q/21991285
type: Tag
tags question: http://stackoverflow.com/q/21883866
tags question: http://stackoverflow.com/q/21992653
tags question: http://stackoverflow.com/q/21899848
tags question: http://stackoverflow.com/q/21967013
tags question: http://stackoverflow.com/q/21966573
tags question: http://stackoverflow.com/q/21953424
tags question: http://stackoverflow.com/q/21888652
tags question: http://stackoverflow.com/q/21890226
tags question: http://stackoverflow.com/q/21961159

http://stackoverflow.com/comment/33194002
type: Comment
has text: if I do listSprite.remove(s) much errors occur.
comment on: http://stackoverflow.com/q/21914624
score: 0
type: QuestionComment

http://stackoverflow.com/q/21854534
answer count: 1
has comment: http://stackoverflow.com/comment/33097471
has comment: http://stackoverflow.com/comment/33097427
has answer: http://stackoverflow.com/a/23788636
has comment: http://stackoverflow.com/comment/33082981
type: UnansweredQuestion
tagged with: android
has body: I have ListView that contains spinner, an image and a TextView. Above this ListView I have an EditText where a user can type his required item name and all the related items has been shown in the ListView. My code is working till here but the problem is when i enter string in the search edit box it does that and when i start to remove the characters the list view is just disappears and there is only a blank screen. while at first the listView that contains the spinners was created successfully but after doing filter and removing all characters in the search box the view cannot be created. Here is my code of getFilter in LazyAdapter that extends from BaseAdapter @SuppressLint("DefaultLocale") public android.widget.Filter getFilter() { return new android.widget.Filter() { @SuppressLint("DefaultLocale") @Override protected FilterResults performFiltering(CharSequence constraint) { FilterResults Result = new FilterResults(); // if constraint is empty return the original names if (TextUtils.isEmpty(constraint)){ //Result.values = storedata; Result.count = listDetails.size(); return Result; } ArrayList&lt;items&gt; Filtered_Names = new ArrayList&lt;items&gt;(); String filterString = constraint.toString().toLowerCase(); String filterableString; for(int i = 0; i&lt;listDetails.size(); i++){ items searchdata = listDetails.get(i); String title = searchdata.title(); String id = searchdata.id(); String imageUrl = searchdata.imageUrl(); String pprice = searchdata.pprice(); String shippingPrice = searchdata.shippingPrice(); String stock = searchdata.stock(); filterableString = title+" "+id+" "+imageUrl+" "+pprice+" "+shippingPrice+" "+status+" "+stitle+" "+stock+" if(filterableString.toLowerCase().contains(filterString)){ Filtered_Names.add(listDetails.get(i)); //Log.e("Added", String.valueOf(Filtered_Names.size())); } } Result.values = Filtered_Names; Result.count = Filtered_Names.size(); //Log.e("Results", Result.values.toString() + String.valueOf(Result.count)); return Result; …
tagged with: java
has title: Filter returns an empty (null) array list
type: Question
has comment: http://stackoverflow.com/comment/33083029
tagged with: android-filter
score: 0

http://stackoverflow.com/a/21941935
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21941883
has body: Well this follows the singleton pattern, which means you only instance the object only once. Which means: You have private variable to hold the class instace. You don't use the constructor to create the instance but use the static method to initialize the instance. Inside getInstance you first check if the instance is already initialized or not. if is return it. Read more at wikipedia gives you more details about the pattern http://en.wikipedia.org/wiki/Singleton_pattern
downvote count: 0

http://stackoverflow.com/a/21856589
score: 1
type: Answer
upvote count: 1
has body: Fields in interfaces are always by default public static. This means they belong to class, not instance. When you access a static field you have to explicitly specify which class you are accessing, so there is no way to override, or even shadow, a static field. So both values take space in memory and both are always available.
downvote count: 0
answers question: http://stackoverflow.com/q/21856476

http://stackoverflow.com/comment/33158006
type: Comment
comment on: http://stackoverflow.com/a/21895192
score: 0
type: AnswerComment
has text: I could not find an arrow head (or anything remotely related) in the docs. I guess will have to hard code it. Would be really great if this was added. It is a very useful for any data visualization context. Thanks :)

http://stackoverflow.com/q/21948363
linked to: http://stackoverflow.com/q/2213340
has body: I am trying to open multiple ports on a server socket so that i could connect multiple clients. Each time i create a create a thread and start it (i know the overridden run method will be invoked) i open a port and listen for a client . But the problem is that when i run the client socket project and try to connect to the port i opened in server ,it says java.net.connectException : connection refused:connect. I also noticed a peculiar thing happenning.The output in the console window is different every time i run the "server code " i have been working on this for the last 3 days and i have achieved nothing i guess. note: this problem is unique for me as i have not found this particular problem on this forum any where so please be kind as i am a newbie to java and socket programming though i have been coding on c++ for quite some time now . server socket import java.io.*; import java.net.*; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.lang.*; public class TryThreads extends Thread { private int Portnumber; private static String inputLine; public TryThreads(int portNumber) { Portnumber = portNumber; setDaemon(true); } public static void main(String[] args) { //create three threads Thread first = new TryThreads(63400); Thread second = new TryThreads(63401); first.start(); second.start(); //third.start(); System.out.println("ending main"); return; } public void run() { try { System.out.println("one socket port opened"); ServerSocket serverSocket = new ServerSocket(Portnumber); System.out.println("one socket port opened"); while (true) { System.out.println("ending main2"); //System.out.println("one socket port opened"); Socket clientSocket = serverSocket.accept(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); while((inputLine = bufferedReader.readLine()) != null) System.out.println(inputLine); } } catch(IOException e) { Syste…
tagged with: sockets
has comment: http://stackoverflow.com/comment/33251487
has comment: http://stackoverflow.com/comment/33251850
has comment: http://stackoverflow.com/comment/33251461
has comment: http://stackoverflow.com/comment/33251743
has title: open multiple server socket ports for multiple clients
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21948464
upvote count: 1
has comment: http://stackoverflow.com/comment/33251789
has comment: http://stackoverflow.com/comment/33251615
has comment: http://stackoverflow.com/comment/33251497
tagged with: java
has comment: http://stackoverflow.com/comment/33251668
has comment: http://stackoverflow.com/comment/33251538
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/32138679
has comment: http://stackoverflow.com/comment/33251537
has comment: http://stackoverflow.com/comment/33251695
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33251575
has comment: http://stackoverflow.com/comment/33251642
favorite count: 0

http://stackoverflow.com/comment/33156014
type: Comment
comment on: http://stackoverflow.com/q/21893813
score: 0
type: QuestionComment
has text: @Ameen I have added it in

http://stackoverflow.com/comment/33204388
score: 0
comment on: http://stackoverflow.com/q/21921818
type: Comment
type: QuestionComment
has text: Can you update the webapps you serve or does it have to be a strict tomcat solution?

http://stackoverflow.com/q/21985123
tagged with: serial-communication
tagged with: serial-port
has body: I am to transfer two files from a Java app to an Arduino of roughly 200k each to be saved to uSD. With a USB connection this is going fine using the RXTX library and simple data parsing on the Arduino. I now want to replace the USB connect with a bluetooth using a HC-06 module. Without changing anything the transfer works but it takes 12 minutes rather than 2 minutes. The transfer hangs at the same 4 (maybe 50) points of the transfer, seen by percentage progress. The bottleneck must be in the RXTX library or bluteooth TX but can't find what's happening. Is there anything I can tweak or is this a limitation of a basic bluetooth module? Here are snippets from code FWIW, nothing out of the ordinary (I think!) : Java : int perc = data.length / 100; for (int i = 0 ; i &lt; data.length ; i++) { try{ output.write(data[i]); } catch(Exception e){ System.err.println(e.toString()); } if(i % perc == 0) System.out.println(i / perc); } Arduino : boolean waiting = true; while( lastData + 2000 &gt; millis() || waiting){ while(Serial.available()) { waiting = false; if(Serial.available() &gt;= 255) nodes[nodeCount++] = byteCount; buff[bytInc++] = Serial.read(); if(bytInc == 512) { bytInc = 0; in.write(buff,512); } lastData = millis(); byteCount++; } } in.write(buff,bytInc); in.flush(); Any optimisation in the snippets above would be much appreciated. The baud rate is 38400. Any faster and the buffer overloads when writing to uSD. Arduino board is a Mega with 256 byte serial buffer. Much appreciated. Have hunted about for relevant posts but can't find anything on bluetooth file transfers like this.
answer count: 0
tagged with: java
tagged with: arduino
type: Question
has comment: http://stackoverflow.com/comment/33317090
has comment: http://stackoverflow.com/comment/33321887
tagged with: bluetooth
score: 0
has comment: http://stackoverflow.com/comment/33333142
has title: Bluetooth Serial Data Transfer Hangs at same points
has comment: http://stackoverflow.com/comment/33333834
type: UnansweredQuestion

http://stackoverflow.com/comment/33350548
has text: "There are reasons why you might do one or the other"...Can you give a short example of one such reason?
comment on: http://stackoverflow.com/a/22003858
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33969234
type: Comment
comment on: http://stackoverflow.com/a/22306933
has text: Thx. But it seems it isn't what I need. If node that was selected for storing value doesn't have enough memory this value displaces another value or it wouldn't be stored.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21857343
upvote count: 3
downvote count: 2
has comment: http://stackoverflow.com/comment/33089388
has comment: http://stackoverflow.com/comment/33088280
has comment: http://stackoverflow.com/comment/33088695
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21861286
tagged with: xjc
has body: I'm wondering why generated (from xsd) getter for list has always null check: public class Response { @XmlElement(type = Integer.class) protected List&lt;Integer&gt; integers; public List&lt;Integer&gt; getIntegers() { if (integers == null) { integers = new ArrayList&lt;Integer&gt;(); } return this.integers; } } Question: Why? What is the reason? Is there any good one? I'm asking becouse in some cases this is not a good thing. And looks like there is no way to change this behavior.
has comment: http://stackoverflow.com/comment/33089712
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33092745
score: 1
has comment: http://stackoverflow.com/comment/33088940
has comment: http://stackoverflow.com/comment/33092178
has title: wsimport (xjc) - why list getter has always null check?
has comment: http://stackoverflow.com/comment/33089073
type: Question
has comment: http://stackoverflow.com/comment/33092245
tagged with: java
tagged with: wsimport
has comment: http://stackoverflow.com/comment/33092994
accepted answer: http://stackoverflow.com/a/21861286
has comment: http://stackoverflow.com/comment/33092720
has comment: http://stackoverflow.com/comment/33089949
has comment: http://stackoverflow.com/comment/33090389

http://stackoverflow.com/q/21854192
has comment: http://stackoverflow.com/comment/33173912
tagged with: maven
has comment: http://stackoverflow.com/comment/33169804
has comment: http://stackoverflow.com/comment/33082648
has comment: http://stackoverflow.com/comment/33161128
linked to: http://stackoverflow.com/q/12533885
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33174013
has comment: http://stackoverflow.com/comment/33147800
tagged with: eclipse
has title: ejb-javaee6 project using maven,giving could not clculate build plan error
score: 0
has comment: http://stackoverflow.com/comment/33166218
has comment: http://stackoverflow.com/comment/33161022
has body: Could not calculate build plan:plugin org.apache.maven.plugins:maven-dependency-plugin:2.1 or one of its dependencies cannot be resolved:Failed to read artifact descriptor for org.apache.maven.plugins:maven-dependency-plugin:jar 2.1. I double checked plugin is available in C:\.m2\repository\org\apache\maven\plugins Here is my pom.xml 4.0.0 com.packtub.as7development.chapter3 ticket-agency-ejb 0.0.1-SNAPSHOT ejb ticket-agency-ejb <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> org.jboss.spec jboss-javaee-6.0 3.0.2.Final pom import javax javaee-api 6.0 provided org.jboss.spec.javax.annotation jboss-annotations-api_1.1_spec provided org.jboss.spec.javax.ejb jboss-ejb-api_3.1_spec provided org.jboss.logging jboss-logging 3.1.3.GA org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 ${endorsed.dir} org.apache.maven.plugins maven-ejb-plugin 2.3 3.1 org.apache.maven.plugins maven-dependency-plugin 2.1 validate copy ${endorsed.dir} true javax javaee-endorsed-api 6.0 jar Here is settings.xml <?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- | This is the configuration file for Maven. It can be specified at two levels: | | 1. User Level. This setting…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33166223

http://stackoverflow.com/q/21906899
duplicate of: http://stackoverflow.com/q/2422468
has body: How can I upload an image using simply JSP and Servlet. I used as below code to get an image in JSP page: File: Now I would like to know how to get these files and how to save them in specific directory ? I named that folder "images", and I would like to put all files these I uploaded in that folder. The images would actually be saved when I restart my server or refresh my page. How can I achieve this?
type: UnansweredQuestion
tagged with: servlets
has comment: http://stackoverflow.com/comment/33177070
has answer: http://stackoverflow.com/a/21907067
downvote count: 0
tagged with: jsp
score: 1
tagged with: file-upload
favorite count: 0
type: Question
has title: JSP Servlet Upload Image File
has answer: http://stackoverflow.com/a/21907744
has answer: http://stackoverflow.com/a/21907031
tagged with: java
answer count: 3
linked to: http://stackoverflow.com/q/2422468
upvote count: 1

http://stackoverflow.com/comment/33331483
has text: Although it can be done sequentially indeed, the question was about how to create a browser using separate threads for each tab.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21992880

http://stackoverflow.com/q/21972141
has body: So, since dynamic variables aren't a thing in Java, and if statements will be horribly unwieldy, was looking for help converting this code block into a more concise one. I looked into hashmaps, and they just didn't seem quite right, it's highly likely I was misunderstanding them though. public String m1 = "Name1"; public String m1ip = "192.1.1.1"; public String m2 = "Name2"; public String m2ip = "192.1.1.1"; public String req; public String reqip; ... snip some code... if (requestedMachine == 1) { req = m1; reqip = m1ip;} else if (requestedMachine == 2) { req = m2; reqip = m2ip;} else if (requestedMachine == 3) { req = m3; reqip = m3ip;} else if (requestedMachine == 4) { req = m4; reqip = m4ip;} else if (requestedMachine == 5) { req = m5; reqip = m5ip;} requestedMachine is going to be an integer, that defines which values should be assigned to req &amp; reqip. Thanks in advance.
accepted answer: http://stackoverflow.com/a/21972176
has answer: http://stackoverflow.com/a/21972996
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21972379
tagged with: java
has comment: http://stackoverflow.com/comment/33293922
has answer: http://stackoverflow.com/a/21972188
type: Question
possible better answer: http://stackoverflow.com/a/21972188
has comment: http://stackoverflow.com/comment/33293877
has answer: http://stackoverflow.com/a/21972176
downvote count: 0
has answer: http://stackoverflow.com/a/21972482
favorite count: 0
has title: How to avoid using dynamic variables / a billion if statements in Java?
upvote count: 2
answer count: 5

http://stackoverflow.com/comment/33350188
has text: You might want to also add a trim() to the end of that replace() or else his Strings will throw an IllegalArgumentException or numberFormatException (I can't remember which, but I'm guessing the number one)
type: AnswerComment
comment on: http://stackoverflow.com/a/22003453
type: Comment
score: 1

x509certificate
tags question: http://stackoverflow.com/q/21891967
tags question: http://stackoverflow.com/q/21916336
type: Tag
tags question: http://stackoverflow.com/q/21961448
tag name: x509certificate
tags question: http://stackoverflow.com/q/21945036

http://stackoverflow.com/comment/33249973
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21947496
has text: Thank you that was very useful considering we've covered ArrayList and TreeMaps so that does make sense! I will accept your answer in 4 minutes - thanks for your advice.

subprocess
tags question: http://stackoverflow.com/q/21918965
tag name: subprocess
type: Tag

http://stackoverflow.com/comment/33173774
comment on: http://stackoverflow.com/a/21902364
score: 0
type: Comment
has text: One question, regarding your last edit about `conduit.getAnnotation`. I don't seem to have `AllowNull` class. Should that be my own, or does it come with Tapestry?
type: AnswerComment

jsp
tags question: http://stackoverflow.com/q/21959831
tags question: http://stackoverflow.com/q/21869941
tags question: http://stackoverflow.com/q/21915875
tags question: http://stackoverflow.com/q/21936749
tags question: http://stackoverflow.com/q/21959650
tags question: http://stackoverflow.com/q/21941535
tags question: http://stackoverflow.com/q/21983369
tags question: http://stackoverflow.com/q/21961115
tags question: http://stackoverflow.com/q/21896815
tags question: http://stackoverflow.com/q/21949070
tags question: http://stackoverflow.com/q/21949115
tags question: http://stackoverflow.com/q/21866279
tags question: http://stackoverflow.com/q/21876536
tags question: http://stackoverflow.com/q/21993403
tags question: http://stackoverflow.com/q/21971433
tags question: http://stackoverflow.com/q/21938719
tags question: http://stackoverflow.com/q/21873749
tags question: http://stackoverflow.com/q/21887825
tags question: http://stackoverflow.com/q/21935160
tags question: http://stackoverflow.com/q/21977567
tags question: http://stackoverflow.com/q/21870573
tags question: http://stackoverflow.com/q/21904186
tags question: http://stackoverflow.com/q/21844180
tags question: http://stackoverflow.com/q/21855210
tags question: http://stackoverflow.com/q/21905705
tags question: http://stackoverflow.com/q/21994444
tags question: http://stackoverflow.com/q/21873660
tags question: http://stackoverflow.com/q/21967984
tags question: http://stackoverflow.com/q/21994257
tags question: http://stackoverflow.com/q/21920421
tags question: http://stackoverflow.com/q/21906899
tags question: http://stackoverflow.com/q/21882192
tags question: http://stackoverflow.com/q/22005083
tags question: http://stackoverflow.com/q/21876057
tags question: http://stackoverflow.com/q/21980881
tags question: http://stackoverflow.com/q/21873315
tags question: http://stackoverflow.com/q/21951094
tags question: http://stackoverflow.com/q/21863363
tags question: http://stackoverflow.com/q/21914838
tags question: http://stackoverflow.com/q/21969395
tags question: http://stackoverflow.com/q/21962380
tags question: http://stackoverflow.com/q/21995563
tags question: http://stackoverflow.com/q/21875920
tags question: http://stackoverflow.com/q/21923158
tags question: http://stackoverflow.com/q/21886493
type: Tag
tags question: http://stackoverflow.com/q/21849748
tags question: http://stackoverflow.com/q/21929291
tags question: http://stackoverflow.com/q/21844104
tags question: http://stackoverflow.com/q/21873513
tags question: http://stackoverflow.com/q/21935256
tags question: http://stackoverflow.com/q/21979741
tags question: http://stackoverflow.com/q/21973677
tags question: http://stackoverflow.com/q/21930458
tags question: http://stackoverflow.com/q/21888084
tags question: http://stackoverflow.com/q/21988444
tags question: http://stackoverflow.com/q/21852273
tags question: http://stackoverflow.com/q/21863856
tags question: http://stackoverflow.com/q/21979502
tags question: http://stackoverflow.com/q/21849229
tags question: http://stackoverflow.com/q/21872065
tags question: http://stackoverflow.com/q/21966870
tag name: jsp
tags question: http://stackoverflow.com/q/21946521
tags question: http://stackoverflow.com/q/21842762
tags question: http://stackoverflow.com/q/21900810
tags question: http://stackoverflow.com/q/21997923
tags question: http://stackoverflow.com/q/21927220
tags question: http://stackoverflow.com/q/21907659
tags question: http://stackoverflow.com/q/21879010
tags question: http://stackoverflow.com/q/21935267
tags question: http://stackoverflow.com/q/22003290
tags question: http://stackoverflow.com/q/21992539
tags question: http://stackoverflow.com/q/21902763
tags question: http://stackoverflow.com/q/21992788
tags question: http://stackoverflow.com/q/21983618
tags question: http://stackoverflow.com/q/21929436
tags question: http://stackoverflow.com/q/21966840
tags question: http://stackoverflow.com/q/21929604
tags question: http://stackoverflow.com/q/21941307

http://stackoverflow.com/q/21954319
accepted answer: http://stackoverflow.com/a/21955804
tagged with: user-interface
answer count: 1
has comment: http://stackoverflow.com/comment/33261738
has comment: http://stackoverflow.com/comment/33263003
has title: How To Extend Java's SWT Label?
has comment: http://stackoverflow.com/comment/33263353
has comment: http://stackoverflow.com/comment/33263646
type: AnsweredQuestion
has body: I wanted to extend the java SWT Label object, and found out it's not allowed. So I created a class 'MyLabel' that contains a Label object. It looks something like this: public class MyLabel { Label label; //more instance variables here... public MyLabel(Composite parent, int type) { label=new Label(parent,type); //more initialization here... } public void setText(String label_text) { label.setText(label_text); } public void setImage(Image label_image) { label.setImage(label_image); } public void addMouseListener(MouseListener board_listener) { label.addMouseListener(board_listener); } public void removeMouseListener(MouseListener board_listener) { label.removeMouseListener(board_listener); } //more staff here... } and it worked fine for a while, until I started listening to events, and realized this: public class SWTTest { public static void main(String[] args) { Display display=new Display(); Shell shell=new Shell(display); shell.setLayout(new RowLayout()); MyLabel my_label=new MyLabel(shell, SWT.SHADOW_OUT); my_label.setText("this is my label"); my_label.addMouseListener(new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { e.getSource(); //returns the Label object instead of MyLabel object... } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } } } this may seems not too bad, but I have several MyLabel objects, and I need to know the source of the mouse click in terms of MyLabel. Is there some solution to this situation? **EDIT I'm trying to create my own label. more specifically, I want a Label with an addition field X in it, and a getX() and setX(X x_var) in it. **EDIT2 OK, I'll be more specific: I have a chess board with 64 labels on it, ordered in a 8x8 grid, each represents a position on the board. Now, what I'm trying to achieve is that whenever one of the 64 positions on the board was clicked - I'll know where it was clicked, in terms of x and y board-coordinates. So, I want to exte…
has comment: http://stackoverflow.com/comment/33264182
tagged with: java
tagged with: swt
type: Question
has comment: http://stackoverflow.com/comment/33262923
has comment: http://stackoverflow.com/comment/33262717
has comment: http://stackoverflow.com/comment/33262295
score: 0
has answer: http://stackoverflow.com/a/21955804

http://stackoverflow.com/a/21980812
score: 2
upvote count: 2
has body: if (j == len || c[j] != c[start]) true---^ ^------Expression is NOT evaluated if (j == len || c[j] != c[start]) false---^ ^------Expression is evaluated If the first expression is true then the jvm will not go to check the second expression in case of OR operator
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21980740

http://stackoverflow.com/comment/53246630
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22013603
type: Comment
has text: Ofcourse, works like a charm :) https://docs.oracle.com/javase/tutorial/reflect/member/methodparameterreflection.html

http://stackoverflow.com/q/21963068
tagged with: eclipse-rcp
accepted answer: http://stackoverflow.com/a/21966387
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21966387
tagged with: eclipse
has body: Say I have a Handler that is logging data to some object via a listener. public Object execute(ExecutionEvent event) throws ExecutionException { IHandlerService service; IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); try { RecordingDocument d = new RecordingDocument("TestProject", "Tester", true); d.record(); MessageDialog.openInformation( window.getShell(), "JavaTV", "You are now recording."); } catch (CoreException e) { e.printStackTrace(); } return null; } This object is created when one of the menu items is selected and begins logging to a data structure inside the object. How do I retrieve this document from a different handler? I need this if someone uses the menu to stop the recording.
type: Question
score: 0
has title: How to communicate between two command Handlers
answer count: 1
tagged with: eclipse-plugin

http://stackoverflow.com/a/21901440
upvote count: 1
has comment: http://stackoverflow.com/comment/33169216
score: 1
accepted answer of: http://stackoverflow.com/q/21900459
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21900459
has body: In Normal mode there should not be any different between running the application from Eclipse and from the command line. This is assuming that the same values for the various memory options (heap size, perm gen space) are used.
type: Answer

http://stackoverflow.com/q/21866569
tagged with: java
tagged with: javafx
type: Question
has answer: http://stackoverflow.com/a/21890793
has title: How to insert data using API into Bar Chart
score: 0
tagged with: javafx-8
answer count: 1
has body: This question is more related to software design. I want to to create API which can be used to update this Bar Chart. This is the original example http://docs.oracle.com/javafx/2/charts/bar-chart.htm I tested to create this: import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.chart.BarChart; import javafx.scene.chart.CategoryAxis; import javafx.scene.chart.NumberAxis; import javafx.scene.chart.XYChart; import javafx.stage.Stage; public class MainApp extends Application { XYChart.Series series1 = new XYChart.Series(); XYChart.Series series2 = new XYChart.Series(); XYChart.Series series3 = new XYChart.Series(); @Override public void start(Stage stage) { setUserAgentStylesheet(STYLESHEET_CASPIAN); stage.setTitle("Bar Chart Sample"); final CategoryAxis xAxis = new CategoryAxis(); final NumberAxis yAxis = new NumberAxis(); final BarChart&lt;String, Number&gt; bc = new BarChart&lt;String, Number&gt;(xAxis, yAxis); bc.setTitle("Country Summary"); xAxis.setLabel("Country"); yAxis.setLabel("Value"); series1.setName("2003"); // series1.getData().add(new XYChart.Data(austria, 25601.34)); // series1.getData().add(new XYChart.Data(brazil, 20148.82)); // series1.getData().add(new XYChart.Data(france, 10000)); // series1.getData().add(new XYChart.Data(italy, 35407.15)); // series1.getData().add(new XYChart.Data(usa, 12000)); series2.setName("2004"); // series2.getData().add(new XYChart.Data(austria, 57401.85)); // series2.getData().add(new XYChart.Data(brazil, 41941.19)); // series2.getData().add(new XYChart.Data(france, 45263.37)); // series2.getData().add(new XYChart.Data(italy, 117320.16)); // series2.getData().add(new XYChart.Data(usa, 14845.27)); series3.setName("2005"); // series3.getData().add(new XYChart.Data(austria, 45000.65)); // series3.getData().add(new XYChart.Data(brazil, 44835.76)); // series3.getData().add(new XYChart.Data(france, 18722.18)); // series3.getData().add(new XYChart.Data(italy, 17557.31)); // series3.getData().add(new…
type: UnansweredQuestion
tagged with: javafx-2

http://stackoverflow.com/comment/33218857
has text: this will give only one address of US. but sting contains 2 addresses... i want both in output.. and number of addresses may increase as string will b changed.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21930402

http://stackoverflow.com/comment/33241666
type: QuestionComment
has text: java is case sentitive derived is not equal to Derived
score: 0
comment on: http://stackoverflow.com/q/21942861
type: Comment

http://stackoverflow.com/q/21937211
tagged with: flac
has comment: http://stackoverflow.com/comment/33232348
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/33232210
linked to: http://stackoverflow.com/q/8115775
has comment: http://stackoverflow.com/comment/33233954
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33234184
tagged with: java
has title: Android record in FLAC file
type: Question
has body: How can I make a record with a microphone in FLAC file? I have tried this: import javaFlacEncoder.FLAC_FileEncoder; FLAC_FileEncoder flacEncoder = new FLAC_FileEncoder(); File outputFile = new File(dir + "/flac1.flac"); flacEncoder.encode(file, outputFile); Error: E/AndroidRuntime(5891): java.lang.VerifyError: javaFlacEncoder/FLAC_FileEncoder Whether it is possible to record sound in format Wav using Java 1.6 and android 4.0.3?
has answer: http://stackoverflow.com/a/44394150
has comment: http://stackoverflow.com/comment/33232039
has comment: http://stackoverflow.com/comment/33232204
answer count: 1

http://stackoverflow.com/comment/33202339
score: 0
type: Comment
has text: the last line does not work ! what is Sets? maybe you wanted to use set1.retainAll(set2) ? but it returns bool... help?
comment on: http://stackoverflow.com/a/21920454
type: AnswerComment

http://stackoverflow.com/comment/33255970
type: AnswerComment
has text: Im trying to add them all to an ArrayList of Strings
comment on: http://stackoverflow.com/a/21895278
score: 0
type: Comment

http://stackoverflow.com/comment/137694512
type: Comment
has text: File confFile = new File("./conf/conf.xml"); is java.io, not java.nio ...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21958158

http://stackoverflow.com/comment/33147529
comment on: http://stackoverflow.com/q/21890029
type: Comment
type: QuestionComment
has text: Query "between tomorrow 00:00 and tomorrow 23:59"; now, how you query depends on the API you use
score: 0

http://stackoverflow.com/a/21966518
has comment: http://stackoverflow.com/comment/33284764
downvote count: 0
answers question: http://stackoverflow.com/q/21966357
has comment: http://stackoverflow.com/comment/33284738
has comment: http://stackoverflow.com/comment/33284328
type: Answer
score: 1
upvote count: 1
has body: JavaFX projects are different from Java SE projects. You can sure use JavaFX components in Swing based Java SE applications though. Netbeans supports both JavaFX and Java SE, but if you're working on a JavaFX project, try and follow its rules.

http://stackoverflow.com/q/21944301
has comment: http://stackoverflow.com/comment/33243897
downvote count: 1
has title: Finding Highest Number in a list. If statements not working. Have results. Java
type: Question
tagged with: if-statement
has answer: http://stackoverflow.com/a/21944433
tagged with: arrays
score: -1
has body: I want to find the students with the three highest averages print their name and their average. It seems to find the highest for all three place. I know there may be better ways to do this, if you choose to explain a better way please explain why this doesn't work first. Only the last statements in the results arent working. the results are: The class average for test 1 is: 88 The class average for test 2 is: 62 The class average for test 3 is: 79 Alex's three test average is 85 Barry's three test average is 77 Cindy's three test average is 81 Deb's three test average is 72 Eric's three test average is 75 Fran's three test average is 63 Gary's three test average is 74 Helen's three test average is 83 The student with the highest average is: Alex with a average of: 85 The student with the second highest average is: Alex with a average of: 85 The student with the third highest average is: Alex with a average of: 85 My code is: package lab3; public class third { public static void main(String[] args) { String[] names = { "Alex", "Barry", "Cindy", "Deb", "Eric", "Fran", "Gary", "Helen" }; int[][] grades = { { 77, 83, 96 }, { 88, 67, 78 }, { 92, 77, 76 }, { 94, 42, 81 }, { 99, 54, 72 }, { 90, 46, 54 }, { 76, 59, 88 }, { 94, 69, 88 } }; int S = grades.length; // number of students int E = grades[0].length; // number of exams int sum = 0; for (int a = 0; a &lt; S; a++) { sum = sum + grades[a][0]; } System.out.println("The class average for test 1 is: " + sum / S); sum = 0; for (int a = 0; a &lt; S; a++) { sum = sum + grades[a][1]; } System.out.println("The class average for test 2 is: " + sum / S); sum = 0; for (int a = 0; a &lt; S; a++) { sum = sum + grades[a][2]; } System.out.println("The class average for test 3 is: " + sum / S); for (int a = 0; a &lt; S; a++) { sum = 0; for (int b = 0; b &lt; E; b++) { sum = sum + grades[a][b]; } System.out .println(names[a] + "'s three test average is " + sum / 3); } int firstPlace = 0; String firstPlaceName = ""; int secondPlace = 0;…
upvote count: 0
answer count: 1
tagged with: variables
favorite count: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/33263146
has text: I will look for issues and let You know !!!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21954801

http://stackoverflow.com/q/21913636
accepted answer: http://stackoverflow.com/a/21914154
has answer: http://stackoverflow.com/a/21913855
type: Question
answer count: 4
tagged with: generator
tagged with: numbers
has body: I'm having some trouble with a program that I'm writing. What I need to do is generate random numbers from 0-9, 100 times, and then print the outcome of how many times each numbers is generated. I have to put this all into arrays, one holding the 100 random numbers, and another holding the 'x' times each number was printed. Here is my code so far: import java.applet.Applet; import java.awt.*; public class RandomTölur extends Applet { TextArea t; int[] random; int[] hveOft; int i; int[] k = hveOft; public void init() { t = new TextArea(5, 25); this.add(t); random = new int[101]; random[0] = 0; for(i=1; i&lt;100; i++) { random[i] = random[i]; } for(int k=1; k&lt;10; k++) { t.appendText("Talan " + k + " kom " + random[i] + " sinnum" + "\n"); } } } When it prints out "Talan 'k' kom 'i' sinnum", that means "the number 'k' was printed 'i' times. The problem I'm having is that it doesnt print out how many times each number came out. Is there anyone who can spot my error? Ps. sorry if this post is unproffessional or something, this is my first post on Stackoverflow. Thanks in advance! :) Ps. I've figured this out thanks to the help of you guys, so thanks everyone who reply'd to this :) Much appriciated.
has answer: http://stackoverflow.com/a/21913844
score: 0
tagged with: java
has title: Java arrays, Random num genertor + sorting into arrays
has answer: http://stackoverflow.com/a/21914154
has answer: http://stackoverflow.com/a/21914143
has comment: http://stackoverflow.com/comment/33189700
tagged with: arrays
tagged with: random
has comment: http://stackoverflow.com/comment/33189515
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21913855

http://stackoverflow.com/q/21947323
score: 0
has comment: http://stackoverflow.com/comment/33252808
answer count: 1
tagged with: drop-down-menu
has answer: http://stackoverflow.com/a/21950380
has comment: http://stackoverflow.com/comment/33252208
tagged with: javafx-2
has title: JavaFX menu won't drop down
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21950380
type: Question
has body: I don't know what seems to be the problem with my menu, but when I click on it, it doesn't drop down to reveal menu items such as "New, Open, Save, etc." I've tried looking at other examples, but I don't see any that I may have missed. private MenuItem _fileNew = new MenuItem("New"); private MenuItem _fileOpen = new MenuItem("Open"); private MenuItem _fileSave = new MenuItem("Save"); private MenuItem _fileSaveAs = new MenuItem("Save as..."); private MenuItem _fileExit = new MenuItem("Exit"); private MenuItem _helpAbout = new MenuItem("About " + TITLE + "..."); @Override public void start(Stage primaryStage) throws Exception { Group root = new Group(); MenuBar menuBar = new MenuBar(); Menu menuFile = new Menu("FILE"); _fileNew.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent actionEvent) { System.out.println("New Clicked"); } }); _fileOpen.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent actionEvent) { System.out.println("Open Clicked"); } }); _fileSave.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent actionEvent) { System.out.println("Save Clicked"); } }); _fileSaveAs.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent actionEvent) { System.out.println("Save As Clicked"); } }); _fileExit.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent actionEvent) { System.out.println("Exit Clicked"); } }); menuFile.getItems().addAll(_fileNew, _fileOpen, _fileSave, _fileSaveAs, _fileExit); // HELP MENU Menu menuHelp = new Menu("HELP"); menuHelp.getItems().addAll(_helpAbout); menuBar.getMenus().addAll(menuFile, menuHelp); menuBar.prefWidthProperty().bind(primaryStage.widthProperty()); primaryStage.setTitle(TITLE + VERSION); primaryStage.setX(_bounds.getMinX()); primaryStage.setY(_bounds.getMinY()); primaryStage.setWidth(_bounds.getWidth()); primaryStage.setHeight(_bound…

http://stackoverflow.com/q/21848895
has body: Hi I am developing an desktop application using swing when i am executing the frame window it is displaying at the left side bottom of my screen can i customize that and display at in center of the screen?
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/7143287
has answer: http://stackoverflow.com/a/21849207
type: Question
accepted answer: http://stackoverflow.com/a/21849207
answer count: 2
has comment: http://stackoverflow.com/comment/33073526
downvote count: 0
possible better answer: http://stackoverflow.com/a/21849391
has comment: http://stackoverflow.com/comment/33073322
upvote count: 1
has comment: http://stackoverflow.com/comment/33073491
has title: how to customize and display the frame window at center of my screen in java swing?
favorite count: 0
tagged with: jframe
tagged with: swing
has comment: http://stackoverflow.com/comment/33073606
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21849391

http://stackoverflow.com/comment/33358709
type: Comment
score: 0
has text: Added more details - let me know, if you have more questions :-)
type: AnswerComment
comment on: http://stackoverflow.com/a/21996083

http://stackoverflow.com/q/21924585
score: 0
tagged with: uri-scheme
tagged with: android
accepted answer: http://stackoverflow.com/a/21982099
has title: Android app opening wrong page after using uri scheme
has answer: http://stackoverflow.com/a/21982099
possible better answer: http://stackoverflow.com/a/21925000
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
has body: In IOS I have 2 apps (App A and App B) that will be performing different objective but at 1 point, App A will call App B using uri scheme to perform a function where App A does not have. I wanted to implement this function to Android and currently have developed a demo for initiating call to App B. Now I am working on App B that will be receiving the uri scheme from the demo app. Problem: After App B return to the demo app using uri scheme I close the demo app. When I go back to home page and open the multitask to reopen App B(or open App B through the icon), the page it reopen is the function that is used for demo app but what I wanted is the login page of App B. This is a part of the Manifest for the intent-filter &lt;activity android:name="com.apps.MasterActivity" android:label="@string/app_name" android:screenOrientation="portrait" android:clearTaskOnLaunch="true" android:windowSoftInputMode="adjustPan" &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;intent-filter&gt; &lt;data android:host="x-callback-url" android:scheme="myapp" /&gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;category android:name="android.intent.category.BROWSABLE" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; This is where I call back to the demo app Intent sendIntent = new Intent(Intent.ACTION_VIEW, responseUri); sendIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); finish(); startActivity(sendIntent);
has answer: http://stackoverflow.com/a/21925000

http://stackoverflow.com/q/21863987
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33103653
has answer: http://stackoverflow.com/a/21864408
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/33103826
has body: I've got the following code on my server end: public class ClientThread extends Thread { Socket clientSocket; DataInputStream dis; ObjectInputStream ois; DataOutputStream dos; public ClientThread(Socket acceptedSocket) { clientSocket = acceptedSocket; try { dis = new DataInputStream(clientSocket.getInputStream()); ois = new ObjectInputStream(clientSocket.getInputStream()); // HANGS HERE dos = new DataOutputStream(clientSocket.getOutputStream()); } catch (Exception e) { System.out.println("ClientThread " + e.getMessage()); } } Rest of the class omitted Why does my application freeze when calling the socket inputstream twice, without throwing an exception? Yes, I could just save the inputstream to an InputStream variable and use that variable to get the desired inputstream type, but I'm curious to why it hangs when being called twice from the socket? What's the difference? Being called twice doesn't change anything? EDIT: Even when saving the inputstream to an InputStream variable and using that variable to get the desired inputstream (DataInputStream and ObjectInputStream) it still hangs when called more than once? Example: public class ClientThread extends Thread { Socket clientSocket; InputStream is; DataInputStream dis; ObjectInputStream ois; DataOutputStream dos; public ClientThread(Socket acceptedSocket) { clientSocket = acceptedSocket; try { is = clientSocket.getInputStream(); dis = new DataInputStream(is); ois = new ObjectInputStream(is); // STILL HANGS HERE dos = new DataOutputStream(clientSocket.getOutputStream()); } catch (Exception e) { System.out.println("ClientThread " + e.getMessage()); } } Rest of the class omitted Client-side code: public class LoginLogic_Callable implements Callable&lt;String&gt; { Socket socket; String actionString; String username; String password; public LoginLogic_Callable(Socket sentSocket, String sentUsername, String sentPassword) { socket = sentSocket; username = sentUsername; password = sentPassword; } @Override public String…
accepted answer: http://stackoverflow.com/a/21864408
answer count: 1
upvote count: 6
has comment: http://stackoverflow.com/comment/33103403
favorite count: 0
has title: Thread hangs when creating ObjectInputStream
tagged with: stream
has comment: http://stackoverflow.com/comment/33101211

http://stackoverflow.com/a/21876696
score: 1
accepted answer of: http://stackoverflow.com/q/21875089
answers question: http://stackoverflow.com/q/21875089
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Instead of implementing something on your own, try using an existing and proven solution like spring security, adding a simple user login form and remember me functionality is a matter of configuration in your context XML, Try this tutorial. If you need an alternative then you could also use Apache Shiro.
upvote count: 1

http://stackoverflow.com/q/21912219
downvote count: 0
has answer: http://stackoverflow.com/a/21912341
tagged with: polymorphism
favorite count: 0
score: 6
upvote count: 6
type: AnsweredQuestion
tagged with: oop
has comment: http://stackoverflow.com/comment/33186699
tagged with: java
has title: Java - avoid switch statements for static functions
possible better answer: http://stackoverflow.com/a/21912341
has answer: http://stackoverflow.com/a/21912325
tagged with: switch-statement
accepted answer: http://stackoverflow.com/a/21912325
type: Question
answer count: 2
has body: Check out this code - switch(kind) { case "green" : GreenKind.doSomething(); // Static function break; case "white" : WhiteKind.doSomething(); // Static function break; case "blue" : BlueKind.doSomething(); // Static function break; case "yellow" : YellowKind.doSomething(); // Static function break; } There is a way to avoid the switch statement? as it smells real bad. Maybe to somethnig like this? - kinds.get(kind).doSomething(); The problem with my solution is that the functions are static, and i can't implement an interface with static functions. If you didn't understood why i wrote interface its because i wanted to use polymorphism in my solution above.

http://stackoverflow.com/a/21898724
answers question: http://stackoverflow.com/q/21897347
has body: You may have to send the modem a serial command and wait for it to reply. Looking around the web I found this: AT commands are issued to the modem to control the modems operation and software configuration. The basic command syntax is as follows: &lt;command&gt;&lt;parameter&gt; The &lt;command&gt; is a combination of the attention prefix (AT) followed by the AT command. And then these specific commands (that seem to need that "AT" thing): I10, I11 Displays connection information. If the modem has not connected with a remote DCE the ATI 11 commands returns - No Previous Call. So it seems if you send the modem "ATI10" or "ATI11" it'll tell you it's status, which may include the phone number it's connected to. There's also these commands which might enable printing the incoming number to the serial port: +VCID=&lt;value&gt; Caller ID Use this command to enable or disable caller ID. +VCID=0 Disable caller ID. +VCID=1 Enable caller ID with formatted presentation. +VCID=2 Enable caller ID with out formatting. Again, I think it needs the AT prefix. I have no way to test any of these, but this guide seems to give a good description of a lot of the serial commands and is where I pull my info from: http://www.airlinkplus.com/manuals/m-aml001.pdf
score: 0
type: Answer

http://stackoverflow.com/comment/33242376
score: 0
type: Comment
type: QuestionComment
has text: @TerryChern Maybe I misunderstood, but he said he wanted 3, 2, 4 to return true.
comment on: http://stackoverflow.com/q/21943377

http://stackoverflow.com/q/21932702
has body: I'm new to GUI and I've heard about Timer but I'm not sure how I will apply it to animate the falling motion of a token when the user clicks on one of the drop buttons at the top of the panel. As of the moment I'm only using setIcon() to change one of the empty circles on the board to the color of the current player whenever the player takes his/her turn. Here's a bit of my code: //1 is for green, 2 is for red //Set icon. Know where to place first from setPosition. public void setToken(int token, int i, int j){ if (token == 1){ buttonArray[i][j].setIcon (greentoken); if (active == GREEN){ active = RED; }else if (active == RED){ active = GREEN; } }else if (token == 2){ buttonArray[i][j].setIcon (redtoken); if (active == GREEN){ active = RED; }else if (active == RED){ active = GREEN; } } } //Position checker. //Invoked by checkColFull(). //checkColFull() called after a drop button is clicked and checks if column is full. public void setPosition(int column){ int row; for (row = 0; row &lt; ROWS; ++row){ if (slots[row][column] &gt; 0) break; } if (row &gt; 0){ //save slots[--row][column] = active; setToken(active, row, column); } } public void actionPerformed (ActionEvent e){ //Buttons else if (e.getSource () == b1){ checkColFull (0); } else if (e.getSource () == b2){ checkColFull(1); } else if (e.getSource () == b3){ checkColFull(2); } else if (e.getSource () == b4){ checkColFull(3); } else if (e.getSource () == b5){ checkColFull(4); } else if (e.getSource () == b6){ checkColFull (5); } else if (e.getSource () == b7){ checkColFull(6); } } If the code snippet I provided isn't enough please someone do tell me. Will I have to scrap everything to achieve the falling token animation I'm after? Any hints?
answer count: 0
has comment: http://stackoverflow.com/comment/33225545
tagged with: swing
tagged with: jbutton
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/33227191
score: 0
has title: Connect4 falling animation
tagged with: timer
type: UnansweredQuestion
tagged with: animation

http://stackoverflow.com/a/21961209
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21960140
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21960140
has body: There are several problems I see with your code: Your removeCats function is creating an iterator, not using it, then probably exploding with a ConcurrentModificationException because you're removing things from the pets set while iterating over it. Many of the other answers have pointed this out, and the best way to fix this is to replace this entire function with something like pets.removeAll(cats);. If you really must use an iterator for some reason, you should be iterating over cats, and calling pets.remove(cat); Once this is fixed, you won't crash horribly. However... removeCats will still not do what you expect, since none of the objects in cats are actually present in pets!: Your join function is not doing what I'd expect it to do based on the method signature - it's not joining together the two sets, but instead discarding the inputs and creating a new list. You probably want to do something like pets.addAll(cats); pets.addAll(dogs); Once you fix this issue, your printPets function will work properly, and removeCats will actually have the right effect the way it is being called, since pets will actually contain cats, and not some new instances of them.
type: Answer

http://stackoverflow.com/q/21977103
downvote count: 4
upvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33302935
answer count: 1
has body: The problem is as follows: I have to write a program using static methods which according to what the arguments are like need to return a certain type of information. if the arguments are 2 int-type numbers then it would return the sum of those 2 if one of the arguments is a double-type number then it would return that number squared if the arguments are a string and an in-type number then it would print said string times the int-type number. The problem is that I do not know how exactly this program should look like since there's just one "sample" problem about static methods and that one is nothing like the one I'm being asked to solve. In addition I still haven't figured out why I even need to use this static method if instead I could simply write an if sentence instead. Feels kind of bad to not to be able to figure this out myself but I guess sometimes how have to ask for help. Anyways thanks in advance!
has answer: http://stackoverflow.com/a/22122136
has title: Write a program using static methods
favorite count: 0
has comment: http://stackoverflow.com/comment/33303018
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33303034
score: -4

http://stackoverflow.com/comment/33549538
type: Comment
comment on: http://stackoverflow.com/q/21981842
score: 0
has text: @Alex Thank you for your response. 1) This batch requests are called by a consumer for fetching posts from facebook when it receives a task from a producer (through AmazonSQS). 2) Yes it is going to run on a server
type: QuestionComment

http://stackoverflow.com/q/21912699
favorite count: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/33188942
type: Question
possible better answer: http://stackoverflow.com/a/21914480
has comment: http://stackoverflow.com/comment/33188614
answer count: 2
has answer: http://stackoverflow.com/a/21914480
tagged with: swing
has comment: http://stackoverflow.com/comment/33188529
has body: I'm searching old invoices using customer's name. Usually I select item in jcombo box and press the button to happen the action. It is working properly. I want to know is there any way we can load the action when I selecting the item from jcombo box. Also I want to know how to refresh the jtable. Please be kind to help me.. thank you. This is the source code I write to button's action. private void btnSearchCustomerActionPerformed(java.awt.event.ActionEvent evt) { public void loadOldInvoiceByCustomer(JComboBox comboCustomer, JTable jtable2) { try { ResultSet rs1 = db.getData("SELECT cuid FROM customer WHERE cuname='" + comboCustomer.getSelectedItem().toString().trim() + "' "); while (rs1.next()) { try { ResultSet rs2 = db.getData("SELECT DISTINCT inid FROM invoice WHERE cuid=' " + rs1.getInt("cuid") + " ' "); while (rs2.next()) { ResultSet rs3 = db.getData("SELECT DISTINCT isdate FROM indetails WHERE inid='" + rs2.getInt("inid") + "'"); try { while (rs3.next()) { Vector v = new Vector(); DefaultTableModel df = (DefaultTableModel) jtable2.getModel(); v.add(rs2.getInt("inid")); v.add(comboCustomer.getSelectedItem().toString()); v.add(rs3.getString("isdate")); df.addRow(v); } } catch (Exception e) { JOptionPane.showMessageDialog(null, this.getClass().getName() + " " + "rs3" + e); } } } catch (Exception e) { JOptionPane.showMessageDialog(null, this.getClass().getName() + " " + "rs2" + e); } } } catch (Exception e) { JOptionPane.showMessageDialog(null, this.getClass().getName() + " " + "rs1" + e); } } }
tagged with: jcombobox
has comment: http://stackoverflow.com/comment/33188296
has comment: http://stackoverflow.com/comment/33187619
has comment: http://stackoverflow.com/comment/33189134
score: 0
has comment: http://stackoverflow.com/comment/33187752
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21912880
downvote count: 1
has comment: http://stackoverflow.com/comment/33188472
has comment: http://stackoverflow.com/comment/33188779
has comment: http://stackoverflow.com/comment/33188786
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21912880
has comment: http://stackoverflow.com/comment/33188229
has title: How to happend an action when selecting item in jcombo box

http://stackoverflow.com/q/21871568
has comment: http://stackoverflow.com/comment/36665079
has comment: http://stackoverflow.com/comment/38243792
has answer: http://stackoverflow.com/a/48984485
has comment: http://stackoverflow.com/comment/36822202
answer count: 2
has comment: http://stackoverflow.com/comment/36666678
tagged with: firefox
downvote count: 1
has title: Xlib: extension "RANDR" missing on display ":99"
favorite count: 0
upvote count: 9
type: UnansweredQuestion
score: 8
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/25564753
tagged with: java
has comment: http://stackoverflow.com/comment/38413350
has body: I have run into an issue. Whenever I run my test class it is showing the following error: Testsuite: com.lo.test.selenium.AssignCampaignTestCase Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 46.991 sec ------------- Standard Error ----------------- org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: Xlib: extension "RANDR" missing on display ":99". *** LOG addons.manager: Application has been upgraded *** LOG addons.xpi: startup *** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID: /tmp/anonymous4942696774897131989webdriver-profile/extensions/webdriver-staging *** LOG addons.xpi: checkForChanges *** LOG addons.xpi-utils: Opening database *** LOG addons.xpi-utils: Creating database schema *** LOG addons.xpi: New add-on fxdriver@googlecode.com installed in app-profile *** LOG addons.xpi: New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global *** LOG addons.xpi: Updating database with changes to installed add-ons *** LOG addons.xpi-utils: Updating add-on states *** LOG addons.xpi-utils: Writing add-ons list *** LOG addons.manager: shutdown *** LOG addons.xpi: shutdown *** LOG addons.xpi-utils: shutdown *** LOG addons.xpi-utils: Database closed Xlib: extension "RANDR" missing on display ":99". *** LOG addons.xpi: startup *** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID: /tmp/anonymous4942696774897131989webdriver-profile/extensions/webdriver-staging *** LOG addons.xpi: checkForChanges *** LOG addons.xpi: No changes found at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:109) at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:245) at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:109) My test class: package com.lo.test.selenium; import static org.junit.Assert.assertTrue; import static org.junit.Ass…
tagged with: selenium
type: Question

http://stackoverflow.com/comment/33153106
score: 0
type: AnswerComment
has text: oh sorry what I mean is that in between the `la 789` as well as `789 ferrari`is separate by a single space. sorry for the confusion..
type: Comment
comment on: http://stackoverflow.com/a/21889006

http://stackoverflow.com/comment/33068487
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21846052
has text: I have already used trim() while calling asynctask, but this doesn't help.
score: 0

http://stackoverflow.com/q/21872102
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21872322
has comment: http://stackoverflow.com/comment/33138324
accepted answer: http://stackoverflow.com/a/21872290
type: Question
answer count: 2
tagged with: libgdx
has comment: http://stackoverflow.com/comment/33115190
downvote count: 0
has title: NullPointerException with libgdx
tagged with: nullpointerexception
tagged with: android
favorite count: 0
score: 2
has answer: http://stackoverflow.com/a/21872290
upvote count: 2
has body: I want to make text appear on the screen, using the code below but whenever I run this portion of code, it gives an error, NullPointerException. batch.begin(); batch.draw(paper, pos.x, pos.y); batch.draw(trash, position.x, position.y); font.setColor(1.0f, 1.0f, 1.0f,1.0f); font.draw(batch, str, 25, 160); batch.end(); To be more precise the part of code that is causing the error is: batch.begin(); font.setColor(1.0f, 1.0f, 1.0f,1.0f); font.draw(batch, str, 25, 160); batch.end(); And if needed, the whole program looks like this package com.me.fixGame; import java.util.Random; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.graphics.GL10; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.Table; public class fixGame implements ApplicationListener { SpriteBatch batch; SpriteBatch spriteBatch; Texture trash; Texture paper; SpriteBatch spritebatch; Vector2 position; Vector2 size; Vector2 size2; Vector2 pos; Rectangle bounds; Rectangle bounds2; int score = 6; CharSequence str = "Hello World!"; BitmapFont font; boolean collision = false; @Override public void create() { spriteBatch = new SpriteBatch(); trash = new Texture(Gdx.files.internal("data/trash.png")); paper = new Texture(Gdx.files.internal("data/paper1.jpg")); position = new Vector2(100, 50); pos = new Vector2(54, 14); batch = new SpriteBatch(); size2 = new Vector2(trash.getWidth() ,trash.getHeight() ); //size2.y = trash.getHeight(); //size2.x = trash.getWidth(); size = new Vector2(paper.getWidth() ,paper.getHeight()); bounds= new Rectangle(pos.x, pos.y, size.x, size.y); bounds2= new Rectangle(position.x, position.y, size2.x, size2.y); } @Override public void dispose() { } public…
has answer: http://stackoverflow.com/a/21872322

http://stackoverflow.com/comment/33264631
type: QuestionComment
has text: You need to learn to use a dependency-management tool, and Maven is the default for most of the standard tools (though Gradle is mostly interoperable). m2eclipse is an Eclipse plugin (available in the marketplace, I think) that lets Eclipse use Maven dependency management. In a Maven project, adding the Neo4J dependency will also include all the jars it needs, such as JAX-WS.
comment on: http://stackoverflow.com/q/21954850
score: 0
type: Comment

http://stackoverflow.com/a/21976881
has comment: http://stackoverflow.com/comment/33312394
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/33303007
has comment: http://stackoverflow.com/comment/33302895
upvote count: 1
has body: Just have a text field that becomes visible (or keep it visible the whole time) when other is selected. On the back end if other is selected read the value of the parameter sent from that text box.
answers question: http://stackoverflow.com/q/21976867

http://stackoverflow.com/q/21855988
downvote count: 0
has comment: http://stackoverflow.com/comment/33105983
favorite count: 0
has comment: http://stackoverflow.com/comment/33085899
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21871221
tagged with: maven
has title: Is there any way to excute a batch file from maven configuration?
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/71408834
has comment: http://stackoverflow.com/comment/33086222
type: Question
score: 3
has body: I have a .bat file that executes some pre-requisites of the build of my Maven project, and I want to execute this .bat file automatically when the project that I developed is built. Is there any way to perform this task with Maven? I saw another question about something similar but it didn't solve my problem.
has comment: http://stackoverflow.com/comment/33109335
linked to: http://stackoverflow.com/q/3491937
has comment: http://stackoverflow.com/comment/33085968
tagged with: batch-file
answer count: 2

http://stackoverflow.com/a/21920473
has comment: http://stackoverflow.com/comment/33203232
has comment: http://stackoverflow.com/comment/33202747
has body: Not sure if this is your issue but since you are annotating the fields (instance variables) and not the properties (get or set method) you need to annotate your class with @XmlAccessorType(XmlAccessType.FIELD). If you don't JAXB will throw a "duplicate property" exception which could manifest itself as the problem you are seeing.
score: 0
has comment: http://stackoverflow.com/comment/33203138
type: Answer
has comment: http://stackoverflow.com/comment/33202190
answers question: http://stackoverflow.com/q/21920293
has comment: http://stackoverflow.com/comment/33203693

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/21993755
tags question: http://stackoverflow.com/q/21868753
tags question: http://stackoverflow.com/q/21945322
type: Tag

web-applications
tags question: http://stackoverflow.com/q/21898483
tags question: http://stackoverflow.com/q/21962380
tags question: http://stackoverflow.com/q/21966840
tags question: http://stackoverflow.com/q/21935447
tags question: http://stackoverflow.com/q/21849179
tags question: http://stackoverflow.com/q/21854358
tags question: http://stackoverflow.com/q/21985695
tag name: web-applications
tags question: http://stackoverflow.com/q/21985600
tags question: http://stackoverflow.com/q/21959831
type: Tag
tags question: http://stackoverflow.com/q/21992670
tags question: http://stackoverflow.com/q/21906712

http://stackoverflow.com/comment/33209806
comment on: http://stackoverflow.com/a/21925136
type: Comment
score: 1
has text: I was actually looking at this, but was unsure how to update the array/catch swipes. Could you provide your `FragmentPagerAdapter` or `FragmentStatePagerAdapter` implementation for me? Thanks
type: AnswerComment

http://stackoverflow.com/a/21968523
type: Answer
has body: You haven't set your java path, first set the class path, or use change in your environment variables and write like this name=path value=C:\Program Files\Java\jdk1.7.0_09\bin; or try this set path=C:\Program Files\Java\jdk1.7.0_09\bin;//your path to jdk bin echo shell_exec("javac test.java 2&gt;&amp;1"); echo exec("java test 2&gt;&amp;1"); Which is given above by @lakshman
score: 0
answers question: http://stackoverflow.com/q/21968358

http://stackoverflow.com/q/21856550
has body: I need to work with the Confluence API. I work with Maven POM but I don't find how to insert the dependencies for the Confluence API. Can you help me? What I've already tried: I need to work with the SpaceManager primaly. I found this tutorial about managing the pom. So after the tutorial, my pom looks like the following: 4.0.0 ***.createspace CreateSpace 0.0.1-SNAPSHOT jar CreateSpace http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> com.atlassian.maven.plugins maven-confluence-plugin 3.2.3 true ${product.version} junit junit 3.8.1 test com.atlassian.confluence confluence ${confluence.version} provided The *** in the groupId is just to hide my package name of my company. But also with this pom, I get the error The import com.atlassian cannot be resolved with this import: import com.atlassian.confluence.spaces.SpaceManager; So can you help me? Or please tell me what I should add to avoid downvotes, then I hope you see I really searched in the net and need help!
has comment: http://stackoverflow.com/comment/33090611
favorite count: 0
has comment: http://stackoverflow.com/comment/33090521
possible better answer: http://stackoverflow.com/a/21856668
has comment: http://stackoverflow.com/comment/33167228
has title: How to import the Confluence API with Maven?
has comment: http://stackoverflow.com/comment/33086746
tagged with: pom.xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33091165
tagged with: maven
has answer: http://stackoverflow.com/a/41752786
type: Question
has answer: http://stackoverflow.com/a/21856668
accepted answer: http://stackoverflow.com/a/21857119
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33185211
upvote count: 3
has answer: http://stackoverflow.com/a/21857119
downvote count: 2
has comment: http://stackoverflow.com/comment/33087625
answer count: 3

http://stackoverflow.com/comment/33217377
comment on: http://stackoverflow.com/a/21924592
type: Comment
score: 0
type: AnswerComment
has text: I think I understand what you are after. See the edit at the bottom of my answer.

http://stackoverflow.com/comment/33182437
score: 0
type: Comment
has text: Nope, it is not because of datapoint list. removing assertion statement makes the test pass.
comment on: http://stackoverflow.com/a/21909321
type: AnswerComment

http://stackoverflow.com/comment/33096286
has text: Correction: None of the statements create a new object, because referencing a String literal does not create a new object.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21860863

http://stackoverflow.com/comment/33273127
comment on: http://stackoverflow.com/q/21951482
has text: The Java 6 to Java 7 transition can cause unpredictable problems. It sometimes helps to set up a new development environment (Eclipse etc) that never had any Java 6 in it, and copy only your source files into that.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33254329
type: AnswerComment
type: Comment
has text: What do you mean not eve try to understand, do you even try to explain? i spent hours trying to do this by my self before I came here. Don't think that I just sat for 5minutes, thought"Aaaghh.. I don't know how to do it ,so I'll just post it on stackoverflow and some guy will help me" I tried to do it by my self and it didn't work, so don't you dare say that I didn't try to understand it. By the way, you are more then welcome to explain it.
comment on: http://stackoverflow.com/a/21946019
score: 0

http://stackoverflow.com/q/21928389
tagged with: gettime
score: 0
answer count: 1
has title: Android trying to display GPS getTime() result is crashing the app
type: UnansweredQuestion
tagged with: android
has body: I'm building an Android app using GPS localization, and for that purpose I need first to display localization parameters like speed, time of last fix, deltatime, distance, an so on. No problem with speed, but as soon as I try to display the getTime(0) result in the textView, the app crashes right after getting the first GPS fix. I don't know how to get the stack view as I'm testing the app directly on my phone, on real GPS signal. I had hard time configuring the journey simulation via GPX data file (the emulator keeps restarting when I'm trying to simulate the GPS signal), so I went directly to work on the real phone. Here are the key elements for the problem : public void displayText(Integer input, double t1, double t0, int signal, int counter) { tv.setText(String.valueOf(input)); t1tv.setText("t1 : "+String.valueOf(t1)); t0tv.setText("t0 : "+String.valueOf(t0)); signaltv.setText("Signal : "+signal); countertv.setText("Counter : "+counter); } private class MyLocationListener implements LocationListener { Integer counter = 0; public void onLocationChanged(Location loc) { if (loc != null) { Integer fix=0; Double speed = 0.0; if (loc.hasSpeed()) { speed = loc.getSpeed() * 1.0; fix=2; speed = speed * 3.6d; displayText(speed.intValue(), loc.getTime(), 0.0, fix, counter); //having the "loc.getTime()" sent to the displayText method is making the app crash. } else { try { // Here I have some other code, but it's irrelevant for the occasion as not used when the app chrashes. } catch (NullPointerException e) { } } counter = (counter + 1) % data_points; } } Nothing too complicated I assume, but I'm quite new to programming in Java (been working years on Pascal/Delphi programming), and I kindly asking you for any help. UPDATE : I changed the function to getElapsedRealtimeNanos(), changed min API to 17, swapped to another VM and managed to run the GPS emulation, and still the app crashes, but now at least I have some trace : 02-21 07:57:08.942: W/dalvikvm(1131): threadid=1: thr…
has answer: http://stackoverflow.com/a/21928643
tagged with: gps
tagged with: java
type: Question

http://stackoverflow.com/comment/33246098
score: 0
type: Comment
type: QuestionComment
has text: Clients does not suppose to be html / js in general. Anyway i prefer to validate data serverside cause its safer and i need to check and store more data
comment on: http://stackoverflow.com/q/21942179

http://stackoverflow.com/comment/33240255
has text: based on the documentation, the answer is no.
comment on: http://stackoverflow.com/q/21942367
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33208618
comment on: http://stackoverflow.com/q/21924364
score: 0
type: Comment
type: QuestionComment
has text: Basically, it's the formula for distance of a line: sqrt((x1-x2)^2+(y1-y2)^2). I tried with just a simple 1,1 and 2,2. Expected output was 1.41, what I got was 0.0

http://stackoverflow.com/a/21937133
upvote count: 2
has body: This woks perfectly ok. public interface Trail { public static final String[] STRINGS = {"bla","bla","bla","bla", "bla", "bla"}; } Implementation public class X implements Trail{ public void get() { System.out.println(STRINGS[1]); } } public class TEstMain { public static void main(String[] args) { X x = new X(); x.get(); } Output: bla
type: Answer
answers question: http://stackoverflow.com/q/21936973
score: 2
downvote count: 0

http://stackoverflow.com/comment/33256321
comment on: http://stackoverflow.com/q/21950439
has text: Yes. Answers from users @ Lashane and @ Leos Literak went useful to me :) @KillerR
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21948551
score: 2
type: AnsweredQuestion
has title: Java JFrame setting custom opacity
downvote count: 0
favorite count: 0
type: Question
has body: How do I change the opacity of a jframe from user input, lets say from a spinner? int opacity = 7; double dOpacity = opacity/10; String sOpacity = Double.toString(dOpacity)+"f"; this.setOpacity(sOpacity); //??? The above code produces a bunch of errors. Is there anyway to get a opacity number, lets say 6, and then convert it to a value that 'this.setOpacity(sOpacity);' will accept? errors : Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: GuiClock.Main.setOpacity at GuiClock.Main.cinitComponents(Main.java:97) at GuiClock.Main.&lt;init&gt;(Main.java:16) at GuiClock.Main$6.run(Main.java:168) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:703) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
has answer: http://stackoverflow.com/a/21948698
has comment: http://stackoverflow.com/comment/33251799
accepted answer: http://stackoverflow.com/a/21948698
upvote count: 2
tagged with: jframe
answer count: 3
has answer: http://stackoverflow.com/a/21948567
has answer: http://stackoverflow.com/a/21948559
possible better answer: http://stackoverflow.com/a/21948567
has comment: http://stackoverflow.com/comment/33251691
tagged with: java

http://stackoverflow.com/q/21881484
linked to: http://stackoverflow.com/q/4081763
tagged with: copy
has title: How to chose which file to copy?
has body: I got this code to copy file from App directory to folder on SD card and use that file to set as ringtone. But there is something that I don't understand. How can I determine which file to take? Let's assume I have 1 file named fusrodah in raw folder. How can I make my app to pick that file and copy it to sdcard folder? private int size; private static final int BUFFER_LEN = 1024; private void copyFile(AssetManager assetManager, String fileName, File out) throws FileNotFoundException, IOException { size = 0; FileOutputStream fos = new FileOutputStream(out); InputStream is = assetManager.open(fileName); int read = 0; byte[] buffer = new byte[BUFFER_LEN]; while ((read = is.read(buffer, 0, BUFFER_LEN)) &gt;= 0) { fos.write(buffer, 0, read); size += read; } fos.flush(); fos.close(); is.close(); } public void onClick(View arg0) { AssetManager assetManager = getAssets(); File file = new File(Environment.getExternalStorageDirectory(), "/myRingtonFolder/Audio/"); if (!file.exists()) { file.mkdirs(); } String path = Environment.getExternalStorageDirectory() .getAbsolutePath() + "/myRingtonFolder/Audio/"; File out = new File(path + "/", "fusrodah.mp3"); if(!out.exists()){ try { copyFile(assetManager, "fusrodah.mp3", out); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }
tagged with: android
has answer: http://stackoverflow.com/a/21881603
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/21881603
type: Question
answer count: 1
tagged with: string

http://stackoverflow.com/comment/33140512
has text: thanks for your help , I've added the hybridHTTPReuest and my jobj is getting deference do you know anyway to prevent this.
type: Comment
comment on: http://stackoverflow.com/a/21883338
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33301053
has text: What does your file look like? Since you're getting Strings out of it, smells like it should be a text file, and if so, use a Reader or Scanner, not a DataInputStream. Please display a goodly portion of your data file.
comment on: http://stackoverflow.com/q/21976093
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21950468
downvote count: 0
type: Answer
has body: I can see a glaring mistake. This is the implementation of your Track_Thread classes run method. public void run() { } So, when you do this: threads[j] = new Thread(new Track_Thread(jobs[j])); threads[j].start(); ..... the thread starts, and then immediately ends, having done absolutely nothing. Your run(String[]) method is never called! In addition, your approach of iterating the map and then clearing it while other threads are simultaneously adding is likely to lead to entries occasionally being removed from the map without the iteration actually seeing them. While I have your attention, you have a lot of style errors in your code: The indentation is a mess. You have named your class incorrectly: it is NOT a thread, and that identifier ignores the Java identifier rule. Your use of white-space in statements is inconsistent. These things make your code hard to read ... and to be frank, they put me off trying to really understand it.
answers question: http://stackoverflow.com/q/21949816
upvote count: 3
score: 3

http://stackoverflow.com/comment/33304593
type: Comment
has text: @VexSilver [SPOILER WARNING] Start with assuming the first one is the minimal value. The loop through all other elements and copare them with the current minimal value you found. If it's smaller, replace the minimal one. If you reached the end of the array, you have foudn the smallest one.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21977941

http://stackoverflow.com/comment/33283689
score: 0
has text: @LeeAllan Isn't Code Review for code you already have, which works, and which you want reviewed?
comment on: http://stackoverflow.com/q/21958751
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21907230
type: Question
linked to: http://stackoverflow.com/q/10596417
downvote count: 0
has answer: http://stackoverflow.com/a/21907445
answer count: 1
has title: How to get text value of hidden span using selenium
has comment: http://stackoverflow.com/comment/33177636
favorite count: 0
accepted answer: http://stackoverflow.com/a/21907445
has comment: http://stackoverflow.com/comment/33177673
upvote count: 1
tagged with: selenium-webdriver
type: AnsweredQuestion
has body: I have lithe trouble with getting telefoon nummer from website. The span looks like, &lt;span itemprop="telephone" class="hidden" id="telefoon_28836_hidden"&gt;010 - 79 53 364&lt;/span&gt; I have tried this code telno = driver.findElement(By.xpath("//span[@itemprop='telephone']")).getText(); And i'm getting empty value. This is how to source code looks like after web driver load the page. &lt;div style="float: left; clear: both; padding-right: 7px;"&gt;Adres:&lt;br&gt;&amp;nbsp;&lt;/div&gt; &lt;div itemtype="http://schema.org/PostalAddress" style="float: left; color:#c71d22; width: 400px;"&gt; &lt;span itemprop="streetAddress"&gt;Mathenesserweg 49A BG&lt;/span&gt;&lt;br&gt; &lt;span itemprop="postalCode"&gt;3027 HE&lt;/span&gt; &lt;span itemprop="addressLocality"&gt; Rotterdam &lt;/span&gt; &lt;/div&gt; &lt;div style="float: left; clear: left; width: 70px;"&gt;&amp;nbsp;&lt;br&gt;Telefoon:&lt;/div&gt; &lt;div style="float: left; color:#c71d22; width: 400px;"&gt;&amp;nbsp;&lt;br&gt; &lt;span id="telefoon_28836_visible"&gt;&lt;a href="#" class="countStatistieken" id="telefoon_28836" style="color:#c71d22;"&gt;Klik hier&lt;/a&gt;&lt;/span&gt; &lt;span itemprop="telephone" class="hidden" id="telefoon_28836_hidden"&gt;010 - 79 53 364&lt;/span&gt; &lt;/div&gt; if i use straat = driver.findElement(By.xpath("//span[@itemprop='streetAddress']")).getText(); I am getting "Mathenesserweg 49A BG" it's work fine but i think because of the class="hidden" of telefoon nummer i am getting empty value. Can somebody help me how to resolve this issue. Thank you.
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37219436

http://stackoverflow.com/comment/33328746
score: 0
comment on: http://stackoverflow.com/q/21991942
type: Comment
has text: Merlevede Can you explain me how to do it or have you got any examples of this?? thank you in advance!!
type: QuestionComment

http://stackoverflow.com/q/22002070
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/33348013
score: 0
has comment: http://stackoverflow.com/comment/33347469
has body: I like empire and I am modified AI.But when I test I find I lost a end like this "#end-if". AI script is like this : (defconst gl-current-age 1) (defconst TSA 2) ......&lt;br/&gt; #load-if-not-defined TURKISH-CIV&lt;br/&gt; (defrule&lt;br/&gt; (goal gl-fixed-eco-balancing NO)&lt;br/&gt; (up-compare-goal gl-current-age &gt;= gv-feudal-up)&lt;br/&gt; (building-type-count barracks &gt; 0)&lt;br/&gt; (or (players-unit-type-count focus-player knight-line &gt; 6)&lt;br/&gt; (players-unit-type-count focus-player boyar &gt; 5))&lt;br/&gt; (unit-type-count-total spearman-line &lt; 20)&lt;br/&gt; (timer-triggered 3) (game-time &lt; 2700) ;these are conditions&lt;br/&gt; =&gt;&lt;br/&gt; (up-modify-goal gl-food-gp-points c:+ 10)&lt;br/&gt; (up-modify-goal gl-wood-gp-points c:+ 8) ;these are actions&lt;br/&gt; )&lt;br/&gt; #else&lt;br/&gt; (defrule&lt;br/&gt; (goal gl-fixed-eco-balancing NO)&lt;br/&gt; (up-compare-goal gl-current-age &gt;= gv-feudal-up)&lt;br/&gt; (building-type-count stable &gt; 0)&lt;br/&gt; (or (players-unit-type-count focus-player knight-line &gt; 6)&lt;br/&gt; (players-unit-type-count focus-player boyar &gt; 5))&lt;br/&gt; (unit-type-count-total camel-line &lt; 8)&lt;br/&gt; (timer-triggered 3)&lt;br/&gt; (game-time &lt; 2700)&lt;br/&gt; =&gt;&lt;br/&gt; (up-modify-goal gl-food-gp-points c:+ 10)&lt;br/&gt; (up-modify-goal gl-gold-gp-points c:+ 8)&lt;br/&gt; )&lt;br/&gt; #end-if ;it is just a trigger&lt;br/&gt; ...... I have located the "#load..."which lacks ending but it makes no sense,because it is cross-module:that is problem.At last I decided to delete "(defrule"` and his")" in pairs also its contents and leave main frame,then I can compare the modified one and original one and find out the place . So regular expression comes to my mind but I cannot continue.I am a newbie in programming and I only learn scanner ,how can java find the string(more than one line )when it reads only a single line? Also I am not sure of my expression "(defrule .* =>.*)\n)". …
has comment: http://stackoverflow.com/comment/33347906
tagged with: regex
has comment: http://stackoverflow.com/comment/33347526
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22004516
tagged with: java
has title: java regular expression of block,not single line

http://stackoverflow.com/q/21987507
accepted answer: http://stackoverflow.com/a/21987778
tagged with: jar
score: 0
has answer: http://stackoverflow.com/a/21987778
answer count: 1
tagged with: solrj
tagged with: solr
tagged with: tomcat7
type: AnsweredQuestion
tagged with: java
has title: Tomcat7 cannot start cause by missing class exception of SolrJ
has body: The tomcat on my machine can start and run normal webApps but when add Solr jars to the classpath, it keeps saying: java.lang.NoClassDefFoundError: org/apache/solr/client/solrj/SolrServerException I already imported all necessary jars according to the list from http://wiki.apache.org/solr/Solrj The exception is look like below: Feb 24, 2014 12:03:35 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: /Users/GeorgeG/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:. Feb 24, 2014 12:03:35 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:DemoApp' did not find a matching property. Feb 24, 2014 12:03:36 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Feb 24, 2014 12:03:36 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] Feb 24, 2014 12:03:36 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 819 ms Feb 24, 2014 12:03:36 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Feb 24, 2014 12:03:36 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.50 Feb 24, 2014 12:03:36 PM org.apache.catalina.core.ContainerBase startInternal SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/DemoApp]] at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252) at java.util.concurrent.FutureTask.get(FutureTask.java:111) at org.apache.catalina.core.Co…
type: Question

http://stackoverflow.com/q/21985308
has answer: http://stackoverflow.com/a/21985995
accepted answer: http://stackoverflow.com/a/21991118
type: AnsweredQuestion
score: 22
tagged with: entity-framework
tagged with: java
tagged with: orm
type: Question
upvote count: 22
tagged with: jpa
downvote count: 0
possible better answer: http://stackoverflow.com/a/21985604
has answer: http://stackoverflow.com/a/21985604
has answer: http://stackoverflow.com/a/21991118
answer count: 3
favorite count: 0
has body: I'm trying to get a firm grasp on the concept of Owning-side. Couldn't really get a clear picture from any question i found here. Basically I'm going through the Java EE JPA tutorial. They have the following database schema, where PLAYER and TEAM have a many-to-many relationship Also stated A player can be on many teams. A team can have many players. There is a many-to-many relationship between PLAYER and TEAM. Pretty straight forward so far. But when is gets to the coding part, they make the TEAM the owning side of the relationship. public class Team { private Collection&lt;Player&gt; players; @ManyToMany @JoinTable( name = "PERSITENCE_ROSTER_TEAM_PLAYER", joinColumns = @JoinColumn(name = "TEAM_ID", referencedColumnName = "ID"), inverseJoinColumns = @JoinColumn(name = "PLAYER_ID", referencedColumnName = "ID") ) public Collection&lt;Player&gt; getPlayers() { return players; } } public class Player { private Collection&lt;Team&gt; teams; @ManyToMany(mappedBy = "players") public Collection&lt;Team&gt; getTeams() { return teams; } } Question(s) I have no problem understanding the code. What I can't get a handle on is: 1. How is it determined that TEAM is the owning side? 2. Would it make any difference if PLAYER was made the owning side instead, in this scenario? Also stated from the tutorial. "The entity that specifies the @JoinTable is the owner of the relationship, so the TEAM entity is the owner of the relationship with the PLAYER entity." That being said: 3. Would the above statement make my second question true? Meaning that there is no determining factor besides which one you decide to make the owning side, with the @JoinTable annotation?
has title: How is the "Owning Side" of this many-to-many relationship determined?

http://stackoverflow.com/q/21969404
has comment: http://stackoverflow.com/comment/33289461
has comment: http://stackoverflow.com/comment/33289689
has comment: http://stackoverflow.com/comment/33292865
has comment: http://stackoverflow.com/comment/33289242
has comment: http://stackoverflow.com/comment/33289131
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33289425
has title: Any reason why the onclick event listener not working?
answer count: 0
has comment: http://stackoverflow.com/comment/33289462
type: Question
has comment: http://stackoverflow.com/comment/33290512
tagged with: java
has body: In the code below, the event listner for button savebutton causes a force close error. The cancel button works. else if(menuItemName=="Make Tenant InActive"){ // TODO Auto-generated method stub // get tenant id // inflate the layout // put id in textbox // get date dialog to work! try{ final Dialog dialog = new Dialog(GetTenantList.this); dialog.setContentView(R.layout.tenant_inactive); dialog.setTitle("Make Tenant InActive(Left)"); int pos = menuInfo.position; Tenants t=(Tenants) tenants.getItem(pos); Log.e("id", Integer.toOctalString(t.get_id())); Log.e("Name",t.getFirstName().toString()); int tenantid=t.get_id(); final TextView idtxt =(TextView) dialog.findViewById(R.id.txtID); idtxt.setText(Integer.toString(tenantid)); Button savebutton = (Button) dialog.findViewById(R.id.upadte); savebutton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int myid= Integer.parseInt(idtxt.getText().toString()); EditText dateInActive= (EditText) findViewById(R.id.txtInactive_Date); java.util.Date inactive = null; try { inactive = fm.parse(dateInActive.getText().toString()); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } String InActiveDate=fm.format(inactive); if(InActiveDate.length()==0) { CharSequence msg ="Date InActive not entered"; int duration =Toast.LENGTH_LONG; Toast toast = Toast.makeText(context, msg, duration); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); return; } if(db.IsvalidDate(InActiveDate )==false) { CharSequence msg ="Date must be entered in format yyyy-mm-dd"; int duration =Toast.LENGTH_LONG; Toast toast = Toast.makeText(context, msg, duration); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); return; } try{ db.SetTenantInActive(myid, InActiveDate ); }catch(Exception e) { Log.e("Setting InActive Err", e.toString()); } } }); Button cancelbutton = (Button) dialog.findViewById(R.id.back); cancelbutton.setOnClickListener( new View.OnClickListener() { @Override public void …
score: 0

http://stackoverflow.com/a/21918090
score: 1
answers question: http://stackoverflow.com/q/21917944
upvote count: 1
type: Answer
has body: In short: Your method works as HashMap is designed - you force put to HashMap with same key and first time add value to map, and any other time you just change value of this element because it has same key. Description: You have this situation - You are created HashMap like that: HashMap&lt;String, String&gt; odin = new HashMap&lt;String, String&gt;(); There is first string key and second string value. When you adding value with line: odin.put("test","test"); You are set value test for key test. If you repeat that, you will change old element with key test with new element with key test This results is that entered value is replaced. Instead of this, you have to put in HashMap something else (array for example) with unique key. In this case you can have 10 inputs with same values. Here is example of this HashMap: HashMap&lt;String, String[]&gt; odin = new HashMap&lt;String, String[]&gt;(); In that case you have to provide string key and array of strings which contains values (first names and last names from your question).
downvote count: 0

http://stackoverflow.com/comment/33218225
type: QuestionComment
comment on: http://stackoverflow.com/q/21929989
type: Comment
has text: That is an option, I'm currently migrating a couple of projects to JBoss EAP 6.2 .. but I would really like to figure out if this is due to some error in the developers code or if it's related to some bug in the JBoss AS 7.0.2.
score: 0

http://stackoverflow.com/comment/33194405
score: 0
comment on: http://stackoverflow.com/q/21915936
type: QuestionComment
type: Comment
has text: just until the picture is taken, that is not the issue. That is just a temporal fix because if the activity continues, the picture is not sent with the intent

http://stackoverflow.com/comment/33165696
type: Comment
comment on: http://stackoverflow.com/a/21899682
has text: How to writ a code using thread
type: AnswerComment
score: 0

http://stackoverflow.com/q/21954779
linked to: http://stackoverflow.com/q/9296476
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21955532
favorite count: 0
type: UnansweredQuestion
tagged with: java
tagged with: jaxb
has title: Prevent JAXB unmarshaller from escaping special characters by default
type: Question
has body: I have an XML file which contains an element with special characters or escape characters in it. When I unmarshall this file into a Java object, JAXB automatically escapes these characters. However I do not want them to be escaped and the object should be populated with whatever value is present in the XML file. Snippet of my XML file looks something like this: &lt;Order&gt; &lt;name&gt;Order One &amp;gt;&lt;/name&gt; &lt;price&gt;50&lt;/price&gt; &lt;Order&gt; My JAXB Order class looks like below: @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "Order") public class Order{ @XmlElement private String name; @XmlElement private String price; //skipping getter and setter for brevity On unmarshalling , Order class object's name field has value "Order one >" whereas I want it to be "Order One &amp;gt;" as that is the requirement. I am aware of the solution of putting this value within CDATA so that it doesn't get escaped however the XML file I am unmarshalling is from an outside source and I have no control over the file. I read about a solution on SO where it was suggested of looking for '&amp;' and replacing it. But that solution doesnt look generic and wont apply to all scenarios. Unmarshalling XML with JAXB without unescaping characters I am new to the world of JAXB and trying to find my feet. What I am trying to do might have been done before but I haven't found a solution for doing it. There are several solutions available on SO about escaping characters with JAXB however almost all talk about marshalling. Any help would be appreciated.
score: 4
upvote count: 4
tagged with: unmarshalling

http://stackoverflow.com/comment/33316324
type: Comment
type: AnswerComment
has text: very informative, Thanks!
comment on: http://stackoverflow.com/a/21984907
score: 0

http://stackoverflow.com/comment/33166305
comment on: http://stackoverflow.com/q/21899532
has text: actually its not going in the else block in the controller class. i already checked the province list by printing the result and the list is returned fine. but the problem is how to make it come in the else block.
score: 0
type: Comment
type: QuestionComment

terracotta
tags question: http://stackoverflow.com/q/21937512
tag name: terracotta
type: Tag

http://stackoverflow.com/comment/33281397
has text: FYI (because of your title) BigInteger is _not_ a primitive.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21964937
type: Comment

http://stackoverflow.com/a/53138902
score: 0
type: Answer
has body: The following codes can be used to generate a random permutation for a given set of integers. // random object Random rnd = new Random(); // the entry set ArrayList&lt;Integer&gt; entry_set = new ArrayList&lt;Integer&gt;(); // add element to the entry set for (int i=0; i&lt;5; i++) { entry_set.add(i); } System.out.println("Entry set: " + entry_set); // a random permutation ArrayList&lt;Integer&gt; pi_per = new ArrayList&lt;Integer&gt;(); // entry set size int s = entry_set.size(); while (s &gt; 0) { // get a random index between 0 - s int indx = rnd.nextInt(s); // get the number from the entry set at this index int num = entry_set.get(indx); // delete this number from the entry set entry_set.remove(indx); // add this number to the permutation set pi_per.add(num); // update s s = entry_set.size(); } // print System.out.println("Random Permutation: " + pi_per);
answers question: http://stackoverflow.com/q/21926014

double
tags question: http://stackoverflow.com/q/21995817
tags question: http://stackoverflow.com/q/21924518
tags question: http://stackoverflow.com/q/21875923
tag name: double
tags question: http://stackoverflow.com/q/21973569
type: Tag
tags question: http://stackoverflow.com/q/21938141
tags question: http://stackoverflow.com/q/21978231
tags question: http://stackoverflow.com/q/21955078
tags question: http://stackoverflow.com/q/21886196
tags question: http://stackoverflow.com/q/21864516

http://stackoverflow.com/comment/33300595
score: 1
has text: That'd match 0000000, which isn't a positive number.
comment on: http://stackoverflow.com/a/21974428
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33484970
has text: How can a getClass() get the subclass? It should get the class of the object that is currently calling getClasss
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21993090

http://stackoverflow.com/a/31504057
has comment: http://stackoverflow.com/comment/50971057
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/21904707
score: 0
type: Answer
has body: Please import com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException; I tested and it will work.

http://stackoverflow.com/comment/33122406
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21875412
has text: It's hard to say why, since the reason for why is not shown in your code. What is your game panel? What layout manager do you have in it? GridLayout (if that's what you're using), will add components starting from top/left, filling a complete row with all columns until breaking for the next row. Hence, the first first components should be cards, and the next two should be labels. But, only if the game panel IS a GridLayout...
score: 0

http://stackoverflow.com/a/28745935
score: 14
upvote count: 14
has body: I agree with corsair992 that typically you should not have to make asynchronous calls from an IntentService because IntentService already does its work on a worker thread. However, if you must do so you can use CountDownLatch. public class MyIntentService extends IntentService implements MyCallback { private CountDownLatch doneSignal = new CountDownLatch(1); public MyIntentService() { super("MyIntentService"); } @Override protected final void onHandleIntent(Intent intent) { MyOtherClass.runAsynchronousTask(this); doneSignal.await(); } } @Override public void onReceiveResults(Object object) { doneSignal.countDown(); } public interface MyCallback { public void onReceiveResults(Object object); } public class MyOtherClass { public void runAsynchronousTask(MyCallback callback) { new Thread() { public void run() { // do some long-running work callback.onReceiveResults(...); } }.start(); } }
has comment: http://stackoverflow.com/comment/79445106
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21964375
has comment: http://stackoverflow.com/comment/79456625

http://stackoverflow.com/comment/33232828
has text: public ArrayList<double[]> wallPositions = new ArrayList<double[]>(); public boolean isThereAWall(double[] userPosition){ if (wallPositions.contains(userPosition)); return true; }
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21938141
type: Comment

http://stackoverflow.com/a/21986339
answers question: http://stackoverflow.com/q/21985168
score: 1
upvote count: 1
downvote count: 0
has body: In your code the configuration is not picked up. To change this use the following snippet to initialize your db: GraphDatabaseService graphDb = new GraphDatabaseFactory() .newEmbeddedDatabaseBuilder(Neo4J_DBPath) .loadPropertiesFromFile("confdir/neo4j.properties") .newGraphDatabase(); Make sure neo4j.properties contains allow_store_upgrade=true. Alternatively you can use the deprecated setConfig(name, value) on the factory.
has comment: http://stackoverflow.com/comment/33363129
type: Answer
has comment: http://stackoverflow.com/comment/33366539

http://stackoverflow.com/q/21878714
type: AnsweredQuestion
tagged with: playframework-2.0
tagged with: junit4
tagged with: java
has comment: http://stackoverflow.com/comment/33127433
type: Question
answer count: 8
has body: Here are the files that I use: component.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd"&gt; &lt;context:component-scan base-package="controllers,services,dao,org.springframework.jndi" /&gt; &lt;/beans&gt; ServiceImpl.java @org.springframework.stereotype.Service public class ServiceImpl implements MyService { @Autowired private MyDAO myDAO; public void getData() {...} } ServiceImplTest.java @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath*:conf/components.xml") public class ServiceImplTest{ @Test public void testMyFunction() {...} } Error: 16:22:48.753 [main] ERROR o.s.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@2092dcdb] to prepare test instance [services.ServiceImplTest@9e1be92] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'services.ServiceImplTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private services.ServiceImpl services.ServiceImplTest.publishedServiceImpl; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [services.ServiceImpl] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. D…
downvote count: 0
has answer: http://stackoverflow.com/a/62762278
has comment: http://stackoverflow.com/comment/33127024
has answer: http://stackoverflow.com/a/61791201
has comment: http://stackoverflow.com/comment/33127725
has answer: http://stackoverflow.com/a/64116810
score: 47
has answer: http://stackoverflow.com/a/21879476
has title: How to write JUnit test with Spring Autowire?
has answer: http://stackoverflow.com/a/74921462
has comment: http://stackoverflow.com/comment/131198542
has comment: http://stackoverflow.com/comment/33127666
upvote count: 47
possible better answer: http://stackoverflow.com/a/62762278
has answer: http://stackoverflow.com/a/72281033
favorite count: 0
linked to: http://stackoverflow.com/q/56712707
has answer: http://stackoverflow.com/a/63152645
accepted answer: http://stackoverflow.com/a/21879476
tagged with: spring
has answer: http://stackoverflow.com/a/21878931

http://stackoverflow.com/comment/123377142
type: Comment
comment on: http://stackoverflow.com/a/21904185
has text: Do we always need to consume the output even if we are not interested? Will the called program freeze otherwise?
score: 0
type: AnswerComment

http://stackoverflow.com/q/21971299
type: AnsweredQuestion
tagged with: oop
has title: Java, Type Substitution
tagged with: java
accepted answer: http://stackoverflow.com/a/21971320
type: Question
has comment: http://stackoverflow.com/comment/33292560
has comment: http://stackoverflow.com/comment/33292484
answer count: 2
favorite count: 0
has body: In Java, type substitution is A subclass object can substitute super-class object A super-class object can substitute subclass object A super-class variable can refer subclass object A subclass variable can refer super-class object I am confuse with options which option is right?
possible better answer: http://stackoverflow.com/a/21971319
has answer: http://stackoverflow.com/a/21971319
downvote count: 6
has answer: http://stackoverflow.com/a/21971320
upvote count: 2
score: -4
has comment: http://stackoverflow.com/comment/33292518

http://stackoverflow.com/a/21910094
answers question: http://stackoverflow.com/q/21909777
accepted answer of: http://stackoverflow.com/q/21909777
has comment: http://stackoverflow.com/comment/33223819
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33183983
has comment: http://stackoverflow.com/comment/33223059
has comment: http://stackoverflow.com/comment/33218841
has comment: http://stackoverflow.com/comment/33222627
has body: Read the test case count. int testCaseCount = scanner.nextInt(); Loop over the number of test cases. for (int i = 0; i &lt; testCaseCount; i++) Read the sum. int sum = scanner.nextInt(); Read the array size and construct the array. int arraySize = scanner.nextInt(); int[] array = new int[arraySize]; Loop through the array, populating it. for (int j = 0; j &lt; array.length; j++) array[j] = scanner.nextInt(); Do what you want to do with this data.
type: Answer
has comment: http://stackoverflow.com/comment/33183655
score: 1
has comment: http://stackoverflow.com/comment/33224001
has comment: http://stackoverflow.com/comment/33214169
upvote count: 1

http://stackoverflow.com/q/21872568
has comment: http://stackoverflow.com/comment/33116037
favorite count: 0
has title: java: running thread methods in the same class
has comment: http://stackoverflow.com/comment/33116016
answer count: 5
has answer: http://stackoverflow.com/a/21872618
tagged with: multithreading
has answer: http://stackoverflow.com/a/21872839
downvote count: 1
accepted answer: http://stackoverflow.com/a/21872839
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/21872735
tagged with: java
has answer: http://stackoverflow.com/a/21872862
has body: I have three threads on the same class i.e Thread A obj, Thread B obj, Thread C obj and that class contains 3 static synchronized methods so when we start the 3 threadssaya.meth1, b.meth2, c.meth3what will happen – does all three will execute or only one ?` Update: interviewr asked me this question so actually i do have any code to write it here
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/21872777
possible better answer: http://stackoverflow.com/a/21872618

http://stackoverflow.com/comment/33124173
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21875238
has text: @BrianRoach it is know at compile time if there's a variable declared of a specific type - the problem is related to generics and type inference as I've explained below.
score: 0

http://stackoverflow.com/q/21844000
downvote count: 2
has comment: http://stackoverflow.com/comment/33065195
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33065160
answer count: 1
has body: I'm working with legacy code and I see a lot of (c &amp; 0xff00) != 65280 for a character array (where c is a character). Can anyone tell me what this accomplishes?
favorite count: 0
has answer: http://stackoverflow.com/a/21844141
score: 0
has comment: http://stackoverflow.com/comment/33065445
accepted answer: http://stackoverflow.com/a/21844141
has comment: http://stackoverflow.com/comment/33065359
tagged with: character
has title: What does (x & 0xff00) != 65280 do?
upvote count: 2

http://stackoverflow.com/comment/33259030
has text: Thanks, the collision work now but it seems like the textures are off, or something, might have to make a new post about that, not sure what's causing it. cheers
comment on: http://stackoverflow.com/a/21952647
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33149341
comment on: http://stackoverflow.com/a/21890987
type: Comment
has text: i believe he has some action to be performed on some specific keys press event.
type: AnswerComment
score: 0

http://stackoverflow.com/q/21957421
has comment: http://stackoverflow.com/comment/33267576
tagged with: jdbc
answer count: 0
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/33267559
has comment: http://stackoverflow.com/comment/33267562
linked to: http://stackoverflow.com/q/17784390
type: Question
has title: MySQL datatime NULL
has comment: http://stackoverflow.com/comment/33267620
has body: It's written here [MySQL, how to insert null dates ] that MySQL support NULL in datetime field. I am doing this with Java and get next error: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: 'NULL' for column 'lastvisited' at row 1 If I run in phpmyadmin: UPDATE `linksbase` SET `lastvisited`=NULL WHERE 1 It is updated. What is the problemw ith Java code? prepareStatement("INSERT INTO `linksbase` (`lastvisited`) VALUES ('NULL')"); If I change statement to prepareStatement("INSERT INTO `linksbase` (`lastvisited`) VALUES (NULL)"); Error is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'lastvisited' cannot be null
score: 0
has comment: http://stackoverflow.com/comment/33267546
has comment: http://stackoverflow.com/comment/33267468
has comment: http://stackoverflow.com/comment/33267498
type: UnansweredQuestion

http://stackoverflow.com/comment/33243166
has text: thanks very much :) The spaces are there because stack overflow complains about having http://10.0.2.2:8080 when you ask a question. how would i be able to recive it on the servlet side for if i were to send one or the other or both.
comment on: http://stackoverflow.com/a/21943531
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33262636
type: QuestionComment
comment on: http://stackoverflow.com/q/21932184
has text: @greg-449 Yes, I am using `org.eclipse.ui.newWizards` extension point.
score: 0
type: Comment

http://stackoverflow.com/comment/33182465
has text: @Saurabh sorry, I fix it now
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21909742
score: 0

http://stackoverflow.com/q/21890769
score: 0
linked to: http://stackoverflow.com/q/21480202
has comment: http://stackoverflow.com/comment/33152222
linked to: http://stackoverflow.com/q/4793387
tagged with: aes
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33148955
tagged with: encryption
has body: I am trying to write the Java equivalent of some .NET encryption code so that they can decrypt our information over a webservice. Here is the .NET method: public static string AESEncrypt(string text, string keyPhrase) { byte[] salt = { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 }; byte[] data = Encoding.Unicode.GetBytes(text); PasswordDeriveBytes pdb = new PasswordDeriveBytes(keyPhrase, salt); Rijndael algorithm = Rijndael.Create(); algorithm.Key = pdb.GetBytes(32); algorithm.IV = pdb.GetBytes(16); MemoryStream mStream = new MemoryStream(); CryptoStream cStream = new CryptoStream(mStream, algorithm.CreateEncryptor(), CryptoStreamMode.Write); cStream.Write(data, 0, data.Length); cStream.Close(); byte[] bytes = mStream.ToArray(); return Convert.ToBase64String(bytes); } Here is my failing attempt at a Java version: public static String encrypt(String text, String keyPhrase) throws Exception { byte[] salt = { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 }; byte[] data = text.getBytes("UTF-16LE"); PBEKeySpec spec = new PBEKeySpec(keyPhrase.toCharArray(), salt, 1); SecretKey secret = new SecretKeySpec(keyPhrase.getBytes("UTF-16LE"), "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, secret); byte[] ciphertext = cipher.doFinal(data); return Base64.encodeBase64String(ciphertext); } The first problem I have is figuring out how to match the PasswordDeriveBytes thing for the key and the iv, although I am sure the rest is wrong, but baby steps. Does anyone know how to match the output in the Java version?
has title: Converting .NET AES encryption to Java
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/29794060
tagged with: .net
answer count: 1

http://stackoverflow.com/a/21972891
upvote count: 8
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/87185446
type: Answer
accepted answer of: http://stackoverflow.com/q/21894128
score: 8
answers question: http://stackoverflow.com/q/21894128
downvote count: 0
has body: Finally found the solution. I had to download SIGAR from the official source. Then I had to copy/paste the entire "lib" folder (with all the .so and .dll and whatnot) into the folder "main/src/webapp" of the project, which is used by Spring to store needed apps (or so I assume). Then after running mvn install, checking the "target" folder and running the newly generated .war file, everything runs as expected.

http://stackoverflow.com/a/21935800
score: 1
downvote count: 0
type: Answer
has body: You can try to cast it from string to int. try{ int result = Integer.parseInt(stringValue); } catch (NumberFormatException nfe) { }
has comment: http://stackoverflow.com/comment/33228130
answers question: http://stackoverflow.com/q/21935734
upvote count: 1

split
tags question: http://stackoverflow.com/q/21844012
tags question: http://stackoverflow.com/q/21972205
tags question: http://stackoverflow.com/q/21910271
tag name: split
tags question: http://stackoverflow.com/q/21933312
tags question: http://stackoverflow.com/q/21875177
tags question: http://stackoverflow.com/q/21920137
tags question: http://stackoverflow.com/q/21998029
tags question: http://stackoverflow.com/q/21919140
tags question: http://stackoverflow.com/q/21933053
tags question: http://stackoverflow.com/q/21924826
tags question: http://stackoverflow.com/q/21949110
type: Tag
tags question: http://stackoverflow.com/q/22000569
tags question: http://stackoverflow.com/q/21950344

http://stackoverflow.com/q/21926220
has title: SessionScoped cdi bean injected in filter - not re-inject for different session?
type: Question
tagged with: dependency-injection
upvote count: 2
linked to: http://stackoverflow.com/q/16796320
has body: I have this issue, and I'm not sure if this is "expected" behaviour, but here is my problem: I have a Http Filter: @WebFilter(filterName = "VerificationFilter", urlPatterns = {"/activation/*"}) public class VerificationFilter implements Filter { private static final Logger logger = LoggerFactory.getLogger(VerificationFilter.class); private static final String ACTIVATION_CODE_PARAM_KEY = "vc"; @Inject private UserInfo userInfo; @Inject private ActivationInfo activationInfo; @Override public void init(FilterConfig filterConfig) throws ServletException { logger.debug("************VerificatoniFilter initializing*************"); } /** * This filter filters requests by path - anything in the /activate/ namespace will * be filtered to first determine if the user has already passed through this filter once. * If the user has been "filtered" and the validation code was deemed to be valid, navigation will * be permitted to pass through. If not, then they will be redirected to an error page * * If the user has not yet been filtered, (determined by the presence of details available in the user's * current session), then the filter will check the validation code for validity and/or allow or reject * access. * */ @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!activationInfoPopulated()) { String activationCode = request.getParameter(ACTIVATION_CODE_PARAM_KEY); if (StringUtils.isEmpty(activationCode)) { throwActivationInvalid(); } else { try { ActivationService aService = new ActivationService(); ClPersonInfo info = aService.findActivationCodeUser(activationCode); if (info == null) { throwActivationInvalid(); } userInfo.setClPersonInfo(info); setActivationInfoPopulated(); setActivationValid(); } catch (ServiceUnavailableException sue) { throw new IamwebApplicationException(sue.getMessage()); } } } else { // if the validationCode is not valid, send the user directly to error page. Else, …
answer count: 1
favorite count: 0
tagged with: cdi
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21943181
tagged with: session-scope
score: 2
downvote count: 0
tagged with: java

http://stackoverflow.com/q/21949868
has answer: http://stackoverflow.com/a/21949894
tagged with: io
possible better answer: http://stackoverflow.com/a/21949904
has answer: http://stackoverflow.com/a/21949904
tagged with: parsing
has body: I'm having difficulties fixing my code. The error message I receive is: Exception in thread "main" java.lang.NumberFormatException: For input string: "60 45 100 30 20" at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source) at java.lang.Double.parseDouble(Unknown Source) at Lab3.main(Lab3.java:15) Here is my code: import java.io.*; import java.math.*; public class Lab3 { public static void main(String[] args) throws IOException { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); double pVelocity, pAngle, tDistance, tSize, tElevation; double radians, time, height, pDistance; String input = br.readLine(); String[] values = input.split("\\+"); pVelocity = Double.parseDouble(values[0]); pAngle = Double.parseDouble(values[1]); tDistance = Double.parseDouble(values[2]); tSize = Double.parseDouble(values[3]); tElevation = Double.parseDouble(values[4]); while(pVelocity != 0 &amp;&amp; pAngle != 0 &amp;&amp; tDistance != 0 &amp;&amp; tSize != 0 &amp;&amp; tElevation != 0) { radians = pAngle*(Math.PI/180); time = tDistance/(pVelocity*Math.cos(radians)); height = (pVelocity*time*Math.sin(radians))-(32.17*time*time)/2; pDistance = time*(pVelocity*Math.cos(radians)); if(pVelocity*Math.cos(radians) == 0) System.out.print("The computed distance cannot be calculated with the given data."); else if(height &gt; tElevation &amp;&amp; height &lt;= tSize) System.out.print("The target was hit by the projectile."); else if(height &lt; tElevation) System.out.print("The projectile was too low."); else if(height &gt; tSize) System.out.print("The projectile was too high."); else if(pDistance &lt; tDistance) System.out.print("The computed distance was too short to reach the target."); else if(height &lt; 0) System.out.println("The projectile's velocity is " + pVelocity + "feet per second."); System.out.println("The angle of elevation is " + radians +"degrees."); System.out.println("The distance to the target is " + tDistance + "feet…
type: AnsweredQuestion
has title: Error: java.lang.NumberFormatException
type: Question
accepted answer: http://stackoverflow.com/a/21949894
tagged with: java
score: 0
tagged with: numberformatexception
answer count: 2

http://stackoverflow.com/q/21913413
favorite count: 0
has body: I need to verify digital signature in a pdf file. I use itextpdf and cryptopro cryptopro provides these aliases for the needed algorithm: , JCP: Signature.GOST3411withGOST3410EL -&gt; ru.CryptoPro.JCP.Sign.GostElSign aliases: [1.2.643.2.2.3, OID.1.2.643.2.2.3, 1.2.643.2.2.9with1.2.643.2.2.19] itextpdf tries to get "GOST3411withECGOST3410" and fails with: "no such algorithm: GOST3411withECGOST3410 for provider JCP" This works: Provider prov = Security.getProvider(PROVIDER_NAME); prov.put("Alg.Alias.Signature.GOST3411withECGOST3410", "GOST3411withGOST3410EL"); Not sure it's a correct way though. Exception in thread "main" ExceptionConverter: java.security.NoSuchAlgorithmException: no such algorithm: GOST3411withECGOST3410 for provider JCP at sun.security.jca.GetInstance.getService(GetInstance.java:70) at sun.security.jca.GetInstance.getInstance(GetInstance.java:190) at java.security.Signature.getInstance(Signature.java:324) at com.itextpdf.text.pdf.security.PdfPKCS7.initSignature(PdfPKCS7.java:692) at com.itextpdf.text.pdf.security.PdfPKCS7.&lt;init&gt;(PdfPKCS7.java:452) at com.itextpdf.text.pdf.AcroFields.verifySignature(AcroFields.java:2349) at org.foo.PdfVerifier.verify(PdfVerifier.java:83) at org.foo.PdfVerifier.main(PdfVerifier.java:53)
tagged with: gost3410
score: 2
type: AnsweredQuestion
tagged with: java
has title: How to add an alias to java.security.Provider?
type: Question
upvote count: 2
tagged with: security
has answer: http://stackoverflow.com/a/21933020
accepted answer: http://stackoverflow.com/a/21933020
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33207050

http://stackoverflow.com/a/23059005
upvote count: 5
answers question: http://stackoverflow.com/q/21878812
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/52872480
has comment: http://stackoverflow.com/comment/36807104
has body: You can get your app api_id and app api_hash from your Telegram app page. This is what you'll be using as of this writing. If you are asked a password, provide the mobile phone number you'll be using to develop and Telegram will send you the password.
has comment: http://stackoverflow.com/comment/36828631
score: 5

http://stackoverflow.com/q/21912619
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33187475
downvote count: 0
has comment: http://stackoverflow.com/comment/33187710
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/21913242
has body: I need to validate a string in Java to fulfill the following requirements: string must be 5-32 characters long string can contain letters (a-z), numbers (0-9), dashes (-), underscores (_), and periods (.). string mustn't contain more than one period (.) in a row. Would this regex be be a correct solution? ^(?!([^\\.]*+\\.){2,})[\\.a-z0-9_-]{5,32}$
linked to: http://stackoverflow.com/q/16225015
has answer: http://stackoverflow.com/a/21913242
type: Question
has comment: http://stackoverflow.com/comment/33187519
has comment: http://stackoverflow.com/comment/33187978
has title: Regex for a string with an optional non-repeating dot
has comment: http://stackoverflow.com/comment/33188386
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/33188604
has answer: http://stackoverflow.com/a/21912723
accepted answer: http://stackoverflow.com/a/21912723
has answer: http://stackoverflow.com/a/21912947
has comment: http://stackoverflow.com/comment/33188082
favorite count: 0
has comment: http://stackoverflow.com/comment/33187852

http://stackoverflow.com/comment/33435247
score: 0
type: Comment
has text: I don't think you can require users to install a `.deb` package locally in order to run your web applet, unless you have a very homogenous user base, all of whom are able (`root` or `sudo` privileges, etc) and willing (or forced by policy) to install packages for you.
type: AnswerComment
comment on: http://stackoverflow.com/a/21993243

http://stackoverflow.com/q/21893158
answer count: 4
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/21893423
tagged with: java
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/21893240
accepted answer: http://stackoverflow.com/a/21893393
type: Question
possible better answer: http://stackoverflow.com/a/21893233
has answer: http://stackoverflow.com/a/21893233
has body: I am doing a presence check and I want some code to run if all 10 of my JTextFields are filled in. How could i do this? thanks. This is in java
downvote count: 0
has title: How can I check that a JTextField has something in it?
favorite count: 0
has answer: http://stackoverflow.com/a/21893393

http://stackoverflow.com/a/21942359
answers question: http://stackoverflow.com/q/21942116
has comment: http://stackoverflow.com/comment/46758100
downvote count: 0
has comment: http://stackoverflow.com/comment/37968754
type: Answer
has comment: http://stackoverflow.com/comment/33241510
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/46738538
has comment: http://stackoverflow.com/comment/33240242
has body: if you use: <p:remoteCommand name="remoteSwitchPage" actionListener="#{circuitBean.redirect}" /> JSF will try to find getRedirect, that's why you should use the circuitBean.redirect(). EDIT: i think you should use action instead of actionListener. Here is my example code (tested): HTML: Logout Another part of HTML (end of the page): <h:form prependId="false"> <p:remoteCommand action="#{sessionMB.logout()}" name="logoutAccount" /> </h:form> Bean: public void logout() { account = null; logged = false; FacesUtil.addInfoGrowl(MessageProvider.getMessage("message.logout.success"), null); FacesUtil.redirectToPage("", true); } redirectToPage method: public static boolean redirectToPage(String completePath, Boolean keepMessages) { try { FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(keepMessages); FacesContext.getCurrentInstance().getExternalContext().redirect(SimegoUtil.redirectProject() + completePath); return true; } catch (IOException ex) { FacesUtil.addErrorGrowl(MessageProvider.getMessage("message.redirectFail"), null); return false; } } So, will be like this: Click > call remoteCommand Javascript > call bean > redirect to another page I just didn't get the template part you said, if i can help in something more just tell me, hope you fix it.

http://stackoverflow.com/comment/33190700
comment on: http://stackoverflow.com/q/21914466
type: Comment
type: QuestionComment
score: 0
has text: Can you format this so it is a little easier to read?

http://stackoverflow.com/a/21913034
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21903924
score: 1
has body: Code to do this can be found in the Android source tree. The old screenshot tool reads from the framebuffer device and saves it to PNG. Note this does not work on newer devices, which may use hardware composer overlays to avoid writing to a single framebuffer. On such devices you need to use the screencap tool instead.

http://stackoverflow.com/a/21950295
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21950157
has comment: http://stackoverflow.com/comment/33267770
answers question: http://stackoverflow.com/q/21950157
has comment: http://stackoverflow.com/comment/33255148
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/33267308
has comment: http://stackoverflow.com/comment/33267561
has comment: http://stackoverflow.com/comment/33294315
score: 2
has body: I don't think it's memory management; if it was, you'd get OutOfMemoryError; and in any case, it would not be truncated. It would be interesting to look at FileHelper.getFileFromFullyQualifiedName(), the problem might very well be there. Or, maybe, in your data file? Would it help to break out of the while-loop after a certain count, wthen resume after a few minutes? Absolutely not. I'd make it an aggravated felony if it was up to me. We've got to program defensively: if you think you might have a bug, debug it, find the precise reason for it and fix it; don't brush it under the rug and then leave it to the poor maintenance programmer who'll be debugging a codebase 10,000 times as large ten years down the road at 3 am. If your error is reproducible, add an "if" statement with string comparison, and print or log all variables to see what's really going on. Better yet, use a debugger, and set a conditional breakpoint there when the string begins with /home/baz and step through it examining all variables and seeing what happens. To get a value visible after an exception is thrown, you can assign it to a field variable (the one defined just after the public class ... { line. Good luck!
has comment: http://stackoverflow.com/comment/33255140
has comment: http://stackoverflow.com/comment/33269749
has comment: http://stackoverflow.com/comment/33267477

http://stackoverflow.com/comment/33342868
score: 0
comment on: http://stackoverflow.com/a/21995892
type: Comment
has text: The answer to which is to make sure that one of the logging targets it supports is present in the classpath. I chose log4j, which just needed dropping into my WEB-INF/lib directory.
type: AnswerComment

http://stackoverflow.com/comment/33202355
has text: @tobias_k what would be a better way to constantly update my paint() method then...
comment on: http://stackoverflow.com/q/21919703
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33187263
comment on: http://stackoverflow.com/q/21912476
score: 0
type: QuestionComment
type: Comment
has text: or http://docs.oracle.com/javase/7/docs/api/java/util/Timer.html#scheduleAtFixedRate%28java.util.TimerTask,%20long,%20long%29

http://stackoverflow.com/comment/33349820
type: AnswerComment
comment on: http://stackoverflow.com/a/21948930
score: 0
type: Comment
has text: @StephenC I agree with the second part - but it's not that simple. JDBC doesn't expose a reserved word / keyword list either, and since you have to quote keywords, IMO JDBC should make it easier to quote any identifier found in database metadata. It exposes the "identifier quote character", but it's worse than useless, especially on things like MS SQL Server where identifier quoting is done with the non-standard `[ident]`.

http://stackoverflow.com/comment/33294739
type: Comment
score: 1
has text: Anthony you need to make a better explanation about what is happening to you. We don't know *anything* about what are you trying to achieve. So please explain your problem from the beginning. What you just wrote makes sense to you because you know a lot more than we do about your problem. But read it as if you knew nothing and see how it's unclear. You have to explain: what are you trying to do, how are you trying to do it, why isn't it working and post the errors that occur.
comment on: http://stackoverflow.com/q/21972355
type: QuestionComment

http://stackoverflow.com/q/21852282
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21852644
has answer: http://stackoverflow.com/a/21852451
type: AnsweredQuestion
has body: I can't access my enum variables in my switch-case statement: public enum Country { FRANCE(0, "France"), SPAIN(1, "Spain"); private final int code; private final String name; Country(int code, String name) { // TODO Auto-generated constructor stub this.code = code; this.name = name; } public int getCode() { return code; } public String getName() { return name; } } In another class there is this code : public Drawable getFlag(){ Drawable d = null; switch(country_id){ case Country.FRANCE.getCode(): break; } return d; } But the problem is that when i type Country, there is only class or this.
possible better answer: http://stackoverflow.com/a/21852451
upvote count: 2
tagged with: java
tagged with: switch-statement
type: Question
tagged with: enums
has answer: http://stackoverflow.com/a/21852517
has answer: http://stackoverflow.com/a/21852644
has title: Can't access enum values inside Switch Case / Java
answer count: 3
score: 2

http://stackoverflow.com/q/21858952
tagged with: playframework
has title: Play Framework: Bind from request returns 'null'
accepted answer: http://stackoverflow.com/a/21883057
tagged with: playframework-2.2
has comment: http://stackoverflow.com/comment/33105179
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33122901
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21883057
tagged with: jpa
answer count: 1
has body: I've created an edit view for my model 'Elk', but when I click submit, I only get 'null'. In 'editElk' I prefill the form with data from the database. This data is rendering correctly in the view. The error occurs when I click 'submit'. I've commented the line giving me 'No value'. I've followed the computer-database-jpa sample, but I just cant understand why my form is returning 'no value'. This is my controller: import play.data.*; import static play.data.Form.*; @Transactional(readOnly = true) public static Result editElk(Long id) { Form<Elk> editElkForm = form(Elk.class).fill(Elk.findById(id)); return ok(views.html.tableio.editelk.render("Edit Elg", editElkForm)); } @Transactional public static Result submitEditedElk() { Form<Elk> submittedForm = form(Elk.class).bindFromRequest(); submittedForm.get().toTableData(); // Gives: IllegalStateException: No value] if (submittedForm.hasErrors()) { return ok(views.html.tableio.editelk.render("Edit Elg - Error", submittedForm)); } else { submittedForm.get().update(submittedForm.get().getId()); return TODO; } } And this is my editElk view: @(title: String, elkForm: Form[Elk]) @import helper._ @main(title){ Edit @form(action = routes.TableIO.submitEditedElk()) { @inputText(elkForm("area")) @inputText(elkForm("sex")) @inputDate(elkForm("date")) @inputText(elkForm("weigth")) @inputText(elkForm("veal")) @inputText(elkForm("antlers")) @inputText(elkForm("age")) @inputText(elkForm("twin")) @inputText(elkForm("sumTick")) @inputText(elkForm("sumLice")) Save } } And finally my routes file: GET /editelk/:elkid controllers.TableIO.editElk() POST /submitEditedElk controllers.TableIO.submitEditedElk() Edit As requested, added the Elk class. @Entity public class Elk { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Required private Date date; @Required private int weight; @Required private double age; @Required private int antlers; @Required private int veal; @Required private int twin; @Required @ManyToOne pri…
score: 0

http://stackoverflow.com/comment/33472255
type: Comment
type: AnswerComment
has text: Thanks Tom! The len() function just does sqrt(x*x+y*y) so it will always be positive.
comment on: http://stackoverflow.com/a/22003115
score: 0

http://stackoverflow.com/comment/33275498
score: 0
type: AnswerComment
has text: thanks for the thorough reply! The directions given to me/what I was taught are frustrating. I've been building in the dark. I have swapped everything but the last section of code you suggested gives me a "cannot find symbol" error
type: Comment
comment on: http://stackoverflow.com/a/21961633

http://stackoverflow.com/comment/33343555
comment on: http://stackoverflow.com/q/21999559
score: 0
type: Comment
type: QuestionComment
has text: How are naturalfoods.data and naturalfoods.script being run?

http://stackoverflow.com/comment/33094563
type: Comment
comment on: http://stackoverflow.com/a/21860245
has text: is you use a label instead of JOptionPane the code will work very fine
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33251223
has text: 02-21 19:48:29.390: E/AndroidRuntime(1929): Caused by: java.lang.NullPointerException
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21948225

http://stackoverflow.com/a/21992137
accepted answer of: http://stackoverflow.com/q/21990742
score: 6
upvote count: 7
answers question: http://stackoverflow.com/q/21990742
downvote count: 1
has body: Found a very bad mistake done my me. Forgot to add public static void main(String args[]) in the Thread_Definition class.
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/21976867
downvote count: 1
possible better answer: http://stackoverflow.com/a/21976881
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21978519
has answer: http://stackoverflow.com/a/21976881
score: 1
tagged with: java
has body: I am working with GUIs on my java homework and I have to specify what other is within a JCheckBox. I have everything else finished except for this minor requirement. I'm not quite sure how to go about this, I've looked in my book and tried researching it online Requirement: A series of check boxes where the supervisor can choose which sports events their residents are most interested in (basketball, hockey, swimming, football, soccer, tennis, wrestling, other). Next to the check box that says "other" should be a text box so the supervisor can specify what "other" means. If you need any clarification let me know I'm new to posting here.
type: Question
tagged with: jcheckbox
accepted answer: http://stackoverflow.com/a/21978519
has title: Specify "other"
answer count: 3
has answer: http://stackoverflow.com/a/21977530
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/56527911
comment on: http://stackoverflow.com/a/21969069
has text: @delive [no!](http://stackoverflow.com/questions/20375176/should-i-always-use-a-parallel-stream-when-possible) - it happens to be faster for this specific code but that is not always true.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/39335009
has body: You can also use if else conditions to use show multiple image on selction. Something like this. spinner = (Spinner) findViewById(R.id.spinner1); imageview = (ImageView) findViewById(R.id.imageView1); spinner.setOnItemSelectedListener(new OnItemSelectedListener() { //spinner. @Override public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { if(arg2==0) { imageview.setImageResource(R.drawable.apple); } else if(arg2==1) { imageview.setImageResource(R.drawable.microsoft); } else { imageview.setImageResource(R.drawable.google); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21902360

http://stackoverflow.com/a/21966782
answers question: http://stackoverflow.com/q/21959526
has comment: http://stackoverflow.com/comment/51883527
score: 0
type: Answer
has body: I figured, okay, thank you. How do I encryption the archive? public static void main(String args[]) throws FileNotFoundException, IOException { SevenZOutputFile sevenZOutput = new SevenZOutputFile(new File("outFile.7z")); File entryFile = new File("D:/image.jpg"); SevenZArchiveEntry entry = sevenZOutput.createArchiveEntry(entryFile, entryFile.getName()); sevenZOutput.putArchiveEntry(entry); FileInputStream in = new FileInputStream(entryFile); int len; byte buffer[] = new byte[8192]; int transferedMegaBytes2=0; while ((len = in.read(buffer)) &gt; 0) { sevenZOutput.write(buffer, 0, len); transferredBytes += len; int transferedMegaBytes = (int) (transferredBytes / 1048576); if(transferedMegaBytes&gt;transferedMegaBytes2){ System.out.println("Transferred: " + transferedMegaBytes + " Megabytes."); transferedMegaBytes2=transferedMegaBytes; } } sevenZOutput.closeArchiveEntry(); sevenZOutput.close(); }

http://stackoverflow.com/a/21896460
type: Answer
has comment: http://stackoverflow.com/comment/33159503
score: 0
has body: You can use the following in a method: Map yourMap; count i=0; Iterator it = yourMap.entrySet().iterator(); while (it.hasNext()) { Map.Entry pairs = (Map.Entry)it.next(); if((pairs.getKey()).contains("A")) i++; } return i; Edit: I am still unsure if you want to check whether the key contains or starts with "A" but using the following condition instead would work to check if the key starts with "A": if((pairs.getKey()).startsWith("A")) i++;
has comment: http://stackoverflow.com/comment/33159657
has comment: http://stackoverflow.com/comment/33159645
answers question: http://stackoverflow.com/q/21896415
has comment: http://stackoverflow.com/comment/33159565
has comment: http://stackoverflow.com/comment/33159584
has comment: http://stackoverflow.com/comment/33159558

http://stackoverflow.com/comment/33191400
type: Comment
comment on: http://stackoverflow.com/a/21913346
score: 0
type: AnswerComment
has text: Can you post an [MCVE](http://stackoverflow.com/help/mcve) showing your updated code? It sounds like you're doing something wrong; you should just be able to add your JTextField without calling repaint() or revalidate(). (Unless your component is already visible for some reason, and even then it shouldn't be more than once)

http://stackoverflow.com/comment/33199970
score: 0
type: Comment
type: QuestionComment
has text: Dup http://stackoverflow.com/questions/14217249/sqlite-and-concurrency?
comment on: http://stackoverflow.com/q/21919402

http://stackoverflow.com/q/21976310
type: AnsweredQuestion
tagged with: java
tagged with: methods
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/21976339
accepted answer: http://stackoverflow.com/a/21976339
has comment: http://stackoverflow.com/comment/33301498
tagged with: class
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/33301685
answer count: 1
has comment: http://stackoverflow.com/comment/33301482
has title: How to use an extended class' name in an if statement
has body: I am trying to use an extended class' name inside an if statement. For this class (the giveAwayFish class) it represents a person quitting and returning all their items to the lake and/or giving them away to another fisher (this is only if the item is desirable to the fisher, otherwise it is thrown back into the lake). However if the person quitting catches Treasure (which is a class that has been extended), they keep it and do not return it to the lake or give it to another fisher. I tried writing the method but it is not working for some reason, if anyone can help me out on this it would be great. if anyone is wondering this is inside my Fisher class public void giveAwayFish(Fisher fisher, Lake lake) { for(Catchable item : thingsCaught) { if(item.isDesirableTo(this) &amp;&amp; !getClass().getSimpleName().equals("Treasure")) { fisher.keep(item); this.numThingsCaught = 0; thingsCaught.clear(); //here thingsCaught represents an arraylist of items //of the person who is quitting } else if(getClass().getSimpleName().equals("Treasure")) { this.numThingsCaught = 1; } else { lake.add(item); this.numThingsCaught = 0; thingsCaught.clear(); } sumOfWeight -= item.getWeight(); } }
has comment: http://stackoverflow.com/comment/33301560
has comment: http://stackoverflow.com/comment/33302375

http://stackoverflow.com/comment/35073531
type: Comment
comment on: http://stackoverflow.com/a/21964736
score: 0
has text: @Trein I'd advise against using your hack and use [my](http://stackoverflow.com/questions/19563766/eclipse-kepler-for-os-x-mavericks-request-java-se-6/19594116#19594116) version instead. It is less error prone and decidedly easier to implement. It also enables people to use both 1.6 and 1.7 without breaking either.
type: AnswerComment

http://stackoverflow.com/q/21947616
tagged with: security
score: 0
has answer: http://stackoverflow.com/a/24269291
has title: How does one use a security policy file with Apache Derby and JRE 1.7.0_51?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/21154400
tagged with: java
type: Question
has body: With the advent of Java 1.7.0_51, there are more restrictive security constraints on opening listener sockets than before. These cause Apache Derby's network server to fail to start with the exception java.security.AccessControlException: access denied ("java.net.SocketPermission" "localhost:1527" "listen,resolve") There are various workarounds at Unable to start derby database from Netbeans 7.4, discussing a variation of this, but each seems to involve hacking the JDK's java.policy file. Although I tend to agree with user230146's sentiment that "Oracle seems to be trying to protect us from ourselves in ways that would be more appropriate to naive users," I'm nevertheless quite wary of what black hat hackers can do. I believe that one should grant the minimal privileges to do the job, and no more. More research led to another alternative, which, of course, isn't working (or I wouldn't be asking). At http://apache-database.10148.n7.nabble.com/Network-Server-Access-Permissions-and-Java-1-7-0-51-td136583.html, there is a recommendation that one include two additional properties on the command line invocation, one of which refers to a security file. At https://issues.apache.org/jira/browse/DERBY-6438 (cited therein) there is a link to download a sample security file. I downloaded and modified the security file to explicitly specify the port, by including the statement (where 1527 is hard-coded in lieu of ${derby.security.port}) permission java.net.SocketPermission "localhost:1527", "listen"; and then attempted to start the server with the command java -classpath "C:\Program Files\Apache-derby-10.5.3\lib\*" ^ -Dderby.system.home=%CD% ^ -Djava.security.manager ^ -Djava.security.policy=%CD%\derbynet.policy ^ org.apache.derby.drda.NetworkServerControl start This, however, didn't effect any change whatsoever in the behavior. Has anyone else used this recommendation successfully?
answer count: 1
tagged with: derby

http://stackoverflow.com/comment/33345967
type: Comment
has text: An alternative compromise: instead of using a TreeSet (which makes adding to be *O(log N)* which can get nasty with many users), sort only when sorted order is required, making first lookup after modification to be *O(N*log N)*.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22000999

http://stackoverflow.com/comment/33223899
score: 0
type: QuestionComment
has text: The files can be 5 GB large. I export them to csv, so I can import them to MySQL with "LOAD DATA INFILE".
type: Comment
comment on: http://stackoverflow.com/q/21932628

http://stackoverflow.com/a/21877875
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21877834
score: 4
has body: char ch = 'A'; int code = ch; Now you have the decimal equivalent in code. If you have a String you should do this for each char from the String.
answers question: http://stackoverflow.com/q/21877834
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/33125689
has comment: http://stackoverflow.com/comment/33125265
has comment: http://stackoverflow.com/comment/33125297
downvote count: 0
has comment: http://stackoverflow.com/comment/33125398

http://stackoverflow.com/comment/33354111
type: AnswerComment
type: Comment
has text: It seems like the problem was me trying to access the database from the background thread. It works fine now. Thanks for the help mate, you are awesome
comment on: http://stackoverflow.com/a/22005538
score: 0

http://stackoverflow.com/comment/33241905
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21943269
has text: Do you understand what a deadlock is? Where in your code do you suspect one could occur?

http://stackoverflow.com/a/21986947
upvote count: 1
has comment: http://stackoverflow.com/comment/33351709
downvote count: 0
has body: To get the first element change your code like this Document doc = Jsoup.connect("http://feed43.com/alytus_06.xml").get(); Element ele=doc.select("item title").first(); System.out.println(ele.text()); To get all element with title tag within item Document doc = Jsoup.connect("http://feed43.com/alytus_06.xml").get(); Elements ele=doc.select("item title"); for(Element element:ele) { System.out.println(element.text()); }
has comment: http://stackoverflow.com/comment/33364047
type: Answer
score: 1
answers question: http://stackoverflow.com/q/21986055

http://stackoverflow.com/q/21912399
tagged with: audio
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21912622
tagged with: java
type: Question
has title: Can't play an Audio clip stored in an audio in Android (Must be turned to String)
answer count: 1
has comment: http://stackoverflow.com/comment/33190646
accepted answer: http://stackoverflow.com/a/21912622
score: 0
tagged with: android
has body: I can't seem to get my audio file to replay as the file output won't accept the given argument. Here's the code: final File output = new File(Environment.getExternalStorageDirectory().getPath()); Problem is I can't replay the audio I store in that file (that is the "output" file). I tried to use this: MediaPlayer replayer = new MediaPlayer(getClass().getResource(output)); replayer.play(); I'm using this with an onclicklistener, but I run into the error: "The argument is not valid for this type(file)" And when I turn it to a String file, then the rest of my code turns up bugged. Thanks for helping. I'm relatively new to Android development so I'm opened to all suggestions.

http://stackoverflow.com/a/21860213
type: Answer
has body: You can install a 32bit JVM on a 64 bit OS. Just download it and install it. No special instructions. Just the normal tricks with PATH and JAVA_HOME that you use when you have multiple JVMs installed on the same machine ... as described in the installation instructions. And, yes you can have multiple JVMs installed on the same machine. Just make sure that you don't install one JVM on top of another one. Install each one in a separate directory.
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21859893
downvote count: 0

http://stackoverflow.com/comment/33159037
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21895686
type: AnswerComment
has text: The cast isn't even required.

http://stackoverflow.com/comment/33330224
type: Comment
has text: @Julien, I replaced them with a slightly "prettier" implementation. However, please note that in **all cases** (including my first option, and including your "regex" suggestion), the complexity depends on the length of the input string. In my previous options 2 and 3, the complexity would be slightly higher if the input string was shorter than 22 characters (all possible hex digits). But the difference is pretty minor, and in general, this question doesn't look like a complexity-related issue.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21992220

http://stackoverflow.com/a/21960507
has comment: http://stackoverflow.com/comment/33273511
has comment: http://stackoverflow.com/comment/33274115
upvote count: 3
has comment: http://stackoverflow.com/comment/33273536
downvote count: 1
has body: I'd like to suggest another method. This problem is called "finding the leader" (at least in Polish literature). Let's call an element occuring more than n/2 times the leader of a sequence. The following observation is crucial - if there exists a leader in a sequence, after removing two different elements, the newly created sequence will have exactly the same leader as the original one. Why is that? If there is a leader, after removing two different elements, exactly one of them is the leader. The new sequence has n - 2 elements and more than (n / 2) - 1 occurences of the original leader, hence the original leader is the new leader. You repeat the deletion until all elements are equal. Then you can perform a linear check if the candidate is a leader. Sample code (based on this article, unfortunately unavailable in English): int leader = 0; int number = 0; /* number of occurences of a leader candidate */ for (int k = 0; k &lt; n; k++) { if (number == 0) { //we set first element as a potential leader leader = a[k]; number = 1; } else if (leader == a[k]) //new leader occurence number++; else //delete two different elements number--; } //check if it really is the leader number = 0; for (int i = 0; i &lt; n; i++) if (a[i] == leader) number++; if (number &gt; n / 2) System.out.println(leader); else System.out.println("There is no leader");
type: Answer
has comment: http://stackoverflow.com/comment/33274063
has comment: http://stackoverflow.com/comment/33276728
has comment: http://stackoverflow.com/comment/33275622
has comment: http://stackoverflow.com/comment/33273682
score: 2
answers question: http://stackoverflow.com/q/21960420

http://stackoverflow.com/comment/33201567
has text: For starters, note that as of Java 1.7.0_07, the `substring` method creates a whole new `String`, so you should use `charAt` instead of `substring`, and then you can just use `==` instead of `equals`.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21920137
type: Comment

http://stackoverflow.com/q/21940739
upvote count: 7
score: 7
tagged with: java
tagged with: jboss
tagged with: eclipse
type: Question
has body: I read in other topics, but I can't quite figure this out. I have an EJB module that uses log4j. I want to package that EJB into a JAR file and put in the WEB-INF/lib path of a web project. The web project has a servlet that executes a function from the EJB, and that's it. But seems that the appender doesn't work, for the file is created but not written. I read that a deployment descriptor for JBoss, so I created one based on one of the previous posts. But i get a "Failed to process phase STRUCTURE of deployment" error. 12:04:44,905 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."SampleWeb.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."SampleWeb.war".STRUCTURE: Failed to process phase STRUCTURE of deployment "SampleWeb.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.runWorker(Unknown Source) [rt.jar:1.7.0_21] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_21] at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_21] Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Sub deployment SampleEJB.jar in jboss-structure.xml was not found. Available sub deployments: at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.subDeploymentNotFound(DeploymentStructureDescriptorParser.java:233) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.deploy(DeploymentStructureDescriptorParser.java:…
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/21940808
has answer: http://stackoverflow.com/a/75830523
downvote count: 0
has answer: http://stackoverflow.com/a/47198666
has title: Failed to process phase STRUCTURE of deployment
favorite count: 0
answer count: 3
type: UnansweredQuestion

http://stackoverflow.com/a/21981331
has comment: http://stackoverflow.com/comment/33311470
has comment: http://stackoverflow.com/comment/33314666
upvote count: 3
has comment: http://stackoverflow.com/comment/33317863
has comment: http://stackoverflow.com/comment/33322634
has comment: http://stackoverflow.com/comment/33319844
has comment: http://stackoverflow.com/comment/33312831
has comment: http://stackoverflow.com/comment/33310860
has comment: http://stackoverflow.com/comment/33319693
has comment: http://stackoverflow.com/comment/33317086
has comment: http://stackoverflow.com/comment/33322773
has comment: http://stackoverflow.com/comment/33315293
has comment: http://stackoverflow.com/comment/33322678
has comment: http://stackoverflow.com/comment/33323095
has comment: http://stackoverflow.com/comment/33317309
has comment: http://stackoverflow.com/comment/33321670
has comment: http://stackoverflow.com/comment/33310354
has comment: http://stackoverflow.com/comment/33322263
has comment: http://stackoverflow.com/comment/33312868
has comment: http://stackoverflow.com/comment/33356124
has comment: http://stackoverflow.com/comment/33319527
has comment: http://stackoverflow.com/comment/33322358
has comment: http://stackoverflow.com/comment/33324025
downvote count: 0
has comment: http://stackoverflow.com/comment/33319118
has comment: http://stackoverflow.com/comment/33313602
has body: The problem is that you're not enclosing the string in single quotes: db.delete(TABLE_READINGS, COLUMN_COMPLAINT_NO +"='"+ id + "'", null); Or you can use the more common method, and pass the string as a "where arg": db.delete(TABLE_READINGS, COLUMN_COMPLAINT_NO +"=?", new String[] {id});
has comment: http://stackoverflow.com/comment/33320126
has comment: http://stackoverflow.com/comment/33310457
has comment: http://stackoverflow.com/comment/33355035
has comment: http://stackoverflow.com/comment/33324518
has comment: http://stackoverflow.com/comment/33320375
has comment: http://stackoverflow.com/comment/33313149
type: Answer
has comment: http://stackoverflow.com/comment/33315963
has comment: http://stackoverflow.com/comment/33313512
has comment: http://stackoverflow.com/comment/33323486
answers question: http://stackoverflow.com/q/21981234
score: 3

http://stackoverflow.com/q/21931692
score: 0
has answer: http://stackoverflow.com/a/21931730
answer count: 2
has title: java, generic and getAll
tagged with: generics
has comment: http://stackoverflow.com/comment/33220979
has body: I'm trying to modify my code to avoid all the duplicate code, using generic. I have a class DBBaseClass wich will be extended by some other class. I'm trying to create a getAll method that return all the object of the subclass stored in a database. class abstract DBBaseClass { abstract readDataBase(int _id); public &lt;T extends DBBaseClass&gt; List&lt;T&gt; getAll() { List&lt;T&gt; array = new ArrayList&lt;T&gt;(); ArrayList&lt;Integer&gt; myints = DBManager.request_database_for_ids(getIdField(), getTableName()); T myTObject = new T(); // NOT WORKING ************************* for (int i=0;i&lt;myints.size();i++) { myTObject.read(myints.get(i)); array.add(myTObject); } return array; I have the errors : - Cannot instantiate the type T - The type T is not generic; it cannot be parameterized with arguments &lt;> How can i instanciate my T subclass here ?? What's the trick ?? Thanks. EDIT : To explain more in details my goal : I have two classes SUbClassA and SubClassB that extends DBBaseClass. I want to a method : SubClassA.getAll() that returns an arraylist of SUbClassA objects. SubClassB.getAll() that returns an arraylist of SUbClassB objects. At first, i created getAll in all my subClasses ... So, I'm trying now to put this getAll() in the DBBaseclass. It's easy to do if i want them to return List but i don't know how to tell the method "return me a list of this particular kind of subclass".
possible better answer: http://stackoverflow.com/a/21931730
has answer: http://stackoverflow.com/a/21932246
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21932246

http://stackoverflow.com/a/61901744
has body: In Java 8+, use java.time. java.time.Duration.ofMinutes(15).toMillis();
upvote count: 4
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/121218204
type: Answer
has comment: http://stackoverflow.com/comment/116378240
answers question: http://stackoverflow.com/q/21852754

http://stackoverflow.com/a/21894236
upvote count: 2
answers question: http://stackoverflow.com/q/21892526
type: Answer
score: 2
downvote count: 0
has body: You are not that far from getting things to work. Just a few things to know: Your UI should be started on the Event dispatching thread (EDT) You actually need to add your panels/components to your frame You need to pack() your Window/Frame You need to make it visible (Design stuff, optional but when you are at it, why not just fix that as well), no need to extend JFrame, so let's just drop that. So eventually, taking these advices into consideration leads you to something like this: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingUtilities; public class StatsGUI implements ActionListener { JLabel label; JLabel label2; JTextField input; JTextField output; JButton getButton; JButton exitButton; @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == exitButton) { System.exit(0); } else { String text = input.getText(); output.setText(text + "COUNTER"); } } public void initUI() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); label = new JLabel("Enter number"); panel.add(label); input = new JTextField(10); input.addActionListener(this); panel.add(input); label2 = new JLabel("Statistics"); output = new JTextField(10); output.setEditable(false); panel.add(output); getButton = new JButton("Go"); getButton.addActionListener(this); panel.add(getButton); exitButton = new JButton("Exit"); exitButton.addActionListener(this); panel.add(exitButton); frame.add(panel); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new StatsGUI().initUI(); } }); } }

http://stackoverflow.com/comment/33337546
comment on: http://stackoverflow.com/a/21928433
has text: Thanks for the reply. Can you elaborate on how to use the PrivilegedExceptionAction? I want to run a 'ls' and get the results back.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33201851
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21919550
has text: I'd check for an old version of Apache Commons Net. According to the docs it's been there since 3.0, which is from May 2011.
score: 0

http://stackoverflow.com/comment/33229199
has text: It's because I can't use it. I don't know how.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21935957

http://stackoverflow.com/comment/33141277
type: Comment
has text: I have no database in my machine, and in the server I have access to none database, so, it'll have to be file only. Socket it is, i guess then? =S
comment on: http://stackoverflow.com/a/21886756
type: AnswerComment
score: 0

http://stackoverflow.com/a/21863385
has comment: http://stackoverflow.com/comment/33162110
has body: You can use a @MappedSuperClass or @Entity to declare the @IdClass. The pk is propagated via inheritance. For example, using @MappedSuperClass, you can do the following: @MappedSuperClass @IdClass(IdClassEntity1.class) public class Entity1 { @Id private long e1pk; @Id private long e1pk; ... @Entity public class Entity2 extends Entity1 { ... Using @Entity, follow the same paradigm
upvote count: 1
has comment: http://stackoverflow.com/comment/33203463
answers question: http://stackoverflow.com/q/21844459
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/108196888

http://stackoverflow.com/comment/33313012
type: Comment
comment on: http://stackoverflow.com/q/21983038
has text: The main reason I did my coding in this manner is that I'm starting out, and explicitly declaring what's where made more sense to me at the time. It feels primitive even to me; but I'd rather start with what's intuitive and work my way up to better, more 'kosher' methods.
score: 0
type: QuestionComment

http://stackoverflow.com/a/22002803
has comment: http://stackoverflow.com/comment/33349844
has comment: http://stackoverflow.com/comment/33348966
type: Answer
has comment: http://stackoverflow.com/comment/33349852
has comment: http://stackoverflow.com/comment/33349147
has comment: http://stackoverflow.com/comment/33348639
has comment: http://stackoverflow.com/comment/33349338
has comment: http://stackoverflow.com/comment/33349792
has comment: http://stackoverflow.com/comment/33349178
has comment: http://stackoverflow.com/comment/33349297
accepted answer of: http://stackoverflow.com/q/22002708
has comment: http://stackoverflow.com/comment/33349641
has comment: http://stackoverflow.com/comment/33349051
has comment: http://stackoverflow.com/comment/33349024
answers question: http://stackoverflow.com/q/22002708
has comment: http://stackoverflow.com/comment/33349427
score: 0
has comment: http://stackoverflow.com/comment/33349718
has comment: http://stackoverflow.com/comment/33349514
type: AcceptedAnswer
has body: When you define an object, consider all the things you might like to ask of the object. For example, for a circle object you may want to ask the area, radius, diameter, circumference ... so Don't get seduced into exposing the internal parameters of an object directly. public class Circle { private double radius; public Circle(Double radius) { this.radius = radius;} public double getArea() { return radius*radius*Math.PI; } public double getRadius() { return radius;} public double getDiameter() { return 2*radius;} public double getCircumference() { return Math.PI*getDiameter();} }
has comment: http://stackoverflow.com/comment/33349838

http://stackoverflow.com/comment/33301709
type: QuestionComment
score: 1
has text: http://stackoverflow.com/questions/7887256/sms-broadcast-receiver-doesnt-get-the-textmessage?rq=1 might be a case of adding android:priority="999" in <intent-filter> block, as detailed in the post.
comment on: http://stackoverflow.com/q/21976366
type: Comment

http://stackoverflow.com/q/21964430
type: AnsweredQuestion
tagged with: android-edittext
has answer: http://stackoverflow.com/a/21964585
tagged with: java
tagged with: eclipse
type: Question
has body: So I'm fairly new to Java coding and I'm trying to create a simple code to have an edit text value act as a url for an intent internet command. I'm using this in Eclipse and ADT. The following is my java code. import android.widget.EditText; import android.widget.Button; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View.OnClickListener; import android.view.View; import android.content.Intent; import android.net.Uri; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button2 = (Button) findViewById(R.id.button2); button2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { EditText UR_L=(EditText) findViewById(R.id.ur_l); String sUR_L= new String(UR_L.getText().toString()); Intent brwsrintnt = new Intent(Intent.ACTION_VIEW, Uri.parse(sUR_L)); startActivity(brwsrintnt); } }); In my layout I have a 2 buttons and an edit box but the edit box reflects a missing input type error. I have no idea how to fix this and I've looked many places. Thanks, David
accepted answer: http://stackoverflow.com/a/21964585
score: 0
has title: How to forward edit text box to intent url in ADT?
answer count: 1
tagged with: android

http://stackoverflow.com/comment/33255753
has text: What exactly is the problem you are encountering?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21950804
score: 0

http://stackoverflow.com/q/21912690
has title: Managed Memory StringBuilder
tagged with: memory-management
has comment: http://stackoverflow.com/comment/33188361
tagged with: java
downvote count: 2
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33412441
type: AnsweredQuestion
has body: Problem: JVM OOME caused by appending large files to a String or StringBuilder Proposed solution: Inspired by the org.apache.axis.attachments.ManagedMemoryDataSource class I have wrote a class that keeps a StringBuilder buffer to a certain maximum. When that maximum is reached the class flush the contents of the StringBuilder to disk, and all subsequent appends are done to disk. is there any custom class out there that accomplish this? am I on the right track?
score: -1
has answer: http://stackoverflow.com/a/21912840
has comment: http://stackoverflow.com/comment/33367084
answer count: 2
has comment: http://stackoverflow.com/comment/33309186
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/22143333
accepted answer: http://stackoverflow.com/a/22143333
possible better answer: http://stackoverflow.com/a/21912840

http://stackoverflow.com/comment/33125418
score: 0
type: Comment
has text: @user3222718 checkm y answer..let me know if you dont understand something
comment on: http://stackoverflow.com/a/21877404
type: AnswerComment

http://stackoverflow.com/a/21964122
score: 0
type: AcceptedAnswer
type: Answer
has body: the server could be anywhere the important is what port is listening and for the client is the same. if you need pass across a router you need verify the redirections ports are succefull.
accepted answer of: http://stackoverflow.com/q/21961965
answers question: http://stackoverflow.com/q/21961965

http://stackoverflow.com/a/21946664
type: Answer
answers question: http://stackoverflow.com/q/21946604
has comment: http://stackoverflow.com/comment/33248586
accepted answer of: http://stackoverflow.com/q/21946604
upvote count: 4
has comment: http://stackoverflow.com/comment/33248425
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33248389
score: 4
has comment: http://stackoverflow.com/comment/33248488
has body: You can call it like this: ColorAdapter.this.notifyDataSetChanged(); As an aside, a more appropriate place to launch this AsyncTask would be from it's host fragment/activity, why? AsyncTasks sometimes tend to stick around longer than you expect, if you don't manage their lifecycle appropriately they can cause trouble.

http://stackoverflow.com/a/21956598
upvote count: 3
answers question: http://stackoverflow.com/q/21946167
score: 3
accepted answer of: http://stackoverflow.com/q/21946167
type: AcceptedAnswer
has body: Creator of ParseKit here. ParseKit does not have a Channels feature, nor does it have a -&gt; tree rewrite feature as ANTLR does. (In general, ParseKit is not as fully-featured as ANTLR). However, you can probably achieve the effect you are looking for using ParseKit's discard feature. When designing your ParseKit grammar, there are often tokens in your language which are pure syntax. These tokens are not important for computing a result nor for building an abstract syntax tree (for further processing). You'll usually want to automatically discard these tokens using the ParseKit ! directive. For example, say you have a rule in your ParseKit grammar called primaryExpr like: primaryExpr = atom | '(' expr ')'! ; Notice the ! after the close parenthesis ')'. This is the discard directive which instructs the ParseKit tokenizer to discard the ) token from the token stream reported to your ParseKit assembler (delegate) callbacks. So in your -parser:didMatchPrimaryExpr: callback, the assembly parameter's stack will not contain the ) token. The ) token will have already been discarded. Discarding is desirable in this case, as the ) is pure syntax which is not important for processing the relevant parenthesized expression. So to discard an unimportant token in your grammar, place a ! directive immediately after it.
downvote count: 0
has comment: http://stackoverflow.com/comment/33337313
has comment: http://stackoverflow.com/comment/33335814
type: Answer

http://stackoverflow.com/comment/33283397
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21965869
has text: I think, you should make your unique UserAgent a configurable parameter and/or read if from a configuration file instead of hard-coding it into your sources anyway.

http://stackoverflow.com/q/21868197
has body: I have a problem on waiting for an iframe and switching to it when I know only part of its name. The name is unique every time the page is loaded. The pattern is "Framexxxxxxx" where "xxxxx" are random numbers. Is there any way to make webdriver ExpectedConditions.frameToBeAvailableAndSwitchToIt() to find that iframe? So far I've tried: By.xpath(".//*[starts-with(name(),'Frame')]") By.xpath("iframe[starts-with(@name,'Frame')]") and some other ways - no luck. Thanks in advance.
tagged with: iframe
answer count: 3
tagged with: selenium
has answer: http://stackoverflow.com/a/21873823
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/21871057
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/30896948
type: Question
accepted answer: http://stackoverflow.com/a/21871057
possible better answer: http://stackoverflow.com/a/30896948
tagged with: selenium-webdriver
has title: WebDriver wait for iframe, identify by part of its name

http://stackoverflow.com/comment/33161975
has text: Do you have to call those four methods in the correct order? Maybe you can do `equals` first and `P67` later? Alternatively, you could just make a copy of array `a`.
comment on: http://stackoverflow.com/a/21897923
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33175226
has text: @sarav-newfort i tested and i am getting the output correctly
type: Comment
comment on: http://stackoverflow.com/a/21905499
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33173234
type: AnswerComment
type: Comment
has text: Sorry this actually solves the problem. It was a combination of this and passing every single jar as parameter and not just the jars directory path.
comment on: http://stackoverflow.com/a/21904148
score: 0

http://stackoverflow.com/comment/33260635
comment on: http://stackoverflow.com/q/21953534
score: 0
type: QuestionComment
type: Comment
has text: The red portion of the log cat is what is helpful for this. Also, please post it directly just as you would code, and it looks like you posted the emulator logcat.

http://stackoverflow.com/q/21918353
type: Question
score: 3
tagged with: java
has body: I find out code that create a shortcut on home screen it works but when I click it on home screen it say : App no installed . Some help? My code : Intent shortcutIntent; shortcutIntent = new Intent(); shortcutIntent.setComponent(new ComponentName( getApplicationContext().getPackageName(), ".GetQuoteActivity")); shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); final Intent putShortCutIntent = new Intent(); putShortCutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); // Sets the custom shortcut's title putShortCutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Get Quote"); putShortCutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,Intent.ShortcutIconResource.fromContext( GetQuoteActivity.this, R.drawable.ic_launcher)); putShortCutIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); sendBroadcast(putShortCutIntent); } AndroidManifest : <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.files.getquote" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="7" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </manifest
has answer: http://stackoverflow.com/a/21918409
answer count: 1
downvote count: 0
favorite count: 0
has title: Home screen shortcut app no installed
accepted answer: http://stackoverflow.com/a/21918409
tagged with: android
type: AnsweredQuestion
upvote count: 3

http://stackoverflow.com/comment/78738597
comment on: http://stackoverflow.com/a/21921312
type: AnswerComment
score: 0
has text: No, you need to write a method
type: Comment

http://stackoverflow.com/comment/33257832
score: 0
type: Comment
type: QuestionComment
has text: @RichardTingle: yes, it all depends what you intend to measure.
comment on: http://stackoverflow.com/q/21951436

http://stackoverflow.com/comment/33293441
comment on: http://stackoverflow.com/q/21971831
score: 0
type: QuestionComment
type: Comment
has text: That's what I tried. Except it didn't work. I'm doing something wrong @K.C.

http://stackoverflow.com/q/21851469
tagged with: edismax
tagged with: dismax
score: 1
tagged with: solr
has title: Solr dismax highlighting not respecting analyzer
upvote count: 1
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21861264
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21861264
has body: In the schema of Solr 3.6.2 there are two field declarations, text and exact <field name="text" type="text" indexed="true" stored="true" /> <field name="exact" type="string" indexed="true" stored="true" /> The former using StandardTokenizer and the latter KeywordTokenizer. Solr queries describing the problem: ?hl=true &hl.fl=text,exact &defType=edismax &qf=text+exact <-------- here &q=a-b Highlight output for field exact: a-b. The problem is the summary for field exact is produced using the analyzer from text. ?hl=true &hl.fl=text,exact &defType=edismax &qf=exact <-------- here &q=a-b Highlight output for field exact: a-b. By simply removing text from qf we get the correct analyzer, why?
tagged with: search-engine

http://stackoverflow.com/q/21879556
tagged with: eclipse
upvote count: 4
downvote count: 0
type: UnansweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/33130189
has answer: http://stackoverflow.com/a/21880395
type: Question
has body: I was trying to create UML Diagram using UMLet. The tutorial shows the examples where I need to start creating it form scratch. But I need to create UML diagram for an already existing code. It gives the class attributes for a particular class, but how can I create an activity diagram or a sequence diagram for an existing code with UMLet?
has title: How to create sequence diagram using UMLet with the java code
answer count: 1
score: 4
tagged with: umlet
tagged with: java
tagged with: sequence-diagram
tagged with: uml

http://stackoverflow.com/a/21918284
type: Answer
downvote count: 0
has body: Not sure what your question is, probably how to fix your code, but my recommendation is to look into standard approaches to solving this problem, such as the KMP algorithm. It efficiently takes into account overlaps too.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33198227
answers question: http://stackoverflow.com/q/21918191

http://stackoverflow.com/a/21907123
has comment: http://stackoverflow.com/comment/33177557
answers question: http://stackoverflow.com/q/21906801
has comment: http://stackoverflow.com/comment/33177477
has body: Is there any way to handle that problem in Java? Basically, no. What you are describing a wrapper class that delegates calls to the wrapped method. The only way you can implement that (in regular Java) is to implement all of the methods and have them make the calls. Another alternative would be to use the Proxy class ... which will effectively generate a dynamic proxy. The problem is that this requires an InvocationHandler that will (I guess) use reflection to make the call to the wrapped object. It is complicated and won't be efficient. If your goal is simply to avoid writing code, I think this is a bad idea. If your goal is to writing the same code over and over (e.g. because you have lots of exampled of C for a given A), then consider coding an abstract class for the C classes that deals with the wrappering / delegation. It would also be possible to generate the wrapper class C from nothing, using the BCEL library or similar. But that's an even worse idea (IMO).
score: 0
type: Answer

http://stackoverflow.com/a/21949140
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33253107
has body: I'm not sure what you expect to happen. You are submitting this form Name: " City: Customer List And handling it with if (uri.endsWith("/customer")) { sendCustomerList(response, request); and private void sendCustomerList(HttpServletResponse response, HttpServletRequest request)//redirect to index throws IOException, ServletException { String url = "/index.jsp"; request.setAttribute("customers", customers); request.getRequestDispatcher(url).forward(request,response); } Nothing in the code above modifies anything in the customers List. Objects don't get changed on their own. You have to make the modifications yourself. Maybe you meant to submit the form with a POST request. In that case, you would need an field for the id. Think about the request-response cycle. Your Servlet container receives an HTTP request, it dispatches your Servlet to handle it. Your servlet performs some logic and forwards to a JSP. The JSP renders some HTML which is written to the body of the HTTP response. The response is sent to the client. In this case, your client is a browser which reads the HTML text and renders it graphically. You can then interact with it, fill in input fields and click buttons. When you do this, the browser takes the values you've entered and produces an HTTP request which it sends to your server. And so on, and so on...
answers question: http://stackoverflow.com/q/21949070
has comment: http://stackoverflow.com/comment/33253005
type: Answer
has comment: http://stackoverflow.com/comment/33253000
has comment: http://stackoverflow.com/comment/33253320
accepted answer of: http://stackoverflow.com/q/21949070
has comment: http://stackoverflow.com/comment/33253042
has comment: http://stackoverflow.com/comment/33253261
has comment: http://stackoverflow.com/comment/33253081
has comment: http://stackoverflow.com/comment/33253126

http://stackoverflow.com/comment/33212649
score: 0
comment on: http://stackoverflow.com/a/21925814
type: Comment
has text: Means you need to start server when the war deploy?
type: AnswerComment

http://stackoverflow.com/q/21933876
answer count: 3
accepted answer: http://stackoverflow.com/a/21933967
has answer: http://stackoverflow.com/a/21933999
favorite count: 0
has title: Join Query not working in Hibernate
has body: I am executing an inner-join query using hibernate-session.createQuery() and I got the error: Feb 21, 2014 5:22:07 PM org.hibernate.hql.internal.ast.ErrorCounter reportError ERROR: line 1:151: unexpected token: on Feb 21, 2014 5:22:07 PM org.hibernate.hql.internal.ast.ErrorCounter reportError ERROR: line 1:151: unexpected token: on line 1:151: unexpected token: on at org.hibernate.hql.internal.antlr.HqlBaseParser.fromJoin(HqlBaseParser.java:1693) at org.hibernate.hql.internal.antlr.HqlBaseParser.fromClause(HqlBaseParser.java:1348) at org.hibernate.hql.internal.antlr.HqlBaseParser.selectFrom(HqlBaseParser.java:1054) at org.hibernate.hql.internal.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:700) at org.hibernate.hql.internal.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:294) at org.hibernate.hql.internal.antlr.HqlBaseParser.statement(HqlBaseParser.java:157) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:266) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:180) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) at org.hibernate.engine.query.spi.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:106) at org.hibernate.engine.query.spi.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:81) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167) at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:217) at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:195) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1649) at com.sanyasi.masterDataActions.ModifyDistrictsAction.display(ModifyDistrictsAction.java:41) 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.…
upvote count: 1
tagged with: inner-join
has comment: http://stackoverflow.com/comment/33224731
possible better answer: http://stackoverflow.com/a/21934088
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21934088
score: 1
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/21933967

http://stackoverflow.com/comment/33134391
type: Comment
has text: Thanks, I marked your answer as useful but didn't mark it as an accepted answer as it's not the answer I'm looking for. Once again thanks.
comment on: http://stackoverflow.com/a/21882808
score: 0
type: AnswerComment

http://stackoverflow.com/a/21881694
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21881552
type: Answer
has body: It means that the compiler cannot find class Elem. Don't forget to import it at the top of your java class in case the Elem class is in the different package. Also make sure you don't have any typo.
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21881552

http://stackoverflow.com/a/22003333
score: 0
has body: First you need to store your download data, after you complete your file download add something like that: SharedPreferences sp = context.getSharedPreferences("filedetails", MODE_PRIVATE); Editor editor = sp.edit(); shared.putLong(MY_STATIC_STRING_TO_REFERENCE,System.currentTimeInMillis()); editor.commit(); Then before you start your download you can check the date like that: SharedPreferences sp= context.getSharedPreferences("filedetails", MODE_PRIVATE); long lastDownload= userDetails.getString(MY_STATIC_STRING_TO_REFERENCE, null); long today = System.currentTimeInMillis(); if((lastDownload+1000*60*60*24*7)&lt;today){ //Do download } All code was done directly on Stack Overflow so can contain some errors, sorry ;(
type: Answer
answers question: http://stackoverflow.com/q/22003068

http://stackoverflow.com/comment/33475764
type: Comment
comment on: http://stackoverflow.com/a/22044611
type: AnswerComment
has text: I am now trying to implement functionality of opennpl.Thank you for the heads up
score: 0

http://stackoverflow.com/a/66255176
upvote count: 1
answers question: http://stackoverflow.com/q/21849590
downvote count: 0
score: 1
type: Answer
has body: As of Spring Data MongoDB 3.2, there seems to be no way to easily define a field specific (not global) type converter. The type converters registered through the overriden configureConverters() method in the configuration bean affect all the domain object. But you can use a simple workaround using different types for field and accessor methods(getter/setter) to accomplish what you want. public class Person{ @AccessType(AccessType.Type.FIELD) private Instant timestamp; public long getTimestamp() { return this.timestamp.getEpochSecond(); } public void setTimestamp(final long ts) { this.timestamp = Instant.ofEpochSecond(ts); } } In the above code, persistency mapper to MongoDB will see java.time.Instant type field and the timestamp field will be mapped to Date(ISODate) type in MongoDB. But, other Java programs will access the Person.timestamp field via long type, because the getter and setter uses long type. Although this approach is not so fancy to use field level annotations (if exists), it is simple and intuitive. java.time.Instant is one of the essential classes for date/time after Java 8. It seems to be the best fit for timestamp in Java. Spring Data MongoDB provided built-in type mapping for both java.util.Date and java.time.Instant to/from MongoDB's date(Date, ISODate) type. Below is a sample domain object from my program. Lombok is applied. In the domain object, java.math.BigInteger type is mapped to MongoDB's decimal(Decimal128) type. @Getter @Setter @RequiredArgsConstructor @Accessors(chain = true) @Document(collection = "transactions") public class Transaction implements java.io.Serializable{ @Id private final String hash; @Field(name = "block_no") private long blockNo; private long index; private String from; // denormalized field from account @Field("from_is_contr") private boolean fromIsContract; private String to; // denormalized field from account @Field("to_is_contr") private boolean toIsContract; @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) @Ac…

http://stackoverflow.com/comment/33131007
comment on: http://stackoverflow.com/a/21881101
has text: Yeah but thats due to not knowing Java. Better to teach him how to do it properly. Using ints for booleans in Java is not best practice.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33249036
has text: And you should follow Hibernate's best practices. A Child has a parent, not an ID of a parent. This association is natural, and extremely useful to have in all the business logic and HQL queries. That's one of the reasons for using ORMs in the first place. Adapt the serialization logic instead of corrupting the object model.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21944946

size
type: Tag
tags question: http://stackoverflow.com/q/21876785
tag name: size

http://stackoverflow.com/a/43617750
answers question: http://stackoverflow.com/q/21979453
score: 0
type: Answer
has body: I faced this problem and its very annoying so to make it clear to all here how you do this first create font by follow this ARABIC &amp; UTF-8 and then on the field or label that may has Arabic content go to its properties by right click or on the properties pallet of it , and make these changes Check the box PDF embed Choose Identity-H (Unicode with horizontal writing) from PDF encoding Choose the font Arial if not there add it to the jasper fonts folder in the installation directory and add it to the class path in settings Rerun in PDF mode ... it will work

http://stackoverflow.com/comment/33063947
type: QuestionComment
comment on: http://stackoverflow.com/q/21843250
type: Comment
has text: Hint: use a *loop* over the *characters* in `text`.
score: 2

http://stackoverflow.com/a/21930926
upvote count: 5
has comment: http://stackoverflow.com/comment/33220143
has comment: http://stackoverflow.com/comment/33220172
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21930817
has comment: http://stackoverflow.com/comment/33219831
has body: I suspect the problem is that you're skipping an element after one call to remove, because you're incrementing i and everything in the list is moving up one element. (It's not really clear what the symptoms are at the moment. If this turns out not to be the problem, it's still a problem.) So if you call remove(2), the next element you want to look at now has index 2. Common ways of fixing this: Work backwards: for (int i = arrayList.size() - 1; i &gt;= 0; i--) Use an iterator instead: for (Iterator&lt;Foo&gt; iterator = arrayList.iterator(); iterator.hasNext(); ) { Foo c = iterator.next(); if (...) { iterator.remove(); } }
has comment: http://stackoverflow.com/comment/33220873
accepted answer of: http://stackoverflow.com/q/21930817
has comment: http://stackoverflow.com/comment/33220105
has comment: http://stackoverflow.com/comment/33219958

http://stackoverflow.com/q/21870962
tagged with: jakarta-ee
tagged with: jsch
tagged with: progress-bar
score: 0
tagged with: sftp
linked to: http://stackoverflow.com/q/7977844
answer count: 1
has title: Progress bar for file transfer from Unix to Java
has comment: http://stackoverflow.com/comment/33119302
has comment: http://stackoverflow.com/comment/33118551
type: UnansweredQuestion
has body: I know this question sounds repeated but the difference is that i am trying to implement progress bar for Unix-Java file transfer.I am using below code for downloading the file from Unix to my local host. String SFTPHOST = "xxx.xx.xx.xxx"; int SFTPPORT = 22; String SFTPUSER = "abc"; String SFTPPASS = "pwd"; String SFTPWORKINGDIR = "/home/Shashank"; String SFTPDEST="G:\\xyz\\update.txt"; Session session = null; Channel channel = null; ChannelSftp channelSftp = null; try{ JSch jsch = new JSch(); session = jsch.getSession(SFTPUSER,SFTPHOST,SFTPPORT); session.setPassword(SFTPPASS); java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.connect(); channel = session.openChannel("sftp"); channel.connect(); channelSftp = (ChannelSftp)channel; channelSftp.cd(SFTPWORKINGDIR); byte[] buffer = new byte[1024]; BufferedInputStream bis = new BufferedInputStream(channelSftp.get("update.txt")); File newFile = new File(SFTPDEST); OutputStream os = new FileOutputStream(newFile); BufferedOutputStream bos = new BufferedOutputStream(os); int readCount; //System.out.println("Getting: " + theLine); while( (readCount = bis.read(buffer)) &gt; 0) { System.out.println("Writing: " ); bos.write(buffer, 0, readCount); } bis.close(); bos.close(); }catch(Exception ex){ ex.printStackTrace(); } Please suggest me how to use progress bar in this code.I tried JSch sftp upload/download progress link but i think this isn't Java-unix file transfer.
has answer: http://stackoverflow.com/a/22075961
has comment: http://stackoverflow.com/comment/33118832
tagged with: java
has comment: http://stackoverflow.com/comment/33113572
type: Question

http://stackoverflow.com/comment/33228775
type: QuestionComment
has text: @TGMCians : checked and EMF file is parsing correctly but error still continues in 4.2 & above platform.
comment on: http://stackoverflow.com/q/21914178
score: 0
type: Comment

http://stackoverflow.com/a/23294111
accepted answer of: http://stackoverflow.com/q/21967946
score: 5
upvote count: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21967946
has body: Real time updates are available for page and user objects.Both of them requires the access token of the respective page or user.(For page you can check it using me/accounts or get it via giving page access permissions to your app). Step 1: You will need a public ip where facebook will post the updates. Step 2: You need to setup your fb app to initiate real-time updates setup String appId = //your app id String token = //app token appId|appSecret String callbackUrl = //your public url PostMethod method = new PostMethod(); method.setURI(new URI("https://graph.facebook.com/" + appId + "/subscriptions?callback_url=" + callbackUrl + "&amp;object=page&amp;fields=feed&amp;verify_token=streamInit&amp;method=POST&amp;access_token="+ token, false)); HttpClient httpClient = new HttpClient(); if (method != null) { int statusCode = httpClient.executeMethod(method); String response = new String(method.getResponseBody()); if (statusCode == HttpStatus.SC_OK) { //Completed streaming initiation }else{ //Streaming initialization failed" } } } catch (Exception e) { } Step 3:This will trigger facebook callback url validation.It can be a servlet or any other which will process the updates posted to callback url.Facebook will provide a challenge code in a get request which you need to resend. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Map parametersMap = request.getParameterMap(); if (parametersMap.size() &gt; 0) { if (request.getParameter("hub.mode").equals("streamInit")) { System.out.println("Verify Token: " + request.getParameter("hub.verify_token")); System.out.println("Challenge number:" + request.getParameter("hub.challenge")); String responseToClient = request.getParameter("hub.challenge"); response.setStatus(HttpServletResponse.SC_OK); response.getWriter().write(responseToClient); response.getWriter().flush(); response.getWriter().close(); //"Completed streaming setup on your url" } } } Step 3: Add your app…
type: Answer

http://stackoverflow.com/q/21982512
has body: I have one folder named 'images' which is just inside my web application 'mywebapp'. ie., mywebapp/images I have one java file (not a servlet), can anyone tell me how to find out the path for 'images' folder? If it would be a servlet, i would have used something like request.getSession().getServletContext().getRealPath( path ) but for a Java file which is inside a web-app, how to find its folder's path? images folder I need to store images in it dynamically!
has comment: http://stackoverflow.com/comment/33312138
has title: can anyone tell me how to find out the path for '`images`' folder which is inside mywebapp?
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/33318366
has answer: http://stackoverflow.com/a/21982921
has comment: http://stackoverflow.com/comment/33312815
answer count: 3
has comment: http://stackoverflow.com/comment/33312301
downvote count: 0
possible better answer: http://stackoverflow.com/a/21982614
has answer: http://stackoverflow.com/a/21982614
favorite count: 0
accepted answer: http://stackoverflow.com/a/21982921
has comment: http://stackoverflow.com/comment/33312173
has answer: http://stackoverflow.com/a/21982708

enums
tags question: http://stackoverflow.com/q/21896738
tags question: http://stackoverflow.com/q/21971272
tags question: http://stackoverflow.com/q/21852282
tags question: http://stackoverflow.com/q/21916812
tag name: enums
tags question: http://stackoverflow.com/q/21922855
tags question: http://stackoverflow.com/q/21971214
tags question: http://stackoverflow.com/q/21941777
type: Tag
tags question: http://stackoverflow.com/q/21904592
tags question: http://stackoverflow.com/q/21924881
tags question: http://stackoverflow.com/q/21855198
tags question: http://stackoverflow.com/q/21963919
tags question: http://stackoverflow.com/q/21892961

http://stackoverflow.com/comment/33265971
score: 0
comment on: http://stackoverflow.com/a/21947184
has text: Ayce, I wouldn't open this can of worms. [SocketChannel](http://docs.oracle.com/javase/7/docs/api/java/nio/channels/SocketChannel.html) wouldn't cut it?
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21877996
has comment: http://stackoverflow.com/comment/33126011
has comment: http://stackoverflow.com/comment/33127481
has comment: http://stackoverflow.com/comment/33125862
has comment: http://stackoverflow.com/comment/33125697
has comment: http://stackoverflow.com/comment/33126102
has body: ok you can try this before executing this line public void insertClient(int id) { try{ conn=dataSource.createConnection(); PreparedStatement ps=conn.prepareStatement("insert into login(id,FirstName,LastName,Gender,Category,Dateofbirth,Age,Address,Country,State,city,PinCode,EmailId,ContactNo,MobileNo)select * from register"); ps.setInt(1, id); ps.executeUpdate(); } catch (SQLException e) { throw new RuntimeException(e); add this to it String x=null; Resultset rs=conn.prepareStatement("select id from old_table where FirstName='request.getParameter('firstname')'and LastName='request.getParameter('lastname')'.......and so on. while(rs.next){ x=rs.getString('id'); } then use this x and pass it in your insert statement..
has comment: http://stackoverflow.com/comment/33126284
answers question: http://stackoverflow.com/q/21876536
score: 0
has comment: http://stackoverflow.com/comment/33128602
has comment: http://stackoverflow.com/comment/33127577
has comment: http://stackoverflow.com/comment/33126731
has comment: http://stackoverflow.com/comment/33126832
has comment: http://stackoverflow.com/comment/33126613
type: Answer

http://stackoverflow.com/a/21999443
type: Answer
answers question: http://stackoverflow.com/q/21998659
has comment: http://stackoverflow.com/comment/33370543
has body: The watch service allows you to register a listener for events in directories. If an event happens more than once before your service is notified, it gets an increment, instead of having two such events causing notification. This is specifically about files, so it handles file creation, modification, deletion in a directory.
has comment: http://stackoverflow.com/comment/33342814
score: 0
has comment: http://stackoverflow.com/comment/33343290

http://stackoverflow.com/a/21864714
answers question: http://stackoverflow.com/q/21864357
downvote count: 0
has comment: http://stackoverflow.com/comment/33102493
has comment: http://stackoverflow.com/comment/33102950
has body: What you can do is that you can use a JLabel and set the ImageIcon to it. make the JLabel transparent by using setOpaque(false). Then, add listener to it and do whatever you want to do :)
has comment: http://stackoverflow.com/comment/33102595
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/33249978
comment on: http://stackoverflow.com/q/21947521
type: Comment
has text: what if you change that 3-row thing into a valid JSON adding something before and after it? :-)
type: QuestionComment
score: 2

http://stackoverflow.com/a/21951063
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/83819284
answers question: http://stackoverflow.com/q/21951039
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21951039
type: Answer
has body: Just creating a new instance of AlertDialogFragment and returning. Usually we create instnace like AlertDialogFragment adf = new AlertDialogFragment(); in your case AlertDialogFragment adf = AlertDialogFragment.newInstance(); See, no difference.

http://stackoverflow.com/a/21951318
upvote count: 1
downvote count: 0
has body: String s="$49monthly"; String newstring=s.replace("$", ""); System.out.println("Value: "+newstring);
type: Answer
answers question: http://stackoverflow.com/q/21951268
score: 1

http://stackoverflow.com/q/21950542
has answer: http://stackoverflow.com/a/21950561
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/21950597
tagged with: null
downvote count: 0
has answer: http://stackoverflow.com/a/21950660
favorite count: 0
has answer: http://stackoverflow.com/a/21950597
answer count: 4
score: 2
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/21950667
has body: I have a array that can sometimes be null (strings[0]) and I want to be able to detect when its null so I don't get a error and I can tell the user. I tried a if statement (if (strings == null){ //do my code }) that didn't work. I tried to do try, catch (NullPointerException) but I'm getting an error in my IDE. Any help would be much appreciated.
tagged with: error-handling
possible better answer: http://stackoverflow.com/a/21950561
has comment: http://stackoverflow.com/comment/33255530
has title: Java- Null handling

http://stackoverflow.com/a/21915409
answers question: http://stackoverflow.com/q/21914705
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
score: 2
has body: TreeMultimap.keySet() returns a NavigableSet. So, for example, the next-lower key to k can be retrieved with TreeMultimap.keySet().lower(k).
accepted answer of: http://stackoverflow.com/q/21914705

http://stackoverflow.com/comment/33222727
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21932628
has text: For "very large" (how large is that?) XML files you might want to consider either to dump it to a relational database (it seems like this XML file actually represents a table) or the use of a native XML database like [Basex](http://www.basex.org).

http://stackoverflow.com/q/21894429
has body: I'm using @RegexFieldValidator on a method as follows. @Validations( regexFields={ @RegexFieldValidator(caseSensitive=false, fieldName="colourHex", regex="[0-9, a-f, A-F]+", key="colour.hex.pattern", messageParams={"A", "F"})}) @Action(value = "AddColour", results = {@Result(name=ActionSupport.SUCCESS, type="redirectAction", location="Colour.jsp", params={"namespace", "/admin_side", "actionName", "Colour", "currentPage", "${currentPage}", "editId", "${editId}"}), @Result(name = ActionSupport.INPUT, location = "Colour.jsp")}, interceptorRefs={@InterceptorRef(value="defaultStack", params={"params.acceptParamNames", "editId, colourId, colourName, colourHex, currentPage, rowCount, totalPages", "validation.validateAnnotatedMethodOnly", "true"})}) public String insert() { return ActionSupport.SUCCESS; } The message which the given key refers to is kept in a property file like the following. colour.hex.pattern=Only digits and letters from {0} to {1} either capital or small are significant. The placeholders are not replaced by the given parameters. They are null and consequently, the message formed is, Only digits and letters from null to null either capital or small are significant. It should actually be like as follows. Only digits and letters from A to F either capital or small are significant. Why aren't the parameters substituted to the placeholders? Validation is performed correctly according to the given pattern.
has title: Message parameters are not substituted to the actual placeholders in a message stored in a property file while using RegexFieldValidator in Struts2
has comment: http://stackoverflow.com/comment/33156004
answer count: 1
downvote count: 0
favorite count: 0
tagged with: struts2
accepted answer: http://stackoverflow.com/a/21903570
has comment: http://stackoverflow.com/comment/33170899
tagged with: regex
upvote count: 3
has comment: http://stackoverflow.com/comment/33156208
type: Question
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/21903570
tagged with: java

unit-testing
tags question: http://stackoverflow.com/q/21965857
tags question: http://stackoverflow.com/q/21856053
tags question: http://stackoverflow.com/q/21863455
tags question: http://stackoverflow.com/q/21901368
tags question: http://stackoverflow.com/q/21958040
tags question: http://stackoverflow.com/q/21946851
tags question: http://stackoverflow.com/q/21870195
tags question: http://stackoverflow.com/q/21866449
tags question: http://stackoverflow.com/q/21904890
tags question: http://stackoverflow.com/q/21901067
tags question: http://stackoverflow.com/q/21920715
tags question: http://stackoverflow.com/q/21998636
tags question: http://stackoverflow.com/q/21902795
tags question: http://stackoverflow.com/q/21914913
tags question: http://stackoverflow.com/q/21925462
tags question: http://stackoverflow.com/q/21879908
tags question: http://stackoverflow.com/q/21878474
tags question: http://stackoverflow.com/q/21936103
type: Tag
tags question: http://stackoverflow.com/q/21911070
tags question: http://stackoverflow.com/q/21909637
tags question: http://stackoverflow.com/q/21932308
tags question: http://stackoverflow.com/q/21900568
tag name: unit-testing
tags question: http://stackoverflow.com/q/21979228
tags question: http://stackoverflow.com/q/21971065
tags question: http://stackoverflow.com/q/21948337
tags question: http://stackoverflow.com/q/21865584
tags question: http://stackoverflow.com/q/21875933

http://stackoverflow.com/comment/33255651
has text: Perhaps you should elaborate on the code for method `b()`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21950684

http://stackoverflow.com/comment/33084466
has text: What is the problem? What happens / does not happen?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21854145

http://stackoverflow.com/q/21983412
type: Question
tagged with: java
tagged with: struts
has answer: http://stackoverflow.com/a/21985305
has body: I am new to STRUTS and to this mailing list, so please be patient with me. What I am trying, is to call an action on jsp load. I guess I need a javasript function which calls an action and 'onload' in my body. function callAction{ ... calling myAction.do } &lt;body onload="callAction();" ... &gt; Can somebody help me with this issue? thank you
answer count: 2
has comment: http://stackoverflow.com/comment/33313907
has answer: http://stackoverflow.com/a/21983600
tagged with: jsp
possible better answer: http://stackoverflow.com/a/21985305
has comment: http://stackoverflow.com/comment/33313718
has comment: http://stackoverflow.com/comment/33313977
type: AnsweredQuestion
has title: Struts Calling Action on page load
accepted answer: http://stackoverflow.com/a/21983600
score: 0
tagged with: jsp-tags
tagged with: struts-1

http://stackoverflow.com/comment/87457892
type: Comment
score: 0
type: AnswerComment
has text: @BenManes I wrote "LRU" when I meant FIFO, as in `expireAfterWrite`.
comment on: http://stackoverflow.com/a/21984264

http://stackoverflow.com/comment/33078761
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21850196
has text: @injecteer can you please elaborate which dependency u are talking about. example will be great.
type: Comment

http://stackoverflow.com/comment/33174013
score: 0
type: Comment
type: QuestionComment
has text: glad to hear that solved your problem.
comment on: http://stackoverflow.com/q/21854192

http://stackoverflow.com/comment/87450279
type: AnswerComment
has text: Exactly what I wanted after applying custom log config!
type: Comment
score: 2
comment on: http://stackoverflow.com/a/48608641

http://stackoverflow.com/comment/33338897
comment on: http://stackoverflow.com/q/21997215
score: 0
has text: If you can supply an array of interfaces to be implemented, it should mean that you already know which interfaces you need to implement.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21956674
has comment: http://stackoverflow.com/comment/33266380
type: Question
tagged with: libgdx
has answer: http://stackoverflow.com/a/21956809
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: android
has title: How to draw a rectangle around an <Array>Rectangle
has comment: http://stackoverflow.com/comment/33266204
has body: Trying the Shape renderer but it just aint workin =P Trying to debug some hitboxes that aren't acting correctly. carb = new Array&lt;Rectangle&gt;(); Iterator&lt;Rectangle&gt; iter = carb.iterator(); while (iter.hasNext()) { Rectangle car2 = iter.next(); batch.end(); sr.begin(ShapeType.Line); sr.setColor(new Color(0,0,1,0)); sr.rect(carb.getPosition(position).x, carb.getPosition(position).y, carb.getSize(position).x, carb.getSize(position).y); sr.end(); ^ Getting the error "The method getPosition/getSize is undefined for the type rectangle"
tagged with: java
has answer: http://stackoverflow.com/a/21956793

http://stackoverflow.com/comment/33209344
comment on: http://stackoverflow.com/a/21924852
has text: I took your advice and changed it anyway but I think I may have found what the problem was. I got an index out of bounds exception once I did that and I found that I unintentionally put the wrong check under setELeaf. It was checking the position's ROW, not the column. At any rate, it seems to be working now but I'll need to run a test or two to verify.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33232881
comment on: http://stackoverflow.com/q/21937588
type: QuestionComment
has text: so, it would be logical to run linux commands from within the program? I don want the user to even be aware of the new user...
score: 0
type: Comment

http://stackoverflow.com/a/21988799
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/76679876
has body: No, it is not a bug. It is a result of how the ParameterizedTypeReference hack works. If you look at its implementation, it uses Class#getGenericSuperclass() which states Returns the Type representing the direct superclass of the entity (class, interface, primitive type or void) represented by this Class. If the superclass is a parameterized type, the Type object returned must accurately reflect the actual type parameters used in the source code. So, if you use new ParameterizedTypeReference&lt;ResponseWrapper&lt;MyClass&gt;&gt;() {} it will accurately return a Type for ResponseWrapper&lt;MyClass&gt;. If you use new ParameterizedTypeReference&lt;ResponseWrapper&lt;T&gt;&gt;() {} it will accurately return a Type for ResponseWrapper&lt;T&gt; because that is how it appears in the source code. When Spring sees T, which is actually a TypeVariable object, it doesn't know the type to use, so it uses its default. You cannot use ParameterizedTypeReference the way you are proposing, making it generic in the sense of accepting any type. Consider writing a Map with key Class mapped to a predefined ParameterizedTypeReference for that class. You can subclass ParameterizedTypeReference and override its getType method to return an appropriately created ParameterizedType, as suggested by IonSpin.
type: Answer
has comment: http://stackoverflow.com/comment/76679497
downvote count: 0
has comment: http://stackoverflow.com/comment/76679824
has comment: http://stackoverflow.com/comment/76679853
score: 71
accepted answer of: http://stackoverflow.com/q/21987295
has comment: http://stackoverflow.com/comment/76679890
answers question: http://stackoverflow.com/q/21987295
upvote count: 71
has comment: http://stackoverflow.com/comment/76679342

http://stackoverflow.com/q/21968435
favorite count: 0
has comment: http://stackoverflow.com/comment/33287732
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21968599
score: 3
has body: Driver code: public class WcDriver { public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException { Configuration conf = new Configuration(); Job job = new Job(conf, "WcDriver"); job.setJarByClass(WcDriver.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(LongWritable.class); job.setInputFormatClass(TextInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); FileInputFormat.setInputPaths(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.setMapperClass(WcMapper.class); job.setReducerClass(WcReducer.class); job.waitForCompletion(true); } } Reducer code public class WcReducer extends Reducer<Text, LongWritable, Text,String> { @Override public void reduce(Text key, Iterable<LongWritable> values, Context context) throws IOException, InterruptedException { String key1 = null; int total = 0; for (LongWritable value : values) { total += value.get(); key1= key.toString(); } context.write(new Text(key1), "ABC"); } } Here, in driver class I have set job.setOutputKeyClass(Text.class) and job.setOutputValueClass(LongWritable.class), but in reducer class I am writing a string context.write(new Text(key1), "ABC");. I think there should be an error while running the program because output types are not matching, and also reducer's key should implement WritableComparable and value should implement Writable interface. Strangely, this program is running good. I do not understand why there is not an exception.
has title: job.setOutputKeyClass and setOutputValueClass in Driver is mismatching with the reducer's context.write method,still program is running fine.how?
tagged with: java
has comment: http://stackoverflow.com/comment/33776148
tagged with: mapreduce
type: Question
tagged with: hadoop
answer count: 2
has answer: http://stackoverflow.com/a/21968598
tagged with: hadoop2
downvote count: 0

http://stackoverflow.com/comment/33199191
has text: is the value for that other field coming from user input? or is it generated as well? another question more related to the answers you got so far: are you running in a cluster? in case you have multiple nodes thread synchronization will not help.
comment on: http://stackoverflow.com/q/21918570
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33228135
type: AnswerComment
has text: Thanks Paul, I tried that but that's not the problem. It won't even hoover over the tab.
type: Comment
comment on: http://stackoverflow.com/a/21931458
score: 0

task
type: Tag
tag name: task
tags question: http://stackoverflow.com/q/21910754
tags question: http://stackoverflow.com/q/21880300

http://stackoverflow.com/comment/34669572
score: 0
type: AnswerComment
has text: You actually CAN play multiplayer, moreover the jar simply needs valid access token to start
type: Comment
comment on: http://stackoverflow.com/a/22738656

http://stackoverflow.com/q/21910789
type: Question
has answer: http://stackoverflow.com/a/21910930
tagged with: arquillian-drone
has title: Cannot set up Drone : NoClassDefFoundError: com/opera/core/systems/OperaDriver
tagged with: jboss-arquillian
answer count: 3
has answer: http://stackoverflow.com/a/21936130
has answer: http://stackoverflow.com/a/21931744
has body: I'm following this tutorial: http://arquillian.org/guides/functional_testing_using_graphene/ But I got this error: Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.047 sec <<< FAILURE! cn.ftc.test.BeanTest Time elapsed: 1.045 sec <<< ERROR! java.lang.NoClassDefFoundError: com/opera/core/systems/OperaDriver at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2436) at java.lang.Class.getDeclaredMethods(Class.java:1793) at org.jboss.arquillian.core.impl.Reflections.getObserverMethods(Reflections.java:52) at org.jboss.arquillian.core.impl.ExtensionImpl.of(ExtensionImpl.java:51) at org.jboss.arquillian.core.impl.ManagerImpl.inject(ManagerImpl.java:198) at org.jboss.arquillian.core.impl.InjectorImpl.inject(InjectorImpl.java:58) at org.jboss.arquillian.core.impl.loadable.ServiceRegistryLoader.createServiceInstance(ServiceRegistryLoader.java:108) at org.jboss.arquillian.core.impl.loadable.ServiceRegistryLoader.all(ServiceRegistryLoader.java:55) at org.jboss.arquillian.drone.impl.DroneRegistrar.registerConfigurators(DroneRegistrar.java:74) at org.jboss.arquillian.drone.impl.DroneRegistrar.register(DroneRegistrar.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.refle…
tagged with: selenium-webdriver
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21936130
tagged with: java
score: 0
tagged with: selenium
possible better answer: http://stackoverflow.com/a/21910930

http://stackoverflow.com/a/21953243
has body: This is happening because you instantiate a as a B object - A a = new B(). It doesn't matter that the explicit type of a is A; it's more generic (abstract) than its real type B (because B inherits from A), therefore polymorphism calls B methods (more specific) in first order. The same applies to fields. After calling a.getX() class B references to A's getX(), which returns its 15 (superclass method has no reference to the object it was called from in this case), then 5 (B's x) is added, resulting in 20. The subsequent calls behave in a similar manner.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21953122
upvote count: 1

http://stackoverflow.com/comment/33349852
type: Comment
comment on: http://stackoverflow.com/a/22002803
score: 1
has text: No problem, maybe you remember this talk later ;)
type: AnswerComment

http://stackoverflow.com/comment/33143335
type: Comment
score: 0
has text: And What problem you are Facing?
type: QuestionComment
comment on: http://stackoverflow.com/q/21887775

http://stackoverflow.com/q/21948103
favorite count: 0
has body: What is the intent behind this piece of code? Button sButton = (Button) findViewById(R.id.button_1);
upvote count: 1
has answer: http://stackoverflow.com/a/21948122
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33254187
tagged with: java
has title: Android Development: Button- findViewById?
possible better answer: http://stackoverflow.com/a/21948122
has answer: http://stackoverflow.com/a/21948218
type: Question
has answer: http://stackoverflow.com/a/21948148
downvote count: 0
tagged with: button
tagged with: android-button
answer count: 3
tagged with: android
accepted answer: http://stackoverflow.com/a/21948218
score: 1

http://stackoverflow.com/q/21935859
has title: Splitting A String Into An Array Of Words To Be Called Again
has comment: http://stackoverflow.com/comment/33228581
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21936205
accepted answer: http://stackoverflow.com/a/21936462
tagged with: java
type: Question
tagged with: computer-science
tagged with: jgrasp
tagged with: arrays
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33228442
has answer: http://stackoverflow.com/a/21936462
tagged with: string
has body: This is my code so far below import java.util.*; import java.io.*; public class USconstitution { public static void main(String [] args) throws Exception { Scanner inFile = new Scanner(new File("constitution.txt")); int x = 0; int keyword1 = 0; Scanner keyboard = new Scanner(System.in); System.out.println("Enter a word from the keyboard"); String input = keyboard.next(); while(inFile.hasNext()) { String word = inFile.next(); x++; if(input.equalsIgnoreCase(word)) keyword1++; } //System.out.println("\n" + x); System.out.println("The constitution has " + x + " words"); System.out.println("The first keyword shows up " + keyword1 + " times in the constitution"); } } THE OUTPUT SO FAR = Enter a word from the keyboard President The constitution has 4610 words The first keyword shows up 20 times in the constitution My goal for this program is to search through a text file that has been given to me which contains the US Constitution. The first part simply counts how many words are in the text file, the next bit that I am trying to do is allow people to search for certain keywords and have it search the text file and say how many times that word shows up. I was thinking of having the prompt ask what keywords the user wishes to enter and have it use the split method to create each word as an individual string and search for that in the file then output how many times it appears. Although I am not so sure how to go about this, any help would be greatly appreciated!
has answer: http://stackoverflow.com/a/21936205

http://stackoverflow.com/comment/33331317
score: 3
comment on: http://stackoverflow.com/q/21992880
has text: I would actually not use threads at all. Multiple tabs don't operate in parallel, they operate in sequence and a single thread can do that already. What you have in parallel is "state" but that's why there are objects where each instance has it's own state.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21956591
has comment: http://stackoverflow.com/comment/33380259
has comment: http://stackoverflow.com/comment/33338304
answers question: http://stackoverflow.com/q/21940270
type: Answer
accepted answer of: http://stackoverflow.com/q/21940270
has comment: http://stackoverflow.com/comment/33352577
has comment: http://stackoverflow.com/comment/33378260
has comment: http://stackoverflow.com/comment/33306232
score: 0
has body: You should override the onTouch method in the TokenView class instead. Canvas is just the place where things of the view are drawn. You should write something like this in your TokenView class: private Cell bufferCell; @Override public boolean onTouchEvent(MotionEvent event) { Cell cell = getCell(event); if (cell != null) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (cell != bufferCell) bufferCell = cell; // DO STUFF HERE. // THE PLAYER HAS JUST TOUCHED A CELL. // invalidate(); break; case MotionEvent.ACTION_MOVE: if (cell != bufferCell) { bufferCell = cell; // Continue Pan // DO STUFF HERE // THE PLAYER'S FINGER IS ON A DIFFERENT CELL NOW, AND MOVING // invalidate(); } break; case MotionEvent.ACTION_UP: // Commit Pan bufferCell = null; // DO STUFF HERE // THE PLAYER HAS TAKEN HIS FINGER OFF THE VIEW // invalidate(); break; } } return true; } private Cell getCell(MotionEvent event) { int motionX = (int) event.getX(); int motionY = (int) event.getY(); if (motionX &gt; 0 &amp;&amp; motionX &lt; sizeOfGrid &amp;&amp; motionY &gt; 0 &amp;&amp; motionY &lt; sizeOfGrid) { int rowIndex = motionY / currentSizeOfCell % rowCount; int columnIndex = motionX / currentSizeOfCell % columnCount; return cellArray[rowIndex][columnIndex]; } return null; } Call invalidate() in order to redraw the view. And don't do Game game = new Game(); inside the onDraw() method of TokenView. It will just keep on creating new Games while you draw stuff, and you will not get any expected behavior. I used a bufferCell variable which will help reduce the amount of time your logic based methods will be called, because as the player moves his finger over the grid, the cell need not change. Only when it changes, calls to appropriate methods will be fired, if you follow the above mentioned code design. Also read about as to how to create custom views in Android. Main methods to override are onDraw(), onSizeChanged(), and onMeasure(). Hope that helps.
has comment: http://stackoverflow.com/comment/33303567
type: AcceptedAnswer

logback
tags question: http://stackoverflow.com/q/22000995
tags question: http://stackoverflow.com/q/21936114
type: Tag
tags question: http://stackoverflow.com/q/21919595
tag name: logback
tags question: http://stackoverflow.com/q/21887954
tags question: http://stackoverflow.com/q/21885787

http://stackoverflow.com/comment/33300307
type: Comment
type: QuestionComment
has text: Can you post the Use case that you are trying to replicate (eg: Step wise description for reproducing your issue)
comment on: http://stackoverflow.com/q/21975607
score: 0

http://stackoverflow.com/comment/33275077
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21961379
has text: I have to agree with @JBNizet. It depends on what sort of behavior you want your list to exhibit.
score: 0

http://stackoverflow.com/q/21987894
has body: I am creating a program that asks the user for several integers and one of the statements ask the user "Enter an integer that is negative and even or positive and odd". How exactly would I go about setting up such a question? I have this so far. I have no idea how exactly I should do this, as my instructions are pretty confusing. This is what the question is for my problem: 4. Ask the user for an integer that is either negative and even or positive and odd. Use an if statement and compound conditional. import java.util.Scanner; public class ExerciseFour { public static void main ( String[] argsv ) { int choice; int choiceTwo; int choiceThree; Scanner input = new Scanner(System.in); System.out.println( "Enter a number between 0 and 10" ); choice = input.nextInt(); if ( choice &gt; 0 &amp;&amp; choice &lt; 10 ) { System.out.println( "Valid number" ); } else { System.out.println( "Invalid number" ); return; } System.out.println( "Enter a number divisible by 2 or 3?" ); choiceTwo = input.nextInt(); if ( choiceTwo % 2 == 0 &amp;&amp; choiceTwo % 3 == 0 ) { System.out.println( "Valid number" ); } else { System.out.println( "Number not divisible by 2 or 3" ); return; } System.out.println( "Enter an integer that is negative and even or positive and odd (Ex. -2 or 7 )" ); choiceThree = input.nextInt(); if ( choiceThree ) { } else { }
has comment: http://stackoverflow.com/comment/33321290
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/33321334
has answer: http://stackoverflow.com/a/21988096
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21988261
has answer: http://stackoverflow.com/a/21988101
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21988001
upvote count: 1
possible better answer: http://stackoverflow.com/a/21988096
has comment: http://stackoverflow.com/comment/33321321
type: Question
has comment: http://stackoverflow.com/comment/33321419
downvote count: 0
has title: Enter an integer that is negative and even or positive and odd
accepted answer: http://stackoverflow.com/a/21988001
has answer: http://stackoverflow.com/a/21988028

http://stackoverflow.com/comment/33323639
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21988836
has text: Yea, So I want it to be like the facebook one you click on one button and it changes the activity but the slide in menu is still there. Do you now how i can acomplish this?
score: 0

http://stackoverflow.com/comment/33249681
comment on: http://stackoverflow.com/q/21947411
score: 5
has text: What do you think `+ tres " ...` would do? Please read the most basic of Java tutorials.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21967435
has title: Merging two WAV files with Java only plays the last part
type: UnansweredQuestion
answer count: 0
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: audio
tagged with: java
has body: I'm trying to write an Application to record a sound on Android and send it through TCP to a Server running on a PC. My main Problem is to buffer received bytes and collect them all on a single file. I can see by Debugging my code that the frameLength grows currectly by reading the old content and appending the new ones, but the File size on Disk remains constant and MediaPlayer plays only the last recorded part. private static final int SAMPLE_RATE = 44100; private File waveFile; private void toWaveFile(final byte[] soundBytes) throws IOException, UnsupportedAudioFileException { final InputStream inputStream = new ByteArrayInputStream(soundBytes); final AudioFormat format = new AudioFormat(SAMPLE_RATE, 16, 1, true, false); final AudioInputStream newAudioInputStream = new AudioInputStream(inputStream, format, soundBytes.length); if (waveFile == null) { waveFile = new File(Config.getInstance().readSetting("tempFolder.path") + "/test_" + System.currentTimeMillis() + ".wav"); AudioSystem.write(newAudioInputStream, AudioFileFormat.Type.WAVE, waveFile); } else { final AudioInputStream currentContentInputStream = AudioSystem.getAudioInputStream(waveFile); final AudioInputStream appendedFilesAudioInputStream = new AudioInputStream( new SequenceInputStream(currentContentInputStream, newAudioInputStream), currentContentInputStream.getFormat(), currentContentInputStream.getFrameLength() + newAudioInputStream.getFrameLength()); AudioSystem.write(appendedFilesAudioInputStream, AudioFileFormat.Type.WAVE, waveFile); } } Any Help is hightly appreciated
upvote count: 1

http://stackoverflow.com/comment/33183033
score: 0
type: Comment
has text: I had tried using Part filePart = request.getPart("file"); I couldn't get the result . It is returning null.
comment on: http://stackoverflow.com/a/21905382
type: AnswerComment

http://stackoverflow.com/comment/33281693
type: Comment
type: QuestionComment
score: 0
has text: I have to mention that the controller is inside the class:@RequestMapping("/customprop") public class CustomPropertyController {....}
comment on: http://stackoverflow.com/q/21964959

http://stackoverflow.com/q/21964912
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/21964960
has comment: http://stackoverflow.com/comment/33281451
answer count: 2
has title: cannot create directory using mkdir() method
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33281354
has comment: http://stackoverflow.com/comment/33281364
tagged with: mkdir
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33281300
has answer: http://stackoverflow.com/a/21965008
has body: import java.io.*; public class mkdir { public static void main(String[] args) { mkdir m = new mkdir(); File d = new File("D:\\Mobile Developer tools\\eclipse"); try { if(d.mkdir()) System.out.println("Directory created :D"); else System.out.println("Directory is not created :("); } catch(Exception e) { } } } I tried the above code to create a directory but the above code shows the output "Directory is not created :(" is there any logical error in this program , thanks in advance
downvote count: 1
type: Question

http://stackoverflow.com/q/21843956
answer count: 0
has comment: http://stackoverflow.com/comment/33081464
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33065385
has comment: http://stackoverflow.com/comment/33065316
tagged with: java
has title: How does tomcat jdbc pool cache the query results?
type: Question
has body: I have encountered an issue, that is, tomcat jdbc pool cooperating with hibernate caches query results, but I have banned hibernate's cache. But when I switch jdbc pool to DBCP, the issue get disappeared. So I ensure that there's a query result cache in tomcat jdbc pool, but I haven't found any documents on this issue. Could someone tell me how to close the query cache in tomcat jdbc pool ? it runs in tomcat-jdbc-7.0.47 and there is the configuration below. &lt;bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close"&gt; &lt;property name="driverClassName" value="com.mysql.jdbc.Driver"/&gt; &lt;property name="url" value="jdbc:mysql://192.168.1.104:3306/uip_test_1?useUnicode=true&amp;amp;characterEncoding=UTF8&amp;amp;zeroDateTimeBehavior=convertToNull"/&gt; &lt;property name="username" value="root"/&gt; &lt;property name="password" value="root"/&gt; &lt;property name="defaultAutoCommit" value="false"/&gt; &lt;!--&lt;property name="initialSize" value="10" /&gt;--&gt; &lt;property name="maxActive" value="40"/&gt; &lt;property name="maxIdle" value="10"/&gt; &lt;property name="maxWait" value="60000"/&gt; &lt;property name="testOnBorrow" value="true"/&gt; &lt;property name="timeBetweenEvictionRunsMillis" value="3600000"/&gt; &lt;property name="testWhileIdle" value="true"/&gt; &lt;property name="validationQuery" value="select 1 from dual"/&gt; &lt;/bean&gt;
tagged with: tomcat
score: 0
tagged with: jdbc-pool
tagged with: jdbc
has comment: http://stackoverflow.com/comment/33065254
has comment: http://stackoverflow.com/comment/33065580

http://stackoverflow.com/comment/33242573
comment on: http://stackoverflow.com/q/21943237
type: QuestionComment
score: 1
has text: Please edit your question to include an [*Minimal, Complete, Tested and Readable Example*](http://stackoverflow.com/help/mcve) that exhibits the problem you describe; some examples are cited [here](http://stackoverflow.com/a/14432646/230513).
type: Comment

http://stackoverflow.com/a/21991550
upvote count: 1
has comment: http://stackoverflow.com/comment/33328553
has comment: http://stackoverflow.com/comment/33328241
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33328384
type: Answer
answers question: http://stackoverflow.com/q/21991524
has body: To re-quote the javadoc Determines if the specified Object is assignment-compatible * with the object represented by this Class. In the expression java.lang.Integer.class.isInstance(java.lang.Number.class); you are checking if the object returned by the expression java.lang.Number.class is an instance of Integer. It is not, it is an instance of java.lang.Class. It should be used like java.lang.Integer.class.isInstance(new Integer(1)); // if you want it to return true You can pass it anything you want, but it will only return true if the argument used is an Integer or one of its sub types (but it is final so there aren't any). Integer is a sub type of Number. Any Integer instance can be used where a Number object is required.
accepted answer of: http://stackoverflow.com/q/21991524
score: 1

http://stackoverflow.com/q/21949570
tagged with: java
accepted answer: http://stackoverflow.com/a/21949596
type: Question
downvote count: 0
tagged with: int
has title: Java 8 Streams int and Integer
answer count: 1
favorite count: 0
tagged with: integer
has answer: http://stackoverflow.com/a/21949596
has body: Was just getting my hands dirty with Java 8 and stumbled on a behaviour as below - public static void main(String... args){ System.out.println("[Start]"); int[] ints = {1, 2, 3, 4}; Stream.of(ints).forEach(i-&gt;System.out.println("Int : "+i)); Integer[] integerNums = {1, 2, 3, 4}; Stream.of(integerNums).forEach(i-&gt;System.out.println("Integer : "+i)); System.out.println("[End]"); } And the output is : [Start] Int : [I@5acf9800 Integer : 1 Integer : 2 Integer : 3 Integer : 4 [End] Whereas I was expecting the code to print all int's and Integer's in both the cases? Any insights on this would be greatly helpful...
score: 6
tagged with: java-8
upvote count: 6
type: AnsweredQuestion
tagged with: java-stream

http://stackoverflow.com/comment/102537430
comment on: http://stackoverflow.com/a/21964831
type: Comment
type: AnswerComment
has text: @johnktejik - Look into how the standard components work in Swing. My answer is written with the assumption that the reader already knows how to display a GUI with a textbox or something in Swing, and just expands on how to go from displaying a standard component to making your own component and displaying that instead.
score: 0

http://stackoverflow.com/q/21957612
has answer: http://stackoverflow.com/a/21957759
has title: Setting Loaded GIF as a Background
has comment: http://stackoverflow.com/comment/33267843
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/11959758
possible better answer: http://stackoverflow.com/a/21959398
linked to: http://stackoverflow.com/q/10836832
tagged with: java
tagged with: swing
has body: Situation: I have a JFrame and I have managed to import the GIF and display it in the Main Panel however it moves all of my other panels down, causing my GUI to be in disarray. Question: How should I go about making the GIF the background instead of adding to the Main Panel Like I am doing? Note: The code is simply making a Jframe ,setting it's details, adding the panels then displaying the GIF as a Jlabel. If you need the code I can display it below.
has comment: http://stackoverflow.com/comment/33267927
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/21960539
accepted answer: http://stackoverflow.com/a/21960539
has comment: http://stackoverflow.com/comment/33268007
has answer: http://stackoverflow.com/a/21959398
answer count: 3
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/15493219

http://stackoverflow.com/comment/33134999
type: Comment
type: QuestionComment
has text: Did you try to run the generate query on the Database directly and see if it returned any values ? Do you have any data in those tables ?
comment on: http://stackoverflow.com/q/21883366
score: 0

http://stackoverflow.com/comment/33267902
score: 0
comment on: http://stackoverflow.com/a/21957185
type: AnswerComment
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/48150/discussion-between-nil-and-hoosier)
type: Comment

http://stackoverflow.com/q/21845715
tagged with: twitter4j
tagged with: java
accepted answer: http://stackoverflow.com/a/21845893
downvote count: 0
answer count: 1
tagged with: twitter-streaming-api
favorite count: 0
has answer: http://stackoverflow.com/a/21845893
score: 2
type: AnsweredQuestion
upvote count: 2
has body: I want to perform certain actions when a particular user tweets something. So is it possible in twitter4j to listen to tweets from a particular user account and handle the event? I know what the answer would be: read streaming api. But I think its too vast for my purpose and I only want to listen to tweets from a particular account.Hence I am asking it here.
type: Question
has title: Twitter4j Listen to tweets from a particular user

http://stackoverflow.com/comment/33118619
has text: Can you be more specific about what it is you're trying to do? Why will a Java object with nullable fields not suffice for the representation?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21874001

http://stackoverflow.com/q/21974366
has answer: http://stackoverflow.com/a/21974686
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/33298139
type: Question
has comment: http://stackoverflow.com/comment/33297922
answer count: 1
score: 0
tagged with: netbeans
has body: How would i go about modifying this program? The program was made to simulate a traffic light and the changing of the lights happens with a button click. I have made the program work just fine under the parameters of the assignment. The assignment needed 4 classes, a JFrame and 2 nested JPanels (one for trafficcontrol and one for the trafficlight panels). I However cannot seem to answer the last question of how to separate the innerclass for the action listener into its own separete entity, and still get the program to work. The Question An inner class is used to facilitate communication between two classes when they have an intimate relationship. Make the inner class (ChangeListener) a regular class by taking it out from TrafficControlPanel and observe the complication involved in making them communicate and the intimacy of the two classes. Here is the program Package traffic.light; import javax.swing.JFrame; public class TrafficLight extends JFrame { public static void main (String[] args) { JFrame frame = new JFrame("Traffic Light"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(150, 230); frame.add(new TrafficControlPanel()); frame.pack(); frame.setVisible(true); } } package traffic.light; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class TrafficLightPanel extends JPanel { private int currentState = 0; private final int NUM_LIGHTS = 3; // the number of lights private final int X = 50, Y = 10, WIDTH = 50, HEIGHT = 130; //box size private final int DIAMETER = 30; // light diameter private final int X_OFFSET = 10, Y_OFFSET = 10; // offsets to position the lights in the box private final int PANEL_WIDTH = 150, PANEL_HEIGHT = 230; // the size of a traffic control panel //----------------------------------------------------------------- // Creates the traffic light panel //----------------------------------------------------------------- public void TrafficLightPanel() { setPreferredSize(new Dimension(150, 230)); setL…
type: UnansweredQuestion
tagged with: swing
tagged with: jbutton
has title: Traffic light application: Implementing ActionListener in its own class

http://stackoverflow.com/q/21884496
has title: Not able to create instance of interface but an object
tagged with: java
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33137434
has comment: http://stackoverflow.com/comment/33137082
has answer: http://stackoverflow.com/a/21884525
favorite count: 0
has comment: http://stackoverflow.com/comment/33137111
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33136937
linked to: http://stackoverflow.com/q/9098235
has body: In java we are not able to create an instance of an interface like this: iJack obj = new iJack(); //iJack is an interface However, I noticed that we can do this: iJack obj; What is the difference between the two? In addition to that, I noticed that you can nest a class within an interface, how is this useful? I can not think of a practical purpose for this. Here is an example of what I am talking about: public interface iJack { public abstract class Jack_class { } }
upvote count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/21884960
type: Question
has comment: http://stackoverflow.com/comment/33137357

http://stackoverflow.com/q/21865370
has comment: http://stackoverflow.com/comment/33103712
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/21884053
has answer: http://stackoverflow.com/a/21883680
tagged with: java
has comment: http://stackoverflow.com/comment/33103658
has comment: http://stackoverflow.com/comment/33103413
type: Question
tagged with: escaping
has title: Efficient way to unescape HTML escape characters WITHOUT external library
score: 0
answer count: 2
tagged with: string
has comment: http://stackoverflow.com/comment/33104596
has body: Now if I want to convert HTML escape characters to readable String I have this method: public static String unescapeHTML(String text) { return text .replace("&amp;#8482;", "™") .replace("&amp;euro;", "€") .replace("&amp;#32;", " ") .replace("&amp;nbsp;", " ") .replace("&amp;#33;", "!") .replace("&amp;#34;", "\"") .replace("&amp;quot;", "\"") .replace("&amp;#35;", "#") .replace("&amp;#36;", "$") .replace("&amp;#37;", "%") .replace("&amp;#38;", "&amp;") //and the rest of HTML escape characters .replace("&amp;amp;", "&amp;"); } My goal is not to use any external library like Apache (class StringUtils), etc. Because the list is quite long - more than 300 chars - it would be nice to know what would be the fastest way to replace them?
type: UnansweredQuestion

http://stackoverflow.com/a/38664260
accepted answer of: http://stackoverflow.com/q/21894873
downvote count: 2
type: Answer
upvote count: 54
answers question: http://stackoverflow.com/q/21894873
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/114098780
has comment: http://stackoverflow.com/comment/113822717
has body: You can try the JSON Schema Faker. It will take a schema and generate/output a JSON object that will validate against the schema. Code available on githubcom
score: 52
has comment: http://stackoverflow.com/comment/116699917

http://stackoverflow.com/comment/33329466
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21990454
has text: Sorry it was my mistake, it really works. Thank you!
type: AnswerComment

http://stackoverflow.com/comment/33171442
type: AnswerComment
comment on: http://stackoverflow.com/a/21868288
type: Comment
score: 0
has text: android's Activity. I want to send the data from one activity to another

http://stackoverflow.com/q/21976323
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22028915
downvote count: 0
tagged with: java
tagged with: wildfly
type: Question
has answer: http://stackoverflow.com/a/22028915
upvote count: 2
answer count: 1
tagged with: jax-rs
favorite count: 0
tagged with: resteasy
has body: Here's the intereceptor code, which is the only difference in whether I get these errors. package com.lm.infrastructure; import java.io.IOException; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.container.PreMatching; import javax.ws.rs.ext.Provider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Provider @PreMatching class RequestLogger implements ContainerRequestFilter { @Override public void filter( ContainerRequestContext crc ) throws IOException { log.warn( "crc = {}", crc ); } public final Logger log = LoggerFactory.getLogger( this.getClass() ); } Here are the errors I'm getting JBAS014775: New missing/unsatisfied dependencies: service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".WeldBootstrapService (missing) dependents: [service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".WeldInstantiator, service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."org.jboss.weld.servlet.WeldInitialListener".WeldInstantiator, service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.faces.webapp.FacetTag".WeldInstantiator, service jboss.undertow.deployment.default-server.default-host./NornLM, JBAS014799: ... and 6 more ] service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".WeldStartService (missing) dependents: [service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".WeldInstantiator, service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."org.jboss.weld.servlet.WeldInitialListener".WeldInstantiator, service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component."javax.faces.webapp.FacetTag".WeldInstantiator, service jboss.deployment.unit."f1b8aa25-3eca-4497-81b2-10788d1c852b.war".component.…
has title: JAX-RS Request interceptor missing dependencies

http://stackoverflow.com/q/21915198
accepted answer: http://stackoverflow.com/a/21915278
type: Question
has body: Like many other question explained that while(true) {} is an infinite loop and so is for( ; ;) my question is while(true) makes sense the conditions is always true but there is no vivid condition true/false in for( ; ;) so how is the later an infinite loop.
tagged with: for-loop
tagged with: infinite-loop
has answer: http://stackoverflow.com/a/21915355
downvote count: 0
has comment: http://stackoverflow.com/comment/33192445
has comment: http://stackoverflow.com/comment/33192598
tagged with: while-loop
tagged with: language-agnostic
has title: How for( ; ;) is infinite loop?
has comment: http://stackoverflow.com/comment/33192501
favorite count: 0
has answer: http://stackoverflow.com/a/21915424
has answer: http://stackoverflow.com/a/21915278
possible better answer: http://stackoverflow.com/a/21915269
has answer: http://stackoverflow.com/a/21915253
answer count: 5
has answer: http://stackoverflow.com/a/21915269
score: 11
has comment: http://stackoverflow.com/comment/33192178
upvote count: 11
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7081339
tagged with: java
duplicate of: http://stackoverflow.com/q/7081339

http://stackoverflow.com/comment/33264355
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21870868
has text: Please try something under this [guide](http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html#wp17314) and ask about programming questions you have.
score: 0

http://stackoverflow.com/q/21985329
score: 6
has comment: http://stackoverflow.com/comment/33316706
has comment: http://stackoverflow.com/comment/33316752
has answer: http://stackoverflow.com/a/51443111
has answer: http://stackoverflow.com/a/21985428
has comment: http://stackoverflow.com/comment/33317331
type: Question
tagged with: hashcode
has title: HashCode implementation for class whose all instances are equal
tagged with: equality
answer count: 3
downvote count: 0
favorite count: 0
has body: Suppose I have a class where all instances are considered equal. A typical use case is for classes that do not have any state, but only behave as functions. public class ToStringFunction implements Function&lt;Object, String&gt; { @Override public String apply(Object o) { return o.toString(); } @Override public boolean equals(Object o) { return o instanceof ToStringFunction; } } Now, how should one implement a hashCode method? Naturally, it needs to be a constant value in order to honor the equals/hashCode contract. But what value should that be? If some trivial value such as 0 or 1 was used, it could lead to collisions with other similar classes. So it seems that this boils down to the question: how to implement a hashCode that is likely to be unique for a given class, but the same for all of its instances. I came up with these two ideas. What do you think, are they sane? @Override public int hashCode() { return ToStringFunction.class.hashCode(); } @Override public int hashCode() { return "ToStringFunction".hashCode(); }
has answer: http://stackoverflow.com/a/21985606
upvote count: 6
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/21954973
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: I'd like to complement the other answers. Even though I think you should store your data in a more efficient data structure than just a string, I think there might be another reason you code is slow. Since your file size seems to be around 100 MB, your code might be slowing down because Eclipse has not allocated enough heap space for it. Try adding the following flag: -Xmx4G This will give your code 4 GB of heap space to work with. To do this, in Eclipse go to: // Run -&gt; Run Configurations -&gt; &lt;Select your main class on the left&gt; // -&gt; &lt;Select the 'Arguments' tab&gt; // -&gt; &lt;Add the string "-Xmx4G" to the 'VM arguments' text area&gt; This might speed it up!
answers question: http://stackoverflow.com/q/21954240

http://stackoverflow.com/a/21884714
type: Answer
has body: This is definitely a case for ThreadLocal. ThreadLocal values are stored in the Thread object, rather than in a concurrent map, so there is absolutely no locking involved, and is therefore much more efficient. Also note that values attached to the thread through a ThreadLocal are automatically discarded when the thread dies, which won't happen with ConcurrentHashMap. One last thing, though: if you have threads that are "reused" in some way, such as workers kept in a pool, you should most probably clear the ThreadLocal's value before returning the thread to the pool. Otherwise, you may leak one task's context into the next task, which might pose either performance, correctness or security issues.
upvote count: 14
has comment: http://stackoverflow.com/comment/129590055
score: 14
downvote count: 0
answers question: http://stackoverflow.com/q/21884359

http://stackoverflow.com/comment/33190200
comment on: http://stackoverflow.com/q/21912842
has text: i believe version wont be a problem. i have executed the program before
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22099296
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21998659
answers question: http://stackoverflow.com/q/21998659
has comment: http://stackoverflow.com/comment/73585470
type: AcceptedAnswer
downvote count: 0
has body: I spent a while experimenting with this and this is my conclusion: An event is repeated, for file f and event type e, if multiple e type events occurred to the same file f. If an e type event occurred to multiple files f1, f2, and f3, but only once each, then none of those events are repeated. When you .take() a WatchKey from the WatchService, you will get a WatchEvent for each file which experienced an event, for each event type it experienced. The .count() will be greater than 1 if that type of event happened to that file multiple times since you last get a WatchKey from the WatchService. That is, if you are watching a directory which has A.txt in it, and then the following events happen: B.txt is created in the directory. B.txt is written to. A.txt is written to. B.txt is deleted. A.txt is written to again. You will get four WatchEvents: The create event for B.txt. The modify event for B.txt. The modify event for A.txt. Its .count() will be 2. The delete event for B.txt. This means that you will never get more than 3*n events in your WatchKey, where n is the number of files that were in the directory at any point. There are four types of events defined in StandardWatchEventKinds, but the OVERFLOW event indicates that events may have been lost, so I omitted it from the above number.

http://stackoverflow.com/q/21864320
tagged with: animation
has body: I am trying to write some simple snake-game. For that I've got an ArrayList with Rectangles. Changing direction already works. But now, when I add more rectangles (Snake body parts), how can i achieve them to follow the "head"? I mustn't change the direction of the entire ArrayList, this would end up in some long block moving up or down. It the body should follow the head's movement, go AFTER the head. How can I achieve that? That's my not working completely useless update method of the snake... ArrayList&lt;Rectangle&gt; rects; public void update() { if(isMoving &amp;&amp; System.currentTimeMillis() - moveTimer &gt; moveSpeed) { rects.get(0).setLocation((int)(rects.get(0).getX()+dx*Core.GRID_SIZE), (int)(rects.get(0).getY()+dy*Core.GRID_SIZE)); for(int i = 0; i &lt; rects.size()-1; i++) { if(rects.get(i).getX() &lt; rects.get(i+1).getX()) { rects.get(i).setLocation((int)(rects.get(0).getX()+Core.GRID_SIZE), (int)(rects.get(i).getY())); } } moveTimer = System.currentTimeMillis(); }
tagged with: java
tagged with: sprite
type: Question
has title: Snake(Game)-like moving rectangles
has comment: http://stackoverflow.com/comment/33101283
score: 0
has answer: http://stackoverflow.com/a/21864830
has comment: http://stackoverflow.com/comment/33101311
answer count: 1
has comment: http://stackoverflow.com/comment/33101255
type: UnansweredQuestion

http://stackoverflow.com/comment/33215818
type: Comment
has text: @Kjartan because my server is java and my client program is c#
comment on: http://stackoverflow.com/q/21928277
score: 0
type: QuestionComment

http://stackoverflow.com/q/21901912
has comment: http://stackoverflow.com/comment/33168651
type: Question
has comment: http://stackoverflow.com/comment/33168937
has comment: http://stackoverflow.com/comment/33169246
has comment: http://stackoverflow.com/comment/33169483
tagged with: jboss6.x
score: 0
linked to: http://stackoverflow.com/q/21673420
has comment: http://stackoverflow.com/comment/33169614
has comment: http://stackoverflow.com/comment/33168600
answer count: 0
has title: What is "Error installing to Parse: name=vfs://.." in JBoss 6.1.0 AS
has comment: http://stackoverflow.com/comment/33169305
type: UnansweredQuestion
has body: I got this error when I try to start the JBoss AS 6.1.0. What could be the reason for that ? In what cases that error appears ?
tagged with: java
has comment: http://stackoverflow.com/comment/33169900

http://stackoverflow.com/q/21999963
has answer: http://stackoverflow.com/a/22000463
has title: making onItemSelected visible to entire class
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22000024
possible better answer: http://stackoverflow.com/a/22000463
tagged with: java
has body: I'm new to this android/java stuff. I have this onItemSelected that will toast what has been selected in the spinner. I want to have the string resumeTableName accessible throughout my entire class that has the value of the selected spinner object. Right now it toasts the selected value however at other places in my class the resumeTableName remains null. I thought the public modifier would make it visible. How do I make this visible, do I use some sort of return? @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) { // On selecting a spinner item String resumeTableName = parent.getItemAtPosition(position).toString(); // Showing selected spinner item Toast.makeText(parent.getContext(), resumeTableName, Toast.LENGTH_LONG).show(); }
type: Question
accepted answer: http://stackoverflow.com/a/22000024
score: 0
answer count: 2
tagged with: android

atomic
type: Tag
tags question: http://stackoverflow.com/q/21853585
tag name: atomic

http://stackoverflow.com/comment/33186842
has text: Why ? he did not mentioned where the integer or string is gonna come
comment on: http://stackoverflow.com/a/21912106
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22002500
tagged with: increment
has comment: http://stackoverflow.com/comment/33348160
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22002515
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/22002528
type: Question
has title: Why is my increment not being calculated right?
possible better answer: http://stackoverflow.com/a/22002528
has body: I've got a for-loop running, and it asks them for the increment number. But when it outputs the table, it actually doubles the increment. So if I put in 10 for incr it will go up by 20. Please help? for (double x = fah1; x &lt;= fah2; x+=incr) { double cel = 5/9.0 * (x-32); if (x &lt;= 99){ System.out.println(x + " " + df.format(cel); x+= incr; } else { System.out.println(x + " " + df.format(cel)); x+=incr; } }
answer count: 2
tagged with: for-loop
score: 2
has answer: http://stackoverflow.com/a/22002515
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/21934989
tagged with: spring-mvc
tagged with: jndi
tagged with: java
has answer: http://stackoverflow.com/a/21935379
score: 4
type: Question
has answer: http://stackoverflow.com/a/33901112
favorite count: 0
has title: javax.naming.NameNotFoundException: Name [jdbc/spitterDS] is not bound in this Context. Unable to find [jdbc]
has answer: http://stackoverflow.com/a/25755105
tagged with: jdbc
has answer: http://stackoverflow.com/a/23199449
upvote count: 4
answer count: 4
downvote count: 0
type: UnansweredQuestion
tagged with: mysql
has body: I am trying to access a JNDI datasource in tomcat using Spring's jee jndi-lookup tag. The exception is indicating that I haven't registered my datasource correctly but I'm unable to figure out why not. Here is my code:- service-context.xml:- <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd"> <context:component-scan base-package="spitter" /> <mvc:annotation-driven /> <jee:jndi-lookup id="dataSource" jndi-name="/jdbc/spitterDS" resource-ref="true" /> </beans> webapp/META-INF/context.xml:- WEB-INF/web.xml <Resource name="jdbc/spitterDS" auth="Container" type="org.apache.commons.dbcp.BasicDataSource" maxActive="100" maxIdle="30" maxWait="10000" username="root" password="password" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/spitter" /> web.xml:- <?xml version="1.0" encoding="UTF-8"?> Spitter Spitter DS jdbc/spitterDS org.apache.commons.dbcp.BasicDataSource Container contextConfigLocation classpath:service-context.xml org.springframework.web.context.ContextLoaderListener dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher / and finally, MainController.java:- package spitter.mvc; import java.sql.Connection; im…

scroll
tags question: http://stackoverflow.com/q/21962031
tags question: http://stackoverflow.com/q/22002642
type: Tag
tag name: scroll

http://stackoverflow.com/comment/33138718
type: Comment
type: QuestionComment
has text: Exception stack trace says otherwise: `Cannot get property 'grailsResourceProcessor' on null object`.
comment on: http://stackoverflow.com/q/21885330
score: 0

http://stackoverflow.com/comment/124167632
has text: thatnks as always, fadden. can u please do some more work so everything will be done and i dont need to move my finger .... thanks fadden. real appreciated XD
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21842536
score: 0

http://stackoverflow.com/q/21872895
answer count: 2
score: -1
has comment: http://stackoverflow.com/comment/33116933
downvote count: 2
tagged with: exception
upvote count: 1
has comment: http://stackoverflow.com/comment/33116879
possible better answer: http://stackoverflow.com/a/21872989
linked to: http://stackoverflow.com/q/299068
has title: What is the need to throw Runtime Exception
favorite count: 0
has body: I don't want to throw Runtime Exceptions. I always enclose my code with try-catch block. So if there is any exception, it will be immediately be caught. I know this is not a good programming practice, but I am quite keen to know whether there will be any performance issue for taking this approach?
accepted answer: http://stackoverflow.com/a/21873021
type: AnsweredQuestion
tagged with: performance
tagged with: java
has answer: http://stackoverflow.com/a/21872989
has comment: http://stackoverflow.com/comment/33116524
has answer: http://stackoverflow.com/a/21873021
type: Question

http://stackoverflow.com/comment/33139555
type: Comment
comment on: http://stackoverflow.com/a/21875916
has text: `writeInt()` will store any integer as 4 bytes, and `readInt()` will read 4 bytes from the file to create an integer. The number of digits in the integer does not matter.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33166242
type: Comment
type: QuestionComment
has text: I've posted [an answer](http://stackoverflow.com/a/21884207/849891) to this question under [its duplicate as marked here](http://stackoverflow.com/questions/18667400/printing-out-prime-numbers-from-2-to-1000).
score: 0
comment on: http://stackoverflow.com/q/21868117

http://stackoverflow.com/comment/33310944
comment on: http://stackoverflow.com/a/21981596
type: AnswerComment
score: 0
has text: in both cases you are getting 0?
type: Comment

http://stackoverflow.com/q/21913795
has comment: http://stackoverflow.com/comment/33189918
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33191412
tagged with: java
tagged with: android-camera-intent
type: Question
has title: Taking image from native camera without a sdcard
has comment: http://stackoverflow.com/comment/33189548
score: 0
has comment: http://stackoverflow.com/comment/33189732
has comment: http://stackoverflow.com/comment/33190411
answer count: 1
has comment: http://stackoverflow.com/comment/33196065
has body: I am trying to write a application which i will take image from camera and use it. At first i used Bitmap image = (Bitmap) data.getExtras().get("data"); However i noticed that this will just return thumbnail of the image. So i updated my code as: public void takePhoto(){ Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); File dir = context.getDir("directory", Context.MODE_PRIVATE); File photo = new File(dir, "Pic.jpg"); mImageUri = Uri.fromFile(photo); intent.putExtra(MediaStore.EXTRA_OUTPUT, mImageUri); startActivityForResult(intent, 0); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data){ super.onActivityResult(requestCode, resultCode, data); if(requestCode == 0){ if(Activity.RESULT_OK == resultCode){ Uri selectedImage = mImageUri; getContentResolver().notifyChange(selectedImage, null); ContentResolver cr = getContentResolver(); Bitmap bitmap; try { bitmap=android.provider.MediaStore.Images.Media.getBitmap(cr, selectedImage); displayIV.setImageBitmap(bitmap); } catch (Exception e) { // TODO: handle exception } } } } Problem is after upgrading the code it stopped calling onActivityResult function after i finish taking photo. After taking picture i am clicking DONE button on camera screen but it doesnt call the application back. The app stays in camera screen. Any idea what i am doing wrong?
has answer: http://stackoverflow.com/a/21917813
accepted answer: http://stackoverflow.com/a/21917813
tagged with: android
has comment: http://stackoverflow.com/comment/33194388

http://stackoverflow.com/a/21995740
accepted answer of: http://stackoverflow.com/q/21995617
has comment: http://stackoverflow.com/comment/33337618
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33336851
has body: You can call as: test(new JButton[3][3]); And your methods will looks like this: private void test(JButton[][] buttons){...} Updated your method will be the following: JButton getRandomButton(JButton[] buttons) { Random rand = new Random(); return buttons[rand.nextInt(buttons.length)]; } And if you wand the 2D array above, you can use it as following: for (int i = 0; i &lt; buttons.length; i++) { JButton randomButton = getRandomButton(buttons[i]); }
has comment: http://stackoverflow.com/comment/33336693
type: Answer
has comment: http://stackoverflow.com/comment/33336606
has comment: http://stackoverflow.com/comment/33337007
has comment: http://stackoverflow.com/comment/33336094
has comment: http://stackoverflow.com/comment/33337102
answers question: http://stackoverflow.com/q/21995617
upvote count: 1
has comment: http://stackoverflow.com/comment/33335841
score: 1

http://stackoverflow.com/q/21891498
favorite count: 0
tagged with: sftp
tagged with: file-upload
upvote count: 2
has answer: http://stackoverflow.com/a/21912170
has title: How to reput on JSch SFTP?
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21912170
score: 2
downvote count: 0
answer count: 1
has body: I'm using JSch to upload files to a SFTP. It works but sometimes the TCP connection is shut down while a file is being uploaded resulting on a truncated file on the server. I found out that the reput command on SFTP servers resumes the upload. How can I send a reput command with JSch? Is it even possible? Here's my code: public void upload(File file) throws Exception { JSch jsch = new JSch(); Session session = jsch.getSession(USER, HOST, PORT); session.setPassword(PASSWORD); java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.connect(); Channel channel=session.openChannel("sftp"); channel.connect(); ChannelSftp sftpChannel = (ChannelSftp)channel; sftpChannel.put(file.getAbsolutePath(), file.getName()); channel.disconnect(); session.disconnect(); }
tagged with: jsch

http://stackoverflow.com/q/21892390
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33152101
downvote count: 0
score: 1
has title: Java Android Emulator: Crash when using Maps v2 (Caused by android.view.InflateException: Binary XML file line #11: Error Inflating class fragment
tagged with: java
linked to: http://stackoverflow.com/q/19372399
tagged with: android-emulator
type: Question
linked to: http://stackoverflow.com/q/14040185
has body: I am trying to show Google Maps on my application but it always crash. I have gotten the API from Google and already added the Google Play Service library to my project. The Map is called in DisplayResult.java Here is my AndroidManifest.xml: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.chicagobus" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19" /> <permission android:name="com.vogella.android.locationapi.maps.permission.MAPS_RECEIVE" android:protectionLevel="signature" /> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="com.example.newmapview.permission.MAPS_RECEIVE" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.example.chicagobus.MainActivity" /> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.example.chicagobus.MainActivity" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyB8J8kUL9n..................." /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> And this is the layout of DisplayResult.java that calls the map: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"…
linked to: http://stackoverflow.com/q/18459338
tagged with: google-maps
upvote count: 1
has answer: http://stackoverflow.com/a/21892469
tagged with: android
answer count: 1
linked to: http://stackoverflow.com/q/19541681

http://stackoverflow.com/a/21969334
has body: I think you should split the allRowsInCSVFile to multiple lists each for one date then you can draw the prepared statement out of the loop (sort of). It will not be as you exactly want, but it will a batch for each date. I think that will be a compromise that you have to do.
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21969200

remote-debugging
tag name: remote-debugging
tags question: http://stackoverflow.com/q/21869288
type: Tag

http://stackoverflow.com/comment/33181516
type: QuestionComment
has text: Could you kindly publish ALL error log?
comment on: http://stackoverflow.com/q/21908990
score: 0
type: Comment

http://stackoverflow.com/a/21846057
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21845798
type: Answer
answers question: http://stackoverflow.com/q/21845798
has body: AVD cannot test a lot of Android features, especially sensors. In case the USB is unavailable for debug in physical device, you can: change to a computer with non-blocking USB, and debug it with real device. make a .apk and install in a real device &amp; diagnose with on-screen debug messages enable "ADB over Network", then you can debug the app with Bluetooth / Wi-Fi network
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/33337360
score: 0
has text: Thanks guys, I found it a few min after asking the question but don't have enough point to answer my own question...Yeah i know about eclipse although the course im doing comes with soft ware we have to use its a introduction to java course so i have to use a basic editor cant use a IDE....might sound odd, but how is it off topic this is the java exchange?
type: Comment
comment on: http://stackoverflow.com/a/21996589
type: AnswerComment

http://stackoverflow.com/comment/33146915
type: AnswerComment
comment on: http://stackoverflow.com/a/21889656
score: 0
type: Comment
has text: Is there a way to make the parseInt happen after they hit the calculate button?

http://stackoverflow.com/q/21959804
possible better answer: http://stackoverflow.com/a/21960001
has body: I'm populating an array by taking data from a mysql table, and what I'm trying to do is iterate through that array, check the value of each item and then do perform different actions depending on what the value is. This is the code for the method where I connect to the database and try and iterate through the array public void HomeRecord(){ ArrayList&lt;HomeTeamResults&gt; allResults = new ArrayList&lt;&gt;(); try { //Sets up the connedtion to the database and installs drivers which are required. Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost", "username", "password"); String table = box1.getSelectedItem().toString(); String SQL = "SELECT * FROM " + table + " WHERE `HomeTeam` = ?"; PreparedStatement prepst; prepst = con.prepareStatement(SQL); prepst.setString(1,box1.getSelectedItem().toString()); rs = prepst.executeQuery(); HomeTeamResults hometeamResults=null; while (rs.next()) { hometeam = rs.getString("HomeTeam"); awayteam = rs.getString("AwayTeam"); result = rs.getString("Result"); custs = (hometeam + "," + awayteam + "," + result); allResults.add(hometeamResults); } } catch (Exception e) { System.out.println("Error " +e); } System.out.println("Size of HomeArrayList::"+allResults.size()); for(HomeTeamResults temp:allResults){ if(temp.getResult().equals("W")){ hometeamvalue = hometeamvalue + 50; } else if(temp.getResult().equals("D")){ hometeamvalue = hometeamvalue + 10; } else { hometeamvalue = hometeamvalue + 0; } } } And this is the code for the array public class HomeTeamResults { private String hometeam; private String awayteam; private String result; public String getHomeTeam() { return hometeam; } public void setHomeTeam(String hometeam) { this.hometeam = hometeam; } public String getAwayTeam() { return awayteam; } public void setAwayTeam(String awayteam) { this.awayteam = awayteam; public String getResult() { return result; } public void setResult(String result) { this.result = result; } private HomeTeamR…
has answer: http://stackoverflow.com/a/21960001
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21959880
accepted answer: http://stackoverflow.com/a/21959880
type: Question
tagged with: java
tagged with: mysql
score: 0
answer count: 2
has title: Iterating through an array and checking values of the items
tagged with: arrays

http://stackoverflow.com/q/22003136
tagged with: jscrollpane
accepted answer: http://stackoverflow.com/a/22003151
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33349482
tagged with: applet
favorite count: 0
upvote count: 2
has title: Why doesn't my scrollpane have scrollbars?
score: 2
has body: For some reason I can't get my scrollpane to be displayed within an applet. public void init() { JFrame frame = new JFrame(); JPanel panel = new JPanel(); JScrollPane scrPane = new JScrollPane(panel); scrPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); scrPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrPane.setLayout(new ScrollPaneLayout()); frame.getContentPane().add(scrPane); this.setVisible(true); }
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22003151
tagged with: swing
type: Question

http://stackoverflow.com/q/21905705
has comment: http://stackoverflow.com/comment/33175125
downvote count: 0
has comment: http://stackoverflow.com/comment/33176000
has title: redirect with model object in spring
tagged with: spring
type: AnsweredQuestion
has body: i need to pass an object into a page that i'm going to redirect @RequestMapping(value = "/createNewQuest",method={ RequestMethod.GET, RequestMethod.POST }) public ModelAndView createNewQuest(Quest quest,ModelAndView mav) { questService.addQuest(quest); mav.addObject("quest", quest); mav.setViewName("redirect:/control/displayQuest"); return mav; } my controller class seems like this but displayQuest page not getting the quest object? any help wil be greatly appreciabl..
possible better answer: http://stackoverflow.com/a/21905801
tagged with: java
has answer: http://stackoverflow.com/a/21905801
accepted answer: http://stackoverflow.com/a/21905830
type: Question
answer count: 2
tagged with: jsp
score: 4
has answer: http://stackoverflow.com/a/21905830
upvote count: 4
favorite count: 0

http://stackoverflow.com/a/21959590
has body: For a few of my games what i do is this: Hero hero; //User ArrayList&lt;Aliens&gt; aliens //ArrayList of enemies Lets say I want to check if they are colliding! for(i = 0; i &lt; aliens.size(); i++){ Aliens a = (Aliens) aliens.get(i); // &lt;-- This might be something you want to do if(hero.getBounds().intersects(a.getBounds()) kill(); else a.remove(i); } Now this is just an example but I am sure you should be able to use this in your program! I could help a bit more if you could provide more of your code!
has comment: http://stackoverflow.com/comment/33276622
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33276589
type: Answer
answers question: http://stackoverflow.com/q/21950524
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/21950524

http://stackoverflow.com/a/21904489
has comment: http://stackoverflow.com/comment/33173247
type: Answer
score: 2
upvote count: 2
has body: You need to pass a Customer object to the UpdateCustomer method, create an Customer object and fill it with your value , then pass it to the UpdateCustomer method, like: public static void main(String [] args) { connectTest(); Customer customer = new Customer(105,"John", 4179, "+4475855216");// note you should have a constructor takes the passed arguments. or you could use setter methods UpdateCustomer(customer); closeTest(); } You need to Read about methods and constructors in java Edit: You don't need to use SET keyword each time, just separate the columns you want to update by a coma, like: public static Customer UpdateCustomer(Customer customer){ System.out.println("Updating customer "); try { statement = connection.createStatement(); statement.executeUpdate("UPDATE customer " + "SET id = " + customer.getCustomerId() + ",name = " + customer.getName() + ",tagNo = " + customer.getTagNo() + ",telephoneNo = " + customer.getTelephoneNo() + ",email = " + customer.getEmail() + "SET noOfTimesRecycles = " + customer.getNoOfTimesRecycled()); } catch (SQLException ex) { System.out.println("Error in updating customer"); ex.printStackTrace(); } return customer; }
has comment: http://stackoverflow.com/comment/33173160
has comment: http://stackoverflow.com/comment/33174862
has comment: http://stackoverflow.com/comment/33173669
has comment: http://stackoverflow.com/comment/33173858
downvote count: 0
answers question: http://stackoverflow.com/q/21904400

http://stackoverflow.com/comment/33258478
type: QuestionComment
comment on: http://stackoverflow.com/q/21952319
has text: @fge Is it not thread safe because of memory consistency issues, or something else? I could see how it could cause memory consistency issues, but if it causes other issues, could you please give more details as to why it's not thread safe? Also, AtomicReference does look helpful, thanks, I will look into it further!
score: 0
type: Comment

http://stackoverflow.com/comment/33083615
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21854687
score: 0
has text: I avoided to say this, but is is already multithreaded. Essentially the file is splitted in a certain number of slices and each thread works on a slice. The loop I describe in the question is actually the work of a single thread

counter
tags question: http://stackoverflow.com/q/21855290
tag name: counter
tags question: http://stackoverflow.com/q/21905802
type: Tag

http://stackoverflow.com/comment/33168062
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21901240
type: Comment
has text: Ok, I've added `javaee-api-6.0.jar` into `WEB-INF`, but nothing is changed.

http://stackoverflow.com/q/21988426
type: UnansweredQuestion
tagged with: java
upvote count: 1
tagged with: swing
tagged with: jmenu
downvote count: 1
type: Question
score: 0
has comment: http://stackoverflow.com/comment/33322357
answer count: 1
tagged with: user-interface
favorite count: 0
has answer: http://stackoverflow.com/a/21988531
has body: -I am trying to display GUI with menubar containing menus like "Open","Run","Help" but all I am able to see in GUI is menu "File" import java.awt.*; import java.awt.event.*; import javax.swing.*; import net.miginfocom.swing.MigLayout; public class test11 extends JFrame { public test11(String title, int width, int height) { //setting up frame setTitle(title); setSize(width, height); setLocationRelativeTo(null); setMinimumSize(new Dimension(700, 500)); setVisible(true); setLayout(new MigLayout("debug, fillx, gap unrel rel","[grow, fill][fill]","[fill][fill]"));//no idea //Menubar JMenuBar m = new JMenuBar(); m.setBackground(new Color(192,192,192)); JMenu op = new JMenu("Open"); op.add(new JMenuItem("Catalogue")); op.add(new JMenuItem("Read a Paper!")); JMenuItem find = new JMenuItem("Find..."); find.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, KeyEvent.CTRL_MASK)); op.add(find); JMenuItem exit = new JMenuItem("Exit", KeyEvent.VK_E); exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.ALT_MASK)); exit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.exit(0); } }); op.add(exit); JMenu run = new JMenu("Run"); run.add(new JMenuItem("Search My System")); JMenuItem synchr = new JMenuItem("Start Synchronizer", 'S'); synchr.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_MASK)); run.add(synchr); JMenu help = new JMenu("Help"); JMenuItem h = new JMenuItem("Help Contents", 'H'); h.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, KeyEvent.CTRL_MASK)); help.add(h); help.add(new JMenuItem("Keyboard Shortcut Card")); help.add(new JMenuItem("About Application")); m.add(op); m.add(run); m.add(help); setJMenuBar(m); //Toolbar JToolBar toolBar = new JToolBar("Draggable"); JButton subject = new JButton("Subject"); toolBar.add(subject); add(toolBar, "span, height 20:35:50, wrap"); JPanel table = new JPanel(); JPanel sideBar = new JPanel(); add(table, "width 400:600:, dock center, growy"…
tagged with: netbeans
has title: JMenuBar not displaying right menu options

http://stackoverflow.com/q/21974748
tagged with: java
downvote count: 2
has body: I'm writing a code that looks through a given array list named values and returns True if found i've gotten it to work for a for-loop and a while-loop but can't figure out how to get the for-each loop to work. Here is what i have that'd giving me the error. EDIT: the error says "java.lang.IndexOutOfBoundsException: Index:642327, Size 30590 (in java.util.ArrayList) public String twoforEachFoundIt(ArrayList&lt;Integer&gt; values, int number){ for(int i:values) { if (values.get(i)== number){ return "True"; } } return null; }
has answer: http://stackoverflow.com/a/21974773
accepted answer: http://stackoverflow.com/a/21974797
has comment: http://stackoverflow.com/comment/33298989
type: Question
has title: ArrayOutOfBounds error when i run a for-each-loop in java
score: -2
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/21974779
upvote count: 0
has answer: http://stackoverflow.com/a/21974779
has answer: http://stackoverflow.com/a/21974787
favorite count: 0
has answer: http://stackoverflow.com/a/21974797
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/33298386
score: 1
has text: The reason that I don't use "msg.toString()" is that I don't want to make a second copy of the data. I use the msg.write() to write to file writers all the time, so I know this writes to a stream properly. The only other difference is the call to "connect" I will try that.
comment on: http://stackoverflow.com/a/21974655
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22001668
tagged with: absolute-value
accepted answer: http://stackoverflow.com/a/22001775
tagged with: modulus
has body: Say I have a limit of 5 meaning values from 0,1,2,3,4,5 The difference from (5 to 0) or (5 to 0) is 1 The difference from (5 to 1) or (1 to 5) is 2 The difference from (0 to 4) or (4 to 0) is 2 The way I seem to understand this is to only use the overwrap difference if the last value or the first value is used in any of the values. Other then that the normal ones that work with Math.abs should be fine Such as Math.abs(1-3) The difference from (1 to 3) is 2 The difference from (3 to 4) is 1 I can't seem to understand how to program the overwrap difference part. I tried this but it's nothing special, I think something with modulus operator will work but I can't seem to figure it out int value_one = 0; int value_two = 5; int answer = Math.abs(value_one - value_two); answer = (((answer % 5) + 5) % 5) + 1; System.out.println(answer); int answer2 = (value_one + value_two) % 5; System.out.println(answer2);
type: AnsweredQuestion
has title: How to find the difference of 2 values with overflow / overwrap values, modulus
tagged with: math
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22001775
tagged with: difference
answer count: 1
score: 0

http://stackoverflow.com/comment/33161744
score: 0
type: Comment
has text: @DavidWallace What I said was - the code is working - at least for me it worked.
type: AnswerComment
comment on: http://stackoverflow.com/a/21897785

http://stackoverflow.com/q/21875202
tagged with: ftp
has comment: http://stackoverflow.com/comment/33126384
has body: As per my requirement, I have developped a a java code that will FTP a file from local path to server. Now I want to store it in database as a procedure/function and want to call it from backend. Below is my code: CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "FtpUrlUpload" AS package net.codejava.ftp; import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; import java.net.URL; import java.net.URLConnection; import java.lang.String; public class FtpUrlUpload { private static final int BUFFER_SIZE = 4096; public static void main(String[] args) { String ftpUrl = "ftp://%s:%s@%s/%s;type=i"; String host = "127.23.21.10"; String user = "samuser"; String pass = "password"; String filePath = "E:/Work/Project.zip"; String uploadPath = "/MyProjects/archive/Project.zip"; ftpUrl = String.format(ftpUrl, user, pass, host, uploadPath); System.out.println("Upload URL: " + ftpUrl); try { URL url = new URL(ftpUrl); URLConnection conn = url.openConnection(); OutputStream outputStream = conn.getOutputStream(); FileInputStream inputStream = new FileInputStream(filePath); byte[] buffer = new byte[BUFFER_SIZE]; int bytesRead = -1; while ((bytesRead = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); } inputStream.close(); outputStream.close(); System.out.println("File uploaded"); } catch (IOException ex) { ex.printStackTrace(); } } } I am facing an issue while trying to compile it in database. Below is the issue: Errors for JAVA SOURCE FtpUrlUpload: LINE/COL -------------------------------------------------------------------------------- ERROR -------------------------------------------------------------------------------- 0/0 FtpUrlUpload:22: cannot resolve symbol 0/0 symbol : method format (java.lang.String,java.lang.String,java.lang.String,java .lang.String,java.lang.String) 0/0 1 error LINE/COL -------------------------------------------------------------------------------- ERROR -------------------------------------------…
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: plsql
has answer: http://stackoverflow.com/a/21886042
score: 0
has comment: http://stackoverflow.com/comment/33120675
answer count: 1
has title: Calling JAVA FTP program from PLSQL

http://stackoverflow.com/a/21860551
has comment: http://stackoverflow.com/comment/48969873
answers question: http://stackoverflow.com/q/21859579
has comment: http://stackoverflow.com/comment/33142379
has comment: http://stackoverflow.com/comment/48962325
accepted answer of: http://stackoverflow.com/q/21859579
has comment: http://stackoverflow.com/comment/33094429
type: Answer
score: 29
downvote count: 0
has body: You shouldn't need to change all your existing queries, you should only need to change the logic that establishes your MongoClient. Most applications do this as some sort of Singleton so adding authentication is just a matter of modifying the Singleton. It is a pain-in-the-butt that there isn't a signature that takes just String, String for username password, but its the Mongo Java API, get used to disappointment. You can either go the MongoURI path which gets you the shortest signature... MongoClient mongo = new MongoClient( new MongoClientURI( "mongodb://app_user:bestPo55word3v3r@localhost/data" ) ); Or go with the more verbose List&lt;MongoCredential&gt; path List&lt;ServerAddress&gt; seeds = new ArrayList&lt;ServerAddress&gt;(); seeds.add( new ServerAddress( "localhost" ); List&lt;MongoCredential&gt; credentials = new ArrayList&lt;MongoCredential&gt;(); credentials.add( MongoCredential.createMongoCRCredential( "app_user", "data", "bestPo55word3v3r".toCharArray() ) ); MongoClient mongo = new MongoClient( seeds, credentials );
upvote count: 29
has comment: http://stackoverflow.com/comment/33094625
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33137027

http://stackoverflow.com/q/21946958
possible better answer: http://stackoverflow.com/a/21956362
tagged with: apache-poi
answer count: 5
has answer: http://stackoverflow.com/a/21956362
accepted answer: http://stackoverflow.com/a/21947170
has answer: http://stackoverflow.com/a/67466447
type: AnsweredQuestion
has body: I tried to remove the third row THIS IS THE EDIT I made based on the comments of rgettman, Leo, zibi. Thank you. public class MainTest { public static void main(String[] args) throws IOException { FileInputStream file = new FileInputStream(new File("test.xlsx") ); XSSFWorkbook wb = new XSSFWorkbook(file); XSSFSheet sheet = wb.getSheetAt(0); sheet.removeRow(sheet.getRow(3)); // sheet.shiftRows(3, 3, -1); File outWB = new File("testResult.xlsx"); OutputStream out = new FileOutputStream(outWB); wb.write(out); out.flush(); out.close(); System.exit(0); } } But this deletes values in a row but does not remove the row
has answer: http://stackoverflow.com/a/68031460
tagged with: java
linked to: http://stackoverflow.com/q/54252684
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/33249093
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/21947170
has title: How to remove a row using apache poi
has comment: http://stackoverflow.com/comment/33249049
has answer: http://stackoverflow.com/a/21947231
favorite count: 0

http://stackoverflow.com/a/21954856
has comment: http://stackoverflow.com/comment/33263540
type: Answer
accepted answer of: http://stackoverflow.com/q/21954131
has comment: http://stackoverflow.com/comment/33264838
score: 1
has comment: http://stackoverflow.com/comment/33263567
has comment: http://stackoverflow.com/comment/33263375
answers question: http://stackoverflow.com/q/21954131
upvote count: 1
has body: As I mention in my other answer here, you need to be running the Java application in a JVM (Java Virtual Machine) with the same "bitness" as the installed version of the Access Database Engine (a.k.a. "ACE"). Since you have the 32-bit version of ACE installed you will need to run the Java application in a 32-bit JVM.
has comment: http://stackoverflow.com/comment/33264980
has comment: http://stackoverflow.com/comment/33263633
has comment: http://stackoverflow.com/comment/33263682
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33269607
type: QuestionComment
comment on: http://stackoverflow.com/q/21958040
score: 0
has text: That's exactly the result i'm taking from that.
type: Comment

http://stackoverflow.com/comment/33237937
has text: what if (editable.length() == 3 ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21940645

http://stackoverflow.com/a/21878846
has body: Your regex works this way: find space then one character then another space, and remove it. In this case spaces that surround one character can't be matched in test of another character like in case of _a_b_c ^^^ -this part matches our pattern so it will be removed leaving b_c and now neither `b` or `c` is surrounded with spaces so they will not be removed To solve this problem just include in match one or more spaces (or start of string) and one character after it like (^|\s+)\w. Also to make sure that after this character is at leas one space (or end of string) but to not include this spaces in match you can use look-ahead mechanism like (?=\s+|$). So in case of Java try String newString = yourString.replaceAll("(^|\\s+)\\w(?=\\s+|$)",""); and in JavaScript var replaced = text.replace(/(^|\s+)\w(?=\s+|$)/g,"") BTW \w will match any character from [a-zA-Z0-9_] so you can change it to something like [a-zA-Z] if you want only letters.
has comment: http://stackoverflow.com/comment/33131899
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33131871
answers question: http://stackoverflow.com/q/21878526
type: Answer
upvote count: 2
score: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/21878526

http://stackoverflow.com/q/21902306
tagged with: import
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21902393
has comment: http://stackoverflow.com/comment/33169549
tagged with: static
accepted answer: http://stackoverflow.com/a/21902323
has comment: http://stackoverflow.com/comment/33170091
tagged with: prefix
has body: Can in java declare? (1) import static com.example.core.MyClass; where: public MyClass{ public static double divide(){ ..... } public static double add(){ ..... } } and in the class where use static import to use freely: devide and add methods without the prefix - name of the class. From what I read we can do: import static com.example.core.MyClass.divide; import static com.example.core.MyClass.add; But Can we do it in one statement as I mentioned in (1)
has comment: http://stackoverflow.com/comment/33169242
type: AnsweredQuestion
tagged with: methods
has title: Is it possible to do static import on whole class by single declaration in Java?
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21902323
has answer: http://stackoverflow.com/a/21902393

http://stackoverflow.com/q/21953242
has title: Java : Program to check if entered number is a SUPER Number or not.. Could someone tell me what I'm doing wrong?
downvote count: 2
score: -2
has answer: http://stackoverflow.com/a/21953428
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/55469247
has body: So.. This is the code. A 'Super' number is one in which the sum of the digits, which are raised in accordance with their position, equals the number itself. TLDR: input : 175 1^1 + 7^2 + 5^3 = 175 Output : Super number. import java.util.Scanner; public class Models_Q6 { public static void main(String args[]) { Scanner s=new Scanner(System.in); System.out.println("Enter a number"); int num=s.nextInt(); int count=1; while(num&gt;0){ num%=10; count++; } Models_Q6 k=new Models_Q6 (); k.Super(num,count); boolean check=k.Super(num,count); if(check==true) System.out.println("The entered number is a Super number"); else System.out.println("The entered number is not a Super number"); } boolean Super(int num,int count){ int test=num; int a=0,sum=0; while(num&gt;0){ a=num%10; num/=10; count--; sum+= Math.pow(a, count); } if(sum==test) return true ; else return false; } } I ran this program through Eclipse and I do get it to work after it accepts the number. And other logic to do the program would be appreciated. P.S I need the coding to be done in a function called 'boolean Super(int)' Cause Professor says so ._. Thanks in advance.
has comment: http://stackoverflow.com/comment/33259957
type: Question
tagged with: function
accepted answer: http://stackoverflow.com/a/21953428
tagged with: logic
tagged with: boolean
tagged with: while-loop
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33260181

http://stackoverflow.com/a/21975279
answers question: http://stackoverflow.com/q/21974407
score: 4
has comment: http://stackoverflow.com/comment/48676744
has comment: http://stackoverflow.com/comment/40925711
has comment: http://stackoverflow.com/comment/48693461
has body: HttpURLConnection is cumbersome to use. With DavidWebb, a tiny wrapper around HttpURLConnection, you can write it like this: JSONObject msg; //passed in as a parameter to this method Webb webb = Webb.create(); JSONObject result = webb.post("http://my-url/path/to/res") .useCaches(false) .body(msg) .ensureSuccess() .asJsonObject() .getBody(); If you don't like it, there is a list of alternative libraries on the link provided. Why should we all write the same boilerplate code every day? BTW the code above is more readable and less error-prone. HttpURLConnection has an awful interface. This has to be wrapped!
type: Answer
has comment: http://stackoverflow.com/comment/40918181
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/48692977
has comment: http://stackoverflow.com/comment/40918128

http://stackoverflow.com/q/21936503
has answer: http://stackoverflow.com/a/21936963
has answer: http://stackoverflow.com/a/76953746
type: AnsweredQuestion
tagged with: guava
has answer: http://stackoverflow.com/a/65954811
tagged with: java
has answer: http://stackoverflow.com/a/42914980
type: Question
has answer: http://stackoverflow.com/a/21936548
has answer: http://stackoverflow.com/a/63588155
has answer: http://stackoverflow.com/a/21936577
accepted answer: http://stackoverflow.com/a/21936577
has body: I want to get string values of my fields (they can be type of long string or any object), if a field is null then it should return empty string, I did this with guava; nullToEmpty(String.valueOf(gearBox)) nullToEmpty(String.valueOf(id)) ... But this returns null if gearbox is null! Not empty string because valueOf methdod returns string "null" which leads to errors. Any Ideas? EDIt: there are 100s fields I look for something easy to implement
upvote count: 120
downvote count: 0
possible better answer: http://stackoverflow.com/a/42914980
has answer: http://stackoverflow.com/a/50148015
favorite count: 0
score: 120
answer count: 9
has title: Get empty string when null
has answer: http://stackoverflow.com/a/21936586

http://stackoverflow.com/q/21941819
has comment: http://stackoverflow.com/comment/33239301
tagged with: java
duplicate of: http://stackoverflow.com/q/125367
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/33239277
type: Question
has answer: http://stackoverflow.com/a/21942094
has comment: http://stackoverflow.com/comment/33239291
has title: Python allows me to compile bytecode that contains an undefined variable, while Java does not. Is python putting me at risk?
has comment: http://stackoverflow.com/comment/33240618
tagged with: python-2.7
score: 0
has body: Lets see same program written in java and python . I cannot understand the motive behind python's behavior . prog.py : #!/usr/bin/python print "Hello, World!\n" def hello(name): print "Hello " + name print sample #hello("harish") Prog.java public class Prog { public static void hello(String name) { System.out.println("Hello " + name); System.out.println(sample); } public static void main (String... args) { System.out.println("Hello, World!\n"); //hello("Harish"); } } The above python code prog.py executes without any problem but Prog.java raises errors . My arguments 1) I would prefer python is good , looking from the angle that I need not bother about it until I call the function hello(name) . If i called the function during execution phase , then an error would be flung as "NameError: global name 'sample' is not defined". 2) But it looks danger by looking at the angle that it might fling such errors in execution time . But java tells all these things even during compile time . 3) also if I want to distribute the python code as .pyc file , using py_compile.compile("prog.py") . The pyc file is generated without warning that 'sample' is an undefined variable . This puts me at risk because these errors might be discovered in production ,which is too dangerous . What am I to interpret from this type of working of python . Why is it designed to be so ? what is the advantage in not being so strict while compilation (py -> pyc ) ? Is it not dangerous ?
has comment: http://stackoverflow.com/comment/33239260
answer count: 1
has comment: http://stackoverflow.com/comment/33241406
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33239420
tagged with: python
linked to: http://stackoverflow.com/q/125367
has comment: http://stackoverflow.com/comment/33240821
has comment: http://stackoverflow.com/comment/33239268

http://stackoverflow.com/comment/33080242
score: 0
type: Comment
type: QuestionComment
has text: keySet() will give you keys of outer map.. iterate over the values and for each value , get keySet and values..
comment on: http://stackoverflow.com/q/21852961

http://stackoverflow.com/comment/33155535
has text: Just like the delete button i have a hash button which will be similar to a submit button. But when i click on the hash button it doesn't display it on screen. I have used the same code for the rest of the numbers or does the hash work different to numbers?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21893721

http://stackoverflow.com/comment/33328919
type: QuestionComment
comment on: http://stackoverflow.com/q/21991890
score: 0
has text: So by "dosen't work" you mean that the last block still dosen't work - but the first block does (no matter what soud)? Have you tried printing something out before and after the code in the last try-block?
type: Comment

http://stackoverflow.com/comment/33338019
type: Comment
score: 1
has text: Yes filtering would be O(n)..whereas sorting and then filtering would be O(n logn)
type: QuestionComment
comment on: http://stackoverflow.com/q/21996922

http://stackoverflow.com/comment/33342872
score: 0
type: AnswerComment
type: Comment
has text: Correct me if I'm wrong, but doesn't that disable the *functionality* while still giving the button a clickable appearance?
comment on: http://stackoverflow.com/a/21999478

http://stackoverflow.com/a/53301333
downvote count: 0
answers question: http://stackoverflow.com/q/22000241
upvote count: 3
has body: Along with the above you can add the below mentioned point: Javascript Objects are mutable(we can add properties) where as Java Objects are immutable(we cannot add properties but we can change the value of the property by means of setters). When i say mutable one can add some additional property to the Javascript object. Say for example. var person = { firstName: "John", secondName: "Deer", } later on we can change it by adding additional properties. Say Person.age = 25; after this step Person will change to {firstName: "John", secondName: "Deer", age: 25} Where as this way of adding properties to the instantiated object is not possible in the case of Java. Javascript Objects can be instantiated in many ways Using Literals var person = {firstName:"Deen",lastName:"Deer"} Using Javascripts new Object var person = new Object(); person.firstName = "John"; erson.lastName = "Deer"; Using Function function Person(firstName, lastName){ this.firstName = firstName; this.lastName = lastName; } and you can create person object as var person = new Person("John","Deer");
type: Answer
score: 3

http://stackoverflow.com/comment/69428661
type: Comment
comment on: http://stackoverflow.com/a/21879866
score: 3
has text: when implementing the abstract factory pattern, wont an interface be more appropriate?
type: AnswerComment

http://stackoverflow.com/comment/33254187
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21948103
score: 0
has text: Did I answer your question completely?

http://stackoverflow.com/comment/33208926
type: Comment
comment on: http://stackoverflow.com/a/21924598
has text: thanks for your help but I want to use operator(Example "is a number but not 5" or "not((not number) or 5)" like http://en.wikipedia.org/wiki/De_Morgan's_laws I can use [^\D5] but can not use [^^\d5]
score: 1
type: AnswerComment

http://stackoverflow.com/comment/33374781
score: 0
type: Comment
has text: It's unfortunate that you didn't mention heat maps, you might have received more answers. But also, you should search around and state some alternatives you consider.
comment on: http://stackoverflow.com/a/21996053
type: AnswerComment

http://stackoverflow.com/q/21901436
has title: Asynchronous programming in Java/Guava
has answer: http://stackoverflow.com/a/21901509
type: Question
has body: class A{ final B; B.compute(); // Does executing this line create a new thread since this returns // a future and the entire function is executed by the same thread ? } class B{ Future&lt;Void&gt; compute(){ C obj = factoryOfC.getC(); ListenableFuture&lt;Void&gt; future = executorService.submit (new Callable(){ doSomething(); }); Futures.addCallback(future, new FutureCallback&lt;Void&gt;(){ @Override void onSuccess(){ } @Override void onFailure(){ } } // end of callback. } // end of class B How would you define a unit of work here ? Which thread/s will be doing which unit of work ? Would the callable and callback be executed in the same thread ? WILL obj of type C be executed by the same thread ?
score: 0
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21914239
tagged with: guava
tagged with: java

http://stackoverflow.com/q/21946796
favorite count: 0
has body: I'm using the standard firmata to interface with Java Processing and run an arduino project. The Arduino class used to interface processing with java does not have a method for delayMicroseconds or any other delay on the arduino board. In most examples you need to use delay techniques in the java environment but these all operate on the order of milliseconds (1000 microseconds). So I can edit the StandardFirmata sketch, the Firmata.java file and the Arduino.java file that makes all these necessary connections to run Processing. Does anyone understand how this code breaks down well enough so that I could add my own delay function that carries through to the arduino class. I don't understand how this code interfaces between the C and Java sides. A better understanding of this would probably help the most. If you want to look at the reference code it can be found at: http://arduino.cc/en/reference/firmata#.UwfW_vldV0Y https://github.com/firmata/processing/tree/master/src
has title: Adding a delayMicroseconds function to the standard firmata for running Arduino with Processing
upvote count: 2
type: UnansweredQuestion
tagged with: firmata
tagged with: java
tagged with: arduino
type: Question
tagged with: processing
has answer: http://stackoverflow.com/a/21960395
tagged with: http://stackoverflow.com/tag/c
score: 2
answer count: 1
downvote count: 0

http://stackoverflow.com/a/21851780
upvote count: 2
answers question: http://stackoverflow.com/q/21851667
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21851667
has comment: http://stackoverflow.com/comment/33079179
has body: You have ClassCastException because of your JTable store Integer values which can't be cast to String like next String column1= (String) jTable1.getValueAt(i,0);. Change that to: String column1= jTable1.getValueAt(i,0) == null ? "" : jTable1.getValueAt(i,0).toString();
type: Answer

http://stackoverflow.com/a/21964080
has body: Your program is attempting to create 10 AccountArray instances, not 10 Accounts. Even if that were to work, you're calling a method outside of the context of either a static reference or the object instance - that is never going to work. What you probably want to do is this: Account[] atm = new Account[10]; for(int i = 0; i &lt; atm.length; i++){ atm[i] = new Account(); atm[i].setBalance(100); } ...although ignoring the other constructors in this case seems a bit...wrong to me. I leave this part as an exercise for the reader.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21964003
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/22010386
has body: Press CTRL+3 then type markers, find the problem in the markers list and see if there is a Quick Fix.
type: Answer
answers question: http://stackoverflow.com/q/22002874
score: 0

http://stackoverflow.com/comment/33151031
score: 1
type: AnswerComment
type: Comment
has text: `countD.append(i+" ");` will create another StringBuilder to concatenate `i` and `" "`. To avoid it use `countD.append(i).append(" ");`
comment on: http://stackoverflow.com/a/21891970

http://stackoverflow.com/a/21897021
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33160573
answers question: http://stackoverflow.com/q/21896589
has body: Swap the if statement and the increase of dayOfWeek. for (dayOfMonth = 1; dayOfMonth &lt;= orderedLengthOfMonthsArray[month]; dayOfMonth++) { if (dayOfMonth == 1 &amp;&amp; dayOfWeek == 7) { System.out.println(dayOfMonth + " " + orderedNamesOfMonthsArray[month] + " " + year); } dayOfWeek++; if (dayOfWeek == 8) { dayOfWeek = 1; } } When you are in the dayOfMonth for loop, you already have the correct day of the week (initially Monday, Jan 1st, 1900), so if you first increase it, then the check afterwards would be incorrect.
type: Answer
accepted answer of: http://stackoverflow.com/q/21896589
upvote count: 3

http://stackoverflow.com/comment/33246204
has text: Looking for the library?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21945605

http://stackoverflow.com/comment/94636621
comment on: http://stackoverflow.com/a/53199077
has text: Please let me know
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33197082
score: 0
has text: That's weird. Try debugging your client (taking a special look on what URLs are called when the RPC is made) and your server (checking if there isn't errors on startup or elsewhere).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21913859

http://stackoverflow.com/a/21958158
answers question: http://stackoverflow.com/q/21958083
downvote count: 6
has body: You could declare your confFile as File instead of Path. Then you can use confFile.getParentFile().mkdirs();, see example below: // ... File confFile = new File("./conf/conf.xml"); confFile.getParentFile().mkdirs(); // ... Or, using your code as is, you can use: Files.createDirectories(confFile.getParent());
has comment: http://stackoverflow.com/comment/33269474
has comment: http://stackoverflow.com/comment/48017514
accepted answer of: http://stackoverflow.com/q/21958083
upvote count: 36
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/137694512
has comment: http://stackoverflow.com/comment/33268947
has comment: http://stackoverflow.com/comment/79440579
has comment: http://stackoverflow.com/comment/79440489
type: Answer
score: 30

cdi
tags question: http://stackoverflow.com/q/21859059
tags question: http://stackoverflow.com/q/21926220
tags question: http://stackoverflow.com/q/21858450
tags question: http://stackoverflow.com/q/21912334
type: Tag
tags question: http://stackoverflow.com/q/21885178
tag name: cdi
tags question: http://stackoverflow.com/q/21932565
tags question: http://stackoverflow.com/q/21904424

http://stackoverflow.com/comment/33318330
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21986193
has text: I tried that..My intention is to install jdk..Install4j is used to run particular java program,

aem
tags question: http://stackoverflow.com/q/21992400
type: Tag
tags question: http://stackoverflow.com/q/21887189
tag name: aem

http://stackoverflow.com/comment/33170144
type: Comment
has text: If `April` then day should return, `2` for `(2014, 03, 01)`. The date `April 1st, 2014` falls on `Tuesday`
type: AnswerComment
comment on: http://stackoverflow.com/a/21902778
score: 0

http://stackoverflow.com/comment/33252281
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21948655
has text: @DaveNewton - What would you like to know about my IDE? I am running Via eclipse, i generated an ant build file by right clicking on project then exporting, that generated an ant build file. I am running that build file.

http://stackoverflow.com/q/21962015
type: UnansweredQuestion
has body: So the main problem I'm getting is when trying to set columnUUID.setCellValueFactory( new PropertyValueFactory&lt;Person,String&gt;("different") ); it wount populate the columnPlayer.setCellValueFactory( new PropertyValueFactory&lt;Person,String&gt;("player") ); works. If I set both with the value of "player" it populates both tables with those values. If I set both methods with "different" it just adds blank text. Changing "different" to a different value in both classes doesn't do anything. package com.sandislandserv.rourke750.Gui; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; import java.net.UnknownHostException; import java.util.Map; import com.sandislandserv.rourke750.BetterAssociations; import com.sandislandserv.rourke750.database.BaseValues; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.ListView; import javafx.scene.control.PasswordField; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TextArea; import javafx.scene.control.TextField; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.AnchorPane; public class GuiController { @FXML private TextField username; @FXML private TextField domain; @FXML private PasswordField password; @FXML private AnchorPane pane; @FXML private Button login; @FXML private TableView&lt;Person&gt; listofPlayers; @FXML private Label badLogin; @FXML private TableColumn&lt;Person, String&gt; columnUUID; @FXML private TableColumn&lt;Person, String&gt; columnPlayer; private ObservableList&lt;Person&gt; data = FXCollections.observableArrayList(); public GuiController() { } public AnchorPane getPane(){ return pane; } @FXML public void Login(){ data.clear(); badLogin.setVisible(false); System.out.pr…
tagged with: java
tagged with: scenebuilder
tagged with: javafx
type: Question
has title: setCellValueFactory for a TableColumn in javafx doesnt input text for one value, but adds white space
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21962111

http://stackoverflow.com/comment/33127795
type: AnswerComment
score: 0
type: Comment
has text: Ah ok, so you have different JVM's. I thought that all members were part of the same JVM. One thing you can do is submit a runnable to a distributed executor and execute it on all members. This runnable can do a System.exit. Is this purely for testing purposes or do you want to terminate members in production?
comment on: http://stackoverflow.com/a/21876695

http://stackoverflow.com/a/21868589
downvote count: 0
has comment: http://stackoverflow.com/comment/33109310
score: 1
has comment: http://stackoverflow.com/comment/33114594
answers question: http://stackoverflow.com/q/21868332
has body: I have a feeling your string is one very very long line. Does it have any new line characters in it? ie "\n"? Anyhoo, here's an example that works // // Test ScrollPane with very very long string // package testjscrollpane; import javax.swing.*; public class TestJScrollPane extends JFrame { public TestJScrollPane() { //Create a long long string String s = ""; int n = 0; for (int i=0; i&lt;10000; i++) { s += Integer.toString(i)+" "; //this next part breaks the string up into lots of lines //if commentted out, the whole string will appear on 1 line //with no vertical scrollbar // n++; // if(n==100) // { // s += "\n"; // n = 0; // } } this.setDefaultCloseOperation((JFrame.EXIT_ON_CLOSE)); this.setSize(400, 400); JTextArea area = new JTextArea(s); JScrollPane scrollpane = new JScrollPane(area); this.add(scrollpane); this.setVisible(true); } public static void main(String[] args) { TestJScrollPane myFrame = new TestJScrollPane(); } } Good luck!
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/33115284

http://stackoverflow.com/q/21935073
answer count: 1
downvote count: 0
has body: I was told that one can generate CRUD operations directly form the database schema using app fuse. But I was unsuccessful in doing that using it and it look very long without any clue. One possibility is to create the models and annotate it and create CRUDs and create database tables and also populate them with dummy variables. But is it possible to do it other way round. I have been following this tutorial provided from App Fuse. Am I doing it wrong or is it possible. Thanks
tagged with: maven-3
favorite count: 0
has answer: http://stackoverflow.com/a/21957209
accepted answer: http://stackoverflow.com/a/21957209
tagged with: maven-2
upvote count: 1
tagged with: appfuse
has title: Using App Fuse to generate CRUD operations directly from database schema
type: AnsweredQuestion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/33248326
has text: You could make a void to call `notifyDataSetChanged` inside your main class and make the `onPostExecute` call that void.
comment on: http://stackoverflow.com/q/21946604
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21890084
has body: I think you need to use custom JDialogs instead of Jframe which will not allow user inputs from another window or dialog. Refer Oracle website for more information and source code. Also you can use a static Jframe variable in a class which will hold the Jframe instance created by event, but its not good way of coding. //global jframe variable class Globals{ public static myFrame myFrameOpenedInstance=null; } // By invoking the event method returns same instance method duringEventOccured() { if(Globals.myFrameOpenedInstance==null){ myFrame newFrameInstance=new myFrame(); Globals.myFrameOpenedInstance=newFrameInstance; newFrameInstance.setVisible(true); } else{ myFrame newFrameInstance=Globals.myFrameOpenedInstance; newFrameInstance.setVisible(true); } }
type: Answer
answers question: http://stackoverflow.com/q/21889292
score: 0

http://stackoverflow.com/comment/33309893
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21981204
has text: restart the system... works for me sometimes :)
score: 0

http://stackoverflow.com/comment/33219531
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21929981
type: AnswerComment
has text: public static final String REGEX_HASHTAGS = "[^|\\s|>]*([a-z]{2}[0-9]+\\.?)\\b"; It's OK for me, thanks you all!!!! <3

tomcat
tags question: http://stackoverflow.com/q/21991017
tags question: http://stackoverflow.com/q/21874976
tags question: http://stackoverflow.com/q/21987200
tags question: http://stackoverflow.com/q/21901186
tags question: http://stackoverflow.com/q/21843956
tags question: http://stackoverflow.com/q/21904818
tags question: http://stackoverflow.com/q/21878375
tags question: http://stackoverflow.com/q/21904651
tags question: http://stackoverflow.com/q/21965379
tags question: http://stackoverflow.com/q/21980858
tags question: http://stackoverflow.com/q/21932640
tags question: http://stackoverflow.com/q/21921818
tags question: http://stackoverflow.com/q/21927744
tags question: http://stackoverflow.com/q/21975167
tags question: http://stackoverflow.com/q/21906293
tags question: http://stackoverflow.com/q/21957507
tags question: http://stackoverflow.com/q/21869288
tags question: http://stackoverflow.com/q/21895507
tags question: http://stackoverflow.com/q/21859371
tags question: http://stackoverflow.com/q/21885568
tags question: http://stackoverflow.com/q/21853847
tags question: http://stackoverflow.com/q/21884150
tags question: http://stackoverflow.com/q/21846836
tags question: http://stackoverflow.com/q/21922006
tag name: tomcat
tags question: http://stackoverflow.com/q/21966339
tags question: http://stackoverflow.com/q/21843869
tags question: http://stackoverflow.com/q/21978741
tags question: http://stackoverflow.com/q/21964316
tags question: http://stackoverflow.com/q/21996332
tags question: http://stackoverflow.com/q/21887954
tags question: http://stackoverflow.com/q/21953785
tags question: http://stackoverflow.com/q/21848394
tags question: http://stackoverflow.com/q/21886778
tags question: http://stackoverflow.com/q/21992280
tags question: http://stackoverflow.com/q/21909632
tags question: http://stackoverflow.com/q/21904372
tags question: http://stackoverflow.com/q/21852459
tags question: http://stackoverflow.com/q/21919402
tags question: http://stackoverflow.com/q/21985653
tags question: http://stackoverflow.com/q/21948159
type: Tag
tags question: http://stackoverflow.com/q/21948873
tags question: http://stackoverflow.com/q/21895993
tags question: http://stackoverflow.com/q/21966756
tags question: http://stackoverflow.com/q/21977030
tags question: http://stackoverflow.com/q/21872271
tags question: http://stackoverflow.com/q/21969111
tags question: http://stackoverflow.com/q/21959686
tags question: http://stackoverflow.com/q/21933182
tags question: http://stackoverflow.com/q/21997923
tags question: http://stackoverflow.com/q/21937642

http://stackoverflow.com/q/21894466
favorite count: 0
tagged with: binary-heap
has answer: http://stackoverflow.com/a/21894809
accepted answer: http://stackoverflow.com/a/21894809
type: AnsweredQuestion
has title: given an input array and sum, return the minimum elements need to get sum
score: 3
tagged with: algorithm
upvote count: 3
tagged with: java
type: Question
answer count: 1
downvote count: 0
has body: The problem is a variation of selection algorithm in selecting the fewest number of items whose sum is at least some value, N. For example you might want to have a list of items whose sum is 5,000 or more, but you don’t want more items than you have to take from an input list. So if one number is 5,001, then your output list will contain a single number. another example: Input list {3,4,5,1,2} target = {8}. output list will be : {5,3}. This problem has been shown to solve using binaryHeap in this excellent series of posts; but when I implemented in Java, I do not get the desired the output. I get the entire input list. I am not able to find out the exact cause of the problem. Here is my code; public class SelectTopSum { public static void main(String[] args){ int[] arr = {5,2,10,1,33}; int target=33; System.out.println(Arrays.toString(selectTop(arr, target))); } private static int[] selectTop(int[] arr, int sum) { //get max heap PriorityQueue&lt;Integer&gt; pq = new PriorityQueue&lt;&gt;(10, new Comparator&lt;Integer&gt;() { @Override public int compare(Integer o1, Integer o2) { return o2.compareTo(o1); } }); int runningTot=0; for (int i : arr) { if (runningTot&lt;sum) { runningTot+=i; pq.add(i); } else if (i &gt; pq.peek()) { runningTot-=pq.remove(); runningTot+=i; pq.add(i); } while (runningTot-pq.peek()&gt;=sum) { runningTot-=pq.remove(); } } //System.out.println("priority queue is "+ pq); int[] result=new int[pq.size()]; int i=0; while (!pq.isEmpty()) { result[i]=pq.remove(); i++; } return result; } }
tagged with: priority-queue

http://stackoverflow.com/a/21892231
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21891675
has body: You could have the user input one line of text with numbers separated by commas and use .split(",") to separate into an array of strings, then loop through that array by the .length and apply .trim() to each string to remove trailing space, then use Integer.parseInt(strarray[i]) to convert the strings to integers. And obviously put it all in a try...catch in case the user inputs badly formatted data.

http://stackoverflow.com/comment/46482150
comment on: http://stackoverflow.com/a/22730778
type: Comment
has text: I see corrupted download when using the AdvancedDownloader in a VMWare environment. The file is created and stored on server disk. The download to the client then has most of the time 32k / 64k and not 46kB or 77kB. Anyone seen this?
score: 0
type: AnswerComment

http://stackoverflow.com/q/21975194
tagged with: printing
has comment: http://stackoverflow.com/comment/33299839
favorite count: 0
has comment: http://stackoverflow.com/comment/33301104
upvote count: 2
has comment: http://stackoverflow.com/comment/33299420
has comment: http://stackoverflow.com/comment/33299462
has answer: http://stackoverflow.com/a/22030967
type: AnsweredQuestion
score: 2
has title: Java is not printing integer variables
has answer: http://stackoverflow.com/a/21975287
tagged with: java
has comment: http://stackoverflow.com/comment/33299971
has comment: http://stackoverflow.com/comment/33299590
possible better answer: http://stackoverflow.com/a/21975287
type: Question
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/22030967
has body: The following code receives two file names from command line and prints the numbers in the second file that are not in the first file. I also need to print how many numbers of this kind there are. Let's say the program prints: 12 13 14 I have to change it to print in the end: 12 13 14 There are 3 numbers! That's why I created the variable ns in the main function. import java.util.Arrays; public class BinarySearch { public static int rank(int key, int[] a) { int lo = 0; int hi = a.length - 1; while (lo &lt;= hi) { int mid = lo + (hi - lo) / 2; if (key &lt; a[mid]) hi = mid - 1; else if (key &gt; a[mid]) lo = mid + 1; else return mid; } return -1; } public static void main(String[] args) { In in = new In(args[0]); int[] whitelist = in.readAllInts(); Arrays.sort(whitelist); int ns = 0; while (!StdIn.isEmpty()) { int key = StdIn.readInt(); if (rank(key, whitelist) == -1) { StdOut.println(key); ns++; } } System.out.println(ns); } } It compiles and I run java BinarySearch tinyW.txt &lt; tinyT.txt. It does print 12 13 14 but it does not print the ns variable in the end as it should. Does anyone know why?

graphical-logo
type: Tag
tags question: http://stackoverflow.com/q/21928424
tag name: graphical-logo

http://stackoverflow.com/comment/33210762
type: QuestionComment
has text: Yea I know that since I was able to parse the json data of example which I was following. But wat i am doing in my MainActivity is that correct?
comment on: http://stackoverflow.com/q/21925685
score: 0
type: Comment

http://stackoverflow.com/comment/33209255
type: AnswerComment
has text: Sorry, I didn't get you wanted to throw errors AND warnings, but you might check my updated answer
comment on: http://stackoverflow.com/a/21924686
type: Comment
score: 0

http://stackoverflow.com/comment/33086026
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21856131
has text: Try: Right click project -> Configure -> Convert to Maven project
score: 0

http://stackoverflow.com/comment/33147975
type: Comment
comment on: http://stackoverflow.com/a/21890284
score: 0
type: AnswerComment
has text: Please have a look at the update I made.

http://stackoverflow.com/q/21937305
has title: Merge Sort Implementation java
answer count: 3
tagged with: mergesort
downvote count: 0
tagged with: sorting
accepted answer: http://stackoverflow.com/a/21937941
favorite count: 0
has body: I'm trying to implement my own Mergesort function but am having a hard time figuring out what's not working. The output I get for UnSorted: [6, 1, 2, 7, 2, 3, 9, 7, 6] is Sorted: [2, 3, 6, 1, 2, 7] Here's what I have so far: public class mergeSort { public static void main(String[] args) { List&lt;Integer&gt; l = new ArrayList&lt;Integer&gt;(); Random rd = new Random(); for (int i = 1; i &lt; 10; i++) { l.add(rd.nextInt(10) + 1); } System.out.println("UnSorted: " + l); msort(l); System.out.println("Sorted: "+msort(l)); } public static List&lt;Integer&gt; msort(List&lt;Integer&gt; l) { if (l.size() &lt;= 1) { return l; } List&lt;Integer&gt; left = new ArrayList&lt;Integer&gt;(); List&lt;Integer&gt; right = new ArrayList&lt;Integer&gt;(); for (int i = 0; i &lt; (l.size() / 2); i++) { left.add(l.get(i)); } for (int i = l.size() / 2; i &lt; l.size(); i++) { right.add(l.get(i)); } msort(left); msort(right); //System.out.println(left + "" +right); return join(left,right); } public static List&lt;Integer&gt; join(List&lt;Integer&gt; left, List&lt;Integer&gt; right) { /*if (right.size() == 0) { return left; } if (left.size() == 0) { return right; }*/ List&lt;Integer&gt; fin = new ArrayList&lt;Integer&gt;(); // pointers int lp = 0, rp = 0, fp = 0; while (lp &lt; left.size() &amp;&amp; rp &lt; right.size()) { if (left.get(lp) &lt; right.get(rp)) { fin.add(left.get(lp)); lp++; } else { fin.add(right.get(rp)); rp++; } fp++; } return fin; } }
linked to: http://stackoverflow.com/q/15579425
possible better answer: http://stackoverflow.com/a/21937828
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21937828
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21937941
has answer: http://stackoverflow.com/a/21937724
score: 1
tagged with: java

http://stackoverflow.com/comment/80089809
comment on: http://stackoverflow.com/a/46566244
type: Comment
has text: Adding some explanation would make this a much better answer
score: 5
type: AnswerComment

http://stackoverflow.com/comment/33237139
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/21940555
has text: What is the timeline to submit the homework?

http://stackoverflow.com/q/21882060
score: 0
has title: Override HttpServletResponse sendError or setStatus
answer count: 1
has body: I'm working on a project where we are migrating code from Jetty to Jboss. This code is used as an API where different services is calling the service, the service perform the operation and returns the data, but if something goes wrong during the process exceptions are thrown and finally caught in the top level class. When using Jetty this worked good, hence the Jetty servlet engine added the message sent to the HttpServletResponse sendError function to the status line. But in Jboss, the default status is instead added: Jetty: return: 500: My Custom error Jboss: 500: Internal Server Error I've not been able to add the *USE_CUSTOM_STATUS_MSG_IN_HEADER* to the Jboss, so I thought I might customize the response by creating a HttpServletResponseWrapper and overriding either the sendError or setStatus message to do what I need and return the content in a way I need it. But, I'm unsure on how to perform this, or if there are any better solutions. best, Henrik
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/21882458
accepted answer: http://stackoverflow.com/a/21882458
tagged with: java
tagged with: jboss
tagged with: servlets

http://stackoverflow.com/comment/101767870
has text: i have the same issue using the 'recommended' way from https://developer.android.com/training/secure-file-sharing/retrieve-info#RetrieveFileInfo , i am running on emulator api24
comment on: http://stackoverflow.com/q/21882322
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33209726
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21925092
has text: I tried this: ([a-z])\1+
score: 0

http://stackoverflow.com/q/21998405
upvote count: 20
tagged with: java
has body: I am currently working on integration of a third party application with our local reporting system. I would like to implement REST calls with basic authentication but facing issues in Spring 4.0.0. I have a simple solution what works nicely: final RestTemplate restTemplate = new RestTemplate(); final String plainCreds = "username:password"; final byte[] plainCredsBytes = plainCreds.getBytes(); final byte[] base64CredsBytes = Base64.encodeBase64(plainCredsBytes); final String base64Creds = new String(base64CredsBytes); final HttpHeaders headers = new HttpHeaders(); headers.add("Authorization", "Basic " + base64Creds); final HttpEntity&lt;String&gt; request = new HttpEntity&lt;String&gt;(headers); final ResponseEntity&lt;MyDto&gt; response = restTemplate.exchange("myUrl", HttpMethod.GET, request, MyDto.class); final MyDto dot = response.getBody(); but wanted to rewrite this to use ClientHttpRequestFactory in the following way: final RestTemplate restTemplate = new RestTemplate(createSecureTransport("username", "password")); private ClientHttpRequestFactory createSecureTransport(final String username, final String password) { final HttpClient client = new HttpClient(); final UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(username, password); client.getState().setCredentials(new AuthScope(null, 9090, AuthScope.ANY_REALM), credentials); return new CommonsClientHttpRequestFactory(client); } This code is not compiling as the CommonsClientHttpRequestFactory class not exists anymore in Spring 4.0.0. Do somebody know any alternative solution to this? I am quite new in this REST world therefore any help will be appreciated.
has answer: http://stackoverflow.com/a/39263014
answer count: 6
has title: Spring 4.0.0 basic authentication with RestTemplate
has answer: http://stackoverflow.com/a/41274773
has answer: http://stackoverflow.com/a/21998572
tagged with: apache
has answer: http://stackoverflow.com/a/39724520
possible better answer: http://stackoverflow.com/a/38945615
favorite count: 0
tagged with: basic-authentication
tagged with: spring
has answer: http://stackoverflow.com/a/25323537
type: AnsweredQuestion
tagged with: resttemplate
has answer: http://stackoverflow.com/a/38945615
downvote count: 1
score: 19
type: Question
accepted answer: http://stackoverflow.com/a/21998572

http://stackoverflow.com/comment/33256174
type: Comment
comment on: http://stackoverflow.com/a/21940077
score: 0
type: AnswerComment
has text: i know that date han't any timezone... but why is it so hard to parse a string to a date without respecting any timezone?

android-broadcast
tag name: android-broadcast
tags question: http://stackoverflow.com/q/21976366
type: Tag

http://stackoverflow.com/a/21893965
answers question: http://stackoverflow.com/q/21893892
upvote count: 2
has comment: http://stackoverflow.com/comment/33156698
score: 2
has comment: http://stackoverflow.com/comment/33156687
has comment: http://stackoverflow.com/comment/33156657
has body: arrays are 0-based. arr[arr.length] will also throw an exception change your if statement to the following, *note the &lt; and thhe -1; if (diagcol&lt;themainarray[columnincrement].length - 1) If you make that change, at least there's a chance that your code will run without an indexoutofbounds exception. it's not a 100% chance. If themainarray.length is less than themainarray[columnincriment].length than you'll also get an exception, because nowhere are you checking against themainarray.length
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33156848
has comment: http://stackoverflow.com/comment/33156585
accepted answer of: http://stackoverflow.com/q/21893892
type: Answer
has comment: http://stackoverflow.com/comment/33155087
has comment: http://stackoverflow.com/comment/33159010

http://stackoverflow.com/comment/33351456
type: Comment
comment on: http://stackoverflow.com/q/22004321
score: 0
type: QuestionComment
has text: Get rid of `low` and `high`, use `plow` and `phigh` instead.

http://stackoverflow.com/q/22004351
has answer: http://stackoverflow.com/a/22004419
favorite count: 0
tagged with: arraylist
tagged with: android
has comment: http://stackoverflow.com/comment/33351469
score: 2
has title: Creating HashMap from ArrayList
upvote count: 2
accepted answer: http://stackoverflow.com/a/22004419
has answer: http://stackoverflow.com/a/22004413
type: AnsweredQuestion
has body: I have two ArrayList of string and want to merge them into a single hashmap. I am doing something like this. HashMap&lt;ArrayList&lt;String&gt;,ArrayList&lt;String&gt;&gt; map = new HashMap&lt;ArrayList&lt;String&gt;, ArrayList&lt;String&gt;&gt;(); ArrayList&lt;String&gt;k = receivedIntent.getStringArrayListExtra("keys"); ArrayList&lt;String&gt;v = receivedIntent.getStringArrayListExtra("values"); map.put(k, v); Is this the right way? Ideally I want to access values in v array using values in k array as keys in the hashmap like value = map.get("Name"), where Name is one of the keys?
tagged with: hashmap
possible better answer: http://stackoverflow.com/a/22004413
tagged with: java
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/33301358
score: 0
type: Comment
has text: Having the ActionListener as an inner class of TrafficControlPanel gives me access to its class variable LightPanel. If I were to make the ActionListener its own regular class then I no longer have direct access to it and so you would no longer be able to just call LightPanel.change(click). This is where i am confused, i don't know how to do it as a beginner programmer and it's the reason I'm pleading for help.
comment on: http://stackoverflow.com/a/21974686
type: AnswerComment

http://stackoverflow.com/a/21880199
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/21880107
downvote count: 0
has comment: http://stackoverflow.com/comment/33129198
type: Answer
has comment: http://stackoverflow.com/comment/33129353
has body: In Scala, there is no switch case fall through. You can do or (|) instead: step match { case 0 | 1 | 2 =&gt; something ... }

http://stackoverflow.com/a/21947627
downvote count: 2
has comment: http://stackoverflow.com/comment/33436942
accepted answer of: http://stackoverflow.com/q/21947452
score: 4257
has comment: http://stackoverflow.com/comment/33605454
has comment: http://stackoverflow.com/comment/34897675
has comment: http://stackoverflow.com/comment/33440840
upvote count: 4259
answers question: http://stackoverflow.com/q/21947452
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33437414
has comment: http://stackoverflow.com/comment/33327824
type: Answer
has body: Pure speculation is that you're using a terminal that attempts to do word-wrapping rather than character-wrapping, and treats B as a word character but # as a non-word character. So when it reaches the end of a line and searches for a place to break the line, it sees a # almost immediately and happily breaks there; whereas with the B, it has to keep searching for longer, and may have more text to wrap (which may be expensive on some terminals, e.g., outputting backspaces, then outputting spaces to overwrite the letters being wrapped). But that's pure speculation.
has comment: http://stackoverflow.com/comment/33300222

http://stackoverflow.com/comment/33147359
has text: @user3093402 just use 1
comment on: http://stackoverflow.com/q/21889675
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33441680
type: QuestionComment
comment on: http://stackoverflow.com/q/22003084
type: Comment
has text: @ShafikYaghmour done! Getting used to SO!
score: 0

http://stackoverflow.com/comment/33285538
type: QuestionComment
comment on: http://stackoverflow.com/q/21967251
score: 0
has text: This works, but i want it inside.
type: Comment

http://stackoverflow.com/comment/33330163
comment on: http://stackoverflow.com/q/21992670
has text: The EXACT meaning you would have to ask the person asking it. I can imagine it regards systems with heavy throughput which have to be able to cope with that within a set timeframe. Realtime systems and/or applications with lots of concurrent users.
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21878972
has answer: http://stackoverflow.com/a/21882486
type: Question
has answer: http://stackoverflow.com/a/21879968
possible better answer: http://stackoverflow.com/a/21879054
has answer: http://stackoverflow.com/a/21879054
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/33127144
accepted answer: http://stackoverflow.com/a/21883220
answer count: 5
has answer: http://stackoverflow.com/a/21883220
type: AnsweredQuestion
has body: I'm just starting my first real project in Java so I'm still understanding the basics so apologies for this. I'm working out the price * quantity then giving the total amount to each individual product, this will then have to be repeated for all my products as part of the order process. So i want to find the best way so i can repeat it. Here is the working code I have: private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { double priceA = 20.00;/*fixed price*/ String strA = txtbxCaseA.getText();/*gets amount from textbox*/ int numA = Integer.parseInt(strA);/*parse to int */ double casetotalA = (priceA * numA);/*sum*/ String caseAtotal = String.valueOf(casetotalA);/*to string */ double priceB = 25.00; String strB = txtbxCaseB.getText(); int numB= Integer.parseInt(strB); double casetotalB = (priceB * numB); String caseBtotal = String.valueOf(casetotalB); double priceC = 30.00; String strC = txtbxCaseC.getText(); int numC = Integer.parseInt(strC); double casetotalC = (priceC * numC); String caseCtotal = String.valueOf(casetotalC); ArrayList caselist = new ArrayList(); caselist.add("Case A Total - £" + caseAtotal); caselist.add("Case B Total - £" + caseBtotal); caselist.add("Case C Total - £" + caseCtotal); DefaultListModel myModel = new DefaultListModel (); for(int i = 0; i &lt; caselist.size(); i++){ jTextArea3.append((String)caselist.get(i) + ('\n')); myModel.addElement(caselist.get(i) + ","); /* - save arraylist to a gobal varible for cart processing - move to next panel (page) along */ } } My question is, is this method good practice, and also is their a better method (maybe shorter) that i can repeat for each of my 50 products as this seems a little inefficient but it works. Any suggestions or comments would be greatly appreciated.
tagged with: java
tagged with: multiplication
has title: Im sure there must be a much easier way java arraylist sums
has answer: http://stackoverflow.com/a/21879110

http://stackoverflow.com/q/21861035
has comment: http://stackoverflow.com/comment/33095987
has comment: http://stackoverflow.com/comment/33095761
answer count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/33095141
tagged with: java
has comment: http://stackoverflow.com/comment/33095359
tagged with: jtable
has title: Java TableCellListener causing an array index out of bound error
score: 0
has body: I wrote a program which uses the TableCellListener class. The code compiles properly but when i run the program I get the following error when I navigate from cell to cell using the Tab key: Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1 This only happens when I use the Tab key. If I use the mouse the program works perfectly. Another user ran the exact same program on his computer and wasn't able to duplicate the problem. Everything ran perfectly. He was using Windows but I'm using a Mac. Has anyone else had this problem with TableCellListener? Here is the code: package testyo; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; import javax.swing.table.*; import java.text.*; public class Testyo { JFrame mainPanel; RXTable myTable; DefaultTableModel myTableModel; Testyo() { mainPanel = new JFrame(); mainPanel.getContentPane().setLayout(new FlowLayout()); mainPanel.setSize(1200, 1200); mainPanel.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); String[] columnNames = {"ID", "First Name", "Last Name", "Salary"}; Object[][] data = { {1, "aaa", "bbb", 2000}, {2, "ccc", "ddd", 2300}, {3, "eee", "fff", 1900} }; myTable = new RXTable(new MyTableModel(data, columnNames)); myTable.setCellSelectionEnabled(true); myTable.setSelectAllForEdit(true); JScrollPane myScrollPane = new JScrollPane(myTable); myTable.setPreferredScrollableViewportSize(new Dimension(1000, 400)); mainPanel.getContentPane().add(myScrollPane); mainPanel.setVisible(true); Action action = new AbstractAction () { public void actionPerformed(ActionEvent e) { TableCellListener tcl = (TableCellListener)e.getSource(); System.out.println("***"); } }; TableCellListener tcl = new TableCellListener(myTable, action); } class MyTableModel extends DefaultTableModel { public MyTableModel(Object[][] data, String[] columnNames) { super(data, columnNames); } @Override public boolean isCellEditable(int row, int col) { return !(col==0); } @Override public Cla…

http://stackoverflow.com/q/21969974
answer count: 1
has comment: http://stackoverflow.com/comment/33290439
linked to: http://stackoverflow.com/q/9413625
has comment: http://stackoverflow.com/comment/33290591
linked to: http://stackoverflow.com/q/6343166
has answer: http://stackoverflow.com/a/21970423
tagged with: android
has body: I am having some trouble retrieving coordinates from my xampp sql server. When I type in the URL (http://192.168.1.100/cwdb/get_all_coordinates.php) on my phone, I get this list of JSON coordinates: {"coordinates":[{"cid":"1","latitude":"36.544670","longitude":"36.544651"},{"cid":"2","latitude":"36.544270","longitude":"15.524650"},{"cid":"3","latitude":"37.544270","longitude":"16.524651"},{"cid":"4","latitude":"27.544270","longitude":"76.524651"},{"cid":"5","latitude":"27.523569","longitude":"31.146650"}],"success":1} However when I try retrieve this through my android application I am running into a problem downloading the JSON string. I have included the internet permission in my manifest file. Here is my code that calls the http connection class. The system.out.print prints "DATAnull" private class JSONCoordinateTask extends AsyncTask&lt;String, Void, ArrayList&lt;Coordinate&gt;&gt; { @Override protected ArrayList&lt;Coordinate&gt; doInBackground(String... params) { ArrayList&lt;Coordinate&gt; cList = new ArrayList&lt;Coordinate&gt;(); String data = (new CoordinateHttpClient()).getCoordinateData(); System.out.println("DATA"+data); try { cList = JSONParser.getCoordinate(data); } catch (JSONException e) { e.printStackTrace(); } return cList; } And here is the http client class. The system out print here does not print out at all. So my guess is that it is not executing at all for some reason? public class CoordinateHttpClient { private static String BASE_URL = "http://192.168.1.100/cwdb/get_all_coordinates.php"; public String getCoordinateData() { try { URL oracle = new URL(BASE_URL); BufferedReader in = new BufferedReader(new InputStreamReader(oracle.openStream())); System.out.println("This doesn't print out"); StringBuffer buffer = new StringBuffer(); String line = null; while ( (line = in.readLine()) != null ) buffer.append(line + "\r\n"); in.close(); return buffer.toString(); } catch(Throwable t) { t.printStackTrace(); } return null; } } Any help at all would b…
type: AnsweredQuestion
has title: JSON Request from Android not executing
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
accepted answer: http://stackoverflow.com/a/21970423
has comment: http://stackoverflow.com/comment/33290691
has comment: http://stackoverflow.com/comment/33290463
score: 0

http://stackoverflow.com/comment/33327023
type: AnswerComment
has text: oh i see... you mean it does not show the list when you click the button? Did you implemented the onClickListener method?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21990447

http://stackoverflow.com/a/21874383
type: Answer
has comment: http://stackoverflow.com/comment/33162063
has comment: http://stackoverflow.com/comment/33166298
answers question: http://stackoverflow.com/q/21874331
has body: You declare your rowvariable but never initialise it. So when you call row.getLastCellNum();, it is still null. And you cannot call a method on an object that is null. It will throw the error you receive! to solve the problem, attribute a value to your variable as defined by what purpose it is to serve. By the excerpt you give I could only guess at what it should be! Edit: as you only use cols in the termination condition of your nested for loop, move the declaration of the variable just before the loop. It is also a good practice to use the minimum scope for variables. double key = 0.0; int cols = row.getLastCellNum(); for (int colIndex = 0; colIndex &lt; cols; colIndex++) // and so on.
score: 0

maven-jaxb2-plugin
type: Tag
tag name: maven-jaxb2-plugin
tags question: http://stackoverflow.com/q/21929157

http://stackoverflow.com/a/21927901
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21927744
has comment: http://stackoverflow.com/comment/33215578
upvote count: 1
has body: I don't think this should be worth the effort. PNGs already have a very high level of compression. It is hard to reduce the size by means of additional compression significantly. If you are really sending the image or the response Base64 encoded to the client, of course there are ways to improve transfer rates: Enable gzip compression on your server so that HTTP responses will be gzip compressed. This reduces the actual number of bytes to transfer quite a bit in case the original data is Base64 encoded (which basically means that you are only using 6 of 8 bits per bytes). Enabling gzip compression is transparent to your server code and is just a configuration switch away for most webservers.
type: Answer

http://stackoverflow.com/comment/33155038
type: QuestionComment
comment on: http://stackoverflow.com/q/21893964
score: 0
has text: @DennisMeng could you provide a snippet? I think I tried it and it didn't work.
type: Comment

google-cloud-storage
tags question: http://stackoverflow.com/q/21916156
type: Tag
tag name: google-cloud-storage

http://stackoverflow.com/comment/33220442
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21928960
has text: I think your @RequestMapping method should be POST.
score: 0

http://stackoverflow.com/comment/33299521
type: Comment
has text: It shouldn't matter, so long as both classes are on the classpath. Are they different projects? Does IntelliJ register them as separate projects that have no dependencies/relationships to one another? What happens if you delete the import statement and let IntelliJ import the class for you?
comment on: http://stackoverflow.com/q/21975254
score: 0
type: QuestionComment

http://stackoverflow.com/a/21921204
has body: Here you are passing two parameters, X and Y: setLocation(500,500); Here you are passing one, but which is it? X or Y? If X, where's Y?: int north = ((screenWidth - width)/2); setLocation(north); The compiler is telling you it doesn't have a setLocation() method that takes one parameter. It wants a location in 2D space: that's an X and Y. Probably what you want is: setLocation(north, 0);
accepted answer of: http://stackoverflow.com/q/21921135
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21921135
upvote count: 5
type: Answer
downvote count: 0
score: 5

http://stackoverflow.com/comment/33284731
type: Comment
has text: Is it the same issue i.e. "No mapping found for HTTP request URI" ?
comment on: http://stackoverflow.com/a/21966329
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33069426
type: AnswerComment
comment on: http://stackoverflow.com/a/21844548
score: 0
type: Comment
has text: where are you calling connect() method ?

http://stackoverflow.com/comment/33166219
type: QuestionComment
comment on: http://stackoverflow.com/q/21899373
has text: You are setting the style to "Title". Whether that's defined in the document's styles part is another question. When you say "change the font to times new roman and size 10", do you mean change the Title style definition? Because if you just mean the run, you can use the docx4j webapp to generate that code.
score: 0
type: Comment

http://stackoverflow.com/comment/33289150
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21969416
has text: but the application will not build.. ? means what ? Are you getting any syntax error ? Any exception ? Also add your manifest here

nested
tags question: http://stackoverflow.com/q/21869294
tag name: nested
type: Tag
tags question: http://stackoverflow.com/q/21882660
tags question: http://stackoverflow.com/q/21842864
tags question: http://stackoverflow.com/q/21947180

http://stackoverflow.com/comment/33715964
type: AnswerComment
has text: Thanks, that did it. Although I can confirm that it worked without this in JDK 1.7!
type: Comment
comment on: http://stackoverflow.com/a/22108079
score: 0

http://stackoverflow.com/q/21856860
type: Question
has answer: http://stackoverflow.com/a/21857080
tagged with: arrays
has answer: http://stackoverflow.com/a/21857306
score: 0
answer count: 3
has body: I'm trying to store rows from a table into an array. I can get the first result and store that but I cannot seem to be able to store any of the other data. This is the code I've written try { test = "select * from Arsenal order by 'MatchNumber' ASC"; rs = st.executeQuery(test); while (rs.next()) { //This retrieves each row of Arsenal table and adds it to an array in the Team Results class. matchno = rs.getString("MatchNumber"); hometeam = rs.getString("HomeTeam"); awayteam = rs.getString("AwayTeam"); homegoals = rs.getString("HomeGoals"); awaygoals = rs.getString("AwayGoals"); result = rs.getString("Result"); teams = (matchno + "," + hometeam + "," + awayteam + "," + homegoals + "," + awaygoals + "," + result); // Takes all the variables containging a single customers information and puts it into a string, seperated by commas. TeamResults.add(matchno,hometeam,awayteam,homegoals,awaygoals,result); } } Any idea where I'm going wrong?
type: UnansweredQuestion
has title: Storing rows from a MySQL table into an array in Java
tagged with: java
has answer: http://stackoverflow.com/a/21856902
tagged with: mysql

http://stackoverflow.com/comment/33121369
type: Comment
score: 0
has text: @Gimby The first servlet for file upload, and second servlet i have to take input values to make calculations from the uploaded file.
comment on: http://stackoverflow.com/q/21874326
type: QuestionComment

http://stackoverflow.com/a/21897359
score: 8
accepted answer of: http://stackoverflow.com/q/21897314
type: AcceptedAnswer
downvote count: 0
upvote count: 8
has body: Just switch HashSet for LinkedHashSet, which preserves insertion order while removing duplicates.
answers question: http://stackoverflow.com/q/21897314
type: Answer

http://stackoverflow.com/comment/33333518
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21993993
has text: See the expected generated tree for detail

http://stackoverflow.com/comment/33180173
type: QuestionComment
has text: If the application requires connection to a running MySQL instance, then you have to either install it or find a running instance with the necessary schema installed. "sqlDump"?
comment on: http://stackoverflow.com/q/21908737
score: 0
type: Comment

http://stackoverflow.com/comment/33122739
score: 0
type: Comment
type: QuestionComment
has text: Post some code. But I don't see the point in testing a query that is not even the query that will be used in your production code. All your test will do is test a fake query.
comment on: http://stackoverflow.com/q/21876385

http://stackoverflow.com/comment/33278060
has text: Action bar icons? But then how does Kik do it http://imgur.com/jIdhlBu,FzOhJzN#0 http://imgur.com/jIdhlBu,FzOhJzN#1
comment on: http://stackoverflow.com/a/21963165
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21976281
score: 0
has body: Why do you use addActionListener to listen to ComboBox item selection? Have you tried using addItemListenerinstead?
has comment: http://stackoverflow.com/comment/33301435
has comment: http://stackoverflow.com/comment/33302002
type: Answer
has comment: http://stackoverflow.com/comment/33301522
has comment: http://stackoverflow.com/comment/33301929
answers question: http://stackoverflow.com/q/21974806

http://stackoverflow.com/a/21995915
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21847525
has body: Using Spring you can create a RestFul webservice easily and spring does all the ground work you needed. As others had mentioned you can consume the webservice in any type of client - including Android. A detailed guide available here: https://spring.io/guides/gs/rest-service/

http://stackoverflow.com/comment/33087128
type: QuestionComment
comment on: http://stackoverflow.com/q/21852976
type: Comment
score: 0
has text: i don't know how to do this SSCCE a you want , i describe my problem very shortly and clearly , so i think that any other thing will be not useful am i right ;)

http://stackoverflow.com/comment/33248492
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21946520
has text: Oh, and I'm getting a 404. I'll update my question.
score: 0

http://stackoverflow.com/q/21990258
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: process
upvote count: 1
type: Question
has body: I'm trying to retrieve the version of python form java using ProcessBuilder. The command i'm using is: {process = new ProcessBuilder("C:\\Python27\\python.exe", "-V")} This command does not return anything. I'm almost sure this is the correct syntax to retrieve the python version, {process = new ProcessBuilder("C:\\Python27\\python.exe", "-h")} returns the python help as expected, but python -V does not return the python version. package com.x.x.precheck.python; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; public class Test { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Process process = null; try { process = new ProcessBuilder("C:\\Python27\\python.exe", "-V") .start(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; System.out.printf("Output of running %s is:", Arrays.toString(args)); try { while ((line = br.readLine()) != null) { System.out.println(line); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
has answer: http://stackoverflow.com/a/21990479
answer count: 2
downvote count: 0
favorite count: 0
has title: Trying to retrieve python version from java
tagged with: processbuilder
possible better answer: http://stackoverflow.com/a/21991254
has answer: http://stackoverflow.com/a/21991254
accepted answer: http://stackoverflow.com/a/21990479
tagged with: python

http://stackoverflow.com/a/21913173
answers question: http://stackoverflow.com/q/21912348
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33329377
has body: Try adding this rule in the class containing your tests: @Rule public Timeout globalTimeout = new Timeout(10000); // 10 seconds max per method tested Source: https://github.com/junit-team/junit/wiki/Timeout-for-tests Note : Put debug point on respective test case also to enable Junit in debug mode
score: 1
upvote count: 1

http://stackoverflow.com/q/21908997
score: 3
downvote count: 0
favorite count: 0
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/32441623
has title: unexpected e_machine: 3 in KaliumJNI for Android
answer count: 1
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/43928187
has body: I'm trying to use the libsodium crypto library (a portable version of NaCl (nacl.cr.yp.to)) on Android but I can't figure out how to properly compile/use the Kalium-JNI language binding. So far I successufully compiled libsodium as described on the libsodium website. In addition, I used the new android-arm compile script added 3 days ago. As a test I compiled the android-x86 version as well to compare the file sizes of the resulting library files. They differ so this seems to be working. As a next step I installed KaliumJNI using the newly generated android-arm libsodium files. No problems here. In my little android-maven test application which basically is a "Hello World" archetype I'm simply trying to generate a new keypair: import org.abstractj.kalium.keys.KeyPair; KeyPair Alice = new KeyPair(); IntelliJ succesfully compiled my little program but when I try to run it on my emulator (or on my Nexus S) it crashes. First it crashed because it wasn't able to find the kaliumjni library so I added libtestjni.so (which is the .so library generated by KaliumJNI) to my project properties which fixed this problem. The next error message I got told me that libtestjni.so is not 32bit (I'm running a 64bit Ubuntu 12.04LTS). I don't see why it has to be 32bit but anyway I managed to set up a 32bit Ubuntu 12.04LTS VM and compiled android-arm libsodium and KaliumJNI again to generate a 32bit libtestjni.so file. But when I use this 32bit file in my original application (on my 64bit machine) I receive the following error: java.lang.IllegalStateException: Could not execute method of the activity at android.view.View$1.onClick(View.java:3823) at android.view.View.performClick(View.java:4438) at android.view.View$PerformClick.run(View.java:18422) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.…
tagged with: libsodium
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33180904

http://stackoverflow.com/comment/33397525
type: AnswerComment
has text: Finally, >15 reputation, thus +1 for you!
comment on: http://stackoverflow.com/a/21974885
type: Comment
score: 0

http://stackoverflow.com/a/21950285
has body: Change the Minus listener to private void minusActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: fNums = Double.parseDouble(display.getText()); &lt;---------- display.setText(""); sub = true; } and enter action performed as private void enterActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your enter code here: if(add == true){ sNums = fNums + Double.parseDouble(display.getText()); display.setText(String.valueOf(sNums)); fNums = 0; add = false; } else { if(sub == true){ sNums = fNums - Double.parseDouble(display.getText()); &lt;---------- display.setText(String.valueOf(sNums)); fNums = 0; sub = false; } } } And Check
score: 0
answers question: http://stackoverflow.com/q/21950077
type: Answer

http://stackoverflow.com/a/21977514
score: -1
downvote count: 1
has body: A simpler way to find even and odd values is to divide number by 2 and check the remainder: if(x % 2 == 0) // remainder is 0 when divided by 2 { //even num } else { //odd num }
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/21977488

tcp
type: Tag
tags question: http://stackoverflow.com/q/21886471
tags question: http://stackoverflow.com/q/21850679
tags question: http://stackoverflow.com/q/21957766
tags question: http://stackoverflow.com/q/21925764
tags question: http://stackoverflow.com/q/21931703
tags question: http://stackoverflow.com/q/21973321
tags question: http://stackoverflow.com/q/21957344
tags question: http://stackoverflow.com/q/21922759
tag name: tcp

http://stackoverflow.com/q/21918553
has comment: http://stackoverflow.com/comment/33219239
tagged with: arrays
tagged with: substring
has body: I'm using this code to read some country names from a resource bundle and add them to a spinner: String [] countries = this.getResources().getStringArray(R.array.CountryCodes); ArrayAdapter<String> adapter = new ArrayAdapter<String>( this, android.R.layout.simple_spinner_item, countries ); adapter.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item ); mCountries.setAdapter(adapter); The resource data is XML that looks like: 93,AF, Afganistan 355,AL, Albania 213,DZ, Algeria How can I display only the country names in the Spinner and then display the corresponding digits in a separate Edittext widget? I know I have to use the split() method to remove the ",". But once I have an individual string element, like "93,AF, Afganistan", how do I get just the country name "Afganistan"? How do I keep that name in sync with the corresponding digits?
linked to: http://stackoverflow.com/q/1732348
score: 0
accepted answer: http://stackoverflow.com/a/21920724
has comment: http://stackoverflow.com/comment/33230835
has comment: http://stackoverflow.com/comment/33201747
has title: Splitting a String for use in a UI selection element
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21920724
tagged with: java
possible better answer: http://stackoverflow.com/a/21918793
has comment: http://stackoverflow.com/comment/33212915
type: Question
has answer: http://stackoverflow.com/a/21918793
linked to: http://stackoverflow.com/q/373833
answer count: 2

http://stackoverflow.com/q/21902518
upvote count: 0
favorite count: 0
has body: I am building an android app for work using android studio. I have a list of witnesses stored as sharedpreference, when the uses clicks to amend these witnesses are split up and listed the user can then click the witness they want to amend, well that's the plan, I just cant seem pass the witness listed number (basically the number used in the loop) to another function that will load the witnesses information into a form to be amended. Below is my code: String s= WitnessDetails; String[] array = s.split("$_$(?=[0-9])"); LinearLayout parentLayout = (LinearLayout)findViewById(R.id.LinearLayout); // Layout inflater LayoutInflater layoutInflater = getLayoutInflater(); View view; for(String str : array) { countWitness++; String WitnessName= str; view = layoutInflater.inflate(R.layout.witnesses_activity, parentLayout, false); // In order to get the view we have to use the new view with text_layout in it TextView textView = (TextView)view.findViewById(R.id.Witnesses_details); textView.setText("Witness 1: " + countWitness + "\n" + WitnessName+"\n Edit"); // Add the text view to the parent layout parentLayout.addView(textView); textView.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { Amendwitness(countWitness); } }); } public void Amendwitness(witnessNum){ }
tagged with: android
has comment: http://stackoverflow.com/comment/33169727
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/21902606
tagged with: java
tagged with: sharedpreferences
score: -1
has answer: http://stackoverflow.com/a/21902578
has comment: http://stackoverflow.com/comment/33169971
type: Question
answer count: 2
has title: Passing values to a function in Java

http://stackoverflow.com/comment/33144470
comment on: http://stackoverflow.com/a/21888020
type: AnswerComment
score: 0
type: Comment
has text: OK..It won't be multiple iOS clients with single applet, it will be multiple iOS clients with multiple sockets. So, each iOS client will be shared data with separate Applet.

http://stackoverflow.com/q/21861542
favorite count: 0
has body: I am using the Jackson jars (core 2.3.1, annotations 2.2.3, databind 2.3.1, all the latest from the downloads page) to read a Json file, grab what I need put it into a new object and write/printout that object to a file or the screen. I have seen most examples say that it's as easy as ObjectMapper mapper = new ObjectMapper(); mapper.writeValueAsString(object); Or ObjectWriter mapper = new ObjectMapper().writer().withDefaultPrettyPrinter(); writer.writeValueAsString(object); Although I have the necessary jar's I keep getting the error ClassNotFoundException: com.fasterxml.jackson.annotation.JsonPropertyDescription. Upon digging deeper I find that the JsonPropertyDescription class that is in the github for jackson, is not packaged with the annotations 2.2.3 jar. So has it been deprecated and there is some new way I haven't seen to take an object and print it to json, or was this class accidentally left out of the newer version?
type: AnsweredQuestion
has title: Jackson JSON Mapping "NoClassDefFoundError: JsonPropertyDescription"
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: noclassdeffounderror
accepted answer: http://stackoverflow.com/a/23385461
type: Question
has comment: http://stackoverflow.com/comment/33096697
tagged with: jackson
has answer: http://stackoverflow.com/a/23385461
has comment: http://stackoverflow.com/comment/33096725
has comment: http://stackoverflow.com/comment/33096534
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/33096912
tagged with: jar

http://stackoverflow.com/comment/33281144
type: AnswerComment
has text: @JigarJoshi No. I'd want to do some more tests and maybe a proof. But I did say "seems" and I also showed an alternative solution just in case. However, in the question comments, OP says that there is indeed a pattern - I'm not sure how he verified this.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21964766

http://stackoverflow.com/a/21942955
has body: public InventoryItem seqSearchRec(int sku) { int index = seqSearchRecHelper(sku,0);// send the key to be searched(sku) //and the start index(lets begin with index 0) if(index == -1){ // sku not found }else{ // sku found at possition index } // return InventoryItem object }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21942720

http://stackoverflow.com/a/21889516
has body: When you call add, the ArrayList now has its own reference to the same object. test ----&gt; Test() object ^ testList ----| That is unaffected by setting your reference test to null. test ----&gt; null testList ----&gt; Test() object
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21889478
type: Answer
accepted answer of: http://stackoverflow.com/q/21889478
score: 3
upvote count: 3

http://stackoverflow.com/q/21866382
linked to: http://stackoverflow.com/q/21868956
favorite count: 0
tagged with: sockets
has body: I'm trying to send and receive some Audio encoded data via UDP, and confused. First of all, I have done UDP send-receive before on C# and node.js, and receiving the packet one by one is very straight forward and easy, but it's different in Java, and confusing me. The every encoded data size is approximately 360-380 bytes for each, and I need to send this encoded data as a packet to remote(or localhost so far) via UDP. The UDP-receiver should receive the encoded data as a packet and process to decode. Here is a brief example to illustrate what I do. Encoder and UDP-sender ds = new DatagramSocket(localPort); //a Thread with While loop---------- Log.d("AudioEncoder", outData.length + " bytes encoded"); //The encoded data size is about 370 bytes for each packet = new DatagramPacket(outData, outData.length, InetAddress.getByName("127.0.0.1"), localPort); ds.send(packet); UDP-receiver and Decoder ds = new DatagramSocket(localPort); byte[] buffer2 = new byte[1024]; DatagramPacket packet = new DatagramPacket(buffer2, buffer2.length); while (isPlaying) { ds.receive(packet); Log.d("UDP-receiver", buffer2.length + " bytes received"); //do Decoding on buffer2 //.......... } Basically, a packet (encoded byte data) size to send and receive is approximately 360-380 bytes for each. Then, I understand for Java Datagram, make a buffer for a specific byte size such as 512 or 1024 (I don't know what size is most optimized in this case, and in these days). If I set the DatagramPacket size 1024 bytes, the packet which size is 360-380 bytes comes twice to be pooled in the buffer, then the original 2 packets are joind together then processed as a single byte array? If I set the DatagramPacket size 512 bytes, the packet which size is 360-380 bytes comes twice to be pooled in the buffer, then since it's overflowed the buffer size, the single packet arrived is swiped to be processed? Again, it's sufficient at least, the receiver can receive a packet one by one, then process for each, but thin…
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21866903
type: Question
tagged with: network-programming
tagged with: udp
has title: Java UDP send - receive packet one by one
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/21866903

http://stackoverflow.com/q/21996156
possible better answer: http://stackoverflow.com/a/21996762
has title: Scope issues in android Development
has answer: http://stackoverflow.com/a/21996762
has answer: http://stackoverflow.com/a/21997641
tagged with: class
has answer: http://stackoverflow.com/a/21997616
tagged with: scope
score: 0
answer count: 3
tagged with: android
accepted answer: http://stackoverflow.com/a/21997641
has body: So I'm familiar with OOP and java basics. Some of the nuances of Android still escape me though. I am having a real issue with the scope of some of my classes right now. Here's an example: In my activity, I reference a custom class called "Player" a player can do a number of thing including draw tiles, and place tiles. I'm keeping a list of all undrawn, available tiles in an array of AVAILABLE_TILES in my activity. This is important because I reference that list all the time in many different situations. Here's my issue though. Here's the code in my activity: public void setUpPlayers(){ for (int i = 0; i &lt; players.length; i++) { players[i] = new Player(playerNames[i], 6000); players[i].drawTile(1); //draw one tile //find the ID for the tile just placed String tileID = players[i].findTileIdByIndex(0); //first tile in thier tile pool players.[i].placeTile(tileID); Log.d(players[i].getName(), tileID); } } and here's the code from the "Player" class: public void drawTile(int quantity){ //repeat for the total number of tiles being drawn for (int i = 0; i &lt; quantity; i++) { //get a random tile ID from the list of available tiles int randomTileIndex = RNG.nextInt(AVAILABLE_TILES.size()); String randomTileName = AVAILABLE_TILES.get(randomTileIndex); //add this tile to the player's pool of tiles addPlayerTile(randomTileName); Log.d("AVAILABLE_TILE_REMOVED", String.valueOf(randomTileIndex)); //and remove that tile now from the available tiles list AVAILABLE_TILES.remove(randomTileIndex); } } So as you can see, I've got an ArrayList that holds the ID of every available tile. (Not in any player pool, and not on the board.) The issue is, that since that ArrayList is in the activity, I can't seem to reference it in Player.java. Do I need to import some android related library to Player.java? In another situation, I've made an array of a custom class "Tile" that extends Button, and that has no problems with referencing the global (Static) variables in the activity. So What's…
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/21856312
duplicate of: http://stackoverflow.com/q/46898
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21856576
has body: How can i print all the values from the following hashmap ServletContext appScope = request.getServletContext(); Map&lt;String, List&lt;String&gt;&gt; onLine = (HashMap&lt;String, List&lt;String&gt;&gt;)appScope.getAttribute("User"); if(onLine != null) { out.print(onLine.get("1")); }
has answer: http://stackoverflow.com/a/21856485
tagged with: java
has answer: http://stackoverflow.com/a/21857509
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/21856360
type: Question
has title: how to get values from hashmap using loop
tagged with: hashmap
score: 0
has answer: http://stackoverflow.com/a/21856683
favorite count: 0
linked to: http://stackoverflow.com/q/46898
has answer: http://stackoverflow.com/a/21856360
answer count: 5
has answer: http://stackoverflow.com/a/21856576

http://stackoverflow.com/comment/33076113
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21849137
type: Comment
has text: Thanks a lot! I've managed to get it working. Also @Karci10 provided an tutorial, which demonstrates it in a similar way http://www.accordess.com/wpblog/an-overview-of-java-compilation-api-jsr-199/

http://stackoverflow.com/q/21881846
favorite count: 0
answer count: 5
type: UnansweredQuestion
has body: I have the followed imports: import org.slf4j.Logger; import org.slf4j.LoggerFactory; and the following instantiation: private static Logger logger = LoggerFactory.getLogger(Test.class); and the following in my Main method: logger.info("SOME MESSAGE: "); However, I'm not able to find the output anywhere. All I see is that in my console there is: 21:21:24.235 [main] INFO some_folder.Test - SOME MESSAGE: How do I locate the log file? Note that the following are on my build path: slf4j-api-1.7.5.jar slf4j-log4j12-1.6.4.jar I read the answer to similar questions but nobody actually says how to fix the problem.
has answer: http://stackoverflow.com/a/21882004
tagged with: bin
tagged with: java
has comment: http://stackoverflow.com/comment/33132281
has answer: http://stackoverflow.com/a/77380811
tagged with: output
has answer: http://stackoverflow.com/a/21882632
tagged with: logging
type: Question
upvote count: 80
has answer: http://stackoverflow.com/a/21881983
has comment: http://stackoverflow.com/comment/33132372
score: 80
has answer: http://stackoverflow.com/a/45620776
tagged with: slf4j
has title: Where does the slf4j log file get saved?
downvote count: 0

http://stackoverflow.com/comment/33153085
type: Comment
type: QuestionComment
has text: What code do you get when you record a macro and try clicking the button?
comment on: http://stackoverflow.com/q/21892880
score: 1

http://stackoverflow.com/q/21846806
accepted answer: http://stackoverflow.com/a/21846873
type: Question
answer count: 6
possible better answer: http://stackoverflow.com/a/21846875
has title: how to parse this response using JSONObject
score: 0
has answer: http://stackoverflow.com/a/21846875
tagged with: android-listview
tagged with: android
has answer: http://stackoverflow.com/a/21846865
has answer: http://stackoverflow.com/a/21846903
has answer: http://stackoverflow.com/a/21847042
type: AnsweredQuestion
tagged with: android-layout
has answer: http://stackoverflow.com/a/21846873
tagged with: java
has answer: http://stackoverflow.com/a/21846988
has body: I have this response that I get back form server. I want to parse it and get the hospital_name out of it. How would I go about it? [ { "Hospital": { "id": "63083", "hospital_name": "Colorado Mental Health Inst", "hospital_add_1": "1600 W 24th St", "hospital_add_2": null, "hospital_city": "Pueblo", "hospital_state": "CO", "hospital_zip": "81003", "hospital_phone": "719-546-4000\r", "hospital_fax": null, "hospital_description": null, "callcenter_agent_approval": "0", "hospital_site": "", "mdpocket_approval": "0", "facebook": "" }, "Floor": [], "Department": [], "Image": [], "Notes": [] }, { "Hospital": { "id": "63084", "hospital_name": "Parkview Medical Center", "hospital_add_1": "400 W 16th St", "hospital_add_2": null, "hospital_city": "Pueblo", "hospital_state": "CO", "hospital_zip": "81003", "hospital_phone": "719-584-4000\r", "hospital_fax": null, "hospital_description": null, "callcenter_agent_approval": "0", "hospital_site": "", "mdpocket_approval": "0", "facebook": "" }, "Floor": [], "Department": [], "Image": [], "Notes": [] }, { "Hospital": { "id": "63085", "hospital_name": "St Mary-Corwin Medical Center", "hospital_add_1": "1008 Minnequa Ave", "hospital_add_2": null, "hospital_city": "Pueblo", "hospital_state": "CO", "hospital_zip": "81004", "hospital_phone": "719-560-4000\r", "hospital_fax": null, "hospital_description": null, "callcenter_agent_approval": "0", "hospital_site": "", "mdpocket_approval": "0", "facebook": "" }, "Floor": [], "Department": [], "Image": [], "Notes": [] } ] EDITED THE JSON *UPDATED JSON *

http://stackoverflow.com/comment/33227870
type: Comment
comment on: http://stackoverflow.com/a/21922895
type: AnswerComment
has text: so just simply : `@PostConstruct public void markSectionTwo() { this.markingFacade.edit(this.markSectionTwo); this.setMessage("Mark Saved"); }`
score: 0

http://stackoverflow.com/comment/33234857
has text: @NeilLunn First of all I would like to thank you for your answers on SO. It helps me out a lot. As for my previous question, I am just confused because the API doesn't work as I expected. I will probably edit that question: `s/bug/results I do not expect/understand/g`.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21933026
type: AnswerComment

http://stackoverflow.com/a/21942675
has comment: http://stackoverflow.com/comment/33240831
has comment: http://stackoverflow.com/comment/33241064
type: AcceptedAnswer
downvote count: 0
has body: By implementing Actor, you promise to implement void act(List&lt;Actor&gt; xxx) method, but you did not. You did implement a method void act(List&lt;Animal&gt; xx), but this is a different method (has a different signature). Simply, you are not correctly overriding act method: public void act(List&lt;Animal&gt; newRabbits) != void act(List&lt;Actor&gt; newActors); The signature must correspond. Since act is abstract in Actor (being an interface) you must override it in a class that implements Actor or declare it abstract (without being able to instantiate it.
type: Answer
accepted answer of: http://stackoverflow.com/q/21942650
answers question: http://stackoverflow.com/q/21942650
score: 5
has comment: http://stackoverflow.com/comment/33240768
upvote count: 5

http://stackoverflow.com/a/21866276
has body: Place line by line log.i(TAG,"OK1"); ... code line log.i(TAG,"OK2"); ... code line log.i(TAG,"OK3"); . . . to find which line of code has NULL error.
type: Answer
has comment: http://stackoverflow.com/comment/33226257
downvote count: 1
has comment: http://stackoverflow.com/comment/41916176
score: -1
has comment: http://stackoverflow.com/comment/33104981
upvote count: 0
answers question: http://stackoverflow.com/q/21866078

http://stackoverflow.com/comment/33103175
has text: Yeah, but I haven't answered the "how can I perform search" part of the question. Nor will I, because it's far too broad.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21865274

http://stackoverflow.com/comment/33349014
type: Comment
comment on: http://stackoverflow.com/a/22002415
type: AnswerComment
has text: First of all, I have the answer, thank you very much. Value of the data result of or after October 2, 1968 is the same for me. I think the problem is the value of the result of data Prior to October 1, 1968 and are different. I want, Disable keyboard input on Android TimePickerDialog. Thank you, Have a nice day.
score: 0

http://stackoverflow.com/a/21984495
score: 0
has comment: http://stackoverflow.com/comment/33315802
has comment: http://stackoverflow.com/comment/33316261
has comment: http://stackoverflow.com/comment/33320488
has comment: http://stackoverflow.com/comment/33316309
answers question: http://stackoverflow.com/q/21984332
has comment: http://stackoverflow.com/comment/33316994
has body: TimerTask runs on a different thread. Ui can be updated only from ui thread. This img.setImageBitmap(bitmap); should be executed on the ui thread Use runOnUiThread. You can also use a Handler. Also i do not understand the need for the for loop. runOnUiThread(new Runnable() { @Override public void run() { img.setImageBitmap(bitmap); } });
has comment: http://stackoverflow.com/comment/33317099
type: Answer
has comment: http://stackoverflow.com/comment/33315873
has comment: http://stackoverflow.com/comment/33316955
has comment: http://stackoverflow.com/comment/33320417
has comment: http://stackoverflow.com/comment/33317049

http://stackoverflow.com/a/21903462
has body: One solution I've used in this case is to create first the parent frame (the one that will be shown after login) and set him invisible. Then you can launch the login window. You must add a listener to this frame so that when it's closed as a login successful result, you make the parent frame visible. public static void main(String[] args) { final JFrame parentFrame = new JFrame("Main window"); parentFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //add content to the main frame parentFrame.setVisible(false); final JFrame loginFrame = new JFrame("Login window"); //add content to the login frame loginFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); loginFrame.addWindowListener(new WindowAdapter() { @Override public void windowDeactivated(final WindowEvent e) { super.windowDeactivated(e); //test if login successful parentFrame.setVisible(true); } }); loginFrame.setVisible(true); }
answers question: http://stackoverflow.com/q/21903251
type: Answer
score: 0

http://stackoverflow.com/q/21963147
tagged with: adjacency-matrix
type: Question
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/21963250
tagged with: boolean
upvote count: 0
answer count: 1
has title: Java Breadth First Search?
favorite count: 0
accepted answer: http://stackoverflow.com/a/21963250
type: AnsweredQuestion
has body: so I am trying to do a breadth first search on a list of nodes that I have but I'm not sure where to start? I have a pretty good understanding of what a breadth first search is but I have no idea how to implement it. My code is as follows: Scanner scanner = new Scanner(System.in);
tagged with: breadth-first-search
downvote count: 1

http://stackoverflow.com/a/21921849
has comment: http://stackoverflow.com/comment/33229081
has body: You can use regex like this: public class Main { public static void main(String[] args) { Pattern p = Pattern.compile("(\\d+\\.\\d+\\.\\d+\\.\\d+)\\s.*\\s.*\\s\\[(.*)\\]\\s\\'(.*)\\'\\s(.*)"); Matcher m = p.matcher("192.168.2.20 - - [28/Jul/2006:10:27:10 -0300] 'GET /cgi-bin/try/ HTTP/1.0' 200 3395"); boolean b = m.matches(); System.out.println(m.group(1)); System.out.println(m.group(2)); System.out.println(m.group(3)); System.out.println(m.group(4)); } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21920949

http://stackoverflow.com/q/21905169
has comment: http://stackoverflow.com/comment/33239680
type: Question
has comment: http://stackoverflow.com/comment/33211654
has body: I'm playing around with java8 lambdas and I came across a compiler error which I didn't expect. Say I have a functional interface A, an abstract class B and a class C with overloaded methods that take either A or B as arguments: public interface A { void invoke(String arg); } public abstract class B { public abstract void invoke(String arg); } public class C { public void apply(A x) { } public B apply(B x) { return x; } } Then I can pass a lambda into c.apply and it is correctly resolved to c.apply(A). C c = new C(); c.apply(x -&gt; System.out.println(x)); But when I change the overload that takes B as argument to a generic version the compiler reports that the two overloads are ambiguous. public class C { public void apply(A x) { } public &lt;T extends B&gt; T apply(T x) { return x; } } I thought the compiler would see that T has to be a subclass of B which is not a functional interface. Why can't it resolve the correct method?
has comment: http://stackoverflow.com/comment/33212297
downvote count: 0
score: 47
upvote count: 47
answer count: 3
has comment: http://stackoverflow.com/comment/33176868
has answer: http://stackoverflow.com/a/21951311
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/24049182
has comment: http://stackoverflow.com/comment/33245765
possible better answer: http://stackoverflow.com/a/21947725
tagged with: lambda
tagged with: java-8
has comment: http://stackoverflow.com/comment/35998747
linked to: http://stackoverflow.com/q/23430854
has answer: http://stackoverflow.com/a/21947725
type: AnsweredQuestion
has title: Java8: ambiguity with lambdas and overloaded methods
tagged with: java
accepted answer: http://stackoverflow.com/a/21951311

http://stackoverflow.com/q/21952602
has title: How to hide an activity after login in android?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33258812
tagged with: android
tagged with: android-activity
tagged with: java
has comment: http://stackoverflow.com/comment/33258789
type: Question
has answer: http://stackoverflow.com/a/21952752
has comment: http://stackoverflow.com/comment/33258840
has answer: http://stackoverflow.com/a/21952700
score: 0
answer count: 3
has body: I have developed an App where the user has to login into the app using the login Activity. After successful login, the app is directed to Activity B. The app doesn't provide any signout options.So next time when the user uses the app I want to hide the login Activity's layout. Is it possible to do so?If yes, how is it possible?
has answer: http://stackoverflow.com/a/21952638

http://stackoverflow.com/comment/36700471
type: Comment
has text: If you aren't using maven, then you must have packaged the `servlet-api` jar inside the WEB-INF/lib folder of the war. Check the lib folder to verify and remove it if it is present there.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21951060

http://stackoverflow.com/comment/39563731
has text: Hi bsmk. so how does that make it Restful if you are stored the token to the repository?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23325774

http://stackoverflow.com/a/21958039
accepted answer of: http://stackoverflow.com/q/21900530
answers question: http://stackoverflow.com/q/21900530
score: 0
type: AcceptedAnswer
has body: As it turns out, the error message was not being written to the console when the method in question was called from within JavaScript. I modified the Applet so that the method could be called from within the Applet, and the error was displayed in the console as expected. The Applet was missing an Apache class, so that was added and all is well.
type: Answer

http://stackoverflow.com/q/21847964
score: -3
has title: An alternative to StringBuilders by just using Strings?
has answer: http://stackoverflow.com/a/21849161
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/33072164
type: Question
has comment: http://stackoverflow.com/comment/33071643
has answer: http://stackoverflow.com/a/21848303
has comment: http://stackoverflow.com/comment/33071614
has comment: http://stackoverflow.com/comment/33072245
has comment: http://stackoverflow.com/comment/33071879
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/33072004
has body: Currently I have this.... public static String repeatLetters(int multiplier, String text) { StringBuilder repeat = new StringBuilder(); for (int i = 0; i &lt; text.length(); i++) { for (int j = 0; j &lt; multiplier; j++) { repeat.append(text.charAt(i)); } } System.out.println("Letters Repeated:"); System.out.println("-----------"); System.out.println(repeat); System.out.println("--------------"); return repeat.toString(); } I would like to code in such a way that the last statement which currently reads "return repeat.toString();" to just "return value". How can I structure this code to do just that? Is there a way to do that without using StringBuilders and just using Strings?
has comment: http://stackoverflow.com/comment/33071560
has comment: http://stackoverflow.com/comment/33071563
tagged with: string
has answer: http://stackoverflow.com/a/21848030
has comment: http://stackoverflow.com/comment/33071838
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33071550

http://stackoverflow.com/comment/33285926
has text: document.close(); } catch (Exception e) { System.out.println(e); } finally { if (document != null && document.isOpen()) { document.close(); } } response.setContentType("application/octet-stream"); response.setHeader("Content-disposition", "attachment; filename=Text.pdf"); response.setContentLength(baos.size()); OutputStream outStream = response.getOutputStream(); baos.writeTo(outStream);
comment on: http://stackoverflow.com/q/21967518
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33233338
comment on: http://stackoverflow.com/q/21892723
has text: Thanks for your help.Now my html is running fine.i did n't see any error message.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33170015
type: Comment
score: 0
type: AnswerComment
has text: I told you it's NumberFormatException, not InputMismatchException. Catch this line dane = Integer.parseInt(sc.next()); This line makes sure that whatever you enter gets parsed into int, if it can't it throws NumberFormatException
comment on: http://stackoverflow.com/a/21901809

http://stackoverflow.com/a/21956222
type: Answer
has comment: http://stackoverflow.com/comment/91887779
score: 79
downvote count: 1
upvote count: 80
has body: If you don't want to use any JPA provider such as OpenJPA or Hibernate, you can just give Apache DbUtils a try. http://commons.apache.org/proper/commons-dbutils/examples.html Then your code will look like this: QueryRunner run = new QueryRunner(dataSource); // Use the BeanListHandler implementation to convert all // ResultSet rows into a List of Person JavaBeans. ResultSetHandler<List<Person>> h = new BeanListHandler<Person>(Person.class); // Execute the SQL statement and return the results in a List of // Person objects generated by the BeanListHandler. List<Person> persons = run.query("SELECT * FROM Person", h);
answers question: http://stackoverflow.com/q/21956042
has comment: http://stackoverflow.com/comment/113985960

http://stackoverflow.com/comment/33087171
score: 2
has text: Please have a look at [this answer](http://stackoverflow.com/a/9866659/1057230) of mine for __Eclipse__ related part, might be this will shed some more light. This link is also available at info of [tag:embedded-resource]
comment on: http://stackoverflow.com/q/21856648
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21990133
tagged with: guava
has answer: http://stackoverflow.com/a/24820173
upvote count: 3
tagged with: java
tagged with: collections
type: Question
has title: Guava CacheBuilder: imply additional conditions to entity removal
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33334944
type: UnansweredQuestion
has body: I want: Remove entity when both conditions are true timeout expired some external conditions are true Question: How should I imply additional removal conditions besides timeout? Or how can I restore entity from removal listener (see code below)? My code (which already remove based on timeout only): LoadingCache&lt;String, Integer&gt; ints = CacheBuilder.newBuilder() .maximumSize(10000) .expireAfterAccess(ACCESS_TIMEOUT, TimeUnit.MILLISECONDS) .removalListener( new RemovalListener() { public void onRemoval(RemovalNotification notification) { if (notification.getCause() == RemovalCause.EXPIRED) { if (!isExternalCondition()) { //IS IT POSSIBLE TO RESTORE? restore(notification.getValue()); } } else { System.out.println("Just removed for some reason"); } } } ) .build( new CacheLoader&lt;String, Integer&gt;() { public Integer load(String key) throws Exception { return new Integer(-1); } });
score: 3

http://stackoverflow.com/q/21911047
tagged with: velocity
has body: Is there any option to set number of pages while converting odt -> pdf using xdocreport? I want the number of pages parameter to be configurable based on the content of the document being generated. If the number of pages in the document is 1 then add one blank page, if length is 3 then add one. So basically I want to generate document with even number of pages and it is fine if last page is blank. The content in the document will be added dynamically so I can't just pass the number of pages using some config parameter.
upvote count: 1
answer count: 1
has title: Option to set number of pages while generating pdf using xdocreport
tagged with: xdocreport
tagged with: java
downvote count: 0
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/21929298
tagged with: http://stackoverflow.com/tag/pdf
score: 1
favorite count: 0

http://stackoverflow.com/comment/33338339
has text: you want to generate a random between the two input right?
type: Comment
comment on: http://stackoverflow.com/a/21996187
score: 0
type: AnswerComment

http://stackoverflow.com/q/21855246
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/21855485
score: 0
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/21855509
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21855449
has answer: http://stackoverflow.com/a/21855449
tagged with: java
has title: Writting pseudocode for android app
accepted answer: http://stackoverflow.com/a/21855509
tagged with: pseudocode
type: Question
has body: I'm trying to write pseudocode for an android GPS app example, i know there is no standard but is it acceptable to do this or there a better and more clear way? Define class MainActivity inherits Android Activity class and implements LocationListener interface MainActivity Start Override the void onCreate method of Activity class start set the buttons of the main screen layout: do set 'my point button' to start GeoLocation class set 'settings button' to start Settings class set 'address button' to start My Address class set 'Help image_button' to start Help class done End Override the void onResume method of Activity class start request Location Updates every 5 seconds end // and so on and what about representing activity life cycle? can it represented this way? when the activity created do ........... done when the activity Resumed //and so on and then i'll write the other classes thank you
favorite count: 0
has answer: http://stackoverflow.com/a/21855547

http://stackoverflow.com/a/21899166
has body: You could use Apache Tika to read pdf document contents and then transform that to XML in some way. Maybe create a Apache Camel route that reads documents in a folder then use Tika to extract content and then spit that out as XML somewhere else.
type: Answer
answers question: http://stackoverflow.com/q/21899089
score: 0

http://stackoverflow.com/comment/33348297
type: Comment
type: QuestionComment
has text: What is the exception?
score: 0
comment on: http://stackoverflow.com/q/22002616

http://stackoverflow.com/comment/33335527
has text: Another problem is that in main, the `BABY` is created with `null` age, and then in `Kindergarten.add_b(BABY)`, the copy-constructor is used, which tries to retrieve the age from the baby.
type: Comment
comment on: http://stackoverflow.com/a/21995640
score: 0
type: AnswerComment

http://stackoverflow.com/q/21986071
tagged with: android
has comment: http://stackoverflow.com/comment/33318677
has comment: http://stackoverflow.com/comment/33318413
has answer: http://stackoverflow.com/a/21986357
linked to: http://stackoverflow.com/q/8133417
tagged with: java
has answer: http://stackoverflow.com/a/21986143
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/33318344
linked to: http://stackoverflow.com/q/8046540
type: UnansweredQuestion
has title: Which exception is thrown when phone memory is filled?
has comment: http://stackoverflow.com/comment/33318552
has answer: http://stackoverflow.com/a/21986219
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33318122
has comment: http://stackoverflow.com/comment/33318225
has comment: http://stackoverflow.com/comment/33318045
type: Question
tagged with: exception
has body: I am trying to create some files programmatically in Android, which are to be saved in the phone's internal memory. My question is , which exception am I supposed to catch in the event that the phone memory completely fills up as I create and save the files? Essentially, I want to know which exception is triggered, so that I can prevent my app from crashing in that event. EDIT: I came to know that IOException is triggered. But how do I track whether this exception occured, because internal memory was full? Since IOException can occur for variety of reasons, how do I track this particular scenario?

http://stackoverflow.com/comment/33164121
comment on: http://stackoverflow.com/a/21899161
has text: I doubt that deleting question by OP will be possible since there is already upvoted answer :)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33213648
comment on: http://stackoverflow.com/a/21912294
type: AnswerComment
score: 0
type: Comment
has text: Thanks, I had to change the proxy type to `Proxy.Type.HTTP` then it worked

http://stackoverflow.com/a/21861225
has body: Any class will have a toString() method, because java.lang.Object has it. Therefore, your assertion is sort of... pointless. As @Kevin mentioned, use Object message instead of Class clazz and that will do it. :)
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21861172
downvote count: 0

http://stackoverflow.com/q/21949070
type: AnsweredQuestion
has title: Sending Information Back From Servlet to JSP
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21949140
tagged with: servlets
answer count: 1
tagged with: jsp
score: 0
has body: A user clicks on edit on the index.jsp page and it sends them to a editCustomer.jsp page. The problem is when I click update it doesnt update the customer information on the index page. How can I do this using the code I have? INDEX.JSP <%@page import="edu.witc.Assignment02.controller.CustomerServlet"%> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ page import="java.util.ArrayList" %> Home <% String customerString =""; ArrayList<edu.witc.Assignment02.model.Customer> customers = (java.util.ArrayList)request.getAttribute("customers"); for (edu.witc.Assignment02.model.Customer customer : customers) { customerString += " " + customer.getName() + "(" + customer.getCity() + ") (" + "edit) "; }%> <%=customerString %> EDITCUSTOMER.JSP <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@page import="edu.witc.Assignment02.controller.CustomerServlet"%> Edit Customer Edit Customer <% int customerId = Integer.parseInt(request.getParameter("id"));%> <input type='hidden' name ='id' value='<%=customerId%>'/> Name: " City: Customer List SERVLET package edu.witc.Assignment02.controller; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; 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 edu.witc.Assignment02.*; import edu.witc.Assignment02.model.Customer; /* * Not thread-safe. For illustration purpose only */ @WebServlet(name = "CustomerServlet", urlPatterns = { "/customer", "/editCustomer", "/updateCustomer"}) public class CustomerServlet extends HttpServlet { private static final long serialVersionUID = -20L; private List<edu.witc.Assignment02.model.Customer> customers = new ArrayList<Customer>(); @Override public void init() throws ServletException { Custom…
has comment: http://stackoverflow.com/comment/33252746
accepted answer: http://stackoverflow.com/a/21949140

http://stackoverflow.com/comment/33168229
has text: where are you setting keepLooping to true??
comment on: http://stackoverflow.com/q/21901665
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33103432
comment on: http://stackoverflow.com/a/21865177
score: 1
type: AnswerComment
has text: Crashing would only happen if you modify the collection. Nothing in your example seems to be modifying the collection, so it won't crash. If something is modifying the collection you will need to restrict using a lock or use a copy-on-write or similar collection.
type: Comment

http://stackoverflow.com/comment/33320266
has text: Ah yes there is an early error that the JSON file is not being downloaded which must be causing the error
score: 0
comment on: http://stackoverflow.com/a/21973109
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21860619
has body: You are confusing the variable you assign an object to, to the actual object instance. Both code samples create the equivalent amount of objects. The second one will keep one instance in larger scope, thus it will be available for a longer time.
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21860573
downvote count: 0
type: Answer

http://stackoverflow.com/q/21977130
has comment: http://stackoverflow.com/comment/33303032
has answer: http://stackoverflow.com/a/21977177
tagged with: equals
has title: How to turn this into an override?
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/21977192
tagged with: java
tagged with: overriding
type: Question
has comment: http://stackoverflow.com/comment/33302966
answer count: 2
upvote count: 0
score: -2
has body: How do you make something into an override? My book offers a basic explanation but does not show how to implement it into your code and the internet is just as helpful. My directions say to... Create a Java class called Rational: ... that overrides equals such that if the parameter’s numerator and denominator are exactly equal to the current objects numerator and denominator the method returns true, and false otherwise. I thought I had figured out how to do the override method but was upon further investigation it looks like I messed it up. Rational.Equals(Rational x){ if(x.numerator == a &amp;&amp; x.denominator == b) { return true; } else { return false; } } Any tips or good reading on how to make this into an override method?
favorite count: 0

http://stackoverflow.com/a/21884946
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: nested exception is java.lang.OutOfMemoryError: PermGen space Above line from exception message means you're running out of memory due to the PermGem space not being high enough. You can increase this with a launch argument like so: -XX:MaxPermSize=128m
accepted answer of: http://stackoverflow.com/q/21884803
answers question: http://stackoverflow.com/q/21884803
upvote count: 1

http://stackoverflow.com/comment/33245187
type: QuestionComment
type: Comment
has text: recompiled, for some reason I lost 7 lines some how.
comment on: http://stackoverflow.com/q/21943803
score: 0

http://stackoverflow.com/a/21902860
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21902533
has comment: http://stackoverflow.com/comment/33170704
has body: Bit strange that they have not mention directly in website, Even i have checked that FAQ page but unable to find. but i think you can ask in support page.
type: Answer
has comment: http://stackoverflow.com/comment/33170868
upvote count: 1

http://stackoverflow.com/comment/33122979
has text: The namespace is indeed the issue. Could you show some java code?
comment on: http://stackoverflow.com/q/21876386
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21994955
favorite count: 0
tagged with: proxy
has answer: http://stackoverflow.com/a/21997006
has body: I know I can write a dynamic proxy like this: public class DecoratedFile implements java.lang.reflect.InvocationHandler { private Object delegate; public static Object newInstance(Object delegate) { return java.lang.reflect.Proxy.newProxyInstance( obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), new DecoratedFile (delegate)); } private DecoratedFile (Object delegate) { this.obj = obj; } public Object invoke(Object proxy, Method m, Object[] args) throws Throwable { ... do something to `delegate` } } ... which can be instantiated like so: File decorated = DecoratedFile.newInstance(new File("README.txt")); Is there a way to write a class such that I can instantiate a dynamic proxy using the "new" keyword: File decorated = new DecoratedFile(new File("README.txt")); For example, to refactor a non-dynamic implementation without affecting its clients. If the answer is "no, you can't" -- is there a design principle behind this?
has comment: http://stackoverflow.com/comment/33337836
score: 2
type: AnsweredQuestion
tagged with: reflection
upvote count: 2
type: Question
accepted answer: http://stackoverflow.com/a/21997006
has comment: http://stackoverflow.com/comment/33336662
tagged with: java
has title: Can I make `new X()` in Java return a dynamic proxy?
has comment: http://stackoverflow.com/comment/33343762
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/33255592
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21950631
has text: That file is 1.7 gigabytes, you can't load it onto a phone so easily.
score: 0

http://stackoverflow.com/q/21936310
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
tagged with: testing
possible better answer: http://stackoverflow.com/a/21941952
has body: I am initiating on browser automation tests using Selenium WebDriver, and while reading the tutorial I got blocked in a point. In the Selenium WebDriver’s Drivers topic where it explains the pros and cons of each WebDriver implementation , it says the following about the HtmlUnit driver: HtmlUnit is a java based implementation of a WebBrowser without a GUI So this means that this driver is equal to a browser application (like Mozzila,Opera or Chrome) without the GUI, we can only interact with it through methods Firefox Driver Runs in a real browser and supports JavaScript Controls the Firefox browser using a Firefox plugin. The Firefox Profile that is used is stripped down from what is installed on the machine to only include the Selenium WebDriver.xpi (plugin). A few settings are also changed by default (see the source to see which ones) Firefox Driver is capable of being run and is tested on Windows, Mac, Linux. Currently on versions 3.6, 10, latest - 1, latest What does this mean? To use this driver, do I have to install Firefox on my machine ? When it says that it "runs in a real browser," does it mean that the multiple commands that we use with the WebDriver interface are sent to the browser installed in our machine ? If my assumption is correct, if we run the test on the Selenium-Server should the machine where the server is installed have Firefox installed?
score: 0
accepted answer: http://stackoverflow.com/a/21944353
has title: Selenium Drivers
has answer: http://stackoverflow.com/a/21941952
has answer: http://stackoverflow.com/a/21944353

http://stackoverflow.com/comment/33197931
has text: What errors are you getting?
score: 1
comment on: http://stackoverflow.com/q/21918275
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21879093
type: Question
has answer: http://stackoverflow.com/a/21879338
downvote count: 0
has body: I created several link button. I want that all the buttons will be in the same row. Every time that I inserted new button then it got to the next row. public void createControls(Composite parent) { myComposite = new Composite(parent, SWT.NONE); GridLayout detailsSideGridLayout = new GridLayout(); detailsSideGridLayout.numColumns = 1; myComposite.setLayout(detailsSideGridLayout); GridDatamyGridData = new GridData(); myGridData.horizontalAlignment = SWT.FILL; myGridData.grabExcessHorizontalSpace = true; myGridData.verticalAlignment = SWT.FILL; myGridData.grabExcessVerticalSpace = true; myComposite.setLayoutData(myGridData); deComposite = new Composite(myComposite, SWT.NONE); RowLayout dgGridLayout = new RowLayout(SWT.HORIZONTAL); deComposite.setLayout(deGridLayout); GridData deGridData = new GridData(); deGridData.horizontalAlignment = SWT.FILL; deGridData.grabExcessHorizontalSpace = true; LinkLabel createDetailsde = createDetailsde(deComposite); createDetailsde.setLayoutData(deGridData); //Add another button createLinkLabel(createDetailsde) myComposite.layout(); private LinkLabel createDetailsde(Composite detailsComposite) { // TODO check resource manager implementation LinkLabel linkLabel = new LinkLabel(detailsComposite, SWT.NONE); linkLabel.setText("test"); //$NON-NLS-1$ return linkLabel; } private LinkLabel createLinkLabel(Composite detailsComposite) { LinkLabel linkLabel = new LinkLabel(detailsComposite, SWT.NONE); linkLabel.setText("test2"); //$NON-NLS-1$ return linkLabel; } I got error message The error is org.eclipse.swt.layout.GridData cannot be cast to org.eclipse.swt.layout.RowData
answer count: 3
has answer: http://stackoverflow.com/a/21879339
favorite count: 0
possible better answer: http://stackoverflow.com/a/21879295
tagged with: swt
has answer: http://stackoverflow.com/a/21879295
upvote count: 1
has title: How to put all the button in the same row?
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21879339

http://stackoverflow.com/comment/33394091
type: AnswerComment
comment on: http://stackoverflow.com/a/22002430
score: 0
type: Comment
has text: Glad to help out! If you're stuck implementing a solution, post another question with what you've tried and where you got stuck. Also, don't forget to upvote and accept answers if they were helpful :)

http://stackoverflow.com/comment/33065978
score: 0
has text: You should use HTML parser like JSOUP. http://jsoup.org/
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21844405

http://stackoverflow.com/comment/33287851
comment on: http://stackoverflow.com/a/21962209
score: 0
type: AnswerComment
has text: @BrianRoach _most_ of the time they might be the same thing, but not _always_ - it's an implementation detail. See the link at the end of my answer
type: Comment

http://stackoverflow.com/q/21895128
has comment: http://stackoverflow.com/comment/33157459
has comment: http://stackoverflow.com/comment/33157728
has comment: http://stackoverflow.com/comment/33158841
has comment: http://stackoverflow.com/comment/33157455
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/33157628
has answer: http://stackoverflow.com/a/21895836
score: 0
has comment: http://stackoverflow.com/comment/33158913
has comment: http://stackoverflow.com/comment/33157260
answer count: 1
has comment: http://stackoverflow.com/comment/33157667
type: UnansweredQuestion
tagged with: android
has title: how to know the first check of a RadioButton of a RadioGroup when all of RadioButton in it are unchecked
has body: I have a group of RadioGroup with seven elements in which every RadioButton in it is unchecked; I need to know when a RadioButton is checked for the first time (each following change is not considered). How can I do that? Here is my attempt: ratingRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener(){ public void onCheckedChanged(RadioGroup rGroup, int checkedId){ if(oneRadioButton.isChecked() == false &amp;&amp; twoRadioButton.isChecked() == false &amp;&amp; threeRadioButton.isChecked() == false &amp;&amp; fourRadioButton.isChecked() == false &amp;&amp; fiveRadioButton.isChecked() == false &amp;&amp; sixRadioButton.isChecked() == false &amp;&amp; sevenRadioButton.isChecked() == false &amp;&amp; taskEditTextShown == true){ lastTime = System.currentTimeMillis(); } } }); But this code doesn't work.

http://stackoverflow.com/comment/33345773
comment on: http://stackoverflow.com/a/22001117
type: AnswerComment
type: Comment
score: 1
has text: Are you sure they're necessary? Can you provide a reference? This says otherwise: http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#close()

http://stackoverflow.com/a/21916207
downvote count: 0
has body: In general, when you build a shared library (.so), some kind of compiler options such as -fPIC are used to generate position-independent code. On the other hand, when you build a static library (.a), such an option is not used. Even if you pack static libraries into a shared library, binary code in the static libraries are not position-independent. It is the reason why loadLibrary() fails, I guess. If I were you, I would avoid packing static libraries into a shared library and instead would compile all C++ files with -fPIC or something equivalent.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21915274
score: 1

http://stackoverflow.com/a/37436151
has comment: http://stackoverflow.com/comment/62375929
answers question: http://stackoverflow.com/q/21873191
type: Answer
has body: The best thing you can do is str.Trim('"') Double quote is enclosed in two single quotes, and thats it. This technique is not limited to just double quotes but you can do for any character. Furthermore, if you wants to do the same thing only for either start or end character (not both) even then there is an option. You can do the same thing like str.TrimEnd('"') this removes only the last character and str.TrimStart('"') removes only the only first(Start) character
upvote count: 0
downvote count: 2
score: -2

http://stackoverflow.com/comment/33221419
comment on: http://stackoverflow.com/q/21931233
has text: It will go slower actually. The code uses reflection to call `new ComponentClassName()`. Reflection calls are slower than direct calls, are not typesafe, are longer, are less readable, and do the exact same thing in the end.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33176288
has text: Do you have an idea on how to add ` ` tags? Should I add it to xhtml file or it can be added to Resource.properties even?
type: Comment
comment on: http://stackoverflow.com/a/21906365
score: 0
type: AnswerComment

http://stackoverflow.com/a/33058367
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/21951606
upvote count: 1
has body: the library basegameutils had updated : check this link : https://github.com/playgameservices/android-basic-samples/tree/master/BasicSamples/libraries/BaseGameUtils/src/main/java/com/google/example/games/basegameutils AppStateManager is deprecated now.

http://stackoverflow.com/a/21869057
has body: Since this looks like "homework" or a test problem, I am going to make some suggestions about structure, rather than provide exact code. First, split your program into a Controller class and a Triangle class. Have the Controller class, read input sides and make a new Triangle object from those sides trialTriangle = new Triangle(side1, side2, side3). In the Triangle class, create the following methods: boolean isTriangle(); String getType(), and int getPerimeter(); Some logic hints: inside Triangle after sorting the sides (say in an array sides[] = new int[3] determine if you have a triangle before seeing what type of triangle (to make sure 0, 0, 0 is not shown as an equilateral triangle); equilateral is same as side[0] == side[2] because sides are in order; then determine isocolese (you only need to see if the first two or last two sorted sides are equal). In the "controller" class, get a line and see if user asked to "end"; if not create triangle and print results and loop.
answers question: http://stackoverflow.com/q/21867456
type: Answer
score: 0

http://stackoverflow.com/a/21956073
answers question: http://stackoverflow.com/q/21956010
has body: remove void: public void GPS(GPSpos main) ^^^^ - constructors in java dont have return type
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21956010
upvote count: 2

http://stackoverflow.com/q/21856596
has title: returning true with an occurance of a letter in a string?
has comment: http://stackoverflow.com/comment/33086761
favorite count: 0
type: UnansweredQuestion
upvote count: 1
answer count: 4
has comment: http://stackoverflow.com/comment/33086867
has answer: http://stackoverflow.com/a/21857439
has answer: http://stackoverflow.com/a/21856797
tagged with: java
has answer: http://stackoverflow.com/a/21856674
downvote count: 1
type: Question
score: 0
has body: it should return true as there is 'c' in the string S but it keeps returning False? public class A { public static void main(String[] args){ System.out.println(contains('c', "cccc")); } public static boolean contains(char c, String s) { boolean to_return = true; while(true) { if(s.equals("")){ return to_return = false; } else { char c2 = s.charAt(0); if(c==c2) { to_return = true; } } s=s.substring(1); } } } I have NO idea why it isnt? it only returns false if the string is empty which is clearly is(I am NOT allowed to use for loops etc..
has answer: http://stackoverflow.com/a/21856790

http://stackoverflow.com/comment/33316544
type: AnswerComment
comment on: http://stackoverflow.com/a/21984523
has text: I tried using this plugin but it created a bunch of other problems, khmarbaise said it's only simpler, so if there isn't something wrong with mine it's not a priority for me to change it. I mention in my post that I have it working when using a second project for my custom classes, so my header is correct. I believe your 'import test.other;' is not btw.
type: Comment
score: 0

http://stackoverflow.com/a/21940750
upvote count: 2
has comment: http://stackoverflow.com/comment/33238762
type: Answer
has comment: http://stackoverflow.com/comment/33240518
has comment: http://stackoverflow.com/comment/33237378
has body: I'm not a Java guy but I'll give it a go with how I do it (all code untested)... Say you have flot code that looks like this: &lt;div id="placeholder" style="width:300px;height:200px"&gt;&lt;/div&gt; $(function() { var series = {data: [[0, 5.2], [1, 3], [2, 9.2], [3, 10]], lines: {show: false}, bars: {show: true, barWidth: 0.75, align:'center'}} somePlot = $.plot("#placeholder", [ series ], {}); }); You need this code as a string, and then Base64 encode it (in a variable base64FlotCode). Create a phantomJS script (saved as phantomJSScript.js) that looks like this: var system = require('system'); var html = system.args[1]; var page = require('webpage').create(); page.onLoadFinished = function(status) { var clipRect = page.evaluate( function() { var el = document.querySelector('#placeholder'); return el.getBoundingClientRect(); } ); page.clipRect = { top: clipRect.top, left: clipRect.left, width: clipRect.width, height: clipRect.height }; page.render('/path/to/myPlot.png'); phantom.exit(); }; function b64_to_utf8(str) { return decodeURIComponent(escape(window.atob(str))); } page.content = b64_to_utf8(html); Now you can call this script as: List&lt;String&gt; args = new ArrayList&lt;String&gt;(); args.add ("/path/to/phamtomjs.exe"); args.add ("/path/to/phantomJSScript.js"); args.add (base64FlotCode); ProcessBuilder pb = new ProcessBuilder (args); Process p = pb.start(); p.waitFor(); EDITS Instead of passing phantomJS a string of your flot code, you could also point it to your webpage: var system = require('system'); var page = require('webpage').create(); page.open('http://www.mywebpage.com', function() { var clipRect = page.evaluate( function() { var el = document.querySelector('#placeholder'); return el.getBoundingClientRect(); } ); page.clipRect = { top: clipRect.top, left: clipRect.left, width: clipRect.width, height: clipRect.height }; page.render('/path/to/myPlot.png'); phantom.exit(); };
has comment: http://stackoverflow.com/comment/33238428
has comment: http://stackoverflow.com/comment/33239798
answers question: http://stackoverflow.com/q/21936750
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33237667

http://stackoverflow.com/q/21999170
tagged with: android-listview
answer count: 0
has comment: http://stackoverflow.com/comment/33342325
type: Question
tagged with: android
has body: I am trying to pull an array dynamically from an adapter class, which currently works fine for a spinner. I have to utilize similar code such that I can use the (R.id.item ), so it can pull dynamically the contents in the array through R.id.item. Here's what I am trying to say: Current implementation: List&lt;String&gt; listItems = new ArrayList&lt;String&gt;(); listItems.add("Personal Cookies"); listItems.add("Shared Cookies"); final CharSequence[] items = listItems.toArray(new CharSequence[listItems.size()]); Here is what I have for dynamic spinner: ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(context, R.layout.spinner_item, entries); adapter.setDropDownViewResource(R.layout.spinner_dropdown_item); setSpinnerAdapter(adapter); How do I make use of this arrayadapter such that I can not only include a layout within my list array, but also pull out the dynamic strings that I am getting from this array adapter? Thanks!
has comment: http://stackoverflow.com/comment/33342440
score: 0
tagged with: java
tagged with: android-layout
has title: How do I convert the following string array into a dynamic array? Also, how do I associate a layout with it?
type: UnansweredQuestion
tagged with: android-spinner

http://stackoverflow.com/comment/33226081
comment on: http://stackoverflow.com/a/21933225
has text: `code`String[] regularDelims = {",", ";"}; String[] escapedDelims = {"\\|", "\n"}; String[] stringsToSplit = {"alpha,bravo,charlie", "delta;echo;foxtrot", "golf|hotel|india", "juliet\nkilo\nlima"}; String allDelims = "["; for (String delim : regularDelims) { allDelims += ("|"+delim); } for (String delim : escapedDelims) { allDelims += ("|\\"+ delim); } allDelims+="]";`code`
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33080699
comment on: http://stackoverflow.com/a/21851989
has text: I use Chrome debugger only; But this is not the case. You can do the same on other browsers too. I dunno why u couldn't :(
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/21998580
score: 0
answers question: http://stackoverflow.com/q/21994850
type: Answer
has body: Java 7 Update 51 came with some new security changes for Web Start and applets. See this link for more detailed info. A couple of the things are: You need to sign the applet with a valid certificate, not self-signed cert. You need to change the jar to include some new attributes to the MANIFEST.MF You may also need to update the tag to include a permissions attribute.

http://stackoverflow.com/comment/33350125
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22003194
has text: There is no compiler error in evidence here, just a runtime exception.

http://stackoverflow.com/comment/33089395
type: Comment
type: QuestionComment
has text: @mbatchkarov Thanks for the suggestion. If something is going wrong in my code, it only happens when I execute it in multiple threads. I guess that's what I will look for next. I'll add some additional logging and try to lock down exactly where the failing threads are failing.
score: 0
comment on: http://stackoverflow.com/q/21857474

http://stackoverflow.com/comment/33064788
has text: @Tanner11 if you want to print the name, then print `System.out.println(firstname[maxFGP(fgm,fga,count)])`
comment on: http://stackoverflow.com/a/21843563
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33268287
type: AnswerComment
type: Comment
score: 1
has text: This is not java.. maybe javafx but the op is looking for swing.
comment on: http://stackoverflow.com/a/21957759

http://stackoverflow.com/q/21956425
tagged with: apache-poi
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33265827
upvote count: 1
has body: I am trying the code below to open and read a Word file in JTextArea, using Netbeans. import java.io.*; import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.extractor.WordExtractor; public class ReadDocFile { public static void main(String[] args) { File file = null; WordExtractor extractor = null; try { file = new File("c:\\New.doc"); FileInputStream fis = new FileInputStream(file.getAbsolutePath()); HWPFDocument document = new HWPFDocument(fis); extractor = new WordExtractor(document); String[] fileData = extractor.getParagraphText(); for (int i = 0; i &lt; fileData.length; i++) { if (fileData[i] != null) System.out.println(fileData[i]); } } catch (Exception exep) { } } } I get the error below: cannot find symbol : HWPFDocument((mypackgename).fileinputstream ) Due to this, I can not open the file. Is there a reason that this isn't working?
has comment: http://stackoverflow.com/comment/33265791
linked to: http://stackoverflow.com/q/7102511
type: Question
has comment: http://stackoverflow.com/comment/33265680
has comment: http://stackoverflow.com/comment/33265644
has title: Opening and reading a Word document in Java
has comment: http://stackoverflow.com/comment/33265706
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33265618
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33265812

http://stackoverflow.com/comment/33104602
comment on: http://stackoverflow.com/q/21865717
has text: In C++, chars are perhaps just unsigned bytes. But that sounds like a very unmodern use of the word "character". Either way, in your specific case, the decryption code seems to *seemingly* take text as input when they are *actually* taking binary data disguised as CP1252. This is probably because CP1252 can represent every unsigned byte and can *technically* hence represent binary data. The decryption algorithms should have been designed to explicitly take binary data as input.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21924560
has body: Scope, scope, scope!! Declarations in Java (and C/C++) are "scoped" to the "block", where a "block" is a set of statements between { and }. This means that if you declare a variable { StudentData aStudent = new StudentData(...); } it goes "poof" when you pass that closing }. If you want it to be "visible" outside that scope you need to declare aStudent outside the block. Note that you can still do the assignment inside that block, just don't mistakenly include StudentData or you will be declaring an entirely different version of the variable. And note that, in Java, a variable must be assigned a value along all possible paths from its declaration to its use, so you may have to assign null (eg) to the variable where it's declared.
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21924439

http://stackoverflow.com/comment/33179380
comment on: http://stackoverflow.com/a/21907737
score: 0
type: AnswerComment
type: Comment
has text: Another thing that you should clarify are the character(s) used to separate the values. The code above assumes you are using one " " (space) character for separating them. If you decide to another value, replace the one set as an argument to the split method.

http://stackoverflow.com/comment/33103660
type: Comment
type: QuestionComment
has text: This sounds a lot like the MTP visibility problem, such as described (rather poorly) here: http://stackoverflow.com/questions/18292694/files-created-on-external-storage-do-not-show-up-when-device-is-mounted-on-windo
score: 1
comment on: http://stackoverflow.com/q/21847017

http://stackoverflow.com/comment/33216178
score: 0
comment on: http://stackoverflow.com/a/21918083
type: Comment
has text: jogl.jar has been replaced by jogl-all.jar in JOGL 2.
type: AnswerComment

http://stackoverflow.com/q/21911776
tagged with: asp.net
has answer: http://stackoverflow.com/a/21912658
has comment: http://stackoverflow.com/comment/33186679
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33185889
tagged with: android
tagged with: web-services
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24161802
has comment: http://stackoverflow.com/comment/33185779
type: UnansweredQuestion
has body: I'm trying to access this link for web service via android . but I don't know what is library or jar files should using to do this . I have used soap but not working will here is link is : http://ictfox.com/demo/Hafil_Updates/Login_Check.aspx?UserLogin=Demo&amp;Password=Demo
has title: Using asp webservice with android
tagged with: api

http://stackoverflow.com/a/21970626
has comment: http://stackoverflow.com/comment/33301614
has comment: http://stackoverflow.com/comment/33301744
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/33301669
score: 0
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/33291130
has comment: http://stackoverflow.com/comment/33291438
has comment: http://stackoverflow.com/comment/33301803
has body: I think you can use != instead of &lt;&gt; in your query to have the same result SELECT u.name, u.cq FROM user u WHERE u.cq != 0 ORDER BY u.cq DESC;
answers question: http://stackoverflow.com/q/21970597
accepted answer of: http://stackoverflow.com/q/21970597
has comment: http://stackoverflow.com/comment/33291271

http://stackoverflow.com/q/21963249
upvote count: 1
has comment: http://stackoverflow.com/comment/33278201
type: Question
accepted answer: http://stackoverflow.com/a/21963297
has answer: http://stackoverflow.com/a/21963297
answer count: 2
possible better answer: http://stackoverflow.com/a/21963292
downvote count: 0
favorite count: 0
has title: what's the difference between assigning null or change value?
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/21963292
tagged with: java
has body: public class ListNode{ ListNode next=null; int val; public ListNode(int val){ this.val=val; } } ListNode node=new ListNode(3); ListNode mm=node; mm=null; System.out.println(node==null); -------&gt; false ListNode nn=node; nn.val=100; System.out.println(node.val); ---------&gt;100 First I assigned node to mm, but after I assigned null to mm, node did not change to null. But when I assigned node to nn, and I changed the value of nn, the value of node changes! Do you know why?

http://stackoverflow.com/a/21870079
type: Answer
has body: Static members (variables and methods ) are allowed to be accessed by objects. this refers to the current object and hence using current object reference, java allows to access static variable.
answers question: http://stackoverflow.com/q/21869969
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/33349179
has text: 500 was an insane maximum I chose. Like I said below, most code is just checking for whether or not it is null. It'll all be deleted eventually.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22002992

http://stackoverflow.com/a/21954372
answers question: http://stackoverflow.com/q/21954146
has body: You should make a custom layout for the ActionBar. In Java: getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); getActionBar().setCustomView(R.layout.actionbar); In XML (this would be R.layout.actionbar): <?xml version="1.0" encoding="utf-8"?> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="YOUR ACTIVITY TITLE" android:textStyle="bold" android:textColor="#ffffff" android:textSize="24sp" /> You can then put more things in the actionbar XML if you wish.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33264212
has comment: http://stackoverflow.com/comment/33262981
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/33263360
accepted answer of: http://stackoverflow.com/q/21954146

http://stackoverflow.com/comment/33286332
type: QuestionComment
type: Comment
has text: Can you add the the relevant code to your question?
comment on: http://stackoverflow.com/q/21967734
score: 0

http://stackoverflow.com/q/22003431
favorite count: 0
upvote count: 2
tagged with: insertion-sort
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22003496
tagged with: java
has title: Insertion sort with an array of objects?
has answer: http://stackoverflow.com/a/22003486
accepted answer: http://stackoverflow.com/a/22003486
type: Question
tagged with: object
tagged with: arrays
tagged with: sorting
has answer: http://stackoverflow.com/a/35329933
has body: I have an array of Faculty members and I want to use the Insertion Sort on it. I get an error at: InsertionSort.insertionSortA(faculty, faculty.length); The error says : "Method insertionSortA in class InsertionSort cannot be applied to given types; required: Comparable [], int found: Faculty [], int I know that doing this will not work: InsertionSort.insertionSortA((Comparable[]) faculty, faculty.length); I know that if I had an Integer[] array would work, but I'm confused why my Faculty[] would not work? public class Tester { public static void main(String[] args) { InsertionSort insertionSort = new InsertionSort(); Education edu = new Education ("BA", "Business", 1); Education edu2 = new Education ("BA", "Health Science", 1); Education edu3 = new Education ("BA", "Computer Science", 1); Faculty[] faculty = new Faculty[] { new Faculty ("538", "Doe", "Jane", 'M', 1994,1,10, "Assistant", edu), new Faculty ("238", "Do", "John", 'F', 1994,6,1, "Assistant", edu2), new Faculty ("080", "White", "Snow", 'F', 1994,4,22, "Full", edu3) }; InsertionSort.insertionSortA(faculty, faculty.length); } } public class InsertionSort { public static void insertionSortA(Comparable[] theArray, int n) { for (int unsorted = 1; unsorted &lt; n; ++unsorted) { Comparable nextItem = theArray[unsorted]; int loc = unsorted; while ((loc &gt; 0) &amp;&amp;(theArray[loc-1].compareTo(nextItem) &gt; 0)) { theArray[loc] = theArray[loc-1]; loc--; } // end while theArray[loc] = nextItem; } // end for } // end insertionSort public static void insertionSortB(Comparable[] theArray, int n) { for (int unsorted = 1; unsorted &lt; n; ++unsorted) { Comparable nextItem = theArray[unsorted]; int loc = unsorted; while ((loc &gt; 0) &amp;&amp;(theArray[loc-1].compareTo(nextItem) &lt; 0)) { theArray[loc] = theArray[loc-1]; loc--; } // end while theArray[loc] = nextItem; } // end for } }
possible better answer: http://stackoverflow.com/a/22003496
answer count: 3
downvote count: 0

http://stackoverflow.com/comment/33323133
comment on: http://stackoverflow.com/q/21988278
has text: Could you check in your application server if the deployed war has the lib poi 3.9 in it (WEB-INF/lib)? Just to eliminate the possibility that the jar is not being packaged with you war application due to some build problem.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/33291198
has text: hm, I am getting this: http://i.imgur.com/Gb354Lt.png I am also getting the same at the end and upon removing my function call, I am getting issues with Intent
comment on: http://stackoverflow.com/a/21969853
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21953317
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33259996
tagged with: heapsort
has answer: http://stackoverflow.com/a/21953371
answer count: 2
has body: I am going to implement specific java maxHeap using priorityQueue as follows: Suppose I have a "Customer" class which has a double variable name "marginalGain". PriorityQueue&lt;Customer&gt; marginalGainHeap=new PriorityQueue&lt;Customer&gt;(); How can I heapify "marginalGainHeap" using the natural order of "marginalGain" variable? Is it possible with using PriorityQueue or I need to re-implement MaxHeap myself? Regards.
has comment: http://stackoverflow.com/comment/33260024
has comment: http://stackoverflow.com/comment/33260078
tagged with: heap
type: UnansweredQuestion
has title: Implementing specific java MaxHeap using priorityQueue
has answer: http://stackoverflow.com/a/25964145

http://stackoverflow.com/comment/33173473
comment on: http://stackoverflow.com/q/21904761
has text: I know, I only tried to use it because URI class wasn't giving me the correct answer in all situations, and to provide more information in this question.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33265532
score: 0
comment on: http://stackoverflow.com/q/21956257
has text: I updated the post so that you can see where it is called from, I have been trying to do this all day and have no idea why it won't work.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21889926
has title: On max no. of activities and fragments
tagged with: android
type: AnsweredQuestion
score: 3
tagged with: android-fragments
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21890221
downvote count: 0
linked to: http://stackoverflow.com/q/12102840
has body: I'm new to android and java programming. Recently I came across this Max. number of activities and it says this- We can have any number of activities, but good to limit max to 25 activities (as Google suggests). We can reduce number of activities by using Fragments. Now the real question what i wanted to ask is- Does every .java files in the src of the app count as an activity? If it doesn't then which ones can actually be called activities? Now as the above mentioned questions's answer suggests the use of fragments.But when creating fragments, I still have to create individual class for each fragment. Now, is that adding to the no. of activities? If every fragment class counts as an activity then is it possible to code it all in a single activity? One more:Does creating too much .java files affect the app performance? Thank your for your help.
answer count: 1
tagged with: android-activity
favorite count: 0
accepted answer: http://stackoverflow.com/a/21890221

http://stackoverflow.com/comment/33166643
comment on: http://stackoverflow.com/q/21897093
has text: Lol, thanks. I guess saying "guarantee" might be a bit much, but in all of my testing with it so far it's always yielded the median value.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33275517
score: 2
has text: [How to Use Tables](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html). Pay special attention to the table model section, you need to work with it.
comment on: http://stackoverflow.com/q/21961724
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21963043
score: 3
downvote count: 0
has body: Just change the order of events in your constructor from this: setTitle ("Stacker"); setSize (380,650); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible (true); setUndecorated (true); setResizable(false); To this: setTitle ("Stacker"); setSize (380,650); setDefaultCloseOperation(EXIT_ON_CLOSE); setUndecorated (true); setResizable(false); setVisible (true); // move setVisible to the end
accepted answer of: http://stackoverflow.com/q/21962886
answers question: http://stackoverflow.com/q/21962886
has comment: http://stackoverflow.com/comment/33296839
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33282488
type: Answer

http://stackoverflow.com/a/49994184
answers question: http://stackoverflow.com/q/21979699
downvote count: 0
score: 6
has body: <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="%clr{%d{yyyy-MM-dd HH:mm:ss.SSS}}{faint} %clr{%5p} %clr{${sys:PID}}{magenta} %clr{---}{faint} %clr{[%15.15t]}{faint} %clr{%-40.40c{1.}}{cyan} %clr{:}{faint} %m%n%xwEx"/> <AppenderRef ref="Console"/> This worked in my Spring Boot application. But I am not sure if it will work without Spring Boot.
upvote count: 6
type: Answer

http://stackoverflow.com/a/21900405
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/33166329
upvote count: 1
answers question: http://stackoverflow.com/q/21899928
has body: It's doable by creating a custom View. You can use Canvas to draw anything you want. But in this case you can instead extend ViewGroup class and draw by yourself only "non-standard" parts. (for example, you can reuse standard buttons by adding them to your ViewGroup subclass.) More info here.

http://stackoverflow.com/comment/36175249
type: AnswerComment
score: 0
type: Comment
has text: I have a quick question: in which context I have to clone the current Graphics? Obviously cloning every graphics instance is not necessary :)
comment on: http://stackoverflow.com/a/21989406

http://stackoverflow.com/q/22001125
has comment: http://stackoverflow.com/comment/33351066
score: 0
answer count: 1
has title: How to generate SWIG interface from C++?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33348512
tagged with: c++
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22025752
tagged with: swig
has body: Is there any way generate SWIG interface from existing C++ code, if I want to expose everything one-to-one for my Java application? To clarify, this is 3rd-party library and I don't have headers for top level files to generate interface from them.

http://stackoverflow.com/comment/33283991
type: Comment
has text: Could you also show an example for the reverse please? Will the data still be in the same order as it is important for me to know which object is which.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21966194

http://stackoverflow.com/comment/137503695
score: 0
type: Comment
type: QuestionComment
has text: For those wanting /usr/libexec/java_home to be managed by SDKMAN see this answer: https://stackoverflow.com/a/76523554/328275
comment on: http://stackoverflow.com/q/21964709

http://stackoverflow.com/comment/33262778
type: Comment
type: QuestionComment
score: 3
has text: I have no idea where to start, other than by pointing out that Java does not have global variables of any kind, and that having your entire Java program directly extending `JApplet` is generally bad design. Perhaps you should create a data object `Person` that you can use to move information around.
comment on: http://stackoverflow.com/q/21954861

http://stackoverflow.com/comment/33196559
type: QuestionComment
comment on: http://stackoverflow.com/q/21917461
has text: I am rather part-and-partial to the Pub/Sub model, where you have workers subscribe to some Topic, and producers publish into that topic. But, this should work just fine. The JavaDoc doesn't mention any thread-safety issues, but it is part of the `java.util.concurrent`, and given the fact it has `Blocking` in the name I'd suspect it's written to handle those. Plus, it doesn't appear you are using `peek()` and it looks like you are de-queing from a single thread anyhow. Do you have any concerns about the app shutting down mid-processing?
score: 0
type: Comment

http://stackoverflow.com/comment/33220403
score: 0
type: Comment
type: QuestionComment
has text: hi i did its above . thanks
comment on: http://stackoverflow.com/q/21931363

http://stackoverflow.com/comment/33363751
comment on: http://stackoverflow.com/a/22011185
has text: Thanks a bunch! I've had issues with java paths for a while and your clear explanation fixed both my problems and the issues.
type: Comment
score: 3
type: AnswerComment

http://stackoverflow.com/comment/33284055
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21966194
has text: Yes, the order will be preserved. If you write one int and one string, you should read one int and one string. You should read the javadoc now that you know which classes you can use.
score: 1

http://stackoverflow.com/q/21993572
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: blender
tagged with: libgdx
has title: LibGDX - Unknown animation error
accepted answer: http://stackoverflow.com/a/21999694
tagged with: 3d
answer count: 1
downvote count: 0
favorite count: 0
has body: I am developing an application on libgdx and I am trying to play an animation I created on Blender but I continue to get the unknown animation error. I have this code in my create method: model = modelLoader.loadModel(Gdx.files.getFileHandle("i1.g3db", FileType.Internal)); modelInstance = new ModelInstance(model); modelInstance.transform.rotate(1, 0, 0, -90); modelInstance.transform.translate(0, 0, -2); controller = new AnimationController(modelInstance); controller.setAnimation("moveHand",1); And this in my render method: camera.update(); camController.update(); controller.update(Gdx.graphics.getDeltaTime()); modelBatch.begin(camera); modelBatch.render(modelInstance, environment); modelBatch.end(); I tried to cut out the pieces that are not relevant to the question. Here is a pic of the dopesheet in Blender which shows that I have named my animation appropriately: Anyone has an idea what might be the problem cause I've been stuck on this one for quite a while, thank you! I have the animation files (.g3db, .blender) uploaded here if anyone feels like opening them: https://www.dropbox.com/s/xyx74tx5mbyj9i3/i1.zip
tagged with: animation
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21999694

http://stackoverflow.com/q/21973842
has comment: http://stackoverflow.com/comment/33297051
tagged with: date
has answer: http://stackoverflow.com/a/21974116
has comment: http://stackoverflow.com/comment/33296902
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/33297212
possible better answer: http://stackoverflow.com/a/21974116
favorite count: 0
has answer: http://stackoverflow.com/a/21976127
has comment: http://stackoverflow.com/comment/33297008
has answer: http://stackoverflow.com/a/21977337
accepted answer: http://stackoverflow.com/a/21977337
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33296765
downvote count: 0
score: 1
tagged with: java
has body: My input is a beginning date and an end date. And I want to check that it is between December 1 and March 31. (The year can change, and there will be only dates in, or dates outside this period). So far I didn't found any solution with Joda-time. Can somebody give me a starting point how to do(not code, just the logic)? I didn't checked the code yet, but it is VERY Ugly, and I want to find an algorithmic solution public static boolean isInWinter(Contract contract) { logger.info("begin isInWinter:"); DateTime beginDate = contract.getBeginningDate(); DateTime endDate = contract.getEndDate(); /* * If the year is different (etc 2012 dec,2013 marc) check that the * beginning month is december, and the end month is jan,feb,marc */ if (endDate.getYear() - beginDate.getYear() == 1) { if ((beginDate.getMonthOfYear() == 12) &amp;&amp; ((endDate.getMonthOfYear() == 1 || endDate.getMonthOfYear() == 2 || endDate .getMonthOfYear() == 3))) { logger.info("return true different year"); return true; } /* * Same year can be if begin and end date is december or begin and * and date is jan,febr,marc TODO REMOVE Auto formatter */ } else if (endDate.getYear() - beginDate.getYear() == 0) { if ((beginDate.getMonthOfYear() == 12 &amp;&amp; endDate.getMonthOfYear() == 12) || ((beginDate.getMonthOfYear() == 1 || beginDate.getMonthOfYear() == 2 || beginDate .getMonthOfYear() == 3) &amp;&amp; (endDate .getMonthOfYear() == 1 || endDate.getMonthOfYear() == 2 || endDate .getMonthOfYear() == 3))) { logger.info("return true same year"); return true; } } logger.info("return false"); return false; }
has title: How can I check that a two dates are between a period(interval)?
type: Question
tagged with: jodatime

http://stackoverflow.com/comment/109301627
score: 0
type: Comment
type: AnswerComment
has text: If you are using a fish terminal then you can use the following command: `set -x JAVA_HOME (/usr/libexec/java_home -d64 -v1.8)` or better yet add it to your .config/fish/config.fish file
comment on: http://stackoverflow.com/a/24657630

http://stackoverflow.com/comment/33252620
score: 0
type: Comment
has text: `NullPointerException`s are thrown at runtime. The compiler has nothing to do with exceptions. If it's resulting in an NPX, then that means you're never setting it to anything appropriate.
comment on: http://stackoverflow.com/a/21948948
type: AnswerComment

http://stackoverflow.com/a/21995715
type: Answer
has body: It would be: private void test(JButton[][] button)
answers question: http://stackoverflow.com/q/21995617
score: 0

http://stackoverflow.com/comment/33262734
type: QuestionComment
score: 0
has text: @JB Nizet win. just win. Thanks :D
comment on: http://stackoverflow.com/q/21954429
type: Comment

http://stackoverflow.com/comment/33266657
has text: This answer is much more concise and elegant than mine (I obviously didn't think about it enough). Though you'd want to do the sublist with `Math.min(3, entry.getValue().size())` in case it's shorter.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21957018
type: Comment

http://stackoverflow.com/a/21950075
type: Answer
accepted answer of: http://stackoverflow.com/q/21948655
upvote count: 3
has body: Your ant script compiles the java classes and puts them into the build directory (that's how it should be). This happens in the target named compile. I assume you have put your input file into the src folder in Eclipse. Eclipse also has a build directory - usually bin - and copies such files over automtically. (There are filters in the settings which define the file types it won't copy.) The ant script does not copy the input file. So it cannot be found, when run from the ant script, but it is found when run from Eclipse. To copy the input file, add this to the compile target: &lt;copy todir="${build}"&gt; &lt;fileset dir="${src}" includes="*.txt" /&gt; &lt;/copy&gt; This copies all .txt files from the src directory to the build directory. (Note: As mentioned, I assume your text file is in the source directory. If it is not, this is probably not the correct solution.)
score: 3
answers question: http://stackoverflow.com/q/21948655
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21961614
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/21957766
type: AcceptedAnswer
downvote count: 0
has body: "I want to make sure that when I re-run my application , any existing connections to these ports are removed." The connections cannot stay open when your application exits - there is no process for them to be connected to. So in that sense, you don't have to worry about closing them on next launch. "And is there a way to automatically close a connection when I am using InetAddress, which does not seem to have any method to terminate an existing connection to an address ?" Yes - the connection will close when isReachable is responded to, or when the timeout expires (or some other error occurs). Just creating an InetAddress does not create a connection - it automatically creates and destroys them as needed to do its functionality. Connections are generally just short lived things that don't stay open unless you make them.
answers question: http://stackoverflow.com/q/21957766

http://stackoverflow.com/comment/33328100
type: QuestionComment
score: 0
has text: Did you mean *group by* `UserAuthorities`?
comment on: http://stackoverflow.com/q/21991521
type: Comment

http://stackoverflow.com/q/21890315
has title: How to bind custom context to Jersey request
has answer: http://stackoverflow.com/a/22228988
accepted answer: http://stackoverflow.com/a/22228988
answer count: 1
has comment: http://stackoverflow.com/comment/33752926
favorite count: 0
has comment: http://stackoverflow.com/comment/33748675
has comment: http://stackoverflow.com/comment/33203885
has body: I have a Jersey REST application with token-based user authentication. When a request comes in, a custom RestContext object gets created and added to the ContainerRequestContext as a property (via a filter that runs right after the request is received). This context manages user authorization (through roles) and access to other business logic. It's available in the resources to perform business logic. When the request is processed, the RestContext gets cleaned up in a second filter that executes at the very end of the pipeline. This works fine although it requires two filters. I have been reading about the use of HK2 and the InjectionResolver and I was wondering if I could use injection to inject this RestContext in my resources and other filters (for example I have a filter that creates a SecurityContext from the RestContext) but I couldn't find an answer. In general, how do I inject an object per request that depends on the request context? Is this even possible? Is there an easier way to do it, e.g., using @Context? EDIT: As pointed out, I'm basically trying to inject in my resources a custom class along the lines of the documentation. However, I don't seem to be able to correctly register my AbstractBinder to bind the injection of my class. I get the following: org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee(requiredType=RestContext,parent=RestContextFilter,qualifiers={}),position=0,optional=false,self=false,unqualified=null,1435496015) EDIT 2: I managed to make some slight progress. I create my config in the following way: new ResourceConfig(allResources()) .packages(packagesToScan()) .registerInstances(new RestContextBinder()); since the documentation clearly states that injection of binders is not supported via class but via instance. However I am now getting this: A MultiException has 3 exceptions. They are: 1. java.lang.IllegalStateException: Not inside a request scope. 2. java.lang.IllegalArgume…
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
type: Question
tagged with: jersey
has comment: http://stackoverflow.com/comment/33744553
upvote count: 3
has comment: http://stackoverflow.com/comment/33203360

http://stackoverflow.com/q/21949420
score: 0
has title: How can i get the junit aassert failure reason in teardown method of test
answer count: 1
tagged with: junit
favorite count: 0
has comment: http://stackoverflow.com/comment/33253379
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22072170
has comment: http://stackoverflow.com/comment/33253724
has comment: http://stackoverflow.com/comment/33253735
has comment: http://stackoverflow.com/comment/33253399
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33253745
has comment: http://stackoverflow.com/comment/33253317
has body: I have written one simple test with setup,Test and tearwon method.In test i have writen 3 assert statements.First one is passed and second one is fail and third one is again pass. Now i want to get the result of test in teardown whether it is pass or fail and If it is fail what was the reason. Help will be appreciated!!!

ucanaccess
tag name: ucanaccess
type: Tag
tags question: http://stackoverflow.com/q/21955256

http://stackoverflow.com/comment/33350372
score: 0
comment on: http://stackoverflow.com/q/22003650
type: QuestionComment
type: Comment
has text: file server is just serving as a drive.it cannot handle that responsibility.

http://stackoverflow.com/comment/33214149
type: Comment
comment on: http://stackoverflow.com/a/21927560
has text: I'm using struts1.1 version. Is it possible in struts1.1?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33245135
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21944944
type: AnswerComment
has text: @La-comadreja You should initialize `max` with one of the values from `integers` instead of `Integer.MIN_VALUE`. `Integer.MIN_VALUE` doesn't even exists in your input array so if your input array is empty, it will return `Integer.MIN_VALUE` which is wrong.

http://stackoverflow.com/q/21946188
has comment: http://stackoverflow.com/comment/33247553
has answer: http://stackoverflow.com/a/21946589
accepted answer: http://stackoverflow.com/a/21946589
has comment: http://stackoverflow.com/comment/33247485
has answer: http://stackoverflow.com/a/21946217
has comment: http://stackoverflow.com/comment/33247452
has body: So we have goods and goods have prices. I'd like to calculate the price of goods. First version (switch): int getPrice(String name){ switch(name){ case "Apple": return 20; case "Banana": return 100; ... } } Second version (map): Map&lt;String, Integer&gt; prices = new HashMap&lt;String, Integer&gt;; int getPrice(String name){ return prices.get(name); } So how this method (or design pattern) is called? Has it a special name?
upvote count: 1
has comment: http://stackoverflow.com/comment/33247409
tagged with: design-patterns
type: Question
type: AnsweredQuestion
has title: How is this design pattern called? (map instead of switch)
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33247381
possible better answer: http://stackoverflow.com/a/21946217
tagged with: switch-statement
answer count: 3
has comment: http://stackoverflow.com/comment/33248042
has comment: http://stackoverflow.com/comment/33247428
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33247444
has answer: http://stackoverflow.com/a/21946272

http://stackoverflow.com/a/21953299
has body: Why don't you use String.indexOf() ? for(int j=0;j&lt;three.length;j++) { if(word.indexOf(three[j]) == -1) { System.out.println("err"); } else { System.out.println("Matched"); } } This way you will enter in a single loop..
answers question: http://stackoverflow.com/q/21953216
score: 0
type: Answer

menu
tags question: http://stackoverflow.com/q/21988836
tags question: http://stackoverflow.com/q/21964037
type: Tag
tags question: http://stackoverflow.com/q/21870679
tag name: menu
tags question: http://stackoverflow.com/q/22002562

http://stackoverflow.com/comment/33306525
has text: @SotiriosDelimanolis I believe that the %f's should be replaced with the objects real and imaginary values that were set in the constructor. Then return that string.
score: 0
comment on: http://stackoverflow.com/q/21979151
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33343347
comment on: http://stackoverflow.com/a/21982794
type: AnswerComment
score: 0
type: Comment
has text: kSession.getAgenda().getAgendaGroup( "prefetch" ).setFocus() throws UnsupportedOperationException... it's not implemented... not sure if this is because we are using old api or something else: StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession(); I tried ksession.getAgenda().setFocus("prefetch") this ignores the focus! Thanks anyway, I can't spend more time on this as I have other tasks to work on.

http://stackoverflow.com/comment/33273303
type: Comment
has text: The thing is that I don't have a list array, I only have an array. I only have an adapter. I have strlist, but that is a string.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21960448

http://stackoverflow.com/comment/33282248
comment on: http://stackoverflow.com/a/21964736
type: AnswerComment
score: 0
type: Comment
has text: I suggest you to edit `.bashrc` with a text editor instead of `.profile`.

run-configuration
type: Tag
tags question: http://stackoverflow.com/q/21912543
tag name: run-configuration

http://stackoverflow.com/a/21876924
score: 0
answers question: http://stackoverflow.com/q/21876660
type: Answer
has body: If I need to lookup a future, I'll store it in a map. With the id as key and the future as value.

http://stackoverflow.com/a/21962580
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21962522
has comment: http://stackoverflow.com/comment/33277091
type: Answer
has body: when declaring your queue if you specify the 'Type' of elements it will be storing then you wouldnt need the cast. Queue q = new LinkedList(); Correct way : Queue&lt;Node&gt; q = new LinkedList&lt;Node&gt;();
upvote count: 2
has comment: http://stackoverflow.com/comment/33277077
answers question: http://stackoverflow.com/q/21962522
score: 2

http://stackoverflow.com/comment/33078886
has text: do you try to call a local server?
score: 0
comment on: http://stackoverflow.com/q/21852177
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21994504
favorite count: 0
has comment: http://stackoverflow.com/comment/33480058
type: UnansweredQuestion
upvote count: 2
tagged with: web-services
type: Question
tagged with: weather
linked to: http://stackoverflow.com/q/8405336
has body: I am learning how to implement web services in Java. Following the example in O'Reilly's book "Learning Java," I downloaded a WSDL file (see http://bit.ly/13moiTh) for a weather service at cdyne.com and generated a set of classes using the wsimport tool. The first problem was that when I generated a JAR file and referenced it in the Eclipse project, the classes were not recognized. I had to use wsimport -keep and individually copy all source files into the project to make it build. Next, to make sure that the service was available, I constructed a simple HTTP POST client based on the code from the book. I could successfully access the getCityWeatherByZIP service with that code, so there was no connectivity or authentication issue. Finally, I tried to access the getCityWeatherByZIP and getCityForecastByZIP services using the automatically-generated web services client code. Both silently failed, i.e. the isSuccess() methods returned false and all response fields were null: Weather service = new Weather(); WeatherSoap weatherSoap = service.getWeatherSoap(); WeatherReturn weather = weatherSoap.getCityWeatherByZIP(ZIP); if (weather.isSuccess()) { System.out.format("%s, %s : %s : Temperature: %s, Wind: %s\n", weather.getCity(), weather.getState(), weather.getDescription(), weather.getTemperature(), weather.getWind()); } else { System.out.println("Failed to obtain weather"); } In stepping through the code, in getCityWeatherByZIP() I discovered the following NoSuchMethodException: com.sun.xml.internal.ws.api.message.Packet.setHeaderList(com.sun.xml.internal.ws.api.message.HeaderList)" This exception occurs in line that says (in the Debug perspective of Eclipse): "SEIStub.invoke(Object, Method, Object[]) line: not available" Clearly, the Packet.setHeaderList(HeaderList) method does not exist, which is also corroborated by the documentation of the non-internal class: https://jax-ws.java.net/nonav/jax-ws-20-fcs/arch/com/sun/xml/ws/api/message/Packet.html I am using the latest…
tagged with: java
tagged with: wsimport
has title: Java web services client unable to access weather services from cdyne.com
score: 2
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21999071

http://stackoverflow.com/q/21923301
has comment: http://stackoverflow.com/comment/33206818
tagged with: android
answer count: 1
favorite count: 0
has body: Hi i'm new in android and i'm implementing google maps v2 in my project and the minsdk version is 8 (2.2) when i run my project nothings wrong but when i click my button for gps always force close "java.lang.runtimeexception" and it keeps bothering me. could help me from this and thank you in advance. here is my codes. LocationFinder.java public class LocationFinder extends FragmentActivity { private static final LatLng KOLKATA = new LatLng(22.5697, 88.3697); private GoogleMap map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_location_finder); map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); Marker kol = map.addMarker(new MarkerOptions().position(KOLKATA) .title("Kolkata").snippet("The City of Joy")); map.moveCamera(CameraUpdateFactory.newLatLngZoom(KOLKATA, 15)); map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.location_finder, menu); return true; } } activity_location_finder.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".LocationFinder" > <fragment android:name="com.google.android.gms.maps.SupportMapFragment" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" /> </RelativeLayout> Android manifest.xml <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" /> <permission android:name="…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33207124
upvote count: 1
has title: Android Google Maps v2 in Froyo (Android 2.2) not working
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21923367
type: Question
tagged with: google-maps
downvote count: 0

http://stackoverflow.com/comment/33344138
type: Comment
has text: @HotLicks Thank's for the link
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21998435

http://stackoverflow.com/q/21875238
has comment: http://stackoverflow.com/comment/33120843
tagged with: netbeans
has comment: http://stackoverflow.com/comment/33123029
possible better answer: http://stackoverflow.com/a/21875335
downvote count: 2
has answer: http://stackoverflow.com/a/21875335
has comment: http://stackoverflow.com/comment/33122027
has comment: http://stackoverflow.com/comment/33121937
accepted answer: http://stackoverflow.com/a/21875361
has comment: http://stackoverflow.com/comment/33122615
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Defining class in String for use in Gson
has body: I am trying to use Gson to instantiate a User object based on some JSON, defining the class in a String. However, it is not working. The error Netbeans's giving me is the following Here's the code Class&lt;?&gt; myClass = Class.forName("User"); Gson gson = new Gson(); User user = gson.fromJson(json, myClass); What is wrong with my approach? Edit: The reason I am trying to do it like this, is because I don't know the type at compilation
tagged with: gson
has comment: http://stackoverflow.com/comment/33120896
has comment: http://stackoverflow.com/comment/33121262
has comment: http://stackoverflow.com/comment/33121071
type: Question
has comment: http://stackoverflow.com/comment/33122735
answer count: 2
has comment: http://stackoverflow.com/comment/33124173
has comment: http://stackoverflow.com/comment/33120708
upvote count: 0
score: -2
favorite count: 0
tagged with: class
has answer: http://stackoverflow.com/a/21875361

http://stackoverflow.com/a/21859827
score: 1
type: Answer
answers question: http://stackoverflow.com/q/21851251
has body: I got this already. What i needed to do is: &lt;script type="text/javascript"&gt; var dataObject = ${timeline}; var timeline_config = { width: '100%', height: '600', source: dataObject, embed_id: 'timeline-embed', //OPTIONAL USE A DIFFERENT DIV ID FOR EMBED start_at_end: false, //OPTIONAL START AT LATEST DATE start_at_slide: '0', //OPTIONAL START AT SPECIFIC SLIDE start_zoom_adjust: '3', //OPTIONAL TWEAK THE DEFAULT ZOOM LEVEL hash_bookmark: true, //OPTIONAL LOCATION BAR HASHES font: 'Bevan-PotanoSans', //OPTIONAL FONT debug: true, //OPTIONAL DEBUG TO CONSOLE lang: 'pt', //OPTIONAL LANGUAGE maptype: 'watercolor', //OPTIONAL MAP STYLE css: 'css/timeline.css', //OPTIONAL PATH TO CSS js: 'js/timeline-min.js' //OPTIONAL PATH TO JS } &lt;/script&gt;
accepted answer of: http://stackoverflow.com/q/21851251
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21900810
tagged with: jsp
type: UnansweredQuestion
tagged with: servlets
tagged with: arraylist
has comment: http://stackoverflow.com/comment/33166731
score: 3
favorite count: 0
has answer: http://stackoverflow.com/a/21901264
type: Question
has answer: http://stackoverflow.com/a/36825168
has title: How to iterate through an array list on a JSP without JSTL
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/72026629
has body: //I have retrieved a Result from MySQL and created and Array-list User .i have sent this //US er Array-list in and sent it through request Response Object. Now i need to display iton //s JSP page. //1.Without JSTL //2.With JSTL //The Name of table is user_reg it has four fields id,username,password,email. //please do explain with example. i need to dispay all fields in a jsp page. but i dont want //to do the jdbc work on the JSP package kinder.dto; public class User { private String id; private String userName; private String saltedkey; private String emailId; private String legalName; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getLegalName() { return legalName; } public void setLegalName(String legalName) { this.legalName = legalName; } public String getEmailId() { return email; }enter code here` public void setEmailId(String emailId) { this.emailId = emailId; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassword() { return saltedkey; } public void setPassword(String password) { this.saltedkey = password; } } //dto package kinder.dto; public class User { private String id; private String userName; private String saltedkey; private String emailId; private String legalName; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getLegalName() { return legalName; } public void setLegalName(String legalName) { this.legalName = legalName; } public String getEmailId() { return emailId; } public void setEmailId(String emailId) { this.emailId = emailId; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassword() { return saltedkey; } public void setPassword(String password) { this.saltedkey = password; } } //servlet protected void doPost(HttpServletRequest request, HttpServletResponse response) t…
downvote count: 1
upvote count: 4

http://stackoverflow.com/q/21994321
has answer: http://stackoverflow.com/a/21994429
score: 0
answer count: 3
has title: Objects and attribute values
has answer: http://stackoverflow.com/a/21994460
has comment: http://stackoverflow.com/comment/33333384
favorite count: 0
has comment: http://stackoverflow.com/comment/33333420
has comment: http://stackoverflow.com/comment/33333301
has answer: http://stackoverflow.com/a/21994412
type: UnansweredQuestion
has body: I need help with my homework. Please note that I have finished the code below myself, but am not sure if I am doing it correctly, especially the last sentence of my homework assignment. My homework assignment: Define a class called Building with the following properties. Every Building has a square footage (area) and stories. The constructor creates a Building with these two attributes. The methods get_squarefootage(), get_stories(), set_square_footage(), and set_stories() will be used to get and set the respective attribute values. The method get_info() will return all the current attribute values of the Building. Write a program that lets a user create Building objects and change their attribute values. package building_hw2; import java.util.Scanner; public class Building { int area; int stories; int get_squarefootage() { //get values of the area return area; } int get_stories() { //get values of the stories return stories; } void set_square_footage(int area) { //set values of the area this.area = area; } void set_stories(int stories) { //set values of the stories this.stories = stories; } void get_info() { //return all the current attribute balues of the building System.out.println("The square footage of the building is " + area); System.out.println("The building has " + stories + " stories"); } //main method public static void main(String[] args) { Building Bldg = new Building(); //create a building object Bldg.area = 40000; Bldg.stories = 5; Bldg.get_info(); //display the current values of the building //get user input to create building object Scanner keybd = new Scanner(System.in); System.out.println("Please enter the square footage(area) of the building : "); int bldgArea = keybd.nextInt(); System.out.println("Please enter the stories : "); int bldgStories = keybd.nextInt(); Bldg.set_square_footage(bldgArea); Bldg.set_stories(bldgStories); Bldg.get_squarefootage(); Bldg.get_stories(); Bldg.get_info(); } }
has comment: http://stackoverflow.com/comment/33333437
has comment: http://stackoverflow.com/comment/35644418
tagged with: java
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/33333462
type: Question

http://stackoverflow.com/a/21900984
downvote count: 0
score: 1
has body: An advantage of a typed list is, that you can assume, that you only have objects of the given type in the list - why would one want to throw this advantage away, if it is completely easy to convert the given type into the type of the list?
has comment: http://stackoverflow.com/comment/33167217
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21900923

http://stackoverflow.com/q/21955831
has comment: http://stackoverflow.com/comment/33264717
has title: Read JSON URL in Twitch IRC bot
score: 0
has comment: http://stackoverflow.com/comment/33264549
tagged with: url
has comment: http://stackoverflow.com/comment/33265192
has body: I'm working on a Twitch IRC Bot and right now I need to make a function which will check if a stream either is online or offline. I've came up with some code now but I always get "null" back even while the stream is online. What i run in my Main Class: public void LiveChecker() { TTtwl.scheduleAtFixedRate(new TimerTask() { @Override public void run() { TwitchLiveChecker(); System.out.println(TwitchLiveChecker.json); System.out.println(TwitchLiveChecker.json); } }, 1000*10, 1000*10); } My Twitch Live checker Class: package YBot; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.net.URL; import java.nio.charset.Charset; import org.json.JSONException; import org.json.JSONObject; public class TwitchLiveChecker { public static JSONObject json; private static String readAll(Reader rd) throws IOException { StringBuilder sb = new StringBuilder(); int cp; while ((cp = rd.read()) != -1) { sb.append((char) cp); } return sb.toString(); } public static JSONObject readJsonFromUrl(String url) throws IOException, JSONException { InputStream is = new URL(url).openStream(); try { BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); String jsonText = readAll(rd); JSONObject json = new JSONObject(jsonText); return json; } finally { is.close(); } } public static void main(String[] args) throws IOException, JSONException { json = readJsonFromUrl("http://api.justin.tv/api/stream/list.json?channel="+MyBot.ownerchannel+""); System.out.println(json.toString()); System.out.println(json.get("id")); } }
has comment: http://stackoverflow.com/comment/33264807
has comment: http://stackoverflow.com/comment/33264612
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33264703
has comment: http://stackoverflow.com/comment/33264872
has comment: http://stackoverflow.com/comment/33264935
has comment: http://stackoverflow.com/comment/33264702
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: inputstream
has comment: http://stackoverflow.com/comment/33264585
type: Question
has comment: http://stackoverflow.com/comment/33264743
has comment: http://stackoverflow.com/comment/33264604

http://stackoverflow.com/comment/33245133
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21944922
has text: I wonder if there's a way to get Hotspot to generate SIMD instructions for the generalized case.
score: 0

http://stackoverflow.com/comment/33174034
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21905086
has text: still not loading data

http://stackoverflow.com/q/21995277
has comment: http://stackoverflow.com/comment/33336078
possible better answer: http://stackoverflow.com/a/21995748
has comment: http://stackoverflow.com/comment/33334929
has comment: http://stackoverflow.com/comment/33335178
has answer: http://stackoverflow.com/a/21995748
accepted answer: http://stackoverflow.com/a/21995640
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33335118
has comment: http://stackoverflow.com/comment/33335220
has comment: http://stackoverflow.com/comment/33335565
has title: java error java.lang.NullPointerException
tagged with: addition
downvote count: 1
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/33334934
tagged with: null
tagged with: java
has body: i wrote this method that will add a object to the array but it get me this error Exception in thread "main" java.lang.NullPointerException i check all the variables and i think there is nothing null :(( this is my add method } } the error is in the add_b() method Exception in thread "main" java.lang.NullPointerException at Kindergarten.add_b(Kindergarten.java:39) at ClientClass.main(ClientClass.java:22)
score: -1
has answer: http://stackoverflow.com/a/21995640
answer count: 2
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/33335744
favorite count: 0
has comment: http://stackoverflow.com/comment/33335140

http://stackoverflow.com/q/21919703
has comment: http://stackoverflow.com/comment/33200780
has comment: http://stackoverflow.com/comment/33200536
has comment: http://stackoverflow.com/comment/33200541
has comment: http://stackoverflow.com/comment/33201477
tagged with: java
has comment: http://stackoverflow.com/comment/33215357
tagged with: swing
tagged with: memory
has comment: http://stackoverflow.com/comment/33201022
has comment: http://stackoverflow.com/comment/33202355
type: Question
has answer: http://stackoverflow.com/a/21920807
has comment: http://stackoverflow.com/comment/33202087
has comment: http://stackoverflow.com/comment/33201631
has title: JFrame using way too much memory
has comment: http://stackoverflow.com/comment/33200990
has comment: http://stackoverflow.com/comment/33203221
has comment: http://stackoverflow.com/comment/33200802
has body: I'm currently working on a 2D game. I have a JFrame that adds a JPanel. For some reason, the program is using more and more memory every second. It starts out at about 50,000K and goes higher and higher until my computer can't handle it. I thought it was the paint() method being called in my JPanel, but when I don't add my JPanel, it's still going up. Here is the code for my JFrame: package main; import java.awt.Component; import javax.swing.JFrame; import level.Level; public class LostCloud { public static int width = 300; public static int height = 300; public static int scale = 2; public static String name = "Lost Cloud: Adventure 2D"; public static JFrame frame; public static JFrame levelFrame; public static Component center = null; public static Menu menu = new Menu(); public static Level level = new Level(); public static void main(String[] args) { frame = new JFrame(name); levelFrame = new JFrame(name); // Set size and settings frame.setSize(width * 2, height * 2); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setLocationRelativeTo(center); // Set visible frame.setVisible(true); // Draw main menu panel frame.add(menu); menu.requestFocusInWindow(); frame.validate(); } public void play() { //Close main menu frame frame.dispose(); // Set size and settings levelFrame.setSize(width * 3, height * 3); levelFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); levelFrame.setResizable(false); levelFrame.setLocationRelativeTo(center); // Set visible levelFrame.setVisible(true); // Draw level panel levelFrame.add(level); level.requestFocusInWindow(); levelFrame.validate(); } } Menu: package main; import java.awt.Color; import java.awt.Font; import java.awt.FontFormatException; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.image.BufferedImage; import java.io.BufferedWriter; import java.io.File; import java.io.FileWrite…
score: 0
has comment: http://stackoverflow.com/comment/33202610
answer count: 1
has comment: http://stackoverflow.com/comment/33201169
has comment: http://stackoverflow.com/comment/33200951
has comment: http://stackoverflow.com/comment/33203111
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33201469
tagged with: memory-leaks
has comment: http://stackoverflow.com/comment/33201914

http://stackoverflow.com/q/21995981
favorite count: 0
has title: Swing/Prefuse or SWT for eclipse plugin development
has body: I have existing java application where GUI had mainly built using Swing and prefuse API (http://prefuse.org/). I want to develop eclipse plugin for this application. I have read in vogella tutorial that SWT is prefer to use for plugin development. My problem is that if I should use SWT, then how can I convert each swing and prefuse API component to SWT? PS: If I use existing GUI in my eclipse plugin project, then when I run the plugin as "Eclipse Application", it display GUI outside eclipse which I am not sure is correct behaviour for plugin development.
type: UnansweredQuestion
tagged with: swt
has comment: http://stackoverflow.com/comment/33336419
upvote count: 1
tagged with: plugins
tagged with: swing
has answer: http://stackoverflow.com/a/22018393
score: 1
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/33337244
linked to: http://stackoverflow.com/q/20905989
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/55092315
comment on: http://stackoverflow.com/a/21966363
score: 0
type: AnswerComment
type: Comment
has text: @RWEQX that doesn't make much sense. If it is only given to developers and you had to apply for it, how is it possible that you would be able to just give it to all users? I mean, is it really *meant* to be given to users, or should the API only be used by developers having such a personal key?

http://stackoverflow.com/comment/33199781
score: 0
has text: read the doc. `create` is a static function that creates and return a MediaPlayer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21919146

http://stackoverflow.com/comment/33168659
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21901249
has text: Thanks. I presume `presentationLayer` is responsible so nothing to do it seems (except patching and recompiling).
type: AnswerComment

http://stackoverflow.com/a/21996780
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/21996728
has comment: http://stackoverflow.com/comment/33337973
has body: Your arrayInBounds method is incorrect. 8 is an invalid index, but your method would incorrectly report that as valid. Also, it doesn't check for invalid indexes below 0. Change your method to check if either x or y is greater than or equal to 8, and also check if either is less than 0.
score: 3

http://stackoverflow.com/comment/62617495
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21946331
type: Comment
has text: Such kind of holder does not seems to be a good idea for me. Beans that originally using an `ExecutorService` to submit tasks, will now need to be injected with that `ExecutorServiceHolder` and get the executorService from it. I think it is a better idea to make a decorator/wrapper of `ExecutorService` instead which will deal with the "restart", so bean using `ExecutorService` (except the one responsible to restart it) will be transparent to such change

http://stackoverflow.com/comment/33118562
comment on: http://stackoverflow.com/a/21873896
score: 0
has text: You can extract details from your timestamp like -- (A) SELECT DAYOFMONTH('1998-02-03'); (B) SELECT DAYOFWEEK('1998-02-03'); -- You can fire expensive query on audit table so that operational table will remain as is without impacting performance.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33319609
type: Comment
comment on: http://stackoverflow.com/a/21976184
has text: Yeah, they kinda missed that. Internally `String.matches` is using `Matcher.matches()`, if you know that you can make the connection... BUt most people won'T read the sourcecode just to get this.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33301421
comment on: http://stackoverflow.com/a/21976116
score: 1
type: AnswerComment
has text: `SwingWorker` has some limitations, but for the most part is a very helpful API
type: Comment

http://stackoverflow.com/q/21883459
score: 0
has body: I'm starting to do some menu programming for a simple game I'm making using Slick2D. My menu is essentially a list of options, which when selected, can open up a sub-menu with more options. For example: Main Menu --------- New Game Options When Options is selected the following menu appears: Options ------- Video Audio Back My question is should I initialize a different BasicGameState for each sub-menu or is there a better way to handle this?
tagged with: lwjgl
has answer: http://stackoverflow.com/a/22400843
accepted answer: http://stackoverflow.com/a/22400843
type: AnsweredQuestion
tagged with: java
tagged with: slick2d
has title: Slick2D: StateBasedGame and creating a menu
type: Question
answer count: 1

http://stackoverflow.com/a/21940442
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21940258
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has body: I believe it would be better having only one Activity and using Fragment in conjunction with a ViewPager to achieve the desired effect. The official training page on the subject explains this better than I could. If you are not familiar with the concept of Fragment, there is also a training section on that here. Finally, since you are a beginner, I would recommend you go through most of the official training or any other complete training support such as Mark Murphy's Busy Coder’s Guide to Android Development or Reto Meier's Professional Android 4 Application Development.
answers question: http://stackoverflow.com/q/21940258

http://stackoverflow.com/comment/33221665
has text: You are throwing away your `Exception ex`. Do not do that, the ifnormation could very well be there. And why are you catching the full `Exception` anyway? Always catch a subclass.
comment on: http://stackoverflow.com/q/21932200
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/33296344
comment on: http://stackoverflow.com/q/21973560
score: 0
has text: @aegean I seem to have figured it out. I didn't save the file with button_send in it :(
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33348315
has text: It works fine with this: [3, 8, 17, 9, 17, 8, 3]
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22002296
score: 0

http://stackoverflow.com/comment/33214015
score: 0
has text: I read something is that happens because you should change the version of aspectj why version are you using
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21927685

http://stackoverflow.com/comment/33108431
score: 0
type: QuestionComment
has text: @JavaDevil *"Must be in my left mind :P"* ;)
type: Comment
comment on: http://stackoverflow.com/q/21867934

http://stackoverflow.com/q/21876785
has answer: http://stackoverflow.com/a/21876960
has comment: http://stackoverflow.com/comment/33123380
has comment: http://stackoverflow.com/comment/33125179
has comment: http://stackoverflow.com/comment/33123802
type: UnansweredQuestion
tagged with: size
tagged with: collections
has comment: http://stackoverflow.com/comment/33123415
tagged with: list
has comment: http://stackoverflow.com/comment/33124120
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33123998
type: Question
answer count: 2
has title: Increasing list's size dynamically java
linked to: http://stackoverflow.com/q/9231018
duplicate of: http://stackoverflow.com/q/9231018
has body: If I use list.add(int, int) method, it will throw an IndexOutBoundException if the position is bigger than or equals to list.size(). I would like to have something that increases the size by adding null elements (if necessairy) until it can safely add a real element to the end. So lets say I have a list(list.size()= 0), I want to add 5 to the third position, then I would get a list of where the size equals to 4, and the elements are null, null, null, 5.
has answer: http://stackoverflow.com/a/21877282

http://stackoverflow.com/comment/33082082
score: 2
comment on: http://stackoverflow.com/a/21853753
has text: @AndreiNicusan Are you sure you tested it with `Class<Wrapper<T>>`? It fails at least on my machine.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21873626
score: 0
tagged with: abstract-class
answer count: 3
tagged with: exception
has comment: http://stackoverflow.com/comment/33117843
tagged with: throw
has answer: http://stackoverflow.com/a/21874110
has answer: http://stackoverflow.com/a/21874060
has body: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.*; public class sentence { public static void main() throws IOException { InputStreamReader br = new InputStreamReader(System.in); BufferedReader in = new BufferedReader(br); System.out.println("Enter a sentence."); String a = in.readLine(); String ar[] = new String[10000]; int k = 0; try { if (a.length() == 0) { throw new NullError(); } if ('a' &lt; a.charAt(0) &amp;&amp; a.charAt(0) &lt; 'z') { throw new CaseError(); } if (a.charAt(a.length() - 1) != '.') { throw new FullStopError(); } int countuppercase = 0; String s1 = ""; for (int i = 0; i &lt; a.length(); i++) { char c = a.charAt(i); if (1 &lt; countuppercase) { throw new CaseError(); } if (c != ' ' &amp;&amp; c != '.') { s1 = s1 + c; } else { ar[k] = s1; k++; s1 = ""; } } } catch (NullError e) { System.out.println("You can't enter an empty string."); } catch (CaseError e) { System.out .println("You have used the upper case and lower case properly."); } catch (FullStopError e) { System.out.println("You have forgot to use the full stop."); } for (int i = 0; i &lt; k - 1; i++) { String tmp = ""; for (int j = i; j &lt; k - 1; j++) { if (ar[j].length() &gt; ar[j + 1].length()) { tmp = ar[j]; ar[j] = ar[j + 1]; ar[j + 1] = tmp; } } } for (int i = 0; i &lt; k; i++) { System.out.print(ar[i]); if (i &lt; (k - 1)) { System.out.print(" "); } else System.out.print("."); } } } class NullError extends Exception// If someone asks me what is name or purpose // of defining this class what should I // tell? { public NullError() { } } class CaseError extends Exception { public CaseError() { } } class FullStopError extends Exception { public FullStopError() { } } For example if I write this code. What is the name of a class which extends the Exception class is it called an abstract class and what is its use? This code arranges the words in sentence in increasing order of the number of letters, I implemented some custom exc…
tagged with: extends
has answer: http://stackoverflow.com/a/21873976
accepted answer: http://stackoverflow.com/a/21873976
has title: How can we define a class which extends the Exception class of java.lang class
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33117896
has comment: http://stackoverflow.com/comment/33118069
possible better answer: http://stackoverflow.com/a/21874060
type: Question
has comment: http://stackoverflow.com/comment/33117977

http://stackoverflow.com/comment/33226256
score: 2
type: Comment
type: QuestionComment
has text: What's your question?
comment on: http://stackoverflow.com/q/21934744

http://stackoverflow.com/comment/33255899
type: Comment
type: QuestionComment
score: 1
has text: "Instead of a Link object use a array of size 2 one of which holds the item and other reference to the next one." - That is a way of somehow forcing an array into the solution. Don't do that!
comment on: http://stackoverflow.com/q/21950868

http://stackoverflow.com/q/21955943
type: UnansweredQuestion
tagged with: android-intent
tagged with: java
has answer: http://stackoverflow.com/a/21956026
type: Question
tagged with: share
has body: HOW CAN I REPLACE THE R.id.ic_launcher with the specific id that user selected. i have created an application which represents some grid view of images, then after user selection it select the specific image and then a share menu button share the image to the social apps. but the error is whenever any image is selected and shared to any application it only sends the default launcher icon i.e, ic_launcher.png. my code goes below like this: FullImageActivity.java @SuppressLint("SdCardPath") public class FullImageActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.full_image); Intent i = getIntent(); int position = i.getExtras().getInt("id"); ImageAdapter imageAdapter = new ImageAdapter(this); ImageView imageView = (ImageView) findViewById(R.id.full_image_view); imageView.setImageResource(imageAdapter.mThumbIds[position]); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); File sd = Environment.getExternalStorageDirectory(); String fileName = "test.png"; File dest = new File(sd, fileName); try { FileOutputStream out; out = new FileOutputStream(dest); bitmap.compress(Bitmap.CompressFormat.PNG, 100, out); out.flush(); out.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } switch (item.getItemId()) { case R.id.item: Uri uri = Uri.fromFile(dest); Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); shareIntent.setType("image/jpeg"); startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.share))); return true; d…
score: 0
tagged with: android
answer count: 1
has title: Share the Selected Image Only in Android

http://stackoverflow.com/comment/33301176
has text: This check if the string _matches_ the regular expression, not if it contains instances of it. See http://stackoverflow.com/q/15130309/1348195
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21976152
score: 0

http://stackoverflow.com/a/21933797
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21933095
type: Answer
answers question: http://stackoverflow.com/q/21933095
upvote count: 1
has body: @LarsChung : code is attached below: public abstract class Person { public void buyFood(String foodName, int payment) { System.out.println("Buy " + foodName + " and pay $" + payment + "."); pay(payment); } public abstract void pay(int amt); } public class Visitor extends Person { @Override public void pay(int amount) { money_v -= amount; System.out.println(this.to_s() + " has got HK$" + money_v + "left."); } }
score: 1

http://stackoverflow.com/a/21842192
type: Answer
has comment: http://stackoverflow.com/comment/33062149
upvote count: 4
has body: Two problems: You are not printing the String that you have manipulated, you are printing the original String you started with, ie "dean". To print the string from the StringBuilder you can use System.out.println(repeat); You are adding the whole word "dean" to your original word instead of adding individual letters/chars. You need to iterate through every letter in your original word and add those letters to an empty StringBuilder. Here is the basic logic you should use to get you going: Get original word ("dean") Create an empty StringBuilder Parse through each letter of your original word ("dean") either by using a for loop and getting each char in the string or using String.split and parsing the Array. For each letter in your original word, append that letter with that letter n times to your StringBuilder. Print the string from StringBuilder once you have parsed through all the letters in the original word.
downvote count: 0
answers question: http://stackoverflow.com/q/21842105
score: 4

http://stackoverflow.com/a/22015548
has body: That would be the right way doing it Request.Post("someurl") .useExpectContinue() .version(HttpVersion.HTTP_1_1) .bodyString("Important stuff", ContentType.create("text/plain", Consts.UTF_8)) .execute() .returnContent().asBytes();
answers question: http://stackoverflow.com/q/21984219
upvote count: 5
score: 5
downvote count: 0
type: Answer

http://stackoverflow.com/comment/33230971
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21937258
has text: which version of commons-dbcp jar ur using and spring jars too ??

http://stackoverflow.com/comment/33316836
type: Comment
score: 0
type: QuestionComment
has text: Is there a reason for not using for loops, or hash sets.
comment on: http://stackoverflow.com/q/21985397

http://stackoverflow.com/a/21990492
type: Answer
accepted answer of: http://stackoverflow.com/q/21987702
answers question: http://stackoverflow.com/q/21987702
score: 1
upvote count: 1
has body: I've got a raspberry pi running as a small server running Apache, PHP and a MySQL DB to hold the registrationIDs for GCM apps running on Android devices. When a device is registered it sends the regID to the DB. The table is called registrations and it has columns device, project, owner, regid. I should stress that the following code on the Android phone is all wrapped up in an AsyncTask and that it is invoked in the doInBackground method. String script = "register_phone.php"; String serverUrl = SERVER_URL + script; Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;(); params.put("regId", regId); params.put("devId", devId); params.put("projId", projId); params.put("owner", owner); // some other largely irrelevant stuff post(serverUrl, params); private static void post(String endpoint, Map&lt;String, String&gt; params) throws IOException { String url = null; url = endpoint; List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); Iterator&lt;Entry&lt;String, String&gt;&gt; iterator = params.entrySet().iterator(); while (iterator.hasNext()) { Entry&lt;String, String&gt; param = iterator.next(); String key = param.getKey(); String value = param.getValue(); nameValuePairs.add(new BasicNameValuePair(key, value)); } HttpResponse response; final HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, NETWORK_TIMEOUT); HttpConnectionParams.setSoTimeout(httpParams, NETWORK_TIMEOUT); HttpConnectionParams.setStaleCheckingEnabled(httpParams, true); HttpClient httpClient = new DefaultHttpClient(httpParams); HttpPost httpPost = new HttpPost(url); try { httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } try { response = httpClient.execute(httpPost); //int status = httpClient.getResponseCode(); Log.d(GCMTAG, "response " + response.getEntity()); String responseBody = "empty"; responseBody = EntityUtils.toString(response.g…
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21979534
tagged with: list
tagged with: uuid
tagged with: java
has answer: http://stackoverflow.com/a/21979562
type: Question
has title: Using UUID.randomUUID() and calling method multiple times?
has body: For a class assignment I have to compare different lists' performance with one another's using UUID.randomUUID().toString() to insert a few thousand random strings in a list and record how long it takes with the nanoTime() method. I just can't recall how to set the amount of calls to my add method for my list to a certain number, or how to do it with the UUID.randomUUID(), at least. newbieList.add(UUID.randomUUID().toString()); is what I have, which just inserts one random string, of course. I know this is a simple question probably but I couldn't find any answers Googling or here, so help would be appreciated! Thanks.
score: 0
tagged with: nanotime
answer count: 1
linked to: http://stackoverflow.com/q/7763131
accepted answer: http://stackoverflow.com/a/21979562
favorite count: 0
has comment: http://stackoverflow.com/comment/33307209
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/33307226
type: AnsweredQuestion

http://stackoverflow.com/comment/33244987
type: Comment
type: QuestionComment
has text: My question is about finding a way to open excel using java and make sure it will run foreground. I'm using ASPOSE to read/write in excel spreadsheets :)
comment on: http://stackoverflow.com/q/21879435
score: 0

http://stackoverflow.com/comment/33955405
type: Comment
comment on: http://stackoverflow.com/a/22335212
has text: I Change it to true but still same problem @rory
score: 0
type: AnswerComment

http://stackoverflow.com/a/21874513
accepted answer of: http://stackoverflow.com/q/21874340
answers question: http://stackoverflow.com/q/21874340
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The line that says ionChildList = (IonList) ionStructList.get(index).get(childList); should say ionChildList = (IonList)((IonStruct) ionList.get(index)).get(childList); because within ionStructList, the indexes will be different, so with your code, you won't retrieve the right list.
upvote count: 3
score: 3

http://stackoverflow.com/q/21856422
has answer: http://stackoverflow.com/a/21914059
tagged with: java
tagged with: collections
has answer: http://stackoverflow.com/a/21918041
has body: I have to convert a Guava Multiset&lt;String&gt; to a Map&lt;String, Integer&gt; (Key, Count). I cannot find any utility function for this. Is there anything shorter than my code below for this? private static Map&lt;String, Integer&gt; multisetToMap(final Multiset&lt;String&gt; multiset) { Map&lt;String, Integer&gt; result = new HashMap&lt;&gt;(); for(String element: multiset.elementSet()) { result.put(element, multiset.count(element)); } return ImmutableMap.copyOf(result); }
has comment: http://stackoverflow.com/comment/33194381
upvote count: 4
possible better answer: http://stackoverflow.com/a/21918041
accepted answer: http://stackoverflow.com/a/21914059
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33142114
type: Question
has title: Convert Multiset to a Map
answer count: 2
score: 4
tagged with: guava

http://stackoverflow.com/a/25554195
score: 1
answers question: http://stackoverflow.com/q/21857567
has body: Have you tried to remove the following from within fragmenttabhost? Put it outside of the fragmenttabhost.
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/q/21858701
has comment: http://stackoverflow.com/comment/33093387
tagged with: web-crawler
tagged with: jsoup
score: 8
has comment: http://stackoverflow.com/comment/33091528
has comment: http://stackoverflow.com/comment/33093441
downvote count: 0
has title: how to fix HTTP error fetching URL. Status=500 in java while crawling?
linked to: http://stackoverflow.com/q/1966503
has comment: http://stackoverflow.com/comment/33091530
has comment: http://stackoverflow.com/comment/33091244
has comment: http://stackoverflow.com/comment/33091839
tagged with: http-error
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33093076
has comment: http://stackoverflow.com/comment/33091007
has answer: http://stackoverflow.com/a/21860404
linked to: http://stackoverflow.com/q/10245519
favorite count: 0
has comment: http://stackoverflow.com/comment/33093087
upvote count: 8
accepted answer: http://stackoverflow.com/a/21860404
type: Question
has body: I am trying to crawl the user's ratings of cinema movies of imdb from the review page: (number of movies in my database is about 600,000). I used jsoup to parse pages as below: (sorry, I didn't write the whole code here since it is too long) try { //connecting to mysql db ResultSet res = st .executeQuery("SELECT id, title, production_year " + "FROM title " + "WHERE kind_id =1 " + "LIMIT 0 , 100000"); while (res.next()){ ....... ....... String baseUrl = "http://www.imdb.com/search/title?release_date=" + ""+year+","+year+"&amp;title="+movieName+"" + "&amp;title_type=feature,short,documentary,unknown"; Document doc = Jsoup.connect(baseUrl) .userAgent("Mozilla") .timeout(0).get(); ..... ..... //insert ratings into database ... I tested it for the first 100, then first 500 and also for the first 2000 movies in my db and it worked well. But the problem is that when I tested for 100,000 movies I got this error: org.jsoup.HttpStatusException: HTTP error fetching URL. Status=500, URL=http://www.imdb.com/search/title?release_date=1899,1899&amp;title='Columbia'%20Close%20to%20the%20Wind&amp;title_type=feature,short,documentary,unknown at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:449) at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:424) at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:178) at org.jsoup.helper.HttpConnection.get(HttpConnection.java:167) at imdb.main(imdb.java:47) I searched a lot for this error and I found it is a server side error with 5xx error number. Then I decided to set a condition that when connection fails, it tries 2 more times and then if still couldn't connect, does not stop and goes to the next url. since I am new to java I tried to search for similar questions and read these answers in stackoverflow: Exceptions while I am extracting data from a Web site Jsoup error handling when couldn&#39;t connect to website Handling connection errors and JSoup but, when I try with "Connection.Respon…
linked to: http://stackoverflow.com/q/19619003
answer count: 1
linked to: http://stackoverflow.com/q/12984961
has comment: http://stackoverflow.com/comment/33092897
tagged with: java

http://stackoverflow.com/a/21935060
answers question: http://stackoverflow.com/q/21934839
downvote count: 0
type: Answer
upvote count: 1
has body: As java API doc describes 'Socket.accept()': Throws: IOException - if an I/O error occurs when waiting for a connection. SecurityException - if a security manager exists and its checkAccept method doesn't allow the operation. SocketTimeoutException - if a timeout was previously set with setSoTimeout and the timeout has been reached. See Java API Doc Socket
score: 1

http://stackoverflow.com/comment/33306146
type: Comment
has text: @user3343715 Add the label in to the JPanel.
comment on: http://stackoverflow.com/a/21970904
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33062603
type: QuestionComment
has text: You can edit your question to remove it
comment on: http://stackoverflow.com/q/21842507
score: 0
type: Comment

http://stackoverflow.com/comment/33183468
comment on: http://stackoverflow.com/q/21910532
score: 0
type: Comment
type: QuestionComment
has text: Forgot to say that methodB() is static, so I don't need to create an instance of the class.

http://stackoverflow.com/q/21917805
favorite count: 0
accepted answer: http://stackoverflow.com/a/21917871
tagged with: focuslistener
tagged with: swing
type: AnsweredQuestion
score: 3
upvote count: 3
linked to: http://stackoverflow.com/q/3953208
has title: Listeners for JTextField text change
tagged with: java
tagged with: jtextfield
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21917871
downvote count: 0
duplicate of: http://stackoverflow.com/q/3953208
has body: I have got a JTextField and I want to add listener to it, which will receive some event as soon as the JTextField looses focus (say when I press with mouse to another component). Also I want a listener to receive an event when the text parameter of JTextField is changed (like when I set jtextfield.setText(anotherText)). Any idea how should I do it?
possible better answer: http://stackoverflow.com/a/21921441
has answer: http://stackoverflow.com/a/21921441

http://stackoverflow.com/comment/33248389
score: 0
type: AnswerComment
type: Comment
has text: hmm the only real i have this AsyncTask in the adapter class is because a button on each row of the list can delete that item. So I'm forced to put it inside my custom ArrayAdapter.
comment on: http://stackoverflow.com/a/21946664

http://stackoverflow.com/comment/33174273
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21902652
has text: Following Exception caught "Connection timed out: connect"
type: Comment

http://stackoverflow.com/comment/33348536
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22002746
has text: Sorry, I should have added, the error code I get when amending c1.radius to c1.getRadius is "getRadius cannot be resolved or is not a field"

http://stackoverflow.com/q/21882025
tagged with: java
has comment: http://stackoverflow.com/comment/33132510
answer count: 1
tagged with: synth
score: 0
type: UnansweredQuestion
tagged with: look-and-feel
tagged with: swing
has title: Do Nimbus look and feel supports loading configuration from xml
has body: NimbusLookAndFeel extends SynthLookAndFeel but does it supports loading properties from xml like SynthLookAndFeel does? Is the XML settings format the same?
has answer: http://stackoverflow.com/a/26854378
tagged with: nimbus
type: Question

http://stackoverflow.com/q/21902749
tagged with: date
type: Question
answer count: 2
score: 0
tagged with: android
has body: java.util.Date gives incorrect day as output. java.util.Date date = new Date(2014,03,01); System.out.println("day is" +date.getDay()); output : day is 3 actually it should be 7 Update : Thanks a lot I was able to get the output Here is my code java.util.Calendar c = java.util.Calendar.getInstance(); c.clear(); c.set(year,month,dd); System.out.println("day of week "+c.get(java.util.Calendar.DAY_OF_WEEK));
has answer: http://stackoverflow.com/a/21903003
has title: finding the day based on date in java - gives incorrect answer
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21902778
tagged with: java

http://stackoverflow.com/a/21945632
score: 0
has comment: http://stackoverflow.com/comment/33246614
has comment: http://stackoverflow.com/comment/33247222
type: Answer
answers question: http://stackoverflow.com/q/21945566
has body: Can you please post the structure of your class so that we can see what are the types of member variables defined in your class. Try declaring sumOfWeight as static varibale to keep count of weights of all objects instantiated of your class.
has comment: http://stackoverflow.com/comment/33246476
has comment: http://stackoverflow.com/comment/33247060

plugins
tags question: http://stackoverflow.com/q/21919709
tags question: http://stackoverflow.com/q/21920616
tags question: http://stackoverflow.com/q/21961329
tags question: http://stackoverflow.com/q/21877325
tags question: http://stackoverflow.com/q/21932184
tag name: plugins
tags question: http://stackoverflow.com/q/21974394
type: Tag
tags question: http://stackoverflow.com/q/21995981

http://stackoverflow.com/comment/33265247
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21956098
has text: Tried it, it solved the problem :D Simply made a `Set` to store all the pixels already visited, so I don't add duplicates of them to the stack. Thanks a lot :)

http://stackoverflow.com/q/21869198
tagged with: image
has answer: http://stackoverflow.com/a/38904629
has answer: http://stackoverflow.com/a/21869520
score: 0
has comment: http://stackoverflow.com/comment/44245048
has title: Saving to internal memory android
type: UnansweredQuestion
tagged with: android
tagged with: java
tagged with: save
has comment: http://stackoverflow.com/comment/33110809
type: Question
answer count: 2
has body: I'm having trouble getting an image to save to internal memory on my device. I've looked at other topics and implemented them, but nothing has worked for me. If anyone can point me in the right direction it would be appreciated. I also can't save the image to an sd card as my tablet does not have one. Here's my code import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.app.Activity; import android.content.Context; import android.content.ContextWrapper; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.BitmapFactory.Options; import android.util.Log; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; public class MainActivity extends Activity { // Request codes for Activities private static final int CAPTURE_IMAGE_REQUEST = 100; private static final int MEDIA_TYPE_IMAGE = 1; private static final int LINK_TO_DROPBOX = 150; // Directory name to store captured images private static String IMAGE_DIRECTORY_NAME = "Android to Dropbox"; // Uri to store images private Uri fileUri; private ImageView imagePreview; // To preview image private Button captureImage; // To launch camera intent private Button linkDropbox; // Link users Dropbox account @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); imagePreview = (ImageView)findViewById(R.id.imagePrview); captureImage = (Button)findViewById(R.id.imageCapture); linkDropbox = (Button)findViewById(R.id.linkToDropbox); // Go to method to start camera intent to capture image captureImage.setOnClickListener(n…

http://stackoverflow.com/a/21940159
score: 0
has body: If you want to achieve better performance try to change listFiles() method to list() method from File class.
answers question: http://stackoverflow.com/q/21939896
has comment: http://stackoverflow.com/comment/33236323
type: Answer

http://stackoverflow.com/comment/33091418
type: Comment
comment on: http://stackoverflow.com/a/21854274
has text: come on man, help me out here I need to get through this. I have 25 books on Java that Im in the process of reading
score: 0
type: AnswerComment

http://stackoverflow.com/a/53331588
has body: I know that the question has been more than 4 years and 8 months old but for the sake of clear solution as of today, I am posting this In my case, the method signature to be tested is public SomeObject create(String code, int status) so the test code for verifying the argument values when the method was invoked would be following verify(this.service).create( argThat(code -&gt; "dummy_code".equals(code)), intThat(status -&gt; status == 105)); If I go with the argThat even for int (or any primitive types) then mockito throws NPE Currently I am using org.mockito:mockito-core:jar:2.15.0 which must have been advanced considering the time when the question was asked! But thinking that this might be helpful to people... Thanks,
score: 6
type: Answer
answers question: http://stackoverflow.com/q/21980728
downvote count: 0
upvote count: 6

rmi
tags question: http://stackoverflow.com/q/21975855
tags question: http://stackoverflow.com/q/21961226
tags question: http://stackoverflow.com/q/21901990
tags question: http://stackoverflow.com/q/21857094
tag name: rmi
type: Tag
tags question: http://stackoverflow.com/q/21961448

http://stackoverflow.com/comment/94558101
type: Comment
score: 11
has text: I wish I could upvote this every time I have to google "os x switch java version" and get back here
type: AnswerComment
comment on: http://stackoverflow.com/a/24657630

http://stackoverflow.com/a/22220537
answers question: http://stackoverflow.com/q/21891552
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I hit this problem in production and solved it by removing batik-js from the classpath. Empirically, org.apache.xmlgraphics 1.7 works fine with rhino 1.7R4 (unpatched), which is what org.lesscss/lesscss 1.3.3 depends on. So, just exclude batik-js from your build/classpath.
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21891552

http://stackoverflow.com/comment/33122527
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21875982
has text: Will there be more than one player card or computer card in the center in any given time?

http://stackoverflow.com/q/21996555
has comment: http://stackoverflow.com/comment/33337387
tagged with: java
has answer: http://stackoverflow.com/a/21996572
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/21997043
answer count: 2
possible better answer: http://stackoverflow.com/a/21996572
upvote count: 0
score: -2
accepted answer: http://stackoverflow.com/a/21997043
linked to: http://stackoverflow.com/q/5794506
tagged with: splash-screen
has body: I have an Android program that includes splash activity. when I run the program everything working perfectly but when press the back button I see my splash activity again .to be able to avoid this it seems I need to close my splash but I can't here is my code package com.tesbih; import android.app.Activity; import android.content.Intent; import android.os.Bundle; public class Splash extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.splash); Thread timer = new Thread(){ public void run(){ try{ sleep(5000); }catch(InterruptedException e){ e .printStackTrace(); }finally{ Intent openStartingPoint = new Intent ("com.tesbih.TESBIHMAINACTIVITY"); startActivity(openStartingPoint); } } }; timer.start(); } }
favorite count: 0
tagged with: android
downvote count: 2
has comment: http://stackoverflow.com/comment/33338570
type: AnsweredQuestion
has title: How to close a splash activity?

http://stackoverflow.com/comment/33255837
score: 1
comment on: http://stackoverflow.com/q/21950524
has text: Might want to take at your for loop condition `{i=0; i; i++)` to start with.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33328874
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21991928
score: 0
has text: You can edit your post instead of posting multiple comments.

http://stackoverflow.com/comment/33167373
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21900294
type: QuestionComment
has text: You are probably using a version of hibernate that doesn't have this static field. What version of hibernate are you using?

http://stackoverflow.com/comment/33221510
type: Comment
has text: I have resolve, I add at the begging of CLASSPATH=.:
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21858368

http://stackoverflow.com/a/21868404
has body: Try setting it up to allow for line wrapping... JTextArea area = new JTextArea(veryLongText.toString()); area.setLineWrap(true); Sets the line-wrapping policy of the text area. If set to true the lines will be wrapped if they are too long to fit within the allocated width. If set to false, the lines will always be unwrapped. A PropertyChange event ("lineWrap") is fired when the policy is changed. By default this property is false. Can even wrap on word boundaries by using... area.setWrapStyleWord(true); Sets the style of wrapping used if the text area is wrapping lines. If set to true the lines will be wrapped at word boundaries (whitespace) if they are too long to fit within the allocated width. If set to false, the lines will be wrapped at character boundaries. By default this property is false. Generally, I suggest both Take a look at the JTextArea JavaDocs and How to use text areas for more details...
has comment: http://stackoverflow.com/comment/33109314
has comment: http://stackoverflow.com/comment/33109313
score: 5
has comment: http://stackoverflow.com/comment/33109276
accepted answer of: http://stackoverflow.com/q/21868332
upvote count: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21868332
type: Answer

http://stackoverflow.com/comment/33351232
type: AnswerComment
type: Comment
has text: `Is there anything certain he may be looking for pertaining to iterators or doubly linked lists that I'm missing?`
score: 1
comment on: http://stackoverflow.com/a/22004231

http://stackoverflow.com/a/21955391
accepted answer of: http://stackoverflow.com/q/21955134
answers question: http://stackoverflow.com/q/21955134
score: 0
has body: This is called the Observation Pattern. The model allows for dynamic (on-fly) creation of any number of entities with any type of properties without schema changes. However, this flexibility has a price; so storing and searching will be slower and more complex than in a normal table design.
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/21897568
type: Question
tagged with: hadoop
has body: I am writing map-reduce program to query cassandra column-family. I need to read only subset of rows(using row key) from only one column family. I have the set of row keys of rows what I have to read. How can I pass "row key set" to the map reduce job so that It can output only those subset of rows from cassandra columnfamily? Abstract: enter code here class GetRows() { public set&lt;String&gt; getRowKeys() { logic..... return set&lt;string&gt;; } } class MapReduceCassandra() { inputformat---columnFamilyInputFormat . ; also need input key-set .. How to get it? } Can any one suggest the best method to call mapreduce from java application and how to pass set of keys to mapreduce?
tagged with: cassandra
score: 0
has answer: http://stackoverflow.com/a/21919866
accepted answer: http://stackoverflow.com/a/21919866
answer count: 1
has title: How to pass multiple input format files to map-reduce job?
type: AnsweredQuestion
tagged with: java
tagged with: mapreduce

http://stackoverflow.com/a/21988093
type: Answer
answers question: http://stackoverflow.com/q/21969395
has body: Instead of capturing the output of your view JSP and then inserting it into your template JSP, try calling the view as an include in the template: processRequest stays the same. getViewContent becomes: protected String getViewContent(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { return "views/frontend/home.jsp"; // Note this is now returning the name of the JSP, not the JSP content } And finally, in default.jsp: ... &lt;body&gt; &lt;jsp:include page="${requestScope['content']}" /&gt; &lt;/body&gt; ....
score: 0

http://stackoverflow.com/a/21991144
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/21970077
score: 2
has body: Your question doesn't contain any useful data to answer this question. The speed of an insert depends on: Size of the row (i.e. the limits that you told the database) Number of indexes touched by the insert Some types like (C)LOB are more expensive than others Actual amount of data per row The database you use Latency Layout of the table storage on disk As a rule of thumb, we join 10000 rows for small inserts (2-3 columns, &lt; 100 bytes for the whole row), 1-2000 for normal rows (&lt; 1KB each) and 1 for huge rows (> 100K) EDIT Write a small performance test that inserts 1 millions records with different batch sizes and time it. Anything else is just guesswork.
downvote count: 0
has comment: http://stackoverflow.com/comment/33327307

http://stackoverflow.com/q/21896303
has answer: http://stackoverflow.com/a/21896474
has comment: http://stackoverflow.com/comment/33159686
has answer: http://stackoverflow.com/a/21896340
type: AnsweredQuestion
tagged with: recursion
has comment: http://stackoverflow.com/comment/33159591
possible better answer: http://stackoverflow.com/a/21896374
has answer: http://stackoverflow.com/a/21896374
tagged with: java
has body: First, I would like to apologize because of my bad English. Now, how do I return a set of string using recursion? I know the logic but I can't figure out how to return the set after adding all these words from a string. example with a string like this String s = "how do i return this?"; After passing this string into the method, I need to create a set, then using recursion to remove the string (which will be added to the set, and return the set). When the set is returned, I supposed to output the set to a file. My logic is: //because every word in the string ends with a space //So I need to get the index of that space int n = s.indexOf(' '); //add each word to the set (each word start at index 0 to the index of the space ' '. set.add(s.substring(0, n)); //recursive case ( keep doing this until the length of string is 0.) methodName(n+1, s.length()); I know I can do this with class variable (set), but I need to use local in this case and it doesn't seem to work.
type: Question
score: 0
has comment: http://stackoverflow.com/comment/33159319
tagged with: string
has answer: http://stackoverflow.com/a/21896464
accepted answer: http://stackoverflow.com/a/21896340
answer count: 4
has comment: http://stackoverflow.com/comment/33159613
has title: returning a set of string in java
tagged with: set

http://stackoverflow.com/comment/33247920
type: Comment
has text: It's difficult to spot this kind of student code. A hard dependency on Scanner in a mergesort constructor, how would you know?
comment on: http://stackoverflow.com/q/21946454
score: 0
type: QuestionComment

http://stackoverflow.com/comment/52716967
type: AnswerComment
type: Comment
score: 13
comment on: http://stackoverflow.com/a/22013603
has text: This is not valid for Java8

http://stackoverflow.com/comment/33308318
type: QuestionComment
comment on: http://stackoverflow.com/q/21980158
has text: @JiteshUpadhyay actually in catch block there is a syntax error so it suggested to add try catch block for this throw exception under catch block. would you please explain why Decompiler showing this syntax error.
score: 0
type: Comment

cocos2d-android
type: Tag
tags question: http://stackoverflow.com/q/21913298
tag name: cocos2d-android

http://stackoverflow.com/a/21843368
has body: The getLetter() method should return type char not int. This is because you have assigned the local variable letter as type char. Also, methods are called by method(); not '(method)'. Try out the following code: public class YourClass { public static void main(String[] args) { //variable declaration char letter; letter = getLetter(); System.out.println(letter); } public static char getLetter() { String text; char letter; text = JOptionPane.showInputDialog("Enter a letter."); letter = text.charAt(0); System.out.println(letter); return letter; } }
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21843270
type: Answer
accepted answer of: http://stackoverflow.com/q/21843270
score: 3
downvote count: 0

http://stackoverflow.com/comment/33332653
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21990079
score: 0
has text: Yes, I figured I needed to get these classes until spring control, but have been unsuccessful. I've tagged them with @Component and put them in my spring.xml, but spring creates an instance (presummably with an AOP proxy), and then jersey creates its own instances. So, how do I get jersey to use spring to obtain its service classes? The situation is different for another project, which uses jax-ws instead of jax-rs. It's service class do use spring AOP successfully. I don't understand why there would be a difference.

http://stackoverflow.com/comment/33089627
type: QuestionComment
score: 1
has text: Don't do that. You should rewrite it in Javascript.
comment on: http://stackoverflow.com/q/21858053
type: Comment

http://stackoverflow.com/comment/33288351
score: 0
type: AnswerComment
type: Comment
has text: Can You suggest me At what point Should I open and close connection sockets to achieve time for wait in this case.
comment on: http://stackoverflow.com/a/21967889

http://stackoverflow.com/comment/33299768
comment on: http://stackoverflow.com/q/21975413
type: Comment
type: QuestionComment
has text: Check the `;` after your `if` conditional expression. Should that be there?
score: 3

http://stackoverflow.com/comment/33179432
has text: @reddy nope. That's OO - `this` is always `this`. It doesn't matter if a is compared to b or visa versa. The contact of `compareTo()` is that it return the comparison of `this` with `that`. The code calling `compareTo()` will use the result as it sees fit.
score: 0
comment on: http://stackoverflow.com/q/21907802
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21931363
has answer: http://stackoverflow.com/a/21931429
score: 0
has body: Why is it that when I have two edit text boxes - (one calls a date dialog and the other calls a time dialog). why do I have to press twice for the dialog to open. the first press focuses it then the second press opens the dialog for it. How do I make it that when I press the edit-text box then the dialog opens on the first press Java coding public class MainActivity extends Activity { int hour = -1, min = -1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ////TIME picker EditText etOne = (EditText) findViewById(R.id.editText1); etOne.setOnClickListener(new EditText.OnClickListener() { public void onClick(View v) { // Do stuff here if (hour == -1 || min == -1) { Calendar c = Calendar.getInstance(); hour = c.get(Calendar.HOUR); min = c.get(Calendar.MINUTE); } showTimeDialog(v, hour, min); } }); // //////////////////////////////////////////////////// // //////////////////////////date picker EditText ettwo = (EditText) findViewById(R.id.editText2); ettwo.setOnClickListener(new EditText.OnClickListener() { public void onClick(View v) { // Do stuff here Calendar c = Calendar.getInstance(); int day = c.get(Calendar.DAY_OF_MONTH); int month = c.get(Calendar.MONTH); int year = c.get(Calendar.YEAR); showDateDialog(v, day, month, year); } }); // /////////////////////////////////////////////// } // ////TIME picker public void showTimeDialog(View v, int hour, int min) { (new TimePickerDialog(this, timeSetListener, hour, min, true)).show(); } public TimePickerDialog.OnTimeSetListener timeSetListener = new TimePickerDialog.OnTimeSetListener() { @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute) { hour = hourOfDay; min = minute; EditText et = (EditText) findViewById(R.id.editText1); et.setText(hour + " : " + min); } }; // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void showDateDialog(V…
has title: why double press to show datedialog
has comment: http://stackoverflow.com/comment/33220393
type: Question
accepted answer: http://stackoverflow.com/a/21931429
tagged with: java
possible better answer: http://stackoverflow.com/a/21931477
has answer: http://stackoverflow.com/a/21931477
has comment: http://stackoverflow.com/comment/33220403
has answer: http://stackoverflow.com/a/21931749
answer count: 3
has comment: http://stackoverflow.com/comment/33220341
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/a/22081220
accepted answer of: http://stackoverflow.com/q/21859972
answers question: http://stackoverflow.com/q/21859972
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
has body: There is a race condition that can occur if any Hystrix commands are executed prior to registering the Servo Hystrix metrics publisher. You must make sure that the Servo publisher is registered prior to executing any commands. When a command is executed and there is no registered metrics publisher the default metrics publisher will be used, and there is no exposed way to change the publisher. See https://github.com/Netflix/Hystrix/issues/150 for another user with a similar problem.
upvote count: 2

http://stackoverflow.com/comment/33260039
score: 0
type: QuestionComment
has text: Check the Customer before and after the method.
type: Comment
comment on: http://stackoverflow.com/q/21953331

http://stackoverflow.com/comment/33345724
has text: Can you also paste the output of 'echo %JAVA_HOME%'?
type: Comment
comment on: http://stackoverflow.com/q/21999201
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33276193
comment on: http://stackoverflow.com/q/21961975
has text: Exception in thread "main" java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:859) at java.util.ArrayList$Itr.next(ArrayList.java:831) at hangman.Hangman.partition(Hangman.java:93) at hangman.Hangman.play(Hangman.java:54) at hangman.TestClient.main(TestClient.java:14)
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/21855589
tagged with: jlabel
tagged with: jframe
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/33085218
tagged with: multithreading
has answer: http://stackoverflow.com/a/21857239
has comment: http://stackoverflow.com/comment/33084985
has answer: http://stackoverflow.com/a/21855830
tagged with: java
has comment: http://stackoverflow.com/comment/33085020
has title: nullpointerexception while calling a constructor
has answer: http://stackoverflow.com/a/21855729
type: Question
downvote count: 4
has comment: http://stackoverflow.com/comment/33085049
upvote count: 0
has body: thanks for having time reading this. my problem here is that when i call the other class it gives me so many error and i dont know how to fix it. im hope you can :) ty and have a good day :) here is my code public class Xavier1 extends JFrame implements ActionListener,Runnable { JButton a[] = new JButton [10]; JLabel pin,acc; JTextField acc1; JButton del,ok,crt; int c=0,d=0,e=0; JPasswordField pin1; JFrame x; String us,pw; JButton res,back,next; JLabel n,accn,bal,age,sex,dep,pins; JFrame X,r; JTextField n1,accn1,bal1,sex1,age1,dep1; JPasswordField pins1; JLabel Xn,Xacc,Xbal,Xage,Xsex; String xn,xacc,xbal,xage,xsex; public void run() { } public Xavier1() { x = new JFrame("ATM"); x.setLayout(null); x.setBounds(400,100,550,500); x.setVisible(true); JPanel x3 = new JPanel(); x.add(x3); x3.setVisible(true); x3.setBounds(150,420,250,100); crt = new JButton("Create Account"); crt.addActionListener(this); x3.add(crt); JPanel x2 = new JPanel(); x.add(x2); x2.setBounds(150,10,250,100); x2.setVisible(true); x2.setLayout(new GridLayout(4,2)); pin = new JLabel("PIN"); acc = new JLabel("ACCOUNT NUMBER"); pin1 = new JPasswordField(20); acc1 = new JTextField(20); x2.add(acc); x2.add(acc1); x2.add(pin); x2.add(pin1); JPanel x1 = new JPanel(); x.add(x1); x1.setBounds(150,200,250,200); x1.setVisible(true); x1.setLayout(new GridLayout(4,3)); for(int b=0;b&lt;10;b++) { a[b] = new JButton(); a[b].setText(Integer.toString(b)); x1.add(a[b]); a[b].addActionListener(this); } ok = new JButton("OK"); ok.addActionListener(this); del = new JButton("DEL"); del.addActionListener(this); x1.add(ok); x1.add(del); } public static void main (String args[]) { Xavier1 xs = new Xavier1(); Thread xd = new Thread(xs); xd.setDaemon(true); } public void actionPerformed(ActionEvent z) { Object zz = z.getSource(); if(e == 0) { for(int c=0;c&lt;a.length;c++) { if(zz == a[c]) { acc1.setText(acc1.getText()+a[c].getText()); } } } if(zz == ok) { e++; } if(e==2) { GateKeeper(); } if(e == 1) { for(int d=0;d&lt;a.lengt…
tagged with: file-io
has comment: http://stackoverflow.com/comment/33085205
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/21855859

http://stackoverflow.com/a/21944283
answers question: http://stackoverflow.com/q/21944180
type: Answer
score: 0
has body: try { // Here the guarded area starts // Here the guarded area ends } catch { // This block is executed when an exception occurs inside the guarded area } finally { // This block is executed always before leaving try - catch - finally block // If there is an exception, then first catch block is executed and then finally } The code inside finally block you have is a commonly used structure for closing streams. If a stream was created inside guarded area (inputStream != null), then finally block will close it. If there was an exception before inputStream was created, then finally block is executed, but because inputStream == null, the code inside if statement does not execute.

http://stackoverflow.com/comment/33222875
has text: @DarshanPatel - That's for auto adding/removing the imports. I think you meant `ctrl + o` but even that lists the methods of a file and here the OP doesn't know which file the method is in.
comment on: http://stackoverflow.com/q/21932746
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/21901498
score: 1
upvote count: 2
type: AcceptedAnswer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/21895478
type: Answer
answers question: http://stackoverflow.com/q/21895478
has body: Enumeartion not only work on legacy collection framework classes but also other collection framework classes. while working with Stack or Vector,we can directly enumerate like this Stack&lt;Integer&gt; stack=new Stack&lt;Integer&gt;(); stack.add(5); stack.add(9); System.out.println(stack); Enumeration&lt;Integer&gt; enumeration=stack.elements(); while (enumeration.hasMoreElements()) { Integer integer = (Integer) enumeration.nextElement(); System.out.println(integer); } Vector&lt;Integer&gt; vector=new Vector&lt;Integer&gt;(); vector.add(5); vector.add(9); System.out.println(vector); Enumeration&lt;Integer&gt; enumeration2=vector.elements(); while (enumeration2.hasMoreElements()) { Integer integer = (Integer) enumeration2.nextElement(); System.out.println(integer); } but when we are working with collection framework classes like HashSet,ArrayList etc we can enumerate by passing the object of the collection as argument to the Vector or Stack constructor.see the below code Set&lt;Integer&gt; set=new HashSet&lt;Integer&gt;(); set.add(6); set.add(7); System.out.println(set); Enumeration&lt;Integer&gt; enumeration3=new Vector(set).elements(); while (enumeration3.hasMoreElements()) { Integer integer = (Integer) enumeration3.nextElement(); System.out.println(integer); } List&lt;Integer&gt; list=new ArrayList&lt;Integer&gt;(); list.add(12); list.add(23); System.out.println(list); Enumeration&lt;Integer&gt; enumeration4=new Vector(list).elements(); while (enumeration4.hasMoreElements()) { Integer integer = (Integer) enumeration4.nextElement(); System.out.println(integer); }
has comment: http://stackoverflow.com/comment/33181985

http://stackoverflow.com/a/21860127
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/21859696
answers question: http://stackoverflow.com/q/21859696
has body: If you have students and modules array lists then you can do: students.clear(); modules.clear(); Model m = Model.readModule("out.ser"); students.addAll(m.getStudentsList()); modules.addAll(m.getModulesList()); Hope this helps.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33093463

http://stackoverflow.com/q/21913970
accepted answer: http://stackoverflow.com/a/21916500
tagged with: inheritance
has body: I'm currently trying to use JaxB but i'm not being very successful with a relatively simple example. My example is the following: public class A { private String m_name; } public abstract class B_Base extends A { } public class B1 extends B_Base { private String m_value1; } public class B2 extends B_Base { private String m_value2; } All my attempts on (even marshalling) have failed. I have looked through Blaise Doughan's blog including articles such as http://blog.bdoughan.com/2010/11/jaxb-and-inheritance-using-xsitype.html but none of them seem to help on my example. It is certainly possible that i've misapplied his examples. I would seem to me that my example should be something that is easily supported in JaxB - after all, java is largely based on inheritance relationships! I would be grateful for a fast response!
has comment: http://stackoverflow.com/comment/33190010
answer count: 1
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/21916500
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has title: JAXB inheritance - non-abstract base class
tagged with: jaxb
has comment: http://stackoverflow.com/comment/33189917
type: Question

http://stackoverflow.com/q/21999252
type: UnansweredQuestion
has body: I'm trying to generate a linear gradient on my pixel raster. I do this in processing 2.0 - this is mainly Java but with some extra classes and variables. I already have a function to do a radial gradient: /* For every pixel */ distance = dist(centerX,centerY, x,y); //calculate distance between position and center of gradient lerpValue = norm(distance, 0, maxRadius) //normalize this value between 0 and the give maximum radius color = lerpColor(startColor, endColor, lerpValue ); //calculate Color /*end for*/ This was easier than I thought. Then I tried to do a gradient from one point to another, and I can't figure out how to calculate this. Of course a horizontal or vertical gradient is no problem, but within two points the line could be any angle. I already found an answer to a similar question but actually I didn't understand it. Would someone explain to me how this calculation is possible - with description in easy words? Please explain what your're doing because I want to understand it and not just copy it. And if you write code please give the variables good names. I know it's faster to write single character names but I don't always know what exactly they are. Oh and the calculation should be pixel per pixel, because rotating lines and drawing them every x steps is pretty slow I think and can lead to ugly results (wrong colors with antialiasing, stairs without). I hope I don't ask too much but as I said I really want to understand how this works, and that's pretty hard if i have to guess e.g. what the names of variables mean..
tagged with: java
tagged with: gradient
type: Question
tagged with: processing
has comment: http://stackoverflow.com/comment/33342552
tagged with: algorithm
has answer: http://stackoverflow.com/a/21999529
has comment: http://stackoverflow.com/comment/33385328
score: 0
has title: Linear Gradient between two points
answer count: 1

http://stackoverflow.com/comment/33246224
comment on: http://stackoverflow.com/q/21945556
has text: we can set the class path to jars(may need to include jdk) in the lib folder in .bat file before actually calling the App.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36629397
type: Comment
comment on: http://stackoverflow.com/a/22778198
has text: @MartyPitt actually it's Poorna
type: AnswerComment
score: 0

http://stackoverflow.com/q/21968382
type: Question
tagged with: java
score: 0
answer count: 1
tagged with: lucene
has body: I want to implement a textual search with Lucene over some documents. The documents are provided already tokenized in a table: |documentID|token|position| 'documentID' is the id of the document the token is in 'position' describes, on which position in the document the token is written My first attempt was to create an index to search for tokens and return the documentID. So I created a Lucene-document for every documentID. To each Lucene-document I added one IntField 'documentID' and several StringFields 'token' for every token in this document. Therefor, no problem. Now I started my second attempt, including position information. First thought: 'No Problem, just add StringFields 'position' to the Lucene-document!' But...Then I have no relation between the positions and the tokens. Here's an example what I want in the end: INPUT: tomato OUTPUT: docID1|position1 docID1|position2 docID2|position1 ... How can I achieve this? In my opinion, the simplest solution would be stopping converting document->Lucene-document and starting to map the single tokens to Lucene-documents. So I create a Lucene-document for every unique token/documentID combination (of course just for documentIDs containing the token). Then I add the token and the documentID as fields to the document. Also, for every hit an IntField containing 'position' from the table. Example: StringField 'token1' IntField 'documentID1' IntField 'position1' IntField 'position2' IntFIeld 'position3' StringField 'token1' IntField 'documentID2' IntField 'position1' IntField 'position2' Are there other ways to store linked fields?
has title: Lucene - Related data in different fields
type: UnansweredQuestion
tagged with: full-text-indexing
has answer: http://stackoverflow.com/a/21973237

http://stackoverflow.com/comment/33202592
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21920691
score: 0
has text: No, im looking for a java solution within the app. I dont plan to make any modifications to the server or have anything happening on its side.

http://stackoverflow.com/a/21861111
has body: You can use reflection to change the modifier to public.
has comment: http://stackoverflow.com/comment/33095156
has comment: http://stackoverflow.com/comment/33095189
answers question: http://stackoverflow.com/q/21861056
has comment: http://stackoverflow.com/comment/33095119
type: Answer
score: 0

http://stackoverflow.com/comment/33112789
type: AnswerComment
comment on: http://stackoverflow.com/a/21868274
score: 0
type: Comment
has text: havn't tried updating navDrawerItems yet, but I messed with it a bit more and now the Table gets updated with items. However, when I switch from one view to another they get reset, any advice on what I can do to fix that?

http://stackoverflow.com/comment/33309907
comment on: http://stackoverflow.com/q/21981204
score: 0
type: Comment
type: QuestionComment
has text: I restarted eclipse for several times but it is showing same message

http://stackoverflow.com/a/21885406
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21885075
answers question: http://stackoverflow.com/q/21885075
type: AcceptedAnswer
downvote count: 0
has body: I think you can't store element on the page, browse, and then come back to use them. Each time you arrive on a new page, you need to select them again (kind of a refresh). Try something like this for (int index=0; index&lt;links.size(); index++ ) { links = driver.findElements(By.tagName("a")); links.get(index).click(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.getTitle(); driver.navigate().back(); }
type: Answer
score: 1

http://stackoverflow.com/q/21951491
has title: updating a text file from a java file
score: 1
tagged with: java
has body: public void updateF()throws Exception { int i; BufferedWriter outputWriter = null; outputWriter = new BufferedWriter(new FileWriter(getClass().getResource("valS.txt").getFile())); for (i = 0; i &lt; Status.length-1; i++) { outputWriter.write(Status[i]+","); } outputWriter.write(Status[i]); outputWriter.flush(); outputWriter.close(); } I am trying to update a file "valS.txt" present where all my .java files are present .This code compiles but does not update anything . I think the path is not reachable . HELP!!
tagged with: file
has answer: http://stackoverflow.com/a/21951647
has answer: http://stackoverflow.com/a/21951567
upvote count: 1
has comment: http://stackoverflow.com/comment/33256830
type: Question
has comment: http://stackoverflow.com/comment/33256852
has comment: http://stackoverflow.com/comment/33256903
has comment: http://stackoverflow.com/comment/33256842
answer count: 3
downvote count: 0
tagged with: ide
favorite count: 0
has answer: http://stackoverflow.com/a/21951579
tagged with: file-io
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33257514

http://stackoverflow.com/a/21956603
type: Answer
has body: The reason why is that MalformedURLException inherits from IOException. try { //call some methods that throw IOException's } catch (IOException e) { // This will catch MalformedURLException since it is an IOException } catch (MalformedURLExceptionn ex) { // Will now never be caught! Ah! } If you want to design catch blocks which properly handle an exception hierarchy, you need to put the super class last and the subclasses which you want to handle individually prior to it. See the example below for how to handle the IOException class hierarchy as it pertains to your code. try { //call some methods that throw IOException's } catch (MalformedURLExceptionn ex) { // This will catch MalformedURLException } catch (IOException e) { // This will catch IOException and all other subclasses besides MalformedURLException }
has comment: http://stackoverflow.com/comment/33266024
score: 9
upvote count: 9
has comment: http://stackoverflow.com/comment/33265867
accepted answer of: http://stackoverflow.com/q/21956589
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21956589

http://stackoverflow.com/a/21860250
has comment: http://stackoverflow.com/comment/33094028
upvote count: 2
answers question: http://stackoverflow.com/q/21860153
type: Answer
has body: Look into using a Timer. For example, the scheduleAtFixedRate() method.
score: 2
downvote count: 0

http://stackoverflow.com/comment/33162561
score: 0
has text: OK, so, what does this program do, and how does it not match your expectations?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21897927

http://stackoverflow.com/a/21863055
has body: You can't do it in a clean way. You must remove the non admin entries from your list, or create a list without those entries, and call notifyDataSetChanged.
type: Answer
has comment: http://stackoverflow.com/comment/33099005
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21862771
downvote count: 0

import
type: Tag
tags question: http://stackoverflow.com/q/22002412
tags question: http://stackoverflow.com/q/22000507
tags question: http://stackoverflow.com/q/21895694
tags question: http://stackoverflow.com/q/21965180
tag name: import
tags question: http://stackoverflow.com/q/21998689
tags question: http://stackoverflow.com/q/21942059
tags question: http://stackoverflow.com/q/21902306
tags question: http://stackoverflow.com/q/21960940
tags question: http://stackoverflow.com/q/21966573
tags question: http://stackoverflow.com/q/21843149
tags question: http://stackoverflow.com/q/21972105

http://stackoverflow.com/q/21860885
has body: I'm using apache.commons.net ftpClient but I'm facing a problem that I'm not sure how to fix. So basically I log in the server, set the passive mode, and then I run: fileFTPFiles = this.ftpClient.listFiles(strPath); In all the servers I have connected to until today, this worked like a charm but today I connected to a server that instead of returning the file or the files in the give path always returns the landing directory files... Although if I run fileFTPFiles = this.ftpClient.mlistDir(strPath); it returns what I expect. Can anyone explain me why this happens and if there is a easy way to detect whether to use listFile or mlistFiles?
type: Question
score: 0
tagged with: apache-commons-net
answer count: 1
has title: FTP List Files return always root files
has answer: http://stackoverflow.com/a/24663297
tagged with: ftp
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/21961347
has body: There are some strange voodoo going on in the character class parsing code of Oracle's implementation of Pattern class, which comes with your JRE/JDK if you downloaded it from Oracle's website or if you are using OpenJDK. I have not checked how other JVM (notably GNU Classpath) implementations parse the regex in the question. From this point, any reference to Pattern class and its internal working is strictly restricted to Oracle's implementation (the reference implementation). It would take some time to read and understand how Pattern class parses the nested negation as shown in the question. However, I have written a program1 to extract information from a Pattern object (with Reflection API) to look at the result of compilation. The output below is from running my program on Java HotSpot Client VM version 1.7.0_51. 1: Currently, the program is an embarrassing mess. I will update this post with a link when I finished it and refactored it. [^0-9] Start. Start unanchored match (minLength=1) CharProperty.complement (character class negation). Match any character NOT matched by the following character class: Pattern.rangeFor (character range). Match any character within the range from code point U+0030 to code point U+0039 (both ends inclusive) LastNode Node. Accept match Nothing surprising here. [^[^0-9]] Start. Start unanchored match (minLength=1) CharProperty.complement (character class negation). Match any character NOT matched by the following character class: Pattern.rangeFor (character range). Match any character within the range from code point U+0030 to code point U+0039 (both ends inclusive) LastNode Node. Accept match [^[^[^0-9]]] Start. Start unanchored match (minLength=1) CharProperty.complement (character class negation). Match any character NOT matched by the following character class: Pattern.rangeFor (character range). Match any character within the range from code point U+0030 to code point U+0039 (both ends inclusive) LastNode Node. Accept match The …
score: 17
has comment: http://stackoverflow.com/comment/33420432
has comment: http://stackoverflow.com/comment/48589154
accepted answer of: http://stackoverflow.com/q/21934168
answers question: http://stackoverflow.com/q/21934168
has comment: http://stackoverflow.com/comment/33281732
has comment: http://stackoverflow.com/comment/48590961
type: AcceptedAnswer
upvote count: 17
has comment: http://stackoverflow.com/comment/33424547
has comment: http://stackoverflow.com/comment/33421962
type: Answer
has comment: http://stackoverflow.com/comment/33422217
downvote count: 0

http://stackoverflow.com/comment/33345449
type: QuestionComment
comment on: http://stackoverflow.com/q/22000764
has text: Seems that this man had the problem like yours . Give a look [HERE](http://stackoverflow.com/questions/18433879/awt-eventqueue-0-exception-when-openning-jframe)
score: 0
type: Comment

http://stackoverflow.com/comment/33118258
comment on: http://stackoverflow.com/q/21873746
score: 0
type: Comment
type: QuestionComment
has text: This is desktop application (run in unix system), nothing with web.

http://stackoverflow.com/a/22005059
type: Answer
answers question: http://stackoverflow.com/q/22002810
downvote count: 0
has body: I was in a fix as well and here is a question which I asked in Oracle Forums, to which, James gave me a vivid reply. Please go through this, it has your answer https://community.oracle.com/thread/2598756
has comment: http://stackoverflow.com/comment/33373650
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22002810

http://stackoverflow.com/q/21962687
score: 0
has answer: http://stackoverflow.com/a/21962710
accepted answer: http://stackoverflow.com/a/21962710
has body: I know vectors in Java are obsolete, I keep getting that warning, but we are supposed to used vectors, so I am. This is what I am trying to make work: The constructor, takes dimension n and sets all elements to 0: NVector(int n) But I am getting an error saying "Array required, but Vector found." Can anyone help me figure this out? public class NVector { Vector&lt;Double&gt; v; NVector(int n) { v = new Vector(n); for(int i = 0; i&lt;=n; i++) { v[i] = 0; //Error in this line } } }
tagged with: constructor
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21962722
tagged with: java
has answer: http://stackoverflow.com/a/21962722
type: Question
has title: Error: Array required, but Vector<Double> found?
answer count: 2
tagged with: vector
tagged with: arrays

http://stackoverflow.com/comment/33121226
score: 0
comment on: http://stackoverflow.com/q/21874326
has text: @SaifAsif The first servlet for file upload, and second servlet i have to take input values to make calculations from the uploaded file.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/86218393
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21974362
type: AnswerComment
has text: `Map<K,V>` isn't the part of `java.util.collection`

http://stackoverflow.com/q/21931762
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/21933027
favorite count: 0
tagged with: android
tagged with: android-notifications
has body: I am testing to make a small application, based on the Remote Messenger Service Sample I have an activity with a button in order to start/stop a service. After starting the service, I bind the service and the activity, as described in the sample, and everything is working as expected. The service have a notification, just as the sample: the notification is displayed in the MessengerService.onCreate() and canceled in the MessengerService.onDestroy(). Now, I want to start the service automatically when the activity shows up. My activity onStart() is as follow (I removed the error checking code to make code more readable): @Override public void onStart() { super.onStart(); Log.d( TAG, "start service at activity startup" ); // Start the service automatically Intent intent = new Intent(this, MessengerService.class); startService(intent); // Bind to the service doBindService(); } With doBingService() taken from the sample: void doBindService() { Log.d( TAG, "doBindService call" ); // Establish a connection with the service. We use an explicit // class name because there is no reason to be able to let other // applications replace our component. bindService(new Intent(this, MessengerService.class), mConnection, Context.BIND_AUTO_CREATE); mIsBound = true; } Now, when I start the application from Android Studio to test it, the activity shows up, I can see the notification briefly, and then, the notification disapears after about a second. The service is still alive, because I can send messages to force the notification to go back. After some investigations, I saw in the event logs: 02-20 22:35:03.342 383 396 I notification_cancel_all: [com.example.messengerservice,-1,0,0] 02-20 22:35:03.545 383 396 I notification_cancel_all: [com.example.messengerservice,-1,0,0] And the corresponding system logs: 02-20 22:35:01.154 22884 22884 D example.Activity: start service at activity startup 02-20 22:35:01.170 22884 22884 D example.Activity: doBindService call 02-20 22:35:01.170 383 381…
score: 2
upvote count: 2
tagged with: java
has title: Android notification displayed at service startup is canceled just after creation
has answer: http://stackoverflow.com/a/21933027
type: Question
type: AnsweredQuestion
tagged with: android-service

http://stackoverflow.com/comment/33116327
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21872809
has text: I have done that.. but should I include **all** the jars in that folder in my reference libraries?
score: 0

http://stackoverflow.com/a/21963593
downvote count: 1
has body: Multiply value input by 100, modulo by split, and check for zero remainder: (54.20 * 100) % 2 = 0 (61.05 * 100) % 2 = 1
has comment: http://stackoverflow.com/comment/33279056
has comment: http://stackoverflow.com/comment/33278861
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33278913
has comment: http://stackoverflow.com/comment/33278943
accepted answer of: http://stackoverflow.com/q/21963500
has comment: http://stackoverflow.com/comment/33278944
has comment: http://stackoverflow.com/comment/33279082
has comment: http://stackoverflow.com/comment/33279527
has comment: http://stackoverflow.com/comment/33278928
answers question: http://stackoverflow.com/q/21963500
has comment: http://stackoverflow.com/comment/33279370
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/33278789
upvote count: 3

http://stackoverflow.com/q/21951966
tagged with: java
has body: I'm doing an AsyncTask web request in Android. The web request code works and returns variables because I can output them to log no worries and see everything I need to see. I must be misunderstanding AsyncTask, I thought that in the onPostExecute method we have access to the GUI, but I keep getting null pointers when I try to run findViewById. TextView textView; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView = (TextView) findViewById(R.id.outputView); } protected void onPostExecute(String result) { Log.w("CleverMining", "Posting results..." + result); textView.setText(result); } Layout XML here - activity_main.xml <?xml version="1.0" encoding="utf-8"?> So the log can see the correct output ezpz, but when I'm looking up the Text-view I get null pointers, implying probably out of scope or something. Pls to assist? How can I access a Text-view in the main activity from an onPostExecute method from an AsyncTask? UPDATE: LOGCAT OUTPUT AT http://pastebin.com/ST7r9eAW UPDATE 2: Creating a class level Text-view then instantiating it in onCreate() gives me the same null pointer error.
has comment: http://stackoverflow.com/comment/33258454
type: Question
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/33258032
accepted answer: http://stackoverflow.com/a/21952022
has answer: http://stackoverflow.com/a/21952093
has comment: http://stackoverflow.com/comment/33258043
has comment: http://stackoverflow.com/comment/33258558
has title: Android AsyncTask onPostExecute accessing GUI element gives Null Pointer
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/33258507
tagged with: android
has answer: http://stackoverflow.com/a/21952022
possible better answer: http://stackoverflow.com/a/21952131
has comment: http://stackoverflow.com/comment/33258588
has comment: http://stackoverflow.com/comment/33257767
has answer: http://stackoverflow.com/a/21952131
answer count: 4
has comment: http://stackoverflow.com/comment/33257653
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/33257616
has comment: http://stackoverflow.com/comment/33257726
has comment: http://stackoverflow.com/comment/33257649
has comment: http://stackoverflow.com/comment/33257652
has answer: http://stackoverflow.com/a/21952019
type: AnsweredQuestion

http://stackoverflow.com/q/21852754
downvote count: 3
has comment: http://stackoverflow.com/comment/33080748
possible better answer: http://stackoverflow.com/a/21852792
type: Question
answer count: 6
has answer: http://stackoverflow.com/a/21852990
has answer: http://stackoverflow.com/a/21852874
has answer: http://stackoverflow.com/a/21852792
has comment: http://stackoverflow.com/comment/33079861
favorite count: 0
has comment: http://stackoverflow.com/comment/33080436
has comment: http://stackoverflow.com/comment/33079768
score: 55
has answer: http://stackoverflow.com/a/21852803
has answer: http://stackoverflow.com/a/73415587
tagged with: android
accepted answer: http://stackoverflow.com/a/21852803
tagged with: datetime
upvote count: 58
has comment: http://stackoverflow.com/comment/33080170
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33079779
has title: Convert Minutes to milliseconds Java/android
has answer: http://stackoverflow.com/a/61901744
has body: I am trying to convert given number of minutes into milliseconds. For eg: 15mins or 20mins or 44mins should be converted to milliseconds programmatically. I tried the below: Calendar alarmCalendar = Calendar.getInstance(); alarmCalendar.set(Calendar.MINUTE,15); long alarmTime = alarmCalendar.getTimeInMillis(); Log.e("Milli", "seconds"+alarmTime); This doesn't give the right value? What is the best way to convert this?
tagged with: java

http://stackoverflow.com/a/21872989
downvote count: 1
answers question: http://stackoverflow.com/q/21872895
upvote count: 0
has body: Sometimes you will get exceptions which are not because of your code/method... Assume if a parent method (caller) passes an invalid argument and you try to use it, you will get an exception... Now, since its the parent who is responsible for the error, only it should handle it.. Not your method... If the exception is due to your code only, then you can have a try-catch block...
type: Answer
has comment: http://stackoverflow.com/comment/33120989
score: -1

http://stackoverflow.com/comment/33257147
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21951669
has text: I fail to see how you could have both indentation, and no white space. Could you provide example input and output?

http://stackoverflow.com/q/21953022
has comment: http://stackoverflow.com/comment/33259845
has comment: http://stackoverflow.com/comment/33260146
has body: How could I trigger a command in ubuntu/linux, whenever a new file is created in a directory by a Java webapp ? Usage/Context: I need to move a newly created file (created by java app), in a directory to amazon s3 using s3cmd command.
tagged with: ubuntu
score: 0
tagged with: linux
tagged with: s3cmd
linked to: http://stackoverflow.com/q/4060212
answer count: 0
type: UnansweredQuestion
has title: Trigger a command in ubuntu/linux whenever a new file is created in a directory
tagged with: java
has comment: http://stackoverflow.com/comment/33259550
type: Question

http://stackoverflow.com/comment/91861769
comment on: http://stackoverflow.com/a/40754792
score: 0
type: AnswerComment
has text: I would make a cli tool similar to `nvm` for switching Java versions, but the acronym `jvm` already means something else :)
type: Comment

http://stackoverflow.com/comment/33210601
score: 0
type: QuestionComment
has text: @AnupNadahalli Then it's best done from JacaScript rather than sending a redirect.
type: Comment
comment on: http://stackoverflow.com/q/21925210

http://stackoverflow.com/comment/40036291
type: AnswerComment
comment on: http://stackoverflow.com/a/21900872
type: Comment
has text: Is there a way to enable/disable the double-alt functionality?
score: 0

http://stackoverflow.com/a/21951356
has comment: http://stackoverflow.com/comment/33258366
accepted answer of: http://stackoverflow.com/q/21950952
has comment: http://stackoverflow.com/comment/33258126
answers question: http://stackoverflow.com/q/21950952
has comment: http://stackoverflow.com/comment/33259468
has comment: http://stackoverflow.com/comment/33258312
score: 1
has body: I haven't executed your code, but if I understand correctly, it works fine except you don't have any column for I3, because no ticket in the XML file has I3 as its imp. So you simply need to do as if there was I3 in the file: private static List&lt;String&gt; getimps(Map&lt;ticket, Integer&gt; count) { List&lt;String&gt; imps = new ArrayList&lt;String&gt;(); for(Map.Entry&lt;ticket, Integer&gt; ent : count.entrySet()) if (!imps.contains(ent.getKey().getimp())) { imps.add(ent.getKey().getimp()); } } // make sure I3 is listed as imp as well: if (!imps.contains("I3")) { imps.add("I3"); } return imps; } And in the getNumOfTeams() method, you shouldn't assume that at least one ticket has the current imp. So I would rewrite it as: private static String getNumOfteams(String team, List&lt;String&gt; imps, Map&lt;ticket, Integer&gt; count) { StringBuilder builder = new StringBuilder(); for (String v : imps){ Integer cnt = count.get(new ticket(team, v)); if (cnt == null) { cnt = 0; } builder.append(cnt + "\t"); } return builder.toString(); } Side note: you should really learn and apply naming conventions. Don't abuse abbreviations. Name your getters and setters getTeam() and setTeam() rather than getteam() and setteam(), classes start with an uppercase letter.
has comment: http://stackoverflow.com/comment/33259527
has comment: http://stackoverflow.com/comment/33258689
has comment: http://stackoverflow.com/comment/33258439
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33258134
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/33259688
has comment: http://stackoverflow.com/comment/33259494
has comment: http://stackoverflow.com/comment/33257797
has comment: http://stackoverflow.com/comment/33257609
has comment: http://stackoverflow.com/comment/33259296

http://stackoverflow.com/a/21969836
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33292271
type: Answer
accepted answer of: http://stackoverflow.com/q/21969625
score: 3
has body: Sometimes, the use of instanceof indicates a flaw in your design, probably by violating some basic principals of Object Oriented Programing. In you case, I can oversee two solutions depending on what your final goal is. The first one is to encapsulate the specific behavior of test() in the classes A, B and C. It can be done by declaring a method test() in the interface Base, making it an abstract class and implementing it in the subclasses. static private abstract class Base { public void test() { System.out.println("Base"); } } static private class A extends Base { private void test() { System.out.println("A"); } } static private class B implements Base { private void test() { System.out.println("B"); } } static private class C extends B { private void test() { System.out.println("C"); } } Notice that classes with an hierarchy level greater than 3 are not a good practice. Inheritance is the highest degree of coupling you can get between two objects. That is why we tend to prefer composition over inheritance. The second way to improve your design is, as @SLaks mentioned, to use the Visitor Pattern. More about this pattern can be found here. Recommended reading on the subject are GOF and Refactoring to Patterns.
upvote count: 3
answers question: http://stackoverflow.com/q/21969625
has comment: http://stackoverflow.com/comment/33292330

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/21960630
type: Tag
tags question: http://stackoverflow.com/q/21907513
tags question: http://stackoverflow.com/q/21876156
tags question: http://stackoverflow.com/q/21942613

http://stackoverflow.com/q/21867193
type: AnsweredQuestion
tagged with: java
type: Question
has body: So I need to use recursive programming to figure out how many times a certain letter appears in a word. For example, the word "complete" would have 2 e's. I kind of know what I need to do but I am just not sure how to do it. I currently have a scanner set up to take the word from the user, but that is all I have coded at the moment. I feel like the pseudocode should be something like; Take word from user if (letter &lt;= 0) return 1; else return length of characters in word I am guessing that I use the length or charAt method somehow? I really need some guidance here, like how does the recursion come in? Is that because it breaks down the word until it finds the amount of "e's" remaining? Would the base case be 0?I really appreciate the help! I am really new to this. Thank you very much.
tagged with: recursion
accepted answer: http://stackoverflow.com/a/21867439
score: 0
has answer: http://stackoverflow.com/a/21867289
has title: In Java how can I figure out how many of a certain letter appears in a string with recursion?
has answer: http://stackoverflow.com/a/21867354
has comment: http://stackoverflow.com/comment/33106849
possible better answer: http://stackoverflow.com/a/21867304
has answer: http://stackoverflow.com/a/21867304
has comment: http://stackoverflow.com/comment/33106867
answer count: 5
has answer: http://stackoverflow.com/a/21867439
has answer: http://stackoverflow.com/a/21867384

http://stackoverflow.com/q/21940631
tagged with: eclipse-plugin
favorite count: 0
has body: What is SwingUtilities.invokeLater() equivalent in Eclipse API 3.x? I.e. how to run something on "main thread"? Can I use @Inject UISynchronize sync; for this in Eclipse Plug-In 3.x? It is written, that UISynchronize is valid "since 1.0". What does it mean? Why is it in e4 package then?
has title: SwingUtilities invokeLater equivalent in SWT / Eclipse 3.x API?
tagged with: long-running-processes
has answer: http://stackoverflow.com/a/21940819
tagged with: swt
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21940819
tagged with: java
tagged with: eclipse
type: Question
upvote count: 4
downvote count: 0
answer count: 1
score: 4
has comment: http://stackoverflow.com/comment/33237398

http://stackoverflow.com/comment/33165391
type: Comment
comment on: http://stackoverflow.com/a/21873080
has text: @user3314492 Asking about handling "Next" button is an *entirely* new question which you should first research and, if necessary, post a new question. One hint: What you present in the user interface (view) and what you maintain as data behind the scenes (model) are two completely **separate things**. Search on "MVC" (Model-View-Controller) and do so reading; don't take any of it too seriously but it will give you ideas.
type: AnswerComment
score: 0

http://stackoverflow.com/q/21870266
upvote count: 2
type: UnansweredQuestion
has body: I'm sorry to ask yet another question on mutual left recursion, I feel like mine is unique to my situation, or at least I can't figure out enough to relate it to everyone else's grammars. I'm a bit new to the comp sci world (I'm self taught in java, which is my target language, and now ANTLR4) so if possible please describe things in layperson terms, not CS major terms. I'm writing a program that requires algebra and symbolic derivatives, and of course that requires that things be parsed, and trees be operated upon but I'm not even going to worry about that yet because I thought ANTLR4 supported direct left recursion, but apparently it doesn't somehow. On the output, it keeps telling me that my method [expression] is mutually left recursive and apparently that's not allowed...? MY QUESTIONS: 1) Can someone explain left recursion/the difference between mutual and direct left recursion if there is one? 2) Explain what in my grammar is causing this recursive annoyance, and how to fix it? And I'm not sure if this is on topic: 3) People say things about alternatives and labeling alternatives (I think they mean the #label notation). What is that for? grammar MathProcessor; @header {package utils;} END: ';'; EQUALS: '='; SIN: 'sin('; COS: 'cos('; TAN: 'tan('; SEC: 'sec('; CSC: 'csc('; COT: 'cot('; LN: 'ln('; EPOW: 'pow('; RPAREN: '('; LPAREN: ')'; EXP: '^'; MULT: '*'; DIV: '/'; ADD: '+'; SUBT: '-'; VAR: ('a'..'z'|'A'..'Z'); INT: ('0'..'9')+; mathobj: ((equation|expression) END) EOF; equation: (expression '=' expression); expression: ((RPAREN|SIN|COS|TAN|SEC|CSC|COT|LN|EPOW) expression (RPAREN)) #parenOps | (expression EXP expression) #exponent | (expression (MULT|DIV) expression) #multiplyDivide | (expression (ADD|SUBT) expression) #addSubtract | (VAR|INT) #varInt ;
tagged with: left-recursion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/21880036
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has title: Mutual Left Recursion ANTLR 4
tagged with: antlr4

http://stackoverflow.com/a/21855501
downvote count: 0
score: 2
upvote count: 2
has body: Just create a new reference with the name you want and assign it from the old reference: ArrayList original = ...; ArrayList newList = original; I should point out that since ArrayList is a reference type, original and newList are both pointing to the same data in memory. If you add an item to original or to newList, it is going to affect both. It is not creating a second copy of the ArrayList. It is a little difficult to understand what you are asking for, though. If you are talking about refactoring your code to rename the variable across the entire application, then it sort of depends on what IDE you are using, but any good IDE will have this capability.
has comment: http://stackoverflow.com/comment/33085267
answers question: http://stackoverflow.com/q/21855436
type: Answer

http://stackoverflow.com/q/21868378
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/33108893
tagged with: parsing
tagged with: integer
has answer: http://stackoverflow.com/a/21868489
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21868394
has body: okay so I have this first class that breaks down a string, strips the spaces and everything, puts it into an Arraylist and feeds it to this parseRec class. For some reason when the first character is "+" it does not register for this first if statement. It surpasses it ang goes to the else statement which is supposed to only take integers. any ideas why? public static Expression parseRec(ArrayList&lt;String&gt; list) { while (list.size() != 0) { if (list.get(i) == "+") { System.out.println("got this far"); ..................... else { System.out.println(list.get(i)); String intE = list.get(i); Expression intExp = new IntExpression(intE); list.remove(i); return intExp; } }
has comment: http://stackoverflow.com/comment/33108922
type: Question
tagged with: tree
tagged with: java
has answer: http://stackoverflow.com/a/21868426
has title: Java string identification
answer count: 3

http://stackoverflow.com/q/21847947
accepted answer: http://stackoverflow.com/a/21852869
possible better answer: http://stackoverflow.com/a/21848362
tagged with: asynchronous
has comment: http://stackoverflow.com/comment/33071846
has comment: http://stackoverflow.com/comment/33071668
has answer: http://stackoverflow.com/a/21852869
tagged with: android
has comment: http://stackoverflow.com/comment/33079687
has comment: http://stackoverflow.com/comment/33071568
has comment: http://stackoverflow.com/comment/33077522
has comment: http://stackoverflow.com/comment/33071785
type: AnsweredQuestion
has body: I am working in Android Technology.In my application i am fetching the data from web service i used A sync Task for consuming web service.It show the data correctly on Toast i.e true or false but My Progress Bar is continuously moving it does not stopped when Background task completed its execution i called dismiss method in onPostExecute().But it failed to dismiss the progress bar.Again it start calling web service but progress bar is not dismmed. Can you tell me what i did wrong in my code.Please solve my problem.. I am attaching source code here Async task public class MyTask extends AsyncTask&lt;String,Void,String&gt; { @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); pd.dismiss(); Toast.makeText(getApplicationContext(), ""+result,Toast.LENGTH_LONG).show(); } @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); pd=new ProgressDialog(MainActivity.this); pd.setMessage("Please Wait"); pd.setCancelable(false); pd.setIndeterminate(false); pd.show(); } @Override protected String doInBackground(String... arg0) { // TODO Auto-generated method stub v=new Validate(); String result; result=v.SendParam(url,user,pass); return result; } } Here id Validate.java code class Validate { ArrayList&lt;NameValuePair&gt; namevaluepair; InputStream is; String res; public String SendParam(String url,String username,String password) { try { HttpClient client=new DefaultHttpClient(); HttpPost post=new HttpPost(url); // add parameter here namevaluepair=new ArrayList&lt;NameValuePair&gt;(); namevaluepair.add(new BasicNameValuePair("id",username)); namevaluepair.add(new BasicNameValuePair("password",password)); post.setEntity(new UrlEncodedFormEntity(namevaluepair)); HttpResponse response=client.execute(post); HttpEntity entity=response.getEntity(); is=entity.getContent(); } catch(Exception e) { Log.d("Httpconnection","error",e); } // read response from try { BufferedReader re…
tagged with: java
has answer: http://stackoverflow.com/a/21848362
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33072287
has comment: http://stackoverflow.com/comment/33071697
has comment: http://stackoverflow.com/comment/33077453
has title: ProgressBar is not stopped after Completing Background Execution in Android
score: 0

http://stackoverflow.com/q/21865095
score: 3
linked to: http://stackoverflow.com/q/4517653
answer count: 2
tagged with: iterator
tagged with: for-loop
has answer: http://stackoverflow.com/a/21865177
has title: is for-each iteration thread safe?
downvote count: 0
has body: I have one situation in multithreaded environment where there is no logical problem, but I am concerned if the iterator of java Set could break in some corner case. I don't know if this would crash after a while or not: class Bar{ AtomicLong a = 0; AtomicLong b = 0; public void addA(int value){ a.addAndGet(value); } public void addB(int value){ b.addAndGet(value); } } class Foo{ Set&lt;Bar&gt; bars = new CopyOnWriteArraySet(); public void addBarData(Bar bar){ if (!bars.add(bar)){ for (Bar b: bars){ if (bar.equals(b)){ b.addA(bar.a); b.addB(bar.b); } } } } } The problem might be if two threads are calling addBarData(barInstance) at the near time, one is entering inside ifs body, and start to iterate for-each, but the other adds another element into the set at that moment. Would for-loop (or iterator) crash because of the change of elements number or not?
favorite count: 0
has answer: http://stackoverflow.com/a/21865825
accepted answer: http://stackoverflow.com/a/21865825
type: AnsweredQuestion
upvote count: 3
possible better answer: http://stackoverflow.com/a/21865177
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/33102832
type: Question

data-structures
tags question: http://stackoverflow.com/q/21851511
tags question: http://stackoverflow.com/q/22002752
tags question: http://stackoverflow.com/q/21977718
tag name: data-structures
tags question: http://stackoverflow.com/q/21913837
tags question: http://stackoverflow.com/q/21884858
tags question: http://stackoverflow.com/q/21855818
tags question: http://stackoverflow.com/q/21974028
tags question: http://stackoverflow.com/q/21897605
tags question: http://stackoverflow.com/q/21959458
tags question: http://stackoverflow.com/q/21923457
tags question: http://stackoverflow.com/q/21886787
tags question: http://stackoverflow.com/q/21977495
tags question: http://stackoverflow.com/q/22001760
type: Tag
tags question: http://stackoverflow.com/q/21946406

http://stackoverflow.com/comment/33182065
type: AnswerComment
has text: Ok, good point. Noted.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21909780

http://stackoverflow.com/comment/33325952
score: 0
comment on: http://stackoverflow.com/a/21989611
type: Comment
has text: Thank you too NPE for your answer. That's what I also read 1 day ago on the Android Developers site, that you should avoid instantiating Dialog directly. But there are no explanations why and what could happen if yes. Only the advantages (except more code :)). Maybe you have an answer or link to the disadvantages? I'm just curious.
type: AnswerComment

windows
tags question: http://stackoverflow.com/q/21967950
tags question: http://stackoverflow.com/q/21959681
tags question: http://stackoverflow.com/q/21967250
tags question: http://stackoverflow.com/q/21879831
tags question: http://stackoverflow.com/q/21879435
tags question: http://stackoverflow.com/q/21923837
type: Tag
tags question: http://stackoverflow.com/q/21900995
tags question: http://stackoverflow.com/q/21889761
tags question: http://stackoverflow.com/q/21913578
tag name: windows
tags question: http://stackoverflow.com/q/21902124

http://stackoverflow.com/comment/33348742
type: Comment
comment on: http://stackoverflow.com/a/22002759
has text: Avoid ad hominem attacks first. Second, I would recommend not exposing as public anything other than constants in a class. You may want to change the internal working sometime, better to hide that behind method calls.
type: AnswerComment
score: 0

http://stackoverflow.com/q/21868389
has title: Android: How do I add two buttons into the action bar
has answer: http://stackoverflow.com/a/21868409
tagged with: android-actionbar
upvote count: 1
tagged with: about-box
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33109404
score: 1
tagged with: java
has body: I would like to add two buttons into the action bar, but in my case just one button appears. What is wrong with my code? <item android:id="@+id/action_settings" android:title="@string/action_settings" android:icon="@drawable/ic_action_settings" myApp:showAsAction="ifRoom"/> <item android:id="@+id/action_about" android:title="@string/action_about" android:icon="@drawable/ic_action_about" myApp:showAsAction="ifRoom"/>
type: Question
accepted answer: http://stackoverflow.com/a/21868409
downvote count: 0
answer count: 1
tagged with: button
tagged with: android
favorite count: 0

http://stackoverflow.com/a/21993010
accepted answer of: http://stackoverflow.com/q/21992302
type: AcceptedAnswer
score: 0
has body: You have several ways, but you are just looking to get the child element of a given parent. driver.findElement(By.id("name_id")).findElement(By.cssSelector("p &gt; kbd &gt; code")).getText(); or even: driver.findElement(By.cssSelector("#name_id &gt; p &gt; kbd &gt; code")).getText(); The above may work (untested, may not even compile)
type: Answer
has comment: http://stackoverflow.com/comment/33331315
answers question: http://stackoverflow.com/q/21992302

http://stackoverflow.com/comment/33083911
has text: Could you show us your directory structure?
score: 0
comment on: http://stackoverflow.com/q/21854827
type: Comment
type: QuestionComment